From 6b0b26c2876e0a9b86468c32e4b806accf9a1342 Mon Sep 17 00:00:00 2001 From: Erik Date: Mon, 13 Apr 2026 13:30:04 +0200 Subject: [PATCH] =?UTF-8?q?fix(v2):=20version=20display=20=E2=80=94=20corr?= =?UTF-8?q?ect=20URL=20path=20(/api/api-version)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit apiFetch adds /api prefix, so /api-version became /api/api-version which was wrong. Use raw fetch with correct path. Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/src/components/map/MapLayout.tsx | 3 ++- ...boardView-BA1NW731.js => DashboardView-CXnQ-RQq.js} | 2 +- .../v2/assets/{index-Cl1VRDup.js => index-enmZs0AR.js} | 10 +++++----- static/v2/index.html | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) rename static/v2/assets/{DashboardView-BA1NW731.js => DashboardView-CXnQ-RQq.js} (99%) rename static/v2/assets/{index-Cl1VRDup.js => index-enmZs0AR.js} (93%) diff --git a/frontend/src/components/map/MapLayout.tsx b/frontend/src/components/map/MapLayout.tsx index 6ff1983e..33da7d61 100644 --- a/frontend/src/components/map/MapLayout.tsx +++ b/frontend/src/components/map/MapLayout.tsx @@ -29,7 +29,8 @@ export const MapLayout: React.FC = ({ data, onViewToggle }) => { const [version, setVersion] = useState(''); useEffect(() => { - apiFetch<{ version: string }>('/api-version').then(d => setVersion(d.version ?? '')).catch(() => {}); + // /api-version is the actual route — apiFetch adds /api prefix, so use raw fetch + fetch('/api/api-version', { credentials: 'include' }).then(r => r.json()).then(d => setVersion(d.version ?? '')).catch(() => {}); }, []); const handleSelectPlayer = useCallback((name: string) => { diff --git a/static/v2/assets/DashboardView-BA1NW731.js b/static/v2/assets/DashboardView-CXnQ-RQq.js similarity index 99% rename from static/v2/assets/DashboardView-BA1NW731.js rename to static/v2/assets/DashboardView-CXnQ-RQq.js index 88ac1b06..99525437 100644 --- a/static/v2/assets/DashboardView-BA1NW731.js +++ b/static/v2/assets/DashboardView-CXnQ-RQq.js @@ -1,4 +1,4 @@ -import{j,R as A,r as N,c as hi,g as ue,a as eO}from"./index-Cl1VRDup.js";const tO=({children:e})=>j.jsxs("div",{className:"dashboard",children:[j.jsxs("header",{className:"dashboard-header",children:[j.jsx("h1",{className:"dashboard-title",children:"Mosswart Overlord"}),j.jsxs("nav",{className:"dashboard-nav",children:[j.jsx("a",{href:"/",className:"nav-link",children:"Classic View"}),j.jsx("a",{href:"/inventory.html",className:"nav-link",children:"Inventory"}),j.jsx("a",{href:"/suitbuilder.html",className:"nav-link",children:"Suitbuilder"})]})]}),j.jsx("main",{className:"dashboard-main",children:e})]}),rO=({activeChars:e,totalKills:t,totalRares:r,serverHealth:n})=>{var o;const i=((o=n==null?void 0:n.status)==null?void 0:o.toLowerCase())??"unknown",a=i==="online"||i==="up";return j.jsxs("div",{className:"global-stats",children:[j.jsxs("div",{className:"global-stat",children:[j.jsx("span",{className:"global-value",children:e}),j.jsx("span",{className:"global-label",children:"Active Characters"})]}),j.jsxs("div",{className:"global-stat",children:[j.jsx("span",{className:"global-value",children:t.toLocaleString()}),j.jsx("span",{className:"global-label",children:"Total Kills"})]}),j.jsxs("div",{className:"global-stat",children:[j.jsx("span",{className:"global-value",children:r}),j.jsx("span",{className:"global-label",children:"Total Rares"})]}),j.jsxs("div",{className:"global-stat",children:[j.jsx("span",{className:`server-dot ${a?"online":"offline"}`}),j.jsxs("span",{className:"global-value",children:[(n==null?void 0:n.latency_ms)??"--","ms"]}),j.jsx("span",{className:"global-label",children:"Coldeve"})]})]})},Pi=A.memo(({label:e,current:t,max:r,color:n,bgColor:i})=>{const a=r>0?Math.min(100,Math.max(0,t/r*100)):0;return j.jsxs("div",{className:"vital-bar",children:[j.jsx("span",{className:"vital-label",children:e}),j.jsx("div",{className:"vital-track",style:{backgroundColor:i},children:j.jsx("div",{className:"vital-fill",style:{width:`${a}%`,background:n}})}),j.jsxs("span",{className:"vital-text",children:[t,"/",r]})]})});Pi.displayName="VitalBar";const nO=e=>{const t=(e||"idle").toLowerCase();return t==="combat"||t==="hunt"?{label:t==="combat"?"Combat":"Hunt",cls:"badge-combat"}:t==="nav"||t==="navigation"?{label:"Nav",cls:"badge-nav"}:t==="default"||t==="idle"||t===""?{label:"Idle",cls:"badge-idle"}:{label:e,cls:"badge-nav"}},Nb=A.memo(({character:e})=>{var u,s,c,f,l,h;const[t,r]=N.useState(!1),{telemetry:n,vitals:i,combat:a}=e,o=nO((n==null?void 0:n.vt_state)??"");return j.jsxs("div",{className:"char-card",onClick:()=>r(!t),children:[j.jsxs("div",{className:"char-header",children:[j.jsx("span",{className:"char-name",children:e.name}),j.jsx("span",{className:`char-badge ${o.cls}`,children:o.label})]}),i?j.jsxs("div",{className:"char-vitals",children:[j.jsx(Pi,{label:"HP",current:i.health_current,max:i.health_max,color:"linear-gradient(90deg, #ff4444, #ff6666)",bgColor:"#330000"}),j.jsx(Pi,{label:"ST",current:i.stamina_current,max:i.stamina_max,color:"linear-gradient(90deg, #ffaa00, #ffcc44)",bgColor:"#331a00"}),j.jsx(Pi,{label:"MN",current:i.mana_current,max:i.mana_max,color:"linear-gradient(90deg, #4488ff, #66aaff)",bgColor:"#001433"})]}):j.jsx("div",{className:"char-vitals-placeholder",children:"Awaiting vitals..."}),j.jsxs("div",{className:"char-stats-row",children:[j.jsxs("div",{className:"stat",children:[j.jsx("span",{className:"stat-value",children:(n==null?void 0:n.kills_per_hour)??"--"}),j.jsx("span",{className:"stat-label",children:"kills/hr"})]}),j.jsxs("div",{className:"stat",children:[j.jsx("span",{className:"stat-value",children:((u=n==null?void 0:n.kills)==null?void 0:u.toLocaleString())??"--"}),j.jsx("span",{className:"stat-label",children:"kills"})]}),j.jsxs("div",{className:"stat",children:[j.jsx("span",{className:"stat-value",children:(n==null?void 0:n.deaths)??"0"}),j.jsx("span",{className:"stat-label",children:"deaths"})]}),j.jsxs("div",{className:"stat",children:[j.jsx("span",{className:"stat-value",children:((s=n==null?void 0:n.onlinetime)==null?void 0:s.replace(/^00\./,""))??"--"}),j.jsx("span",{className:"stat-label",children:"uptime"})]})]}),n&&j.jsxs("div",{className:"char-location",children:[(c=n.ns)==null?void 0:c.toFixed(1),"N, ",(f=n.ew)==null?void 0:f.toFixed(1),"E"]}),t&&j.jsxs("div",{className:"char-expanded",children:[i!=null&&i.vitae?j.jsxs("div",{className:"vitae-warn",children:["Vitae: ",i.vitae,"%"]}):null,j.jsxs("div",{className:"expanded-row",children:[j.jsxs("span",{children:["Prismatics: ",(n==null?void 0:n.prismatic_taper_count)??"--"]}),j.jsxs("span",{children:["Total Deaths: ",(n==null?void 0:n.total_deaths)??"--"]})]}),(a==null?void 0:a.session)&&j.jsxs("div",{className:"expanded-row",children:[j.jsxs("span",{children:["Session Dmg: ",(l=a.session.total_damage_given)==null?void 0:l.toLocaleString()]}),j.jsxs("span",{children:["Session Kills: ",a.session.total_kills]})]}),j.jsxs("div",{className:"expanded-row",children:[j.jsxs("span",{children:["RAM: ",n!=null&&n.mem_mb?(n.mem_mb/1048576).toFixed(0)+" MB":"--"]}),j.jsxs("span",{children:["CPU: ",((h=n==null?void 0:n.cpu_pct)==null?void 0:h.toFixed(1))??"--","%"]})]})]})]})});Nb.displayName="CharacterCard";const iO=({characters:e})=>{const t=N.useMemo(()=>Array.from(e.values()).sort((r,n)=>r.name.localeCompare(n.name)),[e]);return t.length===0?j.jsx("div",{className:"grid-empty",children:"No active characters"}):j.jsx("div",{className:"char-grid",children:t.map(r=>j.jsx(Nb,{character:r},r.name))})},aO=({tabs:e})=>{var n,i;const[t,r]=N.useState(((n=e[0])==null?void 0:n.id)??"");return j.jsxs("div",{className:"tab-container",children:[j.jsx("div",{className:"tab-bar",children:e.map(a=>j.jsx("button",{className:`tab-btn ${t===a.id?"active":""}`,onClick:()=>r(a.id),children:a.label},a.id))}),j.jsx("div",{className:"tab-content",children:(i=e.find(a=>a.id===t))==null?void 0:i.content})]})};function Rb(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t-1}return Wo=t,Wo}var Ho,wd;function OO(){if(wd)return Ho;wd=1;var e=Ea();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return Ho=t,Ho}var Ko,Od;function Ma(){if(Od)return Ko;Od=1;var e=gO(),t=bO(),r=xO(),n=wO(),i=OO();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++uj.jsxs("div",{className:"dashboard",children:[j.jsxs("header",{className:"dashboard-header",children:[j.jsx("h1",{className:"dashboard-title",children:"Mosswart Overlord"}),j.jsxs("nav",{className:"dashboard-nav",children:[j.jsx("a",{href:"/",className:"nav-link",children:"Classic View"}),j.jsx("a",{href:"/inventory.html",className:"nav-link",children:"Inventory"}),j.jsx("a",{href:"/suitbuilder.html",className:"nav-link",children:"Suitbuilder"})]})]}),j.jsx("main",{className:"dashboard-main",children:e})]}),rO=({activeChars:e,totalKills:t,totalRares:r,serverHealth:n})=>{var o;const i=((o=n==null?void 0:n.status)==null?void 0:o.toLowerCase())??"unknown",a=i==="online"||i==="up";return j.jsxs("div",{className:"global-stats",children:[j.jsxs("div",{className:"global-stat",children:[j.jsx("span",{className:"global-value",children:e}),j.jsx("span",{className:"global-label",children:"Active Characters"})]}),j.jsxs("div",{className:"global-stat",children:[j.jsx("span",{className:"global-value",children:t.toLocaleString()}),j.jsx("span",{className:"global-label",children:"Total Kills"})]}),j.jsxs("div",{className:"global-stat",children:[j.jsx("span",{className:"global-value",children:r}),j.jsx("span",{className:"global-label",children:"Total Rares"})]}),j.jsxs("div",{className:"global-stat",children:[j.jsx("span",{className:`server-dot ${a?"online":"offline"}`}),j.jsxs("span",{className:"global-value",children:[(n==null?void 0:n.latency_ms)??"--","ms"]}),j.jsx("span",{className:"global-label",children:"Coldeve"})]})]})},Pi=A.memo(({label:e,current:t,max:r,color:n,bgColor:i})=>{const a=r>0?Math.min(100,Math.max(0,t/r*100)):0;return j.jsxs("div",{className:"vital-bar",children:[j.jsx("span",{className:"vital-label",children:e}),j.jsx("div",{className:"vital-track",style:{backgroundColor:i},children:j.jsx("div",{className:"vital-fill",style:{width:`${a}%`,background:n}})}),j.jsxs("span",{className:"vital-text",children:[t,"/",r]})]})});Pi.displayName="VitalBar";const nO=e=>{const t=(e||"idle").toLowerCase();return t==="combat"||t==="hunt"?{label:t==="combat"?"Combat":"Hunt",cls:"badge-combat"}:t==="nav"||t==="navigation"?{label:"Nav",cls:"badge-nav"}:t==="default"||t==="idle"||t===""?{label:"Idle",cls:"badge-idle"}:{label:e,cls:"badge-nav"}},Nb=A.memo(({character:e})=>{var u,s,c,f,l,h;const[t,r]=N.useState(!1),{telemetry:n,vitals:i,combat:a}=e,o=nO((n==null?void 0:n.vt_state)??"");return j.jsxs("div",{className:"char-card",onClick:()=>r(!t),children:[j.jsxs("div",{className:"char-header",children:[j.jsx("span",{className:"char-name",children:e.name}),j.jsx("span",{className:`char-badge ${o.cls}`,children:o.label})]}),i?j.jsxs("div",{className:"char-vitals",children:[j.jsx(Pi,{label:"HP",current:i.health_current,max:i.health_max,color:"linear-gradient(90deg, #ff4444, #ff6666)",bgColor:"#330000"}),j.jsx(Pi,{label:"ST",current:i.stamina_current,max:i.stamina_max,color:"linear-gradient(90deg, #ffaa00, #ffcc44)",bgColor:"#331a00"}),j.jsx(Pi,{label:"MN",current:i.mana_current,max:i.mana_max,color:"linear-gradient(90deg, #4488ff, #66aaff)",bgColor:"#001433"})]}):j.jsx("div",{className:"char-vitals-placeholder",children:"Awaiting vitals..."}),j.jsxs("div",{className:"char-stats-row",children:[j.jsxs("div",{className:"stat",children:[j.jsx("span",{className:"stat-value",children:(n==null?void 0:n.kills_per_hour)??"--"}),j.jsx("span",{className:"stat-label",children:"kills/hr"})]}),j.jsxs("div",{className:"stat",children:[j.jsx("span",{className:"stat-value",children:((u=n==null?void 0:n.kills)==null?void 0:u.toLocaleString())??"--"}),j.jsx("span",{className:"stat-label",children:"kills"})]}),j.jsxs("div",{className:"stat",children:[j.jsx("span",{className:"stat-value",children:(n==null?void 0:n.deaths)??"0"}),j.jsx("span",{className:"stat-label",children:"deaths"})]}),j.jsxs("div",{className:"stat",children:[j.jsx("span",{className:"stat-value",children:((s=n==null?void 0:n.onlinetime)==null?void 0:s.replace(/^00\./,""))??"--"}),j.jsx("span",{className:"stat-label",children:"uptime"})]})]}),n&&j.jsxs("div",{className:"char-location",children:[(c=n.ns)==null?void 0:c.toFixed(1),"N, ",(f=n.ew)==null?void 0:f.toFixed(1),"E"]}),t&&j.jsxs("div",{className:"char-expanded",children:[i!=null&&i.vitae?j.jsxs("div",{className:"vitae-warn",children:["Vitae: ",i.vitae,"%"]}):null,j.jsxs("div",{className:"expanded-row",children:[j.jsxs("span",{children:["Prismatics: ",(n==null?void 0:n.prismatic_taper_count)??"--"]}),j.jsxs("span",{children:["Total Deaths: ",(n==null?void 0:n.total_deaths)??"--"]})]}),(a==null?void 0:a.session)&&j.jsxs("div",{className:"expanded-row",children:[j.jsxs("span",{children:["Session Dmg: ",(l=a.session.total_damage_given)==null?void 0:l.toLocaleString()]}),j.jsxs("span",{children:["Session Kills: ",a.session.total_kills]})]}),j.jsxs("div",{className:"expanded-row",children:[j.jsxs("span",{children:["RAM: ",n!=null&&n.mem_mb?(n.mem_mb/1048576).toFixed(0)+" MB":"--"]}),j.jsxs("span",{children:["CPU: ",((h=n==null?void 0:n.cpu_pct)==null?void 0:h.toFixed(1))??"--","%"]})]})]})]})});Nb.displayName="CharacterCard";const iO=({characters:e})=>{const t=N.useMemo(()=>Array.from(e.values()).sort((r,n)=>r.name.localeCompare(n.name)),[e]);return t.length===0?j.jsx("div",{className:"grid-empty",children:"No active characters"}):j.jsx("div",{className:"char-grid",children:t.map(r=>j.jsx(Nb,{character:r},r.name))})},aO=({tabs:e})=>{var n,i;const[t,r]=N.useState(((n=e[0])==null?void 0:n.id)??"");return j.jsxs("div",{className:"tab-container",children:[j.jsx("div",{className:"tab-bar",children:e.map(a=>j.jsx("button",{className:`tab-btn ${t===a.id?"active":""}`,onClick:()=>r(a.id),children:a.label},a.id))}),j.jsx("div",{className:"tab-content",children:(i=e.find(a=>a.id===t))==null?void 0:i.content})]})};function Rb(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t-1}return Wo=t,Wo}var Ho,wd;function OO(){if(wd)return Ho;wd=1;var e=Ea();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return Ho=t,Ho}var Ko,Od;function Ma(){if(Od)return Ko;Od=1;var e=gO(),t=bO(),r=xO(),n=wO(),i=OO();function a(o){var u=-1,s=o==null?0:o.length;for(this.clear();++u>>1,yt=z[$];if(0>>1;$d(Z,B))Vd(it,Z)?(z[$]=it,z[V]=B,$=V):(z[$]=Z,z[C]=B,$=C);else if(Vd(it,B))z[$]=it,z[V]=B,$=V;else break t}}return h}function d(z,h){var B=z.sortIndex-h.sortIndex;return B!==0?B:z.id-h.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var x=performance;s.unstable_now=function(){return x.now()}}else{var E=Date,R=E.now();s.unstable_now=function(){return E.now()-R}}var g=[],v=[],Y=1,U=null,L=3,lt=!1,W=!1,et=!1,mt=!1,I=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,F=typeof setImmediate<"u"?setImmediate:null;function Q(z){for(var h=S(v);h!==null;){if(h.callback===null)o(v);else if(h.startTime<=z)o(v),h.sortIndex=h.expirationTime,p(g,h);else break;h=S(v)}}function k(z){if(et=!1,Q(z),!W)if(S(g)!==null)W=!0,q||(q=!0,ot());else{var h=S(v);h!==null&&J(k,h.startTime-z)}}var q=!1,T=-1,G=5,tt=-1;function K(){return mt?!0:!(s.unstable_now()-ttz&&K());){var $=U.callback;if(typeof $=="function"){U.callback=null,L=U.priorityLevel;var yt=$(U.expirationTime<=z);if(z=s.unstable_now(),typeof yt=="function"){U.callback=yt,Q(z),h=!0;break l}U===S(g)&&o(g),Q(z)}else o(g);U=S(g)}if(U!==null)h=!0;else{var m=S(v);m!==null&&J(k,m.startTime-z),h=!1}}break t}finally{U=null,L=B,lt=!1}h=void 0}}finally{h?ot():q=!1}}}var ot;if(typeof F=="function")ot=function(){F(ut)};else if(typeof MessageChannel<"u"){var gt=new MessageChannel,w=gt.port2;gt.port1.onmessage=ut,ot=function(){w.postMessage(null)}}else ot=function(){I(ut,0)};function J(z,h){T=I(function(){z(s.unstable_now())},h)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(z){z.callback=null},s.unstable_forceFrameRate=function(z){0>z||125$?(z.sortIndex=B,p(v,z),S(g)===null&&z===S(v)&&(et?(M(T),T=-1):et=!0,J(k,B-$))):(z.sortIndex=yt,p(g,z),W||lt||(W=!0,q||(q=!0,ot()))),z},s.unstable_shouldYield=K,s.unstable_wrapCallback=function(z){var h=L;return function(){var B=L;L=h;try{return z.apply(this,arguments)}finally{L=B}}}})(As)),As}var Ld;function X0(){return Ld||(Ld=1,Es.exports=q0()),Es.exports}var Ms={exports:{}},It={};/** + */var Xd;function q0(){return Xd||(Xd=1,(function(s){function p(z,h){var B=z.length;z.push(h);t:for(;0>>1,yt=z[W];if(0>>1;Wd(Z,B))Vd(it,Z)?(z[W]=it,z[V]=B,W=V):(z[W]=Z,z[C]=B,W=C);else if(Vd(it,B))z[W]=it,z[V]=B,W=V;else break t}}return h}function d(z,h){var B=z.sortIndex-h.sortIndex;return B!==0?B:z.id-h.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var x=performance;s.unstable_now=function(){return x.now()}}else{var E=Date,R=E.now();s.unstable_now=function(){return E.now()-R}}var g=[],v=[],Y=1,U=null,L=3,lt=!1,J=!1,et=!1,mt=!1,I=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,F=typeof setImmediate<"u"?setImmediate:null;function Q(z){for(var h=S(v);h!==null;){if(h.callback===null)o(v);else if(h.startTime<=z)o(v),h.sortIndex=h.expirationTime,p(g,h);else break;h=S(v)}}function k(z){if(et=!1,Q(z),!J)if(S(g)!==null)J=!0,q||(q=!0,ot());else{var h=S(v);h!==null&&$(k,h.startTime-z)}}var q=!1,T=-1,G=5,tt=-1;function K(){return mt?!0:!(s.unstable_now()-ttz&&K());){var W=U.callback;if(typeof W=="function"){U.callback=null,L=U.priorityLevel;var yt=W(U.expirationTime<=z);if(z=s.unstable_now(),typeof yt=="function"){U.callback=yt,Q(z),h=!0;break l}U===S(g)&&o(g),Q(z)}else o(g);U=S(g)}if(U!==null)h=!0;else{var m=S(v);m!==null&&$(k,m.startTime-z),h=!1}}break t}finally{U=null,L=B,lt=!1}h=void 0}}finally{h?ot():q=!1}}}var ot;if(typeof F=="function")ot=function(){F(ut)};else if(typeof MessageChannel<"u"){var gt=new MessageChannel,w=gt.port2;gt.port1.onmessage=ut,ot=function(){w.postMessage(null)}}else ot=function(){I(ut,0)};function $(z,h){T=I(function(){z(s.unstable_now())},h)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(z){z.callback=null},s.unstable_forceFrameRate=function(z){0>z||125W?(z.sortIndex=B,p(v,z),S(g)===null&&z===S(v)&&(et?(M(T),T=-1):et=!0,$(k,B-W))):(z.sortIndex=yt,p(g,z),J||lt||(J=!0,q||(q=!0,ot()))),z},s.unstable_shouldYield=K,s.unstable_wrapCallback=function(z){var h=L;return function(){var B=L;L=h;try{return z.apply(this,arguments)}finally{L=B}}}})(As)),As}var Ld;function X0(){return Ld||(Ld=1,Es.exports=q0()),Es.exports}var Ms={exports:{}},It={};/** * @license React * react-dom.production.js * @@ -38,12 +38,12 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var wd;function Q0(){if(wd)return Un;wd=1;var s=X0(),p=Rs(),S=G0();function o(t){var l="https://react.dev/errors/"+t;if(1yt||(t.current=$[yt],$[yt]=null,yt--)}function Z(t,l){yt++,$[yt]=t.current,t.current=l}var V=m(null),it=m(null),st=m(null),dt=m(null);function Rt(t,l){switch(Z(st,l),Z(it,t),Z(V,null),l.nodeType){case 9:case 11:t=(t=l.documentElement)&&(t=t.namespaceURI)?nd(t):0;break;default:if(t=l.tagName,l=l.namespaceURI)l=nd(l),t=ud(l,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}C(V),Z(V,t)}function Ot(){C(V),C(it),C(st)}function ll(t){t.memoizedState!==null&&Z(dt,t);var l=V.current,e=ud(l,t.type);l!==e&&(Z(it,t),Z(V,e))}function Bl(t){it.current===t&&(C(V),C(it)),dt.current===t&&(C(dt),Cn._currentValue=B)}var Nl,Xa;function Ne(t){if(Nl===void 0)try{throw Error()}catch(e){var l=e.stack.trim().match(/\n( *(at )?)/);Nl=l&&l[1]||"",Xa=-1yt||(t.current=W[yt],W[yt]=null,yt--)}function Z(t,l){yt++,W[yt]=t.current,t.current=l}var V=m(null),it=m(null),st=m(null),dt=m(null);function Rt(t,l){switch(Z(st,l),Z(it,t),Z(V,null),l.nodeType){case 9:case 11:t=(t=l.documentElement)&&(t=t.namespaceURI)?nd(t):0;break;default:if(t=l.tagName,l=l.namespaceURI)l=nd(l),t=ud(l,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}C(V),Z(V,t)}function Ot(){C(V),C(it),C(st)}function ll(t){t.memoizedState!==null&&Z(dt,t);var l=V.current,e=ud(l,t.type);l!==e&&(Z(it,t),Z(V,e))}function Bl(t){it.current===t&&(C(V),C(it)),dt.current===t&&(C(dt),Cn._currentValue=B)}var Nl,Xa;function Ne(t){if(Nl===void 0)try{throw Error()}catch(e){var l=e.stack.trim().match(/\n( *(at )?)/);Nl=l&&l[1]||"",Xa=-1)":-1n||r[a]!==j[n]){var D=` `+r[a].replace(" at new "," at ");return t.displayName&&D.includes("")&&(D=D.replace("",t.displayName)),D}while(1<=a&&0<=n);break}}}finally{ui=!1,Error.prepareStackTrace=e}return(e=t?t.displayName||t.name:"")?Ne(e):""}function rh(t,l){switch(t.tag){case 26:case 27:case 5:return Ne(t.type);case 16:return Ne("Lazy");case 13:return t.child!==l&&l!==null?Ne("Suspense Fallback"):Ne("Suspense");case 19:return Ne("SuspenseList");case 0:case 15:return ii(t.type,!1);case 11:return ii(t.type.render,!1);case 1:return ii(t.type,!0);case 31:return Ne("Activity");default:return""}}function Ds(t){try{var l="",e=null;do l+=rh(t,e),e=t,t=t.return;while(t);return l}catch(a){return` Error generating stack: `+a.message+` -`+a.stack}}var ci=Object.prototype.hasOwnProperty,si=s.unstable_scheduleCallback,fi=s.unstable_cancelCallback,dh=s.unstable_shouldYield,hh=s.unstable_requestPaint,fl=s.unstable_now,mh=s.unstable_getCurrentPriorityLevel,Us=s.unstable_ImmediatePriority,Bs=s.unstable_UserBlockingPriority,qn=s.unstable_NormalPriority,yh=s.unstable_LowPriority,Hs=s.unstable_IdlePriority,gh=s.log,vh=s.unstable_setDisableYieldValue,La=null,ol=null;function ue(t){if(typeof gh=="function"&&vh(t),ol&&typeof ol.setStrictMode=="function")try{ol.setStrictMode(La,t)}catch{}}var rl=Math.clz32?Math.clz32:bh,ph=Math.log,xh=Math.LN2;function bh(t){return t>>>=0,t===0?32:31-(ph(t)/xh|0)|0}var Xn=256,Ln=262144,Gn=4194304;function Re(t){var l=t&42;if(l!==0)return l;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Qn(t,l,e){var a=t.pendingLanes;if(a===0)return 0;var n=0,u=t.suspendedLanes,c=t.pingedLanes;t=t.warmLanes;var f=a&134217727;return f!==0?(a=f&~u,a!==0?n=Re(a):(c&=f,c!==0?n=Re(c):e||(e=f&~t,e!==0&&(n=Re(e))))):(f=a&~u,f!==0?n=Re(f):c!==0?n=Re(c):e||(e=a&~t,e!==0&&(n=Re(e)))),n===0?0:l!==0&&l!==n&&(l&u)===0&&(u=n&-n,e=l&-l,u>=e||u===32&&(e&4194048)!==0)?l:n}function Ga(t,l){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&l)===0}function Sh(t,l){switch(t){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ys(){var t=Gn;return Gn<<=1,(Gn&62914560)===0&&(Gn=4194304),t}function oi(t){for(var l=[],e=0;31>e;e++)l.push(t);return l}function Qa(t,l){t.pendingLanes|=l,l!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function _h(t,l,e,a,n,u){var c=t.pendingLanes;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=e,t.entangledLanes&=e,t.errorRecoveryDisabledLanes&=e,t.shellSuspendCounter=0;var f=t.entanglements,r=t.expirationTimes,j=t.hiddenUpdates;for(e=c&~e;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Th=/[\n"\\]/g;function Sl(t){return t.replace(Th,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function gi(t,l,e,a,n,u,c,f){t.name="",c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"?t.type=c:t.removeAttribute("type"),l!=null?c==="number"?(l===0&&t.value===""||t.value!=l)&&(t.value=""+bl(l)):t.value!==""+bl(l)&&(t.value=""+bl(l)):c!=="submit"&&c!=="reset"||t.removeAttribute("value"),l!=null?vi(t,c,bl(l)):e!=null?vi(t,c,bl(e)):a!=null&&t.removeAttribute("value"),n==null&&u!=null&&(t.defaultChecked=!!u),n!=null&&(t.checked=n&&typeof n!="function"&&typeof n!="symbol"),f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?t.name=""+bl(f):t.removeAttribute("name")}function Ws(t,l,e,a,n,u,c,f){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(t.type=u),l!=null||e!=null){if(!(u!=="submit"&&u!=="reset"||l!=null)){yi(t);return}e=e!=null?""+bl(e):"",l=l!=null?""+bl(l):e,f||l===t.value||(t.value=l),t.defaultValue=l}a=a??n,a=typeof a!="function"&&typeof a!="symbol"&&!!a,t.checked=f?t.checked:!!a,t.defaultChecked=!!a,c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(t.name=c),yi(t)}function vi(t,l,e){l==="number"&&Vn(t.ownerDocument)===t||t.defaultValue===""+e||(t.defaultValue=""+e)}function la(t,l,e,a){if(t=t.options,l){l={};for(var n=0;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),_i=!1;if(Ql)try{var Ka={};Object.defineProperty(Ka,"passive",{get:function(){_i=!0}}),window.addEventListener("test",Ka,Ka),window.removeEventListener("test",Ka,Ka)}catch{_i=!1}var ce=null,ji=null,kn=null;function af(){if(kn)return kn;var t,l=ji,e=l.length,a,n="value"in ce?ce.value:ce.textContent,u=n.length;for(t=0;t=$a),of=" ",rf=!1;function df(t,l){switch(t){case"keyup":return em.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function hf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ua=!1;function nm(t,l){switch(t){case"compositionend":return hf(l);case"keypress":return l.which!==32?null:(rf=!0,of);case"textInput":return t=l.data,t===of&&rf?null:t;default:return null}}function um(t,l){if(ua)return t==="compositionend"||!Ti&&df(t,l)?(t=af(),kn=ji=ce=null,ua=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1=l)return{node:e,offset:l-t};t=a}t:{for(;e;){if(e.nextSibling){e=e.nextSibling;break t}e=e.parentNode}e=void 0}e=Sf(e)}}function jf(t,l){return t&&l?t===l?!0:t&&t.nodeType===3?!1:l&&l.nodeType===3?jf(t,l.parentNode):"contains"in t?t.contains(l):t.compareDocumentPosition?!!(t.compareDocumentPosition(l)&16):!1:!1}function zf(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var l=Vn(t.document);l instanceof t.HTMLIFrameElement;){try{var e=typeof l.contentWindow.location.href=="string"}catch{e=!1}if(e)t=l.contentWindow;else break;l=Vn(t.document)}return l}function Ni(t){var l=t&&t.nodeName&&t.nodeName.toLowerCase();return l&&(l==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||l==="textarea"||t.contentEditable==="true")}var hm=Ql&&"documentMode"in document&&11>=document.documentMode,ia=null,Ri=null,Pa=null,Di=!1;function Ef(t,l,e){var a=e.window===e?e.document:e.nodeType===9?e:e.ownerDocument;Di||ia==null||ia!==Vn(a)||(a=ia,"selectionStart"in a&&Ni(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),Pa&&Ia(Pa,a)||(Pa=a,a=Lu(Ri,"onSelect"),0>=c,n-=c,Hl=1<<32-rl(l)+n|e<ht?(bt=at,at=null):bt=at.sibling;var jt=A(b,at,_[ht],H);if(jt===null){at===null&&(at=bt);break}t&&at&&jt.alternate===null&&l(b,at),y=u(jt,y,ht),_t===null?nt=jt:_t.sibling=jt,_t=jt,at=bt}if(ht===_.length)return e(b,at),St&&Zl(b,ht),nt;if(at===null){for(;ht<_.length;ht++)at=X(b,_[ht],H),at!==null&&(y=u(at,y,ht),_t===null?nt=at:_t.sibling=at,_t=at);return St&&Zl(b,ht),nt}for(at=a(at);ht<_.length;ht++)bt=O(at,b,ht,_[ht],H),bt!==null&&(t&&bt.alternate!==null&&at.delete(bt.key===null?ht:bt.key),y=u(bt,y,ht),_t===null?nt=bt:_t.sibling=bt,_t=bt);return t&&at.forEach(function(Ce){return l(b,Ce)}),St&&Zl(b,ht),nt}function ct(b,y,_,H){if(_==null)throw Error(o(151));for(var nt=null,_t=null,at=y,ht=y=0,bt=null,jt=_.next();at!==null&&!jt.done;ht++,jt=_.next()){at.index>ht?(bt=at,at=null):bt=at.sibling;var Ce=A(b,at,jt.value,H);if(Ce===null){at===null&&(at=bt);break}t&&at&&Ce.alternate===null&&l(b,at),y=u(Ce,y,ht),_t===null?nt=Ce:_t.sibling=Ce,_t=Ce,at=bt}if(jt.done)return e(b,at),St&&Zl(b,ht),nt;if(at===null){for(;!jt.done;ht++,jt=_.next())jt=X(b,jt.value,H),jt!==null&&(y=u(jt,y,ht),_t===null?nt=jt:_t.sibling=jt,_t=jt);return St&&Zl(b,ht),nt}for(at=a(at);!jt.done;ht++,jt=_.next())jt=O(at,b,ht,jt.value,H),jt!==null&&(t&&jt.alternate!==null&&at.delete(jt.key===null?ht:jt.key),y=u(jt,y,ht),_t===null?nt=jt:_t.sibling=jt,_t=jt);return t&&at.forEach(function(D0){return l(b,D0)}),St&&Zl(b,ht),nt}function Ct(b,y,_,H){if(typeof _=="object"&&_!==null&&_.type===et&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case lt:t:{for(var nt=_.key;y!==null;){if(y.key===nt){if(nt=_.type,nt===et){if(y.tag===7){e(b,y.sibling),H=n(y,_.props.children),H.return=b,b=H;break t}}else if(y.elementType===nt||typeof nt=="object"&&nt!==null&&nt.$$typeof===G&&we(nt)===y.type){e(b,y.sibling),H=n(y,_.props),un(H,_),H.return=b,b=H;break t}e(b,y);break}else l(b,y);y=y.sibling}_.type===et?(H=qe(_.props.children,b.mode,H,_.key),H.return=b,b=H):(H=au(_.type,_.key,_.props,null,b.mode,H),un(H,_),H.return=b,b=H)}return c(b);case W:t:{for(nt=_.key;y!==null;){if(y.key===nt)if(y.tag===4&&y.stateNode.containerInfo===_.containerInfo&&y.stateNode.implementation===_.implementation){e(b,y.sibling),H=n(y,_.children||[]),H.return=b,b=H;break t}else{e(b,y);break}else l(b,y);y=y.sibling}H=Li(_,b.mode,H),H.return=b,b=H}return c(b);case G:return _=we(_),Ct(b,y,_,H)}if(J(_))return P(b,y,_,H);if(ot(_)){if(nt=ot(_),typeof nt!="function")throw Error(o(150));return _=nt.call(_),ct(b,y,_,H)}if(typeof _.then=="function")return Ct(b,y,ou(_),H);if(_.$$typeof===F)return Ct(b,y,iu(b,_),H);ru(b,_)}return typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint"?(_=""+_,y!==null&&y.tag===6?(e(b,y.sibling),H=n(y,_),H.return=b,b=H):(e(b,y),H=Xi(_,b.mode,H),H.return=b,b=H),c(b)):e(b,y)}return function(b,y,_,H){try{nn=0;var nt=Ct(b,y,_,H);return va=null,nt}catch(at){if(at===ga||at===su)throw at;var _t=hl(29,at,null,b.mode);return _t.lanes=H,_t.return=b,_t}finally{}}}var Ve=Jf(!0),$f=Jf(!1),de=!1;function Ii(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Pi(t,l){t=t.updateQueue,l.updateQueue===t&&(l.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function he(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function me(t,l,e){var a=t.updateQueue;if(a===null)return null;if(a=a.shared,(zt&2)!==0){var n=a.pending;return n===null?l.next=l:(l.next=n.next,n.next=l),a.pending=l,l=eu(t),Rf(t,null,e),l}return lu(t,a,l,e),eu(t)}function cn(t,l,e){if(l=l.updateQueue,l!==null&&(l=l.shared,(e&4194048)!==0)){var a=l.lanes;a&=t.pendingLanes,e|=a,l.lanes=e,Xs(t,e)}}function tc(t,l){var e=t.updateQueue,a=t.alternate;if(a!==null&&(a=a.updateQueue,e===a)){var n=null,u=null;if(e=e.firstBaseUpdate,e!==null){do{var c={lane:e.lane,tag:e.tag,payload:e.payload,callback:null,next:null};u===null?n=u=c:u=u.next=c,e=e.next}while(e!==null);u===null?n=u=l:u=u.next=l}else n=u=l;e={baseState:a.baseState,firstBaseUpdate:n,lastBaseUpdate:u,shared:a.shared,callbacks:a.callbacks},t.updateQueue=e;return}t=e.lastBaseUpdate,t===null?e.firstBaseUpdate=l:t.next=l,e.lastBaseUpdate=l}var lc=!1;function sn(){if(lc){var t=ya;if(t!==null)throw t}}function fn(t,l,e,a){lc=!1;var n=t.updateQueue;de=!1;var u=n.firstBaseUpdate,c=n.lastBaseUpdate,f=n.shared.pending;if(f!==null){n.shared.pending=null;var r=f,j=r.next;r.next=null,c===null?u=j:c.next=j,c=r;var D=t.alternate;D!==null&&(D=D.updateQueue,f=D.lastBaseUpdate,f!==c&&(f===null?D.firstBaseUpdate=j:f.next=j,D.lastBaseUpdate=r))}if(u!==null){var X=n.baseState;c=0,D=j=r=null,f=u;do{var A=f.lane&-536870913,O=A!==f.lane;if(O?(xt&A)===A:(a&A)===A){A!==0&&A===ma&&(lc=!0),D!==null&&(D=D.next={lane:0,tag:f.tag,payload:f.payload,callback:null,next:null});t:{var P=t,ct=f;A=l;var Ct=e;switch(ct.tag){case 1:if(P=ct.payload,typeof P=="function"){X=P.call(Ct,X,A);break t}X=P;break t;case 3:P.flags=P.flags&-65537|128;case 0:if(P=ct.payload,A=typeof P=="function"?P.call(Ct,X,A):P,A==null)break t;X=U({},X,A);break t;case 2:de=!0}}A=f.callback,A!==null&&(t.flags|=64,O&&(t.flags|=8192),O=n.callbacks,O===null?n.callbacks=[A]:O.push(A))}else O={lane:A,tag:f.tag,payload:f.payload,callback:f.callback,next:null},D===null?(j=D=O,r=X):D=D.next=O,c|=A;if(f=f.next,f===null){if(f=n.shared.pending,f===null)break;O=f,f=O.next,O.next=null,n.lastBaseUpdate=O,n.shared.pending=null}}while(!0);D===null&&(r=X),n.baseState=r,n.firstBaseUpdate=j,n.lastBaseUpdate=D,u===null&&(n.shared.lanes=0),xe|=c,t.lanes=c,t.memoizedState=X}}function Wf(t,l){if(typeof t!="function")throw Error(o(191,t));t.call(l)}function Ff(t,l){var e=t.callbacks;if(e!==null)for(t.callbacks=null,t=0;tu?u:8;var c=z.T,f={};z.T=f,bc(t,!1,l,e);try{var r=n(),j=z.S;if(j!==null&&j(f,r),r!==null&&typeof r=="object"&&typeof r.then=="function"){var D=_m(r,a);dn(t,l,D,pl(t))}else dn(t,l,a,pl(t))}catch(X){dn(t,l,{then:function(){},status:"rejected",reason:X},pl())}finally{h.p=u,c!==null&&f.types!==null&&(c.types=f.types),z.T=c}}function Tm(){}function pc(t,l,e,a){if(t.tag!==5)throw Error(o(476));var n=Oo(t).queue;Co(t,n,l,B,e===null?Tm:function(){return No(t),e(a)})}function Oo(t){var l=t.memoizedState;if(l!==null)return l;l={memoizedState:B,baseState:B,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jl,lastRenderedState:B},next:null};var e={};return l.next={memoizedState:e,baseState:e,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jl,lastRenderedState:e},next:null},t.memoizedState=l,t=t.alternate,t!==null&&(t.memoizedState=l),l}function No(t){var l=Oo(t);l.next===null&&(l=t.alternate.memoizedState),dn(t,l.next.queue,{},pl())}function xc(){return $t(Cn)}function Ro(){return Xt().memoizedState}function Do(){return Xt().memoizedState}function Cm(t){for(var l=t.return;l!==null;){switch(l.tag){case 24:case 3:var e=pl();t=he(e);var a=me(l,t,e);a!==null&&(sl(a,l,e),cn(a,l,e)),l={cache:Ji()},t.payload=l;return}l=l.return}}function Om(t,l,e){var a=pl();e={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null},Su(t)?Bo(l,e):(e=Yi(t,l,e,a),e!==null&&(sl(e,t,a),Ho(e,l,a)))}function Uo(t,l,e){var a=pl();dn(t,l,e,a)}function dn(t,l,e,a){var n={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null};if(Su(t))Bo(l,n);else{var u=t.alternate;if(t.lanes===0&&(u===null||u.lanes===0)&&(u=l.lastRenderedReducer,u!==null))try{var c=l.lastRenderedState,f=u(c,e);if(n.hasEagerState=!0,n.eagerState=f,dl(f,c))return lu(t,l,n,0),Nt===null&&tu(),!1}catch{}finally{}if(e=Yi(t,l,n,a),e!==null)return sl(e,t,a),Ho(e,l,a),!0}return!1}function bc(t,l,e,a){if(a={lane:2,revertLane:Ic(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Su(t)){if(l)throw Error(o(479))}else l=Yi(t,e,a,2),l!==null&&sl(l,t,2)}function Su(t){var l=t.alternate;return t===rt||l!==null&&l===rt}function Bo(t,l){xa=mu=!0;var e=t.pending;e===null?l.next=l:(l.next=e.next,e.next=l),t.pending=l}function Ho(t,l,e){if((e&4194048)!==0){var a=l.lanes;a&=t.pendingLanes,e|=a,l.lanes=e,Xs(t,e)}}var hn={readContext:$t,use:vu,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useLayoutEffect:Ht,useInsertionEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useSyncExternalStore:Ht,useId:Ht,useHostTransitionStatus:Ht,useFormState:Ht,useActionState:Ht,useOptimistic:Ht,useMemoCache:Ht,useCacheRefresh:Ht};hn.useEffectEvent=Ht;var Yo={readContext:$t,use:vu,useCallback:function(t,l){return tl().memoizedState=[t,l===void 0?null:l],t},useContext:$t,useEffect:bo,useImperativeHandle:function(t,l,e){e=e!=null?e.concat([t]):null,xu(4194308,4,zo.bind(null,l,t),e)},useLayoutEffect:function(t,l){return xu(4194308,4,t,l)},useInsertionEffect:function(t,l){xu(4,2,t,l)},useMemo:function(t,l){var e=tl();l=l===void 0?null:l;var a=t();if(Ke){ue(!0);try{t()}finally{ue(!1)}}return e.memoizedState=[a,l],a},useReducer:function(t,l,e){var a=tl();if(e!==void 0){var n=e(l);if(Ke){ue(!0);try{e(l)}finally{ue(!1)}}}else n=l;return a.memoizedState=a.baseState=n,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:n},a.queue=t,t=t.dispatch=Om.bind(null,rt,t),[a.memoizedState,t]},useRef:function(t){var l=tl();return t={current:t},l.memoizedState=t},useState:function(t){t=hc(t);var l=t.queue,e=Uo.bind(null,rt,l);return l.dispatch=e,[t.memoizedState,e]},useDebugValue:gc,useDeferredValue:function(t,l){var e=tl();return vc(e,t,l)},useTransition:function(){var t=hc(!1);return t=Co.bind(null,rt,t.queue,!0,!1),tl().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,l,e){var a=rt,n=tl();if(St){if(e===void 0)throw Error(o(407));e=e()}else{if(e=l(),Nt===null)throw Error(o(349));(xt&127)!==0||ao(a,l,e)}n.memoizedState=e;var u={value:e,getSnapshot:l};return n.queue=u,bo(uo.bind(null,a,u,t),[t]),a.flags|=2048,Sa(9,{destroy:void 0},no.bind(null,a,u,e,l),null),e},useId:function(){var t=tl(),l=Nt.identifierPrefix;if(St){var e=Yl,a=Hl;e=(a&~(1<<32-rl(a)-1)).toString(32)+e,l="_"+l+"R_"+e,e=yu++,0<\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof a.is=="string"?c.createElement("select",{is:a.is}):c.createElement("select"),a.multiple?u.multiple=!0:a.size&&(u.size=a.size);break;default:u=typeof a.is=="string"?c.createElement(n,{is:a.is}):c.createElement(n)}}u[kt]=l,u[el]=a;t:for(c=l.child;c!==null;){if(c.tag===5||c.tag===6)u.appendChild(c.stateNode);else if(c.tag!==4&&c.tag!==27&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===l)break t;for(;c.sibling===null;){if(c.return===null||c.return===l)break t;c=c.return}c.sibling.return=c.return,c=c.sibling}l.stateNode=u;t:switch(Ft(u,n,a),n){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break t;case"img":a=!0;break t;default:a=!1}a&&Wl(l)}}return Ut(l),Uc(l,l.type,t===null?null:t.memoizedProps,l.pendingProps,e),null;case 6:if(t&&l.stateNode!=null)t.memoizedProps!==a&&Wl(l);else{if(typeof a!="string"&&l.stateNode===null)throw Error(o(166));if(t=st.current,da(l)){if(t=l.stateNode,e=l.memoizedProps,a=null,n=Jt,n!==null)switch(n.tag){case 27:case 5:a=n.memoizedProps}t[kt]=l,t=!!(t.nodeValue===e||a!==null&&a.suppressHydrationWarning===!0||ed(t.nodeValue,e)),t||oe(l,!0)}else t=Gu(t).createTextNode(a),t[kt]=l,l.stateNode=t}return Ut(l),null;case 31:if(e=l.memoizedState,t===null||t.memoizedState!==null){if(a=da(l),e!==null){if(t===null){if(!a)throw Error(o(318));if(t=l.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(o(557));t[kt]=l}else Xe(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Ut(l),t=!1}else e=Zi(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=e),t=!0;if(!t)return l.flags&256?(yl(l),l):(yl(l),null);if((l.flags&128)!==0)throw Error(o(558))}return Ut(l),null;case 13:if(a=l.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(n=da(l),a!==null&&a.dehydrated!==null){if(t===null){if(!n)throw Error(o(318));if(n=l.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(317));n[kt]=l}else Xe(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Ut(l),n=!1}else n=Zi(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=n),n=!0;if(!n)return l.flags&256?(yl(l),l):(yl(l),null)}return yl(l),(l.flags&128)!==0?(l.lanes=e,l):(e=a!==null,t=t!==null&&t.memoizedState!==null,e&&(a=l.child,n=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(n=a.alternate.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==n&&(a.flags|=2048)),e!==t&&e&&(l.child.flags|=8192),Au(l,l.updateQueue),Ut(l),null);case 4:return Ot(),t===null&&es(l.stateNode.containerInfo),Ut(l),null;case 10:return Kl(l.type),Ut(l),null;case 19:if(C(qt),a=l.memoizedState,a===null)return Ut(l),null;if(n=(l.flags&128)!==0,u=a.rendering,u===null)if(n)yn(a,!1);else{if(Yt!==0||t!==null&&(t.flags&128)!==0)for(t=l.child;t!==null;){if(u=hu(t),u!==null){for(l.flags|=128,yn(a,!1),t=u.updateQueue,l.updateQueue=t,Au(l,t),l.subtreeFlags=0,t=e,e=l.child;e!==null;)Df(e,t),e=e.sibling;return Z(qt,qt.current&1|2),St&&Zl(l,a.treeForkCount),l.child}t=t.sibling}a.tail!==null&&fl()>Nu&&(l.flags|=128,n=!0,yn(a,!1),l.lanes=4194304)}else{if(!n)if(t=hu(u),t!==null){if(l.flags|=128,n=!0,t=t.updateQueue,l.updateQueue=t,Au(l,t),yn(a,!0),a.tail===null&&a.tailMode==="hidden"&&!u.alternate&&!St)return Ut(l),null}else 2*fl()-a.renderingStartTime>Nu&&e!==536870912&&(l.flags|=128,n=!0,yn(a,!1),l.lanes=4194304);a.isBackwards?(u.sibling=l.child,l.child=u):(t=a.last,t!==null?t.sibling=u:l.child=u,a.last=u)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=fl(),t.sibling=null,e=qt.current,Z(qt,n?e&1|2:e&1),St&&Zl(l,a.treeForkCount),t):(Ut(l),null);case 22:case 23:return yl(l),ac(),a=l.memoizedState!==null,t!==null?t.memoizedState!==null!==a&&(l.flags|=8192):a&&(l.flags|=8192),a?(e&536870912)!==0&&(l.flags&128)===0&&(Ut(l),l.subtreeFlags&6&&(l.flags|=8192)):Ut(l),e=l.updateQueue,e!==null&&Au(l,e.retryQueue),e=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),a=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(a=l.memoizedState.cachePool.pool),a!==e&&(l.flags|=2048),t!==null&&C(Qe),null;case 24:return e=null,t!==null&&(e=t.memoizedState.cache),l.memoizedState.cache!==e&&(l.flags|=2048),Kl(Lt),Ut(l),null;case 25:return null;case 30:return null}throw Error(o(156,l.tag))}function Bm(t,l){switch(Qi(l),l.tag){case 1:return t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 3:return Kl(Lt),Ot(),t=l.flags,(t&65536)!==0&&(t&128)===0?(l.flags=t&-65537|128,l):null;case 26:case 27:case 5:return Bl(l),null;case 31:if(l.memoizedState!==null){if(yl(l),l.alternate===null)throw Error(o(340));Xe()}return t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 13:if(yl(l),t=l.memoizedState,t!==null&&t.dehydrated!==null){if(l.alternate===null)throw Error(o(340));Xe()}return t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 19:return C(qt),null;case 4:return Ot(),null;case 10:return Kl(l.type),null;case 22:case 23:return yl(l),ac(),t!==null&&C(Qe),t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 24:return Kl(Lt),null;case 25:return null;default:return null}}function cr(t,l){switch(Qi(l),l.tag){case 3:Kl(Lt),Ot();break;case 26:case 27:case 5:Bl(l);break;case 4:Ot();break;case 31:l.memoizedState!==null&&yl(l);break;case 13:yl(l);break;case 19:C(qt);break;case 10:Kl(l.type);break;case 22:case 23:yl(l),ac(),t!==null&&C(Qe);break;case 24:Kl(Lt)}}function gn(t,l){try{var e=l.updateQueue,a=e!==null?e.lastEffect:null;if(a!==null){var n=a.next;e=n;do{if((e.tag&t)===t){a=void 0;var u=e.create,c=e.inst;a=u(),c.destroy=a}e=e.next}while(e!==n)}}catch(f){At(l,l.return,f)}}function ve(t,l,e){try{var a=l.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var u=n.next;a=u;do{if((a.tag&t)===t){var c=a.inst,f=c.destroy;if(f!==void 0){c.destroy=void 0,n=l;var r=e,j=f;try{j()}catch(D){At(n,r,D)}}}a=a.next}while(a!==u)}}catch(D){At(l,l.return,D)}}function sr(t){var l=t.updateQueue;if(l!==null){var e=t.stateNode;try{Ff(l,e)}catch(a){At(t,t.return,a)}}}function fr(t,l,e){e.props=ke(t.type,t.memoizedProps),e.state=t.memoizedState;try{e.componentWillUnmount()}catch(a){At(t,l,a)}}function vn(t,l){try{var e=t.ref;if(e!==null){switch(t.tag){case 26:case 27:case 5:var a=t.stateNode;break;case 30:a=t.stateNode;break;default:a=t.stateNode}typeof e=="function"?t.refCleanup=e(a):e.current=a}}catch(n){At(t,l,n)}}function ql(t,l){var e=t.ref,a=t.refCleanup;if(e!==null)if(typeof a=="function")try{a()}catch(n){At(t,l,n)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof e=="function")try{e(null)}catch(n){At(t,l,n)}else e.current=null}function or(t){var l=t.type,e=t.memoizedProps,a=t.stateNode;try{t:switch(l){case"button":case"input":case"select":case"textarea":e.autoFocus&&a.focus();break t;case"img":e.src?a.src=e.src:e.srcSet&&(a.srcset=e.srcSet)}}catch(n){At(t,t.return,n)}}function Bc(t,l,e){try{var a=t.stateNode;a0(a,t.type,e,l),a[el]=l}catch(n){At(t,t.return,n)}}function rr(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ze(t.type)||t.tag===4}function Hc(t){t:for(;;){for(;t.sibling===null;){if(t.return===null||rr(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&ze(t.type)||t.flags&2||t.child===null||t.tag===4)continue t;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Yc(t,l,e){var a=t.tag;if(a===5||a===6)t=t.stateNode,l?(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e).insertBefore(t,l):(l=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.appendChild(t),e=e._reactRootContainer,e!=null||l.onclick!==null||(l.onclick=Gl));else if(a!==4&&(a===27&&ze(t.type)&&(e=t.stateNode,l=null),t=t.child,t!==null))for(Yc(t,l,e),t=t.sibling;t!==null;)Yc(t,l,e),t=t.sibling}function Mu(t,l,e){var a=t.tag;if(a===5||a===6)t=t.stateNode,l?e.insertBefore(t,l):e.appendChild(t);else if(a!==4&&(a===27&&ze(t.type)&&(e=t.stateNode),t=t.child,t!==null))for(Mu(t,l,e),t=t.sibling;t!==null;)Mu(t,l,e),t=t.sibling}function dr(t){var l=t.stateNode,e=t.memoizedProps;try{for(var a=t.type,n=l.attributes;n.length;)l.removeAttributeNode(n[0]);Ft(l,a,e),l[kt]=t,l[el]=e}catch(u){At(t,t.return,u)}}var Fl=!1,wt=!1,qc=!1,hr=typeof WeakSet=="function"?WeakSet:Set,Kt=null;function Hm(t,l){if(t=t.containerInfo,us=Ju,t=zf(t),Ni(t)){if("selectionStart"in t)var e={start:t.selectionStart,end:t.selectionEnd};else t:{e=(e=t.ownerDocument)&&e.defaultView||window;var a=e.getSelection&&e.getSelection();if(a&&a.rangeCount!==0){e=a.anchorNode;var n=a.anchorOffset,u=a.focusNode;a=a.focusOffset;try{e.nodeType,u.nodeType}catch{e=null;break t}var c=0,f=-1,r=-1,j=0,D=0,X=t,A=null;l:for(;;){for(var O;X!==e||n!==0&&X.nodeType!==3||(f=c+n),X!==u||a!==0&&X.nodeType!==3||(r=c+a),X.nodeType===3&&(c+=X.nodeValue.length),(O=X.firstChild)!==null;)A=X,X=O;for(;;){if(X===t)break l;if(A===e&&++j===n&&(f=c),A===u&&++D===a&&(r=c),(O=X.nextSibling)!==null)break;X=A,A=X.parentNode}X=O}e=f===-1||r===-1?null:{start:f,end:r}}else e=null}e=e||{start:0,end:0}}else e=null;for(is={focusedElem:t,selectionRange:e},Ju=!1,Kt=l;Kt!==null;)if(l=Kt,t=l.child,(l.subtreeFlags&1028)!==0&&t!==null)t.return=l,Kt=t;else for(;Kt!==null;){switch(l=Kt,u=l.alternate,t=l.flags,l.tag){case 0:if((t&4)!==0&&(t=l.updateQueue,t=t!==null?t.events:null,t!==null))for(e=0;e title"))),Ft(u,a,e),u[kt]=t,Vt(u),a=u;break t;case"link":var c=xd("link","href",n).get(a+(e.href||""));if(c){for(var f=0;fCt&&(c=Ct,Ct=ct,ct=c);var b=_f(f,ct),y=_f(f,Ct);if(b&&y&&(O.rangeCount!==1||O.anchorNode!==b.node||O.anchorOffset!==b.offset||O.focusNode!==y.node||O.focusOffset!==y.offset)){var _=X.createRange();_.setStart(b.node,b.offset),O.removeAllRanges(),ct>Ct?(O.addRange(_),O.extend(y.node,y.offset)):(_.setEnd(y.node,y.offset),O.addRange(_))}}}}for(X=[],O=f;O=O.parentNode;)O.nodeType===1&&X.push({element:O,left:O.scrollLeft,top:O.scrollTop});for(typeof f.focus=="function"&&f.focus(),f=0;fe?32:e,z.T=null,e=Vc,Vc=null;var u=Se,c=ee;if(Zt=0,Aa=Se=null,ee=0,(zt&6)!==0)throw Error(o(331));var f=zt;if(zt|=4,zr(u.current),Sr(u,u.current,c,e),zt=f,jn(0,!1),ol&&typeof ol.onPostCommitFiberRoot=="function")try{ol.onPostCommitFiberRoot(La,u)}catch{}return!0}finally{h.p=n,z.T=a,Qr(t,l)}}function Zr(t,l,e){l=jl(e,l),l=zc(t.stateNode,l,2),t=me(t,l,2),t!==null&&(Qa(t,2),Xl(t))}function At(t,l,e){if(t.tag===3)Zr(t,t,e);else for(;l!==null;){if(l.tag===3){Zr(l,t,e);break}else if(l.tag===1){var a=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(be===null||!be.has(a))){t=jl(e,t),e=Vo(2),a=me(l,e,2),a!==null&&(Ko(e,a,l,t),Qa(a,2),Xl(a));break}}l=l.return}}function $c(t,l,e){var a=t.pingCache;if(a===null){a=t.pingCache=new Xm;var n=new Set;a.set(l,n)}else n=a.get(l),n===void 0&&(n=new Set,a.set(l,n));n.has(e)||(Gc=!0,n.add(e),t=Zm.bind(null,t,l,e),l.then(t,t))}function Zm(t,l,e){var a=t.pingCache;a!==null&&a.delete(l),t.pingedLanes|=t.suspendedLanes&e,t.warmLanes&=~e,Nt===t&&(xt&e)===e&&(Yt===4||Yt===3&&(xt&62914560)===xt&&300>fl()-Ou?(zt&2)===0&&Ma(t,0):Qc|=e,Ea===xt&&(Ea=0)),Xl(t)}function Vr(t,l){l===0&&(l=Ys()),t=Ye(t,l),t!==null&&(Qa(t,l),Xl(t))}function Vm(t){var l=t.memoizedState,e=0;l!==null&&(e=l.retryLane),Vr(t,e)}function Km(t,l){var e=0;switch(t.tag){case 31:case 13:var a=t.stateNode,n=t.memoizedState;n!==null&&(e=n.retryLane);break;case 19:a=t.stateNode;break;case 22:a=t.stateNode._retryCache;break;default:throw Error(o(314))}a!==null&&a.delete(l),Vr(t,e)}function km(t,l){return si(t,l)}var Yu=null,Ca=null,Wc=!1,qu=!1,Fc=!1,je=0;function Xl(t){t!==Ca&&t.next===null&&(Ca===null?Yu=Ca=t:Ca=Ca.next=t),qu=!0,Wc||(Wc=!0,$m())}function jn(t,l){if(!Fc&&qu){Fc=!0;do for(var e=!1,a=Yu;a!==null;){if(t!==0){var n=a.pendingLanes;if(n===0)var u=0;else{var c=a.suspendedLanes,f=a.pingedLanes;u=(1<<31-rl(42|t)+1)-1,u&=n&~(c&~f),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(e=!0,$r(a,u))}else u=xt,u=Qn(a,a===Nt?u:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(u&3)===0||Ga(a,u)||(e=!0,$r(a,u));a=a.next}while(e);Fc=!1}}function Jm(){Kr()}function Kr(){qu=Wc=!1;var t=0;je!==0&&u0()&&(t=je);for(var l=fl(),e=null,a=Yu;a!==null;){var n=a.next,u=kr(a,l);u===0?(a.next=null,e===null?Yu=n:e.next=n,n===null&&(Ca=e)):(e=a,(t!==0||(u&3)!==0)&&(qu=!0)),a=n}Zt!==0&&Zt!==5||jn(t),je!==0&&(je=0)}function kr(t,l){for(var e=t.suspendedLanes,a=t.pingedLanes,n=t.expirationTimes,u=t.pendingLanes&-62914561;0f)break;var D=r.transferSize,X=r.initiatorType;D&&ad(X)&&(r=r.responseEnd,c+=D*(r"u"?null:document;function yd(t,l,e){var a=Oa;if(a&&typeof l=="string"&&l){var n=Sl(l);n='link[rel="'+t+'"][href="'+n+'"]',typeof e=="string"&&(n+='[crossorigin="'+e+'"]'),md.has(n)||(md.add(n),t={rel:t,crossOrigin:e,href:l},a.querySelector(n)===null&&(l=a.createElement("link"),Ft(l,"link",t),Vt(l),a.head.appendChild(l)))}}function m0(t){ae.D(t),yd("dns-prefetch",t,null)}function y0(t,l){ae.C(t,l),yd("preconnect",t,l)}function g0(t,l,e){ae.L(t,l,e);var a=Oa;if(a&&t&&l){var n='link[rel="preload"][as="'+Sl(l)+'"]';l==="image"&&e&&e.imageSrcSet?(n+='[imagesrcset="'+Sl(e.imageSrcSet)+'"]',typeof e.imageSizes=="string"&&(n+='[imagesizes="'+Sl(e.imageSizes)+'"]')):n+='[href="'+Sl(t)+'"]';var u=n;switch(l){case"style":u=Na(t);break;case"script":u=Ra(t)}Cl.has(u)||(t=U({rel:"preload",href:l==="image"&&e&&e.imageSrcSet?void 0:t,as:l},e),Cl.set(u,t),a.querySelector(n)!==null||l==="style"&&a.querySelector(Mn(u))||l==="script"&&a.querySelector(Tn(u))||(l=a.createElement("link"),Ft(l,"link",t),Vt(l),a.head.appendChild(l)))}}function v0(t,l){ae.m(t,l);var e=Oa;if(e&&t){var a=l&&typeof l.as=="string"?l.as:"script",n='link[rel="modulepreload"][as="'+Sl(a)+'"][href="'+Sl(t)+'"]',u=n;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=Ra(t)}if(!Cl.has(u)&&(t=U({rel:"modulepreload",href:t},l),Cl.set(u,t),e.querySelector(n)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(e.querySelector(Tn(u)))return}a=e.createElement("link"),Ft(a,"link",t),Vt(a),e.head.appendChild(a)}}}function p0(t,l,e){ae.S(t,l,e);var a=Oa;if(a&&t){var n=Pe(a).hoistableStyles,u=Na(t);l=l||"default";var c=n.get(u);if(!c){var f={loading:0,preload:null};if(c=a.querySelector(Mn(u)))f.loading=5;else{t=U({rel:"stylesheet",href:t,"data-precedence":l},e),(e=Cl.get(u))&&hs(t,e);var r=c=a.createElement("link");Vt(r),Ft(r,"link",t),r._p=new Promise(function(j,D){r.onload=j,r.onerror=D}),r.addEventListener("load",function(){f.loading|=1}),r.addEventListener("error",function(){f.loading|=2}),f.loading|=4,wu(c,l,a)}c={type:"stylesheet",instance:c,count:1,state:f},n.set(u,c)}}}function x0(t,l){ae.X(t,l);var e=Oa;if(e&&t){var a=Pe(e).hoistableScripts,n=Ra(t),u=a.get(n);u||(u=e.querySelector(Tn(n)),u||(t=U({src:t,async:!0},l),(l=Cl.get(n))&&ms(t,l),u=e.createElement("script"),Vt(u),Ft(u,"link",t),e.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(n,u))}}function b0(t,l){ae.M(t,l);var e=Oa;if(e&&t){var a=Pe(e).hoistableScripts,n=Ra(t),u=a.get(n);u||(u=e.querySelector(Tn(n)),u||(t=U({src:t,async:!0,type:"module"},l),(l=Cl.get(n))&&ms(t,l),u=e.createElement("script"),Vt(u),Ft(u,"link",t),e.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(n,u))}}function gd(t,l,e,a){var n=(n=st.current)?Qu(n):null;if(!n)throw Error(o(446));switch(t){case"meta":case"title":return null;case"style":return typeof e.precedence=="string"&&typeof e.href=="string"?(l=Na(e.href),e=Pe(n).hoistableStyles,a=e.get(l),a||(a={type:"style",instance:null,count:0,state:null},e.set(l,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(e.rel==="stylesheet"&&typeof e.href=="string"&&typeof e.precedence=="string"){t=Na(e.href);var u=Pe(n).hoistableStyles,c=u.get(t);if(c||(n=n.ownerDocument||n,c={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(t,c),(u=n.querySelector(Mn(t)))&&!u._p&&(c.instance=u,c.state.loading=5),Cl.has(t)||(e={rel:"preload",as:"style",href:e.href,crossOrigin:e.crossOrigin,integrity:e.integrity,media:e.media,hrefLang:e.hrefLang,referrerPolicy:e.referrerPolicy},Cl.set(t,e),u||S0(n,t,e,c.state))),l&&a===null)throw Error(o(528,""));return c}if(l&&a!==null)throw Error(o(529,""));return null;case"script":return l=e.async,e=e.src,typeof e=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=Ra(e),e=Pe(n).hoistableScripts,a=e.get(l),a||(a={type:"script",instance:null,count:0,state:null},e.set(l,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,t))}}function Na(t){return'href="'+Sl(t)+'"'}function Mn(t){return'link[rel="stylesheet"]['+t+"]"}function vd(t){return U({},t,{"data-precedence":t.precedence,precedence:null})}function S0(t,l,e,a){t.querySelector('link[rel="preload"][as="style"]['+l+"]")?a.loading=1:(l=t.createElement("link"),a.preload=l,l.addEventListener("load",function(){return a.loading|=1}),l.addEventListener("error",function(){return a.loading|=2}),Ft(l,"link",e),Vt(l),t.head.appendChild(l))}function Ra(t){return'[src="'+Sl(t)+'"]'}function Tn(t){return"script[async]"+t}function pd(t,l,e){if(l.count++,l.instance===null)switch(l.type){case"style":var a=t.querySelector('style[data-href~="'+Sl(e.href)+'"]');if(a)return l.instance=a,Vt(a),a;var n=U({},e,{"data-href":e.href,"data-precedence":e.precedence,href:null,precedence:null});return a=(t.ownerDocument||t).createElement("style"),Vt(a),Ft(a,"style",n),wu(a,e.precedence,t),l.instance=a;case"stylesheet":n=Na(e.href);var u=t.querySelector(Mn(n));if(u)return l.state.loading|=4,l.instance=u,Vt(u),u;a=vd(e),(n=Cl.get(n))&&hs(a,n),u=(t.ownerDocument||t).createElement("link"),Vt(u);var c=u;return c._p=new Promise(function(f,r){c.onload=f,c.onerror=r}),Ft(u,"link",a),l.state.loading|=4,wu(u,e.precedence,t),l.instance=u;case"script":return u=Ra(e.src),(n=t.querySelector(Tn(u)))?(l.instance=n,Vt(n),n):(a=e,(n=Cl.get(u))&&(a=U({},e),ms(a,n)),t=t.ownerDocument||t,n=t.createElement("script"),Vt(n),Ft(n,"link",a),t.head.appendChild(n),l.instance=n);case"void":return null;default:throw Error(o(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(a=l.instance,l.state.loading|=4,wu(a,e.precedence,t));return l.instance}function wu(t,l,e){for(var a=e.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),n=a.length?a[a.length-1]:null,u=n,c=0;c title"):null)}function _0(t,l,e){if(e===1||l.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return t=l.disabled,typeof l.precedence=="string"&&t==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function Sd(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function j0(t,l,e,a){if(e.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(e.state.loading&4)===0){if(e.instance===null){var n=Na(a.href),u=l.querySelector(Mn(n));if(u){l=u._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(t.count++,t=Vu.bind(t),l.then(t,t)),e.state.loading|=4,e.instance=u,Vt(u);return}u=l.ownerDocument||l,a=vd(a),(n=Cl.get(n))&&hs(a,n),u=u.createElement("link"),Vt(u);var c=u;c._p=new Promise(function(f,r){c.onload=f,c.onerror=r}),Ft(u,"link",a),e.instance=u}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(e,l),(l=e.state.preload)&&(e.state.loading&3)===0&&(t.count++,e=Vu.bind(t),l.addEventListener("load",e),l.addEventListener("error",e))}}var ys=0;function z0(t,l){return t.stylesheets&&t.count===0&&ku(t,t.stylesheets),0ys?50:800)+l);return t.unsuspend=e,function(){t.unsuspend=null,clearTimeout(a),clearTimeout(n)}}:null}function Vu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ku(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Ku=null;function ku(t,l){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Ku=new Map,l.forEach(E0,t),Ku=null,Vu.call(t))}function E0(t,l){if(!(l.state.loading&4)){var e=Ku.get(t);if(e)var a=e.get(null);else{e=new Map,Ku.set(t,e);for(var n=t.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(p){console.error(p)}}return s(),zs.exports=Q0(),zs.exports}var Z0=w0();const V0="modulepreload",K0=function(s){return"/v2/"+s},Vd={},k0=function(p,S,o){let d=Promise.resolve();if(S&&S.length>0){let E=function(v){return Promise.all(v.map(Y=>Promise.resolve(Y).then(U=>({status:"fulfilled",value:U}),U=>({status:"rejected",reason:U}))))};document.getElementsByTagName("link");const R=document.querySelector("meta[property=csp-nonce]"),g=(R==null?void 0:R.nonce)||(R==null?void 0:R.getAttribute("nonce"));d=E(S.map(v=>{if(v=K0(v),v in Vd)return;Vd[v]=!0;const Y=v.endsWith(".css"),U=Y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${v}"]${U}`))return;const L=document.createElement("link");if(L.rel=Y?"stylesheet":V0,Y||(L.as="script"),L.crossOrigin="",L.href=v,g&&L.setAttribute("nonce",g),document.head.appendChild(L),Y)return new Promise((lt,W)=>{L.addEventListener("load",lt),L.addEventListener("error",()=>W(new Error(`Unable to preload CSS for ${v}`)))})}))}function x(E){const R=new Event("vite:preloadError",{cancelable:!0});if(R.payload=E,window.dispatchEvent(R),!R.defaultPrevented)throw E}return d.then(E=>{for(const R of E||[])R.status==="rejected"&&x(R.reason);return p().catch(x)})},J0="/api";async function Pt(s){const p=await fetch(`${J0}${s}`,{credentials:"include"});if(!p.ok)throw new Error(`API ${s}: ${p.status}`);return p.json()}function $0(){return`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/api/ws/live`}const ch=N.createContext({windows:[],openWindow:()=>{},closeWindow:()=>{},bringToFront:()=>{}}),W0=({children:s})=>{const[p,S]=N.useState([]),o=N.useRef(1e4),d=N.useCallback((R,g,v)=>{S(Y=>Y.find(L=>L.id===R)?Y.map(L=>L.id===R?{...L,zIndex:++o.current}:L):[...Y,{id:R,title:g,charName:v,zIndex:++o.current}])},[]),x=N.useCallback(R=>{S(g=>g.filter(v=>v.id!==R))},[]),E=N.useCallback(R=>{S(g=>g.map(v=>v.id===R?{...v,zIndex:++o.current}:v))},[]);return i.jsx(ch.Provider,{value:{windows:p,openWindow:d,closeWindow:x,bringToFront:E},children:s})},ni=()=>N.useContext(ch),Ol={west:-102.1,east:102.1,north:102.1,south:-102.1};function Yn(s,p,S,o){const d=(s-Ol.west)/(Ol.east-Ol.west)*S,x=(Ol.north-p)/(Ol.north-Ol.south)*o;return{x:d,y:x}}function F0(s,p,S,o,d,x,E){const R=(s-o)/S,g=(p-d)/S,v=Ol.west+R/x*(Ol.east-Ol.west),Y=Ol.north-g/E*(Ol.north-Ol.south);return{ew:v,ns:Y}}function Ns(s,p){const S=s>=0?"N":"S",o=p>=0?"E":"W";return`${Math.abs(s).toFixed(1)}${S}, ${Math.abs(p).toFixed(1)}${o}`}const sh=ai.memo(({players:s,imgW:p,imgH:S,getColor:o,onHover:d,onSelect:x,selectedPlayer:E})=>{const R=N.useMemo(()=>s.filter(g=>g.ew!==void 0&&g.ns!==void 0).map(g=>({...g,pos:Yn(g.ew,g.ns,p,S),color:o(g.character_name)})),[s,p,S,o]);return i.jsx("div",{className:"ml-dots-layer",children:R.map(g=>i.jsx("div",{className:`ml-dot ${E===g.character_name?"ml-dot-selected":""}`,style:{left:g.pos.x,top:g.pos.y,backgroundColor:g.color},onMouseEnter:v=>{var U;const Y=(U=v.currentTarget.closest(".ml-map-container"))==null?void 0:U.getBoundingClientRect();Y&&d(g,v.clientX-Y.left,v.clientY-Y.top)},onMouseLeave:()=>d(null,0,0),onClick:()=>x(g.character_name)},g.character_name))})});sh.displayName="PlayerDots";const fh=ai.memo(({imgW:s,imgH:p,getColor:S})=>{const[o,d]=N.useState([]);N.useEffect(()=>{const E=async()=>{try{const g=await Pt("/trails/?seconds=600");d(g.trails??[])}catch{}};E();const R=setInterval(E,2e3);return()=>clearInterval(R)},[]);const x=N.useMemo(()=>{const E={};for(const R of o){const{x:g,y:v}=Yn(R.ew,R.ns,s,p);E[R.character_name]||(E[R.character_name]=[]),E[R.character_name].push(`${g},${v}`)}return Object.entries(E).filter(([,R])=>R.length>=2).map(([R,g])=>({name:R,points:g.join(" ")}))},[o,s,p]);return i.jsx("svg",{className:"ml-trails-svg",viewBox:`0 0 ${s} ${p}`,preserveAspectRatio:"none",children:x.map(E=>i.jsx("polyline",{points:E.points,stroke:S(E.name),fill:"none",strokeWidth:2,strokeOpacity:.7,strokeLinecap:"round",strokeLinejoin:"round"},E.name))})});fh.displayName="TrailsSVG";const I0=({imgW:s,imgH:p,enabled:S})=>{const o=N.useRef(null),[d,x]=N.useState([]);return N.useEffect(()=>{if(!S)return;(async()=>{try{const R=await Pt("/spawns/heatmap?hours=24&limit=50000");x(R.spawn_points??[])}catch{}})()},[S]),N.useEffect(()=>{const E=o.current;if(!E||!S||d.length===0||s===0)return;E.width=s,E.height=p;const R=E.getContext("2d");if(R){R.clearRect(0,0,s,p);for(const g of d){const{x:v,y:Y}=Yn(g.ew,g.ns,s,p),U=Math.max(5,Math.min(12,5+Math.sqrt(g.intensity*.5))),L=R.createRadialGradient(v,Y,0,v,Y,U);L.addColorStop(0,`rgba(255, 0, 0, ${Math.min(.9,g.intensity/40)})`),L.addColorStop(.6,`rgba(255, 100, 0, ${Math.min(.4,g.intensity/120)})`),L.addColorStop(1,"rgba(255, 150, 0, 0)"),R.fillStyle=L,R.fillRect(v-U,Y-U,U*2,U*2)}}},[d,s,p,S]),S?i.jsx("canvas",{ref:o,className:"ml-heatmap-canvas"}):null},P0=({imgW:s,imgH:p,enabled:S})=>{const[o,d]=N.useState([]);N.useEffect(()=>{if(!S)return;const E=async()=>{try{const g=await Pt("/portals");d(g.portals??[])}catch{}};E();const R=setInterval(E,6e4);return()=>clearInterval(R)},[S]);const x=N.useMemo(()=>o.map(E=>({...E,pos:Yn(E.coordinates.ew,E.coordinates.ns,s,p)})),[o,s,p]);return!S||x.length===0?null:i.jsx("div",{className:"ml-portals-layer",children:x.map((E,R)=>i.jsx("div",{className:"ml-portal-icon",style:{left:E.pos.x,top:E.pos.y},title:`${E.portal_name} (by ${E.discovered_by})`},R))})},Kd=20,kd=.3,ty=({players:s,getColor:p,onSelectPlayer:S,showHeatmap:o,showPortals:d,selectedPlayer:x})=>{var k;const E=N.useRef(null),R=N.useRef(null),[g,v]=N.useState({w:0,h:0}),[Y,U]=N.useState(null),[L,lt]=N.useState(null),W=N.useRef({scale:1,offX:0,offY:0}),et=N.useRef({dragging:!1,sx:0,sy:0,startOffX:0,startOffY:0}),mt=N.useCallback(()=>{if(R.current){const{scale:q,offX:T,offY:G}=W.current;R.current.style.transform=`translate(${T}px, ${G}px) scale(${q})`}},[]),I=N.useCallback(q=>{const T=q.currentTarget;if(v({w:T.naturalWidth,h:T.naturalHeight}),E.current){const G=E.current.clientWidth,tt=E.current.clientHeight,K=Math.min(G/T.naturalWidth,tt/T.naturalHeight);W.current={scale:K,offX:(G-T.naturalWidth*K)/2,offY:(tt-T.naturalHeight*K)/2},mt()}},[mt]),M=N.useCallback(q=>{var w;q.preventDefault();const T=(w=E.current)==null?void 0:w.getBoundingClientRect();if(!T)return;const G=W.current,tt=q.deltaY<0?1.1:.9,K=Math.min(Kd,Math.max(kd,G.scale*tt)),ut=K/G.scale,ot=q.clientX-T.left,gt=q.clientY-T.top;W.current={scale:K,offX:ot-(ot-G.offX)*ut,offY:gt-(gt-G.offY)*ut},mt()},[mt]),F=N.useCallback(q=>{if(q.button!==0)return;const T=W.current;et.current={dragging:!0,sx:q.clientX,sy:q.clientY,startOffX:T.offX,startOffY:T.offY}},[]);N.useEffect(()=>{const q=G=>{const tt=et.current;if(tt.dragging&&(W.current.offX=tt.startOffX+(G.clientX-tt.sx),W.current.offY=tt.startOffY+(G.clientY-tt.sy),mt()),E.current&&g.w>0){const K=E.current.getBoundingClientRect(),ut=W.current,ot=F0(G.clientX-K.left,G.clientY-K.top,ut.scale,ut.offX,ut.offY,g.w,g.h);lt(ot)}},T=()=>{et.current.dragging=!1};return window.addEventListener("mousemove",q),window.addEventListener("mouseup",T),()=>{window.removeEventListener("mousemove",q),window.removeEventListener("mouseup",T)}},[mt,g.w,g.h]),N.useEffect(()=>{if(!x||g.w===0||!E.current)return;const q=s.find(ut=>ut.character_name===x);if(!q)return;const{x:T,y:G}=Yn(q.ew,q.ns,g.w,g.h),tt=E.current.getBoundingClientRect(),K=3;W.current={scale:Math.min(Kd,Math.max(kd,K)),offX:tt.width/2-T*K,offY:tt.height/2-G*K},mt()},[x,s,g.w,g.h,mt]);const Q=N.useCallback((q,T,G)=>{U(q?{x:T,y:G,player:q}:null)},[]);return i.jsxs("div",{className:"ml-map-container",ref:E,onWheel:M,onMouseDown:F,children:[i.jsxs("div",{ref:R,className:"ml-map-group",children:[i.jsx("img",{src:"/dereth.png",alt:"Dereth",className:"ml-map-img",onLoad:I,draggable:!1}),g.w>0&&i.jsxs(i.Fragment,{children:[i.jsx(I0,{imgW:g.w,imgH:g.h,enabled:o}),i.jsx(fh,{imgW:g.w,imgH:g.h,getColor:p}),i.jsx(sh,{players:s,imgW:g.w,imgH:g.h,getColor:p,onHover:Q,onSelect:S,selectedPlayer:x}),i.jsx(P0,{imgW:g.w,imgH:g.h,enabled:d})]})]}),Y&&i.jsxs("div",{className:"ml-tooltip",style:{left:Y.x+12,top:Y.y-10},children:[i.jsx("strong",{children:Y.player.character_name}),i.jsx("br",{}),Ns(Y.player.ns,Y.player.ew),i.jsx("br",{}),Y.player.kills_per_hour," kph · ",(k=Y.player.kills)==null?void 0:k.toLocaleString()," kills"]}),L&&i.jsx("div",{className:"ml-coords",children:Ns(L.ns,L.ew)})]})},oh=ai.memo(({player:s,vitals:p,color:S,onSelect:o})=>{var v,Y;const{openWindow:d}=ni(),x=(s.vt_state||"idle").toLowerCase(),E=x==="combat"||x==="hunt",R=(s.total_rares??0)>0?Math.round((s.total_kills??0)/(s.total_rares??1)).toLocaleString():null,g=s.character_name;return i.jsxs("li",{className:"ml-player-row",style:{borderLeftColor:S},children:[i.jsxs("div",{className:"ml-pr-header",onClick:o,children:[i.jsx("span",{className:"ml-pr-name",children:g}),i.jsx("span",{className:"ml-pr-coords",children:Ns(s.ns,s.ew)})]}),i.jsxs("div",{className:"ml-pr-vitals",children:[i.jsx("div",{className:"ml-vital-bar hp",children:i.jsx("div",{className:"ml-vital-fill",style:{width:`${(p==null?void 0:p.health_percentage)??0}%`}})}),i.jsx("div",{className:"ml-vital-bar sta",children:i.jsx("div",{className:"ml-vital-fill",style:{width:`${(p==null?void 0:p.stamina_percentage)??0}%`}})}),i.jsx("div",{className:"ml-vital-bar mana",children:i.jsx("div",{className:"ml-vital-fill",style:{width:`${(p==null?void 0:p.mana_percentage)??0}%`}})})]}),i.jsxs("div",{className:"ml-pr-grid",children:[i.jsxs("span",{className:"ml-gs",title:"Session kills",children:["⚔️ ",((v=s.kills)==null?void 0:v.toLocaleString())??0]}),i.jsxs("span",{className:"ml-gs",title:"Total kills",children:["🏆 ",(s.total_kills??0).toLocaleString()]}),i.jsxs("span",{className:"ml-gs",title:"Kills per hour",children:[s.kills_per_hour??"0"," ",i.jsx("span",{className:"ml-suffix",children:"KPH"})]}),i.jsxs("span",{className:"ml-gs",title:"Rares (session / total)",children:["💎 ",s.session_rares??0," / ",s.total_rares??0]}),i.jsx("span",{className:"ml-gs",title:"Kills per rare",children:R?i.jsxs(i.Fragment,{children:["📊 ",R," ",i.jsx("span",{className:"ml-suffix",children:"KPR"})]}):""}),i.jsx("span",{className:`ml-meta-pill ${E?"active":""}`,children:s.vt_state||"idle"}),i.jsxs("span",{className:"ml-gs",title:"Online time",children:["🕐 ",((Y=s.onlinetime)==null?void 0:Y.replace(/^00\./,""))??"--"]}),i.jsxs("span",{className:"ml-gs",title:"Deaths",children:["☠️ ",s.deaths??"0"]}),i.jsxs("span",{className:"ml-gs",title:"Prismatic tapers",children:[i.jsx("img",{src:"/prismatic-taper-icon.png",className:"ml-taper-icon",alt:""}),s.prismatic_taper_count??"0"]})]}),i.jsxs("div",{className:"ml-pr-buttons",children:[i.jsx("button",{className:"ml-btn accent",onClick:()=>d(`chat-${g}`,`Chat: ${g}`,g),children:"Chat"}),i.jsx("button",{className:"ml-btn accent",onClick:()=>d(`stats-${g}`,`Stats: ${g}`,g),children:"Stats"}),i.jsx("button",{className:"ml-btn accent",onClick:()=>d(`inv-${g}`,`Inventory: ${g}`,g),children:"Inv"}),i.jsx("button",{className:"ml-btn",onClick:()=>d(`char-${g}`,`Character: ${g}`,g),children:"Char"}),i.jsx("button",{className:"ml-btn",onClick:()=>d(`combat-${g}`,`Combat: ${g}`,g),children:"Combat"}),i.jsx("button",{className:"ml-btn",onClick:()=>d(`radar-${g}`,`Radar: ${g}`,g),children:"Radar"})]})]})});oh.displayName="PlayerRow";const ly=({players:s,vitals:p,getColor:S,onSelect:o})=>i.jsx("ul",{className:"ml-player-list",children:s.map(d=>i.jsx(oh,{player:d,vitals:p.get(d.character_name)??null,color:S(d.character_name),onSelect:()=>o(d.character_name)},d.character_name))}),ey=[{key:"name",label:"Name"},{key:"kph",label:"KPH"},{key:"skills",label:"S.Kills"},{key:"srares",label:"S.Rares"},{key:"tkills",label:"T.Kills"},{key:"kpr",label:"KPR"}],ay=({value:s,onChange:p})=>i.jsx("div",{className:"ml-sort-buttons",children:ey.map(S=>i.jsx("button",{className:`ml-sort-btn ${s===S.key?"active":""}`,onClick:()=>p(S.key),children:S.label},S.key))}),ny=()=>{const{openWindow:s}=ni();return i.jsxs("div",{className:"ml-tool-links",children:[i.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},onClick:()=>s("issues","Issues Board"),children:"📋 Issues"}),i.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},onClick:()=>s("vitalsharing","Vital Sharing"),children:"🤝 Vitals"}),i.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},onClick:()=>s("combatpicker","Combat Stats"),children:"⚔️ Combat"})]})},uy=({players:s,vitals:p,serverHealth:S,totalRares:o,totalKills:d,getColor:x,onSelectPlayer:E,onViewToggle:R,showHeatmap:g,showPortals:v,onToggleHeatmap:Y,onTogglePortals:U})=>{var Q,k;const[L,lt]=N.useState("name"),[W,et]=N.useState(""),mt=N.useMemo(()=>s.reduce((q,T)=>q+(parseInt(T.kills_per_hour)||0),0),[s]),I=((Q=S==null?void 0:S.status)==null?void 0:Q.toLowerCase())==="online"||((k=S==null?void 0:S.status)==null?void 0:k.toLowerCase())==="up",M=N.useDeferredValue(s),F=N.useMemo(()=>{let q=[...M];switch(W&&(q=q.filter(T=>T.character_name.toLowerCase().startsWith(W.toLowerCase()))),L){case"kph":q.sort((T,G)=>(parseInt(G.kills_per_hour)||0)-(parseInt(T.kills_per_hour)||0));break;case"skills":q.sort((T,G)=>(G.kills||0)-(T.kills||0));break;case"srares":q.sort((T,G)=>(G.session_rares??0)-(T.session_rares??0));break;case"tkills":q.sort((T,G)=>(G.total_kills??0)-(T.total_kills??0));break;case"kpr":q.sort((T,G)=>{const tt=(T.total_kills??0)/Math.max(1,T.total_rares??1),K=(G.total_kills??0)/Math.max(1,G.total_rares??1);return tt-K});break;default:q.sort((T,G)=>T.character_name.localeCompare(G.character_name))}return q},[M,L,W]);return i.jsxs("div",{className:"ml-sidebar",children:[i.jsxs("div",{className:"ml-sidebar-header",children:[i.jsxs("span",{className:"ml-sidebar-title",children:["Active Mosswart Enjoyers (",s.length,")"]}),i.jsx("button",{className:"ml-view-toggle",onClick:R,children:"Dashboard"})]}),i.jsxs("div",{className:"ml-server-status",children:[i.jsx("span",{className:`ml-status-dot ${I?"online":"offline"}`}),i.jsxs("span",{className:"ml-status-text",children:["Coldeve ",I?"Online":"Offline"]}),(S==null?void 0:S.player_count)!=null&&i.jsxs("span",{className:"ml-status-detail",children:["👥 ",S.player_count]}),(S==null?void 0:S.latency_ms)!=null&&i.jsxs("span",{className:"ml-status-detail",children:[Math.round(S.latency_ms),"ms"]}),(S==null?void 0:S.uptime_seconds)!=null&&i.jsxs("span",{className:"ml-status-detail",children:["Up: ",Math.floor(S.uptime_seconds/3600),"h"]})]}),i.jsxs("div",{className:"ml-counters",children:[i.jsxs("div",{className:"ml-counter rares",children:[i.jsx("span",{className:"ml-counter-val",children:o}),i.jsx("span",{className:"ml-counter-lbl",children:"Rares"})]}),i.jsxs("div",{className:`ml-counter kph ${mt>5e3?"ultra":""}`,children:[i.jsx("span",{className:"ml-counter-val",children:mt.toLocaleString()}),i.jsx("span",{className:"ml-counter-lbl",children:"Server KPH"})]}),i.jsxs("div",{className:"ml-counter kills",children:[i.jsx("span",{className:"ml-counter-val",children:d.toLocaleString()}),i.jsx("span",{className:"ml-counter-lbl",children:"Kills"})]})]}),i.jsxs("div",{className:"ml-tool-links",children:[i.jsx("a",{href:"/inventory.html",className:"ml-tool-link",children:"🔍 Inv Search"}),i.jsx("a",{href:"/suitbuilder.html",className:"ml-tool-link",children:"🛡️ Suitbuilder"}),i.jsx("a",{href:"/debug.html",className:"ml-tool-link",children:"🐛 Debug"}),i.jsx("a",{href:"/quest-status.html",target:"_blank",className:"ml-tool-link",children:"📜 Quests"})]}),i.jsx(ny,{}),i.jsxs("div",{className:"ml-toggles",children:[i.jsxs("label",{className:"ml-toggle-label",children:[i.jsx("input",{type:"checkbox",checked:g,onChange:q=>Y(q.target.checked)}),i.jsx("span",{children:"Spawn Heatmap"})]}),i.jsxs("label",{className:"ml-toggle-label",children:[i.jsx("input",{type:"checkbox",checked:v,onChange:q=>U(q.target.checked)}),i.jsx("span",{children:"Portals"})]})]}),i.jsx(ay,{value:L,onChange:lt}),i.jsx("input",{className:"ml-filter",type:"text",placeholder:"Filter players...",value:W,onChange:q=>et(q.target.value)}),i.jsx(ly,{players:F,vitals:p,getColor:x,onSelect:E})]})},ne=({id:s,title:p,zIndex:S,width:o=700,height:d=340,children:x})=>{const{closeWindow:E,bringToFront:R}=ni(),g=N.useRef(null),v=N.useRef({dragging:!1,sx:0,sy:0,ox:0,oy:0}),Y=N.useRef({x:420,y:10+Math.random()*40}),U=N.useCallback(L=>{var W;L.preventDefault(),R(s);const lt=(W=g.current)==null?void 0:W.getBoundingClientRect();lt&&(v.current={dragging:!0,sx:L.clientX,sy:L.clientY,ox:lt.left,oy:lt.top})},[s,R]);return N.useEffect(()=>{const L=W=>{const et=v.current;!et.dragging||!g.current||(Y.current.x=et.ox+(W.clientX-et.sx),Y.current.y=et.oy+(W.clientY-et.sy),g.current.style.left=`${Y.current.x}px`,g.current.style.top=`${Y.current.y}px`)},lt=()=>{v.current.dragging=!1};return window.addEventListener("mousemove",L),window.addEventListener("mouseup",lt),()=>{window.removeEventListener("mousemove",L),window.removeEventListener("mouseup",lt)}},[]),i.jsxs("div",{ref:g,className:"ml-window",style:{zIndex:S,width:o,height:d,left:Y.current.x,top:Y.current.y},onMouseDown:()=>R(s),children:[i.jsxs("div",{className:"ml-window-header",onMouseDown:U,children:[i.jsx("span",{className:"ml-window-title",children:p}),i.jsx("button",{className:"ml-window-close",onClick:()=>E(s),children:"×"})]}),i.jsx("div",{className:"ml-window-content",children:x})]})},iy={0:"#00FF00",2:"#FFFFFF",3:"#FF0000",4:"#FFFFFF",5:"#33CCFF",6:"#CCFF99",7:"#00FFFF",14:"#FFD700",15:"#FF69B4",17:"#AAAAFF",18:"#88FF88",21:"#FF8888",22:"#FFAA66"},cy=({id:s,charName:p,zIndex:S,messages:o,socket:d})=>{const x=N.useRef(null),[E,R]=N.useState("");N.useEffect(()=>{x.current&&(x.current.scrollTop=x.current.scrollHeight)},[o.length]);const g=v=>{v.preventDefault();const Y=E.trim();!Y||!d||d.readyState!==WebSocket.OPEN||(d.send(JSON.stringify({player_name:p,command:Y})),R(""))};return i.jsxs(ne,{id:s,title:`Chat: ${p}`,zIndex:S,width:600,height:300,children:[i.jsx("div",{className:"ml-chat-messages",ref:x,children:o.map((v,Y)=>i.jsx("div",{className:"ml-chat-line",style:{color:iy[v.color??2]??"#ddd"},children:v.text},Y))}),i.jsx("form",{className:"ml-chat-form",onSubmit:g,children:i.jsx("input",{className:"ml-chat-input",value:E,onChange:v=>R(v.target.value),placeholder:"Enter chat..."})})]})},sy=[{title:"Kills per Hour",id:1},{title:"Memory (MB)",id:2},{title:"CPU (%)",id:3},{title:"Mem Handles",id:4}],fy=[{label:"1H",value:"now-1h"},{label:"6H",value:"now-6h"},{label:"24H",value:"now-24h"},{label:"7D",value:"now-7d"}],oy=({id:s,charName:p,zIndex:S})=>{const[o,d]=N.useState("now-24h"),x=E=>`/grafana/d-solo/dereth-tracker/dereth-tracker-dashboard?panelId=${E}&var-character=${encodeURIComponent(p)}&from=${o}&to=now&theme=light`;return i.jsxs(ne,{id:s,title:`Stats: ${p}`,zIndex:S,width:750,height:480,children:[i.jsx("div",{className:"ml-stats-controls",children:fy.map(E=>i.jsx("button",{className:`ml-stats-range-btn ${o===E.value?"active":""}`,onClick:()=>d(E.value),children:E.label},E.value))}),i.jsx("div",{className:"ml-stats-grid",children:sy.map(E=>i.jsx("div",{className:"ml-stats-panel",children:i.jsx("iframe",{src:x(E.id),width:"100%",height:"100%",frameBorder:"0",title:E.title})},E.id))})]})},Jd={218:"Reinforcement of the Lugians",219:"Bleeargh's Fortitude",220:"Oswald's Enhancement",221:"Siraluun's Blessing",222:"Enduring Calm",223:"Steadfast Will",224:"Ciandra's Essence",225:"Yoshi's Essence",226:"Jibril's Essence",227:"Celdiseth's Essence",228:"Koga's Essence",229:"Shadow of the Seventh Mule",230:"Might of the Seventh Mule",231:"Clutch of the Miser",232:"Enduring Enchantment",233:"Critical Protection",234:"Quick Learner",235:"Ciandra's Fortune",236:"Charmed Smith",237:"Innate Renewal",238:"Archmage's Endurance",239:"Enhancement of the Blade Turner",240:"Enhancement of the Arrow Turner",241:"Enhancement of the Mace Turner",242:"Caustic Enhancement",243:"Fierce Impaler",244:"Iron Skin of the Invincible",245:"Eye of the Remorseless",246:"Hand of the Remorseless",294:"Master of the Steel Circle",295:"Master of the Focused Eye",296:"Master of the Five Fold Path",297:"Frenzy of the Slayer",298:"Iron Skin of the Invincible",299:"Jack of All Trades",300:"Infused Void Magic",301:"Infused War Magic",302:"Infused Life Magic",309:"Infused Item Magic",310:"Infused Creature Magic",326:"Clutch of the Miser",328:"Enduring Enchantment"},$d={333:"Valor / Destruction",334:"Protection",335:"Glory / Retribution",336:"Temperance / Hardening",338:"Aetheric Vision",339:"Mana Flow",340:"Mana Infusion",342:"Purity",343:"Craftsman",344:"Specialization",365:"World"},Wd={370:"Damage",371:"Damage Resistance",372:"Critical",373:"Critical Resistance",374:"Critical Damage",375:"Critical Damage Resistance",376:"Healing Boost",379:"Vitality"},Fd={287:"Celestial Hand",288:"Eldrytch Web",289:"Radiant Blood"},Id={354:"Melee",355:"Ranged",362:"Summoning"},ry={1:"Unarmed",2:"Swords",3:"Axes",4:"Maces",5:"Spears",6:"Daggers",7:"Staves",8:"Bows",9:"Crossbows",10:"Thrown",11:"Two-Handed",12:"Void",13:"War",14:"Life"},Pd={181:"Chess Rank",192:"Fishing Skill",199:"Total Augmentations",322:"Aetheria Slots",390:"Enlightenment"};function dy(s){return s>=1001?"Master":s>=301?"Lord":s>=151?"Knight":s>=31?"Adept":"Initiate"}const xl="#af7a30",li="#000022",hy=({id:s,charName:p,zIndex:S,vitals:o})=>{var J,z;const[d,x]=N.useState(null),[E,R]=N.useState(0),[g,v]=N.useState(0);N.useEffect(()=>{Pt(`/character-stats/${encodeURIComponent(p)}`).then(x).catch(()=>{})},[p]);const Y=h=>h!=null?Number(h).toLocaleString():"—",U=(d==null?void 0:d.stats_data)||d||{},L=U.attributes||{},lt=U.skills||{},W=U.vitals||{},et=U.titles||[],mt=U.properties||{},I=Object.entries(lt).filter(([,h])=>(h==null?void 0:h.training)==="Specialized").sort(([h],[B])=>h.localeCompare(B)),M=Object.entries(lt).filter(([,h])=>(h==null?void 0:h.training)==="Trained").sort(([h],[B])=>h.localeCompare(B)),F=Object.entries(mt).filter(([h,B])=>Jd[parseInt(h)]&&Number(B)>0).map(([h,B])=>({name:Jd[parseInt(h)],uses:Number(B)})),Q=Object.entries(mt).filter(([h,B])=>$d[parseInt(h)]&&Number(B)>0).map(([h,B])=>({name:$d[parseInt(h)],uses:Number(B)})),k=Object.entries(mt).filter(([h,B])=>Wd[parseInt(h)]&&Number(B)>0).map(([h,B])=>({name:Wd[parseInt(h)],value:Number(B)})),q=[];d!=null&&d.birth&&q.push({name:"Birth",value:d.birth}),(d==null?void 0:d.deaths)!=null&&q.push({name:"Deaths",value:Y(d.deaths)}),Object.entries(mt).forEach(([h,B])=>{const $=parseInt(h);Pd[$]&&q.push({name:Pd[$],value:B})});const T=[];Object.entries(mt).forEach(([h,B])=>{const $=parseInt(h);Id[$]&&T.push({name:Id[$],value:ry[Number(B)]||`Unknown (${B})`})});const G=[];Object.entries(mt).forEach(([h,B])=>{const $=parseInt(h);Fd[$]&&Number(B)>0&&G.push({name:Fd[$],rank:dy(Number(B)),value:Number(B)})});const tt=h=>({padding:"5px 8px",fontSize:12,fontWeight:"bold",color:"#fff",cursor:"pointer",userSelect:"none",borderTop:`2px solid ${h?xl:li}`,borderLeft:`2px solid ${h?xl:li}`,borderRight:`2px solid ${h?xl:li}`,background:h?"rgba(0,100,0,0.4)":"transparent"}),K={background:"#000",border:`2px solid ${xl}`,maxHeight:400,overflowY:"auto",overflowX:"hidden"},ut={background:"#222",fontWeight:"bold",fontSize:12,padding:"2px 6px"},ot={padding:"2px 6px",background:"rgba(0,100,0,0.4)",whiteSpace:"nowrap"},gt={padding:"2px 6px",background:"rgba(0,0,100,0.4)",textAlign:"right",whiteSpace:"nowrap"},w={padding:"2px 6px",color:"#ccc"};return i.jsx(ne,{id:s,title:`Character: ${p}`,zIndex:S,width:740,height:600,children:i.jsxs("div",{style:{background:li,color:"#fff",font:'14px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif',overflowY:"auto",padding:"10px 15px 15px",flex:1},children:[i.jsxs("div",{style:{marginBottom:10},children:[i.jsxs("h1",{style:{margin:"0 0 2px",fontSize:28,fontWeight:"bold"},children:[p,i.jsx("span",{style:{fontSize:"200%",color:"#fff27f",float:"right"},children:(d==null?void 0:d.level)||""})]}),i.jsx("div",{style:{fontSize:"85%",color:"gold"},children:[d==null?void 0:d.gender,d==null?void 0:d.race].filter(Boolean).join(" ")||"Awaiting character data..."})]}),i.jsxs("div",{style:{fontSize:"85%",margin:"6px 0 10px",display:"grid",gridTemplateColumns:"1fr 1fr",gap:"0 20px"},children:[i.jsxs("div",{children:["Total XP: ",Y(d==null?void 0:d.total_xp)]}),i.jsxs("div",{style:{textAlign:"right"},children:["Unassigned XP: ",Y(d==null?void 0:d.unassigned_xp)]}),i.jsxs("div",{children:["Luminance: ",(d==null?void 0:d.luminance_earned)!=null?`${Y(d.luminance_earned)} / ${Y(d.luminance_total)}`:"—"]}),i.jsxs("div",{style:{textAlign:"right"},children:["Deaths: ",Y(d==null?void 0:d.deaths)]})]}),i.jsxs("div",{style:{display:"flex",gap:13,flexWrap:"wrap"},children:[i.jsxs("div",{style:{width:320},children:[i.jsx("div",{style:{height:30,display:"flex"},children:["Attributes","Skills","Titles"].map((h,B)=>i.jsx("div",{style:tt(E===B),onClick:()=>R(B),children:h},h))}),i.jsxs("div",{style:K,children:[E===0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{padding:"6px 8px",display:"flex",flexDirection:"column",gap:8,borderBottom:`2px solid ${xl}`},children:[{label:"Health",pct:(o==null?void 0:o.health_percentage)??0,cur:o==null?void 0:o.health_current,max:o==null?void 0:o.health_max,bg:"#cc3333"},{label:"Stamina",pct:(o==null?void 0:o.stamina_percentage)??0,cur:o==null?void 0:o.stamina_current,max:o==null?void 0:o.stamina_max,bg:"#ccaa33"},{label:"Mana",pct:(o==null?void 0:o.mana_percentage)??0,cur:o==null?void 0:o.mana_current,max:o==null?void 0:o.mana_max,bg:"#3366cc"}].map(h=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[i.jsx("span",{style:{width:55,fontSize:12,color:"#ccc"},children:h.label}),i.jsx("div",{style:{flex:1,height:14,overflow:"hidden",position:"relative",border:`1px solid ${xl}`},children:i.jsx("div",{style:{height:"100%",width:`${h.pct}%`,background:h.bg,transition:"width 0.5s ease"}})}),i.jsxs("span",{style:{width:80,textAlign:"right",fontSize:12,color:"#ccc"},children:[h.cur??"—"," / ",h.max??"—"]})]},h.label))}),i.jsxs("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("td",{style:ut,children:"Attribute"}),i.jsx("td",{style:ut,children:"Creation"}),i.jsx("td",{style:ut,children:"Base"})]})}),i.jsx("tbody",{children:["strength","endurance","coordination","quickness","focus","self"].map(h=>{var B,$;return i.jsxs("tr",{children:[i.jsx("td",{style:ot,children:h.charAt(0).toUpperCase()+h.slice(1)}),i.jsx("td",{style:w,children:((B=L[h])==null?void 0:B.creation)??"—"}),i.jsx("td",{style:gt,children:(($=L[h])==null?void 0:$.base)??"—"})]},h)})})]}),i.jsxs("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("td",{style:ut,children:"Vital"}),i.jsx("td",{style:ut,children:"Base"})]})}),i.jsx("tbody",{children:["health","stamina","mana"].map(h=>{var B;return i.jsxs("tr",{children:[i.jsx("td",{style:ot,children:h.charAt(0).toUpperCase()+h.slice(1)}),i.jsx("td",{style:gt,children:((B=W[h])==null?void 0:B.base)??"—"})]},h)})})]}),i.jsx("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:i.jsx("tbody",{children:i.jsxs("tr",{children:[i.jsx("td",{style:ot,children:"Skill Credits"}),i.jsx("td",{style:gt,children:Y(U.skill_credits)})]})})})]}),E===1&&i.jsxs("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("td",{style:ut,children:"Skill"}),i.jsx("td",{style:ut,children:"Level"})]})}),i.jsxs("tbody",{children:[I.map(([h,B])=>i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px",background:"linear-gradient(to right, #392067, #392067, black)"},children:h.replace(/_/g," ").replace(/\b\w/g,$=>$.toUpperCase())}),i.jsx("td",{style:{...gt,background:"linear-gradient(to right, #392067, #392067, black)"},children:B.base})]},h)),M.map(([h,B])=>i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px",background:"linear-gradient(to right, #0f3c3e, #0f3c3e, black)"},children:h.replace(/_/g," ").replace(/\b\w/g,$=>$.toUpperCase())}),i.jsx("td",{style:{...gt,background:"linear-gradient(to right, #0f3c3e, #0f3c3e, black)"},children:B.base})]},h)),I.length===0&&M.length===0&&i.jsx("tr",{children:i.jsx("td",{colSpan:2,style:{padding:10,color:"#666",fontStyle:"italic",textAlign:"center"},children:"No skill data"})})]})]}),E===2&&i.jsx("div",{style:{padding:"6px 10px",fontSize:13},children:et.length>0?et.map((h,B)=>i.jsx("div",{style:{padding:"1px 0"},children:h},B)):i.jsx("div",{style:{color:"#666",fontStyle:"italic",textAlign:"center",padding:10},children:"No titles"})})]})]}),i.jsxs("div",{style:{width:320},children:[i.jsx("div",{style:{height:30,display:"flex"},children:["Augmentations","Ratings","Other"].map((h,B)=>i.jsx("div",{style:tt(g===B),onClick:()=>v(B),children:h},h))}),i.jsxs("div",{style:K,children:[g===0&&(F.length||Q.length?i.jsxs(i.Fragment,{children:[F.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{background:"#222",padding:"4px 8px",fontWeight:"bold",fontSize:13,borderBottom:`1px solid ${xl}`},children:"Augmentations"}),i.jsxs("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("td",{style:ut,children:"Name"}),i.jsx("td",{style:ut,children:"Uses"})]})}),i.jsx("tbody",{children:F.map(h=>i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px"},children:h.name}),i.jsx("td",{style:{padding:"2px 6px",textAlign:"right"},children:h.uses})]},h.name))})]})]}),Q.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{background:"#222",padding:"4px 8px",fontWeight:"bold",fontSize:13,borderBottom:`1px solid ${xl}`},children:"Auras"}),i.jsxs("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("td",{style:ut,children:"Name"}),i.jsx("td",{style:ut,children:"Uses"})]})}),i.jsx("tbody",{children:Q.map(h=>i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px"},children:h.name}),i.jsx("td",{style:{padding:"2px 6px",textAlign:"right"},children:h.uses})]},h.name))})]})]})]}):i.jsx("div",{style:{color:"#666",fontStyle:"italic",textAlign:"center",padding:10},children:"No augmentation data"})),g===1&&(k.length>0?i.jsxs("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("td",{style:ut,children:"Rating"}),i.jsx("td",{style:ut,children:"Value"})]})}),i.jsx("tbody",{children:k.map(h=>i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px"},children:h.name}),i.jsx("td",{style:{padding:"2px 6px",textAlign:"right"},children:h.value})]},h.name))})]}):i.jsx("div",{style:{color:"#666",fontStyle:"italic",textAlign:"center",padding:10},children:"No rating data"})),g===2&&i.jsxs("div",{children:[q.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{background:"#222",padding:"4px 8px",fontWeight:"bold",fontSize:13,borderBottom:`1px solid ${xl}`},children:"General"}),i.jsx("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:i.jsx("tbody",{children:q.map(h=>i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px"},children:h.name}),i.jsx("td",{style:{padding:"2px 6px",textAlign:"right"},children:h.value})]},h.name))})})]}),T.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{background:"#222",padding:"4px 8px",fontWeight:"bold",fontSize:13,borderBottom:`1px solid ${xl}`},children:"Masteries"}),i.jsx("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:i.jsx("tbody",{children:T.map(h=>i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px"},children:h.name}),i.jsx("td",{style:{padding:"2px 6px",textAlign:"right"},children:h.value})]},h.name))})})]}),G.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{background:"#222",padding:"4px 8px",fontWeight:"bold",fontSize:13,borderBottom:`1px solid ${xl}`},children:"Society"}),i.jsx("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:i.jsx("tbody",{children:G.map(h=>i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px"},children:h.name}),i.jsxs("td",{style:{padding:"2px 6px",textAlign:"right"},children:[h.rank," (",h.value,")"]})]},h.name))})})]}),q.length===0&&T.length===0&&G.length===0&&i.jsx("div",{style:{color:"#666",fontStyle:"italic",textAlign:"center",padding:10},children:"No additional data"})]})]})]})]}),(d==null?void 0:d.allegiance)&&i.jsxs("div",{style:{marginTop:5,border:`2px solid ${xl}`,background:"#000"},children:[i.jsx("div",{style:{background:"#222",padding:"4px 8px",fontWeight:"bold",fontSize:13,borderBottom:`1px solid ${xl}`},children:"Allegiance"}),i.jsx("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:i.jsxs("tbody",{children:[d.allegiance.name&&i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px",color:"#ccc",width:100},children:"Name"}),i.jsx("td",{style:{padding:"2px 6px"},children:d.allegiance.name})]}),((J=d.allegiance.monarch)==null?void 0:J.name)&&i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px",color:"#ccc"},children:"Monarch"}),i.jsx("td",{style:{padding:"2px 6px"},children:d.allegiance.monarch.name})]}),((z=d.allegiance.patron)==null?void 0:z.name)&&i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px",color:"#ccc"},children:"Patron"}),i.jsx("td",{style:{padding:"2px 6px"},children:d.allegiance.patron.name})]}),d.allegiance.rank!=null&&i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px",color:"#ccc"},children:"Rank"}),i.jsx("td",{style:{padding:"2px 6px"},children:d.allegiance.rank})]}),d.allegiance.followers!=null&&i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px",color:"#ccc"},children:"Followers"}),i.jsx("td",{style:{padding:"2px 6px"},children:d.allegiance.followers})]})]})})]})]})})};function my(s){var o,d;if(!s)return s;const p=x=>x!=null&&x!==-1&&x!==-1?x:void 0,S=s.IntValues||{};return{item_id:s.item_id??s.Id??0,name:s.name??s.Name??((o=s.StringValues)==null?void 0:o["1"])??"Unknown",icon:s.icon??s.Icon??0,object_class:s.object_class??s.ObjectClass??0,current_wielded_location:s.current_wielded_location??p(s.CurrentWieldedLocation)??p(Number(S[10]))??0,container_id:s.container_id??s.ContainerId??0,items_capacity:s.items_capacity??p(s.ItemsCapacity)??p(Number(S[6]))??((d=s.enhanced_properties)==null?void 0:d.ItemSlots_Decal)??void 0,value:s.value??p(s.Value)??p(Number(S[19]))??0,burden:s.burden??p(s.Burden)??p(Number(S[5]))??0,armor_level:s.armor_level??p(s.ArmorLevel),max_damage:s.max_damage??p(s.MaxDamage),material:s.material??s.material_name??s.Material??void 0,item_set:s.item_set??s.ItemSet??void 0,imbue:s.imbue??s.Imbue??void 0,tinks:s.tinks??p(s.Tinks),workmanship:s.workmanship??p(s.Workmanship),equip_skill:s.equip_skill??s.equip_skill_name??s.EquipSkill??void 0,wield_level:s.wield_level??p(s.WieldLevel),skill_level:s.skill_level??p(s.SkillLevel),lore_requirement:s.lore_requirement??p(s.LoreRequirement),attack_bonus:s.attack_bonus??p(s.AttackBonus),melee_defense_bonus:s.melee_defense_bonus??p(s.MeleeDefenseBonus),magic_defense_bonus:s.magic_defense_bonus??p(s.MagicDBonus),damage_bonus:s.damage_bonus??p(s.DamageBonus),damage_rating:s.damage_rating??p(s.DamRating),crit_rating:s.crit_rating??p(s.CritRating),heal_boost_rating:s.heal_boost_rating??p(s.HealBoostRating),current_mana:s.current_mana??p(Number(S[218103815]))??void 0,max_mana:s.max_mana??p(Number(S[218103814]))??void 0,spellcraft:s.spellcraft??void 0,damage_range:s.damage_range??void 0,damage_type:s.damage_type??void 0,speed_text:s.speed_text??void 0,mana_display:s.mana_display??void 0,spells:s.spells??void 0,icon_overlay_id:s.icon_overlay_id??p(Number(S[218103849]))??void 0,icon_underlay_id:s.icon_underlay_id??p(Number(S[218103850]))??void 0,_raw:s}}function ei(s){return!s||s<=0?"06000133":(s+100663296).toString(16).toUpperCase().padStart(8,"0")}const Ua={32768:{name:"Neck",row:1,col:1},1:{name:"Head",row:1,col:3},268435456:{name:"Sigil",row:1,col:5},536870912:{name:"Sigil",row:1,col:6},1073741824:{name:"Sigil",row:1,col:7},67108864:{name:"Trinket",row:2,col:1},2048:{name:"U.Arm",row:2,col:2},512:{name:"Chest",row:2,col:3},134217728:{name:"Cloak",row:2,col:7},65536:{name:"Brace L",row:3,col:1},4096:{name:"L.Arm",row:3,col:2},1024:{name:"Abdomen",row:3,col:3},8192:{name:"U.Leg",row:3,col:4},131072:{name:"Brace R",row:3,col:5},2:{name:"Shirt",row:3,col:7},262144:{name:"Ring L",row:4,col:1},32:{name:"Hands",row:4,col:2},16384:{name:"L.Leg",row:4,col:4},524288:{name:"Ring R",row:4,col:5},4:{name:"Pants",row:4,col:7},256:{name:"Feet",row:5,col:4},2097152:{name:"Shield",row:6,col:1},1048576:{name:"Melee",row:6,col:3},4194304:{name:"Missile",row:6,col:3},16777216:{name:"Held",row:6,col:3},33554432:{name:"2H",row:6,col:3},8388608:{name:"Ammo",row:6,col:7}},Ba={},yy=[32768,67108864,65536,131072,262144,524288],gy=[1,512,2048,1024,4096,8192,16384,32,256],vy=[2,4,134217728,268435456,536870912,1073741824],py=[2097152,1048576,4194304,16777216,33554432,8388608];(()=>{const s=new Set;Object.entries(Ua).forEach(([p,S])=>{const o=`${S.row}-${S.col}`,d=parseInt(p);s.has(o)||(s.add(o),yy.includes(d)?Ba[o]="#3a2555":gy.includes(d)?Ba[o]="#1e2e55":vy.includes(d)?Ba[o]="#1e3e3e":py.includes(d)?Ba[o]="#142040":Ba[o]="#2a2a2a")})})();const Ha="#af7a30";function Ts({item:s,size:p=36}){const S={position:"absolute",top:0,left:0,width:p,height:p,border:"none",background:"transparent",imageRendering:"pixelated"},o=s.icon_underlay_id&&s.icon_underlay_id>100?`/icons/${ei(s.icon_underlay_id)}.png`:null,d=s.icon_overlay_id&&s.icon_overlay_id>100?`/icons/${ei(s.icon_overlay_id)}.png`:null;return i.jsxs("div",{style:{width:p,height:p,position:"relative"},children:[o&&i.jsx("img",{src:o,alt:"",style:{...S,zIndex:1},onError:x=>{x.target.style.display="none"}}),i.jsx("img",{src:`/icons/${ei(s.icon)}.png`,alt:s.name,style:{...S,zIndex:2},onError:x=>{x.target.src="/icons/06000133.png"}}),d&&i.jsx("img",{src:d,alt:"",style:{...S,zIndex:3},onError:x=>{x.target.style.display="none"}})]})}function xy({item:s,x:p,y:S}){var E,R;const o=g=>g!=null&&g!==-1&&g!==-1,d=g=>g.toLocaleString(),x=g=>`${((g-1)*100).toFixed(1)}%`;return i.jsxs("div",{style:{position:"fixed",left:p+14,top:S+14,background:"rgba(0,0,0,0.96)",border:"1px solid #555",borderRadius:4,padding:"8px 12px",zIndex:99999,minWidth:200,maxWidth:340,fontSize:13,color:"#ddd",pointerEvents:"none",lineHeight:1.6,fontFamily:'-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif'},children:[i.jsx("div",{style:{color:"#ffcc00",fontWeight:"bold",fontSize:14,marginBottom:4},children:s.name}),i.jsxs("div",{style:{color:"#aaa"},children:["Value: ",d(s.value)," · Burden: ",s.burden]}),s.workmanship&&i.jsxs("div",{style:{color:"#aaa"},children:["Workmanship: ",s.workmanship]}),s.material&&i.jsxs("div",{style:{color:"#88ff88"},children:["Material: ",s.material]}),o(s.armor_level)&&i.jsxs("div",{style:{color:"#88ff88"},children:["Armor Level: ",s.armor_level]}),o(s.max_damage)&&i.jsxs("div",{style:{color:"#88ff88"},children:["Max Damage: ",s.max_damage]}),s.damage_range&&i.jsxs("div",{style:{color:"#88ff88"},children:["Damage: ",s.damage_range,s.damage_type?`, ${s.damage_type}`:""]}),o(s.attack_bonus)&&s.attack_bonus!==1&&i.jsxs("div",{style:{color:"#88ff88"},children:["Attack: +",x(s.attack_bonus)]}),o(s.melee_defense_bonus)&&s.melee_defense_bonus!==1&&i.jsxs("div",{style:{color:"#88ff88"},children:["Melee Def: +",x(s.melee_defense_bonus)]}),o(s.magic_defense_bonus)&&s.magic_defense_bonus!==1&&i.jsxs("div",{style:{color:"#88ff88"},children:["Magic Def: +",x(s.magic_defense_bonus)]}),s.equip_skill&&i.jsxs("div",{style:{color:"#ddd"},children:["Skill: ",s.equip_skill]}),o(s.wield_level)&&i.jsxs("div",{style:{color:"#ffaa00"},children:["Wield Level: ",s.wield_level]}),o(s.lore_requirement)&&i.jsxs("div",{style:{color:"#ffaa00"},children:["Lore: ",s.lore_requirement]}),s.imbue&&i.jsxs("div",{style:{color:"#88ff88"},children:["Imbue: ",s.imbue]}),s.item_set&&i.jsxs("div",{style:{color:"#88ff88"},children:["Set: ",s.item_set]}),o(s.tinks)&&i.jsxs("div",{style:{color:"#88ff88"},children:["Tinks: ",s.tinks]}),o(s.damage_rating)&&i.jsxs("div",{children:["Damage Rating: ",s.damage_rating]}),o(s.crit_rating)&&i.jsxs("div",{children:["Crit Rating: ",s.crit_rating]}),o(s.heal_boost_rating)&&i.jsxs("div",{children:["Heal Boost: ",s.heal_boost_rating]}),s.spellcraft&&i.jsxs("div",{style:{color:"#dda0dd"},children:["Spellcraft: ",s.spellcraft]}),o(s.current_mana)&&o(s.max_mana)&&i.jsxs("div",{style:{color:"#98d7ff"},children:["Mana: ",s.current_mana," / ",s.max_mana]}),((R=(E=s.spells)==null?void 0:E.spells)==null?void 0:R.length)>0&&i.jsxs("div",{style:{color:"#4a90e2",marginTop:4,fontSize:12},children:["Spells: ",s.spells.spells.map(g=>g.name).join(", ")]})]})}function th({iconSrc:s,isActive:p,fillPct:S,label:o,onClick:d}){const x=S>90?"#b7432c":S>70?"#d8a431":"#00ff00";return i.jsxs("div",{onClick:d,title:o,style:{display:"flex",alignItems:"flex-start",gap:2,cursor:"pointer",flexShrink:0,marginTop:3,position:"relative"},children:[p&&i.jsx("span",{style:{position:"absolute",left:-11,top:8,color:Ha,fontSize:10},children:"▶"}),i.jsx("div",{style:{width:30,height:30,border:p?"1px solid #00ff00":"1px solid #333",boxShadow:p?"0 0 4px #00ff00":"none",background:"#000",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx("img",{src:s,alt:"",style:{width:26,height:26,objectFit:"contain",imageRendering:"pixelated"},onError:E=>{E.target.src="/icons/06001080.png"}})}),i.jsx("div",{style:{width:7,height:30,background:"#222",border:"1px solid #666",position:"relative",overflow:"hidden",borderRadius:2},title:`${Math.round(S)}% full`,children:i.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:`${S}%`,background:x,minHeight:S>0?2:0}})})]})}const by=({id:s,charName:p,zIndex:S})=>{var ut,ot,gt;const[o,d]=N.useState([]),[x,E]=N.useState(!0),[R,g]=N.useState(null),[v,Y]=N.useState(null),[U,L]=N.useState(null),[lt,W]=N.useState(null);N.useEffect(()=>{E(!0),Promise.all([Pt(`/inventory/${encodeURIComponent(p)}?limit=1000`).catch(()=>({items:[]})),Pt(`/character-stats/${encodeURIComponent(p)}`).catch(()=>null)]).then(([w,J])=>{const z=w.items??[];d(z.map(my)),L(J)}).finally(()=>E(!1))},[p]);const et=N.useCallback((w,J)=>{Y(w&&J?{item:w,x:J.clientX,y:J.clientY}:null)},[]),mt=N.useMemo(()=>{const w=new Set,J=[];return Object.entries(Ua).forEach(([z,h])=>{const B=`${h.row}-${h.col}`;w.has(B)||(w.add(B),J.push({key:B,...h,mask:parseInt(z)}))}),J},[]),{equippedMap:I,containers:M,packItems:F}=N.useMemo(()=>{const w=new Map,J=[],z=new Set,h=new Map;o.forEach($=>{$.object_class===10&&(J.push($),z.add($.item_id))}),J.sort(($,yt)=>($.item_id>>>0)-(yt.item_id>>>0));let B=null;return o.forEach($=>{$.current_wielded_location>0&&$.container_id&&!z.has($.container_id)&&(B=$.container_id)}),o.forEach($=>{if(z.has($.item_id))return;const yt=$.current_wielded_location;if(yt>0)if($.object_class===2)Object.entries(Ua).forEach(([C,Z])=>{if((yt&parseInt(C))===parseInt(C)){const V=`${Z.row}-${Z.col}`;w.has(V)||w.set(V,$)}});else{let C=!1;if(Ua[yt]){const Z=Ua[yt],V=`${Z.row}-${Z.col}`;w.has(V)||(w.set(V,$),C=!0)}if(!C){for(const[Z,V]of Object.entries(Ua))if((yt&parseInt(Z))===parseInt(Z)){const it=`${V.row}-${V.col}`;if(!w.has(it)){w.set(it,$),C=!0;break}}}}else{let m=$.container_id||0;B&&m===B&&(m=0),h.has(m)||h.set(m,[]),h.get(m).push($)}}),{equippedMap:w,containers:J,packItems:h}},[o]);let Q=F.get(0)??[],k=0;if(Q.length===0){let w=0;for(const[J,z]of F.entries())!M.some(h=>h.item_id===J)&&z.length>w&&(w=z.length,k=J);Q=F.get(k)??[]}const q=R!==null?F.get(R)??[]:Q,T=(U==null?void 0:U.burden_units)??((ut=U==null?void 0:U.stats_data)==null?void 0:ut.burden_units)??0,G=(U==null?void 0:U.encumbrance_capacity)??((ot=U==null?void 0:U.stats_data)==null?void 0:ot.encumbrance_capacity)??0,tt=G>0?Math.min(200,T/G*100):0,K=tt>150?"#b7432c":tt>100?"#d8a431":"#2e8b57";return x?i.jsx(ne,{id:s,title:`Inventory: ${p}`,zIndex:S,width:572,height:720,children:i.jsx("div",{style:{padding:20,color:"#666",fontStyle:"italic"},children:"Loading inventory..."})}):i.jsxs(ne,{id:s,title:`Inventory: ${p}`,zIndex:S,width:572,height:720,children:[i.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden",background:"rgba(14,14,14,0.96)",fontFamily:'-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif',fontSize:13},children:[i.jsxs("div",{style:{width:316,display:"flex",flexDirection:"column",overflow:"hidden"},children:[i.jsx("div",{style:{position:"relative",height:270,minHeight:270,background:"#0a0a0a",borderBottom:`1px solid ${Ha}`},children:mt.map(w=>{const J=I.get(w.key),z=Ba[w.key]??"#2a2a2a";return i.jsx("div",{style:{position:"absolute",left:(w.col-1)*44+4,top:(w.row-1)*44+4,width:36,height:36,background:J?"#5a5a62":z,border:J?"2px solid #00ffff":"2px outset #6a6a72",boxShadow:J?"0 0 5px #00ffff, inset 0 0 5px rgba(0,255,255,0.2)":"none",display:"flex",alignItems:"center",justifyContent:"center",cursor:J?"pointer":"default"},onMouseEnter:h=>J&&et(J,h),onMouseMove:h=>J&&et(J,h),onMouseLeave:()=>et(null),children:J?i.jsx(Ts,{item:J,size:32}):i.jsx("img",{src:"/icons/06000133.png",alt:"",style:{width:28,height:28,opacity:.15,filter:"grayscale(100%)",imageRendering:"pixelated"}})},w.key)})}),i.jsxs("div",{style:{padding:"3px 6px",fontSize:11,color:"#ccc",background:"#111",borderBottom:`1px solid ${Ha}`},children:["Contents of ",R!==null?((gt=M.find(w=>w.item_id===R))==null?void 0:gt.name)??"Pack":"Backpack"]}),i.jsxs("div",{style:{flex:1,overflowY:"auto",display:"grid",gridTemplateColumns:"repeat(6, 36px)",gridAutoRows:36,gap:2,padding:4,alignContent:"start"},children:[q.map((w,J)=>i.jsx("div",{style:{width:36,height:36,background:"linear-gradient(135deg, #3d007a 0%, #1a0033 100%)",border:"1px solid #4a148c",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"},onMouseEnter:z=>et(w,z),onMouseMove:z=>et(w,z),onMouseLeave:()=>et(null),children:i.jsx(Ts,{item:w,size:32})},w.item_id??J)),Array.from({length:Math.max(0,24-q.length)}).map((w,J)=>i.jsx("div",{style:{width:36,height:36,background:"#0a0a0a",border:"1px solid #1a1a1a"}},`e${J}`))]})]}),i.jsxs("div",{style:{width:42,display:"flex",flexDirection:"column",alignItems:"center",padding:"4px 2px",borderLeft:`1px solid ${Ha}`,borderRight:`1px solid ${Ha}`},children:[i.jsx("div",{style:{textAlign:"center",fontSize:8,color:"#ccc",marginBottom:2},children:G>0?`${Math.floor(tt)}%`:"Burden"}),i.jsx("div",{style:{width:14,height:40,background:"#111",border:"1px solid #555",position:"relative",overflow:"hidden",marginBottom:6,flexShrink:0},title:G>0?`${T.toLocaleString()} / ${G.toLocaleString()}`:`Burden: ${o.reduce((w,J)=>w+(J.burden??0),0).toLocaleString()}`,children:i.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:`${tt/2}%`,background:K,transition:"height 0.3s"}})}),i.jsx(th,{iconSrc:"/icons/0600127E.png",isActive:R===null,fillPct:Q.length>0?Math.min(100,Q.length/102*100):0,label:`Backpack (${Q.length}/102)`,onClick:()=>g(null)}),M.map(w=>{const J=w.item_id,z=o.filter($=>$.container_id===J&&$.item_id!==J).length,h=w.items_capacity||24,B=h>0?Math.min(100,z/h*100):0;return i.jsx(th,{iconSrc:`/icons/${ei(w.icon)}.png`,isActive:R===J,fillPct:B,label:`${w.name} (${z}/${h})`,onClick:()=>g(J)},J)})]}),i.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",minWidth:160},children:[i.jsx("div",{style:{padding:"4px 8px",fontSize:"0.72rem",fontWeight:600,color:"#aaa",background:"#111",borderBottom:`1px solid ${Ha}`},children:"Mana"}),i.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"2px 0"},children:[Array.from(I.values()).filter(w=>w.current_mana>0||w.max_mana>0).sort((w,J)=>(w.current_mana??999999)-(J.current_mana??999999)).map((w,J)=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:"1px solid #1a1a1a",cursor:"pointer"},onMouseEnter:z=>et(w,z),onMouseMove:z=>et(w,z),onMouseLeave:()=>et(null),children:[i.jsx("div",{style:{width:20,height:20,flexShrink:0},children:i.jsx(Ts,{item:w,size:20})}),i.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:w.current_mana>0?"#4c4":"#c44",flexShrink:0}}),i.jsx("div",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"0.68rem",color:"#ccc"},children:w.name}),i.jsxs("div",{style:{fontSize:"0.65rem",color:"#88bbff",whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:[w.current_mana??0,"/",w.max_mana??0]}),i.jsx("div",{style:{fontSize:"0.63rem",color:"#9c9",whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums",minWidth:42,textAlign:"right"},children:w.max_mana>0?Sy(w.current_mana??0,w.max_mana??0):""})]},J)),Array.from(I.values()).filter(w=>w.current_mana>0||w.max_mana>0).length===0&&i.jsx("div",{style:{padding:12,color:"#555",textAlign:"center",fontSize:"0.7rem"},children:"No mana items equipped"})]})]})]}),v&&i.jsx(xy,{item:v.item,x:v.x,y:v.y})]})};function Sy(s,p){if(p<=0||s<=0)return"0h00m";const S=s*20,o=Math.floor(S/3600),d=Math.floor(S%3600/60);return`~${o}h${String(d).padStart(2,"0")}m`}const Cs=300,lh=.5,_y={walls:{r:0,g:0,b:255},innerWalls:{r:127,g:127,b:255},rampedWalls:{r:77,g:255,b:255},floors:{r:0,g:127,b:255},stairs:{r:0,g:63,b:255}},jy={walls:{r:140,g:140,b:180},innerWalls:{r:100,g:100,b:140},rampedWalls:{r:120,g:160,b:120},floors:{r:60,g:80,b:60},stairs:{r:180,g:160,b:80}};function zy(s){const p=document.createElement("canvas");p.width=10,p.height=10;const S=p.getContext("2d");S.drawImage(s,0,0,10,10);const o=S.getImageData(0,0,10,10),d=o.data;for(let x=0;x240&&R>240&&g>240){d[x+3]=0;continue}let v=!1;for(const[Y,U]of Object.entries(_y))if(Math.abs(E-U.r)<15&&Math.abs(R-U.g)<15&&Math.abs(g-U.b)<15){const L=jy[Y];d[x]=L.r,d[x+1]=L.g,d[x+2]=L.b,v=!0;break}!v&&E<15&&R<15&&g<15&&(d[x+3]=100)}return S.putImageData(o,0,0),p}function Ey(s){return s===1?Math.PI:s<-.7&&s>-.8?Math.PI/2:s>.7&&s<.8?-Math.PI/2:0}let qa=null;function Ay(){qa||(qa={},fetch("/dungeon_tiles.json").then(s=>s.json()).then(s=>{Object.entries(s).forEach(([p,S])=>{const o=new Image;o.onload=()=>{qa[p]=zy(o)},o.src=S})}).catch(()=>{}))}const eh={Monster:"#ff4444",Player:"#4488ff",NPC:"#44cc44",Vendor:"#44cc44",Portal:"#aa44ff",Corpse:"#ff8800",Container:"#cccc44",Door:"#888888"};function My(s){const p=(s%360+360)%360;return["N","NE","E","SE","S","SW","W","NW"][Math.round(p/45)%8]}const Ty=({id:s,charName:p,zIndex:S,socket:o,radarData:d})=>{const x=N.useRef(null),E=N.useRef(lh),[R,g]=N.useState(lh),[v,Y]=N.useState(null),U=N.useRef(null),L=N.useRef([]);N.useEffect(()=>{const I=new Image;I.src="/dereth.png",I.onload=()=>{U.current=I},Ay()},[]),N.useEffect(()=>((o==null?void 0:o.readyState)===WebSocket.OPEN&&o.send(JSON.stringify({player_name:p,command:"start_radar"})),()=>{(o==null?void 0:o.readyState)===WebSocket.OPEN&&o.send(JSON.stringify({player_name:p,command:"stop_radar"}))}),[p,o]);const lt=N.useCallback(I=>{I.preventDefault();const M=I.deltaY>0?1.25:.8;E.current=Math.max(.02,Math.min(5,E.current*M)),g(E.current)},[]),W=N.useCallback(I=>{const M=x.current;if(!M)return;const F=M.getBoundingClientRect(),Q=(I.clientX-F.left)*(M.width/F.width),k=(I.clientY-F.top)*(M.height/F.height);let q=null,T=20;L.current.forEach(G=>{if(G._px===void 0)return;const tt=Math.sqrt((Q-G._px)**2+(k-G._py)**2);tt{var m;const I=x.current;if(!I||!d)return;const M=I.getContext("2d");if(!M)return;const F=Cs,Q=F/2,k=F/2,q=d.objects??[],T=d.player_ew??0,G=d.player_ns??0,tt=d.player_heading??0,K=d.is_dungeon??!1,ut=d.player_x??0,ot=d.player_y??0,gt=E.current,w=K?F/2/(gt*240):F/2/gt,J=tt*Math.PI/180;M.clearRect(0,0,F,F),M.fillStyle="#111",M.beginPath(),M.arc(Q,k,Q,0,Math.PI*2),M.fill(),M.save(),M.beginPath(),M.arc(Q,k,Q-1,0,Math.PI*2),M.clip();const z=d.landblock??null,h=d.player_raw_z??0;if(K&&z&&((m=window.__dungeonMapCache)!=null&&m[z])){const C=window.__dungeonMapCache[z],Z=Math.floor((h+3)/6)*6;M.translate(Q,k),M.rotate(-(tt-180)*Math.PI/180);const V=10*w,it=qa&&Object.keys(qa).length>0;(C.z_levels||[]).slice().sort((dt,Rt)=>(dt.z===Z?1:0)-(Rt.z===Z?1:0)).forEach(dt=>{const Rt=dt.z===Z;M.globalAlpha=Rt?.85:.12,(dt.cells||[]).forEach(Ot=>{const ll=-(Ot.x-ut)*w,Bl=(Ot.y-ot)*w,Nl=it?qa[String(Ot.env_id)]:null;Nl?(M.save(),M.translate(ll,Bl),M.rotate(Ey(Ot.rotation)),M.drawImage(Nl,-V/2,-V/2,V,V),M.restore()):(M.fillStyle=Rt?"#3a5a3a":"#1a2a1a",M.fillRect(ll-V/2,Bl-V/2,V,V))})}),M.globalAlpha=1,M.setTransform(1,0,0,1,0,0)}else if(!K&&U.current){const C=U.current,Z=C.naturalWidth/204.2,V=(T+102.1)*Z,it=(102.1-G)*Z;M.globalAlpha=.4,M.save(),M.translate(Q,k),M.rotate(-J);const st=gt*Z*2;M.drawImage(C,V-st/2,it-st/2,st,st,-Q,-k,F,F),M.restore(),M.globalAlpha=1}M.restore(),M.strokeStyle="#333",M.lineWidth=1;for(let C=1;C<=4;C++)M.beginPath(),M.arc(Q,k,Q/4*C,0,Math.PI*2),M.stroke();M.beginPath(),M.moveTo(Q,0),M.lineTo(Q,F),M.moveTo(0,k),M.lineTo(F,k),M.stroke(),M.font="bold 12px monospace",M.textAlign="center",M.textBaseline="middle",[{l:"N",a:0},{l:"E",a:Math.PI/2},{l:"S",a:Math.PI},{l:"W",a:-Math.PI/2}].forEach(({l:C,a:Z})=>{const V=Z-J;M.fillStyle=C==="N"?"#cc4444":"#888",M.fillText(C,Q+Math.sin(V)*(Q-12),k-Math.cos(V)*(Q-12))}),M.strokeStyle="#666",M.lineWidth=1,M.beginPath(),M.moveTo(Q,k),M.lineTo(Q,k-Q*.85),M.stroke();const B=K?Math.PI-J:J,$=Math.cos(B),yt=Math.sin(B);q.forEach(C=>{let Z,V;K&&C.raw_x!==void 0?(Z=-(C.raw_x-ut),V=C.raw_y-ot):(Z=(C.ew??0)-T,V=(C.ns??0)-G);const it=Z*$-V*yt,st=K?Z*yt+V*$:-(Z*yt+V*$),dt=Q+it*w,Rt=k+st*w;if(Math.sqrt((dt-Q)**2+(Rt-k)**2)>Q-4)return;C._px=dt,C._py=Rt;const ll=C.object_class??C.type??"",Bl=eh[ll]??"#888",Nl=C.id===v,Xa=Nl?6:ll==="Monster"||ll==="Player"?4:3;Nl&&(M.strokeStyle="#fff",M.lineWidth=2,M.beginPath(),M.arc(dt,Rt,Xa+3,0,Math.PI*2),M.stroke()),M.fillStyle=Bl,M.beginPath(),M.arc(dt,Rt,Xa,0,Math.PI*2),M.fill(),(ll==="Player"||ll==="Portal"||Nl)&&(M.fillStyle=Nl?"#fff":Bl,M.font="9px monospace",M.textAlign="left",M.fillText(C.name,dt+6,Rt+3))}),L.current=q,M.fillStyle="#ffcc00",M.beginPath(),M.arc(Q,k,5,0,Math.PI*2),M.fill(),M.strokeStyle="#fff",M.lineWidth=1,M.stroke()},[d,R,v]);const et=((d==null?void 0:d.objects)??[]).map(I=>{const M=(d==null?void 0:d.player_ew)??0,F=(d==null?void 0:d.player_ns)??0,Q=(d==null?void 0:d.is_dungeon)??!1,k=(d==null?void 0:d.player_x)??0,q=(d==null?void 0:d.player_y)??0;let T,G,tt;Q&&I.raw_x!==void 0?(T=-(I.raw_x-k),G=I.raw_y-q,tt=Math.sqrt(T*T+G*G)):(T=(I.ew??0)-M,G=(I.ns??0)-F,tt=Math.sqrt(T*T+G*G)*240);const K=Math.atan2(T,G)*180/Math.PI;return{...I,dist:tt,dir:My(K)}}).sort((I,M)=>I.dist-M.dist),mt=Math.round(R*240);return i.jsxs(ne,{id:s,title:`Radar: ${p}`,zIndex:S,width:360,height:560,children:[i.jsxs("div",{style:{padding:"4px 8px",display:"flex",justifyContent:"space-between",fontSize:"0.75rem",color:"#888",borderBottom:"1px solid #333",background:"#1a1a1a"},children:[i.jsxs("span",{children:["Range: ~",mt,"m"]}),i.jsx("span",{style:{fontSize:"0.65rem",color:"#555"},children:"Scroll to zoom"})]}),i.jsx("canvas",{ref:x,width:Cs,height:Cs,style:{display:"block",margin:"0 auto",borderBottom:"1px solid #333",cursor:"crosshair",flexShrink:0},onWheel:lt,onClick:W}),i.jsxs("div",{style:{flex:1,overflowY:"auto",fontSize:"0.72rem",minHeight:0},children:[i.jsxs("div",{style:{display:"flex",padding:"3px 6px",borderBottom:"1px solid #333",color:"#666",fontSize:"0.65rem",fontWeight:600},children:[i.jsx("span",{style:{width:8}}),i.jsx("span",{style:{flex:1,marginLeft:6},children:"Name"}),i.jsx("span",{style:{width:55,textAlign:"left"},children:"Type"}),i.jsx("span",{style:{width:40,textAlign:"right"},children:"Dist"}),i.jsx("span",{style:{width:24,textAlign:"center"},children:"Dir"})]}),et.length===0&&i.jsx("div",{style:{padding:12,color:"#555",textAlign:"center",fontSize:"0.7rem"},children:"Waiting for radar data..."}),et.map(I=>{const M=I.object_class??I.type??"",F=eh[M]??"#888",Q=I.id===v;return i.jsxs("div",{onClick:()=>Y(Q?null:I.id),style:{display:"flex",alignItems:"center",padding:"2px 6px",borderBottom:"1px solid #1a1a1a",cursor:"pointer",color:"#ccc",background:Q?"#1a2a3a":"",borderLeft:Q?"2px solid #4488ff":"2px solid transparent"},children:[i.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:F,flexShrink:0}}),i.jsx("span",{style:{flex:1,marginLeft:6,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:I.name}),i.jsx("span",{style:{width:55,color:"#888",fontSize:"0.65rem"},children:M}),i.jsx("span",{style:{width:40,textAlign:"right",fontVariantNumeric:"tabular-nums"},children:I.dist<1e3?`${Math.round(I.dist)}m`:`${(I.dist/1e3).toFixed(1)}km`}),i.jsx("span",{style:{width:24,textAlign:"center",color:"#666"},children:I.dir})]},I.id)})]})]})},Bn=["Typeless","Slash","Pierce","Bludgeon","Fire","Cold","Acid","Electric"];function Oe(s,p,S){var o,d,x,E;return(((d=(o=s==null?void 0:s[p])==null?void 0:o[S])==null?void 0:d.total_normal_damage)??0)+(((E=(x=s==null?void 0:s[p])==null?void 0:x[S])==null?void 0:E.total_crit_damage)??0)}function Cy(s){let p={attacks:0,failed:0,crits:0,normalDmg:0,maxNormal:0,critDmg:0,maxCrit:0};if(!s)return p;for(const S of Object.values(s))for(const o of Object.values(S))p.attacks+=o.total_attacks??0,p.failed+=o.failed_attacks??0,p.crits+=o.crits??0,p.normalDmg+=o.total_normal_damage??0,p.maxNormal=Math.max(p.maxNormal,o.max_normal_damage??0),p.critDmg+=o.total_crit_damage??0,p.maxCrit=Math.max(p.maxCrit,o.max_crit_damage??0);return p}function ah(s,p){let S={attacks:0,failed:0};const o=s==null?void 0:s[p];if(!o)return S;for(const d of Object.values(o))S.attacks+=d.total_attacks??0,S.failed+=d.failed_attacks??0;return S}const Oy=({id:s,charName:p,zIndex:S})=>{const[o,d]=N.useState(null),[x,E]=N.useState("session"),[R,g]=N.useState(null);N.useEffect(()=>{Pt(`/combat-stats/${encodeURIComponent(p)}`).then(d).catch(()=>{});const T=setInterval(()=>{Pt(`/combat-stats/${encodeURIComponent(p)}`).then(d).catch(()=>{})},1e4);return()=>clearInterval(T)},[p]);const v=o==null?void 0:o[x],Y=(v==null?void 0:v.monsters)??{},U=Object.keys(Y).filter(T=>T!=="__cloak_surges__").sort(),L=N.useMemo(()=>{let T={},G={},tt=0,K=0;const ut=R?[Y[R]].filter(Boolean):U.map(ot=>Y[ot]);for(const ot of ut)if(ot){for(const[gt,w]of Object.entries(ot.offense??{})){T[gt]||(T[gt]={});for(const[J,z]of Object.entries(w)){T[gt][J]||(T[gt][J]={total_attacks:0,failed_attacks:0,crits:0,total_normal_damage:0,max_normal_damage:0,total_crit_damage:0,max_crit_damage:0});const h=T[gt][J],B=z;h.total_attacks+=B.total_attacks??0,h.failed_attacks+=B.failed_attacks??0,h.crits+=B.crits??0,h.total_normal_damage+=B.total_normal_damage??0,h.max_normal_damage=Math.max(h.max_normal_damage,B.max_normal_damage??0),h.total_crit_damage+=B.total_crit_damage??0,h.max_crit_damage=Math.max(h.max_crit_damage,B.max_crit_damage??0)}}for(const[gt,w]of Object.entries(ot.defense??{})){G[gt]||(G[gt]={});for(const[J,z]of Object.entries(w)){G[gt][J]||(G[gt][J]={total_attacks:0,failed_attacks:0,crits:0,total_normal_damage:0,max_normal_damage:0,total_crit_damage:0,max_crit_damage:0});const h=G[gt][J],B=z;h.total_attacks+=B.total_attacks??0,h.failed_attacks+=B.failed_attacks??0,h.total_normal_damage+=B.total_normal_damage??0,h.max_normal_damage=Math.max(h.max_normal_damage,B.max_normal_damage??0),h.total_crit_damage+=B.total_crit_damage??0,h.max_crit_damage=Math.max(h.max_crit_damage,B.max_crit_damage??0)}}tt+=ot.aetheria_surges??0,K+=ot.cloak_surges??0}return Y.__cloak_surges__&&!R&&(K+=Y.__cloak_surges__.cloak_surges??0),{offense:T,defense:G,aeth:tt,cloak:K}},[Y,U,R]),lt=Cy(L.offense),W=ah(L.defense,"MeleeMissile"),et=ah(L.defense,"Magic");lt.attacks>0&&((lt.attacks-lt.failed)/lt.attacks*100).toFixed(0);const mt=W.attacks>0?(W.failed/W.attacks*100).toFixed(0):"0",I=et.attacks>0?(et.failed/et.attacks*100).toFixed(0):"0",M=lt.attacks-lt.failed,F=M-lt.crits,Q=F>0?Math.round(lt.normalDmg/F):0;lt.crits>0&&Math.round(lt.critDmg/lt.crits);const k=M>0?(lt.crits/M*100).toFixed(1):"0",q=T=>T===0?"":T.toLocaleString();return i.jsxs(ne,{id:s,title:`Combat: ${p}`,zIndex:S,width:640,height:520,children:[i.jsxs("div",{style:{display:"flex",gap:4,padding:"4px 8px",borderBottom:"1px solid #333"},children:[i.jsx("button",{className:`ml-stats-range-btn ${x==="session"?"active":""}`,onClick:()=>E("session"),children:"Session"}),i.jsx("button",{className:`ml-stats-range-btn ${x==="lifetime"?"active":""}`,onClick:()=>E("lifetime"),children:"Lifetime"})]}),i.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[i.jsxs("div",{style:{width:240,borderRight:"1px solid #333",overflowY:"auto",fontSize:"0.72rem"},children:[i.jsxs("div",{style:{display:"flex",padding:"3px 6px",borderBottom:"1px solid #333",color:"#777",fontSize:"0.65rem",fontWeight:600},children:[i.jsx("span",{style:{width:14}}),i.jsx("span",{style:{flex:1},children:"Monster"}),i.jsx("span",{style:{width:40,textAlign:"right"},children:"Kills"}),i.jsx("span",{style:{width:55,textAlign:"right"},children:"Dmg"})]}),i.jsxs("div",{style:{display:"flex",padding:"3px 6px",cursor:"pointer",background:R===null?"#2a3a4a":"",borderBottom:"1px solid #222",color:"#ddd"},onClick:()=>g(null),children:[i.jsx("span",{style:{width:14,color:"#888"},children:R===null?"*":""}),i.jsx("span",{style:{flex:1},children:"All"}),i.jsx("span",{style:{width:40,textAlign:"right"},children:q((v==null?void 0:v.total_kills)??0)}),i.jsx("span",{style:{width:55,textAlign:"right"},children:q((v==null?void 0:v.total_damage_given)??0)})]}),U.map(T=>{const G=Y[T];return i.jsxs("div",{style:{display:"flex",padding:"2px 6px",cursor:"pointer",background:R===T?"#2a3a4a":"",borderBottom:"1px solid #1a1a1a",color:"#ccc"},onClick:()=>g(T),children:[i.jsx("span",{style:{width:14,color:"#888"},children:R===T?"*":""}),i.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:T}),i.jsx("span",{style:{width:40,textAlign:"right"},children:q(G.kill_count)}),i.jsx("span",{style:{width:55,textAlign:"right"},children:q(G.damage_given)})]},T)})]}),i.jsx("div",{style:{flex:1,overflowY:"auto",padding:6,fontSize:"0.72rem"},children:i.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[i.jsx("thead",{children:i.jsxs("tr",{style:{color:"#777",fontSize:"0.65rem"},children:[i.jsx("th",{style:{textAlign:"left",padding:"1px 4px"}}),i.jsx("th",{style:{textAlign:"right",padding:"1px 3px"},children:"Given M/M"}),i.jsx("th",{style:{textAlign:"right",padding:"1px 3px"},children:"Given Mag"}),i.jsx("th",{style:{width:4}}),i.jsx("th",{style:{textAlign:"right",padding:"1px 3px"},children:"Recv M/M"}),i.jsx("th",{style:{textAlign:"right",padding:"1px 3px"},children:"Recv Mag"}),i.jsx("th",{style:{width:4}}),i.jsx("th",{style:{textAlign:"left",padding:"1px 3px"},children:"Stats"}),i.jsx("th",{style:{textAlign:"right",padding:"1px 3px"}})]})}),i.jsxs("tbody",{children:[Bn.map((T,G)=>{const tt=[["Evades",W.attacks>0?`${q(W.attacks)} (${mt}%)`:""],["Resists",et.attacks>0?`${q(et.attacks)} (${I}%)`:""],["A.Surges",L.aeth>0?`${q(L.aeth)}`:""],["C.Surges",L.cloak>0?`${q(L.cloak)}`:""],["",""],["",""],["Av/Mx",Q>0?`${q(Q)} / ${q(lt.maxNormal)}`:""],["Crits",lt.crits>0?`${q(lt.crits)} (${k}%)`:""]][G]??["",""];return i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"1px 4px",color:"#888"},children:T}),i.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:q(Oe(L.offense,"MeleeMissile",T))}),i.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:q(Oe(L.offense,"Magic",T))}),i.jsx("td",{}),i.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:q(Oe(L.defense,"MeleeMissile",T))}),i.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:q(Oe(L.defense,"Magic",T))}),i.jsx("td",{}),i.jsx("td",{style:{padding:"1px 3px",color:"#777",fontWeight:600,fontSize:"0.65rem"},children:tt[0]}),i.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:tt[1]})]},T)}),i.jsx("tr",{children:i.jsx("td",{colSpan:9,style:{height:4}})}),i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"1px 4px",color:"#888",fontWeight:600},children:"Total"}),i.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:q(Bn.reduce((T,G)=>T+Oe(L.offense,"MeleeMissile",G),0))}),i.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:q(Bn.reduce((T,G)=>T+Oe(L.offense,"Magic",G),0))}),i.jsx("td",{}),i.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:q(Bn.reduce((T,G)=>T+Oe(L.defense,"MeleeMissile",G),0))}),i.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:q(Bn.reduce((T,G)=>T+Oe(L.defense,"Magic",G),0))}),i.jsx("td",{}),i.jsx("td",{style:{padding:"1px 3px",color:"#777",fontWeight:600,fontSize:"0.65rem"},children:"Total"}),i.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:q(lt.normalDmg+lt.critDmg)})]})]})]})})]})]})},nh={plugin:{label:"Plugin",color:"#8844cc"},overlord:{label:"Overlord",color:"#4488cc"},nav:{label:"Nav",color:"#44aa44"},macro:{label:"Macro",color:"#cc8844"},other:{label:"Other",color:"#888888"}},Ya={padding:"3px 6px",fontSize:"0.8rem",border:"1px solid #555",background:"#2a2a2a",color:"#ddd",borderRadius:0},uh={...Ya,fontSize:"0.75rem"},Os={padding:"4px 12px",background:"#4a80c0",color:"#fff",border:"1px solid #336699",cursor:"pointer",fontSize:"0.75rem"},Hn={padding:"3px 8px",background:"#444",color:"#ccc",border:"1px solid #555",cursor:"pointer",fontSize:"0.7rem"},Ny=({id:s,zIndex:p})=>{const[S,o]=N.useState([]),[d,x]=N.useState(""),[E,R]=N.useState(""),[g,v]=N.useState("plugin"),[Y,U]=N.useState(null),[L,lt]=N.useState(""),[W,et]=N.useState(""),[mt,I]=N.useState(""),[M,F]=N.useState({}),Q=N.useCallback(async()=>{try{const K=await Pt("/issues");o((K.issues??[]).sort((ut,ot)=>(ut.resolved?1:0)-(ot.resolved?1:0)))}catch{}},[]);N.useEffect(()=>{Q()},[Q]);const k=async(K,ut)=>{await fetch(`/api${K}`,{...ut,credentials:"include",headers:{"Content-Type":"application/json",...ut.headers}}),Q()},q=async()=>{d.trim()&&(await k("/issues",{method:"POST",body:JSON.stringify({title:d.trim(),description:E.trim(),category:g})}),x(""),R(""))},T=K=>{if(Y===K.id){U(null);return}U(K.id),lt(K.title),et(K.description||""),I(K.category||"other")},G=async K=>{L.trim()&&(await k(`/issues/${K}`,{method:"PATCH",body:JSON.stringify({title:L.trim(),description:W.trim(),category:mt})}),U(null))},tt=async K=>{const ut=(M[K]||"").trim();ut&&(await k(`/issues/${K}/comments`,{method:"POST",body:JSON.stringify({text:ut})}),F(ot=>({...ot,[K]:""})))};return i.jsxs(ne,{id:s,title:"Issues Board",zIndex:p,width:540,height:520,children:[i.jsxs("div",{style:{flex:1,overflowY:"auto",padding:6,fontSize:"0.8rem"},children:[S.length===0&&i.jsx("div",{style:{padding:10,color:"#888",textAlign:"center"},children:"No open issues"}),S.map(K=>{const ut=nh[K.category]||nh.other,ot=K.created?new Date(K.created).toLocaleDateString("sv-SE"):"",gt=K.comments||[];return i.jsxs("div",{style:{padding:"6px 8px",marginBottom:4,background:"#1f1f1f",borderRadius:3,border:"1px solid #333",opacity:K.resolved?.55:1},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[i.jsx("span",{style:{fontSize:"0.65rem",padding:"1px 6px",borderRadius:3,background:ut.color,color:"#fff",fontWeight:600},children:ut.label}),i.jsx("strong",{style:{fontSize:"0.8rem",flex:1},children:K.title}),i.jsxs("span",{style:{fontSize:"0.65rem",color:"#888"},children:["by ",K.author||"User"]}),i.jsx("span",{style:{color:"#666",fontSize:"0.65rem"},children:ot})]}),K.description&&i.jsx("div",{style:{color:"#999",marginTop:3,fontSize:"0.75rem"},children:K.description}),i.jsxs("div",{style:{display:"flex",gap:4,marginTop:4},children:[K.resolved?i.jsxs(i.Fragment,{children:[i.jsx("button",{style:{...Hn,fontSize:"0.65rem"},onClick:()=>k(`/issues/${K.id}`,{method:"PATCH",body:JSON.stringify({resolved:!1})}),children:"↻ Reopen"}),i.jsx("button",{style:{...Hn,fontSize:"0.65rem",color:"#c66"},onClick:()=>{confirm(`Delete issue "${K.title}"?`)&&k(`/issues/${K.id}`,{method:"DELETE"})},children:"🗑 Delete"})]}):i.jsx("button",{style:{...Hn,fontSize:"0.65rem",background:"rgba(68,204,68,0.15)",color:"#4c4",border:"1px solid rgba(68,204,68,0.3)"},onClick:()=>k(`/issues/${K.id}`,{method:"PATCH",body:JSON.stringify({resolved:!0})}),children:"✓ Resolve"}),i.jsx("button",{style:{...Hn,fontSize:"0.65rem"},onClick:()=>T(K),children:"✎ Edit"})]}),Y===K.id&&i.jsxs("div",{style:{marginTop:4,padding:4,background:"#222",borderRadius:3},children:[i.jsxs("div",{style:{display:"flex",gap:4,marginBottom:4},children:[i.jsx("input",{value:L,onChange:w=>lt(w.target.value),style:{...Ya,flex:1}}),i.jsxs("select",{value:mt,onChange:w=>I(w.target.value),style:uh,children:[i.jsx("option",{value:"plugin",children:"Plugin"}),i.jsx("option",{value:"overlord",children:"Overlord"}),i.jsx("option",{value:"nav",children:"Nav"}),i.jsx("option",{value:"macro",children:"Macro"}),i.jsx("option",{value:"other",children:"Other"})]})]}),i.jsxs("div",{style:{display:"flex",gap:4},children:[i.jsx("textarea",{value:W,onChange:w=>et(w.target.value),rows:2,style:{...Ya,flex:1,fontSize:"0.75rem",resize:"vertical"}}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[i.jsx("button",{style:{...Os,fontSize:"0.7rem",padding:"3px 8px"},onClick:()=>G(K.id),children:"Save"}),i.jsx("button",{style:{...Hn},onClick:()=>U(null),children:"Cancel"})]})]})]}),i.jsxs("div",{style:{marginTop:4,paddingTop:4,borderTop:"1px solid #2a2a2a"},children:[gt.length===0?i.jsx("div",{style:{color:"#555",fontSize:"0.7rem",padding:"2px 0"},children:"No comments yet"}):gt.map(w=>i.jsxs("div",{style:{marginBottom:3,fontSize:"0.72rem"},children:[i.jsx("span",{style:{color:"#8ac",fontWeight:500},children:w.author||"Anonymous"}),i.jsx("span",{style:{color:"#555",marginLeft:6,fontSize:"0.6rem"},children:w.created?new Date(w.created).toLocaleDateString("sv-SE"):""}),i.jsx("div",{style:{color:"#bbb",marginTop:1},children:w.text})]},w.id)),i.jsxs("div",{style:{display:"flex",gap:4,marginTop:3},children:[i.jsx("input",{value:M[K.id]||"",onChange:w=>F(J=>({...J,[K.id]:w.target.value})),placeholder:"Add a comment...",style:{...Ya,flex:1,fontSize:"0.75rem"},onKeyDown:w=>{w.key==="Enter"&&tt(K.id)}}),i.jsx("button",{style:{...Os,fontSize:"0.7rem",padding:"3px 8px"},onClick:()=>tt(K.id),children:"Post"})]})]})]},K.id)})]}),i.jsxs("div",{style:{padding:6,borderTop:"1px solid #333"},children:[i.jsxs("div",{style:{display:"flex",gap:4,marginBottom:4},children:[i.jsx("input",{value:d,onChange:K=>x(K.target.value),placeholder:"Issue title...",style:{...Ya,flex:1},onKeyDown:K=>{K.key==="Enter"&&q()}}),i.jsxs("select",{value:g,onChange:K=>v(K.target.value),style:uh,children:[i.jsx("option",{value:"plugin",children:"Plugin"}),i.jsx("option",{value:"overlord",children:"Overlord"}),i.jsx("option",{value:"nav",children:"Nav"}),i.jsx("option",{value:"macro",children:"Macro"}),i.jsx("option",{value:"other",children:"Other"})]})]}),i.jsxs("div",{style:{display:"flex",gap:4},children:[i.jsx("textarea",{value:E,onChange:K=>R(K.target.value),placeholder:"Description (optional)...",rows:2,style:{...Ya,flex:1,fontSize:"0.75rem",resize:"vertical"}}),i.jsx("button",{style:{...Os,alignSelf:"flex-end"},onClick:q,children:"Add"})]})]})]})},Ry=({id:s,zIndex:p})=>{const[S,o]=N.useState([]);N.useEffect(()=>{const x=async()=>{try{const R=await Pt("/vital-sharing/peers");o(R.peers??[])}catch{}};x();const E=setInterval(x,5e3);return()=>clearInterval(E)},[]);const d=(x,E)=>E>0?Math.min(100,x/E*100):0;return i.jsx(ne,{id:s,title:"Vital Sharing Network",zIndex:p,width:520,height:450,children:i.jsx("div",{style:{flex:1,overflowY:"auto",padding:6,fontSize:"0.75rem"},children:S.length===0?i.jsx("div",{style:{padding:16,color:"#666",textAlign:"center"},children:"No vital-sharing peers connected"}):S.map(x=>{var E,R,g;return i.jsxs("div",{style:{padding:"6px 8px",marginBottom:4,background:"#1f1f1f",borderRadius:3,border:"1px solid #333"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:3},children:[i.jsx("span",{style:{color:x.plugin_connected?"#4c4":"#a33",fontSize:"0.8rem"},children:"●"}),i.jsx("strong",{style:{flex:1},children:x.character_name}),x.subscribed&&i.jsx("span",{style:{color:"#6bf",fontSize:"0.65rem"},children:"[subscribed]"})]}),i.jsxs("div",{style:{color:"#666",fontSize:"0.68rem",marginBottom:3},children:["tags: ",((E=x.tags)==null?void 0:E.join(", "))||"none"]}),x.vitals&&x.vitals.max_health>0&&i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[{label:"HP",cur:x.vitals.current_health,max:x.vitals.max_health,bg:"#330000",fill:"#c44"},{label:"STA",cur:x.vitals.current_stamina,max:x.vitals.max_stamina,bg:"#331a00",fill:"#ca0"},{label:"MANA",cur:x.vitals.current_mana,max:x.vitals.max_mana,bg:"#001433",fill:"#48f"}].map(v=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[i.jsx("span",{style:{width:32,color:"#888",fontSize:"0.65rem"},children:v.label}),i.jsx("div",{style:{flex:1,height:6,background:v.bg,borderRadius:3,overflow:"hidden"},children:i.jsx("div",{style:{width:`${d(v.cur,v.max)}%`,height:"100%",background:v.fill,borderRadius:3}})}),i.jsxs("span",{style:{width:60,textAlign:"right",fontSize:"0.65rem",color:"#888"},children:[v.cur,"/",v.max]})]},v.label))}),x.position&&i.jsxs("div",{style:{color:"#555",fontSize:"0.65rem",marginTop:2},children:[(R=x.position.ns)==null?void 0:R.toFixed(1),"N, ",(g=x.position.ew)==null?void 0:g.toFixed(1),"E"]})]},x.character_name)})})})},Dy=({characters:s,chatMessages:p,nearbyObjects:S,socket:o})=>{const{windows:d}=ni();return i.jsx(i.Fragment,{children:d.map(x=>{var g;const E=x.charName??"";switch(x.id.split("-")[0]){case"chat":return i.jsx(cy,{id:x.id,charName:E,zIndex:x.zIndex,messages:p.get(E)??[],socket:o},x.id);case"stats":return i.jsx(oy,{id:x.id,charName:E,zIndex:x.zIndex},x.id);case"char":return i.jsx(hy,{id:x.id,charName:E,zIndex:x.zIndex,vitals:((g=s.get(E))==null?void 0:g.vitals)??void 0},x.id);case"inv":return i.jsx(by,{id:x.id,charName:E,zIndex:x.zIndex},x.id);case"radar":return i.jsx(Ty,{id:x.id,charName:E,zIndex:x.zIndex,socket:o,radarData:S.get(E)??null},x.id);case"combat":return i.jsx(Oy,{id:x.id,charName:E,zIndex:x.zIndex},x.id);case"issues":return i.jsx(Ny,{id:x.id,zIndex:x.zIndex},x.id);case"vitalsharing":return i.jsx(Ry,{id:x.id,zIndex:x.zIndex},x.id);default:return null}})})};let Uy=0;const By=({recentRares:s})=>{const[p,S]=N.useState([]),[o,d]=N.useState(0),[x,E]=N.useState([]);N.useEffect(()=>{if(s.length>o&&o>0){const g=s.slice(0,s.length-o);for(const v of g){const Y=++Uy;S(U=>[...U,{key:Y,charName:v.character_name,rareName:v.name,exiting:!1}]),R(),setTimeout(()=>{S(U=>U.map(L=>L.key===Y?{...L,exiting:!0}:L)),setTimeout(()=>{S(U=>U.filter(L=>L.key!==Y))},500)},6e3)}}d(s.length)},[s.length]);const R=N.useCallback(()=>{const g=Date.now(),v=["#FFD700","#FF4444","#FF8800","#AA44FF","#4488FF"],Y=Array.from({length:30},(U,L)=>{const lt=Math.PI*2*L/30+(Math.random()-.5)*.5,W=100+Math.random()*200;return{dx:Math.cos(lt)*W,dy:Math.sin(lt)*W-50,color:v[Math.floor(Math.random()*v.length)]}});E(U=>[...U,{id:g,particles:Y}]),setTimeout(()=>E(U=>U.filter(L=>L.id!==g)),2200)},[]);return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"ml-rare-notifications",children:p.map(g=>i.jsxs("div",{className:`ml-rare-notif ${g.exiting?"exiting":""}`,children:[i.jsx("div",{className:"ml-rare-notif-title",children:"🎆 LEGENDARY RARE! 🎆"}),i.jsx("div",{className:"ml-rare-notif-name",children:g.rareName}),i.jsx("div",{className:"ml-rare-notif-by",children:"found by"}),i.jsx("div",{className:"ml-rare-notif-char",children:g.charName})]},g.key))}),i.jsx("div",{className:"ml-fireworks",children:x.map(g=>i.jsx(ai.Fragment,{children:g.particles.map((v,Y)=>i.jsx("div",{className:"ml-firework-particle",style:{left:"50%",top:"30%",backgroundColor:v.color,"--dx":`${v.dx}px`,"--dy":`${v.dy+200}px`}},Y))},g.id))})]})},ih=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf","#ff4444","#44ff44","#4444ff","#ffff44","#ff44ff","#44ffff","#ff8844","#88ff44","#4488ff","#ff4488","#cc3333","#33cc33","#3333cc","#cccc33","#cc33cc","#33cccc","#cc6633","#66cc33","#3366cc","#cc3366","#ff6666","#66ff66","#6666ff","#ffff66","#ff66ff","#66ffff","#ffaa66","#aaff66","#66aaff","#ff66aa","#990099","#009900","#000099","#990000","#009999","#999900","#aa5500","#55aa00","#0055aa","#aa0055","#ffaaaa","#aaffaa","#aaaaff","#ffffaa","#ffaaff","#aaffff","#ffccaa","#ccffaa","#aaccff","#ffaacc"];function Hy(s){let p=0;for(let S=0;S{let d=s.current.get(o);return d||(d=p.current{const S=Yy(),[o,d]=N.useState(!1),[x,E]=N.useState(!1),[R,g]=N.useState(null),v=N.useMemo(()=>Array.from(s.characters.values()).filter(W=>W.telemetry).map(W=>W.telemetry),[s.characters]),Y=N.useMemo(()=>new Map(Array.from(s.characters.values()).filter(W=>W.vitals).map(W=>[W.name,W.vitals])),[s.characters]),[U,L]=N.useState("");N.useEffect(()=>{Pt("/api-version").then(W=>L(W.version??"")).catch(()=>{})},[]);const lt=N.useCallback(W=>{g(et=>et===W?null:W)},[]);return i.jsx(W0,{children:i.jsxs("div",{className:"ml-layout",children:[i.jsx(uy,{players:v,vitals:Y,serverHealth:s.serverHealth,totalRares:s.totalRares,totalKills:s.totalKills,getColor:S,onSelectPlayer:lt,onViewToggle:p,showHeatmap:o,showPortals:x,onToggleHeatmap:d,onTogglePortals:E}),i.jsx(ty,{players:v,getColor:S,onSelectPlayer:lt,showHeatmap:o,showPortals:x,selectedPlayer:R}),i.jsx(Dy,{characters:s.characters,chatMessages:s.chatMessages,nearbyObjects:s.nearbyObjects,socket:s.socketRef.current}),i.jsx(By,{recentRares:s.recentRares}),U&&i.jsxs("div",{className:"ml-version",children:["v",U]})]})})};function Xy(s){const p=N.useRef(null),S=N.useRef(0),o=N.useRef(s);o.current=s;const d=N.useCallback(()=>{var E;if(((E=p.current)==null?void 0:E.readyState)===WebSocket.OPEN)return;const x=new WebSocket($0());p.current=x,x.addEventListener("message",R=>{try{const g=JSON.parse(R.data);o.current(g)}catch{}}),x.addEventListener("close",()=>{p.current=null,S.current=window.setTimeout(d,2e3)}),x.addEventListener("error",()=>{x.close()})},[]);return N.useEffect(()=>(d(),()=>{var x;clearTimeout(S.current),(x=p.current)==null||x.close(),p.current=null}),[d]),p}const Ly=()=>Pt("/live"),Gy=()=>Pt("/combat-stats"),Qy=()=>Pt("/server-health"),wy=()=>Pt("/total-rares"),Zy=()=>Pt("/total-kills");function Vy(){const[s,p]=N.useState(new Map),[S,o]=N.useState(null),[d,x]=N.useState(0),[E,R]=N.useState(0),[g,v]=N.useState([]),[Y,U]=N.useState(new Map),[L,lt]=N.useState(new Map),W=N.useRef(s);W.current=s;const et=N.useCallback((M,F)=>{p(Q=>{const k=new Map(Q),q=k.get(M)??{name:M,telemetry:null,vitals:null,combat:null,lastUpdate:0};return k.set(M,F(q)),k})},[]),mt=N.useCallback(M=>{var F;if(M.type){if(M.type==="telemetry"){const Q=M;et(Q.character_name,k=>({...k,telemetry:Q,lastUpdate:Date.now()}))}else if(M.type==="vitals"){const Q=M;et(Q.character_name,k=>({...k,vitals:Q,lastUpdate:Date.now()}))}else if(M.type==="combat_stats"){const Q=M;et(Q.character_name,k=>({...k,combat:Q,lastUpdate:Date.now()}))}else if(M.type==="rare"){const Q=M;v(k=>[Q,...k].slice(0,50))}else if(M.type==="dungeon_map"){const Q=M;Q.landblock&&(window.__dungeonMapCache||(window.__dungeonMapCache={}),window.__dungeonMapCache[Q.landblock]=Q)}else if(M.type==="nearby_objects"){const Q=M;if(lt(k=>{const q=new Map(k);return q.set(Q.character_name,Q),q}),Q.is_dungeon&&Q.landblock&&!((F=window.__dungeonMapCache)!=null&&F[Q.landblock])){const k=I.current;(k==null?void 0:k.readyState)===WebSocket.OPEN&&k.send(JSON.stringify({type:"request_dungeon_map",landblock:Q.landblock}))}}else if(M.type==="chat"){const Q=M;U(k=>{const q=new Map(k),T=[...q.get(Q.character_name)??[],{text:Q.text,color:Q.color,timestamp:Q.timestamp}];return T.length>1e3&&T.splice(0,T.length-1e3),q.set(Q.character_name,T),q})}}},[et]),I=Xy(mt);return N.useEffect(()=>{const M=async()=>{try{const Q=await Ly();p(k=>{var T;const q=new Map(k);for(const G of Q.players??[]){const tt=q.get(G.character_name);q.set(G.character_name,{name:G.character_name,telemetry:G,vitals:(tt==null?void 0:tt.vitals)??null,combat:(tt==null?void 0:tt.combat)??null,lastUpdate:Date.now()})}for(const G of q.keys())(T=Q.players)!=null&&T.some(tt=>tt.character_name===G)||q.delete(G);return q})}catch{}};M();const F=setInterval(M,5e3);return()=>clearInterval(F)},[]),N.useEffect(()=>{const M=async()=>{try{const Q=await Gy();for(const k of Q.stats??[])et(k.character_name,q=>({...q,combat:{...k,type:"combat_stats"}}))}catch{}};M();const F=setInterval(M,3e4);return()=>clearInterval(F)},[et]),N.useEffect(()=>{const M=async()=>{try{o(await Qy())}catch{}};M();const F=setInterval(M,3e4);return()=>clearInterval(F)},[]),N.useEffect(()=>{const M=async()=>{try{const[Q,k]=await Promise.all([wy(),Zy()]);x(Q.all_time??0),R(k.total??0)}catch{}};M();const F=setInterval(M,3e5);return()=>clearInterval(F)},[]),{characters:s,serverHealth:S,totalRares:d,totalKills:E,recentRares:g,chatMessages:Y,nearbyObjects:L,socketRef:I}}const Ky=N.lazy(()=>k0(()=>import("./DashboardView-BA1NW731.js"),[]));function ky(){const[s,p]=N.useState(()=>localStorage.getItem("v2-view")||"map"),S=Vy(),o=()=>{const d=s==="map"?"dashboard":"map";p(d),localStorage.setItem("v2-view",d)};return s==="map"?i.jsx(qy,{data:S,onViewToggle:o}):i.jsx(N.Suspense,{fallback:i.jsx("div",{style:{background:"#0d0d0d",color:"#888",padding:40,textAlign:"center"},children:"Loading dashboard..."}),children:i.jsx(Ky,{data:S,onViewToggle:o})})}Z0.createRoot(document.getElementById("root")).render(i.jsx(N.StrictMode,{children:i.jsx(ky,{})}));export{ai as R,Pt as a,Jy as c,U0 as g,i as j,N as r}; +`+a.stack}}var ci=Object.prototype.hasOwnProperty,si=s.unstable_scheduleCallback,fi=s.unstable_cancelCallback,dh=s.unstable_shouldYield,hh=s.unstable_requestPaint,fl=s.unstable_now,mh=s.unstable_getCurrentPriorityLevel,Us=s.unstable_ImmediatePriority,Bs=s.unstable_UserBlockingPriority,qn=s.unstable_NormalPriority,yh=s.unstable_LowPriority,Hs=s.unstable_IdlePriority,gh=s.log,vh=s.unstable_setDisableYieldValue,La=null,ol=null;function ue(t){if(typeof gh=="function"&&vh(t),ol&&typeof ol.setStrictMode=="function")try{ol.setStrictMode(La,t)}catch{}}var rl=Math.clz32?Math.clz32:bh,ph=Math.log,xh=Math.LN2;function bh(t){return t>>>=0,t===0?32:31-(ph(t)/xh|0)|0}var Xn=256,Ln=262144,Gn=4194304;function Re(t){var l=t&42;if(l!==0)return l;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Qn(t,l,e){var a=t.pendingLanes;if(a===0)return 0;var n=0,u=t.suspendedLanes,c=t.pingedLanes;t=t.warmLanes;var f=a&134217727;return f!==0?(a=f&~u,a!==0?n=Re(a):(c&=f,c!==0?n=Re(c):e||(e=f&~t,e!==0&&(n=Re(e))))):(f=a&~u,f!==0?n=Re(f):c!==0?n=Re(c):e||(e=a&~t,e!==0&&(n=Re(e)))),n===0?0:l!==0&&l!==n&&(l&u)===0&&(u=n&-n,e=l&-l,u>=e||u===32&&(e&4194048)!==0)?l:n}function Ga(t,l){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&l)===0}function Sh(t,l){switch(t){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ys(){var t=Gn;return Gn<<=1,(Gn&62914560)===0&&(Gn=4194304),t}function oi(t){for(var l=[],e=0;31>e;e++)l.push(t);return l}function Qa(t,l){t.pendingLanes|=l,l!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function _h(t,l,e,a,n,u){var c=t.pendingLanes;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=e,t.entangledLanes&=e,t.errorRecoveryDisabledLanes&=e,t.shellSuspendCounter=0;var f=t.entanglements,r=t.expirationTimes,j=t.hiddenUpdates;for(e=c&~e;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Th=/[\n"\\]/g;function Sl(t){return t.replace(Th,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function gi(t,l,e,a,n,u,c,f){t.name="",c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"?t.type=c:t.removeAttribute("type"),l!=null?c==="number"?(l===0&&t.value===""||t.value!=l)&&(t.value=""+bl(l)):t.value!==""+bl(l)&&(t.value=""+bl(l)):c!=="submit"&&c!=="reset"||t.removeAttribute("value"),l!=null?vi(t,c,bl(l)):e!=null?vi(t,c,bl(e)):a!=null&&t.removeAttribute("value"),n==null&&u!=null&&(t.defaultChecked=!!u),n!=null&&(t.checked=n&&typeof n!="function"&&typeof n!="symbol"),f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?t.name=""+bl(f):t.removeAttribute("name")}function Ws(t,l,e,a,n,u,c,f){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(t.type=u),l!=null||e!=null){if(!(u!=="submit"&&u!=="reset"||l!=null)){yi(t);return}e=e!=null?""+bl(e):"",l=l!=null?""+bl(l):e,f||l===t.value||(t.value=l),t.defaultValue=l}a=a??n,a=typeof a!="function"&&typeof a!="symbol"&&!!a,t.checked=f?t.checked:!!a,t.defaultChecked=!!a,c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(t.name=c),yi(t)}function vi(t,l,e){l==="number"&&Vn(t.ownerDocument)===t||t.defaultValue===""+e||(t.defaultValue=""+e)}function la(t,l,e,a){if(t=t.options,l){l={};for(var n=0;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),_i=!1;if(Ql)try{var Ka={};Object.defineProperty(Ka,"passive",{get:function(){_i=!0}}),window.addEventListener("test",Ka,Ka),window.removeEventListener("test",Ka,Ka)}catch{_i=!1}var ce=null,ji=null,kn=null;function af(){if(kn)return kn;var t,l=ji,e=l.length,a,n="value"in ce?ce.value:ce.textContent,u=n.length;for(t=0;t=$a),of=" ",rf=!1;function df(t,l){switch(t){case"keyup":return em.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function hf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ua=!1;function nm(t,l){switch(t){case"compositionend":return hf(l);case"keypress":return l.which!==32?null:(rf=!0,of);case"textInput":return t=l.data,t===of&&rf?null:t;default:return null}}function um(t,l){if(ua)return t==="compositionend"||!Ti&&df(t,l)?(t=af(),kn=ji=ce=null,ua=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1=l)return{node:e,offset:l-t};t=a}t:{for(;e;){if(e.nextSibling){e=e.nextSibling;break t}e=e.parentNode}e=void 0}e=Sf(e)}}function jf(t,l){return t&&l?t===l?!0:t&&t.nodeType===3?!1:l&&l.nodeType===3?jf(t,l.parentNode):"contains"in t?t.contains(l):t.compareDocumentPosition?!!(t.compareDocumentPosition(l)&16):!1:!1}function zf(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var l=Vn(t.document);l instanceof t.HTMLIFrameElement;){try{var e=typeof l.contentWindow.location.href=="string"}catch{e=!1}if(e)t=l.contentWindow;else break;l=Vn(t.document)}return l}function Ni(t){var l=t&&t.nodeName&&t.nodeName.toLowerCase();return l&&(l==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||l==="textarea"||t.contentEditable==="true")}var hm=Ql&&"documentMode"in document&&11>=document.documentMode,ia=null,Ri=null,Pa=null,Di=!1;function Ef(t,l,e){var a=e.window===e?e.document:e.nodeType===9?e:e.ownerDocument;Di||ia==null||ia!==Vn(a)||(a=ia,"selectionStart"in a&&Ni(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),Pa&&Ia(Pa,a)||(Pa=a,a=Lu(Ri,"onSelect"),0>=c,n-=c,Hl=1<<32-rl(l)+n|e<ht?(bt=at,at=null):bt=at.sibling;var jt=A(b,at,_[ht],H);if(jt===null){at===null&&(at=bt);break}t&&at&&jt.alternate===null&&l(b,at),y=u(jt,y,ht),_t===null?nt=jt:_t.sibling=jt,_t=jt,at=bt}if(ht===_.length)return e(b,at),St&&Zl(b,ht),nt;if(at===null){for(;ht<_.length;ht++)at=X(b,_[ht],H),at!==null&&(y=u(at,y,ht),_t===null?nt=at:_t.sibling=at,_t=at);return St&&Zl(b,ht),nt}for(at=a(at);ht<_.length;ht++)bt=O(at,b,ht,_[ht],H),bt!==null&&(t&&bt.alternate!==null&&at.delete(bt.key===null?ht:bt.key),y=u(bt,y,ht),_t===null?nt=bt:_t.sibling=bt,_t=bt);return t&&at.forEach(function(Ce){return l(b,Ce)}),St&&Zl(b,ht),nt}function ct(b,y,_,H){if(_==null)throw Error(o(151));for(var nt=null,_t=null,at=y,ht=y=0,bt=null,jt=_.next();at!==null&&!jt.done;ht++,jt=_.next()){at.index>ht?(bt=at,at=null):bt=at.sibling;var Ce=A(b,at,jt.value,H);if(Ce===null){at===null&&(at=bt);break}t&&at&&Ce.alternate===null&&l(b,at),y=u(Ce,y,ht),_t===null?nt=Ce:_t.sibling=Ce,_t=Ce,at=bt}if(jt.done)return e(b,at),St&&Zl(b,ht),nt;if(at===null){for(;!jt.done;ht++,jt=_.next())jt=X(b,jt.value,H),jt!==null&&(y=u(jt,y,ht),_t===null?nt=jt:_t.sibling=jt,_t=jt);return St&&Zl(b,ht),nt}for(at=a(at);!jt.done;ht++,jt=_.next())jt=O(at,b,ht,jt.value,H),jt!==null&&(t&&jt.alternate!==null&&at.delete(jt.key===null?ht:jt.key),y=u(jt,y,ht),_t===null?nt=jt:_t.sibling=jt,_t=jt);return t&&at.forEach(function(D0){return l(b,D0)}),St&&Zl(b,ht),nt}function Ct(b,y,_,H){if(typeof _=="object"&&_!==null&&_.type===et&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case lt:t:{for(var nt=_.key;y!==null;){if(y.key===nt){if(nt=_.type,nt===et){if(y.tag===7){e(b,y.sibling),H=n(y,_.props.children),H.return=b,b=H;break t}}else if(y.elementType===nt||typeof nt=="object"&&nt!==null&&nt.$$typeof===G&&we(nt)===y.type){e(b,y.sibling),H=n(y,_.props),un(H,_),H.return=b,b=H;break t}e(b,y);break}else l(b,y);y=y.sibling}_.type===et?(H=qe(_.props.children,b.mode,H,_.key),H.return=b,b=H):(H=au(_.type,_.key,_.props,null,b.mode,H),un(H,_),H.return=b,b=H)}return c(b);case J:t:{for(nt=_.key;y!==null;){if(y.key===nt)if(y.tag===4&&y.stateNode.containerInfo===_.containerInfo&&y.stateNode.implementation===_.implementation){e(b,y.sibling),H=n(y,_.children||[]),H.return=b,b=H;break t}else{e(b,y);break}else l(b,y);y=y.sibling}H=Li(_,b.mode,H),H.return=b,b=H}return c(b);case G:return _=we(_),Ct(b,y,_,H)}if($(_))return P(b,y,_,H);if(ot(_)){if(nt=ot(_),typeof nt!="function")throw Error(o(150));return _=nt.call(_),ct(b,y,_,H)}if(typeof _.then=="function")return Ct(b,y,ou(_),H);if(_.$$typeof===F)return Ct(b,y,iu(b,_),H);ru(b,_)}return typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint"?(_=""+_,y!==null&&y.tag===6?(e(b,y.sibling),H=n(y,_),H.return=b,b=H):(e(b,y),H=Xi(_,b.mode,H),H.return=b,b=H),c(b)):e(b,y)}return function(b,y,_,H){try{nn=0;var nt=Ct(b,y,_,H);return va=null,nt}catch(at){if(at===ga||at===su)throw at;var _t=hl(29,at,null,b.mode);return _t.lanes=H,_t.return=b,_t}finally{}}}var Ve=Jf(!0),$f=Jf(!1),de=!1;function Ii(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Pi(t,l){t=t.updateQueue,l.updateQueue===t&&(l.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function he(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function me(t,l,e){var a=t.updateQueue;if(a===null)return null;if(a=a.shared,(zt&2)!==0){var n=a.pending;return n===null?l.next=l:(l.next=n.next,n.next=l),a.pending=l,l=eu(t),Rf(t,null,e),l}return lu(t,a,l,e),eu(t)}function cn(t,l,e){if(l=l.updateQueue,l!==null&&(l=l.shared,(e&4194048)!==0)){var a=l.lanes;a&=t.pendingLanes,e|=a,l.lanes=e,Xs(t,e)}}function tc(t,l){var e=t.updateQueue,a=t.alternate;if(a!==null&&(a=a.updateQueue,e===a)){var n=null,u=null;if(e=e.firstBaseUpdate,e!==null){do{var c={lane:e.lane,tag:e.tag,payload:e.payload,callback:null,next:null};u===null?n=u=c:u=u.next=c,e=e.next}while(e!==null);u===null?n=u=l:u=u.next=l}else n=u=l;e={baseState:a.baseState,firstBaseUpdate:n,lastBaseUpdate:u,shared:a.shared,callbacks:a.callbacks},t.updateQueue=e;return}t=e.lastBaseUpdate,t===null?e.firstBaseUpdate=l:t.next=l,e.lastBaseUpdate=l}var lc=!1;function sn(){if(lc){var t=ya;if(t!==null)throw t}}function fn(t,l,e,a){lc=!1;var n=t.updateQueue;de=!1;var u=n.firstBaseUpdate,c=n.lastBaseUpdate,f=n.shared.pending;if(f!==null){n.shared.pending=null;var r=f,j=r.next;r.next=null,c===null?u=j:c.next=j,c=r;var D=t.alternate;D!==null&&(D=D.updateQueue,f=D.lastBaseUpdate,f!==c&&(f===null?D.firstBaseUpdate=j:f.next=j,D.lastBaseUpdate=r))}if(u!==null){var X=n.baseState;c=0,D=j=r=null,f=u;do{var A=f.lane&-536870913,O=A!==f.lane;if(O?(xt&A)===A:(a&A)===A){A!==0&&A===ma&&(lc=!0),D!==null&&(D=D.next={lane:0,tag:f.tag,payload:f.payload,callback:null,next:null});t:{var P=t,ct=f;A=l;var Ct=e;switch(ct.tag){case 1:if(P=ct.payload,typeof P=="function"){X=P.call(Ct,X,A);break t}X=P;break t;case 3:P.flags=P.flags&-65537|128;case 0:if(P=ct.payload,A=typeof P=="function"?P.call(Ct,X,A):P,A==null)break t;X=U({},X,A);break t;case 2:de=!0}}A=f.callback,A!==null&&(t.flags|=64,O&&(t.flags|=8192),O=n.callbacks,O===null?n.callbacks=[A]:O.push(A))}else O={lane:A,tag:f.tag,payload:f.payload,callback:f.callback,next:null},D===null?(j=D=O,r=X):D=D.next=O,c|=A;if(f=f.next,f===null){if(f=n.shared.pending,f===null)break;O=f,f=O.next,O.next=null,n.lastBaseUpdate=O,n.shared.pending=null}}while(!0);D===null&&(r=X),n.baseState=r,n.firstBaseUpdate=j,n.lastBaseUpdate=D,u===null&&(n.shared.lanes=0),xe|=c,t.lanes=c,t.memoizedState=X}}function Wf(t,l){if(typeof t!="function")throw Error(o(191,t));t.call(l)}function Ff(t,l){var e=t.callbacks;if(e!==null)for(t.callbacks=null,t=0;tu?u:8;var c=z.T,f={};z.T=f,bc(t,!1,l,e);try{var r=n(),j=z.S;if(j!==null&&j(f,r),r!==null&&typeof r=="object"&&typeof r.then=="function"){var D=_m(r,a);dn(t,l,D,pl(t))}else dn(t,l,a,pl(t))}catch(X){dn(t,l,{then:function(){},status:"rejected",reason:X},pl())}finally{h.p=u,c!==null&&f.types!==null&&(c.types=f.types),z.T=c}}function Tm(){}function pc(t,l,e,a){if(t.tag!==5)throw Error(o(476));var n=Oo(t).queue;Co(t,n,l,B,e===null?Tm:function(){return No(t),e(a)})}function Oo(t){var l=t.memoizedState;if(l!==null)return l;l={memoizedState:B,baseState:B,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jl,lastRenderedState:B},next:null};var e={};return l.next={memoizedState:e,baseState:e,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jl,lastRenderedState:e},next:null},t.memoizedState=l,t=t.alternate,t!==null&&(t.memoizedState=l),l}function No(t){var l=Oo(t);l.next===null&&(l=t.alternate.memoizedState),dn(t,l.next.queue,{},pl())}function xc(){return $t(Cn)}function Ro(){return Xt().memoizedState}function Do(){return Xt().memoizedState}function Cm(t){for(var l=t.return;l!==null;){switch(l.tag){case 24:case 3:var e=pl();t=he(e);var a=me(l,t,e);a!==null&&(sl(a,l,e),cn(a,l,e)),l={cache:Ji()},t.payload=l;return}l=l.return}}function Om(t,l,e){var a=pl();e={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null},Su(t)?Bo(l,e):(e=Yi(t,l,e,a),e!==null&&(sl(e,t,a),Ho(e,l,a)))}function Uo(t,l,e){var a=pl();dn(t,l,e,a)}function dn(t,l,e,a){var n={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null};if(Su(t))Bo(l,n);else{var u=t.alternate;if(t.lanes===0&&(u===null||u.lanes===0)&&(u=l.lastRenderedReducer,u!==null))try{var c=l.lastRenderedState,f=u(c,e);if(n.hasEagerState=!0,n.eagerState=f,dl(f,c))return lu(t,l,n,0),Nt===null&&tu(),!1}catch{}finally{}if(e=Yi(t,l,n,a),e!==null)return sl(e,t,a),Ho(e,l,a),!0}return!1}function bc(t,l,e,a){if(a={lane:2,revertLane:Ic(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Su(t)){if(l)throw Error(o(479))}else l=Yi(t,e,a,2),l!==null&&sl(l,t,2)}function Su(t){var l=t.alternate;return t===rt||l!==null&&l===rt}function Bo(t,l){xa=mu=!0;var e=t.pending;e===null?l.next=l:(l.next=e.next,e.next=l),t.pending=l}function Ho(t,l,e){if((e&4194048)!==0){var a=l.lanes;a&=t.pendingLanes,e|=a,l.lanes=e,Xs(t,e)}}var hn={readContext:$t,use:vu,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useLayoutEffect:Ht,useInsertionEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useSyncExternalStore:Ht,useId:Ht,useHostTransitionStatus:Ht,useFormState:Ht,useActionState:Ht,useOptimistic:Ht,useMemoCache:Ht,useCacheRefresh:Ht};hn.useEffectEvent=Ht;var Yo={readContext:$t,use:vu,useCallback:function(t,l){return Pt().memoizedState=[t,l===void 0?null:l],t},useContext:$t,useEffect:bo,useImperativeHandle:function(t,l,e){e=e!=null?e.concat([t]):null,xu(4194308,4,zo.bind(null,l,t),e)},useLayoutEffect:function(t,l){return xu(4194308,4,t,l)},useInsertionEffect:function(t,l){xu(4,2,t,l)},useMemo:function(t,l){var e=Pt();l=l===void 0?null:l;var a=t();if(Ke){ue(!0);try{t()}finally{ue(!1)}}return e.memoizedState=[a,l],a},useReducer:function(t,l,e){var a=Pt();if(e!==void 0){var n=e(l);if(Ke){ue(!0);try{e(l)}finally{ue(!1)}}}else n=l;return a.memoizedState=a.baseState=n,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:n},a.queue=t,t=t.dispatch=Om.bind(null,rt,t),[a.memoizedState,t]},useRef:function(t){var l=Pt();return t={current:t},l.memoizedState=t},useState:function(t){t=hc(t);var l=t.queue,e=Uo.bind(null,rt,l);return l.dispatch=e,[t.memoizedState,e]},useDebugValue:gc,useDeferredValue:function(t,l){var e=Pt();return vc(e,t,l)},useTransition:function(){var t=hc(!1);return t=Co.bind(null,rt,t.queue,!0,!1),Pt().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,l,e){var a=rt,n=Pt();if(St){if(e===void 0)throw Error(o(407));e=e()}else{if(e=l(),Nt===null)throw Error(o(349));(xt&127)!==0||ao(a,l,e)}n.memoizedState=e;var u={value:e,getSnapshot:l};return n.queue=u,bo(uo.bind(null,a,u,t),[t]),a.flags|=2048,Sa(9,{destroy:void 0},no.bind(null,a,u,e,l),null),e},useId:function(){var t=Pt(),l=Nt.identifierPrefix;if(St){var e=Yl,a=Hl;e=(a&~(1<<32-rl(a)-1)).toString(32)+e,l="_"+l+"R_"+e,e=yu++,0<\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof a.is=="string"?c.createElement("select",{is:a.is}):c.createElement("select"),a.multiple?u.multiple=!0:a.size&&(u.size=a.size);break;default:u=typeof a.is=="string"?c.createElement(n,{is:a.is}):c.createElement(n)}}u[kt]=l,u[el]=a;t:for(c=l.child;c!==null;){if(c.tag===5||c.tag===6)u.appendChild(c.stateNode);else if(c.tag!==4&&c.tag!==27&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===l)break t;for(;c.sibling===null;){if(c.return===null||c.return===l)break t;c=c.return}c.sibling.return=c.return,c=c.sibling}l.stateNode=u;t:switch(Ft(u,n,a),n){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break t;case"img":a=!0;break t;default:a=!1}a&&Wl(l)}}return Ut(l),Uc(l,l.type,t===null?null:t.memoizedProps,l.pendingProps,e),null;case 6:if(t&&l.stateNode!=null)t.memoizedProps!==a&&Wl(l);else{if(typeof a!="string"&&l.stateNode===null)throw Error(o(166));if(t=st.current,da(l)){if(t=l.stateNode,e=l.memoizedProps,a=null,n=Jt,n!==null)switch(n.tag){case 27:case 5:a=n.memoizedProps}t[kt]=l,t=!!(t.nodeValue===e||a!==null&&a.suppressHydrationWarning===!0||ed(t.nodeValue,e)),t||oe(l,!0)}else t=Gu(t).createTextNode(a),t[kt]=l,l.stateNode=t}return Ut(l),null;case 31:if(e=l.memoizedState,t===null||t.memoizedState!==null){if(a=da(l),e!==null){if(t===null){if(!a)throw Error(o(318));if(t=l.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(o(557));t[kt]=l}else Xe(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Ut(l),t=!1}else e=Zi(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=e),t=!0;if(!t)return l.flags&256?(yl(l),l):(yl(l),null);if((l.flags&128)!==0)throw Error(o(558))}return Ut(l),null;case 13:if(a=l.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(n=da(l),a!==null&&a.dehydrated!==null){if(t===null){if(!n)throw Error(o(318));if(n=l.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(317));n[kt]=l}else Xe(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Ut(l),n=!1}else n=Zi(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=n),n=!0;if(!n)return l.flags&256?(yl(l),l):(yl(l),null)}return yl(l),(l.flags&128)!==0?(l.lanes=e,l):(e=a!==null,t=t!==null&&t.memoizedState!==null,e&&(a=l.child,n=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(n=a.alternate.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==n&&(a.flags|=2048)),e!==t&&e&&(l.child.flags|=8192),Au(l,l.updateQueue),Ut(l),null);case 4:return Ot(),t===null&&es(l.stateNode.containerInfo),Ut(l),null;case 10:return Kl(l.type),Ut(l),null;case 19:if(C(qt),a=l.memoizedState,a===null)return Ut(l),null;if(n=(l.flags&128)!==0,u=a.rendering,u===null)if(n)yn(a,!1);else{if(Yt!==0||t!==null&&(t.flags&128)!==0)for(t=l.child;t!==null;){if(u=hu(t),u!==null){for(l.flags|=128,yn(a,!1),t=u.updateQueue,l.updateQueue=t,Au(l,t),l.subtreeFlags=0,t=e,e=l.child;e!==null;)Df(e,t),e=e.sibling;return Z(qt,qt.current&1|2),St&&Zl(l,a.treeForkCount),l.child}t=t.sibling}a.tail!==null&&fl()>Nu&&(l.flags|=128,n=!0,yn(a,!1),l.lanes=4194304)}else{if(!n)if(t=hu(u),t!==null){if(l.flags|=128,n=!0,t=t.updateQueue,l.updateQueue=t,Au(l,t),yn(a,!0),a.tail===null&&a.tailMode==="hidden"&&!u.alternate&&!St)return Ut(l),null}else 2*fl()-a.renderingStartTime>Nu&&e!==536870912&&(l.flags|=128,n=!0,yn(a,!1),l.lanes=4194304);a.isBackwards?(u.sibling=l.child,l.child=u):(t=a.last,t!==null?t.sibling=u:l.child=u,a.last=u)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=fl(),t.sibling=null,e=qt.current,Z(qt,n?e&1|2:e&1),St&&Zl(l,a.treeForkCount),t):(Ut(l),null);case 22:case 23:return yl(l),ac(),a=l.memoizedState!==null,t!==null?t.memoizedState!==null!==a&&(l.flags|=8192):a&&(l.flags|=8192),a?(e&536870912)!==0&&(l.flags&128)===0&&(Ut(l),l.subtreeFlags&6&&(l.flags|=8192)):Ut(l),e=l.updateQueue,e!==null&&Au(l,e.retryQueue),e=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),a=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(a=l.memoizedState.cachePool.pool),a!==e&&(l.flags|=2048),t!==null&&C(Qe),null;case 24:return e=null,t!==null&&(e=t.memoizedState.cache),l.memoizedState.cache!==e&&(l.flags|=2048),Kl(Lt),Ut(l),null;case 25:return null;case 30:return null}throw Error(o(156,l.tag))}function Bm(t,l){switch(Qi(l),l.tag){case 1:return t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 3:return Kl(Lt),Ot(),t=l.flags,(t&65536)!==0&&(t&128)===0?(l.flags=t&-65537|128,l):null;case 26:case 27:case 5:return Bl(l),null;case 31:if(l.memoizedState!==null){if(yl(l),l.alternate===null)throw Error(o(340));Xe()}return t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 13:if(yl(l),t=l.memoizedState,t!==null&&t.dehydrated!==null){if(l.alternate===null)throw Error(o(340));Xe()}return t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 19:return C(qt),null;case 4:return Ot(),null;case 10:return Kl(l.type),null;case 22:case 23:return yl(l),ac(),t!==null&&C(Qe),t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 24:return Kl(Lt),null;case 25:return null;default:return null}}function cr(t,l){switch(Qi(l),l.tag){case 3:Kl(Lt),Ot();break;case 26:case 27:case 5:Bl(l);break;case 4:Ot();break;case 31:l.memoizedState!==null&&yl(l);break;case 13:yl(l);break;case 19:C(qt);break;case 10:Kl(l.type);break;case 22:case 23:yl(l),ac(),t!==null&&C(Qe);break;case 24:Kl(Lt)}}function gn(t,l){try{var e=l.updateQueue,a=e!==null?e.lastEffect:null;if(a!==null){var n=a.next;e=n;do{if((e.tag&t)===t){a=void 0;var u=e.create,c=e.inst;a=u(),c.destroy=a}e=e.next}while(e!==n)}}catch(f){At(l,l.return,f)}}function ve(t,l,e){try{var a=l.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var u=n.next;a=u;do{if((a.tag&t)===t){var c=a.inst,f=c.destroy;if(f!==void 0){c.destroy=void 0,n=l;var r=e,j=f;try{j()}catch(D){At(n,r,D)}}}a=a.next}while(a!==u)}}catch(D){At(l,l.return,D)}}function sr(t){var l=t.updateQueue;if(l!==null){var e=t.stateNode;try{Ff(l,e)}catch(a){At(t,t.return,a)}}}function fr(t,l,e){e.props=ke(t.type,t.memoizedProps),e.state=t.memoizedState;try{e.componentWillUnmount()}catch(a){At(t,l,a)}}function vn(t,l){try{var e=t.ref;if(e!==null){switch(t.tag){case 26:case 27:case 5:var a=t.stateNode;break;case 30:a=t.stateNode;break;default:a=t.stateNode}typeof e=="function"?t.refCleanup=e(a):e.current=a}}catch(n){At(t,l,n)}}function ql(t,l){var e=t.ref,a=t.refCleanup;if(e!==null)if(typeof a=="function")try{a()}catch(n){At(t,l,n)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof e=="function")try{e(null)}catch(n){At(t,l,n)}else e.current=null}function or(t){var l=t.type,e=t.memoizedProps,a=t.stateNode;try{t:switch(l){case"button":case"input":case"select":case"textarea":e.autoFocus&&a.focus();break t;case"img":e.src?a.src=e.src:e.srcSet&&(a.srcset=e.srcSet)}}catch(n){At(t,t.return,n)}}function Bc(t,l,e){try{var a=t.stateNode;a0(a,t.type,e,l),a[el]=l}catch(n){At(t,t.return,n)}}function rr(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ze(t.type)||t.tag===4}function Hc(t){t:for(;;){for(;t.sibling===null;){if(t.return===null||rr(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&ze(t.type)||t.flags&2||t.child===null||t.tag===4)continue t;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Yc(t,l,e){var a=t.tag;if(a===5||a===6)t=t.stateNode,l?(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e).insertBefore(t,l):(l=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.appendChild(t),e=e._reactRootContainer,e!=null||l.onclick!==null||(l.onclick=Gl));else if(a!==4&&(a===27&&ze(t.type)&&(e=t.stateNode,l=null),t=t.child,t!==null))for(Yc(t,l,e),t=t.sibling;t!==null;)Yc(t,l,e),t=t.sibling}function Mu(t,l,e){var a=t.tag;if(a===5||a===6)t=t.stateNode,l?e.insertBefore(t,l):e.appendChild(t);else if(a!==4&&(a===27&&ze(t.type)&&(e=t.stateNode),t=t.child,t!==null))for(Mu(t,l,e),t=t.sibling;t!==null;)Mu(t,l,e),t=t.sibling}function dr(t){var l=t.stateNode,e=t.memoizedProps;try{for(var a=t.type,n=l.attributes;n.length;)l.removeAttributeNode(n[0]);Ft(l,a,e),l[kt]=t,l[el]=e}catch(u){At(t,t.return,u)}}var Fl=!1,wt=!1,qc=!1,hr=typeof WeakSet=="function"?WeakSet:Set,Kt=null;function Hm(t,l){if(t=t.containerInfo,us=Ju,t=zf(t),Ni(t)){if("selectionStart"in t)var e={start:t.selectionStart,end:t.selectionEnd};else t:{e=(e=t.ownerDocument)&&e.defaultView||window;var a=e.getSelection&&e.getSelection();if(a&&a.rangeCount!==0){e=a.anchorNode;var n=a.anchorOffset,u=a.focusNode;a=a.focusOffset;try{e.nodeType,u.nodeType}catch{e=null;break t}var c=0,f=-1,r=-1,j=0,D=0,X=t,A=null;l:for(;;){for(var O;X!==e||n!==0&&X.nodeType!==3||(f=c+n),X!==u||a!==0&&X.nodeType!==3||(r=c+a),X.nodeType===3&&(c+=X.nodeValue.length),(O=X.firstChild)!==null;)A=X,X=O;for(;;){if(X===t)break l;if(A===e&&++j===n&&(f=c),A===u&&++D===a&&(r=c),(O=X.nextSibling)!==null)break;X=A,A=X.parentNode}X=O}e=f===-1||r===-1?null:{start:f,end:r}}else e=null}e=e||{start:0,end:0}}else e=null;for(is={focusedElem:t,selectionRange:e},Ju=!1,Kt=l;Kt!==null;)if(l=Kt,t=l.child,(l.subtreeFlags&1028)!==0&&t!==null)t.return=l,Kt=t;else for(;Kt!==null;){switch(l=Kt,u=l.alternate,t=l.flags,l.tag){case 0:if((t&4)!==0&&(t=l.updateQueue,t=t!==null?t.events:null,t!==null))for(e=0;e title"))),Ft(u,a,e),u[kt]=t,Vt(u),a=u;break t;case"link":var c=xd("link","href",n).get(a+(e.href||""));if(c){for(var f=0;fCt&&(c=Ct,Ct=ct,ct=c);var b=_f(f,ct),y=_f(f,Ct);if(b&&y&&(O.rangeCount!==1||O.anchorNode!==b.node||O.anchorOffset!==b.offset||O.focusNode!==y.node||O.focusOffset!==y.offset)){var _=X.createRange();_.setStart(b.node,b.offset),O.removeAllRanges(),ct>Ct?(O.addRange(_),O.extend(y.node,y.offset)):(_.setEnd(y.node,y.offset),O.addRange(_))}}}}for(X=[],O=f;O=O.parentNode;)O.nodeType===1&&X.push({element:O,left:O.scrollLeft,top:O.scrollTop});for(typeof f.focus=="function"&&f.focus(),f=0;fe?32:e,z.T=null,e=Vc,Vc=null;var u=Se,c=ee;if(Zt=0,Aa=Se=null,ee=0,(zt&6)!==0)throw Error(o(331));var f=zt;if(zt|=4,zr(u.current),Sr(u,u.current,c,e),zt=f,jn(0,!1),ol&&typeof ol.onPostCommitFiberRoot=="function")try{ol.onPostCommitFiberRoot(La,u)}catch{}return!0}finally{h.p=n,z.T=a,Qr(t,l)}}function Zr(t,l,e){l=jl(e,l),l=zc(t.stateNode,l,2),t=me(t,l,2),t!==null&&(Qa(t,2),Xl(t))}function At(t,l,e){if(t.tag===3)Zr(t,t,e);else for(;l!==null;){if(l.tag===3){Zr(l,t,e);break}else if(l.tag===1){var a=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(be===null||!be.has(a))){t=jl(e,t),e=Vo(2),a=me(l,e,2),a!==null&&(Ko(e,a,l,t),Qa(a,2),Xl(a));break}}l=l.return}}function $c(t,l,e){var a=t.pingCache;if(a===null){a=t.pingCache=new Xm;var n=new Set;a.set(l,n)}else n=a.get(l),n===void 0&&(n=new Set,a.set(l,n));n.has(e)||(Gc=!0,n.add(e),t=Zm.bind(null,t,l,e),l.then(t,t))}function Zm(t,l,e){var a=t.pingCache;a!==null&&a.delete(l),t.pingedLanes|=t.suspendedLanes&e,t.warmLanes&=~e,Nt===t&&(xt&e)===e&&(Yt===4||Yt===3&&(xt&62914560)===xt&&300>fl()-Ou?(zt&2)===0&&Ma(t,0):Qc|=e,Ea===xt&&(Ea=0)),Xl(t)}function Vr(t,l){l===0&&(l=Ys()),t=Ye(t,l),t!==null&&(Qa(t,l),Xl(t))}function Vm(t){var l=t.memoizedState,e=0;l!==null&&(e=l.retryLane),Vr(t,e)}function Km(t,l){var e=0;switch(t.tag){case 31:case 13:var a=t.stateNode,n=t.memoizedState;n!==null&&(e=n.retryLane);break;case 19:a=t.stateNode;break;case 22:a=t.stateNode._retryCache;break;default:throw Error(o(314))}a!==null&&a.delete(l),Vr(t,e)}function km(t,l){return si(t,l)}var Yu=null,Ca=null,Wc=!1,qu=!1,Fc=!1,je=0;function Xl(t){t!==Ca&&t.next===null&&(Ca===null?Yu=Ca=t:Ca=Ca.next=t),qu=!0,Wc||(Wc=!0,$m())}function jn(t,l){if(!Fc&&qu){Fc=!0;do for(var e=!1,a=Yu;a!==null;){if(t!==0){var n=a.pendingLanes;if(n===0)var u=0;else{var c=a.suspendedLanes,f=a.pingedLanes;u=(1<<31-rl(42|t)+1)-1,u&=n&~(c&~f),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(e=!0,$r(a,u))}else u=xt,u=Qn(a,a===Nt?u:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(u&3)===0||Ga(a,u)||(e=!0,$r(a,u));a=a.next}while(e);Fc=!1}}function Jm(){Kr()}function Kr(){qu=Wc=!1;var t=0;je!==0&&u0()&&(t=je);for(var l=fl(),e=null,a=Yu;a!==null;){var n=a.next,u=kr(a,l);u===0?(a.next=null,e===null?Yu=n:e.next=n,n===null&&(Ca=e)):(e=a,(t!==0||(u&3)!==0)&&(qu=!0)),a=n}Zt!==0&&Zt!==5||jn(t),je!==0&&(je=0)}function kr(t,l){for(var e=t.suspendedLanes,a=t.pingedLanes,n=t.expirationTimes,u=t.pendingLanes&-62914561;0f)break;var D=r.transferSize,X=r.initiatorType;D&&ad(X)&&(r=r.responseEnd,c+=D*(r"u"?null:document;function yd(t,l,e){var a=Oa;if(a&&typeof l=="string"&&l){var n=Sl(l);n='link[rel="'+t+'"][href="'+n+'"]',typeof e=="string"&&(n+='[crossorigin="'+e+'"]'),md.has(n)||(md.add(n),t={rel:t,crossOrigin:e,href:l},a.querySelector(n)===null&&(l=a.createElement("link"),Ft(l,"link",t),Vt(l),a.head.appendChild(l)))}}function m0(t){ae.D(t),yd("dns-prefetch",t,null)}function y0(t,l){ae.C(t,l),yd("preconnect",t,l)}function g0(t,l,e){ae.L(t,l,e);var a=Oa;if(a&&t&&l){var n='link[rel="preload"][as="'+Sl(l)+'"]';l==="image"&&e&&e.imageSrcSet?(n+='[imagesrcset="'+Sl(e.imageSrcSet)+'"]',typeof e.imageSizes=="string"&&(n+='[imagesizes="'+Sl(e.imageSizes)+'"]')):n+='[href="'+Sl(t)+'"]';var u=n;switch(l){case"style":u=Na(t);break;case"script":u=Ra(t)}Cl.has(u)||(t=U({rel:"preload",href:l==="image"&&e&&e.imageSrcSet?void 0:t,as:l},e),Cl.set(u,t),a.querySelector(n)!==null||l==="style"&&a.querySelector(Mn(u))||l==="script"&&a.querySelector(Tn(u))||(l=a.createElement("link"),Ft(l,"link",t),Vt(l),a.head.appendChild(l)))}}function v0(t,l){ae.m(t,l);var e=Oa;if(e&&t){var a=l&&typeof l.as=="string"?l.as:"script",n='link[rel="modulepreload"][as="'+Sl(a)+'"][href="'+Sl(t)+'"]',u=n;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=Ra(t)}if(!Cl.has(u)&&(t=U({rel:"modulepreload",href:t},l),Cl.set(u,t),e.querySelector(n)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(e.querySelector(Tn(u)))return}a=e.createElement("link"),Ft(a,"link",t),Vt(a),e.head.appendChild(a)}}}function p0(t,l,e){ae.S(t,l,e);var a=Oa;if(a&&t){var n=Pe(a).hoistableStyles,u=Na(t);l=l||"default";var c=n.get(u);if(!c){var f={loading:0,preload:null};if(c=a.querySelector(Mn(u)))f.loading=5;else{t=U({rel:"stylesheet",href:t,"data-precedence":l},e),(e=Cl.get(u))&&hs(t,e);var r=c=a.createElement("link");Vt(r),Ft(r,"link",t),r._p=new Promise(function(j,D){r.onload=j,r.onerror=D}),r.addEventListener("load",function(){f.loading|=1}),r.addEventListener("error",function(){f.loading|=2}),f.loading|=4,wu(c,l,a)}c={type:"stylesheet",instance:c,count:1,state:f},n.set(u,c)}}}function x0(t,l){ae.X(t,l);var e=Oa;if(e&&t){var a=Pe(e).hoistableScripts,n=Ra(t),u=a.get(n);u||(u=e.querySelector(Tn(n)),u||(t=U({src:t,async:!0},l),(l=Cl.get(n))&&ms(t,l),u=e.createElement("script"),Vt(u),Ft(u,"link",t),e.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(n,u))}}function b0(t,l){ae.M(t,l);var e=Oa;if(e&&t){var a=Pe(e).hoistableScripts,n=Ra(t),u=a.get(n);u||(u=e.querySelector(Tn(n)),u||(t=U({src:t,async:!0,type:"module"},l),(l=Cl.get(n))&&ms(t,l),u=e.createElement("script"),Vt(u),Ft(u,"link",t),e.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(n,u))}}function gd(t,l,e,a){var n=(n=st.current)?Qu(n):null;if(!n)throw Error(o(446));switch(t){case"meta":case"title":return null;case"style":return typeof e.precedence=="string"&&typeof e.href=="string"?(l=Na(e.href),e=Pe(n).hoistableStyles,a=e.get(l),a||(a={type:"style",instance:null,count:0,state:null},e.set(l,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(e.rel==="stylesheet"&&typeof e.href=="string"&&typeof e.precedence=="string"){t=Na(e.href);var u=Pe(n).hoistableStyles,c=u.get(t);if(c||(n=n.ownerDocument||n,c={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(t,c),(u=n.querySelector(Mn(t)))&&!u._p&&(c.instance=u,c.state.loading=5),Cl.has(t)||(e={rel:"preload",as:"style",href:e.href,crossOrigin:e.crossOrigin,integrity:e.integrity,media:e.media,hrefLang:e.hrefLang,referrerPolicy:e.referrerPolicy},Cl.set(t,e),u||S0(n,t,e,c.state))),l&&a===null)throw Error(o(528,""));return c}if(l&&a!==null)throw Error(o(529,""));return null;case"script":return l=e.async,e=e.src,typeof e=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=Ra(e),e=Pe(n).hoistableScripts,a=e.get(l),a||(a={type:"script",instance:null,count:0,state:null},e.set(l,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,t))}}function Na(t){return'href="'+Sl(t)+'"'}function Mn(t){return'link[rel="stylesheet"]['+t+"]"}function vd(t){return U({},t,{"data-precedence":t.precedence,precedence:null})}function S0(t,l,e,a){t.querySelector('link[rel="preload"][as="style"]['+l+"]")?a.loading=1:(l=t.createElement("link"),a.preload=l,l.addEventListener("load",function(){return a.loading|=1}),l.addEventListener("error",function(){return a.loading|=2}),Ft(l,"link",e),Vt(l),t.head.appendChild(l))}function Ra(t){return'[src="'+Sl(t)+'"]'}function Tn(t){return"script[async]"+t}function pd(t,l,e){if(l.count++,l.instance===null)switch(l.type){case"style":var a=t.querySelector('style[data-href~="'+Sl(e.href)+'"]');if(a)return l.instance=a,Vt(a),a;var n=U({},e,{"data-href":e.href,"data-precedence":e.precedence,href:null,precedence:null});return a=(t.ownerDocument||t).createElement("style"),Vt(a),Ft(a,"style",n),wu(a,e.precedence,t),l.instance=a;case"stylesheet":n=Na(e.href);var u=t.querySelector(Mn(n));if(u)return l.state.loading|=4,l.instance=u,Vt(u),u;a=vd(e),(n=Cl.get(n))&&hs(a,n),u=(t.ownerDocument||t).createElement("link"),Vt(u);var c=u;return c._p=new Promise(function(f,r){c.onload=f,c.onerror=r}),Ft(u,"link",a),l.state.loading|=4,wu(u,e.precedence,t),l.instance=u;case"script":return u=Ra(e.src),(n=t.querySelector(Tn(u)))?(l.instance=n,Vt(n),n):(a=e,(n=Cl.get(u))&&(a=U({},e),ms(a,n)),t=t.ownerDocument||t,n=t.createElement("script"),Vt(n),Ft(n,"link",a),t.head.appendChild(n),l.instance=n);case"void":return null;default:throw Error(o(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(a=l.instance,l.state.loading|=4,wu(a,e.precedence,t));return l.instance}function wu(t,l,e){for(var a=e.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),n=a.length?a[a.length-1]:null,u=n,c=0;c title"):null)}function _0(t,l,e){if(e===1||l.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return t=l.disabled,typeof l.precedence=="string"&&t==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function Sd(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function j0(t,l,e,a){if(e.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(e.state.loading&4)===0){if(e.instance===null){var n=Na(a.href),u=l.querySelector(Mn(n));if(u){l=u._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(t.count++,t=Vu.bind(t),l.then(t,t)),e.state.loading|=4,e.instance=u,Vt(u);return}u=l.ownerDocument||l,a=vd(a),(n=Cl.get(n))&&hs(a,n),u=u.createElement("link"),Vt(u);var c=u;c._p=new Promise(function(f,r){c.onload=f,c.onerror=r}),Ft(u,"link",a),e.instance=u}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(e,l),(l=e.state.preload)&&(e.state.loading&3)===0&&(t.count++,e=Vu.bind(t),l.addEventListener("load",e),l.addEventListener("error",e))}}var ys=0;function z0(t,l){return t.stylesheets&&t.count===0&&ku(t,t.stylesheets),0ys?50:800)+l);return t.unsuspend=e,function(){t.unsuspend=null,clearTimeout(a),clearTimeout(n)}}:null}function Vu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ku(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Ku=null;function ku(t,l){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Ku=new Map,l.forEach(E0,t),Ku=null,Vu.call(t))}function E0(t,l){if(!(l.state.loading&4)){var e=Ku.get(t);if(e)var a=e.get(null);else{e=new Map,Ku.set(t,e);for(var n=t.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(p){console.error(p)}}return s(),zs.exports=Q0(),zs.exports}var Z0=w0();const V0="modulepreload",K0=function(s){return"/v2/"+s},Vd={},k0=function(p,S,o){let d=Promise.resolve();if(S&&S.length>0){let E=function(v){return Promise.all(v.map(Y=>Promise.resolve(Y).then(U=>({status:"fulfilled",value:U}),U=>({status:"rejected",reason:U}))))};document.getElementsByTagName("link");const R=document.querySelector("meta[property=csp-nonce]"),g=(R==null?void 0:R.nonce)||(R==null?void 0:R.getAttribute("nonce"));d=E(S.map(v=>{if(v=K0(v),v in Vd)return;Vd[v]=!0;const Y=v.endsWith(".css"),U=Y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${v}"]${U}`))return;const L=document.createElement("link");if(L.rel=Y?"stylesheet":V0,Y||(L.as="script"),L.crossOrigin="",L.href=v,g&&L.setAttribute("nonce",g),document.head.appendChild(L),Y)return new Promise((lt,J)=>{L.addEventListener("load",lt),L.addEventListener("error",()=>J(new Error(`Unable to preload CSS for ${v}`)))})}))}function x(E){const R=new Event("vite:preloadError",{cancelable:!0});if(R.payload=E,window.dispatchEvent(R),!R.defaultPrevented)throw E}return d.then(E=>{for(const R of E||[])R.status==="rejected"&&x(R.reason);return p().catch(x)})},ch=N.createContext({windows:[],openWindow:()=>{},closeWindow:()=>{},bringToFront:()=>{}}),J0=({children:s})=>{const[p,S]=N.useState([]),o=N.useRef(1e4),d=N.useCallback((R,g,v)=>{S(Y=>Y.find(L=>L.id===R)?Y.map(L=>L.id===R?{...L,zIndex:++o.current}:L):[...Y,{id:R,title:g,charName:v,zIndex:++o.current}])},[]),x=N.useCallback(R=>{S(g=>g.filter(v=>v.id!==R))},[]),E=N.useCallback(R=>{S(g=>g.map(v=>v.id===R?{...v,zIndex:++o.current}:v))},[]);return i.jsx(ch.Provider,{value:{windows:p,openWindow:d,closeWindow:x,bringToFront:E},children:s})},ni=()=>N.useContext(ch),Ol={west:-102.1,east:102.1,north:102.1,south:-102.1};function Yn(s,p,S,o){const d=(s-Ol.west)/(Ol.east-Ol.west)*S,x=(Ol.north-p)/(Ol.north-Ol.south)*o;return{x:d,y:x}}function $0(s,p,S,o,d,x,E){const R=(s-o)/S,g=(p-d)/S,v=Ol.west+R/x*(Ol.east-Ol.west),Y=Ol.north-g/E*(Ol.north-Ol.south);return{ew:v,ns:Y}}function Ns(s,p){const S=s>=0?"N":"S",o=p>=0?"E":"W";return`${Math.abs(s).toFixed(1)}${S}, ${Math.abs(p).toFixed(1)}${o}`}const sh=ai.memo(({players:s,imgW:p,imgH:S,getColor:o,onHover:d,onSelect:x,selectedPlayer:E})=>{const R=N.useMemo(()=>s.filter(g=>g.ew!==void 0&&g.ns!==void 0).map(g=>({...g,pos:Yn(g.ew,g.ns,p,S),color:o(g.character_name)})),[s,p,S,o]);return i.jsx("div",{className:"ml-dots-layer",children:R.map(g=>i.jsx("div",{className:`ml-dot ${E===g.character_name?"ml-dot-selected":""}`,style:{left:g.pos.x,top:g.pos.y,backgroundColor:g.color},onMouseEnter:v=>{var U;const Y=(U=v.currentTarget.closest(".ml-map-container"))==null?void 0:U.getBoundingClientRect();Y&&d(g,v.clientX-Y.left,v.clientY-Y.top)},onMouseLeave:()=>d(null,0,0),onClick:()=>x(g.character_name)},g.character_name))})});sh.displayName="PlayerDots";const W0="/api";async function tl(s){const p=await fetch(`${W0}${s}`,{credentials:"include"});if(!p.ok)throw new Error(`API ${s}: ${p.status}`);return p.json()}function F0(){return`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/api/ws/live`}const fh=ai.memo(({imgW:s,imgH:p,getColor:S})=>{const[o,d]=N.useState([]);N.useEffect(()=>{const E=async()=>{try{const g=await tl("/trails/?seconds=600");d(g.trails??[])}catch{}};E();const R=setInterval(E,2e3);return()=>clearInterval(R)},[]);const x=N.useMemo(()=>{const E={};for(const R of o){const{x:g,y:v}=Yn(R.ew,R.ns,s,p);E[R.character_name]||(E[R.character_name]=[]),E[R.character_name].push(`${g},${v}`)}return Object.entries(E).filter(([,R])=>R.length>=2).map(([R,g])=>({name:R,points:g.join(" ")}))},[o,s,p]);return i.jsx("svg",{className:"ml-trails-svg",viewBox:`0 0 ${s} ${p}`,preserveAspectRatio:"none",children:x.map(E=>i.jsx("polyline",{points:E.points,stroke:S(E.name),fill:"none",strokeWidth:2,strokeOpacity:.7,strokeLinecap:"round",strokeLinejoin:"round"},E.name))})});fh.displayName="TrailsSVG";const I0=({imgW:s,imgH:p,enabled:S})=>{const o=N.useRef(null),[d,x]=N.useState([]);return N.useEffect(()=>{if(!S)return;(async()=>{try{const R=await tl("/spawns/heatmap?hours=24&limit=50000");x(R.spawn_points??[])}catch{}})()},[S]),N.useEffect(()=>{const E=o.current;if(!E||!S||d.length===0||s===0)return;E.width=s,E.height=p;const R=E.getContext("2d");if(R){R.clearRect(0,0,s,p);for(const g of d){const{x:v,y:Y}=Yn(g.ew,g.ns,s,p),U=Math.max(5,Math.min(12,5+Math.sqrt(g.intensity*.5))),L=R.createRadialGradient(v,Y,0,v,Y,U);L.addColorStop(0,`rgba(255, 0, 0, ${Math.min(.9,g.intensity/40)})`),L.addColorStop(.6,`rgba(255, 100, 0, ${Math.min(.4,g.intensity/120)})`),L.addColorStop(1,"rgba(255, 150, 0, 0)"),R.fillStyle=L,R.fillRect(v-U,Y-U,U*2,U*2)}}},[d,s,p,S]),S?i.jsx("canvas",{ref:o,className:"ml-heatmap-canvas"}):null},P0=({imgW:s,imgH:p,enabled:S})=>{const[o,d]=N.useState([]);N.useEffect(()=>{if(!S)return;const E=async()=>{try{const g=await tl("/portals");d(g.portals??[])}catch{}};E();const R=setInterval(E,6e4);return()=>clearInterval(R)},[S]);const x=N.useMemo(()=>o.map(E=>({...E,pos:Yn(E.coordinates.ew,E.coordinates.ns,s,p)})),[o,s,p]);return!S||x.length===0?null:i.jsx("div",{className:"ml-portals-layer",children:x.map((E,R)=>i.jsx("div",{className:"ml-portal-icon",style:{left:E.pos.x,top:E.pos.y},title:`${E.portal_name} (by ${E.discovered_by})`},R))})},Kd=20,kd=.3,ty=({players:s,getColor:p,onSelectPlayer:S,showHeatmap:o,showPortals:d,selectedPlayer:x})=>{var k;const E=N.useRef(null),R=N.useRef(null),[g,v]=N.useState({w:0,h:0}),[Y,U]=N.useState(null),[L,lt]=N.useState(null),J=N.useRef({scale:1,offX:0,offY:0}),et=N.useRef({dragging:!1,sx:0,sy:0,startOffX:0,startOffY:0}),mt=N.useCallback(()=>{if(R.current){const{scale:q,offX:T,offY:G}=J.current;R.current.style.transform=`translate(${T}px, ${G}px) scale(${q})`}},[]),I=N.useCallback(q=>{const T=q.currentTarget;if(v({w:T.naturalWidth,h:T.naturalHeight}),E.current){const G=E.current.clientWidth,tt=E.current.clientHeight,K=Math.min(G/T.naturalWidth,tt/T.naturalHeight);J.current={scale:K,offX:(G-T.naturalWidth*K)/2,offY:(tt-T.naturalHeight*K)/2},mt()}},[mt]),M=N.useCallback(q=>{var w;q.preventDefault();const T=(w=E.current)==null?void 0:w.getBoundingClientRect();if(!T)return;const G=J.current,tt=q.deltaY<0?1.1:.9,K=Math.min(Kd,Math.max(kd,G.scale*tt)),ut=K/G.scale,ot=q.clientX-T.left,gt=q.clientY-T.top;J.current={scale:K,offX:ot-(ot-G.offX)*ut,offY:gt-(gt-G.offY)*ut},mt()},[mt]),F=N.useCallback(q=>{if(q.button!==0)return;const T=J.current;et.current={dragging:!0,sx:q.clientX,sy:q.clientY,startOffX:T.offX,startOffY:T.offY}},[]);N.useEffect(()=>{const q=G=>{const tt=et.current;if(tt.dragging&&(J.current.offX=tt.startOffX+(G.clientX-tt.sx),J.current.offY=tt.startOffY+(G.clientY-tt.sy),mt()),E.current&&g.w>0){const K=E.current.getBoundingClientRect(),ut=J.current,ot=$0(G.clientX-K.left,G.clientY-K.top,ut.scale,ut.offX,ut.offY,g.w,g.h);lt(ot)}},T=()=>{et.current.dragging=!1};return window.addEventListener("mousemove",q),window.addEventListener("mouseup",T),()=>{window.removeEventListener("mousemove",q),window.removeEventListener("mouseup",T)}},[mt,g.w,g.h]),N.useEffect(()=>{if(!x||g.w===0||!E.current)return;const q=s.find(ut=>ut.character_name===x);if(!q)return;const{x:T,y:G}=Yn(q.ew,q.ns,g.w,g.h),tt=E.current.getBoundingClientRect(),K=3;J.current={scale:Math.min(Kd,Math.max(kd,K)),offX:tt.width/2-T*K,offY:tt.height/2-G*K},mt()},[x,s,g.w,g.h,mt]);const Q=N.useCallback((q,T,G)=>{U(q?{x:T,y:G,player:q}:null)},[]);return i.jsxs("div",{className:"ml-map-container",ref:E,onWheel:M,onMouseDown:F,children:[i.jsxs("div",{ref:R,className:"ml-map-group",children:[i.jsx("img",{src:"/dereth.png",alt:"Dereth",className:"ml-map-img",onLoad:I,draggable:!1}),g.w>0&&i.jsxs(i.Fragment,{children:[i.jsx(I0,{imgW:g.w,imgH:g.h,enabled:o}),i.jsx(fh,{imgW:g.w,imgH:g.h,getColor:p}),i.jsx(sh,{players:s,imgW:g.w,imgH:g.h,getColor:p,onHover:Q,onSelect:S,selectedPlayer:x}),i.jsx(P0,{imgW:g.w,imgH:g.h,enabled:d})]})]}),Y&&i.jsxs("div",{className:"ml-tooltip",style:{left:Y.x+12,top:Y.y-10},children:[i.jsx("strong",{children:Y.player.character_name}),i.jsx("br",{}),Ns(Y.player.ns,Y.player.ew),i.jsx("br",{}),Y.player.kills_per_hour," kph · ",(k=Y.player.kills)==null?void 0:k.toLocaleString()," kills"]}),L&&i.jsx("div",{className:"ml-coords",children:Ns(L.ns,L.ew)})]})},oh=ai.memo(({player:s,vitals:p,color:S,onSelect:o})=>{var v,Y;const{openWindow:d}=ni(),x=(s.vt_state||"idle").toLowerCase(),E=x==="combat"||x==="hunt",R=(s.total_rares??0)>0?Math.round((s.total_kills??0)/(s.total_rares??1)).toLocaleString():null,g=s.character_name;return i.jsxs("li",{className:"ml-player-row",style:{borderLeftColor:S},children:[i.jsxs("div",{className:"ml-pr-header",onClick:o,children:[i.jsx("span",{className:"ml-pr-name",children:g}),i.jsx("span",{className:"ml-pr-coords",children:Ns(s.ns,s.ew)})]}),i.jsxs("div",{className:"ml-pr-vitals",children:[i.jsx("div",{className:"ml-vital-bar hp",children:i.jsx("div",{className:"ml-vital-fill",style:{width:`${(p==null?void 0:p.health_percentage)??0}%`}})}),i.jsx("div",{className:"ml-vital-bar sta",children:i.jsx("div",{className:"ml-vital-fill",style:{width:`${(p==null?void 0:p.stamina_percentage)??0}%`}})}),i.jsx("div",{className:"ml-vital-bar mana",children:i.jsx("div",{className:"ml-vital-fill",style:{width:`${(p==null?void 0:p.mana_percentage)??0}%`}})})]}),i.jsxs("div",{className:"ml-pr-grid",children:[i.jsxs("span",{className:"ml-gs",title:"Session kills",children:["⚔️ ",((v=s.kills)==null?void 0:v.toLocaleString())??0]}),i.jsxs("span",{className:"ml-gs",title:"Total kills",children:["🏆 ",(s.total_kills??0).toLocaleString()]}),i.jsxs("span",{className:"ml-gs",title:"Kills per hour",children:[s.kills_per_hour??"0"," ",i.jsx("span",{className:"ml-suffix",children:"KPH"})]}),i.jsxs("span",{className:"ml-gs",title:"Rares (session / total)",children:["💎 ",s.session_rares??0," / ",s.total_rares??0]}),i.jsx("span",{className:"ml-gs",title:"Kills per rare",children:R?i.jsxs(i.Fragment,{children:["📊 ",R," ",i.jsx("span",{className:"ml-suffix",children:"KPR"})]}):""}),i.jsx("span",{className:`ml-meta-pill ${E?"active":""}`,children:s.vt_state||"idle"}),i.jsxs("span",{className:"ml-gs",title:"Online time",children:["🕐 ",((Y=s.onlinetime)==null?void 0:Y.replace(/^00\./,""))??"--"]}),i.jsxs("span",{className:"ml-gs",title:"Deaths",children:["☠️ ",s.deaths??"0"]}),i.jsxs("span",{className:"ml-gs",title:"Prismatic tapers",children:[i.jsx("img",{src:"/prismatic-taper-icon.png",className:"ml-taper-icon",alt:""}),s.prismatic_taper_count??"0"]})]}),i.jsxs("div",{className:"ml-pr-buttons",children:[i.jsx("button",{className:"ml-btn accent",onClick:()=>d(`chat-${g}`,`Chat: ${g}`,g),children:"Chat"}),i.jsx("button",{className:"ml-btn accent",onClick:()=>d(`stats-${g}`,`Stats: ${g}`,g),children:"Stats"}),i.jsx("button",{className:"ml-btn accent",onClick:()=>d(`inv-${g}`,`Inventory: ${g}`,g),children:"Inv"}),i.jsx("button",{className:"ml-btn",onClick:()=>d(`char-${g}`,`Character: ${g}`,g),children:"Char"}),i.jsx("button",{className:"ml-btn",onClick:()=>d(`combat-${g}`,`Combat: ${g}`,g),children:"Combat"}),i.jsx("button",{className:"ml-btn",onClick:()=>d(`radar-${g}`,`Radar: ${g}`,g),children:"Radar"})]})]})});oh.displayName="PlayerRow";const ly=({players:s,vitals:p,getColor:S,onSelect:o})=>i.jsx("ul",{className:"ml-player-list",children:s.map(d=>i.jsx(oh,{player:d,vitals:p.get(d.character_name)??null,color:S(d.character_name),onSelect:()=>o(d.character_name)},d.character_name))}),ey=[{key:"name",label:"Name"},{key:"kph",label:"KPH"},{key:"skills",label:"S.Kills"},{key:"srares",label:"S.Rares"},{key:"tkills",label:"T.Kills"},{key:"kpr",label:"KPR"}],ay=({value:s,onChange:p})=>i.jsx("div",{className:"ml-sort-buttons",children:ey.map(S=>i.jsx("button",{className:`ml-sort-btn ${s===S.key?"active":""}`,onClick:()=>p(S.key),children:S.label},S.key))}),ny=()=>{const{openWindow:s}=ni();return i.jsxs("div",{className:"ml-tool-links",children:[i.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},onClick:()=>s("issues","Issues Board"),children:"📋 Issues"}),i.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},onClick:()=>s("vitalsharing","Vital Sharing"),children:"🤝 Vitals"}),i.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},onClick:()=>s("combatpicker","Combat Stats"),children:"⚔️ Combat"})]})},uy=({players:s,vitals:p,serverHealth:S,totalRares:o,totalKills:d,getColor:x,onSelectPlayer:E,onViewToggle:R,showHeatmap:g,showPortals:v,onToggleHeatmap:Y,onTogglePortals:U})=>{var Q,k;const[L,lt]=N.useState("name"),[J,et]=N.useState(""),mt=N.useMemo(()=>s.reduce((q,T)=>q+(parseInt(T.kills_per_hour)||0),0),[s]),I=((Q=S==null?void 0:S.status)==null?void 0:Q.toLowerCase())==="online"||((k=S==null?void 0:S.status)==null?void 0:k.toLowerCase())==="up",M=N.useDeferredValue(s),F=N.useMemo(()=>{let q=[...M];switch(J&&(q=q.filter(T=>T.character_name.toLowerCase().startsWith(J.toLowerCase()))),L){case"kph":q.sort((T,G)=>(parseInt(G.kills_per_hour)||0)-(parseInt(T.kills_per_hour)||0));break;case"skills":q.sort((T,G)=>(G.kills||0)-(T.kills||0));break;case"srares":q.sort((T,G)=>(G.session_rares??0)-(T.session_rares??0));break;case"tkills":q.sort((T,G)=>(G.total_kills??0)-(T.total_kills??0));break;case"kpr":q.sort((T,G)=>{const tt=(T.total_kills??0)/Math.max(1,T.total_rares??1),K=(G.total_kills??0)/Math.max(1,G.total_rares??1);return tt-K});break;default:q.sort((T,G)=>T.character_name.localeCompare(G.character_name))}return q},[M,L,J]);return i.jsxs("div",{className:"ml-sidebar",children:[i.jsxs("div",{className:"ml-sidebar-header",children:[i.jsxs("span",{className:"ml-sidebar-title",children:["Active Mosswart Enjoyers (",s.length,")"]}),i.jsx("button",{className:"ml-view-toggle",onClick:R,children:"Dashboard"})]}),i.jsxs("div",{className:"ml-server-status",children:[i.jsx("span",{className:`ml-status-dot ${I?"online":"offline"}`}),i.jsxs("span",{className:"ml-status-text",children:["Coldeve ",I?"Online":"Offline"]}),(S==null?void 0:S.player_count)!=null&&i.jsxs("span",{className:"ml-status-detail",children:["👥 ",S.player_count]}),(S==null?void 0:S.latency_ms)!=null&&i.jsxs("span",{className:"ml-status-detail",children:[Math.round(S.latency_ms),"ms"]}),(S==null?void 0:S.uptime_seconds)!=null&&i.jsxs("span",{className:"ml-status-detail",children:["Up: ",Math.floor(S.uptime_seconds/3600),"h"]})]}),i.jsxs("div",{className:"ml-counters",children:[i.jsxs("div",{className:"ml-counter rares",children:[i.jsx("span",{className:"ml-counter-val",children:o}),i.jsx("span",{className:"ml-counter-lbl",children:"Rares"})]}),i.jsxs("div",{className:`ml-counter kph ${mt>5e3?"ultra":""}`,children:[i.jsx("span",{className:"ml-counter-val",children:mt.toLocaleString()}),i.jsx("span",{className:"ml-counter-lbl",children:"Server KPH"})]}),i.jsxs("div",{className:"ml-counter kills",children:[i.jsx("span",{className:"ml-counter-val",children:d.toLocaleString()}),i.jsx("span",{className:"ml-counter-lbl",children:"Kills"})]})]}),i.jsxs("div",{className:"ml-tool-links",children:[i.jsx("a",{href:"/inventory.html",className:"ml-tool-link",children:"🔍 Inv Search"}),i.jsx("a",{href:"/suitbuilder.html",className:"ml-tool-link",children:"🛡️ Suitbuilder"}),i.jsx("a",{href:"/debug.html",className:"ml-tool-link",children:"🐛 Debug"}),i.jsx("a",{href:"/quest-status.html",target:"_blank",className:"ml-tool-link",children:"📜 Quests"})]}),i.jsx(ny,{}),i.jsxs("div",{className:"ml-toggles",children:[i.jsxs("label",{className:"ml-toggle-label",children:[i.jsx("input",{type:"checkbox",checked:g,onChange:q=>Y(q.target.checked)}),i.jsx("span",{children:"Spawn Heatmap"})]}),i.jsxs("label",{className:"ml-toggle-label",children:[i.jsx("input",{type:"checkbox",checked:v,onChange:q=>U(q.target.checked)}),i.jsx("span",{children:"Portals"})]})]}),i.jsx(ay,{value:L,onChange:lt}),i.jsx("input",{className:"ml-filter",type:"text",placeholder:"Filter players...",value:J,onChange:q=>et(q.target.value)}),i.jsx(ly,{players:F,vitals:p,getColor:x,onSelect:E})]})},ne=({id:s,title:p,zIndex:S,width:o=700,height:d=340,children:x})=>{const{closeWindow:E,bringToFront:R}=ni(),g=N.useRef(null),v=N.useRef({dragging:!1,sx:0,sy:0,ox:0,oy:0}),Y=N.useRef({x:420,y:10+Math.random()*40}),U=N.useCallback(L=>{var J;L.preventDefault(),R(s);const lt=(J=g.current)==null?void 0:J.getBoundingClientRect();lt&&(v.current={dragging:!0,sx:L.clientX,sy:L.clientY,ox:lt.left,oy:lt.top})},[s,R]);return N.useEffect(()=>{const L=J=>{const et=v.current;!et.dragging||!g.current||(Y.current.x=et.ox+(J.clientX-et.sx),Y.current.y=et.oy+(J.clientY-et.sy),g.current.style.left=`${Y.current.x}px`,g.current.style.top=`${Y.current.y}px`)},lt=()=>{v.current.dragging=!1};return window.addEventListener("mousemove",L),window.addEventListener("mouseup",lt),()=>{window.removeEventListener("mousemove",L),window.removeEventListener("mouseup",lt)}},[]),i.jsxs("div",{ref:g,className:"ml-window",style:{zIndex:S,width:o,height:d,left:Y.current.x,top:Y.current.y},onMouseDown:()=>R(s),children:[i.jsxs("div",{className:"ml-window-header",onMouseDown:U,children:[i.jsx("span",{className:"ml-window-title",children:p}),i.jsx("button",{className:"ml-window-close",onClick:()=>E(s),children:"×"})]}),i.jsx("div",{className:"ml-window-content",children:x})]})},iy={0:"#00FF00",2:"#FFFFFF",3:"#FF0000",4:"#FFFFFF",5:"#33CCFF",6:"#CCFF99",7:"#00FFFF",14:"#FFD700",15:"#FF69B4",17:"#AAAAFF",18:"#88FF88",21:"#FF8888",22:"#FFAA66"},cy=({id:s,charName:p,zIndex:S,messages:o,socket:d})=>{const x=N.useRef(null),[E,R]=N.useState("");N.useEffect(()=>{x.current&&(x.current.scrollTop=x.current.scrollHeight)},[o.length]);const g=v=>{v.preventDefault();const Y=E.trim();!Y||!d||d.readyState!==WebSocket.OPEN||(d.send(JSON.stringify({player_name:p,command:Y})),R(""))};return i.jsxs(ne,{id:s,title:`Chat: ${p}`,zIndex:S,width:600,height:300,children:[i.jsx("div",{className:"ml-chat-messages",ref:x,children:o.map((v,Y)=>i.jsx("div",{className:"ml-chat-line",style:{color:iy[v.color??2]??"#ddd"},children:v.text},Y))}),i.jsx("form",{className:"ml-chat-form",onSubmit:g,children:i.jsx("input",{className:"ml-chat-input",value:E,onChange:v=>R(v.target.value),placeholder:"Enter chat..."})})]})},sy=[{title:"Kills per Hour",id:1},{title:"Memory (MB)",id:2},{title:"CPU (%)",id:3},{title:"Mem Handles",id:4}],fy=[{label:"1H",value:"now-1h"},{label:"6H",value:"now-6h"},{label:"24H",value:"now-24h"},{label:"7D",value:"now-7d"}],oy=({id:s,charName:p,zIndex:S})=>{const[o,d]=N.useState("now-24h"),x=E=>`/grafana/d-solo/dereth-tracker/dereth-tracker-dashboard?panelId=${E}&var-character=${encodeURIComponent(p)}&from=${o}&to=now&theme=light`;return i.jsxs(ne,{id:s,title:`Stats: ${p}`,zIndex:S,width:750,height:480,children:[i.jsx("div",{className:"ml-stats-controls",children:fy.map(E=>i.jsx("button",{className:`ml-stats-range-btn ${o===E.value?"active":""}`,onClick:()=>d(E.value),children:E.label},E.value))}),i.jsx("div",{className:"ml-stats-grid",children:sy.map(E=>i.jsx("div",{className:"ml-stats-panel",children:i.jsx("iframe",{src:x(E.id),width:"100%",height:"100%",frameBorder:"0",title:E.title})},E.id))})]})},Jd={218:"Reinforcement of the Lugians",219:"Bleeargh's Fortitude",220:"Oswald's Enhancement",221:"Siraluun's Blessing",222:"Enduring Calm",223:"Steadfast Will",224:"Ciandra's Essence",225:"Yoshi's Essence",226:"Jibril's Essence",227:"Celdiseth's Essence",228:"Koga's Essence",229:"Shadow of the Seventh Mule",230:"Might of the Seventh Mule",231:"Clutch of the Miser",232:"Enduring Enchantment",233:"Critical Protection",234:"Quick Learner",235:"Ciandra's Fortune",236:"Charmed Smith",237:"Innate Renewal",238:"Archmage's Endurance",239:"Enhancement of the Blade Turner",240:"Enhancement of the Arrow Turner",241:"Enhancement of the Mace Turner",242:"Caustic Enhancement",243:"Fierce Impaler",244:"Iron Skin of the Invincible",245:"Eye of the Remorseless",246:"Hand of the Remorseless",294:"Master of the Steel Circle",295:"Master of the Focused Eye",296:"Master of the Five Fold Path",297:"Frenzy of the Slayer",298:"Iron Skin of the Invincible",299:"Jack of All Trades",300:"Infused Void Magic",301:"Infused War Magic",302:"Infused Life Magic",309:"Infused Item Magic",310:"Infused Creature Magic",326:"Clutch of the Miser",328:"Enduring Enchantment"},$d={333:"Valor / Destruction",334:"Protection",335:"Glory / Retribution",336:"Temperance / Hardening",338:"Aetheric Vision",339:"Mana Flow",340:"Mana Infusion",342:"Purity",343:"Craftsman",344:"Specialization",365:"World"},Wd={370:"Damage",371:"Damage Resistance",372:"Critical",373:"Critical Resistance",374:"Critical Damage",375:"Critical Damage Resistance",376:"Healing Boost",379:"Vitality"},Fd={287:"Celestial Hand",288:"Eldrytch Web",289:"Radiant Blood"},Id={354:"Melee",355:"Ranged",362:"Summoning"},ry={1:"Unarmed",2:"Swords",3:"Axes",4:"Maces",5:"Spears",6:"Daggers",7:"Staves",8:"Bows",9:"Crossbows",10:"Thrown",11:"Two-Handed",12:"Void",13:"War",14:"Life"},Pd={181:"Chess Rank",192:"Fishing Skill",199:"Total Augmentations",322:"Aetheria Slots",390:"Enlightenment"};function dy(s){return s>=1001?"Master":s>=301?"Lord":s>=151?"Knight":s>=31?"Adept":"Initiate"}const xl="#af7a30",li="#000022",hy=({id:s,charName:p,zIndex:S,vitals:o})=>{var $,z;const[d,x]=N.useState(null),[E,R]=N.useState(0),[g,v]=N.useState(0);N.useEffect(()=>{tl(`/character-stats/${encodeURIComponent(p)}`).then(x).catch(()=>{})},[p]);const Y=h=>h!=null?Number(h).toLocaleString():"—",U=(d==null?void 0:d.stats_data)||d||{},L=U.attributes||{},lt=U.skills||{},J=U.vitals||{},et=U.titles||[],mt=U.properties||{},I=Object.entries(lt).filter(([,h])=>(h==null?void 0:h.training)==="Specialized").sort(([h],[B])=>h.localeCompare(B)),M=Object.entries(lt).filter(([,h])=>(h==null?void 0:h.training)==="Trained").sort(([h],[B])=>h.localeCompare(B)),F=Object.entries(mt).filter(([h,B])=>Jd[parseInt(h)]&&Number(B)>0).map(([h,B])=>({name:Jd[parseInt(h)],uses:Number(B)})),Q=Object.entries(mt).filter(([h,B])=>$d[parseInt(h)]&&Number(B)>0).map(([h,B])=>({name:$d[parseInt(h)],uses:Number(B)})),k=Object.entries(mt).filter(([h,B])=>Wd[parseInt(h)]&&Number(B)>0).map(([h,B])=>({name:Wd[parseInt(h)],value:Number(B)})),q=[];d!=null&&d.birth&&q.push({name:"Birth",value:d.birth}),(d==null?void 0:d.deaths)!=null&&q.push({name:"Deaths",value:Y(d.deaths)}),Object.entries(mt).forEach(([h,B])=>{const W=parseInt(h);Pd[W]&&q.push({name:Pd[W],value:B})});const T=[];Object.entries(mt).forEach(([h,B])=>{const W=parseInt(h);Id[W]&&T.push({name:Id[W],value:ry[Number(B)]||`Unknown (${B})`})});const G=[];Object.entries(mt).forEach(([h,B])=>{const W=parseInt(h);Fd[W]&&Number(B)>0&&G.push({name:Fd[W],rank:dy(Number(B)),value:Number(B)})});const tt=h=>({padding:"5px 8px",fontSize:12,fontWeight:"bold",color:"#fff",cursor:"pointer",userSelect:"none",borderTop:`2px solid ${h?xl:li}`,borderLeft:`2px solid ${h?xl:li}`,borderRight:`2px solid ${h?xl:li}`,background:h?"rgba(0,100,0,0.4)":"transparent"}),K={background:"#000",border:`2px solid ${xl}`,maxHeight:400,overflowY:"auto",overflowX:"hidden"},ut={background:"#222",fontWeight:"bold",fontSize:12,padding:"2px 6px"},ot={padding:"2px 6px",background:"rgba(0,100,0,0.4)",whiteSpace:"nowrap"},gt={padding:"2px 6px",background:"rgba(0,0,100,0.4)",textAlign:"right",whiteSpace:"nowrap"},w={padding:"2px 6px",color:"#ccc"};return i.jsx(ne,{id:s,title:`Character: ${p}`,zIndex:S,width:740,height:600,children:i.jsxs("div",{style:{background:li,color:"#fff",font:'14px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif',overflowY:"auto",padding:"10px 15px 15px",flex:1},children:[i.jsxs("div",{style:{marginBottom:10},children:[i.jsxs("h1",{style:{margin:"0 0 2px",fontSize:28,fontWeight:"bold"},children:[p,i.jsx("span",{style:{fontSize:"200%",color:"#fff27f",float:"right"},children:(d==null?void 0:d.level)||""})]}),i.jsx("div",{style:{fontSize:"85%",color:"gold"},children:[d==null?void 0:d.gender,d==null?void 0:d.race].filter(Boolean).join(" ")||"Awaiting character data..."})]}),i.jsxs("div",{style:{fontSize:"85%",margin:"6px 0 10px",display:"grid",gridTemplateColumns:"1fr 1fr",gap:"0 20px"},children:[i.jsxs("div",{children:["Total XP: ",Y(d==null?void 0:d.total_xp)]}),i.jsxs("div",{style:{textAlign:"right"},children:["Unassigned XP: ",Y(d==null?void 0:d.unassigned_xp)]}),i.jsxs("div",{children:["Luminance: ",(d==null?void 0:d.luminance_earned)!=null?`${Y(d.luminance_earned)} / ${Y(d.luminance_total)}`:"—"]}),i.jsxs("div",{style:{textAlign:"right"},children:["Deaths: ",Y(d==null?void 0:d.deaths)]})]}),i.jsxs("div",{style:{display:"flex",gap:13,flexWrap:"wrap"},children:[i.jsxs("div",{style:{width:320},children:[i.jsx("div",{style:{height:30,display:"flex"},children:["Attributes","Skills","Titles"].map((h,B)=>i.jsx("div",{style:tt(E===B),onClick:()=>R(B),children:h},h))}),i.jsxs("div",{style:K,children:[E===0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{padding:"6px 8px",display:"flex",flexDirection:"column",gap:8,borderBottom:`2px solid ${xl}`},children:[{label:"Health",pct:(o==null?void 0:o.health_percentage)??0,cur:o==null?void 0:o.health_current,max:o==null?void 0:o.health_max,bg:"#cc3333"},{label:"Stamina",pct:(o==null?void 0:o.stamina_percentage)??0,cur:o==null?void 0:o.stamina_current,max:o==null?void 0:o.stamina_max,bg:"#ccaa33"},{label:"Mana",pct:(o==null?void 0:o.mana_percentage)??0,cur:o==null?void 0:o.mana_current,max:o==null?void 0:o.mana_max,bg:"#3366cc"}].map(h=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[i.jsx("span",{style:{width:55,fontSize:12,color:"#ccc"},children:h.label}),i.jsx("div",{style:{flex:1,height:14,overflow:"hidden",position:"relative",border:`1px solid ${xl}`},children:i.jsx("div",{style:{height:"100%",width:`${h.pct}%`,background:h.bg,transition:"width 0.5s ease"}})}),i.jsxs("span",{style:{width:80,textAlign:"right",fontSize:12,color:"#ccc"},children:[h.cur??"—"," / ",h.max??"—"]})]},h.label))}),i.jsxs("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("td",{style:ut,children:"Attribute"}),i.jsx("td",{style:ut,children:"Creation"}),i.jsx("td",{style:ut,children:"Base"})]})}),i.jsx("tbody",{children:["strength","endurance","coordination","quickness","focus","self"].map(h=>{var B,W;return i.jsxs("tr",{children:[i.jsx("td",{style:ot,children:h.charAt(0).toUpperCase()+h.slice(1)}),i.jsx("td",{style:w,children:((B=L[h])==null?void 0:B.creation)??"—"}),i.jsx("td",{style:gt,children:((W=L[h])==null?void 0:W.base)??"—"})]},h)})})]}),i.jsxs("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("td",{style:ut,children:"Vital"}),i.jsx("td",{style:ut,children:"Base"})]})}),i.jsx("tbody",{children:["health","stamina","mana"].map(h=>{var B;return i.jsxs("tr",{children:[i.jsx("td",{style:ot,children:h.charAt(0).toUpperCase()+h.slice(1)}),i.jsx("td",{style:gt,children:((B=J[h])==null?void 0:B.base)??"—"})]},h)})})]}),i.jsx("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:i.jsx("tbody",{children:i.jsxs("tr",{children:[i.jsx("td",{style:ot,children:"Skill Credits"}),i.jsx("td",{style:gt,children:Y(U.skill_credits)})]})})})]}),E===1&&i.jsxs("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("td",{style:ut,children:"Skill"}),i.jsx("td",{style:ut,children:"Level"})]})}),i.jsxs("tbody",{children:[I.map(([h,B])=>i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px",background:"linear-gradient(to right, #392067, #392067, black)"},children:h.replace(/_/g," ").replace(/\b\w/g,W=>W.toUpperCase())}),i.jsx("td",{style:{...gt,background:"linear-gradient(to right, #392067, #392067, black)"},children:B.base})]},h)),M.map(([h,B])=>i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px",background:"linear-gradient(to right, #0f3c3e, #0f3c3e, black)"},children:h.replace(/_/g," ").replace(/\b\w/g,W=>W.toUpperCase())}),i.jsx("td",{style:{...gt,background:"linear-gradient(to right, #0f3c3e, #0f3c3e, black)"},children:B.base})]},h)),I.length===0&&M.length===0&&i.jsx("tr",{children:i.jsx("td",{colSpan:2,style:{padding:10,color:"#666",fontStyle:"italic",textAlign:"center"},children:"No skill data"})})]})]}),E===2&&i.jsx("div",{style:{padding:"6px 10px",fontSize:13},children:et.length>0?et.map((h,B)=>i.jsx("div",{style:{padding:"1px 0"},children:h},B)):i.jsx("div",{style:{color:"#666",fontStyle:"italic",textAlign:"center",padding:10},children:"No titles"})})]})]}),i.jsxs("div",{style:{width:320},children:[i.jsx("div",{style:{height:30,display:"flex"},children:["Augmentations","Ratings","Other"].map((h,B)=>i.jsx("div",{style:tt(g===B),onClick:()=>v(B),children:h},h))}),i.jsxs("div",{style:K,children:[g===0&&(F.length||Q.length?i.jsxs(i.Fragment,{children:[F.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{background:"#222",padding:"4px 8px",fontWeight:"bold",fontSize:13,borderBottom:`1px solid ${xl}`},children:"Augmentations"}),i.jsxs("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("td",{style:ut,children:"Name"}),i.jsx("td",{style:ut,children:"Uses"})]})}),i.jsx("tbody",{children:F.map(h=>i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px"},children:h.name}),i.jsx("td",{style:{padding:"2px 6px",textAlign:"right"},children:h.uses})]},h.name))})]})]}),Q.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{background:"#222",padding:"4px 8px",fontWeight:"bold",fontSize:13,borderBottom:`1px solid ${xl}`},children:"Auras"}),i.jsxs("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("td",{style:ut,children:"Name"}),i.jsx("td",{style:ut,children:"Uses"})]})}),i.jsx("tbody",{children:Q.map(h=>i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px"},children:h.name}),i.jsx("td",{style:{padding:"2px 6px",textAlign:"right"},children:h.uses})]},h.name))})]})]})]}):i.jsx("div",{style:{color:"#666",fontStyle:"italic",textAlign:"center",padding:10},children:"No augmentation data"})),g===1&&(k.length>0?i.jsxs("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("td",{style:ut,children:"Rating"}),i.jsx("td",{style:ut,children:"Value"})]})}),i.jsx("tbody",{children:k.map(h=>i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px"},children:h.name}),i.jsx("td",{style:{padding:"2px 6px",textAlign:"right"},children:h.value})]},h.name))})]}):i.jsx("div",{style:{color:"#666",fontStyle:"italic",textAlign:"center",padding:10},children:"No rating data"})),g===2&&i.jsxs("div",{children:[q.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{background:"#222",padding:"4px 8px",fontWeight:"bold",fontSize:13,borderBottom:`1px solid ${xl}`},children:"General"}),i.jsx("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:i.jsx("tbody",{children:q.map(h=>i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px"},children:h.name}),i.jsx("td",{style:{padding:"2px 6px",textAlign:"right"},children:h.value})]},h.name))})})]}),T.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{background:"#222",padding:"4px 8px",fontWeight:"bold",fontSize:13,borderBottom:`1px solid ${xl}`},children:"Masteries"}),i.jsx("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:i.jsx("tbody",{children:T.map(h=>i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px"},children:h.name}),i.jsx("td",{style:{padding:"2px 6px",textAlign:"right"},children:h.value})]},h.name))})})]}),G.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{background:"#222",padding:"4px 8px",fontWeight:"bold",fontSize:13,borderBottom:`1px solid ${xl}`},children:"Society"}),i.jsx("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:i.jsx("tbody",{children:G.map(h=>i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px"},children:h.name}),i.jsxs("td",{style:{padding:"2px 6px",textAlign:"right"},children:[h.rank," (",h.value,")"]})]},h.name))})})]}),q.length===0&&T.length===0&&G.length===0&&i.jsx("div",{style:{color:"#666",fontStyle:"italic",textAlign:"center",padding:10},children:"No additional data"})]})]})]})]}),(d==null?void 0:d.allegiance)&&i.jsxs("div",{style:{marginTop:5,border:`2px solid ${xl}`,background:"#000"},children:[i.jsx("div",{style:{background:"#222",padding:"4px 8px",fontWeight:"bold",fontSize:13,borderBottom:`1px solid ${xl}`},children:"Allegiance"}),i.jsx("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:i.jsxs("tbody",{children:[d.allegiance.name&&i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px",color:"#ccc",width:100},children:"Name"}),i.jsx("td",{style:{padding:"2px 6px"},children:d.allegiance.name})]}),(($=d.allegiance.monarch)==null?void 0:$.name)&&i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px",color:"#ccc"},children:"Monarch"}),i.jsx("td",{style:{padding:"2px 6px"},children:d.allegiance.monarch.name})]}),((z=d.allegiance.patron)==null?void 0:z.name)&&i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px",color:"#ccc"},children:"Patron"}),i.jsx("td",{style:{padding:"2px 6px"},children:d.allegiance.patron.name})]}),d.allegiance.rank!=null&&i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px",color:"#ccc"},children:"Rank"}),i.jsx("td",{style:{padding:"2px 6px"},children:d.allegiance.rank})]}),d.allegiance.followers!=null&&i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"2px 6px",color:"#ccc"},children:"Followers"}),i.jsx("td",{style:{padding:"2px 6px"},children:d.allegiance.followers})]})]})})]})]})})};function my(s){var o,d;if(!s)return s;const p=x=>x!=null&&x!==-1&&x!==-1?x:void 0,S=s.IntValues||{};return{item_id:s.item_id??s.Id??0,name:s.name??s.Name??((o=s.StringValues)==null?void 0:o["1"])??"Unknown",icon:s.icon??s.Icon??0,object_class:s.object_class??s.ObjectClass??0,current_wielded_location:s.current_wielded_location??p(s.CurrentWieldedLocation)??p(Number(S[10]))??0,container_id:s.container_id??s.ContainerId??0,items_capacity:s.items_capacity??p(s.ItemsCapacity)??p(Number(S[6]))??((d=s.enhanced_properties)==null?void 0:d.ItemSlots_Decal)??void 0,value:s.value??p(s.Value)??p(Number(S[19]))??0,burden:s.burden??p(s.Burden)??p(Number(S[5]))??0,armor_level:s.armor_level??p(s.ArmorLevel),max_damage:s.max_damage??p(s.MaxDamage),material:s.material??s.material_name??s.Material??void 0,item_set:s.item_set??s.ItemSet??void 0,imbue:s.imbue??s.Imbue??void 0,tinks:s.tinks??p(s.Tinks),workmanship:s.workmanship??p(s.Workmanship),equip_skill:s.equip_skill??s.equip_skill_name??s.EquipSkill??void 0,wield_level:s.wield_level??p(s.WieldLevel),skill_level:s.skill_level??p(s.SkillLevel),lore_requirement:s.lore_requirement??p(s.LoreRequirement),attack_bonus:s.attack_bonus??p(s.AttackBonus),melee_defense_bonus:s.melee_defense_bonus??p(s.MeleeDefenseBonus),magic_defense_bonus:s.magic_defense_bonus??p(s.MagicDBonus),damage_bonus:s.damage_bonus??p(s.DamageBonus),damage_rating:s.damage_rating??p(s.DamRating),crit_rating:s.crit_rating??p(s.CritRating),heal_boost_rating:s.heal_boost_rating??p(s.HealBoostRating),current_mana:s.current_mana??p(Number(S[218103815]))??void 0,max_mana:s.max_mana??p(Number(S[218103814]))??void 0,spellcraft:s.spellcraft??void 0,damage_range:s.damage_range??void 0,damage_type:s.damage_type??void 0,speed_text:s.speed_text??void 0,mana_display:s.mana_display??void 0,spells:s.spells??void 0,icon_overlay_id:s.icon_overlay_id??p(Number(S[218103849]))??void 0,icon_underlay_id:s.icon_underlay_id??p(Number(S[218103850]))??void 0,_raw:s}}function ei(s){return!s||s<=0?"06000133":(s+100663296).toString(16).toUpperCase().padStart(8,"0")}const Ua={32768:{name:"Neck",row:1,col:1},1:{name:"Head",row:1,col:3},268435456:{name:"Sigil",row:1,col:5},536870912:{name:"Sigil",row:1,col:6},1073741824:{name:"Sigil",row:1,col:7},67108864:{name:"Trinket",row:2,col:1},2048:{name:"U.Arm",row:2,col:2},512:{name:"Chest",row:2,col:3},134217728:{name:"Cloak",row:2,col:7},65536:{name:"Brace L",row:3,col:1},4096:{name:"L.Arm",row:3,col:2},1024:{name:"Abdomen",row:3,col:3},8192:{name:"U.Leg",row:3,col:4},131072:{name:"Brace R",row:3,col:5},2:{name:"Shirt",row:3,col:7},262144:{name:"Ring L",row:4,col:1},32:{name:"Hands",row:4,col:2},16384:{name:"L.Leg",row:4,col:4},524288:{name:"Ring R",row:4,col:5},4:{name:"Pants",row:4,col:7},256:{name:"Feet",row:5,col:4},2097152:{name:"Shield",row:6,col:1},1048576:{name:"Melee",row:6,col:3},4194304:{name:"Missile",row:6,col:3},16777216:{name:"Held",row:6,col:3},33554432:{name:"2H",row:6,col:3},8388608:{name:"Ammo",row:6,col:7}},Ba={},yy=[32768,67108864,65536,131072,262144,524288],gy=[1,512,2048,1024,4096,8192,16384,32,256],vy=[2,4,134217728,268435456,536870912,1073741824],py=[2097152,1048576,4194304,16777216,33554432,8388608];(()=>{const s=new Set;Object.entries(Ua).forEach(([p,S])=>{const o=`${S.row}-${S.col}`,d=parseInt(p);s.has(o)||(s.add(o),yy.includes(d)?Ba[o]="#3a2555":gy.includes(d)?Ba[o]="#1e2e55":vy.includes(d)?Ba[o]="#1e3e3e":py.includes(d)?Ba[o]="#142040":Ba[o]="#2a2a2a")})})();const Ha="#af7a30";function Ts({item:s,size:p=36}){const S={position:"absolute",top:0,left:0,width:p,height:p,border:"none",background:"transparent",imageRendering:"pixelated"},o=s.icon_underlay_id&&s.icon_underlay_id>100?`/icons/${ei(s.icon_underlay_id)}.png`:null,d=s.icon_overlay_id&&s.icon_overlay_id>100?`/icons/${ei(s.icon_overlay_id)}.png`:null;return i.jsxs("div",{style:{width:p,height:p,position:"relative"},children:[o&&i.jsx("img",{src:o,alt:"",style:{...S,zIndex:1},onError:x=>{x.target.style.display="none"}}),i.jsx("img",{src:`/icons/${ei(s.icon)}.png`,alt:s.name,style:{...S,zIndex:2},onError:x=>{x.target.src="/icons/06000133.png"}}),d&&i.jsx("img",{src:d,alt:"",style:{...S,zIndex:3},onError:x=>{x.target.style.display="none"}})]})}function xy({item:s,x:p,y:S}){var E,R;const o=g=>g!=null&&g!==-1&&g!==-1,d=g=>g.toLocaleString(),x=g=>`${((g-1)*100).toFixed(1)}%`;return i.jsxs("div",{style:{position:"fixed",left:p+14,top:S+14,background:"rgba(0,0,0,0.96)",border:"1px solid #555",borderRadius:4,padding:"8px 12px",zIndex:99999,minWidth:200,maxWidth:340,fontSize:13,color:"#ddd",pointerEvents:"none",lineHeight:1.6,fontFamily:'-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif'},children:[i.jsx("div",{style:{color:"#ffcc00",fontWeight:"bold",fontSize:14,marginBottom:4},children:s.name}),i.jsxs("div",{style:{color:"#aaa"},children:["Value: ",d(s.value)," · Burden: ",s.burden]}),s.workmanship&&i.jsxs("div",{style:{color:"#aaa"},children:["Workmanship: ",s.workmanship]}),s.material&&i.jsxs("div",{style:{color:"#88ff88"},children:["Material: ",s.material]}),o(s.armor_level)&&i.jsxs("div",{style:{color:"#88ff88"},children:["Armor Level: ",s.armor_level]}),o(s.max_damage)&&i.jsxs("div",{style:{color:"#88ff88"},children:["Max Damage: ",s.max_damage]}),s.damage_range&&i.jsxs("div",{style:{color:"#88ff88"},children:["Damage: ",s.damage_range,s.damage_type?`, ${s.damage_type}`:""]}),o(s.attack_bonus)&&s.attack_bonus!==1&&i.jsxs("div",{style:{color:"#88ff88"},children:["Attack: +",x(s.attack_bonus)]}),o(s.melee_defense_bonus)&&s.melee_defense_bonus!==1&&i.jsxs("div",{style:{color:"#88ff88"},children:["Melee Def: +",x(s.melee_defense_bonus)]}),o(s.magic_defense_bonus)&&s.magic_defense_bonus!==1&&i.jsxs("div",{style:{color:"#88ff88"},children:["Magic Def: +",x(s.magic_defense_bonus)]}),s.equip_skill&&i.jsxs("div",{style:{color:"#ddd"},children:["Skill: ",s.equip_skill]}),o(s.wield_level)&&i.jsxs("div",{style:{color:"#ffaa00"},children:["Wield Level: ",s.wield_level]}),o(s.lore_requirement)&&i.jsxs("div",{style:{color:"#ffaa00"},children:["Lore: ",s.lore_requirement]}),s.imbue&&i.jsxs("div",{style:{color:"#88ff88"},children:["Imbue: ",s.imbue]}),s.item_set&&i.jsxs("div",{style:{color:"#88ff88"},children:["Set: ",s.item_set]}),o(s.tinks)&&i.jsxs("div",{style:{color:"#88ff88"},children:["Tinks: ",s.tinks]}),o(s.damage_rating)&&i.jsxs("div",{children:["Damage Rating: ",s.damage_rating]}),o(s.crit_rating)&&i.jsxs("div",{children:["Crit Rating: ",s.crit_rating]}),o(s.heal_boost_rating)&&i.jsxs("div",{children:["Heal Boost: ",s.heal_boost_rating]}),s.spellcraft&&i.jsxs("div",{style:{color:"#dda0dd"},children:["Spellcraft: ",s.spellcraft]}),o(s.current_mana)&&o(s.max_mana)&&i.jsxs("div",{style:{color:"#98d7ff"},children:["Mana: ",s.current_mana," / ",s.max_mana]}),((R=(E=s.spells)==null?void 0:E.spells)==null?void 0:R.length)>0&&i.jsxs("div",{style:{color:"#4a90e2",marginTop:4,fontSize:12},children:["Spells: ",s.spells.spells.map(g=>g.name).join(", ")]})]})}function th({iconSrc:s,isActive:p,fillPct:S,label:o,onClick:d}){const x=S>90?"#b7432c":S>70?"#d8a431":"#00ff00";return i.jsxs("div",{onClick:d,title:o,style:{display:"flex",alignItems:"flex-start",gap:2,cursor:"pointer",flexShrink:0,marginTop:3,position:"relative"},children:[p&&i.jsx("span",{style:{position:"absolute",left:-11,top:8,color:Ha,fontSize:10},children:"▶"}),i.jsx("div",{style:{width:30,height:30,border:p?"1px solid #00ff00":"1px solid #333",boxShadow:p?"0 0 4px #00ff00":"none",background:"#000",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx("img",{src:s,alt:"",style:{width:26,height:26,objectFit:"contain",imageRendering:"pixelated"},onError:E=>{E.target.src="/icons/06001080.png"}})}),i.jsx("div",{style:{width:7,height:30,background:"#222",border:"1px solid #666",position:"relative",overflow:"hidden",borderRadius:2},title:`${Math.round(S)}% full`,children:i.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:`${S}%`,background:x,minHeight:S>0?2:0}})})]})}const by=({id:s,charName:p,zIndex:S})=>{var ut,ot,gt;const[o,d]=N.useState([]),[x,E]=N.useState(!0),[R,g]=N.useState(null),[v,Y]=N.useState(null),[U,L]=N.useState(null),[lt,J]=N.useState(null);N.useEffect(()=>{E(!0),Promise.all([tl(`/inventory/${encodeURIComponent(p)}?limit=1000`).catch(()=>({items:[]})),tl(`/character-stats/${encodeURIComponent(p)}`).catch(()=>null)]).then(([w,$])=>{const z=w.items??[];d(z.map(my)),L($)}).finally(()=>E(!1))},[p]);const et=N.useCallback((w,$)=>{Y(w&&$?{item:w,x:$.clientX,y:$.clientY}:null)},[]),mt=N.useMemo(()=>{const w=new Set,$=[];return Object.entries(Ua).forEach(([z,h])=>{const B=`${h.row}-${h.col}`;w.has(B)||(w.add(B),$.push({key:B,...h,mask:parseInt(z)}))}),$},[]),{equippedMap:I,containers:M,packItems:F}=N.useMemo(()=>{const w=new Map,$=[],z=new Set,h=new Map;o.forEach(W=>{W.object_class===10&&($.push(W),z.add(W.item_id))}),$.sort((W,yt)=>(W.item_id>>>0)-(yt.item_id>>>0));let B=null;return o.forEach(W=>{W.current_wielded_location>0&&W.container_id&&!z.has(W.container_id)&&(B=W.container_id)}),o.forEach(W=>{if(z.has(W.item_id))return;const yt=W.current_wielded_location;if(yt>0)if(W.object_class===2)Object.entries(Ua).forEach(([C,Z])=>{if((yt&parseInt(C))===parseInt(C)){const V=`${Z.row}-${Z.col}`;w.has(V)||w.set(V,W)}});else{let C=!1;if(Ua[yt]){const Z=Ua[yt],V=`${Z.row}-${Z.col}`;w.has(V)||(w.set(V,W),C=!0)}if(!C){for(const[Z,V]of Object.entries(Ua))if((yt&parseInt(Z))===parseInt(Z)){const it=`${V.row}-${V.col}`;if(!w.has(it)){w.set(it,W),C=!0;break}}}}else{let m=W.container_id||0;B&&m===B&&(m=0),h.has(m)||h.set(m,[]),h.get(m).push(W)}}),{equippedMap:w,containers:$,packItems:h}},[o]);let Q=F.get(0)??[],k=0;if(Q.length===0){let w=0;for(const[$,z]of F.entries())!M.some(h=>h.item_id===$)&&z.length>w&&(w=z.length,k=$);Q=F.get(k)??[]}const q=R!==null?F.get(R)??[]:Q,T=(U==null?void 0:U.burden_units)??((ut=U==null?void 0:U.stats_data)==null?void 0:ut.burden_units)??0,G=(U==null?void 0:U.encumbrance_capacity)??((ot=U==null?void 0:U.stats_data)==null?void 0:ot.encumbrance_capacity)??0,tt=G>0?Math.min(200,T/G*100):0,K=tt>150?"#b7432c":tt>100?"#d8a431":"#2e8b57";return x?i.jsx(ne,{id:s,title:`Inventory: ${p}`,zIndex:S,width:572,height:720,children:i.jsx("div",{style:{padding:20,color:"#666",fontStyle:"italic"},children:"Loading inventory..."})}):i.jsxs(ne,{id:s,title:`Inventory: ${p}`,zIndex:S,width:572,height:720,children:[i.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden",background:"rgba(14,14,14,0.96)",fontFamily:'-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif',fontSize:13},children:[i.jsxs("div",{style:{width:316,display:"flex",flexDirection:"column",overflow:"hidden"},children:[i.jsx("div",{style:{position:"relative",height:270,minHeight:270,background:"#0a0a0a",borderBottom:`1px solid ${Ha}`},children:mt.map(w=>{const $=I.get(w.key),z=Ba[w.key]??"#2a2a2a";return i.jsx("div",{style:{position:"absolute",left:(w.col-1)*44+4,top:(w.row-1)*44+4,width:36,height:36,background:$?"#5a5a62":z,border:$?"2px solid #00ffff":"2px outset #6a6a72",boxShadow:$?"0 0 5px #00ffff, inset 0 0 5px rgba(0,255,255,0.2)":"none",display:"flex",alignItems:"center",justifyContent:"center",cursor:$?"pointer":"default"},onMouseEnter:h=>$&&et($,h),onMouseMove:h=>$&&et($,h),onMouseLeave:()=>et(null),children:$?i.jsx(Ts,{item:$,size:32}):i.jsx("img",{src:"/icons/06000133.png",alt:"",style:{width:28,height:28,opacity:.15,filter:"grayscale(100%)",imageRendering:"pixelated"}})},w.key)})}),i.jsxs("div",{style:{padding:"3px 6px",fontSize:11,color:"#ccc",background:"#111",borderBottom:`1px solid ${Ha}`},children:["Contents of ",R!==null?((gt=M.find(w=>w.item_id===R))==null?void 0:gt.name)??"Pack":"Backpack"]}),i.jsxs("div",{style:{flex:1,overflowY:"auto",display:"grid",gridTemplateColumns:"repeat(6, 36px)",gridAutoRows:36,gap:2,padding:4,alignContent:"start"},children:[q.map((w,$)=>i.jsx("div",{style:{width:36,height:36,background:"linear-gradient(135deg, #3d007a 0%, #1a0033 100%)",border:"1px solid #4a148c",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"},onMouseEnter:z=>et(w,z),onMouseMove:z=>et(w,z),onMouseLeave:()=>et(null),children:i.jsx(Ts,{item:w,size:32})},w.item_id??$)),Array.from({length:Math.max(0,24-q.length)}).map((w,$)=>i.jsx("div",{style:{width:36,height:36,background:"#0a0a0a",border:"1px solid #1a1a1a"}},`e${$}`))]})]}),i.jsxs("div",{style:{width:42,display:"flex",flexDirection:"column",alignItems:"center",padding:"4px 2px",borderLeft:`1px solid ${Ha}`,borderRight:`1px solid ${Ha}`},children:[i.jsx("div",{style:{textAlign:"center",fontSize:8,color:"#ccc",marginBottom:2},children:G>0?`${Math.floor(tt)}%`:"Burden"}),i.jsx("div",{style:{width:14,height:40,background:"#111",border:"1px solid #555",position:"relative",overflow:"hidden",marginBottom:6,flexShrink:0},title:G>0?`${T.toLocaleString()} / ${G.toLocaleString()}`:`Burden: ${o.reduce((w,$)=>w+($.burden??0),0).toLocaleString()}`,children:i.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:`${tt/2}%`,background:K,transition:"height 0.3s"}})}),i.jsx(th,{iconSrc:"/icons/0600127E.png",isActive:R===null,fillPct:Q.length>0?Math.min(100,Q.length/102*100):0,label:`Backpack (${Q.length}/102)`,onClick:()=>g(null)}),M.map(w=>{const $=w.item_id,z=o.filter(W=>W.container_id===$&&W.item_id!==$).length,h=w.items_capacity||24,B=h>0?Math.min(100,z/h*100):0;return i.jsx(th,{iconSrc:`/icons/${ei(w.icon)}.png`,isActive:R===$,fillPct:B,label:`${w.name} (${z}/${h})`,onClick:()=>g($)},$)})]}),i.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",minWidth:160},children:[i.jsx("div",{style:{padding:"4px 8px",fontSize:"0.72rem",fontWeight:600,color:"#aaa",background:"#111",borderBottom:`1px solid ${Ha}`},children:"Mana"}),i.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"2px 0"},children:[Array.from(I.values()).filter(w=>w.current_mana>0||w.max_mana>0).sort((w,$)=>(w.current_mana??999999)-($.current_mana??999999)).map((w,$)=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:"1px solid #1a1a1a",cursor:"pointer"},onMouseEnter:z=>et(w,z),onMouseMove:z=>et(w,z),onMouseLeave:()=>et(null),children:[i.jsx("div",{style:{width:20,height:20,flexShrink:0},children:i.jsx(Ts,{item:w,size:20})}),i.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:w.current_mana>0?"#4c4":"#c44",flexShrink:0}}),i.jsx("div",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"0.68rem",color:"#ccc"},children:w.name}),i.jsxs("div",{style:{fontSize:"0.65rem",color:"#88bbff",whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:[w.current_mana??0,"/",w.max_mana??0]}),i.jsx("div",{style:{fontSize:"0.63rem",color:"#9c9",whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums",minWidth:42,textAlign:"right"},children:w.max_mana>0?Sy(w.current_mana??0,w.max_mana??0):""})]},$)),Array.from(I.values()).filter(w=>w.current_mana>0||w.max_mana>0).length===0&&i.jsx("div",{style:{padding:12,color:"#555",textAlign:"center",fontSize:"0.7rem"},children:"No mana items equipped"})]})]})]}),v&&i.jsx(xy,{item:v.item,x:v.x,y:v.y})]})};function Sy(s,p){if(p<=0||s<=0)return"0h00m";const S=s*20,o=Math.floor(S/3600),d=Math.floor(S%3600/60);return`~${o}h${String(d).padStart(2,"0")}m`}const Cs=300,lh=.5,_y={walls:{r:0,g:0,b:255},innerWalls:{r:127,g:127,b:255},rampedWalls:{r:77,g:255,b:255},floors:{r:0,g:127,b:255},stairs:{r:0,g:63,b:255}},jy={walls:{r:140,g:140,b:180},innerWalls:{r:100,g:100,b:140},rampedWalls:{r:120,g:160,b:120},floors:{r:60,g:80,b:60},stairs:{r:180,g:160,b:80}};function zy(s){const p=document.createElement("canvas");p.width=10,p.height=10;const S=p.getContext("2d");S.drawImage(s,0,0,10,10);const o=S.getImageData(0,0,10,10),d=o.data;for(let x=0;x240&&R>240&&g>240){d[x+3]=0;continue}let v=!1;for(const[Y,U]of Object.entries(_y))if(Math.abs(E-U.r)<15&&Math.abs(R-U.g)<15&&Math.abs(g-U.b)<15){const L=jy[Y];d[x]=L.r,d[x+1]=L.g,d[x+2]=L.b,v=!0;break}!v&&E<15&&R<15&&g<15&&(d[x+3]=100)}return S.putImageData(o,0,0),p}function Ey(s){return s===1?Math.PI:s<-.7&&s>-.8?Math.PI/2:s>.7&&s<.8?-Math.PI/2:0}let qa=null;function Ay(){qa||(qa={},fetch("/dungeon_tiles.json").then(s=>s.json()).then(s=>{Object.entries(s).forEach(([p,S])=>{const o=new Image;o.onload=()=>{qa[p]=zy(o)},o.src=S})}).catch(()=>{}))}const eh={Monster:"#ff4444",Player:"#4488ff",NPC:"#44cc44",Vendor:"#44cc44",Portal:"#aa44ff",Corpse:"#ff8800",Container:"#cccc44",Door:"#888888"};function My(s){const p=(s%360+360)%360;return["N","NE","E","SE","S","SW","W","NW"][Math.round(p/45)%8]}const Ty=({id:s,charName:p,zIndex:S,socket:o,radarData:d})=>{const x=N.useRef(null),E=N.useRef(lh),[R,g]=N.useState(lh),[v,Y]=N.useState(null),U=N.useRef(null),L=N.useRef([]);N.useEffect(()=>{const I=new Image;I.src="/dereth.png",I.onload=()=>{U.current=I},Ay()},[]),N.useEffect(()=>((o==null?void 0:o.readyState)===WebSocket.OPEN&&o.send(JSON.stringify({player_name:p,command:"start_radar"})),()=>{(o==null?void 0:o.readyState)===WebSocket.OPEN&&o.send(JSON.stringify({player_name:p,command:"stop_radar"}))}),[p,o]);const lt=N.useCallback(I=>{I.preventDefault();const M=I.deltaY>0?1.25:.8;E.current=Math.max(.02,Math.min(5,E.current*M)),g(E.current)},[]),J=N.useCallback(I=>{const M=x.current;if(!M)return;const F=M.getBoundingClientRect(),Q=(I.clientX-F.left)*(M.width/F.width),k=(I.clientY-F.top)*(M.height/F.height);let q=null,T=20;L.current.forEach(G=>{if(G._px===void 0)return;const tt=Math.sqrt((Q-G._px)**2+(k-G._py)**2);tt{var m;const I=x.current;if(!I||!d)return;const M=I.getContext("2d");if(!M)return;const F=Cs,Q=F/2,k=F/2,q=d.objects??[],T=d.player_ew??0,G=d.player_ns??0,tt=d.player_heading??0,K=d.is_dungeon??!1,ut=d.player_x??0,ot=d.player_y??0,gt=E.current,w=K?F/2/(gt*240):F/2/gt,$=tt*Math.PI/180;M.clearRect(0,0,F,F),M.fillStyle="#111",M.beginPath(),M.arc(Q,k,Q,0,Math.PI*2),M.fill(),M.save(),M.beginPath(),M.arc(Q,k,Q-1,0,Math.PI*2),M.clip();const z=d.landblock??null,h=d.player_raw_z??0;if(K&&z&&((m=window.__dungeonMapCache)!=null&&m[z])){const C=window.__dungeonMapCache[z],Z=Math.floor((h+3)/6)*6;M.translate(Q,k),M.rotate(-(tt-180)*Math.PI/180);const V=10*w,it=qa&&Object.keys(qa).length>0;(C.z_levels||[]).slice().sort((dt,Rt)=>(dt.z===Z?1:0)-(Rt.z===Z?1:0)).forEach(dt=>{const Rt=dt.z===Z;M.globalAlpha=Rt?.85:.12,(dt.cells||[]).forEach(Ot=>{const ll=-(Ot.x-ut)*w,Bl=(Ot.y-ot)*w,Nl=it?qa[String(Ot.env_id)]:null;Nl?(M.save(),M.translate(ll,Bl),M.rotate(Ey(Ot.rotation)),M.drawImage(Nl,-V/2,-V/2,V,V),M.restore()):(M.fillStyle=Rt?"#3a5a3a":"#1a2a1a",M.fillRect(ll-V/2,Bl-V/2,V,V))})}),M.globalAlpha=1,M.setTransform(1,0,0,1,0,0)}else if(!K&&U.current){const C=U.current,Z=C.naturalWidth/204.2,V=(T+102.1)*Z,it=(102.1-G)*Z;M.globalAlpha=.4,M.save(),M.translate(Q,k),M.rotate(-$);const st=gt*Z*2;M.drawImage(C,V-st/2,it-st/2,st,st,-Q,-k,F,F),M.restore(),M.globalAlpha=1}M.restore(),M.strokeStyle="#333",M.lineWidth=1;for(let C=1;C<=4;C++)M.beginPath(),M.arc(Q,k,Q/4*C,0,Math.PI*2),M.stroke();M.beginPath(),M.moveTo(Q,0),M.lineTo(Q,F),M.moveTo(0,k),M.lineTo(F,k),M.stroke(),M.font="bold 12px monospace",M.textAlign="center",M.textBaseline="middle",[{l:"N",a:0},{l:"E",a:Math.PI/2},{l:"S",a:Math.PI},{l:"W",a:-Math.PI/2}].forEach(({l:C,a:Z})=>{const V=Z-$;M.fillStyle=C==="N"?"#cc4444":"#888",M.fillText(C,Q+Math.sin(V)*(Q-12),k-Math.cos(V)*(Q-12))}),M.strokeStyle="#666",M.lineWidth=1,M.beginPath(),M.moveTo(Q,k),M.lineTo(Q,k-Q*.85),M.stroke();const B=K?Math.PI-$:$,W=Math.cos(B),yt=Math.sin(B);q.forEach(C=>{let Z,V;K&&C.raw_x!==void 0?(Z=-(C.raw_x-ut),V=C.raw_y-ot):(Z=(C.ew??0)-T,V=(C.ns??0)-G);const it=Z*W-V*yt,st=K?Z*yt+V*W:-(Z*yt+V*W),dt=Q+it*w,Rt=k+st*w;if(Math.sqrt((dt-Q)**2+(Rt-k)**2)>Q-4)return;C._px=dt,C._py=Rt;const ll=C.object_class??C.type??"",Bl=eh[ll]??"#888",Nl=C.id===v,Xa=Nl?6:ll==="Monster"||ll==="Player"?4:3;Nl&&(M.strokeStyle="#fff",M.lineWidth=2,M.beginPath(),M.arc(dt,Rt,Xa+3,0,Math.PI*2),M.stroke()),M.fillStyle=Bl,M.beginPath(),M.arc(dt,Rt,Xa,0,Math.PI*2),M.fill(),(ll==="Player"||ll==="Portal"||Nl)&&(M.fillStyle=Nl?"#fff":Bl,M.font="9px monospace",M.textAlign="left",M.fillText(C.name,dt+6,Rt+3))}),L.current=q,M.fillStyle="#ffcc00",M.beginPath(),M.arc(Q,k,5,0,Math.PI*2),M.fill(),M.strokeStyle="#fff",M.lineWidth=1,M.stroke()},[d,R,v]);const et=((d==null?void 0:d.objects)??[]).map(I=>{const M=(d==null?void 0:d.player_ew)??0,F=(d==null?void 0:d.player_ns)??0,Q=(d==null?void 0:d.is_dungeon)??!1,k=(d==null?void 0:d.player_x)??0,q=(d==null?void 0:d.player_y)??0;let T,G,tt;Q&&I.raw_x!==void 0?(T=-(I.raw_x-k),G=I.raw_y-q,tt=Math.sqrt(T*T+G*G)):(T=(I.ew??0)-M,G=(I.ns??0)-F,tt=Math.sqrt(T*T+G*G)*240);const K=Math.atan2(T,G)*180/Math.PI;return{...I,dist:tt,dir:My(K)}}).sort((I,M)=>I.dist-M.dist),mt=Math.round(R*240);return i.jsxs(ne,{id:s,title:`Radar: ${p}`,zIndex:S,width:360,height:560,children:[i.jsxs("div",{style:{padding:"4px 8px",display:"flex",justifyContent:"space-between",fontSize:"0.75rem",color:"#888",borderBottom:"1px solid #333",background:"#1a1a1a"},children:[i.jsxs("span",{children:["Range: ~",mt,"m"]}),i.jsx("span",{style:{fontSize:"0.65rem",color:"#555"},children:"Scroll to zoom"})]}),i.jsx("canvas",{ref:x,width:Cs,height:Cs,style:{display:"block",margin:"0 auto",borderBottom:"1px solid #333",cursor:"crosshair",flexShrink:0},onWheel:lt,onClick:J}),i.jsxs("div",{style:{flex:1,overflowY:"auto",fontSize:"0.72rem",minHeight:0},children:[i.jsxs("div",{style:{display:"flex",padding:"3px 6px",borderBottom:"1px solid #333",color:"#666",fontSize:"0.65rem",fontWeight:600},children:[i.jsx("span",{style:{width:8}}),i.jsx("span",{style:{flex:1,marginLeft:6},children:"Name"}),i.jsx("span",{style:{width:55,textAlign:"left"},children:"Type"}),i.jsx("span",{style:{width:40,textAlign:"right"},children:"Dist"}),i.jsx("span",{style:{width:24,textAlign:"center"},children:"Dir"})]}),et.length===0&&i.jsx("div",{style:{padding:12,color:"#555",textAlign:"center",fontSize:"0.7rem"},children:"Waiting for radar data..."}),et.map(I=>{const M=I.object_class??I.type??"",F=eh[M]??"#888",Q=I.id===v;return i.jsxs("div",{onClick:()=>Y(Q?null:I.id),style:{display:"flex",alignItems:"center",padding:"2px 6px",borderBottom:"1px solid #1a1a1a",cursor:"pointer",color:"#ccc",background:Q?"#1a2a3a":"",borderLeft:Q?"2px solid #4488ff":"2px solid transparent"},children:[i.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:F,flexShrink:0}}),i.jsx("span",{style:{flex:1,marginLeft:6,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:I.name}),i.jsx("span",{style:{width:55,color:"#888",fontSize:"0.65rem"},children:M}),i.jsx("span",{style:{width:40,textAlign:"right",fontVariantNumeric:"tabular-nums"},children:I.dist<1e3?`${Math.round(I.dist)}m`:`${(I.dist/1e3).toFixed(1)}km`}),i.jsx("span",{style:{width:24,textAlign:"center",color:"#666"},children:I.dir})]},I.id)})]})]})},Bn=["Typeless","Slash","Pierce","Bludgeon","Fire","Cold","Acid","Electric"];function Oe(s,p,S){var o,d,x,E;return(((d=(o=s==null?void 0:s[p])==null?void 0:o[S])==null?void 0:d.total_normal_damage)??0)+(((E=(x=s==null?void 0:s[p])==null?void 0:x[S])==null?void 0:E.total_crit_damage)??0)}function Cy(s){let p={attacks:0,failed:0,crits:0,normalDmg:0,maxNormal:0,critDmg:0,maxCrit:0};if(!s)return p;for(const S of Object.values(s))for(const o of Object.values(S))p.attacks+=o.total_attacks??0,p.failed+=o.failed_attacks??0,p.crits+=o.crits??0,p.normalDmg+=o.total_normal_damage??0,p.maxNormal=Math.max(p.maxNormal,o.max_normal_damage??0),p.critDmg+=o.total_crit_damage??0,p.maxCrit=Math.max(p.maxCrit,o.max_crit_damage??0);return p}function ah(s,p){let S={attacks:0,failed:0};const o=s==null?void 0:s[p];if(!o)return S;for(const d of Object.values(o))S.attacks+=d.total_attacks??0,S.failed+=d.failed_attacks??0;return S}const Oy=({id:s,charName:p,zIndex:S})=>{const[o,d]=N.useState(null),[x,E]=N.useState("session"),[R,g]=N.useState(null);N.useEffect(()=>{tl(`/combat-stats/${encodeURIComponent(p)}`).then(d).catch(()=>{});const T=setInterval(()=>{tl(`/combat-stats/${encodeURIComponent(p)}`).then(d).catch(()=>{})},1e4);return()=>clearInterval(T)},[p]);const v=o==null?void 0:o[x],Y=(v==null?void 0:v.monsters)??{},U=Object.keys(Y).filter(T=>T!=="__cloak_surges__").sort(),L=N.useMemo(()=>{let T={},G={},tt=0,K=0;const ut=R?[Y[R]].filter(Boolean):U.map(ot=>Y[ot]);for(const ot of ut)if(ot){for(const[gt,w]of Object.entries(ot.offense??{})){T[gt]||(T[gt]={});for(const[$,z]of Object.entries(w)){T[gt][$]||(T[gt][$]={total_attacks:0,failed_attacks:0,crits:0,total_normal_damage:0,max_normal_damage:0,total_crit_damage:0,max_crit_damage:0});const h=T[gt][$],B=z;h.total_attacks+=B.total_attacks??0,h.failed_attacks+=B.failed_attacks??0,h.crits+=B.crits??0,h.total_normal_damage+=B.total_normal_damage??0,h.max_normal_damage=Math.max(h.max_normal_damage,B.max_normal_damage??0),h.total_crit_damage+=B.total_crit_damage??0,h.max_crit_damage=Math.max(h.max_crit_damage,B.max_crit_damage??0)}}for(const[gt,w]of Object.entries(ot.defense??{})){G[gt]||(G[gt]={});for(const[$,z]of Object.entries(w)){G[gt][$]||(G[gt][$]={total_attacks:0,failed_attacks:0,crits:0,total_normal_damage:0,max_normal_damage:0,total_crit_damage:0,max_crit_damage:0});const h=G[gt][$],B=z;h.total_attacks+=B.total_attacks??0,h.failed_attacks+=B.failed_attacks??0,h.total_normal_damage+=B.total_normal_damage??0,h.max_normal_damage=Math.max(h.max_normal_damage,B.max_normal_damage??0),h.total_crit_damage+=B.total_crit_damage??0,h.max_crit_damage=Math.max(h.max_crit_damage,B.max_crit_damage??0)}}tt+=ot.aetheria_surges??0,K+=ot.cloak_surges??0}return Y.__cloak_surges__&&!R&&(K+=Y.__cloak_surges__.cloak_surges??0),{offense:T,defense:G,aeth:tt,cloak:K}},[Y,U,R]),lt=Cy(L.offense),J=ah(L.defense,"MeleeMissile"),et=ah(L.defense,"Magic");lt.attacks>0&&((lt.attacks-lt.failed)/lt.attacks*100).toFixed(0);const mt=J.attacks>0?(J.failed/J.attacks*100).toFixed(0):"0",I=et.attacks>0?(et.failed/et.attacks*100).toFixed(0):"0",M=lt.attacks-lt.failed,F=M-lt.crits,Q=F>0?Math.round(lt.normalDmg/F):0;lt.crits>0&&Math.round(lt.critDmg/lt.crits);const k=M>0?(lt.crits/M*100).toFixed(1):"0",q=T=>T===0?"":T.toLocaleString();return i.jsxs(ne,{id:s,title:`Combat: ${p}`,zIndex:S,width:640,height:520,children:[i.jsxs("div",{style:{display:"flex",gap:4,padding:"4px 8px",borderBottom:"1px solid #333"},children:[i.jsx("button",{className:`ml-stats-range-btn ${x==="session"?"active":""}`,onClick:()=>E("session"),children:"Session"}),i.jsx("button",{className:`ml-stats-range-btn ${x==="lifetime"?"active":""}`,onClick:()=>E("lifetime"),children:"Lifetime"})]}),i.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[i.jsxs("div",{style:{width:240,borderRight:"1px solid #333",overflowY:"auto",fontSize:"0.72rem"},children:[i.jsxs("div",{style:{display:"flex",padding:"3px 6px",borderBottom:"1px solid #333",color:"#777",fontSize:"0.65rem",fontWeight:600},children:[i.jsx("span",{style:{width:14}}),i.jsx("span",{style:{flex:1},children:"Monster"}),i.jsx("span",{style:{width:40,textAlign:"right"},children:"Kills"}),i.jsx("span",{style:{width:55,textAlign:"right"},children:"Dmg"})]}),i.jsxs("div",{style:{display:"flex",padding:"3px 6px",cursor:"pointer",background:R===null?"#2a3a4a":"",borderBottom:"1px solid #222",color:"#ddd"},onClick:()=>g(null),children:[i.jsx("span",{style:{width:14,color:"#888"},children:R===null?"*":""}),i.jsx("span",{style:{flex:1},children:"All"}),i.jsx("span",{style:{width:40,textAlign:"right"},children:q((v==null?void 0:v.total_kills)??0)}),i.jsx("span",{style:{width:55,textAlign:"right"},children:q((v==null?void 0:v.total_damage_given)??0)})]}),U.map(T=>{const G=Y[T];return i.jsxs("div",{style:{display:"flex",padding:"2px 6px",cursor:"pointer",background:R===T?"#2a3a4a":"",borderBottom:"1px solid #1a1a1a",color:"#ccc"},onClick:()=>g(T),children:[i.jsx("span",{style:{width:14,color:"#888"},children:R===T?"*":""}),i.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:T}),i.jsx("span",{style:{width:40,textAlign:"right"},children:q(G.kill_count)}),i.jsx("span",{style:{width:55,textAlign:"right"},children:q(G.damage_given)})]},T)})]}),i.jsx("div",{style:{flex:1,overflowY:"auto",padding:6,fontSize:"0.72rem"},children:i.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[i.jsx("thead",{children:i.jsxs("tr",{style:{color:"#777",fontSize:"0.65rem"},children:[i.jsx("th",{style:{textAlign:"left",padding:"1px 4px"}}),i.jsx("th",{style:{textAlign:"right",padding:"1px 3px"},children:"Given M/M"}),i.jsx("th",{style:{textAlign:"right",padding:"1px 3px"},children:"Given Mag"}),i.jsx("th",{style:{width:4}}),i.jsx("th",{style:{textAlign:"right",padding:"1px 3px"},children:"Recv M/M"}),i.jsx("th",{style:{textAlign:"right",padding:"1px 3px"},children:"Recv Mag"}),i.jsx("th",{style:{width:4}}),i.jsx("th",{style:{textAlign:"left",padding:"1px 3px"},children:"Stats"}),i.jsx("th",{style:{textAlign:"right",padding:"1px 3px"}})]})}),i.jsxs("tbody",{children:[Bn.map((T,G)=>{const tt=[["Evades",J.attacks>0?`${q(J.attacks)} (${mt}%)`:""],["Resists",et.attacks>0?`${q(et.attacks)} (${I}%)`:""],["A.Surges",L.aeth>0?`${q(L.aeth)}`:""],["C.Surges",L.cloak>0?`${q(L.cloak)}`:""],["",""],["",""],["Av/Mx",Q>0?`${q(Q)} / ${q(lt.maxNormal)}`:""],["Crits",lt.crits>0?`${q(lt.crits)} (${k}%)`:""]][G]??["",""];return i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"1px 4px",color:"#888"},children:T}),i.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:q(Oe(L.offense,"MeleeMissile",T))}),i.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:q(Oe(L.offense,"Magic",T))}),i.jsx("td",{}),i.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:q(Oe(L.defense,"MeleeMissile",T))}),i.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:q(Oe(L.defense,"Magic",T))}),i.jsx("td",{}),i.jsx("td",{style:{padding:"1px 3px",color:"#777",fontWeight:600,fontSize:"0.65rem"},children:tt[0]}),i.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:tt[1]})]},T)}),i.jsx("tr",{children:i.jsx("td",{colSpan:9,style:{height:4}})}),i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"1px 4px",color:"#888",fontWeight:600},children:"Total"}),i.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:q(Bn.reduce((T,G)=>T+Oe(L.offense,"MeleeMissile",G),0))}),i.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:q(Bn.reduce((T,G)=>T+Oe(L.offense,"Magic",G),0))}),i.jsx("td",{}),i.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:q(Bn.reduce((T,G)=>T+Oe(L.defense,"MeleeMissile",G),0))}),i.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:q(Bn.reduce((T,G)=>T+Oe(L.defense,"Magic",G),0))}),i.jsx("td",{}),i.jsx("td",{style:{padding:"1px 3px",color:"#777",fontWeight:600,fontSize:"0.65rem"},children:"Total"}),i.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:q(lt.normalDmg+lt.critDmg)})]})]})]})})]})]})},nh={plugin:{label:"Plugin",color:"#8844cc"},overlord:{label:"Overlord",color:"#4488cc"},nav:{label:"Nav",color:"#44aa44"},macro:{label:"Macro",color:"#cc8844"},other:{label:"Other",color:"#888888"}},Ya={padding:"3px 6px",fontSize:"0.8rem",border:"1px solid #555",background:"#2a2a2a",color:"#ddd",borderRadius:0},uh={...Ya,fontSize:"0.75rem"},Os={padding:"4px 12px",background:"#4a80c0",color:"#fff",border:"1px solid #336699",cursor:"pointer",fontSize:"0.75rem"},Hn={padding:"3px 8px",background:"#444",color:"#ccc",border:"1px solid #555",cursor:"pointer",fontSize:"0.7rem"},Ny=({id:s,zIndex:p})=>{const[S,o]=N.useState([]),[d,x]=N.useState(""),[E,R]=N.useState(""),[g,v]=N.useState("plugin"),[Y,U]=N.useState(null),[L,lt]=N.useState(""),[J,et]=N.useState(""),[mt,I]=N.useState(""),[M,F]=N.useState({}),Q=N.useCallback(async()=>{try{const K=await tl("/issues");o((K.issues??[]).sort((ut,ot)=>(ut.resolved?1:0)-(ot.resolved?1:0)))}catch{}},[]);N.useEffect(()=>{Q()},[Q]);const k=async(K,ut)=>{await fetch(`/api${K}`,{...ut,credentials:"include",headers:{"Content-Type":"application/json",...ut.headers}}),Q()},q=async()=>{d.trim()&&(await k("/issues",{method:"POST",body:JSON.stringify({title:d.trim(),description:E.trim(),category:g})}),x(""),R(""))},T=K=>{if(Y===K.id){U(null);return}U(K.id),lt(K.title),et(K.description||""),I(K.category||"other")},G=async K=>{L.trim()&&(await k(`/issues/${K}`,{method:"PATCH",body:JSON.stringify({title:L.trim(),description:J.trim(),category:mt})}),U(null))},tt=async K=>{const ut=(M[K]||"").trim();ut&&(await k(`/issues/${K}/comments`,{method:"POST",body:JSON.stringify({text:ut})}),F(ot=>({...ot,[K]:""})))};return i.jsxs(ne,{id:s,title:"Issues Board",zIndex:p,width:540,height:520,children:[i.jsxs("div",{style:{flex:1,overflowY:"auto",padding:6,fontSize:"0.8rem"},children:[S.length===0&&i.jsx("div",{style:{padding:10,color:"#888",textAlign:"center"},children:"No open issues"}),S.map(K=>{const ut=nh[K.category]||nh.other,ot=K.created?new Date(K.created).toLocaleDateString("sv-SE"):"",gt=K.comments||[];return i.jsxs("div",{style:{padding:"6px 8px",marginBottom:4,background:"#1f1f1f",borderRadius:3,border:"1px solid #333",opacity:K.resolved?.55:1},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[i.jsx("span",{style:{fontSize:"0.65rem",padding:"1px 6px",borderRadius:3,background:ut.color,color:"#fff",fontWeight:600},children:ut.label}),i.jsx("strong",{style:{fontSize:"0.8rem",flex:1},children:K.title}),i.jsxs("span",{style:{fontSize:"0.65rem",color:"#888"},children:["by ",K.author||"User"]}),i.jsx("span",{style:{color:"#666",fontSize:"0.65rem"},children:ot})]}),K.description&&i.jsx("div",{style:{color:"#999",marginTop:3,fontSize:"0.75rem"},children:K.description}),i.jsxs("div",{style:{display:"flex",gap:4,marginTop:4},children:[K.resolved?i.jsxs(i.Fragment,{children:[i.jsx("button",{style:{...Hn,fontSize:"0.65rem"},onClick:()=>k(`/issues/${K.id}`,{method:"PATCH",body:JSON.stringify({resolved:!1})}),children:"↻ Reopen"}),i.jsx("button",{style:{...Hn,fontSize:"0.65rem",color:"#c66"},onClick:()=>{confirm(`Delete issue "${K.title}"?`)&&k(`/issues/${K.id}`,{method:"DELETE"})},children:"🗑 Delete"})]}):i.jsx("button",{style:{...Hn,fontSize:"0.65rem",background:"rgba(68,204,68,0.15)",color:"#4c4",border:"1px solid rgba(68,204,68,0.3)"},onClick:()=>k(`/issues/${K.id}`,{method:"PATCH",body:JSON.stringify({resolved:!0})}),children:"✓ Resolve"}),i.jsx("button",{style:{...Hn,fontSize:"0.65rem"},onClick:()=>T(K),children:"✎ Edit"})]}),Y===K.id&&i.jsxs("div",{style:{marginTop:4,padding:4,background:"#222",borderRadius:3},children:[i.jsxs("div",{style:{display:"flex",gap:4,marginBottom:4},children:[i.jsx("input",{value:L,onChange:w=>lt(w.target.value),style:{...Ya,flex:1}}),i.jsxs("select",{value:mt,onChange:w=>I(w.target.value),style:uh,children:[i.jsx("option",{value:"plugin",children:"Plugin"}),i.jsx("option",{value:"overlord",children:"Overlord"}),i.jsx("option",{value:"nav",children:"Nav"}),i.jsx("option",{value:"macro",children:"Macro"}),i.jsx("option",{value:"other",children:"Other"})]})]}),i.jsxs("div",{style:{display:"flex",gap:4},children:[i.jsx("textarea",{value:J,onChange:w=>et(w.target.value),rows:2,style:{...Ya,flex:1,fontSize:"0.75rem",resize:"vertical"}}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[i.jsx("button",{style:{...Os,fontSize:"0.7rem",padding:"3px 8px"},onClick:()=>G(K.id),children:"Save"}),i.jsx("button",{style:{...Hn},onClick:()=>U(null),children:"Cancel"})]})]})]}),i.jsxs("div",{style:{marginTop:4,paddingTop:4,borderTop:"1px solid #2a2a2a"},children:[gt.length===0?i.jsx("div",{style:{color:"#555",fontSize:"0.7rem",padding:"2px 0"},children:"No comments yet"}):gt.map(w=>i.jsxs("div",{style:{marginBottom:3,fontSize:"0.72rem"},children:[i.jsx("span",{style:{color:"#8ac",fontWeight:500},children:w.author||"Anonymous"}),i.jsx("span",{style:{color:"#555",marginLeft:6,fontSize:"0.6rem"},children:w.created?new Date(w.created).toLocaleDateString("sv-SE"):""}),i.jsx("div",{style:{color:"#bbb",marginTop:1},children:w.text})]},w.id)),i.jsxs("div",{style:{display:"flex",gap:4,marginTop:3},children:[i.jsx("input",{value:M[K.id]||"",onChange:w=>F($=>({...$,[K.id]:w.target.value})),placeholder:"Add a comment...",style:{...Ya,flex:1,fontSize:"0.75rem"},onKeyDown:w=>{w.key==="Enter"&&tt(K.id)}}),i.jsx("button",{style:{...Os,fontSize:"0.7rem",padding:"3px 8px"},onClick:()=>tt(K.id),children:"Post"})]})]})]},K.id)})]}),i.jsxs("div",{style:{padding:6,borderTop:"1px solid #333"},children:[i.jsxs("div",{style:{display:"flex",gap:4,marginBottom:4},children:[i.jsx("input",{value:d,onChange:K=>x(K.target.value),placeholder:"Issue title...",style:{...Ya,flex:1},onKeyDown:K=>{K.key==="Enter"&&q()}}),i.jsxs("select",{value:g,onChange:K=>v(K.target.value),style:uh,children:[i.jsx("option",{value:"plugin",children:"Plugin"}),i.jsx("option",{value:"overlord",children:"Overlord"}),i.jsx("option",{value:"nav",children:"Nav"}),i.jsx("option",{value:"macro",children:"Macro"}),i.jsx("option",{value:"other",children:"Other"})]})]}),i.jsxs("div",{style:{display:"flex",gap:4},children:[i.jsx("textarea",{value:E,onChange:K=>R(K.target.value),placeholder:"Description (optional)...",rows:2,style:{...Ya,flex:1,fontSize:"0.75rem",resize:"vertical"}}),i.jsx("button",{style:{...Os,alignSelf:"flex-end"},onClick:q,children:"Add"})]})]})]})},Ry=({id:s,zIndex:p})=>{const[S,o]=N.useState([]);N.useEffect(()=>{const x=async()=>{try{const R=await tl("/vital-sharing/peers");o(R.peers??[])}catch{}};x();const E=setInterval(x,5e3);return()=>clearInterval(E)},[]);const d=(x,E)=>E>0?Math.min(100,x/E*100):0;return i.jsx(ne,{id:s,title:"Vital Sharing Network",zIndex:p,width:520,height:450,children:i.jsx("div",{style:{flex:1,overflowY:"auto",padding:6,fontSize:"0.75rem"},children:S.length===0?i.jsx("div",{style:{padding:16,color:"#666",textAlign:"center"},children:"No vital-sharing peers connected"}):S.map(x=>{var E,R,g;return i.jsxs("div",{style:{padding:"6px 8px",marginBottom:4,background:"#1f1f1f",borderRadius:3,border:"1px solid #333"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:3},children:[i.jsx("span",{style:{color:x.plugin_connected?"#4c4":"#a33",fontSize:"0.8rem"},children:"●"}),i.jsx("strong",{style:{flex:1},children:x.character_name}),x.subscribed&&i.jsx("span",{style:{color:"#6bf",fontSize:"0.65rem"},children:"[subscribed]"})]}),i.jsxs("div",{style:{color:"#666",fontSize:"0.68rem",marginBottom:3},children:["tags: ",((E=x.tags)==null?void 0:E.join(", "))||"none"]}),x.vitals&&x.vitals.max_health>0&&i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[{label:"HP",cur:x.vitals.current_health,max:x.vitals.max_health,bg:"#330000",fill:"#c44"},{label:"STA",cur:x.vitals.current_stamina,max:x.vitals.max_stamina,bg:"#331a00",fill:"#ca0"},{label:"MANA",cur:x.vitals.current_mana,max:x.vitals.max_mana,bg:"#001433",fill:"#48f"}].map(v=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[i.jsx("span",{style:{width:32,color:"#888",fontSize:"0.65rem"},children:v.label}),i.jsx("div",{style:{flex:1,height:6,background:v.bg,borderRadius:3,overflow:"hidden"},children:i.jsx("div",{style:{width:`${d(v.cur,v.max)}%`,height:"100%",background:v.fill,borderRadius:3}})}),i.jsxs("span",{style:{width:60,textAlign:"right",fontSize:"0.65rem",color:"#888"},children:[v.cur,"/",v.max]})]},v.label))}),x.position&&i.jsxs("div",{style:{color:"#555",fontSize:"0.65rem",marginTop:2},children:[(R=x.position.ns)==null?void 0:R.toFixed(1),"N, ",(g=x.position.ew)==null?void 0:g.toFixed(1),"E"]})]},x.character_name)})})})},Dy=({characters:s,chatMessages:p,nearbyObjects:S,socket:o})=>{const{windows:d}=ni();return i.jsx(i.Fragment,{children:d.map(x=>{var g;const E=x.charName??"";switch(x.id.split("-")[0]){case"chat":return i.jsx(cy,{id:x.id,charName:E,zIndex:x.zIndex,messages:p.get(E)??[],socket:o},x.id);case"stats":return i.jsx(oy,{id:x.id,charName:E,zIndex:x.zIndex},x.id);case"char":return i.jsx(hy,{id:x.id,charName:E,zIndex:x.zIndex,vitals:((g=s.get(E))==null?void 0:g.vitals)??void 0},x.id);case"inv":return i.jsx(by,{id:x.id,charName:E,zIndex:x.zIndex},x.id);case"radar":return i.jsx(Ty,{id:x.id,charName:E,zIndex:x.zIndex,socket:o,radarData:S.get(E)??null},x.id);case"combat":return i.jsx(Oy,{id:x.id,charName:E,zIndex:x.zIndex},x.id);case"issues":return i.jsx(Ny,{id:x.id,zIndex:x.zIndex},x.id);case"vitalsharing":return i.jsx(Ry,{id:x.id,zIndex:x.zIndex},x.id);default:return null}})})};let Uy=0;const By=({recentRares:s})=>{const[p,S]=N.useState([]),[o,d]=N.useState(0),[x,E]=N.useState([]);N.useEffect(()=>{if(s.length>o&&o>0){const g=s.slice(0,s.length-o);for(const v of g){const Y=++Uy;S(U=>[...U,{key:Y,charName:v.character_name,rareName:v.name,exiting:!1}]),R(),setTimeout(()=>{S(U=>U.map(L=>L.key===Y?{...L,exiting:!0}:L)),setTimeout(()=>{S(U=>U.filter(L=>L.key!==Y))},500)},6e3)}}d(s.length)},[s.length]);const R=N.useCallback(()=>{const g=Date.now(),v=["#FFD700","#FF4444","#FF8800","#AA44FF","#4488FF"],Y=Array.from({length:30},(U,L)=>{const lt=Math.PI*2*L/30+(Math.random()-.5)*.5,J=100+Math.random()*200;return{dx:Math.cos(lt)*J,dy:Math.sin(lt)*J-50,color:v[Math.floor(Math.random()*v.length)]}});E(U=>[...U,{id:g,particles:Y}]),setTimeout(()=>E(U=>U.filter(L=>L.id!==g)),2200)},[]);return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"ml-rare-notifications",children:p.map(g=>i.jsxs("div",{className:`ml-rare-notif ${g.exiting?"exiting":""}`,children:[i.jsx("div",{className:"ml-rare-notif-title",children:"🎆 LEGENDARY RARE! 🎆"}),i.jsx("div",{className:"ml-rare-notif-name",children:g.rareName}),i.jsx("div",{className:"ml-rare-notif-by",children:"found by"}),i.jsx("div",{className:"ml-rare-notif-char",children:g.charName})]},g.key))}),i.jsx("div",{className:"ml-fireworks",children:x.map(g=>i.jsx(ai.Fragment,{children:g.particles.map((v,Y)=>i.jsx("div",{className:"ml-firework-particle",style:{left:"50%",top:"30%",backgroundColor:v.color,"--dx":`${v.dx}px`,"--dy":`${v.dy+200}px`}},Y))},g.id))})]})},ih=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf","#ff4444","#44ff44","#4444ff","#ffff44","#ff44ff","#44ffff","#ff8844","#88ff44","#4488ff","#ff4488","#cc3333","#33cc33","#3333cc","#cccc33","#cc33cc","#33cccc","#cc6633","#66cc33","#3366cc","#cc3366","#ff6666","#66ff66","#6666ff","#ffff66","#ff66ff","#66ffff","#ffaa66","#aaff66","#66aaff","#ff66aa","#990099","#009900","#000099","#990000","#009999","#999900","#aa5500","#55aa00","#0055aa","#aa0055","#ffaaaa","#aaffaa","#aaaaff","#ffffaa","#ffaaff","#aaffff","#ffccaa","#ccffaa","#aaccff","#ffaacc"];function Hy(s){let p=0;for(let S=0;S{let d=s.current.get(o);return d||(d=p.current{const S=Yy(),[o,d]=N.useState(!1),[x,E]=N.useState(!1),[R,g]=N.useState(null),v=N.useMemo(()=>Array.from(s.characters.values()).filter(J=>J.telemetry).map(J=>J.telemetry),[s.characters]),Y=N.useMemo(()=>new Map(Array.from(s.characters.values()).filter(J=>J.vitals).map(J=>[J.name,J.vitals])),[s.characters]),[U,L]=N.useState("");N.useEffect(()=>{fetch("/api/api-version",{credentials:"include"}).then(J=>J.json()).then(J=>L(J.version??"")).catch(()=>{})},[]);const lt=N.useCallback(J=>{g(et=>et===J?null:J)},[]);return i.jsx(J0,{children:i.jsxs("div",{className:"ml-layout",children:[i.jsx(uy,{players:v,vitals:Y,serverHealth:s.serverHealth,totalRares:s.totalRares,totalKills:s.totalKills,getColor:S,onSelectPlayer:lt,onViewToggle:p,showHeatmap:o,showPortals:x,onToggleHeatmap:d,onTogglePortals:E}),i.jsx(ty,{players:v,getColor:S,onSelectPlayer:lt,showHeatmap:o,showPortals:x,selectedPlayer:R}),i.jsx(Dy,{characters:s.characters,chatMessages:s.chatMessages,nearbyObjects:s.nearbyObjects,socket:s.socketRef.current}),i.jsx(By,{recentRares:s.recentRares}),U&&i.jsxs("div",{className:"ml-version",children:["v",U]})]})})};function Xy(s){const p=N.useRef(null),S=N.useRef(0),o=N.useRef(s);o.current=s;const d=N.useCallback(()=>{var E;if(((E=p.current)==null?void 0:E.readyState)===WebSocket.OPEN)return;const x=new WebSocket(F0());p.current=x,x.addEventListener("message",R=>{try{const g=JSON.parse(R.data);o.current(g)}catch{}}),x.addEventListener("close",()=>{p.current=null,S.current=window.setTimeout(d,2e3)}),x.addEventListener("error",()=>{x.close()})},[]);return N.useEffect(()=>(d(),()=>{var x;clearTimeout(S.current),(x=p.current)==null||x.close(),p.current=null}),[d]),p}const Ly=()=>tl("/live"),Gy=()=>tl("/combat-stats"),Qy=()=>tl("/server-health"),wy=()=>tl("/total-rares"),Zy=()=>tl("/total-kills");function Vy(){const[s,p]=N.useState(new Map),[S,o]=N.useState(null),[d,x]=N.useState(0),[E,R]=N.useState(0),[g,v]=N.useState([]),[Y,U]=N.useState(new Map),[L,lt]=N.useState(new Map),J=N.useRef(s);J.current=s;const et=N.useCallback((M,F)=>{p(Q=>{const k=new Map(Q),q=k.get(M)??{name:M,telemetry:null,vitals:null,combat:null,lastUpdate:0};return k.set(M,F(q)),k})},[]),mt=N.useCallback(M=>{var F;if(M.type){if(M.type==="telemetry"){const Q=M;et(Q.character_name,k=>({...k,telemetry:Q,lastUpdate:Date.now()}))}else if(M.type==="vitals"){const Q=M;et(Q.character_name,k=>({...k,vitals:Q,lastUpdate:Date.now()}))}else if(M.type==="combat_stats"){const Q=M;et(Q.character_name,k=>({...k,combat:Q,lastUpdate:Date.now()}))}else if(M.type==="rare"){const Q=M;v(k=>[Q,...k].slice(0,50))}else if(M.type==="dungeon_map"){const Q=M;Q.landblock&&(window.__dungeonMapCache||(window.__dungeonMapCache={}),window.__dungeonMapCache[Q.landblock]=Q)}else if(M.type==="nearby_objects"){const Q=M;if(lt(k=>{const q=new Map(k);return q.set(Q.character_name,Q),q}),Q.is_dungeon&&Q.landblock&&!((F=window.__dungeonMapCache)!=null&&F[Q.landblock])){const k=I.current;(k==null?void 0:k.readyState)===WebSocket.OPEN&&k.send(JSON.stringify({type:"request_dungeon_map",landblock:Q.landblock}))}}else if(M.type==="chat"){const Q=M;U(k=>{const q=new Map(k),T=[...q.get(Q.character_name)??[],{text:Q.text,color:Q.color,timestamp:Q.timestamp}];return T.length>1e3&&T.splice(0,T.length-1e3),q.set(Q.character_name,T),q})}}},[et]),I=Xy(mt);return N.useEffect(()=>{const M=async()=>{try{const Q=await Ly();p(k=>{var T;const q=new Map(k);for(const G of Q.players??[]){const tt=q.get(G.character_name);q.set(G.character_name,{name:G.character_name,telemetry:G,vitals:(tt==null?void 0:tt.vitals)??null,combat:(tt==null?void 0:tt.combat)??null,lastUpdate:Date.now()})}for(const G of q.keys())(T=Q.players)!=null&&T.some(tt=>tt.character_name===G)||q.delete(G);return q})}catch{}};M();const F=setInterval(M,5e3);return()=>clearInterval(F)},[]),N.useEffect(()=>{const M=async()=>{try{const Q=await Gy();for(const k of Q.stats??[])et(k.character_name,q=>({...q,combat:{...k,type:"combat_stats"}}))}catch{}};M();const F=setInterval(M,3e4);return()=>clearInterval(F)},[et]),N.useEffect(()=>{const M=async()=>{try{o(await Qy())}catch{}};M();const F=setInterval(M,3e4);return()=>clearInterval(F)},[]),N.useEffect(()=>{const M=async()=>{try{const[Q,k]=await Promise.all([wy(),Zy()]);x(Q.all_time??0),R(k.total??0)}catch{}};M();const F=setInterval(M,3e5);return()=>clearInterval(F)},[]),{characters:s,serverHealth:S,totalRares:d,totalKills:E,recentRares:g,chatMessages:Y,nearbyObjects:L,socketRef:I}}const Ky=N.lazy(()=>k0(()=>import("./DashboardView-CXnQ-RQq.js"),[]));function ky(){const[s,p]=N.useState(()=>localStorage.getItem("v2-view")||"map"),S=Vy(),o=()=>{const d=s==="map"?"dashboard":"map";p(d),localStorage.setItem("v2-view",d)};return s==="map"?i.jsx(qy,{data:S,onViewToggle:o}):i.jsx(N.Suspense,{fallback:i.jsx("div",{style:{background:"#0d0d0d",color:"#888",padding:40,textAlign:"center"},children:"Loading dashboard..."}),children:i.jsx(Ky,{data:S,onViewToggle:o})})}Z0.createRoot(document.getElementById("root")).render(i.jsx(N.StrictMode,{children:i.jsx(ky,{})}));export{ai as R,tl as a,Jy as c,U0 as g,i as j,N as r}; diff --git a/static/v2/index.html b/static/v2/index.html index e4350e93..2cbbab40 100644 --- a/static/v2/index.html +++ b/static/v2/index.html @@ -5,7 +5,7 @@ Mosswart Overlord v2 - +