diff --git a/frontend/dist/VERSION b/frontend/dist/VERSION
index d69a1f68..dda9943d 100644
--- a/frontend/dist/VERSION
+++ b/frontend/dist/VERSION
@@ -1 +1 @@
-0.9.143
+0.9.144
diff --git a/frontend/dist/assets/CollisionExplorerModal-DEtEH0fD.js b/frontend/dist/assets/CollisionExplorerModal-dc7PClY6.js
similarity index 98%
rename from frontend/dist/assets/CollisionExplorerModal-DEtEH0fD.js
rename to frontend/dist/assets/CollisionExplorerModal-dc7PClY6.js
index 746d91b4..294bd1ee 100644
--- a/frontend/dist/assets/CollisionExplorerModal-DEtEH0fD.js
+++ b/frontend/dist/assets/CollisionExplorerModal-dc7PClY6.js
@@ -1 +1 @@
-import{r as e,b as t,j as o,a7 as s,X as n,a5 as r,ao as a,ap as l,aq as i,ar as c,aa as d,$ as u}from"./vendor-react-O8XH9yVn.js";import{L as m}from"./leaflet-D_ckmI2R.js";import{c as h}from"./recharts-BU7auunF.js";import{d as x,w as p,f}from"./index-Dp0UlTio.js";const b={DEFAULT:"#4338CA",AMBER:"#F59E0B",NEIGHBOR:"#39D98A",MUTED:"#6B7280",HIGHLIGHT:"#FBBF24"};function y(){if("undefined"==typeof document)return b;const e=document.documentElement,t=getComputedStyle(e);return{DEFAULT:t.getPropertyValue("--map-hub-color").trim()||b.DEFAULT,AMBER:t.getPropertyValue("--pkt-txt-msg").trim()||b.AMBER,NEIGHBOR:t.getPropertyValue("--accent-success").trim()||b.NEIGHBOR,MUTED:t.getPropertyValue("--text-muted").trim()||b.MUTED,HIGHLIGHT:t.getPropertyValue("--accent-secondary").trim()||b.HIGHLIGHT}}function v({hash:t,highlighted:s}){const[n,r]=e.useState(!1),a=e.useCallback(e=>{e.preventDefault(),e.stopPropagation(),function(e){if("undefined"!=typeof window&&(window.isSecureContext||"https:"===window.location.protocol||"localhost"===window.location.hostname)&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText)return navigator.clipboard.writeText(e).catch(()=>{}),!0;try{const t=window.scrollX,o=window.scrollY,s=document.createElement("textarea");s.value=e,s.style.cssText="position:fixed;left:-9999px;top:-9999px;opacity:0;pointer-events:none",s.setAttribute("readonly",""),document.body.appendChild(s),s.focus({preventScroll:!0}),s.select(),s.setSelectionRange(0,e.length);const n=document.execCommand("copy");return document.body.removeChild(s),window.scrollTo(t,o),n}catch{return!1}}(t),r(!0),setTimeout(()=>r(!1),2e3)},[t]),l=t.length>12?`${t.slice(0,12)}…`:t;return o.jsxs("button",{type:"button",onClick:a,className:h("inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] font-mono rounded transition-all","border border-border-subtle hover:border-border-strong cursor-pointer select-none",s?"bg-accent-secondary/20 border-accent-secondary/50":"bg-bg-subtle/80 hover:bg-bg-elevated"),title:`Click to copy: ${t}`,children:[o.jsx("span",{className:h("transition-colors",n?"text-accent-success":"text-text-secondary"),children:l}),n?o.jsx(d,{className:"w-2.5 h-2.5 text-accent-success"}):o.jsx(u,{className:"w-2.5 h-2.5 opacity-40"})]})}function g({node:e,className:t}){const s=y(),n=e.contactType.toLowerCase(),r="room server"===n||"room_server"===n||"room"===n||"server"===n,d="companion"===n||"client"===n||"cli"===n;return r&&e.isRepeater?o.jsxs("div",{className:h("relative",t),children:[o.jsx(a,{className:"w-full h-full",style:{color:s.AMBER}}),o.jsx(l,{className:"w-1/2 h-1/2 absolute -bottom-0.5 -right-0.5",style:{color:s.DEFAULT}})]}):r?o.jsx(a,{className:t,style:{color:s.AMBER}}):d?o.jsx(i,{className:h(t,"text-text-muted")}):e.isRepeater?e.isNeighbor?o.jsx(c,{className:t,style:{color:s.NEIGHBOR}}):o.jsx(l,{className:t,style:{color:s.DEFAULT}}):o.jsx(i,{className:h(t,"text-text-muted")})}function w({node:e,isHovered:t,onMouseEnter:s,onMouseLeave:n,onTouchStart:r}){return o.jsxs("div",{className:h("flex items-center gap-3 px-3 py-2.5 transition-colors rounded-lg",t?"bg-accent-secondary/10":"hover:bg-white/[0.03]"),onMouseEnter:s,onMouseLeave:n,onTouchStart:r,children:[o.jsx("div",{className:"flex-shrink-0 w-5 h-5",children:o.jsx(g,{node:e,className:"w-5 h-5"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[o.jsx("span",{className:"text-sm font-medium text-text-primary truncate",children:e.name}),e.isNeighbor&&o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium bg-accent-success/20 text-accent-success",children:"NBR"}),e.isRepeater&&o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-white/10 text-text-muted font-medium",children:"RPT"})]}),o.jsx("div",{className:"mt-1",children:o.jsx(v,{hash:e.hash,highlighted:t})})]})]})}function N({nodes:t,hoveredHash:s,onNodeHover:n,onNodeLeave:a}){const l=e.useRef(null),i=e.useRef(null),c=e.useRef(new Map),d=e.useMemo(()=>t.filter(e=>e.latitude&&e.longitude&&0!==e.latitude&&0!==e.longitude),[t]);return e.useEffect(()=>{if(!i.current||l.current)return;const e=m.map(i.current,{zoomControl:!0,attributionControl:!0});return m.tileLayer("https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",{attribution:'© OSM © CARTO'}).addTo(e),l.current=e,()=>{e.remove(),l.current=null}},[]),e.useEffect(()=>{const e=l.current;if(!e)return;if(c.current.forEach(e=>e.remove()),c.current.clear(),0===d.length)return;const t=m.latLngBounds([]);for(const o of d){if(!o.latitude||!o.longitude)continue;const s=m.latLng(o.latitude,o.longitude);t.extend(s);const r=y(),l=o.isNeighbor?r.NEIGHBOR:r.DEFAULT,i=m.circleMarker(s,{radius:8,fillColor:l,fillOpacity:.8,color:"#fff",weight:2,opacity:.9});i.bindTooltip(o.name,{permanent:!1,direction:"top",offset:[0,-8],className:"collision-tooltip"}),i.on("mouseover",()=>n(o.hash)),i.on("mouseout",()=>a()),i.addTo(e),c.current.set(o.hash,i)}t.isValid()&&e.fitBounds(t,{padding:[40,40],maxZoom:12})},[d,n,a]),e.useEffect(()=>{c.current.forEach((e,t)=>{const o=d.find(e=>e.hash===t);if(!o)return;const n=y(),r=t===s,a=o.isNeighbor?n.NEIGHBOR:n.DEFAULT;e.setStyle({radius:r?12:8,fillColor:r?n.HIGHLIGHT:a,weight:r?3:2}),r?(e.openTooltip(),e.bringToFront()):e.closeTooltip()})},[s,d]),0===d.length?o.jsx("div",{className:"h-full flex items-center justify-center bg-bg-subtle/30 rounded-lg",children:o.jsxs("div",{className:"text-center text-text-muted p-4",children:[o.jsx(r,{className:"w-8 h-8 mx-auto mb-2 opacity-40"}),o.jsx("p",{className:"text-sm",children:"No location data available"}),o.jsx("p",{className:"text-xs opacity-70",children:"Nodes need GPS coordinates to appear on the map"})]})}):o.jsx("div",{ref:i,className:"h-full w-full rounded-lg overflow-hidden"})}const j=e.memo(function({isOpen:r,prefix:a,candidateHashes:l,onClose:i}){const c=x(),d=p(),u=f(),[m,b]=e.useState(null),y=e.useMemo(()=>new Set(u.map(e=>e.hash)),[u]),v=null==c?void 0:c.neighbors,g=e.useMemo(()=>v?l.map(e=>{var t,o;const s=v[e];return{hash:e,name:(null==s?void 0:s.node_name)||(null==s?void 0:s.name)||`Unknown (${e.slice(0,8)}…)`,contactType:(null==s?void 0:s.contact_type)||"",isRepeater:(null==s?void 0:s.is_repeater)||"repeater"===(null==(t=null==s?void 0:s.contact_type)?void 0:t.toLowerCase())||"rep"===(null==(o=null==s?void 0:s.contact_type)?void 0:o.toLowerCase())||!1,isNeighbor:y.has(e),isHub:d.has(e),latitude:null==s?void 0:s.latitude,longitude:null==s?void 0:s.longitude,lastSeen:null==s?void 0:s.last_seen}}).sort((e,t)=>e.isNeighbor!==t.isNeighbor?e.isNeighbor?-1:1:e.name.localeCompare(t.name)):[],[l,v,y,d]),j=e.useCallback(e=>b(e),[]),E=e.useCallback(()=>b(null),[]);return e.useEffect(()=>{if(!r)return;const e=e=>{"Escape"===e.key&&i()};window.addEventListener("keydown",e);const t=window.scrollY,o={overflow:document.body.style.overflow,position:document.body.style.position,width:document.body.style.width,top:document.body.style.top};return document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%",document.body.style.top=`-${t}px`,()=>{window.removeEventListener("keydown",e),document.body.style.overflow=o.overflow,document.body.style.position=o.position,document.body.style.width=o.width,document.body.style.top=o.top,window.scrollTo(0,t)}},[r,i]),r?t.createPortal(o.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-[10010] flex items-end sm:items-center justify-center",onClick:i,role:"dialog","aria-modal":"true","aria-labelledby":"collision-modal-title",children:o.jsxs("div",{className:h("glass-card-elevated w-full flex flex-col","max-h-[85vh] rounded-t-2xl rounded-b-none","sm:max-w-2xl sm:mx-4 sm:rounded-xl sm:max-h-[80vh]","pb-safe"),onClick:e=>e.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border-subtle flex-shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"p-2 rounded-lg bg-signal-fair/10",children:o.jsx(s,{className:"w-5 h-5 text-signal-fair"})}),o.jsxs("div",{children:[o.jsxs("h3",{id:"collision-modal-title",className:"text-base font-semibold text-text-primary",children:["Prefix Collision: ",o.jsx("span",{className:"font-mono text-accent-primary",children:a})]}),o.jsxs("p",{className:"text-xs text-text-muted",children:[g.length," nodes share this prefix"]})]})]}),o.jsx("button",{onClick:i,className:"p-2 rounded-lg text-text-muted hover:text-text-primary hover:bg-bg-subtle transition-colors",children:o.jsx(n,{className:"w-5 h-5"})})]}),o.jsxs("div",{className:"flex-1 min-h-0 flex flex-col sm:flex-row overflow-hidden",children:[o.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto sm:max-w-[280px] sm:border-r sm:border-border-subtle",children:o.jsx("div",{className:"p-2",children:g.map(e=>o.jsx(w,{node:e,isHovered:m===e.hash,onMouseEnter:()=>j(e.hash),onMouseLeave:E,onTouchStart:()=>j(e.hash)},e.hash))})}),o.jsx("div",{className:"h-48 sm:h-auto sm:flex-1 p-2 flex-shrink-0",children:o.jsx(N,{nodes:g,hoveredHash:m,onNodeHover:j,onNodeLeave:E})})]})]})}),document.body):null});export{j as C};
+import{r as e,b as t,j as o,a7 as s,X as n,a5 as r,ao as a,ap as l,aq as i,ar as c,aa as d,$ as u}from"./vendor-react-O8XH9yVn.js";import{L as m}from"./leaflet-D_ckmI2R.js";import{c as h}from"./recharts-BU7auunF.js";import{d as x,w as p,f}from"./index-DGrzd8xb.js";const b={DEFAULT:"#4338CA",AMBER:"#F59E0B",NEIGHBOR:"#39D98A",MUTED:"#6B7280",HIGHLIGHT:"#FBBF24"};function y(){if("undefined"==typeof document)return b;const e=document.documentElement,t=getComputedStyle(e);return{DEFAULT:t.getPropertyValue("--map-hub-color").trim()||b.DEFAULT,AMBER:t.getPropertyValue("--pkt-txt-msg").trim()||b.AMBER,NEIGHBOR:t.getPropertyValue("--accent-success").trim()||b.NEIGHBOR,MUTED:t.getPropertyValue("--text-muted").trim()||b.MUTED,HIGHLIGHT:t.getPropertyValue("--accent-secondary").trim()||b.HIGHLIGHT}}function v({hash:t,highlighted:s}){const[n,r]=e.useState(!1),a=e.useCallback(e=>{e.preventDefault(),e.stopPropagation(),function(e){if("undefined"!=typeof window&&(window.isSecureContext||"https:"===window.location.protocol||"localhost"===window.location.hostname)&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText)return navigator.clipboard.writeText(e).catch(()=>{}),!0;try{const t=window.scrollX,o=window.scrollY,s=document.createElement("textarea");s.value=e,s.style.cssText="position:fixed;left:-9999px;top:-9999px;opacity:0;pointer-events:none",s.setAttribute("readonly",""),document.body.appendChild(s),s.focus({preventScroll:!0}),s.select(),s.setSelectionRange(0,e.length);const n=document.execCommand("copy");return document.body.removeChild(s),window.scrollTo(t,o),n}catch{return!1}}(t),r(!0),setTimeout(()=>r(!1),2e3)},[t]),l=t.length>12?`${t.slice(0,12)}…`:t;return o.jsxs("button",{type:"button",onClick:a,className:h("inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] font-mono rounded transition-all","border border-border-subtle hover:border-border-strong cursor-pointer select-none",s?"bg-accent-secondary/20 border-accent-secondary/50":"bg-bg-subtle/80 hover:bg-bg-elevated"),title:`Click to copy: ${t}`,children:[o.jsx("span",{className:h("transition-colors",n?"text-accent-success":"text-text-secondary"),children:l}),n?o.jsx(d,{className:"w-2.5 h-2.5 text-accent-success"}):o.jsx(u,{className:"w-2.5 h-2.5 opacity-40"})]})}function g({node:e,className:t}){const s=y(),n=e.contactType.toLowerCase(),r="room server"===n||"room_server"===n||"room"===n||"server"===n,d="companion"===n||"client"===n||"cli"===n;return r&&e.isRepeater?o.jsxs("div",{className:h("relative",t),children:[o.jsx(a,{className:"w-full h-full",style:{color:s.AMBER}}),o.jsx(l,{className:"w-1/2 h-1/2 absolute -bottom-0.5 -right-0.5",style:{color:s.DEFAULT}})]}):r?o.jsx(a,{className:t,style:{color:s.AMBER}}):d?o.jsx(i,{className:h(t,"text-text-muted")}):e.isRepeater?e.isNeighbor?o.jsx(c,{className:t,style:{color:s.NEIGHBOR}}):o.jsx(l,{className:t,style:{color:s.DEFAULT}}):o.jsx(i,{className:h(t,"text-text-muted")})}function w({node:e,isHovered:t,onMouseEnter:s,onMouseLeave:n,onTouchStart:r}){return o.jsxs("div",{className:h("flex items-center gap-3 px-3 py-2.5 transition-colors rounded-lg",t?"bg-accent-secondary/10":"hover:bg-white/[0.03]"),onMouseEnter:s,onMouseLeave:n,onTouchStart:r,children:[o.jsx("div",{className:"flex-shrink-0 w-5 h-5",children:o.jsx(g,{node:e,className:"w-5 h-5"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[o.jsx("span",{className:"text-sm font-medium text-text-primary truncate",children:e.name}),e.isNeighbor&&o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium bg-accent-success/20 text-accent-success",children:"NBR"}),e.isRepeater&&o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-white/10 text-text-muted font-medium",children:"RPT"})]}),o.jsx("div",{className:"mt-1",children:o.jsx(v,{hash:e.hash,highlighted:t})})]})]})}function N({nodes:t,hoveredHash:s,onNodeHover:n,onNodeLeave:a}){const l=e.useRef(null),i=e.useRef(null),c=e.useRef(new Map),d=e.useMemo(()=>t.filter(e=>e.latitude&&e.longitude&&0!==e.latitude&&0!==e.longitude),[t]);return e.useEffect(()=>{if(!i.current||l.current)return;const e=m.map(i.current,{zoomControl:!0,attributionControl:!0});return m.tileLayer("https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",{attribution:'© OSM © CARTO'}).addTo(e),l.current=e,()=>{e.remove(),l.current=null}},[]),e.useEffect(()=>{const e=l.current;if(!e)return;if(c.current.forEach(e=>e.remove()),c.current.clear(),0===d.length)return;const t=m.latLngBounds([]);for(const o of d){if(!o.latitude||!o.longitude)continue;const s=m.latLng(o.latitude,o.longitude);t.extend(s);const r=y(),l=o.isNeighbor?r.NEIGHBOR:r.DEFAULT,i=m.circleMarker(s,{radius:8,fillColor:l,fillOpacity:.8,color:"#fff",weight:2,opacity:.9});i.bindTooltip(o.name,{permanent:!1,direction:"top",offset:[0,-8],className:"collision-tooltip"}),i.on("mouseover",()=>n(o.hash)),i.on("mouseout",()=>a()),i.addTo(e),c.current.set(o.hash,i)}t.isValid()&&e.fitBounds(t,{padding:[40,40],maxZoom:12})},[d,n,a]),e.useEffect(()=>{c.current.forEach((e,t)=>{const o=d.find(e=>e.hash===t);if(!o)return;const n=y(),r=t===s,a=o.isNeighbor?n.NEIGHBOR:n.DEFAULT;e.setStyle({radius:r?12:8,fillColor:r?n.HIGHLIGHT:a,weight:r?3:2}),r?(e.openTooltip(),e.bringToFront()):e.closeTooltip()})},[s,d]),0===d.length?o.jsx("div",{className:"h-full flex items-center justify-center bg-bg-subtle/30 rounded-lg",children:o.jsxs("div",{className:"text-center text-text-muted p-4",children:[o.jsx(r,{className:"w-8 h-8 mx-auto mb-2 opacity-40"}),o.jsx("p",{className:"text-sm",children:"No location data available"}),o.jsx("p",{className:"text-xs opacity-70",children:"Nodes need GPS coordinates to appear on the map"})]})}):o.jsx("div",{ref:i,className:"h-full w-full rounded-lg overflow-hidden"})}const j=e.memo(function({isOpen:r,prefix:a,candidateHashes:l,onClose:i}){const c=x(),d=p(),u=f(),[m,b]=e.useState(null),y=e.useMemo(()=>new Set(u.map(e=>e.hash)),[u]),v=null==c?void 0:c.neighbors,g=e.useMemo(()=>v?l.map(e=>{var t,o;const s=v[e];return{hash:e,name:(null==s?void 0:s.node_name)||(null==s?void 0:s.name)||`Unknown (${e.slice(0,8)}…)`,contactType:(null==s?void 0:s.contact_type)||"",isRepeater:(null==s?void 0:s.is_repeater)||"repeater"===(null==(t=null==s?void 0:s.contact_type)?void 0:t.toLowerCase())||"rep"===(null==(o=null==s?void 0:s.contact_type)?void 0:o.toLowerCase())||!1,isNeighbor:y.has(e),isHub:d.has(e),latitude:null==s?void 0:s.latitude,longitude:null==s?void 0:s.longitude,lastSeen:null==s?void 0:s.last_seen}}).sort((e,t)=>e.isNeighbor!==t.isNeighbor?e.isNeighbor?-1:1:e.name.localeCompare(t.name)):[],[l,v,y,d]),j=e.useCallback(e=>b(e),[]),E=e.useCallback(()=>b(null),[]);return e.useEffect(()=>{if(!r)return;const e=e=>{"Escape"===e.key&&i()};window.addEventListener("keydown",e);const t=window.scrollY,o={overflow:document.body.style.overflow,position:document.body.style.position,width:document.body.style.width,top:document.body.style.top};return document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%",document.body.style.top=`-${t}px`,()=>{window.removeEventListener("keydown",e),document.body.style.overflow=o.overflow,document.body.style.position=o.position,document.body.style.width=o.width,document.body.style.top=o.top,window.scrollTo(0,t)}},[r,i]),r?t.createPortal(o.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-[10010] flex items-end sm:items-center justify-center",onClick:i,role:"dialog","aria-modal":"true","aria-labelledby":"collision-modal-title",children:o.jsxs("div",{className:h("glass-card-elevated w-full flex flex-col","max-h-[85vh] rounded-t-2xl rounded-b-none","sm:max-w-2xl sm:mx-4 sm:rounded-xl sm:max-h-[80vh]","pb-safe"),onClick:e=>e.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border-subtle flex-shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"p-2 rounded-lg bg-signal-fair/10",children:o.jsx(s,{className:"w-5 h-5 text-signal-fair"})}),o.jsxs("div",{children:[o.jsxs("h3",{id:"collision-modal-title",className:"text-base font-semibold text-text-primary",children:["Prefix Collision: ",o.jsx("span",{className:"font-mono text-accent-primary",children:a})]}),o.jsxs("p",{className:"text-xs text-text-muted",children:[g.length," nodes share this prefix"]})]})]}),o.jsx("button",{onClick:i,className:"p-2 rounded-lg text-text-muted hover:text-text-primary hover:bg-bg-subtle transition-colors",children:o.jsx(n,{className:"w-5 h-5"})})]}),o.jsxs("div",{className:"flex-1 min-h-0 flex flex-col sm:flex-row overflow-hidden",children:[o.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto sm:max-w-[280px] sm:border-r sm:border-border-subtle",children:o.jsx("div",{className:"p-2",children:g.map(e=>o.jsx(w,{node:e,isHovered:m===e.hash,onMouseEnter:()=>j(e.hash),onMouseLeave:E,onTouchStart:()=>j(e.hash)},e.hash))})}),o.jsx("div",{className:"h-48 sm:h-auto sm:flex-1 p-2 flex-shrink-0",children:o.jsx(N,{nodes:g,hoveredHash:m,onNodeHover:j,onNodeLeave:E})})]})]})}),document.body):null});export{j as C};
diff --git a/frontend/dist/assets/Configuration-Cq1_waCf.js b/frontend/dist/assets/Configuration-TGWiCMQL.js
similarity index 99%
rename from frontend/dist/assets/Configuration-Cq1_waCf.js
rename to frontend/dist/assets/Configuration-TGWiCMQL.js
index 78036c2b..7fb9be9e 100644
--- a/frontend/dist/assets/Configuration-Cq1_waCf.js
+++ b/frontend/dist/assets/Configuration-TGWiCMQL.js
@@ -1 +1 @@
-import{r as e,j as t,f as s,i as a,X as r,at as n,aa as l,aX as c,aY as i,k as d,p as o,aZ as u,af as m,a_ as x,a$ as p,b0 as h,aP as b,av as y,b1 as g,aj as f,b2 as j,a7 as v,a2 as N,$ as w,a9 as k,b3 as C}from"./vendor-react-O8XH9yVn.js";import{c as _}from"./recharts-BU7auunF.js";import{ad as S,ae as T,af as F,I as E,ag as L,ah as P,ai as R,aj as I,ac as A,ak as M,al as D,am as z,an as K,ao as O,ap as q,aq as H,ar as $,as as Y}from"./index-Dp0UlTio.js";import{H as V}from"./HashBadge-aS_UIcg2.js";import{C as X}from"./ConfirmModal-DYznouaT.js";import{P as B,b as U,a as G,c as W}from"./PageLayout-DE5PEtD2.js";import{R as Z,C as J}from"./Grid-CIZAny_R.js";import"./vendor-core-WoOfkQwm.js";import"./deckgl-DTsmDcfs.js";const Q=e.memo(function({showLogoOnly:s=!1,showThumbnailsOnly:a=!1}){const{theme:r,setThemePreset:n,setBrightness:l}=S(),{backgroundImage:c,brightness:i}=r,[d,o]=e.useState(!1),[u,m]=e.useState(!1),x=e.useRef(null),p=e.useRef(null),h=T.find(e=>e.backgroundImage===c)??T[0],b=h.id,y=e.useCallback((e,t)=>{if(!p.current)return i;const s=(p.current.y-e)/(t?200:80)*100;return Math.round(Math.max(0,Math.min(100,p.current.brightness+s)))},[i]),g=e.useCallback(e=>{n(e),o(!0)},[n]),f=e.useCallback(e=>{l(e)},[l]),j=e.useCallback(e=>{const t=T.find(t=>t.id===e);t&&F(t.backgroundImage)},[]);if(s){const e=h.displaySize,s=`clamp(${.8*e}rem, ${.6*e}rem + 1.5vw, ${1.4*e}rem)`;return t.jsx("span",{className:"font-medium transition-all duration-300 leading-none",style:{fontFamily:h.displayFont,color:h.displayColor,fontSize:s,fontOpticalSizing:"auto",letterSpacing:"-0.03em"},children:h.displayName})}return t.jsx("div",{className:"flex gap-2 items-start flex-shrink-0",children:T.map(e=>{const s=b===e.id,a=s&&(d||u);return t.jsxs("div",{ref:s?x:void 0,title:e.displayName,className:_("flex flex-col items-center gap-1 p-0.5 rounded-sm transition-all duration-300 ease-out",s?"ring-2 ring-accent-primary scale-105 cursor-ns-resize":"cursor-pointer"),onMouseEnter:()=>{s?o(!0):j(e.id)},onMouseLeave:()=>!u&&o(!1),onClick:()=>!s&&g(e.id),onTouchStart:e=>{if(!s)return;e.preventDefault();const t=e.touches[0];p.current={y:t.clientY,brightness:i},m(!0),o(!0);const a=e=>{e.preventDefault();const t=e.touches[0];f(y(t.clientY,!0))},r=()=>{document.removeEventListener("touchmove",a),document.removeEventListener("touchend",r),p.current=null,m(!1),setTimeout(()=>o(!1),1500)};document.addEventListener("touchmove",a,{passive:!1}),document.addEventListener("touchend",r)},onMouseDown:e=>{if(!s)return;e.preventDefault(),p.current={y:e.clientY,brightness:i},m(!0),o(!0);const t=e=>{f(y(e.clientY,!1))},a=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",a),p.current=null,m(!1)};document.addEventListener("mousemove",t),document.addEventListener("mouseup",a)},children:[t.jsxs("div",{className:"glass-thumbnail w-10 h-10",children:[t.jsx("div",{className:"absolute bg-cover bg-center transition-opacity duration-200",style:{inset:0,backgroundImage:`url(${e.backgroundImage})`,opacity:a?.4:1}}),s&&t.jsxs("div",{className:_("absolute inset-0 transition-opacity duration-200",a?"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-i+"%"}}),t.jsx("div",{className:"absolute inset-x-1 h-0.5 bg-white rounded-full shadow-lg transition-all duration-100 ease-out",style:{top:100-i+"%"}}),t.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:t.jsxs("span",{className:"text-[10px] font-mono font-bold text-white drop-shadow-lg",children:[i,"%"]})})]})]}),t.jsx("div",{className:"flex flex-col gap-0.5",children:e.paletteColors.map((e,s)=>t.jsx("div",{className:"flex gap-0.5 justify-center",children:e.map((e,s)=>t.jsx("div",{className:"w-1.5 h-1.5 rounded-xs",style:{backgroundColor:e}},s))},s))})]},e.id)})})}),ee=[{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"}],te=[5,6,7,8,9,10,11,12],se=[{value:5,label:"4/5"},{value:6,label:"4/6"},{value:7,label:"4/7"},{value:8,label:"4/8"}],ae="radioConfig",re="repeaterSettings",ne="operatingMode";function le({node:e,level:s,expandedKeys:a,selectedKeyId:r,globalFloodPolicy:n,onSelect:l,onToggle:c}){const i=a.has(e.id),d=r===e.id,o=e.children&&e.children.length>0,u="allow"===n;return t.jsxs("div",{children:[t.jsxs("div",{className:_("flex items-center gap-2 h-[36px] px-3 rounded-full cursor-pointer transition-colors",d?"bg-accent-primary/15":"hover:bg-white/[0.02]",u&&"opacity-50 cursor-not-allowed"),style:{marginLeft:16*s+"px"},onClick:()=>!u&&l(e.id),children:[o?t.jsx("button",{onClick:t=>{t.stopPropagation(),c(e.id)},className:"p-1 hover:bg-white/[0.05] rounded-full transition-colors",children:t.jsx(k,{className:_("w-3.5 h-3.5 text-text-muted transition-transform",i&&"rotate-90")})}):t.jsx("span",{className:"w-5"}),t.jsx(C,{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"})]}),o&&i&&t.jsx("div",{children:e.children.map(e=>t.jsx(le,{node:e,level:s+1,expandedKeys:a,selectedKeyId:r,globalFloodPolicy:n,onSelect:l,onToggle:c},e.id))})]})}function ce(){var k,C,S,T,F,ce;const{stats:ie,setMode:de,clearModeMutation:oe,setDutyCycleConfig:ue,clearDutyCycleMutation:me,fetchStats:xe,startMutation:pe,clearMutation:he}=E(),be=null==(k=null==ie?void 0:ie.config)?void 0:k.radio,ye=null==(C=null==ie?void 0:ie.config)?void 0:C.repeater,ge=null==(S=null==ie?void 0:ie.config)?void 0:S.duty_cycle,fe=(null==ie?void 0:ie.node_name)||(null==(T=null==ie?void 0:ie.config)?void 0:T.node_name)||"Unknown Node",je=(null==ye?void 0:ye.mode)??"forward",ve=(null==ge?void 0:ge.enforcement_enabled)??!1,Ne=null==(F=null==ie?void 0:ie.config)?void 0:F.delays,[we,ke]=e.useState(!1),[Ce,_e]=e.useState(""),[Se,Te]=e.useState(62.5),[Fe,Ee]=e.useState(7),[Le,Pe]=e.useState(5),[Re,Ie]=e.useState(""),[Ae,Me]=e.useState("idle"),[De,ze]=e.useState(null),Ke=e.useRef(null),Oe=e.useRef(null),[qe,He]=e.useState(!1),[$e,Ye]=e.useState(""),[Ve,Xe]=e.useState(""),[Be,Ue]=e.useState(""),[Ge,We]=e.useState("idle"),Ze=e.useRef(null),Je=e.useRef(null),[Qe,et]=e.useState(!1),[tt,st]=e.useState(""),[at,rt]=e.useState(""),[nt,lt]=e.useState(""),[ct,it]=e.useState(""),[dt,ot]=e.useState("idle"),[ut,mt]=e.useState(null),xt=e.useRef(null),pt=e.useRef(null),[ht,bt]=e.useState("idle"),[yt,gt]=e.useState("idle"),[ft,jt]=e.useState(null),[vt,Nt]=e.useState(null),wt=e.useRef(!0),kt=e.useRef(null),Ct=e.useRef(null),_t=e.useRef(null),St=e.useRef(null),Tt=e.useRef(!1),Ft=e.useRef(!1);e.useEffect(()=>(wt.current=!0,()=>{wt.current=!1,kt.current&&clearTimeout(kt.current),Ct.current&&clearTimeout(Ct.current),_t.current&&clearTimeout(_t.current),St.current&&clearTimeout(St.current),At.current&&clearTimeout(At.current),Mt.current&&clearTimeout(Mt.current),Oe.current&&clearTimeout(Oe.current),Ze.current&&clearTimeout(Ze.current),pt.current&&clearTimeout(pt.current)}),[]),e.useEffect(()=>{const e=e=>{if(we||Qe||qe)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)},[we,Qe,qe]);const Et=null==(ce=null==ie?void 0:ie.config)?void 0:ce.web,[Lt,Pt]=e.useState("idle"),[Rt,It]=e.useState(null),At=e.useRef(null),Mt=e.useRef(null),Dt=e.useRef(!1),[zt,Kt]=e.useState([]),[Ot,qt]=e.useState(!1),[Ht,$t]=e.useState(null),[Yt,Vt]=e.useState(!1),[Xt,Bt]=e.useState(""),[Ut,Gt]=e.useState(null),[Wt,Zt]=e.useState(!1),[Jt,Qt]=e.useState(null),[es,ts]=e.useState(!1),[ss,as]=e.useState(!1),[rs,ns]=e.useState(!1),[ls,cs]=e.useState([]),[is,ds]=e.useState(!1),[os,us]=e.useState(null),[ms,xs]=e.useState("deny"),[ps,hs]=e.useState(!1),[bs,ys]=e.useState(null),[gs,fs]=e.useState(new Set),[js,vs]=e.useState(!1),[Ns,ws]=e.useState(!1),[ks,Cs]=e.useState(!1),[_s,Ss]=e.useState(null),[Ts,Fs]=e.useState(null),[Es,Ls]=e.useState(""),[Ps,Rs]=e.useState("deny"),[Is,As]=e.useState(!1),[Ms,Ds]=e.useState(!0),[zs,Ks]=e.useState(!1),[Os,qs]=e.useState(!0),[Hs,$s]=e.useState("idle"),[Ys,Vs]=e.useState(!1),[Xs,Bs]=e.useState(!1),Us=e.useRef(!1);e.useEffect(()=>{const e=we&&!Us.current;Us.current=we,be&&e&&(_e((be.frequency/1e6).toFixed(3)),Te(be.bandwidth/1e3),Ee(be.spreading_factor),Pe(be.coding_rate),Ie(String(be.tx_power)))},[be,we]);const Gs=e.useMemo(()=>{if(!be||!we)return!1;const e=be.frequency/1e6,t=be.bandwidth/1e3,s=parseFloat(Ce)||0;return Math.abs(s-e)>1e-4||Se!==t||Fe!==be.spreading_factor||Le!==be.coding_rate||parseInt(Re)!==be.tx_power},[be,we,Ce,Se,Fe,Le,Re]),Ws=e.useCallback(()=>{ke(!1),ze(null),be&&(_e((be.frequency/1e6).toFixed(3)),Te(be.bandwidth/1e3),Ee(be.spreading_factor),Pe(be.coding_rate),Ie(String(be.tx_power)))},[be]);e.useEffect(()=>{if(!we)return;const e=e=>{"loading"!==Ae&&Ke.current&&!Ke.current.contains(e.target)&&Ws()};return document.addEventListener("mouseup",e),()=>{document.removeEventListener("mouseup",e)}},[we,Ws,Ae]);const Zs=e.useCallback(()=>{const e=null==Ne?void 0:Ne.tx_delay_factor;return e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??1:"number"==typeof e?e:1},[Ne]),Js=e.useCallback(()=>{const e=null==Ne?void 0:Ne.direct_tx_delay_factor;return"number"==typeof e?e:.5},[Ne]),Qs=e.useCallback(()=>{const e=null==ge?void 0:ge.max_airtime_percent;return"number"==typeof e?e:e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??6:6},[ge]),ea=e.useCallback(()=>{Ye(Zs().toFixed(2)),Xe(Js().toFixed(2)),Ue(Qs().toFixed(1)),He(!0)},[Zs,Js,Qs]),ta=e.useCallback(()=>{He(!1)},[]);e.useEffect(()=>{if(!qe)return;const e=e=>{"loading"!==Ge&&Je.current&&!Je.current.contains(e.target)&&ta()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[qe,ta,Ge]);const sa=e.useCallback(()=>{var e,t,s;st(fe),rt((null==(e=null==ye?void 0:ye.latitude)?void 0:e.toString())||"0"),lt((null==(t=null==ye?void 0:ye.longitude)?void 0:t.toString())||"0"),it((null==(s=null==ye?void 0:ye.send_advert_interval_hours)?void 0:s.toString())||"0"),mt(null),et(!0)},[fe,ye]),aa=e.useCallback(()=>{et(!1),mt(null)},[]);e.useEffect(()=>{if(!Qe)return;const e=e=>{"loading"!==dt&&xt.current&&!xt.current.contains(e.target)&&aa()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[Qe,aa,dt]);const ra=async()=>{var e;if("loading"===Lt)return;const t=(null==Et?void 0:Et.cors_enabled)??!1,s=!t,a=t;At.current&&clearTimeout(At.current),Mt.current&&clearTimeout(Mt.current),Dt.current=!1,It(s),Pt("loading"),At.current=setTimeout(()=>{Dt.current||wt.current&&(It(a),Pt("error"),Mt.current=setTimeout(()=>{wt.current&&(Pt("idle"),It(null))},2e3))},1e4);try{const t=await M({web:{cors_enabled:s}});if(Dt.current=!0,At.current&&clearTimeout(At.current),!wt.current)return;t.success||(null==(e=t.data)?void 0:e.persisted)?(await xe(),Pt("success"),Mt.current=setTimeout(()=>{wt.current&&(Pt("idle"),It(null))},2e3)):(It(a),Pt("error"),Mt.current=setTimeout(()=>{wt.current&&(Pt("idle"),It(null))},2e3))}catch{if(Dt.current=!0,At.current&&clearTimeout(At.current),!wt.current)return;It(a),Pt("error"),Mt.current=setTimeout(()=>{wt.current&&(Pt("idle"),It(null))},2e3)}};e.useEffect(()=>{(async()=>{qs(!0);try{const e=await D();e.success&&e.data?Ks(e.data.exists):Ks(!1);const t=null==Et?void 0:Et.web_path;Ds(!t||""===t)}catch{Ks(!1)}finally{qs(!1)}})()},[null==Et?void 0:Et.web_path]);const na=async e=>{var t;if("loading"!==Hs){$s("loading");try{const s=await M({web:{web_path:e?null:"/opt/pymc_console/web/html"}});if(!wt.current)return;s.success||(null==(t=s.data)?void 0:t.persisted)?(Ds(e),$s("success"),Vs(!0),setTimeout(()=>{wt.current&&$s("idle")},2e3)):($s("error"),setTimeout(()=>{wt.current&&$s("idle")},2e3))}catch{if(!wt.current)return;$s("error"),setTimeout(()=>{wt.current&&$s("idle")},2e3)}}},la=e.useCallback(async()=>{qt(!0),$t(null);try{const e=await L();Kt(e.tokens||[])}catch(e){$t(e instanceof Error?e.message:"Failed to fetch tokens")}finally{qt(!1)}},[]);e.useEffect(()=>{la()},[la]);const ca=async()=>{if(Xt.trim()){ts(!0),$t(null);try{const e=await K(Xt.trim());Gt(e.token||null),Vt(!1),Zt(!0),Bt(""),await la()}catch(e){$t(e instanceof Error?e.message:"Failed to create token")}finally{ts(!1)}}else $t("Token name is required")},ia=e=>e?new Date(1e3*e).toLocaleString():"Never",da=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},[]),oa=e.useCallback(async()=>{ds(!0),us(null);try{const e=await P();e.success&&e.data?cs(da(e.data)):us(e.error||"Failed to load transport keys")}catch(e){us(e instanceof Error?e.message:"Unknown error occurred")}finally{ds(!1)}},[da]);e.useEffect(()=>{oa()},[oa]);const ua=e.useCallback((e,t)=>{for(const s of e){if(s.id===t)return s;if(s.children){const e=ua(s.children,t);if(e)return e}}return null},[]),ma=e.useCallback(()=>{if(!bs)return;const e=ua(ls,bs);return null==e?void 0:e.name},[bs,ls,ua]),xa=e.useCallback(e=>{fs(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),pa=async e=>{hs(!0),us(null);try{const t=await q("allow"===e);t.success?xs(e):us(t.error||"Failed to update global flood policy")}catch(t){us(t instanceof Error?t.message:"Failed to update global flood policy")}finally{hs(!1)}},ha=async()=>{if(Es.trim()){As(!0),us(null);try{const e=await H({name:Es.trim(),flood_policy:Ps,parent_id:bs??void 0});e.success?(await oa(),vs(!1),Ls(""),Rs("deny")):us(e.error||"Failed to add transport key")}catch(e){us(e instanceof Error?e.message:"Failed to add transport key")}finally{As(!1)}}else us("Key name is required")},ba=e.useCallback(()=>{if(!bs)return;const e=ua(ls,bs);e&&(Ss({...e}),ws(!0))},[bs,ls,ua]);e.useEffect(()=>{const e=e=>{"Escape"===e.key&&(js&&(vs(!1),Ls(""),Rs("deny")),Ns&&(ws(!1),Ss(null)),ks&&(Cs(!1),Fs(null)),Yt&&(Vt(!1),Bt("")),Wt&&(Zt(!1),Gt(null)))};if(js||Ns||ks||Yt||Wt)return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[js,Ns,ks,Yt,Wt]);const ya=e.useCallback(()=>{if(!bs)return;const e=ua(ls,bs);e&&(Fs(e),Cs(!0))},[bs,ls,ua]);return t.jsxs(B,{children:[t.jsx(U,{title:"Configuration",icon:t.jsx(s,{})}),t.jsxs(Z,{template:"standard",children:[t.jsx(J,{span:12,md:6,children:t.jsx(G,{children:t.jsxs("div",{ref:xt,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"}),"Repeater Settings"]}),t.jsx("div",{className:"flex items-center gap-1",children:ye&&(Qe?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:aa,disabled:"loading"===dt,className:_("p-2 rounded-lg transition-colors","loading"===dt?"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"!==dt){pt.current&&clearTimeout(pt.current),pe(re),ot("loading"),mt(null);try{const e={};tt&&tt!==fe&&(e.node_name=tt);const t=parseFloat(at);isNaN(t)||t===(null==ye?void 0:ye.latitude)||(e.latitude=t);const s=parseFloat(nt);isNaN(s)||s===(null==ye?void 0:ye.longitude)||(e.longitude=s);const a=parseInt(ct);if(isNaN(a)||a===(null==ye?void 0:ye.send_advert_interval_hours)||(e.flood_advert_interval_hours=a),0===Object.keys(e).length)return mt({success:!0,message:"No changes to save"}),ot("idle"),void he(re);const r=await A(e);if(!wt.current)return void he(re);if(r.success&&r.data){const e=r.data.applied.join(", ");mt({success:!0,message:`Updated: ${e}`}),await xe({force:!0}),ot("success"),pt.current=setTimeout(()=>{wt.current&&(ot("idle"),et(!1),mt(null),he(re))},1500)}else mt({success:!1,message:r.error||"Failed to save"}),ot("error"),he(re),pt.current=setTimeout(()=>{wt.current&&ot("idle")},2e3)}catch(e){if(!wt.current)return void he(re);mt({success:!1,message:String(e)}),ot("error"),he(re),pt.current=setTimeout(()=>{wt.current&&ot("idle")},2e3)}}},disabled:"loading"===dt,className:_("p-2 rounded-lg transition-colors","loading"===dt?"text-accent-primary cursor-wait":"success"===dt?"text-accent-success":"error"===dt?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save changes",children:"loading"===dt?t.jsx(n,{className:"w-4 h-4 animate-spin"}):"success"===dt?t.jsx(l,{className:"w-4 h-4"}):"error"===dt?t.jsx(r,{className:"w-4 h-4"}):t.jsx(l,{className:"w-4 h-4"})})]}):t.jsx("button",{onClick:sa,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"})}))})]}),ut&&t.jsx("div",{className:_("text-xs mb-3 px-2 py-1.5 rounded-md",ut.success?"text-accent-success bg-accent-success/10":"text-accent-danger bg-accent-danger/10"),children:ut.message}),ye?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",Qe?"bg-white/5":"bg-white/[0.02]"),children:Qe?t.jsx("input",{type:"text",value:tt,onChange:e=>st(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:fe})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:Qe?"Latitude (°)":"Latitude"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",Qe?"bg-white/5":"bg-white/[0.02]"),children:Qe?t.jsx("input",{type:"number",value:at,onChange:e=>rt(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!==ye.latitude?ye.latitude.toFixed(6):"Not set"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:Qe?"Longitude (°)":"Longitude"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",Qe?"bg-white/5":"bg-white/[0.02]"),children:Qe?t.jsx("input",{type:"number",value:nt,onChange:e=>lt(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!==ye.longitude?ye.longitude.toFixed(6):"Not set"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:Qe?"Advert Interval (hours)":"Advert Interval"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",Qe?"bg-white/5":"bg-white/[0.02]"),children:Qe?t.jsx("input",{type:"number",value:ct,onChange:e=>it(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:ye.send_advert_interval_hours>0?`${ye.send_advert_interval_hours}h`:"Disabled"})}),Qe&&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-white/[0.02]",children:t.jsx("span",{className:"type-data text-text-primary",children:ye.use_score_for_tx?"Enabled":"Disabled"})})]})]}):t.jsx("p",{className:"text-text-muted",children:"Loading repeater settings..."})]})})}),t.jsx(J,{span:12,md:6,children:t.jsx(G,{children:t.jsxs("div",{ref:Ke,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(i,{className:"icon-md text-accent-primary"}),"Radio Configuration"]}),t.jsx("div",{className:"flex items-center gap-1",children:be&&(we?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:Ws,disabled:"loading"===Ae,className:_("p-2 rounded-lg transition-colors","loading"===Ae?"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"!==Ae){Oe.current&&clearTimeout(Oe.current),pe(ae),Me("loading"),ze(null);try{const e={},t=parseFloat(Ce),s=be?be.frequency/1e6:0;Math.abs(t-s)>1e-4&&(e.frequency_mhz=t);const a=be?be.bandwidth/1e3:0;Se!==a&&(e.bandwidth_khz=Se),Fe!==(null==be?void 0:be.spreading_factor)&&(e.spreading_factor=Fe),Le!==(null==be?void 0:be.coding_rate)&&(e.coding_rate=Le);const r=parseInt(Re);if(r!==(null==be?void 0:be.tx_power)&&(e.tx_power=r),0===Object.keys(e).length)return ze({success:!0,message:"No changes to save"}),Me("idle"),void he(ae);const n=await A(e);if(!wt.current)return void he(ae);if(n.success&&n.data){const e=n.data.applied.join(", "),t=n.data.live_update?" (applied live)":" (restart required)";ze({success:!0,message:`Updated: ${e}${t}`}),await xe({force:!0}),Me("success"),Oe.current=setTimeout(()=>{wt.current&&(Me("idle"),ke(!1),ze(null),he(ae))},1500)}else ze({success:!1,message:n.error||"Failed to save"}),Me("error"),he(ae),Oe.current=setTimeout(()=>{wt.current&&Me("idle")},2e3)}catch(e){if(!wt.current)return void he(ae);ze({success:!1,message:String(e)}),Me("error"),he(ae),Oe.current=setTimeout(()=>{wt.current&&Me("idle")},2e3)}}},disabled:"loading"===Ae||!Gs,className:_("p-2 rounded-lg transition-colors","loading"===Ae?"text-accent-primary cursor-wait":"success"===Ae?"text-accent-success":"error"===Ae?"text-accent-danger":Gs?"text-accent-success hover:bg-accent-success/10":"text-text-muted cursor-not-allowed"),title:Gs?"Save changes":"No changes to save",children:"loading"===Ae?t.jsx(n,{className:"w-4 h-4 animate-spin"}):"success"===Ae?t.jsx(l,{className:"w-4 h-4"}):"error"===Ae?t.jsx(r,{className:"w-4 h-4"}):t.jsx(l,{className:"w-4 h-4"})})]}):t.jsx("button",{onClick:()=>{be&&(_e((be.frequency/1e6).toFixed(3)),Te(be.bandwidth/1e3),Ee(be.spreading_factor),Pe(be.coding_rate),Ie(String(be.tx_power))),ze(null),ke(!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"})}))})]}),De&&t.jsx("div",{className:_("text-xs mb-3 px-2 py-1.5 rounded-md",De.success?"text-accent-success bg-accent-success/10":"text-accent-danger bg-accent-danger/10"),children:De.message}),be?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:we?"Frequency (MHz)":"Frequency"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",we?"bg-white/5":"bg-white/[0.02]"),children:we?t.jsx("input",{type:"number",value:Ce,onChange:e=>_e(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:R(be.frequency)})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:we?"TX Power (dBm)":"TX Power"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",we?"bg-white/5":"bg-white/[0.02]"),children:we?t.jsx("input",{type:"number",value:Re,onChange:e=>Ie(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:[be.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",we?"bg-white/5":"bg-white/[0.02]"),children:we?t.jsxs(t.Fragment,{children:[t.jsx("select",{value:Se,onChange:e=>Te(parseFloat(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(d,{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(be.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",we?"bg-white/5":"bg-white/[0.02]"),children:we?t.jsxs(t.Fragment,{children:[t.jsx("select",{value:Fe,onChange:e=>Ee(parseInt(e.target.value)),className:"w-full bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data pr-6",children:te.map(e=>t.jsxs("option",{value:e,children:["SF",e]},e))}),t.jsx(d,{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",be.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",we?"bg-white/5":"bg-white/[0.02]"),children:we?t.jsxs(t.Fragment,{children:[t.jsx("select",{value:Le,onChange:e=>Pe(parseInt(e.target.value)),className:"w-full bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data pr-6",children:se.map(e=>t.jsx("option",{value:e.value,children:e.label},e.value))}),t.jsx(d,{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/",be.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-white/[0.02]",children:t.jsxs("span",{className:"type-data text-text-primary",children:[be.preamble_length," symbols"]})})]})]}):t.jsx("p",{className:"text-text-muted",children:"Loading radio configuration..."})]})})})]}),t.jsxs(Z,{template:"standard",children:[t.jsx(J,{span:12,md:6,children:t.jsx(G,{children:t.jsxs("div",{ref:Je,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(o,{className:"icon-md text-icon-card-title"}),"Operating Mode"]}),t.jsx("div",{className:"flex items-center gap-1",children:qe?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:async()=>{if("loading"!==Ge){Ze.current&&clearTimeout(Ze.current),pe(ne),We("loading");try{const e=await A({tx_delay_factor:parseFloat($e),direct_tx_delay_factor:parseFloat(Ve)});if(await ue({max_airtime_percent:parseFloat(Be),enforcement_enabled:ve}),!wt.current)return void he(ne);e.success&&e.data?(await xe({force:!0}),We("success"),Ze.current=setTimeout(()=>{wt.current&&(We("idle"),He(!1),he(ne))},1500)):(We("error"),he(ne),Ze.current=setTimeout(()=>{wt.current&&We("idle")},2e3))}catch{if(!wt.current)return void he(ne);We("error"),he(ne),Ze.current=setTimeout(()=>{wt.current&&We("idle")},2e3)}}},disabled:"loading"===Ge,className:_("p-2 rounded-lg transition-colors","loading"===Ge?"text-accent-primary cursor-wait":"success"===Ge?"text-accent-success":"error"===Ge?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save",children:"loading"===Ge?t.jsx(n,{className:"w-4 h-4 animate-spin"}):"success"===Ge?t.jsx(l,{className:"w-4 h-4"}):"error"===Ge?t.jsx(r,{className:"w-4 h-4"}):t.jsx(l,{className:"w-4 h-4"})}),t.jsx("button",{onClick:ta,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:ea,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!==ft?ft:"forward"===je;return t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:async()=>{if("loading"===ht)return;const t=!e,s="forward"===je;kt.current&&clearTimeout(kt.current),Ct.current&&clearTimeout(Ct.current),Tt.current=!1,jt(t),bt("loading"),kt.current=setTimeout(()=>{Tt.current||wt.current&&(jt(s),bt("error"),Ct.current=setTimeout(()=>{wt.current&&(bt("idle"),jt(null))},2e3))},1e4);try{if(await de(t?"forward":"monitor"),Tt.current=!0,kt.current&&clearTimeout(kt.current),!wt.current)return;bt("success"),Ct.current=setTimeout(()=>{wt.current&&(bt("idle"),jt(null),oe())},2e3)}catch{if(Tt.current=!0,kt.current&&clearTimeout(kt.current),!wt.current)return;jt(s),bt("error"),Ct.current=setTimeout(()=>{wt.current&&(bt("idle"),jt(null))},2e3)}},disabled:"loading"===ht,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"===ht&&"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"===ht&&t.jsx(n,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===ht&&t.jsx(l,{className:"w-4 h-4 text-accent-success"}),"error"===ht&&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!==vt?vt:ve;return t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:async()=>{if("loading"===yt)return;const t=!e,s=ve;_t.current&&clearTimeout(_t.current),St.current&&clearTimeout(St.current),Ft.current=!1,Nt(t),gt("loading"),_t.current=setTimeout(()=>{Ft.current||wt.current&&(Nt(s),gt("error"),St.current=setTimeout(()=>{wt.current&&(gt("idle"),Nt(null))},2e3))},1e4);try{if(await ue({max_airtime_percent:Qs(),enforcement_enabled:t}),Ft.current=!0,_t.current&&clearTimeout(_t.current),!wt.current)return;gt("success"),St.current=setTimeout(()=>{wt.current&&(gt("idle"),Nt(null),me())},2e3)}catch{if(Ft.current=!0,_t.current&&clearTimeout(_t.current),!wt.current)return;Nt(s),gt("error"),St.current=setTimeout(()=>{wt.current&&(gt("idle"),Nt(null))},2e3)}},disabled:"loading"===yt,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"===yt&&"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"===yt&&t.jsx(n,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===yt&&t.jsx(l,{className:"w-4 h-4 text-accent-success"}),"error"===yt&&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]",qe?"bg-white/5":"bg-white/[0.02]"),children:qe?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{type:"number",value:Be,onChange:e=>Ue(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:[Qs().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]",qe?"bg-white/5":"bg-white/[0.02]"),children:qe?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{type:"number",value:$e,onChange:e=>Ye(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:[Zs().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]",qe?"bg-white/5":"bg-white/[0.02]"),children:qe?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{type:"number",value:Ve,onChange:e=>Xe(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:[Js().toFixed(2),"s"]})})]})]})]})]})]})})}),t.jsx(J,{span:12,md:6,children:t.jsxs(G,{children:[t.jsx(W,{icon:t.jsx(s,{}),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!==Rt?Rt:(null==Et?void 0:Et.cors_enabled)??!1;return t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:ra,disabled:"loading"===Lt,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"===Lt&&"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"===Lt&&t.jsx(n,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===Lt&&t.jsx(l,{className:"w-4 h-4 text-accent-success"}),"error"===Lt&&t.jsx(r,{className:"w-4 h-4 text-accent-danger"})]})})()})]}),t.jsxs("div",{children:[t.jsx("span",{className:"type-body text-text-primary font-medium block mb-2",children:"Theme"}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Q,{showLogoOnly:!0})}),t.jsx("div",{className:"flex-shrink-0",children:t.jsx(Q,{showThumbnailsOnly:!0})})]})]})]})]})})]}),t.jsx(Z,{template:"auto",children:t.jsxs(G,{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(u,{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:()=>vs(!0),disabled:"allow"===ms,className:_("flex items-center gap-1.5 h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium","allow"===ms?"bg-white/[0.02] text-text-muted cursor-not-allowed":"bg-accent-success/10 hover:bg-accent-success/20 text-accent-success"),children:[t.jsx(m,{className:"w-3.5 h-3.5"}),"Add"]}),t.jsx("button",{onClick:ba,disabled:!bs||"allow"===ms,className:_("h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium",bs&&"allow"!==ms?"bg-accent-primary/10 hover:bg-accent-primary/20 text-accent-primary":"bg-white/[0.02] text-text-muted cursor-not-allowed"),children:"Edit"}),t.jsx("button",{onClick:ya,disabled:!bs||"allow"===ms,className:_("h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium",bs&&"allow"!==ms?"bg-accent-danger/10 hover:bg-accent-danger/20 text-accent-danger":"bg-white/[0.02] text-text-muted cursor-not-allowed"),children:"Delete"})]})]}),t.jsx("div",{className:"bg-white/[0.02] 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"===ms?"bg-accent-success/20":"bg-accent-danger/20"),children:"allow"===ms?t.jsx(x,{className:"w-5 h-5 text-accent-success"}):t.jsx(p,{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-white/[0.02] rounded-full p-1",children:[t.jsx("button",{onClick:()=>pa("deny"),disabled:ps,className:_("px-4 py-1.5 rounded-full transition-colors type-body-sm font-medium","deny"===ms?"bg-accent-danger/20 text-accent-danger":"text-text-muted hover:text-text-secondary",ps&&"opacity-50"),children:"Deny"}),t.jsx("button",{onClick:()=>pa("allow"),disabled:ps,className:_("px-4 py-1.5 rounded-full transition-colors type-body-sm font-medium","allow"===ms?"bg-accent-success/20 text-accent-success":"text-text-muted hover:text-text-secondary",ps&&"opacity-50"),children:"Allow"})]}),ps&&t.jsx(n,{className:"w-4 h-4 animate-spin text-text-muted"})]})]})}),os&&t.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-accent-danger bg-accent-danger/10",children:os}),t.jsx("div",{className:"bg-white/[0.02] rounded-2xl p-4 min-h-[120px]",children:is?t.jsxs("div",{className:"flex items-center justify-center py-6",children:[t.jsx(n,{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===ls.length?t.jsxs("div",{className:"text-center py-6",children:[t.jsx("div",{className:"w-12 h-12 rounded-full bg-white/[0.02] mx-auto mb-3 flex items-center justify-center",children:t.jsx(u,{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:ls.map(e=>t.jsx(le,{node:e,level:0,expandedKeys:gs,selectedKeyId:bs,globalFloodPolicy:ms,onSelect:ys,onToggle:xa},e.id))})})]})}),t.jsx(Z,{template:"auto",children:t.jsxs(G,{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(h,{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:()=>Vt(!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(m,{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(b,{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."})]})]})}),Ht&&t.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-accent-danger bg-accent-danger/10",children:Ht}),Ot&&0===zt.length?t.jsxs("div",{className:"flex items-center justify-center py-6",children:[t.jsx(n,{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..."})]}):zt.length>0?t.jsx("div",{className:"space-y-2",children:zt.map(e=>t.jsx("div",{className:"bg-white/[0.02] hover:bg-white/[0.04] 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(h,{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: ",ia(e.created_at)]}),t.jsxs("span",{className:"type-data-sm text-text-muted truncate",children:["Last used: ",ia(e.last_used)]})]})]})]}),t.jsxs("button",{onClick:()=>Qt({id:e.id,name:e.name}),disabled:ss,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(y,{className:"w-3.5 h-3.5"}),"Revoke"]})]})},e.id))}):t.jsxs("div",{className:"bg-white/[0.02] rounded-2xl p-6 text-center",children:[t.jsx("div",{className:"w-14 h-14 rounded-full bg-white/[0.02] mx-auto mb-4 flex items-center justify-center",children:t.jsx(h,{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:()=>Vt(!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(Z,{template:"auto",children:t.jsxs(G,{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(g,{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-white/[0.02] rounded-2xl border-2 cursor-pointer transition-all",Ms?"border-accent-primary bg-accent-primary/5":"border-transparent hover:border-accent-primary/30","loading"===Hs&&"opacity-50 pointer-events-none"),children:[t.jsx("input",{type:"radio",name:"frontend",checked:Ms,onChange:()=>na(!0),disabled:"loading"===Hs,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-white/[0.02] rounded-2xl border-2 cursor-pointer transition-all",Ms?"border-transparent hover:border-accent-primary/30":"border-accent-primary bg-accent-primary/5","loading"===Hs&&"opacity-50 pointer-events-none"),children:[t.jsx("input",{type:"radio",name:"frontend",checked:!Ms,onChange:()=>na(!1),disabled:"loading"===Hs,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"})]})]})]}),!Os&&t.jsx("div",{className:_("bg-white/[0.02] rounded-2xl p-4",zs?"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",zs?"bg-accent-success/20":"bg-accent-tertiary/20"),children:zs?t.jsx(f,{className:"w-4 h-4 text-accent-success"}):t.jsx(b,{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:zs?"PyMC Console has been detected":"PyMC Console Not Installed"}),zs?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(j,{className:"w-4 h-4"}),"PyMC Console Install Instructions"]})]})]})]})}),Ys&&t.jsx("div",{className:"bg-white/[0.02] 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(v,{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(!Xs){Bs(!0);try{await z(),Vs(!1),setTimeout(()=>{window.location.reload()},2e3)}catch{Vs(!1),setTimeout(()=>{window.location.reload()},3e3)}}},disabled:Xs,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:Xs?t.jsxs(t.Fragment,{children:[t.jsx(n,{className:"w-4 h-4 animate-spin"}),"Restarting..."]}):t.jsxs(t.Fragment,{children:[t.jsx(N,{className:"w-4 h-4"}),"Restart Now"]})})]})})]})]})}),t.jsx(Z,{template:"auto",children:t.jsxs(G,{children:[t.jsx(W,{icon:t.jsx(o,{}),title:"Node Information",largeTitle:!0}),ie?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[t.jsxs("div",{children:[t.jsx("span",{className:"type-label text-text-muted",children:"Node Name"}),t.jsx("p",{className:"type-body text-text-primary mt-1",children:fe})]}),t.jsxs("div",{children:[t.jsx("span",{className:"type-label text-text-muted",children:"Version"}),t.jsxs("p",{className:"type-data text-text-primary mt-1",children:["v",ie.version]})]}),t.jsxs("div",{children:[t.jsx("span",{className:"type-label text-text-muted",children:"Core Version"}),t.jsxs("p",{className:"type-data text-text-primary mt-1",children:["v",ie.core_version]})]}),t.jsxs("div",{children:[t.jsx("span",{className:"type-label text-text-muted",children:"Local Hash"}),t.jsx("div",{className:"mt-1",children:ie.local_hash?t.jsx(V,{hash:ie.local_hash,size:"sm"}):t.jsx("span",{className:"type-data-sm text-text-muted",children:"N/A"})})]})]}),ie.public_key&&t.jsxs("div",{className:"mt-4 pt-4 border-t border-border-subtle",children:[t.jsx("span",{className:"type-label text-text-muted",children:"Public Key"}),t.jsx("div",{className:"mt-1",children:t.jsx(V,{hash:ie.public_key,prefixLength:12,suffixLength:8})})]})]}):t.jsx("p",{className:"text-text-muted",children:"Loading node information..."})]})}),Yt&&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":"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:Xt,onChange:e=>Bt(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&&ca(),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:()=>{Vt(!1),Bt(""),$t(null)},disabled:es,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:es||!Xt.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:es?t.jsxs(t.Fragment,{children:[t.jsx(n,{className:"w-4 h-4 animate-spin"}),"Creating..."]}):"Create Token"})]})]})]})}),Wt&&Ut&&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&&Zt(!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(v,{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:Ut,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:()=>{Ut&&(navigator.clipboard.writeText(Ut),ns(!0),setTimeout(()=>ns(!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:[rs?t.jsx(l,{className:"w-4 h-4 text-accent-success"}):t.jsx(w,{className:"w-4 h-4"}),rs?"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: ',Ut.slice(0,12),'..." ',window.location.origin,"/api/stats"]})]}),t.jsx("div",{className:"flex justify-end mt-6",children:t.jsx("button",{onClick:()=>{Zt(!1),Gt(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(X,{isOpen:!!Jt,title:"Revoke API Token",message:`Are you sure you want to revoke the token '${null==Jt?void 0:Jt.name}'? This action cannot be undone.`,confirmLabel:ss?"Revoking...":"Revoke",cancelLabel:"Cancel",variant:"danger",onConfirm:async()=>{if(Jt){as(!0),$t(null);try{await O(Jt.id),await la(),Qt(null)}catch(e){$t(e instanceof Error?e.message:"Failed to revoke token")}finally{as(!1)}}},onCancel:()=>Qt(null)}),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&&vs(!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:[bs&&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:ma()})]}),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:Es,onChange:e=>Ls(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&&ha(),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:()=>Rs("deny"),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","deny"===Ps?"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:()=>Rs("allow"),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","allow"===Ps?"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:()=>{vs(!1),Ls(""),Rs("deny")},disabled:Is,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:ha,disabled:Is||!Es.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:Is?t.jsxs(t.Fragment,{children:[t.jsx(n,{className:"w-4 h-4 animate-spin"}),"Adding..."]}):"Add Key"})]})]})]})}),Ns&&_s&&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&&ws(!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:_s.name,onChange:e=>Ss({..._s,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:()=>Ss({..._s,floodPolicy:"deny"}),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","deny"===_s.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:()=>Ss({..._s,floodPolicy:"allow"}),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","allow"===_s.floodPolicy?"bg-accent-success/20 text-accent-success border border-accent-success/50":"text-text-muted hover:text-text-secondary"),children:"ALLOW"})]})]}),_s.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:_s.transport_key})]}),t.jsxs("div",{className:"flex justify-between gap-3 mt-6",children:[t.jsx("button",{onClick:()=>{ws(!1),Fs(_s),Cs(!0),Ss(null)},disabled:Is,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:()=>{ws(!1),Ss(null)},disabled:Is,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(_s){As(!0),us(null);try{const e=await $(_s.id,{name:_s.name,flood_policy:_s.floodPolicy});e.success?(await oa(),ws(!1),Ss(null)):us(e.error||"Failed to update transport key")}catch(e){us(e instanceof Error?e.message:"Failed to update transport key")}finally{As(!1)}}},disabled:Is||!_s.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:Is?t.jsxs(t.Fragment,{children:[t.jsx(n,{className:"w-4 h-4 animate-spin"}),"Saving..."]}):"Save"})]})]})]})]})}),ks&&Ts&&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&&Cs(!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:["'",Ts.name,"'"]}),"?"]}),Ts.children&&Ts.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(v,{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 ",Ts.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:()=>{Cs(!1),Fs(null)},disabled:Is,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(Ts){As(!0),us(null);try{const e=await Y(Ts.id);e.success?(await oa(),Cs(!1),Fs(null),ys(null)):us(e.error||"Failed to delete transport key")}catch(e){us(e instanceof Error?e.message:"Failed to delete transport key")}finally{As(!1)}}},disabled:Is,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:Is?t.jsxs(t.Fragment,{children:[t.jsx(n,{className:"w-4 h-4 animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})}export{ce as default};
+import{r as e,j as t,f as s,i as a,X as r,at as n,aa as l,aX as c,aY as i,k as d,p as o,aZ as u,af as m,a_ as x,a$ as p,b0 as h,aP as b,av as y,b1 as g,aj as f,b2 as j,a7 as v,a2 as N,$ as w,a9 as k,b3 as C}from"./vendor-react-O8XH9yVn.js";import{c as _}from"./recharts-BU7auunF.js";import{ad as S,ae as T,af as F,I as E,ag as L,ah as P,ai as R,aj as I,ac as A,ak as M,al as D,am as z,an as K,ao as O,ap as q,aq as H,ar as $,as as Y}from"./index-DGrzd8xb.js";import{H as V}from"./HashBadge-aS_UIcg2.js";import{C as X}from"./ConfirmModal-DYznouaT.js";import{P as B,b as U,a as G,c as W}from"./PageLayout-DE5PEtD2.js";import{R as Z,C as J}from"./Grid-CIZAny_R.js";import"./vendor-core-WoOfkQwm.js";import"./deckgl-DTsmDcfs.js";const Q=e.memo(function({showLogoOnly:s=!1,showThumbnailsOnly:a=!1}){const{theme:r,setThemePreset:n,setBrightness:l}=S(),{backgroundImage:c,brightness:i}=r,[d,o]=e.useState(!1),[u,m]=e.useState(!1),x=e.useRef(null),p=e.useRef(null),h=T.find(e=>e.backgroundImage===c)??T[0],b=h.id,y=e.useCallback((e,t)=>{if(!p.current)return i;const s=(p.current.y-e)/(t?200:80)*100;return Math.round(Math.max(0,Math.min(100,p.current.brightness+s)))},[i]),g=e.useCallback(e=>{n(e),o(!0)},[n]),f=e.useCallback(e=>{l(e)},[l]),j=e.useCallback(e=>{const t=T.find(t=>t.id===e);t&&F(t.backgroundImage)},[]);if(s){const e=h.displaySize,s=`clamp(${.8*e}rem, ${.6*e}rem + 1.5vw, ${1.4*e}rem)`;return t.jsx("span",{className:"font-medium transition-all duration-300 leading-none",style:{fontFamily:h.displayFont,color:h.displayColor,fontSize:s,fontOpticalSizing:"auto",letterSpacing:"-0.03em"},children:h.displayName})}return t.jsx("div",{className:"flex gap-2 items-start flex-shrink-0",children:T.map(e=>{const s=b===e.id,a=s&&(d||u);return t.jsxs("div",{ref:s?x:void 0,title:e.displayName,className:_("flex flex-col items-center gap-1 p-0.5 rounded-sm transition-all duration-300 ease-out",s?"ring-2 ring-accent-primary scale-105 cursor-ns-resize":"cursor-pointer"),onMouseEnter:()=>{s?o(!0):j(e.id)},onMouseLeave:()=>!u&&o(!1),onClick:()=>!s&&g(e.id),onTouchStart:e=>{if(!s)return;e.preventDefault();const t=e.touches[0];p.current={y:t.clientY,brightness:i},m(!0),o(!0);const a=e=>{e.preventDefault();const t=e.touches[0];f(y(t.clientY,!0))},r=()=>{document.removeEventListener("touchmove",a),document.removeEventListener("touchend",r),p.current=null,m(!1),setTimeout(()=>o(!1),1500)};document.addEventListener("touchmove",a,{passive:!1}),document.addEventListener("touchend",r)},onMouseDown:e=>{if(!s)return;e.preventDefault(),p.current={y:e.clientY,brightness:i},m(!0),o(!0);const t=e=>{f(y(e.clientY,!1))},a=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",a),p.current=null,m(!1)};document.addEventListener("mousemove",t),document.addEventListener("mouseup",a)},children:[t.jsxs("div",{className:"glass-thumbnail w-10 h-10",children:[t.jsx("div",{className:"absolute bg-cover bg-center transition-opacity duration-200",style:{inset:0,backgroundImage:`url(${e.backgroundImage})`,opacity:a?.4:1}}),s&&t.jsxs("div",{className:_("absolute inset-0 transition-opacity duration-200",a?"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-i+"%"}}),t.jsx("div",{className:"absolute inset-x-1 h-0.5 bg-white rounded-full shadow-lg transition-all duration-100 ease-out",style:{top:100-i+"%"}}),t.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:t.jsxs("span",{className:"text-[10px] font-mono font-bold text-white drop-shadow-lg",children:[i,"%"]})})]})]}),t.jsx("div",{className:"flex flex-col gap-0.5",children:e.paletteColors.map((e,s)=>t.jsx("div",{className:"flex gap-0.5 justify-center",children:e.map((e,s)=>t.jsx("div",{className:"w-1.5 h-1.5 rounded-xs",style:{backgroundColor:e}},s))},s))})]},e.id)})})}),ee=[{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"}],te=[5,6,7,8,9,10,11,12],se=[{value:5,label:"4/5"},{value:6,label:"4/6"},{value:7,label:"4/7"},{value:8,label:"4/8"}],ae="radioConfig",re="repeaterSettings",ne="operatingMode";function le({node:e,level:s,expandedKeys:a,selectedKeyId:r,globalFloodPolicy:n,onSelect:l,onToggle:c}){const i=a.has(e.id),d=r===e.id,o=e.children&&e.children.length>0,u="allow"===n;return t.jsxs("div",{children:[t.jsxs("div",{className:_("flex items-center gap-2 h-[36px] px-3 rounded-full cursor-pointer transition-colors",d?"bg-accent-primary/15":"hover:bg-white/[0.02]",u&&"opacity-50 cursor-not-allowed"),style:{marginLeft:16*s+"px"},onClick:()=>!u&&l(e.id),children:[o?t.jsx("button",{onClick:t=>{t.stopPropagation(),c(e.id)},className:"p-1 hover:bg-white/[0.05] rounded-full transition-colors",children:t.jsx(k,{className:_("w-3.5 h-3.5 text-text-muted transition-transform",i&&"rotate-90")})}):t.jsx("span",{className:"w-5"}),t.jsx(C,{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"})]}),o&&i&&t.jsx("div",{children:e.children.map(e=>t.jsx(le,{node:e,level:s+1,expandedKeys:a,selectedKeyId:r,globalFloodPolicy:n,onSelect:l,onToggle:c},e.id))})]})}function ce(){var k,C,S,T,F,ce;const{stats:ie,setMode:de,clearModeMutation:oe,setDutyCycleConfig:ue,clearDutyCycleMutation:me,fetchStats:xe,startMutation:pe,clearMutation:he}=E(),be=null==(k=null==ie?void 0:ie.config)?void 0:k.radio,ye=null==(C=null==ie?void 0:ie.config)?void 0:C.repeater,ge=null==(S=null==ie?void 0:ie.config)?void 0:S.duty_cycle,fe=(null==ie?void 0:ie.node_name)||(null==(T=null==ie?void 0:ie.config)?void 0:T.node_name)||"Unknown Node",je=(null==ye?void 0:ye.mode)??"forward",ve=(null==ge?void 0:ge.enforcement_enabled)??!1,Ne=null==(F=null==ie?void 0:ie.config)?void 0:F.delays,[we,ke]=e.useState(!1),[Ce,_e]=e.useState(""),[Se,Te]=e.useState(62.5),[Fe,Ee]=e.useState(7),[Le,Pe]=e.useState(5),[Re,Ie]=e.useState(""),[Ae,Me]=e.useState("idle"),[De,ze]=e.useState(null),Ke=e.useRef(null),Oe=e.useRef(null),[qe,He]=e.useState(!1),[$e,Ye]=e.useState(""),[Ve,Xe]=e.useState(""),[Be,Ue]=e.useState(""),[Ge,We]=e.useState("idle"),Ze=e.useRef(null),Je=e.useRef(null),[Qe,et]=e.useState(!1),[tt,st]=e.useState(""),[at,rt]=e.useState(""),[nt,lt]=e.useState(""),[ct,it]=e.useState(""),[dt,ot]=e.useState("idle"),[ut,mt]=e.useState(null),xt=e.useRef(null),pt=e.useRef(null),[ht,bt]=e.useState("idle"),[yt,gt]=e.useState("idle"),[ft,jt]=e.useState(null),[vt,Nt]=e.useState(null),wt=e.useRef(!0),kt=e.useRef(null),Ct=e.useRef(null),_t=e.useRef(null),St=e.useRef(null),Tt=e.useRef(!1),Ft=e.useRef(!1);e.useEffect(()=>(wt.current=!0,()=>{wt.current=!1,kt.current&&clearTimeout(kt.current),Ct.current&&clearTimeout(Ct.current),_t.current&&clearTimeout(_t.current),St.current&&clearTimeout(St.current),At.current&&clearTimeout(At.current),Mt.current&&clearTimeout(Mt.current),Oe.current&&clearTimeout(Oe.current),Ze.current&&clearTimeout(Ze.current),pt.current&&clearTimeout(pt.current)}),[]),e.useEffect(()=>{const e=e=>{if(we||Qe||qe)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)},[we,Qe,qe]);const Et=null==(ce=null==ie?void 0:ie.config)?void 0:ce.web,[Lt,Pt]=e.useState("idle"),[Rt,It]=e.useState(null),At=e.useRef(null),Mt=e.useRef(null),Dt=e.useRef(!1),[zt,Kt]=e.useState([]),[Ot,qt]=e.useState(!1),[Ht,$t]=e.useState(null),[Yt,Vt]=e.useState(!1),[Xt,Bt]=e.useState(""),[Ut,Gt]=e.useState(null),[Wt,Zt]=e.useState(!1),[Jt,Qt]=e.useState(null),[es,ts]=e.useState(!1),[ss,as]=e.useState(!1),[rs,ns]=e.useState(!1),[ls,cs]=e.useState([]),[is,ds]=e.useState(!1),[os,us]=e.useState(null),[ms,xs]=e.useState("deny"),[ps,hs]=e.useState(!1),[bs,ys]=e.useState(null),[gs,fs]=e.useState(new Set),[js,vs]=e.useState(!1),[Ns,ws]=e.useState(!1),[ks,Cs]=e.useState(!1),[_s,Ss]=e.useState(null),[Ts,Fs]=e.useState(null),[Es,Ls]=e.useState(""),[Ps,Rs]=e.useState("deny"),[Is,As]=e.useState(!1),[Ms,Ds]=e.useState(!0),[zs,Ks]=e.useState(!1),[Os,qs]=e.useState(!0),[Hs,$s]=e.useState("idle"),[Ys,Vs]=e.useState(!1),[Xs,Bs]=e.useState(!1),Us=e.useRef(!1);e.useEffect(()=>{const e=we&&!Us.current;Us.current=we,be&&e&&(_e((be.frequency/1e6).toFixed(3)),Te(be.bandwidth/1e3),Ee(be.spreading_factor),Pe(be.coding_rate),Ie(String(be.tx_power)))},[be,we]);const Gs=e.useMemo(()=>{if(!be||!we)return!1;const e=be.frequency/1e6,t=be.bandwidth/1e3,s=parseFloat(Ce)||0;return Math.abs(s-e)>1e-4||Se!==t||Fe!==be.spreading_factor||Le!==be.coding_rate||parseInt(Re)!==be.tx_power},[be,we,Ce,Se,Fe,Le,Re]),Ws=e.useCallback(()=>{ke(!1),ze(null),be&&(_e((be.frequency/1e6).toFixed(3)),Te(be.bandwidth/1e3),Ee(be.spreading_factor),Pe(be.coding_rate),Ie(String(be.tx_power)))},[be]);e.useEffect(()=>{if(!we)return;const e=e=>{"loading"!==Ae&&Ke.current&&!Ke.current.contains(e.target)&&Ws()};return document.addEventListener("mouseup",e),()=>{document.removeEventListener("mouseup",e)}},[we,Ws,Ae]);const Zs=e.useCallback(()=>{const e=null==Ne?void 0:Ne.tx_delay_factor;return e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??1:"number"==typeof e?e:1},[Ne]),Js=e.useCallback(()=>{const e=null==Ne?void 0:Ne.direct_tx_delay_factor;return"number"==typeof e?e:.5},[Ne]),Qs=e.useCallback(()=>{const e=null==ge?void 0:ge.max_airtime_percent;return"number"==typeof e?e:e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??6:6},[ge]),ea=e.useCallback(()=>{Ye(Zs().toFixed(2)),Xe(Js().toFixed(2)),Ue(Qs().toFixed(1)),He(!0)},[Zs,Js,Qs]),ta=e.useCallback(()=>{He(!1)},[]);e.useEffect(()=>{if(!qe)return;const e=e=>{"loading"!==Ge&&Je.current&&!Je.current.contains(e.target)&&ta()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[qe,ta,Ge]);const sa=e.useCallback(()=>{var e,t,s;st(fe),rt((null==(e=null==ye?void 0:ye.latitude)?void 0:e.toString())||"0"),lt((null==(t=null==ye?void 0:ye.longitude)?void 0:t.toString())||"0"),it((null==(s=null==ye?void 0:ye.send_advert_interval_hours)?void 0:s.toString())||"0"),mt(null),et(!0)},[fe,ye]),aa=e.useCallback(()=>{et(!1),mt(null)},[]);e.useEffect(()=>{if(!Qe)return;const e=e=>{"loading"!==dt&&xt.current&&!xt.current.contains(e.target)&&aa()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[Qe,aa,dt]);const ra=async()=>{var e;if("loading"===Lt)return;const t=(null==Et?void 0:Et.cors_enabled)??!1,s=!t,a=t;At.current&&clearTimeout(At.current),Mt.current&&clearTimeout(Mt.current),Dt.current=!1,It(s),Pt("loading"),At.current=setTimeout(()=>{Dt.current||wt.current&&(It(a),Pt("error"),Mt.current=setTimeout(()=>{wt.current&&(Pt("idle"),It(null))},2e3))},1e4);try{const t=await M({web:{cors_enabled:s}});if(Dt.current=!0,At.current&&clearTimeout(At.current),!wt.current)return;t.success||(null==(e=t.data)?void 0:e.persisted)?(await xe(),Pt("success"),Mt.current=setTimeout(()=>{wt.current&&(Pt("idle"),It(null))},2e3)):(It(a),Pt("error"),Mt.current=setTimeout(()=>{wt.current&&(Pt("idle"),It(null))},2e3))}catch{if(Dt.current=!0,At.current&&clearTimeout(At.current),!wt.current)return;It(a),Pt("error"),Mt.current=setTimeout(()=>{wt.current&&(Pt("idle"),It(null))},2e3)}};e.useEffect(()=>{(async()=>{qs(!0);try{const e=await D();e.success&&e.data?Ks(e.data.exists):Ks(!1);const t=null==Et?void 0:Et.web_path;Ds(!t||""===t)}catch{Ks(!1)}finally{qs(!1)}})()},[null==Et?void 0:Et.web_path]);const na=async e=>{var t;if("loading"!==Hs){$s("loading");try{const s=await M({web:{web_path:e?null:"/opt/pymc_console/web/html"}});if(!wt.current)return;s.success||(null==(t=s.data)?void 0:t.persisted)?(Ds(e),$s("success"),Vs(!0),setTimeout(()=>{wt.current&&$s("idle")},2e3)):($s("error"),setTimeout(()=>{wt.current&&$s("idle")},2e3))}catch{if(!wt.current)return;$s("error"),setTimeout(()=>{wt.current&&$s("idle")},2e3)}}},la=e.useCallback(async()=>{qt(!0),$t(null);try{const e=await L();Kt(e.tokens||[])}catch(e){$t(e instanceof Error?e.message:"Failed to fetch tokens")}finally{qt(!1)}},[]);e.useEffect(()=>{la()},[la]);const ca=async()=>{if(Xt.trim()){ts(!0),$t(null);try{const e=await K(Xt.trim());Gt(e.token||null),Vt(!1),Zt(!0),Bt(""),await la()}catch(e){$t(e instanceof Error?e.message:"Failed to create token")}finally{ts(!1)}}else $t("Token name is required")},ia=e=>e?new Date(1e3*e).toLocaleString():"Never",da=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},[]),oa=e.useCallback(async()=>{ds(!0),us(null);try{const e=await P();e.success&&e.data?cs(da(e.data)):us(e.error||"Failed to load transport keys")}catch(e){us(e instanceof Error?e.message:"Unknown error occurred")}finally{ds(!1)}},[da]);e.useEffect(()=>{oa()},[oa]);const ua=e.useCallback((e,t)=>{for(const s of e){if(s.id===t)return s;if(s.children){const e=ua(s.children,t);if(e)return e}}return null},[]),ma=e.useCallback(()=>{if(!bs)return;const e=ua(ls,bs);return null==e?void 0:e.name},[bs,ls,ua]),xa=e.useCallback(e=>{fs(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),pa=async e=>{hs(!0),us(null);try{const t=await q("allow"===e);t.success?xs(e):us(t.error||"Failed to update global flood policy")}catch(t){us(t instanceof Error?t.message:"Failed to update global flood policy")}finally{hs(!1)}},ha=async()=>{if(Es.trim()){As(!0),us(null);try{const e=await H({name:Es.trim(),flood_policy:Ps,parent_id:bs??void 0});e.success?(await oa(),vs(!1),Ls(""),Rs("deny")):us(e.error||"Failed to add transport key")}catch(e){us(e instanceof Error?e.message:"Failed to add transport key")}finally{As(!1)}}else us("Key name is required")},ba=e.useCallback(()=>{if(!bs)return;const e=ua(ls,bs);e&&(Ss({...e}),ws(!0))},[bs,ls,ua]);e.useEffect(()=>{const e=e=>{"Escape"===e.key&&(js&&(vs(!1),Ls(""),Rs("deny")),Ns&&(ws(!1),Ss(null)),ks&&(Cs(!1),Fs(null)),Yt&&(Vt(!1),Bt("")),Wt&&(Zt(!1),Gt(null)))};if(js||Ns||ks||Yt||Wt)return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[js,Ns,ks,Yt,Wt]);const ya=e.useCallback(()=>{if(!bs)return;const e=ua(ls,bs);e&&(Fs(e),Cs(!0))},[bs,ls,ua]);return t.jsxs(B,{children:[t.jsx(U,{title:"Configuration",icon:t.jsx(s,{})}),t.jsxs(Z,{template:"standard",children:[t.jsx(J,{span:12,md:6,children:t.jsx(G,{children:t.jsxs("div",{ref:xt,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"}),"Repeater Settings"]}),t.jsx("div",{className:"flex items-center gap-1",children:ye&&(Qe?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:aa,disabled:"loading"===dt,className:_("p-2 rounded-lg transition-colors","loading"===dt?"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"!==dt){pt.current&&clearTimeout(pt.current),pe(re),ot("loading"),mt(null);try{const e={};tt&&tt!==fe&&(e.node_name=tt);const t=parseFloat(at);isNaN(t)||t===(null==ye?void 0:ye.latitude)||(e.latitude=t);const s=parseFloat(nt);isNaN(s)||s===(null==ye?void 0:ye.longitude)||(e.longitude=s);const a=parseInt(ct);if(isNaN(a)||a===(null==ye?void 0:ye.send_advert_interval_hours)||(e.flood_advert_interval_hours=a),0===Object.keys(e).length)return mt({success:!0,message:"No changes to save"}),ot("idle"),void he(re);const r=await A(e);if(!wt.current)return void he(re);if(r.success&&r.data){const e=r.data.applied.join(", ");mt({success:!0,message:`Updated: ${e}`}),await xe({force:!0}),ot("success"),pt.current=setTimeout(()=>{wt.current&&(ot("idle"),et(!1),mt(null),he(re))},1500)}else mt({success:!1,message:r.error||"Failed to save"}),ot("error"),he(re),pt.current=setTimeout(()=>{wt.current&&ot("idle")},2e3)}catch(e){if(!wt.current)return void he(re);mt({success:!1,message:String(e)}),ot("error"),he(re),pt.current=setTimeout(()=>{wt.current&&ot("idle")},2e3)}}},disabled:"loading"===dt,className:_("p-2 rounded-lg transition-colors","loading"===dt?"text-accent-primary cursor-wait":"success"===dt?"text-accent-success":"error"===dt?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save changes",children:"loading"===dt?t.jsx(n,{className:"w-4 h-4 animate-spin"}):"success"===dt?t.jsx(l,{className:"w-4 h-4"}):"error"===dt?t.jsx(r,{className:"w-4 h-4"}):t.jsx(l,{className:"w-4 h-4"})})]}):t.jsx("button",{onClick:sa,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"})}))})]}),ut&&t.jsx("div",{className:_("text-xs mb-3 px-2 py-1.5 rounded-md",ut.success?"text-accent-success bg-accent-success/10":"text-accent-danger bg-accent-danger/10"),children:ut.message}),ye?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",Qe?"bg-white/5":"bg-white/[0.02]"),children:Qe?t.jsx("input",{type:"text",value:tt,onChange:e=>st(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:fe})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:Qe?"Latitude (°)":"Latitude"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",Qe?"bg-white/5":"bg-white/[0.02]"),children:Qe?t.jsx("input",{type:"number",value:at,onChange:e=>rt(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!==ye.latitude?ye.latitude.toFixed(6):"Not set"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:Qe?"Longitude (°)":"Longitude"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",Qe?"bg-white/5":"bg-white/[0.02]"),children:Qe?t.jsx("input",{type:"number",value:nt,onChange:e=>lt(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!==ye.longitude?ye.longitude.toFixed(6):"Not set"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:Qe?"Advert Interval (hours)":"Advert Interval"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",Qe?"bg-white/5":"bg-white/[0.02]"),children:Qe?t.jsx("input",{type:"number",value:ct,onChange:e=>it(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:ye.send_advert_interval_hours>0?`${ye.send_advert_interval_hours}h`:"Disabled"})}),Qe&&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-white/[0.02]",children:t.jsx("span",{className:"type-data text-text-primary",children:ye.use_score_for_tx?"Enabled":"Disabled"})})]})]}):t.jsx("p",{className:"text-text-muted",children:"Loading repeater settings..."})]})})}),t.jsx(J,{span:12,md:6,children:t.jsx(G,{children:t.jsxs("div",{ref:Ke,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(i,{className:"icon-md text-accent-primary"}),"Radio Configuration"]}),t.jsx("div",{className:"flex items-center gap-1",children:be&&(we?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:Ws,disabled:"loading"===Ae,className:_("p-2 rounded-lg transition-colors","loading"===Ae?"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"!==Ae){Oe.current&&clearTimeout(Oe.current),pe(ae),Me("loading"),ze(null);try{const e={},t=parseFloat(Ce),s=be?be.frequency/1e6:0;Math.abs(t-s)>1e-4&&(e.frequency_mhz=t);const a=be?be.bandwidth/1e3:0;Se!==a&&(e.bandwidth_khz=Se),Fe!==(null==be?void 0:be.spreading_factor)&&(e.spreading_factor=Fe),Le!==(null==be?void 0:be.coding_rate)&&(e.coding_rate=Le);const r=parseInt(Re);if(r!==(null==be?void 0:be.tx_power)&&(e.tx_power=r),0===Object.keys(e).length)return ze({success:!0,message:"No changes to save"}),Me("idle"),void he(ae);const n=await A(e);if(!wt.current)return void he(ae);if(n.success&&n.data){const e=n.data.applied.join(", "),t=n.data.live_update?" (applied live)":" (restart required)";ze({success:!0,message:`Updated: ${e}${t}`}),await xe({force:!0}),Me("success"),Oe.current=setTimeout(()=>{wt.current&&(Me("idle"),ke(!1),ze(null),he(ae))},1500)}else ze({success:!1,message:n.error||"Failed to save"}),Me("error"),he(ae),Oe.current=setTimeout(()=>{wt.current&&Me("idle")},2e3)}catch(e){if(!wt.current)return void he(ae);ze({success:!1,message:String(e)}),Me("error"),he(ae),Oe.current=setTimeout(()=>{wt.current&&Me("idle")},2e3)}}},disabled:"loading"===Ae||!Gs,className:_("p-2 rounded-lg transition-colors","loading"===Ae?"text-accent-primary cursor-wait":"success"===Ae?"text-accent-success":"error"===Ae?"text-accent-danger":Gs?"text-accent-success hover:bg-accent-success/10":"text-text-muted cursor-not-allowed"),title:Gs?"Save changes":"No changes to save",children:"loading"===Ae?t.jsx(n,{className:"w-4 h-4 animate-spin"}):"success"===Ae?t.jsx(l,{className:"w-4 h-4"}):"error"===Ae?t.jsx(r,{className:"w-4 h-4"}):t.jsx(l,{className:"w-4 h-4"})})]}):t.jsx("button",{onClick:()=>{be&&(_e((be.frequency/1e6).toFixed(3)),Te(be.bandwidth/1e3),Ee(be.spreading_factor),Pe(be.coding_rate),Ie(String(be.tx_power))),ze(null),ke(!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"})}))})]}),De&&t.jsx("div",{className:_("text-xs mb-3 px-2 py-1.5 rounded-md",De.success?"text-accent-success bg-accent-success/10":"text-accent-danger bg-accent-danger/10"),children:De.message}),be?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:we?"Frequency (MHz)":"Frequency"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",we?"bg-white/5":"bg-white/[0.02]"),children:we?t.jsx("input",{type:"number",value:Ce,onChange:e=>_e(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:R(be.frequency)})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:we?"TX Power (dBm)":"TX Power"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",we?"bg-white/5":"bg-white/[0.02]"),children:we?t.jsx("input",{type:"number",value:Re,onChange:e=>Ie(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:[be.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",we?"bg-white/5":"bg-white/[0.02]"),children:we?t.jsxs(t.Fragment,{children:[t.jsx("select",{value:Se,onChange:e=>Te(parseFloat(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(d,{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(be.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",we?"bg-white/5":"bg-white/[0.02]"),children:we?t.jsxs(t.Fragment,{children:[t.jsx("select",{value:Fe,onChange:e=>Ee(parseInt(e.target.value)),className:"w-full bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data pr-6",children:te.map(e=>t.jsxs("option",{value:e,children:["SF",e]},e))}),t.jsx(d,{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",be.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",we?"bg-white/5":"bg-white/[0.02]"),children:we?t.jsxs(t.Fragment,{children:[t.jsx("select",{value:Le,onChange:e=>Pe(parseInt(e.target.value)),className:"w-full bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data pr-6",children:se.map(e=>t.jsx("option",{value:e.value,children:e.label},e.value))}),t.jsx(d,{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/",be.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-white/[0.02]",children:t.jsxs("span",{className:"type-data text-text-primary",children:[be.preamble_length," symbols"]})})]})]}):t.jsx("p",{className:"text-text-muted",children:"Loading radio configuration..."})]})})})]}),t.jsxs(Z,{template:"standard",children:[t.jsx(J,{span:12,md:6,children:t.jsx(G,{children:t.jsxs("div",{ref:Je,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(o,{className:"icon-md text-icon-card-title"}),"Operating Mode"]}),t.jsx("div",{className:"flex items-center gap-1",children:qe?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:async()=>{if("loading"!==Ge){Ze.current&&clearTimeout(Ze.current),pe(ne),We("loading");try{const e=await A({tx_delay_factor:parseFloat($e),direct_tx_delay_factor:parseFloat(Ve)});if(await ue({max_airtime_percent:parseFloat(Be),enforcement_enabled:ve}),!wt.current)return void he(ne);e.success&&e.data?(await xe({force:!0}),We("success"),Ze.current=setTimeout(()=>{wt.current&&(We("idle"),He(!1),he(ne))},1500)):(We("error"),he(ne),Ze.current=setTimeout(()=>{wt.current&&We("idle")},2e3))}catch{if(!wt.current)return void he(ne);We("error"),he(ne),Ze.current=setTimeout(()=>{wt.current&&We("idle")},2e3)}}},disabled:"loading"===Ge,className:_("p-2 rounded-lg transition-colors","loading"===Ge?"text-accent-primary cursor-wait":"success"===Ge?"text-accent-success":"error"===Ge?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save",children:"loading"===Ge?t.jsx(n,{className:"w-4 h-4 animate-spin"}):"success"===Ge?t.jsx(l,{className:"w-4 h-4"}):"error"===Ge?t.jsx(r,{className:"w-4 h-4"}):t.jsx(l,{className:"w-4 h-4"})}),t.jsx("button",{onClick:ta,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:ea,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!==ft?ft:"forward"===je;return t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:async()=>{if("loading"===ht)return;const t=!e,s="forward"===je;kt.current&&clearTimeout(kt.current),Ct.current&&clearTimeout(Ct.current),Tt.current=!1,jt(t),bt("loading"),kt.current=setTimeout(()=>{Tt.current||wt.current&&(jt(s),bt("error"),Ct.current=setTimeout(()=>{wt.current&&(bt("idle"),jt(null))},2e3))},1e4);try{if(await de(t?"forward":"monitor"),Tt.current=!0,kt.current&&clearTimeout(kt.current),!wt.current)return;bt("success"),Ct.current=setTimeout(()=>{wt.current&&(bt("idle"),jt(null),oe())},2e3)}catch{if(Tt.current=!0,kt.current&&clearTimeout(kt.current),!wt.current)return;jt(s),bt("error"),Ct.current=setTimeout(()=>{wt.current&&(bt("idle"),jt(null))},2e3)}},disabled:"loading"===ht,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"===ht&&"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"===ht&&t.jsx(n,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===ht&&t.jsx(l,{className:"w-4 h-4 text-accent-success"}),"error"===ht&&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!==vt?vt:ve;return t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:async()=>{if("loading"===yt)return;const t=!e,s=ve;_t.current&&clearTimeout(_t.current),St.current&&clearTimeout(St.current),Ft.current=!1,Nt(t),gt("loading"),_t.current=setTimeout(()=>{Ft.current||wt.current&&(Nt(s),gt("error"),St.current=setTimeout(()=>{wt.current&&(gt("idle"),Nt(null))},2e3))},1e4);try{if(await ue({max_airtime_percent:Qs(),enforcement_enabled:t}),Ft.current=!0,_t.current&&clearTimeout(_t.current),!wt.current)return;gt("success"),St.current=setTimeout(()=>{wt.current&&(gt("idle"),Nt(null),me())},2e3)}catch{if(Ft.current=!0,_t.current&&clearTimeout(_t.current),!wt.current)return;Nt(s),gt("error"),St.current=setTimeout(()=>{wt.current&&(gt("idle"),Nt(null))},2e3)}},disabled:"loading"===yt,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"===yt&&"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"===yt&&t.jsx(n,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===yt&&t.jsx(l,{className:"w-4 h-4 text-accent-success"}),"error"===yt&&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]",qe?"bg-white/5":"bg-white/[0.02]"),children:qe?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{type:"number",value:Be,onChange:e=>Ue(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:[Qs().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]",qe?"bg-white/5":"bg-white/[0.02]"),children:qe?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{type:"number",value:$e,onChange:e=>Ye(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:[Zs().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]",qe?"bg-white/5":"bg-white/[0.02]"),children:qe?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{type:"number",value:Ve,onChange:e=>Xe(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:[Js().toFixed(2),"s"]})})]})]})]})]})]})})}),t.jsx(J,{span:12,md:6,children:t.jsxs(G,{children:[t.jsx(W,{icon:t.jsx(s,{}),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!==Rt?Rt:(null==Et?void 0:Et.cors_enabled)??!1;return t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:ra,disabled:"loading"===Lt,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"===Lt&&"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"===Lt&&t.jsx(n,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===Lt&&t.jsx(l,{className:"w-4 h-4 text-accent-success"}),"error"===Lt&&t.jsx(r,{className:"w-4 h-4 text-accent-danger"})]})})()})]}),t.jsxs("div",{children:[t.jsx("span",{className:"type-body text-text-primary font-medium block mb-2",children:"Theme"}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Q,{showLogoOnly:!0})}),t.jsx("div",{className:"flex-shrink-0",children:t.jsx(Q,{showThumbnailsOnly:!0})})]})]})]})]})})]}),t.jsx(Z,{template:"auto",children:t.jsxs(G,{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(u,{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:()=>vs(!0),disabled:"allow"===ms,className:_("flex items-center gap-1.5 h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium","allow"===ms?"bg-white/[0.02] text-text-muted cursor-not-allowed":"bg-accent-success/10 hover:bg-accent-success/20 text-accent-success"),children:[t.jsx(m,{className:"w-3.5 h-3.5"}),"Add"]}),t.jsx("button",{onClick:ba,disabled:!bs||"allow"===ms,className:_("h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium",bs&&"allow"!==ms?"bg-accent-primary/10 hover:bg-accent-primary/20 text-accent-primary":"bg-white/[0.02] text-text-muted cursor-not-allowed"),children:"Edit"}),t.jsx("button",{onClick:ya,disabled:!bs||"allow"===ms,className:_("h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium",bs&&"allow"!==ms?"bg-accent-danger/10 hover:bg-accent-danger/20 text-accent-danger":"bg-white/[0.02] text-text-muted cursor-not-allowed"),children:"Delete"})]})]}),t.jsx("div",{className:"bg-white/[0.02] 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"===ms?"bg-accent-success/20":"bg-accent-danger/20"),children:"allow"===ms?t.jsx(x,{className:"w-5 h-5 text-accent-success"}):t.jsx(p,{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-white/[0.02] rounded-full p-1",children:[t.jsx("button",{onClick:()=>pa("deny"),disabled:ps,className:_("px-4 py-1.5 rounded-full transition-colors type-body-sm font-medium","deny"===ms?"bg-accent-danger/20 text-accent-danger":"text-text-muted hover:text-text-secondary",ps&&"opacity-50"),children:"Deny"}),t.jsx("button",{onClick:()=>pa("allow"),disabled:ps,className:_("px-4 py-1.5 rounded-full transition-colors type-body-sm font-medium","allow"===ms?"bg-accent-success/20 text-accent-success":"text-text-muted hover:text-text-secondary",ps&&"opacity-50"),children:"Allow"})]}),ps&&t.jsx(n,{className:"w-4 h-4 animate-spin text-text-muted"})]})]})}),os&&t.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-accent-danger bg-accent-danger/10",children:os}),t.jsx("div",{className:"bg-white/[0.02] rounded-2xl p-4 min-h-[120px]",children:is?t.jsxs("div",{className:"flex items-center justify-center py-6",children:[t.jsx(n,{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===ls.length?t.jsxs("div",{className:"text-center py-6",children:[t.jsx("div",{className:"w-12 h-12 rounded-full bg-white/[0.02] mx-auto mb-3 flex items-center justify-center",children:t.jsx(u,{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:ls.map(e=>t.jsx(le,{node:e,level:0,expandedKeys:gs,selectedKeyId:bs,globalFloodPolicy:ms,onSelect:ys,onToggle:xa},e.id))})})]})}),t.jsx(Z,{template:"auto",children:t.jsxs(G,{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(h,{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:()=>Vt(!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(m,{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(b,{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."})]})]})}),Ht&&t.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-accent-danger bg-accent-danger/10",children:Ht}),Ot&&0===zt.length?t.jsxs("div",{className:"flex items-center justify-center py-6",children:[t.jsx(n,{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..."})]}):zt.length>0?t.jsx("div",{className:"space-y-2",children:zt.map(e=>t.jsx("div",{className:"bg-white/[0.02] hover:bg-white/[0.04] 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(h,{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: ",ia(e.created_at)]}),t.jsxs("span",{className:"type-data-sm text-text-muted truncate",children:["Last used: ",ia(e.last_used)]})]})]})]}),t.jsxs("button",{onClick:()=>Qt({id:e.id,name:e.name}),disabled:ss,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(y,{className:"w-3.5 h-3.5"}),"Revoke"]})]})},e.id))}):t.jsxs("div",{className:"bg-white/[0.02] rounded-2xl p-6 text-center",children:[t.jsx("div",{className:"w-14 h-14 rounded-full bg-white/[0.02] mx-auto mb-4 flex items-center justify-center",children:t.jsx(h,{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:()=>Vt(!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(Z,{template:"auto",children:t.jsxs(G,{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(g,{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-white/[0.02] rounded-2xl border-2 cursor-pointer transition-all",Ms?"border-accent-primary bg-accent-primary/5":"border-transparent hover:border-accent-primary/30","loading"===Hs&&"opacity-50 pointer-events-none"),children:[t.jsx("input",{type:"radio",name:"frontend",checked:Ms,onChange:()=>na(!0),disabled:"loading"===Hs,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-white/[0.02] rounded-2xl border-2 cursor-pointer transition-all",Ms?"border-transparent hover:border-accent-primary/30":"border-accent-primary bg-accent-primary/5","loading"===Hs&&"opacity-50 pointer-events-none"),children:[t.jsx("input",{type:"radio",name:"frontend",checked:!Ms,onChange:()=>na(!1),disabled:"loading"===Hs,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"})]})]})]}),!Os&&t.jsx("div",{className:_("bg-white/[0.02] rounded-2xl p-4",zs?"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",zs?"bg-accent-success/20":"bg-accent-tertiary/20"),children:zs?t.jsx(f,{className:"w-4 h-4 text-accent-success"}):t.jsx(b,{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:zs?"PyMC Console has been detected":"PyMC Console Not Installed"}),zs?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(j,{className:"w-4 h-4"}),"PyMC Console Install Instructions"]})]})]})]})}),Ys&&t.jsx("div",{className:"bg-white/[0.02] 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(v,{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(!Xs){Bs(!0);try{await z(),Vs(!1),setTimeout(()=>{window.location.reload()},2e3)}catch{Vs(!1),setTimeout(()=>{window.location.reload()},3e3)}}},disabled:Xs,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:Xs?t.jsxs(t.Fragment,{children:[t.jsx(n,{className:"w-4 h-4 animate-spin"}),"Restarting..."]}):t.jsxs(t.Fragment,{children:[t.jsx(N,{className:"w-4 h-4"}),"Restart Now"]})})]})})]})]})}),t.jsx(Z,{template:"auto",children:t.jsxs(G,{children:[t.jsx(W,{icon:t.jsx(o,{}),title:"Node Information",largeTitle:!0}),ie?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[t.jsxs("div",{children:[t.jsx("span",{className:"type-label text-text-muted",children:"Node Name"}),t.jsx("p",{className:"type-body text-text-primary mt-1",children:fe})]}),t.jsxs("div",{children:[t.jsx("span",{className:"type-label text-text-muted",children:"Version"}),t.jsxs("p",{className:"type-data text-text-primary mt-1",children:["v",ie.version]})]}),t.jsxs("div",{children:[t.jsx("span",{className:"type-label text-text-muted",children:"Core Version"}),t.jsxs("p",{className:"type-data text-text-primary mt-1",children:["v",ie.core_version]})]}),t.jsxs("div",{children:[t.jsx("span",{className:"type-label text-text-muted",children:"Local Hash"}),t.jsx("div",{className:"mt-1",children:ie.local_hash?t.jsx(V,{hash:ie.local_hash,size:"sm"}):t.jsx("span",{className:"type-data-sm text-text-muted",children:"N/A"})})]})]}),ie.public_key&&t.jsxs("div",{className:"mt-4 pt-4 border-t border-border-subtle",children:[t.jsx("span",{className:"type-label text-text-muted",children:"Public Key"}),t.jsx("div",{className:"mt-1",children:t.jsx(V,{hash:ie.public_key,prefixLength:12,suffixLength:8})})]})]}):t.jsx("p",{className:"text-text-muted",children:"Loading node information..."})]})}),Yt&&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":"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:Xt,onChange:e=>Bt(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&&ca(),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:()=>{Vt(!1),Bt(""),$t(null)},disabled:es,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:es||!Xt.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:es?t.jsxs(t.Fragment,{children:[t.jsx(n,{className:"w-4 h-4 animate-spin"}),"Creating..."]}):"Create Token"})]})]})]})}),Wt&&Ut&&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&&Zt(!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(v,{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:Ut,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:()=>{Ut&&(navigator.clipboard.writeText(Ut),ns(!0),setTimeout(()=>ns(!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:[rs?t.jsx(l,{className:"w-4 h-4 text-accent-success"}):t.jsx(w,{className:"w-4 h-4"}),rs?"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: ',Ut.slice(0,12),'..." ',window.location.origin,"/api/stats"]})]}),t.jsx("div",{className:"flex justify-end mt-6",children:t.jsx("button",{onClick:()=>{Zt(!1),Gt(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(X,{isOpen:!!Jt,title:"Revoke API Token",message:`Are you sure you want to revoke the token '${null==Jt?void 0:Jt.name}'? This action cannot be undone.`,confirmLabel:ss?"Revoking...":"Revoke",cancelLabel:"Cancel",variant:"danger",onConfirm:async()=>{if(Jt){as(!0),$t(null);try{await O(Jt.id),await la(),Qt(null)}catch(e){$t(e instanceof Error?e.message:"Failed to revoke token")}finally{as(!1)}}},onCancel:()=>Qt(null)}),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&&vs(!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:[bs&&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:ma()})]}),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:Es,onChange:e=>Ls(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&&ha(),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:()=>Rs("deny"),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","deny"===Ps?"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:()=>Rs("allow"),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","allow"===Ps?"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:()=>{vs(!1),Ls(""),Rs("deny")},disabled:Is,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:ha,disabled:Is||!Es.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:Is?t.jsxs(t.Fragment,{children:[t.jsx(n,{className:"w-4 h-4 animate-spin"}),"Adding..."]}):"Add Key"})]})]})]})}),Ns&&_s&&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&&ws(!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:_s.name,onChange:e=>Ss({..._s,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:()=>Ss({..._s,floodPolicy:"deny"}),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","deny"===_s.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:()=>Ss({..._s,floodPolicy:"allow"}),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","allow"===_s.floodPolicy?"bg-accent-success/20 text-accent-success border border-accent-success/50":"text-text-muted hover:text-text-secondary"),children:"ALLOW"})]})]}),_s.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:_s.transport_key})]}),t.jsxs("div",{className:"flex justify-between gap-3 mt-6",children:[t.jsx("button",{onClick:()=>{ws(!1),Fs(_s),Cs(!0),Ss(null)},disabled:Is,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:()=>{ws(!1),Ss(null)},disabled:Is,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(_s){As(!0),us(null);try{const e=await $(_s.id,{name:_s.name,flood_policy:_s.floodPolicy});e.success?(await oa(),ws(!1),Ss(null)):us(e.error||"Failed to update transport key")}catch(e){us(e instanceof Error?e.message:"Failed to update transport key")}finally{As(!1)}}},disabled:Is||!_s.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:Is?t.jsxs(t.Fragment,{children:[t.jsx(n,{className:"w-4 h-4 animate-spin"}),"Saving..."]}):"Save"})]})]})]})]})}),ks&&Ts&&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&&Cs(!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:["'",Ts.name,"'"]}),"?"]}),Ts.children&&Ts.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(v,{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 ",Ts.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:()=>{Cs(!1),Fs(null)},disabled:Is,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(Ts){As(!0),us(null);try{const e=await Y(Ts.id);e.success?(await oa(),Cs(!1),Fs(null),ys(null)):us(e.error||"Failed to delete transport key")}catch(e){us(e instanceof Error?e.message:"Failed to delete transport key")}finally{As(!1)}}},disabled:Is,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:Is?t.jsxs(t.Fragment,{children:[t.jsx(n,{className:"w-4 h-4 animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})}export{ce as default};
diff --git a/frontend/dist/assets/Contacts-au5gCj-N.js b/frontend/dist/assets/Contacts-DfRgoaov.js
similarity index 99%
rename from frontend/dist/assets/Contacts-au5gCj-N.js
rename to frontend/dist/assets/Contacts-DfRgoaov.js
index 28c806d0..b023458c 100644
--- a/frontend/dist/assets/Contacts-au5gCj-N.js
+++ b/frontend/dist/assets/Contacts-DfRgoaov.js
@@ -1,2 +1,2 @@
-const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ContactsMapMapLibre-C5vcx8J6.js","assets/vendor-react-O8XH9yVn.js","assets/vendor-core-WoOfkQwm.js","assets/link-scoring-DacI-LFP.js","assets/index-Dp0UlTio.js","assets/ConfirmModal-DYznouaT.js","assets/useThemeColors-CD0TSU03.js","assets/PageLayout-DE5PEtD2.js","assets/HashBadge-aS_UIcg2.js","assets/SignalIndicator-BVAbF7xm.js","assets/CollisionExplorerModal-DEtEH0fD.js","assets/maplibre-gl-B1CfjdFi.css","assets/index-DjRKexsi.css","assets/leaflet-CIGW-MKW.css"])))=>i.map(i=>d[i]);
-import{j as e,r as s,ab as t,a7 as a,z as n,h as l,ac as c,k as i,ad as r,Z as o,ae as d,y as x,A as m,a1 as h,af as p,ag as u,aa as g,a6 as j,a0 as b,a5 as N,ah as v,o as f,ai as y,aj as w,Y as C,ak as k,p as S,al as M,X as L,am as H,an as P,ao as F,ap as E,aq as R,ar as $,as as T,at as _,au as A,av as O}from"./vendor-react-O8XH9yVn.js";import{A as D,B as z,y as G,C as W,E as I,F as K,G as U,H as B,e as V,I as q,h as J,J as Y,K as Z,L as Q,f as X,m as ee,M as se,N as te}from"./index-Dp0UlTio.js";import{P as ae,b as ne}from"./PageLayout-DE5PEtD2.js";import{_ as le}from"./deckgl-DTsmDcfs.js";import{c as ce,L as ie,T as re,a as oe}from"./recharts-BU7auunF.js";import{H as de}from"./HashBadge-aS_UIcg2.js";import{a as xe}from"./SignalIndicator-BVAbF7xm.js";import{C as me}from"./CollisionExplorerModal-DEtEH0fD.js";import{C as he}from"./ConfirmModal-DYznouaT.js";class pe 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 ue=s.lazy(()=>le(()=>import("./ContactsMapMapLibre-C5vcx8J6.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])));function ge({neighbors:t,localNode:a,localHash:n,onRemoveNode:l,selectedNodeHash:c,onNodeSelected:i,highlightedEdgeKey:r,highlightedGhost:o}){return e.jsx(pe,{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(ue,{neighbors:t,localNode:a,localHash:n,onRemoveNode:l,selectedNodeHash:c,onNodeSelected:i,highlightedEdgeKey:r,highlightedGhost:o})})})}function je(e){return e>=.7?"text-accent-success":e>=.5?"text-accent-secondary":e>=.3?"text-signal-poor":"text-accent-danger"}function be(e){return`${Math.round(100*e)}%`}function Ne(e,s){return s.has(e.toUpperCase())}const ve=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=>Ne(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 ${je(s.healthScore)}`,children:be(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=Ne(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]),b=s.useMemo(()=>m.slice(0,o),[m,o]),N=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:[N&&e.jsxs("div",{className:"flex items-center gap-3 text-[10px]",children:[e.jsxs("span",{className:`tabular-nums ${je(N.avgHealth)}`,children:["Avg: ",be(N.avgHealth)]}),N.weakLinks>0&&e.jsxs("span",{className:"text-accent-danger flex items-center gap-1",children:[e.jsx(a,{className:"w-3 h-3"}),N.weakLinks," weak"]}),N.declining>0&&e.jsxs("span",{className:"text-signal-poor flex items-center gap-1",children:[e.jsx(n,{className:"w-3 h-3"}),N.declining," declining"]}),N.pathsWithGhosts>0&&e.jsxs("span",{className:"text-accent-tertiary flex items-center gap-1",children:[e.jsx(l,{className:"w-3 h-3"}),N.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:b.map(s=>e.jsx(ve,{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 ye(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 we={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 Ce({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=we[u],j="clusterId"in(w=t)&&"temporal"in w;var w;const C=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]),k=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,H=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-xs",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:ce("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:ce("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:ce("px-1.5 py-0.5 rounded text-xs font-medium",g.badgeClass),children:g.label})]}),e.jsx("div",{className:ce("text-xs 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-xs 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(b,{className:"w-3 h-3"}),t.commonNeighbors.size]}),t.estimatedLocation&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(N,{className:"w-3 h-3"}),k]}),S&&e.jsxs("span",{className:ce("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&&H&&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-xs",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:H.knownNodeName?e.jsxs("span",{children:["May match ",e.jsx("span",{className:"font-medium",children:H.knownNodeName})," ","(",(100*H.collisionProbability).toFixed(0),"% probability)"]}):e.jsxs("span",{children:["May match ",e.jsx(de,{hash:H.knownNodeHash,size:"sm",className:"inline"})," ","(",(100*H.collisionProbability).toFixed(0),"% probability)"]})}),H.evidence&&e.jsxs("div",{className:"text-text-muted mt-1 text-[10px]",children:[H.evidence.sharedEdgeCount>0&&e.jsxs("span",{className:"mr-2",children:[H.evidence.sharedEdgeCount," shared edges"]}),void 0!==H.evidence.distanceKm&&e.jsxs("span",{className:"mr-2",children:[H.evidence.distanceKm.toFixed(1),"km apart"]}),H.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(N,{className:"w-4 h-4 text-accent-primary mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-xs",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: ",k]}),j&&t.location&&e.jsxs("div",{className:"mt-1 text-text-muted",children:[e.jsxs("div",{children:["Method: ",ye(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-xs 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-xs",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-xs",children:[e.jsxs("div",{className:"text-text-primary",children:["First seen: ",W(t.firstSeen)," ago"]}),e.jsxs("div",{className:"text-text-muted",children:["Last seen: ",W(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-xs",children:[e.jsxs("div",{className:"text-text-primary",children:["Active period: ",W(t.firstSeen)," – ",W(t.lastSeen)," ago"]}),t.temporal&&e.jsxs("div",{className:"text-text-muted",children:["Obs/hour avg: ",t.temporal.observationsPerHour.toFixed(1)]})]})]}),C.length>0&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(b,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-xs",children:[e.jsxs("div",{className:"text-text-muted mb-1",children:["Adjacent to ",C.length," known node",1!==C.length?"s":"",":"]}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[C.slice(0,5).map(({hash:s})=>e.jsx(de,{hash:s,size:"sm"},s)),C.length>5&&e.jsxs("span",{className:"text-text-muted",children:["+",C.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(ke,{label:"Candidates",passed:t.validationStages.candidateExhaustion}),e.jsx(ke,{label:"Temporal",passed:t.validationStages.temporalConsistency}),e.jsx(ke,{label:"Topology",passed:t.validationStages.topologicalFit}),e.jsx(ke,{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 ke({label:s,passed:t}){return e.jsxs("span",{className:ce("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(C,{className:"w-2.5 h-2.5"}),s]})}function Se({neighbors:t,className:n,onGhostSelect:r}){const o=G(),d=z(),[x,b]=s.useState(new Set),[N,v]=s.useState("actionable"),[f,y]=s.useState(!1),[w,C]=s.useState(!0),[k,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,k)),[o,k]),L=s.useMemo(()=>{const e=Array.from(x);return e.length>0?e[0]:null},[x]),H=s.useMemo(()=>L?M.find(e=>e.prefix===L)??null:null,[L,M]);s.useEffect(()=>{r&&r(H&&!w?{prefix:H.prefix,commonNeighbors:Array.from(H.commonNeighbors),estimatedLocation:H.estimatedLocation}:null)},[H,w,r]),s.useEffect(()=>{w&&b(new Set)},[w]);const{confirmed:P,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=>{b(s=>s.has(e)?new Set:new Set([e]))},_="all"===N,A=P.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:ce("flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors","all"===N?"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"===N?"Actionable":"All"]}),e.jsx("button",{onClick:()=>C(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:()=>C(!1),children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[P.length>0&&e.jsxs("span",{className:"flex items-center gap-1 text-accent-success",children:[e.jsx(u,{className:"w-3 h-3"}),P.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:[P.length>0&&e.jsxs("span",{className:"text-accent-success",children:[P.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:[P.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 (",P.length,")"]})]}),e.jsx("div",{className:"space-y-2",children:P.map(s=>e.jsx(Ce,{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(Ce,{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(Ce,{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"===N&&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(Ce,{ghost:s,neighbors:t,isExpanded:!1,onToggle:()=>{},compact:!0},s.prefix))})]}),"actionable"===N&&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&&A>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 Me="var(--sparkline-critical)",Le="var(--sparkline-poor)",He="var(--sparkline-fair)",Pe="var(--sparkline-good)",Fe="var(--sparkline-excellent)";function Ee({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 Re=s.memo(function({nodeHash:s,width:t=60,height:a=20,color:n,showArea:l=!0,showTooltip:c=!1,className:i=""}){const r=I(s),o=K(),d=!U().backgroundLoadComplete||o,x=n??(r.length>0?function(e){if(0===e.length)return Me;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 Me;if(n>0){const e=a/n;return e>=1.2?Fe:e>=.8?Pe:e>=.4?He:e>=.1?Le:Me}return t>=10?Fe:t>=5?Pe:t>=2?He:t>=1?Le:Me}(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:Me},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(ie,{data:r,width:m,height:h,margin:{top:1,right:1,bottom:1,left:1},children:[c&&e.jsx(re,{content:e.jsx(Ee,{}),cursor:{stroke:"rgba(255,255,255,0.2)",strokeWidth:1}}),e.jsx(oe,{type:"monotone",dataKey:"count",stroke:x,strokeWidth:1.5,dot:!1,isAnimationActive:!1})]})})}),$e=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",b=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:b,"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(k,{className:u})}),e.jsx(me,{isOpen:i,prefix:x.prefix,candidateHashes:x.candidateHashes,onClose:p})]})});function Te(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 _e=Object.freeze(Object.defineProperty({__proto__:null,default:function(){const{stats:t}=q(),a=J(),n=Y(),l=Z(),c=Q(),r=X(),o=G(),x=ee(),[m,h]=s.useState(null),[p,u]=s.useState("lastHeard"),[j,v]=s.useState("desc"),[y,w]=s.useState(""),[C,k]=s.useState(!1),[D,z]=s.useState(null),[W,I]=s.useState(null),[K,U]=s.useState(null),[B,V]=s.useState(null),[le,ce]=s.useState(new Map),[ie,re]=s.useState(new Map),[oe,me]=s.useState(25),[pe,ue]=s.useState(25),je=s.useRef(null),[be,Ne]=s.useState(!1),ve=s.useMemo(()=>(null==t?void 0:t.neighbors)??{},[null==t?void 0:t.neighbors]),ye=s.useMemo(()=>Object.fromEntries(Object.entries(ve).filter(([e])=>!a.has(e))),[ve,a]),we=s.useMemo(()=>{var e;return(null==(e=null==t?void 0:t.config)?void 0:e.repeater)?{latitude:t.config.repeater.latitude,longitude:t.config.repeater.longitude,name:t.config.node_name||"Local Node"}:void 0},[t]),Ce=null==t?void 0:t.local_hash,ke=s.useMemo(()=>{const e=new Map;if(!(null==we?void 0:we.latitude)||!(null==we?void 0:we.longitude))return e;for(const[s,t]of Object.entries(ye))t.latitude&&t.longitude&&0!==t.latitude&&0!==t.longitude?e.set(s,Te(we.latitude,we.longitude,t.latitude,t.longitude)):e.set(s,null);return e},[ye,we]),{neighborHashSet:Me,neighborSignalMap:Le}=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]),He=s.useMemo(()=>{const e=y.toLowerCase().trim(),s="neighbor"===e||"neighbors"===e,t=C||s;return Object.fromEntries(Object.entries(ye).filter(([a,n])=>{if(t&&!Me.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)}))},[ye,y,C,Me]),Pe=s.useMemo(()=>Object.entries(He).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=ke.get(e)??null,a=ke.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}),[He,p,j,ke,c]),Fe=Pe.filter(([,e])=>e.latitude&&e.longitude&&0!==e.latitude&&0!==e.longitude).length,Ee=s.useMemo(()=>new Set(l),[l]),_e=s.useMemo(()=>0===oe?Pe:Pe.slice(0,pe),[Pe,pe,oe]);s.useEffect(()=>{ue(oe||Pe.length)},[p,j,y,C,oe,Pe.length]),s.useEffect(()=>{if(0===oe)return;const e=new IntersectionObserver(e=>{e[0].isIntersecting&&peMath.min(e+oe,Pe.length))},{threshold:.1,rootMargin:"100px"});return je.current&&e.observe(je.current),()=>e.disconnect()},[oe,pe,Pe.length]);const Ae=s.useCallback(e=>{me(e),ue(e||Pe.length),Ne(!1)},[Pe.length]),Oe=s.useCallback(e=>{p===e?v(e=>"desc"===e?"asc":"desc"):(u(e),v("desc"))},[p]),De=s.useCallback(e=>{const s=ye[e];(null==s?void 0:s.latitude)&&(null==s?void 0:s.longitude)&&0!==s.latitude&&0!==s.longitude&&z(e)},[ye]),ze=s.useCallback(()=>{z(null)},[]),Ge=s.useCallback(async(e,s)=>{if(s.stopPropagation(),!B){V(e),ce(s=>{const t=new Map(s);return t.delete(e),t}),re(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 se(s,30);t.success&&t.data?(ce(s=>new Map(s).set(e,t.data)),setTimeout(()=>{ce(s=>{const t=new Map(s);return t.delete(e),t})},1e4)):(re(s=>new Map(s).set(e,t.error||"Ping failed")),setTimeout(()=>{re(s=>{const t=new Map(s);return t.delete(e),t})},5e3))}catch(t){const s=t instanceof Error?t.message:"Ping failed";re(t=>new Map(t).set(e,s)),setTimeout(()=>{re(s=>{const t=new Map(s);return t.delete(e),t})},5e3)}finally{V(null)}}},[B]);return e.jsxs(ae,{children:[e.jsx(ne,{title:"Contacts",icon:e.jsx(b,{}),controls:e.jsxs("div",{className:"flex items-baseline gap-3 sm:gap-4",children:[e.jsxs("span",{className:"roster-title tabular-nums",children:[Pe.length," node",1!==Pe.length?"s":""]}),Fe>0&&e.jsxs("span",{className:"roster-title flex items-baseline gap-1.5 tabular-nums",children:[e.jsx(N,{className:"w-3.5 h-3.5 relative top-[2px]"}),Fe," with location"]})]})}),x?e.jsx(ge,{neighbors:ye,localNode:we,localHash:Ce,onRemoveNode:n,selectedNodeHash:D,onNodeSelected:ze,highlightedEdgeKey:W,highlightedGhost:K}):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(fe,{maxPaths:10,highlightedEdge:W,onHighlightEdge:I}),o.length>0&&(x?e.jsx("div",{className:"chart-container",children:e.jsx(Se,{neighbors:ye,onGhostSelect:U})}):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(b,{className:"chart-title-icon"}),"Discovered Contacts"]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[Me.size>0&&e.jsxs("button",{onClick:()=>k(!C),className:"flex items-center gap-1 px-1.5 sm:px-2.5 py-1.5 text-xs rounded-lg transition-colors "+(C?"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:C?"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:Me.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-xs 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()||k(!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:()=>Oe("lastHeard"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-xs 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(H,{className:"w-3 h-3 "+("asc"===j?"rotate-180":"")})]}),e.jsxs("button",{onClick:()=>Oe("distance"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-xs 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(P,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Distance"}),"distance"===p&&e.jsx(H,{className:"w-3 h-3 "+("asc"===j?"rotate-180":"")})]}),e.jsxs("button",{onClick:()=>Oe("centrality"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-xs 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(H,{className:"w-3 h-3 "+("asc"===j?"rotate-180":"")})]})]}),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>Ne(!be),className:"flex items-center gap-1 px-2 py-1.5 text-xs 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===oe?"All":oe}),e.jsx(i,{className:"w-3 h-3 transition-transform "+(be?"rotate-180":"")})]}),be&&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:()=>Ae(s),className:"w-full px-3 py-1.5 text-xs text-left hover:bg-white/5 transition-colors "+(oe===s?"text-accent-primary":"text-text-secondary"),children:0===s?"All":s},s))})]})]})]}),Pe.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:_e.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=Ee.has(s),r=Me.has(s),o=ke.get(s),x=c.get(s)||0,m=r?Le.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,b="companion"===u||"client"===u||"cli"===u,N=t.is_repeater||"repeater"===u||"rep"===u,v=r?"direct":"flood",f=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:()=>De(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 "+(w=m.avgSnr,void 0===w?"bg-[var(--signal-unknown)]":w>=5?"bg-[var(--signal-excellent)]":w>=0?"bg-[var(--signal-good)]":w>=-5?"bg-[var(--signal-fair)]":w>=-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:f,children:j&&N?e.jsxs("div",{className:"relative w-5 h-5",children:[e.jsx(F,{className:"w-5 h-5 absolute inset-0 text-accent-secondary"}),e.jsx(E,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-accent-primary"})]}):j?e.jsx(F,{className:"w-5 h-5 text-accent-secondary"}):b?e.jsx(R,{className:"w-5 h-5 text-text-muted"}):N?"direct"===v?e.jsx($,{className:"w-5 h-5 text-accent-success"}):e.jsx(E,{className:"w-5 h-5 text-accent-tertiary"}):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("span",{className:"type-badge px-1.5 py-0.5 rounded flex-shrink-0",style:{backgroundColor:"rgba(113, 152, 114, 0.2)",color:"var(--accent-success)"},children:"NBR"}),i&&e.jsxs("span",{className:"type-badge px-1.5 py-0.5 rounded flex items-center gap-1 flex-shrink-0",style:{backgroundColor:"rgba(223, 188, 114, 0.2)",color:"var(--accent-secondary)"},children:[e.jsx(T,{className:"w-3 h-3"}),"HUB"]}),N&&e.jsx("span",{className:"pill-tag flex-shrink-0",children:"RPT"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx(de,{hash:s,size:"xs",prefixLength:8,suffixLength:6}),e.jsx($e,{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(xe,{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(P,{className:"w-3 h-3"}),e.jsx("span",{className:"type-data-xs tabular-nums",children:(y=o,y<1e3?`${Math.round(y)}m`:`${(y/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(Re,{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?te(t.last_seen):"—"})}),e.jsxs("div",{className:"contacts-col-actions flex items-center justify-end gap-1",children:[r&&e.jsx(e.Fragment,{children:le.has(s)?e.jsxs("div",{className:"flex items-center gap-1 text-accent-success",title:`RTT: ${le.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:[le.get(s).snr_db.toFixed(1),"dB"]})]}):ie.has(s)?e.jsx("span",{className:"text-red-400 text-[10px]",title:ie.get(s),children:"✗"}):e.jsx("button",{onClick:e=>Ge(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(A,{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(O,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]},s);var y,w})}),oe>0&&pe0&&peue(e=>Math.min(e+oe,Pe.length)),className:"text-accent-primary hover:text-accent-primary/80 transition-colors",children:"Load more"})]})]}):e.jsxs("div",{className:"roster-empty",children:[e.jsx(b,{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(he,{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{_e as C,Re as N,$e as P};
+const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ContactsMapMapLibre-CEbwjfzP.js","assets/vendor-react-O8XH9yVn.js","assets/vendor-core-WoOfkQwm.js","assets/link-scoring-Bg3LiwiV.js","assets/index-DGrzd8xb.js","assets/ConfirmModal-DYznouaT.js","assets/useThemeColors-CD0TSU03.js","assets/PageLayout-DE5PEtD2.js","assets/HashBadge-aS_UIcg2.js","assets/SignalIndicator-BVAbF7xm.js","assets/CollisionExplorerModal-dc7PClY6.js","assets/maplibre-gl-B1CfjdFi.css","assets/index-DjRKexsi.css","assets/leaflet-CIGW-MKW.css"])))=>i.map(i=>d[i]);
+import{j as e,r as s,ab as t,a7 as a,z as n,h as l,ac as c,k as i,ad as r,Z as o,ae as d,y as x,A as m,a1 as h,af as p,ag as u,aa as g,a6 as j,a0 as b,a5 as N,ah as v,o as f,ai as y,aj as w,Y as C,ak as k,p as S,al as M,X as L,am as H,an as P,ao as F,ap as E,aq as R,ar as $,as as T,at as _,au as A,av as O}from"./vendor-react-O8XH9yVn.js";import{A as D,B as z,y as G,C as W,E as I,F as K,G as U,H as B,e as V,I as q,h as J,J as Y,K as Z,L as Q,f as X,m as ee,M as se,N as te}from"./index-DGrzd8xb.js";import{P as ae,b as ne}from"./PageLayout-DE5PEtD2.js";import{_ as le}from"./deckgl-DTsmDcfs.js";import{c as ce,L as ie,T as re,a as oe}from"./recharts-BU7auunF.js";import{H as de}from"./HashBadge-aS_UIcg2.js";import{a as xe}from"./SignalIndicator-BVAbF7xm.js";import{C as me}from"./CollisionExplorerModal-dc7PClY6.js";import{C as he}from"./ConfirmModal-DYznouaT.js";class pe 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 ue=s.lazy(()=>le(()=>import("./ContactsMapMapLibre-CEbwjfzP.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])));function ge({neighbors:t,localNode:a,localHash:n,onRemoveNode:l,selectedNodeHash:c,onNodeSelected:i,highlightedEdgeKey:r,highlightedGhost:o}){return e.jsx(pe,{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(ue,{neighbors:t,localNode:a,localHash:n,onRemoveNode:l,selectedNodeHash:c,onNodeSelected:i,highlightedEdgeKey:r,highlightedGhost:o})})})}function je(e){return e>=.7?"text-accent-success":e>=.5?"text-accent-secondary":e>=.3?"text-signal-poor":"text-accent-danger"}function be(e){return`${Math.round(100*e)}%`}function Ne(e,s){return s.has(e.toUpperCase())}const ve=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=>Ne(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 ${je(s.healthScore)}`,children:be(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=Ne(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]),b=s.useMemo(()=>m.slice(0,o),[m,o]),N=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:[N&&e.jsxs("div",{className:"flex items-center gap-3 text-[10px]",children:[e.jsxs("span",{className:`tabular-nums ${je(N.avgHealth)}`,children:["Avg: ",be(N.avgHealth)]}),N.weakLinks>0&&e.jsxs("span",{className:"text-accent-danger flex items-center gap-1",children:[e.jsx(a,{className:"w-3 h-3"}),N.weakLinks," weak"]}),N.declining>0&&e.jsxs("span",{className:"text-signal-poor flex items-center gap-1",children:[e.jsx(n,{className:"w-3 h-3"}),N.declining," declining"]}),N.pathsWithGhosts>0&&e.jsxs("span",{className:"text-accent-tertiary flex items-center gap-1",children:[e.jsx(l,{className:"w-3 h-3"}),N.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:b.map(s=>e.jsx(ve,{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 ye(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 we={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 Ce({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=we[u],j="clusterId"in(w=t)&&"temporal"in w;var w;const C=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]),k=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,H=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-xs",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:ce("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:ce("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:ce("px-1.5 py-0.5 rounded text-xs font-medium",g.badgeClass),children:g.label})]}),e.jsx("div",{className:ce("text-xs 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-xs 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(b,{className:"w-3 h-3"}),t.commonNeighbors.size]}),t.estimatedLocation&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(N,{className:"w-3 h-3"}),k]}),S&&e.jsxs("span",{className:ce("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&&H&&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-xs",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:H.knownNodeName?e.jsxs("span",{children:["May match ",e.jsx("span",{className:"font-medium",children:H.knownNodeName})," ","(",(100*H.collisionProbability).toFixed(0),"% probability)"]}):e.jsxs("span",{children:["May match ",e.jsx(de,{hash:H.knownNodeHash,size:"sm",className:"inline"})," ","(",(100*H.collisionProbability).toFixed(0),"% probability)"]})}),H.evidence&&e.jsxs("div",{className:"text-text-muted mt-1 text-[10px]",children:[H.evidence.sharedEdgeCount>0&&e.jsxs("span",{className:"mr-2",children:[H.evidence.sharedEdgeCount," shared edges"]}),void 0!==H.evidence.distanceKm&&e.jsxs("span",{className:"mr-2",children:[H.evidence.distanceKm.toFixed(1),"km apart"]}),H.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(N,{className:"w-4 h-4 text-accent-primary mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-xs",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: ",k]}),j&&t.location&&e.jsxs("div",{className:"mt-1 text-text-muted",children:[e.jsxs("div",{children:["Method: ",ye(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-xs 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-xs",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-xs",children:[e.jsxs("div",{className:"text-text-primary",children:["First seen: ",W(t.firstSeen)," ago"]}),e.jsxs("div",{className:"text-text-muted",children:["Last seen: ",W(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-xs",children:[e.jsxs("div",{className:"text-text-primary",children:["Active period: ",W(t.firstSeen)," – ",W(t.lastSeen)," ago"]}),t.temporal&&e.jsxs("div",{className:"text-text-muted",children:["Obs/hour avg: ",t.temporal.observationsPerHour.toFixed(1)]})]})]}),C.length>0&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(b,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-xs",children:[e.jsxs("div",{className:"text-text-muted mb-1",children:["Adjacent to ",C.length," known node",1!==C.length?"s":"",":"]}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[C.slice(0,5).map(({hash:s})=>e.jsx(de,{hash:s,size:"sm"},s)),C.length>5&&e.jsxs("span",{className:"text-text-muted",children:["+",C.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(ke,{label:"Candidates",passed:t.validationStages.candidateExhaustion}),e.jsx(ke,{label:"Temporal",passed:t.validationStages.temporalConsistency}),e.jsx(ke,{label:"Topology",passed:t.validationStages.topologicalFit}),e.jsx(ke,{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 ke({label:s,passed:t}){return e.jsxs("span",{className:ce("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(C,{className:"w-2.5 h-2.5"}),s]})}function Se({neighbors:t,className:n,onGhostSelect:r}){const o=G(),d=z(),[x,b]=s.useState(new Set),[N,v]=s.useState("actionable"),[f,y]=s.useState(!1),[w,C]=s.useState(!0),[k,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,k)),[o,k]),L=s.useMemo(()=>{const e=Array.from(x);return e.length>0?e[0]:null},[x]),H=s.useMemo(()=>L?M.find(e=>e.prefix===L)??null:null,[L,M]);s.useEffect(()=>{r&&r(H&&!w?{prefix:H.prefix,commonNeighbors:Array.from(H.commonNeighbors),estimatedLocation:H.estimatedLocation}:null)},[H,w,r]),s.useEffect(()=>{w&&b(new Set)},[w]);const{confirmed:P,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=>{b(s=>s.has(e)?new Set:new Set([e]))},_="all"===N,A=P.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:ce("flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors","all"===N?"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"===N?"Actionable":"All"]}),e.jsx("button",{onClick:()=>C(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:()=>C(!1),children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[P.length>0&&e.jsxs("span",{className:"flex items-center gap-1 text-accent-success",children:[e.jsx(u,{className:"w-3 h-3"}),P.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:[P.length>0&&e.jsxs("span",{className:"text-accent-success",children:[P.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:[P.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 (",P.length,")"]})]}),e.jsx("div",{className:"space-y-2",children:P.map(s=>e.jsx(Ce,{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(Ce,{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(Ce,{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"===N&&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(Ce,{ghost:s,neighbors:t,isExpanded:!1,onToggle:()=>{},compact:!0},s.prefix))})]}),"actionable"===N&&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&&A>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 Me="var(--sparkline-critical)",Le="var(--sparkline-poor)",He="var(--sparkline-fair)",Pe="var(--sparkline-good)",Fe="var(--sparkline-excellent)";function Ee({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 Re=s.memo(function({nodeHash:s,width:t=60,height:a=20,color:n,showArea:l=!0,showTooltip:c=!1,className:i=""}){const r=I(s),o=K(),d=!U().backgroundLoadComplete||o,x=n??(r.length>0?function(e){if(0===e.length)return Me;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 Me;if(n>0){const e=a/n;return e>=1.2?Fe:e>=.8?Pe:e>=.4?He:e>=.1?Le:Me}return t>=10?Fe:t>=5?Pe:t>=2?He:t>=1?Le:Me}(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:Me},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(ie,{data:r,width:m,height:h,margin:{top:1,right:1,bottom:1,left:1},children:[c&&e.jsx(re,{content:e.jsx(Ee,{}),cursor:{stroke:"rgba(255,255,255,0.2)",strokeWidth:1}}),e.jsx(oe,{type:"monotone",dataKey:"count",stroke:x,strokeWidth:1.5,dot:!1,isAnimationActive:!1})]})})}),$e=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",b=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:b,"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(k,{className:u})}),e.jsx(me,{isOpen:i,prefix:x.prefix,candidateHashes:x.candidateHashes,onClose:p})]})});function Te(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 _e=Object.freeze(Object.defineProperty({__proto__:null,default:function(){const{stats:t}=q(),a=J(),n=Y(),l=Z(),c=Q(),r=X(),o=G(),x=ee(),[m,h]=s.useState(null),[p,u]=s.useState("lastHeard"),[j,v]=s.useState("desc"),[y,w]=s.useState(""),[C,k]=s.useState(!1),[D,z]=s.useState(null),[W,I]=s.useState(null),[K,U]=s.useState(null),[B,V]=s.useState(null),[le,ce]=s.useState(new Map),[ie,re]=s.useState(new Map),[oe,me]=s.useState(25),[pe,ue]=s.useState(25),je=s.useRef(null),[be,Ne]=s.useState(!1),ve=s.useMemo(()=>(null==t?void 0:t.neighbors)??{},[null==t?void 0:t.neighbors]),ye=s.useMemo(()=>Object.fromEntries(Object.entries(ve).filter(([e])=>!a.has(e))),[ve,a]),we=s.useMemo(()=>{var e;return(null==(e=null==t?void 0:t.config)?void 0:e.repeater)?{latitude:t.config.repeater.latitude,longitude:t.config.repeater.longitude,name:t.config.node_name||"Local Node"}:void 0},[t]),Ce=null==t?void 0:t.local_hash,ke=s.useMemo(()=>{const e=new Map;if(!(null==we?void 0:we.latitude)||!(null==we?void 0:we.longitude))return e;for(const[s,t]of Object.entries(ye))t.latitude&&t.longitude&&0!==t.latitude&&0!==t.longitude?e.set(s,Te(we.latitude,we.longitude,t.latitude,t.longitude)):e.set(s,null);return e},[ye,we]),{neighborHashSet:Me,neighborSignalMap:Le}=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]),He=s.useMemo(()=>{const e=y.toLowerCase().trim(),s="neighbor"===e||"neighbors"===e,t=C||s;return Object.fromEntries(Object.entries(ye).filter(([a,n])=>{if(t&&!Me.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)}))},[ye,y,C,Me]),Pe=s.useMemo(()=>Object.entries(He).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=ke.get(e)??null,a=ke.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}),[He,p,j,ke,c]),Fe=Pe.filter(([,e])=>e.latitude&&e.longitude&&0!==e.latitude&&0!==e.longitude).length,Ee=s.useMemo(()=>new Set(l),[l]),_e=s.useMemo(()=>0===oe?Pe:Pe.slice(0,pe),[Pe,pe,oe]);s.useEffect(()=>{ue(oe||Pe.length)},[p,j,y,C,oe,Pe.length]),s.useEffect(()=>{if(0===oe)return;const e=new IntersectionObserver(e=>{e[0].isIntersecting&&peMath.min(e+oe,Pe.length))},{threshold:.1,rootMargin:"100px"});return je.current&&e.observe(je.current),()=>e.disconnect()},[oe,pe,Pe.length]);const Ae=s.useCallback(e=>{me(e),ue(e||Pe.length),Ne(!1)},[Pe.length]),Oe=s.useCallback(e=>{p===e?v(e=>"desc"===e?"asc":"desc"):(u(e),v("desc"))},[p]),De=s.useCallback(e=>{const s=ye[e];(null==s?void 0:s.latitude)&&(null==s?void 0:s.longitude)&&0!==s.latitude&&0!==s.longitude&&z(e)},[ye]),ze=s.useCallback(()=>{z(null)},[]),Ge=s.useCallback(async(e,s)=>{if(s.stopPropagation(),!B){V(e),ce(s=>{const t=new Map(s);return t.delete(e),t}),re(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 se(s,30);t.success&&t.data?(ce(s=>new Map(s).set(e,t.data)),setTimeout(()=>{ce(s=>{const t=new Map(s);return t.delete(e),t})},1e4)):(re(s=>new Map(s).set(e,t.error||"Ping failed")),setTimeout(()=>{re(s=>{const t=new Map(s);return t.delete(e),t})},5e3))}catch(t){const s=t instanceof Error?t.message:"Ping failed";re(t=>new Map(t).set(e,s)),setTimeout(()=>{re(s=>{const t=new Map(s);return t.delete(e),t})},5e3)}finally{V(null)}}},[B]);return e.jsxs(ae,{children:[e.jsx(ne,{title:"Contacts",icon:e.jsx(b,{}),controls:e.jsxs("div",{className:"flex items-baseline gap-3 sm:gap-4",children:[e.jsxs("span",{className:"roster-title tabular-nums",children:[Pe.length," node",1!==Pe.length?"s":""]}),Fe>0&&e.jsxs("span",{className:"roster-title flex items-baseline gap-1.5 tabular-nums",children:[e.jsx(N,{className:"w-3.5 h-3.5 relative top-[2px]"}),Fe," with location"]})]})}),x?e.jsx(ge,{neighbors:ye,localNode:we,localHash:Ce,onRemoveNode:n,selectedNodeHash:D,onNodeSelected:ze,highlightedEdgeKey:W,highlightedGhost:K}):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(fe,{maxPaths:10,highlightedEdge:W,onHighlightEdge:I}),o.length>0&&(x?e.jsx("div",{className:"chart-container",children:e.jsx(Se,{neighbors:ye,onGhostSelect:U})}):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(b,{className:"chart-title-icon"}),"Discovered Contacts"]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[Me.size>0&&e.jsxs("button",{onClick:()=>k(!C),className:"flex items-center gap-1 px-1.5 sm:px-2.5 py-1.5 text-xs rounded-lg transition-colors "+(C?"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:C?"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:Me.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-xs 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()||k(!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:()=>Oe("lastHeard"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-xs 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(H,{className:"w-3 h-3 "+("asc"===j?"rotate-180":"")})]}),e.jsxs("button",{onClick:()=>Oe("distance"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-xs 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(P,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Distance"}),"distance"===p&&e.jsx(H,{className:"w-3 h-3 "+("asc"===j?"rotate-180":"")})]}),e.jsxs("button",{onClick:()=>Oe("centrality"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-xs 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(H,{className:"w-3 h-3 "+("asc"===j?"rotate-180":"")})]})]}),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>Ne(!be),className:"flex items-center gap-1 px-2 py-1.5 text-xs 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===oe?"All":oe}),e.jsx(i,{className:"w-3 h-3 transition-transform "+(be?"rotate-180":"")})]}),be&&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:()=>Ae(s),className:"w-full px-3 py-1.5 text-xs text-left hover:bg-white/5 transition-colors "+(oe===s?"text-accent-primary":"text-text-secondary"),children:0===s?"All":s},s))})]})]})]}),Pe.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:_e.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=Ee.has(s),r=Me.has(s),o=ke.get(s),x=c.get(s)||0,m=r?Le.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,b="companion"===u||"client"===u||"cli"===u,N=t.is_repeater||"repeater"===u||"rep"===u,v=r?"direct":"flood",f=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:()=>De(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 "+(w=m.avgSnr,void 0===w?"bg-[var(--signal-unknown)]":w>=5?"bg-[var(--signal-excellent)]":w>=0?"bg-[var(--signal-good)]":w>=-5?"bg-[var(--signal-fair)]":w>=-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:f,children:j&&N?e.jsxs("div",{className:"relative w-5 h-5",children:[e.jsx(F,{className:"w-5 h-5 absolute inset-0 text-accent-secondary"}),e.jsx(E,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-accent-primary"})]}):j?e.jsx(F,{className:"w-5 h-5 text-accent-secondary"}):b?e.jsx(R,{className:"w-5 h-5 text-text-muted"}):N?"direct"===v?e.jsx($,{className:"w-5 h-5 text-accent-success"}):e.jsx(E,{className:"w-5 h-5 text-accent-tertiary"}):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("span",{className:"type-badge px-1.5 py-0.5 rounded flex-shrink-0",style:{backgroundColor:"rgba(113, 152, 114, 0.2)",color:"var(--accent-success)"},children:"NBR"}),i&&e.jsxs("span",{className:"type-badge px-1.5 py-0.5 rounded flex items-center gap-1 flex-shrink-0",style:{backgroundColor:"rgba(223, 188, 114, 0.2)",color:"var(--accent-secondary)"},children:[e.jsx(T,{className:"w-3 h-3"}),"HUB"]}),N&&e.jsx("span",{className:"pill-tag flex-shrink-0",children:"RPT"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx(de,{hash:s,size:"xs",prefixLength:8,suffixLength:6}),e.jsx($e,{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(xe,{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(P,{className:"w-3 h-3"}),e.jsx("span",{className:"type-data-xs tabular-nums",children:(y=o,y<1e3?`${Math.round(y)}m`:`${(y/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(Re,{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?te(t.last_seen):"—"})}),e.jsxs("div",{className:"contacts-col-actions flex items-center justify-end gap-1",children:[r&&e.jsx(e.Fragment,{children:le.has(s)?e.jsxs("div",{className:"flex items-center gap-1 text-accent-success",title:`RTT: ${le.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:[le.get(s).snr_db.toFixed(1),"dB"]})]}):ie.has(s)?e.jsx("span",{className:"text-red-400 text-[10px]",title:ie.get(s),children:"✗"}):e.jsx("button",{onClick:e=>Ge(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(A,{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(O,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]},s);var y,w})}),oe>0&&pe0&&peue(e=>Math.min(e+oe,Pe.length)),className:"text-accent-primary hover:text-accent-primary/80 transition-colors",children:"Load more"})]})]}):e.jsxs("div",{className:"roster-empty",children:[e.jsx(b,{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(he,{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{_e as C,Re as N,$e as P};
diff --git a/frontend/dist/assets/ContactsMapMapLibre-C5vcx8J6.js b/frontend/dist/assets/ContactsMapMapLibre-CEbwjfzP.js
similarity index 99%
rename from frontend/dist/assets/ContactsMapMapLibre-C5vcx8J6.js
rename to frontend/dist/assets/ContactsMapMapLibre-CEbwjfzP.js
index 9efdafad..726e981d 100644
--- a/frontend/dist/assets/ContactsMapMapLibre-C5vcx8J6.js
+++ b/frontend/dist/assets/ContactsMapMapLibre-CEbwjfzP.js
@@ -1 +1 @@
-import{r as A,b as e,j as t,aa as r,ab as n,b9 as o,ba as i,h as a,at as s,ao as l,V as c,a2 as u,ad as d,k as f,aP as g,bb as h,bc as m,bd as b,be as p,af as x,A as v,aL as w,Z as y,bf as k,bg as C,bh as B,c as M,bi as D,X as E,bj as N,a8 as Q,bk as j,av as P,b2 as F,bl as S,$ as L,o as I,an as R,a5 as T,bm as _,au as H,b5 as z,b6 as G,b8 as O,b4 as U,bn as Y}from"./vendor-react-O8XH9yVn.js";import"./maplibre-gl-Bk5DsYkB.js";import{L as W,c as V}from"./link-scoring-DacI-LFP.js";import{y as Z,B as K,T as J,at as X,au as q,av as $,e as AA,aw as eA,M as tA,N as rA,ax as nA,ay as oA,f as iA,G as aA,az as sA,aA as lA}from"./index-Dp0UlTio.js";import{C as cA}from"./ConfirmModal-DYznouaT.js";import{c as uA}from"./recharts-BU7auunF.js";import{g as dA,f as fA,h as gA,i as hA}from"./useThemeColors-CD0TSU03.js";import{p as mA,a as bA}from"./vendor-core-WoOfkQwm.js";import{P as pA,N as xA}from"./Contacts-au5gCj-N.js";import"./deckgl-DTsmDcfs.js";import"./PageLayout-DE5PEtD2.js";import"./HashBadge-aS_UIcg2.js";import"./SignalIndicator-BVAbF7xm.js";import"./CollisionExplorerModal-DEtEH0fD.js";import"./leaflet-D_ckmI2R.js";function vA(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}function wA({label:A,icon:e,status:n,detail:o}){return t.jsxs("div",{className:uA("flex items-center gap-3 py-3 px-4 rounded-xl transition-all duration-300","active"===n&&"bg-accent-primary/10","complete"===n&&"bg-accent-success/10","pending"===n&&"opacity-40"),children:[t.jsx("div",{className:uA("w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 transition-all duration-300","active"===n&&"bg-accent-primary/20","complete"===n&&"bg-accent-success/20","pending"===n&&"bg-white/5"),children:"complete"===n?t.jsx(r,{className:"w-4 h-4 text-accent-success"}):"active"===n?t.jsx(s,{className:"w-4 h-4 animate-spin text-accent-primary"}):t.jsx("span",{className:"text-text-muted",children:e})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:uA("text-sm font-medium transition-colors","active"===n&&"text-accent-primary","complete"===n&&"text-accent-success","pending"===n&&"text-text-muted"),children:A}),o&&"pending"!==n&&t.jsx("div",{className:"text-xs text-text-muted mt-0.5 truncate",children:o})]})]})}const yA=A.memo(function({isOpen:s,currentStep:l,packetCount:c,onClose:u}){if(A.useEffect(()=>{if(!s)return;const A=A=>{"Escape"===A.key&&u&&u()};window.addEventListener("keydown",A);const e=document.body.style.overflow,t=document.body.style.position,r=document.body.style.width,n=document.body.style.top,o=window.scrollY;return document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%",document.body.style.top=`-${o}px`,()=>{window.removeEventListener("keydown",A),document.body.style.overflow=e,document.body.style.position=t,document.body.style.width=r,document.body.style.top=n,window.scrollTo(0,o)}},[s,u]),!s)return null;const d="complete"===l,f=A=>{const e=["fetching","analyzing","building","discovering","complete"],t=e.indexOf(l),r=e.indexOf(A);return r0?`${c.toLocaleString()} packets`:"Loading database..."}),t.jsx(wA,{label:"Analyzing Database",icon:t.jsx(i,{className:"w-4 h-4"}),status:f("analyzing"),detail:"Processing packet paths"}),t.jsx(wA,{label:"Building Topology",icon:t.jsx(n,{className:"w-4 h-4"}),status:f("building"),detail:"Computing mesh edges"}),t.jsx(wA,{label:"Discovering Nodes",icon:t.jsx(a,{className:"w-4 h-4"}),status:f("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..."})]})})]}),document.body)}),kA={nodeFill:"#F5F5F0",nodeStroke:"#4A5568",localColor:"#FBBF24",hubColor:"#8B7BAD",mobileColor:"#F97316",roomServerColor:"#E17899",neighborColor:"#FBBF24",edges:{rest:"#4B4B4B",restBright:"#616161",restDim:"#3F3F3F",hoverDirect:"#6FBCBD",hoverLoop:"#8B7BAD",hoverStandard:"#8A8A8A",hoverNeighbor:"#FBBF24",neighborRest:"#6B7280",neighborHover:"#FBBF24",highlight:"#FFD700"},edgeOpacity:.82};function CA(){if("undefined"==typeof window)return kA;const A=dA(),e=fA();return{nodeFill:A.nodeFill,nodeStroke:A.nodeStroke,localColor:A.localColor,hubColor:A.hubColor,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:kA.edges.neighborRest,neighborHover:kA.edges.neighborHover,highlight:e.highlight},edgeOpacity:kA.edgeOpacity}}const BA=2e3;function MA({text:A}){return t.jsx(J,{content:A,delay:200,children:t.jsx(g,{className:"w-3.5 h-3.5 text-text-muted cursor-help"})})}function DA({title:A,tooltip:e,isOpen:r,onToggle:n,hasBorder:o=!1}){return t.jsxs("button",{onClick:n,className:"w-full flex items-center justify-between text-text-secondary font-medium py-1 hover:text-text-primary transition-colors "+(o?"mt-2 pt-2 border-t border-white/10":""),children:[t.jsxs("span",{className:"flex items-center gap-1",children:[A,t.jsx(MA,{text:e})]}),t.jsx(f,{className:"w-3 h-3 text-text-muted transition-transform duration-200 "+(r?"":"-rotate-90")})]})}function EA({showTopology:e,validatedPolylineCount:r,filteredNeighborCount:n,hasLocalNode:o,meshTopology:i,zeroHopNeighbors:s,neighborsWithLocation:f}){const g=gA(),h=Z(),m=K(),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}(i),[x,v]=A.useState(!0),[w,y]=A.useState(!0),[k,C]=A.useState(!0);return t.jsxs("div",{className:"map-control-glass text-xs",style:{padding:"0.625rem"},children:[t.jsx(DA,{title:"Nodes",tooltip:"Node type shown by shape. Yellow = direct RF neighbor.",isOpen:x,onToggle:()=>v(!x)}),x&&t.jsxs("div",{className:"flex flex-col gap-1 mt-1.5",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"14px",height:"14px",backgroundColor:g.nodeFill}}),t.jsx("span",{className:"text-text-muted",children:"Node"}),t.jsx(MA,{text:"Standard mesh node. Can be a repeater, client, or companion device."})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"14px",height:"14px",backgroundColor:g.hubColor}}),t.jsx("span",{className:"text-text-muted",children:"Hub"}),t.jsx(MA,{text:"Network hub (≥10% of last-hop traffic). Hubs are central to mesh traffic flow."})]}),(B=f,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})&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(l,{className:"w-3 h-3 flex-shrink-0",style:{color:g.roomColor},strokeWidth:2.5}),t.jsx("span",{className:"text-text-muted",children:"Room"}),t.jsx(MA,{text:"Room Server identity. Hosts a chat room that clients can sync messages with."})]})),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(c,{className:"w-3 h-3 flex-shrink-0",style:{color:g.localColor},strokeWidth:2.5}),t.jsx("span",{className:"text-text-muted",children:"Local"}),t.jsx(MA,{text:"Your repeater. This is the node running pyMC_Repeater that you're connected to."})]}),s.size>0&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"rounded flex-shrink-0",style:{width:"12px",height:"8px",backgroundColor:g.neighborColor}}),t.jsx("span",{className:"text-text-muted",children:"Neighbor"}),t.jsx(MA,{text:"Zero-hop direct RF contact. Color indicates we receive their ADVERTs directly."})]}),i.gatewayNodes.length>0&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"14px",height:"14px",backgroundColor:g.hubColor,opacity:.7}}),t.jsx("span",{className:"text-text-muted",children:"Gateway"}),t.jsx(MA,{text:"Significant traffic forwarder (7-10% of last-hop traffic). Gateways relay substantial traffic to the local node."})]}),p>0&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"14px",height:"14px",backgroundColor:"rgb(168, 85, 247)",opacity:.8}}),t.jsx("span",{className:"text-text-muted",children:"Backbone"}),t.jsx(MA,{text:"Critical relay with 4+ neighbors and high betweenness centrality. Backbone nodes carry the majority of mesh traffic."})]}),i.mobileNodes.length>0&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"14px",height:"14px",background:"transparent",border:`4px solid ${g.mobileColor}`,boxSizing:"border-box"}}),t.jsx("span",{className:"text-text-muted",children:"Mobile"}),t.jsx(MA,{text:"Volatile node that frequently appears/disappears from paths. Likely a portable or vehicle-mounted device."})]}),b>0&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(a,{className:"w-3 h-3 flex-shrink-0",style:{color:"var(--accent-tertiary)"},strokeWidth:2.5}),t.jsxs("span",{className:"text-text-muted",children:["Ghost (",b,")"]}),t.jsx(MA,{text:"Unknown repeater discovered via Viterbi HMM path analysis. These nodes appear in paths but aren't in our neighbor table."})]})]}),s.size>0&&t.jsxs(t.Fragment,{children:[t.jsx(DA,{title:"Link Quality",tooltip:"Neighbor edge colors based on bidirectional link balance. 2-Way = balanced. Listener = they hear us. Loud = they route to us.",isOpen:w,onToggle:()=>y(!w),hasBorder:!0}),w&&t.jsxs("div",{className:"flex flex-col gap-1 mt-1.5",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"flex-shrink-0 rounded-sm",style:{width:"16px",height:"3px",backgroundColor:W.YELLOW}}),t.jsx("span",{className:"text-text-muted",children:"2-Way"}),t.jsx(MA,{text:"33-67% balanced. Ideal bidirectional link - this neighbor both hears us and routes traffic to us equally well."})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"flex-shrink-0 rounded-sm",style:{width:"16px",height:"3px",backgroundColor:W.GREEN}}),t.jsx("span",{className:"text-text-muted",children:"Listener"}),t.jsx(MA,{text:">67% listener score. This neighbor hears our transmissions well (good RX from us)."})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"flex-shrink-0 rounded-sm",style:{width:"16px",height:"3px",backgroundColor:W.RED}}),t.jsx("span",{className:"text-text-muted",children:"Loud"}),t.jsx(MA,{text:"<33% listener score. This neighbor routes more traffic TO us than they hear from us."})]})]})]}),e&&r>0&&t.jsxs(t.Fragment,{children:[t.jsx(DA,{title:"Topology",tooltip:"Links with 5+ validations. Thickness = relative strength.",isOpen:k,onToggle:()=>C(!k),hasBorder:!0}),k&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex flex-col gap-0.5 text-text-muted mt-1",children:[t.jsxs("div",{className:"flex justify-between tabular-nums",children:[t.jsx("span",{children:"Nodes"}),t.jsx("span",{className:"text-text-secondary",children:n+(o?1:0)})]}),i.hubNodes.length>0&&t.jsxs("div",{className:"flex justify-between tabular-nums",children:[t.jsx("span",{children:"Hubs"}),t.jsx("span",{style:{color:kA.hubColor},children:i.hubNodes.length})]})]}),i.loops.length>0&&t.jsx("div",{className:"mt-1.5 pt-1.5 border-t border-white/10",children:t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(u,{className:"w-3 h-3 flex-shrink-0",style:{color:kA.edges.hoverLoop}}),t.jsxs("div",{className:"flex flex-col",children:[t.jsxs("span",{style:{color:kA.edges.hoverLoop},className:"font-medium",children:[i.loops.length," ",1===i.loops.length?"Loop":"Loops"]}),t.jsx("span",{className:"text-text-muted text-[10px] leading-tight",children:"Redundant paths"})]})]})}),m.totalPaths>0&&t.jsx("div",{className:"mt-1.5 pt-1.5 border-t border-white/10",children:t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(d,{className:"w-3 h-3 flex-shrink-0",style:{color:"var(--accent-primary)"}}),t.jsxs("div",{className:"flex flex-col",children:[t.jsxs("span",{style:{color:"var(--accent-primary)"},className:"font-medium",children:[m.totalPaths.toLocaleString()," Viterbi"]}),t.jsx("span",{className:"text-text-muted text-[10px] leading-tight",children:"HMM decoded paths"})]})]})})]})]})]});var B}function NA({options:A,value:e,onChange:r,size:n="sm",className:o=""}){const i={sm:"text-[10px] px-1.5 py-0.5",md:"text-xs px-2 py-1"};return t.jsx("div",{className:`inline-flex rounded-md bg-black/40 p-0.5 ${o}`,role:"radiogroup",children:A.map(A=>{const o=e===A.value;return t.jsx("button",{onClick:()=>r(A.value),className:`\n ${i[n]}\n rounded transition-all font-medium\n ${o?"bg-white/15 text-text-primary shadow-sm":"text-text-muted hover:text-text-secondary hover:bg-white/5"}\n `,role:"radio","aria-checked":o,title:A.title,children:A.icon?t.jsxs("span",{className:"flex items-center gap-1",children:[A.icon,t.jsx("span",{className:"hidden sm:inline",children:A.label})]}):A.label},A.value)})})}function QA({mapRef:A,showNeighborLines:e,onToggleNeighborLines:r,hasNeighborPolylines:n,nodeFilter:o,onNodeFilterChange:i,hasHubNodes:a,hasZeroHopNeighbors:s,showCoverage:l,onToggleCoverage:c,show3DTerrain:u,onToggle3DTerrain:d,isFullscreen:f,onToggleFullscreen:g}){const y=[{value:"all",label:"All",title:"Show all nodes"},...a?[{value:"hubs",label:"Hubs",title:"Show only hub nodes and their connections"}]:[],...s?[{value:"direct",label:"Direct",title:"Show only zero-hop (direct RF) neighbors"}]:[]];return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"absolute top-3 right-3 z-[600] map-controls-container sm:top-4 sm:right-4",children:t.jsxs("div",{className:"map-controls-row",children:[n&&t.jsx("button",{onClick:r,className:"map-control-btn rounded-lg transition-colors hover:bg-white/5",style:e?{backgroundColor:"#1a1408"}:void 0,title:e?"Hide neighbor lines":"Show neighbor lines","aria-label":e?"Hide neighbor lines":"Show neighbor lines","aria-pressed":e,children:t.jsx(h,{className:"map-control-icon "+(e?"text-amber-400":"text-text-secondary")})}),y.length>1&&t.jsx(NA,{options:y,value:o,onChange:i,size:"sm"}),t.jsx("button",{onClick:d,className:"map-control-btn rounded-lg transition-colors hover:bg-white/5",style:u?{backgroundColor:"#0a1a1a"}:void 0,title:u?"Disable 3D terrain":"Enable 3D terrain","aria-label":u?"Disable 3D terrain":"Enable 3D terrain","aria-pressed":u,children:t.jsx(m,{className:"map-control-icon "+(u?"text-teal-400":"text-text-secondary")})}),t.jsx("button",{onClick:g,className:"map-control-btn rounded-lg transition-colors hover:bg-white/5",title:f?"Exit fullscreen":"Fullscreen","aria-label":f?"Exit fullscreen":"Enter fullscreen","aria-pressed":f,children:f?t.jsx(b,{className:"map-control-icon text-text-secondary"}):t.jsx(p,{className:"map-control-icon text-text-secondary"})})]})}),t.jsx("div",{className:"absolute top-[3.5rem] right-3 z-[600] map-controls-container sm:top-[4rem] sm:right-4 lg:top-[4.5rem]",children:t.jsxs("div",{className:"flex flex-col items-stretch map-nav-module",children:[t.jsx("button",{onClick:()=>{var e,t;null==(t=null==(e=A.current)?void 0:e.getMap())||t.zoomIn()},className:"map-control-btn hover:bg-white/5 flex items-center justify-center",title:"Zoom in","aria-label":"Zoom in",children:t.jsx(x,{className:"map-control-icon text-text-secondary"})}),t.jsx("button",{onClick:()=>{var e,t;null==(t=null==(e=A.current)?void 0:e.getMap())||t.zoomOut()},className:"map-control-btn hover:bg-white/5 border-t border-white/6 flex items-center justify-center",title:"Zoom out","aria-label":"Zoom out",children:t.jsx(v,{className:"map-control-icon text-text-secondary"})}),t.jsx("button",{onClick:()=>{var e;const t=null==(e=A.current)?void 0:e.getMap();t&&t.easeTo({bearing:0,pitch:0,duration:300})},className:"map-control-btn hover:bg-white/5 border-t border-white/6 flex items-center justify-center",title:"Reset bearing to north","aria-label":"Reset bearing to north",children:t.jsx(w,{className:"map-control-icon text-text-secondary"})})]})})]})}const jA="#4ADE80",PA="DeepAnalysis";function FA(){return"abcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(36*Math.random())]}function SA({isActive:e,hasAnalyzed:r,isLoading:o,onClick:i}){const[a,l]=A.useState(!1),[c,u]=A.useState(PA),d=A.useRef(!1),f=A.useRef(null),[g]=A.useState(()=>{var A;return"undefined"!=typeof window&&((null==(A=window.matchMedia)?void 0:A.call(window,"(hover: hover)").matches)??!1)}),h=a&&!e&&!o&&g;A.useEffect(()=>{if(a&&!e&&!o&&!d.current){d.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{f.current&&cancelAnimationFrame(f.current)}},[a,e,o]);const m=o?"Analyzing...":c;return t.jsxs("button",{onClick:i,onMouseEnter:()=>g&&l(!0),onMouseLeave:()=>g&&l(!1),onPointerEnter:()=>g&&l(!0),onPointerLeave:()=>g&&l(!1),disabled:o,className:`map-control-btn flex items-center gap-2 w-full text-left transition-colors ${e?"map-control-glass-active":"map-control-glass"} ${o?"cursor-wait":""}`,style:{padding:"0.5rem 0.625rem",backgroundColor:e?"#0a1a0a":"#050505"},title:o?"Analyzing packet history...":r?e?"Hide topology edges":"Show topology edges":"Load full packet history and build topology",children:[o?t.jsx(s,{className:"w-3.5 h-3.5 flex-shrink-0 text-green-400 animate-spin"}):t.jsx(n,{className:"w-3.5 h-3.5 flex-shrink-0 transition-colors "+(e?"text-green-400":"text-text-secondary"),style:h?{color:jA}:void 0}),t.jsx("span",{className:e?"text-green-400":"text-text-secondary",style:{fontFamily:"ui-monospace, SFMono-Regular, monospace",fontSize:"0.6875rem",fontWeight:e||h?700:500,letterSpacing:"-0.01em",lineHeight:1,...h?{color:jA}:{}},children:m})]})}const LA="#00FFFF";function IA({isActive:e,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),d=A.useRef(!1),[f]=A.useState(()=>{var A;return"undefined"!=typeof window&&((null==(A=window.matchMedia)?void 0:A.call(window,"(hover: hover)").matches)??!1)}),g=n&&!e&&f;A.useEffect(()=>{g&&!d.current&&(d.current=!0,u(1),setTimeout(()=>u(2),100),setTimeout(()=>u(3),200)),n||(d.current=!1,u(0))},[g,n]),A.useEffect(()=>{if(n&&!e&&!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,e]);const h=A=>{if(e)return;if(!g)return;const t=11*i;return A>=t-2&&Af&&o(!0),onMouseLeave:()=>f&&o(!1),onPointerEnter:()=>f&&o(!0),onPointerLeave:()=>f&&o(!1),className:"map-control-btn flex items-center gap-2 w-full text-left transition-colors "+(e?"map-control-glass-active":"map-control-glass"),style:{padding:"0.5rem 0.625rem",backgroundColor:e?"#0a2a2a":"#050505"},title:e?"Disable live packet tracing (reduces CPU usage)":"Enable live packet tracing",children:[t.jsx(y,{className:"w-3.5 h-3.5 flex-shrink-0 "+(e?"text-cyan-400":"text-text-secondary"),fill:1===c?"#FFFFFF":3===c?LA:"none",stroke:1===c||2===c?"#FFFFFF":g?LA:"currentColor",style:{transition:"fill 0.05s, stroke 0.05s"}}),t.jsx("span",{className:e?"text-cyan-400":"text-text-secondary",style:{fontFamily:"ui-monospace, SFMono-Regular, monospace",fontSize:"0.6875rem",fontWeight:e||g?700:500,letterSpacing:"-0.01em",lineHeight:1},children:"LiveTrace".split("").map((A,e)=>t.jsx("span",{style:{color:h(e)||void 0},children:A},e))})]})}const RA="#fe8019";function TA({isActive:e,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(()=>{if(!i||e)return;const A=requestAnimationFrame(()=>l(!0)),t=setTimeout(()=>l(!1),80);return()=>{cancelAnimationFrame(A),clearTimeout(t)}},[i,e]);const u=Math.max(.01,Math.min(1,n)),d=u<.999,f=u>.011,g=i&&!e&&c;return t.jsxs("button",{onClick:r,onMouseEnter:()=>c&&a(!0),onMouseLeave:()=>c&&a(!1),onPointerEnter:()=>c&&a(!0),onPointerLeave:()=>c&&a(!1),className:"map-control-btn flex items-center gap-2 w-full text-left transition-colors "+(e?"map-control-glass-active":"map-control-glass"),style:{padding:"0.5rem 0.625rem",backgroundColor:e?"#1a1408":"#050505"},title:e?"Configure wardriving coverage":"Show wardriving coverage",children:[t.jsx(k,{className:"w-3.5 h-3.5 flex-shrink-0 transition-colors "+(e?"text-amber-400":"text-text-secondary"),style:g?{color:RA}:void 0}),t.jsx("span",{className:e?"text-amber-400":"text-text-secondary",style:{fontFamily:e||g?"'Jacquard 12', serif":"ui-monospace, SFMono-Regular, monospace",fontSize:e||g?"0.75rem":"0.6875rem",fontWeight:500,letterSpacing:"-0.01em",lineHeight:1,transition:"none",transform:e?"scale(1.45)":g?`scale(${s?1.595:1.45})`:void 0,transformOrigin:"left center",...g?{color:RA}:{}},children:"Wardrive"}),e&&o&&t.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[t.jsx("button",{onClick:A=>{A.stopPropagation();const e=Math.max(.01,u-.2);null==o||o(e)},disabled:!f,className:"p-0.5 rounded transition-colors "+(f?"hover:bg-[#252525] text-amber-400":"text-amber-400/30 cursor-not-allowed"),title:`Decrease opacity (${Math.round(100*u)}%)`,children:t.jsx(C,{className:"w-3.5 h-3.5"})}),t.jsx("button",{onClick:A=>{A.stopPropagation();const e=Math.min(1,u+.2);null==o||o(e)},disabled:!d,className:"p-0.5 rounded transition-colors "+(d?"hover:bg-[#252525] text-amber-400":"text-amber-400/30 cursor-not-allowed"),title:`Increase opacity (${Math.round(100*u)}%)`,children:t.jsx(B,{className:"w-3.5 h-3.5"})})]})]})}function _A(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 HA(A){return Math.exp(-A*Math.LN2/7)}const zA="pymc-wardriving-url",GA="pymc-wardriving-enabled",OA="pymc-wardriving-brightness";function UA(A){"undefined"!=typeof localStorage&&(A?localStorage.setItem(zA,A):localStorage.removeItem(zA))}function YA(A){"undefined"!=typeof localStorage&&localStorage.setItem(GA,String(A))}function WA(){if("undefined"==typeof localStorage)return.7;const A=localStorage.getItem(OA);if(A){const e=parseFloat(A);if(!isNaN(e)&&e>=.01&&e<=1)return e}return.7}function VA(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 ZA=M((A,e)=>({status:"idle",isVisible:"undefined"!=typeof localStorage&&"true"===localStorage.getItem(GA),coveragePoints:[],repeaters:[],error:null,stats:{coverageCount:0,repeaterCount:0,lastUpdated:null},url:"undefined"==typeof localStorage?"":localStorage.getItem(zA)||"",brightness:WA(),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(OA,String(e))}(t),A({brightness:t})},toggleVisibility:()=>{const t=!e().isVisible;YA(t),A({isVisible:t})},setVisible:e=>{YA(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}=_A(r.hash),o=parseInt(r.time,10),i=isNaN(o)?30:(Date.now()-o)/864e5,a=HA(i),s=VA(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()}),UA(e.trim()),YA(!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:""}),UA(""),YA(!1)}}));function KA({status:A}){if("connecting"!==A&&"loading"!==A&&"processing"!==A)return null;const e={idle:"",connecting:"Connecting to server...",loading:"Fetching coverage data...",processing:"Processing coverage points...",success:"",error:""}[A];return e?t.jsxs("div",{className:"flex items-center gap-3 p-4 bg-amber-500/10 border border-amber-500/30 rounded-xl",children:[t.jsx("div",{className:"relative",children:t.jsx(s,{className:"w-5 h-5 text-amber-400 animate-spin"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"text-sm text-amber-400 font-medium",children:e}),t.jsx("div",{className:"mt-2 h-1 bg-amber-500/20 rounded-full overflow-hidden",children:t.jsx("div",{className:"h-full bg-amber-400 rounded-full transition-all duration-300",style:{width:"connecting"===A?"30%":"loading"===A?"60%":"90%"}})})]})]}):null}function JA(){const{isModalOpen:e,closeModal:n,status:i,isVisible:a,stats:l,error:c,url:u,brightness:f,loadCoverage:g,clearCoverage:h,toggleVisibility:m,setUrl:b,setBrightness:p}=ZA(),x="connecting"===i||"loading"===i||"processing"===i,[v,w]=A.useState(u),y=A.useCallback(async()=>{await g(v)},[v,g]),k=A.useCallback(()=>{w(""),h()},[h]),C=A.useCallback(A=>{"Enter"!==A.key||A.shiftKey||x||(A.preventDefault(),y())},[y,x]),M=A.useCallback(A=>{const e=A.target.value;w(e),b(e)},[b]);if(!e)return null;const S=l.coverageCount>0,L=v.trim().length>0&&!x;return t.jsxs("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center",children:[t.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-md",onClick:x?void 0:n}),t.jsxs("div",{className:"relative glass-card-elevated w-full max-w-md mx-4",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border-subtle",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"p-2 rounded-lg bg-amber-500/20",children:t.jsx(D,{className:"w-5 h-5 text-amber-400"})}),t.jsxs("div",{children:[t.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Wardriving Coverage"}),t.jsx("p",{className:"text-xs text-text-muted",children:"Overlay RF coverage heatmap"})]})]}),t.jsx("button",{onClick:n,disabled:x,className:"p-2 rounded-lg hover:bg-[#252525] transition-colors disabled:opacity-50",children:t.jsx(E,{className:"w-5 h-5 text-text-secondary"})})]}),t.jsxs("div",{className:"p-4 space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-2",children:"Coverage Server URL"}),t.jsx("input",{type:"url",value:v,onChange:M,onKeyDown:C,placeholder:"https://coverage.wcmesh.com",className:"w-full px-4 py-3 bg-black/30 border border-border rounded-xl text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-amber-500/50 focus:border-amber-500/50 transition-all disabled:opacity-50",disabled:x}),t.jsx("p",{className:"mt-1.5 text-xs text-text-muted",children:"Enter the base URL of a wardriving coverage server (e.g., coverage.wcmesh.com)"})]}),t.jsx(KA,{status:i}),"error"===i&&c&&t.jsxs("div",{className:"flex items-start gap-3 p-3 bg-red-500/10 border border-red-500/30 rounded-xl",children:[t.jsx(N,{className:"w-5 h-5 text-red-400 flex-shrink-0 mt-0.5"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm text-red-400 font-medium",children:"Connection Failed"}),t.jsx("p",{className:"text-xs text-red-400/80 mt-0.5",children:c})]})]}),"success"===i&&S&&t.jsxs("div",{className:"flex items-start gap-3 p-3 bg-green-500/10 border border-green-500/30 rounded-xl",children:[t.jsx(r,{className:"w-5 h-5 text-green-400 flex-shrink-0 mt-0.5"}),t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"text-sm text-green-400 font-medium",children:"Data Loaded Successfully"}),t.jsxs("p",{className:"text-xs text-green-400/80 mt-0.5",children:[l.coverageCount.toLocaleString()," coverage points • ",l.repeaterCount.toLocaleString()," repeaters"]})]})]}),S&&!x&&"success"!==i&&t.jsxs("div",{className:"flex items-start gap-3 p-3 bg-amber-500/10 border border-amber-500/30 rounded-xl",children:[t.jsx(Q,{className:"w-5 h-5 text-amber-400 flex-shrink-0 mt-0.5"}),t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"text-sm text-amber-400 font-medium",children:"Coverage Data Loaded"}),t.jsxs("p",{className:"text-xs text-amber-400/80 mt-0.5",children:[l.coverageCount.toLocaleString()," points •",l.lastUpdated&&` Last updated ${l.lastUpdated.toLocaleTimeString()}`]})]})]}),S&&!x&&t.jsx("div",{className:"p-3 bg-black/20 border border-border-subtle rounded-xl",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(B,{className:"w-4 h-4 flex-shrink-0 "+(f>.5?"text-amber-400":"text-text-muted")}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsx("span",{className:"text-xs text-text-secondary",children:"Brightness"}),t.jsxs("span",{className:"text-xs text-text-muted font-mono",children:[Math.round(100*f),"%"]})]}),t.jsx("input",{type:"range",min:"1",max:"100",value:100*f,onChange:A=>p(Number(A.target.value)/100),className:"w-full h-1.5 cursor-pointer accent-amber-400"})]})]})})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3 p-4 border-t border-border-subtle",children:[t.jsx("div",{className:"flex items-center gap-2",children:S&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:m,disabled:x,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-text-secondary hover:text-text-primary hover:bg-[#202020] rounded-lg transition-colors disabled:opacity-50",title:a?"Hide heatmap":"Show heatmap",children:a?t.jsxs(t.Fragment,{children:[t.jsx(j,{className:"w-3.5 h-3.5"})," Hide"]}):t.jsxs(t.Fragment,{children:[t.jsx(d,{className:"w-3.5 h-3.5"})," Show"]})}),t.jsxs("button",{onClick:k,disabled:x,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-red-400/80 hover:text-red-400 hover:bg-red-500/10 rounded-lg transition-colors disabled:opacity-50",title:"Clear coverage data",children:[t.jsx(P,{className:"w-3.5 h-3.5"})," Clear"]})]})}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:n,disabled:x,className:"px-4 py-2 text-sm font-medium text-text-secondary hover:bg-[#252525] rounded-lg transition-colors disabled:opacity-50",children:S?"Done":"Cancel"}),t.jsx("button",{onClick:y,disabled:!L,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium bg-amber-500 hover:bg-amber-400 text-black rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:x?t.jsxs(t.Fragment,{children:[t.jsx(s,{className:"w-4 h-4 animate-spin"}),"Loading..."]}):S?t.jsxs(t.Fragment,{children:[t.jsx(o,{className:"w-4 h-4"}),"Refresh"]}):t.jsxs(t.Fragment,{children:[t.jsx(F,{className:"w-4 h-4"}),"Connect"]})})]})]})]})]})}const XA={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{}}},qA=M()(mA(A=>({isEnabled:!1,toggle:()=>A(A=>({isEnabled:!A.isEnabled})),setEnabled:e=>A({isEnabled:e})}),{name:"pymc-live-trace",storage:bA(()=>XA)}));var $A=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,d,f,g,h,m,b,p="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function x(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}(f,A,e):""}function v(A,e){return A%e>0&&(A+=e-A%e),A}function w(A){u=A,t.HEAP8=d=new Int8Array(A),t.HEAP16=g=new Int16Array(A),t.HEAP32=h=new Int32Array(A),t.HEAPU8=f=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,w(u),h[7156]=5271536;var C=[],B=[],M=[],D=[];function E(A){C.unshift(A)}function N(A){D.unshift(A)}var Q=Math.abs,j=Math.ceil,P=Math.floor,F=Math.min,S=0,L=null;t.preloadedImages={},t.preloadedAudios={};var I,R,T=null,_="data:application/octet-stream;base64,";function H(A){return String.prototype.startsWith?A.startsWith(_):0===A.indexOf(_)}function z(){return d.length}T="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAAAAUAAAACAAAAAAAAAAIAAAADAAAAAQAAAAQAAAAGAAAAAAAAAAUAAAADAAAABgAAAAQAAAAFAAAAAAAAAAEAAAACAAAABAAAAAUA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1YgmzowSQNM25BRKWARArGS08/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//////////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAACAAAAAAAAAAIAAAABAAAAAQAAAAIAAAACAAAAAAAAAAUAAAAFAAAAAAAAAAIAAAACAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAAAAEAAAACAAAA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grHiPwAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAP////8AAAAAAAAAAAAAAAABAAAAAAAAAAAAAAD/////AAAAAAAAAAABAAAAAQAAAAAAAAAAAAAA/////wAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAP////8FAAAABQAAAAAAAAAAAAAAAAAAAAAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAEAAAAAAAAABQAAAAEAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQAAAAAAAQABAAABAQAAAAAAAQ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uMwI/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+yEJQBgtRFT7IQnAYWxnb3MuYwBoM05laWdoYm9yUm90YXRpb25zAGNvb3Jka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FBlbnRhZ29uKGJhc2VDZWxsKQBiYXNlQ2VsbFJvdGF0aW9ucyA+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|I(A,e,t,r,o,s,l,0);break}(a=0|We(s,4))?(c=0|I(A,e,t,r,a,s,l,0),Ye(a),a=c):a=13}else a=2}while(0);return P=i,0|a}function L(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,d=0,f=0,g=0,h=0,m=0;if(a=P,P=P+16|0,m=a+8|0,n[(h=i=a)>>2]=A,n[h+4>>2]=e,(0|t)<0)return P=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 P=a,9;n[m>>2]=0;A:do{if((0|t)>=1)if(s)for(f=1,d=0,g=0,h=1,s=A;;){if(!(d|g)){if(0|(s=0|R(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|R(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+(f<<3)|0)>>2]=s,n[A+4>>2]=e,n[o+(f<<2)>>2]=h,l=(0|(A=d+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}f=f+1|0,d=l?0:A,g=l?u?0:c:g}else for(f=1,d=0,g=0,h=1,s=A;;){if(!(d|g)){if(0|(s=0|R(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|R(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+(f<<3)|0)>>2]=s,n[A+4>>2]=e,l=(0|(A=d+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}f=f+1|0,d=l?0:A,g=l?u?0:c:g}else s=0}while(0);return P=a,0|s}function I(A,e,t,r,o,i,a,s){t|=0,r|=0,o|=0,s|=0;var l,c,u,d=0,f=0,g=0,h=0,m=0,b=0,p=0;if(u=P,P=P+16|0,l=u+8|0,c=u,d=0|At(0|(A|=0),0|(e|=0),0|(i|=0),0|(a|=0)),g=0|B(),!(!(0|(p=0|n[(b=h=r+(d<<3)|0)>>2]))&!(0|(b=0|n[b+4>>2]))|(f=(0|p)==(0|A)&(0|b)==(0|e))))do{d=0|$e(0|(d=0|Ve(0|d,0|g,1,0)),0|B(),0|i,0|a),g=0|B(),f=(0|(b=0|n[(p=h=r+(d<<3)|0)>>2]))==(0|A)&(0|(p=0|n[p+4>>2]))==(0|e)}while(!(!(0|b)&!(0|p)|f));if(d=o+(d<<2)|0,f&&(0|n[d>>2])<=(0|s))return P=u,0;if(n[(p=h)>>2]=A,n[p+4>>2]=e,n[d>>2]=s,(0|s)>=(0|t))return P=u,0;switch(f=s+1|0,n[l>>2]=0,0|(d=0|R(A,e,2,l,c))){case 9:m=9;break;case 0:(d=0|I(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f))||(m=9)}A:do{if(9==(0|m)){switch(n[l>>2]=0,0|(d=0|R(A,e,3,l,c))){case 9:break;case 0:if(0|(d=0|I(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f)))break A;break;default:break A}switch(n[l>>2]=0,0|(d=0|R(A,e,1,l,c))){case 9:break;case 0:if(0|(d=0|I(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f)))break A;break;default:break A}switch(n[l>>2]=0,0|(d=0|R(A,e,5,l,c))){case 9:break;case 0:if(0|(d=0|I(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f)))break A;break;default:break A}switch(n[l>>2]=0,0|(d=0|R(A,e,4,l,c))){case 9:break;case 0:if(0|(d=0|I(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f)))break A;break;default:break A}switch(n[l>>2]=0,0|(d=0|R(A,e,6,l,c))){case 9:break;case 0:if(0|(d=0|I(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f)))break A;break;default:break A}return P=u,0}}while(0);return P=u,0|d}function R(A,e,t,r,o){A|=0,e|=0,o|=0;var i,a,s=0,l=0,c=0,u=0,d=0,f=0,g=0;if((t|=0)>>>0>6)return 1;if(d=(0|n[(r|=0)>>2])%6|0,n[r>>2]=d,(0|d)>0){s=0;do{t=0|xA(t),s=s+1|0}while((0|s)<(0|n[r>>2]))}if(d=0|tt(0|A,0|e,45),B(),(a=127&d)>>>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,f=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&~f,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&d){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 T(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,d=0,f=0,g=0,h=0;if(i=P,P=P+16|0,h=i+8|0,n[(g=o=i)>>2]=A,n[g+4>>2]=e,(0|t)<0)return P=i,2;if(!t)return n[(h=r)>>2]=A,n[h+4>>2]=e,P=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|R(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[(f=r)>>2]=g,n[f+4>>2]=e,f=t+-1|0,d=0,A=1;do{if(a=26800+(d<<2)|0,5==(0|d))for(l=0|n[a>>2],s=0,a=A;;){if(0|(A=0|R(0|n[(A=o)>>2],0|n[A+4>>2],l,h,o)))break A;if((0|s)!=(0|f)){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|R(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}d=d+1|0}while(d>>>0<6);A=(0|g)==(0|n[(A=o)>>2])&&(0|e)==(0|n[A+4>>2])?0:9}}while(0);return P=i,0|A}function _(A,e,t,r){t|=0,r|=0;var o,i,a,s=0,l=0;for(a=P,P=P+16|0,o=a,i=a+8|0,s=(s=!(0|HA(A|=0,e|=0)))?1:2;;){if(n[i>>2]=0,!(0|R(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)?(P=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,d,f,g,h,m,b,p,x=0,v=0,w=0,y=0,k=0,C=0,M=0,D=0,E=0,N=0,Q=0,j=0,F=0,S=0,L=0,I=0,R=0,T=0,_=0;if(p=P,P=P+64|0,h=p+48|0,m=p+32|0,b=p+24|0,l=p+8|0,c=p,(0|(v=0|n[(A|=0)>>2]))<=0)return P=p,0;for(u=A+4|0,d=h+8|0,f=m+8|0,g=l+8|0,x=0,F=0;;){j=(w=0|n[u>>2])+(F<<4)|0,n[h>>2]=n[j>>2],n[h+4>>2]=n[j+4>>2],n[h+8>>2]=n[j+8>>2],n[h+12>>2]=n[j+12>>2],(0|F)==(v+-1|0)?(n[m>>2]=n[w>>2],n[m+4>>2]=n[w+4>>2],n[m+8>>2]=n[w+8>>2],n[m+12>>2]=n[w+12>>2]):(j=w+(F+1<<4)|0,n[m>>2]=n[j>>2],n[m+4>>2]=n[j+4>>2],n[m+8>>2]=n[j+8>>2],n[m+12>>2]=n[j+12>>2]),v=0|tA(h,m,r,b);A:do{if(v)w=0,x=v;else if(w=0|n[(v=b)>>2],(0|(v=0|n[v+4>>2]))>0|!(0|v)&w>>>0>0){Q=0,j=0;e:for(;;){if(R=1/(+(w>>>0)+4294967296*+(0|v)),_=+o[h>>3],T=+((v=0|Ze(0|w,0|v,0|Q,0|j))>>>0)+4294967296*+(0|B()),I=+(Q>>>0)+4294967296*+(0|j),o[l>>3]=R*(_*T)+R*(+o[m>>3]*I),o[g>>3]=R*(+o[d>>3]*T)+R*(+o[f>>3]*I),0|(v=0|KA(l,r,c))){x=v;break}C=0|At(0|(E=0|n[(N=c)>>2]),0|(N=0|n[N+4>>2]),0|e,0|t),y=0|B(),w=0|n[(k=v=s+(C<<3)|0)>>2],k=0|n[k+4>>2];t:do{if(!(0|w)&!(0|k))S=v,L=16;else for(M=0,D=0;;){if((0|M)>(0|t)|(0|M)==(0|t)&D>>>0>e>>>0){x=1;break e}if((0|w)==(0|E)&(0|k)==(0|N))break t;if(C=0|$e(0|(v=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|(w=0|n[(k=v=s+(C<<3)|0)>>2]))&!(0|(k=0|n[k+4>>2]))){S=v,L=16;break}}}while(0);if(16!=(0|L)||(L=0,!(0|E)&!(0|N))||(n[(D=S)>>2]=E,n[D+4>>2]=N,D=a+(n[i>>2]<<3)|0,n[D>>2]=E,n[D+4>>2]=N,D=0|Ve(0|n[(D=i)>>2],0|n[D+4>>2],1,0),E=0|B(),n[(N=i)>>2]=D,n[N+4>>2]=E),Q=0|Ve(0|Q,0|j,1,0),j=0|B(),w=0|n[(v=b)>>2],!((0|(v=0|n[v+4>>2]))>(0|j)|(0|v)==(0|j)&w>>>0>Q>>>0)){w=1;break A}}w=0}else w=1}while(0);if(F=F+1|0,!w){L=21;break}if((0|F)>=(0|(v=0|n[A>>2]))){x=0,L=21;break}}return 21==(0|L)?(P=p,0|x):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=P,P=P+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),P=i}function eA(A,e,t){A|=0,e|=0,t|=0;var r,a,c,u,d,f,g,h=0,m=0,b=0,p=0,v=0,y=0,k=0;f=P,P=P+288|0,d=f+264|0,p=f+96|0,m=(h=b=f)+96|0;do{n[h>>2]=0,h=h+4|0}while((0|h)<(0|m));return 0|(e=0|Ae(e,b))?(P=f,0|(y=e)):(qA(b=0|n[(m=b)>>2],m=0|n[m+4>>2],d),$A(b,m,p),u=+ae(d,p+8|0),o[d>>3]=+o[A>>3],o[(m=d+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(d,p),k=+o[m>>3]-+o[b>>3],c=+l(+k),g=+o[d>>3]-+o[p>>3],r=+l(+g),!(0==k|0==g)&&(k=+ot(+c,+r),k=+x(+a*a/+it(+k/+it(+c,+r),3)/(u*(2.59807621135*u)*.8)),o[i>>3]=k,v=~~k>>>0,y=+l(k)>=1?k>0?~~+w(+s(k/4294967296),4294967295)>>>0:~~+x((k-+(~~k>>>0))/4294967296)>>>0:0,2146435072&~n[i+4>>2])?(p=!(0|v)&!(0|y),n[(e=t)>>2]=p?1:v,n[e+4>>2]=p?0:y,e=0):e=1,P=f,0|(y=e))}function tA(A,e,t,r){A|=0,e|=0,t|=0,r|=0;var a,c,u,d,f=0,g=0,h=0;d=P,P=P+288|0,c=d+264|0,u=d+96|0,a=(f=g=d)+96|0;do{n[f>>2]=0,f=f+4|0}while((0|f)<(0|a));return 0|(t=0|Ae(t,g))?(P=d,0|(r=t)):(qA(f=0|n[(t=g)>>2],t=0|n[t+4>>2],c),$A(f,t,u),h=+ae(c,u+8|0),h=+x(+ +ae(A,e)/(2*h)),o[i>>3]=h,t=~~h>>>0,f=+l(h)>=1?h>0?~~+w(+s(h/4294967296),4294967295)>>>0:~~+x((h-+(~~h>>>0))/4294967296)>>>0:0,2146435072&~n[i+4>>2]?(g=!(0|t)&!(0|f),n[r>>2]=g?1:t,n[r+4>>2]=g?0:f,P=d,0|(r=0)):(P=d,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|v(0|n[(A|=0)>>2],e),n[A>>2]=r,t=0|v(0|n[(r=A+4|0)>>2],e),n[r>>2]=t,e=0|v(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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=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 xA(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 vA(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 wA(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>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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|IA(A,t)):0|(t=0)}function DA(A,e,t){t|=0;var r,o,i=0,a=0;return o=P,P=P+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=P,P=P+16|0,i=r,o=0|HA(A|=0,e|=0),(t+-1|0)>>>0>5)return P=r,-1;if(1==(0|t)&(o=!!(0|o)))return P=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 P=r,0|(i=o)}(A,a,7&i),-1==(0|i)?(n[t>>2]=0,P=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)?NA(r,e,i,2,t):FA(r,e,i,2,t),P=o,0|(a=0))):(P=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=+d(+t),t=+f(+t),e=s*+f(+e)+ +d(+a)*(t*+d(+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/+d(+e),a=t*+f(+a)*c,t=+o[A>>3],e=c*((s-+f(+e)*+f(+t))/+d(+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 NA(A,e,t,r,i){A|=0,e|=0,t|=0,r|=0,i|=0;var a,s,l,c,u,d,f,g,h,m,b,p,x,v,w,y,k,C,B,D,E,N,Q=0,j=0,F=0,S=0,L=0,I=0;if(N=P,P=P+272|0,S=N+240|0,B=N,D=N+224|0,E=N+208|0,b=N+176|0,p=N+160|0,x=N+192|0,v=N+144|0,w=N+128|0,y=N+112|0,k=N+96|0,C=N+80|0,n[(Q=N+256|0)>>2]=e,n[S>>2]=n[A>>2],n[S+4>>2]=n[A+4>>2],n[S+8>>2]=n[A+8>>2],n[S+12>>2]=n[A+12>>2],QA(S,Q,B),n[i>>2]=0,(0|(S=r+t+(5==(0|r)&1)|0))<=(0|t))P=N;else{s=D+4|0,l=b+4|0,c=t+5|0,u=16880+((a=0|n[Q>>2])<<2)|0,d=16960+(a<<2)|0,f=w+8|0,g=y+8|0,h=k+8|0,m=E+4|0,F=t;A:for(;;){j=B+((0|F)%5<<4)|0,n[E>>2]=n[j>>2],n[E+4>>2]=n[j+4>>2],n[E+8>>2]=n[j+8>>2],n[E+12>>2]=n[j+12>>2];do{}while(2==(0|jA(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],Q=0|n[17040+(80*r|0)+(n[D>>2]<<2)>>2],n[b>>2]=n[18640+(80*r|0)+(20*Q|0)>>2],(0|(j=0|n[18640+(80*r|0)+(20*Q|0)+16>>2]))>0){A=0;do{bA(l),A=A+1|0}while((0|A)<(0|j))}switch(j=18640+(80*r|0)+(20*Q|0)+4|0,n[x>>2]=n[j>>2],n[x+4>>2]=n[j+4>>2],n[x+8>>2]=n[j+8>>2],sA(x,3*(0|n[u>>2])|0),iA(l,x,l),nA(l),oA(l,v),L=+(0|n[d>>2]),o[w>>3]=3*L,o[f>>3]=0,I=-1.5*L,o[y>>3]=I,o[g>>3]=2.598076211353316*L,o[k>>3]=I,o[h>>3]=-2.598076211353316*L,0|n[17040+(80*(0|n[b>>2])|0)+(n[E>>2]<<2)>>2]){case 1:A=y,r=w;break;case 3:A=k,r=y;break;case 2:A=w,r=k;break;default:A=12;break A}Qe(p,v,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|S)){A=3;break}}3!=(0|A)?12==(0|A)&&M(26970,27017,572,27027):P=N}}function QA(A,e,t){A|=0,e|=0,t|=0;var r,o=0,i=0,a=0,s=0,l=0;r=P,P=P+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,wA(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),P=r}function jA(A,e,t,r){t|=0,r|=0;var o,i,a,s,l,c,u=0,d=0,f=0,g=0,h=0;if(c=P,P=P+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[(d=A+12|0)>>2])|0))==(0|g))return P=c,1;f=d}else u=o+u+(r=0|n[(f=A+12|0)>>2])|0;if((0|u)<=(0|g))return P=c,0;do{if((0|r)>0){if(r=0|n[A>>2],(0|o)>0){d=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),d=r,r=A):(d=r,r=A)}else d=18640+(80*(0|n[A>>2])|0)+20|0,r=A}while(0);if(n[r>>2]=n[d>>2],(0|n[(u=d+16|0)>>2])>0){r=0;do{bA(h),r=r+1|0}while((0|r)<(0|n[u>>2]))}return A=d+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[f>>2])|0)==(0|g)?1:2,P=c,0|r}function PA(A,e){A|=0,e|=0;var t=0;do{t=0|jA(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,d,f,g,h,m,b,p,x,v,w,y,k,C,B=0,D=0,E=0,N=0,Q=0;if(C=P,P=P+240|0,v=C+208|0,w=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,x=C+96|0,n[(B=C+224|0)>>2]=e,n[v>>2]=n[A>>2],n[v+4>>2]=n[A+4>>2],n[v+8>>2]=n[A+8>>2],n[v+12>>2]=n[A+12>>2],SA(v,B,w),n[i>>2]=0,(0|(g=r+t+(6==(0|r)&1)|0))<=(0|t))P=C;else{s=t+6|0,l=16960+((a=0|n[B>>2])<<2)|0,c=m+8|0,u=b+8|0,d=p+8|0,f=y+4|0,D=0,E=t,r=-1;A:for(;;){if(A=w+((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|jA(y,a,0,1),(0|E)>(0|t)&!!(0|ZA(e))&&1!=(0|A)&&(0|n[y>>2])!=(0|r)){switch(oA(w+((B+5|0)%6<<4)+4|0,k),oA(w+(B<<4)+4|0,h),N=+(0|n[l>>2]),o[m>>3]=3*N,o[c>>3]=0,Q=-1.5*N,o[b>>3]=Q,o[u>>3]=2.598076211353316*N,o[p>>3]=Q,o[d>>3]=-2.598076211353316*N,B=0|n[v>>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}Qe(k,h,r,A,x),0|je(k,x)||0|je(h,x)||(EA(x,0|n[v>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2]))}if((0|E)<(0|s)&&(oA(f,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):P=C}}function SA(A,e,t){A|=0,e|=0,t|=0;var r,o=0,i=0,a=0,s=0,l=0;r=P,P=P+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,wA(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),P=r}function LA(A,e){return e=0|tt(0|(A|=0),0|(e|=0),45),B(),127&e}function IA(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 RA(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 TA(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|xA(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|xA(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|xA(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|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(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|vA(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|vA(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=P,P=P+16|0,i=r,(e|=0)>>>0>15?(P=r,0|(i=4)):2146435072&~n[4+(A|=0)>>2]&&2146435072&~n[A+8+4>>2]?(function(A,e,t){var r,i;r=P,P=P+16|0,function(A,e,t,r){e|=0,r|=0;var i,a=0,s=0,l=0,c=0;if(i=P,P=P+16|0,function(A,e,t){e|=0,t|=0;var r,i,a=0;i=P,P=P+32|0,function(A,e){e|=0;var t,r,n=0;n=+o[(A|=0)>>3],t=+d(+n),n=+f(+n),o[e+16>>3]=n,n=+o[A+8>>3],r=t*+d(+n),o[e>>3]=r,n=t*+f(+n),o[e+8>>3]=n}(A|=0,r=i),n[e>>2]=0,o[t>>3]=5,(a=+Pe(16400,r))<+o[t>>3]&&(n[e>>2]=0,o[t>>3]=a),(a=+Pe(16424,r))<+o[t>>3]&&(n[e>>2]=1,o[t>>3]=a),(a=+Pe(16448,r))<+o[t>>3]&&(n[e>>2]=2,o[t>>3]=a),(a=+Pe(16472,r))<+o[t>>3]&&(n[e>>2]=3,o[t>>3]=a),(a=+Pe(16496,r))<+o[t>>3]&&(n[e>>2]=4,o[t>>3]=a),(a=+Pe(16520,r))<+o[t>>3]&&(n[e>>2]=5,o[t>>3]=a),(a=+Pe(16544,r))<+o[t>>3]&&(n[e>>2]=6,o[t>>3]=a),(a=+Pe(16568,r))<+o[t>>3]&&(n[e>>2]=7,o[t>>3]=a),(a=+Pe(16592,r))<+o[t>>3]&&(n[e>>2]=8,o[t>>3]=a),(a=+Pe(16616,r))<+o[t>>3]&&(n[e>>2]=9,o[t>>3]=a),(a=+Pe(16640,r))<+o[t>>3]&&(n[e>>2]=10,o[t>>3]=a),(a=+Pe(16664,r))<+o[t>>3]&&(n[e>>2]=11,o[t>>3]=a),(a=+Pe(16688,r))<+o[t>>3]&&(n[e>>2]=12,o[t>>3]=a),(a=+Pe(16712,r))<+o[t>>3]&&(n[e>>2]=13,o[t>>3]=a),(a=+Pe(16736,r))<+o[t>>3]&&(n[e>>2]=14,o[t>>3]=a),(a=+Pe(16760,r))<+o[t>>3]&&(n[e>>2]=15,o[t>>3]=a),(a=+Pe(16784,r))<+o[t>>3]&&(n[e>>2]=16,o[t>>3]=a),(a=+Pe(16808,r))<+o[t>>3]&&(n[e>>2]=17,o[t>>3]=a),(a=+Pe(16832,r))<+o[t>>3]&&(n[e>>2]=18,o[t>>3]=a),(a=+Pe(16856,r))<+o[t>>3]?(n[e>>2]=19,o[t>>3]=a,P=i):P=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(P=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=+d(+i),n=+o[e+8>>3]-+o[A+8>>3],a=r*+f(+n),t=+o[A>>3],+ +p(+a,+(+f(+i)*+d(+t)-+d(+n)*(r*+f(+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=+d(+l)*a,o[r>>3]=s,l=+f(+l)*a,o[r+8>>3]=l,P=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,d=0,f=0,g=0,h=0;n[(a=8+(e|=0)|0)>>2]=0,r=+o[A>>3],d=+l(+r),i=+o[A+8>>3],d+=.5*(f=1.1547005383792515*+l(+i)),d-=+(0|(s=~~d)),f-=+(0|(A=~~f));do{if(d<.5){if(d<.3333333333333333){if(n[e>>2]=s,f<.5*(d+1)){n[e+4>>2]=A;break}A=A+1|0,n[e+4>>2]=A;break}if(A=(1&!(f<(h=1-d)))+A|0,n[e+4>>2]=A,h<=f&f<2*d){s=s+1|0,n[e>>2]=s;break}n[e>>2]=s;break}if(!(d<.6666666666666666)){if(s=s+1|0,n[e>>2]=s,f<.5*d){n[e+4>>2]=A;break}A=A+1|0,n[e+4>>2]=A;break}if(f<1-d){if(n[e+4>>2]=A,2*d-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),P=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=P,P=P+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)),P=t,0|l):(rt(0|O(A),0,45),s=0|B()|r,l=-1,C(0|s),P=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?(dA(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)):(fA(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|xA(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|vA(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|xA(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)),P=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),P=r,0|(i=0)):(P=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=P,P=P+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,P=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|vA(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 P=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|jA(t,s,i,0)){if(0|z(u))do{}while(0|jA(t,s,0,0));(0|s)!=(0|c)&&fA(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 P=o,0}function qA(A,e,t){t|=0;var r,o,i=0;return o=P,P=P+16|0,0|(i=0|XA(A|=0,e|=0,r=o))?(P=o,0|i):(i=0|tt(0|A,0|e,52),B(),function(A,e,t){var r,o;e|=0,t|=0,r=P,P=P+16|0,oA(4+(A|=0)|0,o=r),EA(o,0|n[A>>2],e,0,t),P=r}(r,15&i,t),P=o,0|(i=0))}function $A(A,e,t){t|=0;var r,n=0,o=0,i=0;if(r=P,P=P+16|0,0|(n=0|XA(A|=0,e|=0,i=r)))return P=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 NA(i,o,0,5,t),P=r,0}}while(0);return FA(i,o,0,6,t),P=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=+f(.5*(r-t)))*n+(i=+f(.5*(+o[e+8>>3]-+o[A+8>>3])))*(+d(+r)*+d(+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,x=0;return x=+o[(e|=0)>>3],i=+o[A>>3],m=+f(.5*(x-i)),u=+o[e+8>>3],n=+o[A+8>>3],h=+f(.5*(u-n)),r=+d(+i),a=+d(+x),h=2*+p(+ +c(+(h=m*m+h*(a*r*h))),+ +c(+(1-h))),m=+o[t>>3],x=+f(.5*(m-x)),s=+o[t+8>>3],u=+f(.5*(s-u)),l=+d(+m),u=2*+p(+ +c(+(u=x*x+u*(a*l*u))),+ +c(+(1-u))),m=+f(.5*(i-m)),s=+f(.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=P,P=P+192|0,i=a,0|(l=0|qA(A|=0,e|=0,r=a+168|0)))return P=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,P=a,0}function de(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 fe(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,d=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],d=0|n[(t=t+16|0)>>2],a=+o[(d=0|d?d:A)>>3],l=+o[d+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],d=0|n[(t=t+16|0)>>2],a=+o[(d=0|d?d:A)>>3],l=+o[d+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,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0;if(c=P,P=P+32|0,v=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 P=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 P=c,5;if(b=(0|h)!=(0|m)){if(7==(0|(f=0|V(h,m))))return P=c,1;7==(0|(g=0|V(m,h)))?M(27514,27538,161,27548):(p=f,d=g)}else p=0,d=0;a=0|z(h),s=0|z(m),n[v>>2]=0,n[v+4>>2]=0,n[v+8>>2]=0,n[v+12>>2]=0;do{if(p){if(f=(0|(m=0|n[4272+(28*h|0)+(p<<2)>>2]))>0,s)if(f){h=0,g=t,f=o;do{g=0|WA(g,f),f=0|B(),1==(0|(d=0|vA(d)))&&(d=0|vA(1)),h=h+1|0}while((0|h)!=(0|m));m=d,h=g,g=f}else m=d,h=t,g=o;else if(f){h=0,g=t,f=o;do{g=0|VA(g,f),f=0|B(),d=0|vA(d),h=h+1|0}while((0|h)!=(0|m));m=d,h=g,g=f}else m=d,h=t,g=o;if(JA(h,g,v),b||M(27563,27538,191,27548),(f=!!(0|a))&(d=!!(0|s))&&M(27590,27538,192,27548),f){if(7==(0|(d=0|OA(A,e)))){u=5;break}if(0|r[22e3+(7*d|0)+p|0]){u=1;break}h=g=0|n[21168+(28*d|0)+(p<<2)>>2]}else if(d){if(7==(0|(d=0|OA(h,g)))){u=5;break}if(0|r[22e3+(7*d|0)+m|0]){u=1;break}h=0,g=0|n[21168+(28*m|0)+(d<<2)>>2]}else h=0,g=0;if((h|g|0)<0)u=5;else{if((0|g)>0){f=v+4|0,d=0;do{pA(f),d=d+1|0}while((0|d)!=(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(x=v+4|0,l,x),nA(x),x=51}}else if(JA(t,o,v),!!(0|a)&!!(0|s))if((0|m)!=(0|h)&&M(27621,27538,261,27548),7==(0|(d=0|OA(A,e)))|7==(0|(u=0|OA(t,o))))u=5;else if(0|r[22e3+(7*d|0)+u|0])u=1;else if((0|(d=0|n[21168+(28*d|0)+(u<<2)>>2]))>0){f=v+4|0,u=0;do{pA(f),u=u+1|0}while((0|u)!=(0|d));x=51}else x=51;else x=51}while(0);return 51==(0|x)&&(u=v+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),P=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,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0;if(a=P,P=P+48|0,o=a+36|0,c=a+24|0,u=a+12|0,d=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 P=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)))?(P=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,P=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,d),nA(d),x=0|n[(s=r)>>2],s=0|n[s+4>>2],p=0|rt(7,0,0|(v=3*(15-l|0)|0)),s&=~B(),v=0|rt(0|lA(d),0,0|v),s=0|B()|s,n[(b=r)>>2]=v|x&~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){d=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|xA(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,f=s)}else m=s,h=0,f=t;if((0|(u=0|n[4272+(28*g|0)+(f<<2)>>2]))<=-1&&M(27724,27538,419,27678),!d){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[(v=r)>>2]=t,n[v+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[(v=r)>>2]=t,n[v+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[(v=r)>>2]=t,n[v+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[(v=r)>>2]=l,n[v+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|d)){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[(v=r)>>2]=c,n[v+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)&&d&&(t=59),59==(0|t)&&1==(0|OA(0|n[(v=r)>>2],0|n[v+4>>2]))){s=9;break}p=0|n[(v=r)>>2],v=-1040385&n[v+4>>2],x=0|rt(0|s,0,45),v=0|v|B(),n[(s=r)>>2]=p|x,n[s+4>>2]=v,s=0}else s=1}while(0);return P=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 xe(A,e,t,r){t|=0,r|=0;var i,a=0,s=0,l=0,c=0,u=0,f=0;i=P,P=P+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/+d(+u),f=+o[25968+(l<<3)>>3],o[t>>3]=u+f,o[t+8>>3]=u-f,u=+o[s+8>>3],c*=f,o[t+16>>3]=c+u,o[t+24>>3]=u-c;break}return P=i,0|a}if(a=0|tt(0|A,0|e,45),B(),(a&=127)>>>0>121)return P=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]?(P=i,0|(l=0)):(o[t+16>>3]=3.141592653589793,o[t+24>>3]=-3.141592653589793,P=i,0|(l=0))}function ve(A){var e,t,o,i,a=0,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=0,y=0;if(i=P,P=P+336|0,e=i+168|0,t=i,!(0|(s=0|n[(l=A|=0)>>2]))&!(0|(l=0|n[l+4>>2])))P=i;else{if(0|r[0|(a=A+28|0)]?(s=0|we(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(P=i);c=15&(a=0|n[(y=A+16|0)>>2]);A:do{if(!(0|s)&!(0|l))w=A+24|0;else{x=A+12|0,b=3==(0|c),m=255&a,g=3==(1|c),p=A+24|0,h=(c+-1|0)>>>0<3,d=3==(2|c),f=t+8|0;e:for(;;){if(u=0|tt(0|s,0|l,52),B(),(0|(u&=15))==(0|n[x>>2])){switch(15&m){case 0:case 2:case 3:if(0|(c=0|qA(s,l,e))){v=15;break e}if(0|Me(0|n[o>>2],0|n[p>>2],e)){v=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)){v=25;break}if((0|n[(c=t)>>2])==(0|s)&&(0|n[c+4>>2])==(0|l)){v=29;break}}if(h){if(0|(c=0|$A(s,l,e))){v=32;break}if(0|xe(s,l,t,0)){v=36;break}if(d&&0|De(0|n[o>>2],0|n[p>>2],e,t)){v=42;break}if(g&&0|Ne(0|n[o>>2],0|n[p>>2],e,t)){v=42;break}}if(b){if(a=0|xe(s,l,e,1),c=0|n[p>>2],0|a){v=45;break}if(0|q(c,e)){if(AA(t,e),0|$(e,0|n[p>>2])){v=53;break}if(0|Me(0|n[o>>2],0|n[p>>2],f)){v=53;break}if(0|Ne(0|n[o>>2],0|n[p>>2],t,e)){v=53;break}}}}do{if((0|u)<(0|n[x>>2])){if(a=0|xe(s,l,e,1),c=0|n[p>>2],0|a){v=58;break e}if(!(0|q(c,e))){v=73;break}if(0|$(0|n[p>>2],e)&&(AA(t,e),0|De(0|n[o>>2],0|n[p>>2],t,e))){v=65;break e}if(0|(s=0|GA(s,l,u+1|0,t))){v=67;break e}s=0|n[(l=t)>>2],l=0|n[l+4>>2]}else v=73}while(0);if(73==(0|v)&&(v=0,s=0|we(s,l),l=0|B()),!(0|s)&!(0|l)){w=p;break A}}switch(0|v){case 15:0|(a=0|n[p>>2])&&Ye(a),n[(v=A)>>2]=0,n[v+4>>2]=0,n[o>>2]=0,n[x>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=c,v=20;break;case 19:n[A>>2]=s,n[A+4>>2]=l,v=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(P=i);case 32:return 0|(a=0|n[p>>2])&&Ye(a),n[(w=A)>>2]=0,n[w+4>>2]=0,n[o>>2]=0,n[x>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=c,void(P=i);case 36:M(27795,27761,493,27772);break;case 45:0|c&&Ye(c),n[(v=A)>>2]=0,n[v+4>>2]=0,n[o>>2]=0,n[x>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=a,v=55;break;case 53:n[A>>2]=s,n[A+4>>2]=l,v=55;break;case 58:0|c&&Ye(c),n[(v=A)>>2]=0,n[v+4>>2]=0,n[o>>2]=0,n[x>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=a,v=71;break;case 65:n[A>>2]=s,n[A+4>>2]=l,v=71;break;case 67:return 0|(a=0|n[p>>2])&&Ye(a),n[(w=A)>>2]=0,n[w+4>>2]=0,n[o>>2]=0,n[x>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=s,void(P=i)}if(20==(0|v))return void(P=i);if(55==(0|v))return void(P=i);if(71==(0|v))return void(P=i)}}while(0);0|(a=0|n[w>>2])&&Ye(a),n[(v=A)>>2]=0,n[v+4>>2]=0,n[A+8>>2]=0,n[o>>2]=0,n[A+12>>2]=-1,n[y>>2]=0,n[w>>2]=0,P=i}}function we(A,e){var t,r=0,o=0,i=0,a=0,s=0,l=0,c=0,u=0,d=0;t=P,P=P+16|0,d=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 d=0|rt(((d=!(0|c)&!!(0|HA(r,i)))?2:1)+c|0,0,0|a),u=0|B()|e&~l,d|=A&~s,C(0|u),P=t,0|d}}while(0);return(r&=127)>>>0>120?(d=0,C(0|(u=0)),P=t,0|d):(RA(d,0,r+1|0,0),u=0|n[d+4>>2],d=0|n[d>>2],C(0|u),P=t,0|d)}function ye(A,e,t){A|=0;var r,i=0,a=0,s=0,l=0,c=0,u=0,d=0,f=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,f=a,t=-1,A=0;A:for(;;){for(d=A;l=+o[r+(d<<4)>>3],a=+o[r+(d<<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=d+1|0))>=(0|g)){t=22;break A}A=d,d=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)>(f=c==f|l==f?f+-2220446049250313e-31:f)&&(e^=1),(0|(A=d+1|0))>=(0|g)){t=22;break}t=d}if(22==(0|t))return 0|e}else{e=0,f=a,t=-1,A=0;A:for(;;){for(d=A;l=+o[r+(d<<4)>>3],a=+o[r+(d<<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=d+1|0))>=(0|g)){t=22;break A}A=d,d=t,t=A}if(l+(i-s)/(u-s)*(a-l)>(f=l==f|a==f?f+-2220446049250313e-31:f)&&(e^=1),(0|(A=d+1|0))>=(0|g)){t=22;break}t=d}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,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=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,x=0,A=-1,f=17976931348623157e292,g=17976931348623157e292,m=-17976931348623157e292,u=-17976931348623157e292,v=0;c=+o[t+(v<<4)>>3],h=+o[t+(v<<4)+8>>3],d=+o[t+(((0|(A=A+2|0))==(0|r)?0:A)<<4)+8>>3],c>3]=c,f=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,x|=+l(+(h-d))>3.141592653589793,(0|(A=v+1|0))!=(0|r);)w=v,m=c,v=A,A=w;x&&(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,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=0,y=0,k=0,C=0,B=0,M=0;if(p=0|n[(A|=0)>>2]){if(o[(x=e+8|0)>>3]=17976931348623157e292,o[(v=e+24|0)>>3]=17976931348623157e292,o[e>>3]=-17976931348623157e292,o[(w=e+16|0)>>3]=-17976931348623157e292,(0|p)>0){for(a=0|n[A+4>>2],m=17976931348623157e292,b=-17976931348623157e292,i=0,r=-1,d=17976931348623157e292,f=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,d=s),g>3]=g,f=g),s>h?o[e>>3]=s:s=h,g>c&&(o[w>>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[w>>3]=b,o[v>>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,v=e+((C=C+1|0)<<5)|0,w=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[v>>3]=-17976931348623157e292,o[(k=e+(C<<5)+16|0)>>3]=-17976931348623157e292,(0|w)>0){for(p=0|n[a+(i<<3)+4>>2],m=17976931348623157e292,b=-17976931348623157e292,a=0,i=-1,x=0,d=17976931348623157e292,f=17976931348623157e292,g=-17976931348623157e292,c=-17976931348623157e292;s=+o[p+(x<<4)>>3],h=+o[p+(x<<4)+8>>3],u=+o[p+(((0|(i=i+2|0))==(0|w)?0:i)<<4)+8>>3],s>3]=s,d=s),h>3]=h,f=h),s>g?o[v>>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=x+1|0))!=(0|w);)M=x,x=i,g=s,i=M;a&&(o[k>>3]=b,o[A>>3]=m)}}else n[v>>2]=0,n[v+4>>2]=0,n[v+8>>2]=0,n[v+12>>2]=0,n[v+16>>2]=0,n[v+20>>2]=0,n[v+24>>2]=0,n[v+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=P,P=P+16|0,o=i,!(0|ye(A|=0,e|=0,l=8+(t|=0)|0)))return P=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 P=i,0|a}}while(0);if(0|Ee(A,e,t,r))return P=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 P=i,0|a}function Ee(A,e,t,r){A|=0,t|=0;var i,a,s,l,c,u,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=0,y=0,k=0,C=0,B=0,M=0;if(u=P,P=P+176|0,l=u+172|0,d=u+168|0,c=u,!(0|q(e|=0,r|=0)))return P=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,d),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[d>>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[d>>2]),i=+ie(+o[r+24>>3],0|n[d>>2]);A:do{if((0|n[A>>2])>0){if(r=A+4|0,(0|(d=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],v=+o[e+(t<<4)>>3],w=+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,f=+o[e+(B<<4)>>3],g=+ie(+o[e+(B<<4)+8>>3],0|n[l>>2]),!(v>=a)|!(f>=a)&&!(v<=s)|!(f<=s)&&!(w<=i)|!(g<=i)&&!(w>=y)|!(g>=y)){x=f-v,b=g-w,e=0;do{if(M=e,B=(0|(e=e+1|0))==(0|d)?0:e,f=+o[c+8+(M<<4)+8>>3],g=+o[c+8+(B<<4)+8>>3]-f,h=+o[c+8+(M<<4)>>3],!(0==(p=x*g-b*(m=+o[c+8+(B<<4)>>3]-h))||(k=w-f,C=v-h,m=(k*m-g*C)/p,m<0|m>1))&&(p=(x*k-b*C)/p)>=0&p<=1){e=1;break A}}while((0|e)<(0|d))}if((0|t)>=(0|n[A>>2])){e=0;break}}}else e=0}while(0);return P=u,0|e}function Ne(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 Qe(A,e,t,r,n){e|=0,t|=0,r|=0,n|=0;var i,a,s,l,c,u,d,f=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],f=((f=+o[r>>3]-u)*(a-(d=+o[t+8>>3]))-(l-u)*(c=+o[r+8>>3]-d))/(s*c-i*f),o[n>>3]=l+s*f,o[n+8>>3]=a+i*f}function je(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 Pe(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=P,P=P+32|0,u=a,0|(s=0|XA(A|=0,e|=0,o=a+16|0)))return P=a,0|s;r=0|LA(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,P=a,0}function Se(A,e,t,r){t|=0,r|=0;var o,i,a,s,l,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0;if(l=P,P=P+32|0,v=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 P=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 P=l,1;if(0|Fe(A,e,v))return P=l,1;if(u=(0|n[v>>2])+t|0,7==(0|(p=0|n[(c=c?26704+((0|u)%5<<2)|0:26736+((0|u)%6<<2)|0)>>2])))return P=l,1;n[s>>2]=0,c=0|R(A,e,p,s,a);do{if(!c){if(h=0|n[(f=a)>>2],u=(d=(f=0|n[f+4>>2])>>>0>>0|(0|f)==(0|e)&h>>>0>>0)?h:A,d=d?f:e,!b&&!(h&(b=0|rt(7,0,3*(15^m)|0)))&!(f&(0|B())))c=t;else{if(f=(t+-1+g|0)%(0|g)|0,c=0|HA(A,e),(0|f)<0&&M(27795,27797,248,27822),(0|((g=!!(0|c))?4:5))<(0|f)&&M(27795,27797,248,27822),0|Fe(A,e,v)&&M(27795,27797,248,27822),c=(0|n[v>>2])+f|0,7==(0|(f=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|R(A,e,f,i,o)))break;g=0|n[(h=o)>>2],h=0|n[h+4>>2];do{if(h>>>0>>0|(0|h)==(0|d)&g>>>0>>0){if(u=0|HA(g,h)?0|_(g,h,A,e):0|n[26800+(((0|n[i>>2])+(0|n[26768+(f<<2)>>2])|0)%6<<2)>>2],c=0|HA(g,h),(u+-1|0)>>>0>5){c=-1,u=g,d=h;break}if(1==(0|u)&(c=!!(0|c))){c=-1,u=g,d=h;break}do{if(!(0|Fe(g,h,v))){if(c){c=(5+(0|n[26352+(u<<2)>>2])-(0|n[v>>2])|0)%5|0;break}c=(6+(0|n[26384+(u<<2)>>2])-(0|n[v>>2])|0)%6|0;break}c=-1}while(0);u=g,d=h}else c=t}while(0);h=0|n[(f=a)>>2],f=0|n[f+4>>2]}if((0|u)==(0|h)&(0|d)==(0|f)){if(A=(g=!!(0|HA(h,f)))?0|_(h,f,A,e):0|n[26800+(((0|n[s>>2])+(0|n[26768+(p<<2)>>2])|0)%6<<2)>>2],c=0|HA(h,f),(A+-1|0)>>>0<=5&&!(1==(0|A)&(x=!!(0|c))))do{if(!(0|Fe(h,f,v))){if(x){c=(5+(0|n[26352+(A<<2)>>2])-(0|n[v>>2])|0)%5|0;break}c=(6+(0|n[26384+(A<<2)>>2])-(0|n[v>>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=d,A=u;break A}}while(0);return P=l,0|c}}while(0);return x=0|rt(0|c,0,56),v=B()|-2130706433&e|536870912,n[r>>2]=x|A,n[r+4>>2]=v,P=l,0}function Le(A,e){A|=0;var t,r,o=0,i=0;return r=P,P=P+16|0,t=r,!0&536870912==(2013265920&(e|=0))&&0|IA(A,o=-2130706433&e|134217728)?(i=0|tt(0|A,0|e,56),B(),o=(i=!(0|Se(A,o,7&i,t)))&((0|n[(o=t)>>2])==(0|A)?(0|n[o+4>>2])==(0|e):0)&1,P=r,0|o):(P=r,0|(o=0))}function Ie(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 Re(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 Te(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,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=0,y=0;e=P,P=P+16|0,g=e;do{if(A>>>0<245){if(A=(u=A>>>0<11?16:A+11&-8)>>>3,3&(r=(f=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]=f&~(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],P=e,0|i;if(u>>>0>(d=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=f&~(1<>2]=t,n[A>>2]=r,A=f),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|d&&(o=0|n[6986],r=27964+((t=d>>>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,P=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|d&&(o=0|n[6986],r=27964+((t=d>>>3)<<1<<2)|0,(t=1<>2]:(n[6981]=t|f,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),P=e,0|l+8}f=u}else f=u}else f=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<<(f=(A+1048320|0)>>>16&8))|0)>>>16&4)|f|(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=f>>>12&16)>>>5&8)|s|(l=(f>>>=a)>>>2&4)|(c=(f>>>=l)>>>1&2)|(r=(f>>>=c)>>>1&1))+(f>>>r)<<2)>>2]}r?b=65:(l=A,s=i)}if(65==(0|b))for(a=r;;){if(i=(r=(f=(-8&n[a+4>>2])-u|0)>>>0>>0)?f: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&&(d=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[d+4>>2]=1|s,n[d+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]=d,n[t+12>>2]=d,n[d+8>>2]=t,n[d+12>>2]=r;break}if(t=28228+((r=(t=s>>>8)?s>>>0>16777215?31:s>>>(7+(r=14-((v=(520192+(y=t<<(w=(t+1048320|0)>>>16&8))|0)>>>16&4)|w|(r=(245760+(y<<=v)|0)>>>16&2))+(y<>>15)|0)|0)&1|r<<1:0)<<2)|0,n[d+28>>2]=r,n[4+(A=d+16|0)>>2]=0,n[A>>2]=0,!(o&(A=1<>2]=d,n[d+24>>2]=t,n[d+12>>2]=d,n[d+8>>2]=d;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]=d,n[d+24>>2]=t,n[d+12>>2]=d,n[d+8>>2]=d;break A}}while(0);y=0|n[(w=t+8|0)>>2],n[y+12>>2]=d,n[w>>2]=d,n[d+8>>2]=y,n[d+12>>2]=t,n[d+24>>2]=0}}while(0);return P=e,0|l+8}f=u}else f=u;else f=-1}while(0);if((r=0|n[6983])>>>0>=f>>>0)return t=r-f|0,A=0|n[6986],t>>>0>15?(y=A+f|0,n[6986]=y,n[6983]=t,n[y+4>>2]=1|t,n[A+r>>2]=t,n[A+4>>2]=3|f):(n[6983]=0,n[6986]=0,n[A+4>>2]=3|r,n[(y=A+r+4|0)>>2]=1|n[y>>2]),P=e,0|A+8;if((s=0|n[6984])>>>0>f>>>0)return v=s-f|0,n[6984]=v,w=(y=0|n[6987])+f|0,n[6987]=w,n[w+4>>2]=1|v,n[y+4>>2]=3|f,P=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=f+48|0,(u=(a=A+(c=f+47|0)|0)&(i=0-A|0))>>>0<=f>>>0)return P=e,0;if(0|(A=0|n[7091])&&(g=(d=0|n[7089])+u|0)>>>0<=d>>>0|g>>>0>A>>>0)return P=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>f>>>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|(v=0|ut(0|u)))|1^(x=(p=(m=0|ut(0))-v|0)>>>0>(f+40|0)>>>0)|v>>>0>>0&-1!=(0|v)&-1!=(0|m)^1)&&(s=x?p:t,a=v,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)||(w=t+4|0,8&n[t+12>>2]))&&a>>>0>c>>>0&A>>>0<=c>>>0){n[w>>2]=r+s,w=c+(v=7&(v=c+8|0)?0-v&7:0)|0,v=(y=(0|n[6984])+s|0)-v|0,n[6987]=w,n[6984]=v,n[w+4>>2]=1|v,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[(d=t+4|0)>>2]=(0|n[d>>2])+s,u=(d=a+(7&(d=a+8|0)?0-d&7:0)|0)+f|0,l=(t=r+(7&(t=r+8|0)?0-t&7:0)|0)-d-f|0,n[d+4>>2]=3|f;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-((v=(520192+(y=t<<(w=(t+1048320|0)>>>16&8))|0)>>>16&4)|w|(o=(245760+(y<<=v)|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[(w=t+8|0)>>2],n[y+12>>2]=u,n[w>>2]=u,n[u+8>>2]=y,n[u+12>>2]=t,n[u+24>>2]=0}}while(0);return P=e,0|d+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,w=a+(v=7&(v=a+8|0)?0-v&7:0)|0,v=(r=s+-40|0)-v|0,n[6987]=w,n[6984]=v,n[w+4>>2]=1|v,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{w=t,n[(t=t+4|0)>>2]=7}while((w+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-((v=(520192+(y=t<<(w=(t+1048320|0)>>>16&8))|0)>>>16&4)|w|(o=(245760+(y<<=v)|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[(w=t+8|0)>>2],n[y+12>>2]=c,n[w>>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,w=a+(v=7&(v=a+8|0)?0-v&7:0)|0,v=(y=s+-40|0)-v|0,n[6987]=w,n[6984]=v,n[w+4>>2]=1|v,n[a+y+4>>2]=40,n[6988]=n[7103]}while(0);if((t=0|n[6984])>>>0>f>>>0)return v=t-f|0,n[6984]=v,w=(y=0|n[6987])+f|0,n[6987]=w,n[w+4>>2]=1|v,n[y+4>>2]=3|f,P=e,0|y+8}return n[(y=27920)>>2]=12,P=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|v(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,d=0,f=0,g=0,h=0;if(u=A|=0,a=t|=0,s=f=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|(f=0)),o)):(o=0,0|(C(0|(f=0)),o)):(i&&(n[o>>2]=(u>>>0)%(a>>>0),n[o+4>>2]=0),o=(u>>>0)/(a>>>0)>>>0,0|(C(0|(f=0)),o));i=!(0|s);do{if(a){if(!i){if((i=(0|k(0|s))-(0|k(0|c))|0)>>>0<=31){a=d=i+1|0,A=u>>>(d>>>0)&(e=i-31>>31)|c<<(s=31-i|0),e&=c>>>(d>>>0),i=0,s=u<>2]=0|A,n[o+4>>2]=l|0&e,o=0,0|(C(0|(f=0)),o)):(o=0,0|(C(0|(f=0)),o))}if((i=a-1|0)&a){a=s=33+(0|k(0|a))-(0|k(0|c))|0,A=(d=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=d>>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|(d=0|t),0|(u=f|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|(f=A>>>31|e<<1)),s=1&(g=(h=0|B())>>31|((0|h)<0?-1:0)<<1),A=0|Ze(0|r,0|f,g&d|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|v(o=65535&(e|=0),n=65535&(A|=0)))>>>16)+(0|v(o,r=A>>>16))|0,e=0|v(o=e>>>16,n),0|(C((A>>>16)+(0|v(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|v(e,o))+(0|v(r,n))+A|0&A),t)}function $e(A,e,t,r){var o,i,a,s,l,c;return t|=0,o=P,P=P+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(),P=o,0|(C(0|t),r)}function At(A,e,t,r){var o,i;return i=P,P=P+16|0,Je(A|=0,e|=0,t|=0,r|=0,o=0|i),P=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):+x(A-.5)}function st(A,e,t){A|=0,e|=0;var o,i,a=0;if((0|(t|=0))>=8192)return N(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):+x(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?(j(0|e),D(12),-1):(0|e)>(0|r)&&!(0|Q(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,d=0;if(s=P,P=P+64|0,a=s,i=s+56|0,!(!0&134217728==(2013265920&(e|=0))&!0&134217728==(2013265920&(r|=0))))return P=s,5;if((0|(A|=0))==(0|(t|=0))&(0|e)==(0|r))return n[o>>2]=0,P=s,0;if(c=0|tt(0|A,0|e,52),B(),c&=15,d=0|tt(0|t,0|r,52),B(),(0|c)!=(15&d))return P=s,12;if(l=c+-1|0,c>>>0>1){TA(A,e,l,a),TA(t,r,l,i),u=0|n[(d=a)>>2],d=0|n[d+4>>2];A:do{if((0|u)==(0|n[i>>2])&&(0|d)==(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,d)){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 P=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,P=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,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0;if(o=P,P=P+16|0,p=o,x=0|tt(0|(A|=0),0|(e|=0),52),B(),t>>>0>15)return P=o,4;if((0|(x&=15))<(0|t))return P=o,12;if((0|x)!=(0|t))if(a=0|rt(0|t,0,52),a|=A,l=B()|-15728641&e,(0|x)>(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|x));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|x)>(0|t)){for(m=-15728641&e,h=x;;){if(g=h,(h=h+-1|0)>>>0>15|(0|x)<(0|h)){u=19;break}if((0|x)!=(0|h))if(a=0|rt(0|h,0,52),a|=A,c=0|B()|m,(0|x)<(0|g))f=a;else{u=h;do{f=0|rt(7,0,3*(14-u|0)|0),u=u+1|0,a|=f,c=0|B()|c}while((0|u)<(0|x));f=a}else f=A,c=e;if(d=0|tt(0|f,0|c,45),B(),0|z(127&d)){d=0|tt(0|f,0|c,52),B(),d&=15;e:do{if(d)for(u=1;;){if(a=0|tt(0|f,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|(f=c+((!!(0|c)&a)<<31>>31)|0)&&(u=0|pe(7,0,u=x-g|0,((0|u)<0)<<31>>31),d=0|B(),a?(a=0|Ve(0|(a=0|qe(0|u,0|d,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=d),g=0|Ve(0|a,0|c,0|(g=0|qe(0|u,0|d,0|(g=f+-1|0),((0|g)<0)<<31>>31)),0|B()),d=0|Ve(0|g,0|(f=0|B()),0|n[(d=r)>>2],0|n[d+4>>2]),f=0|B(),n[(g=r)>>2]=d,n[g+4>>2]=f),(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 P=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|x)>(0|t)){for(a=x;;){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=x-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 P=o,0|i}i=0,s=0}}while(0);return 0|_A(b,l,x,p)&&M(27795,27122,1327,27173),((0|i)>-1|-1==(0|i)&s>>>0>4294967295)&((0|(p=0|n[(x=p)+4>>2]))>(0|i)|((0|p)==(0|i)?(0|n[x>>2])>>>0>s>>>0:0))?(P=o,0|(x=0)):(M(27795,27122,1407,27158),0)},_cellToChildren:function(A,e,t,r){r|=0;var o,i,a=0,s=0;if(i=P,P=P+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 P=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 P=i,0},_cellToChildrenSize:_A,_cellToLatLng:qA,_cellToLocalIj:function(A,e,t,r,o,i){var a,s;return A|=0,i|=0,s=P,P=P+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),P=s,0|A},_cellToParent:TA,_cellToVertex:Se,_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|Se(A,e,0,t))),i?r?0|(o=0|Se(A,e,1,t+8|0))||0|(o=0|Se(A,e,2,t+16|0))||0|(o=0|Se(A,e,3,t+24|0))||(o=0|Se(A,e,4,t+32|0))?0|(i=o):0|Se(A,e,5,t+40|0):0|(i=o):r?0|(o=0|Se(A,e,1,t+8|0))||0|(o=0|Se(A,e,2,t+16|0))||0|(o=0|Se(A,e,3,t+24|0))||0|(o=0|Se(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=P,P=P+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=P,P=P+176|0,r=o,(0|(e|=0))<1)return Ie(t,0,0),P=o,0;for(c=0|tt(0|n[(c=A)>>2],0|n[c+4>>2],52),B(),Ie(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)?(P=o,0|i):(Re(t),P=o,0|(u=i))}(A|=0,e|=0,i=a+16|0)))return P=a,0|A;if(n[t>>2]=0,n[t+4>>2]=0,n[t+8>>2]=0,0|(A=0|Te(i)))do{e=0|de(t);do{fe(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|Te(i)}while(0|A);return Re(i),(A=0|function(A){var e,t,r=0,i=0,a=0,s=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=0,y=0,k=0,C=0,B=0,D=0,E=0,N=0,Q=0,j=0,P=0,F=0,S=0,L=0,I=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,S=0,D=0,m=0;A:for(;;){if(h=0|n[a>>2]){c=0,u=h;do{if(f=+o[u+8>>3],r=u,u=0|n[u+16>>2],d=+o[(s=(g=!(0|u))?h:u)+8>>3],+l(+(f-d))>3.141592653589793){I=14;break}c+=(d-f)*(+o[r>>3]+ +o[s>>3])}while(!g);if(14==(0|I)){I=0,c=0,r=h;do{B=+o[r+8>>3],P=0|n[(F=r+16|0)>>2],C=+o[(P=0|P?P:h)+8>>3],c+=(+o[r>>3]+ +o[P>>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+(S<<2)>>2]=a,S=S+1|0,s=D,r=m):I=19}else I=19;if(19==(0|I)){I=0;do{if(!i){if(m){s=E,u=m+8|0,r=a,i=A;break}if(0|n[A>>2]){I=27;break A}s=E,u=A,r=a,i=A;break}if(0|n[(r=i+8|0)>>2]){I=21;break A}if(!(i=0|We(1,12))){I=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,f=17976931348623157e292,v=17976931348623157e292,w=-17976931348623157e292,d=-17976931348623157e292;c=+o[p>>3],B=+o[p+8>>3],p=0|n[p+16>>2],C=+o[((x=!(0|p))?g:p)+8>>3],c>3]=c,f=c),B>3]=B,v=B),c>w?o[u>>3]=c:c=w,B>d&&(o[b>>3]=B,d=B),y=B>0&Bk?B:k,s|=+l(+(B-C))>3.141592653589793,!x;)w=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){I=45;break}D=s,m=r}if(21==(0|I))M(27213,27235,35,27247);else if(23==(0|I))M(27267,27235,37,27247);else if(27==(0|I))M(27310,27235,61,27333);else if(45==(0|I)){A:do{if((0|S)>0){for(F=!(0|s),j=s<<2,P=!(0|A),Q=0,r=0;;){if(N=0|n[t+(Q<<2)>>2],F)I=73;else{if(!(D=0|Ue(j))){I=50;break}if(!(E=0|Ue(j))){I=52;break}e:do{if(P)i=0;else{for(s=0,i=0,u=A;a=e+(s<<5)|0,0|he(0|n[u>>2],a,0|n[N>>2])?(n[D+(i<<2)>>2]=u,n[E+(i<<2)>>2]=a,x=i+1|0):x=i,u=0|n[u+8>>2];)s=s+1|0,i=x;if((0|x)>0)if(a=0|n[D>>2],1==(0|x))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|x);)a=h;if(i=(s=(0|h)>(0|p))?m:i,(0|(a=b+1|0))==(0|x))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]){I=70;break}n[i>>2]=N,n[s>>2]=N}else I=73}if(73==(0|I)){if(I=0,0|(r=0|n[N>>2]))do{E=r,r=0|n[r+16>>2],Ye(E)}while(0|r);Ye(N),r=1}if((0|(Q=Q+1|0))>=(0|S)){L=r;break A}}50==(0|I)?M(27452,27235,249,27471):52==(0|I)?M(27490,27235,252,27471):70==(0|I)&&M(27310,27235,61,27333)}else L=0}while(0);return Ye(t),Ye(e),0|L}return 0}(t))?(ge(t),P=a,0|(s=A)):(P=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,d=0,f=0,g=0,h=0,m=0;if(a=P,P=P+16|0,s=a,(o|=0)>>>0>15)return P=a,4;if(l=0|tt(0|(t|=0),0|(r|=0),52),B(),(0|(l&=15))>(0|o))return P=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[(d=s)+4>>2]))>(0|e)|((0|u)==(0|e)?(0|n[d>>2])>>>0>A>>>0:0))))return P=a,2;d=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|d)<1)return P=a,0;for(u=15^l,r=-1,c=1,s=1;;){l=0|pe(7,0,l=d-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[(f=i)>>2],f=0|n[f+4>>2],g=0|rt(7,0,0|(m=3*(u+r|0)|0)),f&=~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),f=0|B()|f,n[(o=i)>>2]=m|h&~g,n[o+4>>2]=f,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],f=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&~f,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|d)>(0|c))){e=0;break}r=~c,c=c+1|0}return P=a,0|e}}while(0);if((0|d)<1)return P=a,0;for(o=15^l,s=1;;){if(h=0|pe(7,0,h=d-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|(f=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|f,0|g,0|h,0|m)),0|B()),e=0|B(),(0|d)<=(0|s)){e=0;break}s=s+1|0}return P=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,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=0,y=0,k=0,C=0,D=0,E=0,N=0,Q=0,j=0,P=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[(P=e)>>2]=a,n[P+4>>2]=i,1==(0|t)&!(0|r))return 0;i=1,a=0;do{j=0|n[4+(Q=A+(i<<3)|0)>>2],n[(P=e+(i<<3)|0)>>2]=n[Q>>2],n[P+4>>2]=j,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(!(j=0|Ue(o=t<<3)))return 13;if(st(0|j,0|A,0|o),!(Q=0|We(t,8)))return Ye(j),13;A:for(;;){E=0|tt(0|(u=0|n[(i=j)>>2]),0|(i=0|n[i+4>>2]),52),B(),N=(E&=15)-1|0,D=!!(0|E),C=(0|r)>0|!(0|r)&t>>>0>0;e:do{if(D&C){if(v=0|rt(0|N,0,52),w=0|B(),N>>>0>15){if(!(!(0|u)&!(0|i))){P=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=j+(a<<3)|0)>>2]))&!(0|(s=0|n[s+4>>2])))){i=s,P=16;break A}}}for(l=u,A=i,a=0,s=0;;){if(!(!(0|l)&!(0|A))){if(!(!0&!(117440512&A))){P=21;break A}if(d=0|tt(0|l,0|A,52),B(),(0|(d&=15))<(0|N)){i=12,P=27;break A}if((0|d)!=(0|N)&&(l|=v,A=-15728641&A|w,d>>>0>=E>>>0)){c=N;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|(f=0|n[(d=c=Q+(g<<3)|0)>>2]))&!(0|(d=0|n[d+4>>2])))){p=0,x=0;do{if((0|p)>(0|r)|(0|p)==(0|r)&x>>>0>t>>>0){P=31;break A}if((0|f)==(0|l)&(-117440513&d)==(0|A)){m=0|tt(0|f,0|d,56),B(),b=1+(m&=7)|0,k=0|tt(0|f,0|d,45),B();t:do{if(0|z(127&k)){if(f=0|tt(0|f,0|d,52),B(),!(f&=15)){d=6;break}for(d=1;;){if(!(!((k=0|rt(7,0,3*(15-d|0)|0))&l)&!((0|B())&A))){d=7;break t}if(!(d>>>0>>0)){d=6;break}d=d+1|0}}else d=7}while(0);if((m+2|0)>>>0>d>>>0){P=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();x=0|Ve(0|x,0|p,1,0),p=0|B(),f=0|n[(d=c=Q+(g<<3)|0)>>2],d=0|n[d+4>>2]}while(!(!(0|f)&!(0|d)))}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=j+(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){P=85;break}if(k=0|Xe(0|t,0|r,6,0),B(),!(k=0|We(k,8))){P=48;break}do{if(C){for(b=0,A=0,m=0,p=0;;){if(!(0|(a=0|n[(s=d=Q+(b<<3)|0)>>2]))&!(0|(s=0|n[s+4>>2])))y=m;else{f=0|tt(0|a,0|s,56),B(),l=1+(f&=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=d)>>2]=a,n[l+4>>2]=s,l=f+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(x=N>>>0>15,v=0|rt(0|N,0,52),w=0|B(),!D){for(a=0,c=0,l=0,s=0;!(0|u)&!(0|i)||(n[(N=e+(a<<3)|0)>>2]=u,n[N+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=j+(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(),x|(0|(h&=15))<(0|N)){P=80;break A}if((0|h)!=(0|N)){if(d=u|v,f=-15728641&i|w,h>>>0>=E>>>0){g=N;do{D=0|rt(7,0,3*(14-g|0)|0),g=g+1|0,d|=D,f=0|B()|f}while(g>>>0>>0)}}else d=u,f=i;m=0|At(0|d,0|f,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){P=81;break A}if((-117440513&(b=0|n[4+(D=Q+(m<<3)|0)>>2]))==(0|f)&&(0|n[D>>2])==(0|d)){P=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=Q+(m<<3)|0}while((0|n[D>>2])!=(0|d)||(0|n[D+4>>2])!=(0|f));if(65==(0|P)&&(P=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=j+(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|Q,0,0|o),st(0|j,0|k,A<<3),Ye(k),!(0|A)&!(0|i)){P=89;break}e=e+(a<<3)|0,r=i,t=A}if(16==(0|P))!0&!(117440512&i)?(i=4,P=27):P=21;else if(31==(0|P))M(27795,27122,620,27132);else{if(41==(0|P))return Ye(j),Ye(Q),10;if(48==(0|P))return Ye(j),Ye(Q),13;80==(0|P)?M(27795,27122,711,27132):81==(0|P)?M(27795,27122,723,27132):85==(0|P)&&(st(0|e,0|j,t<<3),P=89)}return 21==(0|P)?(Ye(j),Ye(Q),0|(P=5)):27==(0|P)?(Ye(j),Ye(Q),0|(P=i)):89==(0|P)?(Ye(j),Ye(Q),0|(P=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=P,P=P+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|R(A,o,7&e,a,t+8|0),P=r,0|a):(P=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=P,P=P+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,P=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,P=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=+f(.5*(i-g)),u=a,a=+o[l+8+(A<<4)+8>>3],u=h*h+(u=+f(.5*(a-u)))*(+d(+g)*+d(+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,P=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=P,P=P+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,P=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,P=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=+f(.5*(i-g)),u=a,a=+o[l+8+(A<<4)+8>>3],u=h*h+(u=+f(.5*(a-u)))*(+d(+g)*+d(+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,P=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=P,P=P+176|0,0|(A=0|DA(A|=0,e|=0,l=r)))return P=r,0|A;if(o[t>>3]=0,(0|(A=0|n[l>>2]))<=1)return P=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=+f(.5*(i-g)),u=a,a=+o[l+8+(A<<4)+8>>3],u=h*h+(u=+f(.5*(a-u)))*(+d(+i)*+d(+g)*u),s+=2*+p(+ +c(+u),+ +c(+(1-u)))}while((0|A)<(0|e));return o[t>>3]=s,P=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:LA,_getDirectedEdgeDestination:function(A,e,t){A|=0,e|=0,t|=0;var r,o,i=0;return r=P,P=P+16|0,n[(i=r)>>2]=0,!0&268435456==(2013265920&e)?(o=0|tt(0|A,0|e,56),B(),i=0|R(A,-2130706433&e|134217728,7&o,i,t),P=r,0|i):(P=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,d=0,f=0;o=P,P=P+128|0,d=o+112|0,s=o+96|0,f=o,a=0|tt(0|(e|=0),0|(t|=0),52),B(),c=15&a,n[d>>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),f=B()|-15728641&t,f=0|A((u|e)&~(d=0|rt(7,0,3*(14-c|0)|0)),f&~B(),r),P=o,0|f;a=1}else a=0}while(0);if(!(i=0|XA(e,t,s))){a?(QA(s,d,f),u=5):(SA(s,d,f),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(PA(l=f+(s<<4)|0,0|n[d>>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(jA(l=f+(s<<4)|0,0|n[d>>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 P=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=+f(.5*(r-t)))*n+(i=+f(.5*(+o[e+8>>3]-+o[A+8>>3])))*(+d(+r)*+d(+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=+f(.5*(r-t)))*n+(i=+f(.5*(+o[e+8>>3]-+o[A+8>>3])))*(+d(+r)*+d(+t)*i),2*+p(+ +c(+i),+ +c(+(1-i)))},_gridDisk:F,_gridDiskDistances:S,_gridDistance:function(A,e,t,r,o){t|=0,r|=0,o|=0;var i,a,s=0,l=0;return a=P,P=P+32|0,l=a,0|(i=0|me(A|=0,e|=0,A,e,s=a+12|0))?(P=a,0|(l=i)):0|(A=0|me(A,e,t,r,l))?(P=a,0|(l=A)):(s=0|kA(s,l),n[(l=o)>>2]=s,n[l+4>>2]=((0|s)<0)<<31>>31,P=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,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=0,y=0,k=0,C=0,D=0,E=0;if(a=P,P=P+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],x=g*+((0|n[c>>2])-t|0),r=0|n[(v=i+4|0)>>2],w=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=x*(d=+(p>>>0)+4294967296*+(0|b))+ +(0|t),u=w*d+ +(0|r),d=g*d+ +(0|s),t=~~+at(+E),c=~~+at(+u),s=~~+at(+d),E=+l(+(+(0|t)-E)),u=+l(+(+(0|c)-u)),d=+l(+(+(0|s)-d));do{if(!(E>u&E>d)){if(f=0-t|0,u>d){r=f-s|0;break}r=c,s=f-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[v>>2],s=0|n[y>>2]}}while(0);return P=a,0|s}return P=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=P,P=P+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))?(P=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,P=i,0|(l=0))},_gridRing:function(A,e,t,r){return 0|T(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,d=0,f=0;if(o=P,P=P+16|0,s=o,!(t|=0))return n[r>>2]=A,n[r+4>>2]=e,P=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 d=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|d,0|a,0|i,0|B())),0|B(),1,0),a=0|B(),n[(d=s)>>2]=i,n[d+4>>2]=a;if(u=0|We(i,8)){if(!(d=0|We(i,4))){Ye(u),i=13;break}if(0|(i=0|I(A,e,t,u,d,i,a,0))){Ye(u),Ye(d);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[d+(l<<2)>>2])!=(0|t)||(n[(f=r+(i<<3)|0)>>2]=a,n[f+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(d),i=0}else i=13}else i=2}while(0);return P=o,0|i}(A,e,t,r))):0|(r=0)},_gridRingUnsafe:T,_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:IA,_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|Le(A,e)))},_isValidVertex:Le,_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=P,P=P+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)),P=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=P,P=P+48|0,i=o+16|0,a=o+8|0,s=o,0|(t=0|Ce(t|=0)))return P=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 P=o,0|t},_maxPolygonToCellsSizeExperimental:function(A,e,t,i){e|=0,t|=0,i|=0;var a,s,c=0,u=0,f=0,g=0,h=0,m=0,b=0,p=0;if(s=P,P=P+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,P=s,0;RA(h,0,0,0),c=0|n[(f=h)>>2],f=0|n[f+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]=f,n[(f=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/+d(+ +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(ve(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,ve(a),t=0|n[(p=a)>>2],c=0|n[p+4>>2]}while(!(!(0|t)&!(0|c)));t=0|n[f>>2]}}while(0);return P=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,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=0,y=0,k=0,C=0,M=0,D=0,E=0,N=0,Q=0,j=0,F=0,S=0,R=0,T=0,_=0;if(s=P,P=P+112|0,o=s+80|0,f=s+72|0,i=s,a=s+56|0,0|(l=0|Ce(t|=0)))return P=s,0|l;if(!(_=0|Ue(32+(n[(g=A+8|0)>>2]<<5)|0)))return P=s,13;if(Be(A,_),!(l=0|Ce(t))){if(T=0|n[(R=A)+4>>2],n[(l=f)>>2]=n[R>>2],n[l+4>>2]=T,ke(f,o),l=0|eA(o,e,i))R=0,T=0;else{if(l=0|n[f>>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,R=0|Ve(0|t,0|l,12,0),T=0|B(),n[(l=i)>>2]=R,n[l+4>>2]=T,l=0}if(!l){if(!(t=0|We(R,8)))return Ye(_),P=s,13;if(!(d=0|We(R,8)))return Ye(_),Ye(t),P=s,13;n[(F=o)>>2]=0,n[F+4>>2]=0,S=0|n[(F=A)+4>>2],n[(l=f)>>2]=n[F>>2],n[l+4>>2]=S,l=0|H(f,R,T,e,o,t,d);A:do{if(l)Ye(t),Ye(d),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,R,T,e,o,t,d),c=c+1|0,!(0|l);)if((0|c)>=(0|n[g>>2]))break e;Ye(t),Ye(d),Ye(_);break A}}while(0);(0|T)>0|!(0|T)&R>>>0>0&<(0|d,0,R<<3),F=0|n[(S=o)+4>>2];e:do{if((0|F)>0|!(0|F)&(0|n[S>>2])>>>0>0){N=t,Q=d,j=t,F=d,S=t,l=t,M=t,D=d,E=d,t=d;t:for(;;){for(w=0,y=0,k=0,C=0,c=0,u=0;;){f=(d=i)+56|0;do{n[d>>2]=0,d=d+4|0}while((0|d)<(0|f));if(0|L(g=0|n[(e=N+(w<<3)|0)>>2],e=0|n[e+4>>2],1,i,0)){f=(d=i)+56|0;do{n[d>>2]=0,d=d+4|0}while((0|d)<(0|f));0|(d=0|We(7,4))&&(I(g,e,1,i,d,7,0,0),Ye(d))}for(v=0;;){p=0|n[(x=i+(v<<3)|0)>>2],x=0|n[x+4>>2];r:do{if(!(0|p)&!(0|x))d=c,f=u;else{if(h=0|At(0|p,0|x,0|R,0|T),g=0|B(),!(!(0|(f=0|n[(e=d=r+(h<<3)|0)>>2]))&!(0|(e=0|n[e+4>>2])))){m=0,b=0;do{if((0|m)>(0|T)|(0|m)==(0|T)&b>>>0>R>>>0)break t;if((0|f)==(0|p)&(0|e)==(0|x)){d=c,f=u;break r}h=0|$e(0|(d=0|Ve(0|h,0|g,1,0)),0|B(),0|R,0|T),g=0|B(),b=0|Ve(0|b,0|m,1,0),m=0|B(),f=0|n[(e=d=r+(h<<3)|0)>>2],e=0|n[e+4>>2]}while(!(!(0|f)&!(0|e)))}if(!(0|p)&!(0|x)){d=c,f=u;break}qA(p,x,a),0|Me(A,_,a)&&(b=0|Ve(0|c,0|u,1,0),u=0|B(),n[(m=d)>>2]=p,n[m+4>>2]=x,n[(c=Q+(c<<3)|0)>>2]=p,n[c+4>>2]=x,c=b),d=c,f=u}}while(0);if((v=v+1|0)>>>0>=7)break;c=d,u=f}if(w=0|Ve(0|w,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=d,u=f}if((0|u)>0|!(0|u)&c>>>0>0){c=0,u=0;do{n[(C=N+(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]=d,n[C+4>>2]=f,!((0|f)>0|!(0|f)&d>>>0>0))break e;v=t,w=E,y=S,k=D,C=Q,t=M,E=l,D=j,M=v,l=w,S=F,F=y,j=k,Q=N,N=C}Ye(j),Ye(F),Ye(_),l=1;break A}l=d}while(0);Ye(_),Ye(t),Ye(l),l=0}}while(0);return P=s,0|l}}return Ye(_),P=s,0|l},_polygonToCellsExperimental:function(A,e,t,o,i,a){o|=0,i|=0,a|=0;var s,l,c,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0;c=P,P=P+160|0,d=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,d=0;s=P,P=P+48|0,i=s+40|0,a=s,RA(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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>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]=f,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[d>>2],n[h+4>>2]=n[d+4>>2],n[h+8>>2]=n[d+8>>2],n[h+12>>2]=n[d+12>>2],!(0|s)&!(0|f))return P=c,0|u;t=p+16|0,l=p+24|0,g=p+28|0,u=0,d=0,e=s,A=f;do{if(!((0|u)<(0|i)|(0|u)==(0|i)&d>>>0>>0)){b=4;break}if(f=d,d=0|Ve(0|d,0|u,1,0),u=0|B(),n[(f=a+(f<<3)|0)>>2]=e,n[f+4>>2]=A,re(h),!(0|(e=0|n[(A=h)>>2]))&!(0|(A=0|n[A+4>>2]))){if(ve(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[(f=p)>>2]=e,n[f+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,P=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],P=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,d=0,f=0,g=0,h=0,m=0;if(s=P,P=P+16|0,m=s,!((0|(t|=0))>0|!(0|t)&(e|=0)>>>0>0))return P=s,0;if((0|(a|=0))>=16)return P=s,12;g=0,h=0,f=0,l=0;A:for(;;){if(d=0|tt(0|(c=0|n[(u=A+(g<<3)|0)>>2]),0|(u=0|n[u+4>>2]),52),B(),(15&d)>(0|a)){l=12,c=11;break}if(ee(m,c,u,a),!(0|(u=0|n[(d=m)>>2]))&!(0|(d=0|n[d+4>>2])))c=f;else{c=f;do{if(!((0|l)<(0|i)|(0|l)==(0|i)&c>>>0>>0)){c=10;break A}n[(f=r+(c<<3)|0)>>2]=u,n[f+4>>2]=d,c=0|Ve(0|c,0|l,1,0),l=0|B(),re(m),u=0|n[(f=m)>>2],d=0|n[f+4>>2]}while(!(!(0|u)&!(0|d)))}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}f=c}return 10==(0|c)?(P=s,0|(m=14)):11==(0|c)?(P=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,d=0,f=0;a=P,P=P+16|0,i=a;A:do{if((0|t)>0|!(0|t)&e>>>0>0){for(d=0,l=0,s=0,f=0;;){if(!(!(0|(c=0|n[(u=A+(d<<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(d=0|Ve(0|d,0|f,1,0),!((0|(f=0|B()))<(0|t)|(0|f)==(0|t)&d>>>0>>0))break A}return P=a,0|s}l=0,s=0}while(0);return n[o>>2]=l,n[o+4>>2]=s,P=a,0},_vertexToLatLng:function(A,e,t){t|=0;var r,o,i,a,s=0,l=0;return a=P,P=P+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))?(P=a,0|(l=r)):(e=0|tt(0|A,0|e,52),B(),e&=15,0|HA(A,l)?NA(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],P=a,0|(l=0))},establishStackSpace:function(A,e){P=A|=0},stackAlloc:function(A){var e;return e=P,P=15+(P=P+(A|=0)|0)&-16,0|e},stackRestore:function(A){P=A|=0},stackSave:function(){return 0|P}}}({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: "+x(A)+", at: "+[e?x(e):"unknown filename",t,r?x(r):"unknown function"])},e:function(A){return t.___errno_location&&(h[t.___errno_location()>>2]=A),A},f:z,g:function(A,e,t){f.set(f.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,f,e,t)}(A,e=Z(t),t)}return e},array:function(A){var e,t,r=Z(A.length);return e=A,t=r,d.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":R=[e>>>0,(I=e,+Q(I)>=1?I>0?(0|F(+P(I/4294967296),4294967295))>>>0:~~+j((I-+(~~I>>>0))/4294967296)>>>0:0)],h[A>>2]=R[0],h[A+4>>2]=R[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 d[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},T){H(T)||(W=T,T=t.locateFile?t.locateFile(W,o):o+W),S++,t.monitorRunDependencies&&t.monitorRunDependencies(S);var X=function(A){A.byteLength&&(A=new Uint8Array(A)),f.set(A,8),t.memoryInitializerRequest&&delete t.memoryInitializerRequest.response,function(){if(S--,t.monitorRunDependencies&&t.monitorRunDependencies(S),0==S&&L){var A=L;L=null,A()}}()},q=function(){n(T,X,function(){throw"could not load memory initializer "+T})},$=O(T);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;)N(t.postRun.shift());k(D)}()))}S>0||(function(){if(t.preRun)for("function"==typeof t.preRun&&(t.preRun=[t.preRun]);t.preRun.length;)E(t.preRun.shift());k(C)}(),S>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(L=function A(){V||eA(),V||(L=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 $A?$A:{}),Ae="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"},te={1e3:"Unknown unit",1001:"Array length out of bounds",1002:"Got unexpected null value for H3 index"};function re(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 re(ee,A,2===arguments.length?{value:e}:{})}(A)}var oe={};[["sizeOfH3Index",Ae],["sizeOfLatLng",Ae],["sizeOfCellBoundary",Ae],["sizeOfGeoLoop",Ae],["sizeOfGeoPolygon",Ae],["sizeOfLinkedGeoPolygon",Ae],["sizeOfCoordIJ",Ae],["readInt64AsDoubleFromPointer",Ae],["isValidCell",Ae,[Ae,Ae]],["isValidIndex",Ae,[Ae,Ae]],["latLngToCell",Ae,[Ae,Ae,Ae,Ae]],["cellToLatLng",Ae,[Ae,Ae,Ae]],["cellToBoundary",Ae,[Ae,Ae,Ae]],["maxGridDiskSize",Ae,[Ae,Ae]],["gridDisk",Ae,[Ae,Ae,Ae,Ae]],["gridDiskDistances",Ae,[Ae,Ae,Ae,Ae,Ae]],["gridRing",Ae,[Ae,Ae,Ae,Ae]],["gridRingUnsafe",Ae,[Ae,Ae,Ae,Ae]],["maxPolygonToCellsSize",Ae,[Ae,Ae,Ae,Ae]],["polygonToCells",Ae,[Ae,Ae,Ae,Ae]],["maxPolygonToCellsSizeExperimental",Ae,[Ae,Ae,Ae,Ae]],["polygonToCellsExperimental",Ae,[Ae,Ae,Ae,Ae,Ae,Ae]],["cellsToLinkedMultiPolygon",Ae,[Ae,Ae,Ae]],["destroyLinkedMultiPolygon",null,[Ae]],["compactCells",Ae,[Ae,Ae,Ae,Ae]],["uncompactCells",Ae,[Ae,Ae,Ae,Ae,Ae,Ae]],["uncompactCellsSize",Ae,[Ae,Ae,Ae,Ae,Ae]],["isPentagon",Ae,[Ae,Ae]],["isResClassIII",Ae,[Ae,Ae]],["getBaseCellNumber",Ae,[Ae,Ae]],["getResolution",Ae,[Ae,Ae]],["getIndexDigit",Ae,[Ae,Ae,Ae]],["constructCell",Ae,[Ae,Ae,Ae,Ae]],["maxFaceCount",Ae,[Ae,Ae,Ae]],["getIcosahedronFaces",Ae,[Ae,Ae,Ae]],["cellToParent",Ae,[Ae,Ae,Ae,Ae]],["cellToChildren",Ae,[Ae,Ae,Ae,Ae]],["cellToCenterChild",Ae,[Ae,Ae,Ae,Ae]],["cellToChildrenSize",Ae,[Ae,Ae,Ae,Ae]],["cellToChildPos",Ae,[Ae,Ae,Ae,Ae]],["childPosToCell",Ae,[Ae,Ae,Ae,Ae,Ae,Ae]],["areNeighborCells",Ae,[Ae,Ae,Ae,Ae,Ae]],["cellsToDirectedEdge",Ae,[Ae,Ae,Ae,Ae,Ae]],["getDirectedEdgeOrigin",Ae,[Ae,Ae,Ae]],["getDirectedEdgeDestination",Ae,[Ae,Ae,Ae]],["isValidDirectedEdge",Ae,[Ae,Ae]],["directedEdgeToCells",Ae,[Ae,Ae,Ae]],["originToDirectedEdges",Ae,[Ae,Ae,Ae]],["directedEdgeToBoundary",Ae,[Ae,Ae,Ae]],["gridDistance",Ae,[Ae,Ae,Ae,Ae,Ae]],["gridPathCells",Ae,[Ae,Ae,Ae,Ae,Ae]],["gridPathCellsSize",Ae,[Ae,Ae,Ae,Ae,Ae]],["cellToLocalIj",Ae,[Ae,Ae,Ae,Ae,Ae,Ae]],["localIjToCell",Ae,[Ae,Ae,Ae,Ae,Ae]],["getHexagonAreaAvgM2",Ae,[Ae,Ae]],["getHexagonAreaAvgKm2",Ae,[Ae,Ae]],["getHexagonEdgeLengthAvgM",Ae,[Ae,Ae]],["getHexagonEdgeLengthAvgKm",Ae,[Ae,Ae]],["greatCircleDistanceM",Ae,[Ae,Ae]],["greatCircleDistanceKm",Ae,[Ae,Ae]],["greatCircleDistanceRads",Ae,[Ae,Ae]],["cellAreaM2",Ae,[Ae,Ae,Ae]],["cellAreaKm2",Ae,[Ae,Ae,Ae]],["cellAreaRads2",Ae,[Ae,Ae,Ae]],["edgeLengthM",Ae,[Ae,Ae,Ae]],["edgeLengthKm",Ae,[Ae,Ae,Ae]],["edgeLengthRads",Ae,[Ae,Ae,Ae]],["getNumCells",Ae,[Ae,Ae]],["getRes0Cells",Ae,[Ae]],["res0CellCount",Ae],["getPentagons",Ae,[Ae,Ae]],["pentagonCount",Ae],["cellToVertex",Ae,[Ae,Ae,Ae,Ae]],["cellToVertexes",Ae,[Ae,Ae,Ae]],["vertexToLatLng",Ae,[Ae,Ae,Ae]],["isValidVertex",Ae,[Ae,Ae]]].forEach(function(A){oe[A[0]]=$A.cwrap.apply($A,A)});var ie=16,ae=oe.sizeOfH3Index(),se=oe.sizeOfLatLng(),le=oe.sizeOfCellBoundary();oe.sizeOfGeoPolygon(),oe.sizeOfGeoLoop(),oe.sizeOfLinkedGeoPolygon(),oe.sizeOfCoordIJ();var ce=/[^0-9a-fA-F]/;function ue(A){if(A>=0)return A.toString(ie);var e=de(8,(A&=2147483647).toString(ie));return(parseInt(e[0],ie)+8).toString(ie)+e.substring(1)}function de(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 ke({coveragePoints:e,visible:r,terrainEnabled:n=!1,brightness:o=.7}){const{current:i}=S(),[a,s]=A.useState(null),[l,c]=A.useState(!1),u=A.useRef({aborted:!1}),d=A.useRef(0),f=function(e){const[t,r]=A.useState(e);return A.useEffect(()=>{const A=setTimeout(()=>r(e),300);return()=>clearTimeout(A)},[e,300]),t}(e),g=A.useMemo(()=>function(){var A;const e=hA();return 24===e.length&&0!==(null==(A=e[0])?void 0:A[0])?e:ve}(),[]);A.useEffect(()=>{if(!f||!Array.isArray(f)||0===f.length)return void queueMicrotask(()=>{s(null),d.current=0});if(f.length===d.current&&a)return;d.current=f.length,u.current.aborted=!0,u.current={aborted:!1};const A=u.current;c(!0);const{cells:e,minQuality:t,maxQuality:r}=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=he(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}}(f);if(0===e.length)return s(null),void c(!1);if(e.length<500){const n=function(A,e,t,r){const n=[];for(const o of A){const A=me(o.hexId).map(([A,e])=>[e,A]);A.push(A[0]);const i=ye(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}}(e,t,r,g);return void(A.aborted||(s(n),c(!1)))}return async function(A,e,t,r,n){const o=[];let i=0;for(;i[e,A]);a.push(a[0]);const s=ye(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}}(e,t,r,g,A).then(e=>{!A.aborted&&e&&s(e)}).finally(()=>{A.aborted||c(!1)}),()=>{A.aborted=!0}},[f,g]),A.useEffect(()=>{var A;const e=null==(A=null==i?void 0:i.getMap)?void 0:A.call(i);if(!e)return;const t=()=>{var A,t;try{const n=e.getLayer(xe),i=e.getSource(pe);if(r&&a&&a.features.length>0){if(i?e.getSource(pe).setData(a):e.addSource(pe,{type:"geojson",data:a}),!n){const r=e.getLayer("topology-weak-edges-native"),n=null==(t=null==(A=e.getStyle())?void 0:A.layers)?void 0:t.find(A=>"symbol"===A.type),i=r?"topology-weak-edges-native":null==n?void 0:n.id;e.addLayer({id:xe,type:"fill",source:pe,paint:{"fill-color":["get","color"],"fill-opacity":o}},i)}}else n&&e.removeLayer(xe),i&&e.removeSource(pe)}catch(n){}};e.isStyleLoaded()?t():e.once("style.load",t)},[i,r,a,n]),A.useEffect(()=>{var A;const e=null==(A=null==i?void 0:i.getMap)?void 0:A.call(i);if(e&&r)try{e.getLayer(xe)&&e.setPaintProperty(xe,"fill-opacity",o)}catch{}},[i,o,r]),A.useEffect(()=>()=>{var A;const e=null==(A=null==i?void 0:i.getMap)?void 0:A.call(i);if(e)try{e.getLayer(xe)&&e.removeLayer(xe),e.getSource(pe)&&e.removeSource(pe)}catch{}},[i]);const h=(null==a?void 0:a.features.length)??0;return h>0&&r?t.jsx("div",{"data-testid":"wardriving-hexlayer-maplibre-active","data-point-count":(null==e?void 0:e.length)||0,"data-cell-count":h,"data-terrain-enabled":n,"data-is-processing":l,style:{display:"none"}}):null}const Ce="https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png",Be="terrarium",Me="terrain-dem",De="hillshade-dem",Ee="terrain-hillshade";function Ne({enabled:e,exaggeration:t=4}){const{current:r}=S(),n=A.useRef(null);return A.useEffect(()=>{var A;const e=null==(A=null==r?void 0:r.getMap)?void 0:A.call(r);if(!e)return;let t=!0;const n=()=>{var A,r;if(t)try{if(e.getSource(De)||e.addSource(De,{type:"raster-dem",tiles:[Ce],encoding:Be,tileSize:256,maxzoom:14}),!e.getLayer(Ee)){const t=null==(r=null==(A=e.getStyle())?void 0:A.layers)?void 0:r.find(A=>"symbol"===A.type);e.addLayer({id:Ee,type:"hillshade",source:De,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==t?void 0:t.id)}}catch(n){}};return e.isStyleLoaded()?n():e.once("style.load",n),()=>{t=!1}},[r]),A.useEffect(()=>{var A;const o=null==(A=null==r?void 0:r.getMap)?void 0:A.call(r);if(!o)return;let i=!0;const a=()=>{if(i)try{o.getSource(Me)||o.addSource(Me,{type:"raster-dem",tiles:[Ce],encoding:Be,tileSize:256,maxzoom:14}),e?(o.setCenterClampedToGround(!1),o.setTerrain({source:Me,exaggeration:t}),o.setMaxPitch(70),o.getPitch()<30&&!o.isMoving()&&(null!==n.current&&clearTimeout(n.current),n.current=window.setTimeout(()=>{n.current=null,i&&!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(A){}};return o.isStyleLoaded()?a():o.once("style.load",a),()=>{i=!1,null!==n.current&&(clearTimeout(n.current),n.current=null);try{o.getStyle()&&o.isStyleLoaded()&&o.setTerrain(null)}catch{}}},[r,e,t]),A.useEffect(()=>{var A;const e=null==(A=null==r?void 0:r.getMap)?void 0:A.call(r);return()=>{var A;try{(null==(A=null==e?void 0:e.getStyle)?void 0:A.call(e))&&e.isStyleLoaded()&&(e.setTerrain(null),e.getLayer(Ee)&&e.removeLayer(Ee),e.getSource(De)&&e.removeSource(De),e.getSource(Me)&&e.removeSource(Me))}catch{}}},[r]),null}function Qe(A,e=!1,t=!1,r=!1,n=.7){const o=fA();return r?n>=.75?o.restBright:o.rest:n>=.85?o.rest:o.restDim}function je(A){return[A[1],A[0]]}function Pe(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 Fe(A){return A<.5?4*A*A*A:1-Math.pow(-2*A+2,3)/2}function Se(A,e,t,r,n,o,i,a,s,l,c){const u=CA(),d=[];let f=1/0,g=-1/0;const h=[];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);h.push({polyline:b,brightnessScore:A}),f=Math.min(f,A),g=Math.max(g,A)}if(0===h.length)return{type:"FeatureCollection",features:[]};const m=g-f||1;h.sort((A,e)=>A.brightnessScore-e.brightnessScore);for(const{polyline:b,brightnessScore:p}of h){const{from:A,to:i,edge:g}=b,h=t.get(g.key)??0;if(h<=0)continue;const x=a.has(g.key),v=s.has(g.key),w=g.avgConfidence??(e?.7:.5),y=l===g.key,k=c[g.fromHash],C=c[g.toHash],B=(null==k?void 0:k.node_name)||(null==k?void 0:k.name)||g.fromHash.slice(0,8),M=(null==C?void 0:C.node_name)||(null==C?void 0:C.name)||g.toHash.slice(0,8),D=[A[0]+(i[0]-A[0])*h,A[1]+(i[1]-A[1])*h];let E,N,Q,j;if(e){const A=o.get(g.key)??vA(g.certainCount),e=n.get(g.key)??A;E=e+(A-e)*r,y?E=Math.max(1.6*E,4.5):v&&(E*=1.3)}else E=1.5;if(N=y?u.edges.highlight:Qe(0,g.isDirectPathEdge??!1,x,v,w),Q=y?u.edges.highlight:g.isDirectPathEdge?u.edges.hoverDirect:x?u.edges.hoverLoop:u.edges.hoverStandard,e){const A=Math.min(1.5*h,1)*u.edgeOpacity;j=v?1.15*A:A}else j=(.3+.3*w)*h;y&&(j=.95);const P=(p-f)/m;d.push({type:"Feature",properties:{key:g.key,baseColor:N,hoverColor:Q,baseWidth:E,baseOpacity:j,brightnessScore:P,isLoopEdge:x,isBackbone:v,isDirectPath:g.isDirectPathEdge??!1,isHubConnection:g.isHubConnection??!1,isZeroHop:g.isZeroHop??!1,isValidated:e,certainCount:g.certainCount,confidence:w,symmetryRatio:g.symmetryRatio??1,dominantDirection:g.dominantDirection??"balanced",fromName:B,toName:M,fromHash:g.fromHash,toHash:g.toHash},geometry:{type:"LineString",coordinates:[je(A),je(D)]}})}return{type:"FeatureCollection",features:d}}function Le(A,e){const t=CA(),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,d=(null==l?void 0:l.avgSnr)??s.snr??null,f=(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,x=n>0?p/n:0,v=o.rxAdvertCount??0,w=o.txProxyCount??0,y=v+w,k=y>0?(w-v)/y:0,C=Pe(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:d,packetCount:f,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:x,linkAsymmetry:k,rxAdvertCount:v,txProxyCount:w},geometry:{type:"LineString",coordinates:C}})}return{type:"FeatureCollection",features:r}}function Ie(A){return A<.5?4*A*A*A:1-Math.pow(-2*A+2,3)/2}function Re(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 Te(A,e,t){const r=t?AA(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 _e="edge-blink-source",He="edge-blink-layer",ze=1e3,Ge=1e3,Oe="node-markers-layer";function Ue(A){return A<0||A>=ze?0:1-A/ze}function Ye(A){if(A<0)return 0;if(A>=Ge)return 0;const e=A/Ge;return Math.pow(1-e,3)}function We(A){return[A[1],A[0]]}function Ve(A){const e=new Date(1e3*A);return`${(e.getMonth()+1).toString().padStart(2,"0")}/${e.getDate().toString().padStart(2,"0")}`}function Ze({hash:e,hashPrefix:n,name:o,isHub:i,isGateway:a,isBackbone:l,isZeroHop:c,isMobile:u,isRoomServer:d,isStale:f,lastSeenTimestamp:g,centrality:h,affinity:m,meanSnr:b,meanRssi:p,neighbor:x,onRemove:v,txDelayRec:w,onPingResult:y}){const k=gA(),[C,B]=A.useState(!1),[M,D]=A.useState(!1),[E,N]=A.useState(null),[Q,j]=A.useState(null),F=A.useCallback(async()=>{if(!M){D(!0),j(null),N(null);try{const A=e.startsWith("0x")?e.slice(0,4):`0x${e.slice(0,2)}`,t=await tA(A,30);t.success&&t.data?(N(t.data),null==y||y(t.data)):j(t.error||"Ping failed")}catch(A){j(A instanceof Error?A.message:"Ping failed")}finally{D(!1)}}},[e,M,y]),S=c?"Direct":(null==m?void 0:m.typicalHopPosition)?`${m.typicalHopPosition}-hop`:null,z=w&&!w.insufficientData,G={hub:{bg:"bg-amber-500/20",text:"text-amber-400",title:"Hub: High-connectivity node that bridges many paths"},backbone:{bg:"bg-purple-500/20",text:"text-purple-400",title:"Backbone: Critical relay with high traffic"},relay:{bg:"bg-cyan-500/20",text:"text-cyan-400",title:"Relay: Standard forwarding node"},edge:{bg:"bg-gray-500/20",text:"text-gray-400",title:"Edge: Peripheral node"}},O={high:{bg:"bg-green-500/20",text:"text-green-400",title:"1000+ packets"},medium:{bg:"bg-amber-500/20",text:"text-amber-400",title:"500-999 packets"},low:{bg:"bg-red-500/20",text:"text-red-400",title:"100-499 packets"},insufficient:{bg:"bg-gray-500/20",text:"text-gray-400",title:"Insufficient data"}};return t.jsxs("div",{className:"w-[240px] pr-2",children:[t.jsx("div",{className:"text-[14px] font-semibold text-text-primary leading-tight truncate mb-1",children:o}),t.jsxs("div",{className:"flex items-center gap-1 flex-wrap mb-1.5",children:[t.jsx("code",{className:"font-mono text-[10px] text-text-secondary bg-[#1a1a1a] px-1 py-0.5 rounded",children:n}),t.jsx("button",{onClick:async()=>{try{await navigator.clipboard.writeText(e),B(!0),setTimeout(()=>B(!1),1500)}catch(A){const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();try{document.execCommand("copy"),B(!0),setTimeout(()=>B(!1),1500)}catch{}document.body.removeChild(t)}},className:"p-0.5 hover:bg-[#252525] rounded transition-colors",title:"Copy full hash",children:C?t.jsx(r,{className:"w-3 h-3 text-accent-success"}):t.jsx(L,{className:"w-3 h-3 text-text-secondary"})}),t.jsx(pA,{hash:e,size:"sm"}),S&&t.jsx("span",{className:"px-1 py-0.5 text-[9px] font-bold uppercase rounded "+(c?"bg-amber-400 text-gray-900":"bg-[#2a2a2a] text-white"),children:S}),x.is_repeater&&t.jsx("span",{className:"px-1 py-0.5 text-[9px] font-bold uppercase rounded bg-cyan-500/20 text-cyan-400",children:"Rptr"}),i&&t.jsx("span",{className:"px-1 py-0.5 text-[9px] font-bold uppercase rounded",style:{backgroundColor:k.hubColor,color:"#fff"},title:"Hub: ≥10% of last-hop traffic",children:"Hub"}),a&&!i&&t.jsx("span",{className:"px-1 py-0.5 text-[9px] font-bold uppercase rounded",style:{backgroundColor:k.hubColor,color:"#fff",opacity:.8},title:"Gateway: 7-10% of last-hop traffic",children:"Gate"}),l&&t.jsx("span",{className:"px-1 py-0.5 text-[9px] font-bold uppercase rounded bg-purple-500/80 text-white",title:"Backbone",children:"Bone"}),u&&t.jsx("span",{className:"px-1 py-0.5 text-[9px] font-bold uppercase rounded bg-orange-500/25 text-orange-300",children:"Mobile"}),d&&t.jsx("span",{className:"px-1 py-0.5 text-[9px] font-bold uppercase rounded bg-amber-500/25 text-amber-400",children:"Room"}),f&&g&&t.jsxs("span",{className:"px-1 py-0.5 text-[9px] font-medium rounded bg-gray-500/30 text-gray-300",title:"Neighbor not heard in 7+ days",children:["Idle ",Ve(g)]})]}),t.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-text-secondary mb-1.5",children:[t.jsxs("span",{className:"flex items-center gap-0.5",children:[t.jsx(I,{className:"w-3 h-3 text-text-muted shrink-0"}),t.jsx("span",{className:"font-mono",children:rA(x.last_seen)})]}),(null==m?void 0:m.distanceMeters)&&t.jsxs("span",{className:"flex items-center gap-0.5",children:[t.jsx(R,{className:"w-3 h-3 text-text-muted shrink-0"}),t.jsx("span",{className:"font-mono font-semibold text-text-primary",children:(U=m.distanceMeters,null===U?"—":U<1e3?`${Math.round(U)}m`:`${(U/1e3).toFixed(1)}km`)})]}),x.latitude&&x.longitude&&0!==x.latitude&&0!==x.longitude&&t.jsxs("span",{className:"flex items-center gap-0.5",children:[t.jsx(T,{className:"w-3 h-3 text-text-muted shrink-0"}),t.jsxs("span",{className:"font-mono text-text-muted",children:[x.latitude.toFixed(2),", ",x.longitude.toFixed(2)]})]})]}),t.jsx("div",{className:"mb-1.5",style:{width:224},children:t.jsx(xA,{nodeHash:e,width:224,height:26,showArea:!0,showTooltip:!0})}),t.jsxs("div",{className:"flex gap-3 text-[10px] mb-1.5",children:[t.jsxs("div",{className:"flex-1 space-y-0.5",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("span",{className:"text-text-muted",children:"Packets"}),t.jsx("span",{className:"font-mono font-semibold text-text-primary",children:(null==m?void 0:m.frequency)||0})]}),c&&void 0!==b&&t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("span",{className:"text-text-muted",children:"SNR"}),t.jsxs("span",{className:"font-mono font-semibold text-text-primary",children:[b.toFixed(1)," dB"]})]}),z&&w.networkRole&&t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("span",{className:"text-text-muted",children:"Role"}),t.jsx("span",{className:`text-[9px] font-bold uppercase px-1 py-0.5 rounded ${G[w.networkRole].bg} ${G[w.networkRole].text}`,title:G[w.networkRole].title,children:w.networkRole})]})]}),t.jsxs("div",{className:"flex-1 space-y-0.5",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("span",{className:"text-text-muted",children:"Adverts"}),t.jsx("span",{className:"font-mono font-semibold text-text-primary",children:x.advert_count||0})]}),c&&void 0!==p&&t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("span",{className:"text-text-muted",children:"RSSI"}),t.jsxs("span",{className:"font-mono font-semibold text-text-primary",children:[Math.round(p)," dBm"]})]}),z&&w.dataConfidence&&t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("span",{className:"text-text-muted",children:"Data"}),t.jsx("span",{className:`text-[9px] font-bold uppercase px-1 py-0.5 rounded ${O[w.dataConfidence].bg} ${O[w.dataConfidence].text}`,title:O[w.dataConfidence].title,children:w.dataConfidence})]})]})]}),z&&t.jsxs("div",{className:"flex items-center gap-2 text-[10px] mb-1.5 py-1 px-1.5 bg-amber-400/5 rounded",children:[t.jsx(_,{className:"w-3 h-3 text-amber-400 shrink-0"}),t.jsx("span",{className:"text-text-muted",children:"TxDelay"}),t.jsxs("div",{className:"flex gap-3 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"text-text-muted",children:"F"}),t.jsxs("span",{className:"font-mono font-semibold text-amber-400",children:["×",(w.floodFactor??w.txDelayFactor).toFixed(1)]})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"text-text-muted",children:"D"}),t.jsxs("span",{className:"font-mono font-semibold text-amber-400",children:["×",(w.directFactor??w.directTxDelayFactor).toFixed(1)]})]})]})]}),t.jsxs("div",{className:"flex items-center justify-between pt-1 border-t border-white/[0.08]",children:[c?t.jsxs("button",{onClick:F,disabled:M,className:"flex items-center gap-1 py-0.5 text-[10px] text-text-secondary hover:text-accent-primary hover:bg-accent-primary/10 rounded transition-colors disabled:opacity-50",title:"Ping neighbor",children:[M?t.jsx(s,{className:"w-3 h-3 animate-spin"}):t.jsx(H,{className:"w-3 h-3"}),t.jsx("span",{children:"Ping"})]}):t.jsx("div",{}),v&&t.jsx("button",{onClick:v,className:"p-1 text-text-secondary hover:text-red-400 hover:bg-red-500/10 rounded transition-colors",title:"Remove from contacts",children:t.jsx(P,{className:"w-3.5 h-3.5"})})]}),E&&t.jsxs("div",{className:"mt-1 pt-1 border-t border-white/[0.08] text-[10px]",children:[t.jsxs("div",{className:"flex items-center gap-1 text-accent-success mb-0.5",children:[t.jsx(r,{className:"w-3 h-3"}),t.jsx("span",{className:"font-medium",children:"Ping OK"})]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsxs("div",{className:"flex-1 space-y-0.5",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-text-muted",children:"RTT"}),t.jsxs("span",{className:"font-mono font-semibold text-text-primary",children:[E.rtt_ms.toFixed(0)," ms"]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-text-muted",children:"RSSI"}),t.jsxs("span",{className:"font-mono font-semibold text-text-primary",children:[E.rssi," dBm"]})]})]}),t.jsxs("div",{className:"flex-1 space-y-0.5",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-text-muted",children:"SNR"}),t.jsxs("span",{className:"font-mono font-semibold text-text-primary",children:[E.snr_db.toFixed(1)," dB"]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-text-muted",children:"Hops"}),t.jsx("span",{className:"font-mono font-semibold text-text-primary",children:E.path.length})]})]})]})]}),Q&&t.jsxs("div",{className:"mt-1.5 pt-1.5 border-t border-white/[0.08] text-[10px] text-red-400",children:["⚠ ",Q]})]});var U}const Ke="node-markers-native",Je="node-markers-layer",Xe="node-markers-layer-local",qe="marker-standard",$e="marker-standard-neighbor",At="marker-hub",et="marker-hub-neighbor",tt="marker-gateway",rt="marker-gateway-neighbor",nt="marker-mobile",ot="marker-mobile-neighbor",it="marker-room-server",at="marker-room-server-neighbor",st="marker-local",lt="marker-blink-black",ct="marker-blink-black-local",ut="marker-blink",dt="marker-blink-local";function ft(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 gt(A){return A.startsWith("0x")?A.slice(2,4).toUpperCase():A.slice(0,2).toUpperCase()}function ht({neighborsWithLocation:e,localNode:r,localHash:n,zeroHopNeighbors:o,lastHopNeighborMap:i,meshTopology:a,hoveredMarker:s,onMarkerHover:l,getNodeOpacity:c,shouldShowNode:u,onRequestRemove:d,openPopupId:f,onOpenPopup:g,onClosePopup:h,blinkingNodes:m}){const{current:b}=S(),p=A.useRef(!1),[x,v]=A.useState(!1);A.useEffect(()=>{var A;const e=null==(A=null==b?void 0:b.getMap)?void 0:A.call(b);if(!e)return;const t=()=>{if(!p.current)try{!function(A){const e=dA(),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={[qe]:t(e.nodeFill,e.nodeStroke,1.5),[$e]:t(e.neighborColor),[At]:t(e.hubColor),[et]:t(e.neighborColor),[tt]:t(e.hubColor+"B3"),[rt]:t(e.neighborColor),[nt]:t("transparent",e.mobileColor,2),[ot]:t(e.neighborColor),[it]:n(e.roomColor),[at]:n(e.neighborColor,"#1a1a1c"),[st]:r(e.localColor),[lt]:t("#000000"),[ct]:r("#000000"),[ut]:t(o,void 0,0,!0),[dt]: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),p.current=!0,v(!0)}catch(A){}};e.isStyleLoaded()?t():e.once("style.load",t);const r=()=>{p.current=!1,t()},n=new MutationObserver(A=>{for(const e of A)if("data-theme"===e.attributeName){setTimeout(r,100);break}});return n.observe(document.documentElement,{attributes:!0}),()=>{n.disconnect()}},[b]);const w=A.useMemo(()=>{var A;const t=[],r=[...e].sort(([A,e],[t,r])=>{const n=(A,e)=>{var t;return ft(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[e,n]of r){if(!n.latitude||!n.longitude)continue;const r=u(e),s=c(e,r);if(s<=.01)continue;const l=o.has(e),d=a.hubNodes.includes(e),f=(null==(A=a.gatewayNodes)?void 0:A.includes(e))??!1,g=a.mobileNodes.includes(e),h=ft(n),m=a.centrality.get(e)||0,b=i.get(e),p="stale"===(null==b?void 0:b.status),x=p?Math.min(s,.5):s;let v="standard";h?v="roomServer":d?v="hub":f?v="gateway":g&&(v="mobile");const w=a.fullAffinity.get(e),y=a.txDelayRecommendations.get(e);t.push({type:"Feature",geometry:{type:"Point",coordinates:[n.longitude,n.latitude]},properties:{hash:e,name:n.node_name||n.name||"Unknown",hashPrefix:gt(e),iconType:v,isNeighbor:l,isHub:d,isGateway:f,isMobile:g,isRoomServer:h,isStale:p,isZeroHop:l,opacity:x,blinkIntensity:0,lastSeenTimestamp:null==b?void 0:b.lastSeen,centrality:m,neighborJson:JSON.stringify(n),affinityJson:w?JSON.stringify(w):void 0,txDelayRecJson:y?JSON.stringify(y):void 0,meanSnr:(null==b?void 0:b.avgSnr)??void 0,meanRssi:(null==b?void 0:b.avgRssi)??void 0}})}return{type:"FeatureCollection",features:t}},[e,o,i,a,c,u]),y=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?gt(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]),k=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)},[g]),C=A.useCallback(A=>{var e,t;if(!A.features||0===A.features.length)return;const r=null==(e=null==b?void 0:b.getMap)?void 0:e.call(b);r&&(r.getCanvas().style.cursor="pointer");const n=null==(t=A.features[0].properties)?void 0:t.hash;n&&l(n)},[b,l]),B=A.useCallback(()=>{var A;const e=null==(A=null==b?void 0:b.getMap)?void 0:A.call(b);e&&(e.getCanvas().style.cursor=""),l(null)},[b,l]);A.useEffect(()=>{var A;const e=null==(A=null==b?void 0:b.getMap)?void 0:A.call(b);if(!e||!x)return;const t=[Je,Xe];for(const r of t)e.on("click",r,k),e.on("mouseenter",r,C),e.on("mouseleave",r,B);return()=>{for(const A of t)e.off("click",A,k),e.off("mouseenter",A,C),e.off("mouseleave",A,B)}},[b,x,k,C,B]);const M=A.useRef(w),D=A.useRef(y);A.useEffect(()=>{M.current=w,D.current=y},[w,y]),A.useEffect(()=>{var A;const e=null==(A=null==b?void 0:b.getMap)?void 0:A.call(b);if(!e||!x||!m||0===m.size)return;const t=e.getSource(Ke),r=e.getSource(`${Ke}-local`);if(t||r){if(t){const A=M.current;let e=!1;const r=A.features.map(A=>{const t=m.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=m.get(n)??0,e=D.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}}]})}}},[b,x,m,n]);const E=A.useMemo(()=>{if(!f)return null;if("local"===f&&r)return{longitude:r.longitude,latitude:r.latitude,isLocal:!0,name:r.name,hash:n};const A=w.features.find(A=>A.properties.hash===f);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}},[f,r,n,w]);if(!x)return null;const N=dA(),Q=["case",[">",["get","blinkIntensity"],.66],ut,[">",["get","blinkIntensity"],.33],lt,["==",["get","iconType"],"roomServer"],["case",["get","isNeighbor"],at,it],["==",["get","iconType"],"hub"],["case",["get","isNeighbor"],et,At],["==",["get","iconType"],"gateway"],["case",["get","isNeighbor"],rt,tt],["==",["get","iconType"],"mobile"],["case",["get","isNeighbor"],ot,nt],["case",["get","isNeighbor"],$e,qe]],j=["interpolate",["linear"],["zoom"],6,.25,10,1];return t.jsxs(t.Fragment,{children:[t.jsx(z,{id:Ke,type:"geojson",data:w,children:t.jsx(G,{id:Je,type:"symbol",layout:{"icon-image":Q,"icon-size":j,"icon-allow-overlap":!0,"icon-ignore-placement":!0,"symbol-sort-key":["get","opacity"]},paint:{"icon-opacity":["get","opacity"]}})}),t.jsx(z,{id:`${Ke}-local`,type:"geojson",data:y,children:t.jsx(G,{id:Xe,type:"symbol",layout:{"icon-image":["case",[">",["get","blinkIntensity"],.66],dt,[">",["get","blinkIntensity"],.33],ct,st],"icon-size":j,"icon-allow-overlap":!0,"icon-ignore-placement":!0},paint:{"icon-opacity":1}})}),E&&h&&t.jsx(O,{longitude:E.longitude,latitude:E.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:E.isLocal?t.jsxs("div",{className:"text-sm",children:[t.jsx("strong",{className:"text-base",children:E.name}),E.hash&&t.jsx("span",{className:"ml-2 font-mono text-xs text-text-muted bg-surface-elevated px-1.5 py-0.5 rounded",children:gt(E.hash)}),t.jsx("br",{}),t.jsx("span",{style:{color:N.localColor},className:"font-medium",children:"This Node (Local)"}),t.jsx("br",{}),r&&t.jsxs("span",{className:"text-xs text-text-muted",children:[r.latitude.toFixed(5),", ",r.longitude.toFixed(5)]})]}):E.neighbor&&E.hash?t.jsx(Ze,{hash:E.hash,hashPrefix:E.hashPrefix,name:E.name,isHub:E.isHub,isGateway:E.isGateway,isBackbone:E.isBackbone,isZeroHop:E.isZeroHop,isMobile:E.isMobile,isRoomServer:E.isRoomServer,isStale:E.isStale,lastSeenTimestamp:E.lastSeenTimestamp,centrality:E.centrality,affinity:E.affinity,meanSnr:E.meanSnr,meanRssi:E.meanRssi,neighbor:E.neighbor,txDelayRec:E.txDelayRec,onRemove:d?()=>d(E.hash,E.name):void 0}):null})]})}const mt=[Je,Xe];A.createContext(null);const bt="topology-validated-edges-native",pt="topology-weak-edges-native",xt="neighbor-edges-native",vt="topology-weak-edges-native",wt="topology-validated-edges-native",yt="neighbor-edges-native",kt={type:"FeatureCollection",features:[]},Ct={"line-cap":"round","line-join":"round"},Bt={"line-color":"transparent","line-width":16,"line-opacity":0};function Mt({showTopology:e,isExiting:r,hoveredEdgeKey:n,highlightedLoopEdges:o,onEdgeHover:i,onLoopHover:a,loops:s=[],neighborNames:l={},opacityBias:c=.5,widthMultiplier:u=1,trafficFilter:d=0,showNeighborLines:f=!0,disableHover:g=!1}){const{current:h}=S(),m=e||r,b=!0,p=f?"visible":"none",x=g||r,v=A.useRef(null),w=A.useRef(x),y=A.useRef(new Map),k=A.useRef(l),C=A.useRef(a);A.useLayoutEffect(()=>{w.current=x,k.current=l,C.current=a});const B=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}(s),[s]);A.useLayoutEffect(()=>{y.current=B},[B]);const M=A.useCallback(A=>{var e,t;if(w.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!==v.current){v.current=n;const o=!0===r.isNeighborEdge||"true"===r.isNeighborEdge,a=!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};i(n,[A.lngLat.lng,A.lngLat.lat],t),null==(e=C.current)||e.call(C,null)}else if(a&&C.current){const e=y.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=>k.current[A]||A.substring(0,4))};C.current(r,[A.lngLat.lng,A.lngLat.lat]),i(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};i(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:a,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};i(n,[A.lngLat.lng,A.lngLat.lat],e),null==(t=C.current)||t.call(C,null)}}},[i]),D=A.useCallback(()=>{var A;null!==v.current&&(v.current=null,i(null),null==(A=C.current)||A.call(C,null))},[i]);A.useEffect(()=>{var A;const e=null==(A=null==h?void 0:h.getMap)?void 0:A.call(h);if(!e||!m)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,M),e.on("mouseleave",t,D),!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,M),e.off("mouseleave",t,D))}catch{}}}return()=>{try{r()&&(e.off("mousemove",t,M),e.off("mouseleave",t,D))}catch{}}},[h,m,M,D]),A.useEffect(()=>{var A;const e=null==(A=null==h?void 0:h.getMap)?void 0:A.call(h);if(!e||!f)return;const t="neighbor-edges-hitarea-native",r=()=>{try{return e.getStyle()&&e.getLayer(t)}catch{return!1}},n=()=>!!r()&&(e.on("mousemove",t,M),e.on("mouseleave",t,D),!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,M),e.off("mouseleave",t,D))}catch{}}}return()=>{try{r()&&(e.off("mousemove",t,M),e.off("mouseleave",t,D))}catch{}}},[h,b,f,M,D]),A.useEffect(()=>{var A;const e=null==(A=null==h?void 0:h.getMap)?void 0:A.call(h);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(yt,"node-markers-layer"),r("neighbor-edges-hitarea-native",yt),(r(wt,"neighbor-edges-hitarea-native")||r(wt,"node-markers-layer"))&&r("topology-validated-edges-hitarea-native",wt),r(vt,"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===bt||A.sourceId===pt||A.sourceId===xt)&&o()};return e.on("sourcedata",a),()=>{clearTimeout(i),t&&clearTimeout(t);try{e.off("styledata",o),e.off("sourcedata",a)}catch{}}},[h,m,b,f]);const E=x?null:n,N=function(A,e,t,r,n){const o=CA(),i=null!==A,a=n&&n.size>0,s=a?Array.from(n):[],l=e<=0?["get","baseColor"]:["case",[">=",["get","brightnessScore"],1-.5*e],"#FFFFFF",["get","baseColor"]],c=e<=0?1:["max",.1,["+",1,["*",e,3,["-",["get","brightnessScore"],.5]]]],u=a?["in",["get","key"],["literal",s]]:!!i&&["==",["get","key"],A],d=i||a,f=o.edges.hoverLoop??"#A78BFA";return{"line-color":d?["case",u,a?f:["get","hoverColor"],l]:l,"line-width":d?["case",u,["max",["*",["get","baseWidth"],t,1.3],3.5],["*",["get","baseWidth"],t]]:["*",["get","baseWidth"],t],"line-opacity":["case",["<",["get","brightnessScore"],r],0,d?["case",u,["min",["*",["get","baseOpacity"],1.25],1],["*",["get","baseOpacity"],c,.35]]:["*",["get","baseOpacity"],c]]}}(E,c,u,d,x?null:o),Q=function(A){const e=null!==A,{YELLOW:t,GREEN:r,RED:n,GRAY:o}=W,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}}(E);return t.jsxs(t.Fragment,{children:[m&&t.jsx(z,{id:pt,type:"geojson",data:kt,children:t.jsx(G,{id:vt,type:"line",paint:N,layout:Ct})}),m&&t.jsxs(z,{id:bt,type:"geojson",data:kt,children:[t.jsx(G,{id:"topology-validated-edges-hitarea-native",type:"line",paint:Bt,layout:Ct}),t.jsx(G,{id:wt,type:"line",paint:N,layout:Ct})]}),t.jsxs(z,{id:xt,type:"geojson",data:kt,children:[t.jsx(G,{id:"neighbor-edges-hitarea-native",type:"line",paint:Bt,layout:{...Ct,visibility:p}}),t.jsx(G,{id:yt,type:"line",paint:Q,layout:{...Ct,visibility:p}})]})]})}const Dt=["topology-validated-edges-hitarea-native","topology-validated-edges-native","topology-weak-edges-native","neighbor-edges-hitarea-native","neighbor-edges-native"];function Et({targetHash:e,nodeCoordinates:t,onComplete:r}){const{current:n}=S(),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 Nt({highlightedEdgeKey:e,validatedPolylines:t,weakPolylines:r,onEnsureTopology:n}){const{current:o}=S(),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 Qt(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 jt(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 Pt({ghost:e,neighborCoordinates:r,onHighlightedNeighborsChange:n}){const{current:o}=S(),i=A.useRef(null),a=A.useRef(null),s=A.useMemo(()=>e?new Set(e.commonNeighbors):new Set,[e]);A.useEffect(()=>{null==n||n(s)},[s,n]);const l=A.useMemo(()=>{if(!(null==e?void 0:e.commonNeighbors)||e.commonNeighbors.length<2)return 8e3;let A=0;const t=[];for(const n of e.commonNeighbors){const A=r.get(n);A&&t.push(A)}e.estimatedLocation&&t.push([e.estimatedLocation.lat,e.estimatedLocation.lon]);for(let e=0;eA&&(A=n)}return Math.max(A,2e3)},[e,r]),c=A.useMemo(()=>{if(!(null==e?void 0:e.estimatedLocation))return{type:"FeatureCollection",features:[]};const{lat:A,lon:t,uncertaintyM:r}=e.estimatedLocation,n=.5*l,o=r>0?r:2e3;return{type:"FeatureCollection",features:[jt(t,A,Math.max(500,Math.min(o,n)))]}},[e,l]);if(A.useEffect(()=>{if(!o)return;const A=o.getMap();if(e&&e.prefix!==a.current){if(a.current=e.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 t=[];for(const A of e.commonNeighbors){const e=r.get(A);e&&t.push([e[1],e[0]])}if(e.estimatedLocation&&t.push([e.estimatedLocation.lon,e.estimatedLocation.lat]),t.length>0){const r=()=>{var n;if(A.isMoving())setTimeout(r,100);else if(1===t.length)o.flyTo({center:t[0],zoom:13,duration:1500});else{let A=1/0,r=-1/0,i=1/0,a=-1/0;for(const[e,n]of t)A=Math.min(A,e),r=Math.max(r,e),i=Math.min(i,n),a=Math.max(a,n);if(null==(n=e.estimatedLocation)?void 0:n.uncertaintyM){const t=e.estimatedLocation.uncertaintyM/111e3;A-=t,r+=t,i-=t,a+=t}o.fitBounds([[A,i],[r,a]],{padding:{top:60,bottom:60,left:60,right:60},maxZoom:14,duration:1500})}};setTimeout(r,50)}}if(!e&&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)}},[e,o,r]),!(null==e?void 0:e.estimatedLocation))return null;return t.jsx(z,{id:"ghost-uncertainty-circle",type:"geojson",data:c,children:t.jsx(G,{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))}(kA.edges.neighborHover);const Ft={longitude:0,latitude:0,zoom:2};function St(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))*6371}function Lt({data:A}){const e=A.subtitle&&"loop"===A.type,r=A.subtitle&&"loop"!==A.type;return t.jsxs("div",{className:"w-[540px]",children:[t.jsxs("div",{className:"flex items-center justify-between h-5",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[A.title.icon&&t.jsx("span",{className:`${A.title.color} text-base leading-none flex-shrink-0`,children:A.title.icon}),t.jsx("span",{className:`${A.title.color} font-semibold text-[13px] truncate`,children:A.title.text}),r&&t.jsx("span",{className:`${A.subtitle.color} text-[11px] flex-shrink-0`,children:A.subtitle.text})]}),A.badges.length>0&&t.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:A.badges.map((A,e)=>t.jsx("span",{className:`${A.color} text-[11px] font-medium`,children:A.text},e))})]}),e&&t.jsx("div",{className:"h-4 mt-0.5 overflow-hidden",children:t.jsx("span",{className:"font-mono text-[10px] text-text-muted truncate block",children:A.subtitle.text})}),t.jsx("div",{className:`flex items-center gap-4 h-4 ${e?"mt-1":"mt-1.5"} text-[11px]`,children:A.stats.map((A,e)=>t.jsxs("span",{className:"whitespace-nowrap",children:[t.jsx("span",{className:`font-mono tabular-nums font-semibold ${A.color??"text-text-primary"}`,children:A.value}),t.jsx("span",{className:"text-text-muted ml-1",children:A.label}),A.unit&&t.jsx("span",{className:"text-text-muted/50 ml-0.5",children:A.unit})]},e))})]})}function It({neighbors:e,localNode:r,localHash:n,onRemoveNode:o,selectedNodeHash:i,onNodeSelected:a,highlightedEdgeKey:s,highlightedGhost:l}){const c=A.useRef(null),u=nA(),d=oA(),f=iA(),g=aA(),h=sA(),[m,b]=A.useState(!1),p=lA(A=>A.preloadFromNodes),x=lA(A=>A.isLoading),v=lA(A=>A.terrainGrid),w=n??h,y=A.useMemo(()=>{const A=[];for(const[,t]of Object.entries(e))t.latitude&&t.longitude&&A.push([t.latitude,t.longitude]);return A},[e]),k=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])=>({pos:[A,e],dist:St(t,r,A,e)}));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[f,g]of t)r=Math.min(r,g),n=Math.max(n,g),o=Math.min(o,f),i=Math.max(i,f);const a=(r+n)/2,s=(o+i)/2,l=i-o,c=n-r,u=Math.max(l,c);let d=16;return u>0&&(d=Math.floor(Math.log2(360/u*1.2)),d=Math.max(1,Math.min(14,d))),d=Math.min(d+1,12),{longitude:a,latitude:s,zoom:d}}(y,r),[y,r]),[C,B]=A.useState(()=>k??Ft),M=A.useRef(!1);A.useEffect(()=>{!M.current&&k&&(B(k),M.current=!0,setTimeout(()=>b(!0),50))},[k]);const[D,E]=A.useState(!1),[N,Q]=A.useState(!1),[j,P]=A.useState(!0),[F,S]=A.useState(!1),[L,I]=A.useState(!1),[R,T]=A.useState("all"),[_,H]=A.useState(null),[z,G]=A.useState(null),[O]=A.useState(0),[W]=A.useState(.5),[Z]=A.useState(0),[K,J]=A.useState(null),[tA,rA]=A.useState(""),[uA,dA]=A.useState(!1),[fA,gA]=A.useState("fetching"),[hA,mA]=A.useState(!1),[bA,pA]=A.useState(0),[xA,wA]=A.useState(!1),[kA,CA]=A.useState(null),MA=A.useCallback(A=>CA(A),[]),DA=A.useCallback(()=>CA(null),[]),[,NA]=A.useState(new Set),jA=ZA(A=>A.coveragePoints),PA=ZA(A=>A.isVisible),FA=ZA(A=>A.brightness),LA=ZA(A=>A.openModal),RA=qA(A=>A.isEnabled),_A=qA(A=>A.toggle),HA=A.useRef(!1);A.useEffect(()=>{jA.length>0&&PA&&!HA.current&&(P(!1),HA.current=!0)},[jA.length,PA]);const zA=A.useRef(null);A.useEffect(()=>{if(i&&i!==zA.current){zA.current=i;const A=setTimeout(()=>{CA(i)},1250);return()=>clearTimeout(A)}},[i]);const[GA,OA]=A.useState(null),[UA,YA]=A.useState(null),WA=A.useCallback((A,e,t)=>{G(A),A&&e&&t?OA({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,color:"",width:0,opacity:0,symmetryRatio:t.symmetryRatio,dominantDirection:t.dominantDirection}}):A||OA(null)},[]),VA=A.useCallback((A,e)=>{YA(A),A&&OA(null)},[]),KA=A.useMemo(()=>{const A={};for(const[t,r]of Object.entries(e))A[t]=r.node_name||r.name||t.substring(0,4);return w&&(A[w]="You"),A},[e,w]),XA=A.useMemo(()=>Object.entries(e).filter(([,A])=>A.latitude&&A.longitude),[e]),$A=A.useMemo(()=>{const A=new Map;w&&(null==r?void 0:r.latitude)&&(null==r?void 0:r.longitude)&&A.set(w,[r.latitude,r.longitude]);for(const[e,t]of XA)t.latitude&&t.longitude&&A.set(e,[t.latitude,t.longitude]);return A},[w,r,XA]),Ae=A.useMemo(()=>{const A=new Map;for(const e of f)"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},[f]),ee=A.useMemo(()=>{var A,t;const r=new Set;for(const n of Ae.keys())(null==(A=e[n])?void 0:A.latitude)&&(null==(t=e[n])?void 0:t.longitude)&&r.add(n);return r},[Ae,e]),te=A.useMemo(()=>{if(0===ee.size||!w)return new Map;const A=q.getPackets();if(0===A.length)return new Map;const e=AA(w);return V(A,ee,e).scores},[ee,w,g.packetCount]),re=A.useCallback(A=>!!(w&&(A.fromHash===w&&ee.has(A.toHash)||A.toHash===w&&ee.has(A.fromHash))),[w,ee]),ne=A.useMemo(()=>{var A,t;if(0===f.length||!w)return[];if(g.backgroundLoadComplete)return[];const r=[];for(const n of f){if("expired"===n.status)continue;if(!(null==(A=e[n.hash])?void 0:A.latitude)||!(null==(t=e[n.hash])?void 0:t.longitude))continue;const o=[w,n.hash].sort(),i=`${o[0]}~${o[1]}`;r.push({fromHash:w,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},[f,w,g.backgroundLoadComplete,e]),oe=A.useMemo(()=>{const A=[];if(ne.length>0&&!g.backgroundLoadComplete){for(const e of ne){const t=$A.get(e.fromHash),r=$A.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A}for(const e of u.validatedEdges){if(re(e))continue;const t=$A.get(e.fromHash),r=$A.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A},[u.validatedEdges,$A,re,ne,g.backgroundLoadComplete]),ie=A.useMemo(()=>{const A=[];for(const e of u.weakEdges){if(re(e))continue;const t=$A.get(e.fromHash),r=$A.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A},[u.weakEdges,$A,re]),ae=A.useMemo(()=>{if(!(null==r?void 0:r.latitude)||!(null==r?void 0:r.longitude))return[];const A=[],t=[r.latitude,r.longitude],n=new Map;for(const e of u.lastHopNeighbors)n.set(e.hash,e.count);const o=new Map;for(const e of f)o.set(e.hash,e.count);for(const r of ee){const i=e[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:t,to:[i.latitude,i.longitude],hash:r,neighbor:i,lastHopData:Ae.get(r)??null,rxAdvertCount:a,txProxyCount:s})}return A},[r,ee,e,Ae,u.lastHopNeighbors,f]),se=A.useMemo(()=>new Set(u.loopEdgeKeys),[u.loopEdgeKeys]),le=A.useMemo(()=>new Set(u.backboneEdges),[u.backboneEdges]),ce=A.useMemo(()=>{let A=0;if(ne.length>0&&!g.backgroundLoadComplete){for(const e of ne)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,ne,g.backgroundLoadComplete]),ue=A.useRef(null);A.useLayoutEffect(()=>{var A,e;ue.current=(null==(e=null==(A=c.current)?void 0:A.getMap)?void 0:e.call(A))??null});const de=X(),fe=A.useMemo(()=>q.getPackets(),[de]);!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),d=A.useRef([]),f=A.useRef(0),g=A.useRef(!1),[h,m]=A.useState(!1),b=A.useRef(null),p=A.useRef([]),x=A.useRef(new Map),v=A.useRef(t);A.useEffect(()=>{v.current=t},[t]),A.useEffect(()=>{x.current=function(A,e){const t=new Map;for(const r of Object.keys(A)){const A=AA(r);t.has(A)||t.set(A,r)}if(e){const A=AA(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),d.current=[];const A=s.current;if(A&&c.current){const e=A.getSource(_e);e&&e.setData({type:"FeatureCollection",features:[]})}g.current=!1,f.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(He)&&A.removeLayer(He),A.getSource(_e)&&A.removeSource(_e),A.addSource(_e,{type:"geojson",data:{type:"FeatureCollection",features:[]}});const t=A.getLayer(Oe)?Oe:void 0;A.addLayer({id:He,type:"line",source:_e,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["case",["any",["==",["get","isSpeculative"],!0],["==",["get","isSpeculative"],"true"]],"#8B7BAD","#00FFFF"],"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(He)&&A.removeLayer(He),A.getSource(_e)&&A.removeSource(_e)}catch{}c.current=!1,m(!1)}}},[l]);const w=A.useRef(()=>{});A.useEffect(()=>{w.current=()=>{const A=s.current;if(!A)return;const e=A.getSource(_e);if(!e)return;const t=performance.now(),r=d.current,n=[],o=[];for(const i of r){const A=t-i.startTime-i.delay;if(A<(i.isSpeculative?Ge:ze)){o.push(i);const e=i.isSpeculative?Ye(A):Ue(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}),d.current=o,o.length>0?u.current=requestAnimationFrame(()=>w.current()):u.current=null}},[]);const y=A.useCallback(()=>{const A=s.current;A&&function(A){if(!A.getLayer(He))return;const e=A.getLayer(Oe)?Oe:void 0;try{A.moveLayer(He,e)}catch{}}(A),null===u.current&&(u.current=requestAnimationFrame(()=>w.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=x.current,t=v.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=$(s,n);if(!A||A.original.length<2)continue;const c=A.original;let u=0,f=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(f),n=t.get(o);d.current.push({edgeKey:A,fromCoord:We(e),toCoord:We(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=f.current;if(!g.current){g.current=!0;const A=(e-3e4)/1e3,t=r.filter(e=>(e.timestamp??0)>=A),n=Math.max(...r.map(A=>A.timestamp??0));if(f.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);0!==n.length&&(f.current=Math.max(...n.map(A=>A.timestamp??0)),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:ue,nodeCoordinates:$A,packets:fe,localHash:w,neighbors:e,meshTopology:u,enabled:RA});const{isExiting:ge,isAnimating:he,resetAnimationState:me}=function({map:e,showTopology:t,validatedPolylines:r,weakPolylines:n,maxCertainCount:o,loopEdgeKeys:i,backboneEdgeKeys:a,highlightedEdgeKey:s,neighbors:l,validatedSourceId:c,weakSourceId:u,neighborPolylines:d=[],showNeighborLines:f=!0,neighborSourceId:g,neighborLinkScores:h=new Map}){const m=A.useRef(null);A.useEffect(()=>{const A=e&&"current"in e?e.current:e;m.current=A});const b=A.useRef(new Map),p=A.useRef(1),x=A.useRef(new Map),v=A.useRef(new Map),w=A.useRef(!1),y=A.useRef(null),k=A.useRef(t),C=A.useRef(new Set),B=A.useRef(""),M=A.useRef(new Map),D=A.useRef(""),E=A.useRef(""),N=A.useRef(""),Q=A.useRef(r),j=A.useRef(n),P=A.useRef(o),F=A.useRef(i),S=A.useRef(a),L=A.useRef(s),I=A.useRef(l),R=A.useRef(d),T=A.useRef(f),_=A.useRef(h);A.useEffect(()=>{Q.current=r,j.current=n,P.current=o,F.current=i,S.current=a,L.current=s,I.current=l,R.current=d,T.current=f,_.current=h},[r,n,o,i,a,s,l,d,f,h]);const H=A.useCallback((A=!1)=>{var e,t,r,n,o,i,a,s,l,d;const f=m.current;if(!f)return;const h=f.getSource(c),w=f.getSource(u),y=f.getSource(g);if(h){const o=Se(Q.current,!0,b.current,p.current,x.current,v.current,P.current,F.current,S.current,L.current,I.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!==D.current)&&(h.setData(o),D.current=i)}if(w){const e=Se(j.current,!1,b.current,p.current,x.current,v.current,P.current,F.current,S.current,L.current,I.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!==E.current)&&(w.setData(e),E.current=t)}if(y&&R.current.length>0){const e=Le(R.current,_.current),t=`${e.features.length}:${(null==(d=null==(l=e.features[0])?void 0:l.properties)?void 0:d.hash)??""}`;(A||t!==N.current)&&(y.setData(e),N.current=t)}},[c,u,g]),z=A.useCallback(()=>{y.current&&(cancelAnimationFrame(y.current),y.current=null),b.current=new Map,p.current=1,x.current=new Map,v.current=new Map,w.current=!1,C.current=new Set,B.current="",M.current=new Map},[]);return A.useEffect(()=>{const A=k.current,e=t;if(k.current=t,m.current){if(y.current&&(cancelAnimationFrame(y.current),y.current=null),A&&!e&&!w.current){w.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));H(!0),o<1?y.current=requestAnimationFrame(t):(w.current=!1,b.current=new Map,C.current=new Set,B.current="",x.current=new Map,v.current=new Map,y.current=null,H(!0))};y.current=requestAnimationFrame(t)}!A&&e&&(b.current=new Map,C.current=new Set,B.current="")}},[t,H]),A.useEffect(()=>{const A=m.current;if(!t||w.current||!A)return;const e=[...r,...n],o=e.map(A=>`${A.edge.key}:${A.edge.certainCount}`).sort().join(","),i=0===C.current.size,a=""!==B.current&&B.current!==o;if(!i&&!a)return void H();const s=[],l=[];for(const{edge:t}of e)C.current.has(t.key)?l.push(t.key):s.push(t.key);a&&l.length>0&&(x.current=new Map(M.current),p.current=0),v.current=new Map;for(const{edge:t}of r){const A=vA(t.certainCount);v.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){y.current&&(cancelAnimationFrame(y.current),y.current=null);let A=null;const e=Math.min(100,BA/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/BA,1);p.current=Fe(A)}H(!0);const o=BA+(s.length-1)*e;y.current=n{const A=m.current;if(!A||!g)return;const e=()=>{const e=A.getSource(g);if(!e)return!1;if(d.length>0){const A=Le(d,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,d,h]),A.useEffect(()=>()=>{y.current&&(cancelAnimationFrame(y.current),y.current=null)},[]),{isExiting:w.current,isAnimating:null!==y.current,resetAnimationState:z,weightAnimProgress:p.current,animStartWeights:x.current,animTargetWeights:v.current}}({map:ue,showTopology:N,validatedPolylines:oe,weakPolylines:ie,maxCertainCount:ce,loopEdgeKeys:se,backboneEdgeKeys:le,highlightedEdgeKey:s,neighbors:e,validatedSourceId:bt,weakSourceId:pt,neighborPolylines:ae,showNeighborLines:j,neighborSourceId:xt,neighborLinkScores:te}),be=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]),pe=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),d=A.useRef(new Map),f=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;f.current&&(cancelAnimationFrame(f.current),f.current=null);const a=g.current,s=h.current,p=m.current,x=b.current;for(const e of r)d.current.has(e)||d.current.set(e,Math.random());const v=(A,e,t)=>{const r=a.has(A),n=s.has(A),o=x&&p.has(A);return!e&&!t||(e&&t?r||n||o:t?r:!e||n||o)},w=[];for(const e of r){const t=v(e,A,n),r=v(e,o,i);t!==r&&w.push({hash:e,startOpacity:t?1:0,targetOpacity:r?1:0})}if(0===w.length)return;l(A=>{const e=new Map(A);for(const{hash:t,startOpacity:r}of w)e.set(t,r);return e});const y=w;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*(d.current.get(r)??0),a=Math.max(0,e-i),s=Math.min(a/500,1),l=n+(o-n)*Ie(s);A.set(r,l),s<1&&(t=!1)}return A}),e<750&&!t?f.current=requestAnimationFrame(C):(f.current=null,l(new Map))};return f.current=requestAnimationFrame(C),()=>{f.current&&(cancelAnimationFrame(f.current),f.current=null)}},[e,t,r]),{nodeOpacities:s,getNodeOpacity:(A,e)=>s.has(A)?s.get(A):e?1:0}}({soloDirect:"direct"===R,soloHubs:"hubs"===R,neighborHashes:XA.map(([A])=>A),hubConnectedNodes:be,directNodeSet:ee,localConnectedNodes:pe,showTopology:N}),{blinkingNodes:ve,blinkColor:we}=function({neighbors:e,localHash:t,enabled:r=!0}){const[n,o]=A.useState(new Map),i=X(),a=A.useRef(q.getPackets());A.useEffect(()=>{a.current=q.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=AA(t);e.has(A)||e.set(A,t)}return e}(e)},[e]);const d=A.useRef(null);return A.useEffect(()=>{d.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=Re(e,750);A>0&&t.set(n,A)}}for(const n of r)e.delete(n);o(t),e.size>0&&d.current?l.current=requestAnimationFrame(d.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 f=0;for(const r of n){const A=$(r,t);if(!A||0===A.original.length)continue;const e=Te(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:e,localHash:n,enabled:RA}),ye=A.useCallback(A=>{if("all"===R)return!0;if("direct"===R)return ee.has(A);if("hubs"===R){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},[R,ee,u.hubNodes,u.validatedEdges]),Ce=A.useCallback(async()=>{mA(!0),dA(!0),gA("fetching"),pA(0),await d(),pA(g.packetCount),gA("analyzing"),await new Promise(A=>setTimeout(A,200)),gA("building");const A=Date.now(),e=Date.now()-A;e<1700&&await new Promise(A=>setTimeout(A,1700-e)),gA("complete"),await new Promise(A=>setTimeout(A,1e3)),dA(!1),mA(!1),me(),wA(!0),setTimeout(()=>{Q(!0)},150)},[d,me,g.packetCount]),Be=A.useCallback(()=>{xA?Q(A=>!A):Ce()},[xA,Ce]),Me=A.useCallback(A=>{B(A.viewState)},[]),De=A.useCallback(()=>{E(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})},[]),Ee=A.useCallback(A=>{T(A)},[]),Qe=A.useCallback(()=>{P(A=>!A)},[]),je=A.useCallback(()=>{S(A=>!A)},[]),Pe=A.useCallback(()=>{I(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})},[]),Ve=A.useCallback(()=>{N||Q(!0)},[N]),Ze=A.useCallback((A,e)=>{J(A),rA(e)},[]),Ke=A.useCallback(()=>{K&&o&&o(K),J(null),rA("")},[K,o]),Je=A.useMemo(()=>[...Dt,...mt],[]),Xe=A.useRef(!1);A.useEffect(()=>{Xe.current="ontouchstart"in window||navigator.maxTouchPoints>0},[]);const qe=A.useCallback(A=>{!Xe.current||!GA||A.features&&0!==A.features.length||(OA(null),G(null))},[GA]),$e=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(z&&(G(null),OA(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]$/,"");G(e),A.lngLat&&OA({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{}},[z]),At=A.useCallback(()=>{var A;G(null),OA(null);try{(null==(A=c.current)?void 0:A.getCanvas())&&(c.current.getCanvas().style.cursor="")}catch{}},[]),et=D?"map-container-fullscreen":"map-container-16-9",tt=y.length>0||(null==r?void 0:r.latitude)&&(null==r?void 0:r.longitude),rt=!m||!tt,nt=tt;return t.jsxs("div",{className:`relative ${et}`,role:"application","aria-label":"Mesh network contacts map","aria-describedby":"map-instructions",children:[t.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."}),rt&&t.jsx("div",{className:"absolute inset-0 z-50 glass-card flex items-center justify-center","aria-hidden":"true",children:t.jsxs("div",{className:"flex flex-col items-center gap-3",children:[t.jsx("div",{className:"w-6 h-6 border-2 border-accent-primary border-t-transparent rounded-full animate-spin"}),t.jsx("span",{className:"text-sm text-text-muted",children:"Loading map..."})]})}),nt&&t.jsx("div",{className:`relative w-full h-full ${D?"":"rounded-[1.125rem] overflow-hidden"} ${rt?"opacity-0":"opacity-100 transition-opacity duration-300"}`,children:t.jsxs(U,{ref:c,...C,onMove:Me,mapStyle:"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json",style:{width:"100%",height:"100%"},attributionControl:!1,interactiveLayerIds:Je,onMouseMove:$e,onMouseLeave:At,onClick:qe,onLoad:A=>{const e=A.target;try{const A=e.getStyle();if(null==A?void 0:A.layers){const t=["road","highway","tunnel","bridge","motorway","trunk","primary","secondary","tertiary","street","path","track"],r=A=>t.some(e=>A.toLowerCase().includes(e));for(const n of A.layers)"fill"===n.type&&n.id.toLowerCase().includes("water")&&e.setPaintProperty(n.id,"fill-color","rgba(22, 26, 32, 1)"),"line"===n.type&&r(n.id)&&e.setPaintProperty(n.id,"line-color","rgba(25, 26, 29, 1)"),"symbol"===n.type&&(e.setPaintProperty(n.id,"text-color","rgba(108, 110, 120, 0.85)"),e.setPaintProperty(n.id,"text-halo-color","rgba(8, 9, 11, 0.9)"),e.setPaintProperty(n.id,"text-halo-width",1),e.setLayoutProperty(n.id,"text-font",["Inter","Open Sans Regular","Arial Unicode MS Regular"]))}}catch(t){}},onError:A=>{},onIdle:()=>{if(!v&&!x&&c.current){const A=c.current.getMap();if(A){const t=Object.values(e).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)&&t.push({latitude:r.latitude,longitude:r.longitude}),t.length>0&&p(t,A)}}},children:[t.jsx(Y,{position:"bottom-right"}),t.jsx(Ne,{enabled:L,exaggeration:4}),t.jsx(ke,{coveragePoints:jA,visible:jA.length>0&&PA,terrainEnabled:L,brightness:FA}),t.jsx(Mt,{showTopology:N,isExiting:ge,hoveredEdgeKey:z,highlightedLoopEdges:null==UA?void 0:UA.highlightedEdgeKeys,onEdgeHover:WA,onLoopHover:VA,loops:u.loops,neighborNames:KA,opacityBias:O,widthMultiplier:W,trafficFilter:Z,showNeighborLines:j,disableHover:he||hA}),i&&t.jsx(Et,{targetHash:i,nodeCoordinates:$A,onComplete:a}),s&&t.jsx(Nt,{highlightedEdgeKey:s,validatedPolylines:oe,weakPolylines:ie,onEnsureTopology:Ve}),t.jsx(Pt,{ghost:l??null,neighborCoordinates:$A,onHighlightedNeighborsChange:NA}),t.jsx(ht,{neighborsWithLocation:XA,localNode:r,localHash:n,zeroHopNeighbors:ee,lastHopNeighborMap:Ae,meshTopology:u,hoveredMarker:_,onMarkerHover:H,getNodeOpacity:xe,shouldShowNode:ye,onRequestRemove:o?Ze:void 0,openPopupId:kA,onOpenPopup:MA,onClosePopup:DA,blinkingNodes:ve,blinkColor:we})]})}),(()=>{const A=function(A,e,t){if(e){const A=e.loops[0],t=e.loops.length,r=[{label:"edges in loop",value:A.size},{label:"strength",value:`${Math.round(100*A.strength)}%`,unit:"(weakest link)"}],n=[];return A.includesLocal&&n.push({text:"★ Includes your node",color:"text-amber-400"}),t>1&&n.push({text:`Part of ${t} overlapping loops`,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}(GA?{type:GA.type,properties:GA.properties}:null,UA,ce);return A&&t.jsx("div",{className:"map-edge-tooltip",children:t.jsx("div",{className:"map-control-glass map-edge-tooltip-inner",children:t.jsx(Lt,{data:A})})})})(),t.jsx(QA,{mapRef:c,showNeighborLines:j,onToggleNeighborLines:Qe,hasNeighborPolylines:ae.length>0,nodeFilter:R,onNodeFilterChange:Ee,hasHubNodes:u.hubNodes.length>0,hasZeroHopNeighbors:ee.size>0,showCoverage:F,onToggleCoverage:je,show3DTerrain:L,onToggle3DTerrain:Pe,isFullscreen:D,onToggleFullscreen:De}),t.jsxs("div",{className:"map-legend-stack",children:[t.jsx(SA,{isActive:N,hasAnalyzed:xA,isLoading:hA,onClick:Be}),t.jsx(IA,{isActive:RA,onClick:_A}),t.jsx(TA,{isActive:jA.length>0&&PA,onClick:LA}),t.jsx(EA,{showTopology:N,validatedPolylineCount:oe.length,filteredNeighborCount:XA.length,hasLocalNode:!(!(null==r?void 0:r.latitude)||!(null==r?void 0:r.longitude)),meshTopology:u,zeroHopNeighbors:ee,neighborsWithLocation:XA})]}),!D&&t.jsx("div",{className:"glass-card-frame absolute inset-0 pointer-events-none rounded-[1.125rem]",style:{zIndex:9999},"aria-hidden":"true"}),t.jsx(cA,{isOpen:null!==K,onCancel:()=>J(null),onConfirm:Ke,title:"Remove Node?",message:`Remove "${tA}" from the contacts list? This will hide the node until it sends a new packet.`,confirmLabel:"Remove",cancelLabel:"Cancel",variant:"danger"}),t.jsx(yA,{isOpen:uA,currentStep:fA,packetCount:bA}),t.jsx(JA,{})]})}export{It as default};
+import{r as A,b as e,j as t,aa as r,ab as n,b9 as o,ba as i,h as a,at as s,ao as l,V as c,a2 as u,ad as d,k as f,aP as g,bb as h,bc as m,bd as b,be as p,af as x,A as v,aL as w,Z as y,bf as k,bg as C,bh as B,c as M,bi as D,X as E,bj as N,a8 as Q,bk as j,av as P,b2 as F,bl as S,$ as L,o as I,an as R,a5 as T,bm as _,au as H,b5 as z,b6 as G,b8 as O,b4 as U,bn as Y}from"./vendor-react-O8XH9yVn.js";import"./maplibre-gl-Bk5DsYkB.js";import{L as W,c as V}from"./link-scoring-Bg3LiwiV.js";import{y as Z,B as K,T as J,at as X,au as q,av as $,e as AA,aw as eA,M as tA,N as rA,ax as nA,ay as oA,f as iA,G as aA,az as sA,aA as lA}from"./index-DGrzd8xb.js";import{C as cA}from"./ConfirmModal-DYznouaT.js";import{c as uA}from"./recharts-BU7auunF.js";import{g as dA,f as fA,h as gA,i as hA}from"./useThemeColors-CD0TSU03.js";import{p as mA,a as bA}from"./vendor-core-WoOfkQwm.js";import{P as pA,N as xA}from"./Contacts-DfRgoaov.js";import"./deckgl-DTsmDcfs.js";import"./PageLayout-DE5PEtD2.js";import"./HashBadge-aS_UIcg2.js";import"./SignalIndicator-BVAbF7xm.js";import"./CollisionExplorerModal-dc7PClY6.js";import"./leaflet-D_ckmI2R.js";function vA(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}function wA({label:A,icon:e,status:n,detail:o}){return t.jsxs("div",{className:uA("flex items-center gap-3 py-3 px-4 rounded-xl transition-all duration-300","active"===n&&"bg-accent-primary/10","complete"===n&&"bg-accent-success/10","pending"===n&&"opacity-40"),children:[t.jsx("div",{className:uA("w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 transition-all duration-300","active"===n&&"bg-accent-primary/20","complete"===n&&"bg-accent-success/20","pending"===n&&"bg-white/5"),children:"complete"===n?t.jsx(r,{className:"w-4 h-4 text-accent-success"}):"active"===n?t.jsx(s,{className:"w-4 h-4 animate-spin text-accent-primary"}):t.jsx("span",{className:"text-text-muted",children:e})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:uA("text-sm font-medium transition-colors","active"===n&&"text-accent-primary","complete"===n&&"text-accent-success","pending"===n&&"text-text-muted"),children:A}),o&&"pending"!==n&&t.jsx("div",{className:"text-xs text-text-muted mt-0.5 truncate",children:o})]})]})}const yA=A.memo(function({isOpen:s,currentStep:l,packetCount:c,onClose:u}){if(A.useEffect(()=>{if(!s)return;const A=A=>{"Escape"===A.key&&u&&u()};window.addEventListener("keydown",A);const e=document.body.style.overflow,t=document.body.style.position,r=document.body.style.width,n=document.body.style.top,o=window.scrollY;return document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%",document.body.style.top=`-${o}px`,()=>{window.removeEventListener("keydown",A),document.body.style.overflow=e,document.body.style.position=t,document.body.style.width=r,document.body.style.top=n,window.scrollTo(0,o)}},[s,u]),!s)return null;const d="complete"===l,f=A=>{const e=["fetching","analyzing","building","discovering","complete"],t=e.indexOf(l),r=e.indexOf(A);return r0?`${c.toLocaleString()} packets`:"Loading database..."}),t.jsx(wA,{label:"Analyzing Database",icon:t.jsx(i,{className:"w-4 h-4"}),status:f("analyzing"),detail:"Processing packet paths"}),t.jsx(wA,{label:"Building Topology",icon:t.jsx(n,{className:"w-4 h-4"}),status:f("building"),detail:"Computing mesh edges"}),t.jsx(wA,{label:"Discovering Nodes",icon:t.jsx(a,{className:"w-4 h-4"}),status:f("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..."})]})})]}),document.body)}),kA={nodeFill:"#F5F5F0",nodeStroke:"#4A5568",localColor:"#FBBF24",hubColor:"#8B7BAD",mobileColor:"#F97316",roomServerColor:"#E17899",neighborColor:"#FBBF24",edges:{rest:"#4B4B4B",restBright:"#616161",restDim:"#3F3F3F",hoverDirect:"#6FBCBD",hoverLoop:"#8B7BAD",hoverStandard:"#8A8A8A",hoverNeighbor:"#FBBF24",neighborRest:"#6B7280",neighborHover:"#FBBF24",highlight:"#FFD700"},edgeOpacity:.82};function CA(){if("undefined"==typeof window)return kA;const A=dA(),e=fA();return{nodeFill:A.nodeFill,nodeStroke:A.nodeStroke,localColor:A.localColor,hubColor:A.hubColor,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:kA.edges.neighborRest,neighborHover:kA.edges.neighborHover,highlight:e.highlight},edgeOpacity:kA.edgeOpacity}}const BA=2e3;function MA({text:A}){return t.jsx(J,{content:A,delay:200,children:t.jsx(g,{className:"w-3.5 h-3.5 text-text-muted cursor-help"})})}function DA({title:A,tooltip:e,isOpen:r,onToggle:n,hasBorder:o=!1}){return t.jsxs("button",{onClick:n,className:"w-full flex items-center justify-between text-text-secondary font-medium py-1 hover:text-text-primary transition-colors "+(o?"mt-2 pt-2 border-t border-white/10":""),children:[t.jsxs("span",{className:"flex items-center gap-1",children:[A,t.jsx(MA,{text:e})]}),t.jsx(f,{className:"w-3 h-3 text-text-muted transition-transform duration-200 "+(r?"":"-rotate-90")})]})}function EA({showTopology:e,validatedPolylineCount:r,filteredNeighborCount:n,hasLocalNode:o,meshTopology:i,zeroHopNeighbors:s,neighborsWithLocation:f}){const g=gA(),h=Z(),m=K(),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}(i),[x,v]=A.useState(!0),[w,y]=A.useState(!0),[k,C]=A.useState(!0);return t.jsxs("div",{className:"map-control-glass text-xs",style:{padding:"0.625rem"},children:[t.jsx(DA,{title:"Nodes",tooltip:"Node type shown by shape. Yellow = direct RF neighbor.",isOpen:x,onToggle:()=>v(!x)}),x&&t.jsxs("div",{className:"flex flex-col gap-1 mt-1.5",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"14px",height:"14px",backgroundColor:g.nodeFill}}),t.jsx("span",{className:"text-text-muted",children:"Node"}),t.jsx(MA,{text:"Standard mesh node. Can be a repeater, client, or companion device."})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"14px",height:"14px",backgroundColor:g.hubColor}}),t.jsx("span",{className:"text-text-muted",children:"Hub"}),t.jsx(MA,{text:"Network hub (≥10% of last-hop traffic). Hubs are central to mesh traffic flow."})]}),(B=f,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})&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(l,{className:"w-3 h-3 flex-shrink-0",style:{color:g.roomColor},strokeWidth:2.5}),t.jsx("span",{className:"text-text-muted",children:"Room"}),t.jsx(MA,{text:"Room Server identity. Hosts a chat room that clients can sync messages with."})]})),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(c,{className:"w-3 h-3 flex-shrink-0",style:{color:g.localColor},strokeWidth:2.5}),t.jsx("span",{className:"text-text-muted",children:"Local"}),t.jsx(MA,{text:"Your repeater. This is the node running pyMC_Repeater that you're connected to."})]}),s.size>0&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"rounded flex-shrink-0",style:{width:"12px",height:"8px",backgroundColor:g.neighborColor}}),t.jsx("span",{className:"text-text-muted",children:"Neighbor"}),t.jsx(MA,{text:"Zero-hop direct RF contact. Color indicates we receive their ADVERTs directly."})]}),i.gatewayNodes.length>0&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"14px",height:"14px",backgroundColor:g.hubColor,opacity:.7}}),t.jsx("span",{className:"text-text-muted",children:"Gateway"}),t.jsx(MA,{text:"Significant traffic forwarder (7-10% of last-hop traffic). Gateways relay substantial traffic to the local node."})]}),p>0&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"14px",height:"14px",backgroundColor:"rgb(168, 85, 247)",opacity:.8}}),t.jsx("span",{className:"text-text-muted",children:"Backbone"}),t.jsx(MA,{text:"Critical relay with 4+ neighbors and high betweenness centrality. Backbone nodes carry the majority of mesh traffic."})]}),i.mobileNodes.length>0&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"14px",height:"14px",background:"transparent",border:`4px solid ${g.mobileColor}`,boxSizing:"border-box"}}),t.jsx("span",{className:"text-text-muted",children:"Mobile"}),t.jsx(MA,{text:"Volatile node that frequently appears/disappears from paths. Likely a portable or vehicle-mounted device."})]}),b>0&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(a,{className:"w-3 h-3 flex-shrink-0",style:{color:"var(--accent-tertiary)"},strokeWidth:2.5}),t.jsxs("span",{className:"text-text-muted",children:["Ghost (",b,")"]}),t.jsx(MA,{text:"Unknown repeater discovered via Viterbi HMM path analysis. These nodes appear in paths but aren't in our neighbor table."})]})]}),s.size>0&&t.jsxs(t.Fragment,{children:[t.jsx(DA,{title:"Link Quality",tooltip:"Neighbor edge colors based on bidirectional link balance. 2-Way = balanced. Listener = they hear us. Loud = they route to us.",isOpen:w,onToggle:()=>y(!w),hasBorder:!0}),w&&t.jsxs("div",{className:"flex flex-col gap-1 mt-1.5",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"flex-shrink-0 rounded-sm",style:{width:"16px",height:"3px",backgroundColor:W.YELLOW}}),t.jsx("span",{className:"text-text-muted",children:"2-Way"}),t.jsx(MA,{text:"33-67% balanced. Ideal bidirectional link - this neighbor both hears us and routes traffic to us equally well."})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"flex-shrink-0 rounded-sm",style:{width:"16px",height:"3px",backgroundColor:W.GREEN}}),t.jsx("span",{className:"text-text-muted",children:"Listener"}),t.jsx(MA,{text:">67% listener score. This neighbor hears our transmissions well (good RX from us)."})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"flex-shrink-0 rounded-sm",style:{width:"16px",height:"3px",backgroundColor:W.RED}}),t.jsx("span",{className:"text-text-muted",children:"Loud"}),t.jsx(MA,{text:"<33% listener score. This neighbor routes more traffic TO us than they hear from us."})]})]})]}),e&&r>0&&t.jsxs(t.Fragment,{children:[t.jsx(DA,{title:"Topology",tooltip:"Links with 5+ validations. Thickness = relative strength.",isOpen:k,onToggle:()=>C(!k),hasBorder:!0}),k&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex flex-col gap-0.5 text-text-muted mt-1",children:[t.jsxs("div",{className:"flex justify-between tabular-nums",children:[t.jsx("span",{children:"Nodes"}),t.jsx("span",{className:"text-text-secondary",children:n+(o?1:0)})]}),i.hubNodes.length>0&&t.jsxs("div",{className:"flex justify-between tabular-nums",children:[t.jsx("span",{children:"Hubs"}),t.jsx("span",{style:{color:kA.hubColor},children:i.hubNodes.length})]})]}),i.loops.length>0&&t.jsx("div",{className:"mt-1.5 pt-1.5 border-t border-white/10",children:t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(u,{className:"w-3 h-3 flex-shrink-0",style:{color:kA.edges.hoverLoop}}),t.jsxs("div",{className:"flex flex-col",children:[t.jsxs("span",{style:{color:kA.edges.hoverLoop},className:"font-medium",children:[i.loops.length," ",1===i.loops.length?"Loop":"Loops"]}),t.jsx("span",{className:"text-text-muted text-[10px] leading-tight",children:"Redundant paths"})]})]})}),m.totalPaths>0&&t.jsx("div",{className:"mt-1.5 pt-1.5 border-t border-white/10",children:t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(d,{className:"w-3 h-3 flex-shrink-0",style:{color:"var(--accent-primary)"}}),t.jsxs("div",{className:"flex flex-col",children:[t.jsxs("span",{style:{color:"var(--accent-primary)"},className:"font-medium",children:[m.totalPaths.toLocaleString()," Viterbi"]}),t.jsx("span",{className:"text-text-muted text-[10px] leading-tight",children:"HMM decoded paths"})]})]})})]})]})]});var B}function NA({options:A,value:e,onChange:r,size:n="sm",className:o=""}){const i={sm:"text-[10px] px-1.5 py-0.5",md:"text-xs px-2 py-1"};return t.jsx("div",{className:`inline-flex rounded-md bg-black/40 p-0.5 ${o}`,role:"radiogroup",children:A.map(A=>{const o=e===A.value;return t.jsx("button",{onClick:()=>r(A.value),className:`\n ${i[n]}\n rounded transition-all font-medium\n ${o?"bg-white/15 text-text-primary shadow-sm":"text-text-muted hover:text-text-secondary hover:bg-white/5"}\n `,role:"radio","aria-checked":o,title:A.title,children:A.icon?t.jsxs("span",{className:"flex items-center gap-1",children:[A.icon,t.jsx("span",{className:"hidden sm:inline",children:A.label})]}):A.label},A.value)})})}function QA({mapRef:A,showNeighborLines:e,onToggleNeighborLines:r,hasNeighborPolylines:n,nodeFilter:o,onNodeFilterChange:i,hasHubNodes:a,hasZeroHopNeighbors:s,showCoverage:l,onToggleCoverage:c,show3DTerrain:u,onToggle3DTerrain:d,isFullscreen:f,onToggleFullscreen:g}){const y=[{value:"all",label:"All",title:"Show all nodes"},...a?[{value:"hubs",label:"Hubs",title:"Show only hub nodes and their connections"}]:[],...s?[{value:"direct",label:"Direct",title:"Show only zero-hop (direct RF) neighbors"}]:[]];return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"absolute top-3 right-3 z-[600] map-controls-container sm:top-4 sm:right-4",children:t.jsxs("div",{className:"map-controls-row",children:[n&&t.jsx("button",{onClick:r,className:"map-control-btn rounded-lg transition-colors hover:bg-white/5",style:e?{backgroundColor:"#1a1408"}:void 0,title:e?"Hide neighbor lines":"Show neighbor lines","aria-label":e?"Hide neighbor lines":"Show neighbor lines","aria-pressed":e,children:t.jsx(h,{className:"map-control-icon "+(e?"text-amber-400":"text-text-secondary")})}),y.length>1&&t.jsx(NA,{options:y,value:o,onChange:i,size:"sm"}),t.jsx("button",{onClick:d,className:"map-control-btn rounded-lg transition-colors hover:bg-white/5",style:u?{backgroundColor:"#0a1a1a"}:void 0,title:u?"Disable 3D terrain":"Enable 3D terrain","aria-label":u?"Disable 3D terrain":"Enable 3D terrain","aria-pressed":u,children:t.jsx(m,{className:"map-control-icon "+(u?"text-teal-400":"text-text-secondary")})}),t.jsx("button",{onClick:g,className:"map-control-btn rounded-lg transition-colors hover:bg-white/5",title:f?"Exit fullscreen":"Fullscreen","aria-label":f?"Exit fullscreen":"Enter fullscreen","aria-pressed":f,children:f?t.jsx(b,{className:"map-control-icon text-text-secondary"}):t.jsx(p,{className:"map-control-icon text-text-secondary"})})]})}),t.jsx("div",{className:"absolute top-[3.5rem] right-3 z-[600] map-controls-container sm:top-[4rem] sm:right-4 lg:top-[4.5rem]",children:t.jsxs("div",{className:"flex flex-col items-stretch map-nav-module",children:[t.jsx("button",{onClick:()=>{var e,t;null==(t=null==(e=A.current)?void 0:e.getMap())||t.zoomIn()},className:"map-control-btn hover:bg-white/5 flex items-center justify-center",title:"Zoom in","aria-label":"Zoom in",children:t.jsx(x,{className:"map-control-icon text-text-secondary"})}),t.jsx("button",{onClick:()=>{var e,t;null==(t=null==(e=A.current)?void 0:e.getMap())||t.zoomOut()},className:"map-control-btn hover:bg-white/5 border-t border-white/6 flex items-center justify-center",title:"Zoom out","aria-label":"Zoom out",children:t.jsx(v,{className:"map-control-icon text-text-secondary"})}),t.jsx("button",{onClick:()=>{var e;const t=null==(e=A.current)?void 0:e.getMap();t&&t.easeTo({bearing:0,pitch:0,duration:300})},className:"map-control-btn hover:bg-white/5 border-t border-white/6 flex items-center justify-center",title:"Reset bearing to north","aria-label":"Reset bearing to north",children:t.jsx(w,{className:"map-control-icon text-text-secondary"})})]})})]})}const jA="#4ADE80",PA="DeepAnalysis";function FA(){return"abcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(36*Math.random())]}function SA({isActive:e,hasAnalyzed:r,isLoading:o,onClick:i}){const[a,l]=A.useState(!1),[c,u]=A.useState(PA),d=A.useRef(!1),f=A.useRef(null),[g]=A.useState(()=>{var A;return"undefined"!=typeof window&&((null==(A=window.matchMedia)?void 0:A.call(window,"(hover: hover)").matches)??!1)}),h=a&&!e&&!o&&g;A.useEffect(()=>{if(a&&!e&&!o&&!d.current){d.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{f.current&&cancelAnimationFrame(f.current)}},[a,e,o]);const m=o?"Analyzing...":c;return t.jsxs("button",{onClick:i,onMouseEnter:()=>g&&l(!0),onMouseLeave:()=>g&&l(!1),onPointerEnter:()=>g&&l(!0),onPointerLeave:()=>g&&l(!1),disabled:o,className:`map-control-btn flex items-center gap-2 w-full text-left transition-colors ${e?"map-control-glass-active":"map-control-glass"} ${o?"cursor-wait":""}`,style:{padding:"0.5rem 0.625rem",backgroundColor:e?"#0a1a0a":"#050505"},title:o?"Analyzing packet history...":r?e?"Hide topology edges":"Show topology edges":"Load full packet history and build topology",children:[o?t.jsx(s,{className:"w-3.5 h-3.5 flex-shrink-0 text-green-400 animate-spin"}):t.jsx(n,{className:"w-3.5 h-3.5 flex-shrink-0 transition-colors "+(e?"text-green-400":"text-text-secondary"),style:h?{color:jA}:void 0}),t.jsx("span",{className:e?"text-green-400":"text-text-secondary",style:{fontFamily:"ui-monospace, SFMono-Regular, monospace",fontSize:"0.6875rem",fontWeight:e||h?700:500,letterSpacing:"-0.01em",lineHeight:1,...h?{color:jA}:{}},children:m})]})}const LA="#00FFFF";function IA({isActive:e,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),d=A.useRef(!1),[f]=A.useState(()=>{var A;return"undefined"!=typeof window&&((null==(A=window.matchMedia)?void 0:A.call(window,"(hover: hover)").matches)??!1)}),g=n&&!e&&f;A.useEffect(()=>{g&&!d.current&&(d.current=!0,u(1),setTimeout(()=>u(2),100),setTimeout(()=>u(3),200)),n||(d.current=!1,u(0))},[g,n]),A.useEffect(()=>{if(n&&!e&&!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,e]);const h=A=>{if(e)return;if(!g)return;const t=11*i;return A>=t-2&&Af&&o(!0),onMouseLeave:()=>f&&o(!1),onPointerEnter:()=>f&&o(!0),onPointerLeave:()=>f&&o(!1),className:"map-control-btn flex items-center gap-2 w-full text-left transition-colors "+(e?"map-control-glass-active":"map-control-glass"),style:{padding:"0.5rem 0.625rem",backgroundColor:e?"#0a2a2a":"#050505"},title:e?"Disable live packet tracing (reduces CPU usage)":"Enable live packet tracing",children:[t.jsx(y,{className:"w-3.5 h-3.5 flex-shrink-0 "+(e?"text-cyan-400":"text-text-secondary"),fill:1===c?"#FFFFFF":3===c?LA:"none",stroke:1===c||2===c?"#FFFFFF":g?LA:"currentColor",style:{transition:"fill 0.05s, stroke 0.05s"}}),t.jsx("span",{className:e?"text-cyan-400":"text-text-secondary",style:{fontFamily:"ui-monospace, SFMono-Regular, monospace",fontSize:"0.6875rem",fontWeight:e||g?700:500,letterSpacing:"-0.01em",lineHeight:1},children:"LiveTrace".split("").map((A,e)=>t.jsx("span",{style:{color:h(e)||void 0},children:A},e))})]})}const RA="#fe8019";function TA({isActive:e,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(()=>{if(!i||e)return;const A=requestAnimationFrame(()=>l(!0)),t=setTimeout(()=>l(!1),80);return()=>{cancelAnimationFrame(A),clearTimeout(t)}},[i,e]);const u=Math.max(.01,Math.min(1,n)),d=u<.999,f=u>.011,g=i&&!e&&c;return t.jsxs("button",{onClick:r,onMouseEnter:()=>c&&a(!0),onMouseLeave:()=>c&&a(!1),onPointerEnter:()=>c&&a(!0),onPointerLeave:()=>c&&a(!1),className:"map-control-btn flex items-center gap-2 w-full text-left transition-colors "+(e?"map-control-glass-active":"map-control-glass"),style:{padding:"0.5rem 0.625rem",backgroundColor:e?"#1a1408":"#050505"},title:e?"Configure wardriving coverage":"Show wardriving coverage",children:[t.jsx(k,{className:"w-3.5 h-3.5 flex-shrink-0 transition-colors "+(e?"text-amber-400":"text-text-secondary"),style:g?{color:RA}:void 0}),t.jsx("span",{className:e?"text-amber-400":"text-text-secondary",style:{fontFamily:e||g?"'Jacquard 12', serif":"ui-monospace, SFMono-Regular, monospace",fontSize:e||g?"0.75rem":"0.6875rem",fontWeight:500,letterSpacing:"-0.01em",lineHeight:1,transition:"none",transform:e?"scale(1.45)":g?`scale(${s?1.595:1.45})`:void 0,transformOrigin:"left center",...g?{color:RA}:{}},children:"Wardrive"}),e&&o&&t.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[t.jsx("button",{onClick:A=>{A.stopPropagation();const e=Math.max(.01,u-.2);null==o||o(e)},disabled:!f,className:"p-0.5 rounded transition-colors "+(f?"hover:bg-[#252525] text-amber-400":"text-amber-400/30 cursor-not-allowed"),title:`Decrease opacity (${Math.round(100*u)}%)`,children:t.jsx(C,{className:"w-3.5 h-3.5"})}),t.jsx("button",{onClick:A=>{A.stopPropagation();const e=Math.min(1,u+.2);null==o||o(e)},disabled:!d,className:"p-0.5 rounded transition-colors "+(d?"hover:bg-[#252525] text-amber-400":"text-amber-400/30 cursor-not-allowed"),title:`Increase opacity (${Math.round(100*u)}%)`,children:t.jsx(B,{className:"w-3.5 h-3.5"})})]})]})}function _A(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 HA(A){return Math.exp(-A*Math.LN2/7)}const zA="pymc-wardriving-url",GA="pymc-wardriving-enabled",OA="pymc-wardriving-brightness";function UA(A){"undefined"!=typeof localStorage&&(A?localStorage.setItem(zA,A):localStorage.removeItem(zA))}function YA(A){"undefined"!=typeof localStorage&&localStorage.setItem(GA,String(A))}function WA(){if("undefined"==typeof localStorage)return.7;const A=localStorage.getItem(OA);if(A){const e=parseFloat(A);if(!isNaN(e)&&e>=.01&&e<=1)return e}return.7}function VA(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 ZA=M((A,e)=>({status:"idle",isVisible:"undefined"!=typeof localStorage&&"true"===localStorage.getItem(GA),coveragePoints:[],repeaters:[],error:null,stats:{coverageCount:0,repeaterCount:0,lastUpdated:null},url:"undefined"==typeof localStorage?"":localStorage.getItem(zA)||"",brightness:WA(),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(OA,String(e))}(t),A({brightness:t})},toggleVisibility:()=>{const t=!e().isVisible;YA(t),A({isVisible:t})},setVisible:e=>{YA(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}=_A(r.hash),o=parseInt(r.time,10),i=isNaN(o)?30:(Date.now()-o)/864e5,a=HA(i),s=VA(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()}),UA(e.trim()),YA(!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:""}),UA(""),YA(!1)}}));function KA({status:A}){if("connecting"!==A&&"loading"!==A&&"processing"!==A)return null;const e={idle:"",connecting:"Connecting to server...",loading:"Fetching coverage data...",processing:"Processing coverage points...",success:"",error:""}[A];return e?t.jsxs("div",{className:"flex items-center gap-3 p-4 bg-amber-500/10 border border-amber-500/30 rounded-xl",children:[t.jsx("div",{className:"relative",children:t.jsx(s,{className:"w-5 h-5 text-amber-400 animate-spin"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"text-sm text-amber-400 font-medium",children:e}),t.jsx("div",{className:"mt-2 h-1 bg-amber-500/20 rounded-full overflow-hidden",children:t.jsx("div",{className:"h-full bg-amber-400 rounded-full transition-all duration-300",style:{width:"connecting"===A?"30%":"loading"===A?"60%":"90%"}})})]})]}):null}function JA(){const{isModalOpen:e,closeModal:n,status:i,isVisible:a,stats:l,error:c,url:u,brightness:f,loadCoverage:g,clearCoverage:h,toggleVisibility:m,setUrl:b,setBrightness:p}=ZA(),x="connecting"===i||"loading"===i||"processing"===i,[v,w]=A.useState(u),y=A.useCallback(async()=>{await g(v)},[v,g]),k=A.useCallback(()=>{w(""),h()},[h]),C=A.useCallback(A=>{"Enter"!==A.key||A.shiftKey||x||(A.preventDefault(),y())},[y,x]),M=A.useCallback(A=>{const e=A.target.value;w(e),b(e)},[b]);if(!e)return null;const S=l.coverageCount>0,L=v.trim().length>0&&!x;return t.jsxs("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center",children:[t.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-md",onClick:x?void 0:n}),t.jsxs("div",{className:"relative glass-card-elevated w-full max-w-md mx-4",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border-subtle",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"p-2 rounded-lg bg-amber-500/20",children:t.jsx(D,{className:"w-5 h-5 text-amber-400"})}),t.jsxs("div",{children:[t.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Wardriving Coverage"}),t.jsx("p",{className:"text-xs text-text-muted",children:"Overlay RF coverage heatmap"})]})]}),t.jsx("button",{onClick:n,disabled:x,className:"p-2 rounded-lg hover:bg-[#252525] transition-colors disabled:opacity-50",children:t.jsx(E,{className:"w-5 h-5 text-text-secondary"})})]}),t.jsxs("div",{className:"p-4 space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-2",children:"Coverage Server URL"}),t.jsx("input",{type:"url",value:v,onChange:M,onKeyDown:C,placeholder:"https://coverage.wcmesh.com",className:"w-full px-4 py-3 bg-black/30 border border-border rounded-xl text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-amber-500/50 focus:border-amber-500/50 transition-all disabled:opacity-50",disabled:x}),t.jsx("p",{className:"mt-1.5 text-xs text-text-muted",children:"Enter the base URL of a wardriving coverage server (e.g., coverage.wcmesh.com)"})]}),t.jsx(KA,{status:i}),"error"===i&&c&&t.jsxs("div",{className:"flex items-start gap-3 p-3 bg-red-500/10 border border-red-500/30 rounded-xl",children:[t.jsx(N,{className:"w-5 h-5 text-red-400 flex-shrink-0 mt-0.5"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm text-red-400 font-medium",children:"Connection Failed"}),t.jsx("p",{className:"text-xs text-red-400/80 mt-0.5",children:c})]})]}),"success"===i&&S&&t.jsxs("div",{className:"flex items-start gap-3 p-3 bg-green-500/10 border border-green-500/30 rounded-xl",children:[t.jsx(r,{className:"w-5 h-5 text-green-400 flex-shrink-0 mt-0.5"}),t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"text-sm text-green-400 font-medium",children:"Data Loaded Successfully"}),t.jsxs("p",{className:"text-xs text-green-400/80 mt-0.5",children:[l.coverageCount.toLocaleString()," coverage points • ",l.repeaterCount.toLocaleString()," repeaters"]})]})]}),S&&!x&&"success"!==i&&t.jsxs("div",{className:"flex items-start gap-3 p-3 bg-amber-500/10 border border-amber-500/30 rounded-xl",children:[t.jsx(Q,{className:"w-5 h-5 text-amber-400 flex-shrink-0 mt-0.5"}),t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"text-sm text-amber-400 font-medium",children:"Coverage Data Loaded"}),t.jsxs("p",{className:"text-xs text-amber-400/80 mt-0.5",children:[l.coverageCount.toLocaleString()," points •",l.lastUpdated&&` Last updated ${l.lastUpdated.toLocaleTimeString()}`]})]})]}),S&&!x&&t.jsx("div",{className:"p-3 bg-black/20 border border-border-subtle rounded-xl",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(B,{className:"w-4 h-4 flex-shrink-0 "+(f>.5?"text-amber-400":"text-text-muted")}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsx("span",{className:"text-xs text-text-secondary",children:"Brightness"}),t.jsxs("span",{className:"text-xs text-text-muted font-mono",children:[Math.round(100*f),"%"]})]}),t.jsx("input",{type:"range",min:"1",max:"100",value:100*f,onChange:A=>p(Number(A.target.value)/100),className:"w-full h-1.5 cursor-pointer accent-amber-400"})]})]})})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3 p-4 border-t border-border-subtle",children:[t.jsx("div",{className:"flex items-center gap-2",children:S&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:m,disabled:x,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-text-secondary hover:text-text-primary hover:bg-[#202020] rounded-lg transition-colors disabled:opacity-50",title:a?"Hide heatmap":"Show heatmap",children:a?t.jsxs(t.Fragment,{children:[t.jsx(j,{className:"w-3.5 h-3.5"})," Hide"]}):t.jsxs(t.Fragment,{children:[t.jsx(d,{className:"w-3.5 h-3.5"})," Show"]})}),t.jsxs("button",{onClick:k,disabled:x,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-red-400/80 hover:text-red-400 hover:bg-red-500/10 rounded-lg transition-colors disabled:opacity-50",title:"Clear coverage data",children:[t.jsx(P,{className:"w-3.5 h-3.5"})," Clear"]})]})}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:n,disabled:x,className:"px-4 py-2 text-sm font-medium text-text-secondary hover:bg-[#252525] rounded-lg transition-colors disabled:opacity-50",children:S?"Done":"Cancel"}),t.jsx("button",{onClick:y,disabled:!L,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium bg-amber-500 hover:bg-amber-400 text-black rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:x?t.jsxs(t.Fragment,{children:[t.jsx(s,{className:"w-4 h-4 animate-spin"}),"Loading..."]}):S?t.jsxs(t.Fragment,{children:[t.jsx(o,{className:"w-4 h-4"}),"Refresh"]}):t.jsxs(t.Fragment,{children:[t.jsx(F,{className:"w-4 h-4"}),"Connect"]})})]})]})]})]})}const XA={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{}}},qA=M()(mA(A=>({isEnabled:!1,toggle:()=>A(A=>({isEnabled:!A.isEnabled})),setEnabled:e=>A({isEnabled:e})}),{name:"pymc-live-trace",storage:bA(()=>XA)}));var $A=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,d,f,g,h,m,b,p="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function x(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}(f,A,e):""}function v(A,e){return A%e>0&&(A+=e-A%e),A}function w(A){u=A,t.HEAP8=d=new Int8Array(A),t.HEAP16=g=new Int16Array(A),t.HEAP32=h=new Int32Array(A),t.HEAPU8=f=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,w(u),h[7156]=5271536;var C=[],B=[],M=[],D=[];function E(A){C.unshift(A)}function N(A){D.unshift(A)}var Q=Math.abs,j=Math.ceil,P=Math.floor,F=Math.min,S=0,L=null;t.preloadedImages={},t.preloadedAudios={};var I,R,T=null,_="data:application/octet-stream;base64,";function H(A){return String.prototype.startsWith?A.startsWith(_):0===A.indexOf(_)}function z(){return d.length}T="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAAAAUAAAACAAAAAAAAAAIAAAADAAAAAQAAAAQAAAAGAAAAAAAAAAUAAAADAAAABgAAAAQAAAAFAAAAAAAAAAE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mW43AFAZhu25b633D8c1YgmzowSQNM25BRKWARArGS08/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//////////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAACAAAAAAAAAAIAAAABAAAAAQAAAAIAAAACAAAAAAAAAAUAAAAFAAAAAAAAAAIAAAACAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAA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xL9y/tK8+D86XyZpgrHiPwAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAP////8AAAAAAAAAAAAAAAABAAAAAAAAAAAAAAD/////AAAAAAAAAAABAAAAAQAAAAAAAAAAAAAA/////wAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAP////8FAAAABQAAAAAAAAAAAAAAAAAAAAAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAEAAAAAAAAABQAAAAEAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQAAAAAAA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+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+yEJQBgtRFT7IQnAYWxnb3MuYwBoM05laWdoYm9yUm90Y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faXNCYXNlQ2VsbFBlbnRhZ29uKGJhc2VDZWxsKQBiYXNlQ2VsbFJvdGF0aW9ucyA+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|I(A,e,t,r,o,s,l,0);break}(a=0|We(s,4))?(c=0|I(A,e,t,r,a,s,l,0),Ye(a),a=c):a=13}else a=2}while(0);return P=i,0|a}function L(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,d=0,f=0,g=0,h=0,m=0;if(a=P,P=P+16|0,m=a+8|0,n[(h=i=a)>>2]=A,n[h+4>>2]=e,(0|t)<0)return P=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 P=a,9;n[m>>2]=0;A:do{if((0|t)>=1)if(s)for(f=1,d=0,g=0,h=1,s=A;;){if(!(d|g)){if(0|(s=0|R(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|R(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+(f<<3)|0)>>2]=s,n[A+4>>2]=e,n[o+(f<<2)>>2]=h,l=(0|(A=d+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}f=f+1|0,d=l?0:A,g=l?u?0:c:g}else for(f=1,d=0,g=0,h=1,s=A;;){if(!(d|g)){if(0|(s=0|R(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|R(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+(f<<3)|0)>>2]=s,n[A+4>>2]=e,l=(0|(A=d+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}f=f+1|0,d=l?0:A,g=l?u?0:c:g}else s=0}while(0);return P=a,0|s}function I(A,e,t,r,o,i,a,s){t|=0,r|=0,o|=0,s|=0;var l,c,u,d=0,f=0,g=0,h=0,m=0,b=0,p=0;if(u=P,P=P+16|0,l=u+8|0,c=u,d=0|At(0|(A|=0),0|(e|=0),0|(i|=0),0|(a|=0)),g=0|B(),!(!(0|(p=0|n[(b=h=r+(d<<3)|0)>>2]))&!(0|(b=0|n[b+4>>2]))|(f=(0|p)==(0|A)&(0|b)==(0|e))))do{d=0|$e(0|(d=0|Ve(0|d,0|g,1,0)),0|B(),0|i,0|a),g=0|B(),f=(0|(b=0|n[(p=h=r+(d<<3)|0)>>2]))==(0|A)&(0|(p=0|n[p+4>>2]))==(0|e)}while(!(!(0|b)&!(0|p)|f));if(d=o+(d<<2)|0,f&&(0|n[d>>2])<=(0|s))return P=u,0;if(n[(p=h)>>2]=A,n[p+4>>2]=e,n[d>>2]=s,(0|s)>=(0|t))return P=u,0;switch(f=s+1|0,n[l>>2]=0,0|(d=0|R(A,e,2,l,c))){case 9:m=9;break;case 0:(d=0|I(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f))||(m=9)}A:do{if(9==(0|m)){switch(n[l>>2]=0,0|(d=0|R(A,e,3,l,c))){case 9:break;case 0:if(0|(d=0|I(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f)))break A;break;default:break A}switch(n[l>>2]=0,0|(d=0|R(A,e,1,l,c))){case 9:break;case 0:if(0|(d=0|I(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f)))break A;break;default:break A}switch(n[l>>2]=0,0|(d=0|R(A,e,5,l,c))){case 9:break;case 0:if(0|(d=0|I(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f)))break A;break;default:break A}switch(n[l>>2]=0,0|(d=0|R(A,e,4,l,c))){case 9:break;case 0:if(0|(d=0|I(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f)))break A;break;default:break A}switch(n[l>>2]=0,0|(d=0|R(A,e,6,l,c))){case 9:break;case 0:if(0|(d=0|I(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f)))break A;break;default:break A}return P=u,0}}while(0);return P=u,0|d}function R(A,e,t,r,o){A|=0,e|=0,o|=0;var i,a,s=0,l=0,c=0,u=0,d=0,f=0,g=0;if((t|=0)>>>0>6)return 1;if(d=(0|n[(r|=0)>>2])%6|0,n[r>>2]=d,(0|d)>0){s=0;do{t=0|xA(t),s=s+1|0}while((0|s)<(0|n[r>>2]))}if(d=0|tt(0|A,0|e,45),B(),(a=127&d)>>>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,f=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&~f,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&d){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 T(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,d=0,f=0,g=0,h=0;if(i=P,P=P+16|0,h=i+8|0,n[(g=o=i)>>2]=A,n[g+4>>2]=e,(0|t)<0)return P=i,2;if(!t)return n[(h=r)>>2]=A,n[h+4>>2]=e,P=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|R(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[(f=r)>>2]=g,n[f+4>>2]=e,f=t+-1|0,d=0,A=1;do{if(a=26800+(d<<2)|0,5==(0|d))for(l=0|n[a>>2],s=0,a=A;;){if(0|(A=0|R(0|n[(A=o)>>2],0|n[A+4>>2],l,h,o)))break A;if((0|s)!=(0|f)){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|R(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}d=d+1|0}while(d>>>0<6);A=(0|g)==(0|n[(A=o)>>2])&&(0|e)==(0|n[A+4>>2])?0:9}}while(0);return P=i,0|A}function _(A,e,t,r){t|=0,r|=0;var o,i,a,s=0,l=0;for(a=P,P=P+16|0,o=a,i=a+8|0,s=(s=!(0|HA(A|=0,e|=0)))?1:2;;){if(n[i>>2]=0,!(0|R(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)?(P=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,d,f,g,h,m,b,p,x=0,v=0,w=0,y=0,k=0,C=0,M=0,D=0,E=0,N=0,Q=0,j=0,F=0,S=0,L=0,I=0,R=0,T=0,_=0;if(p=P,P=P+64|0,h=p+48|0,m=p+32|0,b=p+24|0,l=p+8|0,c=p,(0|(v=0|n[(A|=0)>>2]))<=0)return P=p,0;for(u=A+4|0,d=h+8|0,f=m+8|0,g=l+8|0,x=0,F=0;;){j=(w=0|n[u>>2])+(F<<4)|0,n[h>>2]=n[j>>2],n[h+4>>2]=n[j+4>>2],n[h+8>>2]=n[j+8>>2],n[h+12>>2]=n[j+12>>2],(0|F)==(v+-1|0)?(n[m>>2]=n[w>>2],n[m+4>>2]=n[w+4>>2],n[m+8>>2]=n[w+8>>2],n[m+12>>2]=n[w+12>>2]):(j=w+(F+1<<4)|0,n[m>>2]=n[j>>2],n[m+4>>2]=n[j+4>>2],n[m+8>>2]=n[j+8>>2],n[m+12>>2]=n[j+12>>2]),v=0|tA(h,m,r,b);A:do{if(v)w=0,x=v;else if(w=0|n[(v=b)>>2],(0|(v=0|n[v+4>>2]))>0|!(0|v)&w>>>0>0){Q=0,j=0;e:for(;;){if(R=1/(+(w>>>0)+4294967296*+(0|v)),_=+o[h>>3],T=+((v=0|Ze(0|w,0|v,0|Q,0|j))>>>0)+4294967296*+(0|B()),I=+(Q>>>0)+4294967296*+(0|j),o[l>>3]=R*(_*T)+R*(+o[m>>3]*I),o[g>>3]=R*(+o[d>>3]*T)+R*(+o[f>>3]*I),0|(v=0|KA(l,r,c))){x=v;break}C=0|At(0|(E=0|n[(N=c)>>2]),0|(N=0|n[N+4>>2]),0|e,0|t),y=0|B(),w=0|n[(k=v=s+(C<<3)|0)>>2],k=0|n[k+4>>2];t:do{if(!(0|w)&!(0|k))S=v,L=16;else for(M=0,D=0;;){if((0|M)>(0|t)|(0|M)==(0|t)&D>>>0>e>>>0){x=1;break e}if((0|w)==(0|E)&(0|k)==(0|N))break t;if(C=0|$e(0|(v=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|(w=0|n[(k=v=s+(C<<3)|0)>>2]))&!(0|(k=0|n[k+4>>2]))){S=v,L=16;break}}}while(0);if(16!=(0|L)||(L=0,!(0|E)&!(0|N))||(n[(D=S)>>2]=E,n[D+4>>2]=N,D=a+(n[i>>2]<<3)|0,n[D>>2]=E,n[D+4>>2]=N,D=0|Ve(0|n[(D=i)>>2],0|n[D+4>>2],1,0),E=0|B(),n[(N=i)>>2]=D,n[N+4>>2]=E),Q=0|Ve(0|Q,0|j,1,0),j=0|B(),w=0|n[(v=b)>>2],!((0|(v=0|n[v+4>>2]))>(0|j)|(0|v)==(0|j)&w>>>0>Q>>>0)){w=1;break A}}w=0}else w=1}while(0);if(F=F+1|0,!w){L=21;break}if((0|F)>=(0|(v=0|n[A>>2]))){x=0,L=21;break}}return 21==(0|L)?(P=p,0|x):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=P,P=P+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),P=i}function eA(A,e,t){A|=0,e|=0,t|=0;var r,a,c,u,d,f,g,h=0,m=0,b=0,p=0,v=0,y=0,k=0;f=P,P=P+288|0,d=f+264|0,p=f+96|0,m=(h=b=f)+96|0;do{n[h>>2]=0,h=h+4|0}while((0|h)<(0|m));return 0|(e=0|Ae(e,b))?(P=f,0|(y=e)):(qA(b=0|n[(m=b)>>2],m=0|n[m+4>>2],d),$A(b,m,p),u=+ae(d,p+8|0),o[d>>3]=+o[A>>3],o[(m=d+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(d,p),k=+o[m>>3]-+o[b>>3],c=+l(+k),g=+o[d>>3]-+o[p>>3],r=+l(+g),!(0==k|0==g)&&(k=+ot(+c,+r),k=+x(+a*a/+it(+k/+it(+c,+r),3)/(u*(2.59807621135*u)*.8)),o[i>>3]=k,v=~~k>>>0,y=+l(k)>=1?k>0?~~+w(+s(k/4294967296),4294967295)>>>0:~~+x((k-+(~~k>>>0))/4294967296)>>>0:0,2146435072&~n[i+4>>2])?(p=!(0|v)&!(0|y),n[(e=t)>>2]=p?1:v,n[e+4>>2]=p?0:y,e=0):e=1,P=f,0|(y=e))}function tA(A,e,t,r){A|=0,e|=0,t|=0,r|=0;var a,c,u,d,f=0,g=0,h=0;d=P,P=P+288|0,c=d+264|0,u=d+96|0,a=(f=g=d)+96|0;do{n[f>>2]=0,f=f+4|0}while((0|f)<(0|a));return 0|(t=0|Ae(t,g))?(P=d,0|(r=t)):(qA(f=0|n[(t=g)>>2],t=0|n[t+4>>2],c),$A(f,t,u),h=+ae(c,u+8|0),h=+x(+ +ae(A,e)/(2*h)),o[i>>3]=h,t=~~h>>>0,f=+l(h)>=1?h>0?~~+w(+s(h/4294967296),4294967295)>>>0:~~+x((h-+(~~h>>>0))/4294967296)>>>0:0,2146435072&~n[i+4>>2]?(g=!(0|t)&!(0|f),n[r>>2]=g?1:t,n[r+4>>2]=g?0:f,P=d,0|(r=0)):(P=d,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|v(0|n[(A|=0)>>2],e),n[A>>2]=r,t=0|v(0|n[(r=A+4|0)>>2],e),n[r>>2]=t,e=0|v(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 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*+((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 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*+(((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|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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 xA(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 vA(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 wA(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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>>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|IA(A,t)):0|(t=0)}function DA(A,e,t){t|=0;var r,o,i=0,a=0;return o=P,P=P+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=P,P=P+16|0,i=r,o=0|HA(A|=0,e|=0),(t+-1|0)>>>0>5)return P=r,-1;if(1==(0|t)&(o=!!(0|o)))return P=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 P=r,0|(i=o)}(A,a,7&i),-1==(0|i)?(n[t>>2]=0,P=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)?NA(r,e,i,2,t):FA(r,e,i,2,t),P=o,0|(a=0))):(P=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=+d(+t),t=+f(+t),e=s*+f(+e)+ +d(+a)*(t*+d(+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/+d(+e),a=t*+f(+a)*c,t=+o[A>>3],e=c*((s-+f(+e)*+f(+t))/+d(+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 NA(A,e,t,r,i){A|=0,e|=0,t|=0,r|=0,i|=0;var a,s,l,c,u,d,f,g,h,m,b,p,x,v,w,y,k,C,B,D,E,N,Q=0,j=0,F=0,S=0,L=0,I=0;if(N=P,P=P+272|0,S=N+240|0,B=N,D=N+224|0,E=N+208|0,b=N+176|0,p=N+160|0,x=N+192|0,v=N+144|0,w=N+128|0,y=N+112|0,k=N+96|0,C=N+80|0,n[(Q=N+256|0)>>2]=e,n[S>>2]=n[A>>2],n[S+4>>2]=n[A+4>>2],n[S+8>>2]=n[A+8>>2],n[S+12>>2]=n[A+12>>2],QA(S,Q,B),n[i>>2]=0,(0|(S=r+t+(5==(0|r)&1)|0))<=(0|t))P=N;else{s=D+4|0,l=b+4|0,c=t+5|0,u=16880+((a=0|n[Q>>2])<<2)|0,d=16960+(a<<2)|0,f=w+8|0,g=y+8|0,h=k+8|0,m=E+4|0,F=t;A:for(;;){j=B+((0|F)%5<<4)|0,n[E>>2]=n[j>>2],n[E+4>>2]=n[j+4>>2],n[E+8>>2]=n[j+8>>2],n[E+12>>2]=n[j+12>>2];do{}while(2==(0|jA(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],Q=0|n[17040+(80*r|0)+(n[D>>2]<<2)>>2],n[b>>2]=n[18640+(80*r|0)+(20*Q|0)>>2],(0|(j=0|n[18640+(80*r|0)+(20*Q|0)+16>>2]))>0){A=0;do{bA(l),A=A+1|0}while((0|A)<(0|j))}switch(j=18640+(80*r|0)+(20*Q|0)+4|0,n[x>>2]=n[j>>2],n[x+4>>2]=n[j+4>>2],n[x+8>>2]=n[j+8>>2],sA(x,3*(0|n[u>>2])|0),iA(l,x,l),nA(l),oA(l,v),L=+(0|n[d>>2]),o[w>>3]=3*L,o[f>>3]=0,I=-1.5*L,o[y>>3]=I,o[g>>3]=2.598076211353316*L,o[k>>3]=I,o[h>>3]=-2.598076211353316*L,0|n[17040+(80*(0|n[b>>2])|0)+(n[E>>2]<<2)>>2]){case 1:A=y,r=w;break;case 3:A=k,r=y;break;case 2:A=w,r=k;break;default:A=12;break A}Qe(p,v,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|S)){A=3;break}}3!=(0|A)?12==(0|A)&&M(26970,27017,572,27027):P=N}}function QA(A,e,t){A|=0,e|=0,t|=0;var r,o=0,i=0,a=0,s=0,l=0;r=P,P=P+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,wA(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),P=r}function jA(A,e,t,r){t|=0,r|=0;var o,i,a,s,l,c,u=0,d=0,f=0,g=0,h=0;if(c=P,P=P+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[(d=A+12|0)>>2])|0))==(0|g))return P=c,1;f=d}else u=o+u+(r=0|n[(f=A+12|0)>>2])|0;if((0|u)<=(0|g))return P=c,0;do{if((0|r)>0){if(r=0|n[A>>2],(0|o)>0){d=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),d=r,r=A):(d=r,r=A)}else d=18640+(80*(0|n[A>>2])|0)+20|0,r=A}while(0);if(n[r>>2]=n[d>>2],(0|n[(u=d+16|0)>>2])>0){r=0;do{bA(h),r=r+1|0}while((0|r)<(0|n[u>>2]))}return A=d+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[f>>2])|0)==(0|g)?1:2,P=c,0|r}function PA(A,e){A|=0,e|=0;var t=0;do{t=0|jA(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,d,f,g,h,m,b,p,x,v,w,y,k,C,B=0,D=0,E=0,N=0,Q=0;if(C=P,P=P+240|0,v=C+208|0,w=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,x=C+96|0,n[(B=C+224|0)>>2]=e,n[v>>2]=n[A>>2],n[v+4>>2]=n[A+4>>2],n[v+8>>2]=n[A+8>>2],n[v+12>>2]=n[A+12>>2],SA(v,B,w),n[i>>2]=0,(0|(g=r+t+(6==(0|r)&1)|0))<=(0|t))P=C;else{s=t+6|0,l=16960+((a=0|n[B>>2])<<2)|0,c=m+8|0,u=b+8|0,d=p+8|0,f=y+4|0,D=0,E=t,r=-1;A:for(;;){if(A=w+((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|jA(y,a,0,1),(0|E)>(0|t)&!!(0|ZA(e))&&1!=(0|A)&&(0|n[y>>2])!=(0|r)){switch(oA(w+((B+5|0)%6<<4)+4|0,k),oA(w+(B<<4)+4|0,h),N=+(0|n[l>>2]),o[m>>3]=3*N,o[c>>3]=0,Q=-1.5*N,o[b>>3]=Q,o[u>>3]=2.598076211353316*N,o[p>>3]=Q,o[d>>3]=-2.598076211353316*N,B=0|n[v>>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}Qe(k,h,r,A,x),0|je(k,x)||0|je(h,x)||(EA(x,0|n[v>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2]))}if((0|E)<(0|s)&&(oA(f,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):P=C}}function SA(A,e,t){A|=0,e|=0,t|=0;var r,o=0,i=0,a=0,s=0,l=0;r=P,P=P+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,wA(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),P=r}function LA(A,e){return e=0|tt(0|(A|=0),0|(e|=0),45),B(),127&e}function IA(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 RA(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 TA(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|xA(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|xA(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|xA(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|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(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|vA(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|vA(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=P,P=P+16|0,i=r,(e|=0)>>>0>15?(P=r,0|(i=4)):2146435072&~n[4+(A|=0)>>2]&&2146435072&~n[A+8+4>>2]?(function(A,e,t){var r,i;r=P,P=P+16|0,function(A,e,t,r){e|=0,r|=0;var i,a=0,s=0,l=0,c=0;if(i=P,P=P+16|0,function(A,e,t){e|=0,t|=0;var r,i,a=0;i=P,P=P+32|0,function(A,e){e|=0;var t,r,n=0;n=+o[(A|=0)>>3],t=+d(+n),n=+f(+n),o[e+16>>3]=n,n=+o[A+8>>3],r=t*+d(+n),o[e>>3]=r,n=t*+f(+n),o[e+8>>3]=n}(A|=0,r=i),n[e>>2]=0,o[t>>3]=5,(a=+Pe(16400,r))<+o[t>>3]&&(n[e>>2]=0,o[t>>3]=a),(a=+Pe(16424,r))<+o[t>>3]&&(n[e>>2]=1,o[t>>3]=a),(a=+Pe(16448,r))<+o[t>>3]&&(n[e>>2]=2,o[t>>3]=a),(a=+Pe(16472,r))<+o[t>>3]&&(n[e>>2]=3,o[t>>3]=a),(a=+Pe(16496,r))<+o[t>>3]&&(n[e>>2]=4,o[t>>3]=a),(a=+Pe(16520,r))<+o[t>>3]&&(n[e>>2]=5,o[t>>3]=a),(a=+Pe(16544,r))<+o[t>>3]&&(n[e>>2]=6,o[t>>3]=a),(a=+Pe(16568,r))<+o[t>>3]&&(n[e>>2]=7,o[t>>3]=a),(a=+Pe(16592,r))<+o[t>>3]&&(n[e>>2]=8,o[t>>3]=a),(a=+Pe(16616,r))<+o[t>>3]&&(n[e>>2]=9,o[t>>3]=a),(a=+Pe(16640,r))<+o[t>>3]&&(n[e>>2]=10,o[t>>3]=a),(a=+Pe(16664,r))<+o[t>>3]&&(n[e>>2]=11,o[t>>3]=a),(a=+Pe(16688,r))<+o[t>>3]&&(n[e>>2]=12,o[t>>3]=a),(a=+Pe(16712,r))<+o[t>>3]&&(n[e>>2]=13,o[t>>3]=a),(a=+Pe(16736,r))<+o[t>>3]&&(n[e>>2]=14,o[t>>3]=a),(a=+Pe(16760,r))<+o[t>>3]&&(n[e>>2]=15,o[t>>3]=a),(a=+Pe(16784,r))<+o[t>>3]&&(n[e>>2]=16,o[t>>3]=a),(a=+Pe(16808,r))<+o[t>>3]&&(n[e>>2]=17,o[t>>3]=a),(a=+Pe(16832,r))<+o[t>>3]&&(n[e>>2]=18,o[t>>3]=a),(a=+Pe(16856,r))<+o[t>>3]?(n[e>>2]=19,o[t>>3]=a,P=i):P=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(P=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=+d(+i),n=+o[e+8>>3]-+o[A+8>>3],a=r*+f(+n),t=+o[A>>3],+ +p(+a,+(+f(+i)*+d(+t)-+d(+n)*(r*+f(+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=+d(+l)*a,o[r>>3]=s,l=+f(+l)*a,o[r+8>>3]=l,P=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,d=0,f=0,g=0,h=0;n[(a=8+(e|=0)|0)>>2]=0,r=+o[A>>3],d=+l(+r),i=+o[A+8>>3],d+=.5*(f=1.1547005383792515*+l(+i)),d-=+(0|(s=~~d)),f-=+(0|(A=~~f));do{if(d<.5){if(d<.3333333333333333){if(n[e>>2]=s,f<.5*(d+1)){n[e+4>>2]=A;break}A=A+1|0,n[e+4>>2]=A;break}if(A=(1&!(f<(h=1-d)))+A|0,n[e+4>>2]=A,h<=f&f<2*d){s=s+1|0,n[e>>2]=s;break}n[e>>2]=s;break}if(!(d<.6666666666666666)){if(s=s+1|0,n[e>>2]=s,f<.5*d){n[e+4>>2]=A;break}A=A+1|0,n[e+4>>2]=A;break}if(f<1-d){if(n[e+4>>2]=A,2*d-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),P=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=P,P=P+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)),P=t,0|l):(rt(0|O(A),0,45),s=0|B()|r,l=-1,C(0|s),P=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?(dA(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)):(fA(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|xA(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|vA(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|xA(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)),P=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),P=r,0|(i=0)):(P=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=P,P=P+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,P=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|vA(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 P=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|jA(t,s,i,0)){if(0|z(u))do{}while(0|jA(t,s,0,0));(0|s)!=(0|c)&&fA(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 P=o,0}function qA(A,e,t){t|=0;var r,o,i=0;return o=P,P=P+16|0,0|(i=0|XA(A|=0,e|=0,r=o))?(P=o,0|i):(i=0|tt(0|A,0|e,52),B(),function(A,e,t){var r,o;e|=0,t|=0,r=P,P=P+16|0,oA(4+(A|=0)|0,o=r),EA(o,0|n[A>>2],e,0,t),P=r}(r,15&i,t),P=o,0|(i=0))}function $A(A,e,t){t|=0;var r,n=0,o=0,i=0;if(r=P,P=P+16|0,0|(n=0|XA(A|=0,e|=0,i=r)))return P=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 NA(i,o,0,5,t),P=r,0}}while(0);return FA(i,o,0,6,t),P=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=+f(.5*(r-t)))*n+(i=+f(.5*(+o[e+8>>3]-+o[A+8>>3])))*(+d(+r)*+d(+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,x=0;return x=+o[(e|=0)>>3],i=+o[A>>3],m=+f(.5*(x-i)),u=+o[e+8>>3],n=+o[A+8>>3],h=+f(.5*(u-n)),r=+d(+i),a=+d(+x),h=2*+p(+ +c(+(h=m*m+h*(a*r*h))),+ +c(+(1-h))),m=+o[t>>3],x=+f(.5*(m-x)),s=+o[t+8>>3],u=+f(.5*(s-u)),l=+d(+m),u=2*+p(+ +c(+(u=x*x+u*(a*l*u))),+ +c(+(1-u))),m=+f(.5*(i-m)),s=+f(.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=P,P=P+192|0,i=a,0|(l=0|qA(A|=0,e|=0,r=a+168|0)))return P=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,P=a,0}function de(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 fe(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,d=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],d=0|n[(t=t+16|0)>>2],a=+o[(d=0|d?d:A)>>3],l=+o[d+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],d=0|n[(t=t+16|0)>>2],a=+o[(d=0|d?d:A)>>3],l=+o[d+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,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0;if(c=P,P=P+32|0,v=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 P=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 P=c,5;if(b=(0|h)!=(0|m)){if(7==(0|(f=0|V(h,m))))return P=c,1;7==(0|(g=0|V(m,h)))?M(27514,27538,161,27548):(p=f,d=g)}else p=0,d=0;a=0|z(h),s=0|z(m),n[v>>2]=0,n[v+4>>2]=0,n[v+8>>2]=0,n[v+12>>2]=0;do{if(p){if(f=(0|(m=0|n[4272+(28*h|0)+(p<<2)>>2]))>0,s)if(f){h=0,g=t,f=o;do{g=0|WA(g,f),f=0|B(),1==(0|(d=0|vA(d)))&&(d=0|vA(1)),h=h+1|0}while((0|h)!=(0|m));m=d,h=g,g=f}else m=d,h=t,g=o;else if(f){h=0,g=t,f=o;do{g=0|VA(g,f),f=0|B(),d=0|vA(d),h=h+1|0}while((0|h)!=(0|m));m=d,h=g,g=f}else m=d,h=t,g=o;if(JA(h,g,v),b||M(27563,27538,191,27548),(f=!!(0|a))&(d=!!(0|s))&&M(27590,27538,192,27548),f){if(7==(0|(d=0|OA(A,e)))){u=5;break}if(0|r[22e3+(7*d|0)+p|0]){u=1;break}h=g=0|n[21168+(28*d|0)+(p<<2)>>2]}else if(d){if(7==(0|(d=0|OA(h,g)))){u=5;break}if(0|r[22e3+(7*d|0)+m|0]){u=1;break}h=0,g=0|n[21168+(28*m|0)+(d<<2)>>2]}else h=0,g=0;if((h|g|0)<0)u=5;else{if((0|g)>0){f=v+4|0,d=0;do{pA(f),d=d+1|0}while((0|d)!=(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(x=v+4|0,l,x),nA(x),x=51}}else if(JA(t,o,v),!!(0|a)&!!(0|s))if((0|m)!=(0|h)&&M(27621,27538,261,27548),7==(0|(d=0|OA(A,e)))|7==(0|(u=0|OA(t,o))))u=5;else if(0|r[22e3+(7*d|0)+u|0])u=1;else if((0|(d=0|n[21168+(28*d|0)+(u<<2)>>2]))>0){f=v+4|0,u=0;do{pA(f),u=u+1|0}while((0|u)!=(0|d));x=51}else x=51;else x=51}while(0);return 51==(0|x)&&(u=v+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),P=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,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0;if(a=P,P=P+48|0,o=a+36|0,c=a+24|0,u=a+12|0,d=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 P=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)))?(P=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,P=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,d),nA(d),x=0|n[(s=r)>>2],s=0|n[s+4>>2],p=0|rt(7,0,0|(v=3*(15-l|0)|0)),s&=~B(),v=0|rt(0|lA(d),0,0|v),s=0|B()|s,n[(b=r)>>2]=v|x&~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){d=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|xA(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,f=s)}else m=s,h=0,f=t;if((0|(u=0|n[4272+(28*g|0)+(f<<2)>>2]))<=-1&&M(27724,27538,419,27678),!d){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[(v=r)>>2]=t,n[v+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[(v=r)>>2]=t,n[v+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[(v=r)>>2]=t,n[v+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[(v=r)>>2]=l,n[v+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|d)){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[(v=r)>>2]=c,n[v+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)&&d&&(t=59),59==(0|t)&&1==(0|OA(0|n[(v=r)>>2],0|n[v+4>>2]))){s=9;break}p=0|n[(v=r)>>2],v=-1040385&n[v+4>>2],x=0|rt(0|s,0,45),v=0|v|B(),n[(s=r)>>2]=p|x,n[s+4>>2]=v,s=0}else s=1}while(0);return P=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 xe(A,e,t,r){t|=0,r|=0;var i,a=0,s=0,l=0,c=0,u=0,f=0;i=P,P=P+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/+d(+u),f=+o[25968+(l<<3)>>3],o[t>>3]=u+f,o[t+8>>3]=u-f,u=+o[s+8>>3],c*=f,o[t+16>>3]=c+u,o[t+24>>3]=u-c;break}return P=i,0|a}if(a=0|tt(0|A,0|e,45),B(),(a&=127)>>>0>121)return P=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]?(P=i,0|(l=0)):(o[t+16>>3]=3.141592653589793,o[t+24>>3]=-3.141592653589793,P=i,0|(l=0))}function ve(A){var e,t,o,i,a=0,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=0,y=0;if(i=P,P=P+336|0,e=i+168|0,t=i,!(0|(s=0|n[(l=A|=0)>>2]))&!(0|(l=0|n[l+4>>2])))P=i;else{if(0|r[0|(a=A+28|0)]?(s=0|we(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(P=i);c=15&(a=0|n[(y=A+16|0)>>2]);A:do{if(!(0|s)&!(0|l))w=A+24|0;else{x=A+12|0,b=3==(0|c),m=255&a,g=3==(1|c),p=A+24|0,h=(c+-1|0)>>>0<3,d=3==(2|c),f=t+8|0;e:for(;;){if(u=0|tt(0|s,0|l,52),B(),(0|(u&=15))==(0|n[x>>2])){switch(15&m){case 0:case 2:case 3:if(0|(c=0|qA(s,l,e))){v=15;break e}if(0|Me(0|n[o>>2],0|n[p>>2],e)){v=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)){v=25;break}if((0|n[(c=t)>>2])==(0|s)&&(0|n[c+4>>2])==(0|l)){v=29;break}}if(h){if(0|(c=0|$A(s,l,e))){v=32;break}if(0|xe(s,l,t,0)){v=36;break}if(d&&0|De(0|n[o>>2],0|n[p>>2],e,t)){v=42;break}if(g&&0|Ne(0|n[o>>2],0|n[p>>2],e,t)){v=42;break}}if(b){if(a=0|xe(s,l,e,1),c=0|n[p>>2],0|a){v=45;break}if(0|q(c,e)){if(AA(t,e),0|$(e,0|n[p>>2])){v=53;break}if(0|Me(0|n[o>>2],0|n[p>>2],f)){v=53;break}if(0|Ne(0|n[o>>2],0|n[p>>2],t,e)){v=53;break}}}}do{if((0|u)<(0|n[x>>2])){if(a=0|xe(s,l,e,1),c=0|n[p>>2],0|a){v=58;break e}if(!(0|q(c,e))){v=73;break}if(0|$(0|n[p>>2],e)&&(AA(t,e),0|De(0|n[o>>2],0|n[p>>2],t,e))){v=65;break e}if(0|(s=0|GA(s,l,u+1|0,t))){v=67;break e}s=0|n[(l=t)>>2],l=0|n[l+4>>2]}else v=73}while(0);if(73==(0|v)&&(v=0,s=0|we(s,l),l=0|B()),!(0|s)&!(0|l)){w=p;break A}}switch(0|v){case 15:0|(a=0|n[p>>2])&&Ye(a),n[(v=A)>>2]=0,n[v+4>>2]=0,n[o>>2]=0,n[x>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=c,v=20;break;case 19:n[A>>2]=s,n[A+4>>2]=l,v=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(P=i);case 32:return 0|(a=0|n[p>>2])&&Ye(a),n[(w=A)>>2]=0,n[w+4>>2]=0,n[o>>2]=0,n[x>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=c,void(P=i);case 36:M(27795,27761,493,27772);break;case 45:0|c&&Ye(c),n[(v=A)>>2]=0,n[v+4>>2]=0,n[o>>2]=0,n[x>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=a,v=55;break;case 53:n[A>>2]=s,n[A+4>>2]=l,v=55;break;case 58:0|c&&Ye(c),n[(v=A)>>2]=0,n[v+4>>2]=0,n[o>>2]=0,n[x>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=a,v=71;break;case 65:n[A>>2]=s,n[A+4>>2]=l,v=71;break;case 67:return 0|(a=0|n[p>>2])&&Ye(a),n[(w=A)>>2]=0,n[w+4>>2]=0,n[o>>2]=0,n[x>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=s,void(P=i)}if(20==(0|v))return void(P=i);if(55==(0|v))return void(P=i);if(71==(0|v))return void(P=i)}}while(0);0|(a=0|n[w>>2])&&Ye(a),n[(v=A)>>2]=0,n[v+4>>2]=0,n[A+8>>2]=0,n[o>>2]=0,n[A+12>>2]=-1,n[y>>2]=0,n[w>>2]=0,P=i}}function we(A,e){var t,r=0,o=0,i=0,a=0,s=0,l=0,c=0,u=0,d=0;t=P,P=P+16|0,d=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 d=0|rt(((d=!(0|c)&!!(0|HA(r,i)))?2:1)+c|0,0,0|a),u=0|B()|e&~l,d|=A&~s,C(0|u),P=t,0|d}}while(0);return(r&=127)>>>0>120?(d=0,C(0|(u=0)),P=t,0|d):(RA(d,0,r+1|0,0),u=0|n[d+4>>2],d=0|n[d>>2],C(0|u),P=t,0|d)}function ye(A,e,t){A|=0;var r,i=0,a=0,s=0,l=0,c=0,u=0,d=0,f=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,f=a,t=-1,A=0;A:for(;;){for(d=A;l=+o[r+(d<<4)>>3],a=+o[r+(d<<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=d+1|0))>=(0|g)){t=22;break A}A=d,d=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)>(f=c==f|l==f?f+-2220446049250313e-31:f)&&(e^=1),(0|(A=d+1|0))>=(0|g)){t=22;break}t=d}if(22==(0|t))return 0|e}else{e=0,f=a,t=-1,A=0;A:for(;;){for(d=A;l=+o[r+(d<<4)>>3],a=+o[r+(d<<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=d+1|0))>=(0|g)){t=22;break A}A=d,d=t,t=A}if(l+(i-s)/(u-s)*(a-l)>(f=l==f|a==f?f+-2220446049250313e-31:f)&&(e^=1),(0|(A=d+1|0))>=(0|g)){t=22;break}t=d}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,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=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,x=0,A=-1,f=17976931348623157e292,g=17976931348623157e292,m=-17976931348623157e292,u=-17976931348623157e292,v=0;c=+o[t+(v<<4)>>3],h=+o[t+(v<<4)+8>>3],d=+o[t+(((0|(A=A+2|0))==(0|r)?0:A)<<4)+8>>3],c>3]=c,f=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,x|=+l(+(h-d))>3.141592653589793,(0|(A=v+1|0))!=(0|r);)w=v,m=c,v=A,A=w;x&&(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,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=0,y=0,k=0,C=0,B=0,M=0;if(p=0|n[(A|=0)>>2]){if(o[(x=e+8|0)>>3]=17976931348623157e292,o[(v=e+24|0)>>3]=17976931348623157e292,o[e>>3]=-17976931348623157e292,o[(w=e+16|0)>>3]=-17976931348623157e292,(0|p)>0){for(a=0|n[A+4>>2],m=17976931348623157e292,b=-17976931348623157e292,i=0,r=-1,d=17976931348623157e292,f=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,d=s),g>3]=g,f=g),s>h?o[e>>3]=s:s=h,g>c&&(o[w>>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[w>>3]=b,o[v>>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,v=e+((C=C+1|0)<<5)|0,w=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[v>>3]=-17976931348623157e292,o[(k=e+(C<<5)+16|0)>>3]=-17976931348623157e292,(0|w)>0){for(p=0|n[a+(i<<3)+4>>2],m=17976931348623157e292,b=-17976931348623157e292,a=0,i=-1,x=0,d=17976931348623157e292,f=17976931348623157e292,g=-17976931348623157e292,c=-17976931348623157e292;s=+o[p+(x<<4)>>3],h=+o[p+(x<<4)+8>>3],u=+o[p+(((0|(i=i+2|0))==(0|w)?0:i)<<4)+8>>3],s>3]=s,d=s),h>3]=h,f=h),s>g?o[v>>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=x+1|0))!=(0|w);)M=x,x=i,g=s,i=M;a&&(o[k>>3]=b,o[A>>3]=m)}}else n[v>>2]=0,n[v+4>>2]=0,n[v+8>>2]=0,n[v+12>>2]=0,n[v+16>>2]=0,n[v+20>>2]=0,n[v+24>>2]=0,n[v+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=P,P=P+16|0,o=i,!(0|ye(A|=0,e|=0,l=8+(t|=0)|0)))return P=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 P=i,0|a}}while(0);if(0|Ee(A,e,t,r))return P=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 P=i,0|a}function Ee(A,e,t,r){A|=0,t|=0;var i,a,s,l,c,u,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=0,y=0,k=0,C=0,B=0,M=0;if(u=P,P=P+176|0,l=u+172|0,d=u+168|0,c=u,!(0|q(e|=0,r|=0)))return P=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,d),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[d>>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[d>>2]),i=+ie(+o[r+24>>3],0|n[d>>2]);A:do{if((0|n[A>>2])>0){if(r=A+4|0,(0|(d=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],v=+o[e+(t<<4)>>3],w=+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,f=+o[e+(B<<4)>>3],g=+ie(+o[e+(B<<4)+8>>3],0|n[l>>2]),!(v>=a)|!(f>=a)&&!(v<=s)|!(f<=s)&&!(w<=i)|!(g<=i)&&!(w>=y)|!(g>=y)){x=f-v,b=g-w,e=0;do{if(M=e,B=(0|(e=e+1|0))==(0|d)?0:e,f=+o[c+8+(M<<4)+8>>3],g=+o[c+8+(B<<4)+8>>3]-f,h=+o[c+8+(M<<4)>>3],!(0==(p=x*g-b*(m=+o[c+8+(B<<4)>>3]-h))||(k=w-f,C=v-h,m=(k*m-g*C)/p,m<0|m>1))&&(p=(x*k-b*C)/p)>=0&p<=1){e=1;break A}}while((0|e)<(0|d))}if((0|t)>=(0|n[A>>2])){e=0;break}}}else e=0}while(0);return P=u,0|e}function Ne(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 Qe(A,e,t,r,n){e|=0,t|=0,r|=0,n|=0;var i,a,s,l,c,u,d,f=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],f=((f=+o[r>>3]-u)*(a-(d=+o[t+8>>3]))-(l-u)*(c=+o[r+8>>3]-d))/(s*c-i*f),o[n>>3]=l+s*f,o[n+8>>3]=a+i*f}function je(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 Pe(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=P,P=P+32|0,u=a,0|(s=0|XA(A|=0,e|=0,o=a+16|0)))return P=a,0|s;r=0|LA(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,P=a,0}function Se(A,e,t,r){t|=0,r|=0;var o,i,a,s,l,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0;if(l=P,P=P+32|0,v=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 P=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 P=l,1;if(0|Fe(A,e,v))return P=l,1;if(u=(0|n[v>>2])+t|0,7==(0|(p=0|n[(c=c?26704+((0|u)%5<<2)|0:26736+((0|u)%6<<2)|0)>>2])))return P=l,1;n[s>>2]=0,c=0|R(A,e,p,s,a);do{if(!c){if(h=0|n[(f=a)>>2],u=(d=(f=0|n[f+4>>2])>>>0>>0|(0|f)==(0|e)&h>>>0>>0)?h:A,d=d?f:e,!b&&!(h&(b=0|rt(7,0,3*(15^m)|0)))&!(f&(0|B())))c=t;else{if(f=(t+-1+g|0)%(0|g)|0,c=0|HA(A,e),(0|f)<0&&M(27795,27797,248,27822),(0|((g=!!(0|c))?4:5))<(0|f)&&M(27795,27797,248,27822),0|Fe(A,e,v)&&M(27795,27797,248,27822),c=(0|n[v>>2])+f|0,7==(0|(f=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|R(A,e,f,i,o)))break;g=0|n[(h=o)>>2],h=0|n[h+4>>2];do{if(h>>>0>>0|(0|h)==(0|d)&g>>>0>>0){if(u=0|HA(g,h)?0|_(g,h,A,e):0|n[26800+(((0|n[i>>2])+(0|n[26768+(f<<2)>>2])|0)%6<<2)>>2],c=0|HA(g,h),(u+-1|0)>>>0>5){c=-1,u=g,d=h;break}if(1==(0|u)&(c=!!(0|c))){c=-1,u=g,d=h;break}do{if(!(0|Fe(g,h,v))){if(c){c=(5+(0|n[26352+(u<<2)>>2])-(0|n[v>>2])|0)%5|0;break}c=(6+(0|n[26384+(u<<2)>>2])-(0|n[v>>2])|0)%6|0;break}c=-1}while(0);u=g,d=h}else c=t}while(0);h=0|n[(f=a)>>2],f=0|n[f+4>>2]}if((0|u)==(0|h)&(0|d)==(0|f)){if(A=(g=!!(0|HA(h,f)))?0|_(h,f,A,e):0|n[26800+(((0|n[s>>2])+(0|n[26768+(p<<2)>>2])|0)%6<<2)>>2],c=0|HA(h,f),(A+-1|0)>>>0<=5&&!(1==(0|A)&(x=!!(0|c))))do{if(!(0|Fe(h,f,v))){if(x){c=(5+(0|n[26352+(A<<2)>>2])-(0|n[v>>2])|0)%5|0;break}c=(6+(0|n[26384+(A<<2)>>2])-(0|n[v>>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=d,A=u;break A}}while(0);return P=l,0|c}}while(0);return x=0|rt(0|c,0,56),v=B()|-2130706433&e|536870912,n[r>>2]=x|A,n[r+4>>2]=v,P=l,0}function Le(A,e){A|=0;var t,r,o=0,i=0;return r=P,P=P+16|0,t=r,!0&536870912==(2013265920&(e|=0))&&0|IA(A,o=-2130706433&e|134217728)?(i=0|tt(0|A,0|e,56),B(),o=(i=!(0|Se(A,o,7&i,t)))&((0|n[(o=t)>>2])==(0|A)?(0|n[o+4>>2])==(0|e):0)&1,P=r,0|o):(P=r,0|(o=0))}function Ie(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 Re(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 Te(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,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=0,y=0;e=P,P=P+16|0,g=e;do{if(A>>>0<245){if(A=(u=A>>>0<11?16:A+11&-8)>>>3,3&(r=(f=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]=f&~(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],P=e,0|i;if(u>>>0>(d=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=f&~(1<>2]=t,n[A>>2]=r,A=f),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|d&&(o=0|n[6986],r=27964+((t=d>>>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,P=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|d&&(o=0|n[6986],r=27964+((t=d>>>3)<<1<<2)|0,(t=1<>2]:(n[6981]=t|f,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),P=e,0|l+8}f=u}else f=u}else f=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<<(f=(A+1048320|0)>>>16&8))|0)>>>16&4)|f|(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=f>>>12&16)>>>5&8)|s|(l=(f>>>=a)>>>2&4)|(c=(f>>>=l)>>>1&2)|(r=(f>>>=c)>>>1&1))+(f>>>r)<<2)>>2]}r?b=65:(l=A,s=i)}if(65==(0|b))for(a=r;;){if(i=(r=(f=(-8&n[a+4>>2])-u|0)>>>0>>0)?f: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&&(d=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[d+4>>2]=1|s,n[d+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]=d,n[t+12>>2]=d,n[d+8>>2]=t,n[d+12>>2]=r;break}if(t=28228+((r=(t=s>>>8)?s>>>0>16777215?31:s>>>(7+(r=14-((v=(520192+(y=t<<(w=(t+1048320|0)>>>16&8))|0)>>>16&4)|w|(r=(245760+(y<<=v)|0)>>>16&2))+(y<>>15)|0)|0)&1|r<<1:0)<<2)|0,n[d+28>>2]=r,n[4+(A=d+16|0)>>2]=0,n[A>>2]=0,!(o&(A=1<>2]=d,n[d+24>>2]=t,n[d+12>>2]=d,n[d+8>>2]=d;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]=d,n[d+24>>2]=t,n[d+12>>2]=d,n[d+8>>2]=d;break A}}while(0);y=0|n[(w=t+8|0)>>2],n[y+12>>2]=d,n[w>>2]=d,n[d+8>>2]=y,n[d+12>>2]=t,n[d+24>>2]=0}}while(0);return P=e,0|l+8}f=u}else f=u;else f=-1}while(0);if((r=0|n[6983])>>>0>=f>>>0)return t=r-f|0,A=0|n[6986],t>>>0>15?(y=A+f|0,n[6986]=y,n[6983]=t,n[y+4>>2]=1|t,n[A+r>>2]=t,n[A+4>>2]=3|f):(n[6983]=0,n[6986]=0,n[A+4>>2]=3|r,n[(y=A+r+4|0)>>2]=1|n[y>>2]),P=e,0|A+8;if((s=0|n[6984])>>>0>f>>>0)return v=s-f|0,n[6984]=v,w=(y=0|n[6987])+f|0,n[6987]=w,n[w+4>>2]=1|v,n[y+4>>2]=3|f,P=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=f+48|0,(u=(a=A+(c=f+47|0)|0)&(i=0-A|0))>>>0<=f>>>0)return P=e,0;if(0|(A=0|n[7091])&&(g=(d=0|n[7089])+u|0)>>>0<=d>>>0|g>>>0>A>>>0)return P=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>f>>>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|(v=0|ut(0|u)))|1^(x=(p=(m=0|ut(0))-v|0)>>>0>(f+40|0)>>>0)|v>>>0>>0&-1!=(0|v)&-1!=(0|m)^1)&&(s=x?p:t,a=v,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)||(w=t+4|0,8&n[t+12>>2]))&&a>>>0>c>>>0&A>>>0<=c>>>0){n[w>>2]=r+s,w=c+(v=7&(v=c+8|0)?0-v&7:0)|0,v=(y=(0|n[6984])+s|0)-v|0,n[6987]=w,n[6984]=v,n[w+4>>2]=1|v,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[(d=t+4|0)>>2]=(0|n[d>>2])+s,u=(d=a+(7&(d=a+8|0)?0-d&7:0)|0)+f|0,l=(t=r+(7&(t=r+8|0)?0-t&7:0)|0)-d-f|0,n[d+4>>2]=3|f;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-((v=(520192+(y=t<<(w=(t+1048320|0)>>>16&8))|0)>>>16&4)|w|(o=(245760+(y<<=v)|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[(w=t+8|0)>>2],n[y+12>>2]=u,n[w>>2]=u,n[u+8>>2]=y,n[u+12>>2]=t,n[u+24>>2]=0}}while(0);return P=e,0|d+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,w=a+(v=7&(v=a+8|0)?0-v&7:0)|0,v=(r=s+-40|0)-v|0,n[6987]=w,n[6984]=v,n[w+4>>2]=1|v,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{w=t,n[(t=t+4|0)>>2]=7}while((w+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-((v=(520192+(y=t<<(w=(t+1048320|0)>>>16&8))|0)>>>16&4)|w|(o=(245760+(y<<=v)|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[(w=t+8|0)>>2],n[y+12>>2]=c,n[w>>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,w=a+(v=7&(v=a+8|0)?0-v&7:0)|0,v=(y=s+-40|0)-v|0,n[6987]=w,n[6984]=v,n[w+4>>2]=1|v,n[a+y+4>>2]=40,n[6988]=n[7103]}while(0);if((t=0|n[6984])>>>0>f>>>0)return v=t-f|0,n[6984]=v,w=(y=0|n[6987])+f|0,n[6987]=w,n[w+4>>2]=1|v,n[y+4>>2]=3|f,P=e,0|y+8}return n[(y=27920)>>2]=12,P=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|v(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,d=0,f=0,g=0,h=0;if(u=A|=0,a=t|=0,s=f=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|(f=0)),o)):(o=0,0|(C(0|(f=0)),o)):(i&&(n[o>>2]=(u>>>0)%(a>>>0),n[o+4>>2]=0),o=(u>>>0)/(a>>>0)>>>0,0|(C(0|(f=0)),o));i=!(0|s);do{if(a){if(!i){if((i=(0|k(0|s))-(0|k(0|c))|0)>>>0<=31){a=d=i+1|0,A=u>>>(d>>>0)&(e=i-31>>31)|c<<(s=31-i|0),e&=c>>>(d>>>0),i=0,s=u<>2]=0|A,n[o+4>>2]=l|0&e,o=0,0|(C(0|(f=0)),o)):(o=0,0|(C(0|(f=0)),o))}if((i=a-1|0)&a){a=s=33+(0|k(0|a))-(0|k(0|c))|0,A=(d=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=d>>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|(d=0|t),0|(u=f|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|(f=A>>>31|e<<1)),s=1&(g=(h=0|B())>>31|((0|h)<0?-1:0)<<1),A=0|Ze(0|r,0|f,g&d|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|v(o=65535&(e|=0),n=65535&(A|=0)))>>>16)+(0|v(o,r=A>>>16))|0,e=0|v(o=e>>>16,n),0|(C((A>>>16)+(0|v(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|v(e,o))+(0|v(r,n))+A|0&A),t)}function $e(A,e,t,r){var o,i,a,s,l,c;return t|=0,o=P,P=P+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(),P=o,0|(C(0|t),r)}function At(A,e,t,r){var o,i;return i=P,P=P+16|0,Je(A|=0,e|=0,t|=0,r|=0,o=0|i),P=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):+x(A-.5)}function st(A,e,t){A|=0,e|=0;var o,i,a=0;if((0|(t|=0))>=8192)return N(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):+x(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?(j(0|e),D(12),-1):(0|e)>(0|r)&&!(0|Q(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,d=0;if(s=P,P=P+64|0,a=s,i=s+56|0,!(!0&134217728==(2013265920&(e|=0))&!0&134217728==(2013265920&(r|=0))))return P=s,5;if((0|(A|=0))==(0|(t|=0))&(0|e)==(0|r))return n[o>>2]=0,P=s,0;if(c=0|tt(0|A,0|e,52),B(),c&=15,d=0|tt(0|t,0|r,52),B(),(0|c)!=(15&d))return P=s,12;if(l=c+-1|0,c>>>0>1){TA(A,e,l,a),TA(t,r,l,i),u=0|n[(d=a)>>2],d=0|n[d+4>>2];A:do{if((0|u)==(0|n[i>>2])&&(0|d)==(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,d)){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 P=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,P=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,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0;if(o=P,P=P+16|0,p=o,x=0|tt(0|(A|=0),0|(e|=0),52),B(),t>>>0>15)return P=o,4;if((0|(x&=15))<(0|t))return P=o,12;if((0|x)!=(0|t))if(a=0|rt(0|t,0,52),a|=A,l=B()|-15728641&e,(0|x)>(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|x));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|x)>(0|t)){for(m=-15728641&e,h=x;;){if(g=h,(h=h+-1|0)>>>0>15|(0|x)<(0|h)){u=19;break}if((0|x)!=(0|h))if(a=0|rt(0|h,0,52),a|=A,c=0|B()|m,(0|x)<(0|g))f=a;else{u=h;do{f=0|rt(7,0,3*(14-u|0)|0),u=u+1|0,a|=f,c=0|B()|c}while((0|u)<(0|x));f=a}else f=A,c=e;if(d=0|tt(0|f,0|c,45),B(),0|z(127&d)){d=0|tt(0|f,0|c,52),B(),d&=15;e:do{if(d)for(u=1;;){if(a=0|tt(0|f,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|(f=c+((!!(0|c)&a)<<31>>31)|0)&&(u=0|pe(7,0,u=x-g|0,((0|u)<0)<<31>>31),d=0|B(),a?(a=0|Ve(0|(a=0|qe(0|u,0|d,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=d),g=0|Ve(0|a,0|c,0|(g=0|qe(0|u,0|d,0|(g=f+-1|0),((0|g)<0)<<31>>31)),0|B()),d=0|Ve(0|g,0|(f=0|B()),0|n[(d=r)>>2],0|n[d+4>>2]),f=0|B(),n[(g=r)>>2]=d,n[g+4>>2]=f),(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 P=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|x)>(0|t)){for(a=x;;){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=x-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 P=o,0|i}i=0,s=0}}while(0);return 0|_A(b,l,x,p)&&M(27795,27122,1327,27173),((0|i)>-1|-1==(0|i)&s>>>0>4294967295)&((0|(p=0|n[(x=p)+4>>2]))>(0|i)|((0|p)==(0|i)?(0|n[x>>2])>>>0>s>>>0:0))?(P=o,0|(x=0)):(M(27795,27122,1407,27158),0)},_cellToChildren:function(A,e,t,r){r|=0;var o,i,a=0,s=0;if(i=P,P=P+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 P=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 P=i,0},_cellToChildrenSize:_A,_cellToLatLng:qA,_cellToLocalIj:function(A,e,t,r,o,i){var a,s;return A|=0,i|=0,s=P,P=P+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),P=s,0|A},_cellToParent:TA,_cellToVertex:Se,_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|Se(A,e,0,t))),i?r?0|(o=0|Se(A,e,1,t+8|0))||0|(o=0|Se(A,e,2,t+16|0))||0|(o=0|Se(A,e,3,t+24|0))||(o=0|Se(A,e,4,t+32|0))?0|(i=o):0|Se(A,e,5,t+40|0):0|(i=o):r?0|(o=0|Se(A,e,1,t+8|0))||0|(o=0|Se(A,e,2,t+16|0))||0|(o=0|Se(A,e,3,t+24|0))||0|(o=0|Se(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=P,P=P+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=P,P=P+176|0,r=o,(0|(e|=0))<1)return Ie(t,0,0),P=o,0;for(c=0|tt(0|n[(c=A)>>2],0|n[c+4>>2],52),B(),Ie(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)?(P=o,0|i):(Re(t),P=o,0|(u=i))}(A|=0,e|=0,i=a+16|0)))return P=a,0|A;if(n[t>>2]=0,n[t+4>>2]=0,n[t+8>>2]=0,0|(A=0|Te(i)))do{e=0|de(t);do{fe(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|Te(i)}while(0|A);return Re(i),(A=0|function(A){var e,t,r=0,i=0,a=0,s=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=0,y=0,k=0,C=0,B=0,D=0,E=0,N=0,Q=0,j=0,P=0,F=0,S=0,L=0,I=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,S=0,D=0,m=0;A:for(;;){if(h=0|n[a>>2]){c=0,u=h;do{if(f=+o[u+8>>3],r=u,u=0|n[u+16>>2],d=+o[(s=(g=!(0|u))?h:u)+8>>3],+l(+(f-d))>3.141592653589793){I=14;break}c+=(d-f)*(+o[r>>3]+ +o[s>>3])}while(!g);if(14==(0|I)){I=0,c=0,r=h;do{B=+o[r+8>>3],P=0|n[(F=r+16|0)>>2],C=+o[(P=0|P?P:h)+8>>3],c+=(+o[r>>3]+ +o[P>>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+(S<<2)>>2]=a,S=S+1|0,s=D,r=m):I=19}else I=19;if(19==(0|I)){I=0;do{if(!i){if(m){s=E,u=m+8|0,r=a,i=A;break}if(0|n[A>>2]){I=27;break A}s=E,u=A,r=a,i=A;break}if(0|n[(r=i+8|0)>>2]){I=21;break A}if(!(i=0|We(1,12))){I=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,f=17976931348623157e292,v=17976931348623157e292,w=-17976931348623157e292,d=-17976931348623157e292;c=+o[p>>3],B=+o[p+8>>3],p=0|n[p+16>>2],C=+o[((x=!(0|p))?g:p)+8>>3],c>3]=c,f=c),B>3]=B,v=B),c>w?o[u>>3]=c:c=w,B>d&&(o[b>>3]=B,d=B),y=B>0&Bk?B:k,s|=+l(+(B-C))>3.141592653589793,!x;)w=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){I=45;break}D=s,m=r}if(21==(0|I))M(27213,27235,35,27247);else if(23==(0|I))M(27267,27235,37,27247);else if(27==(0|I))M(27310,27235,61,27333);else if(45==(0|I)){A:do{if((0|S)>0){for(F=!(0|s),j=s<<2,P=!(0|A),Q=0,r=0;;){if(N=0|n[t+(Q<<2)>>2],F)I=73;else{if(!(D=0|Ue(j))){I=50;break}if(!(E=0|Ue(j))){I=52;break}e:do{if(P)i=0;else{for(s=0,i=0,u=A;a=e+(s<<5)|0,0|he(0|n[u>>2],a,0|n[N>>2])?(n[D+(i<<2)>>2]=u,n[E+(i<<2)>>2]=a,x=i+1|0):x=i,u=0|n[u+8>>2];)s=s+1|0,i=x;if((0|x)>0)if(a=0|n[D>>2],1==(0|x))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|x);)a=h;if(i=(s=(0|h)>(0|p))?m:i,(0|(a=b+1|0))==(0|x))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]){I=70;break}n[i>>2]=N,n[s>>2]=N}else I=73}if(73==(0|I)){if(I=0,0|(r=0|n[N>>2]))do{E=r,r=0|n[r+16>>2],Ye(E)}while(0|r);Ye(N),r=1}if((0|(Q=Q+1|0))>=(0|S)){L=r;break A}}50==(0|I)?M(27452,27235,249,27471):52==(0|I)?M(27490,27235,252,27471):70==(0|I)&&M(27310,27235,61,27333)}else L=0}while(0);return Ye(t),Ye(e),0|L}return 0}(t))?(ge(t),P=a,0|(s=A)):(P=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,d=0,f=0,g=0,h=0,m=0;if(a=P,P=P+16|0,s=a,(o|=0)>>>0>15)return P=a,4;if(l=0|tt(0|(t|=0),0|(r|=0),52),B(),(0|(l&=15))>(0|o))return P=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[(d=s)+4>>2]))>(0|e)|((0|u)==(0|e)?(0|n[d>>2])>>>0>A>>>0:0))))return P=a,2;d=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|d)<1)return P=a,0;for(u=15^l,r=-1,c=1,s=1;;){l=0|pe(7,0,l=d-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[(f=i)>>2],f=0|n[f+4>>2],g=0|rt(7,0,0|(m=3*(u+r|0)|0)),f&=~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),f=0|B()|f,n[(o=i)>>2]=m|h&~g,n[o+4>>2]=f,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],f=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&~f,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|d)>(0|c))){e=0;break}r=~c,c=c+1|0}return P=a,0|e}}while(0);if((0|d)<1)return P=a,0;for(o=15^l,s=1;;){if(h=0|pe(7,0,h=d-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|(f=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|f,0|g,0|h,0|m)),0|B()),e=0|B(),(0|d)<=(0|s)){e=0;break}s=s+1|0}return P=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,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=0,y=0,k=0,C=0,D=0,E=0,N=0,Q=0,j=0,P=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[(P=e)>>2]=a,n[P+4>>2]=i,1==(0|t)&!(0|r))return 0;i=1,a=0;do{j=0|n[4+(Q=A+(i<<3)|0)>>2],n[(P=e+(i<<3)|0)>>2]=n[Q>>2],n[P+4>>2]=j,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(!(j=0|Ue(o=t<<3)))return 13;if(st(0|j,0|A,0|o),!(Q=0|We(t,8)))return Ye(j),13;A:for(;;){E=0|tt(0|(u=0|n[(i=j)>>2]),0|(i=0|n[i+4>>2]),52),B(),N=(E&=15)-1|0,D=!!(0|E),C=(0|r)>0|!(0|r)&t>>>0>0;e:do{if(D&C){if(v=0|rt(0|N,0,52),w=0|B(),N>>>0>15){if(!(!(0|u)&!(0|i))){P=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=j+(a<<3)|0)>>2]))&!(0|(s=0|n[s+4>>2])))){i=s,P=16;break A}}}for(l=u,A=i,a=0,s=0;;){if(!(!(0|l)&!(0|A))){if(!(!0&!(117440512&A))){P=21;break A}if(d=0|tt(0|l,0|A,52),B(),(0|(d&=15))<(0|N)){i=12,P=27;break A}if((0|d)!=(0|N)&&(l|=v,A=-15728641&A|w,d>>>0>=E>>>0)){c=N;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|(f=0|n[(d=c=Q+(g<<3)|0)>>2]))&!(0|(d=0|n[d+4>>2])))){p=0,x=0;do{if((0|p)>(0|r)|(0|p)==(0|r)&x>>>0>t>>>0){P=31;break A}if((0|f)==(0|l)&(-117440513&d)==(0|A)){m=0|tt(0|f,0|d,56),B(),b=1+(m&=7)|0,k=0|tt(0|f,0|d,45),B();t:do{if(0|z(127&k)){if(f=0|tt(0|f,0|d,52),B(),!(f&=15)){d=6;break}for(d=1;;){if(!(!((k=0|rt(7,0,3*(15-d|0)|0))&l)&!((0|B())&A))){d=7;break t}if(!(d>>>0>>0)){d=6;break}d=d+1|0}}else d=7}while(0);if((m+2|0)>>>0>d>>>0){P=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();x=0|Ve(0|x,0|p,1,0),p=0|B(),f=0|n[(d=c=Q+(g<<3)|0)>>2],d=0|n[d+4>>2]}while(!(!(0|f)&!(0|d)))}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=j+(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){P=85;break}if(k=0|Xe(0|t,0|r,6,0),B(),!(k=0|We(k,8))){P=48;break}do{if(C){for(b=0,A=0,m=0,p=0;;){if(!(0|(a=0|n[(s=d=Q+(b<<3)|0)>>2]))&!(0|(s=0|n[s+4>>2])))y=m;else{f=0|tt(0|a,0|s,56),B(),l=1+(f&=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=d)>>2]=a,n[l+4>>2]=s,l=f+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(x=N>>>0>15,v=0|rt(0|N,0,52),w=0|B(),!D){for(a=0,c=0,l=0,s=0;!(0|u)&!(0|i)||(n[(N=e+(a<<3)|0)>>2]=u,n[N+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=j+(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(),x|(0|(h&=15))<(0|N)){P=80;break A}if((0|h)!=(0|N)){if(d=u|v,f=-15728641&i|w,h>>>0>=E>>>0){g=N;do{D=0|rt(7,0,3*(14-g|0)|0),g=g+1|0,d|=D,f=0|B()|f}while(g>>>0>>0)}}else d=u,f=i;m=0|At(0|d,0|f,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){P=81;break A}if((-117440513&(b=0|n[4+(D=Q+(m<<3)|0)>>2]))==(0|f)&&(0|n[D>>2])==(0|d)){P=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=Q+(m<<3)|0}while((0|n[D>>2])!=(0|d)||(0|n[D+4>>2])!=(0|f));if(65==(0|P)&&(P=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=j+(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|Q,0,0|o),st(0|j,0|k,A<<3),Ye(k),!(0|A)&!(0|i)){P=89;break}e=e+(a<<3)|0,r=i,t=A}if(16==(0|P))!0&!(117440512&i)?(i=4,P=27):P=21;else if(31==(0|P))M(27795,27122,620,27132);else{if(41==(0|P))return Ye(j),Ye(Q),10;if(48==(0|P))return Ye(j),Ye(Q),13;80==(0|P)?M(27795,27122,711,27132):81==(0|P)?M(27795,27122,723,27132):85==(0|P)&&(st(0|e,0|j,t<<3),P=89)}return 21==(0|P)?(Ye(j),Ye(Q),0|(P=5)):27==(0|P)?(Ye(j),Ye(Q),0|(P=i)):89==(0|P)?(Ye(j),Ye(Q),0|(P=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=P,P=P+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|R(A,o,7&e,a,t+8|0),P=r,0|a):(P=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=P,P=P+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,P=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,P=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=+f(.5*(i-g)),u=a,a=+o[l+8+(A<<4)+8>>3],u=h*h+(u=+f(.5*(a-u)))*(+d(+g)*+d(+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,P=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=P,P=P+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,P=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,P=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=+f(.5*(i-g)),u=a,a=+o[l+8+(A<<4)+8>>3],u=h*h+(u=+f(.5*(a-u)))*(+d(+g)*+d(+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,P=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=P,P=P+176|0,0|(A=0|DA(A|=0,e|=0,l=r)))return P=r,0|A;if(o[t>>3]=0,(0|(A=0|n[l>>2]))<=1)return P=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=+f(.5*(i-g)),u=a,a=+o[l+8+(A<<4)+8>>3],u=h*h+(u=+f(.5*(a-u)))*(+d(+i)*+d(+g)*u),s+=2*+p(+ +c(+u),+ +c(+(1-u)))}while((0|A)<(0|e));return o[t>>3]=s,P=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:LA,_getDirectedEdgeDestination:function(A,e,t){A|=0,e|=0,t|=0;var r,o,i=0;return r=P,P=P+16|0,n[(i=r)>>2]=0,!0&268435456==(2013265920&e)?(o=0|tt(0|A,0|e,56),B(),i=0|R(A,-2130706433&e|134217728,7&o,i,t),P=r,0|i):(P=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,d=0,f=0;o=P,P=P+128|0,d=o+112|0,s=o+96|0,f=o,a=0|tt(0|(e|=0),0|(t|=0),52),B(),c=15&a,n[d>>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),f=B()|-15728641&t,f=0|A((u|e)&~(d=0|rt(7,0,3*(14-c|0)|0)),f&~B(),r),P=o,0|f;a=1}else a=0}while(0);if(!(i=0|XA(e,t,s))){a?(QA(s,d,f),u=5):(SA(s,d,f),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(PA(l=f+(s<<4)|0,0|n[d>>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(jA(l=f+(s<<4)|0,0|n[d>>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 P=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=+f(.5*(r-t)))*n+(i=+f(.5*(+o[e+8>>3]-+o[A+8>>3])))*(+d(+r)*+d(+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=+f(.5*(r-t)))*n+(i=+f(.5*(+o[e+8>>3]-+o[A+8>>3])))*(+d(+r)*+d(+t)*i),2*+p(+ +c(+i),+ +c(+(1-i)))},_gridDisk:F,_gridDiskDistances:S,_gridDistance:function(A,e,t,r,o){t|=0,r|=0,o|=0;var i,a,s=0,l=0;return a=P,P=P+32|0,l=a,0|(i=0|me(A|=0,e|=0,A,e,s=a+12|0))?(P=a,0|(l=i)):0|(A=0|me(A,e,t,r,l))?(P=a,0|(l=A)):(s=0|kA(s,l),n[(l=o)>>2]=s,n[l+4>>2]=((0|s)<0)<<31>>31,P=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,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=0,y=0,k=0,C=0,D=0,E=0;if(a=P,P=P+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],x=g*+((0|n[c>>2])-t|0),r=0|n[(v=i+4|0)>>2],w=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=x*(d=+(p>>>0)+4294967296*+(0|b))+ +(0|t),u=w*d+ +(0|r),d=g*d+ +(0|s),t=~~+at(+E),c=~~+at(+u),s=~~+at(+d),E=+l(+(+(0|t)-E)),u=+l(+(+(0|c)-u)),d=+l(+(+(0|s)-d));do{if(!(E>u&E>d)){if(f=0-t|0,u>d){r=f-s|0;break}r=c,s=f-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[v>>2],s=0|n[y>>2]}}while(0);return P=a,0|s}return P=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=P,P=P+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))?(P=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,P=i,0|(l=0))},_gridRing:function(A,e,t,r){return 0|T(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,d=0,f=0;if(o=P,P=P+16|0,s=o,!(t|=0))return n[r>>2]=A,n[r+4>>2]=e,P=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 d=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|d,0|a,0|i,0|B())),0|B(),1,0),a=0|B(),n[(d=s)>>2]=i,n[d+4>>2]=a;if(u=0|We(i,8)){if(!(d=0|We(i,4))){Ye(u),i=13;break}if(0|(i=0|I(A,e,t,u,d,i,a,0))){Ye(u),Ye(d);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[d+(l<<2)>>2])!=(0|t)||(n[(f=r+(i<<3)|0)>>2]=a,n[f+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(d),i=0}else i=13}else i=2}while(0);return P=o,0|i}(A,e,t,r))):0|(r=0)},_gridRingUnsafe:T,_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:IA,_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|Le(A,e)))},_isValidVertex:Le,_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=P,P=P+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)),P=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=P,P=P+48|0,i=o+16|0,a=o+8|0,s=o,0|(t=0|Ce(t|=0)))return P=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 P=o,0|t},_maxPolygonToCellsSizeExperimental:function(A,e,t,i){e|=0,t|=0,i|=0;var a,s,c=0,u=0,f=0,g=0,h=0,m=0,b=0,p=0;if(s=P,P=P+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,P=s,0;RA(h,0,0,0),c=0|n[(f=h)>>2],f=0|n[f+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]=f,n[(f=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/+d(+ +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(ve(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,ve(a),t=0|n[(p=a)>>2],c=0|n[p+4>>2]}while(!(!(0|t)&!(0|c)));t=0|n[f>>2]}}while(0);return P=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,d=0,f=0,g=0,h=0,m=0,b=0,p=0,x=0,v=0,w=0,y=0,k=0,C=0,M=0,D=0,E=0,N=0,Q=0,j=0,F=0,S=0,R=0,T=0,_=0;if(s=P,P=P+112|0,o=s+80|0,f=s+72|0,i=s,a=s+56|0,0|(l=0|Ce(t|=0)))return P=s,0|l;if(!(_=0|Ue(32+(n[(g=A+8|0)>>2]<<5)|0)))return P=s,13;if(Be(A,_),!(l=0|Ce(t))){if(T=0|n[(R=A)+4>>2],n[(l=f)>>2]=n[R>>2],n[l+4>>2]=T,ke(f,o),l=0|eA(o,e,i))R=0,T=0;else{if(l=0|n[f>>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,R=0|Ve(0|t,0|l,12,0),T=0|B(),n[(l=i)>>2]=R,n[l+4>>2]=T,l=0}if(!l){if(!(t=0|We(R,8)))return Ye(_),P=s,13;if(!(d=0|We(R,8)))return Ye(_),Ye(t),P=s,13;n[(F=o)>>2]=0,n[F+4>>2]=0,S=0|n[(F=A)+4>>2],n[(l=f)>>2]=n[F>>2],n[l+4>>2]=S,l=0|H(f,R,T,e,o,t,d);A:do{if(l)Ye(t),Ye(d),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,R,T,e,o,t,d),c=c+1|0,!(0|l);)if((0|c)>=(0|n[g>>2]))break e;Ye(t),Ye(d),Ye(_);break A}}while(0);(0|T)>0|!(0|T)&R>>>0>0&<(0|d,0,R<<3),F=0|n[(S=o)+4>>2];e:do{if((0|F)>0|!(0|F)&(0|n[S>>2])>>>0>0){N=t,Q=d,j=t,F=d,S=t,l=t,M=t,D=d,E=d,t=d;t:for(;;){for(w=0,y=0,k=0,C=0,c=0,u=0;;){f=(d=i)+56|0;do{n[d>>2]=0,d=d+4|0}while((0|d)<(0|f));if(0|L(g=0|n[(e=N+(w<<3)|0)>>2],e=0|n[e+4>>2],1,i,0)){f=(d=i)+56|0;do{n[d>>2]=0,d=d+4|0}while((0|d)<(0|f));0|(d=0|We(7,4))&&(I(g,e,1,i,d,7,0,0),Ye(d))}for(v=0;;){p=0|n[(x=i+(v<<3)|0)>>2],x=0|n[x+4>>2];r:do{if(!(0|p)&!(0|x))d=c,f=u;else{if(h=0|At(0|p,0|x,0|R,0|T),g=0|B(),!(!(0|(f=0|n[(e=d=r+(h<<3)|0)>>2]))&!(0|(e=0|n[e+4>>2])))){m=0,b=0;do{if((0|m)>(0|T)|(0|m)==(0|T)&b>>>0>R>>>0)break t;if((0|f)==(0|p)&(0|e)==(0|x)){d=c,f=u;break r}h=0|$e(0|(d=0|Ve(0|h,0|g,1,0)),0|B(),0|R,0|T),g=0|B(),b=0|Ve(0|b,0|m,1,0),m=0|B(),f=0|n[(e=d=r+(h<<3)|0)>>2],e=0|n[e+4>>2]}while(!(!(0|f)&!(0|e)))}if(!(0|p)&!(0|x)){d=c,f=u;break}qA(p,x,a),0|Me(A,_,a)&&(b=0|Ve(0|c,0|u,1,0),u=0|B(),n[(m=d)>>2]=p,n[m+4>>2]=x,n[(c=Q+(c<<3)|0)>>2]=p,n[c+4>>2]=x,c=b),d=c,f=u}}while(0);if((v=v+1|0)>>>0>=7)break;c=d,u=f}if(w=0|Ve(0|w,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=d,u=f}if((0|u)>0|!(0|u)&c>>>0>0){c=0,u=0;do{n[(C=N+(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]=d,n[C+4>>2]=f,!((0|f)>0|!(0|f)&d>>>0>0))break e;v=t,w=E,y=S,k=D,C=Q,t=M,E=l,D=j,M=v,l=w,S=F,F=y,j=k,Q=N,N=C}Ye(j),Ye(F),Ye(_),l=1;break A}l=d}while(0);Ye(_),Ye(t),Ye(l),l=0}}while(0);return P=s,0|l}}return Ye(_),P=s,0|l},_polygonToCellsExperimental:function(A,e,t,o,i,a){o|=0,i|=0,a|=0;var s,l,c,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0;c=P,P=P+160|0,d=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,d=0;s=P,P=P+48|0,i=s+40|0,a=s,RA(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[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[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]=f,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[d>>2],n[h+4>>2]=n[d+4>>2],n[h+8>>2]=n[d+8>>2],n[h+12>>2]=n[d+12>>2],!(0|s)&!(0|f))return P=c,0|u;t=p+16|0,l=p+24|0,g=p+28|0,u=0,d=0,e=s,A=f;do{if(!((0|u)<(0|i)|(0|u)==(0|i)&d>>>0>>0)){b=4;break}if(f=d,d=0|Ve(0|d,0|u,1,0),u=0|B(),n[(f=a+(f<<3)|0)>>2]=e,n[f+4>>2]=A,re(h),!(0|(e=0|n[(A=h)>>2]))&!(0|(A=0|n[A+4>>2]))){if(ve(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[(f=p)>>2]=e,n[f+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,P=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],P=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,d=0,f=0,g=0,h=0,m=0;if(s=P,P=P+16|0,m=s,!((0|(t|=0))>0|!(0|t)&(e|=0)>>>0>0))return P=s,0;if((0|(a|=0))>=16)return P=s,12;g=0,h=0,f=0,l=0;A:for(;;){if(d=0|tt(0|(c=0|n[(u=A+(g<<3)|0)>>2]),0|(u=0|n[u+4>>2]),52),B(),(15&d)>(0|a)){l=12,c=11;break}if(ee(m,c,u,a),!(0|(u=0|n[(d=m)>>2]))&!(0|(d=0|n[d+4>>2])))c=f;else{c=f;do{if(!((0|l)<(0|i)|(0|l)==(0|i)&c>>>0>>0)){c=10;break A}n[(f=r+(c<<3)|0)>>2]=u,n[f+4>>2]=d,c=0|Ve(0|c,0|l,1,0),l=0|B(),re(m),u=0|n[(f=m)>>2],d=0|n[f+4>>2]}while(!(!(0|u)&!(0|d)))}if(g=0|Ve(0|g,0|h,1,0),!((0|(h=0|B()))<(0|t)|(0|h)==(0|t)&g>>>0