diff --git a/README.md b/README.md index a010c49c..7d98ebb6 100644 --- a/README.md +++ b/README.md @@ -76,10 +76,10 @@ The MeshCore Python ecosystem has three components: - **Animated edges** — Trace-in effect on toggle, smooth fade-out - **Filter toggles** — Solo view for hub nodes or direct neighbors only - **Loop detection** — Identifies redundant paths (double-line rendering) -- **Visual identity** — Yellow house icon for local node, indigo rings for neighbors +- **High-contrast markers** — Light fill with dark outline ensures visibility against any overlay - **Path health panel** — Health scores, weakest links, and latency estimates for observed routes - **Mobile node detection** — Identifies volatile nodes that appear/disappear frequently -- **Wardriving coverage heatmap** — Overlay coverage data from external wardriving servers (e.g., coverage.wcmesh.com) as a GPU-accelerated heatmap showing signal coverage across your area +- **Wardriving coverage overlay** — H3 hexagonal tiles from external coverage servers (e.g., coverage.wcmesh.com) with SNR-based coloring ![Topology Map](docs/images/topology.png) @@ -92,6 +92,8 @@ The MeshCore Python ecosystem has three components: - **Mode toggle** — Forward (repeating) or Monitor (RX only) - **Duty cycle** — Enable/disable enforcement - **Radio config** — Live frequency, power, SF, bandwidth changes +- **Theme selection** — Six color schemes (Seoul256, Gruvbox, Deus, Gotham, Sonokai, Kanagawa) +- **Background images** — Multiple ambient backgrounds with adjustable brightness ![Settings](docs/images/settings.png) diff --git a/frontend/dist/VERSION b/frontend/dist/VERSION index 0b105a61..92b2e7c4 100644 --- a/frontend/dist/VERSION +++ b/frontend/dist/VERSION @@ -1 +1 @@ -0.9.127 +0.9.128 diff --git a/frontend/dist/assets/CollisionExplorerModal-BemV0oqY.js b/frontend/dist/assets/CollisionExplorerModal-CR_bXIKw.js similarity index 97% rename from frontend/dist/assets/CollisionExplorerModal-BemV0oqY.js rename to frontend/dist/assets/CollisionExplorerModal-CR_bXIKw.js index bb65622e..9bb9cd4d 100644 --- a/frontend/dist/assets/CollisionExplorerModal-BemV0oqY.js +++ b/frontend/dist/assets/CollisionExplorerModal-CR_bXIKw.js @@ -1 +1 @@ -import{c as e,f as t,z as o,g as s,j as n,X as a}from"./index-CFwwWdzm.js";import{b as r,g as l,c as i}from"./recharts-bmHCCfxU.js";import{L as c}from"./leaflet-ClE6qLuu.js";import{T as d,a as h,C as m}from"./triangle-alert-D3gq7TmU.js";import{M as u}from"./map-pin-T4wlME-z.js";const x=e("arrow-left-right",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]),p=e("messages-square",[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]]),y=e("monitor-smartphone",[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]]),f=e("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),b=e("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),g="#4338CA",v="#F59E0B",w="#39D98A";function j({hash:e,highlighted:t}){const[o,s]=r.useState(!1),a=r.useCallback(t=>{t.preventDefault(),t.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}}(e),s(!0),setTimeout(()=>s(!1),2e3)},[e]),l=e.length>12?`${e.slice(0,12)}…`:e;return n.jsxs("button",{type:"button",onClick:a,className:i("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",t?"bg-accent-secondary/20 border-accent-secondary/50":"bg-bg-subtle/80 hover:bg-bg-elevated"),title:`Click to copy: ${e}`,children:[n.jsx("span",{className:i("transition-colors",o?"text-accent-success":"text-text-secondary"),children:l}),o?n.jsx(h,{className:"w-2.5 h-2.5 text-accent-success"}):n.jsx(m,{className:"w-2.5 h-2.5 opacity-40"})]})}function N({node:e,className:t}){const o=e.contactType.toLowerCase(),s="room server"===o||"room_server"===o||"room"===o||"server"===o,a="companion"===o||"client"===o||"cli"===o;return s&&e.isRepeater?n.jsxs("div",{className:i("relative",t),children:[n.jsx(p,{className:"w-full h-full",style:{color:v}}),n.jsx(b,{className:"w-1/2 h-1/2 absolute -bottom-0.5 -right-0.5",style:{color:g}})]}):s?n.jsx(p,{className:t,style:{color:v}}):a?n.jsx(y,{className:i(t,"text-text-muted")}):e.isRepeater?e.isNeighbor?n.jsx(x,{className:t,style:{color:w}}):n.jsx(b,{className:t,style:{color:g}}):n.jsx(y,{className:i(t,"text-text-muted")})}function k({node:e,isHovered:t,onMouseEnter:o,onMouseLeave:s,onTouchStart:a}){return n.jsxs("div",{className:i("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:o,onMouseLeave:s,onTouchStart:a,children:[n.jsx("div",{className:"flex-shrink-0 w-5 h-5",children:n.jsx(N,{node:e,className:"w-5 h-5"})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx("span",{className:"text-sm font-medium text-text-primary truncate",children:e.name}),e.isNeighbor&&n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium",style:{backgroundColor:"rgba(57, 217, 138, 0.2)",color:"#39D98A"},children:"NBR"}),e.isRepeater&&n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-white/10 text-text-muted font-medium",children:"RPT"})]}),n.jsx("div",{className:"mt-1",children:n.jsx(j,{hash:e.hash,highlighted:t})})]})]})}function C({nodes:e,hoveredHash:t,onNodeHover:o,onNodeLeave:s}){const a=r.useRef(null),l=r.useRef(null),i=r.useRef(new Map),d=r.useMemo(()=>e.filter(e=>e.latitude&&e.longitude&&0!==e.latitude&&0!==e.longitude),[e]);return r.useEffect(()=>{if(!l.current||a.current)return;const e=c.map(l.current,{zoomControl:!0,attributionControl:!0});return c.tileLayer("https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",{attribution:'© OSM © CARTO'}).addTo(e),a.current=e,()=>{e.remove(),a.current=null}},[]),r.useEffect(()=>{const e=a.current;if(!e)return;if(i.current.forEach(e=>e.remove()),i.current.clear(),0===d.length)return;const t=c.latLngBounds([]);for(const n of d){if(!n.latitude||!n.longitude)continue;const a=c.latLng(n.latitude,n.longitude);t.extend(a);const r=n.isNeighbor?w:g,l=c.circleMarker(a,{radius:8,fillColor:r,fillOpacity:.8,color:"#fff",weight:2,opacity:.9});l.bindTooltip(n.name,{permanent:!1,direction:"top",offset:[0,-8],className:"collision-tooltip"}),l.on("mouseover",()=>o(n.hash)),l.on("mouseout",()=>s()),l.addTo(e),i.current.set(n.hash,l)}t.isValid()&&e.fitBounds(t,{padding:[40,40],maxZoom:12})},[d,o,s]),r.useEffect(()=>{i.current.forEach((e,o)=>{const s=d.find(e=>e.hash===o);if(!s)return;const n=o===t,a=s.isNeighbor?w:g;e.setStyle({radius:n?12:8,fillColor:n?"#FBBF24":a,weight:n?3:2}),n?(e.openTooltip(),e.bringToFront()):e.closeTooltip()})},[t,d]),0===d.length?n.jsx("div",{className:"h-full flex items-center justify-center bg-bg-subtle/30 rounded-lg",children:n.jsxs("div",{className:"text-center text-text-muted p-4",children:[n.jsx(u,{className:"w-8 h-8 mx-auto mb-2 opacity-40"}),n.jsx("p",{className:"text-sm",children:"No location data available"}),n.jsx("p",{className:"text-xs opacity-70",children:"Nodes need GPS coordinates to appear on the map"})]})}):n.jsx("div",{ref:l,className:"h-full w-full rounded-lg overflow-hidden"})}const M=r.memo(function({isOpen:e,prefix:c,candidateHashes:h,onClose:m}){const u=t(),x=o(),p=s(),[y,f]=r.useState(null),b=r.useMemo(()=>new Set(p.map(e=>e.hash)),[p]),g=null==u?void 0:u.neighbors,v=r.useMemo(()=>g?h.map(e=>{var t,o;const s=g[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:b.has(e),isHub:x.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)):[],[h,g,b,x]),w=r.useCallback(e=>f(e),[]),j=r.useCallback(()=>f(null),[]);return r.useEffect(()=>{if(!e)return;const t=e=>{"Escape"===e.key&&m()};window.addEventListener("keydown",t);const o=window.scrollY,s={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=`-${o}px`,()=>{window.removeEventListener("keydown",t),document.body.style.overflow=s.overflow,document.body.style.position=s.position,document.body.style.width=s.width,document.body.style.top=s.top,window.scrollTo(0,o)}},[e,m]),e?l.createPortal(n.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-[10010] flex items-end sm:items-center justify-center",onClick:m,role:"dialog","aria-modal":"true","aria-labelledby":"collision-modal-title",children:n.jsxs("div",{className:i("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:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border-subtle flex-shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"p-2 rounded-lg bg-signal-fair/10",children:n.jsx(d,{className:"w-5 h-5 text-signal-fair"})}),n.jsxs("div",{children:[n.jsxs("h3",{id:"collision-modal-title",className:"text-base font-semibold text-text-primary",children:["Prefix Collision: ",n.jsx("span",{className:"font-mono text-accent-primary",children:c})]}),n.jsxs("p",{className:"text-xs text-text-muted",children:[v.length," nodes share this prefix"]})]})]}),n.jsx("button",{onClick:m,className:"p-2 rounded-lg text-text-muted hover:text-text-primary hover:bg-bg-subtle transition-colors",children:n.jsx(a,{className:"w-5 h-5"})})]}),n.jsxs("div",{className:"flex-1 min-h-0 flex flex-col sm:flex-row overflow-hidden",children:[n.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto sm:max-w-[280px] sm:border-r sm:border-border-subtle",children:n.jsx("div",{className:"p-2",children:v.map(e=>n.jsx(k,{node:e,isHovered:y===e.hash,onMouseEnter:()=>w(e.hash),onMouseLeave:j,onTouchStart:()=>w(e.hash)},e.hash))})}),n.jsx("div",{className:"h-48 sm:h-auto sm:flex-1 p-2 flex-shrink-0",children:n.jsx(C,{nodes:v,hoveredHash:y,onNodeHover:w,onNodeLeave:j})})]})]})}),document.body):null});export{x as A,M as C,p as M,f as N,b as S,y as a}; +import{c as e,f as t,z as o,g as s,j as n,X as a}from"./index-B-2Jxr7j.js";import{b as r,g as l,c as i}from"./recharts-bmHCCfxU.js";import{L as c}from"./leaflet-ClE6qLuu.js";import{T as d,a as h,C as m}from"./triangle-alert-DgnBDldk.js";import{M as u}from"./map-pin-DUDH5S76.js";const x=e("arrow-left-right",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]),p=e("messages-square",[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]]),y=e("monitor-smartphone",[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]]),f=e("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),b=e("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),g="#4338CA",v="#F59E0B",w="#39D98A";function j({hash:e,highlighted:t}){const[o,s]=r.useState(!1),a=r.useCallback(t=>{t.preventDefault(),t.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}}(e),s(!0),setTimeout(()=>s(!1),2e3)},[e]),l=e.length>12?`${e.slice(0,12)}…`:e;return n.jsxs("button",{type:"button",onClick:a,className:i("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",t?"bg-accent-secondary/20 border-accent-secondary/50":"bg-bg-subtle/80 hover:bg-bg-elevated"),title:`Click to copy: ${e}`,children:[n.jsx("span",{className:i("transition-colors",o?"text-accent-success":"text-text-secondary"),children:l}),o?n.jsx(h,{className:"w-2.5 h-2.5 text-accent-success"}):n.jsx(m,{className:"w-2.5 h-2.5 opacity-40"})]})}function N({node:e,className:t}){const o=e.contactType.toLowerCase(),s="room server"===o||"room_server"===o||"room"===o||"server"===o,a="companion"===o||"client"===o||"cli"===o;return s&&e.isRepeater?n.jsxs("div",{className:i("relative",t),children:[n.jsx(p,{className:"w-full h-full",style:{color:v}}),n.jsx(b,{className:"w-1/2 h-1/2 absolute -bottom-0.5 -right-0.5",style:{color:g}})]}):s?n.jsx(p,{className:t,style:{color:v}}):a?n.jsx(y,{className:i(t,"text-text-muted")}):e.isRepeater?e.isNeighbor?n.jsx(x,{className:t,style:{color:w}}):n.jsx(b,{className:t,style:{color:g}}):n.jsx(y,{className:i(t,"text-text-muted")})}function k({node:e,isHovered:t,onMouseEnter:o,onMouseLeave:s,onTouchStart:a}){return n.jsxs("div",{className:i("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:o,onMouseLeave:s,onTouchStart:a,children:[n.jsx("div",{className:"flex-shrink-0 w-5 h-5",children:n.jsx(N,{node:e,className:"w-5 h-5"})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx("span",{className:"text-sm font-medium text-text-primary truncate",children:e.name}),e.isNeighbor&&n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium",style:{backgroundColor:"rgba(57, 217, 138, 0.2)",color:"#39D98A"},children:"NBR"}),e.isRepeater&&n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-white/10 text-text-muted font-medium",children:"RPT"})]}),n.jsx("div",{className:"mt-1",children:n.jsx(j,{hash:e.hash,highlighted:t})})]})]})}function C({nodes:e,hoveredHash:t,onNodeHover:o,onNodeLeave:s}){const a=r.useRef(null),l=r.useRef(null),i=r.useRef(new Map),d=r.useMemo(()=>e.filter(e=>e.latitude&&e.longitude&&0!==e.latitude&&0!==e.longitude),[e]);return r.useEffect(()=>{if(!l.current||a.current)return;const e=c.map(l.current,{zoomControl:!0,attributionControl:!0});return c.tileLayer("https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",{attribution:'© OSM © CARTO'}).addTo(e),a.current=e,()=>{e.remove(),a.current=null}},[]),r.useEffect(()=>{const e=a.current;if(!e)return;if(i.current.forEach(e=>e.remove()),i.current.clear(),0===d.length)return;const t=c.latLngBounds([]);for(const n of d){if(!n.latitude||!n.longitude)continue;const a=c.latLng(n.latitude,n.longitude);t.extend(a);const r=n.isNeighbor?w:g,l=c.circleMarker(a,{radius:8,fillColor:r,fillOpacity:.8,color:"#fff",weight:2,opacity:.9});l.bindTooltip(n.name,{permanent:!1,direction:"top",offset:[0,-8],className:"collision-tooltip"}),l.on("mouseover",()=>o(n.hash)),l.on("mouseout",()=>s()),l.addTo(e),i.current.set(n.hash,l)}t.isValid()&&e.fitBounds(t,{padding:[40,40],maxZoom:12})},[d,o,s]),r.useEffect(()=>{i.current.forEach((e,o)=>{const s=d.find(e=>e.hash===o);if(!s)return;const n=o===t,a=s.isNeighbor?w:g;e.setStyle({radius:n?12:8,fillColor:n?"#FBBF24":a,weight:n?3:2}),n?(e.openTooltip(),e.bringToFront()):e.closeTooltip()})},[t,d]),0===d.length?n.jsx("div",{className:"h-full flex items-center justify-center bg-bg-subtle/30 rounded-lg",children:n.jsxs("div",{className:"text-center text-text-muted p-4",children:[n.jsx(u,{className:"w-8 h-8 mx-auto mb-2 opacity-40"}),n.jsx("p",{className:"text-sm",children:"No location data available"}),n.jsx("p",{className:"text-xs opacity-70",children:"Nodes need GPS coordinates to appear on the map"})]})}):n.jsx("div",{ref:l,className:"h-full w-full rounded-lg overflow-hidden"})}const M=r.memo(function({isOpen:e,prefix:c,candidateHashes:h,onClose:m}){const u=t(),x=o(),p=s(),[y,f]=r.useState(null),b=r.useMemo(()=>new Set(p.map(e=>e.hash)),[p]),g=null==u?void 0:u.neighbors,v=r.useMemo(()=>g?h.map(e=>{var t,o;const s=g[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:b.has(e),isHub:x.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)):[],[h,g,b,x]),w=r.useCallback(e=>f(e),[]),j=r.useCallback(()=>f(null),[]);return r.useEffect(()=>{if(!e)return;const t=e=>{"Escape"===e.key&&m()};window.addEventListener("keydown",t);const o=window.scrollY,s={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=`-${o}px`,()=>{window.removeEventListener("keydown",t),document.body.style.overflow=s.overflow,document.body.style.position=s.position,document.body.style.width=s.width,document.body.style.top=s.top,window.scrollTo(0,o)}},[e,m]),e?l.createPortal(n.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-[10010] flex items-end sm:items-center justify-center",onClick:m,role:"dialog","aria-modal":"true","aria-labelledby":"collision-modal-title",children:n.jsxs("div",{className:i("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:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border-subtle flex-shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"p-2 rounded-lg bg-signal-fair/10",children:n.jsx(d,{className:"w-5 h-5 text-signal-fair"})}),n.jsxs("div",{children:[n.jsxs("h3",{id:"collision-modal-title",className:"text-base font-semibold text-text-primary",children:["Prefix Collision: ",n.jsx("span",{className:"font-mono text-accent-primary",children:c})]}),n.jsxs("p",{className:"text-xs text-text-muted",children:[v.length," nodes share this prefix"]})]})]}),n.jsx("button",{onClick:m,className:"p-2 rounded-lg text-text-muted hover:text-text-primary hover:bg-bg-subtle transition-colors",children:n.jsx(a,{className:"w-5 h-5"})})]}),n.jsxs("div",{className:"flex-1 min-h-0 flex flex-col sm:flex-row overflow-hidden",children:[n.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto sm:max-w-[280px] sm:border-r sm:border-border-subtle",children:n.jsx("div",{className:"p-2",children:v.map(e=>n.jsx(k,{node:e,isHovered:y===e.hash,onMouseEnter:()=>w(e.hash),onMouseLeave:j,onTouchStart:()=>w(e.hash)},e.hash))})}),n.jsx("div",{className:"h-48 sm:h-auto sm:flex-1 p-2 flex-shrink-0",children:n.jsx(C,{nodes:v,hoveredHash:y,onNodeHover:w,onNodeLeave:j})})]})]})}),document.body):null});export{x as A,M as C,p as M,f as N,b as S,y as a}; diff --git a/frontend/dist/assets/Configuration-B9QbnTUG.js b/frontend/dist/assets/Configuration-B9QbnTUG.js deleted file mode 100644 index 00418be0..00000000 --- a/frontend/dist/assets/Configuration-B9QbnTUG.js +++ /dev/null @@ -1 +0,0 @@ -import{c as e,ae as t,af as s,ag as a,j as r,J as n,ah as l,ai as c,aj as i,ak as d,X as o,al as u,E as m,am as x,R as p,ac as h,an as b,ao as y,ap as g,aq as f,ar as j,as as v,at as N,au as w,av as k}from"./index-CFwwWdzm.js";import{b as C,c as _}from"./recharts-bmHCCfxU.js";import{H as S}from"./HashBadge-Bkq6dZ2T.js";import{T,C as F}from"./ConfirmModal-vJgaOhfN.js";import{P as E,a as L,C as M,b as P}from"./PageLayout-BUtLzwWM.js";import{R,C as z}from"./Grid-DbeqLJGI.js";import{L as A}from"./loader-circle-D-YFxAvv.js";import{a as I,T as D,C as H}from"./triangle-alert-D3gq7TmU.js";import{I as O}from"./info-CmmWJjrG.js";import{E as q}from"./external-link-DOcxKPBQ.js";import{R as K}from"./refresh-cw-DL6OUtNR.js";import{C as V}from"./chevron-right-CD3nhAMR.js";import"./maplibre-gl-CFO9X1Ek.js";const $=e("antenna",[["path",{d:"M2 12 7 2",key:"117k30"}],["path",{d:"m7 12 5-10",key:"1tvx22"}],["path",{d:"m12 12 5-10",key:"ev1o1a"}],["path",{d:"m17 12 5-10",key:"1e4ti3"}],["path",{d:"M4.5 7h15",key:"vlsxkz"}],["path",{d:"M12 16v6",key:"c8a4gj"}]]),Y=e("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),B=e("folder-key",[["circle",{cx:"16",cy:"20",r:"2",key:"1vifvg"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2",key:"3hgo9p"}],["path",{d:"m22 14-4.5 4.5",key:"1ef6z8"}],["path",{d:"m21 15 1 1",key:"1ejcpy"}]]),U=e("folder-lock",[["rect",{width:"8",height:"5",x:"14",y:"17",rx:"1",key:"19aais"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2.5",key:"1w6v7t"}],["path",{d:"M20 17v-2a2 2 0 1 0-4 0v2",key:"pwaxnr"}]]),X=e("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]),G=e("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),W=e("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),J=e("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),Q=e("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Z=e("shield-x",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]),ee=C.memo(function({showLogoOnly:e=!1,showThumbnailsOnly:n=!1}){const{theme:l,setThemePreset:c,setBrightness:i}=t(),{backgroundImage:d,brightness:o}=l,[u,m]=C.useState(!1),[x,p]=C.useState(!1),h=C.useRef(null),b=C.useRef(null),y=s.find(e=>e.backgroundImage===d)??s[0],g=y.id,f=C.useCallback((e,t)=>{if(!b.current)return o;const s=(b.current.y-e)/(t?200:80)*100;return Math.round(Math.max(0,Math.min(100,b.current.brightness+s)))},[o]),j=C.useCallback(e=>{c(e),m(!0)},[c]),v=C.useCallback(e=>{i(e)},[i]),N=C.useCallback(e=>{const t=s.find(t=>t.id===e);t&&a(t.backgroundImage)},[]);if(e){const e=y.displaySize,t=`clamp(${.8*e}rem, ${.6*e}rem + 1.5vw, ${1.4*e}rem)`;return r.jsx("span",{className:"font-medium transition-all duration-300 leading-none",style:{fontFamily:y.displayFont,color:y.displayColor,fontSize:t,fontOpticalSizing:"auto",letterSpacing:"-0.03em"},children:y.displayName})}return r.jsx("div",{className:"flex gap-2 items-start flex-shrink-0",children:s.map(e=>{const t=g===e.id,s=t&&(u||x);return r.jsxs("div",{ref:t?h:void 0,title:e.displayName,className:_("flex flex-col items-center gap-1 p-0.5 rounded-sm transition-all duration-300 ease-out",t?"ring-2 ring-accent-primary scale-105 cursor-ns-resize":"cursor-pointer"),onMouseEnter:()=>{t?m(!0):N(e.id)},onMouseLeave:()=>!x&&m(!1),onClick:()=>!t&&j(e.id),onTouchStart:e=>{if(!t)return;e.preventDefault();const s=e.touches[0];b.current={y:s.clientY,brightness:o},p(!0),m(!0);const a=e=>{e.preventDefault();const t=e.touches[0];v(f(t.clientY,!0))},r=()=>{document.removeEventListener("touchmove",a),document.removeEventListener("touchend",r),b.current=null,p(!1),setTimeout(()=>m(!1),1500)};document.addEventListener("touchmove",a,{passive:!1}),document.addEventListener("touchend",r)},onMouseDown:e=>{if(!t)return;e.preventDefault(),b.current={y:e.clientY,brightness:o},p(!0),m(!0);const s=e=>{v(f(e.clientY,!1))},a=()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",a),b.current=null,p(!1)};document.addEventListener("mousemove",s),document.addEventListener("mouseup",a)},children:[r.jsxs("div",{className:"glass-thumbnail w-10 h-10",children:[r.jsx("div",{className:"absolute bg-cover bg-center transition-opacity duration-200",style:{inset:0,backgroundImage:`url(${e.backgroundImage})`,opacity:s?.4:1}}),t&&r.jsxs("div",{className:_("absolute inset-0 transition-opacity duration-200",s?"opacity-100":"opacity-0"),children:[r.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-black/70 transition-all duration-100 ease-out",style:{height:100-o+"%"}}),r.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-o+"%"}}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:r.jsxs("span",{className:"text-[10px] font-mono font-bold text-white drop-shadow-lg",children:[o,"%"]})})]})]}),r.jsx("div",{className:"flex flex-col gap-0.5",children:e.paletteColors.map((e,t)=>r.jsx("div",{className:"flex gap-0.5 justify-center",children:e.map((e,t)=>r.jsx("div",{className:"w-1.5 h-1.5 rounded-xs",style:{backgroundColor:e}},t))},t))})]},e.id)})})}),te=[{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"}],se=[5,6,7,8,9,10,11,12],ae=[{value:5,label:"4/5"},{value:6,label:"4/6"},{value:7,label:"4/7"},{value:8,label:"4/8"}];function re(){var e,t,s,a,re,ne;const{stats:le,setMode:ce,clearModeMutation:ie,setDutyCycleConfig:de,clearDutyCycleMutation:oe,fetchStats:ue}=n(),me=null==(e=null==le?void 0:le.config)?void 0:e.radio,xe=null==(t=null==le?void 0:le.config)?void 0:t.repeater,pe=null==(s=null==le?void 0:le.config)?void 0:s.duty_cycle,he=(null==le?void 0:le.node_name)||(null==(a=null==le?void 0:le.config)?void 0:a.node_name)||"Unknown Node",be=(null==xe?void 0:xe.mode)??"forward",ye=(null==pe?void 0:pe.enforcement_enabled)??!1,ge=null==(re=null==le?void 0:le.config)?void 0:re.delays,[fe,je]=C.useState(!1),[ve,Ne]=C.useState(""),[we,ke]=C.useState(62.5),[Ce,_e]=C.useState(7),[Se,Te]=C.useState(5),[Fe,Ee]=C.useState(""),[Le,Me]=C.useState("idle"),[Pe,Re]=C.useState(null),ze=C.useRef(null),Ae=C.useRef(null),Ie=C.useRef(null),[De,He]=C.useState("idle"),[Oe,qe]=C.useState("idle"),[Ke,Ve]=C.useState(null),[$e,Ye]=C.useState(null),Be=C.useRef(!0),Ue=C.useRef(null),Xe=C.useRef(null),Ge=C.useRef(null),We=C.useRef(null),Je=C.useRef(!1),Qe=C.useRef(!1);C.useEffect(()=>(Be.current=!0,()=>{Be.current=!1,Ue.current&&clearTimeout(Ue.current),Xe.current&&clearTimeout(Xe.current),Ge.current&&clearTimeout(Ge.current),We.current&&clearTimeout(We.current),Lt.current&&clearTimeout(Lt.current),Mt.current&&clearTimeout(Mt.current),Ae.current&&clearTimeout(Ae.current),dt.current&&clearTimeout(dt.current),Ct.current&&clearTimeout(Ct.current)}),[]);const[Ze,et]=C.useState(!1),[tt,st]=C.useState(""),[at,rt]=C.useState(""),[nt,lt]=C.useState(""),[ct,it]=C.useState("idle"),dt=C.useRef(null),[ot,ut]=C.useState(!1),[mt,xt]=C.useState(""),[pt,ht]=C.useState(""),[bt,yt]=C.useState(""),[gt,ft]=C.useState(""),[jt,vt]=C.useState("idle"),[Nt,wt]=C.useState(null),kt=C.useRef(null),Ct=C.useRef(null),_t=null==(ne=null==le?void 0:le.config)?void 0:ne.web,[St,Tt]=C.useState("idle"),[Ft,Et]=C.useState(null),Lt=C.useRef(null),Mt=C.useRef(null),Pt=C.useRef(!1),[Rt,zt]=C.useState([]),[At,It]=C.useState(!1),[Dt,Ht]=C.useState(null),[Ot,qt]=C.useState(!1),[Kt,Vt]=C.useState(""),[$t,Yt]=C.useState(null),[Bt,Ut]=C.useState(!1),[Xt,Gt]=C.useState(null),[Wt,Jt]=C.useState(!1),[Qt,Zt]=C.useState(!1),[es,ts]=C.useState(!1),[ss,as]=C.useState([]),[rs,ns]=C.useState(!1),[ls,cs]=C.useState(null),[is,ds]=C.useState("deny"),[os,us]=C.useState(!1),[ms,xs]=C.useState(null),[ps,hs]=C.useState(new Set),[bs,ys]=C.useState(!1),[gs,fs]=C.useState(!1),[js,vs]=C.useState(!1),[Ns,ws]=C.useState(null),[ks,Cs]=C.useState(null),[_s,Ss]=C.useState(""),[Ts,Fs]=C.useState("deny"),[Es,Ls]=C.useState(!1),[Ms,Ps]=C.useState(!0),[Rs,zs]=C.useState(!1),[As,Is]=C.useState(!0),[Ds,Hs]=C.useState("idle"),[Os,qs]=C.useState(!1),[Ks,Vs]=C.useState(!1);C.useEffect(()=>{me&&fe&&(Ne((me.frequency/1e6).toFixed(3)),ke(me.bandwidth/1e3),_e(me.spreading_factor),Te(me.coding_rate),Ee(String(me.tx_power)))},[me,fe]);const $s=C.useMemo(()=>{if(!me||!fe)return!1;const e=me.frequency/1e6,t=me.bandwidth/1e3,s=parseFloat(ve)||0;return Math.abs(s-e)>1e-4||we!==t||Ce!==me.spreading_factor||Se!==me.coding_rate||parseInt(Fe)!==me.tx_power},[me,fe,ve,we,Ce,Se,Fe]),Ys=C.useCallback(()=>{je(!1),Re(null),me&&(Ne((me.frequency/1e6).toFixed(3)),ke(me.bandwidth/1e3),_e(me.spreading_factor),Te(me.coding_rate),Ee(String(me.tx_power)))},[me]);C.useEffect(()=>{if(!fe)return;const e=e=>{ze.current&&!ze.current.contains(e.target)&&Ys()};return document.addEventListener("mouseup",e),()=>{document.removeEventListener("mouseup",e)}},[fe,Ys]);const Bs=C.useCallback(()=>{const e=null==ge?void 0:ge.tx_delay_factor;return e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??1:"number"==typeof e?e:1},[ge]),Us=C.useCallback(()=>{const e=null==ge?void 0:ge.direct_tx_delay_factor;return"number"==typeof e?e:.5},[ge]),Xs=C.useCallback(()=>{const e=null==pe?void 0:pe.max_airtime_percent;return"number"==typeof e?e:e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??6:6},[pe]),Gs=C.useCallback(()=>{st(Bs().toFixed(2)),rt(Us().toFixed(2)),lt(Xs().toFixed(1)),et(!0)},[Bs,Us,Xs]),Ws=C.useCallback(()=>{et(!1)},[]);C.useEffect(()=>{if(!Ze)return;const e=e=>{Ie.current&&!Ie.current.contains(e.target)&&Ws()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[Ze,Ws]);const Js=C.useCallback(()=>{var e,t,s;xt(he),ht((null==(e=null==xe?void 0:xe.latitude)?void 0:e.toString())||"0"),yt((null==(t=null==xe?void 0:xe.longitude)?void 0:t.toString())||"0"),ft((null==(s=null==xe?void 0:xe.send_advert_interval_hours)?void 0:s.toString())||"0"),wt(null),ut(!0)},[he,xe]),Qs=C.useCallback(()=>{ut(!1),wt(null)},[]);C.useEffect(()=>{if(!ot)return;const e=e=>{kt.current&&!kt.current.contains(e.target)&&Qs()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[ot,Qs]);const Zs=async()=>{var e;if("loading"===St)return;const t=(null==_t?void 0:_t.cors_enabled)??!1,s=!t,a=t;Lt.current&&clearTimeout(Lt.current),Mt.current&&clearTimeout(Mt.current),Pt.current=!1,Et(s),Tt("loading"),Lt.current=setTimeout(()=>{Pt.current||Be.current&&(Et(a),Tt("error"),Mt.current=setTimeout(()=>{Be.current&&(Tt("idle"),Et(null))},2e3))},1e4);try{const t=await b({web:{cors_enabled:s}});if(Pt.current=!0,Lt.current&&clearTimeout(Lt.current),!Be.current)return;t.success||(null==(e=t.data)?void 0:e.persisted)?(await ue(),Tt("success"),Mt.current=setTimeout(()=>{Be.current&&(Tt("idle"),Et(null))},2e3)):(Et(a),Tt("error"),Mt.current=setTimeout(()=>{Be.current&&(Tt("idle"),Et(null))},2e3))}catch{if(Pt.current=!0,Lt.current&&clearTimeout(Lt.current),!Be.current)return;Et(a),Tt("error"),Mt.current=setTimeout(()=>{Be.current&&(Tt("idle"),Et(null))},2e3)}};C.useEffect(()=>{(async()=>{Is(!0);try{const e=await y();e.success&&e.data?zs(e.data.exists):zs(!1);const t=null==_t?void 0:_t.web_path;Ps(!t||""===t)}catch{zs(!1)}finally{Is(!1)}})()},[null==_t?void 0:_t.web_path]);const ea=async e=>{var t;if("loading"!==Ds){Hs("loading");try{const s=await b({web:{web_path:e?null:"/opt/pymc_console/web/html"}});if(!Be.current)return;s.success||(null==(t=s.data)?void 0:t.persisted)?(Ps(e),Hs("success"),qs(!0),setTimeout(()=>{Be.current&&Hs("idle")},2e3)):(Hs("error"),setTimeout(()=>{Be.current&&Hs("idle")},2e3))}catch{if(!Be.current)return;Hs("error"),setTimeout(()=>{Be.current&&Hs("idle")},2e3)}}},ta=C.useCallback(async()=>{It(!0),Ht(null);try{const e=await l();zt(e.tokens||[])}catch(e){Ht(e instanceof Error?e.message:"Failed to fetch tokens")}finally{It(!1)}},[]);C.useEffect(()=>{ta()},[ta]);const sa=async()=>{if(Kt.trim()){Jt(!0),Ht(null);try{const e=await f(Kt.trim());Yt(e.token||null),qt(!1),Ut(!0),Vt(""),await ta()}catch(e){Ht(e instanceof Error?e.message:"Failed to create token")}finally{Jt(!1)}}else Ht("Token name is required")},aa=e=>e?new Date(1e3*e).toLocaleString():"Never",ra=C.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},[]),na=C.useCallback(async()=>{ns(!0),cs(null);try{const e=await c();e.success&&e.data?as(ra(e.data)):cs(e.error||"Failed to load transport keys")}catch(e){cs(e instanceof Error?e.message:"Unknown error occurred")}finally{ns(!1)}},[ra]);C.useEffect(()=>{na()},[na]);const la=C.useCallback((e,t)=>{for(const s of e){if(s.id===t)return s;if(s.children){const e=la(s.children,t);if(e)return e}}return null},[]),ca=C.useCallback(()=>{if(!ms)return;const e=la(ss,ms);return null==e?void 0:e.name},[ms,ss,la]),ia=C.useCallback(e=>{hs(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),da=async e=>{us(!0),cs(null);try{const t=await v("allow"===e);t.success?ds(e):cs(t.error||"Failed to update global flood policy")}catch(t){cs(t instanceof Error?t.message:"Failed to update global flood policy")}finally{us(!1)}},oa=async()=>{if(_s.trim()){Ls(!0),cs(null);try{const e=await N({name:_s.trim(),flood_policy:Ts,parent_id:ms??void 0});e.success?(await na(),ys(!1),Ss(""),Fs("deny")):cs(e.error||"Failed to add transport key")}catch(e){cs(e instanceof Error?e.message:"Failed to add transport key")}finally{Ls(!1)}}else cs("Key name is required")},ua=C.useCallback(()=>{if(!ms)return;const e=la(ss,ms);e&&(ws({...e}),fs(!0))},[ms,ss,la]);C.useEffect(()=>{const e=e=>{"Escape"===e.key&&(bs&&(ys(!1),Ss(""),Fs("deny")),gs&&(fs(!1),ws(null)),js&&(vs(!1),Cs(null)),Ot&&(qt(!1),Vt("")),Bt&&(Ut(!1),Yt(null)))};if(bs||gs||js||Ot||Bt)return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[bs,gs,js,Ot,Bt]);const ma=C.useCallback(()=>{if(!ms)return;const e=la(ss,ms);e&&(Cs(e),vs(!0))},[ms,ss,la]),xa=({node:e,level:t})=>{const s=ps.has(e.id),a=ms===e.id,n=e.children&&e.children.length>0,l="allow"===is;return r.jsxs("div",{children:[r.jsxs("div",{className:_("flex items-center gap-2 h-[36px] px-3 rounded-full cursor-pointer transition-colors",a?"bg-accent-primary/15":"hover:bg-white/[0.02]",l&&"opacity-50 cursor-not-allowed"),style:{marginLeft:16*t+"px"},onClick:()=>!l&&xs(e.id),children:[n?r.jsx("button",{onClick:t=>{t.stopPropagation(),ia(e.id)},className:"p-1 hover:bg-white/[0.05] rounded-full transition-colors",children:r.jsx(V,{className:_("w-3.5 h-3.5 text-text-muted transition-transform",s&&"rotate-90")})}):r.jsx("span",{className:"w-5"}),r.jsx(B,{className:"w-4 h-4 text-accent-primary flex-shrink-0"}),r.jsx("span",{className:"type-data text-text-primary flex-1 truncate",children:e.name}),r.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"})]}),n&&s&&r.jsx("div",{children:e.children.map(e=>r.jsx(xa,{node:e,level:t+1},e.id))})]})};return r.jsxs(E,{children:[r.jsx(L,{title:"Configuration",icon:r.jsx(i,{})}),r.jsxs(R,{template:"standard",children:[r.jsx(z,{span:12,md:6,children:r.jsx(M,{children:r.jsxs("div",{ref:kt,children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("h2",{className:"type-subheading text-text-primary flex items-center gap-2",children:[r.jsx(d,{className:"icon-md text-accent-primary"}),"Repeater Settings"]}),r.jsx("div",{className:"flex items-center gap-1",children:xe&&(ot?r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:Qs,disabled:"loading"===jt,className:_("p-2 rounded-lg transition-colors","loading"===jt?"text-text-muted cursor-not-allowed":"text-text-muted hover:text-accent-danger hover:bg-accent-danger/10"),title:"Cancel",children:r.jsx(o,{className:"w-4 h-4"})}),r.jsx("button",{onClick:async()=>{if("loading"!==jt){Ct.current&&clearTimeout(Ct.current),vt("loading"),wt(null);try{const e={};mt&&mt!==he&&(e.node_name=mt);const t=parseFloat(pt);isNaN(t)||t===(null==xe?void 0:xe.latitude)||(e.latitude=t);const s=parseFloat(bt);isNaN(s)||s===(null==xe?void 0:xe.longitude)||(e.longitude=s);const a=parseInt(gt);if(isNaN(a)||a===(null==xe?void 0:xe.send_advert_interval_hours)||(e.flood_advert_interval_hours=a),0===Object.keys(e).length)return wt({success:!0,message:"No changes to save"}),void vt("idle");const r=await h(e);if(!Be.current)return;if(r.success&&r.data){const e=r.data.applied.join(", ");wt({success:!0,message:`Updated: ${e}`}),await ue(),vt("success"),Ct.current=setTimeout(()=>{Be.current&&(vt("idle"),ut(!1),wt(null))},1500)}else wt({success:!1,message:r.error||"Failed to save"}),vt("error"),Ct.current=setTimeout(()=>{Be.current&&vt("idle")},2e3)}catch(e){if(!Be.current)return;wt({success:!1,message:String(e)}),vt("error"),Ct.current=setTimeout(()=>{Be.current&&vt("idle")},2e3)}}},disabled:"loading"===jt,className:_("p-2 rounded-lg transition-colors","loading"===jt?"text-accent-primary cursor-wait":"success"===jt?"text-accent-success":"error"===jt?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save changes",children:"loading"===jt?r.jsx(A,{className:"w-4 h-4 animate-spin"}):"success"===jt?r.jsx(I,{className:"w-4 h-4"}):"error"===jt?r.jsx(o,{className:"w-4 h-4"}):r.jsx(I,{className:"w-4 h-4"})})]}):r.jsx("button",{onClick:Js,className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:"Edit repeater settings",children:r.jsx(W,{className:"w-4 h-4"})}))})]}),Nt&&r.jsx("div",{className:_("text-xs mb-3 px-2 py-1.5 rounded-md",Nt.success?"text-accent-success bg-accent-success/10":"text-accent-danger bg-accent-danger/10"),children:Nt.message}),xe?r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"col-span-2",children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Node Name"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",ot?"bg-white/5":"bg-white/[0.02]"),children:ot?r.jsx("input",{type:"text",value:mt,onChange:e=>xt(e.target.value),maxLength:50,className:"w-full bg-transparent text-text-primary focus:outline-none type-data",placeholder:"Enter node name"}):r.jsx("span",{className:"type-data text-text-primary",children:he})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:ot?"Latitude (°)":"Latitude"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",ot?"bg-white/5":"bg-white/[0.02]"),children:ot?r.jsx("input",{type:"number",value:pt,onChange:e=>ht(e.target.value),step:"0.000001",min:"-90",max:"90",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):r.jsx("span",{className:"type-data text-text-primary",children:0!==xe.latitude?xe.latitude.toFixed(6):"Not set"})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:ot?"Longitude (°)":"Longitude"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",ot?"bg-white/5":"bg-white/[0.02]"),children:ot?r.jsx("input",{type:"number",value:bt,onChange:e=>yt(e.target.value),step:"0.000001",min:"-180",max:"180",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):r.jsx("span",{className:"type-data text-text-primary",children:0!==xe.longitude?xe.longitude.toFixed(6):"Not set"})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:ot?"Advert Interval (hours)":"Advert Interval"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",ot?"bg-white/5":"bg-white/[0.02]"),children:ot?r.jsx("input",{type:"number",value:gt,onChange:e=>ft(e.target.value),min:"0",max:"48",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):r.jsx("span",{className:"type-data text-text-primary",children:xe.send_advert_interval_hours>0?`${xe.send_advert_interval_hours}h`:"Disabled"})}),ot&&r.jsx("p",{className:"type-data-xs text-text-muted mt-1 ml-4",children:"0 = disabled, 3-48 hours"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Score-based TX"}),r.jsx("div",{className:"h-[38px] rounded-full px-4 flex items-center bg-white/[0.02]",children:r.jsx("span",{className:"type-data text-text-primary",children:xe.use_score_for_tx?"Enabled":"Disabled"})})]})]}):r.jsx("p",{className:"text-text-muted",children:"Loading repeater settings..."})]})})}),r.jsx(z,{span:12,md:6,children:r.jsx(M,{children:r.jsxs("div",{ref:ze,children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("h2",{className:"type-subheading text-text-primary flex items-center gap-2",children:[r.jsx($,{className:"icon-md text-accent-primary"}),"Radio Configuration"]}),r.jsx("div",{className:"flex items-center gap-1",children:me&&(fe?r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:Ys,disabled:"loading"===Le,className:_("p-2 rounded-lg transition-colors","loading"===Le?"text-text-muted cursor-not-allowed":"text-text-muted hover:text-accent-danger hover:bg-accent-danger/10"),title:"Cancel",children:r.jsx(o,{className:"w-4 h-4"})}),r.jsx("button",{onClick:async()=>{if("loading"!==Le){Ae.current&&clearTimeout(Ae.current),Me("loading"),Re(null);try{const e={},t=parseFloat(ve),s=me?me.frequency/1e6:0;Math.abs(t-s)>1e-4&&(e.frequency_mhz=t);const a=me?me.bandwidth/1e3:0;we!==a&&(e.bandwidth_khz=we),Ce!==(null==me?void 0:me.spreading_factor)&&(e.spreading_factor=Ce),Se!==(null==me?void 0:me.coding_rate)&&(e.coding_rate=Se);const r=parseInt(Fe);if(r!==(null==me?void 0:me.tx_power)&&(e.tx_power=r),0===Object.keys(e).length)return Re({success:!0,message:"No changes to save"}),void Me("idle");const n=await h(e);if(!Be.current)return;if(n.success&&n.data){const e=n.data.applied.join(", "),t=n.data.live_update?" (applied live)":" (restart required)";Re({success:!0,message:`Updated: ${e}${t}`}),await ue(),Me("success"),Ae.current=setTimeout(()=>{Be.current&&(Me("idle"),je(!1),Re(null))},1500)}else Re({success:!1,message:n.error||"Failed to save"}),Me("error"),Ae.current=setTimeout(()=>{Be.current&&Me("idle")},2e3)}catch(e){if(!Be.current)return;Re({success:!1,message:String(e)}),Me("error"),Ae.current=setTimeout(()=>{Be.current&&Me("idle")},2e3)}}},disabled:"loading"===Le||!$s,className:_("p-2 rounded-lg transition-colors","loading"===Le?"text-accent-primary cursor-wait":"success"===Le?"text-accent-success":"error"===Le?"text-accent-danger":$s?"text-accent-success hover:bg-accent-success/10":"text-text-muted cursor-not-allowed"),title:$s?"Save changes":"No changes to save",children:"loading"===Le?r.jsx(A,{className:"w-4 h-4 animate-spin"}):"success"===Le?r.jsx(I,{className:"w-4 h-4"}):"error"===Le?r.jsx(o,{className:"w-4 h-4"}):r.jsx(I,{className:"w-4 h-4"})})]}):r.jsx("button",{onClick:()=>{me&&(Ne((me.frequency/1e6).toFixed(3)),ke(me.bandwidth/1e3),_e(me.spreading_factor),Te(me.coding_rate),Ee(String(me.tx_power))),Re(null),je(!0)},className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:"Edit radio settings",children:r.jsx(W,{className:"w-4 h-4"})}))})]}),Pe&&r.jsx("div",{className:_("text-xs mb-3 px-2 py-1.5 rounded-md",Pe.success?"text-accent-success bg-accent-success/10":"text-accent-danger bg-accent-danger/10"),children:Pe.message}),me?r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:fe?"Frequency (MHz)":"Frequency"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",fe?"bg-white/5":"bg-white/[0.02]"),children:fe?r.jsx("input",{type:"number",value:ve,onChange:e=>Ne(e.target.value),step:"0.001",min:"400",max:"930",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):r.jsx("span",{className:"type-data text-text-primary",children:u(me.frequency)})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:fe?"TX Power (dBm)":"TX Power"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",fe?"bg-white/5":"bg-white/[0.02]"),children:fe?r.jsx("input",{type:"number",value:Fe,onChange:e=>Ee(e.target.value),min:"-9",max:"22",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):r.jsxs("span",{className:"type-data text-text-primary",children:[me.tx_power," dBm"]})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Bandwidth"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors relative",fe?"bg-white/5":"bg-white/[0.02]"),children:fe?r.jsxs(r.Fragment,{children:[r.jsx("select",{value:we,onChange:e=>ke(parseFloat(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=>r.jsx("option",{value:e.value,children:e.label},e.value))}),r.jsx(m,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-text-muted pointer-events-none"})]}):r.jsx("span",{className:"type-data text-text-primary",children:x(me.bandwidth)})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Spreading Factor"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors relative",fe?"bg-white/5":"bg-white/[0.02]"),children:fe?r.jsxs(r.Fragment,{children:[r.jsx("select",{value:Ce,onChange:e=>_e(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=>r.jsxs("option",{value:e,children:["SF",e]},e))}),r.jsx(m,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-text-muted pointer-events-none"})]}):r.jsxs("span",{className:"type-data text-text-primary",children:["SF",me.spreading_factor]})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Coding Rate"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors relative",fe?"bg-white/5":"bg-white/[0.02]"),children:fe?r.jsxs(r.Fragment,{children:[r.jsx("select",{value:Se,onChange:e=>Te(parseInt(e.target.value)),className:"w-full bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data pr-6",children:ae.map(e=>r.jsx("option",{value:e.value,children:e.label},e.value))}),r.jsx(m,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-text-muted pointer-events-none"})]}):r.jsxs("span",{className:"type-data text-text-primary",children:["4/",me.coding_rate]})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Preamble"}),r.jsx("div",{className:"h-[38px] rounded-full px-4 flex items-center bg-white/[0.02]",children:r.jsxs("span",{className:"type-data text-text-primary",children:[me.preamble_length," symbols"]})})]})]}):r.jsx("p",{className:"text-text-muted",children:"Loading radio configuration..."})]})})})]}),r.jsxs(R,{template:"standard",children:[r.jsx(z,{span:12,md:6,children:r.jsx(M,{children:r.jsxs("div",{ref:Ie,children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("h2",{className:"type-subheading text-text-primary flex items-center gap-3",children:[r.jsx(p,{className:"icon-md text-text-secondary"}),"Operating Mode"]}),r.jsx("div",{className:"flex items-center gap-1",children:Ze?r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:async()=>{if("loading"!==ct){dt.current&&clearTimeout(dt.current),it("loading");try{const e=await h({tx_delay_factor:parseFloat(tt),direct_tx_delay_factor:parseFloat(at)});if(await de({max_airtime_percent:parseFloat(nt),enforcement_enabled:ye}),!Be.current)return;e.success&&e.data?(await ue(),it("success"),dt.current=setTimeout(()=>{Be.current&&(it("idle"),et(!1))},1500)):(it("error"),dt.current=setTimeout(()=>{Be.current&&it("idle")},2e3))}catch{if(!Be.current)return;it("error"),dt.current=setTimeout(()=>{Be.current&&it("idle")},2e3)}}},disabled:"loading"===ct,className:_("p-2 rounded-lg transition-colors","loading"===ct?"text-accent-primary cursor-wait":"success"===ct?"text-accent-success":"error"===ct?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save",children:"loading"===ct?r.jsx(A,{className:"w-4 h-4 animate-spin"}):"success"===ct?r.jsx(I,{className:"w-4 h-4"}):"error"===ct?r.jsx(o,{className:"w-4 h-4"}):r.jsx(I,{className:"w-4 h-4"})}),r.jsx("button",{onClick:Ws,className:"p-2 rounded-lg text-text-muted hover:text-accent-danger hover:bg-accent-danger/10",title:"Cancel",children:r.jsx(o,{className:"w-4 h-4"})})]}):r.jsx("button",{onClick:Gs,className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:"Edit settings",children:r.jsx(W,{className:"w-4 h-4"})})})]}),r.jsx("p",{className:"type-label text-text-muted mb-3",children:"Control how the repeater handles packets"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"flex-1 space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("label",{className:"type-label text-text-muted",children:"Repeat"}),r.jsx("div",{className:"flex items-center gap-2",children:(()=>{const e=null!==Ke?Ke:"forward"===be;return r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:async()=>{if("loading"===De)return;const t=!e,s="forward"===be;Ue.current&&clearTimeout(Ue.current),Xe.current&&clearTimeout(Xe.current),Je.current=!1,Ve(t),He("loading"),Ue.current=setTimeout(()=>{Je.current||Be.current&&(Ve(s),He("error"),Xe.current=setTimeout(()=>{Be.current&&(He("idle"),Ve(null))},2e3))},1e4);try{if(await ce(t?"forward":"monitor"),Je.current=!0,Ue.current&&clearTimeout(Ue.current),!Be.current)return;He("success"),Xe.current=setTimeout(()=>{Be.current&&(He("idle"),Ve(null),ie())},2e3)}catch{if(Je.current=!0,Ue.current&&clearTimeout(Ue.current),!Be.current)return;Ve(s),He("error"),Xe.current=setTimeout(()=>{Be.current&&(He("idle"),Ve(null))},2e3)}},disabled:"loading"===De,className:_("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2",e?"bg-accent-success border-accent-success":"bg-bg-elevated border-border-subtle","loading"===De&&"opacity-70"),"aria-label":"Toggle forward mode",children:r.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")})}),r.jsx("span",{className:_("type-data text-sm w-7",e?"text-accent-success":"text-text-muted"),children:e?"On":"Off"}),"loading"===De&&r.jsx(A,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===De&&r.jsx(I,{className:"w-4 h-4 text-accent-success"}),"error"===De&&r.jsx(o,{className:"w-4 h-4 text-accent-danger"})]})})()})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("label",{className:"type-label text-text-muted",children:"Duty Cycle"}),r.jsx("div",{className:"flex items-center gap-2",children:(()=>{const e=null!==$e?$e:ye;return r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:async()=>{if("loading"===Oe)return;const t=!e,s=ye;Ge.current&&clearTimeout(Ge.current),We.current&&clearTimeout(We.current),Qe.current=!1,Ye(t),qe("loading"),Ge.current=setTimeout(()=>{Qe.current||Be.current&&(Ye(s),qe("error"),We.current=setTimeout(()=>{Be.current&&(qe("idle"),Ye(null))},2e3))},1e4);try{if(await de({max_airtime_percent:Xs(),enforcement_enabled:t}),Qe.current=!0,Ge.current&&clearTimeout(Ge.current),!Be.current)return;qe("success"),We.current=setTimeout(()=>{Be.current&&(qe("idle"),Ye(null),oe())},2e3)}catch{if(Qe.current=!0,Ge.current&&clearTimeout(Ge.current),!Be.current)return;Ye(s),qe("error"),We.current=setTimeout(()=>{Be.current&&(qe("idle"),Ye(null))},2e3)}},disabled:"loading"===Oe,className:_("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2",e?"bg-accent-success border-accent-success":"bg-bg-elevated border-border-subtle","loading"===Oe&&"opacity-70"),"aria-label":"Toggle duty cycle",children:r.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")})}),r.jsx("span",{className:_("type-data text-sm w-7",e?"text-accent-success":"text-text-muted"),children:e?"On":"Off"}),"loading"===Oe&&r.jsx(A,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===Oe&&r.jsx(I,{className:"w-4 h-4 text-accent-success"}),"error"===Oe&&r.jsx(o,{className:"w-4 h-4 text-accent-danger"})]})})()})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("label",{className:"type-label text-text-muted",children:"Max Airtime"}),r.jsx("div",{className:_("h-[32px] rounded-full px-3 flex items-center justify-end transition-colors min-w-[80px]",Ze?"bg-white/5":"bg-white/[0.02]"),children:Ze?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("input",{type:"number",value:nt,onChange:e=>lt(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"}),r.jsx("span",{className:"text-text-muted type-data",children:"%"})]}):r.jsxs("span",{className:"type-data text-text-primary",children:[Xs().toFixed(1),"%"]})})]})]}),r.jsx("div",{className:"hidden sm:block w-px bg-border-subtle"}),r.jsxs("div",{className:"flex-1 pt-4 sm:pt-0 border-t sm:border-t-0 border-border-subtle",children:[r.jsx("label",{className:"type-label text-text-muted block mb-3",children:"TX Delays"}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"type-label text-text-muted",children:"Flood"}),r.jsx("div",{className:_("h-[32px] rounded-full px-3 flex items-center justify-end transition-colors min-w-[80px]",Ze?"bg-white/5":"bg-white/[0.02]"),children:Ze?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("input",{type:"number",value:tt,onChange:e=>st(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"}),r.jsx("span",{className:"text-text-muted type-data",children:"x"})]}):r.jsxs("span",{className:"type-data text-text-primary",children:[Bs().toFixed(2),"x"]})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"type-label text-text-muted",children:"Direct"}),r.jsx("div",{className:_("h-[32px] rounded-full px-3 flex items-center justify-end transition-colors min-w-[80px]",Ze?"bg-white/5":"bg-white/[0.02]"),children:Ze?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("input",{type:"number",value:at,onChange:e=>rt(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"}),r.jsx("span",{className:"text-text-muted type-data",children:"s"})]}):r.jsxs("span",{className:"type-data text-text-primary",children:[Us().toFixed(2),"s"]})})]})]})]})]})]})})}),r.jsx(z,{span:12,md:6,children:r.jsxs(M,{children:[r.jsx(P,{icon:r.jsx(i,{}),title:"App Settings",largeTitle:!0}),r.jsx("p",{className:"type-body-sm text-text-muted mb-4",children:"Appearance and web server options."}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{children:[r.jsx("span",{className:"type-body text-text-primary font-medium block",children:"Enable CORS"}),r.jsx("span",{className:"type-body-sm text-text-muted",children:"Allow cross-origin API access"})]}),r.jsx("div",{className:"flex items-center gap-2",children:(()=>{const e=null!==Ft?Ft:(null==_t?void 0:_t.cors_enabled)??!1;return r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:Zs,disabled:"loading"===St,className:_("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2",e?"bg-accent-primary border-accent-primary":"bg-bg-elevated border-border-subtle","loading"===St&&"opacity-70"),title:e?"Disable CORS":"Enable CORS",children:r.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"===St&&r.jsx(A,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===St&&r.jsx(I,{className:"w-4 h-4 text-accent-success"}),"error"===St&&r.jsx(o,{className:"w-4 h-4 text-accent-danger"})]})})()})]}),r.jsxs("div",{children:[r.jsx("span",{className:"type-body text-text-primary font-medium block mb-2",children:"Theme"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsx(ee,{showLogoOnly:!0})}),r.jsx("div",{className:"flex-shrink-0",children:r.jsx(ee,{showThumbnailsOnly:!0})})]})]})]})]})})]}),r.jsx(R,{template:"auto",children:r.jsxs(M,{children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[r.jsxs("div",{children:[r.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[r.jsx(U,{className:"icon-md text-accent-primary"}),"Regions / Transport Keys"]}),r.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Manage regional key hierarchy for flood control"})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs("button",{onClick:()=>ys(!0),disabled:"allow"===is,className:_("flex items-center gap-1.5 h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium","allow"===is?"bg-white/[0.02] text-text-muted cursor-not-allowed":"bg-accent-success/10 hover:bg-accent-success/20 text-accent-success"),children:[r.jsx(J,{className:"w-3.5 h-3.5"}),"Add"]}),r.jsx("button",{onClick:ua,disabled:!ms||"allow"===is,className:_("h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium",ms&&"allow"!==is?"bg-accent-primary/10 hover:bg-accent-primary/20 text-accent-primary":"bg-white/[0.02] text-text-muted cursor-not-allowed"),children:"Edit"}),r.jsx("button",{onClick:ma,disabled:!ms||"allow"===is,className:_("h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium",ms&&"allow"!==is?"bg-accent-danger/10 hover:bg-accent-danger/20 text-accent-danger":"bg-white/[0.02] text-text-muted cursor-not-allowed"),children:"Delete"})]})]}),r.jsx("div",{className:"bg-white/[0.02] rounded-2xl p-4 mb-4",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:_("w-10 h-10 rounded-full flex items-center justify-center","allow"===is?"bg-accent-success/20":"bg-accent-danger/20"),children:"allow"===is?r.jsx(Q,{className:"w-5 h-5 text-accent-success"}):r.jsx(Z,{className:"w-5 h-5 text-accent-danger"})}),r.jsxs("div",{children:[r.jsx("h4",{className:"type-body text-text-primary font-medium",children:"Global Flood Policy"}),r.jsx("p",{className:"type-body-sm text-text-muted",children:"Master control for repeater flooding"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"flex bg-white/[0.02] rounded-full p-1",children:[r.jsx("button",{onClick:()=>da("deny"),disabled:os,className:_("px-4 py-1.5 rounded-full transition-colors type-body-sm font-medium","deny"===is?"bg-accent-danger/20 text-accent-danger":"text-text-muted hover:text-text-secondary",os&&"opacity-50"),children:"Deny"}),r.jsx("button",{onClick:()=>da("allow"),disabled:os,className:_("px-4 py-1.5 rounded-full transition-colors type-body-sm font-medium","allow"===is?"bg-accent-success/20 text-accent-success":"text-text-muted hover:text-text-secondary",os&&"opacity-50"),children:"Allow"})]}),os&&r.jsx(A,{className:"w-4 h-4 animate-spin text-text-muted"})]})]})}),ls&&r.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-accent-danger bg-accent-danger/10",children:ls}),r.jsx("div",{className:"bg-white/[0.02] rounded-2xl p-4 min-h-[120px]",children:rs?r.jsxs("div",{className:"flex items-center justify-center py-6",children:[r.jsx(A,{className:"w-5 h-5 animate-spin text-accent-primary mr-2"}),r.jsx("span",{className:"type-body-sm text-text-muted",children:"Loading transport keys..."})]}):0===ss.length?r.jsxs("div",{className:"text-center py-6",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-white/[0.02] mx-auto mb-3 flex items-center justify-center",children:r.jsx(U,{className:"w-6 h-6 text-text-muted/50"})}),r.jsx("p",{className:"type-body text-text-muted",children:"No transport keys found"}),r.jsx("p",{className:"type-body-sm text-text-muted/70 mt-1",children:"Add your first transport key to get started"})]}):r.jsx("div",{className:"space-y-1",children:ss.map(e=>r.jsx(xa,{node:e,level:0},e.id))})})]})}),r.jsx(R,{template:"auto",children:r.jsxs(M,{children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[r.jsxs("div",{children:[r.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[r.jsx(X,{className:"icon-md text-accent-primary"}),"API Tokens"]}),r.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Manage API tokens for machine-to-machine authentication"})]}),r.jsxs("button",{onClick:()=>qt(!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:[r.jsx(J,{className:"w-4 h-4"}),"Create Token"]})]}),r.jsx("div",{className:"bg-accent-tertiary/5 rounded-2xl p-4 mb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-full bg-accent-tertiary/20 flex items-center justify-center flex-shrink-0",children:r.jsx(O,{className:"w-4 h-4 text-accent-tertiary"})}),r.jsxs("div",{className:"type-body-sm text-text-muted",children:[r.jsxs("p",{children:[r.jsx("span",{className:"text-text-secondary",children:"API tokens"})," are used for machine-to-machine authentication. Include the token in the ",r.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."]}),r.jsx("p",{className:"mt-1 text-text-muted/70",children:"Tokens are only shown once at creation. Store them securely."})]})]})}),Dt&&r.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-accent-danger bg-accent-danger/10",children:Dt}),At&&0===Rt.length?r.jsxs("div",{className:"flex items-center justify-center py-6",children:[r.jsx(A,{className:"w-5 h-5 animate-spin text-accent-primary mr-2"}),r.jsx("span",{className:"type-body-sm text-text-muted",children:"Loading tokens..."})]}):Rt.length>0?r.jsx("div",{className:"space-y-2",children:Rt.map(e=>r.jsx("div",{className:"bg-white/[0.02] hover:bg-white/[0.04] rounded-2xl p-4 transition-colors",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[r.jsx("div",{className:"w-10 h-10 rounded-full bg-accent-primary/10 flex items-center justify-center flex-shrink-0",children:r.jsx(X,{className:"w-5 h-5 text-accent-primary"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h3",{className:"type-body text-text-primary font-medium truncate",children:e.name}),r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:gap-4 mt-0.5",children:[r.jsxs("span",{className:"type-data-sm text-text-muted truncate",children:["Created: ",aa(e.created_at)]}),r.jsxs("span",{className:"type-data-sm text-text-muted truncate",children:["Last used: ",aa(e.last_used)]})]})]})]}),r.jsxs("button",{onClick:()=>Gt({id:e.id,name:e.name}),disabled:Qt,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:[r.jsx(T,{className:"w-3.5 h-3.5"}),"Revoke"]})]})},e.id))}):r.jsxs("div",{className:"bg-white/[0.02] rounded-2xl p-6 text-center",children:[r.jsx("div",{className:"w-14 h-14 rounded-full bg-white/[0.02] mx-auto mb-4 flex items-center justify-center",children:r.jsx(X,{className:"w-7 h-7 text-text-muted/50"})}),r.jsx("h3",{className:"type-body text-text-primary font-medium mb-1",children:"No API Tokens"}),r.jsx("p",{className:"type-body-sm text-text-muted mb-4",children:"Create a token to enable API access"}),r.jsx("button",{onClick:()=>qt(!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"})]})]})}),r.jsx(R,{template:"auto",children:r.jsxs(M,{children:[r.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:r.jsxs("div",{children:[r.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[r.jsx(G,{className:"icon-md text-accent-primary"}),"Web Frontend"]}),r.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Choose which web interface to use"})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.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"===Ds&&"opacity-50 pointer-events-none"),children:[r.jsx("input",{type:"radio",name:"frontend",checked:Ms,onChange:()=>ea(!0),disabled:"loading"===Ds,className:"mt-1 h-4 w-4 text-accent-primary focus:ring-accent-primary focus:ring-offset-bg-elevated"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{className:"type-body text-text-primary font-medium",children:"Default Frontend"}),r.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"})]}),r.jsx("div",{className:"type-body-sm text-text-muted mt-1",children:"Built-in pyMC Repeater web interface"}),r.jsx("div",{className:"type-data-xs text-text-muted/60 mt-1 font-mono",children:"/opt/pymc_repeater/repeater/web/html"})]})]}),r.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"===Ds&&"opacity-50 pointer-events-none"),children:[r.jsx("input",{type:"radio",name:"frontend",checked:!Ms,onChange:()=>ea(!1),disabled:"loading"===Ds,className:"mt-1 h-4 w-4 text-accent-primary focus:ring-accent-primary focus:ring-offset-bg-elevated"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{className:"type-body text-text-primary font-medium",children:"PyMC Console"}),r.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 ⚡"})]}),r.jsx("div",{className:"type-body-sm text-text-muted mt-1",children:"Alternative web interface for pyMC Repeater"}),r.jsx("div",{className:"type-data-xs text-text-muted/60 mt-1 font-mono",children:"/opt/pymc_console/web/html"})]})]})]}),!As&&r.jsx("div",{className:_("bg-white/[0.02] rounded-2xl p-4",Rs?"border border-accent-success/20":"border border-accent-tertiary/20"),children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:_("w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0",Rs?"bg-accent-success/20":"bg-accent-tertiary/20"),children:Rs?r.jsx(Y,{className:"w-4 h-4 text-accent-success"}):r.jsx(O,{className:"w-4 h-4 text-accent-tertiary"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h4",{className:"type-body text-text-primary font-medium",children:Rs?"PyMC Console has been detected":"PyMC Console Not Installed"}),Rs?r.jsxs("p",{className:"type-body-sm text-text-muted mt-1",children:["PyMC Console is installed at ",r.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"})]}):r.jsxs(r.Fragment,{children:[r.jsxs("p",{className:"type-body-sm text-text-muted mt-1 mb-3",children:["PyMC Console must be installed at ",r.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."]}),r.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:[r.jsx(q,{className:"w-4 h-4"}),"PyMC Console Install Instructions"]})]})]})]})}),Os&&r.jsx("div",{className:"bg-white/[0.02] rounded-2xl p-4 border border-accent-secondary/30",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[r.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[r.jsx("div",{className:"w-8 h-8 rounded-full bg-accent-secondary/20 flex items-center justify-center flex-shrink-0",children:r.jsx(D,{className:"w-4 h-4 text-accent-secondary"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h4",{className:"type-body text-text-primary font-medium",children:"Service restart required"}),r.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Web frontend changes will take effect after restarting the pymc-repeater service."})]})]}),r.jsx("button",{onClick:async()=>{if(!Ks){Vs(!0);try{await g(),qs(!1),setTimeout(()=>{window.location.reload()},2e3)}catch{qs(!1),setTimeout(()=>{window.location.reload()},3e3)}}},disabled:Ks,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:Ks?r.jsxs(r.Fragment,{children:[r.jsx(A,{className:"w-4 h-4 animate-spin"}),"Restarting..."]}):r.jsxs(r.Fragment,{children:[r.jsx(K,{className:"w-4 h-4"}),"Restart Now"]})})]})})]})]})}),r.jsx(R,{template:"auto",children:r.jsxs(M,{children:[r.jsx(P,{icon:r.jsx(p,{}),title:"Node Information",largeTitle:!0}),le?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[r.jsxs("div",{children:[r.jsx("span",{className:"type-label text-text-muted",children:"Node Name"}),r.jsx("p",{className:"type-body text-text-primary mt-1",children:he})]}),r.jsxs("div",{children:[r.jsx("span",{className:"type-label text-text-muted",children:"Version"}),r.jsxs("p",{className:"type-data text-text-primary mt-1",children:["v",le.version]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"type-label text-text-muted",children:"Core Version"}),r.jsxs("p",{className:"type-data text-text-primary mt-1",children:["v",le.core_version]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"type-label text-text-muted",children:"Local Hash"}),r.jsx("div",{className:"mt-1",children:le.local_hash?r.jsx(S,{hash:le.local_hash,size:"sm"}):r.jsx("span",{className:"type-data-sm text-text-muted",children:"N/A"})})]})]}),le.public_key&&r.jsxs("div",{className:"mt-4 pt-4 border-t border-border-subtle",children:[r.jsx("span",{className:"type-label text-text-muted",children:"Public Key"}),r.jsx("div",{className:"mt-1",children:r.jsx(S,{hash:le.public_key,prefixLength:12,suffixLength:8})})]})]}):r.jsx("p",{className:"text-text-muted",children:"Loading node information..."})]})}),Ot&&r.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&&qt(!1),role:"dialog","aria-modal":"true","aria-labelledby":"create-token-modal-title",children:r.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[r.jsx("h3",{id:"create-token-modal-title",className:"type-subheading text-text-primary mb-4",children:"Create API Token"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Token Name"}),r.jsx("input",{type:"text",value:Kt,onChange:e=>Vt(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&&sa(),autoFocus:!0}),r.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Give your token a descriptive name to identify its purpose"})]}),r.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[r.jsx("button",{onClick:()=>{qt(!1),Vt(""),Ht(null)},disabled:Wt,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"}),r.jsx("button",{onClick:sa,disabled:Wt||!Kt.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:Wt?r.jsxs(r.Fragment,{children:[r.jsx(A,{className:"w-4 h-4 animate-spin"}),"Creating..."]}):"Create Token"})]})]})]})}),Bt&&$t&&r.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&&Ut(!1),role:"dialog","aria-modal":"true","aria-labelledby":"show-token-modal-title",children:r.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-lg w-full shadow-2xl",children:[r.jsx("h3",{id:"show-token-modal-title",className:"type-subheading text-text-primary mb-4",children:"Token Created Successfully"}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"bg-accent-secondary/10 border border-accent-secondary/30 rounded-lg p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx(D,{className:"w-4 h-4 text-accent-secondary flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"text-sm text-text-secondary",children:[r.jsx("strong",{children:"Save this token now!"})," For security reasons, it will not be shown again."]})]})}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Your API Token"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{value:$t,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"}),r.jsxs("button",{onClick:()=>{$t&&(navigator.clipboard.writeText($t),ts(!0),setTimeout(()=>ts(!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:[es?r.jsx(I,{className:"w-4 h-4 text-accent-success"}):r.jsx(H,{className:"w-4 h-4"}),es?"Copied!":"Copy"]})]})]}),r.jsxs("div",{className:"bg-accent-tertiary/10 border border-accent-tertiary/30 rounded-lg p-3",children:[r.jsx("p",{className:"text-sm text-text-secondary mb-2",children:r.jsx("strong",{children:"Usage Example:"})}),r.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: ',$t.slice(0,12),'..." ',window.location.origin,"/api/stats"]})]}),r.jsx("div",{className:"flex justify-end mt-6",children:r.jsx("button",{onClick:()=>{Ut(!1),Yt(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"})})]})]})}),r.jsx(F,{isOpen:!!Xt,title:"Revoke API Token",message:`Are you sure you want to revoke the token '${null==Xt?void 0:Xt.name}'? This action cannot be undone.`,confirmLabel:Qt?"Revoking...":"Revoke",cancelLabel:"Cancel",variant:"danger",onConfirm:async()=>{if(Xt){Zt(!0),Ht(null);try{await j(Xt.id),await ta(),Gt(null)}catch(e){Ht(e instanceof Error?e.message:"Failed to revoke token")}finally{Zt(!1)}}},onCancel:()=>Gt(null)}),bs&&r.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&ys(!1),role:"dialog","aria-modal":"true","aria-labelledby":"add-key-modal-title",children:r.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[r.jsx("h3",{id:"add-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Add Transport Key"}),r.jsxs("div",{className:"space-y-4",children:[ms&&r.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: ",r.jsx("strong",{className:"text-text-primary",children:ca()})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Key Name"}),r.jsx("input",{type:"text",value:_s,onChange:e=>Ss(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&&oa(),autoFocus:!0})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Flood Policy"}),r.jsxs("div",{className:"flex bg-bg-subtle rounded-lg border border-border-subtle p-1",children:[r.jsx("button",{onClick:()=>Fs("deny"),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","deny"===Ts?"bg-accent-danger/20 text-accent-danger border border-accent-danger/50":"text-text-muted hover:text-text-secondary"),children:"DENY"}),r.jsx("button",{onClick:()=>Fs("allow"),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","allow"===Ts?"bg-accent-success/20 text-accent-success border border-accent-success/50":"text-text-muted hover:text-text-secondary"),children:"ALLOW"})]})]}),r.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[r.jsx("button",{onClick:()=>{ys(!1),Ss(""),Fs("deny")},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"}),r.jsx("button",{onClick:oa,disabled:Es||!_s.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?r.jsxs(r.Fragment,{children:[r.jsx(A,{className:"w-4 h-4 animate-spin"}),"Adding..."]}):"Add Key"})]})]})]})}),gs&&Ns&&r.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&&fs(!1),role:"dialog","aria-modal":"true","aria-labelledby":"edit-key-modal-title",children:r.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[r.jsx("h3",{id:"edit-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Edit Transport Key"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Key Name"}),r.jsx("input",{type:"text",value:Ns.name,onChange:e=>ws({...Ns,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})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Flood Policy"}),r.jsxs("div",{className:"flex bg-bg-subtle rounded-lg border border-border-subtle p-1",children:[r.jsx("button",{onClick:()=>ws({...Ns,floodPolicy:"deny"}),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","deny"===Ns.floodPolicy?"bg-accent-danger/20 text-accent-danger border border-accent-danger/50":"text-text-muted hover:text-text-secondary"),children:"DENY"}),r.jsx("button",{onClick:()=>ws({...Ns,floodPolicy:"allow"}),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","allow"===Ns.floodPolicy?"bg-accent-success/20 text-accent-success border border-accent-success/50":"text-text-muted hover:text-text-secondary"),children:"ALLOW"})]})]}),Ns.transport_key&&r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Transport Key"}),r.jsx("code",{className:"block bg-bg-subtle px-3 py-2 rounded-lg text-xs text-text-muted font-mono overflow-x-auto",children:Ns.transport_key})]}),r.jsxs("div",{className:"flex justify-between gap-3 mt-6",children:[r.jsx("button",{onClick:()=>{fs(!1),Cs(Ns),vs(!0),ws(null)},disabled:Es,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"}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("button",{onClick:()=>{fs(!1),ws(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"}),r.jsx("button",{onClick:async()=>{if(Ns){Ls(!0),cs(null);try{const e=await w(Ns.id,{name:Ns.name,flood_policy:Ns.floodPolicy});e.success?(await na(),fs(!1),ws(null)):cs(e.error||"Failed to update transport key")}catch(e){cs(e instanceof Error?e.message:"Failed to update transport key")}finally{Ls(!1)}}},disabled:Es||!Ns.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:Es?r.jsxs(r.Fragment,{children:[r.jsx(A,{className:"w-4 h-4 animate-spin"}),"Saving..."]}):"Save"})]})]})]})]})}),js&&ks&&r.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":"delete-key-modal-title",children:r.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[r.jsx("h3",{id:"delete-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Delete Transport Key"}),r.jsxs("p",{className:"text-text-secondary mb-4",children:["Are you sure you want to delete ",r.jsxs("strong",{className:"text-text-primary",children:["'",ks.name,"'"]}),"?"]}),ks.children&&ks.children.length>0&&r.jsx("div",{className:"bg-accent-secondary/10 border border-accent-secondary/30 rounded-lg p-3 mb-4",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx(D,{className:"w-4 h-4 text-accent-secondary flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"text-sm text-text-secondary",children:["This key has ",ks.children.length," child key(s). Deleting will also remove all children."]})]})}),r.jsxs("div",{className:"flex justify-end gap-3",children:[r.jsx("button",{onClick:()=>{vs(!1),Cs(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"}),r.jsx("button",{onClick:async()=>{if(ks){Ls(!0),cs(null);try{const e=await k(ks.id);e.success?(await na(),vs(!1),Cs(null),xs(null)):cs(e.error||"Failed to delete transport key")}catch(e){cs(e instanceof Error?e.message:"Failed to delete transport key")}finally{Ls(!1)}}},disabled:Es,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:Es?r.jsxs(r.Fragment,{children:[r.jsx(A,{className:"w-4 h-4 animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})}export{re as default}; diff --git a/frontend/dist/assets/Configuration-DR1y-HDf.js b/frontend/dist/assets/Configuration-DR1y-HDf.js new file mode 100644 index 00000000..e0031a58 --- /dev/null +++ b/frontend/dist/assets/Configuration-DR1y-HDf.js @@ -0,0 +1 @@ +import{c as e,ae as t,af as s,ag as a,j as r,J as n,ah as l,ai as c,aj as i,ak as d,X as o,al as u,E as m,am as x,R as p,ac as h,an as b,ao as y,ap as g,aq as f,ar as j,as as v,at as N,au as w,av as k}from"./index-B-2Jxr7j.js";import{b as C,c as _}from"./recharts-bmHCCfxU.js";import{H as S}from"./HashBadge-DctM4L1c.js";import{T,C as F}from"./ConfirmModal-B3N0K8V1.js";import{P as E,a as L,C as M,b as P}from"./PageLayout-CdW7LNwg.js";import{R,C as A}from"./Grid-CWMN38GB.js";import{L as z}from"./loader-circle-CpgDoVxS.js";import{a as I,T as D,C as H}from"./triangle-alert-DgnBDldk.js";import{I as O}from"./info-DsmVqi2a.js";import{E as q}from"./external-link-CBYhc14a.js";import{R as K}from"./refresh-cw-CaoPFM1D.js";import{C as V}from"./chevron-right-DEYpbtQc.js";import"./maplibre-gl-CFO9X1Ek.js";const $=e("antenna",[["path",{d:"M2 12 7 2",key:"117k30"}],["path",{d:"m7 12 5-10",key:"1tvx22"}],["path",{d:"m12 12 5-10",key:"ev1o1a"}],["path",{d:"m17 12 5-10",key:"1e4ti3"}],["path",{d:"M4.5 7h15",key:"vlsxkz"}],["path",{d:"M12 16v6",key:"c8a4gj"}]]),Y=e("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),B=e("folder-key",[["circle",{cx:"16",cy:"20",r:"2",key:"1vifvg"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2",key:"3hgo9p"}],["path",{d:"m22 14-4.5 4.5",key:"1ef6z8"}],["path",{d:"m21 15 1 1",key:"1ejcpy"}]]),U=e("folder-lock",[["rect",{width:"8",height:"5",x:"14",y:"17",rx:"1",key:"19aais"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2.5",key:"1w6v7t"}],["path",{d:"M20 17v-2a2 2 0 1 0-4 0v2",key:"pwaxnr"}]]),X=e("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]),G=e("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),W=e("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),J=e("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),Q=e("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Z=e("shield-x",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]),ee=C.memo(function({showLogoOnly:e=!1,showThumbnailsOnly:n=!1}){const{theme:l,setThemePreset:c,setBrightness:i}=t(),{backgroundImage:d,brightness:o}=l,[u,m]=C.useState(!1),[x,p]=C.useState(!1),h=C.useRef(null),b=C.useRef(null),y=s.find(e=>e.backgroundImage===d)??s[0],g=y.id,f=C.useCallback((e,t)=>{if(!b.current)return o;const s=(b.current.y-e)/(t?200:80)*100;return Math.round(Math.max(0,Math.min(100,b.current.brightness+s)))},[o]),j=C.useCallback(e=>{c(e),m(!0)},[c]),v=C.useCallback(e=>{i(e)},[i]),N=C.useCallback(e=>{const t=s.find(t=>t.id===e);t&&a(t.backgroundImage)},[]);if(e){const e=y.displaySize,t=`clamp(${.8*e}rem, ${.6*e}rem + 1.5vw, ${1.4*e}rem)`;return r.jsx("span",{className:"font-medium transition-all duration-300 leading-none",style:{fontFamily:y.displayFont,color:y.displayColor,fontSize:t,fontOpticalSizing:"auto",letterSpacing:"-0.03em"},children:y.displayName})}return r.jsx("div",{className:"flex gap-2 items-start flex-shrink-0",children:s.map(e=>{const t=g===e.id,s=t&&(u||x);return r.jsxs("div",{ref:t?h:void 0,title:e.displayName,className:_("flex flex-col items-center gap-1 p-0.5 rounded-sm transition-all duration-300 ease-out",t?"ring-2 ring-accent-primary scale-105 cursor-ns-resize":"cursor-pointer"),onMouseEnter:()=>{t?m(!0):N(e.id)},onMouseLeave:()=>!x&&m(!1),onClick:()=>!t&&j(e.id),onTouchStart:e=>{if(!t)return;e.preventDefault();const s=e.touches[0];b.current={y:s.clientY,brightness:o},p(!0),m(!0);const a=e=>{e.preventDefault();const t=e.touches[0];v(f(t.clientY,!0))},r=()=>{document.removeEventListener("touchmove",a),document.removeEventListener("touchend",r),b.current=null,p(!1),setTimeout(()=>m(!1),1500)};document.addEventListener("touchmove",a,{passive:!1}),document.addEventListener("touchend",r)},onMouseDown:e=>{if(!t)return;e.preventDefault(),b.current={y:e.clientY,brightness:o},p(!0),m(!0);const s=e=>{v(f(e.clientY,!1))},a=()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",a),b.current=null,p(!1)};document.addEventListener("mousemove",s),document.addEventListener("mouseup",a)},children:[r.jsxs("div",{className:"glass-thumbnail w-10 h-10",children:[r.jsx("div",{className:"absolute bg-cover bg-center transition-opacity duration-200",style:{inset:0,backgroundImage:`url(${e.backgroundImage})`,opacity:s?.4:1}}),t&&r.jsxs("div",{className:_("absolute inset-0 transition-opacity duration-200",s?"opacity-100":"opacity-0"),children:[r.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-black/70 transition-all duration-100 ease-out",style:{height:100-o+"%"}}),r.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-o+"%"}}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:r.jsxs("span",{className:"text-[10px] font-mono font-bold text-white drop-shadow-lg",children:[o,"%"]})})]})]}),r.jsx("div",{className:"flex flex-col gap-0.5",children:e.paletteColors.map((e,t)=>r.jsx("div",{className:"flex gap-0.5 justify-center",children:e.map((e,t)=>r.jsx("div",{className:"w-1.5 h-1.5 rounded-xs",style:{backgroundColor:e}},t))},t))})]},e.id)})})}),te=[{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"}],se=[5,6,7,8,9,10,11,12],ae=[{value:5,label:"4/5"},{value:6,label:"4/6"},{value:7,label:"4/7"},{value:8,label:"4/8"}];function re(){var e,t,s,a,re,ne;const{stats:le,setMode:ce,clearModeMutation:ie,setDutyCycleConfig:de,clearDutyCycleMutation:oe,fetchStats:ue}=n(),me=null==(e=null==le?void 0:le.config)?void 0:e.radio,xe=null==(t=null==le?void 0:le.config)?void 0:t.repeater,pe=null==(s=null==le?void 0:le.config)?void 0:s.duty_cycle,he=(null==le?void 0:le.node_name)||(null==(a=null==le?void 0:le.config)?void 0:a.node_name)||"Unknown Node",be=(null==xe?void 0:xe.mode)??"forward",ye=(null==pe?void 0:pe.enforcement_enabled)??!1,ge=null==(re=null==le?void 0:le.config)?void 0:re.delays,[fe,je]=C.useState(!1),[ve,Ne]=C.useState(""),[we,ke]=C.useState(62.5),[Ce,_e]=C.useState(7),[Se,Te]=C.useState(5),[Fe,Ee]=C.useState(""),[Le,Me]=C.useState("idle"),[Pe,Re]=C.useState(null),Ae=C.useRef(null),ze=C.useRef(null),Ie=C.useRef(null),[De,He]=C.useState("idle"),[Oe,qe]=C.useState("idle"),[Ke,Ve]=C.useState(null),[$e,Ye]=C.useState(null),Be=C.useRef(!0),Ue=C.useRef(null),Xe=C.useRef(null),Ge=C.useRef(null),We=C.useRef(null),Je=C.useRef(!1),Qe=C.useRef(!1);C.useEffect(()=>(Be.current=!0,()=>{Be.current=!1,Ue.current&&clearTimeout(Ue.current),Xe.current&&clearTimeout(Xe.current),Ge.current&&clearTimeout(Ge.current),We.current&&clearTimeout(We.current),Lt.current&&clearTimeout(Lt.current),Mt.current&&clearTimeout(Mt.current),ze.current&&clearTimeout(ze.current),dt.current&&clearTimeout(dt.current),Ct.current&&clearTimeout(Ct.current)}),[]);const[Ze,et]=C.useState(!1),[tt,st]=C.useState(""),[at,rt]=C.useState(""),[nt,lt]=C.useState(""),[ct,it]=C.useState("idle"),dt=C.useRef(null),[ot,ut]=C.useState(!1),[mt,xt]=C.useState(""),[pt,ht]=C.useState(""),[bt,yt]=C.useState(""),[gt,ft]=C.useState(""),[jt,vt]=C.useState("idle"),[Nt,wt]=C.useState(null),kt=C.useRef(null),Ct=C.useRef(null),_t=null==(ne=null==le?void 0:le.config)?void 0:ne.web,[St,Tt]=C.useState("idle"),[Ft,Et]=C.useState(null),Lt=C.useRef(null),Mt=C.useRef(null),Pt=C.useRef(!1),[Rt,At]=C.useState([]),[zt,It]=C.useState(!1),[Dt,Ht]=C.useState(null),[Ot,qt]=C.useState(!1),[Kt,Vt]=C.useState(""),[$t,Yt]=C.useState(null),[Bt,Ut]=C.useState(!1),[Xt,Gt]=C.useState(null),[Wt,Jt]=C.useState(!1),[Qt,Zt]=C.useState(!1),[es,ts]=C.useState(!1),[ss,as]=C.useState([]),[rs,ns]=C.useState(!1),[ls,cs]=C.useState(null),[is,ds]=C.useState("deny"),[os,us]=C.useState(!1),[ms,xs]=C.useState(null),[ps,hs]=C.useState(new Set),[bs,ys]=C.useState(!1),[gs,fs]=C.useState(!1),[js,vs]=C.useState(!1),[Ns,ws]=C.useState(null),[ks,Cs]=C.useState(null),[_s,Ss]=C.useState(""),[Ts,Fs]=C.useState("deny"),[Es,Ls]=C.useState(!1),[Ms,Ps]=C.useState(!0),[Rs,As]=C.useState(!1),[zs,Is]=C.useState(!0),[Ds,Hs]=C.useState("idle"),[Os,qs]=C.useState(!1),[Ks,Vs]=C.useState(!1);C.useEffect(()=>{me&&fe&&(Ne((me.frequency/1e6).toFixed(3)),ke(me.bandwidth/1e3),_e(me.spreading_factor),Te(me.coding_rate),Ee(String(me.tx_power)))},[me,fe]);const $s=C.useMemo(()=>{if(!me||!fe)return!1;const e=me.frequency/1e6,t=me.bandwidth/1e3,s=parseFloat(ve)||0;return Math.abs(s-e)>1e-4||we!==t||Ce!==me.spreading_factor||Se!==me.coding_rate||parseInt(Fe)!==me.tx_power},[me,fe,ve,we,Ce,Se,Fe]),Ys=C.useCallback(()=>{je(!1),Re(null),me&&(Ne((me.frequency/1e6).toFixed(3)),ke(me.bandwidth/1e3),_e(me.spreading_factor),Te(me.coding_rate),Ee(String(me.tx_power)))},[me]);C.useEffect(()=>{if(!fe)return;const e=e=>{Ae.current&&!Ae.current.contains(e.target)&&Ys()};return document.addEventListener("mouseup",e),()=>{document.removeEventListener("mouseup",e)}},[fe,Ys]);const Bs=C.useCallback(()=>{const e=null==ge?void 0:ge.tx_delay_factor;return e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??1:"number"==typeof e?e:1},[ge]),Us=C.useCallback(()=>{const e=null==ge?void 0:ge.direct_tx_delay_factor;return"number"==typeof e?e:.5},[ge]),Xs=C.useCallback(()=>{const e=null==pe?void 0:pe.max_airtime_percent;return"number"==typeof e?e:e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??6:6},[pe]),Gs=C.useCallback(()=>{st(Bs().toFixed(2)),rt(Us().toFixed(2)),lt(Xs().toFixed(1)),et(!0)},[Bs,Us,Xs]),Ws=C.useCallback(()=>{et(!1)},[]);C.useEffect(()=>{if(!Ze)return;const e=e=>{Ie.current&&!Ie.current.contains(e.target)&&Ws()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[Ze,Ws]);const Js=C.useCallback(()=>{var e,t,s;xt(he),ht((null==(e=null==xe?void 0:xe.latitude)?void 0:e.toString())||"0"),yt((null==(t=null==xe?void 0:xe.longitude)?void 0:t.toString())||"0"),ft((null==(s=null==xe?void 0:xe.send_advert_interval_hours)?void 0:s.toString())||"0"),wt(null),ut(!0)},[he,xe]),Qs=C.useCallback(()=>{ut(!1),wt(null)},[]);C.useEffect(()=>{if(!ot)return;const e=e=>{kt.current&&!kt.current.contains(e.target)&&Qs()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[ot,Qs]);const Zs=async()=>{var e;if("loading"===St)return;const t=(null==_t?void 0:_t.cors_enabled)??!1,s=!t,a=t;Lt.current&&clearTimeout(Lt.current),Mt.current&&clearTimeout(Mt.current),Pt.current=!1,Et(s),Tt("loading"),Lt.current=setTimeout(()=>{Pt.current||Be.current&&(Et(a),Tt("error"),Mt.current=setTimeout(()=>{Be.current&&(Tt("idle"),Et(null))},2e3))},1e4);try{const t=await b({web:{cors_enabled:s}});if(Pt.current=!0,Lt.current&&clearTimeout(Lt.current),!Be.current)return;t.success||(null==(e=t.data)?void 0:e.persisted)?(await ue(),Tt("success"),Mt.current=setTimeout(()=>{Be.current&&(Tt("idle"),Et(null))},2e3)):(Et(a),Tt("error"),Mt.current=setTimeout(()=>{Be.current&&(Tt("idle"),Et(null))},2e3))}catch{if(Pt.current=!0,Lt.current&&clearTimeout(Lt.current),!Be.current)return;Et(a),Tt("error"),Mt.current=setTimeout(()=>{Be.current&&(Tt("idle"),Et(null))},2e3)}};C.useEffect(()=>{(async()=>{Is(!0);try{const e=await y();e.success&&e.data?As(e.data.exists):As(!1);const t=null==_t?void 0:_t.web_path;Ps(!t||""===t)}catch{As(!1)}finally{Is(!1)}})()},[null==_t?void 0:_t.web_path]);const ea=async e=>{var t;if("loading"!==Ds){Hs("loading");try{const s=await b({web:{web_path:e?null:"/opt/pymc_console/web/html"}});if(!Be.current)return;s.success||(null==(t=s.data)?void 0:t.persisted)?(Ps(e),Hs("success"),qs(!0),setTimeout(()=>{Be.current&&Hs("idle")},2e3)):(Hs("error"),setTimeout(()=>{Be.current&&Hs("idle")},2e3))}catch{if(!Be.current)return;Hs("error"),setTimeout(()=>{Be.current&&Hs("idle")},2e3)}}},ta=C.useCallback(async()=>{It(!0),Ht(null);try{const e=await l();At(e.tokens||[])}catch(e){Ht(e instanceof Error?e.message:"Failed to fetch tokens")}finally{It(!1)}},[]);C.useEffect(()=>{ta()},[ta]);const sa=async()=>{if(Kt.trim()){Jt(!0),Ht(null);try{const e=await f(Kt.trim());Yt(e.token||null),qt(!1),Ut(!0),Vt(""),await ta()}catch(e){Ht(e instanceof Error?e.message:"Failed to create token")}finally{Jt(!1)}}else Ht("Token name is required")},aa=e=>e?new Date(1e3*e).toLocaleString():"Never",ra=C.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},[]),na=C.useCallback(async()=>{ns(!0),cs(null);try{const e=await c();e.success&&e.data?as(ra(e.data)):cs(e.error||"Failed to load transport keys")}catch(e){cs(e instanceof Error?e.message:"Unknown error occurred")}finally{ns(!1)}},[ra]);C.useEffect(()=>{na()},[na]);const la=C.useCallback((e,t)=>{for(const s of e){if(s.id===t)return s;if(s.children){const e=la(s.children,t);if(e)return e}}return null},[]),ca=C.useCallback(()=>{if(!ms)return;const e=la(ss,ms);return null==e?void 0:e.name},[ms,ss,la]),ia=C.useCallback(e=>{hs(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),da=async e=>{us(!0),cs(null);try{const t=await v("allow"===e);t.success?ds(e):cs(t.error||"Failed to update global flood policy")}catch(t){cs(t instanceof Error?t.message:"Failed to update global flood policy")}finally{us(!1)}},oa=async()=>{if(_s.trim()){Ls(!0),cs(null);try{const e=await N({name:_s.trim(),flood_policy:Ts,parent_id:ms??void 0});e.success?(await na(),ys(!1),Ss(""),Fs("deny")):cs(e.error||"Failed to add transport key")}catch(e){cs(e instanceof Error?e.message:"Failed to add transport key")}finally{Ls(!1)}}else cs("Key name is required")},ua=C.useCallback(()=>{if(!ms)return;const e=la(ss,ms);e&&(ws({...e}),fs(!0))},[ms,ss,la]);C.useEffect(()=>{const e=e=>{"Escape"===e.key&&(bs&&(ys(!1),Ss(""),Fs("deny")),gs&&(fs(!1),ws(null)),js&&(vs(!1),Cs(null)),Ot&&(qt(!1),Vt("")),Bt&&(Ut(!1),Yt(null)))};if(bs||gs||js||Ot||Bt)return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[bs,gs,js,Ot,Bt]);const ma=C.useCallback(()=>{if(!ms)return;const e=la(ss,ms);e&&(Cs(e),vs(!0))},[ms,ss,la]),xa=({node:e,level:t})=>{const s=ps.has(e.id),a=ms===e.id,n=e.children&&e.children.length>0,l="allow"===is;return r.jsxs("div",{children:[r.jsxs("div",{className:_("flex items-center gap-2 h-[36px] px-3 rounded-full cursor-pointer transition-colors",a?"bg-accent-primary/15":"hover:bg-white/[0.02]",l&&"opacity-50 cursor-not-allowed"),style:{marginLeft:16*t+"px"},onClick:()=>!l&&xs(e.id),children:[n?r.jsx("button",{onClick:t=>{t.stopPropagation(),ia(e.id)},className:"p-1 hover:bg-white/[0.05] rounded-full transition-colors",children:r.jsx(V,{className:_("w-3.5 h-3.5 text-text-muted transition-transform",s&&"rotate-90")})}):r.jsx("span",{className:"w-5"}),r.jsx(B,{className:"w-4 h-4 text-accent-primary flex-shrink-0"}),r.jsx("span",{className:"type-data text-text-primary flex-1 truncate",children:e.name}),r.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"})]}),n&&s&&r.jsx("div",{children:e.children.map(e=>r.jsx(xa,{node:e,level:t+1},e.id))})]})};return r.jsxs(E,{children:[r.jsx(L,{title:"Configuration",icon:r.jsx(i,{})}),r.jsxs(R,{template:"standard",children:[r.jsx(A,{span:12,md:6,children:r.jsx(M,{children:r.jsxs("div",{ref:kt,children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("h2",{className:"type-subheading text-text-primary flex items-center gap-2",children:[r.jsx(d,{className:"icon-md text-accent-primary"}),"Repeater Settings"]}),r.jsx("div",{className:"flex items-center gap-1",children:xe&&(ot?r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:Qs,disabled:"loading"===jt,className:_("p-2 rounded-lg transition-colors","loading"===jt?"text-text-muted cursor-not-allowed":"text-text-muted hover:text-accent-danger hover:bg-accent-danger/10"),title:"Cancel",children:r.jsx(o,{className:"w-4 h-4"})}),r.jsx("button",{onClick:async()=>{if("loading"!==jt){Ct.current&&clearTimeout(Ct.current),vt("loading"),wt(null);try{const e={};mt&&mt!==he&&(e.node_name=mt);const t=parseFloat(pt);isNaN(t)||t===(null==xe?void 0:xe.latitude)||(e.latitude=t);const s=parseFloat(bt);isNaN(s)||s===(null==xe?void 0:xe.longitude)||(e.longitude=s);const a=parseInt(gt);if(isNaN(a)||a===(null==xe?void 0:xe.send_advert_interval_hours)||(e.flood_advert_interval_hours=a),0===Object.keys(e).length)return wt({success:!0,message:"No changes to save"}),void vt("idle");const r=await h(e);if(!Be.current)return;if(r.success&&r.data){const e=r.data.applied.join(", ");wt({success:!0,message:`Updated: ${e}`}),await ue(),vt("success"),Ct.current=setTimeout(()=>{Be.current&&(vt("idle"),ut(!1),wt(null))},1500)}else wt({success:!1,message:r.error||"Failed to save"}),vt("error"),Ct.current=setTimeout(()=>{Be.current&&vt("idle")},2e3)}catch(e){if(!Be.current)return;wt({success:!1,message:String(e)}),vt("error"),Ct.current=setTimeout(()=>{Be.current&&vt("idle")},2e3)}}},disabled:"loading"===jt,className:_("p-2 rounded-lg transition-colors","loading"===jt?"text-accent-primary cursor-wait":"success"===jt?"text-accent-success":"error"===jt?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save changes",children:"loading"===jt?r.jsx(z,{className:"w-4 h-4 animate-spin"}):"success"===jt?r.jsx(I,{className:"w-4 h-4"}):"error"===jt?r.jsx(o,{className:"w-4 h-4"}):r.jsx(I,{className:"w-4 h-4"})})]}):r.jsx("button",{onClick:Js,className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:"Edit repeater settings",children:r.jsx(W,{className:"w-4 h-4"})}))})]}),Nt&&r.jsx("div",{className:_("text-xs mb-3 px-2 py-1.5 rounded-md",Nt.success?"text-accent-success bg-accent-success/10":"text-accent-danger bg-accent-danger/10"),children:Nt.message}),xe?r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"col-span-2",children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Node Name"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",ot?"bg-white/5":"bg-white/[0.02]"),children:ot?r.jsx("input",{type:"text",value:mt,onChange:e=>xt(e.target.value),maxLength:50,className:"w-full bg-transparent text-text-primary focus:outline-none type-data",placeholder:"Enter node name"}):r.jsx("span",{className:"type-data text-text-primary",children:he})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:ot?"Latitude (°)":"Latitude"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",ot?"bg-white/5":"bg-white/[0.02]"),children:ot?r.jsx("input",{type:"number",value:pt,onChange:e=>ht(e.target.value),step:"0.000001",min:"-90",max:"90",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):r.jsx("span",{className:"type-data text-text-primary",children:0!==xe.latitude?xe.latitude.toFixed(6):"Not set"})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:ot?"Longitude (°)":"Longitude"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",ot?"bg-white/5":"bg-white/[0.02]"),children:ot?r.jsx("input",{type:"number",value:bt,onChange:e=>yt(e.target.value),step:"0.000001",min:"-180",max:"180",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):r.jsx("span",{className:"type-data text-text-primary",children:0!==xe.longitude?xe.longitude.toFixed(6):"Not set"})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:ot?"Advert Interval (hours)":"Advert Interval"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",ot?"bg-white/5":"bg-white/[0.02]"),children:ot?r.jsx("input",{type:"number",value:gt,onChange:e=>ft(e.target.value),min:"0",max:"48",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):r.jsx("span",{className:"type-data text-text-primary",children:xe.send_advert_interval_hours>0?`${xe.send_advert_interval_hours}h`:"Disabled"})}),ot&&r.jsx("p",{className:"type-data-xs text-text-muted mt-1 ml-4",children:"0 = disabled, 3-48 hours"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Score-based TX"}),r.jsx("div",{className:"h-[38px] rounded-full px-4 flex items-center bg-white/[0.02]",children:r.jsx("span",{className:"type-data text-text-primary",children:xe.use_score_for_tx?"Enabled":"Disabled"})})]})]}):r.jsx("p",{className:"text-text-muted",children:"Loading repeater settings..."})]})})}),r.jsx(A,{span:12,md:6,children:r.jsx(M,{children:r.jsxs("div",{ref:Ae,children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("h2",{className:"type-subheading text-text-primary flex items-center gap-2",children:[r.jsx($,{className:"icon-md text-accent-primary"}),"Radio Configuration"]}),r.jsx("div",{className:"flex items-center gap-1",children:me&&(fe?r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:Ys,disabled:"loading"===Le,className:_("p-2 rounded-lg transition-colors","loading"===Le?"text-text-muted cursor-not-allowed":"text-text-muted hover:text-accent-danger hover:bg-accent-danger/10"),title:"Cancel",children:r.jsx(o,{className:"w-4 h-4"})}),r.jsx("button",{onClick:async()=>{if("loading"!==Le){ze.current&&clearTimeout(ze.current),Me("loading"),Re(null);try{const e={},t=parseFloat(ve),s=me?me.frequency/1e6:0;Math.abs(t-s)>1e-4&&(e.frequency_mhz=t);const a=me?me.bandwidth/1e3:0;we!==a&&(e.bandwidth_khz=we),Ce!==(null==me?void 0:me.spreading_factor)&&(e.spreading_factor=Ce),Se!==(null==me?void 0:me.coding_rate)&&(e.coding_rate=Se);const r=parseInt(Fe);if(r!==(null==me?void 0:me.tx_power)&&(e.tx_power=r),0===Object.keys(e).length)return Re({success:!0,message:"No changes to save"}),void Me("idle");const n=await h(e);if(!Be.current)return;if(n.success&&n.data){const e=n.data.applied.join(", "),t=n.data.live_update?" (applied live)":" (restart required)";Re({success:!0,message:`Updated: ${e}${t}`}),await ue(),Me("success"),ze.current=setTimeout(()=>{Be.current&&(Me("idle"),je(!1),Re(null))},1500)}else Re({success:!1,message:n.error||"Failed to save"}),Me("error"),ze.current=setTimeout(()=>{Be.current&&Me("idle")},2e3)}catch(e){if(!Be.current)return;Re({success:!1,message:String(e)}),Me("error"),ze.current=setTimeout(()=>{Be.current&&Me("idle")},2e3)}}},disabled:"loading"===Le||!$s,className:_("p-2 rounded-lg transition-colors","loading"===Le?"text-accent-primary cursor-wait":"success"===Le?"text-accent-success":"error"===Le?"text-accent-danger":$s?"text-accent-success hover:bg-accent-success/10":"text-text-muted cursor-not-allowed"),title:$s?"Save changes":"No changes to save",children:"loading"===Le?r.jsx(z,{className:"w-4 h-4 animate-spin"}):"success"===Le?r.jsx(I,{className:"w-4 h-4"}):"error"===Le?r.jsx(o,{className:"w-4 h-4"}):r.jsx(I,{className:"w-4 h-4"})})]}):r.jsx("button",{onClick:()=>{me&&(Ne((me.frequency/1e6).toFixed(3)),ke(me.bandwidth/1e3),_e(me.spreading_factor),Te(me.coding_rate),Ee(String(me.tx_power))),Re(null),je(!0)},className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:"Edit radio settings",children:r.jsx(W,{className:"w-4 h-4"})}))})]}),Pe&&r.jsx("div",{className:_("text-xs mb-3 px-2 py-1.5 rounded-md",Pe.success?"text-accent-success bg-accent-success/10":"text-accent-danger bg-accent-danger/10"),children:Pe.message}),me?r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:fe?"Frequency (MHz)":"Frequency"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",fe?"bg-white/5":"bg-white/[0.02]"),children:fe?r.jsx("input",{type:"number",value:ve,onChange:e=>Ne(e.target.value),step:"0.001",min:"400",max:"930",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):r.jsx("span",{className:"type-data text-text-primary",children:u(me.frequency)})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:fe?"TX Power (dBm)":"TX Power"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",fe?"bg-white/5":"bg-white/[0.02]"),children:fe?r.jsx("input",{type:"number",value:Fe,onChange:e=>Ee(e.target.value),min:"-9",max:"22",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):r.jsxs("span",{className:"type-data text-text-primary",children:[me.tx_power," dBm"]})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Bandwidth"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors relative",fe?"bg-white/5":"bg-white/[0.02]"),children:fe?r.jsxs(r.Fragment,{children:[r.jsx("select",{value:we,onChange:e=>ke(parseFloat(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=>r.jsx("option",{value:e.value,children:e.label},e.value))}),r.jsx(m,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-text-muted pointer-events-none"})]}):r.jsx("span",{className:"type-data text-text-primary",children:x(me.bandwidth)})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Spreading Factor"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors relative",fe?"bg-white/5":"bg-white/[0.02]"),children:fe?r.jsxs(r.Fragment,{children:[r.jsx("select",{value:Ce,onChange:e=>_e(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=>r.jsxs("option",{value:e,children:["SF",e]},e))}),r.jsx(m,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-text-muted pointer-events-none"})]}):r.jsxs("span",{className:"type-data text-text-primary",children:["SF",me.spreading_factor]})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Coding Rate"}),r.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors relative",fe?"bg-white/5":"bg-white/[0.02]"),children:fe?r.jsxs(r.Fragment,{children:[r.jsx("select",{value:Se,onChange:e=>Te(parseInt(e.target.value)),className:"w-full bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data pr-6",children:ae.map(e=>r.jsx("option",{value:e.value,children:e.label},e.value))}),r.jsx(m,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-text-muted pointer-events-none"})]}):r.jsxs("span",{className:"type-data text-text-primary",children:["4/",me.coding_rate]})})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Preamble"}),r.jsx("div",{className:"h-[38px] rounded-full px-4 flex items-center bg-white/[0.02]",children:r.jsxs("span",{className:"type-data text-text-primary",children:[me.preamble_length," symbols"]})})]})]}):r.jsx("p",{className:"text-text-muted",children:"Loading radio configuration..."})]})})})]}),r.jsxs(R,{template:"standard",children:[r.jsx(A,{span:12,md:6,children:r.jsx(M,{children:r.jsxs("div",{ref:Ie,children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("h2",{className:"type-subheading text-text-primary flex items-center gap-3",children:[r.jsx(p,{className:"icon-md text-icon-card-title"}),"Operating Mode"]}),r.jsx("div",{className:"flex items-center gap-1",children:Ze?r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:async()=>{if("loading"!==ct){dt.current&&clearTimeout(dt.current),it("loading");try{const e=await h({tx_delay_factor:parseFloat(tt),direct_tx_delay_factor:parseFloat(at)});if(await de({max_airtime_percent:parseFloat(nt),enforcement_enabled:ye}),!Be.current)return;e.success&&e.data?(await ue(),it("success"),dt.current=setTimeout(()=>{Be.current&&(it("idle"),et(!1))},1500)):(it("error"),dt.current=setTimeout(()=>{Be.current&&it("idle")},2e3))}catch{if(!Be.current)return;it("error"),dt.current=setTimeout(()=>{Be.current&&it("idle")},2e3)}}},disabled:"loading"===ct,className:_("p-2 rounded-lg transition-colors","loading"===ct?"text-accent-primary cursor-wait":"success"===ct?"text-accent-success":"error"===ct?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save",children:"loading"===ct?r.jsx(z,{className:"w-4 h-4 animate-spin"}):"success"===ct?r.jsx(I,{className:"w-4 h-4"}):"error"===ct?r.jsx(o,{className:"w-4 h-4"}):r.jsx(I,{className:"w-4 h-4"})}),r.jsx("button",{onClick:Ws,className:"p-2 rounded-lg text-text-muted hover:text-accent-danger hover:bg-accent-danger/10",title:"Cancel",children:r.jsx(o,{className:"w-4 h-4"})})]}):r.jsx("button",{onClick:Gs,className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:"Edit settings",children:r.jsx(W,{className:"w-4 h-4"})})})]}),r.jsx("p",{className:"type-label text-text-muted mb-3",children:"Control how the repeater handles packets"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"flex-1 space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("label",{className:"type-label text-text-muted",children:"Repeat"}),r.jsx("div",{className:"flex items-center gap-2",children:(()=>{const e=null!==Ke?Ke:"forward"===be;return r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:async()=>{if("loading"===De)return;const t=!e,s="forward"===be;Ue.current&&clearTimeout(Ue.current),Xe.current&&clearTimeout(Xe.current),Je.current=!1,Ve(t),He("loading"),Ue.current=setTimeout(()=>{Je.current||Be.current&&(Ve(s),He("error"),Xe.current=setTimeout(()=>{Be.current&&(He("idle"),Ve(null))},2e3))},1e4);try{if(await ce(t?"forward":"monitor"),Je.current=!0,Ue.current&&clearTimeout(Ue.current),!Be.current)return;He("success"),Xe.current=setTimeout(()=>{Be.current&&(He("idle"),Ve(null),ie())},2e3)}catch{if(Je.current=!0,Ue.current&&clearTimeout(Ue.current),!Be.current)return;Ve(s),He("error"),Xe.current=setTimeout(()=>{Be.current&&(He("idle"),Ve(null))},2e3)}},disabled:"loading"===De,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"===De&&"opacity-70"),"aria-label":"Toggle forward mode",children:r.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")})}),r.jsx("span",{className:_("type-data text-sm w-7",e?"text-accent-success":"text-text-muted"),children:e?"On":"Off"}),"loading"===De&&r.jsx(z,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===De&&r.jsx(I,{className:"w-4 h-4 text-accent-success"}),"error"===De&&r.jsx(o,{className:"w-4 h-4 text-accent-danger"})]})})()})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("label",{className:"type-label text-text-muted",children:"Duty Cycle"}),r.jsx("div",{className:"flex items-center gap-2",children:(()=>{const e=null!==$e?$e:ye;return r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:async()=>{if("loading"===Oe)return;const t=!e,s=ye;Ge.current&&clearTimeout(Ge.current),We.current&&clearTimeout(We.current),Qe.current=!1,Ye(t),qe("loading"),Ge.current=setTimeout(()=>{Qe.current||Be.current&&(Ye(s),qe("error"),We.current=setTimeout(()=>{Be.current&&(qe("idle"),Ye(null))},2e3))},1e4);try{if(await de({max_airtime_percent:Xs(),enforcement_enabled:t}),Qe.current=!0,Ge.current&&clearTimeout(Ge.current),!Be.current)return;qe("success"),We.current=setTimeout(()=>{Be.current&&(qe("idle"),Ye(null),oe())},2e3)}catch{if(Qe.current=!0,Ge.current&&clearTimeout(Ge.current),!Be.current)return;Ye(s),qe("error"),We.current=setTimeout(()=>{Be.current&&(qe("idle"),Ye(null))},2e3)}},disabled:"loading"===Oe,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"===Oe&&"opacity-70"),"aria-label":"Toggle duty cycle",children:r.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")})}),r.jsx("span",{className:_("type-data text-sm w-7",e?"text-accent-success":"text-text-muted"),children:e?"On":"Off"}),"loading"===Oe&&r.jsx(z,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===Oe&&r.jsx(I,{className:"w-4 h-4 text-accent-success"}),"error"===Oe&&r.jsx(o,{className:"w-4 h-4 text-accent-danger"})]})})()})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("label",{className:"type-label text-text-muted",children:"Max Airtime"}),r.jsx("div",{className:_("h-[32px] rounded-full px-3 flex items-center justify-end transition-colors min-w-[80px]",Ze?"bg-white/5":"bg-white/[0.02]"),children:Ze?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("input",{type:"number",value:nt,onChange:e=>lt(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"}),r.jsx("span",{className:"text-text-muted type-data",children:"%"})]}):r.jsxs("span",{className:"type-data text-text-primary",children:[Xs().toFixed(1),"%"]})})]})]}),r.jsx("div",{className:"hidden sm:block w-px bg-border-subtle"}),r.jsxs("div",{className:"flex-1 pt-4 sm:pt-0 border-t sm:border-t-0 border-border-subtle",children:[r.jsx("label",{className:"type-label text-text-muted block mb-3",children:"TX Delays"}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"type-label text-text-muted",children:"Flood"}),r.jsx("div",{className:_("h-[32px] rounded-full px-3 flex items-center justify-end transition-colors min-w-[80px]",Ze?"bg-white/5":"bg-white/[0.02]"),children:Ze?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("input",{type:"number",value:tt,onChange:e=>st(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"}),r.jsx("span",{className:"text-text-muted type-data",children:"x"})]}):r.jsxs("span",{className:"type-data text-text-primary",children:[Bs().toFixed(2),"x"]})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"type-label text-text-muted",children:"Direct"}),r.jsx("div",{className:_("h-[32px] rounded-full px-3 flex items-center justify-end transition-colors min-w-[80px]",Ze?"bg-white/5":"bg-white/[0.02]"),children:Ze?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("input",{type:"number",value:at,onChange:e=>rt(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"}),r.jsx("span",{className:"text-text-muted type-data",children:"s"})]}):r.jsxs("span",{className:"type-data text-text-primary",children:[Us().toFixed(2),"s"]})})]})]})]})]})]})})}),r.jsx(A,{span:12,md:6,children:r.jsxs(M,{children:[r.jsx(P,{icon:r.jsx(i,{}),title:"App Settings",largeTitle:!0}),r.jsx("p",{className:"type-body-sm text-text-muted mb-4",children:"Appearance and web server options."}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{children:[r.jsx("span",{className:"type-body text-text-primary font-medium block",children:"Enable CORS"}),r.jsx("span",{className:"type-body-sm text-text-muted",children:"Allow cross-origin API access"})]}),r.jsx("div",{className:"flex items-center gap-2",children:(()=>{const e=null!==Ft?Ft:(null==_t?void 0:_t.cors_enabled)??!1;return r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:Zs,disabled:"loading"===St,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"===St&&"opacity-70"),title:e?"Disable CORS":"Enable CORS",children:r.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"===St&&r.jsx(z,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===St&&r.jsx(I,{className:"w-4 h-4 text-accent-success"}),"error"===St&&r.jsx(o,{className:"w-4 h-4 text-accent-danger"})]})})()})]}),r.jsxs("div",{children:[r.jsx("span",{className:"type-body text-text-primary font-medium block mb-2",children:"Theme"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsx(ee,{showLogoOnly:!0})}),r.jsx("div",{className:"flex-shrink-0",children:r.jsx(ee,{showThumbnailsOnly:!0})})]})]})]})]})})]}),r.jsx(R,{template:"auto",children:r.jsxs(M,{children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[r.jsxs("div",{children:[r.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[r.jsx(U,{className:"icon-md text-accent-primary"}),"Regions / Transport Keys"]}),r.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Manage regional key hierarchy for flood control"})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs("button",{onClick:()=>ys(!0),disabled:"allow"===is,className:_("flex items-center gap-1.5 h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium","allow"===is?"bg-white/[0.02] text-text-muted cursor-not-allowed":"bg-accent-success/10 hover:bg-accent-success/20 text-accent-success"),children:[r.jsx(J,{className:"w-3.5 h-3.5"}),"Add"]}),r.jsx("button",{onClick:ua,disabled:!ms||"allow"===is,className:_("h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium",ms&&"allow"!==is?"bg-accent-primary/10 hover:bg-accent-primary/20 text-accent-primary":"bg-white/[0.02] text-text-muted cursor-not-allowed"),children:"Edit"}),r.jsx("button",{onClick:ma,disabled:!ms||"allow"===is,className:_("h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium",ms&&"allow"!==is?"bg-accent-danger/10 hover:bg-accent-danger/20 text-accent-danger":"bg-white/[0.02] text-text-muted cursor-not-allowed"),children:"Delete"})]})]}),r.jsx("div",{className:"bg-white/[0.02] rounded-2xl p-4 mb-4",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:_("w-10 h-10 rounded-full flex items-center justify-center","allow"===is?"bg-accent-success/20":"bg-accent-danger/20"),children:"allow"===is?r.jsx(Q,{className:"w-5 h-5 text-accent-success"}):r.jsx(Z,{className:"w-5 h-5 text-accent-danger"})}),r.jsxs("div",{children:[r.jsx("h4",{className:"type-body text-text-primary font-medium",children:"Global Flood Policy"}),r.jsx("p",{className:"type-body-sm text-text-muted",children:"Master control for repeater flooding"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"flex bg-white/[0.02] rounded-full p-1",children:[r.jsx("button",{onClick:()=>da("deny"),disabled:os,className:_("px-4 py-1.5 rounded-full transition-colors type-body-sm font-medium","deny"===is?"bg-accent-danger/20 text-accent-danger":"text-text-muted hover:text-text-secondary",os&&"opacity-50"),children:"Deny"}),r.jsx("button",{onClick:()=>da("allow"),disabled:os,className:_("px-4 py-1.5 rounded-full transition-colors type-body-sm font-medium","allow"===is?"bg-accent-success/20 text-accent-success":"text-text-muted hover:text-text-secondary",os&&"opacity-50"),children:"Allow"})]}),os&&r.jsx(z,{className:"w-4 h-4 animate-spin text-text-muted"})]})]})}),ls&&r.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-accent-danger bg-accent-danger/10",children:ls}),r.jsx("div",{className:"bg-white/[0.02] rounded-2xl p-4 min-h-[120px]",children:rs?r.jsxs("div",{className:"flex items-center justify-center py-6",children:[r.jsx(z,{className:"w-5 h-5 animate-spin text-accent-primary mr-2"}),r.jsx("span",{className:"type-body-sm text-text-muted",children:"Loading transport keys..."})]}):0===ss.length?r.jsxs("div",{className:"text-center py-6",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-white/[0.02] mx-auto mb-3 flex items-center justify-center",children:r.jsx(U,{className:"w-6 h-6 text-text-muted/50"})}),r.jsx("p",{className:"type-body text-text-muted",children:"No transport keys found"}),r.jsx("p",{className:"type-body-sm text-text-muted/70 mt-1",children:"Add your first transport key to get started"})]}):r.jsx("div",{className:"space-y-1",children:ss.map(e=>r.jsx(xa,{node:e,level:0},e.id))})})]})}),r.jsx(R,{template:"auto",children:r.jsxs(M,{children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[r.jsxs("div",{children:[r.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[r.jsx(X,{className:"icon-md text-accent-primary"}),"API Tokens"]}),r.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Manage API tokens for machine-to-machine authentication"})]}),r.jsxs("button",{onClick:()=>qt(!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:[r.jsx(J,{className:"w-4 h-4"}),"Create Token"]})]}),r.jsx("div",{className:"bg-accent-tertiary/5 rounded-2xl p-4 mb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-full bg-accent-tertiary/20 flex items-center justify-center flex-shrink-0",children:r.jsx(O,{className:"w-4 h-4 text-accent-tertiary"})}),r.jsxs("div",{className:"type-body-sm text-text-muted",children:[r.jsxs("p",{children:[r.jsx("span",{className:"text-text-secondary",children:"API tokens"})," are used for machine-to-machine authentication. Include the token in the ",r.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."]}),r.jsx("p",{className:"mt-1 text-text-muted/70",children:"Tokens are only shown once at creation. Store them securely."})]})]})}),Dt&&r.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-accent-danger bg-accent-danger/10",children:Dt}),zt&&0===Rt.length?r.jsxs("div",{className:"flex items-center justify-center py-6",children:[r.jsx(z,{className:"w-5 h-5 animate-spin text-accent-primary mr-2"}),r.jsx("span",{className:"type-body-sm text-text-muted",children:"Loading tokens..."})]}):Rt.length>0?r.jsx("div",{className:"space-y-2",children:Rt.map(e=>r.jsx("div",{className:"bg-white/[0.02] hover:bg-white/[0.04] rounded-2xl p-4 transition-colors",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[r.jsx("div",{className:"w-10 h-10 rounded-full bg-accent-primary/10 flex items-center justify-center flex-shrink-0",children:r.jsx(X,{className:"w-5 h-5 text-accent-primary"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h3",{className:"type-body text-text-primary font-medium truncate",children:e.name}),r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:gap-4 mt-0.5",children:[r.jsxs("span",{className:"type-data-sm text-text-muted truncate",children:["Created: ",aa(e.created_at)]}),r.jsxs("span",{className:"type-data-sm text-text-muted truncate",children:["Last used: ",aa(e.last_used)]})]})]})]}),r.jsxs("button",{onClick:()=>Gt({id:e.id,name:e.name}),disabled:Qt,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:[r.jsx(T,{className:"w-3.5 h-3.5"}),"Revoke"]})]})},e.id))}):r.jsxs("div",{className:"bg-white/[0.02] rounded-2xl p-6 text-center",children:[r.jsx("div",{className:"w-14 h-14 rounded-full bg-white/[0.02] mx-auto mb-4 flex items-center justify-center",children:r.jsx(X,{className:"w-7 h-7 text-text-muted/50"})}),r.jsx("h3",{className:"type-body text-text-primary font-medium mb-1",children:"No API Tokens"}),r.jsx("p",{className:"type-body-sm text-text-muted mb-4",children:"Create a token to enable API access"}),r.jsx("button",{onClick:()=>qt(!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"})]})]})}),r.jsx(R,{template:"auto",children:r.jsxs(M,{children:[r.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:r.jsxs("div",{children:[r.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[r.jsx(G,{className:"icon-md text-accent-primary"}),"Web Frontend"]}),r.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Choose which web interface to use"})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.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"===Ds&&"opacity-50 pointer-events-none"),children:[r.jsx("input",{type:"radio",name:"frontend",checked:Ms,onChange:()=>ea(!0),disabled:"loading"===Ds,className:"mt-1 h-4 w-4 text-accent-primary focus:ring-accent-primary focus:ring-offset-bg-elevated"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{className:"type-body text-text-primary font-medium",children:"Default Frontend"}),r.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"})]}),r.jsx("div",{className:"type-body-sm text-text-muted mt-1",children:"Built-in pyMC Repeater web interface"}),r.jsx("div",{className:"type-data-xs text-text-muted/60 mt-1 font-mono",children:"/opt/pymc_repeater/repeater/web/html"})]})]}),r.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"===Ds&&"opacity-50 pointer-events-none"),children:[r.jsx("input",{type:"radio",name:"frontend",checked:!Ms,onChange:()=>ea(!1),disabled:"loading"===Ds,className:"mt-1 h-4 w-4 text-accent-primary focus:ring-accent-primary focus:ring-offset-bg-elevated"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{className:"type-body text-text-primary font-medium",children:"PyMC Console"}),r.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 ⚡"})]}),r.jsx("div",{className:"type-body-sm text-text-muted mt-1",children:"Alternative web interface for pyMC Repeater"}),r.jsx("div",{className:"type-data-xs text-text-muted/60 mt-1 font-mono",children:"/opt/pymc_console/web/html"})]})]})]}),!zs&&r.jsx("div",{className:_("bg-white/[0.02] rounded-2xl p-4",Rs?"border border-accent-success/20":"border border-accent-tertiary/20"),children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:_("w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0",Rs?"bg-accent-success/20":"bg-accent-tertiary/20"),children:Rs?r.jsx(Y,{className:"w-4 h-4 text-accent-success"}):r.jsx(O,{className:"w-4 h-4 text-accent-tertiary"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h4",{className:"type-body text-text-primary font-medium",children:Rs?"PyMC Console has been detected":"PyMC Console Not Installed"}),Rs?r.jsxs("p",{className:"type-body-sm text-text-muted mt-1",children:["PyMC Console is installed at ",r.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"})]}):r.jsxs(r.Fragment,{children:[r.jsxs("p",{className:"type-body-sm text-text-muted mt-1 mb-3",children:["PyMC Console must be installed at ",r.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."]}),r.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:[r.jsx(q,{className:"w-4 h-4"}),"PyMC Console Install Instructions"]})]})]})]})}),Os&&r.jsx("div",{className:"bg-white/[0.02] rounded-2xl p-4 border border-accent-secondary/30",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[r.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[r.jsx("div",{className:"w-8 h-8 rounded-full bg-accent-secondary/20 flex items-center justify-center flex-shrink-0",children:r.jsx(D,{className:"w-4 h-4 text-accent-secondary"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h4",{className:"type-body text-text-primary font-medium",children:"Service restart required"}),r.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Web frontend changes will take effect after restarting the pymc-repeater service."})]})]}),r.jsx("button",{onClick:async()=>{if(!Ks){Vs(!0);try{await g(),qs(!1),setTimeout(()=>{window.location.reload()},2e3)}catch{qs(!1),setTimeout(()=>{window.location.reload()},3e3)}}},disabled:Ks,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:Ks?r.jsxs(r.Fragment,{children:[r.jsx(z,{className:"w-4 h-4 animate-spin"}),"Restarting..."]}):r.jsxs(r.Fragment,{children:[r.jsx(K,{className:"w-4 h-4"}),"Restart Now"]})})]})})]})]})}),r.jsx(R,{template:"auto",children:r.jsxs(M,{children:[r.jsx(P,{icon:r.jsx(p,{}),title:"Node Information",largeTitle:!0}),le?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[r.jsxs("div",{children:[r.jsx("span",{className:"type-label text-text-muted",children:"Node Name"}),r.jsx("p",{className:"type-body text-text-primary mt-1",children:he})]}),r.jsxs("div",{children:[r.jsx("span",{className:"type-label text-text-muted",children:"Version"}),r.jsxs("p",{className:"type-data text-text-primary mt-1",children:["v",le.version]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"type-label text-text-muted",children:"Core Version"}),r.jsxs("p",{className:"type-data text-text-primary mt-1",children:["v",le.core_version]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"type-label text-text-muted",children:"Local Hash"}),r.jsx("div",{className:"mt-1",children:le.local_hash?r.jsx(S,{hash:le.local_hash,size:"sm"}):r.jsx("span",{className:"type-data-sm text-text-muted",children:"N/A"})})]})]}),le.public_key&&r.jsxs("div",{className:"mt-4 pt-4 border-t border-border-subtle",children:[r.jsx("span",{className:"type-label text-text-muted",children:"Public Key"}),r.jsx("div",{className:"mt-1",children:r.jsx(S,{hash:le.public_key,prefixLength:12,suffixLength:8})})]})]}):r.jsx("p",{className:"text-text-muted",children:"Loading node information..."})]})}),Ot&&r.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&&qt(!1),role:"dialog","aria-modal":"true","aria-labelledby":"create-token-modal-title",children:r.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[r.jsx("h3",{id:"create-token-modal-title",className:"type-subheading text-text-primary mb-4",children:"Create API Token"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Token Name"}),r.jsx("input",{type:"text",value:Kt,onChange:e=>Vt(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&&sa(),autoFocus:!0}),r.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Give your token a descriptive name to identify its purpose"})]}),r.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[r.jsx("button",{onClick:()=>{qt(!1),Vt(""),Ht(null)},disabled:Wt,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"}),r.jsx("button",{onClick:sa,disabled:Wt||!Kt.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:Wt?r.jsxs(r.Fragment,{children:[r.jsx(z,{className:"w-4 h-4 animate-spin"}),"Creating..."]}):"Create Token"})]})]})]})}),Bt&&$t&&r.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&&Ut(!1),role:"dialog","aria-modal":"true","aria-labelledby":"show-token-modal-title",children:r.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-lg w-full shadow-2xl",children:[r.jsx("h3",{id:"show-token-modal-title",className:"type-subheading text-text-primary mb-4",children:"Token Created Successfully"}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"bg-accent-secondary/10 border border-accent-secondary/30 rounded-lg p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx(D,{className:"w-4 h-4 text-accent-secondary flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"text-sm text-text-secondary",children:[r.jsx("strong",{children:"Save this token now!"})," For security reasons, it will not be shown again."]})]})}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Your API Token"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{value:$t,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"}),r.jsxs("button",{onClick:()=>{$t&&(navigator.clipboard.writeText($t),ts(!0),setTimeout(()=>ts(!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:[es?r.jsx(I,{className:"w-4 h-4 text-accent-success"}):r.jsx(H,{className:"w-4 h-4"}),es?"Copied!":"Copy"]})]})]}),r.jsxs("div",{className:"bg-accent-tertiary/10 border border-accent-tertiary/30 rounded-lg p-3",children:[r.jsx("p",{className:"text-sm text-text-secondary mb-2",children:r.jsx("strong",{children:"Usage Example:"})}),r.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: ',$t.slice(0,12),'..." ',window.location.origin,"/api/stats"]})]}),r.jsx("div",{className:"flex justify-end mt-6",children:r.jsx("button",{onClick:()=>{Ut(!1),Yt(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"})})]})]})}),r.jsx(F,{isOpen:!!Xt,title:"Revoke API Token",message:`Are you sure you want to revoke the token '${null==Xt?void 0:Xt.name}'? This action cannot be undone.`,confirmLabel:Qt?"Revoking...":"Revoke",cancelLabel:"Cancel",variant:"danger",onConfirm:async()=>{if(Xt){Zt(!0),Ht(null);try{await j(Xt.id),await ta(),Gt(null)}catch(e){Ht(e instanceof Error?e.message:"Failed to revoke token")}finally{Zt(!1)}}},onCancel:()=>Gt(null)}),bs&&r.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&ys(!1),role:"dialog","aria-modal":"true","aria-labelledby":"add-key-modal-title",children:r.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[r.jsx("h3",{id:"add-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Add Transport Key"}),r.jsxs("div",{className:"space-y-4",children:[ms&&r.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: ",r.jsx("strong",{className:"text-text-primary",children:ca()})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Key Name"}),r.jsx("input",{type:"text",value:_s,onChange:e=>Ss(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&&oa(),autoFocus:!0})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Flood Policy"}),r.jsxs("div",{className:"flex bg-bg-subtle rounded-lg border border-border-subtle p-1",children:[r.jsx("button",{onClick:()=>Fs("deny"),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","deny"===Ts?"bg-accent-danger/20 text-accent-danger border border-accent-danger/50":"text-text-muted hover:text-text-secondary"),children:"DENY"}),r.jsx("button",{onClick:()=>Fs("allow"),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","allow"===Ts?"bg-accent-success/20 text-accent-success border border-accent-success/50":"text-text-muted hover:text-text-secondary"),children:"ALLOW"})]})]}),r.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[r.jsx("button",{onClick:()=>{ys(!1),Ss(""),Fs("deny")},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"}),r.jsx("button",{onClick:oa,disabled:Es||!_s.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?r.jsxs(r.Fragment,{children:[r.jsx(z,{className:"w-4 h-4 animate-spin"}),"Adding..."]}):"Add Key"})]})]})]})}),gs&&Ns&&r.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&&fs(!1),role:"dialog","aria-modal":"true","aria-labelledby":"edit-key-modal-title",children:r.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[r.jsx("h3",{id:"edit-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Edit Transport Key"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Key Name"}),r.jsx("input",{type:"text",value:Ns.name,onChange:e=>ws({...Ns,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})]}),r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Flood Policy"}),r.jsxs("div",{className:"flex bg-bg-subtle rounded-lg border border-border-subtle p-1",children:[r.jsx("button",{onClick:()=>ws({...Ns,floodPolicy:"deny"}),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","deny"===Ns.floodPolicy?"bg-accent-danger/20 text-accent-danger border border-accent-danger/50":"text-text-muted hover:text-text-secondary"),children:"DENY"}),r.jsx("button",{onClick:()=>ws({...Ns,floodPolicy:"allow"}),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","allow"===Ns.floodPolicy?"bg-accent-success/20 text-accent-success border border-accent-success/50":"text-text-muted hover:text-text-secondary"),children:"ALLOW"})]})]}),Ns.transport_key&&r.jsxs("div",{children:[r.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Transport Key"}),r.jsx("code",{className:"block bg-bg-subtle px-3 py-2 rounded-lg text-xs text-text-muted font-mono overflow-x-auto",children:Ns.transport_key})]}),r.jsxs("div",{className:"flex justify-between gap-3 mt-6",children:[r.jsx("button",{onClick:()=>{fs(!1),Cs(Ns),vs(!0),ws(null)},disabled:Es,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"}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("button",{onClick:()=>{fs(!1),ws(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"}),r.jsx("button",{onClick:async()=>{if(Ns){Ls(!0),cs(null);try{const e=await w(Ns.id,{name:Ns.name,flood_policy:Ns.floodPolicy});e.success?(await na(),fs(!1),ws(null)):cs(e.error||"Failed to update transport key")}catch(e){cs(e instanceof Error?e.message:"Failed to update transport key")}finally{Ls(!1)}}},disabled:Es||!Ns.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:Es?r.jsxs(r.Fragment,{children:[r.jsx(z,{className:"w-4 h-4 animate-spin"}),"Saving..."]}):"Save"})]})]})]})]})}),js&&ks&&r.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":"delete-key-modal-title",children:r.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[r.jsx("h3",{id:"delete-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Delete Transport Key"}),r.jsxs("p",{className:"text-text-secondary mb-4",children:["Are you sure you want to delete ",r.jsxs("strong",{className:"text-text-primary",children:["'",ks.name,"'"]}),"?"]}),ks.children&&ks.children.length>0&&r.jsx("div",{className:"bg-accent-secondary/10 border border-accent-secondary/30 rounded-lg p-3 mb-4",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx(D,{className:"w-4 h-4 text-accent-secondary flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"text-sm text-text-secondary",children:["This key has ",ks.children.length," child key(s). Deleting will also remove all children."]})]})}),r.jsxs("div",{className:"flex justify-end gap-3",children:[r.jsx("button",{onClick:()=>{vs(!1),Cs(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"}),r.jsx("button",{onClick:async()=>{if(ks){Ls(!0),cs(null);try{const e=await k(ks.id);e.success?(await na(),vs(!1),Cs(null),xs(null)):cs(e.error||"Failed to delete transport key")}catch(e){cs(e instanceof Error?e.message:"Failed to delete transport key")}finally{Ls(!1)}}},disabled:Es,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:Es?r.jsxs(r.Fragment,{children:[r.jsx(z,{className:"w-4 h-4 animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})}export{re as default}; diff --git a/frontend/dist/assets/ConfirmModal-B3N0K8V1.js b/frontend/dist/assets/ConfirmModal-B3N0K8V1.js new file mode 100644 index 00000000..01fabcc2 --- /dev/null +++ b/frontend/dist/assets/ConfirmModal-B3N0K8V1.js @@ -0,0 +1 @@ +import{c as e,j as t,X as o}from"./index-B-2Jxr7j.js";import{b as s,g as n,c as r}from"./recharts-bmHCCfxU.js";import{T as d}from"./triangle-alert-DgnBDldk.js";const a=e("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),i=s.memo(function({isOpen:e,title:a="Confirm",message:i,confirmLabel:l="Confirm",cancelLabel:c="Cancel",variant:m="default",onConfirm:b,onCancel:x}){if(s.useEffect(()=>{if(!e)return;const t=e=>{"Escape"===e.key&&x()};window.addEventListener("keydown",t);const o=document.body.style.overflow,s=document.body.style.position,n=document.body.style.width,r=document.body.style.top,d=window.scrollY;return document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%",document.body.style.top=`-${d}px`,()=>{window.removeEventListener("keydown",t),document.body.style.overflow=o,document.body.style.position=s,document.body.style.width=n,document.body.style.top=r,window.scrollTo(0,d)}},[e,x]),!e)return null;const u={danger:{icon:"text-accent-danger",button:"bg-accent-danger hover:brightness-110 active:brightness-90"},warning:{icon:"text-accent-secondary",button:"bg-accent-secondary hover:brightness-110 active:brightness-90 text-bg-body"},default:{icon:"text-accent-primary",button:"bg-accent-primary hover:brightness-110 active:brightness-90 text-bg-body"}}[m];return n.createPortal(t.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-md z-[10010] flex items-end sm:items-center justify-center",onClick:x,role:"dialog","aria-modal":"true","aria-labelledby":"confirm-modal-title",children:t.jsxs("div",{className:r("glass-card-elevated w-full max-w-sm","sm:mx-4 sm:rounded-xl","rounded-t-2xl rounded-b-none sm:rounded-b-xl","pb-safe"),onClick:e=>e.stopPropagation(),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:r("p-2 rounded-lg bg-bg-subtle",u.icon),children:t.jsx(d,{className:"w-5 h-5"})}),t.jsx("h3",{id:"confirm-modal-title",className:"text-base font-semibold text-text-primary",children:a})]}),t.jsx("button",{onClick:x,className:"p-2 rounded-lg text-text-muted hover:text-text-primary hover:bg-bg-subtle transition-colors",children:t.jsx(o,{className:"w-5 h-5"})})]}),t.jsx("div",{className:"p-4",children:t.jsx("p",{className:"text-sm text-text-secondary",children:i})}),t.jsxs("div",{className:"flex gap-3 p-4 pt-0",children:[t.jsx("button",{onClick:x,className:"flex-1 px-4 py-2.5 rounded-lg text-sm font-medium text-text-secondary bg-bg-subtle hover:bg-bg-elevated border border-border-subtle transition-colors",children:c}),t.jsx("button",{onClick:b,className:r("flex-1 px-4 py-2.5 rounded-lg text-sm font-medium text-text-primary transition-colors",u.button),children:l})]})]})}),document.body)});export{i as C,a as T}; diff --git a/frontend/dist/assets/ConfirmModal-vJgaOhfN.js b/frontend/dist/assets/ConfirmModal-vJgaOhfN.js deleted file mode 100644 index 2ea6c6e5..00000000 --- a/frontend/dist/assets/ConfirmModal-vJgaOhfN.js +++ /dev/null @@ -1 +0,0 @@ -import{c as e,j as t,X as o}from"./index-CFwwWdzm.js";import{b as n,g as s,c as d}from"./recharts-bmHCCfxU.js";import{T as r}from"./triangle-alert-D3gq7TmU.js";const a=e("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),l=n.memo(function({isOpen:e,title:a="Confirm",message:l,confirmLabel:c="Confirm",cancelLabel:i="Cancel",variant:m="default",onConfirm:b,onCancel:x}){if(n.useEffect(()=>{if(!e)return;const t=e=>{"Escape"===e.key&&x()};window.addEventListener("keydown",t);const o=document.body.style.overflow,n=document.body.style.position,s=document.body.style.width,d=document.body.style.top,r=window.scrollY;return document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%",document.body.style.top=`-${r}px`,()=>{window.removeEventListener("keydown",t),document.body.style.overflow=o,document.body.style.position=n,document.body.style.width=s,document.body.style.top=d,window.scrollTo(0,r)}},[e,x]),!e)return null;const u={danger:{icon:"text-accent-danger",button:"bg-accent-danger hover:bg-red-600"},warning:{icon:"text-accent-secondary",button:"bg-accent-secondary hover:bg-yellow-600 text-bg-body"},default:{icon:"text-accent-primary",button:"bg-accent-primary hover:bg-violet-500 text-bg-body"}}[m];return s.createPortal(t.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-md z-[10010] flex items-end sm:items-center justify-center",onClick:x,role:"dialog","aria-modal":"true","aria-labelledby":"confirm-modal-title",children:t.jsxs("div",{className:d("glass-card-elevated w-full max-w-sm","sm:mx-4 sm:rounded-xl","rounded-t-2xl rounded-b-none sm:rounded-b-xl","pb-safe"),onClick:e=>e.stopPropagation(),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:d("p-2 rounded-lg bg-bg-subtle",u.icon),children:t.jsx(r,{className:"w-5 h-5"})}),t.jsx("h3",{id:"confirm-modal-title",className:"text-base font-semibold text-text-primary",children:a})]}),t.jsx("button",{onClick:x,className:"p-2 rounded-lg text-text-muted hover:text-text-primary hover:bg-bg-subtle transition-colors",children:t.jsx(o,{className:"w-5 h-5"})})]}),t.jsx("div",{className:"p-4",children:t.jsx("p",{className:"text-sm text-text-secondary",children:l})}),t.jsxs("div",{className:"flex gap-3 p-4 pt-0",children:[t.jsx("button",{onClick:x,className:"flex-1 px-4 py-2.5 rounded-lg text-sm font-medium text-text-secondary bg-bg-subtle hover:bg-bg-elevated border border-border-subtle transition-colors",children:i}),t.jsx("button",{onClick:b,className:d("flex-1 px-4 py-2.5 rounded-lg text-sm font-medium text-text-primary transition-colors",u.button),children:c})]})]})}),document.body)});export{l as C,a as T}; diff --git a/frontend/dist/assets/Contacts-DdomMPi3.js b/frontend/dist/assets/Contacts-DdomMPi3.js new file mode 100644 index 00000000..799d2be0 --- /dev/null +++ b/frontend/dist/assets/Contacts-DdomMPi3.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ContactsMapMapLibre-DADBlu6n.js","assets/index-B-2Jxr7j.js","assets/recharts-bmHCCfxU.js","assets/maplibre-gl-CFO9X1Ek.js","assets/index-CWIXaxI_.css","assets/maplibre-gl-t5lNjMoZ.js","assets/maplibre-gl-B1CfjdFi.css","assets/ConfirmModal-B3N0K8V1.js","assets/triangle-alert-DgnBDldk.js","assets/loader-circle-CpgDoVxS.js","assets/useThemeColors-zSiXVtFF.js","assets/info-DsmVqi2a.js","assets/CollisionExplorerModal-CR_bXIKw.js","assets/leaflet-ClE6qLuu.js","assets/map-pin-DUDH5S76.js","assets/CollisionExplorerModal-CIGW-MKW.css","assets/house-ClBwMRk7.js","assets/refresh-cw-CaoPFM1D.js","assets/map-6qITm9y3.js","assets/external-link-CBYhc14a.js","assets/SignalIndicator-BKVtHdr4.js","assets/zap-xl716-0r.js","assets/activity-MCvW9Qx-.js","assets/trending-up-B8UTa5oU.js","assets/HashBadge-DctM4L1c.js","assets/PageLayout-CdW7LNwg.js","assets/users-CacnDxFB.js"])))=>i.map(i=>d[i]); +import{c as e,j as t,_ as s,F as a,E as n,G as r,H as l,I as c,y as i,J as o,h as d,K as h,M as x,N as m,g as u,O as p,R as g,X as j,C as f,Q as v}from"./index-B-2Jxr7j.js";import{b as y,d as N,h as b,T as w,f as k,e as M,L as C}from"./recharts-bmHCCfxU.js";import{a as S}from"./SignalIndicator-BKVtHdr4.js";import{T as H,a as L}from"./triangle-alert-DgnBDldk.js";import{T as $,Z as _,M as T}from"./zap-xl716-0r.js";import{A as P}from"./activity-MCvW9Qx-.js";import{T as R}from"./trending-up-B8UTa5oU.js";import{H as E}from"./HashBadge-DctM4L1c.js";import{T as F,C as A}from"./ConfirmModal-B3N0K8V1.js";import{C as O,M as z,S as D,a as K,A as W,N as q}from"./CollisionExplorerModal-CR_bXIKw.js";import{P as I,a as B}from"./PageLayout-CdW7LNwg.js";import{M as U}from"./map-pin-DUDH5S76.js";import{U as G}from"./users-CacnDxFB.js";import{L as V}from"./loader-circle-CpgDoVxS.js";const Z=e("arrow-up-down",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]),J=e("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),Q=e("file-digit",[["path",{d:"M4 12V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2",key:"jrl274"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 16h2v6",key:"1bxocy"}],["path",{d:"M10 22h4",key:"ceow96"}],["rect",{x:"2",y:"16",width:"4",height:"6",rx:"2",key:"r45zd0"}]]),X=e("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]),Y=e("ruler",[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]]),ee=e("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),te=e("target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);class se extends y.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}render(){var e;return this.state.hasError?t.jsx("div",{className:"map-container-16-9 glass-card flex items-center justify-center",role:"alert","aria-live":"assertive",children:t.jsxs("div",{className:"text-center text-white/50 p-4",children:[t.jsx("p",{className:"text-lg mb-2",children:"Map failed to load"}),t.jsx("p",{className:"text-sm text-white/30",children:(null==(e=this.state.error)?void 0:e.message)||"Unknown error"}),t.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 ae=y.lazy(()=>s(()=>import("./ContactsMapMapLibre-DADBlu6n.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26])));function ne({neighbors:e,localNode:s,localHash:a,onRemoveNode:n,selectedNodeHash:r,onNodeSelected:l,highlightedEdgeKey:c}){return t.jsx(se,{children:t.jsx(y.Suspense,{fallback:t.jsx("div",{className:"map-container-16-9 glass-card flex items-center justify-center",role:"status","aria-live":"polite","aria-label":"Loading map",children:t.jsxs("div",{className:"text-white/50 flex items-center gap-3",children:[t.jsx("div",{className:"w-5 h-5 border-2 border-accent-primary border-t-transparent rounded-full animate-spin","aria-hidden":"true"}),t.jsx("span",{children:"Loading map..."})]})}),children:t.jsx(ae,{neighbors:e,localNode:s,localHash:a,onRemoveNode:n,selectedNodeHash:r,onNodeSelected:l,highlightedEdgeKey:c})})})}function re(e){return e>=.7?"text-accent-success":e>=.5?"text-accent-secondary":e>=.3?"text-signal-poor":"text-accent-danger"}function le(e){return`${Math.round(100*e)}%`}const ce=y.memo(function({path:e,isHighlighted:s,onHighlight:a}){const n=function(e){return e>.2?{icon:t.jsx(R,{className:"w-3 h-3"}),color:"text-accent-success"}:e<-.2?{icon:t.jsx($,{className:"w-3 h-3"}),color:"text-accent-danger"}:{icon:t.jsx(T,{className:"w-3 h-3"}),color:"text-text-muted"}}(e.observationTrend),r=e.weakestLinkKey&&e.weakestLinkConfidence<.5;return t.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-md transition-colors cursor-pointer "+(s?"bg-accent-primary/20 border border-accent-primary/40":"hover:bg-white/5"),onClick:()=>a(s?null:e.weakestLinkKey),children:[t.jsx("div",{className:"flex-shrink-0 w-12 text-center py-1 rounded-md "+(l=e.healthScore,l>=.7?"bg-accent-success/10":l>=.5?"bg-accent-secondary/10":l>=.3?"bg-signal-poor/10":"bg-accent-danger/10"),children:t.jsx("span",{className:`text-xs font-semibold tabular-nums ${re(e.healthScore)}`,children:le(e.healthScore)})}),t.jsx("div",{className:"flex-1 flex items-center gap-0.5 overflow-x-auto min-w-0",children:e.hops.map((s,a)=>{var n;return t.jsxs("span",{className:"flex items-center",children:[t.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded "+(r&&(null==(n=e.weakestLinkKey)?void 0:n.includes(s))?"bg-accent-danger/20 text-accent-danger":"bg-white/10 text-text-secondary"),children:s}),al.slice(0,e),[l,e]),d=y.useMemo(()=>0===l.length?null:{avgHealth:l.reduce((e,t)=>e+t.healthScore,0)/l.length,declining:l.filter(e=>e.observationTrend<-.2).length,weakLinks:l.filter(e=>e.weakestLinkConfidence<.5).length},[l]),h=e=>{null==s||s(e)};return 0===l.length?null:t.jsxs("div",{className:"chart-container",children:[t.jsxs("button",{onClick:()=>i(!c),className:"w-full chart-header hover:bg-white/5 transition-colors rounded-t-lg cursor-pointer",children:[t.jsxs("div",{className:"chart-title",children:[t.jsx(X,{className:"chart-title-icon"}),"Path Health",t.jsxs("span",{className:"ml-2 text-[10px] font-normal text-text-muted",children:["(",l.length," paths)"]})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[d&&t.jsxs("div",{className:"flex items-center gap-3 text-[10px]",children:[t.jsxs("span",{className:`tabular-nums ${re(d.avgHealth)}`,children:["Avg: ",le(d.avgHealth)]}),d.weakLinks>0&&t.jsxs("span",{className:"text-accent-danger flex items-center gap-1",children:[t.jsx(H,{className:"w-3 h-3"}),d.weakLinks," weak"]}),d.declining>0&&t.jsxs("span",{className:"text-signal-poor flex items-center gap-1",children:[t.jsx($,{className:"w-3 h-3"}),d.declining," declining"]})]}),c?t.jsx(J,{className:"w-4 h-4 text-text-muted"}):t.jsx(n,{className:"w-4 h-4 text-text-muted"})]})]}),c&&t.jsxs("div",{className:"p-3 pt-0 space-y-1",children:[t.jsxs("div",{className:"flex items-center gap-4 text-[10px] text-text-muted pb-2 border-b border-white/5",children:[t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-success"})," Healthy (≥70%)"]}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-secondary"})," Fair (50-70%)"]}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"w-2 h-2 rounded-full bg-signal-poor"})," Weak (30-50%)"]}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-danger"})," Critical (<30%)"]})]}),t.jsx("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:o.map(e=>t.jsx(ce,{path:e,isHighlighted:r===e.weakestLinkKey,onHighlight:h},e.pathKey))}),l.length>e&&t.jsxs("div",{className:"text-center text-[10px] text-text-muted pt-2",children:["Showing top ",e," of ",l.length," paths"]})]})]})}),oe="var(--signal-critical)",de="var(--signal-poor)",he="var(--signal-fair)",xe="var(--signal-good)",me="var(--signal-excellent)",ue="var(--text-muted)";function pe({active:e,payload:s}){if(!e||!s||!s.length)return null;const a=s[0].payload,n=new Date(a.timestamp),r=`${(n.getMonth()+1).toString().padStart(2,"0")}/${n.getDate().toString().padStart(2,"0")}`;return t.jsxs("div",{className:"bg-tooltip-bg border border-border-subtle rounded px-1.5 py-0.5 text-[10px] shadow-xl",children:[t.jsx("span",{className:"text-text-muted",children:r}),t.jsx("span",{className:"ml-1.5 font-semibold tabular-nums",children:a.count})]})}const ge=y.memo(function({nodeHash:e,width:s=60,height:a=20,color:n,showArea:c=!0,showTooltip:i=!1,className:o=""}){const d=r(e),h=l(),x=n??(d.length>0?function(e){if(0===e.length)return oe;const t=e.slice(-4),s=t.reduce((e,t)=>e+t.count,0),a=s/t.length,n=e.reduce((e,t)=>e+t.count,0)/e.length;if(0===s)return oe;if(n>0){const e=a/n;return e>=1.2?me:e>=.8?xe:e>=.4?he:e>=.1?de:oe}return s>=10?me:s>=5?xe:s>=2?he:s>=1?de:oe}(d):ue),m={width:s,height:a};if(d.length<2){const e="number"==typeof s?s:60,n=h?ue:oe;return t.jsx("div",{className:`flex items-center justify-center ${o}`,style:{...m,color:n},children:t.jsx("svg",{width:"100%",height:a,viewBox:`0 0 ${e} ${a}`,preserveAspectRatio:"none",children:t.jsx("line",{x1:4,y1:a/2,x2:e-4,y2:a/2,stroke:"currentColor",strokeWidth:1.5,strokeDasharray:"3,2",className:h?"animate-pulse":""})})})}const u=`sparkline-gradient-${e.slice(-6)}`;return t.jsx("div",{className:o,style:m,children:t.jsx(N,{width:"100%",height:"100%",minWidth:1,minHeight:1,children:c?t.jsxs(b,{data:d,margin:{top:1,right:1,bottom:1,left:1},children:[t.jsx("defs",{children:t.jsxs("linearGradient",{id:u,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"0%",stopColor:x,stopOpacity:.35}),t.jsx("stop",{offset:"100%",stopColor:x,stopOpacity:.05})]})}),i&&t.jsx(w,{content:t.jsx(pe,{}),cursor:{stroke:"rgba(255,255,255,0.2)",strokeWidth:1}}),t.jsx(k,{type:"monotone",dataKey:"count",stroke:"none",fill:`url(#${u})`,isAnimationActive:!1}),t.jsx(M,{type:"monotone",dataKey:"count",stroke:x,strokeWidth:1.5,dot:!1,isAnimationActive:!1})]}):t.jsxs(C,{data:d,margin:{top:1,right:1,bottom:1,left:1},children:[i&&t.jsx(w,{content:t.jsx(pe,{}),cursor:{stroke:"rgba(255,255,255,0.2)",strokeWidth:1}}),t.jsx(M,{type:"monotone",dataKey:"count",stroke:x,strokeWidth:1.5,dot:!1,isAnimationActive:!1})]})})})}),je=y.memo(function({hash:e,className:s="",size:a="sm"}){const n=c(),[r,l]=y.useState(!1),o=y.useMemo(()=>i(e),[e]),d=y.useMemo(()=>o?n.find(e=>e.prefix===o)??null:null,[o,n]),h=y.useCallback(e=>{e.preventDefault(),e.stopPropagation(),l(!0)},[]),x=y.useCallback(()=>{l(!1)},[]);if(!d)return null;const m="sm"===a?"w-3.5 h-3.5":"w-4 h-4";return t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:h,className:`inline-flex items-center justify-center p-0.5 rounded text-signal-fair hover:text-accent-secondary hover:bg-signal-fair/10 focus:outline-none focus:ring-2 focus:ring-signal-fair/50 transition-colors cursor-pointer touch-manipulation ${s}`,title:`Prefix conflict: ${d.candidateCount} nodes share prefix "${o}"`,"aria-label":`View prefix conflict for ${o}`,children:t.jsx(Q,{className:m})}),t.jsx(O,{isOpen:r,prefix:d.prefix,candidateHashes:d.candidateHashes,onClose:x})]})});function fe(e,t,s,a){const n=(s-e)*Math.PI/180,r=(a-t)*Math.PI/180,l=Math.sin(n/2)*Math.sin(n/2)+Math.cos(e*Math.PI/180)*Math.cos(s*Math.PI/180)*Math.sin(r/2)*Math.sin(r/2);return 2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l))*6371e3}const ve=Object.freeze(Object.defineProperty({__proto__:null,default:function(){const{stats:e}=o(),s=d(),a=h(),n=x(),r=m(),l=u(),[c,i]=y.useState(null),[N,b]=y.useState("lastHeard"),[w,k]=y.useState("desc"),[M,C]=y.useState(""),[H,$]=y.useState(!1),[_,T]=y.useState(null),[R,O]=y.useState(null),[J,Q]=y.useState(null),[X,se]=y.useState(new Map),[ae,re]=y.useState(new Map),le=y.useMemo(()=>(null==e?void 0:e.neighbors)??{},[null==e?void 0:e.neighbors]),ce=y.useMemo(()=>Object.fromEntries(Object.entries(le).filter(([e])=>!s.has(e))),[le,s]),oe=y.useMemo(()=>{var t;return(null==(t=null==e?void 0:e.config)?void 0:t.repeater)?{latitude:e.config.repeater.latitude,longitude:e.config.repeater.longitude,name:e.config.node_name||"Local Node"}:void 0},[e]),de=null==e?void 0:e.local_hash,he=y.useMemo(()=>{const e=new Map;if(!(null==oe?void 0:oe.latitude)||!(null==oe?void 0:oe.longitude))return e;for(const[t,s]of Object.entries(ce))s.latitude&&s.longitude&&0!==s.latitude&&0!==s.longitude?e.set(t,fe(oe.latitude,oe.longitude,s.latitude,s.longitude)):e.set(t,null);return e},[ce,oe]),{neighborHashSet:xe,neighborSignalMap:me}=y.useMemo(()=>{const e=new Set,t=new Map;for(const s of l)e.add(s.hash),t.set(s.hash,{avgRssi:s.avgRssi,avgSnr:s.avgSnr});return{neighborHashSet:e,neighborSignalMap:t}},[l]),ue=y.useMemo(()=>{const e=M.toLowerCase().trim(),t="neighbor"===e||"neighbors"===e,s=H||t;return Object.fromEntries(Object.entries(ce).filter(([a,n])=>{if(s&&!xe.has(a))return!1;if(t)return!0;if(!e)return!0;const r=(n.node_name||n.name||"").toLowerCase(),l=a.slice(2,4).toLowerCase();return r.includes(e)||l.includes(e)||a.toLowerCase().includes(e)}))},[ce,M,H,xe]),pe=y.useMemo(()=>Object.entries(ue).sort(([e,t],[s,a])=>{let n=0;switch(N){case"lastHeard":n=(t.last_seen||0)-(a.last_seen||0);break;case"distance":{const t=he.get(e)??null,a=he.get(s)??null;n=null===t&&null===a?0:null===t?1:null===a?-1:t-a;break}case"centrality":n=(r.get(e)||0)-(r.get(s)||0)}return"desc"===w?-n:n}),[ue,N,w,he,r]),ve=pe.filter(([,e])=>e.latitude&&e.longitude&&0!==e.latitude&&0!==e.longitude).length,ye=y.useMemo(()=>new Set(n),[n]),Ne=y.useCallback(e=>{N===e?k(e=>"desc"===e?"asc":"desc"):(b(e),k("desc"))},[N]),be=y.useCallback(e=>{const t=ce[e];(null==t?void 0:t.latitude)&&(null==t?void 0:t.longitude)&&0!==t.latitude&&0!==t.longitude&&T(e)},[ce]),we=y.useCallback(()=>{T(null)},[]),ke=y.useCallback(async(e,t)=>{if(t.stopPropagation(),!J){Q(e),se(t=>{const s=new Map(t);return s.delete(e),s}),re(t=>{const s=new Map(t);return s.delete(e),s});try{const t=e.startsWith("0x")?e.slice(0,4):`0x${e.slice(0,2)}`,s=await p(t,30);s.success&&s.data?(se(t=>new Map(t).set(e,s.data)),setTimeout(()=>{se(t=>{const s=new Map(t);return s.delete(e),s})},1e4)):(re(t=>new Map(t).set(e,s.error||"Ping failed")),setTimeout(()=>{re(t=>{const s=new Map(t);return s.delete(e),s})},5e3))}catch(s){const t=s instanceof Error?s.message:"Ping failed";re(s=>new Map(s).set(e,t)),setTimeout(()=>{re(t=>{const s=new Map(t);return s.delete(e),s})},5e3)}finally{Q(null)}}},[J]);return t.jsxs(I,{children:[t.jsx(B,{title:"Contacts",icon:t.jsx(G,{}),controls:t.jsxs("div",{className:"flex items-baseline gap-3 sm:gap-4",children:[t.jsxs("span",{className:"roster-title tabular-nums",children:[pe.length," node",1!==pe.length?"s":""]}),ve>0&&t.jsxs("span",{className:"roster-title flex items-baseline gap-1.5 tabular-nums",children:[t.jsx(U,{className:"w-3.5 h-3.5 relative top-[2px]"}),ve," with location"]})]})}),t.jsx("div",{className:"relative",children:t.jsx(ne,{neighbors:ce,localNode:oe,localHash:de,onRemoveNode:a,selectedNodeHash:_,onNodeSelected:we,highlightedEdgeKey:R})}),t.jsx(ie,{maxPaths:10,highlightedEdge:R,onHighlightEdge:O}),t.jsxs("div",{className:"chart-container",children:[t.jsxs("div",{className:"chart-header",children:[t.jsxs("div",{className:"chart-title",children:[t.jsx(G,{className:"chart-title-icon"}),"Discovered Contacts"]}),t.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[xe.size>0&&t.jsxs("button",{onClick:()=>$(!H),className:"flex items-center gap-1 px-1.5 sm:px-2.5 py-1.5 text-xs rounded-lg transition-colors "+(H?"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:H?"Show all contacts":"Show only MeshCore neighbors (direct RF contact)",children:[t.jsx(g,{className:"w-3.5 h-3.5"}),t.jsx("span",{className:"hidden sm:inline",children:"Neighbors"}),t.jsx("span",{className:"sm:hidden tabular-nums",children:xe.size})]}),t.jsxs("div",{className:"relative",children:[t.jsx(ee,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-text-muted"}),t.jsx("input",{type:"text",value:M,onChange:e=>C(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"}),M&&t.jsx("button",{onClick:()=>{C(""),"neighbor"!==M.toLowerCase().trim()&&"neighbors"!==M.toLowerCase().trim()||$(!1)},className:"absolute right-1.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary p-0.5",children:t.jsx(j,{className:"w-3 h-3"})})]}),t.jsxs("div",{className:"flex items-center gap-0.5 sm:gap-1",children:[t.jsxs("button",{onClick:()=>Ne("lastHeard"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-xs rounded-lg transition-colors "+("lastHeard"===N?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover:bg-white/5"),title:"Sort by last heard",children:[t.jsx(f,{className:"w-3.5 h-3.5"}),t.jsx("span",{className:"hidden sm:inline",children:"Recent"}),"lastHeard"===N&&t.jsx(Z,{className:"w-3 h-3 "+("asc"===w?"rotate-180":"")})]}),t.jsxs("button",{onClick:()=>Ne("distance"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-xs rounded-lg transition-colors "+("distance"===N?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover:bg-white/5"),title:"Sort by distance",children:[t.jsx(Y,{className:"w-3.5 h-3.5"}),t.jsx("span",{className:"hidden sm:inline",children:"Distance"}),"distance"===N&&t.jsx(Z,{className:"w-3 h-3 "+("asc"===w?"rotate-180":"")})]}),t.jsxs("button",{onClick:()=>Ne("centrality"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-xs rounded-lg transition-colors "+("centrality"===N?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover:bg-white/5"),title:"Sort by network centrality",children:[t.jsx(P,{className:"w-3.5 h-3.5"}),t.jsx("span",{className:"hidden sm:inline",children:"Centrality"}),"centrality"===N&&t.jsx(Z,{className:"w-3 h-3 "+("asc"===w?"rotate-180":"")})]})]})]})]}),pe.length>0?t.jsxs(t.Fragment,{children:[t.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:[t.jsx("div",{className:"contacts-col-node",children:"Node"}),t.jsx("div",{className:"contacts-col-signal text-right",children:"Signal"}),t.jsx("div",{className:"contacts-col-distance text-right",children:"Distance"}),t.jsx("div",{className:"contacts-col-centrality text-right",children:"Centrality"}),t.jsx("div",{className:"contacts-col-activity text-center",children:"Activity"}),t.jsx("div",{className:"contacts-col-seen text-right",children:"Last Seen"}),t.jsx("div",{className:"contacts-col-actions"})]}),t.jsx("div",{className:"divide-y divide-border-subtle/30",children:pe.map(([e,s])=>{var a;const n=s.latitude&&s.longitude&&0!==s.latitude&&0!==s.longitude,l=s.node_name||s.name||"Unknown",c=ye.has(e),o=xe.has(e),d=he.get(e),h=r.get(e)||0,x=o?me.get(e):void 0,m=o&&x,u=null==(a=s.contact_type)?void 0:a.toLowerCase(),p="room server"===u||"room_server"===u||"room"===u||"server"===u,g="companion"===u||"client"===u||"cli"===u,j=s.is_repeater||"repeater"===u||"rep"===u,f=o?"direct":"flood",y=o?"Direct RF contact (zero-hop neighbor)":"Flood routing (multi-hop via mesh)";return t.jsxs("div",{className:`contacts-grid-row ${c?"bg-amber-500/5 border-l-2 border-l-amber-400":""} ${n?"cursor-pointer hover:bg-white/[0.02]":""}`,onClick:()=>be(e),children:[t.jsxs("div",{className:"contacts-col-node flex items-center gap-2 min-w-0",children:[m&&null!==(null==x?void 0:x.avgSnr)?t.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0 self-center "+(b=x.avgSnr,void 0===b?"bg-[var(--signal-unknown)]":b>=5?"bg-[var(--signal-excellent)]":b>=0?"bg-[var(--signal-good)]":b>=-5?"bg-[var(--signal-fair)]":b>=-10?"bg-[var(--signal-poor)]":"bg-[var(--signal-critical)]")}):t.jsx("div",{className:"w-2 flex-shrink-0"}),t.jsx("div",{className:"roster-icon flex-shrink-0",title:y,children:p&&j?t.jsxs("div",{className:"relative w-5 h-5",children:[t.jsx(z,{className:"w-5 h-5 absolute inset-0 text-accent-secondary"}),t.jsx(D,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-accent-primary"})]}):p?t.jsx(z,{className:"w-5 h-5 text-accent-secondary"}):g?t.jsx(K,{className:"w-5 h-5 text-text-muted"}):j?"direct"===f?t.jsx(W,{className:"w-5 h-5 text-accent-success"}):t.jsx(D,{className:"w-5 h-5 text-accent-tertiary"}):t.jsx(K,{className:"w-5 h-5 text-text-muted"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-1.5 overflow-hidden",children:[t.jsx("span",{className:"roster-title truncate",title:l,children:l}),o&&t.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"}),c&&t.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:[t.jsx(q,{className:"w-3 h-3"}),"HUB"]}),j&&t.jsx("span",{className:"pill-tag flex-shrink-0",children:"RPT"})]}),t.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[t.jsx(E,{hash:e,size:"xs",prefixLength:8,suffixLength:6}),t.jsx(je,{hash:e})]})]})]}),t.jsxs("div",{className:"contacts-col-signal flex items-center justify-end gap-2",children:[m&&null!==(null==x?void 0:x.avgRssi)&&t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(S,{rssi:x.avgRssi,className:"w-3.5 h-3.5"}),t.jsx("span",{className:"type-data-xs tabular-nums text-text-muted",children:Math.round(x.avgRssi)})]}),m&&null!==(null==x?void 0:x.avgSnr)&&t.jsxs("span",{className:"type-data-xs tabular-nums text-text-muted",children:[x.avgSnr.toFixed(1)," dB"]})]}),t.jsx("div",{className:"contacts-col-distance flex items-center justify-end gap-1 text-text-muted",children:null!=d&&t.jsxs(t.Fragment,{children:[t.jsx(Y,{className:"w-3 h-3"}),t.jsx("span",{className:"type-data-xs tabular-nums",children:(N=d,N<1e3?`${Math.round(N)}m`:`${(N/1e3).toFixed(1)}km`)})]})}),t.jsx("div",{className:"contacts-col-centrality flex items-center justify-end gap-1",children:h>0&&t.jsxs(t.Fragment,{children:[t.jsx(P,{className:"w-3 h-3 text-accent-secondary"}),t.jsxs("span",{className:"type-data-xs tabular-nums text-text-muted",children:[(100*h).toFixed(0),"%"]})]})}),t.jsx("div",{className:"contacts-col-activity flex items-center justify-center",children:t.jsx(ge,{nodeHash:e,width:48,height:16})}),t.jsx("div",{className:"contacts-col-seen flex items-center justify-end",children:t.jsx("span",{className:"type-data-xs tabular-nums text-text-primary whitespace-nowrap",children:s.last_seen?v(s.last_seen):"—"})}),t.jsxs("div",{className:"contacts-col-actions flex items-center justify-end gap-1",children:[o&&t.jsx(t.Fragment,{children:X.has(e)?t.jsxs("div",{className:"flex items-center gap-1 text-accent-success",title:`RTT: ${X.get(e).rtt_ms.toFixed(0)}ms`,children:[t.jsx(L,{className:"w-3.5 h-3.5"}),t.jsxs("span",{className:"type-data-xs tabular-nums hidden sm:inline",children:[X.get(e).snr_db.toFixed(1),"dB"]})]}):ae.has(e)?t.jsx("span",{className:"text-red-400 text-[10px]",title:ae.get(e),children:"✗"}):t.jsx("button",{onClick:t=>ke(e,t),disabled:null!==J,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:J===e?t.jsx(V,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 animate-spin"}):t.jsx(te,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})}),t.jsx("button",{onClick:t=>{t.stopPropagation(),i({hash:e,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:t.jsx(F,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]},e);var N,b})})]}):t.jsxs("div",{className:"roster-empty",children:[t.jsx(G,{className:"roster-empty-icon"}),t.jsx("div",{className:"type-label text-text-secondary",children:"No Contacts Discovered"}),t.jsx("div",{className:"type-data-xs text-text-muted mt-1",children:"Contacts will appear here as they advertise on the mesh network."})]})]}),t.jsx(A,{isOpen:!!c,title:"Remove Contact",message:`Are you sure you would like to remove ${(null==c?void 0:c.name)||"this contact"}?`,confirmLabel:"Remove",cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{c&&a(c.hash),i(null)},onCancel:()=>i(null)})]})}},Symbol.toStringTag,{value:"Module"}));export{ve as C,X as G,ge as N,je as P,te as T}; diff --git a/frontend/dist/assets/Contacts-YSj88FxC.js b/frontend/dist/assets/Contacts-YSj88FxC.js deleted file mode 100644 index 16509c10..00000000 --- a/frontend/dist/assets/Contacts-YSj88FxC.js +++ /dev/null @@ -1,2 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ContactsMapMapLibre-dMF0Ucvt.js","assets/index-CFwwWdzm.js","assets/recharts-bmHCCfxU.js","assets/maplibre-gl-CFO9X1Ek.js","assets/index-4t45GZGR.css","assets/maplibre-gl-xbE8v0ww.js","assets/maplibre-gl-B1CfjdFi.css","assets/ConfirmModal-vJgaOhfN.js","assets/triangle-alert-D3gq7TmU.js","assets/loader-circle-D-YFxAvv.js","assets/info-CmmWJjrG.js","assets/useThemeColors-CMkWsRmX.js","assets/CollisionExplorerModal-BemV0oqY.js","assets/leaflet-ClE6qLuu.js","assets/map-pin-T4wlME-z.js","assets/CollisionExplorerModal-CIGW-MKW.css","assets/house-B__u6rG_.js","assets/refresh-cw-DL6OUtNR.js","assets/map-YsJHyCoF.js","assets/external-link-DOcxKPBQ.js","assets/SignalIndicator-C_KfOKH5.js","assets/zap-kZ-noEk0.js","assets/activity-DlXJf5Rp.js","assets/trending-up-BlGackjE.js","assets/HashBadge-Bkq6dZ2T.js","assets/PageLayout-BUtLzwWM.js","assets/users-BOGrD51n.js"])))=>i.map(i=>d[i]); -import{c as e,j as t,_ as s,F as a,E as n,G as r,H as l,I as c,y as i,J as o,h as d,K as h,M as x,N as m,g as u,R as p,X as g,C as j,O as f}from"./index-CFwwWdzm.js";import{b as v,d as N,h as y,T as b,f as w,e as k,L as C}from"./recharts-bmHCCfxU.js";import{a as M}from"./SignalIndicator-C_KfOKH5.js";import{T as S}from"./triangle-alert-D3gq7TmU.js";import{T as H,Z as L,M as $}from"./zap-kZ-noEk0.js";import{A as _}from"./activity-DlXJf5Rp.js";import{T as R}from"./trending-up-BlGackjE.js";import{H as E}from"./HashBadge-Bkq6dZ2T.js";import{T as A,C as P}from"./ConfirmModal-vJgaOhfN.js";import{C as T,M as F,S as O,a as z,A as D,N as K}from"./CollisionExplorerModal-BemV0oqY.js";import{P as W,a as q}from"./PageLayout-BUtLzwWM.js";import{M as I}from"./map-pin-T4wlME-z.js";import{U as B}from"./users-BOGrD51n.js";const U=e("arrow-up-down",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]),G=e("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),V=e("file-digit",[["path",{d:"M4 12V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2",key:"jrl274"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 16h2v6",key:"1bxocy"}],["path",{d:"M10 22h4",key:"ceow96"}],["rect",{x:"2",y:"16",width:"4",height:"6",rx:"2",key:"r45zd0"}]]),Z=e("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]),J=e("ruler",[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]]),Q=e("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);class X extends v.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}render(){var e;return this.state.hasError?t.jsx("div",{className:"map-container-16-9 glass-card flex items-center justify-center",role:"alert","aria-live":"assertive",children:t.jsxs("div",{className:"text-center text-white/50 p-4",children:[t.jsx("p",{className:"text-lg mb-2",children:"Map failed to load"}),t.jsx("p",{className:"text-sm text-white/30",children:(null==(e=this.state.error)?void 0:e.message)||"Unknown error"}),t.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 Y=v.lazy(()=>s(()=>import("./ContactsMapMapLibre-dMF0Ucvt.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26])));function ee({neighbors:e,localNode:s,localHash:a,onRemoveNode:n,selectedNodeHash:r,onNodeSelected:l,highlightedEdgeKey:c}){return t.jsx(X,{children:t.jsx(v.Suspense,{fallback:t.jsx("div",{className:"map-container-16-9 glass-card flex items-center justify-center",role:"status","aria-live":"polite","aria-label":"Loading map",children:t.jsxs("div",{className:"text-white/50 flex items-center gap-3",children:[t.jsx("div",{className:"w-5 h-5 border-2 border-accent-primary border-t-transparent rounded-full animate-spin","aria-hidden":"true"}),t.jsx("span",{children:"Loading map..."})]})}),children:t.jsx(Y,{neighbors:e,localNode:s,localHash:a,onRemoveNode:n,selectedNodeHash:r,onNodeSelected:l,highlightedEdgeKey:c})})})}function te(e){return e>=.7?"text-accent-success":e>=.5?"text-accent-secondary":e>=.3?"text-signal-poor":"text-accent-danger"}function se(e){return`${Math.round(100*e)}%`}const ae=v.memo(function({path:e,isHighlighted:s,onHighlight:a}){const n=function(e){return e>.2?{icon:t.jsx(R,{className:"w-3 h-3"}),color:"text-accent-success"}:e<-.2?{icon:t.jsx(H,{className:"w-3 h-3"}),color:"text-accent-danger"}:{icon:t.jsx($,{className:"w-3 h-3"}),color:"text-text-muted"}}(e.observationTrend),r=e.weakestLinkKey&&e.weakestLinkConfidence<.5;return t.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-md transition-colors cursor-pointer "+(s?"bg-accent-primary/20 border border-accent-primary/40":"hover:bg-white/5"),onClick:()=>a(s?null:e.weakestLinkKey),children:[t.jsx("div",{className:"flex-shrink-0 w-12 text-center py-1 rounded-md "+(l=e.healthScore,l>=.7?"bg-accent-success/10":l>=.5?"bg-accent-secondary/10":l>=.3?"bg-signal-poor/10":"bg-accent-danger/10"),children:t.jsx("span",{className:`text-xs font-semibold tabular-nums ${te(e.healthScore)}`,children:se(e.healthScore)})}),t.jsx("div",{className:"flex-1 flex items-center gap-0.5 overflow-x-auto min-w-0",children:e.hops.map((s,a)=>{var n;return t.jsxs("span",{className:"flex items-center",children:[t.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded "+(r&&(null==(n=e.weakestLinkKey)?void 0:n.includes(s))?"bg-accent-danger/20 text-accent-danger":"bg-white/10 text-text-secondary"),children:s}),al.slice(0,e),[l,e]),d=v.useMemo(()=>0===l.length?null:{avgHealth:l.reduce((e,t)=>e+t.healthScore,0)/l.length,declining:l.filter(e=>e.observationTrend<-.2).length,weakLinks:l.filter(e=>e.weakestLinkConfidence<.5).length},[l]),h=e=>{null==s||s(e)};return 0===l.length?null:t.jsxs("div",{className:"chart-container",children:[t.jsxs("button",{onClick:()=>i(!c),className:"w-full chart-header hover:bg-white/5 transition-colors rounded-t-lg cursor-pointer",children:[t.jsxs("div",{className:"chart-title",children:[t.jsx(Z,{className:"chart-title-icon"}),"Path Health",t.jsxs("span",{className:"ml-2 text-[10px] font-normal text-text-muted",children:["(",l.length," paths)"]})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[d&&t.jsxs("div",{className:"flex items-center gap-3 text-[10px]",children:[t.jsxs("span",{className:`tabular-nums ${te(d.avgHealth)}`,children:["Avg: ",se(d.avgHealth)]}),d.weakLinks>0&&t.jsxs("span",{className:"text-accent-danger flex items-center gap-1",children:[t.jsx(S,{className:"w-3 h-3"}),d.weakLinks," weak"]}),d.declining>0&&t.jsxs("span",{className:"text-signal-poor flex items-center gap-1",children:[t.jsx(H,{className:"w-3 h-3"}),d.declining," declining"]})]}),c?t.jsx(G,{className:"w-4 h-4 text-text-muted"}):t.jsx(n,{className:"w-4 h-4 text-text-muted"})]})]}),c&&t.jsxs("div",{className:"p-3 pt-0 space-y-1",children:[t.jsxs("div",{className:"flex items-center gap-4 text-[10px] text-text-muted pb-2 border-b border-white/5",children:[t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-success"})," Healthy (≥70%)"]}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-secondary"})," Fair (50-70%)"]}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"w-2 h-2 rounded-full bg-signal-poor"})," Weak (30-50%)"]}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-danger"})," Critical (<30%)"]})]}),t.jsx("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:o.map(e=>t.jsx(ae,{path:e,isHighlighted:r===e.weakestLinkKey,onHighlight:h},e.pathKey))}),l.length>e&&t.jsxs("div",{className:"text-center text-[10px] text-text-muted pt-2",children:["Showing top ",e," of ",l.length," paths"]})]})]})}),re="var(--signal-critical)",le="var(--signal-poor)",ce="var(--signal-fair)",ie="var(--signal-good)",oe="var(--signal-excellent)",de="var(--text-muted)";function he({active:e,payload:s}){if(!e||!s||!s.length)return null;const a=s[0].payload,n=new Date(a.timestamp),r=`${(n.getMonth()+1).toString().padStart(2,"0")}/${n.getDate().toString().padStart(2,"0")}`;return t.jsxs("div",{className:"bg-tooltip-bg border border-border-subtle rounded px-1.5 py-0.5 text-[10px] shadow-xl",children:[t.jsx("span",{className:"text-text-muted",children:r}),t.jsx("span",{className:"ml-1.5 font-semibold tabular-nums",children:a.count})]})}const xe=v.memo(function({nodeHash:e,width:s=60,height:a=20,color:n,showArea:c=!0,showTooltip:i=!1,className:o=""}){const d=r(e),h=l(),x=n??(d.length>0?function(e){if(0===e.length)return re;const t=e.slice(-4),s=t.reduce((e,t)=>e+t.count,0),a=s/t.length,n=e.reduce((e,t)=>e+t.count,0)/e.length;if(0===s)return re;if(n>0){const e=a/n;return e>=1.2?oe:e>=.8?ie:e>=.4?ce:e>=.1?le:re}return s>=10?oe:s>=5?ie:s>=2?ce:s>=1?le:re}(d):de),m={width:s,height:a};if(d.length<2){const e="number"==typeof s?s:60,n=h?de:re;return t.jsx("div",{className:`flex items-center justify-center ${o}`,style:{...m,color:n},children:t.jsx("svg",{width:"100%",height:a,viewBox:`0 0 ${e} ${a}`,preserveAspectRatio:"none",children:t.jsx("line",{x1:4,y1:a/2,x2:e-4,y2:a/2,stroke:"currentColor",strokeWidth:1.5,strokeDasharray:"3,2",className:h?"animate-pulse":""})})})}const u=`sparkline-gradient-${e.slice(-6)}`;return t.jsx("div",{className:o,style:m,children:t.jsx(N,{width:"100%",height:"100%",children:c?t.jsxs(y,{data:d,margin:{top:1,right:1,bottom:1,left:1},children:[t.jsx("defs",{children:t.jsxs("linearGradient",{id:u,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"0%",stopColor:x,stopOpacity:.35}),t.jsx("stop",{offset:"100%",stopColor:x,stopOpacity:.05})]})}),i&&t.jsx(b,{content:t.jsx(he,{}),cursor:{stroke:"rgba(255,255,255,0.2)",strokeWidth:1}}),t.jsx(w,{type:"monotone",dataKey:"count",stroke:"none",fill:`url(#${u})`,isAnimationActive:!1}),t.jsx(k,{type:"monotone",dataKey:"count",stroke:x,strokeWidth:1.5,dot:!1,isAnimationActive:!1})]}):t.jsxs(C,{data:d,margin:{top:1,right:1,bottom:1,left:1},children:[i&&t.jsx(b,{content:t.jsx(he,{}),cursor:{stroke:"rgba(255,255,255,0.2)",strokeWidth:1}}),t.jsx(k,{type:"monotone",dataKey:"count",stroke:x,strokeWidth:1.5,dot:!1,isAnimationActive:!1})]})})})}),me=v.memo(function({hash:e,className:s="",size:a="sm"}){const n=c(),[r,l]=v.useState(!1),o=v.useMemo(()=>i(e),[e]),d=v.useMemo(()=>o?n.find(e=>e.prefix===o)??null:null,[o,n]),h=v.useCallback(e=>{e.preventDefault(),e.stopPropagation(),l(!0)},[]),x=v.useCallback(()=>{l(!1)},[]);if(!d)return null;const m="sm"===a?"w-3.5 h-3.5":"w-4 h-4";return t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:h,className:`inline-flex items-center justify-center p-0.5 rounded text-signal-fair hover:text-accent-secondary hover:bg-signal-fair/10 focus:outline-none focus:ring-2 focus:ring-signal-fair/50 transition-colors cursor-pointer touch-manipulation ${s}`,title:`Prefix conflict: ${d.candidateCount} nodes share prefix "${o}"`,"aria-label":`View prefix conflict for ${o}`,children:t.jsx(V,{className:m})}),t.jsx(T,{isOpen:r,prefix:d.prefix,candidateHashes:d.candidateHashes,onClose:x})]})});function ue(e,t,s,a){const n=(s-e)*Math.PI/180,r=(a-t)*Math.PI/180,l=Math.sin(n/2)*Math.sin(n/2)+Math.cos(e*Math.PI/180)*Math.cos(s*Math.PI/180)*Math.sin(r/2)*Math.sin(r/2);return 2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l))*6371e3}const pe=Object.freeze(Object.defineProperty({__proto__:null,default:function(){const{stats:e}=o(),s=d(),a=h(),n=x(),r=m(),l=u(),[c,i]=v.useState(null),[N,y]=v.useState("lastHeard"),[b,w]=v.useState("desc"),[k,C]=v.useState(""),[S,H]=v.useState(!1),[L,$]=v.useState(null),[R,T]=v.useState(null),G=v.useMemo(()=>(null==e?void 0:e.neighbors)??{},[null==e?void 0:e.neighbors]),V=v.useMemo(()=>Object.fromEntries(Object.entries(G).filter(([e])=>!s.has(e))),[G,s]),Z=v.useMemo(()=>{var t;return(null==(t=null==e?void 0:e.config)?void 0:t.repeater)?{latitude:e.config.repeater.latitude,longitude:e.config.repeater.longitude,name:e.config.node_name||"Local Node"}:void 0},[e]),X=null==e?void 0:e.local_hash,Y=v.useMemo(()=>{const e=new Map;if(!(null==Z?void 0:Z.latitude)||!(null==Z?void 0:Z.longitude))return e;for(const[t,s]of Object.entries(V))s.latitude&&s.longitude&&0!==s.latitude&&0!==s.longitude?e.set(t,ue(Z.latitude,Z.longitude,s.latitude,s.longitude)):e.set(t,null);return e},[V,Z]),{neighborHashSet:te,neighborSignalMap:se}=v.useMemo(()=>{const e=new Set,t=new Map;for(const s of l)e.add(s.hash),t.set(s.hash,{avgRssi:s.avgRssi,avgSnr:s.avgSnr});return{neighborHashSet:e,neighborSignalMap:t}},[l]),ae=v.useMemo(()=>{const e=k.toLowerCase().trim(),t="neighbor"===e||"neighbors"===e,s=S||t;return Object.fromEntries(Object.entries(V).filter(([a,n])=>{if(s&&!te.has(a))return!1;if(t)return!0;if(!e)return!0;const r=(n.node_name||n.name||"").toLowerCase(),l=a.slice(2,4).toLowerCase();return r.includes(e)||l.includes(e)||a.toLowerCase().includes(e)}))},[V,k,S,te]),re=v.useMemo(()=>Object.entries(ae).sort(([e,t],[s,a])=>{let n=0;switch(N){case"lastHeard":n=(t.last_seen||0)-(a.last_seen||0);break;case"distance":{const t=Y.get(e)??null,a=Y.get(s)??null;n=null===t&&null===a?0:null===t?1:null===a?-1:t-a;break}case"centrality":n=(r.get(e)||0)-(r.get(s)||0)}return"desc"===b?-n:n}),[ae,N,b,Y,r]),le=re.filter(([,e])=>e.latitude&&e.longitude&&0!==e.latitude&&0!==e.longitude).length,ce=v.useMemo(()=>new Set(n),[n]),ie=v.useCallback(e=>{N===e?w(e=>"desc"===e?"asc":"desc"):(y(e),w("desc"))},[N]),oe=v.useCallback(e=>{const t=V[e];(null==t?void 0:t.latitude)&&(null==t?void 0:t.longitude)&&0!==t.latitude&&0!==t.longitude&&$(e)},[V]),de=v.useCallback(()=>{$(null)},[]);return t.jsxs(W,{children:[t.jsx(q,{title:"Contacts",icon:t.jsx(B,{}),controls:t.jsxs("div",{className:"flex items-baseline gap-3 sm:gap-4",children:[t.jsxs("span",{className:"roster-title tabular-nums",children:[re.length," node",1!==re.length?"s":""]}),le>0&&t.jsxs("span",{className:"roster-title flex items-baseline gap-1.5 tabular-nums",children:[t.jsx(I,{className:"w-3.5 h-3.5 relative top-[2px]"}),le," with location"]})]})}),t.jsx("div",{className:"relative",children:t.jsx(ee,{neighbors:V,localNode:Z,localHash:X,onRemoveNode:a,selectedNodeHash:L,onNodeSelected:de,highlightedEdgeKey:R})}),t.jsx(ne,{maxPaths:10,highlightedEdge:R,onHighlightEdge:T}),t.jsxs("div",{className:"chart-container",children:[t.jsxs("div",{className:"chart-header",children:[t.jsxs("div",{className:"chart-title",children:[t.jsx(B,{className:"chart-title-icon"}),"Discovered Contacts"]}),t.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[te.size>0&&t.jsxs("button",{onClick:()=>H(!S),className:"flex items-center gap-1 px-1.5 sm:px-2.5 py-1.5 text-xs rounded-lg transition-colors "+(S?"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:S?"Show all contacts":"Show only MeshCore neighbors (direct RF contact)",children:[t.jsx(p,{className:"w-3.5 h-3.5"}),t.jsx("span",{className:"hidden sm:inline",children:"Neighbors"}),t.jsx("span",{className:"sm:hidden tabular-nums",children:te.size})]}),t.jsxs("div",{className:"relative",children:[t.jsx(Q,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-text-muted"}),t.jsx("input",{type:"text",value:k,onChange:e=>C(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"}),k&&t.jsx("button",{onClick:()=>{C(""),"neighbor"!==k.toLowerCase().trim()&&"neighbors"!==k.toLowerCase().trim()||H(!1)},className:"absolute right-1.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary p-0.5",children:t.jsx(g,{className:"w-3 h-3"})})]}),t.jsxs("div",{className:"flex items-center gap-0.5 sm:gap-1",children:[t.jsxs("button",{onClick:()=>ie("lastHeard"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-xs rounded-lg transition-colors "+("lastHeard"===N?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover:bg-white/5"),title:"Sort by last heard",children:[t.jsx(j,{className:"w-3.5 h-3.5"}),t.jsx("span",{className:"hidden sm:inline",children:"Recent"}),"lastHeard"===N&&t.jsx(U,{className:"w-3 h-3 "+("asc"===b?"rotate-180":"")})]}),t.jsxs("button",{onClick:()=>ie("distance"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-xs rounded-lg transition-colors "+("distance"===N?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover:bg-white/5"),title:"Sort by distance",children:[t.jsx(J,{className:"w-3.5 h-3.5"}),t.jsx("span",{className:"hidden sm:inline",children:"Distance"}),"distance"===N&&t.jsx(U,{className:"w-3 h-3 "+("asc"===b?"rotate-180":"")})]}),t.jsxs("button",{onClick:()=>ie("centrality"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-xs rounded-lg transition-colors "+("centrality"===N?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover:bg-white/5"),title:"Sort by network centrality",children:[t.jsx(_,{className:"w-3.5 h-3.5"}),t.jsx("span",{className:"hidden sm:inline",children:"Centrality"}),"centrality"===N&&t.jsx(U,{className:"w-3 h-3 "+("asc"===b?"rotate-180":"")})]})]})]})]}),re.length>0?t.jsxs(t.Fragment,{children:[t.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:[t.jsx("div",{className:"contacts-col-node",children:"Node"}),t.jsx("div",{className:"contacts-col-signal text-right",children:"Signal"}),t.jsx("div",{className:"contacts-col-distance text-right",children:"Distance"}),t.jsx("div",{className:"contacts-col-centrality text-right",children:"Centrality"}),t.jsx("div",{className:"contacts-col-activity text-center",children:"Activity"}),t.jsx("div",{className:"contacts-col-seen text-right",children:"Last Seen"}),t.jsx("div",{className:"contacts-col-actions"})]}),t.jsx("div",{className:"divide-y divide-border-subtle/30",children:re.map(([e,s])=>{var a;const n=s.latitude&&s.longitude&&0!==s.latitude&&0!==s.longitude,l=s.node_name||s.name||"Unknown",c=ce.has(e),o=te.has(e),d=Y.get(e),h=r.get(e)||0,x=o?se.get(e):void 0,m=o&&x,u=null==(a=s.contact_type)?void 0:a.toLowerCase(),p="room server"===u||"room_server"===u||"room"===u||"server"===u,g="companion"===u||"client"===u||"cli"===u,j=s.is_repeater||"repeater"===u||"rep"===u,v=o?"direct":"flood",N=o?"Direct RF contact (zero-hop neighbor)":"Flood routing (multi-hop via mesh)";return t.jsxs("div",{className:`contacts-grid-row ${c?"bg-amber-500/5 border-l-2 border-l-amber-400":""} ${n?"cursor-pointer hover:bg-white/[0.02]":""}`,onClick:()=>oe(e),children:[t.jsxs("div",{className:"contacts-col-node flex items-center gap-2 min-w-0",children:[m&&null!==(null==x?void 0:x.avgSnr)?t.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0 self-center "+(b=x.avgSnr,void 0===b?"bg-[var(--signal-unknown)]":b>=5?"bg-[var(--signal-excellent)]":b>=0?"bg-[var(--signal-good)]":b>=-5?"bg-[var(--signal-fair)]":b>=-10?"bg-[var(--signal-poor)]":"bg-[var(--signal-critical)]")}):t.jsx("div",{className:"w-2 flex-shrink-0"}),t.jsx("div",{className:"roster-icon flex-shrink-0",title:N,children:p&&j?t.jsxs("div",{className:"relative w-5 h-5",children:[t.jsx(F,{className:"w-5 h-5 absolute inset-0 text-accent-secondary"}),t.jsx(O,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-accent-primary"})]}):p?t.jsx(F,{className:"w-5 h-5 text-accent-secondary"}):g?t.jsx(z,{className:"w-5 h-5 text-text-muted"}):j?"direct"===v?t.jsx(D,{className:"w-5 h-5 text-accent-success"}):t.jsx(O,{className:"w-5 h-5 text-accent-tertiary"}):t.jsx(z,{className:"w-5 h-5 text-text-muted"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-1.5 overflow-hidden",children:[t.jsx("span",{className:"roster-title truncate",title:l,children:l}),o&&t.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"}),c&&t.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:[t.jsx(K,{className:"w-3 h-3"}),"HUB"]}),j&&t.jsx("span",{className:"pill-tag flex-shrink-0",children:"RPT"})]}),t.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[t.jsx(E,{hash:e,size:"xs",prefixLength:8,suffixLength:6}),t.jsx(me,{hash:e})]})]})]}),t.jsxs("div",{className:"contacts-col-signal flex items-center justify-end gap-2",children:[m&&null!==(null==x?void 0:x.avgRssi)&&t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(M,{rssi:x.avgRssi,className:"w-3.5 h-3.5"}),t.jsx("span",{className:"type-data-xs tabular-nums text-text-muted",children:Math.round(x.avgRssi)})]}),m&&null!==(null==x?void 0:x.avgSnr)&&t.jsxs("span",{className:"type-data-xs tabular-nums text-text-muted",children:[x.avgSnr.toFixed(1)," dB"]})]}),t.jsx("div",{className:"contacts-col-distance flex items-center justify-end gap-1 text-text-muted",children:null!=d&&t.jsxs(t.Fragment,{children:[t.jsx(J,{className:"w-3 h-3"}),t.jsx("span",{className:"type-data-xs tabular-nums",children:(y=d,y<1e3?`${Math.round(y)}m`:`${(y/1e3).toFixed(1)}km`)})]})}),t.jsx("div",{className:"contacts-col-centrality flex items-center justify-end gap-1",children:h>0&&t.jsxs(t.Fragment,{children:[t.jsx(_,{className:"w-3 h-3 text-accent-secondary"}),t.jsxs("span",{className:"type-data-xs tabular-nums text-text-muted",children:[(100*h).toFixed(0),"%"]})]})}),t.jsx("div",{className:"contacts-col-activity flex items-center justify-center",children:t.jsx(xe,{nodeHash:e,width:48,height:16})}),t.jsx("div",{className:"contacts-col-seen flex items-center justify-end",children:t.jsx("span",{className:"type-data-xs tabular-nums text-text-primary whitespace-nowrap",children:s.last_seen?f(s.last_seen):"—"})}),t.jsx("div",{className:"contacts-col-actions flex items-center justify-end",children:t.jsx("button",{onClick:t=>{t.stopPropagation(),i({hash:e,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:t.jsx(A,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})})]},e);var y,b})})]}):t.jsxs("div",{className:"roster-empty",children:[t.jsx(B,{className:"roster-empty-icon"}),t.jsx("div",{className:"type-label text-text-secondary",children:"No Contacts Discovered"}),t.jsx("div",{className:"type-data-xs text-text-muted mt-1",children:"Contacts will appear here as they advertise on the mesh network."})]})]}),t.jsx(P,{isOpen:!!c,title:"Remove Contact",message:`Are you sure you would like to remove ${(null==c?void 0:c.name)||"this contact"}?`,confirmLabel:"Remove",cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{c&&a(c.hash),i(null)},onCancel:()=>i(null)})]})}},Symbol.toStringTag,{value:"Module"}));export{pe as C,Z as G,xe as N,me as P}; diff --git a/frontend/dist/assets/ContactsMapMapLibre-DADBlu6n.js b/frontend/dist/assets/ContactsMapMapLibre-DADBlu6n.js new file mode 100644 index 00000000..e358a5ad --- /dev/null +++ b/frontend/dist/assets/ContactsMapMapLibre-DADBlu6n.js @@ -0,0 +1 @@ +var e,t,n=Object.defineProperty,r=(e,t,r)=>((e,t,r)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);import{c as i,j as s,O as o,Q as a,a7 as A,X as l,_ as c,aw as u,ax as h,g as d,ay as f}from"./index-B-2Jxr7j.js";import{b as p,g,c as m,r as _}from"./recharts-bmHCCfxU.js";import{u as b,b as v,P as y,a as w,N as x,S as E}from"./maplibre-gl-t5lNjMoZ.js";import{T,C as S}from"./ConfirmModal-B3N0K8V1.js";import{a as C,C as k}from"./triangle-alert-DgnBDldk.js";import{G as R,P,N as I,T as M}from"./Contacts-DdomMPi3.js";import{L}from"./loader-circle-CpgDoVxS.js";import{g as B,e as N,f as D,h as O}from"./useThemeColors-zSiXVtFF.js";import{I as F}from"./info-DsmVqi2a.js";import{M as U,N as j}from"./CollisionExplorerModal-CR_bXIKw.js";import{H as G}from"./house-ClBwMRk7.js";import{R as z}from"./refresh-cw-CaoPFM1D.js";import{M as V}from"./map-pin-DUDH5S76.js";import{M as W}from"./map-6qITm9y3.js";import{E as H}from"./external-link-CBYhc14a.js";import"./maplibre-gl-CFO9X1Ek.js";import"./SignalIndicator-BKVtHdr4.js";import"./zap-xl716-0r.js";import"./activity-MCvW9Qx-.js";import"./trending-up-B8UTa5oU.js";import"./HashBadge-DctM4L1c.js";import"./PageLayout-CdW7LNwg.js";import"./users-CacnDxFB.js";import"./leaflet-ClE6qLuu.js";const $=i("car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]),X=i("chart-no-axes-column",[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V3",key:"1lcnhd"}],["path",{d:"M19 21V9",key:"unv183"}]]),Q=i("chevrons-left-right-ellipsis",[["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"m17 7 5 5-5 5",key:"1xlxn0"}],["path",{d:"m7 7-5 5 5 5",key:"19njba"}],["path",{d:"M8 12h.01",key:"czm47f"}]]),Y=i("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),q=i("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),K=i("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),Z=i("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),J=i("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),ee=i("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]),te=i("minimize-2",[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]),ne=i("mountain",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]]),re=i("waypoints",[["circle",{cx:"12",cy:"4.5",r:"2.5",key:"r5ysbb"}],["path",{d:"m10.2 6.3-3.9 3.9",key:"1nzqf6"}],["circle",{cx:"4.5",cy:"12",r:"2.5",key:"jydg6v"}],["path",{d:"M7 12h10",key:"b7w52i"}],["circle",{cx:"19.5",cy:"12",r:"2.5",key:"1piiel"}],["path",{d:"m13.8 17.7 3.9-3.9",key:"1wyg1y"}],["circle",{cx:"12",cy:"19.5",r:"2.5",key:"13o1pw"}]]);function ie(e,t){const n=Math.max(5,Math.min(e,300)),r=Math.log(5),i=Math.log(300);return 1+(Math.log(n)-r)/(i-r)*5}function se({label:e,icon:t,status:n,detail:r}){return s.jsxs("div",{className:m("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:[s.jsx("div",{className:m("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?s.jsx(C,{className:"w-4 h-4 text-accent-success"}):"active"===n?s.jsx(L,{className:"w-4 h-4 animate-spin text-accent-primary"}):s.jsx("span",{className:"text-text-muted",children:t})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:m("text-sm font-medium transition-colors","active"===n&&"text-accent-primary","complete"===n&&"text-accent-success","pending"===n&&"text-text-muted"),children:e}),r&&"pending"!==n&&s.jsx("div",{className:"text-xs text-text-muted mt-0.5 truncate",children:r})]})]})}const oe=p.memo(function({isOpen:e,currentStep:t,packetCount:n,onClose:r}){if(p.useEffect(()=>{if(!e)return;const t=e=>{"Escape"===e.key&&r&&r()};window.addEventListener("keydown",t);const n=document.body.style.overflow,i=document.body.style.position,s=document.body.style.width,o=document.body.style.top,a=window.scrollY;return document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%",document.body.style.top=`-${a}px`,()=>{window.removeEventListener("keydown",t),document.body.style.overflow=n,document.body.style.position=i,document.body.style.width=s,document.body.style.top=o,window.scrollTo(0,a)}},[e,r]),!e)return null;const i="complete"===t,o=e=>{const n=["fetching","analyzing","building","complete"],r=n.indexOf(t),i=n.indexOf(e);return i0?`${n.toLocaleString()} packets`:"Loading database..."}),s.jsx(se,{label:"Analyzing Database",icon:s.jsx(q,{className:"w-4 h-4"}),status:o("analyzing"),detail:"Processing packet paths"}),s.jsx(se,{label:"Building Topology",icon:s.jsx(R,{className:"w-4 h-4"}),status:o("building"),detail:"Computing mesh edges"})]}),s.jsx("p",{className:"text-xs text-text-muted text-center mt-5",children:"This may take a few seconds..."})]})})]}),document.body)}),ae={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"},edgeOpacity:.82},Ae=2e3;function le({text:e}){return s.jsxs("span",{className:"group relative cursor-help",children:[s.jsx(F,{className:"w-3 h-3 text-text-muted"}),s.jsx("div",{className:"absolute bottom-full left-0 mb-1 hidden group-hover:block w-44 p-2 text-[10px] leading-tight rounded-lg z-10 bg-tooltip-bg border border-border-subtle",children:e})]})}function ce(e){const t=new Date(1e3*e);return`${(t.getMonth()+1).toString().padStart(2,"0")}/${t.getDate().toString().padStart(2,"0")}`}function ue({hash:e,hashPrefix:t,name:n,isHub:r,isZeroHop:i,isMobile:A,isRoomServer:l,isStale:c,lastSeenTimestamp:u,centrality:h,affinity:d,meanSnr:f,meanRssi:g,neighbor:m,onRemove:_,txDelayRec:b,onPingResult:v}){const[y,w]=p.useState(!1),[x,E]=p.useState(!1),[S,R]=p.useState(null),[B,N]=p.useState(null),D=p.useCallback(async()=>{if(!x){E(!0),N(null),R(null);try{const t=e.startsWith("0x")?e.slice(0,4):`0x${e.slice(0,2)}`,n=await o(t,30);n.success&&n.data?(R(n.data),null==v||v(n.data)):N(n.error||"Ping failed")}catch(t){N(t instanceof Error?t.message:"Ping failed")}finally{E(!1)}}},[e,x,v]),O=i?"Direct":(null==d?void 0:d.typicalHopPosition)?`${d.typicalHopPosition}-hop`:null,F=[{label:"Packets",value:(null==d?void 0:d.frequency)||0},{label:"Adverts",value:m.advert_count||0}];i&&void 0!==f&&F.push({label:"SNR",value:`${f.toFixed(1)} dB`}),i&&void 0!==g&&F.push({label:"RSSI",value:`${Math.round(g)} dBm`});const U=b&&!b.insufficientData,j={hub:{bg:"bg-amber-500/20",text:"text-amber-400",title:"Hub: High-connectivity node (4+ neighbors) that bridges many paths"},backbone:{bg:"bg-purple-500/20",text:"text-purple-400",title:"Backbone: Critical relay with 4+ neighbors and high traffic"},relay:{bg:"bg-cyan-500/20",text:"text-cyan-400",title:"Relay: Standard forwarding node with symmetric traffic"},edge:{bg:"bg-gray-500/20",text:"text-gray-400",title:"Edge: Peripheral node with few connections"}},G={high:{bg:"bg-green-500/20",text:"text-green-400",title:"1000+ packets observed"},medium:{bg:"bg-amber-500/20",text:"text-amber-400",title:"500-999 packets observed"},low:{bg:"bg-red-500/20",text:"text-red-400",title:"100-499 packets observed"},insufficient:{bg:"bg-gray-500/20",text:"text-gray-400",title:"Insufficient data for analysis"}};return s.jsxs("div",{className:"w-[220px] pr-3",children:[s.jsx("div",{className:"text-[14px] font-semibold text-text-primary leading-snug truncate mb-0.5",children:n}),s.jsxs("div",{className:"flex items-center gap-1 flex-wrap mb-1.5",children:[s.jsx("code",{className:"font-mono text-[10px] text-text-muted/70 bg-white/5 px-1 py-px rounded",children:t}),s.jsx("button",{onClick:()=>{navigator.clipboard.writeText(e),w(!0),setTimeout(()=>w(!1),1500)},className:"p-0.5 hover:bg-white/10 rounded transition-colors",title:"Copy full hash",children:y?s.jsx(C,{className:"w-2.5 h-2.5 text-accent-success"}):s.jsx(k,{className:"w-2.5 h-2.5 text-text-muted/50"})}),s.jsx(P,{hash:e,size:"sm"}),r&&s.jsx("span",{className:"px-1 py-px text-[8px] font-bold uppercase rounded",style:{backgroundColor:"#FBBF24",color:"#000"},children:"Hub"}),O&&s.jsx("span",{className:"px-1 py-px text-[8px] font-bold uppercase rounded "+(i?"bg-map-neighbor-color text-black":"bg-white/[0.08] text-white/50"),children:O}),A&&s.jsx("span",{className:"px-1 py-px text-[8px] font-bold uppercase rounded bg-orange-500/25 text-orange-300",children:"Mobile"}),m.is_repeater&&s.jsx("span",{className:"px-1 py-px text-[8px] font-bold uppercase rounded bg-cyan-500/20 text-cyan-400",children:"Rptr"}),l&&s.jsx("span",{className:"px-1 py-px text-[8px] font-bold uppercase rounded bg-amber-500/25 text-amber-400",children:"Room"}),c&&u&&s.jsxs("span",{className:"px-1 py-px text-[8px] font-medium rounded bg-gray-500/30 text-gray-300",title:"Neighbor not heard in 7+ days",children:["Idle ",ce(u)]})]}),s.jsxs("div",{className:"text-[10px] text-text-muted/60 mb-2 leading-tight",children:[s.jsx("span",{children:a(m.last_seen)}),(null==d?void 0:d.distanceMeters)&&s.jsxs("span",{className:"font-medium text-text-muted/80",children:[" · ",(z=d.distanceMeters,null===z?"—":z<1e3?`${Math.round(z)}m`:`${(z/1e3).toFixed(1)}km`)]}),m.latitude&&m.longitude&&0!==m.latitude&&0!==m.longitude&&s.jsxs("span",{className:"font-mono text-[9px]",children:[" · ",m.latitude.toFixed(4),", ",m.longitude.toFixed(4)]})]}),s.jsx("div",{className:"mb-2",children:s.jsx(I,{nodeHash:e,width:"100%",height:28,showArea:!0,showTooltip:!0})}),s.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-0.5 text-[11px] mb-2",children:[F.map((e,t)=>s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-text-muted/50",children:e.label}),s.jsx("span",{className:"font-semibold tabular-nums "+("highlight"in e&&e.highlight?"text-amber-400":""),children:e.value})]},t)),U&&b.networkRole&&s.jsx(s.Fragment,{children:s.jsxs("div",{className:"flex items-center justify-between col-span-2 mt-1 pt-1 border-t border-white/5",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"text-text-muted/50",children:"Role"}),s.jsx("span",{className:`px-1.5 py-px text-[8px] font-bold uppercase rounded ${j[b.networkRole].bg} ${j[b.networkRole].text}`,title:j[b.networkRole].title,children:b.networkRole})]}),b.dataConfidence&&s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"text-text-muted/50",children:"Data"}),s.jsx("span",{className:`px-1.5 py-px text-[8px] font-bold uppercase rounded ${G[b.dataConfidence].bg} ${G[b.dataConfidence].text}`,title:G[b.dataConfidence].title,children:b.dataConfidence})]})]})})]}),(U||_)&&s.jsxs("div",{className:"pt-1.5 border-t border-white/5",children:[U&&s.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[s.jsx("span",{className:"text-text-muted/50",children:"TX Delay"}),s.jsxs("span",{className:"font-semibold tabular-nums text-amber-400",children:["×",(b.floodFactor??b.txDelayFactor).toFixed(1)]}),s.jsx("span",{className:"text-text-muted/30",children:"flood"}),s.jsxs("span",{className:"font-semibold tabular-nums text-amber-400",children:["×",(b.directFactor??b.directTxDelayFactor).toFixed(1)]}),s.jsx("span",{className:"text-text-muted/30",children:"direct"})]}),s.jsxs("div",{className:"flex items-center justify-between "+(U?"mt-1.5":""),children:[i&&s.jsxs("button",{onClick:D,disabled:x,className:"flex items-center gap-1 px-1.5 py-1 text-[10px] text-text-muted/50 hover:text-accent-primary hover:bg-accent-primary/10 rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:"Ping neighbor for updated signal info",children:[x?s.jsx(L,{className:"w-3 h-3 animate-spin"}):s.jsx(M,{className:"w-3 h-3"}),s.jsx("span",{children:"Ping"})]}),!i&&s.jsx("div",{}),_&&s.jsx("button",{onClick:_,className:"flex items-center gap-0.5 p-1 text-[10px] text-text-muted/30 hover:text-red-400 hover:bg-red-500/10 rounded transition-colors",title:"Remove from contacts",children:s.jsx(T,{className:"w-3 h-3"})})]}),S&&s.jsxs("div",{className:"mt-1.5 pt-1.5 border-t border-white/5 text-[10px]",children:[s.jsxs("div",{className:"flex items-center gap-2 text-accent-success",children:[s.jsx(C,{className:"w-3 h-3"}),s.jsx("span",{className:"font-medium",children:"Ping successful"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-0.5 mt-1",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-text-muted/50",children:"RTT"}),s.jsxs("span",{className:"font-semibold tabular-nums",children:[S.rtt_ms.toFixed(0),"ms"]})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-text-muted/50",children:"SNR"}),s.jsxs("span",{className:"font-semibold tabular-nums",children:[S.snr_db.toFixed(1)," dB"]})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-text-muted/50",children:"RSSI"}),s.jsxs("span",{className:"font-semibold tabular-nums",children:[S.rssi," dBm"]})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-text-muted/50",children:"Hops"}),s.jsx("span",{className:"font-semibold tabular-nums",children:S.path.length})]})]})]}),B&&s.jsx("div",{className:"mt-1.5 pt-1.5 border-t border-white/5 text-[10px] text-red-400",children:s.jsxs("span",{children:["⚠ ",B]})})]})]});var z}function he({showTopology:e,validatedPolylineCount:t,filteredNeighborCount:n,hasLocalNode:r,meshTopology:i,zeroHopNeighbors:o,neighborsWithLocation:a}){const A=D();return s.jsxs("div",{className:"map-control-glass text-xs",style:{padding:"0.625rem"},children:[s.jsxs("div",{className:"text-text-secondary font-medium mb-1.5 flex items-center gap-1",children:["Nodes",s.jsx(le,{text:"Node type shown by shape. Yellow = direct RF neighbor."})]}),s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"10px",height:"10px",backgroundColor:A.nodeFill}}),s.jsx("span",{className:"text-text-muted",children:"Node"}),s.jsx(le,{text:"Standard mesh node. Can be a repeater, client, or companion device."})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"10px",height:"10px",backgroundColor:A.hubColor}}),s.jsx("span",{className:"text-text-muted",children:"Hub"}),s.jsx(le,{text:"Network hub (≥10% of last-hop traffic). Hubs are central to mesh traffic flow."})]}),(l=a,l.some(([,e])=>{var t;const n=null==(t=e.contact_type)?void 0:t.toLowerCase();return"room server"===n||"room_server"===n||"room"===n||"server"===n})&&s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(U,{className:"w-3 h-3 flex-shrink-0",style:{color:A.roomColor},strokeWidth:2.5}),s.jsx("span",{className:"text-text-muted",children:"Room"}),s.jsx(le,{text:"Room Server identity. Hosts a chat room that clients can sync messages with."})]})),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(G,{className:"w-3 h-3 flex-shrink-0",style:{color:A.localColor},strokeWidth:2.5}),s.jsx("span",{className:"text-text-muted",children:"Local"}),s.jsx(le,{text:"Your repeater. This is the node running pyMC_Repeater that you're connected to."})]}),o.size>0&&s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"rounded flex-shrink-0",style:{width:"12px",height:"8px",backgroundColor:A.neighborColor}}),s.jsx("span",{className:"text-text-muted",children:"Neighbor"}),s.jsx(le,{text:"Zero-hop direct RF contact. Color indicates we receive their ADVERTs directly."})]}),i.gatewayNodes.length>0&&s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"10px",height:"10px",backgroundColor:A.hubColor,opacity:.7}}),s.jsx("span",{className:"text-text-muted",children:"Gateway"}),s.jsx(le,{text:"Significant traffic forwarder (7-10% of last-hop traffic). Gateways relay substantial traffic to the local node."})]}),i.mobileNodes.length>0&&s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"rounded-full flex-shrink-0",style:{width:"10px",height:"10px",background:"transparent",border:`4px solid ${A.mobileColor}`,boxSizing:"border-box"}}),s.jsx("span",{className:"text-text-muted",children:"Mobile"}),s.jsx(le,{text:"Volatile node that frequently appears/disappears from paths. Likely a portable or vehicle-mounted device."})]})]}),o.size>0&&s.jsx("div",{className:"mt-1.5 pt-1.5 border-t border-white/10",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"flex-shrink-0",style:{width:"14px",height:"2px",backgroundImage:`repeating-linear-gradient(90deg, ${ae.edges.neighborRest} 0, ${ae.edges.neighborRest} 3px, transparent 3px, transparent 5px)`,borderRadius:"1px"}}),s.jsx("span",{className:"text-text-muted",children:"Neighbor"}),s.jsx(le,{text:"Dashed gray → yellow on hover. Direct RF contact with local."})]})}),e&&t>0&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"text-text-secondary font-medium mt-2 pt-2 border-t border-white/10 mb-1 flex items-center gap-1",children:["Topology",s.jsx(le,{text:"Links with 5+ validations. Thickness = relative strength."})]}),s.jsxs("div",{className:"flex flex-col gap-0.5 text-text-muted",children:[s.jsxs("div",{className:"flex justify-between tabular-nums",children:[s.jsx("span",{children:"Nodes"}),s.jsx("span",{className:"text-text-secondary",children:n+(r?1:0)})]}),s.jsxs("div",{className:"flex justify-between tabular-nums",children:[s.jsx("span",{children:"Links"}),s.jsx("span",{className:"text-text-secondary",children:t})]}),i.hubNodes.length>0&&s.jsxs("div",{className:"flex justify-between tabular-nums",children:[s.jsx("span",{children:"Hubs"}),s.jsx("span",{style:{color:ae.hubColor},children:i.hubNodes.length})]})]}),s.jsx("div",{className:"flex flex-col gap-1 mt-1.5 pt-1.5 border-t border-white/10",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"flex-shrink-0",style:{width:"14px",height:"3px",backgroundColor:ae.edges.rest,borderRadius:"1px"}}),s.jsx("span",{className:"text-text-muted",children:"Link"}),s.jsx(le,{text:"Gray at rest. Hover to reveal type (teal=direct, indigo=loop)."})]})}),i.loops.length>0&&s.jsx("div",{className:"mt-1.5 pt-1.5 border-t border-white/10",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(z,{className:"w-3 h-3 flex-shrink-0",style:{color:ae.edges.hoverLoop}}),s.jsxs("div",{className:"flex flex-col",children:[s.jsxs("span",{style:{color:ae.edges.hoverLoop},className:"font-medium",children:[i.loops.length," ",1===i.loops.length?"Loop":"Loops"]}),s.jsx("span",{className:"text-text-muted text-[10px] leading-tight",children:"Redundant paths"})]})]})})]})]});var l}const de="rgba(251, 191, 36, 0.2)";function fe({isDeepLoading:e,showDeepAnalysisModal:t,onDeepAnalysis:n,showTopology:r,onToggleTopology:i,hasValidatedPolylines:o,showNeighborLines:a,onToggleNeighborLines:A,hasNeighborPolylines:l,showNodes:c,onToggleNodes:u,soloHubs:h,onToggleSoloHubs:d,hasHubNodes:f,soloDirect:p,onToggleSoloDirect:g,hasZeroHopNeighbors:m,showCoverage:_,onToggleCoverage:b,show3DTerrain:v,onToggle3DTerrain:y,isFullscreen:w,onToggleFullscreen:x}){return s.jsxs("div",{className:"absolute top-4 right-4 z-[600] map-controls-container",children:[s.jsxs("button",{onClick:n,disabled:e||t,className:"map-control-glass px-3 py-2 flex items-center gap-2 transition-colors hover:bg-white/10 disabled:opacity-50 disabled:cursor-not-allowed",title:"Deep Analysis - Load full packet history and rebuild topology",children:[s.jsx("span",{className:"map-control-label text-xs font-medium text-text-primary",children:"Deep Analysis"}),s.jsx(X,{className:"w-4 h-4 text-accent-primary"})]}),o&&s.jsx("button",{onClick:i,className:"p-2 transition-colors hover:bg-white/10 "+(r?"map-control-glass-active":"map-control-glass"),style:r?{backgroundColor:"rgba(74, 222, 128, 0.2)"}:void 0,title:r?"Hide topology lines":"Show topology lines",children:r?s.jsx(R,{className:"w-4 h-4 text-green-400"}):s.jsx(Z,{className:"w-4 h-4 text-text-secondary"})}),l&&s.jsx("button",{onClick:A,className:"p-2 transition-colors hover:bg-white/10 "+(a?"map-control-glass-active":"map-control-glass"),style:a?{backgroundColor:de}:void 0,title:a?"Hide neighbor lines":"Show neighbor lines",children:s.jsx(re,{className:"w-4 h-4 "+(a?"text-amber-400":"text-text-secondary")})}),s.jsx("button",{onClick:u,className:"p-2 transition-colors hover:bg-white/10 "+(c?"map-control-glass-active":"map-control-glass"),style:c?{backgroundColor:"rgba(99, 102, 241, 0.2)"}:void 0,title:c?"Hide all nodes":"Show all nodes",children:c?s.jsx(V,{className:"w-4 h-4 text-indigo-400"}):s.jsx(Z,{className:"w-4 h-4 text-text-secondary"})}),f&&s.jsx("button",{onClick:d,className:"p-2 transition-colors hover:bg-white/10 "+(h?"map-control-glass-active":"map-control-glass"),style:h?{backgroundColor:de}:void 0,title:h?"Show all nodes":"Solo hubs & connections",children:s.jsx(j,{className:"w-4 h-4 "+(h?"text-amber-400":"text-text-secondary")})}),m&&s.jsx("button",{onClick:g,className:"p-2 transition-colors hover:bg-white/10 "+(p?"map-control-glass-active":"map-control-glass"),style:p?{backgroundColor:"rgba(67, 56, 202, 0.35)"}:void 0,title:p?"Show all nodes":"Solo direct (0-hop) nodes",children:s.jsx(Q,{className:"w-4 h-4 "+(p?"text-indigo-400":"text-text-secondary")})}),s.jsx("button",{onClick:y,className:"p-2 transition-colors hover:bg-white/10 "+(v?"map-control-glass-active":"map-control-glass"),style:v?{backgroundColor:"rgba(45, 212, 191, 0.2)"}:void 0,title:v?"Disable 3D terrain":"Enable 3D terrain",children:s.jsx(ne,{className:"w-4 h-4 "+(v?"text-teal-400":"text-text-secondary")})}),s.jsx("button",{onClick:x,className:"map-control-glass p-2 transition-colors hover:bg-white/10",title:w?"Exit fullscreen":"Fullscreen",children:w?s.jsx(te,{className:"w-4 h-4 text-text-secondary"}):s.jsx(ee,{className:"w-4 h-4 text-text-secondary"})})]})}function pe({isActive:e,onClick:t}){return s.jsxs("button",{onClick:t,className:"flex items-center gap-2 w-full text-left transition-colors hover:bg-white/5 "+(e?"map-control-glass-active":"map-control-glass"),style:{padding:"0.5rem 0.625rem",...e?{backgroundColor:"rgba(245, 158, 11, 0.15)"}:{}},title:e?"Configure wardriving coverage":"Show wardriving coverage",children:[s.jsx($,{className:"w-3.5 h-3.5 flex-shrink-0 "+(e?"text-amber-400":"text-text-secondary")}),s.jsx("span",{className:"text-xs font-medium "+(e?"text-amber-400":"text-text-secondary"),children:"Wardrive"})]})}function ge(e){let t=!0,n=-90,r=90,i=-180,s=180;for(const o of e.toLowerCase()){const e="0123456789bcdefghjkmnpqrstuvwxyz".indexOf(o);if(-1!==e)for(let o=4;o>=0;o--){const a=e>>o&1;if(t){const e=(i+s)/2;a?i=e:s=e}else{const e=(n+r)/2;a?n=e:r=e}t=!t}}return{lat:(n+r)/2,lon:(i+s)/2}}function me(e){return Math.exp(-e*Math.LN2/7)}const _e="pymc-wardriving-url",be="pymc-wardriving-enabled";function ve(e){"undefined"!=typeof localStorage&&(e?localStorage.setItem(_e,e):localStorage.removeItem(_e))}function ye(e){"undefined"!=typeof localStorage&&localStorage.setItem(be,String(e))}function we(e,t=null){if(null!==e){const n=(Math.max(-12,Math.min(12,e))+12)/24;return null!==t?.8*n+(Math.max(-120,Math.min(-50,t))+120)/70*.2:n}return null!==t?(Math.max(-120,Math.min(-50,t))+120)/70:.5}const xe=A((e,t)=>({status:"idle",isVisible:"undefined"!=typeof localStorage&&"true"===localStorage.getItem(be),coveragePoints:[],repeaters:[],error:null,stats:{coverageCount:0,repeaterCount:0,lastUpdated:null},url:"undefined"==typeof localStorage?"":localStorage.getItem(_e)||"",isModalOpen:!1,openModal:()=>e({isModalOpen:!0}),closeModal:()=>e({isModalOpen:!1}),setUrl:t=>e({url:t}),toggleVisibility:()=>{const n=!t().isVisible;ye(n),e({isVisible:n})},setVisible:t=>{ye(t),e({isVisible:t})},loadCoverage:async t=>{if(!t.trim())return e({error:"Please enter a URL",status:"error"}),!1;try{new URL(t.trim())}catch{return e({error:"Invalid URL format",status:"error"}),!1}e({error:null,status:"connecting"});try{e({status:"loading"});const n=await async function(e){const t=`${e.replace(/\/+$/,"").replace(/\/get-nodes$/,"").replace(/\/get-samples$/,"")}/get-samples`,n=await async function(e,t={},n=8e3){const r=new AbortController,i=setTimeout(()=>r.abort(),n);try{return await fetch(e,{...t,signal:r.signal})}catch(s){if(s instanceof Error&&"AbortError"===s.name)throw new Error(`Connection timed out after ${n/1e3}s`);throw s}finally{clearTimeout(i)}}(t,{headers:{Accept:"application/json"}});if(!n.ok)throw new Error(`Failed to fetch precise samples: ${n.status}`);return n.json()}(t.trim());if(!n||"object"!=typeof n)throw new Error("Invalid response from server");if(!Array.isArray(n.keys))throw new Error("No sample data found in response");e({status:"processing"});const r=function(e){var t;const n=[];for(const r of e.keys){if(!r.observed)continue;const{lat:e,lon:i}=ge(r.hash),s=parseInt(r.time,10),o=isNaN(s)?30:(Date.now()-s)/864e5,a=me(o),A=we(r.snr,r.rssi)*(.3+.7*a);n.push({lat:e,lon:i,successRate:r.observed?1:0,weight:A,totalSamples:1,ageDays:o,geohash:r.hash,repeaters:(null==(t=r.path)?void 0:t.map(e=>e.toLowerCase()))||[]})}return n}(n);if(0===r.length)throw new Error("No valid coverage points found");return e({coveragePoints:r,repeaters:[],stats:{coverageCount:r.length,repeaterCount:0,lastUpdated:new Date},status:"success",isVisible:!0,url:t.trim()}),ve(t.trim()),ye(!0),!0}catch(n){const t=n instanceof Error?n.message:"Failed to load coverage data";let r=t;return t.includes("timed out")?r="Connection timed out. Server may be unreachable or slow.":t.includes("Failed to fetch")||t.includes("NetworkError")?r="Could not connect to server. Check the URL and try again.":t.includes("CORS")?r="Server does not allow cross-origin requests.":t.includes("404")?r="Coverage endpoint not found. Check the URL.":(t.includes("ERR_NAME_NOT_RESOLVED")||t.includes("DNS"))&&(r="Server not found. Check the URL for typos."),e({error:r,status:"error"}),!1}},clearCoverage:()=>{e({coveragePoints:[],repeaters:[],stats:{coverageCount:0,repeaterCount:0,lastUpdated:null},status:"idle",error:null,isVisible:!1,url:""}),ve(""),ye(!1)}}));function Ee({status:e}){if("connecting"!==e&&"loading"!==e&&"processing"!==e)return null;const t={idle:"",connecting:"Connecting to server...",loading:"Fetching coverage data...",processing:"Processing coverage points...",success:"",error:""}[e];return t?s.jsxs("div",{className:"flex items-center gap-3 p-4 bg-amber-500/10 border border-amber-500/30 rounded-xl",children:[s.jsx("div",{className:"relative",children:s.jsx(L,{className:"w-5 h-5 text-amber-400 animate-spin"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-sm text-amber-400 font-medium",children:t}),s.jsx("div",{className:"mt-2 h-1 bg-amber-500/20 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-amber-400 rounded-full transition-all duration-300",style:{width:"connecting"===e?"30%":"loading"===e?"60%":"90%"}})})]})]}):null}function Te(){const{isModalOpen:e,closeModal:t,status:n,isVisible:r,stats:i,error:o,url:a,loadCoverage:A,clearCoverage:c,toggleVisibility:u,setUrl:h}=xe(),d="connecting"===n||"loading"===n||"processing"===n,[f,g]=p.useState(a),m=p.useCallback(async()=>{await A(f)},[f,A]),_=p.useCallback(()=>{g(""),c()},[c]),b=p.useCallback(e=>{"Enter"!==e.key||e.shiftKey||d||(e.preventDefault(),m())},[m,d]),v=p.useCallback(e=>{const t=e.target.value;g(t),h(t)},[h]);if(!e)return null;const y=i.coverageCount>0,w=f.trim().length>0&&!d;return s.jsxs("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center",children:[s.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-md",onClick:d?void 0:t}),s.jsxs("div",{className:"relative glass-card-elevated w-full max-w-md mx-4",children:[s.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border-subtle",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-2 rounded-lg bg-amber-500/20",children:s.jsx($,{className:"w-5 h-5 text-amber-400"})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Wardriving Coverage"}),s.jsx("p",{className:"text-xs text-text-muted",children:"Overlay RF coverage heatmap"})]})]}),s.jsx("button",{onClick:t,disabled:d,className:"p-2 rounded-lg hover:bg-white/10 transition-colors disabled:opacity-50",children:s.jsx(l,{className:"w-5 h-5 text-text-secondary"})})]}),s.jsxs("div",{className:"p-4 space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-2",children:"Coverage Server URL"}),s.jsx("input",{type:"url",value:f,onChange:v,onKeyDown:b,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:d}),s.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)"})]}),s.jsx(Ee,{status:n}),"error"===n&&o&&s.jsxs("div",{className:"flex items-start gap-3 p-3 bg-red-500/10 border border-red-500/30 rounded-xl",children:[s.jsx(Y,{className:"w-5 h-5 text-red-400 flex-shrink-0 mt-0.5"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-red-400 font-medium",children:"Connection Failed"}),s.jsx("p",{className:"text-xs text-red-400/80 mt-0.5",children:o})]})]}),"success"===n&&y&&s.jsxs("div",{className:"flex items-start gap-3 p-3 bg-green-500/10 border border-green-500/30 rounded-xl",children:[s.jsx(C,{className:"w-5 h-5 text-green-400 flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-sm text-green-400 font-medium",children:"Data Loaded Successfully"}),s.jsxs("p",{className:"text-xs text-green-400/80 mt-0.5",children:[i.coverageCount.toLocaleString()," coverage points • ",i.repeaterCount.toLocaleString()," repeaters"]})]})]}),y&&!d&&"success"!==n&&s.jsxs("div",{className:"flex items-start gap-3 p-3 bg-amber-500/10 border border-amber-500/30 rounded-xl",children:[s.jsx(W,{className:"w-5 h-5 text-amber-400 flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-sm text-amber-400 font-medium",children:"Coverage Data Loaded"}),s.jsxs("p",{className:"text-xs text-amber-400/80 mt-0.5",children:[i.coverageCount.toLocaleString()," points •",i.lastUpdated&&` Last updated ${i.lastUpdated.toLocaleTimeString()}`]})]})]})]}),s.jsxs("div",{className:"flex items-center justify-between gap-3 p-4 border-t border-border-subtle",children:[s.jsx("div",{className:"flex items-center gap-2",children:y&&s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:u,disabled:d,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-white/5 rounded-lg transition-colors disabled:opacity-50",title:r?"Hide heatmap":"Show heatmap",children:r?s.jsxs(s.Fragment,{children:[s.jsx(Z,{className:"w-3.5 h-3.5"})," Hide"]}):s.jsxs(s.Fragment,{children:[s.jsx(J,{className:"w-3.5 h-3.5"})," Show"]})}),s.jsxs("button",{onClick:_,disabled:d,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:[s.jsx(T,{className:"w-3.5 h-3.5"})," Clear"]})]})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:t,disabled:d,className:"px-4 py-2 text-sm font-medium text-text-secondary hover:bg-white/10 rounded-lg transition-colors disabled:opacity-50",children:y?"Done":"Cancel"}),s.jsx("button",{onClick:m,disabled:!w,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:d?s.jsxs(s.Fragment,{children:[s.jsx(L,{className:"w-4 h-4 animate-spin"}),"Loading..."]}):y?s.jsxs(s.Fragment,{children:[s.jsx(K,{className:"w-4 h-4"}),"Refresh"]}):s.jsxs(s.Fragment,{children:[s.jsx(H,{className:"w-4 h-4"}),"Connect"]})})]})]})]})]})}var Se=function(e){var t,n=void 0!==(e=e||{})?e:{},r={};for(t in n)n.hasOwnProperty(t)&&(r[t]=n[t]);var i,s="";"undefined"!=typeof document&&document.currentScript&&(s=document.currentScript.src),s=0!==s.indexOf("blob:")?s.substr(0,s.lastIndexOf("/")+1):"",i=function(e,t,n){var r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=function(){if(200==r.status||0==r.status&&r.response)t(r.response);else{var i=V(e);i?t(i.buffer):n()}},r.onerror=n,r.send(null)};var o=n.print||function(){}.bind(),a=n.printErr||function(){}.bind();for(t in r)r.hasOwnProperty(t)&&(n[t]=r[t]);r=null,n.arguments&&n.arguments;var A=0,l=!1;function c(e){var t=n["_"+e];return t||ne("Assertion failed: "+("Cannot call unknown function "+e+", make sure it is exported")),t}var u,h,d,f,p,g,m,_="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function b(e,t){return e?function(e,t,n){for(var r=t+n,i=t;e[i]&&!(i>=r);)++i;if(i-t>16&&e.subarray&&_)return _.decode(e.subarray(t,i));for(var s="";t>10,56320|1023&l)}}else s+=String.fromCharCode((31&o)<<6|a)}else s+=String.fromCharCode(o)}return s}(d,e,t):""}function v(e,t){return e%t>0&&(e+=t-e%t),e}function y(e){u=e,n.HEAP8=h=new Int8Array(e),n.HEAP16=f=new Int16Array(e),n.HEAP32=p=new Int32Array(e),n.HEAPU8=d=new Uint8Array(e),n.HEAPU16=new Uint16Array(e),n.HEAPU32=new Uint32Array(e),n.HEAPF32=g=new Float32Array(e),n.HEAPF64=m=new Float64Array(e)}"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");var w=n.TOTAL_MEMORY||33554432;function x(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var r=t.func;"number"==typeof r?void 0===t.arg?n.dynCall_v(r):n.dynCall_vi(r,t.arg):r(void 0===t.arg?null:t.arg)}else t()}}w=(u=n.buffer?n.buffer:new ArrayBuffer(w)).byteLength,y(u),p[7156]=5271536;var E=[],T=[],S=[],C=[];function k(e){E.unshift(e)}function R(e){C.unshift(e)}var P=Math.abs,I=Math.ceil,M=Math.floor,L=Math.min,B=0,N=null;n.preloadedImages={},n.preloadedAudios={};var D,O,F=null,U="data:application/octet-stream;base64,";function j(e){return String.prototype.startsWith?e.startsWith(U):0===e.indexOf(U)}function G(){return h.length}F="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAAAAUAAAACAAAAAAAAAAIAAAADAAAAAQAAAAQAAAAGAAAAAAAAAAUAAAADAAAABgAAAAQAAAAFAAAAAAAAAAEAAAACAAAABAAAAAUAAAAGAAAAAAAAAAIAAAADAAAAAQAAAAUAAAACAAAAAAAAAAEAAAADAAAABgAAAAQAAAAGAAAAAAAAAAUAAAACAAAAAQAAAAQAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAAAAAAEAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAYAAAAAAAAABQAAAAAAAAAAAAAABAAAAAUAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAYAAAAAAAAABgAAAAA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n/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//////////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAACAAAAAAAAAAIAAAABAAAAAQAAAAIAAAACAAAAAAAAAAUAAAAFAAAAAAAAAAIAAAACAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAAAAEAAAACAAAAAgAAAAIAAAAAAAAABQAAAAYAAAAAAAAAAgAAAAIAAAADAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAAAAAACAAAAAQAAAAMAAAACAAAAAgAAAAAAAAAFAAAABwAAAAAAAAACAAAAAgAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAACAAAAAAAAAAIAAAABAAAABAAAAAIAAAACAAAAAAAAAAUAAAAIAAAAAAAAAAIAAAACAAAAAwAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAIAAAAAAAAAAgAAAAEAAAAAAAAAAgAAAAIAAAAAAAAABQAAAAkAAAAAAAAAAgAAAAIAAAADAAAABQAAAAAAAAAAAAA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QZYNk/WyOTkB2i5b8of+GtdSDxvwpaaulDSwVADMQAX+lOAECEHWF8XNPmv1cr/B+VnvG/XyFG6opcCMD/mtR32/UEQP+2XEF3hui/ulBTjAt88r/imfCfRP+yP9zbvtc8XeO/TZuKJD5G6b/MaTExyXzyvxiTQeElXOO/rbJRQVGN9L/z0wR2g9DqvxOqKRxEX/O/FDGCEei99j9x8zV4VYTmP2lzCnsYk+u/l6ELZ9tg878pRXacaDT/v3k6GZRqoQXAVB67LiP56r94+LDK0Sn0vwO6pZ9b7wFAvK0nKVcc9j8+U/hCvyruv6QMsuuLQ/W/FPhKFYv46j8MyxaDTOW/v9L18g1caO2/vebfvctE9b/7GD8ZrF3xv3gx1AR9bQDAuMEtsM4c77+SabgA2nj0v5xKFIwxsATArKNSBaKsB0Cjara6ozTwv33ArMz7sfa/dF2U0FcWCcDxL357DJX/P69pJmt7c/G/quJYWJZl+L/YntVJlnrSP4sRLzXM+fe/46uU8w3c8r+q4lhYlmX4v85lu5+QRwRAsI0H/WU8479jaeZNtj/zv6riWFiWZfi/sI0H/WU847/OZbufkEcEQHAoPUBrnss/9exKzDtFtT88wM8kax+gP9OqeKeAYog/MW0ItiZvcj+ph+smvt5bP2lCaV5dEUU/StaUmQDaLz+kK9y22BMYP0O3whZuMwI/IIbgZGWE6z7UkjYaEM3UPuezxwa9cr8+LybxRMnFpz6E1N8DbPiRPsYjySMvK3s+//////8fAAj//////zMQCP////9/MiAI/////28yMAj/////YzJACP///z9iMlAI////N2IyYAj///8zYjJwCP//vzNiMoAI//+rM2IykAj/f6szYjKgCP8PqzNiMrAI/wOrM2IywAi/A6szYjLQCJ8DqzNiMuAImQOrM2Iy8Aj//////z8PCP//////Kx8I/////38pLwj/////Pyk/CP////85KU8I////PzgpXwj///8POClvCP///w44KX8I//8fDjgpjwj//w8OOCmfCP9/DQ44Ka8I/w8NDjgpvwj/DQ0OOCnPCP8MDQ44Kd8IxwwNDjgp7wjEDA0OOCn/CAcAAAAHAAAAAQAAA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=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{t=a.indexOf(e.charAt(l++))<<2|(i=a.indexOf(e.charAt(l++)))>>4,n=(15&i)<<4|(s=a.indexOf(e.charAt(l++)))>>2,r=(3&s)<<6|(o=a.indexOf(e.charAt(l++))),A+=String.fromCharCode(t),64!==s&&(A+=String.fromCharCode(n)),64!==o&&(A+=String.fromCharCode(r))}while(l=0){if((0|n)>13780509){if(0|(a=0|lt(15,A)))break;A=0|i[(l=A)>>2],l=0|i[l+4>>2]}else c=0|Zt(0|n,0|(a=((0|n)<0)<<31>>31),3,0),l=0|T(),a=0|Xt(0|n,0|a,1,0),a=0|Xt(0|(a=0|Zt(0|c,0|l,0|a,0|T())),0|T(),1,0),l=0|T(),i[A>>2]=a,i[A+4>>2]=l,A=a;if(cn(0|r,0,A<<3),0|s){cn(0|s,0,A<<2),a=0|D(e,t,n,r,s,A,l,0);break}(a=0|$t(A,4))?(c=0|D(e,t,n,r,a,A,l,0),Ht(a),a=c):a=13}else a=2}while(0);return M=o,0|a}function N(e,t,n,r,s){e|=0,t|=0,n|=0,r|=0,s|=0;var o,a,A=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0,g=0;if(a=M,M=M+16|0,g=a+8|0,i[(p=o=a)>>2]=e,i[p+4>>2]=t,(0|n)<0)return M=a,2;if(i[(A=r)>>2]=e,i[A+4>>2]=t,(A=!!(0|s))&&(i[s>>2]=0),0|je(e,t))return M=a,9;i[g>>2]=0;e:do{if((0|n)>=1)if(A)for(d=1,h=0,f=0,p=1,A=e;;){if(!(h|f)){if(0|(A=0|O(A,t,4,g,o)))break e;if(0|je(A=0|i[(t=o)>>2],t=0|i[t+4>>2])){A=9;break e}}if(0|(A=0|O(A,t,0|i[26800+(f<<2)>>2],g,o)))break e;if(A=0|i[(t=o)>>2],t=0|i[t+4>>2],i[(e=r+(d<<3)|0)>>2]=A,i[e+4>>2]=t,i[s+(d<<2)>>2]=p,l=(0|(e=h+1|0))==(0|p),u=6==(0|(c=f+1|0)),0|je(A,t)){A=9;break e}if((0|(p=p+(u&l&1)|0))>(0|n)){A=0;break}d=d+1|0,h=l?0:e,f=l?u?0:c:f}else for(d=1,h=0,f=0,p=1,A=e;;){if(!(h|f)){if(0|(A=0|O(A,t,4,g,o)))break e;if(0|je(A=0|i[(t=o)>>2],t=0|i[t+4>>2])){A=9;break e}}if(0|(A=0|O(A,t,0|i[26800+(f<<2)>>2],g,o)))break e;if(A=0|i[(t=o)>>2],t=0|i[t+4>>2],i[(e=r+(d<<3)|0)>>2]=A,i[e+4>>2]=t,l=(0|(e=h+1|0))==(0|p),u=6==(0|(c=f+1|0)),0|je(A,t)){A=9;break e}if((0|(p=p+(u&l&1)|0))>(0|n)){A=0;break}d=d+1|0,h=l?0:e,f=l?u?0:c:f}else A=0}while(0);return M=a,0|A}function D(e,t,n,r,s,o,a,A){n|=0,r|=0,s|=0,A|=0;var l,c,u,h=0,d=0,f=0,p=0,g=0,m=0,_=0;if(u=M,M=M+16|0,l=u+8|0,c=u,h=0|en(0|(e|=0),0|(t|=0),0|(o|=0),0|(a|=0)),f=0|T(),!(!(0|(_=0|i[(m=p=r+(h<<3)|0)>>2]))&!(0|(m=0|i[m+4>>2]))|(d=(0|_)==(0|e)&(0|m)==(0|t))))do{h=0|Jt(0|(h=0|Xt(0|h,0|f,1,0)),0|T(),0|o,0|a),f=0|T(),d=(0|(m=0|i[(_=p=r+(h<<3)|0)>>2]))==(0|e)&(0|(_=0|i[_+4>>2]))==(0|t)}while(!(!(0|m)&!(0|_)|d));if(h=s+(h<<2)|0,d&&(0|i[h>>2])<=(0|A))return M=u,0;if(i[(_=p)>>2]=e,i[_+4>>2]=t,i[h>>2]=A,(0|A)>=(0|n))return M=u,0;switch(d=A+1|0,i[l>>2]=0,0|(h=0|O(e,t,2,l,c))){case 9:g=9;break;case 0:(h=0|D(0|i[(h=c)>>2],0|i[h+4>>2],n,r,s,o,a,d))||(g=9)}e:do{if(9==(0|g)){switch(i[l>>2]=0,0|(h=0|O(e,t,3,l,c))){case 9:break;case 0:if(0|(h=0|D(0|i[(h=c)>>2],0|i[h+4>>2],n,r,s,o,a,d)))break e;break;default:break e}switch(i[l>>2]=0,0|(h=0|O(e,t,1,l,c))){case 9:break;case 0:if(0|(h=0|D(0|i[(h=c)>>2],0|i[h+4>>2],n,r,s,o,a,d)))break e;break;default:break e}switch(i[l>>2]=0,0|(h=0|O(e,t,5,l,c))){case 9:break;case 0:if(0|(h=0|D(0|i[(h=c)>>2],0|i[h+4>>2],n,r,s,o,a,d)))break e;break;default:break e}switch(i[l>>2]=0,0|(h=0|O(e,t,4,l,c))){case 9:break;case 0:if(0|(h=0|D(0|i[(h=c)>>2],0|i[h+4>>2],n,r,s,o,a,d)))break e;break;default:break e}switch(i[l>>2]=0,0|(h=0|O(e,t,6,l,c))){case 9:break;case 0:if(0|(h=0|D(0|i[(h=c)>>2],0|i[h+4>>2],n,r,s,o,a,d)))break e;break;default:break e}return M=u,0}}while(0);return M=u,0|h}function O(e,t,n,r,s){e|=0,t|=0,s|=0;var o,a,A=0,l=0,c=0,u=0,h=0,d=0,f=0;if((n|=0)>>>0>6)return 1;if(h=(0|i[(r|=0)>>2])%6|0,i[r>>2]=h,(0|h)>0){A=0;do{n=0|be(n),A=A+1|0}while((0|A)<(0|i[r>>2]))}if(h=0|nn(0|e,0|t,45),T(),(a=127&h)>>>0>121)return 5;o=0|Ve(e,t),A=0|nn(0|e,0|t,52),T(),A&=15;e:do{if(A){for(;;){if(c=0|nn(0|e,0|t,0|(l=3*(15-A|0)|0)),T(),7==(0|(c&=7))){t=5;break}if(f=!(0|Qe(A)),A=A+-1|0,d=0|rn(7,0,0|l),t&=~T(),e=0|rn(0|i[(f?432:16)+(28*c|0)+(n<<2)>>2],0,0|l)|e&~d,t|=l=0|T(),!(n=0|i[(f?640:224)+(28*c|0)+(n<<2)>>2])){n=0;break e}if(!A){u=8;break e}}return 0|t}u=8}while(0);8==(0|u)&&(e|=0|rn(0|(f=0|i[848+(28*a|0)+(n<<2)>>2]),0,45),t=T()|-1040385&t,n=0|i[4272+(28*a|0)+(n<<2)>>2],127&~f||(f=0|rn(0|i[848+(28*a|0)+20>>2],0,45),t=T()|-1040385&t,n=0|i[4272+(28*a|0)+20>>2],e=0|He(f|e,t),t=0|T(),i[r>>2]=1+(0|i[r>>2]))),c=0|nn(0|e,0|t,45),T(),c&=127;e:do{if(0|G(c)){t:do{if(1==(0|Ve(e,t))){if((0|a)!=(0|c)){if(0|H(c,0|i[7696+(28*a|0)>>2])){e=0|Xe(e,t),l=1,t=0|T();break}S(27795,26864,533,26872)}switch(0|o){case 3:e=0|He(e,t),t=0|T(),i[r>>2]=1+(0|i[r>>2]),l=0;break t;case 5:e=0|Xe(e,t),t=0|T(),i[r>>2]=5+(0|i[r>>2]),l=0;break t;case 0:return 9;default:return 1}}else l=0}while(0);if((0|n)>0){A=0;do{e=0|We(e,t),t=0|T(),A=A+1|0}while((0|A)!=(0|n))}if((0|a)!=(0|c)){if(!(0|z(c))){if(!!(0|l)|5!=(0|Ve(e,t)))break;i[r>>2]=1+(0|i[r>>2]);break}switch(127&h){case 8:case 118:break e}3!=(0|Ve(e,t))&&(i[r>>2]=1+(0|i[r>>2]))}}else if((0|n)>0){A=0;do{e=0|He(e,t),t=0|T(),A=A+1|0}while((0|A)!=(0|n))}}while(0);return i[r>>2]=((0|i[r>>2])+n|0)%6|0,i[(f=s)>>2]=e,i[f+4>>2]=t,0}function F(e,t,n,r){e|=0,t|=0,n|=0,r|=0;var s,o,a=0,A=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0;if(o=M,M=M+16|0,p=o+8|0,i[(f=s=o)>>2]=e,i[f+4>>2]=t,(0|n)<0)return M=o,2;if(!n)return i[(p=r)>>2]=e,i[p+4>>2]=t,M=o,0;i[p>>2]=0;e:do{if(0|je(e,t))e=9;else{a=0,f=e;do{if(0|(e=0|O(f,t,4,p,s)))break e;if(a=a+1|0,0|je(f=0|i[(t=s)>>2],t=0|i[t+4>>2])){e=9;break e}}while((0|a)<(0|n));i[(d=r)>>2]=f,i[d+4>>2]=t,d=n+-1|0,h=0,e=1;do{if(a=26800+(h<<2)|0,5==(0|h))for(l=0|i[a>>2],A=0,a=e;;){if(0|(e=0|O(0|i[(e=s)>>2],0|i[e+4>>2],l,p,s)))break e;if((0|A)!=(0|d)){if(c=0|i[(u=s)>>2],u=0|i[u+4>>2],i[(e=r+(a<<3)|0)>>2]=c,i[e+4>>2]=u,0|je(c,u)){e=9;break e}e=a+1|0}else e=a;if((0|(A=A+1|0))>=(0|n))break;a=e}else for(l=s,u=0|i[a>>2],c=0,a=e,A=0|i[l>>2],l=0|i[l+4>>2];;){if(0|(e=0|O(A,l,u,p,s)))break e;if(A=0|i[(l=s)>>2],l=0|i[l+4>>2],i[(e=r+(a<<3)|0)>>2]=A,i[e+4>>2]=l,e=a+1|0,0|je(A,l)){e=9;break e}if((0|(c=c+1|0))>=(0|n))break;a=e}h=h+1|0}while(h>>>0<6);e=(0|f)==(0|i[(e=s)>>2])&&(0|t)==(0|i[e+4>>2])?0:9}}while(0);return M=o,0|e}function U(e,t,n,r){n|=0,r|=0;var s,o,a,A=0,l=0;for(a=M,M=M+16|0,s=a,o=a+8|0,A=(A=!(0|je(e|=0,t|=0)))?1:2;;){if(i[o>>2]=0,!(0|O(e,t,A,o,s))&((0|i[(l=s)>>2])==(0|n)?(0|i[l+4>>2])==(0|r):0)){e=4;break}if((A=A+1|0)>>>0>=7){A=7,e=4;break}}return 4==(0|e)?(M=a,0|A):0}function j(e,t,n,r,o,a,A){t|=0,n|=0,r|=0,o|=0,a|=0,A|=0;var l,c,u,h,d,f,p,g,m,_,b=0,v=0,y=0,w=0,x=0,E=0,S=0,C=0,k=0,R=0,P=0,I=0,L=0,B=0,N=0,D=0,O=0,F=0,U=0;if(_=M,M=M+64|0,p=_+48|0,g=_+32|0,m=_+24|0,l=_+8|0,c=_,(0|(v=0|i[(e|=0)>>2]))<=0)return M=_,0;for(u=e+4|0,h=p+8|0,d=g+8|0,f=l+8|0,b=0,L=0;;){I=(y=0|i[u>>2])+(L<<4)|0,i[p>>2]=i[I>>2],i[p+4>>2]=i[I+4>>2],i[p+8>>2]=i[I+8>>2],i[p+12>>2]=i[I+12>>2],(0|L)==(v+-1|0)?(i[g>>2]=i[y>>2],i[g+4>>2]=i[y+4>>2],i[g+8>>2]=i[y+8>>2],i[g+12>>2]=i[y+12>>2]):(I=y+(L+1<<4)|0,i[g>>2]=i[I>>2],i[g+4>>2]=i[I+4>>2],i[g+8>>2]=i[I+8>>2],i[g+12>>2]=i[I+12>>2]),v=0|ne(p,g,r,m);e:do{if(v)y=0,b=v;else if(y=0|i[(v=m)>>2],(0|(v=0|i[v+4>>2]))>0|!(0|v)&y>>>0>0){P=0,I=0;t:for(;;){if(O=1/(+(y>>>0)+4294967296*+(0|v)),U=+s[p>>3],F=+((v=0|Qt(0|y,0|v,0|P,0|I))>>>0)+4294967296*+(0|T()),D=+(P>>>0)+4294967296*+(0|I),s[l>>3]=O*(U*F)+O*(+s[g>>3]*D),s[f>>3]=O*(+s[h>>3]*F)+O*(+s[d>>3]*D),0|(v=0|Ye(l,r,c))){b=v;break}E=0|en(0|(k=0|i[(R=c)>>2]),0|(R=0|i[R+4>>2]),0|t,0|n),w=0|T(),y=0|i[(x=v=A+(E<<3)|0)>>2],x=0|i[x+4>>2];n:do{if(!(0|y)&!(0|x))B=v,N=16;else for(S=0,C=0;;){if((0|S)>(0|n)|(0|S)==(0|n)&C>>>0>t>>>0){b=1;break t}if((0|y)==(0|k)&(0|x)==(0|R))break n;if(E=0|Jt(0|(v=0|Xt(0|E,0|w,1,0)),0|T(),0|t,0|n),w=0|T(),C=0|Xt(0|C,0|S,1,0),S=0|T(),!(0|(y=0|i[(x=v=A+(E<<3)|0)>>2]))&!(0|(x=0|i[x+4>>2]))){B=v,N=16;break}}}while(0);if(16!=(0|N)||(N=0,!(0|k)&!(0|R))||(i[(C=B)>>2]=k,i[C+4>>2]=R,C=a+(i[o>>2]<<3)|0,i[C>>2]=k,i[C+4>>2]=R,C=0|Xt(0|i[(C=o)>>2],0|i[C+4>>2],1,0),k=0|T(),i[(R=o)>>2]=C,i[R+4>>2]=k),P=0|Xt(0|P,0|I,1,0),I=0|T(),y=0|i[(v=m)>>2],!((0|(v=0|i[v+4>>2]))>(0|I)|(0|v)==(0|I)&y>>>0>P>>>0)){y=1;break e}}y=0}else y=1}while(0);if(L=L+1|0,!y){N=21;break}if((0|L)>=(0|(v=0|i[e>>2]))){b=0,N=21;break}}return 21==(0|N)?(M=_,0|b):0}function G(e){return(e|=0)>>>0>121?0|(e=0):0|(e=0|i[7696+(28*e|0)+16>>2])}function z(e){return 4==(0|(e|=0))|117==(0|e)|0}function V(e){return 0|i[11120+(216*(0|i[(e|=0)>>2])|0)+(72*(0|i[e+4>>2])|0)+(24*(0|i[e+8>>2])|0)+(i[e+12>>2]<<3)>>2]}function W(e){return 0|i[11120+(216*(0|i[(e|=0)>>2])|0)+(72*(0|i[e+4>>2])|0)+(24*(0|i[e+8>>2])|0)+(i[e+12>>2]<<3)+4>>2]}function H(e,t){return t|=0,(0|i[7696+(28*(e|=0)|0)+20>>2])==(0|t)?0|(t=1):0|(t=(0|i[7696+(28*e|0)+24>>2])==(0|t))}function $(e,t){return 0|i[848+(28*(e|=0)|0)+((t|=0)<<2)>>2]}function X(e,t){return t|=0,(0|i[848+(28*(e|=0)|0)>>2])==(0|t)?0|(t=0):(0|i[848+(28*e|0)+4>>2])==(0|t)?0|(t=1):(0|i[848+(28*e|0)+8>>2])==(0|t)?0|(t=2):(0|i[848+(28*e|0)+12>>2])==(0|t)?0|(t=3):(0|i[848+(28*e|0)+16>>2])==(0|t)?0|(t=4):(0|i[848+(28*e|0)+20>>2])==(0|t)?0|(t=5):0|((0|i[848+(28*e|0)+24>>2])==(0|t)?6:7)}function Q(e){var t,n,r;return t=(r=+s[16+(e|=0)>>3])-(n=+s[e+24>>3]),+(r>3]<+s[e+24>>3]|0}function q(e){return+(+s[(e|=0)>>3]-+s[e+8>>3])}function K(e,t){e|=0;var n,r,i=0;return(i=+s[(t|=0)>>3])>=+s[e+8>>3]&&i<=+s[e>>3]?(n=+s[e+16>>3],i=+s[e+24>>3],t=(r=+s[t+8>>3])>=i,e=r<=n&1,n>3]<+s[t+8>>3]||+s[e+8>>3]>+s[t>>3]?0|(A=0):(i=(l=+s[e+16>>3])<(u=+s[(n=e+24|0)>>3]),c=(a=+s[(A=t+16|0)>>3])<(o=+s[(r=t+24|0)>>3]),t=u-a>3],t)||(u=+ot(+s[n>>3],e))>+ot(+s[A>>3],t)?0|(c=0):0|(c=1))}function J(e,t){t|=0;var n,r,i,o,a,A=0,l=0,c=0,u=0;return+s[(e|=0)>>3]<+s[t>>3]||+s[e+8>>3]>+s[t+8>>3]?0|(A=0):(i=(o=+s[(A=e+16|0)>>3])<(l=+s[e+24>>3]),c=(u=+s[(n=t+16|0)>>3])<(a=+s[(r=t+24|0)>>3]),t=l-u>3],t)?0|(c=(u=+ot(+s[A>>3],e))>=+ot(+s[n>>3],t)):0|(c=0))}function ee(e,t){e|=0,t|=0;var n,r,o,a,A,l=0;o=M,M=M+176|0,i[(r=o)>>2]=4,l=+s[t>>3],s[r+8>>3]=l,a=+s[t+16>>3],s[r+16>>3]=a,s[r+24>>3]=l,l=+s[t+24>>3],s[r+32>>3]=l,A=+s[t+8>>3],s[r+40>>3]=A,s[r+48>>3]=l,s[r+56>>3]=A,s[r+64>>3]=a,n=96+(t=r+72|0)|0;do{i[t>>2]=0,t=t+4|0}while((0|t)<(0|n));ln(0|e,0|r,168),M=o}function te(e,t,n){e|=0,t|=0,n|=0;var r,a,c,u,h,d,f,p=0,g=0,m=0,_=0,v=0,w=0,x=0;d=M,M=M+288|0,h=d+264|0,_=d+96|0,g=(p=m=d)+96|0;do{i[p>>2]=0,p=p+4|0}while((0|p)<(0|g));return 0|(t=0|et(t,m))?(M=d,0|(w=t)):(Ze(m=0|i[(g=m)>>2],g=0|i[g+4>>2],h),Je(m,g,_),u=+at(h,_+8|0),s[h>>3]=+s[e>>3],s[(g=h+8|0)>>3]=+s[e+16>>3],s[_>>3]=+s[e+8>>3],s[(m=_+8|0)>>3]=+s[e+24>>3],a=+at(h,_),x=+s[g>>3]-+s[m>>3],c=+l(+x),f=+s[h>>3]-+s[_>>3],r=+l(+f),!(0==x|0==f)&&(x=+on(+c,+r),x=+b(+a*a/+an(+x/+an(+c,+r),3)/(u*(2.59807621135*u)*.8)),s[o>>3]=x,v=~~x>>>0,w=+l(x)>=1?x>0?~~+y(+A(x/4294967296),4294967295)>>>0:~~+b((x-+(~~x>>>0))/4294967296)>>>0:0,2146435072&~i[o+4>>2])?(_=!(0|v)&!(0|w),i[(t=n)>>2]=_?1:v,i[t+4>>2]=_?0:w,t=0):t=1,M=d,0|(w=t))}function ne(e,t,n,r){e|=0,t|=0,n|=0,r|=0;var a,c,u,h,d=0,f=0,p=0;h=M,M=M+288|0,c=h+264|0,u=h+96|0,a=(d=f=h)+96|0;do{i[d>>2]=0,d=d+4|0}while((0|d)<(0|a));return 0|(n=0|et(n,f))?(M=h,0|(r=n)):(Ze(d=0|i[(n=f)>>2],n=0|i[n+4>>2],c),Je(d,n,u),p=+at(c,u+8|0),p=+b(+ +at(e,t)/(2*p)),s[o>>3]=p,n=~~p>>>0,d=+l(p)>=1?p>0?~~+y(+A(p/4294967296),4294967295)>>>0:~~+b((p-+(~~p>>>0))/4294967296)>>>0:0,2146435072&~i[o+4>>2]?(f=!(0|n)&!(0|d),i[r>>2]=f?1:n,i[r+4>>2]=f?0:d,M=h,0|(r=0)):(M=h,0|(r=1)))}function re(e,t,n,r){t|=0,n|=0,r|=0,i[(e|=0)>>2]=t,i[e+4>>2]=n,i[e+8>>2]=r}function ie(e){var t,n=0,r=0,s=0,o=0,a=0;n=0|i[(e|=0)>>2],r=0|i[(t=e+4|0)>>2],(0|n)<0&&(r=r-n|0,i[t>>2]=r,i[(a=e+8|0)>>2]=(0|i[a>>2])-n,i[e>>2]=0,n=0),(0|r)<0?(n=n-r|0,i[e>>2]=n,o=(0|i[(a=e+8|0)>>2])-r|0,i[a>>2]=o,i[t>>2]=0,r=0):(a=o=e+8|0,o=0|i[o>>2]),(0|o)<0&&(n=n-o|0,i[e>>2]=n,r=r-o|0,i[t>>2]=r,i[a>>2]=0,o=0),(0|(s=(0|o)<(0|(s=(0|r)<(0|n)?r:n))?o:s))<=0||(i[e>>2]=n-s,i[t>>2]=r-s,i[a>>2]=o-s)}function se(e,t){var n,r;t|=0,r=0|i[8+(e|=0)>>2],n=+((0|i[e+4>>2])-r|0),s[t>>3]=+((0|i[e>>2])-r|0)-.5*n,s[t+8>>3]=.8660254037844386*n}function oe(e,t,n){e|=0,t|=0,i[(n|=0)>>2]=(0|i[t>>2])+(0|i[e>>2]),i[n+4>>2]=(0|i[t+4>>2])+(0|i[e+4>>2]),i[n+8>>2]=(0|i[t+8>>2])+(0|i[e+8>>2])}function ae(e,t,n){e|=0,t|=0,i[(n|=0)>>2]=(0|i[e>>2])-(0|i[t>>2]),i[n+4>>2]=(0|i[e+4>>2])-(0|i[t+4>>2]),i[n+8>>2]=(0|i[e+8>>2])-(0|i[t+8>>2])}function Ae(e,t){t|=0;var n,r=0;r=0|v(0|i[(e|=0)>>2],t),i[e>>2]=r,n=0|v(0|i[(r=e+4|0)>>2],t),i[r>>2]=n,t=0|v(0|i[(e=e+8|0)>>2],t),i[e>>2]=t}function le(e){var t,n,r=0,s=0,o=0,a=0,A=0;A=(0|(n=0|i[(e|=0)>>2]))<0,e=(e=(s=(0|(a=((t=(0|(o=(0|i[e+4>>2])-(A?n:0)|0))<0)?0-o|0:0)+((0|i[e+8>>2])-(A?n:0))|0))<0)?0:a)-((o=(0|(s=(0|e)<(0|(s=(0|(r=(t?0:o)-(s?a:0)|0))<(0|(a=(A?0:n)-(t?o:0)-(s?a:0)|0))?r:a))?e:s))>0)?s:0)|0,r=r-(o?s:0)|0;e:do{switch(a-(o?s:0)|0){case 0:switch(0|r){case 0:return 0|(0|e?1==(0|e)?1:7:0);case 1:return 0|(0|e?1==(0|e)?3:7:2);default:break e}case 1:switch(0|r){case 0:return 0|(0|e?1==(0|e)?5:7:4);case 1:if(e)break e;return 6;default:break e}}}while(0);return 7}function ce(e){var t,n,r=0,s=0,o=0,a=0,A=0,l=0,c=0;if(l=0|i[(n=8+(e|=0)|0)>>2],(t=(0|i[e>>2])-l|0)>>>0>715827881|(l=(0|i[(c=e+4|0)>>2])-l|0)>>>0>715827881){if(a=2147483647-t|0,A=-2147483648-t|0,(o=(0|t)>0)?(0|a)<(0|t):(0|A)>(0|t))return 1;if(s=t<<1,o?(2147483647-s|0)<(0|t):(-2147483648-s|0)>(0|t))return 1;if((0|l)>0?(2147483647-l|0)<(0|l):(-2147483648-l|0)>(0|l))return 1;if(r=3*t|0,s=l<<1,(o?(0|a)<(0|s):(0|A)>(0|s))||((0|t)>-1?(-2147483648|r)>=(0|l):(-2147483648^r)<(0|l)))return 1}else s=l<<1,r=3*t|0;return o=0|Vt(.14285714285714285*+(r-l|0)),i[e>>2]=o,a=0|Vt(.14285714285714285*+(s+t|0)),i[c>>2]=a,i[n>>2]=0,r=(s=(0|a)<(0|o))?o:a,(0|(s=s?a:o))<0&&((-2147483648==(0|s)||((0|r)>0?(2147483647-r|0)<(0|s):(-2147483648-r|0)>(0|s)))&&S(27795,26892,354,26903),((0|r)>-1?(-2147483648|r)>=(0|s):(-2147483648^r)<(0|s))&&S(27795,26892,354,26903)),r=a-o|0,(0|o)<0?(s=0-o|0,i[c>>2]=r,i[n>>2]=s,i[e>>2]=0,o=0):(r=a,s=0),(0|r)<0&&(o=o-r|0,i[e>>2]=o,s=s-r|0,i[n>>2]=s,i[c>>2]=0,r=0),A=o-s|0,a=r-s|0,(0|s)<0?(i[e>>2]=A,i[c>>2]=a,i[n>>2]=0,r=a,a=A,s=0):a=o,(0|(o=(0|s)<(0|(o=(0|r)<(0|a)?r:a))?s:o))<=0||(i[e>>2]=a-o,i[c>>2]=r-o,i[n>>2]=s-o),0}function ue(e){var t,n=0,r=0,s=0,o=0,a=0,A=0,l=0;if(o=0|i[(t=8+(e|=0)|0)>>2],(a=(0|i[e>>2])-o|0)>>>0>715827881|(o=(0|i[(A=e+4|0)>>2])-o|0)>>>0>715827881){if((r=(0|a)>0)?(2147483647-a|0)<(0|a):(-2147483648-a|0)>(0|a))return 1;if(n=a<<1,(s=(0|o)>0)?(2147483647-o|0)<(0|o):(-2147483648-o|0)>(0|o))return 1;if(l=o<<1,s?(2147483647-l|0)<(0|o):(-2147483648-l|0)>(0|o))return 1;if(r?(2147483647-n|0)<(0|o):(-2147483648-n|0)>(0|o))return 1;if(r=3*o|0,(0|o)>-1?(-2147483648|r)>=(0|a):(-2147483648^r)<(0|a))return 1}else r=3*o|0,n=a<<1;return s=0|Vt(.14285714285714285*+(n+o|0)),i[e>>2]=s,o=0|Vt(.14285714285714285*+(r-a|0)),i[A>>2]=o,i[t>>2]=0,n=(r=(0|o)<(0|s))?s:o,(0|(r=r?o:s))<0&&((-2147483648==(0|r)||((0|n)>0?(2147483647-n|0)<(0|r):(-2147483648-n|0)>(0|r)))&&S(27795,26892,402,26917),((0|n)>-1?(-2147483648|n)>=(0|r):(-2147483648^n)<(0|r))&&S(27795,26892,402,26917)),n=o-s|0,(0|s)<0?(r=0-s|0,i[A>>2]=n,i[t>>2]=r,i[e>>2]=0,s=0):(n=o,r=0),(0|n)<0&&(s=s-n|0,i[e>>2]=s,r=r-n|0,i[t>>2]=r,i[A>>2]=0,n=0),a=s-r|0,o=n-r|0,(0|r)<0?(i[e>>2]=a,i[A>>2]=o,i[t>>2]=0,n=o,o=a,r=0):o=s,(0|(s=(0|r)<(0|(s=(0|n)<(0|o)?n:o))?r:s))<=0||(i[e>>2]=o-s,i[A>>2]=n-s,i[t>>2]=r-s),0}function he(e){var t,n,r=0,s=0,o=0,a=0,A=0;s=0|i[(t=8+(e|=0)|0)>>2],o=0|Vt(.14285714285714285*+((3*(r=(0|i[e>>2])-s|0)|0)-(s=(0|i[(n=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>>2]=n,i[s>>2]=A,i[r>>2]=0,a=n,t=0):A=o,(0|(o=(0|t)<(0|(o=(0|A)<(0|a)?A:a))?t:o))<=0||(i[e>>2]=a-o,i[s>>2]=A-o,i[r>>2]=t-o))}function me(e){var t,n,r,s=0,o=0,a=0,A=0;A=0|i[(e|=0)>>2],a=(s=0|i[(n=e+4|0)>>2])+A|0,A=(o=0|i[(r=e+8|0)>>2])+A|0,i[e>>2]=A,i[n>>2]=a,s=o+s|0,i[r>>2]=s,o=a-A|0,(0|A)<0?(s=s-A|0,i[n>>2]=o,i[r>>2]=s,i[e>>2]=0,a=0):(o=a,a=A),(0|o)<0&&(a=a-o|0,i[e>>2]=a,s=s-o|0,i[r>>2]=s,i[n>>2]=0,o=0),t=a-s|0,A=o-s|0,(0|s)<0?(i[e>>2]=t,i[n>>2]=A,i[r>>2]=0,a=t,s=0):A=o,(0|(o=(0|s)<(0|(o=(0|A)<(0|a)?A:a))?s:o))<=0||(i[e>>2]=a-o,i[n>>2]=A-o,i[r>>2]=s-o)}function _e(e){var t,n,r,s=0,o=0,a=0,A=0;s=0|i[(e|=0)>>2],a=0|i[(n=e+4|0)>>2],o=0|i[(r=e+8|0)>>2],A=a+s|0,i[e>>2]=A,a=o+a|0,i[n>>2]=a,s=o+s|0,i[r>>2]=s,o=a-A|0,(0|A)<0?(s=s-A|0,i[n>>2]=o,i[r>>2]=s,i[e>>2]=0,a=0):(o=a,a=A),(0|o)<0&&(a=a-o|0,i[e>>2]=a,s=s-o|0,i[r>>2]=s,i[n>>2]=0,o=0),t=a-s|0,A=o-s|0,(0|s)<0?(i[e>>2]=t,i[n>>2]=A,i[r>>2]=0,a=t,s=0):A=o,(0|(o=(0|s)<(0|(o=(0|A)<(0|a)?A:a))?s:o))<=0||(i[e>>2]=a-o,i[n>>2]=A-o,i[r>>2]=s-o)}function be(e){switch(0|(e|=0)){case 1:e=5;break;case 5:e=4;break;case 4:e=6;break;case 6:e=2;break;case 2:e=3;break;case 3:e=1}return 0|e}function ve(e){switch(0|(e|=0)){case 1:e=3;break;case 3:e=2;break;case 2:e=6;break;case 6:e=4;break;case 4:e=5;break;case 5:e=1}return 0|e}function ye(e){var t,n,r,s=0,o=0,a=0,A=0;s=0|i[(e|=0)>>2],o=0|i[(n=e+4|0)>>2],a=0|i[(r=e+8|0)>>2],A=o+(s<<1)|0,i[e>>2]=A,o=a+(o<<1)|0,i[n>>2]=o,s=(a<<1)+s|0,i[r>>2]=s,a=o-A|0,(0|A)<0?(s=s-A|0,i[n>>2]=a,i[r>>2]=s,i[e>>2]=0,o=a,a=0):a=A,(0|o)<0&&(a=a-o|0,i[e>>2]=a,s=s-o|0,i[r>>2]=s,i[n>>2]=0,o=0),t=a-s|0,A=o-s|0,(0|s)<0?(i[e>>2]=t,i[n>>2]=A,i[r>>2]=0,a=t,s=0):A=o,(0|(o=(0|s)<(0|(o=(0|A)<(0|a)?A:a))?s:o))<=0||(i[e>>2]=a-o,i[n>>2]=A-o,i[r>>2]=s-o)}function we(e){var t,n,r,s=0,o=0,a=0,A=0;A=0|i[(e|=0)>>2],a=((s=0|i[(n=e+4|0)>>2])<<1)+A|0,A=(o=0|i[(r=e+8|0)>>2])+(A<<1)|0,i[e>>2]=A,i[n>>2]=a,s=(o<<1)+s|0,i[r>>2]=s,o=a-A|0,(0|A)<0?(s=s-A|0,i[n>>2]=o,i[r>>2]=s,i[e>>2]=0,A=0):o=a,(0|o)<0&&(A=A-o|0,i[e>>2]=A,s=s-o|0,i[r>>2]=s,i[n>>2]=0,o=0),t=A-s|0,a=o-s|0,(0|s)<0?(i[e>>2]=t,i[n>>2]=a,i[r>>2]=0,A=t,s=0):a=o,(0|(o=(0|s)<(0|(o=(0|a)<(0|A)?a:A))?s:o))<=0||(i[e>>2]=A-o,i[n>>2]=a-o,i[r>>2]=s-o)}function xe(e,t){t|=0;var n,r,s,o=0,a=0,A=0;return s=(0|(r=(0|i[(e|=0)>>2])-(0|i[t>>2])|0))<0,n=(0|(a=(0|i[e+4>>2])-(0|i[t+4>>2])-(s?r:0)|0))<0,t=(t=(e=(0|(A=(s?0-r|0:0)+(0|i[e+8>>2])-(0|i[t+8>>2])+(n?0-a|0:0)|0))<0)?0:A)-((a=(0|(e=(0|t)<(0|(e=(0|(o=(n?0:a)-(e?A:0)|0))<(0|(A=(s?0:r)-(n?a:0)-(e?A:0)|0))?o:A))?t:e))>0)?e:0)|0,o=o-(a?e:0)|0,0|((0|(e=(0|(e=A-(a?e:0)|0))>-1?e:0-e|0))>(0|(t=(0|(o=(0|o)>-1?o:0-o|0))>(0|(t=(0|t)>-1?t:0-t|0))?o:t))?e:t)}function Ee(e){var t,n,r,s;n=(s=0|i[(t=8+(e|=0)|0)>>2])-(0|i[e>>2])|0,i[e>>2]=n,e=(0|i[(r=e+4|0)>>2])-s|0,i[r>>2]=e,i[t>>2]=0-(e+n)}function Te(e){var t,n,r=0,s=0,o=0,a=0,A=0;r=0-(s=0|i[(e|=0)>>2])|0,i[e>>2]=r,i[(t=e+8|0)>>2]=0,a=(o=0|i[(n=e+4|0)>>2])+s|0,(0|s)>0?(i[n>>2]=a,i[t>>2]=s,i[e>>2]=0,r=0,o=a):s=0,(0|o)<0?(A=r-o|0,i[e>>2]=A,s=s-o|0,i[t>>2]=s,i[n>>2]=0,a=A-s|0,r=0-s|0,(0|s)<0?(i[e>>2]=a,i[n>>2]=r,i[t>>2]=0,o=r,s=0):(o=0,a=A)):a=r,(0|(r=(0|s)<(0|(r=(0|o)<(0|a)?o:a))?s:r))<=0||(i[e>>2]=a-r,i[n>>2]=o-r,i[t>>2]=s-r)}function Se(e,t){var n=0;switch(n=0|nn(0|(e|=0),0|(t|=0),56),T(),7&n){case 0:case 7:return 0}return n=-2130706433&t|134217728,!0&268435456==(2013265920&t)?!0&16777216==(117440512&t)&!!(0|je(e,n))?0|(n=0):0|(n=0|De(e,n)):0|(n=0)}function Ce(e,t,n){n|=0;var r,s,o=0,a=0;return s=M,M=M+16|0,r=s,a=-2130706433&(t|=0)|134217728,!0&268435456==(2013265920&t)?(o=0|nn(0|(e|=0),0|t,56),T(),o=0|function(e,t,n){n|=0;var r,s=0,o=0;if(r=M,M=M+16|0,o=r,s=0|je(e|=0,t|=0),(n+-1|0)>>>0>5)return M=r,-1;if(1==(0|n)&(s=!!(0|s)))return M=r,-1;do{if(!(0|Lt(e,t,o))){if(s){s=(5+(0|i[26352+(n<<2)>>2])-(0|i[o>>2])|0)%5|0;break}s=(6+(0|i[26384+(n<<2)>>2])-(0|i[o>>2])|0)%6|0;break}s=-1}while(0);return M=r,0|(o=s)}(e,a,7&o),-1==(0|o)?(i[n>>2]=0,M=s,0|(a=6)):(0|Ke(e,a,r)&&S(27795,26932,282,26947),t=0|nn(0|e,0|t,52),T(),t&=15,0|je(e,a)?Re(r,t,o,2,n):Le(r,t,o,2,n),M=s,0|(a=0))):(M=s,0|(a=6))}function ke(e,t,n,r,o){t|=0,n|=0,r|=0,o|=0;var a,A=0,u=0;if(A=+function(e){var t,n;return n=+s[(e|=0)>>3],t=+s[e+8>>3],+ +c(+(n*n+t*t))}(e|=0),A<1e-16)return t=15600+(t<<4)|0,i[o>>2]=i[t>>2],i[o+4>>2]=i[t+4>>2],i[o+8>>2]=i[t+8>>2],void(i[o+12>>2]=i[t+12>>2]);if(u=+_(+ +s[e+8>>3],+ +s[e>>3]),(0|n)>0){e=0;do{A*=.37796447300922725,e=e+1|0}while((0|e)!=(0|n))}a=.3333333333333333*A,r?(n=!(0|Qe(n)),A=+m(.381966011250105*(n?a:.37796447300922725*a))):(A=+m(.381966011250105*A),0|Qe(n)&&(u=+it(u+.3334731722518321))),function(e,t,n,r){e|=0,t=+t,r|=0;var o=0,a=0,A=0,c=0;if((n=+n)<1e-16)return i[r>>2]=i[e>>2],i[r+4>>2]=i[e+4>>2],i[r+8>>2]=i[e+8>>2],void(i[r+12>>2]=i[e+12>>2]);a=t<0?t+6.283185307179586:t,a=t>=6.283185307179586?a+-6.283185307179586:a;do{if(!(a<1e-16)){if(o=+l(+(a+-3.141592653589793))<1e-16,t=+s[e>>3],o){t-=n,s[r>>3]=t,o=r;break}if(A=+h(+n),n=+d(+n),t=A*+d(+t)+ +h(+a)*(n*+h(+t)),t=+g(+((t=t>1?1:t)<-1?-1:t)),s[r>>3]=t,+l(+(t+-1.5707963267948966))<1e-16)return s[r>>3]=1.5707963267948966,void(s[r+8>>3]=0);if(+l(+(t+1.5707963267948966))<1e-16)return s[r>>3]=-1.5707963267948966,void(s[r+8>>3]=0);if(c=1/+h(+t),a=n*+d(+a)*c,n=+s[e>>3],t=c*((A-+d(+t)*+d(+n))/+h(+n)),A=a>1?1:a,t=t>1?1:t,(t=+s[e+8>>3]+ +_(+(A<-1?-1:A),+(t<-1?-1:t)))>3.141592653589793)do{t+=-6.283185307179586}while(t>3.141592653589793);if(t<-3.141592653589793)do{t+=6.283185307179586}while(t<-3.141592653589793);return void(s[r+8>>3]=t)}t=+s[e>>3]+n,s[r>>3]=t,o=r}while(0);if(+l(+(t+-1.5707963267948966))<1e-16)return s[o>>3]=1.5707963267948966,void(s[r+8>>3]=0);if(+l(+(t+1.5707963267948966))<1e-16)return s[o>>3]=-1.5707963267948966,void(s[r+8>>3]=0);if((t=+s[e+8>>3])>3.141592653589793)do{t+=-6.283185307179586}while(t>3.141592653589793);if(t<-3.141592653589793)do{t+=6.283185307179586}while(t<-3.141592653589793);s[r+8>>3]=t}(15600+(t<<4)|0,+it(+s[15920+(24*t|0)>>3]-u),A,o)}function Re(e,t,n,r,o){e|=0,t|=0,n|=0,r|=0,o|=0;var a,A,l,c,u,h,d,f,p,g,m,_,b,v,y,w,x,E,T,C,k,R,P=0,I=0,L=0,B=0,N=0,D=0;if(R=M,M=M+272|0,B=R+240|0,T=R,C=R+224|0,k=R+208|0,m=R+176|0,_=R+160|0,b=R+192|0,v=R+144|0,y=R+128|0,w=R+112|0,x=R+96|0,E=R+80|0,i[(P=R+256|0)>>2]=t,i[B>>2]=i[e>>2],i[B+4>>2]=i[e+4>>2],i[B+8>>2]=i[e+8>>2],i[B+12>>2]=i[e+12>>2],Pe(B,P,T),i[o>>2]=0,(0|(B=r+n+(5==(0|r)&1)|0))<=(0|n))M=R;else{A=C+4|0,l=m+4|0,c=n+5|0,u=16880+((a=0|i[P>>2])<<2)|0,h=16960+(a<<2)|0,d=y+8|0,f=w+8|0,p=x+8|0,g=k+4|0,L=n;e:for(;;){I=T+((0|L)%5<<4)|0,i[k>>2]=i[I>>2],i[k+4>>2]=i[I+4>>2],i[k+8>>2]=i[I+8>>2],i[k+12>>2]=i[I+12>>2];do{}while(2==(0|Ie(k,a,0,1)));if((0|L)>(0|n)&!!(0|Qe(t))){if(i[m>>2]=i[k>>2],i[m+4>>2]=i[k+4>>2],i[m+8>>2]=i[k+8>>2],i[m+12>>2]=i[k+12>>2],se(A,_),r=0|i[m>>2],P=0|i[17040+(80*r|0)+(i[C>>2]<<2)>>2],i[m>>2]=i[18640+(80*r|0)+(20*P|0)>>2],(0|(I=0|i[18640+(80*r|0)+(20*P|0)+16>>2]))>0){e=0;do{me(l),e=e+1|0}while((0|e)<(0|I))}switch(I=18640+(80*r|0)+(20*P|0)+4|0,i[b>>2]=i[I>>2],i[b+4>>2]=i[I+4>>2],i[b+8>>2]=i[I+8>>2],Ae(b,3*(0|i[u>>2])|0),oe(l,b,l),ie(l),se(l,v),N=+(0|i[h>>2]),s[y>>3]=3*N,s[d>>3]=0,D=-1.5*N,s[w>>3]=D,s[f>>3]=2.598076211353316*N,s[x>>3]=D,s[p>>3]=-2.598076211353316*N,0|i[17040+(80*(0|i[m>>2])|0)+(i[k>>2]<<2)>>2]){case 1:e=w,r=y;break;case 3:e=x,r=w;break;case 2:e=y,r=x;break;default:e=12;break e}Pt(_,v,r,e,E),ke(E,0|i[m>>2],a,1,o+8+(i[o>>2]<<4)|0),i[o>>2]=1+(0|i[o>>2])}if((0|L)<(0|c)&&(se(g,m),ke(m,0|i[k>>2],a,1,o+8+(i[o>>2]<<4)|0),i[o>>2]=1+(0|i[o>>2])),i[C>>2]=i[k>>2],i[C+4>>2]=i[k+4>>2],i[C+8>>2]=i[k+8>>2],i[C+12>>2]=i[k+12>>2],(0|(L=L+1|0))>=(0|B)){e=3;break}}3!=(0|e)?12==(0|e)&&S(26970,27017,572,27027):M=R}}function Pe(e,t,n){e|=0,t|=0,n|=0;var r,s=0,o=0,a=0,A=0,l=0;r=M,M=M+128|0,o=r,A=20240,l=60+(a=s=r+64|0)|0;do{i[a>>2]=i[A>>2],a=a+4|0,A=A+4|0}while((0|a)<(0|l));A=20304,l=(a=o)+60|0;do{i[a>>2]=i[A>>2],a=a+4|0,A=A+4|0}while((0|a)<(0|l));s=(l=!(0|Qe(0|i[t>>2])))?s:o,ye(o=e+4|0),we(o),0|Qe(0|i[t>>2])&&(pe(o),i[t>>2]=1+(0|i[t>>2])),i[n>>2]=i[e>>2],oe(o,s,t=n+4|0),ie(t),i[n+16>>2]=i[e>>2],oe(o,s+12|0,t=n+20|0),ie(t),i[n+32>>2]=i[e>>2],oe(o,s+24|0,t=n+36|0),ie(t),i[n+48>>2]=i[e>>2],oe(o,s+36|0,t=n+52|0),ie(t),i[n+64>>2]=i[e>>2],oe(o,s+48|0,n=n+68|0),ie(n),M=r}function Ie(e,t,n,r){n|=0,r|=0;var s,o,a,A,l,c,u=0,h=0,d=0,f=0,p=0;if(c=M,M=M+32|0,l=c+12|0,o=c,p=4+(e|=0)|0,f=0|i[16960+((t|=0)<<2)>>2],f=(A=!!(0|r))?3*f|0:f,u=0|i[p>>2],s=0|i[(a=e+8|0)>>2],A){if((0|(u=s+u+(r=0|i[(h=e+12|0)>>2])|0))==(0|f))return M=c,1;d=h}else u=s+u+(r=0|i[(d=e+12|0)>>2])|0;if((0|u)<=(0|f))return M=c,0;do{if((0|r)>0){if(r=0|i[e>>2],(0|s)>0){h=18640+(80*r|0)+60|0,r=e;break}r=18640+(80*r|0)+40|0,n?(re(l,f,0,0),ae(p,l,o),_e(o),oe(o,l,p),h=r,r=e):(h=r,r=e)}else h=18640+(80*(0|i[e>>2])|0)+20|0,r=e}while(0);if(i[r>>2]=i[h>>2],(0|i[(u=h+16|0)>>2])>0){r=0;do{me(p),r=r+1|0}while((0|r)<(0|i[u>>2]))}return e=h+4|0,i[l>>2]=i[e>>2],i[l+4>>2]=i[e+4>>2],i[l+8>>2]=i[e+8>>2],t=0|i[16880+(t<<2)>>2],Ae(l,A?3*t|0:t),oe(p,l,p),ie(p),r=A&&((0|i[a>>2])+(0|i[p>>2])+(0|i[d>>2])|0)==(0|f)?1:2,M=c,0|r}function Me(e,t){e|=0,t|=0;var n=0;do{n=0|Ie(e,t,0,1)}while(2==(0|n));return 0|n}function Le(e,t,n,r,o){e|=0,t|=0,n|=0,r|=0,o|=0;var a,A,l,c,u,h,d,f,p,g,m,_,b,v,y,w,x,E,T=0,C=0,k=0,R=0,P=0;if(E=M,M=M+240|0,v=E+208|0,y=E,w=E+192|0,x=E+176|0,p=E+160|0,g=E+144|0,m=E+128|0,_=E+112|0,b=E+96|0,i[(T=E+224|0)>>2]=t,i[v>>2]=i[e>>2],i[v+4>>2]=i[e+4>>2],i[v+8>>2]=i[e+8>>2],i[v+12>>2]=i[e+12>>2],Be(v,T,y),i[o>>2]=0,(0|(f=r+n+(6==(0|r)&1)|0))<=(0|n))M=E;else{A=n+6|0,l=16960+((a=0|i[T>>2])<<2)|0,c=g+8|0,u=m+8|0,h=_+8|0,d=w+4|0,C=0,k=n,r=-1;e:for(;;){if(e=y+((T=(0|k)%6|0)<<4)|0,i[w>>2]=i[e>>2],i[w+4>>2]=i[e+4>>2],i[w+8>>2]=i[e+8>>2],i[w+12>>2]=i[e+12>>2],e=C,C=0|Ie(w,a,0,1),(0|k)>(0|n)&!!(0|Qe(t))&&1!=(0|e)&&(0|i[w>>2])!=(0|r)){switch(se(y+((T+5|0)%6<<4)+4|0,x),se(y+(T<<4)+4|0,p),R=+(0|i[l>>2]),s[g>>3]=3*R,s[c>>3]=0,P=-1.5*R,s[m>>3]=P,s[u>>3]=2.598076211353316*R,s[_>>3]=P,s[h>>3]=-2.598076211353316*R,T=0|i[v>>2],0|i[17040+(80*T|0)+(((0|r)==(0|T)?i[w>>2]:r)<<2)>>2]){case 1:e=m,r=g;break;case 3:e=_,r=m;break;case 2:e=g,r=_;break;default:e=8;break e}Pt(x,p,r,e,b),0|It(x,b)||0|It(p,b)||(ke(b,0|i[v>>2],a,1,o+8+(i[o>>2]<<4)|0),i[o>>2]=1+(0|i[o>>2]))}if((0|k)<(0|A)&&(se(d,x),ke(x,0|i[w>>2],a,1,o+8+(i[o>>2]<<4)|0),i[o>>2]=1+(0|i[o>>2])),(0|(k=k+1|0))>=(0|f)){e=3;break}r=0|i[w>>2]}3!=(0|e)?8==(0|e)&&S(27054,27017,737,27099):M=E}}function Be(e,t,n){e|=0,t|=0,n|=0;var r,s=0,o=0,a=0,A=0,l=0;r=M,M=M+160|0,o=r,A=20368,l=72+(a=s=r+80|0)|0;do{i[a>>2]=i[A>>2],a=a+4|0,A=A+4|0}while((0|a)<(0|l));A=20448,l=(a=o)+72|0;do{i[a>>2]=i[A>>2],a=a+4|0,A=A+4|0}while((0|a)<(0|l));s=(l=!(0|Qe(0|i[t>>2])))?s:o,ye(o=e+4|0),we(o),0|Qe(0|i[t>>2])&&(pe(o),i[t>>2]=1+(0|i[t>>2])),i[n>>2]=i[e>>2],oe(o,s,t=n+4|0),ie(t),i[n+16>>2]=i[e>>2],oe(o,s+12|0,t=n+20|0),ie(t),i[n+32>>2]=i[e>>2],oe(o,s+24|0,t=n+36|0),ie(t),i[n+48>>2]=i[e>>2],oe(o,s+36|0,t=n+52|0),ie(t),i[n+64>>2]=i[e>>2],oe(o,s+48|0,t=n+68|0),ie(t),i[n+80>>2]=i[e>>2],oe(o,s+60|0,n=n+84|0),ie(n),M=r}function Ne(e,t){return t=0|nn(0|(e|=0),0|(t|=0),45),T(),127&t}function De(e,t){e|=0;var n=0,i=0,s=0,o=0;return!0&134217728==(-16777216&(t|=0))?(i=0|nn(0|e,0|t,52),T(),i&=15,n=0|nn(0|e,0|t,45),T(),(n&=127)>>>0>121?0|(e=0):!(613566756&(o=0|rn(0|(s=0|nn(0|e,0|t,0|(o=3*(15^i)|0))),0|T(),0|o))&Qt(-1227133514,-1171,0|o,0|(s=0|T())))&!(4681&s&T())&&15==(0|i)|!(0|(o=0|nn(0|rn(0|~e,0|~t,0|(o=19+(3*i|0)|0)),0|T(),0|o)))&!(0|T())?0|r[20528+n|0]?!(0|e)&!(0|(t&=8191))?0|(o=1):(o=0|sn(0|e,0|t),T(),0|!!((63-o|0)%3|0)):0|(o=1):0|(o=0)):0|(e=0)}function Oe(e,t,n,r){e|=0,n|=0,r|=0;var s=0,o=0,a=0,A=0;if(s=0|rn(0|(t|=0),0,52),o=0|T(),n=0|rn(0|n,0,45),n=0|o|T()|134225919,(0|t)<1)return o=-1,r=n,i[(t=e)>>2]=o,void(i[(e=e+4|0)>>2]=r);for(o=1,s=-1;A=0|rn(7,0,0|(a=3*(15-o|0)|0)),n&=~T(),s=s&~A|(a=0|rn(0|r,0,0|a)),n=0|n|T(),(0|o)!=(0|t);)o=o+1|0;i[(a=A=e)>>2]=s,i[(A=A+4|0)>>2]=n}function Fe(e,t,n,r){n|=0,r|=0;var s=0,o=0;if(o=0|nn(0|(e|=0),0|(t|=0),52),T(),n>>>0>15)return 4;if((0|(o&=15))<(0|n))return 12;if((0|o)==(0|n))return i[r>>2]=e,i[r+4>>2]=t,0;if(s=0|rn(0|n,0,52),s|=e,e=T()|-15728641&t,(0|o)>(0|n))do{t=0|rn(7,0,3*(14-n|0)|0),n=n+1|0,s|=t,e=0|T()|e}while((0|n)<(0|o));return i[r>>2]=s,i[r+4>>2]=e,0}function Ue(e,t,n,r){n|=0,r|=0;var s=0,o=0,a=0;if(o=0|nn(0|(e|=0),0|(t|=0),52),T(),!((0|n)<16&(0|(o&=15))<=(0|n)))return 4;s=n-o|0,n=0|nn(0|e,0|t,45),T();e:do{if(0|G(127&n)){t:do{if(0|o){for(n=1;!((a=0|rn(7,0,3*(15-n|0)|0))&e)&!((0|T())&t);){if(!(n>>>0>>0))break t;n=n+1|0}n=0|_t(7,0,s,((0|s)<0)<<31>>31),s=0|T();break e}}while(0);n=0|Xt(0|(n=0|Zt(0|(n=0|_t(7,0,s,((0|s)<0)<<31>>31)),0|T(),5,0)),0|T(),-5,-1),n=0|Xt(0|(n=0|Kt(0|n,0|T(),6,0)),0|T(),1,0),s=0|T()}else n=0|_t(7,0,s,((0|s)<0)<<31>>31),s=0|T()}while(0);return i[(a=r)>>2]=n,i[a+4>>2]=s,0}function je(e,t){var n=0,r=0,i=0;if(i=0|nn(0|(e|=0),0|(t|=0),45),T(),!(0|G(127&i)))return 0;i=0|nn(0|e,0|t,52),T(),i&=15;e:do{if(i)for(r=1;;){if(n=0|nn(0|e,0|t,3*(15-r|0)|0),T(),0|(n&=7))break e;if(!(r>>>0>>0)){n=0;break}r=r+1|0}else n=0}while(0);return 1&!(0|n)}function Ge(e,t,n,r){return e|=0,t|=0,(0|(r|=0))<(0|(n|=0))?(r=e,E(0|(n=t)),0|r):(n=0|rn(-1,-1,3+(3*(r-n|0)|0)|0),r=0|rn(0|~n,0|~T(),3*(15-r|0)|0),n=~T()&t,r=~r&e,E(0|n),0|r)}function ze(e,t,n,r){n|=0,r|=0;var s=0;return s=0|nn(0|(e|=0),0|(t|=0),52),T(),(0|n)<16&(0|(s&=15))<=(0|n)?((0|s)<(0|n)&&(s=0|rn(-1,-1,3+(3*(n+-1-s|0)|0)|0),s=0|rn(0|~s,0|~T(),3*(15-n|0)|0),t=~T()&t,e&=~s),s=0|rn(0|n,0,52),n=-15728641&t|T(),i[r>>2]=e|s,i[r+4>>2]=n,0|(r=0)):0|(r=4)}function Ve(e,t){var n=0,r=0,i=0;if(i=0|nn(0|(e|=0),0|(t|=0),52),T(),!(i&=15))return 0;for(r=1;;){if(n=0|nn(0|e,0|t,3*(15-r|0)|0),T(),0|(n&=7)){r=5;break}if(!(r>>>0>>0)){n=0,r=5;break}r=r+1|0}return 5==(0|r)?0|n:0}function We(e,t){var n=0,r=0,i=0,s=0,o=0,a=0,A=0;if(A=0|nn(0|(e|=0),0|(t|=0),52),T(),!(A&=15))return A=e,E(0|(a=t)),0|A;for(a=1,n=0;;){r=0|rn(7,0,0|(s=3*(15-a|0)|0)),i=0|T(),o=0|nn(0|e,0|t,0|s),T(),e=(s=0|rn(0|be(7&o),0,0|s))|e&~r,t=(o=0|T())|t&~i;e:do{if(!n)if(!(s&r|0)&!(o&i|0))n=0;else if(r=0|nn(0|e,0|t,52),T(),r&=15){n=1;t:for(;;){switch(o=0|nn(0|e,0|t,3*(15-n|0)|0),T(),7&o){case 1:break t;case 0:break;default:n=1;break e}if(!(n>>>0>>0)){n=1;break e}n=n+1|0}for(n=1;;){if(i=0|nn(0|e,0|t,0|(o=3*(15-n|0)|0)),T(),s=0|rn(7,0,0|o),t&=~T(),e=e&~s|(o=0|rn(0|be(7&i),0,0|o)),t=0|t|T(),!(n>>>0>>0)){n=1;break}n=n+1|0}}else n=1}while(0);if(!(a>>>0>>0))break;a=a+1|0}return E(0|t),0|e}function He(e,t){var n=0,r=0,i=0,s=0,o=0;if(r=0|nn(0|(e|=0),0|(t|=0),52),T(),!(r&=15))return r=e,E(0|(n=t)),0|r;for(n=1;o=0|nn(0|e,0|t,0|(s=3*(15-n|0)|0)),T(),i=0|rn(7,0,0|s),t&=~T(),e=(s=0|rn(0|be(7&o),0,0|s))|e&~i,t=0|T()|t,n>>>0>>0;)n=n+1|0;return E(0|t),0|e}function $e(e,t){var n=0,r=0,i=0,s=0,o=0,a=0,A=0;if(A=0|nn(0|(e|=0),0|(t|=0),52),T(),!(A&=15))return A=e,E(0|(a=t)),0|A;for(a=1,n=0;;){r=0|rn(7,0,0|(s=3*(15-a|0)|0)),i=0|T(),o=0|nn(0|e,0|t,0|s),T(),e=(s=0|rn(0|ve(7&o),0,0|s))|e&~r,t=(o=0|T())|t&~i;e:do{if(!n)if(!(s&r|0)&!(o&i|0))n=0;else if(r=0|nn(0|e,0|t,52),T(),r&=15){n=1;t:for(;;){switch(o=0|nn(0|e,0|t,3*(15-n|0)|0),T(),7&o){case 1:break t;case 0:break;default:n=1;break e}if(!(n>>>0>>0)){n=1;break e}n=n+1|0}for(n=1;;){if(s=0|rn(7,0,0|(i=3*(15-n|0)|0)),o=t&~T(),t=0|nn(0|e,0|t,0|i),T(),e=e&~s|(t=0|rn(0|ve(7&t),0,0|i)),t=0|o|T(),!(n>>>0>>0)){n=1;break}n=n+1|0}}else n=1}while(0);if(!(a>>>0>>0))break;a=a+1|0}return E(0|t),0|e}function Xe(e,t){var n=0,r=0,i=0,s=0,o=0;if(r=0|nn(0|(e|=0),0|(t|=0),52),T(),!(r&=15))return r=e,E(0|(n=t)),0|r;for(n=1;s=0|rn(7,0,0|(o=3*(15-n|0)|0)),i=t&~T(),t=0|nn(0|e,0|t,0|o),T(),e=(t=0|rn(0|ve(7&t),0,0|o))|e&~s,t=0|T()|i,n>>>0>>0;)n=n+1|0;return E(0|t),0|e}function Qe(e){return(0|(e|=0))%2|0}function Ye(e,t,n){n|=0;var r,o=0;return r=M,M=M+16|0,o=r,(t|=0)>>>0>15?(M=r,0|(o=4)):2146435072&~i[4+(e|=0)>>2]&&2146435072&~i[e+8+4>>2]?(function(e,t,n){var r,o;r=M,M=M+16|0,function(e,t,n,r){t|=0,r|=0;var o,a=0,A=0,l=0,c=0;if(o=M,M=M+16|0,function(e,t,n){t|=0,n|=0;var r,o,a=0;o=M,M=M+32|0,function(e,t){t|=0;var n,r,i=0;i=+s[(e|=0)>>3],n=+h(+i),i=+d(+i),s[t+16>>3]=i,i=+s[e+8>>3],r=n*+h(+i),s[t>>3]=r,i=n*+d(+i),s[t+8>>3]=i}(e|=0,r=o),i[t>>2]=0,s[n>>3]=5,(a=+Mt(16400,r))<+s[n>>3]&&(i[t>>2]=0,s[n>>3]=a),(a=+Mt(16424,r))<+s[n>>3]&&(i[t>>2]=1,s[n>>3]=a),(a=+Mt(16448,r))<+s[n>>3]&&(i[t>>2]=2,s[n>>3]=a),(a=+Mt(16472,r))<+s[n>>3]&&(i[t>>2]=3,s[n>>3]=a),(a=+Mt(16496,r))<+s[n>>3]&&(i[t>>2]=4,s[n>>3]=a),(a=+Mt(16520,r))<+s[n>>3]&&(i[t>>2]=5,s[n>>3]=a),(a=+Mt(16544,r))<+s[n>>3]&&(i[t>>2]=6,s[n>>3]=a),(a=+Mt(16568,r))<+s[n>>3]&&(i[t>>2]=7,s[n>>3]=a),(a=+Mt(16592,r))<+s[n>>3]&&(i[t>>2]=8,s[n>>3]=a),(a=+Mt(16616,r))<+s[n>>3]&&(i[t>>2]=9,s[n>>3]=a),(a=+Mt(16640,r))<+s[n>>3]&&(i[t>>2]=10,s[n>>3]=a),(a=+Mt(16664,r))<+s[n>>3]&&(i[t>>2]=11,s[n>>3]=a),(a=+Mt(16688,r))<+s[n>>3]&&(i[t>>2]=12,s[n>>3]=a),(a=+Mt(16712,r))<+s[n>>3]&&(i[t>>2]=13,s[n>>3]=a),(a=+Mt(16736,r))<+s[n>>3]&&(i[t>>2]=14,s[n>>3]=a),(a=+Mt(16760,r))<+s[n>>3]&&(i[t>>2]=15,s[n>>3]=a),(a=+Mt(16784,r))<+s[n>>3]&&(i[t>>2]=16,s[n>>3]=a),(a=+Mt(16808,r))<+s[n>>3]&&(i[t>>2]=17,s[n>>3]=a),(a=+Mt(16832,r))<+s[n>>3]&&(i[t>>2]=18,s[n>>3]=a),(a=+Mt(16856,r))<+s[n>>3]?(i[t>>2]=19,s[n>>3]=a,M=o):M=o}(e|=0,n|=0,c=o),(A=+p(+(1-.5*+s[c>>3])))<1e-16)return i[r>>2]=0,i[r+4>>2]=0,i[r+8>>2]=0,i[r+12>>2]=0,void(M=o);if(c=0|i[n>>2],a=+it((a=+s[15920+(24*c|0)>>3])-+it(+function(e,t){var n,r,i,o,a;return e|=0,o=+s[(t|=0)>>3],r=+h(+o),i=+s[t+8>>3]-+s[e+8>>3],a=r*+d(+i),n=+s[e>>3],+ +_(+a,+(+d(+o)*+h(+n)-+h(+i)*(r*+d(+n))))}(15600+(c<<4)|0,e))),l=0|Qe(t)?+it(a+-.3334731722518321):a,a=2.618033988749896*+f(+A),(0|t)>0){e=0;do{a*=2.6457513110645907,e=e+1|0}while((0|e)!=(0|t))}A=+h(+l)*a,s[r>>3]=A,l=+d(+l)*a,s[r+8>>3]=l,M=o}(e|=0,t|=0,n|=0,o=r),function(e,t){e|=0;var n,r,o,a,A=0,c=0,u=0,h=0,d=0,f=0,p=0;i[(a=8+(t|=0)|0)>>2]=0,r=+s[e>>3],h=+l(+r),o=+s[e+8>>3],h+=.5*(d=1.1547005383792515*+l(+o)),h-=+(0|(A=~~h)),d-=+(0|(e=~~d));do{if(h<.5){if(h<.3333333333333333){if(i[t>>2]=A,d<.5*(h+1)){i[t+4>>2]=e;break}e=e+1|0,i[t+4>>2]=e;break}if(e=(1&!(d<(p=1-h)))+e|0,i[t+4>>2]=e,p<=d&d<2*h){A=A+1|0,i[t>>2]=A;break}i[t>>2]=A;break}if(!(h<.6666666666666666)){if(A=A+1|0,i[t>>2]=A,d<.5*h){i[t+4>>2]=e;break}e=e+1|0,i[t+4>>2]=e;break}if(d<1-h){if(i[t+4>>2]=e,2*h-1>2]=A;break}}else e=e+1|0,i[t+4>>2]=e;A=A+1|0,i[t>>2]=A}while(0);do{if(r<0){if(1&e){A=~~(+(0|A)-(2*(+((f=0|Qt(0|A,((0|A)<0)<<31>>31,0|(f=(e+1|0)/2|0),((0|f)<0)<<31>>31))>>>0)+4294967296*+(0|T()))+1)),i[t>>2]=A;break}A=~~(+(0|A)-2*(+((f=0|Qt(0|A,((0|A)<0)<<31>>31,0|(f=(0|e)/2|0),((0|f)<0)<<31>>31))>>>0)+4294967296*+(0|T()))),i[t>>2]=A;break}}while(0);f=t+4|0,o<0&&(A=A-((1|e<<1)/2|0)|0,i[t>>2]=A,e=0-e|0,i[f>>2]=e),c=e-A|0,(0|A)<0?(u=0-A|0,i[f>>2]=c,i[a>>2]=u,i[t>>2]=0,e=c,A=0):u=0,(0|e)<0&&(A=A-e|0,i[t>>2]=A,u=u-e|0,i[a>>2]=u,i[f>>2]=0,e=0),n=A-u|0,c=e-u|0,(0|u)<0&&(i[t>>2]=n,i[f>>2]=c,i[a>>2]=0,e=c,A=n,u=0),(0|(c=(0|u)<(0|(c=(0|e)<(0|A)?e:A))?u:c))<=0||(i[t>>2]=A-c,i[f>>2]=e-c,i[a>>2]=u-c)}(o,n+4|0),M=r}(e,t,o),t=0|function(e,t){e|=0;var n,r=0,s=0,o=0,a=0,A=0,l=0,c=0,u=0;if(n=M,M=M+64|0,l=n+40|0,s=n+24|0,o=n+12|0,a=n,rn(0|(t|=0),0,52),r=134225919|T(),!t)return(0|i[e+4>>2])>2||(0|i[e+8>>2])>2||(0|i[e+12>>2])>2?(l=0,E(0|(A=0)),M=n,0|l):(rn(0|V(e),0,45),A=0|T()|r,l=-1,E(0|A),M=n,0|l);if(i[l>>2]=i[e>>2],i[l+4>>2]=i[e+4>>2],i[l+8>>2]=i[e+8>>2],i[l+12>>2]=i[e+12>>2],A=l+4|0,(0|t)>0)for(e=-1;i[s>>2]=i[A>>2],i[s+4>>2]=i[A+4>>2],i[s+8>>2]=i[A+8>>2],1&t?(he(A),i[o>>2]=i[A>>2],i[o+4>>2]=i[A+4>>2],i[o+8>>2]=i[A+8>>2],fe(o)):(de(A),i[o>>2]=i[A>>2],i[o+4>>2]=i[A+4>>2],i[o+8>>2]=i[A+8>>2],pe(o)),ae(s,o,a),ie(a),c=0|rn(7,0,0|(u=3*(15-t|0)|0)),r&=~T(),e=(u=0|rn(0|le(a),0,0|u))|e&~c,r=0|T()|r,(0|t)>1;)t=t+-1|0;else e=-1;e:do{if((0|i[A>>2])<=2&&(0|i[l+8>>2])<=2&&(0|i[l+12>>2])<=2){if(t=0|rn(0|(s=0|V(l)),0,45),t|=e,e=T()|-1040385&r,a=0|W(l),!(0|G(s))){if((0|a)<=0)break;for(o=0;;){if(s=0|nn(0|t,0|e,52),T(),s&=15)for(r=1;l=0|nn(0|t,0|e,0|(u=3*(15-r|0)|0)),T(),c=0|rn(7,0,0|u),e&=~T(),t=t&~c|(u=0|rn(0|be(7&l),0,0|u)),e=0|e|T(),r>>>0>>0;)r=r+1|0;if((0|(o=o+1|0))==(0|a))break e}}o=0|nn(0|t,0|e,52),T(),o&=15;t:do{if(o){r=1;n:for(;;){switch(u=0|nn(0|t,0|e,3*(15-r|0)|0),T(),7&u){case 1:break n;case 0:break;default:break t}if(!(r>>>0>>0))break t;r=r+1|0}if(0|H(s,0|i[l>>2]))for(r=1;c=0|rn(7,0,0|(l=3*(15-r|0)|0)),u=e&~T(),e=0|nn(0|t,0|e,0|l),T(),t=t&~c|(e=0|rn(0|ve(7&e),0,0|l)),e=0|u|T(),r>>>0>>0;)r=r+1|0;else for(r=1;l=0|nn(0|t,0|e,0|(u=3*(15-r|0)|0)),T(),c=0|rn(7,0,0|u),e&=~T(),t=t&~c|(u=0|rn(0|be(7&l),0,0|u)),e=0|e|T(),r>>>0>>0;)r=r+1|0}}while(0);if((0|a)>0){r=0;do{t=0|We(t,e),e=0|T(),r=r+1|0}while((0|r)!=(0|a))}}else t=0,e=0}while(0);return u=t,E(0|(c=e)),M=n,0|u}(o,t),o=0|T(),i[n>>2]=t,i[n+4>>2]=o,!(0|t)&!(0|o)&&S(27795,27122,1050,27145),M=r,0|(o=0)):(M=r,0|(o=3))}function qe(e,t,n){var r,s=0,o=0,a=0;if(r=4+(n|=0)|0,o=0|nn(0|(e|=0),0|(t|=0),52),T(),o&=15,a=0|nn(0|e,0|t,45),T(),s=!(0|o),0|G(127&a)){if(s)return 1;s=1}else{if(s)return 0;s=0|i[r>>2]||0|i[n+8>>2]?1:1&!!(0|i[n+12>>2])}for(n=1;1&n?fe(r):pe(r),a=0|nn(0|e,0|t,3*(15-n|0)|0),T(),ge(r,7&a),n>>>0>>0;)n=n+1|0;return 0|s}function Ke(e,t,n){n|=0;var r,s,o=0,a=0,A=0,l=0,c=0,u=0;if(s=M,M=M+16|0,r=s,u=0|nn(0|(e|=0),0|(t|=0),45),T(),(u&=127)>>>0>121)return i[n>>2]=0,i[n+4>>2]=0,i[n+8>>2]=0,i[n+12>>2]=0,M=s,5;e:do{if(0|G(u)&&(A=0|nn(0|e,0|t,52),T(),0|(A&=15))){o=1;t:for(;;){switch(c=0|nn(0|e,0|t,3*(15-o|0)|0),T(),7&c){case 5:break t;case 0:break;default:o=t;break e}if(!(o>>>0>>0)){o=t;break e}o=o+1|0}for(a=1,o=t;l=0|rn(7,0,0|(t=3*(15-a|0)|0)),c=o&~T(),o=0|nn(0|e,0|o,0|t),T(),e=e&~l|(o=0|rn(0|ve(7&o),0,0|t)),o=0|c|T(),a>>>0>>0;)a=a+1|0}else o=t}while(0);if(c=7696+(28*u|0)|0,i[n>>2]=i[c>>2],i[n+4>>2]=i[c+4>>2],i[n+8>>2]=i[c+8>>2],i[n+12>>2]=i[c+12>>2],!(0|qe(e,o,n)))return M=s,0;if(l=n+4|0,i[r>>2]=i[l>>2],i[r+4>>2]=i[l+4>>2],i[r+8>>2]=i[l+8>>2],A=0|nn(0|e,0|o,52),T(),c=15&A,1&A?(pe(l),A=c+1|0):A=c,0|G(u)){e:do{if(c)for(t=1;;){if(a=0|nn(0|e,0|o,3*(15-t|0)|0),T(),0|(a&=7)){o=a;break e}if(!(t>>>0>>0)){o=0;break}t=t+1|0}else o=0}while(0);o=4==(0|o)&1}else o=0;if(0|Ie(n,A,o,0)){if(0|G(u))do{}while(0|Ie(n,A,0,0));(0|A)!=(0|c)&&de(l)}else(0|A)!=(0|c)&&(i[l>>2]=i[r>>2],i[l+4>>2]=i[r+4>>2],i[l+8>>2]=i[r+8>>2]);return M=s,0}function Ze(e,t,n){n|=0;var r,s,o=0;return s=M,M=M+16|0,0|(o=0|Ke(e|=0,t|=0,r=s))?(M=s,0|o):(o=0|nn(0|e,0|t,52),T(),function(e,t,n){var r,s;t|=0,n|=0,r=M,M=M+16|0,se(4+(e|=0)|0,s=r),ke(s,0|i[e>>2],t,0,n),M=r}(r,15&o,n),M=s,0|(o=0))}function Je(e,t,n){n|=0;var r,i=0,s=0,o=0;if(r=M,M=M+16|0,0|(i=0|Ke(e|=0,t|=0,o=r)))return M=r,0|i;i=0|nn(0|e,0|t,45),T(),i=!(0|G(127&i)),s=0|nn(0|e,0|t,52),T(),s&=15;e:do{if(!i){if(0|s)for(i=1;;){if(!(!((0|rn(7,0,3*(15-i|0)|0))&e)&!((0|T())&t)))break e;if(!(i>>>0>>0))break;i=i+1|0}return Re(o,s,0,5,n),M=r,0}}while(0);return Le(o,s,0,6,n),M=r,0}function et(e,t){t|=0;var n=0,r=0,s=0,o=0,a=0,A=0,l=0;if((e|=0)>>>0>15)return 4;if(rn(0|e,0,52),A=134225919|T(),!e){n=0,r=0;do{0|G(r)&&(rn(0|r,0,45),a=0|A|T(),i[(e=t+(n<<3)|0)>>2]=-1,i[e+4>>2]=a,n=n+1|0),r=r+1|0}while(122!=(0|r));return 0}n=0,a=0;do{if(0|G(a)){for(rn(0|a,0,45),r=1,s=-1,o=0|A|T();s&=~(l=0|rn(7,0,3*(15-r|0)|0)),o&=~T(),(0|r)!=(0|e);)r=r+1|0;i[(l=t+(n<<3)|0)>>2]=s,i[l+4>>2]=o,n=n+1|0}a=a+1|0}while(122!=(0|a));return 0}function tt(e,t,n,r){e|=0,r|=0;var s=0,o=0,a=0;s=0|nn(0|(t|=0),0|(n|=0),52),T(),!(0|t)&!(0|n)|(0|r)>15|(0|(s&=15))>(0|r)?(o=-1,t=-1,n=0,s=0):(t=0|Ge(t,n,s+1|0,r),a=-15728641&T(),n=0|rn(0|r,0,52),o=s,t=(t=!(0|je(n|=t,a=0|a|T())))?-1:r,s=a),i[(a=e)>>2]=n,i[a+4>>2]=s,i[e+8>>2]=o,i[e+12>>2]=t}function nt(e,t,n,r){n|=0,r|=0;var s=0,o=0;return s=0|nn(0|(e|=0),0|(t|=0),52),T(),s&=15,i[(o=r+8|0)>>2]=s,!(0|e)&!(0|t)|(0|n)>15|(0|s)>(0|n)?(i[(n=r)>>2]=0,i[n+4>>2]=0,i[o>>2]=-1,void(i[r+12>>2]=-1)):(e=0|Ge(e,t,s+1|0,n),o=-15728641&T(),s=0|rn(0|n,0,52),s|=e,o=0|o|T(),i[(e=r)>>2]=s,i[e+4>>2]=o,e=r+12|0,0|je(s,o)?void(i[e>>2]=n):void(i[e>>2]=-1))}function rt(e){var t,n=0,r=0,s=0,o=0,a=0,A=0,l=0,c=0;if(!(!(0|(n=0|i[(r=e|=0)>>2]))&!(0|(r=0|i[r+4>>2]))||(s=0|nn(0|n,0|r,52),T(),n=0|Xt(0|(l=0|rn(1,0,3*(15^(s&=15))|0)),0|T(),0|n,0|r),r=0|T(),i[(l=e)>>2]=n,i[l+4>>2]=r,(0|s)<(0|(A=0|i[(l=e+8|0)>>2]))))){for(t=e+12|0,a=s;;){if((0|a)==(0|A)){s=5;break}if(c=(0|a)==(0|i[t>>2]),s=0|nn(0|n,0|r,0|(o=3*(15-a|0)|0)),T(),c&1==(0|(s&=7))&!0){s=7;break}if(!(7==(0|s)&!0)){s=10;break}if(n=0|Xt(0|n,0|r,0|(c=0|rn(1,0,0|o)),0|T()),r=0|T(),i[(c=e)>>2]=n,i[c+4>>2]=r,!((0|a)>(0|A))){s=10;break}a=a+-1|0}if(5==(0|s))return i[(c=e)>>2]=0,i[c+4>>2]=0,i[l>>2]=-1,void(i[t>>2]=-1);if(7==(0|s))return A=0|Xt(0|n,0|r,0|(A=0|rn(1,0,0|o)),0|T()),l=0|T(),i[(c=e)>>2]=A,i[c+4>>2]=l,void(i[t>>2]=a+-1)}}function it(e){var t;return t=(e=+e)<0?e+6.283185307179586:e,+(e>=6.283185307179586?t+-6.283185307179586:t)}function st(e,t){return t|=0,+l(+(+s[(e|=0)>>3]-+s[t>>3]))<17453292519943298e-27?0|(t=+l(+(+s[e+8>>3]-+s[t+8>>3]))<17453292519943298e-27):0|(t=0)}function ot(e,t){switch(e=+e,0|(t|=0)){case 1:e=e<0?e+6.283185307179586:e;break;case 2:e=e>0?e+-6.283185307179586:e}return+e}function at(e,t){e|=0;var n,r,i,o=0;return r=+s[(t|=0)>>3],n=+s[e>>3],o=(i=+d(.5*(r-n)))*i+(o=+d(.5*(+s[t+8>>3]-+s[e+8>>3])))*(+h(+r)*+h(+n)*o),2*+_(+ +c(+o),+ +c(+(1-o)))*6371.007180918475}function At(e,t){return t|=0,(e|=0)>>>0>15?0|(t=4):(s[t>>3]=+s[20656+(e<<3)>>3],0|(t=0))}function lt(e,t){t|=0;var n=0;return(e|=0)>>>0>15?0|(t=4):(n=0|Zt(0|(n=0|_t(7,0,e,((0|e)<0)<<31>>31)),0|T(),120,0),e=0|T(),i[t>>2]=2|n,i[t+4>>2]=e,0|(t=0))}function ct(e,t,n){e|=0,n|=0;var r,i,o,a,A=0,l=0,u=0,p=0,g=0,b=0;return b=+s[(t|=0)>>3],o=+s[e>>3],g=+d(.5*(b-o)),u=+s[t+8>>3],i=+s[e+8>>3],p=+d(.5*(u-i)),r=+h(+o),a=+h(+b),p=2*+_(+ +c(+(p=g*g+p*(a*r*p))),+ +c(+(1-p))),g=+s[n>>3],b=+d(.5*(g-b)),A=+s[n+8>>3],u=+d(.5*(A-u)),l=+h(+g),u=2*+_(+ +c(+(u=b*b+u*(a*l*u))),+ +c(+(1-u))),g=+d(.5*(o-g)),A=+d(.5*(i-A)),A=2*+_(+ +c(+(A=g*g+A*(r*l*A))),+ +c(+(1-A))),4*+m(+ +c(+ +f(.5*(l=.5*(p+u+A)))*+f(.5*(l-p))*+f(.5*(l-u))*+f(.5*(l-A))))}function ut(e,t,n){n|=0;var r,o,a,A=0,l=0;if(a=M,M=M+192|0,o=a,0|(l=0|Ze(e|=0,t|=0,r=a+168|0)))return M=a,0|l;if(0|Je(e,t,o)&&S(27795,27190,415,27199),(0|(t=0|i[o>>2]))>0){if(A=+ct(o+8|0,o+8+((1!=(0|t)&1)<<4)|0,r)+0,1!=(0|t)){e=1;do{A+=+ct(o+8+((l=e)<<4)|0,o+8+((0|(e=e+1|0))%(0|t)<<4)|0,r)}while((0|e)<(0|t))}}else A=0;return s[n>>3]=A,M=a,0}function ht(e){e|=0;var t,n,r=0;return(t=0|$t(1,12))||S(27280,27235,49,27293),0|(r=0|i[(n=e+4|0)>>2])?(i[(r=r+8|0)>>2]=t,i[n>>2]=t,0|t):(0|i[e>>2]&&S(27310,27235,61,27333),i[(r=e)>>2]=t,i[n>>2]=t,0|t)}function dt(e,t){var n,r;return e|=0,t|=0,(r=0|Wt(24))||S(27347,27235,78,27361),i[r>>2]=i[t>>2],i[r+4>>2]=i[t+4>>2],i[r+8>>2]=i[t+8>>2],i[r+12>>2]=i[t+12>>2],i[r+16>>2]=0,0|(n=0|i[(t=e+4|0)>>2])?(i[n+16>>2]=r,i[t>>2]=r,0|r):(0|i[e>>2]&&S(27376,27235,82,27361),i[e>>2]=r,i[t>>2]=r,0|r)}function ft(e){var t=0,n=0,r=0,s=0;if(e|=0)for(r=1;;){if(0|(t=0|i[e>>2]))do{if(0|(n=0|i[t>>2]))do{s=n,n=0|i[n+16>>2],Ht(s)}while(0|n);s=t,t=0|i[t+8>>2],Ht(s)}while(0|t);if(t=e,e=0|i[e+8>>2],r||Ht(t),!e)break;r=0}}function pt(e,t,n){e|=0;var r=0,o=0,a=0,A=0,l=0,c=0,u=0,h=0;if(!(0|K(t|=0,n|=0)))return 0;if(t=0|Y(t),r=+s[n>>3],o=t&(o=+s[n+8>>3])<0?o+6.283185307179586:o,!(e=0|i[e>>2]))return 0;if(t){t=0,u=o,n=e;e:for(;;){for(;A=+s[n>>3],o=+s[n+8>>3],h=0|i[(n=n+16|0)>>2],a=+s[(h=0|h?h:e)>>3],l=+s[h+8>>3],A>a?(c=A,A=l):(c=a,a=A,A=o,o=l),(r=r==a|r==c?r+2220446049250313e-31:r)c;)if(!(n=0|i[n>>2])){n=22;break e}if(((c=(l=A<0?A+6.283185307179586:A)+(r-a)/(c-a)*((A=o<0?o+6.283185307179586:o)-l))<0?c+6.283185307179586:c)>(u=l==u|A==u?u+-2220446049250313e-31:u)&&(t^=1),!(n=0|i[n>>2])){n=22;break}}if(22==(0|n))return 0|t}else{t=0,u=o,n=e;e:for(;;){for(;A=+s[n>>3],o=+s[n+8>>3],h=0|i[(n=n+16|0)>>2],a=+s[(h=0|h?h:e)>>3],l=+s[h+8>>3],A>a?(c=A,A=l):(c=a,a=A,A=o,o=l),(r=r==a|r==c?r+2220446049250313e-31:r)c;)if(!(n=0|i[n>>2])){n=22;break e}if(A+(r-a)/(c-a)*(o-A)>(u=A==u|o==u?u+-2220446049250313e-31:u)&&(t^=1),!(n=0|i[n>>2])){n=22;break}}if(22==(0|n))return 0|t}return 0}function gt(e,t,n,s,o){n|=0,s|=0,o|=0;var a,A,l,c,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0,v=0;if(c=M,M=M+32|0,v=c+16|0,l=c,u=0|nn(0|(e|=0),0|(t|=0),52),T(),u&=15,m=0|nn(0|n,0|s,52),T(),(0|u)!=(15&m))return M=c,12;if(p=0|nn(0|e,0|t,45),T(),p&=127,g=0|nn(0|n,0|s,45),T(),p>>>0>121|(g&=127)>>>0>121)return M=c,5;if(m=(0|p)!=(0|g)){if(7==(0|(d=0|X(p,g))))return M=c,1;7==(0|(f=0|X(g,p)))?S(27514,27538,161,27548):(_=d,h=f)}else _=0,h=0;a=0|G(p),A=0|G(g),i[v>>2]=0,i[v+4>>2]=0,i[v+8>>2]=0,i[v+12>>2]=0;do{if(_){if(d=(0|(g=0|i[4272+(28*p|0)+(_<<2)>>2]))>0,A)if(d){p=0,f=n,d=s;do{f=0|$e(f,d),d=0|T(),1==(0|(h=0|ve(h)))&&(h=0|ve(1)),p=p+1|0}while((0|p)!=(0|g));g=h,p=f,f=d}else g=h,p=n,f=s;else if(d){p=0,f=n,d=s;do{f=0|Xe(f,d),d=0|T(),h=0|ve(h),p=p+1|0}while((0|p)!=(0|g));g=h,p=f,f=d}else g=h,p=n,f=s;if(qe(p,f,v),m||S(27563,27538,191,27548),(d=!!(0|a))&(h=!!(0|A))&&S(27590,27538,192,27548),d){if(7==(0|(h=0|Ve(e,t)))){u=5;break}if(0|r[22e3+(7*h|0)+_|0]){u=1;break}p=f=0|i[21168+(28*h|0)+(_<<2)>>2]}else if(h){if(7==(0|(h=0|Ve(p,f)))){u=5;break}if(0|r[22e3+(7*h|0)+g|0]){u=1;break}p=0,f=0|i[21168+(28*g|0)+(h<<2)>>2]}else p=0,f=0;if((p|f|0)<0)u=5;else{if((0|f)>0){d=v+4|0,h=0;do{_e(d),h=h+1|0}while((0|h)!=(0|f))}if(i[l>>2]=0,i[l+4>>2]=0,i[l+8>>2]=0,ge(l,_),0|u)for(;0|Qe(u)?fe(l):pe(l),(0|u)>1;)u=u+-1|0;if((0|p)>0){u=0;do{_e(l),u=u+1|0}while((0|u)!=(0|p))}oe(b=v+4|0,l,b),ie(b),b=51}}else if(qe(n,s,v),!!(0|a)&!!(0|A))if((0|g)!=(0|p)&&S(27621,27538,261,27548),7==(0|(h=0|Ve(e,t)))|7==(0|(u=0|Ve(n,s))))u=5;else if(0|r[22e3+(7*h|0)+u|0])u=1;else if((0|(h=0|i[21168+(28*h|0)+(u<<2)>>2]))>0){d=v+4|0,u=0;do{_e(d),u=u+1|0}while((0|u)!=(0|h));b=51}else b=51;else b=51}while(0);return 51==(0|b)&&(u=v+4|0,i[o>>2]=i[u>>2],i[o+4>>2]=i[u+4>>2],i[o+8>>2]=i[u+8>>2],u=0),M=c,0|u}function mt(e,t,n,r){n|=0,r|=0;var s,o,a,A=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0,v=0;if(a=M,M=M+48|0,s=a+36|0,c=a+24|0,u=a+12|0,h=a,A=0|nn(0|(e|=0),0|(t|=0),52),T(),A&=15,f=0|nn(0|e,0|t,45),T(),(f&=127)>>>0>121)return M=a,5;if(o=0|G(f),rn(0|A,0,52),m=134225919|T(),i[(l=r)>>2]=-1,i[l+4>>2]=m,!A)return 7==(0|(A=0|le(n)))||127==(0|(A=0|$(f,A)))?(M=a,0|(m=1)):(p=0|rn(0|A,0,45),g=0|T(),g=-1040385&i[(f=r)+4>>2]|g,i[(m=r)>>2]=i[f>>2]|p,i[m+4>>2]=g,M=a,0|(m=0));for(i[s>>2]=i[n>>2],i[s+4>>2]=i[n+4>>2],i[s+8>>2]=i[n+8>>2],n=A;;){if(l=n,n=n+-1|0,i[c>>2]=i[s>>2],i[c+4>>2]=i[s+4>>2],i[c+8>>2]=i[s+8>>2],0|Qe(l)){if(0|(A=0|ce(s))){n=13;break}i[u>>2]=i[s>>2],i[u+4>>2]=i[s+4>>2],i[u+8>>2]=i[s+8>>2],fe(u)}else{if(0|(A=0|ue(s))){n=13;break}i[u>>2]=i[s>>2],i[u+4>>2]=i[s+4>>2],i[u+8>>2]=i[s+8>>2],pe(u)}if(ae(c,u,h),ie(h),b=0|i[(A=r)>>2],A=0|i[A+4>>2],_=0|rn(7,0,0|(v=3*(15-l|0)|0)),A&=~T(),v=0|rn(0|le(h),0,0|v),A=0|T()|A,i[(m=r)>>2]=v|b&~_,i[m+4>>2]=A,(0|l)<=1){n=14;break}}e:do{if(13!=(0|n)&&14==(0|n))if((0|i[s>>2])<=1&&(0|i[s+4>>2])<=1&&(0|i[s+8>>2])<=1){h=127==(0|(A=0|$(f,n=0|le(s))))?0:0|G(A);t:do{if(n){if(o){if(7==(0|(A=0|Ve(e,t)))){A=5;break e}if((0|(l=0|i[21376+(28*A|0)+(n<<2)>>2]))>0){A=n,n=0;do{A=0|be(A),n=n+1|0}while((0|n)!=(0|l))}else A=n;if(1==(0|A)){A=9;break e}127==(0|(n=0|$(f,A)))&&S(27648,27538,411,27678),0|G(n)?S(27693,27538,412,27678):(g=n,p=l,d=A)}else g=A,p=0,d=n;if((0|(u=0|i[4272+(28*f|0)+(d<<2)>>2]))<=-1&&S(27724,27538,419,27678),!h){if((0|p)<0){A=5;break e}if(0|p){A=0,n=0|i[(l=r)>>2],l=0|i[l+4>>2];do{n=0|He(n,l),l=0|T(),i[(v=r)>>2]=n,i[v+4>>2]=l,A=A+1|0}while((0|A)<(0|p))}if((0|u)<=0){A=g,n=58;break}for(A=0,n=0|i[(l=r)>>2],l=0|i[l+4>>2];;)if(n=0|He(n,l),l=0|T(),i[(v=r)>>2]=n,i[v+4>>2]=l,(0|(A=A+1|0))==(0|u)){A=g,n=58;break t}}if(7==(0|(c=0|X(g,f)))&&S(27514,27538,428,27678),n=0|i[(A=r)>>2],A=0|i[A+4>>2],(0|u)>0){l=0;do{n=0|He(n,A),A=0|T(),i[(v=r)>>2]=n,i[v+4>>2]=A,l=l+1|0}while((0|l)!=(0|u))}if(7==(0|(A=0|Ve(n,A)))&&S(27795,27538,440,27678),n=0|z(g),(0|(n=0|i[(n?21792:21584)+(28*c|0)+(A<<2)>>2]))<0&&S(27795,27538,454,27678),n){A=0,l=0|i[(c=r)>>2],c=0|i[c+4>>2];do{l=0|We(l,c),c=0|T(),i[(v=r)>>2]=l,i[v+4>>2]=c,A=A+1|0}while((0|A)<(0|n));A=g,n=58}else A=g,n=58}else if(!!(0|o)&!!(0|h)){if(7==(0|(n=0|Ve(e,t)))|7==(0|(l=0|Ve(0|i[(l=r)>>2],0|i[l+4>>2])))){A=5;break e}if((0|(l=0|i[21376+(28*n|0)+(l<<2)>>2]))<0){A=5;break e}if(l){n=0,c=0|i[(u=r)>>2],u=0|i[u+4>>2];do{c=0|He(c,u),u=0|T(),i[(v=r)>>2]=c,i[v+4>>2]=u,n=n+1|0}while((0|n)<(0|l));n=58}else n=59}else n=58}while(0);if(58==(0|n)&&h&&(n=59),59==(0|n)&&1==(0|Ve(0|i[(v=r)>>2],0|i[v+4>>2]))){A=9;break}_=0|i[(v=r)>>2],v=-1040385&i[v+4>>2],b=0|rn(0|A,0,45),v=0|v|T(),i[(A=r)>>2]=_|b,i[A+4>>2]=v,A=0}else A=1}while(0);return M=a,0|A}function _t(e,t,n,r){e|=0,t|=0;var i=0,s=0,o=0;if(!(0|(n|=0))&!(0|(r|=0)))return s=1,E(0|(i=0)),0|s;s=e,i=t,e=1,t=0;do{e=0|Zt(0|((o=!0&!(1&n))?1:s),0|(o?0:i),0|e,0|t),t=0|T(),n=0|tn(0|n,0|r,1),r=0|T(),s=0|Zt(0|s,0|i,0|s,0|i),i=0|T()}while(!(!(0|n)&!(0|r)));return E(0|t),0|e}function bt(e,t,n,r){n|=0,r|=0;var o,a=0,A=0,l=0,c=0,u=0,d=0;o=M,M=M+16|0,A=o,l=0|nn(0|(e|=0),0|(t|=0),52),T(),l&=15;do{if(l){if(!(a=0|Ze(e,t,A))){u=+s[A>>3],c=1/+h(+u),d=+s[25968+(l<<3)>>3],s[n>>3]=u+d,s[n+8>>3]=u-d,u=+s[A+8>>3],c*=d,s[n+16>>3]=c+u,s[n+24>>3]=u-c;break}return M=o,0|a}if(a=0|nn(0|e,0|t,45),T(),(a&=127)>>>0>121)return M=o,5;A=22064+(a<<5)|0,i[n>>2]=i[A>>2],i[n+4>>2]=i[A+4>>2],i[n+8>>2]=i[A+8>>2],i[n+12>>2]=i[A+12>>2],i[n+16>>2]=i[A+16>>2],i[n+20>>2]=i[A+20>>2],i[n+24>>2]=i[A+24>>2],i[n+28>>2]=i[A+28>>2];break}while(0);return function(e,t){t=+t;var n,r,i,o,a,A,l,c=0,u=0;c=(o=+s[(i=16+(e|=0)|0)>>3])-(r=+s[(n=e+24|0)>>3]),c=o>3],c=.5*(c*t-c),u+=t=.5*((l=u-(A=+s[(a=e+8|0)>>3]))*t-l),s[e>>3]=u>1.5707963267948966?1.5707963267948966:u,t=A-t,s[a>>3]=t<-1.5707963267948966?-1.5707963267948966:t,t=(t=o+c)>3.141592653589793?t+-6.283185307179586:t,s[i>>3]=t<-3.141592653589793?t+6.283185307179586:t,t=(t=r-c)>3.141592653589793?t+-6.283185307179586:t,s[n>>3]=t<-3.141592653589793?t+6.283185307179586:t}(n,r?1.4:1.1),(0|i[(r=26096+(l<<3)|0)>>2])==(0|e)&&(0|i[r+4>>2])==(0|t)&&(s[n>>3]=1.5707963267948966),(0|i[(l=26224+(l<<3)|0)>>2])==(0|e)&&(0|i[l+4>>2])==(0|t)&&(s[n+8>>3]=-1.5707963267948966),1.5707963267948966!=+s[n>>3]&&-1.5707963267948966!=+s[n+8>>3]?(M=o,0|(l=0)):(s[n+16>>3]=3.141592653589793,s[n+24>>3]=-3.141592653589793,M=o,0|(l=0))}function vt(e){var t,n,s,o,a=0,A=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0,v=0,y=0,w=0;if(o=M,M=M+336|0,t=o+168|0,n=o,!(0|(A=0|i[(l=e|=0)>>2]))&!(0|(l=0|i[l+4>>2])))M=o;else{if(0|r[0|(a=e+28|0)]?(A=0|yt(A,l),l=0|T()):r[0|a]=1,!(0|i[i[(s=e+20|0)>>2]>>2]))return 0|(A=0|i[(a=e+24|0)>>2])&&Ht(A),i[(w=e)>>2]=0,i[w+4>>2]=0,i[e+8>>2]=0,i[s>>2]=0,i[e+12>>2]=-1,i[e+16>>2]=0,i[a>>2]=0,void(M=o);c=15&(a=0|i[(w=e+16|0)>>2]);e:do{if(!(0|A)&!(0|l))y=e+24|0;else{b=e+12|0,m=3==(0|c),g=255&a,f=3==(1|c),_=e+24|0,p=(c+-1|0)>>>0<3,h=3==(2|c),d=n+8|0;t:for(;;){if(u=0|nn(0|A,0|l,52),T(),(0|(u&=15))==(0|i[b>>2])){switch(15&g){case 0:case 2:case 3:if(0|(c=0|Ze(A,l,t))){v=15;break t}if(0|St(0|i[s>>2],0|i[_>>2],t)){v=19;break t}}if(f&&(c=0|i[4+(0|i[s>>2])>>2],i[t>>2]=i[c>>2],i[t+4>>2]=i[c+4>>2],i[t+8>>2]=i[c+8>>2],i[t+12>>2]=i[c+12>>2],0|K(26832,t))){if(0|Ye(0|i[4+(0|i[s>>2])>>2],u,n)){v=25;break}if((0|i[(c=n)>>2])==(0|A)&&(0|i[c+4>>2])==(0|l)){v=29;break}}if(p){if(0|(c=0|Je(A,l,t))){v=32;break}if(0|bt(A,l,n,0)){v=36;break}if(h&&0|Ct(0|i[s>>2],0|i[_>>2],t,n)){v=42;break}if(f&&0|Rt(0|i[s>>2],0|i[_>>2],t,n)){v=42;break}}if(m){if(a=0|bt(A,l,t,1),c=0|i[_>>2],0|a){v=45;break}if(0|Z(c,t)){if(ee(n,t),0|J(t,0|i[_>>2])){v=53;break}if(0|St(0|i[s>>2],0|i[_>>2],d)){v=53;break}if(0|Rt(0|i[s>>2],0|i[_>>2],n,t)){v=53;break}}}}do{if((0|u)<(0|i[b>>2])){if(a=0|bt(A,l,t,1),c=0|i[_>>2],0|a){v=58;break t}if(!(0|Z(c,t))){v=73;break}if(0|J(0|i[_>>2],t)&&(ee(n,t),0|Ct(0|i[s>>2],0|i[_>>2],n,t))){v=65;break t}if(0|(A=0|ze(A,l,u+1|0,n))){v=67;break t}A=0|i[(l=n)>>2],l=0|i[l+4>>2]}else v=73}while(0);if(73==(0|v)&&(v=0,A=0|yt(A,l),l=0|T()),!(0|A)&!(0|l)){y=_;break e}}switch(0|v){case 15:0|(a=0|i[_>>2])&&Ht(a),i[(v=e)>>2]=0,i[v+4>>2]=0,i[s>>2]=0,i[b>>2]=-1,i[w>>2]=0,i[_>>2]=0,i[e+8>>2]=c,v=20;break;case 19:i[e>>2]=A,i[e+4>>2]=l,v=20;break;case 25:S(27795,27761,470,27772);break;case 29:case 42:return i[e>>2]=A,i[e+4>>2]=l,void(M=o);case 32:return 0|(a=0|i[_>>2])&&Ht(a),i[(y=e)>>2]=0,i[y+4>>2]=0,i[s>>2]=0,i[b>>2]=-1,i[w>>2]=0,i[_>>2]=0,i[e+8>>2]=c,void(M=o);case 36:S(27795,27761,493,27772);break;case 45:0|c&&Ht(c),i[(v=e)>>2]=0,i[v+4>>2]=0,i[s>>2]=0,i[b>>2]=-1,i[w>>2]=0,i[_>>2]=0,i[e+8>>2]=a,v=55;break;case 53:i[e>>2]=A,i[e+4>>2]=l,v=55;break;case 58:0|c&&Ht(c),i[(v=e)>>2]=0,i[v+4>>2]=0,i[s>>2]=0,i[b>>2]=-1,i[w>>2]=0,i[_>>2]=0,i[e+8>>2]=a,v=71;break;case 65:i[e>>2]=A,i[e+4>>2]=l,v=71;break;case 67:return 0|(a=0|i[_>>2])&&Ht(a),i[(y=e)>>2]=0,i[y+4>>2]=0,i[s>>2]=0,i[b>>2]=-1,i[w>>2]=0,i[_>>2]=0,i[e+8>>2]=A,void(M=o)}if(20==(0|v))return void(M=o);if(55==(0|v))return void(M=o);if(71==(0|v))return void(M=o)}}while(0);0|(a=0|i[y>>2])&&Ht(a),i[(v=e)>>2]=0,i[v+4>>2]=0,i[e+8>>2]=0,i[s>>2]=0,i[e+12>>2]=-1,i[w>>2]=0,i[y>>2]=0,M=o}}function yt(e,t){var n,r=0,s=0,o=0,a=0,A=0,l=0,c=0,u=0,h=0;n=M,M=M+16|0,h=n,s=0|nn(0|(e|=0),0|(t|=0),52),T(),s&=15,r=0|nn(0|e,0|t,45),T();do{if(s){for(;r=0|rn(s+4095|0,0,52),o=T()|-15728641&t,r=r|e|(A=0|rn(7,0,0|(a=3*(15-s|0)|0))),o|=l=0|T(),c=0|nn(0|e,0|t,0|a),T(),s=s+-1|0,!((c&=7)>>>0<6);){if(!s){u=4;break}t=o,e=r}if(4==(0|u)){r=0|nn(0|r,0|o,45),T();break}return h=0|rn(((h=!(0|c)&!!(0|je(r,o)))?2:1)+c|0,0,0|a),u=0|T()|t&~l,h|=e&~A,E(0|u),M=n,0|h}}while(0);return(r&=127)>>>0>120?(h=0,E(0|(u=0)),M=n,0|h):(Oe(h,0,r+1|0,0),u=0|i[h+4>>2],h=0|i[h>>2],E(0|u),M=n,0|h)}function wt(e,t,n){e|=0;var r,o=0,a=0,A=0,l=0,c=0,u=0,h=0,d=0,f=0;if(!(0|K(t|=0,n|=0)))return 0;if(t=0|Y(t),o=+s[n>>3],a=t&(a=+s[n+8>>3])<0?a+6.283185307179586:a,(0|(f=0|i[e>>2]))<=0)return 0;if(r=0|i[e+4>>2],t){t=0,d=a,n=-1,e=0;e:for(;;){for(h=e;l=+s[r+(h<<4)>>3],a=+s[r+(h<<4)+8>>3],A=+s[r+((e=(n+2|0)%(0|f)|0)<<4)>>3],c=+s[r+(e<<4)+8>>3],l>A?(u=l,l=c):(u=A,A=l,l=a,a=c),(o=o==A|o==u?o+2220446049250313e-31:o)u;){if((0|(n=h+1|0))>=(0|f)){n=22;break e}e=h,h=n,n=e}if(((u=(c=l<0?l+6.283185307179586:l)+(o-A)/(u-A)*((l=a<0?a+6.283185307179586:a)-c))<0?u+6.283185307179586:u)>(d=c==d|l==d?d+-2220446049250313e-31:d)&&(t^=1),(0|(e=h+1|0))>=(0|f)){n=22;break}n=h}if(22==(0|n))return 0|t}else{t=0,d=a,n=-1,e=0;e:for(;;){for(h=e;l=+s[r+(h<<4)>>3],a=+s[r+(h<<4)+8>>3],A=+s[r+((e=(n+2|0)%(0|f)|0)<<4)>>3],c=+s[r+(e<<4)+8>>3],l>A?(u=l,l=c):(u=A,A=l,l=a,a=c),(o=o==A|o==u?o+2220446049250313e-31:o)u;){if((0|(n=h+1|0))>=(0|f)){n=22;break e}e=h,h=n,n=e}if(l+(o-A)/(u-A)*(a-l)>(d=l==d|a==d?d+-2220446049250313e-31:d)&&(t^=1),(0|(e=h+1|0))>=(0|f)){n=22;break}n=h}if(22==(0|n))return 0|t}return 0}function xt(e,t){t|=0;var n,r,o,a,A,c=0,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0,v=0,y=0;if(!(r=0|i[(e|=0)>>2]))return i[t>>2]=0,i[t+4>>2]=0,i[t+8>>2]=0,i[t+12>>2]=0,i[t+16>>2]=0,i[t+20>>2]=0,i[t+24>>2]=0,void(i[t+28>>2]=0);if(s[(o=t+8|0)>>3]=17976931348623157e292,s[(a=t+24|0)>>3]=17976931348623157e292,s[t>>3]=-17976931348623157e292,s[(A=t+16|0)>>3]=-17976931348623157e292,!((0|r)<=0)){for(n=0|i[e+4>>2],m=17976931348623157e292,_=-17976931348623157e292,b=0,e=-1,d=17976931348623157e292,f=17976931348623157e292,g=-17976931348623157e292,u=-17976931348623157e292,v=0;c=+s[n+(v<<4)>>3],p=+s[n+(v<<4)+8>>3],h=+s[n+(((0|(e=e+2|0))==(0|r)?0:e)<<4)+8>>3],c>3]=c,d=c),p>3]=p,f=p),c>g?s[t>>3]=c:c=g,p>u&&(s[A>>3]=p,u=p),m=p>0&p_?p:_,b|=+l(+(p-h))>3.141592653589793,(0|(e=v+1|0))!=(0|r);)y=v,g=c,v=e,e=y;b&&(s[A>>3]=_,s[a>>3]=m)}}function Et(e){return 0|((e|=0)>>>0<4?0:15)}function Tt(e,t){t|=0;var n,r=0,o=0,a=0,A=0,c=0,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0,v=0,y=0,w=0,x=0,E=0,T=0,S=0;if(_=0|i[(e|=0)>>2]){if(s[(b=t+8|0)>>3]=17976931348623157e292,s[(v=t+24|0)>>3]=17976931348623157e292,s[t>>3]=-17976931348623157e292,s[(y=t+16|0)>>3]=-17976931348623157e292,(0|_)>0){for(a=0|i[e+4>>2],g=17976931348623157e292,m=-17976931348623157e292,o=0,r=-1,h=17976931348623157e292,d=17976931348623157e292,p=-17976931348623157e292,c=-17976931348623157e292,w=0;A=+s[a+(w<<4)>>3],f=+s[a+(w<<4)+8>>3],u=+s[a+(((0|(T=r+2|0))==(0|_)?0:T)<<4)+8>>3],A>3]=A,h=A),f>3]=f,d=f),A>p?s[t>>3]=A:A=p,f>c&&(s[y>>3]=f,c=f),g=f>0&fm?f:m,o|=+l(+(f-u))>3.141592653589793,(0|(r=w+1|0))!=(0|_);)T=w,p=A,w=r,r=T;o&&(s[y>>3]=m,s[v>>3]=g)}}else i[t>>2]=0,i[t+4>>2]=0,i[t+8>>2]=0,i[t+12>>2]=0,i[t+16>>2]=0,i[t+20>>2]=0,i[t+24>>2]=0,i[t+28>>2]=0;if(!((0|(r=0|i[(T=e+8|0)>>2]))<=0)){n=e+12|0,E=0;do{if(a=0|i[n>>2],o=E,v=t+((E=E+1|0)<<5)|0,y=0|i[a+(o<<3)>>2]){if(s[(w=t+(E<<5)+8|0)>>3]=17976931348623157e292,s[(e=t+(E<<5)+24|0)>>3]=17976931348623157e292,s[v>>3]=-17976931348623157e292,s[(x=t+(E<<5)+16|0)>>3]=-17976931348623157e292,(0|y)>0){for(_=0|i[a+(o<<3)+4>>2],g=17976931348623157e292,m=-17976931348623157e292,a=0,o=-1,b=0,h=17976931348623157e292,d=17976931348623157e292,f=-17976931348623157e292,c=-17976931348623157e292;A=+s[_+(b<<4)>>3],p=+s[_+(b<<4)+8>>3],u=+s[_+(((0|(o=o+2|0))==(0|y)?0:o)<<4)+8>>3],A>3]=A,h=A),p>3]=p,d=p),A>f?s[v>>3]=A:A=f,p>c&&(s[x>>3]=p,c=p),g=p>0&pm?p:m,a|=+l(+(p-u))>3.141592653589793,(0|(o=b+1|0))!=(0|y);)S=b,b=o,f=A,o=S;a&&(s[x>>3]=m,s[e>>3]=g)}}else i[v>>2]=0,i[v+4>>2]=0,i[v+8>>2]=0,i[v+12>>2]=0,i[v+16>>2]=0,i[v+20>>2]=0,i[v+24>>2]=0,i[v+28>>2]=0,r=0|i[T>>2]}while((0|E)<(0|r))}}function St(e,t,n){var r=0,s=0,o=0;if(!(0|wt(e|=0,t|=0,n|=0)))return 0;if((0|i[(s=e+8|0)>>2])<=0)return 1;for(r=e+12|0,e=0;;){if(o=e,e=e+1|0,0|wt((0|i[r>>2])+(o<<3)|0,t+(e<<5)|0,n)){e=0,r=6;break}if((0|e)>=(0|i[s>>2])){e=1,r=6;break}}return 6==(0|r)?0|e:0}function Ct(e,t,n,r){r|=0;var s,o,a=0,A=0,l=0,c=0,u=0;if(o=M,M=M+16|0,s=o,!(0|wt(e|=0,t|=0,l=8+(n|=0)|0)))return M=o,0;c=e+8|0;e:do{if((0|i[c>>2])>0){for(A=e+12|0,a=0;;){if(u=a,a=a+1|0,0|wt((0|i[A>>2])+(u<<3)|0,t+(a<<5)|0,l)){a=0;break}if((0|a)>=(0|i[c>>2]))break e}return M=o,0|a}}while(0);if(0|kt(e,t,n,r))return M=o,0;i[s>>2]=i[n>>2],i[s+4>>2]=l,a=0|i[c>>2];e:do{if((0|a)>0)for(e=e+12|0,l=0,A=a;;){if(a=0|i[e>>2],(0|i[a+(l<<3)>>2])>0){if(0|wt(s,r,0|i[a+(l<<3)+4>>2])){a=0;break e}if(a=l+1|0,0|kt((0|i[e>>2])+(l<<3)|0,t+(a<<5)|0,n,r)){a=0;break e}A=0|i[c>>2]}else a=l+1|0;if(!((0|a)<(0|A))){a=1;break}l=a}else a=1}while(0);return M=o,0|a}function kt(e,t,n,r){e|=0,n|=0;var o,a,A,l,c,u,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0,v=0,y=0,w=0,x=0,E=0,T=0,S=0;if(u=M,M=M+176|0,l=u+172|0,h=u+168|0,c=u,!(0|Z(t|=0,r|=0)))return M=u,0;if(function(e,t,n,r){var o,a,A,l,c;t|=0,n|=0,r|=0,e=(a=+s[16+(e|=0)>>3])<(c=+s[e+24>>3]),o=(l=+s[t+16>>3])<(A=+s[t+24>>3]),t=c-l>2]=e?o|t?1:2:0,i[r>>2]=o?e?1:t?2:1:0}(t,r,l,h),ln(0|c,0|n,168),(0|i[n>>2])>0){t=0;do{w=+ot(+s[(T=c+8+(t<<4)+8|0)>>3],0|i[h>>2]),s[T>>3]=w,t=t+1|0}while((0|t)<(0|i[n>>2]))}a=+s[r>>3],A=+s[r+8>>3],w=+ot(+s[r+16>>3],0|i[h>>2]),o=+ot(+s[r+24>>3],0|i[h>>2]);e:do{if((0|i[e>>2])>0){if(r=e+4|0,(0|(h=0|i[c>>2]))<=0)for(t=0;;)if((0|(t=t+1|0))>=(0|i[e>>2])){t=0;break e}for(n=0;;){if(t=0|i[r>>2],v=+s[t+(n<<4)>>3],y=+ot(+s[t+(n<<4)+8>>3],0|i[l>>2]),t=0|i[r>>2],T=(0|(n=n+1|0))%(0|i[e>>2])|0,d=+s[t+(T<<4)>>3],f=+ot(+s[t+(T<<4)+8>>3],0|i[l>>2]),!(v>=a)|!(d>=a)&&!(v<=A)|!(d<=A)&&!(y<=o)|!(f<=o)&&!(y>=w)|!(f>=w)){b=d-v,m=f-y,t=0;do{if(S=t,T=(0|(t=t+1|0))==(0|h)?0:t,d=+s[c+8+(S<<4)+8>>3],f=+s[c+8+(T<<4)+8>>3]-d,p=+s[c+8+(S<<4)>>3],!(0==(_=b*f-m*(g=+s[c+8+(T<<4)>>3]-p))||(x=y-d,E=v-p,g=(x*g-f*E)/_,g<0|g>1))&&(_=(b*x-m*E)/_)>=0&_<=1){t=1;break e}}while((0|t)<(0|h))}if((0|n)>=(0|i[e>>2])){t=0;break}}}else t=0}while(0);return M=u,0|t}function Rt(e,t,n,r){var s=0,o=0,a=0;if(0|kt(e|=0,t|=0,n|=0,r|=0))return 1;if((0|i[(o=e+8|0)>>2])<=0)return 0;for(s=e+12|0,e=0;;){if(a=e,e=e+1|0,0|kt((0|i[s>>2])+(a<<3)|0,t+(e<<5)|0,n,r)){e=1,s=6;break}if((0|e)>=(0|i[o>>2])){e=0,s=6;break}}return 6==(0|s)?0|e:0}function Pt(e,t,n,r,i){t|=0,n|=0,r|=0,i|=0;var o,a,A,l,c,u,h,d=0;l=+s[(e|=0)>>3],A=+s[t>>3]-l,a=+s[e+8>>3],o=+s[t+8>>3]-a,u=+s[n>>3],d=((d=+s[r>>3]-u)*(a-(h=+s[n+8>>3]))-(l-u)*(c=+s[r+8>>3]-h))/(A*c-o*d),s[i>>3]=l+A*d,s[i+8>>3]=a+o*d}function It(e,t){return t|=0,+l(+(+s[(e|=0)>>3]-+s[t>>3]))<1.1920928955078125e-7?0|(t=+l(+(+s[e+8>>3]-+s[t+8>>3]))<1.1920928955078125e-7):0|(t=0)}function Mt(e,t){var n,r,i;return t|=0,+((i=+s[(e|=0)>>3]-+s[t>>3])*i+(r=+s[e+8>>3]-+s[t+8>>3])*r+(n=+s[e+16>>3]-+s[t+16>>3])*n)}function Lt(e,t,n){n|=0;var r,s,o,a,A=0,l=0,c=0,u=0;if(a=M,M=M+32|0,u=a,0|(A=0|Ke(e|=0,t|=0,s=a+16|0)))return M=a,0|A;r=0|Ne(e,t),o=0|Ve(e,t),function(e,t){e=7696+(28*(e|=0)|0)|0,i[(t|=0)>>2]=i[e>>2],i[t+4>>2]=i[e+4>>2],i[t+8>>2]=i[e+8>>2],i[t+12>>2]=i[e+12>>2]}(r,u),A=0|function(e,t){e|=0;var n=0,r=0;if((t|=0)>>>0>20)return-1;do{if((0|i[11120+(216*t|0)>>2])!=(0|e))if((0|i[11120+(216*t|0)+8>>2])!=(0|e))if((0|i[11120+(216*t|0)+16>>2])!=(0|e))if((0|i[11120+(216*t|0)+24>>2])!=(0|e))if((0|i[11120+(216*t|0)+32>>2])!=(0|e))if((0|i[11120+(216*t|0)+40>>2])!=(0|e))if((0|i[11120+(216*t|0)+48>>2])!=(0|e))if((0|i[11120+(216*t|0)+56>>2])!=(0|e))if((0|i[11120+(216*t|0)+64>>2])!=(0|e))if((0|i[11120+(216*t|0)+72>>2])!=(0|e))if((0|i[11120+(216*t|0)+80>>2])!=(0|e))if((0|i[11120+(216*t|0)+88>>2])!=(0|e))if((0|i[11120+(216*t|0)+96>>2])!=(0|e))if((0|i[11120+(216*t|0)+104>>2])!=(0|e))if((0|i[11120+(216*t|0)+112>>2])!=(0|e))if((0|i[11120+(216*t|0)+120>>2])!=(0|e))if((0|i[11120+(216*t|0)+128>>2])!=(0|e)){if((0|i[11120+(216*t|0)+136>>2])!=(0|e)){if((0|i[11120+(216*t|0)+144>>2])==(0|e)){e=0,n=2,r=0;break}if((0|i[11120+(216*t|0)+152>>2])==(0|e)){e=0,n=2,r=1;break}if((0|i[11120+(216*t|0)+160>>2])==(0|e)){e=0,n=2,r=2;break}if((0|i[11120+(216*t|0)+168>>2])==(0|e)){e=1,n=2,r=0;break}if((0|i[11120+(216*t|0)+176>>2])==(0|e)){e=1,n=2,r=1;break}if((0|i[11120+(216*t|0)+184>>2])==(0|e)){e=1,n=2,r=2;break}if((0|i[11120+(216*t|0)+192>>2])==(0|e)){e=2,n=2,r=0;break}if((0|i[11120+(216*t|0)+200>>2])==(0|e)){e=2,n=2,r=1;break}if((0|i[11120+(216*t|0)+208>>2])==(0|e)){e=2,n=2,r=2;break}return-1}e=2,n=1,r=2}else e=2,n=1,r=1;else e=2,n=1,r=0;else e=1,n=1,r=2;else e=1,n=1,r=1;else e=1,n=1,r=0;else e=0,n=1,r=2;else e=0,n=1,r=1;else e=0,n=1,r=0;else e=2,n=0,r=2;else e=2,n=0,r=1;else e=2,n=0,r=0;else e=1,n=0,r=2;else e=1,n=0,r=1;else e=1,n=0,r=0;else e=0,n=0,r=2;else e=0,n=0,r=1;else e=0,n=0,r=0}while(0);return 0|i[11120+(216*t|0)+(72*n|0)+(24*e|0)+(r<<3)+4>>2]}(r,0|i[s>>2]);do{if(0|G(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:S(27795,27797,75,27806)}if(c=0|i[26416+(24*l|0)+8>>2],t=0|i[26416+(24*l|0)+16>>2],(0|(e=0|i[s>>2]))!=(0|i[u>>2])&&(u=0|z(r))|(0|(e=0|i[s>>2]))==(0|t)&&(A=(A+1|0)%6|0),3==(0|o)&(0|e)==(0|t)){A=(A+5|0)%6|0;break}5==(0|o)&(0|e)==(0|c)&&(A=(A+1|0)%6|0)}}while(0);return i[n>>2]=A,M=a,0}function Bt(e,t,n,r){n|=0,r|=0;var s,o,a,A,l,c=0,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0,v=0;if(l=M,M=M+32|0,v=l+24|0,A=l+20|0,a=l+8|0,o=l+16|0,s=l,f=(f=!(0|je(e|=0,t|=0)))?6:5,g=0|nn(0|e,0|t,52),T(),f>>>0<=n>>>0)return M=l,2;!(m=!(0|(g&=15)))&&!((_=0|rn(7,0,3*(15^g)|0))&e)&!((0|T())&t)?c=n:u=4;e:do{if(4==(0|u)){if((0|((c=!!(0|je(e,t)))?4:5))<(0|n))return M=l,1;if(0|Lt(e,t,v))return M=l,1;if(u=(0|i[v>>2])+n|0,7==(0|(_=0|i[(c=c?26704+((0|u)%5<<2)|0:26736+((0|u)%6<<2)|0)>>2])))return M=l,1;i[A>>2]=0,c=0|O(e,t,_,A,a);do{if(!c){if(p=0|i[(d=a)>>2],u=(h=(d=0|i[d+4>>2])>>>0>>0|(0|d)==(0|t)&p>>>0>>0)?p:e,h=h?d:t,!m&&!(p&(m=0|rn(7,0,3*(15^g)|0)))&!(d&(0|T())))c=n;else{if(d=(n+-1+f|0)%(0|f)|0,c=0|je(e,t),(0|d)<0&&S(27795,27797,248,27822),(0|((f=!!(0|c))?4:5))<(0|d)&&S(27795,27797,248,27822),0|Lt(e,t,v)&&S(27795,27797,248,27822),c=(0|i[v>>2])+d|0,7==(0|(d=0|i[(c=f?26704+((0|c)%5<<2)|0:26736+((0|c)%6<<2)|0)>>2]))&&S(27795,27797,248,27822),i[o>>2]=0,0|(c=0|O(e,t,d,o,s)))break;f=0|i[(p=s)>>2],p=0|i[p+4>>2];do{if(p>>>0>>0|(0|p)==(0|h)&f>>>0>>0){if(u=0|je(f,p)?0|U(f,p,e,t):0|i[26800+(((0|i[o>>2])+(0|i[26768+(d<<2)>>2])|0)%6<<2)>>2],c=0|je(f,p),(u+-1|0)>>>0>5){c=-1,u=f,h=p;break}if(1==(0|u)&(c=!!(0|c))){c=-1,u=f,h=p;break}do{if(!(0|Lt(f,p,v))){if(c){c=(5+(0|i[26352+(u<<2)>>2])-(0|i[v>>2])|0)%5|0;break}c=(6+(0|i[26384+(u<<2)>>2])-(0|i[v>>2])|0)%6|0;break}c=-1}while(0);u=f,h=p}else c=n}while(0);p=0|i[(d=a)>>2],d=0|i[d+4>>2]}if((0|u)==(0|p)&(0|h)==(0|d)){if(e=(f=!!(0|je(p,d)))?0|U(p,d,e,t):0|i[26800+(((0|i[A>>2])+(0|i[26768+(_<<2)>>2])|0)%6<<2)>>2],c=0|je(p,d),(e+-1|0)>>>0<=5&&!(1==(0|e)&(b=!!(0|c))))do{if(!(0|Lt(p,d,v))){if(b){c=(5+(0|i[26352+(e<<2)>>2])-(0|i[v>>2])|0)%5|0;break}c=(6+(0|i[26384+(e<<2)>>2])-(0|i[v>>2])|0)%6|0;break}c=-1}while(0);else c=-1;c=6==(0|(c=c+1|0))|f&5==(0|c)?0:c}t=h,e=u;break e}}while(0);return M=l,0|c}}while(0);return b=0|rn(0|c,0,56),v=T()|-2130706433&t|536870912,i[r>>2]=b|e,i[r+4>>2]=v,M=l,0}function Nt(e,t){e|=0;var n,r,s=0,o=0;return r=M,M=M+16|0,n=r,!0&536870912==(2013265920&(t|=0))&&0|De(e,s=-2130706433&t|134217728)?(o=0|nn(0|e,0|t,56),T(),s=(o=!(0|Bt(e,s,7&o,n)))&((0|i[(s=n)>>2])==(0|e)?(0|i[s+4>>2])==(0|t):0)&1,M=r,0|s):(M=r,0|(s=0))}function Dt(e,t,n){e|=0,n|=0;var r=0;(0|(t|=0))>0?(r=0|$t(t,4),i[e>>2]=r,r||S(27835,27858,40,27872)):i[e>>2]=0,i[e+4>>2]=t,i[e+8>>2]=0,i[e+12>>2]=n}function Ot(e){var t,n,r,o=0,a=0,A=0,c=0;t=4+(e|=0)|0,n=e+12|0,r=e+8|0;e:for(;;){for(a=0|i[t>>2],o=0;;){if((0|o)>=(0|a))break e;if(A=0|i[e>>2],c=0|i[A+(o<<2)>>2])break;o=o+1|0}o=A+(~~(+l(+ +u(10,+ +(15-(0|i[n>>2])|0))*(+s[c>>3]+ +s[c+8>>3]))%+(0|a))>>>0<<2)|0,a=0|i[o>>2];t:do{if(0|a){if(A=c+32|0,(0|a)==(0|c))i[o>>2]=i[A>>2];else{if(!(o=0|i[(a=a+32|0)>>2]))break;for(;(0|o)!=(0|c);)if(!(o=0|i[(a=o+32|0)>>2]))break t;i[a>>2]=i[A>>2]}Ht(c),i[r>>2]=(0|i[r>>2])-1}}while(0)}Ht(0|i[e>>2])}function Ft(e){var t,n=0,r=0;for(t=0|i[4+(e|=0)>>2],r=0;;){if((0|r)>=(0|t)){n=0,r=4;break}if(n=0|i[(0|i[e>>2])+(r<<2)>>2]){r=4;break}r=r+1|0}return 4==(0|r)?0|n:0}function Ut(e,t){t|=0;var n=0,r=0,o=0,a=0;if(n=~~(+l(+ +u(10,+ +(15-(0|i[12+(e|=0)>>2])|0))*(+s[t>>3]+ +s[t+8>>3]))%+(0|i[e+4>>2]))>>>0,n=(0|i[e>>2])+(n<<2)|0,!(r=0|i[n>>2]))return 1;a=t+32|0;do{if((0|r)!=(0|t)){if(!(n=0|i[r+32>>2]))return 1;for(o=n;;){if((0|o)==(0|t)){o=8;break}if(!(n=0|i[o+32>>2])){n=1,o=10;break}r=o,o=n}if(8==(0|o)){i[r+32>>2]=i[a>>2];break}if(10==(0|o))return 0|n}else i[n>>2]=i[a>>2]}while(0);return Ht(t),i[(a=e+8|0)>>2]=(0|i[a>>2])-1,0}function jt(e,t,n){e|=0,t|=0,n|=0;var r,o=0,a=0,A=0;(r=0|Wt(40))||S(27888,27858,98,27901),i[r>>2]=i[t>>2],i[r+4>>2]=i[t+4>>2],i[r+8>>2]=i[t+8>>2],i[r+12>>2]=i[t+12>>2],i[(a=r+16|0)>>2]=i[n>>2],i[a+4>>2]=i[n+4>>2],i[a+8>>2]=i[n+8>>2],i[a+12>>2]=i[n+12>>2],i[r+32>>2]=0,a=~~(+l(+ +u(10,+ +(15-(0|i[e+12>>2])|0))*(+s[t>>3]+ +s[t+8>>3]))%+(0|i[e+4>>2]))>>>0,a=(0|i[e>>2])+(a<<2)|0,o=0|i[a>>2];do{if(o){for(;!(0|st(o,t)&&0|st(o+16|0,n));)if(a=0|i[o+32>>2],!(0|i[(o=0|a?a:o)+32>>2])){A=10;break}if(10==(0|A)){i[o+32>>2]=r;break}return Ht(r),0|o}i[a>>2]=r}while(0);return i[(A=e+8|0)>>2]=1+(0|i[A>>2]),0|r}function Gt(e,t,n){t|=0,n|=0;var r=0,o=0;if(o=~~(+l(+ +u(10,+ +(15-(0|i[12+(e|=0)>>2])|0))*(+s[t>>3]+ +s[t+8>>3]))%+(0|i[e+4>>2]))>>>0,!(o=0|i[(0|i[e>>2])+(o<<2)>>2]))return 0;if(!n){for(e=o;;){if(0|st(e,t)){r=10;break}if(!(e=0|i[e+32>>2])){e=0,r=10;break}}if(10==(0|r))return 0|e}for(e=o;;){if(0|st(e,t)&&0|st(e+16|0,n)){r=10;break}if(!(e=0|i[e+32>>2])){e=0,r=10;break}}return 10==(0|r)?0|e:0}function zt(e,t){t|=0;var n=0;if(n=~~(+l(+ +u(10,+ +(15-(0|i[12+(e|=0)>>2])|0))*(+s[t>>3]+ +s[t+8>>3]))%+(0|i[e+4>>2]))>>>0,!(e=0|i[(0|i[e>>2])+(n<<2)>>2]))return 0;for(;;){if(0|st(e,t)){t=5;break}if(!(e=0|i[e+32>>2])){e=0,t=5;break}}return 5==(0|t)?0|e:0}function Vt(e){return 0|+un(+(e=+e))}function Wt(e){e|=0;var t,n=0,r=0,s=0,o=0,a=0,A=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0,v=0,y=0,w=0;t=M,M=M+16|0,f=t;do{if(e>>>0<245){if(e=(u=e>>>0<11?16:e+11&-8)>>>3,3&(r=(d=0|i[6981])>>>e))return s=0|i[(r=8+(e=27964+((n=(1&r^1)+e|0)<<1<<2)|0)|0)>>2],(0|(a=0|i[(o=s+8|0)>>2]))==(0|e)?i[6981]=d&~(1<>2]=e,i[r>>2]=a),w=n<<3,i[s+4>>2]=3|w,i[(w=s+w+4|0)>>2]=1|i[w>>2],M=t,0|o;if(u>>>0>(h=0|i[6983])>>>0){if(0|r)return n=((n=r<>>=l=n>>>12&16)>>>5&8)|l|(a=(n>>>=r)>>>2&4)|(e=(n>>>=a)>>>1&2)|(s=(n>>>=e)>>>1&1))+(n>>>s)|0)<<1<<2)|0)|0)>>2],(0|(r=0|i[(l=a+8|0)>>2]))==(0|n)?(e=d&~(1<>2]=n,i[e>>2]=r,e=d),A=(w=s<<3)-u|0,i[a+4>>2]=3|u,i[4+(o=a+u|0)>>2]=1|A,i[a+w>>2]=A,0|h&&(s=0|i[6986],r=27964+((n=h>>>3)<<1<<2)|0,e&(n=1<>2]:(i[6981]=e|n,n=r,e=r+8|0),i[e>>2]=s,i[n+12>>2]=s,i[s+8>>2]=n,i[s+12>>2]=r),i[6983]=A,i[6986]=o,M=t,0|l;if(a=0|i[6982]){for(r=(a&0-a)-1|0,r=c=0|i[28228+(((s=(r>>>=o=r>>>12&16)>>>5&8)|o|(A=(r>>>=s)>>>2&4)|(l=(r>>>=A)>>>1&2)|(c=(r>>>=l)>>>1&1))+(r>>>c)<<2)>>2],l=c,c=(-8&i[c+4>>2])-u|0;(e=0|i[r+16>>2])||(e=0|i[r+20>>2]);)r=e,l=(o=(A=(-8&i[e+4>>2])-u|0)>>>0>>0)?e:l,c=o?A:c;if((A=l+u|0)>>>0>l>>>0){o=0|i[l+24>>2],n=0|i[l+12>>2];do{if((0|n)==(0|l)){if(!(n=0|i[(e=l+20|0)>>2])&&!(n=0|i[(e=l+16|0)>>2])){r=0;break}for(;;)if(r=0|i[(s=n+20|0)>>2])n=r,e=s;else{if(!(r=0|i[(s=n+16|0)>>2]))break;n=r,e=s}i[e>>2]=0,r=n}else r=0|i[l+8>>2],i[r+12>>2]=n,i[n+8>>2]=r,r=n}while(0);do{if(0|o){if(n=0|i[l+28>>2],(0|l)==(0|i[(e=28228+(n<<2)|0)>>2])){if(i[e>>2]=r,!r){i[6982]=a&~(1<>2])==(0|l)?w:o+20)>>2]=r,!r)break;i[r+24>>2]=o,0|(n=0|i[l+16>>2])&&(i[r+16>>2]=n,i[n+24>>2]=r),0|(n=0|i[l+20>>2])&&(i[r+20>>2]=n,i[n+24>>2]=r)}}while(0);return c>>>0<16?(w=c+u|0,i[l+4>>2]=3|w,i[(w=l+w+4|0)>>2]=1|i[w>>2]):(i[l+4>>2]=3|u,i[A+4>>2]=1|c,i[A+c>>2]=c,0|h&&(s=0|i[6986],r=27964+((n=h>>>3)<<1<<2)|0,(n=1<>2]:(i[6981]=n|d,n=r,e=r+8|0),i[e>>2]=s,i[n+12>>2]=s,i[s+8>>2]=n,i[s+12>>2]=r),i[6983]=c,i[6986]=A),M=t,0|l+8}d=u}else d=u}else d=u}else if(e>>>0<=4294967231)if(u=-8&(e=e+11|0),s=0|i[6982]){o=0-u|0,c=(e>>>=8)?u>>>0>16777215?31:u>>>(7+(c=14-((l=(520192+(m=e<<(d=(e+1048320|0)>>>16&8))|0)>>>16&4)|d|(c=(245760+(m<<=l)|0)>>>16&2))+(m<>>15)|0)|0)&1|c<<1:0,r=0|i[28228+(c<<2)>>2];e:do{if(r)for(e=0,l=u<<(31==(0|c)?0:25-(c>>>1)|0),a=0;;){if((A=(-8&i[r+4>>2])-u|0)>>>0>>0){if(!A){e=r,o=0,m=65;break e}e=r,o=A}if(a=!(0|(m=0|i[r+20>>2]))|(0|m)==(0|(r=0|i[r+16+(l>>>31<<2)>>2]))?a:m,!r){r=a,m=61;break}l<<=1}else r=0,e=0,m=61}while(0);if(61==(0|m)){if(!(0|r)&!(0|e)){if(!(e=((e=2<>>=A=d>>>12&16)>>>5&8)|A|(l=(d>>>=a)>>>2&4)|(c=(d>>>=l)>>>1&2)|(r=(d>>>=c)>>>1&1))+(d>>>r)<<2)>>2]}r?m=65:(l=e,A=o)}if(65==(0|m))for(a=r;;){if(o=(r=(d=(-8&i[a+4>>2])-u|0)>>>0>>0)?d:o,e=r?a:e,(r=0|i[a+16>>2])||(r=0|i[a+20>>2]),!r){l=e,A=o;break}a=r}if(0|l&&A>>>0<((0|i[6983])-u|0)>>>0&&(h=l+u|0)>>>0>l>>>0){a=0|i[l+24>>2],n=0|i[l+12>>2];do{if((0|n)==(0|l)){if(!(n=0|i[(e=l+20|0)>>2])&&!(n=0|i[(e=l+16|0)>>2])){n=0;break}for(;;)if(r=0|i[(o=n+20|0)>>2])n=r,e=o;else{if(!(r=0|i[(o=n+16|0)>>2]))break;n=r,e=o}i[e>>2]=0}else w=0|i[l+8>>2],i[w+12>>2]=n,i[n+8>>2]=w}while(0);do{if(a){if(e=0|i[l+28>>2],(0|l)==(0|i[(r=28228+(e<<2)|0)>>2])){if(i[r>>2]=n,!n){s&=~(1<>2])==(0|l)?w:a+20)>>2]=n,!n)break;i[n+24>>2]=a,0|(e=0|i[l+16>>2])&&(i[n+16>>2]=e,i[e+24>>2]=n),(e=0|i[l+20>>2])&&(i[n+20>>2]=e,i[e+24>>2]=n)}}while(0);e:do{if(A>>>0<16)w=A+u|0,i[l+4>>2]=3|w,i[(w=l+w+4|0)>>2]=1|i[w>>2];else{if(i[l+4>>2]=3|u,i[h+4>>2]=1|A,i[h+A>>2]=A,n=A>>>3,A>>>0<256){r=27964+(n<<1<<2)|0,(e=0|i[6981])&(n=1<>2]:(i[6981]=e|n,n=r,e=r+8|0),i[e>>2]=h,i[n+12>>2]=h,i[h+8>>2]=n,i[h+12>>2]=r;break}if(n=28228+((r=(n=A>>>8)?A>>>0>16777215?31:A>>>(7+(r=14-((v=(520192+(w=n<<(y=(n+1048320|0)>>>16&8))|0)>>>16&4)|y|(r=(245760+(w<<=v)|0)>>>16&2))+(w<>>15)|0)|0)&1|r<<1:0)<<2)|0,i[h+28>>2]=r,i[4+(e=h+16|0)>>2]=0,i[e>>2]=0,!(s&(e=1<>2]=h,i[h+24>>2]=n,i[h+12>>2]=h,i[h+8>>2]=h;break}n=0|i[n>>2];t:do{if((-8&i[n+4>>2])!=(0|A)){for(s=A<<(31==(0|r)?0:25-(r>>>1)|0);e=0|i[(r=n+16+(s>>>31<<2)|0)>>2];){if((-8&i[e+4>>2])==(0|A)){n=e;break t}s<<=1,n=e}i[r>>2]=h,i[h+24>>2]=n,i[h+12>>2]=h,i[h+8>>2]=h;break e}}while(0);w=0|i[(y=n+8|0)>>2],i[w+12>>2]=h,i[y>>2]=h,i[h+8>>2]=w,i[h+12>>2]=n,i[h+24>>2]=0}}while(0);return M=t,0|l+8}d=u}else d=u;else d=-1}while(0);if((r=0|i[6983])>>>0>=d>>>0)return n=r-d|0,e=0|i[6986],n>>>0>15?(w=e+d|0,i[6986]=w,i[6983]=n,i[w+4>>2]=1|n,i[e+r>>2]=n,i[e+4>>2]=3|d):(i[6983]=0,i[6986]=0,i[e+4>>2]=3|r,i[(w=e+r+4|0)>>2]=1|i[w>>2]),M=t,0|e+8;if((A=0|i[6984])>>>0>d>>>0)return v=A-d|0,i[6984]=v,y=(w=0|i[6987])+d|0,i[6987]=y,i[y+4>>2]=1|v,i[w+4>>2]=3|d,M=t,0|w+8;if(0|i[7099]?e=0|i[7101]:(i[7101]=4096,i[7100]=4096,i[7102]=-1,i[7103]=-1,i[7104]=0,i[7092]=0,i[7099]=-16&f^1431655768,e=4096),l=d+48|0,(u=(a=e+(c=d+47|0)|0)&(o=0-e|0))>>>0<=d>>>0)return M=t,0;if(0|(e=0|i[7091])&&(f=(h=0|i[7089])+u|0)>>>0<=h>>>0|f>>>0>e>>>0)return M=t,0;e:do{if(4&i[7092])n=0,m=143;else{r=0|i[6987];t:do{if(r){for(s=28372;!((f=0|i[s>>2])>>>0<=r>>>0&&(f+(0|i[s+4>>2])|0)>>>0>r>>>0);){if(!(e=0|i[s+8>>2])){m=128;break t}s=e}if((n=a-A&o)>>>0<2147483647)if((0|(e=0|hn(0|n)))==((0|i[s>>2])+(0|i[s+4>>2])|0)){if(-1!=(0|e)){A=n,a=e,m=145;break e}}else s=e,m=136;else n=0}else m=128}while(0);do{if(128==(0|m))if(-1!=(0|(r=0|hn(0)))&&(n=r,g=(n=((g=(p=0|i[7100])-1|0)&n?(g+n&0-p)-n|0:0)+u|0)+(p=0|i[7089])|0,n>>>0>d>>>0&n>>>0<2147483647)){if(0|(f=0|i[7091])&&g>>>0<=p>>>0|g>>>0>f>>>0){n=0;break}if((0|(e=0|hn(0|n)))==(0|r)){A=n,a=r,m=145;break e}s=e,m=136}else n=0}while(0);do{if(136==(0|m)){if(r=0-n|0,!(l>>>0>n>>>0&n>>>0<2147483647&-1!=(0|s))){if(-1==(0|s)){n=0;break}A=n,a=s,m=145;break e}if((e=c-n+(e=0|i[7101])&0-e)>>>0>=2147483647){A=n,a=s,m=145;break e}if(-1==(0|hn(0|e))){hn(0|r),n=0;break}A=e+n|0,a=s,m=145;break e}}while(0);i[7092]=4|i[7092],m=143}}while(0);if(143==(0|m)&&u>>>0<2147483647&&!(-1==(0|(v=0|hn(0|u)))|1^(b=(_=(g=0|hn(0))-v|0)>>>0>(d+40|0)>>>0)|v>>>0>>0&-1!=(0|v)&-1!=(0|g)^1)&&(A=b?_:n,a=v,m=145),145==(0|m)){n=(0|i[7089])+A|0,i[7089]=n,n>>>0>(0|i[7090])>>>0&&(i[7090]=n),c=0|i[6987];e:do{if(c){for(n=28372;;){if((0|a)==((e=0|i[n>>2])+(r=0|i[n+4>>2])|0)){m=154;break}if(!(s=0|i[n+8>>2]))break;n=s}if(!(154!=(0|m)||(y=n+4|0,8&i[n+12>>2]))&&a>>>0>c>>>0&e>>>0<=c>>>0){i[y>>2]=r+A,y=c+(v=7&(v=c+8|0)?0-v&7:0)|0,v=(w=(0|i[6984])+A|0)-v|0,i[6987]=y,i[6984]=v,i[y+4>>2]=1|v,i[c+w+4>>2]=40,i[6988]=i[7103];break}for(a>>>0<(0|i[6985])>>>0&&(i[6985]=a),r=a+A|0,n=28372;;){if((0|i[n>>2])==(0|r)){m=162;break}if(!(e=0|i[n+8>>2]))break;n=e}if(162==(0|m)&&!(8&i[n+12>>2])){i[n>>2]=a,i[(h=n+4|0)>>2]=(0|i[h>>2])+A,u=(h=a+(7&(h=a+8|0)?0-h&7:0)|0)+d|0,l=(n=r+(7&(n=r+8|0)?0-n&7:0)|0)-h-d|0,i[h+4>>2]=3|d;t:do{if((0|c)==(0|n))w=(0|i[6984])+l|0,i[6984]=w,i[6987]=u,i[u+4>>2]=1|w;else{if((0|i[6986])==(0|n)){w=(0|i[6983])+l|0,i[6983]=w,i[6986]=u,i[u+4>>2]=1|w,i[u+w>>2]=w;break}if(1==(3&(e=0|i[n+4>>2]))){A=-8&e,s=e>>>3;n:do{if(e>>>0<256){if(e=0|i[n+8>>2],(0|(r=0|i[n+12>>2]))==(0|e)){i[6981]=i[6981]&~(1<>2]=r,i[r+8>>2]=e;break}a=0|i[n+24>>2],e=0|i[n+12>>2];do{if((0|e)==(0|n)){if(e=0|i[(s=4+(r=n+16|0)|0)>>2])r=s;else if(!(e=0|i[r>>2])){e=0;break}for(;;)if(s=0|i[(o=e+20|0)>>2])e=s,r=o;else{if(!(s=0|i[(o=e+16|0)>>2]))break;e=s,r=o}i[r>>2]=0}else w=0|i[n+8>>2],i[w+12>>2]=e,i[e+8>>2]=w}while(0);if(!a)break;s=28228+((r=0|i[n+28>>2])<<2)|0;do{if((0|i[s>>2])==(0|n)){if(i[s>>2]=e,0|e)break;i[6982]=i[6982]&~(1<>2])==(0|n)?w:a+20)>>2]=e,!e)break n}while(0);if(i[e+24>>2]=a,0|(s=0|i[(r=n+16|0)>>2])&&(i[e+16>>2]=s,i[s+24>>2]=e),!(r=0|i[r+4>>2]))break;i[e+20>>2]=r,i[r+24>>2]=e}while(0);n=n+A|0,o=A+l|0}else o=l;if(i[(n=n+4|0)>>2]=-2&i[n>>2],i[u+4>>2]=1|o,i[u+o>>2]=o,n=o>>>3,o>>>0<256){r=27964+(n<<1<<2)|0,(e=0|i[6981])&(n=1<>2]:(i[6981]=e|n,n=r,e=r+8|0),i[e>>2]=u,i[n+12>>2]=u,i[u+8>>2]=n,i[u+12>>2]=r;break}n=o>>>8;do{if(n){if(o>>>0>16777215){s=31;break}s=o>>>(7+(s=14-((v=(520192+(w=n<<(y=(n+1048320|0)>>>16&8))|0)>>>16&4)|y|(s=(245760+(w<<=v)|0)>>>16&2))+(w<>>15)|0)|0)&1|s<<1}else s=0}while(0);if(n=28228+(s<<2)|0,i[u+28>>2]=s,i[4+(e=u+16|0)>>2]=0,i[e>>2]=0,!((e=0|i[6982])&(r=1<>2]=u,i[u+24>>2]=n,i[u+12>>2]=u,i[u+8>>2]=u;break}n=0|i[n>>2];n:do{if((-8&i[n+4>>2])!=(0|o)){for(s=o<<(31==(0|s)?0:25-(s>>>1)|0);e=0|i[(r=n+16+(s>>>31<<2)|0)>>2];){if((-8&i[e+4>>2])==(0|o)){n=e;break n}s<<=1,n=e}i[r>>2]=u,i[u+24>>2]=n,i[u+12>>2]=u,i[u+8>>2]=u;break t}}while(0);w=0|i[(y=n+8|0)>>2],i[w+12>>2]=u,i[y>>2]=u,i[u+8>>2]=w,i[u+12>>2]=n,i[u+24>>2]=0}}while(0);return M=t,0|h+8}for(n=28372;!((e=0|i[n>>2])>>>0<=c>>>0&&(w=e+(0|i[n+4>>2])|0)>>>0>c>>>0);)n=0|i[n+8>>2];n=(e=(e=(o=w+-47|0)+(7&(e=o+8|0)?0-e&7:0)|0)>>>0<(o=c+16|0)>>>0?c:e)+8|0,y=a+(v=7&(v=a+8|0)?0-v&7:0)|0,v=(r=A+-40|0)-v|0,i[6987]=y,i[6984]=v,i[y+4>>2]=1|v,i[a+r+4>>2]=40,i[6988]=i[7103],i[(r=e+4|0)>>2]=27,i[n>>2]=i[7093],i[n+4>>2]=i[7094],i[n+8>>2]=i[7095],i[n+12>>2]=i[7096],i[7093]=a,i[7094]=A,i[7096]=0,i[7095]=n,n=e+24|0;do{y=n,i[(n=n+4|0)>>2]=7}while((y+8|0)>>>0>>0);if((0|e)!=(0|c)){if(a=e-c|0,i[r>>2]=-2&i[r>>2],i[c+4>>2]=1|a,i[e>>2]=a,n=a>>>3,a>>>0<256){r=27964+(n<<1<<2)|0,(e=0|i[6981])&(n=1<>2]:(i[6981]=e|n,n=r,e=r+8|0),i[e>>2]=c,i[n+12>>2]=c,i[c+8>>2]=n,i[c+12>>2]=r;break}if(r=28228+((s=(n=a>>>8)?a>>>0>16777215?31:a>>>(7+(s=14-((v=(520192+(w=n<<(y=(n+1048320|0)>>>16&8))|0)>>>16&4)|y|(s=(245760+(w<<=v)|0)>>>16&2))+(w<>>15)|0)|0)&1|s<<1:0)<<2)|0,i[c+28>>2]=s,i[c+20>>2]=0,i[o>>2]=0,!((n=0|i[6982])&(e=1<>2]=c,i[c+24>>2]=r,i[c+12>>2]=c,i[c+8>>2]=c;break}n=0|i[r>>2];t:do{if((-8&i[n+4>>2])!=(0|a)){for(s=a<<(31==(0|s)?0:25-(s>>>1)|0);e=0|i[(r=n+16+(s>>>31<<2)|0)>>2];){if((-8&i[e+4>>2])==(0|a)){n=e;break t}s<<=1,n=e}i[r>>2]=c,i[c+24>>2]=n,i[c+12>>2]=c,i[c+8>>2]=c;break e}}while(0);w=0|i[(y=n+8|0)>>2],i[w+12>>2]=c,i[y>>2]=c,i[c+8>>2]=w,i[c+12>>2]=n,i[c+24>>2]=0}}else!(0|(w=0|i[6985]))|a>>>0>>0&&(i[6985]=a),i[7093]=a,i[7094]=A,i[7096]=0,i[6990]=i[7099],i[6989]=-1,i[6994]=27964,i[6993]=27964,i[6996]=27972,i[6995]=27972,i[6998]=27980,i[6997]=27980,i[7e3]=27988,i[6999]=27988,i[7002]=27996,i[7001]=27996,i[7004]=28004,i[7003]=28004,i[7006]=28012,i[7005]=28012,i[7008]=28020,i[7007]=28020,i[7010]=28028,i[7009]=28028,i[7012]=28036,i[7011]=28036,i[7014]=28044,i[7013]=28044,i[7016]=28052,i[7015]=28052,i[7018]=28060,i[7017]=28060,i[7020]=28068,i[7019]=28068,i[7022]=28076,i[7021]=28076,i[7024]=28084,i[7023]=28084,i[7026]=28092,i[7025]=28092,i[7028]=28100,i[7027]=28100,i[7030]=28108,i[7029]=28108,i[7032]=28116,i[7031]=28116,i[7034]=28124,i[7033]=28124,i[7036]=28132,i[7035]=28132,i[7038]=28140,i[7037]=28140,i[7040]=28148,i[7039]=28148,i[7042]=28156,i[7041]=28156,i[7044]=28164,i[7043]=28164,i[7046]=28172,i[7045]=28172,i[7048]=28180,i[7047]=28180,i[7050]=28188,i[7049]=28188,i[7052]=28196,i[7051]=28196,i[7054]=28204,i[7053]=28204,i[7056]=28212,i[7055]=28212,y=a+(v=7&(v=a+8|0)?0-v&7:0)|0,v=(w=A+-40|0)-v|0,i[6987]=y,i[6984]=v,i[y+4>>2]=1|v,i[a+w+4>>2]=40,i[6988]=i[7103]}while(0);if((n=0|i[6984])>>>0>d>>>0)return v=n-d|0,i[6984]=v,y=(w=0|i[6987])+d|0,i[6987]=y,i[y+4>>2]=1|v,i[w+4>>2]=3|d,M=t,0|w+8}return i[(w=27920)>>2]=12,M=t,0}function Ht(e){var t=0,n=0,r=0,s=0,o=0,a=0,A=0,l=0;if(e|=0){n=e+-8|0,s=0|i[6985],l=n+(t=-8&(e=0|i[e+-4>>2]))|0;do{if(1&e)A=n,a=n;else{if(r=0|i[n>>2],!(3&e))return;if(o=r+t|0,(a=n+(0-r)|0)>>>0>>0)return;if((0|i[6986])==(0|a)){if(3&~(t=0|i[(e=l+4|0)>>2])){A=a,t=o;break}return i[6983]=o,i[e>>2]=-2&t,i[a+4>>2]=1|o,void(i[a+o>>2]=o)}if(n=r>>>3,r>>>0<256){if(e=0|i[a+8>>2],(0|(t=0|i[a+12>>2]))==(0|e)){i[6981]=i[6981]&~(1<>2]=t,i[t+8>>2]=e,A=a,t=o;break}s=0|i[a+24>>2],e=0|i[a+12>>2];do{if((0|e)==(0|a)){if(e=0|i[(n=4+(t=a+16|0)|0)>>2])t=n;else if(!(e=0|i[t>>2])){e=0;break}for(;;)if(n=0|i[(r=e+20|0)>>2])e=n,t=r;else{if(!(n=0|i[(r=e+16|0)>>2]))break;e=n,t=r}i[t>>2]=0}else A=0|i[a+8>>2],i[A+12>>2]=e,i[e+8>>2]=A}while(0);if(s){if(t=0|i[a+28>>2],(0|i[(n=28228+(t<<2)|0)>>2])==(0|a)){if(i[n>>2]=e,!e){i[6982]=i[6982]&~(1<>2])==(0|a)?A:s+20)>>2]=e,!e){A=a,t=o;break}i[e+24>>2]=s,0|(n=0|i[(t=a+16|0)>>2])&&(i[e+16>>2]=n,i[n+24>>2]=e),(t=0|i[t+4>>2])?(i[e+20>>2]=t,i[t+24>>2]=e,A=a,t=o):(A=a,t=o)}else A=a,t=o}}while(0);if(!(a>>>0>=l>>>0)&&1&(r=0|i[(e=l+4|0)>>2])){if(2&r)i[e>>2]=-2&r,i[A+4>>2]=1|t,i[a+t>>2]=t,s=t;else{if((0|i[6987])==(0|l)){if(l=(0|i[6984])+t|0,i[6984]=l,i[6987]=A,i[A+4>>2]=1|l,(0|A)!=(0|i[6986]))return;return i[6986]=0,void(i[6983]=0)}if((0|i[6986])==(0|l))return l=(0|i[6983])+t|0,i[6983]=l,i[6986]=a,i[A+4>>2]=1|l,void(i[a+l>>2]=l);s=(-8&r)+t|0,n=r>>>3;do{if(r>>>0<256){if(t=0|i[l+8>>2],(0|(e=0|i[l+12>>2]))==(0|t)){i[6981]=i[6981]&~(1<>2]=e,i[e+8>>2]=t;break}o=0|i[l+24>>2],e=0|i[l+12>>2];do{if((0|e)==(0|l)){if(e=0|i[(n=4+(t=l+16|0)|0)>>2])t=n;else if(!(e=0|i[t>>2])){n=0;break}for(;;)if(n=0|i[(r=e+20|0)>>2])e=n,t=r;else{if(!(n=0|i[(r=e+16|0)>>2]))break;e=n,t=r}i[t>>2]=0,n=e}else n=0|i[l+8>>2],i[n+12>>2]=e,i[e+8>>2]=n,n=e}while(0);if(0|o){if(e=0|i[l+28>>2],(0|i[(t=28228+(e<<2)|0)>>2])==(0|l)){if(i[t>>2]=n,!n){i[6982]=i[6982]&~(1<>2])==(0|l)?r:o+20)>>2]=n,!n)break;i[n+24>>2]=o,0|(t=0|i[(e=l+16|0)>>2])&&(i[n+16>>2]=t,i[t+24>>2]=n),0|(e=0|i[e+4>>2])&&(i[n+20>>2]=e,i[e+24>>2]=n)}}while(0);if(i[A+4>>2]=1|s,i[a+s>>2]=s,(0|A)==(0|i[6986]))return void(i[6983]=s)}if(e=s>>>3,s>>>0<256)return n=27964+(e<<1<<2)|0,(t=0|i[6981])&(e=1<>2]:(i[6981]=t|e,e=n,t=n+8|0),i[t>>2]=A,i[e+12>>2]=A,i[A+8>>2]=e,void(i[A+12>>2]=n);e=28228+((r=(e=s>>>8)?s>>>0>16777215?31:s>>>(7+(r=14-((o=(520192+(l=e<<(a=(e+1048320|0)>>>16&8))|0)>>>16&4)|a|(r=(245760+(l<<=o)|0)>>>16&2))+(l<>>15)|0)|0)&1|r<<1:0)<<2)|0,i[A+28>>2]=r,i[A+20>>2]=0,i[A+16>>2]=0,t=0|i[6982],n=1<>2];t:do{if((-8&i[e+4>>2])!=(0|s)){for(r=s<<(31==(0|r)?0:25-(r>>>1)|0);t=0|i[(n=e+16+(r>>>31<<2)|0)>>2];){if((-8&i[t+4>>2])==(0|s)){e=t;break t}r<<=1,e=t}i[n>>2]=A,i[A+24>>2]=e,i[A+12>>2]=A,i[A+8>>2]=A;break e}}while(0);l=0|i[(a=e+8|0)>>2],i[l+12>>2]=A,i[a>>2]=A,i[A+8>>2]=l,i[A+12>>2]=e,i[A+24>>2]=0}else i[6982]=t|n,i[e>>2]=A,i[A+24>>2]=e,i[A+12>>2]=A,i[A+8>>2]=A}while(0);if(l=(0|i[6989])-1|0,i[6989]=l,!(0|l)){for(e=28380;e=0|i[e>>2];)e=e+8|0;i[6989]=-1}}}}function $t(e,t){t|=0;var n=0;return(e|=0)?(n=0|v(t,e),(t|e)>>>0>65535&&(n=((n>>>0)/(e>>>0)|0)==(0|t)?n:-1)):n=0,(e=0|Wt(n))&&3&i[e+-4>>2]?(cn(0|e,0,0|n),0|e):0|e}function Xt(e,t,n,r){return 0|(E((t|=0)+(r|=0)+((n=(e|=0)+(n|=0)>>>0)>>>0>>0|0)>>>0|0),n)}function Qt(e,t,n,r){return 0|(E(0|(r=(t|=0)-(r|=0)-((n|=0)>>>0>(e|=0)>>>0|0)>>>0)),e-n>>>0)}function Yt(e){return 0|((e|=0)?31-(0|x(e^e-1)):32)}function qt(e,t,n,r,s){s|=0;var o=0,a=0,A=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0;if(u=e|=0,a=n|=0,A=d=r|=0,!(c=l=t|=0))return o=!!(0|s),A?o?(i[s>>2]=0|e,i[s+4>>2]=0&t,s=0,0|(E(0|(d=0)),s)):(s=0,0|(E(0|(d=0)),s)):(o&&(i[s>>2]=(u>>>0)%(a>>>0),i[s+4>>2]=0),s=(u>>>0)/(a>>>0)>>>0,0|(E(0|(d=0)),s));o=!(0|A);do{if(a){if(!o){if((o=(0|x(0|A))-(0|x(0|c))|0)>>>0<=31){a=h=o+1|0,e=u>>>(h>>>0)&(t=o-31>>31)|c<<(A=31-o|0),t&=c>>>(h>>>0),o=0,A=u<>2]=0|e,i[s+4>>2]=l|0&t,s=0,0|(E(0|(d=0)),s)):(s=0,0|(E(0|(d=0)),s))}if((o=a-1|0)&a){a=A=33+(0|x(0|a))-(0|x(0|c))|0,e=(h=32-A|0)-1>>31&c>>>((f=A-32|0)>>>0)|(c<>>(A>>>0))&(t=f>>31),t&=c>>>(A>>>0),o=u<<(p=64-A|0)&(l=h>>31),A=(c<>>(f>>>0))&l|u<>31;break}return 0|s&&(i[s>>2]=o&u,i[s+4>>2]=0),1==(0|a)?(p=0|e,0|(E(0|(f=l|0&t)),p)):(f=c>>>((p=0|Yt(0|a))>>>0)|0,p=c<<32-p|u>>>(p>>>0),0|(E(0|f),p))}if(o)return 0|s&&(i[s>>2]=(c>>>0)%(a>>>0),i[s+4>>2]=0),p=(c>>>0)/(a>>>0)>>>0,0|(E(0|(f=0)),p);if(!u)return 0|s&&(i[s>>2]=0,i[s+4>>2]=(c>>>0)%(A>>>0)),p=(c>>>0)/(A>>>0)>>>0,0|(E(0|(f=0)),p);if(!((o=A-1|0)&A))return 0|s&&(i[s>>2]=0|e,i[s+4>>2]=o&c|0&t),f=0,p=c>>>((0|Yt(0|A))>>>0),0|(E(0|f),p);if((o=(0|x(0|A))-(0|x(0|c))|0)>>>0<=30){a=t=o+1|0,e=c<<(A=31-o|0)|u>>>(t>>>0),t=c>>>(t>>>0),o=0,A=u<>2]=0|e,i[s+4>>2]=l|0&t,p=0,0|(E(0|(f=0)),p)):(p=0,0|(E(0|(f=0)),p))}while(0);if(a){c=0|Xt(0|(h=0|n),0|(u=d|0&r),-1,-1),n=0|T(),l=A,A=0;do{r=l,l=o>>>31|l<<1,o=A|o<<1,Qt(0|c,0|n,0|(r=e<<1|r>>>31),0|(d=e>>>31|t<<1)),A=1&(f=(p=0|T())>>31|((0|p)<0?-1:0)<<1),e=0|Qt(0|r,0|d,f&h|0,(((0|p)<0?-1:0)>>31|((0|p)<0?-1:0)<<1)&u),t=0|T(),a=a-1|0}while(0|a);c=l,l=0}else c=A,l=0,A=0;return a=0,0|s&&(i[s>>2]=e,i[s+4>>2]=t),p=o<<1&-2|A,0|(E(0|(f=(0|o)>>>31|(c|a)<<1|l)),p)}function Kt(e,t,n,r){var i,s,o,a,A;return n|=0,s=(r|=0)>>31|((0|r)<0?-1:0)<<1,i=((0|r)<0?-1:0)>>31|((0|r)<0?-1:0)<<1,o=0|Qt((A=(t|=0)>>31|((0|t)<0?-1:0)<<1)^(e|=0),(a=((0|t)<0?-1:0)>>31|((0|t)<0?-1:0)<<1)^t,0|A,0|a),e=s^A,t=i^a,0|Qt((0|qt(o,0|T(),0|Qt(s^n|0,i^r|0,0|s,0|i),0|T(),0))^e,(0|T())^t,0|e,0|t)}function Zt(e,t,n,r){var i,s;return t|=0,r|=0,n=0|function(e,t){var n,r,i,s=0;return e=((n=0|v(s=65535&(t|=0),i=65535&(e|=0)))>>>16)+(0|v(s,r=e>>>16))|0,t=0|v(s=t>>>16,i),0|(E((e>>>16)+(0|v(s,r))+(((65535&e)+t|0)>>>16)|0),e+t<<16|65535&n)}(i=e|=0,s=n|=0),e=0|T(),0|(E((0|v(t,s))+(0|v(r,i))+e|0&e),n)}function Jt(e,t,n,r){var s,o,a,A,l,c;return n|=0,s=M,M=M+16|0,A=0|s,c=(r|=0)>>31|((0|r)<0?-1:0)<<1,l=((0|r)<0?-1:0)>>31|((0|r)<0?-1:0)<<1,qt(e=0|Qt((a=(t|=0)>>31|((0|t)<0?-1:0)<<1)^(e|=0),(o=((0|t)<0?-1:0)>>31|((0|t)<0?-1:0)<<1)^t,0|a,0|o),t=0|T(),0|Qt(c^n|0,l^r|0,0|c,0|l),0|T(),A),r=0|Qt(i[A>>2]^a|0,i[A+4>>2]^o|0,0|a,0|o),n=0|T(),M=s,0|(E(0|n),r)}function en(e,t,n,r){var s,o;return o=M,M=M+16|0,qt(e|=0,t|=0,n|=0,r|=0,s=0|o),M=o,0|(E(0|i[s+4>>2]),i[s>>2])}function tn(e,t,n){return e|=0,t|=0,(0|(n|=0))<32?(E(t>>n|0),e>>>n|(t&(1<>n-32)}function nn(e,t,n){return e|=0,t|=0,(0|(n|=0))<32?(E(t>>>n|0),e>>>n|(t&(1<>>n-32|0)}function rn(e,t,n){return e|=0,(0|(n|=0))<32?(E((t|=0)<>>32-n),e<=0?+A(e+.5):+b(e-.5)}function ln(e,t,n){e|=0,t|=0;var s,o,a=0;if((0|(n|=0))>=8192)return R(0|e,0|t,0|n),0|e;if(o=0|e,s=e+n|0,(3&e)==(3&t)){for(;3&e;){if(!n)return 0|o;r[0|e]=0|r[0|t],e=e+1|0,t=t+1|0,n=n-1|0}for(a=(n=-4&s)-64|0;(0|e)<=(0|a);)i[e>>2]=i[t>>2],i[e+4>>2]=i[t+4>>2],i[e+8>>2]=i[t+8>>2],i[e+12>>2]=i[t+12>>2],i[e+16>>2]=i[t+16>>2],i[e+20>>2]=i[t+20>>2],i[e+24>>2]=i[t+24>>2],i[e+28>>2]=i[t+28>>2],i[e+32>>2]=i[t+32>>2],i[e+36>>2]=i[t+36>>2],i[e+40>>2]=i[t+40>>2],i[e+44>>2]=i[t+44>>2],i[e+48>>2]=i[t+48>>2],i[e+52>>2]=i[t+52>>2],i[e+56>>2]=i[t+56>>2],i[e+60>>2]=i[t+60>>2],e=e+64|0,t=t+64|0;for(;(0|e)<(0|n);)i[e>>2]=i[t>>2],e=e+4|0,t=t+4|0}else for(n=s-4|0;(0|e)<(0|n);)r[0|e]=0|r[0|t],r[e+1|0]=0|r[t+1|0],r[e+2|0]=0|r[t+2|0],r[e+3|0]=0|r[t+3|0],e=e+4|0,t=t+4|0;for(;(0|e)<(0|s);)r[0|e]=0|r[0|t],e=e+1|0,t=t+1|0;return 0|o}function cn(e,t,n){t|=0;var s,o=0,a=0,A=0;if(s=(e|=0)+(n|=0)|0,t&=255,(0|n)>=67){for(;3&e;)r[0|e]=t,e=e+1|0;for(A=t|t<<8|t<<16|t<<24,a=(o=-4&s)-64|0;(0|e)<=(0|a);)i[e>>2]=A,i[e+4>>2]=A,i[e+8>>2]=A,i[e+12>>2]=A,i[e+16>>2]=A,i[e+20>>2]=A,i[e+24>>2]=A,i[e+28>>2]=A,i[e+32>>2]=A,i[e+36>>2]=A,i[e+40>>2]=A,i[e+44>>2]=A,i[e+48>>2]=A,i[e+52>>2]=A,i[e+56>>2]=A,i[e+60>>2]=A,e=e+64|0;for(;(0|e)<(0|o);)i[e>>2]=A,e=e+4|0}for(;(0|e)<(0|s);)r[0|e]=t,e=e+1|0;return s-n|0}function un(e){return(e=+e)>=0?+A(e+.5):+b(e-.5)}function hn(e){var t,n,r;return e|=0,r=0|k(),(0|e)>0&(0|(t=(n=0|i[a>>2])+e|0))<(0|n)|(0|t)<0?(I(0|t),C(12),-1):(0|t)>(0|r)&&!(0|P(0|t))?(C(12),-1):(i[a>>2]=t,0|n)}return{___divdi3:Kt,___muldi3:Zt,___remdi3:Jt,___uremdi3:en,_areNeighborCells:function(e,t,n,r,s){s|=0;var o,a,A,l=0,c=0,u=0,h=0;if(A=M,M=M+64|0,a=A,o=A+56|0,!(!0&134217728==(2013265920&(t|=0))&!0&134217728==(2013265920&(r|=0))))return M=A,5;if((0|(e|=0))==(0|(n|=0))&(0|t)==(0|r))return i[s>>2]=0,M=A,0;if(c=0|nn(0|e,0|t,52),T(),c&=15,h=0|nn(0|n,0|r,52),T(),(0|c)!=(15&h))return M=A,12;if(l=c+-1|0,c>>>0>1){Fe(e,t,l,a),Fe(n,r,l,o),u=0|i[(h=a)>>2],h=0|i[h+4>>2];e:do{if((0|u)==(0|i[o>>2])&&(0|h)==(0|i[o+4>>2])){l=0|nn(0|e,0|t,0|(c=3*(15^c)|0)),T(),l&=7,c=0|nn(0|n,0|r,0|c),T(),c&=7;do{if(!(0|l)|!(0|c))i[s>>2]=1,l=0;else if(7==(0|l))l=5;else{if(1==(0|l)|1==(0|c)&&0|je(u,h)){l=5;break}if((0|i[15536+(l<<2)>>2])!=(0|c)&&(0|i[15568+(l<<2)>>2])!=(0|c))break e;i[s>>2]=1,l=0}}while(0);return M=A,0|l}}while(0)}c=(l=a)+56|0;do{i[l>>2]=0,l=l+4|0}while((0|l)<(0|c));return L(e,t,1,a),l=(0|i[(t=a)>>2])==(0|n)&&(0|i[t+4>>2])==(0|r)||(0|i[(t=a+8|0)>>2])==(0|n)&&(0|i[t+4>>2])==(0|r)||(0|i[(t=a+16|0)>>2])==(0|n)&&(0|i[t+4>>2])==(0|r)||(0|i[(t=a+24|0)>>2])==(0|n)&&(0|i[t+4>>2])==(0|r)||(0|i[(t=a+32|0)>>2])==(0|n)&&(0|i[t+4>>2])==(0|r)||(0|i[(t=a+40|0)>>2])==(0|n)&&(0|i[t+4>>2])==(0|r)?1:1&((0|i[(l=a+48|0)>>2])==(0|n)?(0|i[l+4>>2])==(0|r):0),i[s>>2]=l,M=A,0},_bitshift64Ashr:tn,_bitshift64Lshr:nn,_bitshift64Shl:rn,_calloc:$t,_cellAreaKm2:function(e,t,n){return 0|(e=0|ut(e|=0,t|=0,n|=0))||(s[n>>3]=6371.007180918475*+s[n>>3]*6371.007180918475),0|e},_cellAreaM2:function(e,t,n){return 0|(e=0|ut(e|=0,t|=0,n|=0))||(s[n>>3]=6371.007180918475*+s[n>>3]*6371.007180918475*1e3*1e3),0|e},_cellAreaRads2:ut,_cellToBoundary:Je,_cellToCenterChild:ze,_cellToChildPos:function(e,t,n,r){n|=0,r|=0;var s,o=0,a=0,A=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0;if(s=M,M=M+16|0,_=s,b=0|nn(0|(e|=0),0|(t|=0),52),T(),n>>>0>15)return M=s,4;if((0|(b&=15))<(0|n))return M=s,12;if((0|b)!=(0|n))if(a=0|rn(0|n,0,52),a|=e,l=T()|-15728641&t,(0|b)>(0|n)){c=n;do{m=0|rn(7,0,3*(14-c|0)|0),c=c+1|0,a|=m,l=0|T()|l}while((0|c)<(0|b));m=a}else m=a;else m=e,l=t;g=0|nn(0|m,0|l,45),T();e:do{if(0|G(127&g)){if(c=0|nn(0|m,0|l,52),T(),0|(c&=15))for(a=1;;){if(!(!((g=0|rn(7,0,3*(15-a|0)|0))&m)&!((0|T())&l))){u=33;break e}if(!(a>>>0>>0))break;a=a+1|0}if(i[(g=r)>>2]=0,i[g+4>>2]=0,(0|b)>(0|n)){for(g=-15728641&t,p=b;;){if(f=p,(p=p+-1|0)>>>0>15|(0|b)<(0|p)){u=19;break}if((0|b)!=(0|p))if(a=0|rn(0|p,0,52),a|=e,c=0|T()|g,(0|b)<(0|f))d=a;else{u=p;do{d=0|rn(7,0,3*(14-u|0)|0),u=u+1|0,a|=d,c=0|T()|c}while((0|u)<(0|b));d=a}else d=e,c=t;if(h=0|nn(0|d,0|c,45),T(),0|G(127&h)){h=0|nn(0|d,0|c,52),T(),h&=15;t:do{if(h)for(u=1;;){if(a=0|nn(0|d,0|c,3*(15-u|0)|0),T(),0|(a&=7))break t;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|nn(0|e,0|t,3*(15-f|0)|0),T(),7==(0|(c&=7))){o=5,u=42;break}if(1==(0|c)&(a=!!(0|a))){o=5,u=42;break}if(0|(d=c+((!!(0|c)&a)<<31>>31)|0)&&(u=0|_t(7,0,u=b-f|0,((0|u)<0)<<31>>31),h=0|T(),a?(a=0|Xt(0|(a=0|Zt(0|u,0|h,5,0)),0|T(),-5,-1),a=0|Xt(0|(a=0|Kt(0|a,0|T(),6,0)),0|T(),1,0),c=0|T()):(a=u,c=h),f=0|Xt(0|a,0|c,0|(f=0|Zt(0|u,0|h,0|(f=d+-1|0),((0|f)<0)<<31>>31)),0|T()),h=0|Xt(0|f,0|(d=0|T()),0|i[(h=r)>>2],0|i[h+4>>2]),d=0|T(),i[(f=r)>>2]=h,i[f+4>>2]=d),(0|p)<=(0|n)){u=37;break}}if(19==(0|u))S(27795,27122,1367,27158);else{if(37==(0|u)){o=0|i[(A=r)+4>>2],A=0|i[A>>2];break}if(42==(0|u))return M=s,0|o}}else o=0,A=0}else u=33}while(0);e:do{if(33==(0|u)){if(i[(g=r)>>2]=0,i[g+4>>2]=0,(0|b)>(0|n)){for(a=b;;){if(o=0|nn(0|e,0|t,3*(15-a|0)|0),T(),7==(0|(o&=7))){o=5;break}if(o=0|Zt(0|(A=0|_t(7,0,A=b-a|0,((0|A)<0)<<31>>31)),0|T(),0|o,0),A=0|T(),A=0|Xt(0|i[(g=r)>>2],0|i[g+4>>2],0|o,0|A),o=0|T(),i[(g=r)>>2]=A,i[g+4>>2]=o,(0|(a=a+-1|0))<=(0|n))break e}return M=s,0|o}o=0,A=0}}while(0);return 0|Ue(m,l,b,_)&&S(27795,27122,1327,27173),((0|o)>-1|-1==(0|o)&A>>>0>4294967295)&((0|(_=0|i[(b=_)+4>>2]))>(0|o)|((0|_)==(0|o)?(0|i[b>>2])>>>0>A>>>0:0))?(M=s,0|(b=0)):(S(27795,27122,1407,27158),0)},_cellToChildren:function(e,t,n,r){r|=0;var s,o,a=0,A=0;if(o=M,M=M+16|0,tt(s=o,e|=0,t|=0,n|=0),!(0|(e=0|i[(t=s)>>2]))&!(0|(t=0|i[t+4>>2])))return M=o,0;a=0,n=0;do{i[(A=r+(a<<3)|0)>>2]=e,i[A+4>>2]=t,a=0|Xt(0|a,0|n,1,0),n=0|T(),rt(s),e=0|i[(A=s)>>2],t=0|i[A+4>>2]}while(!(!(0|e)&!(0|t)));return M=o,0},_cellToChildrenSize:Ue,_cellToLatLng:Ze,_cellToLocalIj:function(e,t,n,r,s,o){var a,A;return e|=0,o|=0,A=M,M=M+16|0,a=A,(s|=0)?e=15:(e=0|gt(e,t|=0,n|=0,r|=0,a))||(function(e,t){var n;t|=0,n=0|i[8+(e|=0)>>2],i[t>>2]=(0|i[e>>2])-n,i[t+4>>2]=(0|i[e+4>>2])-n}(a,o),e=0),M=A,0|e},_cellToParent:Fe,_cellToVertex:Bt,_cellToVertexes:function(e,t,n){n|=0;var r,s=0,o=0;return o=!(0|je(e|=0,t|=0)),r=!(0|(s=0|Bt(e,t,0,n))),o?r?0|(s=0|Bt(e,t,1,n+8|0))||0|(s=0|Bt(e,t,2,n+16|0))||0|(s=0|Bt(e,t,3,n+24|0))||(s=0|Bt(e,t,4,n+32|0))?0|(o=s):0|Bt(e,t,5,n+40|0):0|(o=s):r?0|(s=0|Bt(e,t,1,n+8|0))||0|(s=0|Bt(e,t,2,n+16|0))||0|(s=0|Bt(e,t,3,n+24|0))||0|(s=0|Bt(e,t,4,n+32|0))?0|(o=s):(i[(o=n+40|0)>>2]=0,i[o+4>>2]=0,0|(o=0)):0|(o=s)},_cellsToDirectedEdge:function(e,t,n,r,s){return s|=0,7==(0|(n=0|U(e|=0,t|=0,n|=0,r|=0)))?0|(s=11):(r=0|rn(0|n,0,56),t=-2130706433&t|T()|268435456,i[s>>2]=e|r,i[s+4>>2]=t,0|(s=0))},_cellsToLinkedMultiPolygon:function(e,t,n){n|=0;var r,o,a,A=0;if(a=M,M=M+32|0,r=a,0|(e=0|function(e,t,n){e|=0,n|=0;var r,s,o=0,a=0,A=0,l=0,c=0,u=0;if(s=M,M=M+176|0,r=s,(0|(t|=0))<1)return Dt(n,0,0),M=s,0;for(c=0|nn(0|i[(c=e)>>2],0|i[c+4>>2],52),T(),Dt(n,(0|t)>6?t:6,15&c),c=0;!(0|(o=0|Je(0|i[(o=e+(c<<3)|0)>>2],0|i[o+4>>2],r)));){if((0|(o=0|i[r>>2]))>0){l=0;do{A=r+8+(l<<4)|0,(a=0|Gt(n,o=r+8+((0|(l=l+1|0))%(0|o)<<4)|0,A))?Ut(n,a):jt(n,A,o),o=0|i[r>>2]}while((0|l)<(0|o))}if((0|(c=c+1|0))>=(0|t)){o=0,u=13;break}}return 13==(0|u)?(M=s,0|o):(Ot(n),M=s,0|(u=o))}(e|=0,t|=0,o=a+16|0)))return M=a,0|e;if(i[n>>2]=0,i[n+4>>2]=0,i[n+8>>2]=0,0|(e=0|Ft(o)))do{t=0|ht(n);do{dt(t,e),A=e+16|0,i[r>>2]=i[A>>2],i[r+4>>2]=i[A+4>>2],i[r+8>>2]=i[A+8>>2],i[r+12>>2]=i[A+12>>2],Ut(o,e),e=0|zt(o,r)}while(0|e);e=0|Ft(o)}while(0|e);return Ot(o),(e=0|function(e){var t,n,r=0,o=0,a=0,A=0,c=0,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0,v=0,y=0,w=0,x=0,E=0,T=0,C=0,k=0,R=0,P=0,I=0,M=0,L=0,B=0,N=0,D=0;if(0|i[(A=(e|=0)+8|0)>>2])return 1;if(!(a=0|i[e>>2]))return 0;r=a,o=0;do{o=o+1|0,r=0|i[r+8>>2]}while(0|r);if(o>>>0<2)return 0;(n=0|Wt(o<<2))||S(27396,27235,317,27415),(t=0|Wt(o<<5))||S(27437,27235,321,27415),i[e>>2]=0,i[(k=e+4|0)>>2]=0,i[A>>2]=0,o=0,B=0,C=0,g=0;e:for(;;){if(p=0|i[a>>2]){c=0,u=p;do{if(d=+s[u+8>>3],r=u,u=0|i[u+16>>2],h=+s[(A=(f=!(0|u))?p:u)+8>>3],+l(+(d-h))>3.141592653589793){D=14;break}c+=(h-d)*(+s[r>>3]+ +s[A>>3])}while(!f);if(14==(0|D)){D=0,c=0,r=p;do{T=+s[r+8>>3],M=0|i[(L=r+16|0)>>2],E=+s[(M=0|M?M:p)+8>>3],c+=(+s[r>>3]+ +s[M>>3])*((E<0?E+6.283185307179586:E)-(T<0?T+6.283185307179586:T)),r=0|i[(0|r?L:a)>>2]}while(0|r)}c>0?(i[n+(B<<2)>>2]=a,B=B+1|0,A=C,r=g):D=19}else D=19;if(19==(0|D)){D=0;do{if(!o){if(g){A=k,u=g+8|0,r=a,o=e;break}if(0|i[e>>2]){D=27;break e}A=k,u=e,r=a,o=e;break}if(0|i[(r=o+8|0)>>2]){D=21;break e}if(!(o=0|$t(1,12))){D=23;break e}i[r>>2]=o,A=o+4|0,u=o,r=g}while(0);if(i[u>>2]=a,i[A>>2]=a,u=t+(C<<5)|0,f=0|i[a>>2]){for(s[(p=t+(C<<5)+8|0)>>3]=17976931348623157e292,s[(g=t+(C<<5)+24|0)>>3]=17976931348623157e292,s[u>>3]=-17976931348623157e292,s[(m=t+(C<<5)+16|0)>>3]=-17976931348623157e292,w=17976931348623157e292,x=-17976931348623157e292,A=0,_=f,d=17976931348623157e292,v=17976931348623157e292,y=-17976931348623157e292,h=-17976931348623157e292;c=+s[_>>3],T=+s[_+8>>3],_=0|i[_+16>>2],E=+s[((b=!(0|_))?f:_)+8>>3],c>3]=c,d=c),T>3]=T,v=T),c>y?s[u>>3]=c:c=y,T>h&&(s[m>>3]=T,h=T),w=T>0&Tx?T:x,A|=+l(+(T-E))>3.141592653589793,!b;)y=c;A&&(s[m>>3]=x,s[g>>3]=w)}else i[u>>2]=0,i[u+4>>2]=0,i[u+8>>2]=0,i[u+12>>2]=0,i[u+16>>2]=0,i[u+20>>2]=0,i[u+24>>2]=0,i[u+28>>2]=0;A=C+1|0}if(a=0|i[(L=a+8|0)>>2],i[L>>2]=0,!a){D=45;break}C=A,g=r}if(21==(0|D))S(27213,27235,35,27247);else if(23==(0|D))S(27267,27235,37,27247);else if(27==(0|D))S(27310,27235,61,27333);else if(45==(0|D)){e:do{if((0|B)>0){for(L=!(0|A),I=A<<2,M=!(0|e),P=0,r=0;;){if(R=0|i[n+(P<<2)>>2],L)D=73;else{if(!(C=0|Wt(I))){D=50;break}if(!(k=0|Wt(I))){D=52;break}t:do{if(M)o=0;else{for(A=0,o=0,u=e;a=t+(A<<5)|0,0|pt(0|i[u>>2],a,0|i[R>>2])?(i[C+(o<<2)>>2]=u,i[k+(o<<2)>>2]=a,b=o+1|0):b=o,u=0|i[u+8>>2];)A=A+1|0,o=b;if((0|b)>0)if(a=0|i[C>>2],1==(0|b))o=a;else for(m=0,_=-1,o=a,g=a;;){for(f=0|i[g>>2],a=0,u=0;p=(0|(A=0|i[i[C+(u<<2)>>2]>>2]))==(0|f)?a:a+(1&pt(A,0|i[k+(u<<2)>>2],0|i[f>>2]))|0,(0|(u=u+1|0))!=(0|b);)a=p;if(o=(A=(0|p)>(0|_))?g:o,(0|(a=m+1|0))==(0|b))break t;m=a,_=A?p:_,g=0|i[C+(a<<2)>>2]}else o=0}}while(0);if(Ht(C),Ht(k),o){if(a=0|i[(A=o+4|0)>>2])o=a+8|0;else if(0|i[o>>2]){D=70;break}i[o>>2]=R,i[A>>2]=R}else D=73}if(73==(0|D)){if(D=0,0|(r=0|i[R>>2]))do{k=r,r=0|i[r+16>>2],Ht(k)}while(0|r);Ht(R),r=1}if((0|(P=P+1|0))>=(0|B)){N=r;break e}}50==(0|D)?S(27452,27235,249,27471):52==(0|D)?S(27490,27235,252,27471):70==(0|D)&&S(27310,27235,61,27333)}else N=0}while(0);return Ht(n),Ht(t),0|N}return 0}(n))?(ft(n),M=a,0|(A=e)):(M=a,0|(A=0))},_childPosToCell:function(e,t,n,r,s,o){e|=0,t|=0,o|=0;var a,A=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0,g=0;if(a=M,M=M+16|0,A=a,(s|=0)>>>0>15)return M=a,4;if(l=0|nn(0|(n|=0),0|(r|=0),52),T(),(0|(l&=15))>(0|s))return M=a,12;if(0|Ue(n,r,s,A)&&S(27795,27122,1327,27173),!(((0|t)>-1|-1==(0|t)&e>>>0>4294967295)&((0|(u=0|i[(h=A)+4>>2]))>(0|t)|((0|u)==(0|t)?(0|i[h>>2])>>>0>e>>>0:0))))return M=a,2;h=s-l|0,s=0|rn(0|s,0,52),c=T()|-15728641&r,i[(u=o)>>2]=s|n,i[u+4>>2]=c,u=0|nn(0|n,0|r,45),T();e:do{if(0|G(127&u)){if(0|l)for(A=1;;){if(!(!((u=0|rn(7,0,3*(15-A|0)|0))&n)&!((0|T())&r)))break e;if(!(A>>>0>>0))break;A=A+1|0}if((0|h)<1)return M=a,0;for(u=15^l,r=-1,c=1,A=1;;){l=0|_t(7,0,l=h-c|0,((0|l)<0)<<31>>31),n=0|T();do{if(A){if(A=0|Kt(0|(A=0|Xt(0|(A=0|Zt(0|l,0|n,5,0)),0|T(),-5,-1)),0|T(),6,0),(0|t)>(0|(s=0|T()))|(0|t)==(0|s)&e>>>0>A>>>0){t=0|Qt(0|(t=0|Xt(0|e,0|t,-1,-1)),0|T(),0|A,0|s),A=0|T(),p=0|i[(d=o)>>2],d=0|i[d+4>>2],f=0|rn(7,0,0|(g=3*(u+r|0)|0)),d&=~T(),g=0|rn(0|(s=0|Xt(0|(r=0|Kt(0|t,0|A,0|l,0|n)),0|(e=0|T()),2,0)),0|T(),0|g),d=0|T()|d,i[(s=o)>>2]=g|p&~f,i[s+4>>2]=d,e=0|Qt(0|t,0|A,0|(e=0|Zt(0|r,0|e,0|l,0|n)),0|T()),A=0,t=0|T();break}f=0|i[(g=o)>>2],g=0|i[g+4>>2],p=0|rn(7,0,3*(u+r|0)|0),g&=~T(),i[(A=o)>>2]=f&~p,i[A+4>>2]=g,A=1;break}s=0|i[(f=o)>>2],f=0|i[f+4>>2],d=0|rn(7,0,0|(r=3*(u+r|0)|0)),f&=~T(),r=0|rn(0|(g=0|Kt(0|e,0|t,0|l,0|n)),0|(A=0|T()),0|r),f=0|T()|f,i[(p=o)>>2]=r|s&~d,i[p+4>>2]=f,e=0|Qt(0|e,0|t,0|(A=0|Zt(0|g,0|A,0|l,0|n)),0|T()),A=0,t=0|T()}while(0);if(!((0|h)>(0|c))){t=0;break}r=~c,c=c+1|0}return M=a,0|t}}while(0);if((0|h)<1)return M=a,0;for(s=15^l,A=1;;){if(p=0|_t(7,0,p=h-A|0,((0|p)<0)<<31>>31),g=0|T(),n=0|i[(c=o)>>2],c=0|i[c+4>>2],r=0|rn(7,0,0|(l=3*(s-A|0)|0)),c&=~T(),l=0|rn(0|(d=0|Kt(0|e,0|t,0|p,0|g)),0|(f=0|T()),0|l),c=0|T()|c,i[(u=o)>>2]=l|n&~r,i[u+4>>2]=c,e=0|Qt(0|e,0|t,0|(g=0|Zt(0|d,0|f,0|p,0|g)),0|T()),t=0|T(),(0|h)<=(0|A)){t=0;break}A=A+1|0}return M=a,0|t},_compactCells:function(e,t,n,r){t|=0;var s,o=0,a=0,A=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0,v=0,y=0,w=0,x=0,E=0,C=0,k=0,R=0,P=0,I=0,M=0;if(!(0|(n|=0))&!(0|(r|=0)))return 0;if(a=0|i[(o=e|=0)>>2],!0&!(15728640&(o=0|i[o+4>>2]))){if(!((0|r)>0|!(0|r)&n>>>0>0))return 0;if(i[(M=t)>>2]=a,i[M+4>>2]=o,1==(0|n)&!(0|r))return 0;o=1,a=0;do{I=0|i[4+(P=e+(o<<3)|0)>>2],i[(M=t+(o<<3)|0)>>2]=i[P>>2],i[M+4>>2]=I,o=0|Xt(0|o,0|a,1,0),a=0|T()}while((0|a)<(0|r)|(0|a)==(0|r)&o>>>0>>0);return 0}if(!(I=0|Wt(s=n<<3)))return 13;if(ln(0|I,0|e,0|s),!(P=0|$t(n,8)))return Ht(I),13;e:for(;;){k=0|nn(0|(u=0|i[(o=I)>>2]),0|(o=0|i[o+4>>2]),52),T(),R=(k&=15)-1|0,C=!!(0|k),E=(0|r)>0|!(0|r)&n>>>0>0;t:do{if(C&E){if(v=0|rn(0|R,0,52),y=0|T(),R>>>0>15){if(!(!(0|u)&!(0|o))){M=16;break e}for(a=0,e=0;;){if(a=0|Xt(0|a,0|e,1,0),!((0|(e=0|T()))<(0|r)|(0|e)==(0|r)&a>>>0>>0))break t;if(!(!(0|(x=0|i[(A=I+(a<<3)|0)>>2]))&!(0|(A=0|i[A+4>>2])))){o=A,M=16;break e}}}for(l=u,e=o,a=0,A=0;;){if(!(!(0|l)&!(0|e))){if(!(!0&!(117440512&e))){M=21;break e}if(h=0|nn(0|l,0|e,52),T(),(0|(h&=15))<(0|R)){o=12,M=27;break e}if((0|h)!=(0|R)&&(l|=v,e=-15728641&e|y,h>>>0>=k>>>0)){c=R;do{x=0|rn(7,0,3*(14-c|0)|0),c=c+1|0,l|=x,e=0|T()|e}while(c>>>0>>0)}if(f=0|en(0|l,0|e,0|n,0|r),p=0|T(),!(!(0|(d=0|i[(h=c=P+(f<<3)|0)>>2]))&!(0|(h=0|i[h+4>>2])))){_=0,b=0;do{if((0|_)>(0|r)|(0|_)==(0|r)&b>>>0>n>>>0){M=31;break e}if((0|d)==(0|l)&(-117440513&h)==(0|e)){g=0|nn(0|d,0|h,56),T(),m=1+(g&=7)|0,x=0|nn(0|d,0|h,45),T();n:do{if(0|G(127&x)){if(d=0|nn(0|d,0|h,52),T(),!(d&=15)){h=6;break}for(h=1;;){if(!(!((x=0|rn(7,0,3*(15-h|0)|0))&l)&!((0|T())&e))){h=7;break n}if(!(h>>>0>>0)){h=6;break}h=h+1|0}}else h=7}while(0);if((g+2|0)>>>0>h>>>0){M=41;break e}x=0|rn(0|m,0,56),e=T()|-117440513&e,i[(w=c)>>2]=0,i[w+4>>2]=0,l|=x}else f=0|Jt(0|(f=0|Xt(0|f,0|p,1,0)),0|T(),0|n,0|r),p=0|T();b=0|Xt(0|b,0|_,1,0),_=0|T(),d=0|i[(h=c=P+(f<<3)|0)>>2],h=0|i[h+4>>2]}while(!(!(0|d)&!(0|h)))}i[(x=c)>>2]=l,i[x+4>>2]=e}if(a=0|Xt(0|a,0|A,1,0),!((0|(A=0|T()))<(0|r)|(0|A)==(0|r)&a>>>0>>0))break t;l=0|i[(e=I+(a<<3)|0)>>2],e=0|i[e+4>>2]}}}while(0);if(x=0|Xt(0|n,0|r,5,0),(w=0|T())>>>0<0|!(0|w)&x>>>0<11){M=85;break}if(x=0|Kt(0|n,0|r,6,0),T(),!(x=0|$t(x,8))){M=48;break}do{if(E){for(m=0,e=0,g=0,_=0;;){if(!(0|(a=0|i[(A=h=P+(m<<3)|0)>>2]))&!(0|(A=0|i[A+4>>2])))w=g;else{d=0|nn(0|a,0|A,56),T(),l=1+(d&=7)|0,f=-117440513&A,w=0|nn(0|a,0|A,45),T();t:do{if(0|G(127&w)){if(p=0|nn(0|a,0|A,52),T(),0|(p&=15))for(c=1;;){if(!(!(a&(w=0|rn(7,0,3*(15-c|0)|0)))&!(f&(0|T()))))break t;if(!(c>>>0

>>0))break;c=c+1|0}a|=A=0|rn(0|l,0,56),A=0|T()|f,i[(l=h)>>2]=a,i[l+4>>2]=A,l=d+2|0}}while(0);7==(0|l)?(i[(w=x+(e<<3)|0)>>2]=a,i[w+4>>2]=-117440513&A,e=0|Xt(0|e,0|g,1,0),w=0|T()):w=g}if(m=0|Xt(0|m,0|_,1,0),!((0|(_=0|T()))<(0|r)|(0|_)==(0|r)&m>>>0>>0))break;g=w}if(E){if(b=R>>>0>15,v=0|rn(0|R,0,52),y=0|T(),!C){for(a=0,c=0,l=0,A=0;!(0|u)&!(0|o)||(i[(R=t+(a<<3)|0)>>2]=u,i[R+4>>2]=o,a=0|Xt(0|a,0|c,1,0),c=0|T()),l=0|Xt(0|l,0|A,1,0),(0|(A=0|T()))<(0|r)|(0|A)==(0|r)&l>>>0>>0;)u=0|i[(o=I+(l<<3)|0)>>2],o=0|i[o+4>>2];o=w;break}for(a=0,c=0,A=0,l=0;;){do{if(!(!(0|u)&!(0|o))){if(p=0|nn(0|u,0|o,52),T(),b|(0|(p&=15))<(0|R)){M=80;break e}if((0|p)!=(0|R)){if(h=u|v,d=-15728641&o|y,p>>>0>=k>>>0){f=R;do{C=0|rn(7,0,3*(14-f|0)|0),f=f+1|0,h|=C,d=0|T()|d}while(f>>>0

>>0)}}else h=u,d=o;g=0|en(0|h,0|d,0|n,0|r),f=0,p=0,_=0|T();do{if((0|f)>(0|r)|(0|f)==(0|r)&p>>>0>n>>>0){M=81;break e}if((-117440513&(m=0|i[4+(C=P+(g<<3)|0)>>2]))==(0|d)&&(0|i[C>>2])==(0|h)){M=65;break}g=0|Jt(0|(C=0|Xt(0|g,0|_,1,0)),0|T(),0|n,0|r),_=0|T(),p=0|Xt(0|p,0|f,1,0),f=0|T(),C=P+(g<<3)|0}while((0|i[C>>2])!=(0|h)||(0|i[C+4>>2])!=(0|d));if(65==(0|M)&&(M=0,!0&100663296==(117440512&m)))break;i[(C=t+(a<<3)|0)>>2]=u,i[C+4>>2]=o,a=0|Xt(0|a,0|c,1,0),c=0|T()}}while(0);if(A=0|Xt(0|A,0|l,1,0),!((0|(l=0|T()))<(0|r)|(0|l)==(0|r)&A>>>0>>0))break;u=0|i[(o=I+(A<<3)|0)>>2],o=0|i[o+4>>2]}o=w}else a=0,o=w}else a=0,e=0,o=0}while(0);if(cn(0|P,0,0|s),ln(0|I,0|x,e<<3),Ht(x),!(0|e)&!(0|o)){M=89;break}t=t+(a<<3)|0,r=o,n=e}if(16==(0|M))!0&!(117440512&o)?(o=4,M=27):M=21;else if(31==(0|M))S(27795,27122,620,27132);else{if(41==(0|M))return Ht(I),Ht(P),10;if(48==(0|M))return Ht(I),Ht(P),13;80==(0|M)?S(27795,27122,711,27132):81==(0|M)?S(27795,27122,723,27132):85==(0|M)&&(ln(0|t,0|I,n<<3),M=89)}return 21==(0|M)?(Ht(I),Ht(P),0|(M=5)):27==(0|M)?(Ht(I),Ht(P),0|(M=o)):89==(0|M)?(Ht(I),Ht(P),0|(M=0)):0},_constructCell:function(e,t,n,s){n|=0,s|=0;var o=0,a=0,A=0,l=0,c=0,u=0;if((e|=0)>>>0>15)return 4;if((t|=0)>>>0>121)return 17;A=0|rn(0|e,0,52),o=0|T(),l=0|rn(0|t,0,45),o=0|o|T()|134225919;e:do{if((0|e)>=1){for(l=1,A=!!(0|r[20528+t|0]),a=-1;;){if((t=0|i[n+(l+-1<<2)>>2])>>>0>6){o=18,t=10;break}if(!(!(0|t)|1^A)){if(1==(0|t)){o=19,t=10;break}A=0}if(c=0|rn(7,0,0|(u=3*(15-l|0)|0)),o&=~T(),a=(t=0|rn(0|t,((0|t)<0)<<31>>31,0|u))|a&~c,o=0|T()|o,!((0|l)<(0|e)))break e;l=l+1|0}if(10==(0|t))return 0|o}else a=-1}while(0);return i[(u=s)>>2]=a,i[u+4>>2]=o,0},_destroyLinkedMultiPolygon:ft,_directedEdgeToBoundary:Ce,_directedEdgeToCells:function(e,t,n){e|=0;var r,s,o,a=0;return r=M,M=M+16|0,a=r,!0&268435456==(2013265920&(t|=0))?(s=-2130706433&t|134217728,i[(o=n|=0)>>2]=e,i[o+4>>2]=s,i[a>>2]=0,t=0|nn(0|e,0|t,56),T(),a=0|O(e,s,7&t,a,n+8|0),M=r,0|a):(M=r,0|(a=6))},_edgeLengthKm:function(e,t,n){n|=0;var r,o=0,a=0,A=0,l=0,u=0,f=0,p=0;if(r=M,M=M+176|0,0|(e=0|Ce(e|=0,t|=0,l=r)))return l=e,A=+s[n>>3],A*=6371.007180918475,s[n>>3]=A,M=r,0|l;if(s[n>>3]=0,(0|(e=0|i[l>>2]))<=1)return l=0,A=0,A*=6371.007180918475,s[n>>3]=A,M=r,0|l;t=e+-1|0,e=0,o=+s[l+8>>3],a=+s[l+16>>3],A=0;do{f=o,o=+s[l+8+((e=e+1|0)<<4)>>3],p=+d(.5*(o-f)),u=a,a=+s[l+8+(e<<4)+8>>3],u=p*p+(u=+d(.5*(a-u)))*(+h(+f)*+h(+o)*u),A+=2*+_(+ +c(+u),+ +c(+(1-u)))}while((0|e)!=(0|t));return s[n>>3]=A,l=0,p=A,p*=6371.007180918475,s[n>>3]=p,M=r,0|l},_edgeLengthM:function(e,t,n){n|=0;var r,o=0,a=0,A=0,l=0,u=0,f=0,p=0;if(r=M,M=M+176|0,0|(e=0|Ce(e|=0,t|=0,l=r)))return l=e,A=+s[n>>3],A*=6371.007180918475,A*=1e3,s[n>>3]=A,M=r,0|l;if(s[n>>3]=0,(0|(e=0|i[l>>2]))<=1)return l=0,A=0,A*=6371.007180918475,A*=1e3,s[n>>3]=A,M=r,0|l;t=e+-1|0,e=0,o=+s[l+8>>3],a=+s[l+16>>3],A=0;do{f=o,o=+s[l+8+((e=e+1|0)<<4)>>3],p=+d(.5*(o-f)),u=a,a=+s[l+8+(e<<4)+8>>3],u=p*p+(u=+d(.5*(a-u)))*(+h(+f)*+h(+o)*u),A+=2*+_(+ +c(+u),+ +c(+(1-u)))}while((0|e)!=(0|t));return s[n>>3]=A,l=0,p=A,p*=6371.007180918475,p*=1e3,s[n>>3]=p,M=r,0|l},_edgeLengthRads:function(e,t,n){n|=0;var r,o=0,a=0,A=0,l=0,u=0,f=0,p=0;if(r=M,M=M+176|0,0|(e=0|Ce(e|=0,t|=0,l=r)))return M=r,0|e;if(s[n>>3]=0,(0|(e=0|i[l>>2]))<=1)return M=r,0;t=e+-1|0,e=0,o=+s[l+8>>3],a=+s[l+16>>3],A=0;do{f=o,o=+s[l+8+((e=e+1|0)<<4)>>3],p=+d(.5*(o-f)),u=a,a=+s[l+8+(e<<4)+8>>3],u=p*p+(u=+d(.5*(a-u)))*(+h(+o)*+h(+f)*u),A+=2*+_(+ +c(+u),+ +c(+(1-u)))}while((0|e)<(0|t));return s[n>>3]=A,M=r,0},_emscripten_replace_memory:function(e){return r=new Int8Array(e),i=new Int32Array(e),s=new Float64Array(e),n=e,!0},_free:Ht,_getBaseCellNumber:Ne,_getDirectedEdgeDestination:function(e,t,n){e|=0,t|=0,n|=0;var r,s,o=0;return r=M,M=M+16|0,i[(o=r)>>2]=0,!0&268435456==(2013265920&t)?(s=0|nn(0|e,0|t,56),T(),o=0|O(e,-2130706433&t|134217728,7&s,o,n),M=r,0|o):(M=r,0|(o=6))},_getDirectedEdgeOrigin:function(e,t,n){return e|=0,n|=0,!0&268435456==(2013265920&(t|=0))?(i[n>>2]=e,i[n+4>>2]=-2130706433&t|134217728,0|(n=0)):0|(n=6)},_getHexagonAreaAvgKm2:At,_getHexagonAreaAvgM2:function(e,t){return t|=0,(e|=0)>>>0>15?0|(t=4):(s[t>>3]=+s[20784+(e<<3)>>3],0|(t=0))},_getHexagonEdgeLengthAvgKm:function(e,t){return t|=0,(e|=0)>>>0>15?0|(t=4):(s[t>>3]=+s[20912+(e<<3)>>3],0|(t=0))},_getHexagonEdgeLengthAvgM:function(e,t){return t|=0,(e|=0)>>>0>15?0|(t=4):(s[t>>3]=+s[21040+(e<<3)>>3],0|(t=0))},_getIcosahedronFaces:function e(t,n,r){r|=0;var s,o=0,a=0,A=0,l=0,c=0,u=0,h=0,d=0;s=M,M=M+128|0,h=s+112|0,A=s+96|0,d=s,a=0|nn(0|(t|=0),0|(n|=0),52),T(),c=15&a,i[h>>2]=c,l=0|nn(0|t,0|n,45),T(),l&=127;e:do{if(0|G(l)){if(0|c)for(o=1;;){if(!(!((u=0|rn(7,0,3*(15-o|0)|0))&t)&!((0|T())&n))){a=0;break e}if(!(o>>>0>>0))break;o=o+1|0}if(!(1&a))return u=0|rn(c+1|0,0,52),d=T()|-15728641&n,d=0|e((u|t)&~(h=0|rn(7,0,3*(14-c|0)|0)),d&~T(),r),M=s,0|d;a=1}else a=0}while(0);if(!(o=0|Ke(t,n,A))){a?(Pe(A,h,d),u=5):(Be(A,h,d),u=6);e:do{if(0|G(l))if(c)for(o=1;;){if(!(!((l=0|rn(7,0,3*(15-o|0)|0))&t)&!((0|T())&n))){t=2;break e}if(!(o>>>0>>0)){t=5;break}o=o+1|0}else t=5;else t=2}while(0);cn(0|r,-1,t<<2);e:do{if(a)for(A=0;;){if(Me(l=d+(A<<4)|0,0|i[h>>2]),l=0|i[l>>2],-1==(0|(c=0|i[r>>2]))|(0|c)==(0|l))o=r;else{a=0;do{if((a=a+1|0)>>>0>=t>>>0){o=1;break e}c=0|i[(o=r+(a<<2)|0)>>2]}while(!(-1==(0|c)|(0|c)==(0|l)))}if(i[o>>2]=l,(A=A+1|0)>>>0>=u>>>0){o=0;break}}else for(A=0;;){if(Ie(l=d+(A<<4)|0,0|i[h>>2],0,1),l=0|i[l>>2],-1==(0|(c=0|i[r>>2]))|(0|c)==(0|l))o=r;else{a=0;do{if((a=a+1|0)>>>0>=t>>>0){o=1;break e}c=0|i[(o=r+(a<<2)|0)>>2]}while(!(-1==(0|c)|(0|c)==(0|l)))}if(i[o>>2]=l,(A=A+1|0)>>>0>=u>>>0){o=0;break}}}while(0)}return M=s,0|o},_getIndexDigit:function(e,t,n,r){return r|=0,((n|=0)-1|0)>>>0>14?0|(r=4):(n=0|nn(0|(e|=0),0|(t|=0),3*(15-n|0)|0),T(),i[r>>2]=7&n,0|(r=0))},_getNumCells:lt,_getPentagons:et,_getRes0Cells:function(e){e|=0;var t=0,n=0,r=0;t=0;do{rn(0|t,0,45),r=134225919|T(),i[(n=e+(t<<3)|0)>>2]=-1,i[n+4>>2]=r,t=t+1|0}while(122!=(0|t));return 0},_getResolution:function(e,t){return t=0|nn(0|(e|=0),0|(t|=0),52),T(),15&t},_greatCircleDistanceKm:at,_greatCircleDistanceM:function(e,t){e|=0;var n,r,i,o=0;return r=+s[(t|=0)>>3],n=+s[e>>3],o=(i=+d(.5*(r-n)))*i+(o=+d(.5*(+s[t+8>>3]-+s[e+8>>3])))*(+h(+r)*+h(+n)*o),2*+_(+ +c(+o),+ +c(+(1-o)))*6371.007180918475*1e3},_greatCircleDistanceRads:function(e,t){e|=0;var n,r,i,o=0;return r=+s[(t|=0)>>3],n=+s[e>>3],o=(i=+d(.5*(r-n)))*i+(o=+d(.5*(+s[t+8>>3]-+s[e+8>>3])))*(+h(+r)*+h(+n)*o),2*+_(+ +c(+o),+ +c(+(1-o)))},_gridDisk:L,_gridDiskDistances:B,_gridDistance:function(e,t,n,r,s){n|=0,r|=0,s|=0;var o,a,A=0,l=0;return a=M,M=M+32|0,l=a,0|(o=0|gt(e|=0,t|=0,e,t,A=a+12|0))?(M=a,0|(l=o)):0|(e=0|gt(e,t,n,r,l))?(M=a,0|(l=e)):(A=0|xe(A,l),i[(l=s)>>2]=A,i[l+4>>2]=((0|A)<0)<<31>>31,M=a,0|(l=0))},_gridPathCells:function(e,t,n,r,s){n|=0,r|=0,s|=0;var o,a,A=0,c=0,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0,v=0,y=0,w=0,x=0,E=0,C=0,k=0;if(a=M,M=M+48|0,c=a+12|0,C=a,!(A=0|gt(e|=0,t|=0,e,t,o=a+24|0))&&!(A=0|gt(e,t,n,r,c))){E=((0|(x=0|xe(o,c)))<0)<<31>>31,i[o>>2]=0,i[o+4>>2]=0,i[o+8>>2]=0,i[c>>2]=0,i[c+4>>2]=0,i[c+8>>2]=0,0|gt(e,t,e,t,o)&&S(27795,27538,692,27747),0|gt(e,t,n,r,c)&&S(27795,27538,697,27747),Ee(o),Ee(c),f=0|x?1/+(0|x):0,n=0|i[o>>2],b=f*+((0|i[c>>2])-n|0),r=0|i[(v=o+4|0)>>2],y=f*+((0|i[c+4>>2])-r|0),A=0|i[(w=o+8|0)>>2],f*=+((0|i[c+8>>2])-A|0),i[C>>2]=n,i[(p=C+4|0)>>2]=r,i[(g=C+8|0)>>2]=A;e:do{if((0|x)<0)A=0;else for(m=0,_=0;;){k=b*(h=+(_>>>0)+4294967296*+(0|m))+ +(0|n),u=y*h+ +(0|r),h=f*h+ +(0|A),n=~~+An(+k),c=~~+An(+u),A=~~+An(+h),k=+l(+(+(0|n)-k)),u=+l(+(+(0|c)-u)),h=+l(+(+(0|A)-h));do{if(!(k>u&k>h)){if(d=0-n|0,u>h){r=d-A|0;break}r=c,A=d-c|0;break}n=0-(c+A)|0,r=c}while(0);if(i[C>>2]=n,i[p>>2]=r,i[g>>2]=A,Te(C),0|(A=0|mt(e,t,C,s+(_<<3)|0)))break e;if(!((0|m)<(0|E)|(0|m)==(0|E)&_>>>0>>0)){A=0;break e}n=0|Xt(0|_,0|m,1,0),m=r=0|T(),_=n,n=0|i[o>>2],r=0|i[v>>2],A=0|i[w>>2]}}while(0);return M=a,0|A}return M=a,0|A},_gridPathCellsSize:function(e,t,n,r,s){n|=0,r|=0,s|=0;var o,a=0,A=0,l=0;return o=M,M=M+32|0,l=o,(a=0|gt(e|=0,t|=0,e,t,A=o+12|0))||(a=0|gt(e,t,n,r,l))?(M=o,0|(l=a)):(r=0|Xt(0|(r=0|xe(A,l)),((0|r)<0)<<31>>31,1,0),A=0|T(),i[(l=s)>>2]=r,i[l+4>>2]=A,M=o,0|(l=0))},_gridRing:function(e,t,n,r){return 0|F(e|=0,t|=0,n|=0,r|=0)?(cn(0|r,0,48*n|0),0|(r=0|function(e,t,n,r){e|=0,t|=0,r|=0;var s,o=0,a=0,A=0,l=0,c=0,u=0,h=0,d=0;if(s=M,M=M+16|0,A=s,!(n|=0))return i[r>>2]=e,i[r+4>>2]=t,M=s,0;do{if((0|n)>=0){if((0|n)>13780509){if(0|(o=0|lt(15,A)))break;o=0|i[(a=A)>>2],a=0|i[a+4>>2]}else h=0|Zt(0|n,0|(o=((0|n)<0)<<31>>31),3,0),a=0|T(),o=0|Xt(0|n,0|o,1,0),o=0|Xt(0|(o=0|Zt(0|h,0|a,0|o,0|T())),0|T(),1,0),a=0|T(),i[(h=A)>>2]=o,i[h+4>>2]=a;if(u=0|$t(o,8)){if(!(h=0|$t(o,4))){Ht(u),o=13;break}if(0|(o=0|D(e,t,n,u,h,o,a,0))){Ht(u),Ht(h);break}if(t=0|i[A>>2],(0|(A=0|i[A+4>>2]))>0|!(0|A)&t>>>0>0){o=0,l=0,c=0;do{!(0|(a=0|i[(e=u+(l<<3)|0)>>2]))&!(0|(e=0|i[e+4>>2]))||(0|i[h+(l<<2)>>2])!=(0|n)||(i[(d=r+(o<<3)|0)>>2]=a,i[d+4>>2]=e,o=o+1|0),l=0|Xt(0|l,0|c,1,0),c=0|T()}while((0|c)<(0|A)|(0|c)==(0|A)&l>>>0>>0)}Ht(u),Ht(h),o=0}else o=13}else o=2}while(0);return M=s,0|o}(e,t,n,r))):0|(r=0)},_gridRingUnsafe:F,_i64Add:Xt,_i64Subtract:Qt,_isPentagon:je,_isResClassIII:function(e,t){return t=0|nn(0|(e|=0),0|(t|=0),52),T(),1&t},_isValidCell:De,_isValidDirectedEdge:Se,_isValidIndex:function(e,t){e|=0;var n=0,i=0,s=0,o=0;if(!0&134217728==(-16777216&(t|=0))&&(i=0|nn(0|e,0|t,52),T(),i&=15,n=0|nn(0|e,0|t,45),T(),(n&=127)>>>0<=121)&&!(613566756&(o=0|rn(0|(s=0|nn(0|e,0|t,0|(o=3*(15^i)|0))),0|T(),0|o))&Qt(-1227133514,-1171,0|o,0|(s=0|T())))&!(4681&s&T())&&15==(0|i)|!(0|(o=0|nn(0|rn(0|~e,0|~t,0|(o=19+(3*i|0)|0)),0|T(),0|o)))&!(0|T())){if(!(0|r[20528+n|0]))return 1;if(!(0|e)&!(0|(n=8191&t)))return 1;if(o=0|sn(0|e,0|n),T(),(63-o|0)%3|0)return 1}return 0|Se(e,t)?0|(o=1):0|(o=1&!!(0|Nt(e,t)))},_isValidVertex:Nt,_latLngToCell:Ye,_llvm_ctlz_i64:sn,_llvm_maxnum_f64:on,_llvm_minnum_f64:an,_llvm_round_f64:An,_localIjToCell:function(e,t,n,r,s){var o,a;return e|=0,t|=0,n|=0,s|=0,a=M,M=M+16|0,o=a,(r|=0)?n=15:(n=0|function(e,t){t|=0;var n,r,s,o=0,a=0,A=0;if(a=0|i[(e|=0)>>2],i[t>>2]=a,A=0|i[e+4>>2],i[(r=t+4|0)>>2]=A,i[(s=t+8|0)>>2]=0,e=(o=(0|A)<(0|a))?a:A,(0|(o=o?A:a))<0){if(-2147483648==(0|o)||((0|e)>0?(2147483647-e|0)<(0|o):(-2147483648-e|0)>(0|o)))return 1;if((0|e)>-1?(-2147483648|e)>=(0|o):(-2147483648^e)<(0|o))return 1}return e=A-a|0,(0|a)<0?(o=0-a|0,i[r>>2]=e,i[s>>2]=o,i[t>>2]=0,a=0):(e=A,o=0),(0|e)<0&&(a=a-e|0,i[t>>2]=a,o=o-e|0,i[s>>2]=o,i[r>>2]=0,e=0),n=a-o|0,A=e-o|0,(0|o)<0?(i[t>>2]=n,i[r>>2]=A,i[s>>2]=0,e=A,A=n,o=0):A=a,(0|(a=(0|o)<(0|(a=(0|e)<(0|A)?e:A))?o:a))<=0||(i[t>>2]=A-a,i[r>>2]=e-a,i[s>>2]=o-a),0}(n,o))||(n=0|mt(e,t,o,s)),M=a,0|n},_malloc:Wt,_maxFaceCount:function(e,t,n){n|=0;var r=0,s=0;if(s=0|nn(0|(e|=0),0|(t|=0),45),T(),!(0|G(127&s)))return s=2,i[n>>2]=s,0;if(s=0|nn(0|e,0|t,52),T(),!(s&=15))return s=5,i[n>>2]=s,0;for(r=1;;){if(!(!((0|rn(7,0,3*(15-r|0)|0))&e)&!((0|T())&t))){r=2,e=6;break}if(!(r>>>0>>0)){r=5,e=6;break}r=r+1|0}return 6==(0|e)?(i[n>>2]=r,0):0},_maxGridDiskSize:function(e,t){t|=0;var n=0,r=0,s=0;return(0|(e|=0))<0?0|(t=2):(0|e)>13780509?0|(t=0|lt(15,t)):(s=0|Zt(0|e,0|(n=((0|e)<0)<<31>>31),3,0),r=0|T(),n=0|Xt(0|e,0|n,1,0),n=0|Xt(0|(n=0|Zt(0|s,0|r,0|n,0|T())),0|T(),1,0),e=0|T(),i[t>>2]=n,i[t+4>>2]=e,0|(t=0))},_maxPolygonToCellsSize:function(e,t,n,r){e|=0,t|=0,r|=0;var s,o=0,a=0,A=0,l=0,c=0;if(s=M,M=M+48|0,o=s+16|0,a=s+8|0,A=s,0|(n=0|Et(n|=0)))return M=s,0|n;if(l=0|i[(c=e)+4>>2],i[(n=a)>>2]=i[c>>2],i[n+4>>2]=l,xt(a,o),!(n=0|te(o,t,A))){if(t=0|i[a>>2],(0|(a=0|i[e+8>>2]))>0){o=0|i[e+12>>2],n=0;do{t=(0|i[o+(n<<3)>>2])+t|0,n=n+1|0}while((0|n)<(0|a))}o=0|i[(n=A)>>2],(0|(n=0|i[n+4>>2]))<(0|(a=((0|t)<0)<<31>>31))|(0|n)==(0|a)&o>>>0>>0?(i[(n=A)>>2]=t,i[n+4>>2]=a,n=a):t=o,l=0|Xt(0|t,0|n,12,0),c=0|T(),i[(n=A)>>2]=l,i[n+4>>2]=c,i[(n=r)>>2]=l,i[n+4>>2]=c,n=0}return M=s,0|n},_maxPolygonToCellsSizeExperimental:function(e,t,n,o){t|=0,n|=0,o|=0;var a,A,c=0,u=0,d=0,f=0,p=0,g=0,m=0,_=0;if(A=M,M=M+48|0,p=A+32|0,f=A+40|0,a=A,!(0|i[(e|=0)>>2]))return i[(g=o)>>2]=0,i[g+4>>2]=0,M=A,0;Oe(p,0,0,0),c=0|i[(d=p)>>2],d=0|i[d+4>>2];do{if(t>>>0>15)i[(g=a)>>2]=0,i[g+4>>2]=0,i[a+8>>2]=4,i[a+12>>2]=-1,n=a+29|0,i[(g=a+16|0)>>2]=0,i[g+4>>2]=0,i[g+8>>2]=0,r[g+12|0]=0,r[0|n]=0|r[0|f],r[n+1|0]=0|r[f+1|0],r[n+2|0]=0|r[f+2|0],n=4,g=9;else{if(0|(n=0|Et(n))){i[(p=a)>>2]=0,i[p+4>>2]=0,i[a+8>>2]=n,i[a+12>>2]=-1,g=a+29|0,i[(p=a+16|0)>>2]=0,i[p+4>>2]=0,i[p+8>>2]=0,r[p+12|0]=0,r[0|g]=0|r[0|f],r[g+1|0]=0|r[f+1|0],r[g+2|0]=0|r[f+2|0],g=9;break}if(!(n=0|$t(1+(0|i[e+8>>2])|0,32))){i[(g=a)>>2]=0,i[g+4>>2]=0,i[a+8>>2]=13,i[a+12>>2]=-1,n=a+29|0,i[(g=a+16|0)>>2]=0,i[g+4>>2]=0,i[g+8>>2]=0,r[g+12|0]=0,r[0|n]=0|r[0|f],r[n+1|0]=0|r[f+1|0],r[n+2|0]=0|r[f+2|0],n=13,g=9;break}Tt(e,n),i[(_=a)>>2]=c,i[_+4>>2]=d,i[(d=a+8|0)>>2]=0,i[a+12>>2]=t,i[a+20>>2]=e,i[a+24>>2]=n,r[a+28|0]=0,r[0|(c=a+29|0)]=0|r[0|f],r[c+1|0]=0|r[f+1|0],r[c+2|0]=0|r[f+2|0],i[a+16>>2]=3,m=+q(n),m*=+Q(n),u=+l(+ +s[n>>3]),u=m/+h(+ +an(+u,+ +l(+ +s[n+8>>3])))*6371.007180918475*6371.007180918475,n=0|i[(c=a+12|0)>>2];e:do{if((0|n)>0)do{if(At(n+-1|0,p),!(u/+s[p>>3]>10))break e;n=(_=0|i[c>>2])-1|0,i[c>>2]=n}while((0|_)>1)}while(0);if(vt(a),i[(c=o)>>2]=0,i[c+4>>2]=0,!(!(0|(n=0|i[(c=a)>>2]))&!(0|(c=0|i[c+4>>2]))))do{Ue(n,c,t,p),f=p,f=0|Xt(0|i[(e=o)>>2],0|i[e+4>>2],0|i[f>>2],0|i[f+4>>2]),e=0|T(),i[(_=o)>>2]=f,i[_+4>>2]=e,vt(a),n=0|i[(_=a)>>2],c=0|i[_+4>>2]}while(!(!(0|n)&!(0|c)));n=0|i[d>>2]}}while(0);return M=A,0|n},_memcpy:ln,_memset:cn,_originToDirectedEdges:function(e,t,n){n|=0;var r,s=0;return r=!(0|je(e|=0,t|=0)),t&=-2130706433,i[(s=n)>>2]=r?e:0,i[s+4>>2]=r?285212672|t:0,i[(s=n+8|0)>>2]=e,i[s+4>>2]=301989888|t,i[(s=n+16|0)>>2]=e,i[s+4>>2]=318767104|t,i[(s=n+24|0)>>2]=e,i[s+4>>2]=335544320|t,i[(s=n+32|0)>>2]=e,i[s+4>>2]=352321536|t,i[(n=n+40|0)>>2]=e,i[n+4>>2]=369098752|t,0},_pentagonCount:function(){return 12},_polygonToCells:function(e,t,n,r){e|=0,t|=0,r|=0;var s,o,a,A,l=0,c=0,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0,b=0,v=0,y=0,w=0,x=0,E=0,S=0,C=0,k=0,R=0,P=0,I=0,L=0,B=0,O=0,F=0,U=0;if(A=M,M=M+112|0,s=A+80|0,d=A+72|0,o=A,a=A+56|0,0|(l=0|Et(n|=0)))return M=A,0|l;if(!(U=0|Wt(32+(i[(f=e+8|0)>>2]<<5)|0)))return M=A,13;if(Tt(e,U),!(l=0|Et(n))){if(F=0|i[(O=e)+4>>2],i[(l=d)>>2]=i[O>>2],i[l+4>>2]=F,xt(d,s),l=0|te(s,t,o))O=0,F=0;else{if(l=0|i[d>>2],(0|(c=0|i[f>>2]))>0){u=0|i[e+12>>2],n=0;do{l=(0|i[u+(n<<3)>>2])+l|0,n=n+1|0}while((0|n)!=(0|c));n=l}else n=l;c=0|i[(l=o)>>2],(0|(l=0|i[l+4>>2]))<(0|(u=((0|n)<0)<<31>>31))|(0|l)==(0|u)&c>>>0>>0?(i[(l=o)>>2]=n,i[l+4>>2]=u,l=u):n=c,O=0|Xt(0|n,0|l,12,0),F=0|T(),i[(l=o)>>2]=O,i[l+4>>2]=F,l=0}if(!l){if(!(n=0|$t(O,8)))return Ht(U),M=A,13;if(!(h=0|$t(O,8)))return Ht(U),Ht(n),M=A,13;i[(L=s)>>2]=0,i[L+4>>2]=0,B=0|i[(L=e)+4>>2],i[(l=d)>>2]=i[L>>2],i[l+4>>2]=B,l=0|j(d,O,F,t,s,n,h);e:do{if(l)Ht(n),Ht(h),Ht(U);else{t:do{if((0|i[f>>2])>0){for(u=e+12|0,c=0;l=0|j((0|i[u>>2])+(c<<3)|0,O,F,t,s,n,h),c=c+1|0,!(0|l);)if((0|c)>=(0|i[f>>2]))break t;Ht(n),Ht(h),Ht(U);break e}}while(0);(0|F)>0|!(0|F)&O>>>0>0&&cn(0|h,0,O<<3),L=0|i[(B=s)+4>>2];t:do{if((0|L)>0|!(0|L)&(0|i[B>>2])>>>0>0){R=n,P=h,I=n,L=h,B=n,l=n,S=n,C=h,k=h,n=h;n:for(;;){for(y=0,w=0,x=0,E=0,c=0,u=0;;){d=(h=o)+56|0;do{i[h>>2]=0,h=h+4|0}while((0|h)<(0|d));if(0|N(f=0|i[(t=R+(y<<3)|0)>>2],t=0|i[t+4>>2],1,o,0)){d=(h=o)+56|0;do{i[h>>2]=0,h=h+4|0}while((0|h)<(0|d));0|(h=0|$t(7,4))&&(D(f,t,1,o,h,7,0,0),Ht(h))}for(v=0;;){_=0|i[(b=o+(v<<3)|0)>>2],b=0|i[b+4>>2];r:do{if(!(0|_)&!(0|b))h=c,d=u;else{if(p=0|en(0|_,0|b,0|O,0|F),f=0|T(),!(!(0|(d=0|i[(t=h=r+(p<<3)|0)>>2]))&!(0|(t=0|i[t+4>>2])))){g=0,m=0;do{if((0|g)>(0|F)|(0|g)==(0|F)&m>>>0>O>>>0)break n;if((0|d)==(0|_)&(0|t)==(0|b)){h=c,d=u;break r}p=0|Jt(0|(h=0|Xt(0|p,0|f,1,0)),0|T(),0|O,0|F),f=0|T(),m=0|Xt(0|m,0|g,1,0),g=0|T(),d=0|i[(t=h=r+(p<<3)|0)>>2],t=0|i[t+4>>2]}while(!(!(0|d)&!(0|t)))}if(!(0|_)&!(0|b)){h=c,d=u;break}Ze(_,b,a),0|St(e,U,a)&&(m=0|Xt(0|c,0|u,1,0),u=0|T(),i[(g=h)>>2]=_,i[g+4>>2]=b,i[(c=P+(c<<3)|0)>>2]=_,i[c+4>>2]=b,c=m),h=c,d=u}}while(0);if((v=v+1|0)>>>0>=7)break;c=h,u=d}if(y=0|Xt(0|y,0|w,1,0),w=0|T(),x=0|Xt(0|x,0|E,1,0),E=0|T(),c=0|i[(u=s)>>2],!((0|E)<(0|(u=0|i[u+4>>2]))|(0|E)==(0|u)&x>>>0>>0))break;c=h,u=d}if((0|u)>0|!(0|u)&c>>>0>0){c=0,u=0;do{i[(E=R+(c<<3)|0)>>2]=0,i[E+4>>2]=0,c=0|Xt(0|c,0|u,1,0),u=0|T(),x=0|i[(E=s)+4>>2]}while((0|u)<(0|x)|((0|u)==(0|x)?c>>>0<(0|i[E>>2])>>>0:0))}if(i[(E=s)>>2]=h,i[E+4>>2]=d,!((0|d)>0|!(0|d)&h>>>0>0))break t;v=n,y=k,w=B,x=C,E=P,n=S,k=l,C=I,S=v,l=y,B=L,L=w,I=x,P=R,R=E}Ht(I),Ht(L),Ht(U),l=1;break e}l=h}while(0);Ht(U),Ht(n),Ht(l),l=0}}while(0);return M=A,0|l}}return Ht(U),M=A,0|l},_polygonToCellsExperimental:function(e,t,n,s,o,a){s|=0,o|=0,a|=0;var A,l,c,u=0,h=0,d=0,f=0,p=0,g=0,m=0,_=0;c=M,M=M+160|0,h=c+64|0,p=c+112|0,_=c,function(e,t,n,s){e|=0,t|=0,n|=0,s|=0;var o,a,A,l=0,c=0,u=0,h=0;A=M,M=M+48|0,o=A+40|0,a=A,Oe(c=A+32|0,0,0,0),u=0|i[c>>2],c=0|i[c+4>>2];do{if(n>>>0<=15){if(0|(l=0|Et(s))){i[(s=a)>>2]=0,i[s+4>>2]=0,i[a+8>>2]=l,i[a+12>>2]=-1,u=a+29|0,i[(s=a+16|0)>>2]=0,i[s+4>>2]=0,i[s+8>>2]=0,r[s+12|0]=0,r[0|u]=0|r[0|o],r[u+1|0]=0|r[o+1|0],r[u+2|0]=0|r[o+2|0];break}if(l=0|$t(1+(0|i[t+8>>2])|0,32)){Tt(t,l),i[(h=a)>>2]=u,i[h+4>>2]=c,i[a+8>>2]=0,i[a+12>>2]=n,i[a+16>>2]=s,i[a+20>>2]=t,i[a+24>>2]=l,r[a+28|0]=0,r[0|(u=a+29|0)]=0|r[0|o],r[u+1|0]=0|r[o+1|0],r[u+2|0]=0|r[o+2|0];break}i[(s=a)>>2]=0,i[s+4>>2]=0,i[a+8>>2]=13,i[a+12>>2]=-1,u=a+29|0,i[(s=a+16|0)>>2]=0,i[s+4>>2]=0,i[s+8>>2]=0,r[s+12|0]=0,r[0|u]=0|r[0|o],r[u+1|0]=0|r[o+1|0],r[u+2|0]=0|r[o+2|0];break}i[(u=a)>>2]=0,i[u+4>>2]=0,i[a+8>>2]=4,i[a+12>>2]=-1,h=a+29|0,i[(u=a+16|0)>>2]=0,i[u+4>>2]=0,i[u+8>>2]=0,r[u+12|0]=0,r[0|h]=0|r[0|o],r[h+1|0]=0|r[o+1|0],r[h+2|0]=0|r[o+2|0]}while(0);vt(a),i[e>>2]=i[a>>2],i[e+4>>2]=i[a+4>>2],i[e+8>>2]=i[a+8>>2],i[e+12>>2]=i[a+12>>2],i[e+16>>2]=i[a+16>>2],i[e+20>>2]=i[a+20>>2],i[e+24>>2]=i[a+24>>2],i[e+28>>2]=i[a+28>>2],M=A}(f=c+80|0,e|=0,t|=0,n|=0),tt(h,0|i[(d=f)>>2],0|i[d+4>>2],t),A=0|i[(d=h)>>2],d=0|i[d+4>>2],u=0|i[f+8>>2],i[(g=p+4|0)>>2]=i[f>>2],i[g+4>>2]=i[f+4>>2],i[g+8>>2]=i[f+8>>2],i[g+12>>2]=i[f+12>>2],i[g+16>>2]=i[f+16>>2],i[g+20>>2]=i[f+20>>2],i[g+24>>2]=i[f+24>>2],i[g+28>>2]=i[f+28>>2],i[(g=_)>>2]=A,i[g+4>>2]=d,i[(g=_+8|0)>>2]=u,t=p,n=36+(e=_+12|0)|0;do{i[e>>2]=i[t>>2],e=e+4|0,t=t+4|0}while((0|e)<(0|n));if(i[(p=_+48|0)>>2]=i[h>>2],i[p+4>>2]=i[h+4>>2],i[p+8>>2]=i[h+8>>2],i[p+12>>2]=i[h+12>>2],!(0|A)&!(0|d))return M=c,0|u;n=_+16|0,l=_+24|0,f=_+28|0,u=0,h=0,t=A,e=d;do{if(!((0|u)<(0|o)|(0|u)==(0|o)&h>>>0>>0)){m=4;break}if(d=h,h=0|Xt(0|h,0|u,1,0),u=0|T(),i[(d=a+(d<<3)|0)>>2]=t,i[d+4>>2]=e,rt(p),!(0|(t=0|i[(e=p)>>2]))&!(0|(e=0|i[e+4>>2]))){if(vt(n),!(0|(e=0|i[(t=n)>>2]))&!(0|(t=0|i[t+4>>2]))){m=10;break}nt(e,t,0|i[f>>2],p),t=0|i[(e=p)>>2],e=0|i[e+4>>2]}i[(d=_)>>2]=t,i[d+4>>2]=e}while(!(!(0|t)&!(0|e)));return 4==(0|m)?(0|(t=0|i[(e=_+40|0)>>2])&&Ht(t),i[(m=_+16|0)>>2]=0,i[m+4>>2]=0,i[l>>2]=0,i[_+36>>2]=0,i[f>>2]=-1,i[_+32>>2]=0,i[e>>2]=0,nt(0,0,0,p),i[_>>2]=0,i[_+4>>2]=0,i[g>>2]=0,M=c,0|(_=14)):(10==(0|m)&&(i[_>>2]=0,i[_+4>>2]=0,i[g>>2]=i[l>>2]),_=0|i[g>>2],M=c,0|_)},_readInt64AsDoubleFromPointer:function(e){return+(+((0|i[(e|=0)>>2])>>>0)+4294967296*+(0|i[e+4>>2]))},_res0CellCount:function(){return 122},_round:un,_sbrk:hn,_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(e,t,n,r,s,o,a){e|=0,r|=0,s|=0,o|=0;var A,l=0,c=0,u=0,h=0,d=0,f=0,p=0,g=0;if(A=M,M=M+16|0,g=A,!((0|(n|=0))>0|!(0|n)&(t|=0)>>>0>0))return M=A,0;if((0|(a|=0))>=16)return M=A,12;f=0,p=0,d=0,l=0;e:for(;;){if(h=0|nn(0|(c=0|i[(u=e+(f<<3)|0)>>2]),0|(u=0|i[u+4>>2]),52),T(),(15&h)>(0|a)){l=12,c=11;break}if(tt(g,c,u,a),!(0|(u=0|i[(h=g)>>2]))&!(0|(h=0|i[h+4>>2])))c=d;else{c=d;do{if(!((0|l)<(0|o)|(0|l)==(0|o)&c>>>0>>0)){c=10;break e}i[(d=r+(c<<3)|0)>>2]=u,i[d+4>>2]=h,c=0|Xt(0|c,0|l,1,0),l=0|T(),rt(g),u=0|i[(d=g)>>2],h=0|i[d+4>>2]}while(!(!(0|u)&!(0|h)))}if(f=0|Xt(0|f,0|p,1,0),!((0|(p=0|T()))<(0|n)|(0|p)==(0|n)&f>>>0>>0)){l=0,c=11;break}d=c}return 10==(0|c)?(M=A,0|(g=14)):11==(0|c)?(M=A,0|l):0},_uncompactCellsSize:function(e,t,n,r,s){e|=0,t|=0,n|=0,r|=0,s|=0;var o,a,A=0,l=0,c=0,u=0,h=0,d=0;a=M,M=M+16|0,o=a;e:do{if((0|n)>0|!(0|n)&t>>>0>0){for(h=0,l=0,A=0,d=0;;){if(!(!(0|(c=0|i[(u=e+(h<<3)|0)>>2]))&!(0|(u=0|i[u+4>>2]))||(u=!(0|Ue(c,u,r,o)),l=0|Xt(0|i[(c=o)>>2],0|i[c+4>>2],0|l,0|A),A=0|T(),u))){A=12;break}if(h=0|Xt(0|h,0|d,1,0),!((0|(d=0|T()))<(0|n)|(0|d)==(0|n)&h>>>0>>0))break e}return M=a,0|A}l=0,A=0}while(0);return i[s>>2]=l,i[s+4>>2]=A,M=a,0},_vertexToLatLng:function(e,t,n){n|=0;var r,s,o,a,A=0,l=0;return a=M,M=M+192|0,s=a,o=a+168|0,A=0|nn(0|(e|=0),0|(t|=0),56),T(),A&=7,0|(r=0|Ke(e,l=-2130706433&t|134217728,o))?(M=a,0|(l=r)):(t=0|nn(0|e,0|t,52),T(),t&=15,0|je(e,l)?Re(o,t,A,1,s):Le(o,t,A,1,s),l=s+8|0,i[n>>2]=i[l>>2],i[n+4>>2]=i[l+4>>2],i[n+8>>2]=i[l+8>>2],i[n+12>>2]=i[l+12>>2],M=a,0|(l=0))},establishStackSpace:function(e,t){M=e|=0},stackAlloc:function(e){var t;return t=M,M=15+(M=M+(e|=0)|0)&-16,0|t},stackRestore:function(e){M=e|=0},stackSave:function(){return 0|M}}}({Math:Math,Int8Array:Int8Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Float32Array:Float32Array,Float64Array:Float64Array},{b:function(e){A=e},c:function(){return A},d:function(e,t,n,r){ne("Assertion failed: "+b(e)+", at: "+[t?b(t):"unknown filename",n,r?b(r):"unknown function"])},e:function(e){return n.___errno_location&&(p[n.___errno_location()>>2]=e),e},f:G,g:function(e,t,n){d.set(d.subarray(t,t+n),e)},h:function(e){var t=G(),n=16777216,r=2130706432;if(e>r)return!1;for(var i=Math.max(t,16777216);i0))return 0;for(var i=n+r-1,s=0;s=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++s)),o<=127){if(n>=i)break;t[n++]=o}else if(o<=2047){if(n+1>=i)break;t[n++]=192|o>>6,t[n++]=128|63&o}else if(o<=65535){if(n+2>=i)break;t[n++]=224|o>>12,t[n++]=128|o>>6&63,t[n++]=128|63&o}else{if(n+3>=i)break;t[n++]=240|o>>18,t[n++]=128|o>>12&63,t[n++]=128|o>>6&63,t[n++]=128|63&o}}t[n]=0}(e,d,t,n)}(e,t=Q(n),n)}return t},array:function(e){var t,n,r=Q(e.length);return t=e,n=r,h.set(t,n),r}},s=c(e),o=[],a=0;if(r)for(var A=0;A>1]=t;break;case"i32":p[e>>2]=t;break;case"i64":O=[t>>>0,(D=t,+P(D)>=1?D>0?(0|L(+M(D/4294967296),4294967295))>>>0:~~+I((D-+(~~D>>>0))/4294967296)>>>0:0)],p[e>>2]=O[0],p[e+4>>2]=O[1];break;case"float":g[e>>2]=t;break;case"double":m[e>>3]=t;break;default:ne("invalid type for setValue: "+n)}},n.getValue=function(e,t,n){switch("*"===(t=t||"i8").charAt(t.length-1)&&(t="i32"),t){case"i1":case"i8":return h[0|e];case"i16":return f[e>>1];case"i32":case"i64":return p[e>>2];case"float":return g[e>>2];case"double":return m[e>>3];default:ne("invalid type for getValue: "+t)}return null},F){j(F)||($=F,F=n.locateFile?n.locateFile($,s):s+$),B++,n.monitorRunDependencies&&n.monitorRunDependencies(B);var K=function(e){e.byteLength&&(e=new Uint8Array(e)),d.set(e,8),n.memoryInitializerRequest&&delete n.memoryInitializerRequest.response,function(){if(B--,n.monitorRunDependencies&&n.monitorRunDependencies(B),0==B&&N){var e=N;N=null,e()}}()},Z=function(){i(F,K,function(){throw"could not load memory initializer "+F})},J=V(F);if(J)K(J.buffer);else if(n.memoryInitializerRequest){var ee=function(){var e=n.memoryInitializerRequest,t=e.response;if(200!==e.status&&0!==e.status){var r=V(n.memoryInitializerRequestURL);if(!r)return void Z();t=r.buffer}K(t)};n.memoryInitializerRequest.response?setTimeout(ee,0):n.memoryInitializerRequest.addEventListener("load",ee)}else Z()}function te(e){function t(){X||(X=!0,l||(x(T),x(S),n.onRuntimeInitialized&&n.onRuntimeInitialized(),function(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)R(n.postRun.shift());x(C)}()))}B>0||(function(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)k(n.preRun.shift());x(E)}(),B>0||(n.setStatus?(n.setStatus("Running..."),setTimeout(function(){setTimeout(function(){n.setStatus("")},1),t()},1)):t()))}function ne(e){throw n.onAbort&&n.onAbort(e),o(e+=""),a(e),l=!0,"abort("+e+"). Build with -s ASSERTIONS=1 for more info."}if(N=function e(){X||te(),X||(N=e)},n.run=te,n.abort=ne,n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return te(),e}("object"==typeof Se?Se:{}),Ce="number",ke={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"},Re={1e3:"Unknown unit",1001:"Array length out of bounds",1002:"Got unexpected null value for H3 index"};function Pe(e,t,n){var r=n&&"value"in n,i=new Error((e[t]||"Unknown error")+" (code: "+t+(r?", value: "+n.value:"")+")");return i.code=t,i}function Ie(e){if(0!==e)throw function(e,t){return Pe(ke,e,2===arguments.length?{value:t}:{})}(e)}var Me={};[["sizeOfH3Index",Ce],["sizeOfLatLng",Ce],["sizeOfCellBoundary",Ce],["sizeOfGeoLoop",Ce],["sizeOfGeoPolygon",Ce],["sizeOfLinkedGeoPolygon",Ce],["sizeOfCoordIJ",Ce],["readInt64AsDoubleFromPointer",Ce],["isValidCell",Ce,[Ce,Ce]],["isValidIndex",Ce,[Ce,Ce]],["latLngToCell",Ce,[Ce,Ce,Ce,Ce]],["cellToLatLng",Ce,[Ce,Ce,Ce]],["cellToBoundary",Ce,[Ce,Ce,Ce]],["maxGridDiskSize",Ce,[Ce,Ce]],["gridDisk",Ce,[Ce,Ce,Ce,Ce]],["gridDiskDistances",Ce,[Ce,Ce,Ce,Ce,Ce]],["gridRing",Ce,[Ce,Ce,Ce,Ce]],["gridRingUnsafe",Ce,[Ce,Ce,Ce,Ce]],["maxPolygonToCellsSize",Ce,[Ce,Ce,Ce,Ce]],["polygonToCells",Ce,[Ce,Ce,Ce,Ce]],["maxPolygonToCellsSizeExperimental",Ce,[Ce,Ce,Ce,Ce]],["polygonToCellsExperimental",Ce,[Ce,Ce,Ce,Ce,Ce,Ce]],["cellsToLinkedMultiPolygon",Ce,[Ce,Ce,Ce]],["destroyLinkedMultiPolygon",null,[Ce]],["compactCells",Ce,[Ce,Ce,Ce,Ce]],["uncompactCells",Ce,[Ce,Ce,Ce,Ce,Ce,Ce]],["uncompactCellsSize",Ce,[Ce,Ce,Ce,Ce,Ce]],["isPentagon",Ce,[Ce,Ce]],["isResClassIII",Ce,[Ce,Ce]],["getBaseCellNumber",Ce,[Ce,Ce]],["getResolution",Ce,[Ce,Ce]],["getIndexDigit",Ce,[Ce,Ce,Ce]],["constructCell",Ce,[Ce,Ce,Ce,Ce]],["maxFaceCount",Ce,[Ce,Ce,Ce]],["getIcosahedronFaces",Ce,[Ce,Ce,Ce]],["cellToParent",Ce,[Ce,Ce,Ce,Ce]],["cellToChildren",Ce,[Ce,Ce,Ce,Ce]],["cellToCenterChild",Ce,[Ce,Ce,Ce,Ce]],["cellToChildrenSize",Ce,[Ce,Ce,Ce,Ce]],["cellToChildPos",Ce,[Ce,Ce,Ce,Ce]],["childPosToCell",Ce,[Ce,Ce,Ce,Ce,Ce,Ce]],["areNeighborCells",Ce,[Ce,Ce,Ce,Ce,Ce]],["cellsToDirectedEdge",Ce,[Ce,Ce,Ce,Ce,Ce]],["getDirectedEdgeOrigin",Ce,[Ce,Ce,Ce]],["getDirectedEdgeDestination",Ce,[Ce,Ce,Ce]],["isValidDirectedEdge",Ce,[Ce,Ce]],["directedEdgeToCells",Ce,[Ce,Ce,Ce]],["originToDirectedEdges",Ce,[Ce,Ce,Ce]],["directedEdgeToBoundary",Ce,[Ce,Ce,Ce]],["gridDistance",Ce,[Ce,Ce,Ce,Ce,Ce]],["gridPathCells",Ce,[Ce,Ce,Ce,Ce,Ce]],["gridPathCellsSize",Ce,[Ce,Ce,Ce,Ce,Ce]],["cellToLocalIj",Ce,[Ce,Ce,Ce,Ce,Ce,Ce]],["localIjToCell",Ce,[Ce,Ce,Ce,Ce,Ce]],["getHexagonAreaAvgM2",Ce,[Ce,Ce]],["getHexagonAreaAvgKm2",Ce,[Ce,Ce]],["getHexagonEdgeLengthAvgM",Ce,[Ce,Ce]],["getHexagonEdgeLengthAvgKm",Ce,[Ce,Ce]],["greatCircleDistanceM",Ce,[Ce,Ce]],["greatCircleDistanceKm",Ce,[Ce,Ce]],["greatCircleDistanceRads",Ce,[Ce,Ce]],["cellAreaM2",Ce,[Ce,Ce,Ce]],["cellAreaKm2",Ce,[Ce,Ce,Ce]],["cellAreaRads2",Ce,[Ce,Ce,Ce]],["edgeLengthM",Ce,[Ce,Ce,Ce]],["edgeLengthKm",Ce,[Ce,Ce,Ce]],["edgeLengthRads",Ce,[Ce,Ce,Ce]],["getNumCells",Ce,[Ce,Ce]],["getRes0Cells",Ce,[Ce]],["res0CellCount",Ce],["getPentagons",Ce,[Ce,Ce]],["pentagonCount",Ce],["cellToVertex",Ce,[Ce,Ce,Ce,Ce]],["cellToVertexes",Ce,[Ce,Ce,Ce]],["vertexToLatLng",Ce,[Ce,Ce,Ce]],["isValidVertex",Ce,[Ce,Ce]]].forEach(function(e){Me[e[0]]=Se.cwrap.apply(Se,e)});var Le=16,Be=Me.sizeOfH3Index(),Ne=Me.sizeOfLatLng(),De=Me.sizeOfCellBoundary();Me.sizeOfGeoPolygon(),Me.sizeOfGeoLoop(),Me.sizeOfLinkedGeoPolygon(),Me.sizeOfCoordIJ();var Oe=/[^0-9a-fA-F]/;function Fe(e){if(e>=0)return e.toString(Le);var t=Ue(8,(e&=2147483647).toString(Le));return(parseInt(t[0],Le)+8).toString(Le)+t.substring(1)}function Ue(e,t){for(var n=e-t.length,r="",i=0;i.85?.9+(o-.85)/.15*.1:.1+(o-.15)/.7*.8;var o;return Ye(r[Math.min(23,Math.floor(24*s))],Xe,.7)}function Ke({coveragePoints:e,visible:t,terrainEnabled:n=!1}){const{current:r}=b(),[i,o]=p.useState(null),[a,A]=p.useState(!1),l=p.useRef({aborted:!1}),c=p.useRef(0),u=function(e){const[t,n]=p.useState(e);return p.useEffect(()=>{const t=setTimeout(()=>n(e),300);return()=>clearTimeout(t)},[e,300]),t}(e),h=p.useMemo(()=>function(){var e;const t=O();return 24===t.length&&0!==(null==(e=t[0])?void 0:e[0])?t:Qe}(),[]);p.useEffect(()=>{if(!u||!Array.isArray(u)||0===u.length)return o(null),void(c.current=0);if(u.length===c.current&&i)return;c.current=u.length,l.current.aborted=!0,l.current={aborted:!1};const e=l.current;A(!0);const{cells:t,minQuality:n,maxQuality:r}=function(e){const t=new Map;for(const s of e){if("number"!=typeof s.lat||"number"!=typeof s.lon||isNaN(s.lat)||isNaN(s.lon))continue;const e=ze(s.lat,s.lon,8),n=t.get(e),r=s.weight;n?(n.count++,n.qualitySum+=r):t.set(e,{count:1,qualitySum:r})}const n=[];let r=1/0,i=-1/0;for(const[s,o]of t.entries()){const e=o.qualitySum/o.count;n.push({hexId:s,count:o.count,avgQuality:e}),r=Math.min(r,e),i=Math.max(i,e)}return{cells:n,minQuality:n.length>0?r:0,maxQuality:n.length>0?i:0}}(u);if(0===t.length)return o(null),void A(!1);if(t.length<500){const i=function(e,t,n,r){const i=[];for(const s of e){const e=Ve(s.hexId).map(([e,t])=>[t,e]);e.push(e[0]);const o=qe(s.avgQuality,t,n,r);i.push({type:"Feature",properties:{color:o,quality:s.avgQuality,count:s.count},geometry:{type:"Polygon",coordinates:[e]}})}return{type:"FeatureCollection",features:i}}(t,n,r,h);return void(e.aborted||(o(i),A(!1)))}return async function(e,t,n,r,i){const s=[];let o=0;for(;o[t,e]);a.push(a[0]);const A=qe(i.avgQuality,t,n,r);s.push({type:"Feature",properties:{color:A,quality:i.avgQuality,count:i.count},geometry:{type:"Polygon",coordinates:[a]}})}orequestAnimationFrame(e))}return{type:"FeatureCollection",features:s}}(t,n,r,h,e).then(t=>{!e.aborted&&t&&o(t)}).finally(()=>{e.aborted||A(!1)}),()=>{e.aborted=!0}},[u,h]),p.useEffect(()=>{var e;const n=null==(e=null==r?void 0:r.getMap)?void 0:e.call(r);if(!n)return;const s=()=>{var e,r;try{const s=n.getLayer($e),o=n.getSource(He);if(t&&i&&i.features.length>0){if(o?n.getSource(He).setData(i):n.addSource(He,{type:"geojson",data:i}),!s){const t=null==(r=null==(e=n.getStyle())?void 0:e.layers)?void 0:r.find(e=>"symbol"===e.type);n.addLayer({id:$e,type:"fill",source:He,paint:{"fill-color":["get","color"],"fill-opacity":1}},null==t?void 0:t.id)}}else s&&n.removeLayer($e),o&&n.removeSource(He)}catch(s){}};n.isStyleLoaded()?s():n.once("style.load",s)},[r,t,i,n]),p.useEffect(()=>()=>{var e;const t=null==(e=null==r?void 0:r.getMap)?void 0:e.call(r);if(t)try{t.getLayer($e)&&t.removeLayer($e),t.getSource(He)&&t.removeSource(He)}catch{}},[r]);const d=(null==i?void 0:i.features.length)??0;return d>0&&t?s.jsx("div",{"data-testid":"wardriving-hexlayer-maplibre-active","data-point-count":(null==e?void 0:e.length)||0,"data-cell-count":d,"data-terrain-enabled":n,"data-is-processing":a,style:{display:"none"}}):null}const Ze="terrain-dem",Je="terrain-hillshade";function et({enabled:e,exaggeration:t=2}){const{current:n}=b();return p.useEffect(()=>{var r;const i=null==(r=null==n?void 0:n.getMap)?void 0:r.call(n);if(!i)return;const s=()=>{var n,r;try{if(i.getSource(Ze)||i.addSource(Ze,{type:"raster-dem",tiles:["https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png"],encoding:"terrarium",tileSize:256,maxzoom:10}),e){if(i.setCenterClampedToGround(!1),i.setTerrain({source:Ze,exaggeration:t}),!i.getLayer(Je)){const e=null==(r=null==(n=i.getStyle())?void 0:n.layers)?void 0:r.find(e=>"symbol"===e.type);i.addLayer({id:Je,type:"hillshade",source:Ze,paint:{"hillshade-shadow-color":"rgba(10, 10, 10, 0.5)","hillshade-highlight-color":"rgba(200, 195, 185, 0.4)","hillshade-accent-color":"rgba(80, 65, 55, 0.35)","hillshade-illumination-direction":315,"hillshade-exaggeration":.25}},null==e?void 0:e.id)}i.setMaxPitch(70),i.getPitch()<30&&!i.isMoving()&&setTimeout(()=>{!i.isMoving()&&i.getPitch()<30&&i.easeTo({pitch:45,duration:1e3})},200)}else i.setTerrain(null),i.setCenterClampedToGround(!0),i.getLayer(Je)&&i.removeLayer(Je),i.getPitch()>0&&!i.isMoving()&&i.easeTo({pitch:0,duration:800}),i.setMaxPitch(60)}catch(s){}};return i.isStyleLoaded()?s():i.once("style.load",s),()=>{var e;try{const t=null==(e=null==n?void 0:n.getMap)?void 0:e.call(n);if(!t)return;t.isStyleLoaded()&&(t.setTerrain(null),t.getLayer(Je)&&t.removeLayer(Je))}catch{}}},[n,e,t]),null}function tt(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function nt(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}var rt,it={},st={};var ot,at,At={};var lt,ct,ut=(at||(at=1,lt=function(){if(rt)return st;rt=1;var e=_();function t(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n