diff --git a/repeater/data_acquisition/sqlite_handler.py b/repeater/data_acquisition/sqlite_handler.py
index 5302f0d..c5d8c8a 100644
--- a/repeater/data_acquisition/sqlite_handler.py
+++ b/repeater/data_acquisition/sqlite_handler.py
@@ -1877,6 +1877,63 @@ class SQLiteHandler:
logger.error(f"Failed to upsert companion contact: {e}")
return False
+ def companion_import_repeater_contacts(
+ self,
+ companion_hash: str,
+ contact_types: Optional[List[str]] = None,
+ hours: Optional[int] = None,
+ limit: Optional[int] = None,
+ ) -> int:
+ """Import repeater adverts into a companion's contact store (one-time seed).
+
+ Results are ordered by last_seen DESC so the most recent contacts are
+ imported first. Optional hours filters to adverts seen within the last N hours;
+ optional limit caps how many contacts are imported.
+ """
+ type_map = {"companion": 1, "repeater": 2, "room_server": 3, "sensor": 4}
+ try:
+ with sqlite3.connect(self.sqlite_path) as conn:
+ conn.row_factory = sqlite3.Row
+ query = (
+ "SELECT pubkey, node_name, contact_type, latitude, longitude, last_seen "
+ "FROM adverts WHERE pubkey IS NOT NULL"
+ )
+ params: list = []
+ if contact_types:
+ placeholders = ",".join("?" * len(contact_types))
+ query += f" AND contact_type IN ({placeholders})"
+ params.extend(contact_types)
+ if hours is not None:
+ cutoff = time.time() - (hours * 3600)
+ query += " AND last_seen >= ?"
+ params.append(cutoff)
+ query += " ORDER BY last_seen DESC"
+ if limit is not None:
+ query += " LIMIT ?"
+ params.append(limit)
+ rows = conn.execute(query, params).fetchall()
+
+ count = 0
+ for row in rows:
+ raw_type = row["contact_type"] or ""
+ normalized_type = raw_type.lower().replace(" ", "_").strip()
+ adv_type = type_map.get(normalized_type, 0)
+ contact = {
+ "pubkey": bytes.fromhex(row["pubkey"]),
+ "name": row["node_name"] or "",
+ "adv_type": adv_type,
+ "gps_lat": row["latitude"] or 0.0,
+ "gps_lon": row["longitude"] or 0.0,
+ "last_advert_timestamp": int(row["last_seen"] or 0),
+ "lastmod": int(row["last_seen"] or 0),
+ }
+ if self.companion_upsert_contact(companion_hash, contact):
+ count += 1
+ return count
+ except Exception as e:
+ logger.error(f"Failed to import repeater contacts: {e}")
+ return 0
+
def companion_load_prefs(self, companion_hash: str) -> Optional[Dict]:
"""Load persisted prefs for a companion. Returns parsed JSON dict or None if no row."""
try:
diff --git a/repeater/web/api_endpoints.py b/repeater/web/api_endpoints.py
index 18e1916..ac884f8 100644
--- a/repeater/web/api_endpoints.py
+++ b/repeater/web/api_endpoints.py
@@ -3131,12 +3131,49 @@ class APIEndpoints:
}
)
+ # Add companion identities (no login/ACL fields; use registered + active for status)
+ companion_bridges = getattr(self.daemon_instance, "companion_bridges", {})
+ # Build hash -> active TCP connection and client IP (frame server has at most one client)
+ active_by_hash = {}
+ client_ip_by_hash = {}
+ for fs in getattr(self.daemon_instance, "companion_frame_servers", []):
+ try:
+ ch = getattr(fs, "companion_hash", None)
+ h = (
+ int(ch, 16)
+ if isinstance(ch, str) and ch.startswith("0x")
+ else (int(ch) if ch is not None else None)
+ )
+ if h is not None:
+ writer = getattr(fs, "_client_writer", None)
+ active_by_hash[h] = writer is not None
+ if writer is not None:
+ peername = writer.get_extra_info("peername") if hasattr(writer, "get_extra_info") else None
+ client_ip_by_hash[h] = str(peername[0]) if peername else None
+ except (ValueError, TypeError):
+ pass
+ for name, identity, config in identity_manager.get_identities_by_type("companion"):
+ hash_byte = identity.get_public_key()[0]
+ active = active_by_hash.get(hash_byte, False)
+ entry = {
+ "name": name,
+ "type": "companion",
+ "hash": f"0x{hash_byte:02X}",
+ "registered": hash_byte in companion_bridges,
+ "active": active,
+ }
+ if active:
+ entry["client_ip"] = client_ip_by_hash.get(hash_byte)
+ else:
+ entry["client_ip"] = None
+ acl_info_list.append(entry)
+
return self._success(
{
"acls": acl_info_list,
"total_identities": len(acl_info_list),
"total_authenticated_clients": sum(
- a["authenticated_clients"] for a in acl_info_list
+ a.get("authenticated_clients", 0) for a in acl_info_list
),
}
)
@@ -3198,6 +3235,15 @@ class APIEndpoints:
"hash": self._fmt_hash(identity.get_public_key()),
}
+ # Add companions
+ for name, identity, config in identity_manager.get_identities_by_type("companion"):
+ hash_byte = identity.get_public_key()[0]
+ identity_map[hash_byte] = {
+ "name": name,
+ "type": "companion",
+ "hash": f"0x{hash_byte:02X}",
+ }
+
# Filter by identity if requested
target_hash = None
if identity_hash:
@@ -3394,6 +3440,7 @@ class APIEndpoints:
identity_stats = {
"repeater": {"count": 0, "clients": 0},
"room_server": {"count": 0, "clients": 0},
+ "companion": {"count": 0, "clients": 0},
}
# Count repeater
@@ -3430,6 +3477,18 @@ class APIEndpoints:
else:
guest_count += 1
+ # Count companions (no admin/guest; they use frame server, not OTA login)
+ companions = identity_manager.get_identities_by_type("companion")
+ identity_stats["companion"]["count"] = len(companions)
+
+ for name, identity, config in companions:
+ hash_byte = identity.get_public_key()[0]
+ acl = acl_dict.get(hash_byte)
+ if acl:
+ clients = acl.get_all_clients()
+ identity_stats["companion"]["clients"] += len(clients)
+ total_clients += len(clients)
+
return self._success(
{
"total_identities": len(acl_dict),
diff --git a/repeater/web/companion_endpoints.py b/repeater/web/companion_endpoints.py
index 52226a0..d33384d 100644
--- a/repeater/web/companion_endpoints.py
+++ b/repeater/web/companion_endpoints.py
@@ -146,6 +146,23 @@ class CompanionAPIEndpoints:
except (ValueError, TypeError) as exc:
raise cherrypy.HTTPError(400, f"Invalid public key: {exc}")
+ def _get_sqlite_handler(self):
+ """Return the repeater's sqlite_handler, or raise 503 if unavailable."""
+ if not self.daemon_instance:
+ raise cherrypy.HTTPError(503, "Daemon not initialized")
+ if (
+ not hasattr(self.daemon_instance, "repeater_handler")
+ or not self.daemon_instance.repeater_handler
+ ):
+ raise cherrypy.HTTPError(503, "Repeater handler not initialized")
+ storage = getattr(self.daemon_instance.repeater_handler, "storage", None)
+ if not storage:
+ raise cherrypy.HTTPError(503, "Storage not initialized")
+ sqlite_handler = getattr(storage, "sqlite_handler", None)
+ if not sqlite_handler:
+ raise cherrypy.HTTPError(503, "SQLite storage not available")
+ return sqlite_handler
+
# ------------------------------------------------------------------
# SSE push-event plumbing
# ------------------------------------------------------------------
@@ -323,6 +340,75 @@ class CompanionAPIEndpoints:
}
)
+ @cherrypy.expose
+ @cherrypy.tools.json_out()
+ @require_auth
+ def import_repeater_contacts(self, **kwargs):
+ """POST /api/companion/import_repeater_contacts {companion_name, contact_types?, hours?, limit?}
+
+ Import repeater adverts into this companion's contact store (one-time seed).
+ Optional: contact_types (list), hours (only adverts seen in last N hours),
+ limit (max contacts to import, capped by companion max_contacts).
+ Results are sorted by last_seen DESC. After import, contacts are hot-reloaded.
+ """
+ self._require_post()
+ body = self._get_json_body()
+ companion_name = body.get("companion_name")
+ if not companion_name:
+ raise cherrypy.HTTPError(400, "companion_name required")
+ contact_types = body.get("contact_types")
+ if contact_types is not None:
+ if not isinstance(contact_types, list):
+ raise cherrypy.HTTPError(400, "contact_types must be a list")
+ allowed = {"companion", "repeater", "room_server", "sensor"}
+ for t in contact_types:
+ if not isinstance(t, str) or t not in allowed:
+ raise cherrypy.HTTPError(
+ 400,
+ f"contact_types must contain only: companion, repeater, room_server, sensor (got {t!r})",
+ )
+ if not contact_types:
+ contact_types = None
+ hours = body.get("hours")
+ if hours is not None:
+ try:
+ hours = int(hours)
+ except (TypeError, ValueError):
+ raise cherrypy.HTTPError(400, "hours must be a positive integer")
+ if hours < 1:
+ raise cherrypy.HTTPError(400, "hours must be a positive integer")
+ limit = body.get("limit")
+ if limit is not None:
+ try:
+ limit = int(limit)
+ except (TypeError, ValueError):
+ raise cherrypy.HTTPError(400, "limit must be a positive integer")
+ if limit < 1:
+ raise cherrypy.HTTPError(400, "limit must be a positive integer")
+ bridge = self._get_bridge(**self._resolve_bridge_params(body))
+ if limit is not None:
+ max_contacts = getattr(bridge, "max_contacts", 1000)
+ limit = min(limit, max_contacts)
+ companion_hash = getattr(bridge, "_companion_hash", None)
+ if not companion_hash:
+ raise cherrypy.HTTPError(503, "Companion hash not available")
+ sqlite_handler = self._get_sqlite_handler()
+ count = sqlite_handler.companion_import_repeater_contacts(
+ companion_hash,
+ contact_types=contact_types,
+ hours=hours,
+ limit=limit,
+ )
+ contact_rows = sqlite_handler.companion_load_contacts(companion_hash)
+ if contact_rows:
+ records = []
+ for row in contact_rows:
+ d = dict(row)
+ d["public_key"] = d.pop("pubkey", d.get("public_key", b""))
+ records.append(d)
+ bridge.contacts.load_from_dicts(records)
+ return self._success({"imported": count})
+
# ----- Channels -----
@cherrypy.expose
diff --git a/repeater/web/html/assets/CADCalibration-BxVQoh3t.js b/repeater/web/html/assets/CADCalibration-BxVQoh3t.js
new file mode 100644
index 0000000..10b6893
--- /dev/null
+++ b/repeater/web/html/assets/CADCalibration-BxVQoh3t.js
@@ -0,0 +1 @@
+import{a as G,M as K,c as Q,r as o,o as W,P as X,b as g,e as a,g as k,i as F,t as l,k as h,n as ee,L as T,Y as te,Z as ae,p as f,x as se}from"./index-D0IT5vDS.js";import{P as M}from"./plotly.min-DO11Gp-n.js";import"./_commonjsHelpers-CqkleIqs.js";const oe={class:"p-6 space-y-6"},re={class:"glass-card rounded-[15px] p-6"},le={class:"flex justify-center"},ne={class:"flex gap-4"},ie=["disabled"],ce=["disabled"],de={class:"glass-card rounded-[15px] p-6 space-y-4"},ue={class:"text-content-primary dark:text-content-primary"},ve={key:0,class:"p-4 bg-primary/10 border border-primary/30 rounded-lg"},pe={class:"text-content-primary dark:text-primary"},me={class:"space-y-2"},be={class:"w-full bg-white/10 rounded-full h-2"},ge={class:"text-content-secondary dark:text-content-muted text-sm"},fe={class:"grid grid-cols-2 md:grid-cols-4 gap-4"},xe={class:"glass-card rounded-[15px] p-4 text-center"},ye={class:"text-2xl font-bold text-primary"},_e={class:"glass-card rounded-[15px] p-4 text-center"},ke={class:"text-2xl font-bold text-primary"},he={class:"glass-card rounded-[15px] p-4 text-center"},Ce={class:"text-2xl font-bold text-primary"},we={class:"glass-card rounded-[15px] p-4 text-center"},Re={class:"text-2xl font-bold text-primary"},Se={key:0,class:"glass-card rounded-[15px] p-6 space-y-4"},De={key:0,class:"p-4 bg-accent-green/10 border border-accent-green/30 rounded-lg"},Ae={class:"text-content-primary dark:text-content-primary mb-4"},Be={key:1,class:"p-4 bg-secondary/20 border border-secondary/40 rounded-lg"},Ee=G({name:"CADCalibrationView",__name:"CADCalibration",setup(Fe){const m=K(),I=Q(()=>document.documentElement.classList.contains("dark")),P=()=>{const e=I.value;return{title:e?"#F9FAFB":"#111827",subtitle:e?"#9CA3AF":"#6B7280",axis:e?"#D1D5DB":"#374151",tick:e?"#9CA3AF":"#6B7280",grid:e?"rgba(148, 163, 184, 0.1)":"rgba(107, 114, 128, 0.15)",zeroline:e?"rgba(148, 163, 184, 0.2)":"rgba(107, 114, 128, 0.25)",line:e?"rgba(148, 163, 184, 0.3)":"rgba(107, 114, 128, 0.35)",colorbarBorder:e?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.15)",markerLine:e?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.15)"}},u=o(!1),C=o(null),r=o(null),v=o({}),n=o(null),$=o([]),N=o({}),d=o("Ready to start calibration"),x=o(0),b=o(0),w=o(0),R=o(0),S=o(0),D=o(0),i=o(null),A=o(!1),B=o(!1),y=o(!1),_=o(!1);let c=null;const O={responsive:!0,displayModeBar:!0,modeBarButtonsToRemove:["pan2d","select2d","lasso2d","autoScale2d"],displaylogo:!1,toImageButtonOptions:{format:"png",filename:"cad-calibration-heatmap",height:600,width:800,scale:2}};function V(){const e=P(),t=[{x:[],y:[],z:[],mode:"markers",type:"scatter",marker:{size:12,color:[],colorscale:[[0,"rgba(75, 85, 99, 0.4)"],[.1,"rgba(6, 182, 212, 0.3)"],[.5,"rgba(6, 182, 212, 0.6)"],[1,"rgba(16, 185, 129, 0.9)"]],showscale:!0,colorbar:{title:{text:"Detection Rate (%)",font:{color:e.axis,size:14}},tickfont:{color:e.tick},bgcolor:"rgba(0,0,0,0)",bordercolor:e.colorbarBorder,borderwidth:1,thickness:15},line:{color:e.markerLine,width:1}},hovertemplate:"Peak: %{x}
Min: %{y}
Detection Rate: %{marker.color:.1f}%
",name:"Test Results"}],s={title:{text:`CAD Detection Rate
Channel Activity Detection Calibration`,font:{color:e.title,size:18},x:.5},xaxis:{title:{text:"CAD Peak Threshold",font:{color:e.axis,size:14}},tickfont:{color:e.tick},gridcolor:e.grid,zerolinecolor:e.zeroline,linecolor:e.line},yaxis:{title:{text:"CAD Min Threshold",font:{color:e.axis,size:14}},tickfont:{color:e.tick},gridcolor:e.grid,zerolinecolor:e.zeroline,linecolor:e.line},plot_bgcolor:"rgba(0, 0, 0, 0)",paper_bgcolor:"rgba(0, 0, 0, 0)",font:{color:e.title,family:"Inter, system-ui, sans-serif"},margin:{l:80,r:80,t:100,b:80},showlegend:!1};M.newPlot("plotly-chart",t,s,O)}function j(){if(Object.keys(v.value).length===0)return;const e=Object.values(v.value),t=[],s=[],p=[];for(const E of e)t.push(E.det_peak),s.push(E.det_min),p.push(E.detection_rate);const q={x:[t],y:[s],"marker.color":[p],hovertemplate:"Peak: %{x}
Min: %{y}
Detection Rate: %{marker.color:.1f}%
Status: Tested
"};M.restyle("plotly-chart",q,[0])}async function U(){try{const s=await T.post("/cad-calibration-start",{samples:10,delay_ms:50});if(s.success)u.value=!0,C.value=Date.now(),m.setCadCalibrationRunning(!0),v.value={},$.value=[],N.value={},n.value=null,A.value=!1,B.value=!1,y.value=!1,_.value=!1,w.value=0,R.value=0,S.value=0,D.value=0,x.value=0,b.value=0,c=setInterval(()=>{C.value&&(D.value=Math.floor((Date.now()-C.value)/1e3))},1e3),L();else throw new Error(s.error||"Failed to start calibration")}catch(s){d.value=`Error: ${s instanceof Error?s.message:"Unknown error"}`}}async function z(){try{(await T.post("/cad-calibration-stop")).success&&(u.value=!1,m.setCadCalibrationRunning(!1),r.value&&(r.value.close(),r.value=null),c&&(clearInterval(c),c=null))}catch(e){console.error("Failed to stop calibration:",e)}}function L(){r.value&&r.value.close();const e=te(),t=e?`?token=${encodeURIComponent(e)}`:"";r.value=new EventSource(`${ae}/api/cad-calibration-stream${t}`),r.value.onmessage=function(s){try{const p=JSON.parse(s.data);H(p)}catch(p){console.error("Failed to parse SSE data:",p)}},r.value.onerror=function(s){console.error("SSE connection error:",s),u.value||r.value&&(r.value.close(),r.value=null)}}function H(e){switch(e.type){case"status":d.value=e.message||"Status update",e.test_ranges&&(i.value=e.test_ranges,A.value=!0);break;case"progress":x.value=e.current||0,b.value=e.total||0,w.value=e.current||0;break;case"result":if(e.det_peak!==void 0&&e.det_min!==void 0&&e.detection_rate!==void 0&&e.detections!==void 0&&e.samples!==void 0){const t=`${e.det_peak}_${e.det_min}`;v.value[t]={det_peak:e.det_peak,det_min:e.det_min,detection_rate:e.detection_rate,detections:e.detections,samples:e.samples},j(),J()}break;case"complete":case"completed":u.value=!1,d.value=e.message||"Calibration completed",m.setCadCalibrationRunning(!1),Y(),r.value&&(r.value.close(),r.value=null),c&&(clearInterval(c),c=null);break;case"error":d.value=`Error: ${e.message}`,m.setCadCalibrationRunning(!1),z();break}}function J(){const e=Object.values(v.value).map(t=>t.detection_rate);e.length!==0&&(R.value=Math.max(...e),S.value=e.reduce((t,s)=>t+s,0)/e.length)}function Y(){B.value=!0;let e=null,t=0;for(const s of Object.values(v.value))s.detection_rate>t&&(t=s.detection_rate,e=s);n.value=e,e&&t>0?(y.value=!0,_.value=!1):(y.value=!1,_.value=!0)}async function Z(){if(!n.value){d.value="Error: No calibration results to save";return}try{const e=await T.post("/save_cad_settings",{peak:n.value.det_peak,min_val:n.value.det_min,detection_rate:n.value.detection_rate});if(e.success)d.value=`Settings saved! Peak=${n.value.det_peak}, Min=${n.value.det_min} applied to configuration.`;else throw new Error(e.error||"Failed to save settings")}catch(e){d.value=`Error: Failed to save settings: ${e instanceof Error?e.message:"Unknown error"}`}}return W(()=>{V()}),X(()=>{r.value&&r.value.close(),c&&clearInterval(c),m.setCadCalibrationRunning(!1),document.getElementById("plotly-chart")&&M.purge("plotly-chart")}),(e,t)=>(f(),g("div",oe,[t[14]||(t[14]=a("div",null,[a("h1",{class:"text-2xl font-bold text-content-primary dark:text-content-primary"},"CAD Calibration Tool"),a("p",{class:"text-content-secondary dark:text-content-muted mt-2"},"Channel Activity Detection calibration")],-1)),a("div",re,[a("div",le,[a("div",ne,[a("button",{onClick:U,disabled:u.value,class:"flex items-center gap-3 px-6 py-3 bg-accent-green/10 hover:bg-accent-green/20 disabled:bg-gray-500/10 text-accent-green disabled:text-gray-400 rounded-lg border border-accent-green/30 disabled:border-gray-500/20 transition-colors disabled:cursor-not-allowed"},t[0]||(t[0]=[F('
Start Calibration
Begin testing
',2)]),8,ie),a("button",{onClick:z,disabled:!u.value,class:"flex items-center gap-3 px-6 py-3 bg-accent-red/10 hover:bg-accent-red/20 disabled:bg-gray-500/10 text-accent-red disabled:text-gray-400 rounded-lg border border-accent-red/30 disabled:border-gray-500/20 transition-colors disabled:cursor-not-allowed"},t[1]||(t[1]=[F('',2)]),8,ce)])])]),a("div",de,[a("div",ue,l(d.value),1),A.value&&i.value?(f(),g("div",ve,[a("div",pe,[t[2]||(t[2]=a("strong",null,"Configuration:",-1)),h(" SF"+l(i.value.spreading_factor)+" | Peak: "+l(i.value.peak_min)+" - "+l(i.value.peak_max)+" | Min: "+l(i.value.min_min)+" - "+l(i.value.min_max)+" | "+l((i.value.peak_max-i.value.peak_min+1)*(i.value.min_max-i.value.min_min+1))+" tests ",1)])])):k("",!0),a("div",me,[a("div",be,[a("div",{class:"bg-gradient-to-r from-primary to-accent-green h-2 rounded-full transition-all duration-300",style:ee({width:b.value>0?`${x.value/b.value*100}%`:"0%"})},null,4)]),a("div",ge,l(x.value)+" / "+l(b.value)+" tests completed",1)])]),a("div",fe,[a("div",xe,[a("div",ye,l(w.value),1),t[3]||(t[3]=a("div",{class:"text-content-secondary dark:text-content-muted text-sm"},"Tests Completed",-1))]),a("div",_e,[a("div",ke,l(R.value.toFixed(1))+"%",1),t[4]||(t[4]=a("div",{class:"text-content-secondary dark:text-content-muted text-sm"},"Best Detection Rate",-1))]),a("div",he,[a("div",Ce,l(S.value.toFixed(1))+"%",1),t[5]||(t[5]=a("div",{class:"text-content-secondary dark:text-content-muted text-sm"},"Average Rate",-1))]),a("div",we,[a("div",Re,l(D.value)+"s",1),t[6]||(t[6]=a("div",{class:"text-content-secondary dark:text-content-muted text-sm"},"Elapsed Time",-1))])]),t[15]||(t[15]=a("div",{class:"glass-card rounded-[15px] p-6"},[a("div",{id:"plotly-chart",class:"w-full h-96"})],-1)),B.value?(f(),g("div",Se,[t[13]||(t[13]=a("h3",{class:"text-xl font-bold text-content-primary dark:text-content-primary"},"Calibration Results",-1)),y.value&&n.value?(f(),g("div",De,[t[11]||(t[11]=a("h4",{class:"font-medium text-accent-green mb-2"},"Optimal Settings Found:",-1)),a("p",Ae,[t[7]||(t[7]=h(" Peak: ",-1)),a("strong",null,l(n.value.det_peak),1),t[8]||(t[8]=h(", Min: ",-1)),a("strong",null,l(n.value.det_min),1),t[9]||(t[9]=h(", Rate: ",-1)),a("strong",null,l(n.value.detection_rate.toFixed(1))+"%",1)]),a("div",{class:"flex justify-center"},[a("button",{onClick:Z,class:"flex items-center gap-3 px-6 py-3 bg-primary/20 hover:bg-primary/30 text-primary rounded-lg border border-primary/50 transition-colors"},t[10]||(t[10]=[F('Save Settings
Apply to configuration
',2)]))])])):k("",!0),_.value?(f(),g("div",Be,t[12]||(t[12]=[a("h4",{class:"font-medium text-secondary mb-2"},"No Optimal Settings Found",-1),a("p",{class:"text-content-secondary dark:text-content-muted"},"All tested combinations showed low detection rates. Consider running calibration again or adjusting test parameters.",-1)]))):k("",!0)])):k("",!0)]))}}),Ie=se(Ee,[["__scopeId","data-v-c30e5f38"]]);export{Ie as default};
diff --git a/repeater/web/html/assets/Companions-dNR-ED8E.js b/repeater/web/html/assets/Companions-dNR-ED8E.js
new file mode 100644
index 0000000..3bd0d3c
--- /dev/null
+++ b/repeater/web/html/assets/Companions-dNR-ED8E.js
@@ -0,0 +1 @@
+import{a as ee,r as u,D as q,c as oe,b as d,g,e,k as j,t as p,w as b,$ as X,F as L,h as z,u as ne,W as G,v as _,s as se,L as A,p as i,E as Q,o as ae,f as K,i as le,j as Z}from"./index-D0IT5vDS.js";import{_ as de}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-CidOa_xU.js";import{_ as ie}from"./MessageDialog.vue_vue_type_script_setup_true_lang-C6ugQFfD.js";const ue={id:"import-modal-description",class:"text-content-secondary dark:text-content-muted text-sm mb-4"},ce={class:"mb-4"},pe={class:"flex items-center gap-2 mb-2"},me={key:0,class:"text-content-muted dark:text-content-muted text-xs mb-2"},be={key:1,class:"flex flex-wrap gap-3 ml-6"},ve=["value"],xe={class:"text-content-primary dark:text-content-primary text-sm capitalize"},ye={class:"border-t border-stroke-subtle dark:border-white/10 pt-4 mt-4 mb-4"},ke={class:"flex flex-wrap gap-3 mb-2"},ge=["value"],fe={class:"text-content-primary dark:text-content-primary text-sm"},we={class:"flex flex-wrap items-center gap-2 mt-2"},he={class:"flex items-center gap-2"},_e={key:1,class:"text-content-muted dark:text-content-muted text-sm"},Ce={class:"border-t border-stroke-subtle dark:border-white/10 pt-4 mt-4 mb-4"},$e={class:"flex flex-wrap items-center gap-2"},Ie={key:0,role:"alert",class:"mb-4 p-3 rounded-lg bg-accent-red/10 dark:bg-accent-red/20 border border-accent-red/30 text-accent-red text-sm"},Me={key:1,class:"text-content-muted dark:text-content-muted text-sm mb-4"},Ne={class:"flex justify-end gap-3"},Ee=["disabled"],Ve=["disabled"],Se=ee({name:"ImportRepeaterContactsModal",__name:"ImportRepeaterContactsModal",props:{isOpen:{type:Boolean},companionName:{}},emits:["close","imported"],setup(Y,{emit:P}){const I=["companion","repeater","room_server","sensor"],V=[{label:"All time",value:null},{label:"Last 24 hours",value:24},{label:"Last 7 days",value:168},{label:"Last 30 days",value:720},{label:"Custom",value:"custom"}].slice(0,4),N=Y,l=P,f=u(!1),v=u(null),x=u(!0),y=u([]),m=u(null),M=u(""),C=u(""),S=u(null),T=u(null);function c(){const a=m.value;if(a===null||a==="custom"){if(a==="custom"){const r=M.value;if(r===""||r===null)return;const s=Number(r);return Number.isInteger(s)&&s>=1?s:void 0}return}return a}function $(){const a=C.value;if(a===""||a===null)return;const r=Number(a);return Number.isInteger(r)&&r>=1?r:void 0}function D(){x.value=!0,y.value=[],m.value=null,M.value="",C.value="",v.value=null}q(()=>N.isOpen,a=>{a&&(D(),Q(()=>{T.value?.focus()}))}),q(m,a=>{a==="custom"&&Q(()=>{S.value?.focus()})});const O=oe(()=>{const a=x.value?"All types":y.value.map(R=>R.replace("_"," ")).join(", ");let r;const s=m.value;if(s===null)r="all time";else if(s==="custom"){const R=c();r=R!==void 0?`last ${R} hours`:"custom"}else s===24?r="last 24 hours":s===168?r="last 7 days":s===720?r="last 30 days":r="all time";const k=$(),h=k!==void 0?`max ${k} contacts`:"no limit";return`Import: ${a}, ${r}, ${h}.`});function F(){if(m.value==="custom"){const r=c();if(r===void 0||r<1)return"Custom recency must be at least 1 hour."}const a=$();if(C.value!==""&&(a===void 0||a<1))return"Limit must be at least 1.";if(!x.value&&y.value.length===0)return"Select at least one contact type or use All types.";if(!x.value){const r=y.value.filter(s=>!I.includes(s));if(r.length>0)return`Invalid contact type: ${r.join(", ")}`}return null}async function H(){v.value=null;const a=F();if(a){v.value=a;return}const r={companion_name:N.companionName};!x.value&&y.value.length>0&&(r.contact_types=[...y.value]);const s=c();s!==void 0&&(r.hours=s);const k=$();k!==void 0&&(r.limit=k),f.value=!0;try{const h=await A.importRepeaterContacts(r);h.success&&h.data?(l("imported",h.data.imported),l("close")):v.value=h.error||"Import failed."}catch(h){v.value=h instanceof Error?h.message:"Import failed."}finally{f.value=!1}}function w(a){a.target===a.currentTarget&&l("close")}function B(a){a.key==="Escape"&&l("close")}return(a,r)=>a.isOpen?(i(),d("div",{key:0,class:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:w,onKeydown:B},[e("div",{role:"dialog","aria-describedby":"import-modal-description",class:"bg-white dark:bg-surface-elevated backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-6 max-w-lg w-full max-h-[90vh] overflow-y-auto",onClick:r[7]||(r[7]=se(()=>{},["stop"]))},[r[18]||(r[18]=e("h2",{class:"text-xl font-bold text-content-primary dark:text-content-primary mb-4"}," Import repeater contacts ",-1)),e("p",ue,[r[8]||(r[8]=j(" Seed ",-1)),e("strong",null,p(a.companionName),1),r[9]||(r[9]=j(" with contacts from the repeater's adverts. Results are ordered by most recent first. ",-1))]),e("div",ce,[r[11]||(r[11]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"}," Contact types ",-1)),e("label",pe,[b(e("input",{ref_key:"firstFocusRef",ref:T,"onUpdate:modelValue":r[0]||(r[0]=s=>x.value=s),type:"checkbox",class:"rounded border-stroke-subtle dark:border-stroke/20 text-primary focus:ring-primary/50"},null,512),[[X,x.value]]),r[10]||(r[10]=e("span",{class:"text-content-primary dark:text-content-primary text-sm"},"All types",-1))]),x.value?(i(),d("p",me," Uncheck to filter by type (repeater, companion, room server, sensor). ")):g("",!0),x.value?g("",!0):(i(),d("div",be,[(i(),d(L,null,z(I,s=>e("label",{key:s,class:"flex items-center gap-2"},[b(e("input",{"onUpdate:modelValue":r[1]||(r[1]=k=>y.value=k),type:"checkbox",value:s,class:"rounded border-stroke-subtle dark:border-stroke/20 text-primary focus:ring-primary/50"},null,8,ve),[[X,y.value]]),e("span",xe,p(s.replace("_"," ")),1)])),64))]))]),e("div",ye,[r[13]||(r[13]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"}," Recency ",-1)),e("div",ke,[(i(!0),d(L,null,z(ne(V),s=>(i(),d("label",{key:s.label,class:"flex items-center gap-2"},[b(e("input",{"onUpdate:modelValue":r[2]||(r[2]=k=>m.value=k),type:"radio",value:s.value,class:"border-stroke-subtle dark:border-stroke/20 text-primary focus:ring-primary/50"},null,8,ge),[[G,m.value]]),e("span",fe,p(s.label),1)]))),128))]),e("div",we,[e("label",he,[b(e("input",{"onUpdate:modelValue":r[3]||(r[3]=s=>m.value=s),type:"radio",value:"custom",class:"border-stroke-subtle dark:border-stroke/20 text-primary focus:ring-primary/50"},null,512),[[G,m.value]]),r[12]||(r[12]=e("span",{class:"text-content-primary dark:text-content-primary text-sm"},"Custom:",-1))]),m.value==="custom"?b((i(),d("input",{key:0,ref_key:"customHoursInputRef",ref:S,"onUpdate:modelValue":r[4]||(r[4]=s=>M.value=s),type:"number",min:"1",placeholder:"e.g. 48",class:"w-24 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-3 py-1.5 text-content-primary dark:text-content-primary text-sm placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50"},null,512)),[[_,M.value,void 0,{number:!0}]]):g("",!0),m.value==="custom"?(i(),d("span",_e,"hours")):g("",!0)])]),e("div",Ce,[r[16]||(r[16]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"}," Max contacts (optional) ",-1)),e("div",$e,[r[14]||(r[14]=e("span",{class:"text-content-muted dark:text-content-muted text-sm"},"Import at most",-1)),b(e("input",{"onUpdate:modelValue":r[5]||(r[5]=s=>C.value=s),type:"number",inputmode:"numeric",min:"1",placeholder:"No limit",class:"w-32 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-3 py-2 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50"},null,512),[[_,C.value,void 0,{number:!0}]]),r[15]||(r[15]=e("span",{class:"text-content-muted dark:text-content-muted text-sm"},"contacts",-1))]),r[17]||(r[17]=e("p",{class:"text-content-muted dark:text-content-muted text-xs mt-1"},"Leave empty for no cap. Server caps at companion max.",-1))]),v.value?(i(),d("div",Ie,p(v.value),1)):g("",!0),v.value?g("",!0):(i(),d("p",Me,p(O.value),1)),e("div",Ne,[e("button",{type:"button",disabled:f.value,class:"px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg transition-colors disabled:opacity-50",onClick:r[6]||(r[6]=s=>l("close"))}," Cancel ",8,Ee),e("button",{type:"button",disabled:f.value,class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-primary rounded-lg border border-primary/50 transition-colors disabled:opacity-50",onClick:H},p(f.value?"Importing…":"Import"),9,Ve)])])],32)):g("",!0)}}),Te={class:"p-6 space-y-6"},Re={key:0,class:"grid grid-cols-1 md:grid-cols-2 gap-4"},Pe={class:"group relative overflow-hidden glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-5"},Ue={class:"relative flex items-center justify-between"},Ae={class:"text-3xl font-bold text-content-primary dark:text-content-primary"},je={class:"glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-6"},Le={key:0,class:"flex items-center justify-center py-12"},De={key:1,class:"flex items-center justify-center py-12"},Oe={class:"text-center"},Fe={class:"text-content-secondary dark:text-content-muted text-sm mb-4"},He={key:2,class:"space-y-4"},Be={class:"relative flex items-start justify-between"},Ke={class:"flex-1"},ze={class:"flex items-center gap-3 mb-4"},Ye={class:"relative"},We={key:0,class:"absolute inset-0 bg-accent-green/50 rounded-full animate-ping"},Je={class:"text-xl font-bold text-content-primary dark:text-content-primary"},qe={key:0,class:"text-content-muted dark:text-content-muted text-sm"},Xe={class:"grid grid-cols-1 md:grid-cols-2 gap-3 text-sm mb-3"},Ge={class:"text-content-primary dark:text-content-primary/90 ml-2"},Qe={class:"text-content-primary dark:text-content-primary/90 ml-2"},Ze={class:"text-content-primary dark:text-content-primary/90 ml-2"},et={class:"flex items-center gap-2"},tt={key:0,class:"text-content-primary dark:text-content-primary/90 font-mono ml-2 text-xs"},rt={key:1,class:"text-content-muted dark:text-content-muted ml-2 text-xs"},ot=["onClick"],nt={class:"text-xs text-content-muted dark:text-content-muted"},st={key:0,class:"ml-2 font-mono text-content-primary dark:text-content-primary/90 break-all"},at={key:1,class:"ml-2 text-content-muted dark:text-content-muted"},lt={class:"ml-4 flex flex-wrap gap-2"},dt=["onClick"],it=["onClick"],ut=["onClick"],ct={key:3,class:"text-center py-12 text-content-secondary dark:text-content-muted"},pt={key:1,class:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4"},mt={class:"bg-white dark:bg-surface-elevated backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-6 max-w-2xl w-full max-h-[90vh] overflow-y-auto"},bt={class:"space-y-4"},vt={class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},xt={key:0},yt={key:1,class:"text-content-secondary dark:text-content-muted text-sm"},kt={class:"grid grid-cols-2 gap-4"},gt={key:2,class:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4"},ft={class:"bg-white dark:bg-surface-elevated backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-6 max-w-2xl w-full max-h-[90vh] overflow-y-auto"},wt={class:"space-y-4"},ht=["value"],_t={class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},Ct={key:0},$t={class:"grid grid-cols-2 gap-4"},It=5050,Mt=1,Nt=65535,Tt=ee({name:"CompanionsView",__name:"Companions",setup(Y){const P=u(!1),I=u(null),E=u(null),V=u(!1),N=u(!1),l=u(null),f=u(!1),v=u(!1),x=u(new Set),y=u(!1),m=u(""),M=u(!1),C=u(""),S=u(!1),T=u({message:"",variant:"success"}),c=u({name:"",identity_key:"",type:"companion",settings:{node_name:"",tcp_port:5e3,bind_address:"0.0.0.0"}});ae(async()=>{await $()});async function $(){P.value=!0,I.value=null;try{const n=await A.getIdentities();n.success?E.value=n.data:I.value=n.error||"Failed to load identities"}catch(n){I.value=n instanceof Error?n.message:"Failed to load identities"}finally{P.value=!1}}async function D(){try{const n=await A.createIdentity({...c.value,settings:{node_name:c.value.settings.node_name||c.value.name,tcp_port:c.value.settings.tcp_port??5e3,bind_address:c.value.settings.bind_address||"0.0.0.0"}});n.success?(V.value=!1,a(),await $(),w(n.message||"Companion created successfully!","success")):w(`Failed to create companion: ${n.error}`,"error")}catch(n){w(`Error creating companion: ${n}`,"error")}}async function O(){try{const n=await A.updateIdentity({name:l.value.name,new_name:l.value.new_name,identity_key:l.value.identity_key,type:"companion",settings:{node_name:l.value.settings?.node_name,tcp_port:l.value.settings?.tcp_port,bind_address:l.value.settings?.bind_address}});n.success?(N.value=!1,l.value=null,await $(),w(n.message||"Companion updated successfully!","success")):w(`Failed to update companion: ${n.error}`,"error")}catch(n){w(`Error updating companion: ${n}`,"error")}}function F(n){m.value=n,y.value=!0}async function H(){const n=m.value;y.value=!1;try{const t=await A.deleteIdentity(n,"companion");t.success?(await $(),w(t.message||"Companion deleted successfully!","success")):w(`Failed to delete companion: ${t.error}`,"error")}catch(t){w(`Error deleting companion: ${t}`,"error")}finally{m.value=""}}function w(n,t){T.value={message:n,variant:t},S.value=!0}function B(n){l.value=JSON.parse(JSON.stringify(n)),l.value.settings||(l.value.settings={node_name:"",tcp_port:5e3,bind_address:"0.0.0.0"}),l.value.new_name="",v.value=!1,N.value=!0}function a(){c.value={name:"",identity_key:"",type:"companion",settings:{node_name:"",tcp_port:5e3,bind_address:"0.0.0.0"}},f.value=!1}function r(){V.value=!1,N.value=!1,l.value=null,f.value=!1,v.value=!1,a()}function s(n){x.value.has(n)?x.value.delete(n):x.value.add(n)}const k=()=>E.value?.configured_companions??[],h=()=>E.value?.total_configured_companions??0;function R(){const n=k();if(n.length===0)return It;const t=n.map(U=>U.settings?.tcp_port??5e3),o=Math.max(...t)+1;return Math.min(Nt,Math.max(Mt,o))}function W(){a(),c.value.settings.tcp_port=R(),V.value=!0}function te(n){C.value=n,M.value=!0}function J(){M.value=!1,C.value=""}function re(n){w(`Imported ${n} contact${n===1?"":"s"}.`,"success"),J()}return(n,t)=>(i(),d(L,null,[e("div",Te,[e("div",{class:"relative overflow-hidden rounded-[20px] p-6 mb-6 glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10"},[t[16]||(t[16]=e("div",{class:"absolute inset-0 bg-gradient-to-br from-primary/20 via-secondary/10 to-accent-purple/20 opacity-50"},null,-1)),t[17]||(t[17]=e("div",{class:"absolute inset-0 bg-gradient-to-tl from-accent-green/10 via-transparent to-primary/10 animate-pulse"},null,-1)),e("div",{class:"relative flex items-center justify-between"},[t[15]||(t[15]=le('Companions
Manage companion identities (TCP frame server)
',1)),e("button",{onClick:W,class:"group relative px-6 py-3 bg-gradient-to-r from-primary/30 to-secondary/30 hover:from-primary/40 hover:to-secondary/40 text-content-primary dark:text-content-primary rounded-[12px] border border-primary/50 transition-all hover:scale-105 hover:shadow-lg hover:shadow-primary/20"},t[14]||(t[14]=[e("span",{class:"flex items-center gap-2"},[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})]),j(" Add Companion ")],-1)]))])]),E.value&&h()>0?(i(),d("div",Re,[e("div",Pe,[e("div",Ue,[e("div",null,[t[18]||(t[18]=e("div",{class:"text-content-secondary dark:text-content-muted text-xs font-medium mb-2 uppercase tracking-wide"},"Total Configured",-1)),e("div",Ae,p(h()),1)])])])])):g("",!0),e("div",je,[P.value?(i(),d("div",Le,t[19]||(t[19]=[e("div",{class:"text-center"},[e("div",{class:"animate-spin w-8 h-8 border-2 border-stroke-subtle dark:border-stroke/20 border-t-primary rounded-full mx-auto mb-4"}),e("div",{class:"text-content-secondary dark:text-content-primary/70"},"Loading companions...")],-1)]))):I.value?(i(),d("div",De,[e("div",Oe,[t[20]||(t[20]=e("div",{class:"text-red-600 dark:text-red-400 mb-2"},"Failed to load companions",-1)),e("div",Fe,p(I.value),1),e("button",{onClick:$,class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors"}," Retry ")])])):E.value&&k().length>0?(i(),d("div",He,[(i(!0),d(L,null,z(k(),o=>(i(),d("div",{key:o.name,class:"group relative overflow-hidden glass-card backdrop-blur-xl rounded-[15px] p-5 border border-stroke-subtle dark:border-white/10 hover:border-primary/30 transition-all duration-300"},[e("div",Be,[e("div",Ke,[e("div",ze,[e("div",Ye,[o.registered?(i(),d("div",We)):g("",!0),e("div",{class:Z(["relative w-3 h-3 rounded-full",o.registered?"bg-accent-green":"bg-accent-red"])},null,2)]),e("h3",Je,p(o.name),1),e("span",{class:Z(["px-3 py-1 text-xs font-semibold rounded-full",o.registered?"bg-accent-green/20 text-accent-green border border-accent-green/30":"bg-accent-red/20 text-accent-red border border-accent-red/30"])},p(o.registered?"● Active":"○ Inactive"),3),o.hash?(i(),d("span",qe,p(o.hash),1)):g("",!0)]),e("div",Xe,[e("div",null,[t[21]||(t[21]=e("span",{class:"text-content-muted dark:text-content-muted"},"Node Name:",-1)),e("span",Ge,p(o.settings?.node_name||o.name),1)]),e("div",null,[t[22]||(t[22]=e("span",{class:"text-content-muted dark:text-content-muted"},"TCP Port:",-1)),e("span",Qe,p(o.settings?.tcp_port??5e3),1)]),e("div",null,[t[23]||(t[23]=e("span",{class:"text-content-muted dark:text-content-muted"},"Bind Address:",-1)),e("span",Ze,p(o.settings?.bind_address||"0.0.0.0"),1)]),e("div",et,[t[24]||(t[24]=e("span",{class:"text-content-muted dark:text-content-muted"},"Identity Key:",-1)),x.value.has(o.name)?(i(),d("span",tt,p(o.identity_key),1)):(i(),d("span",rt,"••••••••••••••••")),e("button",{onClick:U=>s(o.name),class:"text-primary/70 hover:text-primary text-xs underline"},p(x.value.has(o.name)?"Hide":"Show"),9,ot)])]),e("div",nt,[t[25]||(t[25]=e("span",{class:"text-content-muted dark:text-content-muted"},"Public Key:",-1)),o.public_key?(i(),d("span",st,p(o.public_key),1)):(i(),d("span",at,"—"))])]),e("div",lt,[e("button",{onClick:U=>te(o.name),class:"px-3 py-1 bg-primary/20 hover:bg-primary/30 text-primary rounded text-xs transition-colors"}," Import contacts ",8,dt),e("button",{onClick:U=>B(o),class:"px-3 py-1 bg-primary/20 hover:bg-primary/30 text-primary rounded text-xs transition-colors"}," Edit ",8,it),e("button",{onClick:U=>F(o.name),class:"px-3 py-1 bg-accent-red/20 hover:bg-accent-red/30 text-accent-red rounded text-xs transition-colors"}," Delete ",8,ut)])])]))),128))])):(i(),d("div",ct,[t[26]||(t[26]=e("svg",{class:"w-16 h-16 mx-auto mb-4 text-content-muted dark:text-content-muted/60",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z"})],-1)),t[27]||(t[27]=e("p",{class:"text-lg mb-2"},"No companions configured",-1)),t[28]||(t[28]=e("p",{class:"text-sm mb-4"},"Add a companion to run a TCP frame server for firmware or other clients",-1)),e("button",{onClick:W,class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-primary rounded-lg border border-primary/50 transition-colors"}," + Add Companion ")]))]),V.value?(i(),d("div",pt,[e("div",mt,[t[35]||(t[35]=e("h2",{class:"text-xl font-bold text-content-primary dark:text-content-primary mb-4"},"Add Companion",-1)),e("div",bt,[e("div",null,[t[29]||(t[29]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Name *",-1)),b(e("input",{"onUpdate:modelValue":t[0]||(t[0]=o=>c.value.name=o),type:"text",placeholder:"e.g., TestCompanion",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[_,c.value.name]])]),e("div",null,[e("label",vt,[t[30]||(t[30]=j(" Identity Key (Optional) ",-1)),e("button",{onClick:t[1]||(t[1]=o=>f.value=!f.value),type:"button",class:"ml-2 text-primary/70 hover:text-primary text-xs underline"},p(f.value?"Hide":"Show/Edit"),1)]),f.value?(i(),d("div",xt,[b(e("input",{"onUpdate:modelValue":t[2]||(t[2]=o=>c.value.identity_key=o),type:"text",placeholder:"Leave empty to auto-generate (32 bytes hex)",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary font-mono text-sm placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[_,c.value.identity_key]]),t[31]||(t[31]=e("p",{class:"text-content-secondary dark:text-content-muted text-xs mt-1"},"32 or 64 bytes hex. Leave empty to auto-generate.",-1))])):(i(),d("div",yt," Will be auto-generated if not provided "))]),e("div",null,[t[32]||(t[32]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Node Name",-1)),b(e("input",{"onUpdate:modelValue":t[3]||(t[3]=o=>c.value.settings.node_name=o),type:"text",placeholder:"Display name (defaults to Name)",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[_,c.value.settings.node_name]])]),e("div",kt,[e("div",null,[t[33]||(t[33]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"TCP Port",-1)),b(e("input",{"onUpdate:modelValue":t[4]||(t[4]=o=>c.value.settings.tcp_port=o),type:"number",min:"1",max:"65535",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[_,c.value.settings.tcp_port,void 0,{number:!0}]])]),e("div",null,[t[34]||(t[34]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Bind Address",-1)),b(e("input",{"onUpdate:modelValue":t[5]||(t[5]=o=>c.value.settings.bind_address=o),type:"text",placeholder:"0.0.0.0",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[_,c.value.settings.bind_address]])])])]),e("div",{class:"flex justify-end gap-3 mt-6"},[e("button",{onClick:r,class:"px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg transition-colors"}," Cancel "),e("button",{onClick:D,class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-primary rounded-lg border border-primary/50 transition-colors"}," Create ")])])])):g("",!0),N.value&&l.value?(i(),d("div",gt,[e("div",ft,[t[42]||(t[42]=e("h2",{class:"text-xl font-bold text-content-primary dark:text-content-primary mb-4"},"Edit Companion",-1)),e("div",wt,[e("div",null,[t[36]||(t[36]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Current Name",-1)),e("input",{value:l.value.name,disabled:"",type:"text",class:"w-full bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-muted dark:text-content-muted cursor-not-allowed"},null,8,ht)]),e("div",null,[t[37]||(t[37]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"New Name (optional)",-1)),b(e("input",{"onUpdate:modelValue":t[6]||(t[6]=o=>l.value.new_name=o),type:"text",placeholder:"Leave empty to keep current name",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[_,l.value.new_name]])]),e("div",null,[e("label",_t,[t[38]||(t[38]=j(" Identity Key (Optional) ",-1)),e("button",{onClick:t[7]||(t[7]=o=>v.value=!v.value),type:"button",class:"ml-2 text-primary/70 hover:text-primary text-xs underline"},p(v.value?"Hide":"Show/Edit"),1)]),v.value?(i(),d("div",Ct,[b(e("input",{"onUpdate:modelValue":t[8]||(t[8]=o=>l.value.identity_key=o),type:"text",placeholder:"Leave empty to keep current key",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary font-mono text-sm placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[_,l.value.identity_key]])])):g("",!0)]),e("div",null,[t[39]||(t[39]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Node Name",-1)),b(e("input",{"onUpdate:modelValue":t[9]||(t[9]=o=>l.value.settings.node_name=o),type:"text",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[_,l.value.settings.node_name]])]),e("div",$t,[e("div",null,[t[40]||(t[40]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"TCP Port",-1)),b(e("input",{"onUpdate:modelValue":t[10]||(t[10]=o=>l.value.settings.tcp_port=o),type:"number",min:"1",max:"65535",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[_,l.value.settings.tcp_port,void 0,{number:!0}]])]),e("div",null,[t[41]||(t[41]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Bind Address",-1)),b(e("input",{"onUpdate:modelValue":t[11]||(t[11]=o=>l.value.settings.bind_address=o),type:"text",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[_,l.value.settings.bind_address]])])])]),e("div",{class:"flex justify-end gap-3 mt-6"},[e("button",{onClick:r,class:"px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg transition-colors"}," Cancel "),e("button",{onClick:O,class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-primary rounded-lg border border-primary/50 transition-colors"}," Update ")])])])):g("",!0)]),K(Se,{"is-open":M.value,"companion-name":C.value,onClose:J,onImported:re},null,8,["is-open","companion-name"]),K(de,{show:y.value,title:"Delete Companion",message:`Are you sure you want to delete '${m.value}'? Restart required to fully remove.`,"confirm-text":"Delete","cancel-text":"Cancel",variant:"danger",onClose:t[12]||(t[12]=o=>y.value=!1),onConfirm:H},null,8,["show","message"]),K(ie,{show:S.value,message:T.value.message,variant:T.value.variant,onClose:t[13]||(t[13]=o=>S.value=!1)},null,8,["show","message","variant"])],64))}});export{Tt as default};
diff --git a/repeater/web/html/assets/Configuration-jnqusIoi.js b/repeater/web/html/assets/Configuration-jnqusIoi.js
new file mode 100644
index 0000000..b6b9725
--- /dev/null
+++ b/repeater/web/html/assets/Configuration-jnqusIoi.js
@@ -0,0 +1,2 @@
+const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/leaflet-src-BtisrQHC.js","assets/_commonjsHelpers-CqkleIqs.js"])))=>i.map(i=>d[i]);
+import{a as q,M as re,c as T,r as m,D as te,b as r,g as L,e,t as u,F as U,w as S,v as V,h as J,q as ee,k as H,L as K,p as o,P as we,s as G,E as ie,S as me,x as pe,f as R,y as de,d as _e,U as ce,j as D,l as ve,N as xe,V as be,T as Ce,i as W,W as ne,o as ae,u as X,X as $e,Q as Z}from"./index-D0IT5vDS.js";/* empty css */import{_ as Me}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-CidOa_xU.js";import{g as Ae,s as Se}from"./preferences-DtwbSSgO.js";const je={class:"space-y-4"},Te={key:0,class:"bg-green-100 dark:bg-green-500/20 border border-green-500/50 rounded-lg p-3"},Ne={class:"text-green-600 dark:text-green-400 text-sm"},Be={key:1,class:"bg-red-100 dark:bg-red-500/20 border border-red-500/50 rounded-lg p-3"},Ee={class:"text-red-600 dark:text-red-400 text-sm"},Le={class:"flex justify-end gap-2"},Fe=["disabled"],Pe=["disabled"],ze={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},Ve={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},De={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Ie={key:1,class:"flex items-center gap-2"},He={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},Ue={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Re={key:1},Ke=["value"],Oe={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},qe={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},We={key:1},Ge=["value"],Qe={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},Ye={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Xe={key:1,class:"flex items-center gap-2"},Je={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},Ze={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},et={key:1},tt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1"},ot={class:"text-content-primary dark:text-content-primary font-mono text-sm"},rt={key:2,class:"bg-yellow-500/10 dark:bg-yellow-500/10 border border-yellow-500/30 rounded-lg p-3"},st=q({__name:"RadioSettings",setup(I){const _=re(),i=T(()=>_.stats?.config?.radio||{}),x=m(!1),g=m(!1),c=m(null),p=m(null),s=m(0),v=m(0),f=m(0),h=m(0),E=m(0),A=m(0),$=[{value:7.8,label:"7.8 kHz"},{value:10.4,label:"10.4 kHz"},{value:15.6,label:"15.6 kHz"},{value:20.8,label:"20.8 kHz"},{value:31.25,label:"31.25 kHz"},{value:41.7,label:"41.7 kHz"},{value:62.5,label:"62.5 kHz"},{value:125,label:"125 kHz"},{value:250,label:"250 kHz"},{value:500,label:"500 kHz"}];te(i,C=>{C&&!x.value&&(s.value=C.frequency?Number((C.frequency/1e6).toFixed(3)):0,v.value=C.spreading_factor??0,f.value=C.bandwidth?Number((C.bandwidth/1e3).toFixed(1)):0,h.value=C.tx_power??0,E.value=C.coding_rate??0,A.value=C.preamble_length??0)},{immediate:!0});const n=T(()=>{const C=i.value.frequency;return C?(C/1e6).toFixed(3)+" MHz":"Not set"}),t=T(()=>{const C=i.value.bandwidth;return C?(C/1e3).toFixed(1)+" kHz":"Not set"}),a=T(()=>{const C=i.value.tx_power;return C!==void 0?C+" dBm":"Not set"}),j=T(()=>{const C=i.value.coding_rate;return C?"4/"+C:"Not set"}),k=T(()=>{const C=i.value.preamble_length;return C?C+" symbols":"Not set"}),b=T(()=>i.value.spreading_factor??"Not set"),y=()=>{x.value=!0,c.value=null,p.value=null},z=()=>{x.value=!1,c.value=null;const C=i.value;s.value=C.frequency?Number((C.frequency/1e6).toFixed(3)):0,v.value=C.spreading_factor??0,f.value=C.bandwidth?Number((C.bandwidth/1e3).toFixed(1)):0,h.value=C.tx_power??0,E.value=C.coding_rate??0,A.value=C.preamble_length??0},O=async()=>{g.value=!0,c.value=null,p.value=null;try{const C={};s.value&&(C.frequency=s.value*1e6),v.value&&(C.spreading_factor=v.value),f.value&&(C.bandwidth=f.value*1e3),h.value&&(C.tx_power=h.value),E.value&&(C.coding_rate=E.value);const P=(await K.post("/update_radio_config",C)).data;P.message||P.persisted?(p.value=P.message||"Settings saved successfully",x.value=!1,await _.fetchStats(),setTimeout(()=>{p.value=null},3e3)):P.error?c.value=P.error:c.value="Unknown response from server"}catch(C){console.error("Failed to update radio settings:",C);const N=C;c.value=N.response?.data?.error||"Failed to update settings"}finally{g.value=!1}};return(C,N)=>(o(),r("div",je,[p.value?(o(),r("div",Te,[e("p",Ne,u(p.value),1)])):L("",!0),c.value?(o(),r("div",Be,[e("p",Ee,u(c.value),1)])):L("",!0),e("div",Le,[x.value?(o(),r(U,{key:1},[e("button",{onClick:z,disabled:g.value,class:"px-3 sm:px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"}," Cancel ",8,Fe),e("button",{onClick:O,disabled:g.value,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"},u(g.value?"Saving...":"Save Changes"),9,Pe)],64)):(o(),r("button",{key:0,onClick:y,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm"}," Edit Settings "))]),e("div",ze,[e("div",Ve,[N[6]||(N[6]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Frequency",-1)),x.value?(o(),r("div",Ie,[S(e("input",{"onUpdate:modelValue":N[0]||(N[0]=P=>s.value=P),type:"number",step:"0.001",min:"100",max:"1000",class:"w-32 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512),[[V,s.value,void 0,{number:!0}]]),N[5]||(N[5]=e("span",{class:"text-content-muted dark:text-content-muted text-sm"},"MHz",-1))])):(o(),r("div",De,u(n.value),1))]),e("div",He,[N[7]||(N[7]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Spreading Factor",-1)),x.value?(o(),r("div",Re,[S(e("select",{"onUpdate:modelValue":N[1]||(N[1]=P=>v.value=P),class:"px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},[(o(),r(U,null,J([5,6,7,8,9,10,11,12],P=>e("option",{key:P,value:P},u(P),9,Ke)),64))],512),[[ee,v.value,void 0,{number:!0}]])])):(o(),r("div",Ue,u(b.value),1))]),e("div",Oe,[N[8]||(N[8]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Bandwidth",-1)),x.value?(o(),r("div",We,[S(e("select",{"onUpdate:modelValue":N[2]||(N[2]=P=>f.value=P),class:"px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},[(o(),r(U,null,J($,P=>e("option",{key:P.value,value:P.value},u(P.label),9,Ge)),64))],512),[[ee,f.value,void 0,{number:!0}]])])):(o(),r("div",qe,u(t.value),1))]),e("div",Qe,[N[10]||(N[10]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"TX Power",-1)),x.value?(o(),r("div",Xe,[S(e("input",{"onUpdate:modelValue":N[3]||(N[3]=P=>h.value=P),type:"number",min:"2",max:"30",class:"w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512),[[V,h.value,void 0,{number:!0}]]),N[9]||(N[9]=e("span",{class:"text-content-muted dark:text-content-muted text-sm"},"dBm",-1))])):(o(),r("div",Ye,u(a.value),1))]),e("div",Je,[N[12]||(N[12]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Coding Rate",-1)),x.value?(o(),r("div",et,[S(e("select",{"onUpdate:modelValue":N[4]||(N[4]=P=>E.value=P),class:"px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},N[11]||(N[11]=[e("option",{value:5},"4/5",-1),e("option",{value:6},"4/6",-1),e("option",{value:7},"4/7",-1),e("option",{value:8},"4/8",-1)]),512),[[ee,E.value,void 0,{number:!0}]])])):(o(),r("div",Ze,u(j.value),1))]),e("div",tt,[N[13]||(N[13]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Preamble Length",-1)),e("span",ot,u(k.value),1)])]),x.value?(o(),r("div",rt,N[14]||(N[14]=[e("p",{class:"text-yellow-700 dark:text-yellow-400 text-xs"},[e("strong",null,"Note:"),H(" Radio hardware changes (frequency, bandwidth, spreading factor, coding rate) may require a service restart to apply. ")],-1)]))):L("",!0)]))}}),nt={class:"glass-card border border-stroke-subtle dark:border-white/20 rounded-[15px] w-full max-w-3xl max-h-[90vh] flex flex-col shadow-2xl"},at={class:"flex-1 relative min-h-[400px]"},lt={class:"p-6 border-t border-stroke-subtle dark:border-stroke/10 space-y-4"},dt={class:"grid grid-cols-2 gap-4"},it=q({__name:"LocationPicker",props:{isOpen:{type:Boolean},latitude:{},longitude:{}},emits:["close","select"],setup(I,{emit:_}){const i=I,x=_,g=m(null),c=m(i.latitude||0),p=m(i.longitude||0);let s=null,v=null;const f=async()=>{if(g.value){h();try{const n=(await me(async()=>{const{default:k}=await import("./leaflet-src-BtisrQHC.js").then(b=>b.l);return{default:k}},__vite__mapDeps([0,1]))).default;delete n.Icon.Default.prototype._getIconUrl,n.Icon.Default.mergeOptions({iconRetinaUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon-2x.png",iconUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",shadowUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png"}),await ie();const t=c.value||0,a=p.value||0,j=t===0&&a===0?2:13;s=n.map(g.value).setView([t,a],j);try{const k=n.tileLayer("https://{s}.basemaps.cartocdn.com/dark_nolabels/{z}/{x}/{y}{r}.png",{maxZoom:19,attribution:'© OpenStreetMap contributors © CARTO',errorTileUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="}),b=n.tileLayer("https://{s}.basemaps.cartocdn.com/dark_only_labels/{z}/{x}/{y}{r}.png",{maxZoom:19,attribution:"",errorTileUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="});k.addTo(s),b.addTo(s)}catch(k){console.warn("Error loading tiles:",k)}(t!==0||a!==0)&&(v=n.marker([t,a]).addTo(s)),s.on("click",k=>{c.value=k.latlng.lat,p.value=k.latlng.lng,v?v.setLatLng(k.latlng):v=n.marker(k.latlng).addTo(s)}),setTimeout(()=>{s?.invalidateSize()},200)}catch(n){console.error("Failed to initialize map:",n)}}},h=()=>{s&&(s.remove(),s=null,v=null)};te(()=>i.isOpen,async n=>{n?(await ie(),await f()):h()}),te(()=>[i.latitude,i.longitude],([n,t])=>{c.value=n,p.value=t});const E=()=>{x("select",{latitude:c.value,longitude:p.value}),x("close")},A=()=>{x("close")},$=()=>{navigator.geolocation?navigator.geolocation.getCurrentPosition(async n=>{if(c.value=n.coords.latitude,p.value=n.coords.longitude,s){s.setView([c.value,p.value],13);const t=(await me(async()=>{const{default:a}=await import("./leaflet-src-BtisrQHC.js").then(j=>j.l);return{default:a}},__vite__mapDeps([0,1]))).default;v?v.setLatLng([c.value,p.value]):v=t.marker([c.value,p.value]).addTo(s)}},n=>{console.error("Error getting location:",n),alert("Unable to get current location. Please check browser permissions.")}):alert("Geolocation is not supported by this browser.")};return we(()=>{h()}),(n,t)=>n.isOpen?(o(),r("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:G(A,["self"])},[e("div",nt,[e("div",{class:"flex items-center justify-between p-6 border-b border-stroke-subtle dark:border-stroke/10"},[t[3]||(t[3]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary"},"Select Location",-1)),e("button",{onClick:A,class:"text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors"},t[2]||(t[2]=[e("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),e("div",at,[e("div",{ref_key:"mapContainer",ref:g,class:"absolute inset-0 rounded-b-[15px] overflow-hidden"},null,512)]),e("div",lt,[e("div",dt,[e("div",null,[t[4]||(t[4]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-muted mb-2"},"Latitude",-1)),S(e("input",{"onUpdate:modelValue":t[0]||(t[0]=a=>c.value=a),type:"number",step:"0.000001",class:"w-full px-4 py-2 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary focus:outline-none focus:border-primary",readonly:""},null,512),[[V,c.value,void 0,{number:!0}]])]),e("div",null,[t[5]||(t[5]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-muted mb-2"},"Longitude",-1)),S(e("input",{"onUpdate:modelValue":t[1]||(t[1]=a=>p.value=a),type:"number",step:"0.000001",class:"w-full px-4 py-2 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary focus:outline-none focus:border-primary",readonly:""},null,512),[[V,p.value,void 0,{number:!0}]])])]),e("div",{class:"flex gap-3"},[e("button",{onClick:$,class:"flex-1 px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm flex items-center justify-center gap-2"},t[6]||(t[6]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})],-1),H(" Use Current Location ",-1)])),e("button",{onClick:A,class:"px-6 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm"}," Cancel "),e("button",{onClick:E,class:"px-6 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm"}," Select Location ")]),t[7]||(t[7]=e("p",{class:"text-content-muted dark:text-content-muted text-xs text-center"},"Click on the map to select a location",-1))])])])):L("",!0)}}),ct=pe(it,[["__scopeId","data-v-186d3c86"]]),ut={class:"space-y-4"},mt={key:0,class:"bg-green-100 dark:bg-green-500/10 border border-green-300 dark:border-green-500/30 rounded-lg p-3"},pt={class:"text-green-700 dark:text-green-400 text-sm"},vt={key:1,class:"bg-red-100 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30 rounded-lg p-3"},xt={class:"text-red-700 dark:text-red-400 text-sm"},bt={class:"flex justify-end gap-2"},kt=["disabled"],gt=["disabled"],yt={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},ft={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},ht={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm break-all"},wt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},_t={class:"text-content-primary dark:text-content-primary font-mono text-xs break-all"},Ct={class:"flex flex-col sm:flex-row sm:justify-between sm:items-start py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},$t={class:"text-content-primary dark:text-content-primary font-mono text-xs break-all sm:text-right sm:max-w-xs"},Mt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},At={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},St={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},jt={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Tt={key:0,class:"flex justify-end"},Nt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},Bt={class:"text-content-primary dark:text-content-primary font-mono text-sm"},Et={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},Lt={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Ft={class:"flex flex-col py-2 gap-2"},Pt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-start gap-1"},zt={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm sm:ml-4"},Vt={key:1,class:"flex items-center gap-2"},Dt=q({__name:"RepeaterSettings",setup(I){const _=re(),i=T(()=>_.stats?.config||{}),x=T(()=>i.value.repeater||{}),g=T(()=>_.stats),c=m(!1),p=m(!1),s=m(null),v=m(null),f=m(!1),h=m(""),E=m(0),A=m(0),$=m(0),n=m(1),t=T(()=>i.value.mesh||{});te([i,x,t],()=>{if(!c.value){h.value=i.value.node_name||"",E.value=x.value.latitude||0,A.value=x.value.longitude||0,$.value=x.value.send_advert_interval_hours||0;const d=t.value.path_hash_mode;n.value=d===0||d===1||d===2?d+1:1}},{immediate:!0});const a=T(()=>i.value.node_name||"Not set"),j=T(()=>g.value?.local_hash||"Not available"),k=T(()=>{const d=g.value?.public_key;return!d||d==="Not set"?"Not set":d}),b=T(()=>{const d=x.value.latitude;return d&&d!==0?d.toFixed(6):"Not set"}),y=T(()=>{const d=x.value.longitude;return d&&d!==0?d.toFixed(6):"Not set"}),z=T(()=>{const d=x.value.mode;return d?d.charAt(0).toUpperCase()+d.slice(1):"Not set"}),O=T(()=>{const d=x.value.send_advert_interval_hours;return d===void 0?"Not set":d===0?"Disabled":d+" hour"+(d!==1?"s":"")}),C=T(()=>{const d=t.value.path_hash_mode;return d===0||d===1||d===2?d+1+(d===0?" byte":" bytes"):"Not set"}),N=()=>{c.value=!0,s.value=null,v.value=null},P=()=>{c.value=!1,s.value=null,h.value=i.value.node_name||"",E.value=x.value.latitude||0,A.value=x.value.longitude||0,$.value=x.value.send_advert_interval_hours||0;const d=t.value.path_hash_mode;n.value=d===0||d===1||d===2?d+1:1},oe=async()=>{p.value=!0,s.value=null,v.value=null;try{const d={};h.value&&(d.node_name=h.value),d.latitude=E.value,d.longitude=A.value,d.flood_advert_interval_hours=$.value,d.path_hash_mode=n.value-1;const F=(await K.post("/update_radio_config",d)).data;F.message||F.persisted?(v.value=F.message||"Settings saved successfully",c.value=!1,await _.fetchStats(),setTimeout(()=>{v.value=null},3e3)):F.error?s.value=F.error:s.value="Unknown response from server"}catch(d){console.error("Failed to update repeater settings:",d);const w=d;s.value=w.response?.data?.error||"Failed to update settings"}finally{p.value=!1}},Y=()=>{f.value=!0},M=d=>{E.value=d.latitude,A.value=d.longitude};return(d,w)=>(o(),r("div",ut,[v.value?(o(),r("div",mt,[e("p",pt,u(v.value),1)])):L("",!0),s.value?(o(),r("div",vt,[e("p",xt,u(s.value),1)])):L("",!0),e("div",bt,[c.value?(o(),r(U,{key:1},[e("button",{onClick:P,disabled:p.value,class:"px-3 sm:px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"}," Cancel ",8,kt),e("button",{onClick:oe,disabled:p.value,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"},u(p.value?"Saving...":"Save Changes"),9,gt)],64)):(o(),r("button",{key:0,onClick:N,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm"}," Edit Settings "))]),e("div",yt,[e("div",ft,[w[6]||(w[6]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Node Name",-1)),c.value?S((o(),r("input",{key:1,"onUpdate:modelValue":w[0]||(w[0]=F=>h.value=F),type:"text",maxlength:"50",class:"w-full sm:w-64 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary",placeholder:"Enter node name"},null,512)),[[V,h.value]]):(o(),r("div",ht,u(a.value),1))]),e("div",wt,[w[7]||(w[7]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Local Hash",-1)),e("span",_t,u(j.value),1)]),e("div",Ct,[w[8]||(w[8]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm flex-shrink-0"},"Public Key",-1)),e("span",$t,u(k.value),1)]),e("div",Mt,[w[9]||(w[9]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Latitude",-1)),c.value?S((o(),r("input",{key:1,"onUpdate:modelValue":w[1]||(w[1]=F=>E.value=F),type:"number",step:"0.000001",min:"-90",max:"90",class:"w-full sm:w-48 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512)),[[V,E.value,void 0,{number:!0}]]):(o(),r("div",At,u(b.value),1))]),e("div",St,[w[10]||(w[10]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Longitude",-1)),c.value?S((o(),r("input",{key:1,"onUpdate:modelValue":w[2]||(w[2]=F=>A.value=F),type:"number",step:"0.000001",min:"-180",max:"180",class:"w-full sm:w-48 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512)),[[V,A.value,void 0,{number:!0}]]):(o(),r("div",jt,u(y.value),1))]),c.value?(o(),r("div",Tt,[e("button",{onClick:Y,class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm flex items-center gap-2",title:"Pick location on map"},w[11]||(w[11]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})],-1),H(" Pick Location on Map ",-1)]))])):L("",!0),e("div",Nt,[w[12]||(w[12]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Mode",-1)),e("span",Bt,u(z.value),1)]),e("div",Et,[w[14]||(w[14]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Path hash length",-1)),c.value?S((o(),r("select",{key:1,"onUpdate:modelValue":w[3]||(w[3]=F=>n.value=F),class:"w-full sm:w-32 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},w[13]||(w[13]=[e("option",{value:1},"1 byte",-1),e("option",{value:2},"2 bytes",-1),e("option",{value:3},"3 bytes",-1)]),512)),[[ee,n.value,void 0,{number:!0}]]):(o(),r("div",Lt,u(C.value),1))]),e("div",Ft,[e("div",Pt,[w[16]||(w[16]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Periodic Advertisement Interval",-1)),c.value?(o(),r("div",Vt,[S(e("input",{"onUpdate:modelValue":w[4]||(w[4]=F=>$.value=F),type:"number",min:"0",max:"48",class:"w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512),[[V,$.value,void 0,{number:!0}]]),w[15]||(w[15]=e("span",{class:"text-content-muted dark:text-content-muted text-sm"},"hours",-1))])):(o(),r("div",zt,u(O.value),1))]),w[17]||(w[17]=e("span",{class:"text-content-muted dark:text-content-muted text-xs"},"How often the repeater sends an advertisement packet (0 = disabled, 3-48 hours)",-1))])]),R(ct,{"is-open":f.value,latitude:E.value,longitude:A.value,onClose:w[5]||(w[5]=F=>f.value=!1),onSelect:M},null,8,["is-open","latitude","longitude"])]))}}),It={class:"space-y-4"},Ht={key:0,class:"bg-green-100 dark:bg-green-500/20 border border-green-500 dark:border-green-500/50 rounded-lg p-3 text-green-700 dark:text-green-400 text-sm"},Ut={key:1,class:"bg-red-100 dark:bg-red-500/20 border border-red-500 dark:border-red-500/50 rounded-lg p-3 text-red-700 dark:text-red-400 text-sm"},Rt={class:"flex justify-end gap-2"},Kt=["disabled"],Ot=["disabled"],qt={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},Wt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},Gt={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Qt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1"},Yt={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Xt=q({__name:"DutyCycle",setup(I){const _=re(),i=T(()=>_.stats?.config?.duty_cycle||{}),x=T(()=>{const n=i.value.max_airtime_percent;return typeof n=="number"?n.toFixed(1)+"%":n&&typeof n=="object"&&"parsedValue"in n?(n.parsedValue||0).toFixed(1)+"%":"Not set"}),g=T(()=>i.value.enforcement_enabled?"Enabled":"Disabled"),c=m(!1),p=m(!1),s=m(""),v=m(""),f=m(0),h=m(!0),E=()=>{const n=i.value.max_airtime_percent;typeof n=="number"?f.value=n:n&&typeof n=="object"&&"parsedValue"in n?f.value=n.parsedValue||0:f.value=6,h.value=i.value.enforcement_enabled!==!1,c.value=!0,s.value="",v.value=""},A=()=>{c.value=!1,s.value="",v.value=""},$=async()=>{p.value=!0,v.value="",s.value="";try{const t=(await de.post("/api/update_duty_cycle_config",{max_airtime_percent:f.value,enforcement_enabled:h.value})).data;t.message||t.persisted?(s.value=t.message||"Settings saved successfully",c.value=!1,await _.fetchStats(),setTimeout(()=>{s.value=""},3e3)):v.value="Failed to save settings"}catch(n){console.error("Failed to save duty cycle settings:",n),v.value=n.response?.data?.error||"Failed to save settings"}finally{p.value=!1}};return(n,t)=>(o(),r("div",It,[s.value?(o(),r("div",Ht,u(s.value),1)):L("",!0),v.value?(o(),r("div",Ut,u(v.value),1)):L("",!0),e("div",Rt,[c.value?(o(),r(U,{key:1},[e("button",{onClick:A,disabled:p.value,class:"px-3 sm:px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"}," Cancel ",8,Kt),e("button",{onClick:$,disabled:p.value,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"},u(p.value?"Saving...":"Save Changes"),9,Ot)],64)):(o(),r("button",{key:0,onClick:E,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm"}," Edit Settings "))]),e("div",qt,[e("div",Wt,[t[2]||(t[2]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Max Airtime %",-1)),c.value?S((o(),r("input",{key:1,"onUpdate:modelValue":t[0]||(t[0]=a=>f.value=a),type:"number",step:"0.1",min:"0.1",max:"100",class:"w-full sm:w-32 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512)),[[V,f.value,void 0,{number:!0}]]):(o(),r("div",Gt,u(x.value),1))]),e("div",Qt,[t[4]||(t[4]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Enforcement",-1)),c.value?S((o(),r("select",{key:1,"onUpdate:modelValue":t[1]||(t[1]=a=>h.value=a),class:"w-full sm:w-32 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},t[3]||(t[3]=[e("option",{value:!0},"Enabled",-1),e("option",{value:!1},"Disabled",-1)]),512)),[[ee,h.value]]):(o(),r("div",Yt,u(g.value),1))])])]))}}),Jt={class:"space-y-4"},Zt={key:0,class:"bg-green-100 dark:bg-green-500/20 border border-green-500 dark:border-green-500/50 rounded-lg p-3 text-green-700 dark:text-green-400 text-sm"},eo={key:1,class:"bg-red-100 dark:bg-red-500/20 border border-red-500 dark:border-red-500/50 rounded-lg p-3 text-red-700 dark:text-red-400 text-sm"},to={class:"flex justify-end gap-2"},oo=["disabled"],ro=["disabled"],so={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},no={class:"flex flex-col py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-2"},ao={class:"flex flex-col sm:flex-row sm:justify-between sm:items-start gap-1"},lo={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm sm:ml-4"},io={class:"flex flex-col py-2 gap-2"},co={class:"flex flex-col sm:flex-row sm:justify-between sm:items-start gap-1"},uo={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm sm:ml-4"},mo=q({__name:"TransmissionDelays",setup(I){const _=re(),i=T(()=>_.stats?.config?.delays||{}),x=T(()=>{const n=i.value.tx_delay_factor;if(n&&typeof n=="object"&&n!==null&&"parsedValue"in n){const t=n.parsedValue;if(typeof t=="number")return t.toFixed(2)+"x"}return"Not set"}),g=T(()=>{const n=i.value.direct_tx_delay_factor;return typeof n=="number"?n.toFixed(2)+"s":"Not set"}),c=m(!1),p=m(!1),s=m(""),v=m(""),f=m(0),h=m(0),E=()=>{const n=i.value.tx_delay_factor;n&&typeof n=="object"&&"parsedValue"in n?f.value=n.parsedValue||1:typeof n=="number"?f.value=n:f.value=1;const t=i.value.direct_tx_delay_factor;h.value=typeof t=="number"?t:.5,c.value=!0,s.value="",v.value=""},A=()=>{c.value=!1,s.value="",v.value=""},$=async()=>{p.value=!0,v.value="",s.value="";try{const t=(await de.post("/api/update_radio_config",{tx_delay_factor:f.value,direct_tx_delay_factor:h.value})).data;t.message||t.persisted?(s.value=t.message||"Settings saved successfully",c.value=!1,await _.fetchStats(),setTimeout(()=>{s.value=""},3e3)):v.value="Failed to save settings"}catch(n){console.error("Failed to save delay settings:",n),v.value=n.response?.data?.error||"Failed to save settings"}finally{p.value=!1}};return(n,t)=>(o(),r("div",Jt,[s.value?(o(),r("div",Zt,u(s.value),1)):L("",!0),v.value?(o(),r("div",eo,u(v.value),1)):L("",!0),e("div",to,[c.value?(o(),r(U,{key:1},[e("button",{onClick:A,disabled:p.value,class:"px-3 sm:px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"}," Cancel ",8,oo),e("button",{onClick:$,disabled:p.value,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"},u(p.value?"Saving...":"Save Changes"),9,ro)],64)):(o(),r("button",{key:0,onClick:E,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm"}," Edit Settings "))]),e("div",so,[e("div",no,[e("div",ao,[t[2]||(t[2]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Flood TX Delay Factor",-1)),c.value?S((o(),r("input",{key:1,"onUpdate:modelValue":t[0]||(t[0]=a=>f.value=a),type:"number",step:"0.1",min:"0",max:"5",class:"w-full sm:w-32 px-3 py-1.5 bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512)),[[V,f.value,void 0,{number:!0}]]):(o(),r("div",lo,u(x.value),1))]),t[3]||(t[3]=e("span",{class:"text-content-muted dark:text-content-muted text-xs"},"Multiplier for flood packet transmission delays (collision avoidance)",-1))]),e("div",io,[e("div",co,[t[4]||(t[4]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Direct TX Delay Factor",-1)),c.value?S((o(),r("input",{key:1,"onUpdate:modelValue":t[1]||(t[1]=a=>h.value=a),type:"number",step:"0.1",min:"0",max:"5",class:"w-full sm:w-32 px-3 py-1.5 bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512)),[[V,h.value,void 0,{number:!0}]]):(o(),r("div",uo,u(g.value),1))]),t[5]||(t[5]=e("span",{class:"text-content-muted dark:text-content-muted text-xs"},"Base delay for direct-routed packet transmission (seconds)",-1))])])]))}}),ke=_e("treeState",()=>{const I=ce(new Set),_=ce({value:null}),i=s=>{I.add(s)},x=s=>{I.delete(s)};return{expandedNodes:I,selectedNodeId:_,addExpandedNode:i,removeExpandedNode:x,isNodeExpanded:s=>I.has(s),setSelectedNode:s=>{_.value=s},toggleExpanded:s=>{I.has(s)?x(s):i(s)}}}),po={class:"select-none"},vo={class:"flex-shrink-0"},xo={key:0,class:"w-3.5 h-3.5 sm:w-4 sm:h-4 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},bo={key:1,class:"w-3.5 h-3.5 sm:w-4 sm:h-4 text-accent-green",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ko={key:0,class:"hidden sm:flex items-center gap-1 ml-2"},go={class:"relative group"},yo=["title"],fo={key:0,class:"text-xs font-mono text-white/50 bg-white/5 px-1.5 py-0.5 rounded border border-white/10"},ho={class:"flex justify-between items-start mb-4"},wo={class:"bg-black/20 border border-white/10 rounded-md p-4 mb-4"},_o={class:"text-sm font-mono text-white/80 break-all leading-relaxed"},Co={class:"flex items-center gap-1 sm:gap-2 ml-auto flex-shrink-0"},$o={key:0,class:"hidden sm:flex items-center gap-1"},Mo=["title"],Ao={key:1,class:"hidden sm:flex items-center gap-1"},So={key:2,class:"hidden sm:inline-block px-2 py-1 bg-white/10 text-white/60 text-xs rounded-full ml-1"},jo={key:0,class:"space-y-1"},To=q({__name:"TreeNode",props:{node:{},selectedNodeId:{},level:{},disabled:{type:Boolean}},emits:["select"],setup(I,{emit:_}){const i=I,x=_,g=ke(),c=m(!1),p=T({get:()=>g.isNodeExpanded(i.node.id),set:t=>{t?g.addExpandedNode(i.node.id):g.removeExpandedNode(i.node.id)}}),s=T(()=>i.node.children.length>0);function v(t){if(!t)return"Never";const j=new Date().getTime()-t.getTime(),k=Math.floor(j/(1e3*60)),b=Math.floor(j/(1e3*60*60)),y=Math.floor(j/(1e3*60*60*24)),z=Math.floor(y/365);return k<60?`${k}m ago`:b<24?`${b}h ago`:y<365?`${y}d ago`:`${z}y ago`}function f(t){return t?t.length<=16?t:`${t.slice(0,8)}...${t.slice(-8)}`:"No key"}function h(){if(s.value){const t=!p.value;p.value=t}}function E(){x("select",i.node.id)}function A(t){x("select",t)}function $(t){t.stopPropagation(),c.value=!c.value}function n(t){t.stopPropagation(),i.node.transport_key&&window.navigator?.clipboard&&window.navigator.clipboard.writeText(i.node.transport_key)}return(t,a)=>{const j=be("TreeNode",!0);return o(),r("div",po,[e("div",{class:D(["flex flex-wrap sm:flex-nowrap items-start sm:items-center gap-1 sm:gap-2 py-2 px-2 sm:px-3 rounded-lg cursor-pointer transition-all duration-200",i.disabled?"opacity-50 cursor-not-allowed":"hover:bg-white/5",t.selectedNodeId===t.node.id&&!i.disabled?"bg-primary/20 text-primary":"text-white/80 hover:text-white",`ml-${t.level*4}`]),onClick:a[3]||(a[3]=k=>!i.disabled&&E())},[e("div",{class:"flex-shrink-0 w-3 h-3 sm:w-4 sm:h-4 flex items-center justify-center",onClick:G(h,["stop"])},[s.value?(o(),r("svg",{key:0,class:D(["w-2.5 h-2.5 sm:w-3 sm:h-3 transition-transform duration-200",p.value?"rotate-90":"rotate-0"]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},a[4]||(a[4]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"},null,-1)]),2)):L("",!0)]),e("div",vo,[i.node.name.startsWith("#")?(o(),r("svg",xo,a[5]||(a[5]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"},null,-1)]))):(o(),r("svg",bo,a[6]||(a[6]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"},null,-1)])))]),e("span",{class:D(["font-mono text-xs sm:text-sm transition-colors duration-200 break-all",t.selectedNodeId===t.node.id?"text-primary font-medium":""])},u(t.node.name),3),t.node.transport_key?(o(),r("div",ko,[e("div",go,[e("button",{onClick:$,class:"p-1 rounded hover:bg-white/10 transition-colors",title:c.value?"Hide full key":"Show full key"},a[7]||(a[7]=[e("svg",{class:"w-3 h-3 text-white/60 hover:text-white/80",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})],-1)]),8,yo),c.value?L("",!0):(o(),r("span",fo,u(f(t.node.transport_key)),1)),c.value?(o(),r("div",{key:1,class:"fixed inset-0 z-[9998] flex items-center justify-center bg-black/70 backdrop-blur-md",onClick:a[2]||(a[2]=k=>c.value=!1)},[e("div",{class:"bg-black/20 border border-white/20 rounded-lg shadow-lg p-6 max-w-2xl w-full mx-4",onClick:a[1]||(a[1]=G(()=>{},["stop"]))},[e("div",ho,[a[9]||(a[9]=e("h3",{class:"text-lg font-semibold text-white"},"Transport Key",-1)),e("button",{onClick:a[0]||(a[0]=k=>c.value=!1),class:"text-white/60 hover:text-white transition-colors"},a[8]||(a[8]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),e("div",wo,[e("div",_o,u(t.node.transport_key),1)]),e("div",{class:"flex justify-end"},[e("button",{onClick:n,class:"px-4 py-2 bg-accent-green/20 hover:bg-accent-green/30 border border-accent-green/50 text-accent-green rounded-lg transition-colors flex items-center gap-2",title:"Copy to clipboard"},a[10]||(a[10]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})],-1),H(" Copy Key ",-1)]))])])])):L("",!0)])])):L("",!0),e("div",Co,[t.node.last_used?(o(),r("div",$o,[a[11]||(a[11]=e("svg",{class:"w-3 h-3 text-white/40",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),e("span",{class:"text-xs text-white/50",title:t.node.last_used.toLocaleString()},u(v(t.node.last_used)),9,Mo)])):(o(),r("div",Ao,a[12]||(a[12]=[e("svg",{class:"w-3 h-3 text-white/30",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})],-1),e("span",{class:"text-xs text-white/30 italic"},"Never",-1)]))),e("span",{class:D(["px-1.5 sm:px-2 py-0.5 text-[10px] sm:text-xs font-medium rounded-md transition-colors",t.node.floodPolicy==="allow"?"bg-accent-green/10 text-accent-green/90 border border-accent-green/20":"bg-accent-red/10 text-accent-red/90 border border-accent-red/20"])},u(t.node.floodPolicy==="allow"?"ALLOW":"DENY"),3),s.value?(o(),r("span",So," > "+u(t.node.children.length),1)):L("",!0)])],2),R(Ce,{"enter-active-class":"transition-all duration-300 ease-out","enter-from-class":"opacity-0 max-h-0 overflow-hidden","enter-to-class":"opacity-100 max-h-screen overflow-visible","leave-active-class":"transition-all duration-300 ease-in","leave-from-class":"opacity-100 max-h-screen overflow-visible","leave-to-class":"opacity-0 max-h-0 overflow-hidden"},{default:ve(()=>[p.value&&t.node.children.length>0?(o(),r("div",jo,[(o(!0),r(U,null,J(t.node.children,k=>(o(),xe(j,{key:k.id,node:k,"selected-node-id":t.selectedNodeId,level:t.level+1,disabled:i.disabled,onSelect:A},null,8,["node","selected-node-id","level","disabled"]))),128))])):L("",!0)]),_:1})])}}}),No=pe(To,[["__scopeId","data-v-59e9974c"]]),Bo={class:"flex items-center justify-between mb-6"},Eo={class:"text-content-secondary dark:text-content-muted text-sm mt-1"},Lo={key:0},Fo={class:"text-primary font-mono"},Po={key:1},zo={for:"keyName",class:"block text-sm font-medium text-white mb-2"},Vo={class:"flex items-center gap-2"},Do={key:0,class:"w-4 h-4 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Io={key:1,class:"w-4 h-4 text-accent-green",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Ho={class:"bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4"},Uo={class:"flex items-center gap-3 mb-2"},Ro={class:"flex items-center gap-2"},Ko={key:0,class:"w-5 h-5 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Oo={key:1,class:"w-5 h-5 text-accent-green",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},qo={class:"text-content-secondary dark:text-content-muted text-sm"},Wo={class:"grid grid-cols-2 gap-3"},Go={class:"relative cursor-pointer group"},Qo={class:"relative cursor-pointer group"},Yo={class:"flex gap-3 pt-4"},Xo=["disabled"],Jo=q({__name:"AddKeyModal",props:{show:{type:Boolean},selectedNodeName:{},selectedNodeId:{}},emits:["close","add"],setup(I,{emit:_}){const i=I,x=_,g=m(""),c=m(""),p=m("allow"),s=T(()=>g.value.startsWith("#")),v=T(()=>({type:s.value?"Region":"Private Key",description:s.value?"Regional organizational key":"Individual assigned key"}));te(s,$=>{$?c.value="This will create a new region for organizing keys":c.value="This will create a new private key entry"},{immediate:!0});const f=T(()=>g.value.trim().length>0),h=()=>{f.value&&(x("add",{name:g.value.trim(),floodPolicy:p.value,parentId:i.selectedNodeId}),g.value="",c.value="",p.value="allow")},E=()=>{g.value="",c.value="",p.value="allow",x("close")},A=$=>{$.target===$.currentTarget&&E()};return($,n)=>$.show?(o(),r("div",{key:0,onClick:A,class:"fixed inset-0 bg-black/40 backdrop-blur-lg z-[99999] flex items-center justify-center p-4",style:{"backdrop-filter":"blur(8px) saturate(180%)",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"}},[e("div",{class:"bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[20px] p-6 w-full max-w-md border border-stroke-subtle dark:border-white/10",onClick:n[3]||(n[3]=G(()=>{},["stop"]))},[e("div",Bo,[e("div",null,[n[5]||(n[5]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary"},"Add New Entry",-1)),e("p",Eo,[i.selectedNodeName?(o(),r("span",Lo,[n[4]||(n[4]=H(" Add to: ",-1)),e("span",Fo,u(i.selectedNodeName),1)])):(o(),r("span",Po," Add to root level (#uk) "))])]),e("button",{onClick:E,class:"text-white/60 hover:text-white transition-colors"},n[6]||(n[6]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),e("form",{onSubmit:G(h,["prevent"]),class:"space-y-4"},[e("div",null,[e("label",zo,[e("div",Vo,[s.value?(o(),r("svg",Do,n[7]||(n[7]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"},null,-1)]))):(o(),r("svg",Io,n[8]||(n[8]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"},null,-1)]))),n[9]||(n[9]=H(" Region/Key Name ",-1))])]),S(e("input",{id:"keyName","onUpdate:modelValue":n[0]||(n[0]=t=>g.value=t),type:"text",placeholder:"Enter name (prefix with # for regions)",class:"w-full px-4 py-3 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/50 focus:outline-none focus:border-primary focus:ring-2 focus:ring-primary/20 transition-colors",autocomplete:"off"},null,512),[[V,g.value]])]),e("div",Ho,[e("div",Uo,[e("div",Ro,[s.value?(o(),r("svg",Ko,n[10]||(n[10]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"},null,-1)]))):(o(),r("svg",Oo,n[11]||(n[11]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1221 9z"},null,-1)]))),e("span",{class:D([s.value?"text-secondary":"text-accent-green","font-medium"])},u(v.value.type),3)]),e("div",{class:D(["flex-1 h-px",s.value?"bg-secondary/20":"bg-accent-green/20"])},null,2)]),e("p",qo,u(v.value.description),1)]),e("div",null,[n[14]||(n[14]=e("label",{class:"block text-sm font-medium text-content-primary dark:text-content-primary mb-3"},[e("div",{class:"flex items-center gap-2"},[e("svg",{class:"w-4 h-4 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})]),H(" Flood Policy ")])],-1)),e("div",Wo,[e("label",Go,[S(e("input",{type:"radio","onUpdate:modelValue":n[1]||(n[1]=t=>p.value=t),value:"allow",class:"sr-only"},null,512),[[ne,p.value]]),n[12]||(n[12]=W('',1))]),e("label",Qo,[S(e("input",{type:"radio","onUpdate:modelValue":n[2]||(n[2]=t=>p.value=t),value:"deny",class:"sr-only"},null,512),[[ne,p.value]]),n[13]||(n[13]=W('',1))])])]),e("div",Yo,[e("button",{type:"button",onClick:E,class:"flex-1 px-4 py-3 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary rounded-lg transition-colors"}," Cancel "),e("button",{type:"submit",disabled:!f.value,class:D(["flex-1 px-4 py-3 rounded-lg transition-colors font-medium",f.value?"bg-accent-green/20 hover:bg-accent-green/30 border border-accent-green/50 text-accent-green":"bg-background-mute dark:bg-stroke/5 border border-stroke-subtle dark:border-stroke/20 text-content-muted dark:text-content-muted cursor-not-allowed"])}," Add "+u(v.value.type),11,Xo)])],32)])])):L("",!0)}}),Zo={class:"flex items-center justify-between mb-6"},er={class:"text-content-secondary dark:text-content-muted text-sm mt-1"},tr={class:"text-primary font-mono"},or={for:"keyName",class:"block text-sm font-medium text-content-secondary dark:text-content-primary mb-2"},rr={class:"flex items-center gap-2"},sr={key:0,class:"w-4 h-4 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},nr={key:1,class:"w-4 h-4 text-accent-green",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ar={class:"bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4"},lr={class:"flex items-center gap-3 mb-2"},dr={class:"flex items-center gap-2"},ir={key:0,class:"w-5 h-5 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},cr={key:1,class:"w-5 h-5 text-accent-green",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ur={class:"text-content-secondary dark:text-content-muted text-sm"},mr={key:0,class:"space-y-4"},pr={key:0,class:"bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4"},vr={class:"bg-background-mute dark:bg-black/20 border border-stroke-subtle dark:border-stroke/10 rounded-md p-3"},xr={class:"text-xs font-mono text-content-primary dark:text-content-primary/80 break-all"},br={key:1,class:"bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4"},kr={class:"flex items-center justify-between"},gr={class:"text-sm text-content-secondary dark:text-content-muted"},yr={class:"text-xs text-content-muted dark:text-content-muted"},fr={class:"grid grid-cols-2 gap-3"},hr={class:"relative cursor-pointer group"},wr={class:"relative cursor-pointer group"},_r={class:"flex gap-3 pt-4"},Cr=["disabled"],$r=q({__name:"EditKeyModal",props:{show:{type:Boolean},node:{}},emits:["close","save","request-delete"],setup(I,{emit:_}){const i=I,x=_,g=m(""),c=m("allow"),p=T(()=>g.value.startsWith("#")),s=T(()=>({type:p.value?"Region":"Private Key",description:p.value?"Regional organizational key":"Individual assigned key"}));te(()=>i.node,t=>{t?(g.value=t.name,c.value=t.floodPolicy):(g.value="",c.value="allow")},{immediate:!0});const v=T(()=>g.value.trim().length>0&&i.node),f=t=>{const j=new Date().getTime()-t.getTime(),k=Math.floor(j/(1e3*60)),b=Math.floor(j/(1e3*60*60)),y=Math.floor(j/(1e3*60*60*24)),z=Math.floor(y/365);return k<60?`${k}m ago`:b<24?`${b}h ago`:y<365?`${y}d ago`:`${z}y ago`},h=t=>{window.navigator?.clipboard&&window.navigator.clipboard.writeText(t)},E=()=>{!v.value||!i.node||(x("save",{id:i.node.id,name:g.value.trim(),floodPolicy:c.value}),$())},A=()=>{i.node&&(x("request-delete",i.node),$())},$=()=>{x("close")},n=t=>{t.target===t.currentTarget&&$()};return(t,a)=>t.show?(o(),r("div",{key:0,onClick:n,class:"fixed inset-0 bg-black/50 backdrop-blur-lg z-[99999] flex items-center justify-center p-4",style:{"backdrop-filter":"blur(8px) saturate(180%)",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"}},[e("div",{class:"bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[20px] p-6 w-full max-w-lg border border-stroke-subtle dark:border-white/10",onClick:a[4]||(a[4]=G(()=>{},["stop"]))},[e("div",Zo,[e("div",null,[a[6]||(a[6]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary"},"Edit Entry",-1)),e("p",er,[a[5]||(a[5]=H(" Modify ",-1)),e("span",tr,u(t.node?.name),1)])]),e("button",{onClick:$,class:"text-white/60 hover:text-white transition-colors"},a[7]||(a[7]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),e("form",{onSubmit:G(E,["prevent"]),class:"space-y-4"},[e("div",null,[e("label",or,[e("div",rr,[p.value?(o(),r("svg",sr,a[8]||(a[8]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"},null,-1)]))):(o(),r("svg",nr,a[9]||(a[9]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1721 9z"},null,-1)]))),a[10]||(a[10]=H(" Region/Key Name ",-1))])]),S(e("input",{id:"keyName","onUpdate:modelValue":a[0]||(a[0]=j=>g.value=j),type:"text",placeholder:"Enter name (prefix with # for regions)",class:"w-full px-4 py-3 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/50 focus:outline-none focus:border-primary focus:ring-2 focus:ring-primary/20 transition-colors",autocomplete:"off"},null,512),[[V,g.value]])]),e("div",ar,[e("div",lr,[e("div",dr,[p.value?(o(),r("svg",ir,a[11]||(a[11]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"},null,-1)]))):(o(),r("svg",cr,a[12]||(a[12]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1721 9z"},null,-1)]))),e("span",{class:D([p.value?"text-secondary":"text-accent-green","font-medium"])},u(s.value.type),3)]),e("div",{class:D(["flex-1 h-px",p.value?"bg-secondary/20":"bg-accent-green/20"])},null,2)]),e("p",ur,u(s.value.description),1)]),t.node?(o(),r("div",mr,[t.node.transport_key?(o(),r("div",pr,[a[14]||(a[14]=W('',1)),e("div",vr,[e("div",xr,u(t.node.transport_key),1),e("button",{onClick:a[1]||(a[1]=j=>h(t.node.transport_key||"")),class:"mt-2 text-xs text-accent-green hover:text-accent-green/80 flex items-center gap-1",title:"Copy to clipboard"},a[13]||(a[13]=[e("svg",{class:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})],-1),H(" Copy Key ",-1)]))])])):L("",!0),t.node.last_used?(o(),r("div",br,[a[15]||(a[15]=e("div",{class:"flex items-center gap-2 mb-3"},[e("svg",{class:"w-4 h-4 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})]),e("span",{class:"text-sm font-medium text-content-primary dark:text-content-primary"},"Last Used")],-1)),e("div",kr,[e("div",gr,u(t.node.last_used.toLocaleDateString())+" at "+u(t.node.last_used.toLocaleTimeString()),1),e("div",yr,u(f(t.node.last_used)),1)])])):L("",!0)])):L("",!0),e("div",null,[a[18]||(a[18]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-primary mb-3"},[e("div",{class:"flex items-center gap-2"},[e("svg",{class:"w-4 h-4 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})]),H(" Flood Policy ")])],-1)),e("div",fr,[e("label",hr,[S(e("input",{type:"radio","onUpdate:modelValue":a[2]||(a[2]=j=>c.value=j),value:"allow",class:"sr-only"},null,512),[[ne,c.value]]),a[16]||(a[16]=W('',1))]),e("label",wr,[S(e("input",{type:"radio","onUpdate:modelValue":a[3]||(a[3]=j=>c.value=j),value:"deny",class:"sr-only"},null,512),[[ne,c.value]]),a[17]||(a[17]=W('',1))])])]),e("div",_r,[e("button",{type:"button",onClick:A,class:"px-4 py-3 bg-accent-red/20 hover:bg-accent-red/30 border border-accent-red/50 text-accent-red rounded-lg transition-colors"}," Delete "),e("button",{type:"button",onClick:$,class:"flex-1 px-4 py-3 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary rounded-lg transition-colors"}," Cancel "),e("button",{type:"submit",disabled:!v.value,class:D(["flex-1 px-4 py-3 rounded-lg transition-colors font-medium",v.value?"bg-accent-green/20 hover:bg-accent-green/30 border border-accent-green/50 text-accent-green":"bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 text-content-muted dark:text-content-muted/70 cursor-not-allowed"])}," Save Changes ",10,Cr)])],32)])])):L("",!0)}}),Mr={class:"flex items-center gap-3 mb-6"},Ar={class:"text-content-secondary dark:text-content-muted text-sm mt-1"},Sr={class:"text-accent-red font-mono"},jr={key:0,class:"bg-accent-red/10 border border-accent-red/30 rounded-lg p-4 mb-6"},Tr={class:"flex items-start gap-3"},Nr={class:"flex-1"},Br={class:"text-accent-red font-medium text-sm mb-2"},Er={class:"space-y-1 max-h-32 overflow-y-auto"},Lr={key:0,class:"w-3 h-3 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Fr={key:1,class:"w-3 h-3 text-accent-green",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Pr={class:"font-mono"},zr={key:0,class:"text-content-secondary dark:text-content-muted text-xs"},Vr={key:1,class:"mb-6"},Dr={class:"mb-3"},Ir={class:"relative"},Hr={class:"space-y-2 max-h-40 overflow-y-auto border border-stroke-subtle dark:border-stroke/20 rounded-lg p-3 bg-gray-50 dark:bg-white/5"},Ur={key:0,class:"text-center py-4 text-content-secondary dark:text-content-muted text-sm"},Rr={class:"relative"},Kr=["value"],Or={class:"flex items-center gap-2 flex-1"},qr={class:"text-content-primary dark:text-content-primary font-mono text-sm"},Wr={key:0,class:"ml-auto px-2 py-0.5 bg-background-mute dark:bg-stroke/10 text-content-secondary dark:text-content-muted text-xs rounded-full"},Gr={class:"flex gap-3"},Qr=q({__name:"DeleteConfirmModal",props:{show:{type:Boolean},node:{},allNodes:{}},emits:["close","delete-all","move-children"],setup(I,{emit:_}){const i=I,x=_,g=m(null),c=m(""),p=n=>{const t=[],a=j=>{for(const k of j.children)t.push(k),a(k)};return a(n),t},s=T(()=>i.node?p(i.node):[]),v=T(()=>{if(!i.node)return[];const n=new Set([i.node.id,...s.value.map(a=>a.id)]),t=a=>{const j=[];for(const k of a)k.name.startsWith("#")&&!n.has(k.id)&&j.push(k),k.children.length>0&&j.push(...t(k.children));return j};return t(i.allNodes)}),f=T(()=>{if(!c.value.trim())return v.value;const n=c.value.toLowerCase();return v.value.filter(t=>t.name.toLowerCase().includes(n))}),h=()=>{i.node&&(x("delete-all",i.node.id),A())},E=()=>{!i.node||!g.value||(x("move-children",{nodeId:i.node.id,targetParentId:g.value}),A())},A=()=>{g.value=null,c.value="",x("close")},$=n=>{n.target===n.currentTarget&&A()};return(n,t)=>n.show&&n.node?(o(),r("div",{key:0,onClick:$,class:"fixed inset-0 bg-black/80 backdrop-blur-lg z-[99999] flex items-center justify-center p-4",style:{"backdrop-filter":"blur(8px) saturate(180%)",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"}},[e("div",{class:"bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[20px] p-6 w-full max-w-lg border border-stroke-subtle dark:border-white/10",onClick:t[2]||(t[2]=G(()=>{},["stop"]))},[e("div",Mr,[t[6]||(t[6]=e("svg",{class:"w-6 h-6 text-accent-red",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"})],-1)),e("div",null,[t[4]||(t[4]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary"},"Confirm Deletion",-1)),e("p",Ar,[t[3]||(t[3]=H(" Deleting ",-1)),e("span",Sr,u(n.node?.name),1)])]),e("button",{onClick:A,class:"ml-auto text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors"},t[5]||(t[5]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),s.value.length>0?(o(),r("div",jr,[e("div",Tr,[t[9]||(t[9]=e("svg",{class:"w-5 h-5 text-accent-red flex-shrink-0 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),e("div",Nr,[e("h4",Br," This will affect "+u(s.value.length)+" child "+u(s.value.length===1?"entry":"entries")+": ",1),e("div",Er,[(o(!0),r(U,null,J(s.value.slice(0,10),a=>(o(),r("div",{key:a.id,class:"flex items-center gap-2 text-xs text-content-secondary dark:text-content-primary/80"},[a.name.startsWith("#")?(o(),r("svg",Lr,t[7]||(t[7]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"},null,-1)]))):(o(),r("svg",Fr,t[8]||(t[8]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1721 9z"},null,-1)]))),e("span",Pr,u(a.name),1),e("span",{class:D(["px-1 py-0.5 text-xs rounded",a.floodPolicy==="allow"?"bg-accent-green/20 text-accent-green":"bg-accent-red/20 text-accent-red"])},u(a.floodPolicy),3)]))),128)),s.value.length>10?(o(),r("div",zr," ...and "+u(s.value.length-10)+" more ",1)):L("",!0)])])])])):L("",!0),s.value.length>0&&v.value.length>0?(o(),r("div",Vr,[t[13]||(t[13]=e("h4",{class:"text-content-primary dark:text-content-primary font-medium text-sm mb-3"},"Move children to another region:",-1)),e("div",Dr,[e("div",Ir,[t[10]||(t[10]=e("svg",{class:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-content-muted dark:text-content-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})],-1)),S(e("input",{"onUpdate:modelValue":t[0]||(t[0]=a=>c.value=a),type:"text",placeholder:"Search regions...",class:"w-full pl-9 pr-4 py-2 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/50 focus:outline-none focus:border-primary focus:ring-2 focus:ring-primary/20 transition-colors text-sm"},null,512),[[V,c.value]])])]),e("div",Hr,[f.value.length===0?(o(),r("div",Ur,u(c.value?"No regions match your search":"No available regions"),1)):L("",!0),(o(!0),r(U,null,J(f.value,a=>(o(),r("label",{key:a.id,class:"flex items-center gap-3 p-2 rounded cursor-pointer hover:bg-stroke-subtle dark:hover:bg-white/10 transition-colors group"},[e("div",Rr,[S(e("input",{type:"radio",value:a.id,"onUpdate:modelValue":t[1]||(t[1]=j=>g.value=j),class:"sr-only peer"},null,8,Kr),[[ne,g.value]]),t[11]||(t[11]=e("div",{class:"w-4 h-4 border-2 border-stroke dark:border-stroke/30 rounded-full group-hover:border-stroke dark:group-hover:border-stroke/50 peer-checked:border-primary peer-checked:bg-primary/20 transition-all"},[e("div",{class:"w-2 h-2 rounded-full bg-primary scale-0 peer-checked:scale-100 transition-transform absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2"})],-1))]),e("div",Or,[t[12]||(t[12]=e("svg",{class:"w-4 h-4 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"})],-1)),e("span",qr,u(a.name),1),a.children.length>0?(o(),r("span",Wr,u(a.children.length),1)):L("",!0)])]))),128))])])):L("",!0),e("div",Gr,[e("button",{onClick:A,class:"flex-1 px-4 py-3 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary rounded-lg transition-colors"}," Cancel "),s.value.length>0&&g.value?(o(),r("button",{key:0,onClick:E,class:"flex-1 px-4 py-3 bg-primary/20 hover:bg-primary/30 border border-primary/50 text-primary rounded-lg transition-colors"}," Move & Delete ")):L("",!0),e("button",{onClick:h,class:"flex-1 px-4 py-3 bg-accent-red/20 hover:bg-accent-red/30 border border-accent-red/50 text-accent-red rounded-lg transition-colors font-medium"},u(s.value.length>0?"Delete All":"Delete"),1)])])])):L("",!0)}}),Yr={class:"space-y-4 sm:space-y-6"},Xr={class:"flex flex-col sm:flex-row sm:justify-between sm:items-start gap-3"},Jr={class:"flex gap-2 flex-wrap"},Zr=["disabled"],es=["disabled"],ts=["disabled"],os={class:"glass-card rounded-[15px] p-3 sm:p-4 border border-stroke-subtle dark:border-stroke/10 bg-background-mute dark:bg-white/5"},rs={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3"},ss={class:"flex items-center gap-2 sm:gap-3"},ns={class:"flex bg-background-mute dark:bg-stroke/5 rounded-lg border border-stroke-subtle dark:border-stroke/20 p-0.5 sm:p-1"},as={class:"glass-card rounded-[15px] p-3 sm:p-6 border border-stroke-subtle dark:border-stroke/10"},ls={key:0,class:"flex items-center justify-center py-8"},ds={key:1,class:"text-center py-8"},is={class:"text-content-secondary dark:text-content-muted text-sm"},cs={key:2,class:"text-center py-8"},us={key:3,class:"space-y-2"},ms=q({name:"TransportKeys",__name:"TransportKeys",setup(I){const _=ke(),i=m(!1),x=m(!1),g=m(!1),c=m(null),p=m(null),s=m("deny"),v=m([]),f=m(!1),h=m(null),E=M=>{const d=new Map,w=[];return M.forEach(F=>{const se={id:F.id,name:F.name,floodPolicy:F.flood_policy,transport_key:F.transport_key,last_used:F.last_used?new Date(F.last_used*1e3):void 0,parent_id:F.parent_id,children:[]};d.set(F.id,se)}),d.forEach(F=>{F.parent_id&&d.has(F.parent_id)?d.get(F.parent_id).children.push(F):w.push(F)}),w},A=async()=>{try{f.value=!0,h.value=null;const M=await K.getTransportKeys();M.success&&M.data?v.value=E(M.data):h.value=M.error||"Failed to load transport keys"}catch(M){h.value=M instanceof Error?M.message:"Unknown error occurred",console.error("Error loading transport keys:",M)}finally{f.value=!1}};ae(()=>{A()});function $(M,d){for(const w of M){if(w.id===d)return w;if(w.children){const F=$(w.children,d);if(F)return F}}return null}function n(){const M=_.selectedNodeId.value;return M?$(v.value,M)?.name:void 0}function t(M){s.value==="deny"&&_.setSelectedNode(M)}function a(){s.value==="deny"&&(i.value=!0)}function j(){if(s.value==="deny"&&_.selectedNodeId.value){const M=$(v.value,_.selectedNodeId.value);M&&(p.value=M,g.value=!0)}}function k(){if(s.value==="deny"&&_.selectedNodeId.value){const M=$(v.value,_.selectedNodeId.value);M&&(c.value=M,x.value=!0)}}const b=async M=>{try{const d=await K.createTransportKey(M.name,M.floodPolicy,void 0,M.parentId,void 0);d.success?await A():(console.error("Failed to add transport key:",d.error),h.value=d.error||"Failed to add transport key")}catch(d){console.error("Error adding transport key:",d),h.value=d instanceof Error?d.message:"Unknown error occurred"}finally{i.value=!1}};function y(){i.value=!1}async function z(M){try{const d=M==="allow",w=await K.updateGlobalFloodPolicy(d);w.success?s.value=M:(console.error("Failed to update global flood policy:",w.error),h.value=w.error||"Failed to update global flood policy")}catch(d){console.error("Error updating global flood policy:",d),h.value=d instanceof Error?d.message:"Failed to update global flood policy"}}function O(){x.value=!1,c.value=null}async function C(M){try{const d=await K.updateTransportKey(M.id,M.name,M.floodPolicy);d.success?await A():(console.error("Failed to update transport key:",d.error),h.value=d.error||"Failed to update transport key")}catch(d){console.error("Error updating transport key:",d),h.value=d instanceof Error?d.message:"Unknown error occurred"}finally{O()}}function N(M){x.value=!1,c.value=null,p.value=M,g.value=!0}function P(){g.value=!1,p.value=null}async function oe(M){try{const d=await K.deleteTransportKey(M);d.success?(await A(),_.setSelectedNode(null)):(console.error("Failed to delete transport key:",d.error),h.value=d.error||"Failed to delete transport key")}catch(d){console.error("Error deleting transport key:",d),h.value=d instanceof Error?d.message:"Unknown error occurred"}finally{P()}}async function Y(M){try{const d=await K.deleteTransportKey(M.nodeId);d.success?(await A(),_.setSelectedNode(null)):(console.error("Failed to delete transport key:",d.error),h.value=d.error||"Failed to delete transport key")}catch(d){console.error("Error deleting transport key:",d),h.value=d instanceof Error?d.message:"Unknown error occurred"}finally{P()}}return(M,d)=>(o(),r("div",Yr,[e("div",Xr,[d[3]||(d[3]=e("div",null,[e("h3",{class:"text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2"},"Regions/Keys"),e("p",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Manage regional key hierarchy")],-1)),e("div",Jr,[e("button",{onClick:a,disabled:s.value==="allow",class:D(["flex items-center gap-1.5 sm:gap-2 px-2.5 sm:px-3 py-1.5 sm:py-2 rounded-lg border transition-colors text-xs sm:text-sm",s.value==="allow"?"bg-background-mute dark:bg-white/5 text-content-muted dark:text-content-muted/70 border-stroke-subtle dark:border-stroke/20 cursor-not-allowed":"bg-accent-green/10 hover:bg-accent-green/20 text-accent-green border-accent-green/30"])},d[2]||(d[2]=[e("svg",{class:"w-3.5 h-3.5 sm:w-4 sm:h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})],-1),H(" Add ",-1)]),10,Zr),e("button",{onClick:k,disabled:!X(_).selectedNodeId.value||s.value==="allow",class:D(["px-2.5 sm:px-4 py-1.5 sm:py-2 rounded-lg border transition-colors text-xs sm:text-sm",!X(_).selectedNodeId.value||s.value==="allow"?"bg-background-mute dark:bg-stroke/10 text-content-muted dark:text-content-muted/70 border-stroke-subtle dark:border-stroke/20 cursor-not-allowed":"bg-accent-green/20 hover:bg-accent-green/30 text-accent-green border-accent-green/50"])}," Edit ",10,es),e("button",{onClick:j,disabled:!X(_).selectedNodeId.value||s.value==="allow",class:D(["px-2.5 sm:px-4 py-1.5 sm:py-2 rounded-lg border transition-colors text-xs sm:text-sm",!X(_).selectedNodeId.value||s.value==="allow"?"bg-background-mute dark:bg-stroke/10 text-content-muted dark:text-content-muted/70 border-stroke-subtle dark:border-stroke/20 cursor-not-allowed":"bg-accent-red/20 hover:bg-accent-red/30 text-accent-red border-accent-red/50"])}," Delete ",10,ts)])]),e("div",os,[e("div",rs,[d[4]||(d[4]=e("div",null,[e("h4",{class:"text-xs sm:text-sm font-medium text-content-primary dark:text-content-primary mb-1"},"Global Flood Policy (*)"),e("p",{class:"text-content-secondary dark:text-content-muted text-[10px] sm:text-xs"},"Master control for repeater flooding")],-1)),e("div",ss,[e("div",ns,[e("button",{onClick:d[0]||(d[0]=w=>z("deny")),class:D(["px-2 sm:px-3 py-1 text-[10px] sm:text-xs font-medium rounded transition-colors",s.value==="deny"?"bg-accent-red/20 text-accent-red border border-accent-red/50":"text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-secondary"])}," DENY ",2),e("button",{onClick:d[1]||(d[1]=w=>z("allow")),class:D(["px-2 sm:px-3 py-1 text-[10px] sm:text-xs font-medium rounded transition-colors",s.value==="allow"?"bg-accent-green/20 text-accent-green border border-accent-green/50":"text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-secondary"])}," ALLOW ",2)])])])]),e("div",as,[f.value?(o(),r("div",ls,d[5]||(d[5]=[e("div",{class:"animate-spin rounded-full h-8 w-8 border-b-2 border-accent-green"},null,-1),e("span",{class:"ml-2 text-content-secondary dark:text-content-muted"},"Loading transport keys...",-1)]))):h.value?(o(),r("div",ds,[d[6]||(d[6]=e("div",{class:"text-accent-red mb-2"},"⚠️ Error loading transport keys",-1)),e("div",is,u(h.value),1),e("button",{onClick:A,class:"mt-4 px-4 py-2 bg-accent-green/20 hover:bg-accent-green/30 text-accent-green border border-accent-green/50 rounded-lg transition-colors"}," Retry ")])):v.value.length===0?(o(),r("div",cs,d[7]||(d[7]=[e("div",{class:"text-content-muted dark:text-content-muted mb-2"},"📝 No transport keys found",-1),e("div",{class:"text-content-muted dark:text-content-muted/60 text-sm"},"Add your first transport key to get started",-1)]))):(o(),r("div",us,[(o(!0),r(U,null,J(v.value,w=>(o(),xe(No,{key:w.id,node:w,"selected-node-id":X(_).selectedNodeId.value,level:0,disabled:s.value==="allow",onSelect:t},null,8,["node","selected-node-id","disabled"]))),128))]))]),R(Jo,{show:i.value,"selected-node-name":n(),"selected-node-id":X(_).selectedNodeId.value||void 0,onClose:y,onAdd:b},null,8,["show","selected-node-name","selected-node-id"]),R($r,{show:x.value,node:c.value,onClose:O,onSave:C,onRequestDelete:N},null,8,["show","node"]),R(Qr,{show:g.value,node:p.value,"all-nodes":v.value,onClose:P,onDeleteAll:oe,onMoveChildren:Y},null,8,["show","node","all-nodes"])]))}}),ps={class:"space-y-4 sm:space-y-6"},vs={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3"},xs={key:0,class:"bg-red-500/10 border border-red-500/30 rounded-lg p-4"},bs={class:"flex items-center gap-2 text-red-600 dark:text-red-400"},ks={key:1,class:"flex items-center justify-center py-12"},gs={key:2,class:"space-y-3"},ys={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3"},fs={class:"flex-1"},hs={class:"flex items-center gap-2 sm:gap-3"},ws={class:"min-w-0 flex-1"},_s={class:"text-content-primary dark:text-content-primary font-medium text-sm sm:text-base break-all"},Cs={class:"flex flex-col sm:flex-row sm:items-center sm:gap-4 mt-1 text-xs text-content-secondary dark:text-content-muted"},$s={class:"truncate"},Ms={class:"truncate"},As=["onClick","disabled"],Ss={key:3,class:"text-center py-12"},js={class:"bg-surface dark:bg-surface-elevated border border-stroke-subtle dark:border-stroke/20 rounded-[15px] p-6 max-w-md w-full shadow-2xl"},Ts={class:"space-y-4"},Ns={class:"flex justify-end gap-3 mt-6"},Bs=["disabled"],Es=["disabled"],Ls={class:"bg-surface dark:bg-surface-elevated border border-stroke-subtle dark:border-stroke/20 rounded-[15px] p-6 max-w-lg w-full shadow-2xl"},Fs={class:"space-y-4"},Ps={class:"flex gap-2"},zs=["value"],Vs={class:"bg-blue-500/10 border border-blue-500/30 rounded-lg p-4"},Ds={class:"block bg-blue-500/20 px-3 py-2 rounded text-xs text-blue-100 font-mono overflow-x-auto"},Is=q({name:"APITokens",__name:"APITokens",setup(I){const _=m([]),i=m(!1),x=m(null),g=m(!1),c=m(""),p=m(null),s=m(!1),v=m(!1),f=m(null),h=async()=>{i.value=!0,x.value=null;try{const b=await K.get("/auth/tokens"),y=b.data||b;_.value=y.tokens||[]}catch(b){console.error("Failed to fetch API tokens:",b),x.value=b instanceof Error?b.message:"Failed to fetch tokens"}finally{i.value=!1}},E=async()=>{if(!c.value.trim()){x.value="Token name is required";return}i.value=!0,x.value=null;try{const b=await K.post("/auth/tokens",{name:c.value.trim()}),y=b.data||b;p.value=y.token||null,g.value=!1,s.value=!0,c.value="",await h()}catch(b){console.error("Failed to create API token:",b),x.value=b instanceof Error?b.message:"Failed to create token"}finally{i.value=!1}},A=(b,y)=>{f.value={id:b,name:y},v.value=!0},$=async()=>{if(f.value){i.value=!0,x.value=null;try{await K.delete(`/auth/tokens/${f.value.id}`),await h(),v.value=!1,f.value=null}catch(b){console.error("Failed to revoke API token:",b),x.value=b instanceof Error?b.message:"Failed to revoke token"}finally{i.value=!1}}},n=()=>{g.value=!1,c.value="",x.value=null},t=()=>{s.value=!1,p.value=null},a=()=>{p.value&&navigator.clipboard.writeText(p.value)},j=b=>b?new Date(b*1e3).toLocaleString():"Never",k=T(()=>`${window.location.origin}/api/stats`);return ae(()=>{h()}),(b,y)=>(o(),r(U,null,[e("div",ps,[e("div",vs,[y[5]||(y[5]=e("div",null,[e("h2",{class:"text-lg sm:text-xl font-semibold text-content-primary dark:text-content-primary"},"API Tokens"),e("p",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm mt-1"},"Manage API tokens for machine-to-machine authentication")],-1)),e("button",{onClick:y[0]||(y[0]=z=>g.value=!0),class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors flex items-center justify-center gap-2 text-sm sm:text-base"},y[4]||(y[4]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})],-1),H(" Create Token ",-1)]))]),y[20]||(y[20]=W('API tokens are used for machine-to-machine authentication. Include the token in the X-API-Key header when making API requests.
Tokens are only shown once at creation. Store them securely.
',1)),x.value?(o(),r("div",xs,[e("div",bs,[y[6]||(y[6]=e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),H(" "+u(x.value),1)])])):L("",!0),i.value&&_.value.length===0?(o(),r("div",ks,y[7]||(y[7]=[e("div",{class:"text-center"},[e("div",{class:"animate-spin w-8 h-8 border-2 border-stroke-subtle dark:border-stroke/20 border-t-primary rounded-full mx-auto mb-4"}),e("div",{class:"text-content-secondary dark:text-content-muted"},"Loading tokens...")],-1)]))):_.value.length>0?(o(),r("div",gs,[(o(!0),r(U,null,J(_.value,z=>(o(),r("div",{key:z.id,class:"bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-3 sm:p-4 hover:bg-stroke-subtle dark:hover:bg-white/10 transition-colors"},[e("div",ys,[e("div",fs,[e("div",hs,[y[8]||(y[8]=e("svg",{class:"w-4 h-4 sm:w-5 sm:h-5 text-primary flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"})],-1)),e("div",ws,[e("h3",_s,u(z.name),1),e("div",Cs,[e("span",$s,"Created: "+u(j(z.created_at)),1),e("span",Ms,"Last used: "+u(j(z.last_used)),1)])])])]),e("button",{onClick:O=>A(z.id,z.name),disabled:i.value,class:"w-full sm:w-auto px-3 py-1.5 bg-red-100 dark:bg-red-500/20 hover:bg-red-500/30 text-red-600 dark:text-red-400 rounded-lg border border-red-500/50 transition-colors disabled:opacity-50 text-sm"}," Revoke ",8,As)])]))),128))])):(o(),r("div",Ss,[y[9]||(y[9]=e("svg",{class:"w-16 h-16 text-content-muted dark:text-content-muted/40 mx-auto mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"})],-1)),y[10]||(y[10]=e("h3",{class:"text-content-primary dark:text-content-primary font-medium mb-2"},"No API Tokens",-1)),y[11]||(y[11]=e("p",{class:"text-content-secondary dark:text-content-muted text-sm mb-4"},"Create a token to enable API access",-1)),e("button",{onClick:y[1]||(y[1]=z=>g.value=!0),class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors"}," Create Your First Token ")])),g.value?(o(),r("div",{key:4,class:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:G(n,["self"])},[e("div",js,[y[14]||(y[14]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary mb-4"},"Create API Token",-1)),e("div",Ts,[e("div",null,[y[12]||(y[12]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-muted mb-2"},"Token Name",-1)),S(e("input",{"onUpdate:modelValue":y[2]||(y[2]=z=>c.value=z),type:"text",placeholder:"e.g., Production Server, CI/CD Pipeline",class:"w-full px-4 py-2 bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-400 dark:placeholder-white/40 focus:outline-none focus:border-primary transition-colors",onKeydown:$e(E,["enter"])},null,544),[[V,c.value]]),y[13]||(y[13]=e("p",{class:"text-xs text-content-muted dark:text-content-muted mt-1"},"Give your token a descriptive name to identify its purpose",-1))]),e("div",Ns,[e("button",{onClick:n,disabled:i.value,class:"px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/10 transition-colors disabled:opacity-50"}," Cancel ",8,Bs),e("button",{onClick:E,disabled:i.value||!c.value.trim(),class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors disabled:opacity-50"},u(i.value?"Creating...":"Create Token"),9,Es)])])])])):L("",!0),s.value&&p.value?(o(),r("div",{key:5,class:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:G(t,["self"])},[e("div",Ls,[y[19]||(y[19]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary mb-4"},"Token Created Successfully",-1)),e("div",Fs,[y[18]||(y[18]=W('Save this token now! For security reasons, it will not be shown again.
',1)),e("div",null,[y[16]||(y[16]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-muted mb-2"},"Your API Token",-1)),e("div",Ps,[e("input",{value:p.value,readonly:"",class:"flex-1 px-4 py-2 bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary font-mono text-sm"},null,8,zs),e("button",{onClick:a,class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors flex items-center gap-2",title:"Copy to clipboard"},y[15]||(y[15]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})],-1),H(" Copy ",-1)]))])]),e("div",Vs,[y[17]||(y[17]=e("p",{class:"text-sm text-blue-200 mb-2"},[e("strong",null,"Usage Example:")],-1)),e("code",Ds,' curl -H "X-API-Key: '+u(p.value)+'" '+u(k.value),1)]),e("div",{class:"flex justify-end mt-6"},[e("button",{onClick:t,class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors"}," Done ")])])])])):L("",!0)]),R(Me,{show:v.value,title:"Revoke API Token",message:`Are you sure you want to revoke the token '${f.value?.name}'? This action cannot be undone.`,"confirm-text":"Revoke","cancel-text":"Cancel",variant:"danger",onConfirm:$,onClose:y[3]||(y[3]=z=>v.value=!1)},null,8,["show","message"])],64))}}),Hs={class:"space-y-6"},Us={class:"glass-card rounded-lg border border-stroke-subtle dark:border-stroke/10 p-6"},Rs={class:"space-y-4"},Ks={class:"flex items-center justify-between"},Os=["disabled"],qs={class:"glass-card rounded-lg border border-stroke-subtle dark:border-stroke/10 p-6"},Ws={class:"space-y-4"},Gs={class:"space-y-3"},Qs=["checked","disabled"],Ys=["checked","disabled"],Xs={class:"flex items-start gap-3"},Js={key:0,class:"w-5 h-5 text-green-600 dark:text-green-400 flex-shrink-0 mt-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},Zs={key:1,class:"w-5 h-5 text-accent-cyan flex-shrink-0 mt-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},en={class:"flex-1"},tn={class:"text-sm font-medium text-content-primary dark:text-content-primary"},on={key:0,class:"text-xs text-green-600 dark:text-green-400 mt-1"},rn={key:1,class:"p-4 bg-amber-500/10 border border-amber-500/30 rounded-lg"},sn={class:"flex items-start justify-between gap-3"},nn=["disabled"],an={key:0,class:"animate-spin h-4 w-4",fill:"none",viewBox:"0 0 24 24"},ln={key:1,class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},dn={class:"flex items-center space-x-2"},cn={key:0,class:"w-5 h-5 text-green-600 dark:text-green-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},un={key:1,class:"w-5 h-5 text-red-600 dark:text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},mn=q({name:"WebSettings",__name:"WebSettings",setup(I){const _=m(!1),i=m(""),x=m(!1),g=m(!1),c=m(!1),p=m(!1),s=m(!0),v=ce({cors_enabled:!1,use_default_frontend:!0}),f=T(()=>x.value?"bg-green-500/10 border-green-600/40 dark:border-green-500/30":"bg-red-500/10 border-red-500/30");async function h(){try{s.value=!0;const k=await K.get("/check_pymc_console");k.success&&k.data&&(p.value=k.data.exists,console.log("PyMC Console exists:",p.value))}catch(k){console.error("Failed to check PyMC Console:",k),p.value=!1}finally{s.value=!1}}async function E(){try{const k=await K.get("/stats");console.log("WebSettings: Full response:",k);let b=null;if(k.success&&k.data?b=k.data:k&&"version"in k&&(b=k),b){const y=b.config?.web||{};console.log("WebSettings: webConfig:",y),v.cors_enabled=y.cors_enabled===!0,console.log("WebSettings: Set cors_enabled to:",v.cors_enabled);const z=y.web_path;v.use_default_frontend=!z||z==="",console.log("WebSettings: Set use_default_frontend to:",v.use_default_frontend,"from web_path:",z)}}catch(k){console.error("Failed to load web settings:",k),a("Failed to load settings",!1)}}async function A(){_.value=!0,i.value="";try{const k={web:{cors_enabled:v.cors_enabled}};v.use_default_frontend?k.web.web_path=null:k.web.web_path="/opt/pymc_console/web/html";const b=await K.post("/update_web_config",k);b.success?(a("Settings saved successfully",!0),g.value=!0):a(b.error||"Failed to save settings",!1)}catch(k){console.error("Failed to save web settings:",k),a(k.message||"Failed to save settings",!1)}finally{_.value=!1}}async function $(){v.cors_enabled=!v.cors_enabled,await A()}async function n(){v.use_default_frontend=!0,await A()}async function t(){v.use_default_frontend=!1,await A()}function a(k,b){i.value=k,x.value=b,setTimeout(()=>{i.value=""},5e3)}async function j(){c.value=!0,i.value="";try{const k=await K.post("/restart_service",{});k.success?(a("Service restart initiated. Page will reload...",!0),g.value=!1,setTimeout(()=>{window.location.reload()},2e3)):a(k.error||"Failed to restart service",!1)}catch(k){k.code==="ERR_NETWORK"||k.message?.includes("Network error")?(a("Service restarting... Page will reload",!0),g.value=!1,setTimeout(()=>{window.location.reload()},3e3)):(console.error("Failed to restart service:",k),a(k.message||"Failed to restart service",!1))}finally{c.value=!1}}return ae(()=>{E(),h()}),(k,b)=>(o(),r("div",Hs,[e("div",Us,[b[1]||(b[1]=e("div",{class:"flex items-start justify-between mb-4"},[e("div",null,[e("h3",{class:"text-lg font-semibold text-content-primary dark:text-content-primary mb-1"},"CORS Settings"),e("p",{class:"text-sm text-content-secondary dark:text-content-muted"},"Control cross-origin resource sharing for API access")])],-1)),e("div",Rs,[e("div",Ks,[b[0]||(b[0]=e("div",null,[e("label",{class:"text-sm font-medium text-content-primary dark:text-content-primary"},"Enable CORS"),e("p",{class:"text-xs text-content-secondary dark:text-content-muted mt-1"},"Allow web frontends from different origins to access the API")],-1)),e("button",{onClick:$,disabled:_.value,class:D(["relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2",v.cors_enabled?"bg-cyan-600 dark:bg-teal-500 border-cyan-600 dark:border-teal-500":"bg-gray-400 dark:bg-gray-600 border-gray-400 dark:border-gray-600",_.value?"opacity-50 cursor-not-allowed":"cursor-pointer"])},[e("span",{class:D(["inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",v.cors_enabled?"translate-x-5":"translate-x-0.5"])},null,2)],10,Os)])])]),e("div",qs,[b[11]||(b[11]=e("div",{class:"flex items-start justify-between mb-4"},[e("div",null,[e("h3",{class:"text-lg font-semibold text-content-primary dark:text-content-primary mb-1"},"Web Frontend"),e("p",{class:"text-sm text-content-secondary dark:text-content-muted"},"Choose which web interface to use")])],-1)),e("div",Ws,[e("div",Gs,[e("label",{class:D(["flex items-start space-x-3 p-4 bg-background-mute dark:bg-background/30 rounded-lg border-2 cursor-pointer transition-all",v.use_default_frontend?"border-accent-cyan bg-accent-cyan/10":"border-stroke-subtle dark:border-stroke/10 hover:border-accent-cyan/50"])},[e("input",{type:"radio",name:"frontend",checked:v.use_default_frontend,onChange:n,disabled:_.value,class:"mt-1 h-4 w-4 text-accent-cyan focus:ring-accent-cyan focus:ring-offset-background"},null,40,Qs),b[2]||(b[2]=e("div",{class:"flex-1"},[e("div",{class:"text-sm font-medium text-content-primary dark:text-content-primary"},"Default Frontend"),e("div",{class:"text-xs text-content-secondary dark:text-content-muted mt-1"},"Built-in pyMC Repeater web interface"),e("div",{class:"text-xs text-content-muted dark:text-content-muted/60 mt-1 font-mono"},"Built-in")],-1))],2),e("label",{class:D(["flex items-start space-x-3 p-4 bg-background-mute dark:bg-background/30 rounded-lg border-2 cursor-pointer transition-all",v.use_default_frontend?"border-stroke-subtle dark:border-stroke/10 hover:border-accent-cyan/50":"border-accent-cyan bg-accent-cyan/10"])},[e("input",{type:"radio",name:"frontend",checked:!v.use_default_frontend,onChange:t,disabled:_.value,class:"mt-1 h-4 w-4 text-accent-cyan focus:ring-accent-cyan focus:ring-offset-background"},null,40,Ys),b[3]||(b[3]=W('Alternative web interface for pyMC Repeater
/opt/pymc_console/web/html
',1))],2)]),s.value?L("",!0):(o(),r("div",{key:0,class:D(["p-4 rounded-lg border",p.value?"bg-green-500/5 border-green-500/20":"bg-accent-cyan/5 border-accent-cyan/20"])},[e("div",Xs,[p.value?(o(),r("svg",Js,b[4]||(b[4]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)]))):(o(),r("svg",Zs,b[5]||(b[5]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)]))),e("div",en,[e("h4",tn,u(p.value?"PyMC Console has been detected":"PyMC Console Not Installed"),1),p.value?(o(),r("p",on,b[6]||(b[6]=[H(" PyMC Console is installed at ",-1),e("code",{class:"text-green-700 dark:text-green-300"},"/opt/pymc_console/web/html",-1)]))):(o(),r(U,{key:1},[b[7]||(b[7]=W(' PyMC Console must be installed at /opt/pymc_console/web/html before selecting this option.
PyMC Console Install Instructions ',2))],64))])])],2)),g.value?(o(),r("div",rn,[e("div",sn,[b[10]||(b[10]=W('Service restart required
Web frontend changes will take effect after restarting the pymc-repeater service.
',1)),e("button",{onClick:j,disabled:c.value,class:"px-4 py-2 bg-amber-500 hover:bg-amber-600 disabled:bg-amber-500/50 text-white font-medium rounded-lg transition-colors disabled:cursor-not-allowed flex items-center gap-2 whitespace-nowrap"},[c.value?(o(),r("svg",an,b[8]||(b[8]=[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),e("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},null,-1)]))):(o(),r("svg",ln,b[9]||(b[9]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"},null,-1)]))),H(" "+u(c.value?"Restarting...":"Restart Now"),1)],8,nn)])])):L("",!0)])]),i.value?(o(),r("div",{key:0,class:D(["p-4 rounded-lg border",f.value])},[e("div",dn,[x.value?(o(),r("svg",cn,b[12]||(b[12]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"},null,-1)]))):(o(),r("svg",un,b[13]||(b[13]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"},null,-1)]))),e("span",{class:D(x.value?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400")},u(i.value),3)])],2)):L("",!0)]))}}),pn={class:"space-y-4"},vn={key:0,class:"bg-green-100 dark:bg-green-500/20 border border-green-500 dark:border-green-500/50 rounded-lg p-3 text-green-700 dark:text-green-400 text-sm"},xn={key:1,class:"bg-red-100 dark:bg-red-500/20 border border-red-500 dark:border-red-500/50 rounded-lg p-3 text-red-700 dark:text-red-400 text-sm"},bn={class:"flex justify-between items-center"},kn={class:"flex gap-2"},gn=["disabled"],yn={class:"flex gap-2"},fn=["disabled"],hn=["disabled"],wn={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},_n={key:0,class:"flex items-center justify-center py-4"},Cn={key:1,class:"text-center py-4"},$n={class:"grid grid-cols-2 sm:grid-cols-4 gap-3"},Mn={class:"text-center p-2 bg-white dark:bg-white/5 rounded-lg"},An={class:"text-center p-2 bg-white dark:bg-white/5 rounded-lg"},Sn={class:"text-lg font-mono text-content-primary dark:text-content-primary"},jn={class:"text-center p-2 bg-white dark:bg-white/5 rounded-lg"},Tn={class:"text-lg font-mono text-green-600 dark:text-green-400"},Nn={class:"text-center p-2 bg-white dark:bg-white/5 rounded-lg"},Bn={class:"text-lg font-mono text-red-600 dark:text-red-400"},En={key:0,class:"mt-2 p-2 bg-red-50 dark:bg-red-500/10 rounded-lg border border-red-200 dark:border-red-500/30"},Ln={key:1,class:"mt-2 p-2 bg-orange-50 dark:bg-orange-500/10 rounded-lg border border-orange-200 dark:border-orange-500/30"},Fn={class:"font-medium"},Pn={class:"font-mono text-[10px] opacity-70"},zn={class:"text-[10px]"},Vn={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},Dn={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},In={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Hn={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},Un={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Rn={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},Kn={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},On={key:1,class:"flex items-center gap-2"},qn={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1"},Wn={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Gn={key:1,class:"flex items-center gap-2"},Qn={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},Yn={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},Xn={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Jn={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},Zn={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},ea={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},ta={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},oa={key:1,class:"flex items-center gap-2"},ra={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},sa={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},na={key:1,class:"flex items-center gap-2"},aa={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1"},la={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},da={key:1,class:"flex items-center gap-2"},ia={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},ca={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},ua={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},ma={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},pa={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},va={key:1,class:"flex items-center gap-2"},xa={class:"py-2"},ba={class:"grid grid-cols-3 gap-2 mt-2"},ka={class:"text-center p-2 bg-white dark:bg-white/5 rounded-lg"},ga={key:0,class:"font-mono text-sm text-content-primary dark:text-content-primary"},ya={class:"text-center p-2 bg-white dark:bg-white/5 rounded-lg"},fa={key:0,class:"font-mono text-sm text-content-primary dark:text-content-primary"},ha={class:"text-center p-2 bg-white dark:bg-white/5 rounded-lg"},wa={key:0,class:"font-mono text-sm text-content-primary dark:text-content-primary"},_a={class:"p-6 space-y-4"},Ca={class:"flex justify-between items-start"},$a={class:"flex justify-end pt-4 border-t border-stroke-subtle dark:border-stroke/20"},Ma=q({__name:"AdvertSettings",setup(I){const _=re(),i=T(()=>_.stats?.config?.repeater||{}),x=T(()=>i.value.advert_rate_limit||{}),g=T(()=>i.value.advert_penalty_box||{}),c=T(()=>i.value.advert_adaptive||{}),p=T(()=>c.value.thresholds||{}),s=m(!1),v=m(!1),f=m(""),h=m(""),E=m(!1),A=m(!1),$=m(null),n=m(!0),t=m(2),a=m(1),j=m(10),k=m(60),b=m(!0),y=m(2),z=m(12),O=m(6),C=m(2),N=m(24),P=m(!0),oe=m(.1),Y=m(5),M=m(.05),d=m(.2),w=m(.5),F=async()=>{A.value=!0;try{const Q=await de.get("/api/advert_rate_limit_stats");Q.data?.success&&($.value=Q.data.data)}catch(Q){console.error("Failed to fetch rate limit stats:",Q)}finally{A.value=!1}};te([x,g,c],()=>{console.log("[AdvertSettings] Watch triggered, isEditing:",s.value),s.value?console.log("[AdvertSettings] Watch skipped (editing mode)"):(console.log("[AdvertSettings] Watch loading values from store"),console.log("[AdvertSettings] rateLimitConfig:",x.value),console.log("[AdvertSettings] penaltyConfig:",g.value),console.log("[AdvertSettings] adaptiveConfig:",c.value),n.value=x.value.enabled??!1,t.value=x.value.bucket_capacity??2,a.value=x.value.refill_tokens??1,j.value=Math.round((x.value.refill_interval_seconds??36e3)/3600),k.value=Math.round((x.value.min_interval_seconds??0)/60),b.value=g.value.enabled??!1,y.value=g.value.violation_threshold??2,z.value=Math.round((g.value.violation_decay_seconds??43200)/3600),O.value=Math.round((g.value.base_penalty_seconds??21600)/3600),C.value=g.value.penalty_multiplier??2,N.value=Math.round((g.value.max_penalty_seconds??86400)/3600),P.value=c.value.enabled??!1,oe.value=c.value.ewma_alpha??.1,Y.value=Math.round((c.value.hysteresis_seconds??300)/60),M.value=p.value.quiet_max??.05,d.value=p.value.normal_max??.2,w.value=p.value.busy_max??.5,console.log("[AdvertSettings] Watch loaded values:"),console.log(" rateLimitEnabled:",n.value),console.log(" minIntervalMinutes:",k.value))},{immediate:!0}),ae(()=>{F()});const se=()=>{console.log("[AdvertSettings] reloadFormValues called"),console.log("[AdvertSettings] rateLimitConfig:",x.value),console.log("[AdvertSettings] penaltyConfig:",g.value),console.log("[AdvertSettings] adaptiveConfig:",c.value),n.value=x.value.enabled??!1,t.value=x.value.bucket_capacity??2,a.value=x.value.refill_tokens??1,j.value=Math.round((x.value.refill_interval_seconds??36e3)/3600),k.value=Math.round((x.value.min_interval_seconds??0)/60),b.value=g.value.enabled??!1,y.value=g.value.violation_threshold??2,z.value=Math.round((g.value.violation_decay_seconds??43200)/3600),O.value=Math.round((g.value.base_penalty_seconds??21600)/3600),C.value=g.value.penalty_multiplier??2,N.value=Math.round((g.value.max_penalty_seconds??86400)/3600),P.value=c.value.enabled??!1,oe.value=c.value.ewma_alpha??.1,Y.value=Math.round((c.value.hysteresis_seconds??300)/60),M.value=p.value.quiet_max??.05,d.value=p.value.normal_max??.2,w.value=p.value.busy_max??.5,console.log("[AdvertSettings] Form values after reload:"),console.log(" rateLimitEnabled:",n.value),console.log(" minIntervalMinutes:",k.value),console.log(" penaltyEnabled:",b.value),console.log(" adaptiveEnabled:",P.value)},ge=()=>{s.value=!0,f.value="",h.value=""},ye=()=>{s.value=!1,f.value="",h.value="",se()},fe=async()=>{v.value=!0,h.value="",f.value="";try{const Q={rate_limit_enabled:n.value,bucket_capacity:t.value,refill_tokens:a.value,refill_interval_seconds:j.value*3600,min_interval_seconds:k.value*60,penalty_enabled:b.value,violation_threshold:y.value,violation_decay_seconds:z.value*3600,base_penalty_seconds:O.value*3600,penalty_multiplier:C.value,max_penalty_seconds:N.value*3600,adaptive_enabled:P.value,ewma_alpha:oe.value,hysteresis_seconds:Y.value*60,quiet_max:M.value,normal_max:d.value,busy_max:w.value};console.log("[AdvertSettings] Sending save request with payload:",Q);const B=(await de.post("/api/update_advert_rate_limit_config",Q)).data;console.log("[AdvertSettings] API response:",B),B.success?(f.value=B.data?.message||"Settings saved successfully",console.log("[AdvertSettings] Save successful, fetching updated config..."),await _.fetchStats(),console.log("[AdvertSettings] systemStore.fetchStats() complete"),console.log("[AdvertSettings] rateLimitConfig after fetchStats:",x.value),await F(),console.log("[AdvertSettings] fetchStats() complete"),await ie(),console.log("[AdvertSettings] nextTick() complete, calling reloadFormValues()"),se(),console.log("[AdvertSettings] reloadFormValues() complete, exiting edit mode"),s.value=!1,setTimeout(()=>{f.value=""},3e3)):(h.value=B.error||"Failed to save settings",console.error("[AdvertSettings] Save failed:",B.error))}catch(Q){console.error("Failed to save advert settings:",Q),h.value=Q.response?.data?.error||"Failed to save settings"}finally{v.value=!1}},ue=T(()=>$.value?.adaptive?.current_tier||"unknown"),he=T(()=>{switch(ue.value){case"quiet":return"bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400 border-green-500";case"normal":return"bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400 border-blue-500";case"busy":return"bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400 border-yellow-500";case"congested":return"bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400 border-red-500";default:return"bg-gray-100 dark:bg-gray-500/20 text-gray-700 dark:text-gray-400 border-gray-500"}});return(Q,l)=>(o(),r("div",pn,[f.value?(o(),r("div",vn,u(f.value),1)):L("",!0),h.value?(o(),r("div",xn,u(h.value),1)):L("",!0),e("div",bn,[e("div",kn,[e("button",{onClick:F,disabled:A.value,class:"px-3 py-1.5 text-xs bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-secondary dark:text-content-muted rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors disabled:opacity-50"},u(A.value?"Loading...":"Refresh Stats"),9,gn),e("button",{onClick:l[0]||(l[0]=B=>E.value=!0),class:"px-3 py-1.5 text-xs bg-blue-100 dark:bg-blue-500/20 hover:bg-blue-200 dark:hover:bg-blue-500/30 text-blue-700 dark:text-blue-400 rounded-lg border border-blue-500/50 transition-colors",title:"How rate limiting works"},l[19]||(l[19]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)]))]),e("div",yn,[s.value?(o(),r(U,{key:1},[e("button",{onClick:ye,disabled:v.value,class:"px-3 sm:px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"}," Cancel ",8,fn),e("button",{onClick:fe,disabled:v.value,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"},u(v.value?"Saving...":"Save Changes"),9,hn)],64)):(o(),r("button",{key:0,onClick:ge,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm"}," Edit Settings "))])]),e("div",wn,[l[28]||(l[28]=e("h3",{class:"text-sm font-medium text-content-primary dark:text-content-primary"},"Current Status",-1)),A.value&&!$.value?(o(),r("div",_n,l[20]||(l[20]=[e("div",{class:"animate-spin w-5 h-5 border-2 border-stroke-subtle dark:border-stroke/20 border-t-cyan-500 dark:border-t-primary rounded-full"},null,-1),e("span",{class:"ml-2 text-sm text-content-muted"},"Loading stats...",-1)]))):$.value?(o(),r(U,{key:2},[e("div",$n,[e("div",Mn,[l[22]||(l[22]=e("div",{class:"text-xs text-content-muted dark:text-content-muted"},"Mesh Tier",-1)),e("div",{class:D(["mt-1 px-2 py-0.5 rounded border text-xs font-medium inline-block",he.value])},u(ue.value.toUpperCase()),3)]),e("div",An,[l[23]||(l[23]=e("div",{class:"text-xs text-content-muted dark:text-content-muted"},"Adverts/min",-1)),e("div",Sn,u($.value.metrics?.adverts_per_min_ewma?.toFixed(2)||"0.00"),1)]),e("div",jn,[l[24]||(l[24]=e("div",{class:"text-xs text-content-muted dark:text-content-muted"},"Allowed",-1)),e("div",Tn,u($.value.stats?.adverts_allowed||0),1)]),e("div",Nn,[l[25]||(l[25]=e("div",{class:"text-xs text-content-muted dark:text-content-muted"},"Dropped",-1)),e("div",Bn,u($.value.stats?.adverts_dropped||0),1)])]),Object.keys($.value.active_penalties||{}).length>0?(o(),r("div",En,[l[26]||(l[26]=e("div",{class:"text-xs font-medium text-red-700 dark:text-red-400 mb-1"},"Active Penalties",-1)),(o(!0),r(U,null,J($.value.active_penalties,(B,le)=>(o(),r("div",{key:le,class:"text-xs font-mono text-red-600 dark:text-red-400"},u(le)+"... - "+u(Math.round(B))+"s remaining ",1))),128))])):L("",!0),$.value.recent_drops&&$.value.recent_drops.length>0?(o(),r("div",Ln,[l[27]||(l[27]=e("div",{class:"text-xs font-medium text-orange-700 dark:text-orange-400 mb-1"},"Recently Dropped Adverts",-1)),(o(!0),r(U,null,J($.value.recent_drops,(B,le)=>(o(),r("div",{key:le,class:"text-xs text-orange-600 dark:text-orange-400 py-0.5"},[e("span",Fn,u(B.name),1),e("span",Pn,"("+u(B.pubkey)+"...)",1),e("span",zn," - "+u(B.reason)+" ("+u(B.seconds_ago)+"s ago)",1)]))),128))])):L("",!0)],64)):(o(),r("div",Cn,l[21]||(l[21]=[e("p",{class:"text-xs text-content-muted dark:text-content-muted"},' Stats not available. Click "Refresh Stats" to load. ',-1)])))]),e("div",Vn,[l[36]||(l[36]=e("h3",{class:"text-sm font-medium text-content-primary dark:text-content-primary flex items-center gap-2"},[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})]),H(" Token Bucket Rate Limiting ")],-1)),l[37]||(l[37]=e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Controls how many adverts each pubkey can send in a given time period.",-1)),e("div",Dn,[l[30]||(l[30]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Rate Limiting",-1)),s.value?S((o(),r("select",{key:1,"onUpdate:modelValue":l[1]||(l[1]=B=>n.value=B),class:"w-full sm:w-32 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},l[29]||(l[29]=[e("option",{value:!0},"Enabled",-1),e("option",{value:!1},"Disabled",-1)]),512)),[[ee,n.value]]):(o(),r("div",In,u(n.value?"Enabled":"Disabled"),1))]),e("div",Hn,[l[31]||(l[31]=e("div",null,[e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Bucket Capacity"),e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Max burst size (adverts)")],-1)),s.value?S((o(),r("input",{key:1,"onUpdate:modelValue":l[2]||(l[2]=B=>t.value=B),type:"number",min:"1",max:"10",class:"w-full sm:w-24 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512)),[[V,t.value,void 0,{number:!0}]]):(o(),r("div",Un,u(t.value),1))]),e("div",Rn,[l[33]||(l[33]=e("div",null,[e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Refill Interval"),e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Time between token refills")],-1)),s.value?(o(),r("div",On,[S(e("input",{"onUpdate:modelValue":l[3]||(l[3]=B=>j.value=B),type:"number",min:"1",max:"48",class:"w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512),[[V,j.value,void 0,{number:!0}]]),l[32]||(l[32]=e("span",{class:"text-content-muted text-sm"},"hours",-1))])):(o(),r("div",Kn,u(j.value)+" hours",1))]),e("div",qn,[l[35]||(l[35]=e("div",null,[e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Minimum Interval"),e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Hard minimum between adverts")],-1)),s.value?(o(),r("div",Gn,[S(e("input",{"onUpdate:modelValue":l[4]||(l[4]=B=>k.value=B),type:"number",min:"0",max:"1440",class:"w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512),[[V,k.value,void 0,{number:!0}]]),l[34]||(l[34]=e("span",{class:"text-content-muted text-sm"},"min",-1))])):(o(),r("div",Wn,u(k.value)+" min",1))])]),e("div",Qn,[l[47]||(l[47]=e("h3",{class:"text-sm font-medium text-content-primary dark:text-content-primary flex items-center gap-2"},[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"})]),H(" Penalty Box (Repeat Offenders) ")],-1)),l[48]||(l[48]=e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Applies escalating cooldowns to pubkeys that repeatedly violate limits.",-1)),e("div",Yn,[l[39]||(l[39]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Penalty Box",-1)),s.value?S((o(),r("select",{key:1,"onUpdate:modelValue":l[5]||(l[5]=B=>b.value=B),class:"w-full sm:w-32 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},l[38]||(l[38]=[e("option",{value:!0},"Enabled",-1),e("option",{value:!1},"Disabled",-1)]),512)),[[ee,b.value]]):(o(),r("div",Xn,u(b.value?"Enabled":"Disabled"),1))]),e("div",Jn,[l[40]||(l[40]=e("div",null,[e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Violation Threshold"),e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Violations before penalty")],-1)),s.value?S((o(),r("input",{key:1,"onUpdate:modelValue":l[6]||(l[6]=B=>y.value=B),type:"number",min:"1",max:"10",class:"w-full sm:w-24 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512)),[[V,y.value,void 0,{number:!0}]]):(o(),r("div",Zn,u(y.value),1))]),e("div",ea,[l[42]||(l[42]=e("div",null,[e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Base Penalty Duration"),e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"First penalty duration")],-1)),s.value?(o(),r("div",oa,[S(e("input",{"onUpdate:modelValue":l[7]||(l[7]=B=>O.value=B),type:"number",min:"1",max:"48",class:"w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512),[[V,O.value,void 0,{number:!0}]]),l[41]||(l[41]=e("span",{class:"text-content-muted text-sm"},"hours",-1))])):(o(),r("div",ta,u(O.value)+" hours",1))]),e("div",ra,[l[44]||(l[44]=e("div",null,[e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Penalty Multiplier"),e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Escalation factor")],-1)),s.value?(o(),r("div",na,[S(e("input",{"onUpdate:modelValue":l[8]||(l[8]=B=>C.value=B),type:"number",min:"1",max:"5",step:"0.5",class:"w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512),[[V,C.value,void 0,{number:!0}]]),l[43]||(l[43]=e("span",{class:"text-content-muted text-sm"},"x",-1))])):(o(),r("div",sa,u(C.value)+"x",1))]),e("div",aa,[l[46]||(l[46]=e("div",null,[e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Max Penalty Duration"),e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Maximum cooldown cap")],-1)),s.value?(o(),r("div",da,[S(e("input",{"onUpdate:modelValue":l[9]||(l[9]=B=>N.value=B),type:"number",min:"1",max:"168",class:"w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512),[[V,N.value,void 0,{number:!0}]]),l[45]||(l[45]=e("span",{class:"text-content-muted text-sm"},"hours",-1))])):(o(),r("div",la,u(N.value)+" hours",1))])]),e("div",ia,[l[58]||(l[58]=W(' Adaptive Rate Limiting
How the three systems work together: Each layer can be enabled/disabled independently and the others will still function.
- Rate Limiting OFF: All limiting disabled — adverts pass through freely
- Adaptive OFF: Token bucket uses fixed limits (no tier scaling), penalty box still works
- Penalty Box OFF: Token bucket still applies, but no escalating cooldowns for repeat offenders
Decision flow when all enabled: Adaptive tier check → Penalty box check → Token bucket check → Violation recording (triggers penalty box)
Activity tiers:Quiet (bypass limiting) → Normal (lighter: 0.5x intervals) → Busy (base: 1.0x intervals) → Congested (stricter: 2.0x intervals)
Note: Adaptive mode scales refill/min-interval timing; bucket capacity stays at the configured base value.
',2)),e("div",ca,[l[50]||(l[50]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Adaptive Mode",-1)),s.value?S((o(),r("select",{key:1,"onUpdate:modelValue":l[10]||(l[10]=B=>P.value=B),class:"w-full sm:w-32 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},l[49]||(l[49]=[e("option",{value:!0},"Enabled",-1),e("option",{value:!1},"Disabled",-1)]),512)),[[ee,P.value]]):(o(),r("div",ua,u(P.value?"Enabled":"Disabled"),1))]),e("div",ma,[l[52]||(l[52]=e("div",null,[e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Tier Change Delay"),e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Prevents tier flapping")],-1)),s.value?(o(),r("div",va,[S(e("input",{"onUpdate:modelValue":l[11]||(l[11]=B=>Y.value=B),type:"number",min:"0",max:"60",class:"w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512),[[V,Y.value,void 0,{number:!0}]]),l[51]||(l[51]=e("span",{class:"text-content-muted text-sm"},"min",-1))])):(o(),r("div",pa,u(Y.value)+" min",1))]),e("div",xa,[l[56]||(l[56]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm mb-2 block"},"Activity Tier Thresholds (adverts/min)",-1)),e("div",ba,[e("div",ka,[l[53]||(l[53]=e("div",{class:"text-xs text-green-600 dark:text-green-400 mb-1"},"Quiet Max",-1)),s.value?S((o(),r("input",{key:1,"onUpdate:modelValue":l[12]||(l[12]=B=>M.value=B),type:"number",min:"0",max:"1",step:"0.01",class:"w-full px-2 py-1 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded text-content-primary dark:text-content-primary text-sm text-center focus:outline-none focus:border-primary"},null,512)),[[V,M.value,void 0,{number:!0}]]):(o(),r("div",ga,u(M.value),1))]),e("div",ya,[l[54]||(l[54]=e("div",{class:"text-xs text-blue-600 dark:text-blue-400 mb-1"},"Normal Max",-1)),s.value?S((o(),r("input",{key:1,"onUpdate:modelValue":l[13]||(l[13]=B=>d.value=B),type:"number",min:"0",max:"5",step:"0.01",class:"w-full px-2 py-1 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded text-content-primary dark:text-content-primary text-sm text-center focus:outline-none focus:border-primary"},null,512)),[[V,d.value,void 0,{number:!0}]]):(o(),r("div",fa,u(d.value),1))]),e("div",ha,[l[55]||(l[55]=e("div",{class:"text-xs text-yellow-600 dark:text-yellow-400 mb-1"},"Busy Max",-1)),s.value?S((o(),r("input",{key:1,"onUpdate:modelValue":l[14]||(l[14]=B=>w.value=B),type:"number",min:"0",max:"10",step:"0.01",class:"w-full px-2 py-1 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded text-content-primary dark:text-content-primary text-sm text-center focus:outline-none focus:border-primary"},null,512)),[[V,w.value,void 0,{number:!0}]]):(o(),r("div",wa,u(w.value),1))])]),l[57]||(l[57]=e("p",{class:"text-xs text-content-muted dark:text-content-muted mt-2"},"Above Busy Max = Congested tier (strictest limiting)",-1))])]),E.value?(o(),r("div",{key:2,class:"fixed inset-0 bg-black/50 flex items-start justify-center z-50 p-4 overflow-y-auto",onClick:l[18]||(l[18]=G(B=>E.value=!1,["self"]))},[e("div",{class:"bg-background dark:bg-background-dark rounded-lg shadow-xl max-w-3xl w-full my-8",onClick:l[17]||(l[17]=G(()=>{},["stop"]))},[e("div",_a,[e("div",Ca,[l[60]||(l[60]=e("h2",{class:"text-xl font-semibold text-content-primary dark:text-content-primary"},"How Advert Rate Limiting Works",-1)),e("button",{onClick:l[15]||(l[15]=B=>E.value=!1),class:"text-content-muted hover:text-content-primary dark:text-content-muted dark:hover:text-content-primary"},l[59]||(l[59]=[e("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),l[61]||(l[61]=W('Why you may see the same advert more than once
Mesh traffic can reach your repeater through different paths, so duplicate advert packets are expected.
- First copy arrives and is forwarded
- Second copy arrives through another repeater path
- Later copies may be dropped once limits are hit
This is normal behavior and helps prevent repeated rebroadcasts from flooding the mesh.
Token Bucket Rate Limiting
Each sender has a token bucket. Every forwarded advert uses one token.
- Bucket Capacity: How many adverts can pass in a burst.
- Refill Rate: How quickly tokens come back over time.
- Min Interval: Optional gap between adverts from the same sender (usually set to 0).
Example (capacity 2):
- Copy 1 forwarded (2 → 1 tokens)
- Copy 2 forwarded (1 → 0 tokens)
- Copy 3 dropped (no tokens left)
Penalty Box (Repeat Offenders)
If a sender keeps hitting the limit, it is temporarily blocked.
- Violation Threshold: How many hits before penalty starts.
- Base Penalty: First block duration.
- Multiplier: Repeated penalties get longer.
- Decay Time: Violations age out after stable behavior.
Adaptive Mesh Activity Tiers
Adaptive mode adjusts limits based on recent advert activity.
How Congestion is Measured:- What is counted: Advert packets only (not chat/data traffic)
- Smoothing: 60-second EWMA to avoid reacting to short spikes
- Score: Tier is based on adverts per minute
- Hysteresis: Tier changes must hold for 5 minutes
QUIET
Activity < 0.05/min
No rate limiting
NORMAL
Activity 0.05-0.20/min
Light limiting (50%)
BUSY
Activity 0.20-0.50/min
Standard limiting (100%)
CONGESTED
Activity > 0.50/min
Aggressive (200%)
Quick examples:
- 0.02 adverts/min → QUIET (bypass)
- 0.35 adverts/min → BUSY (tighter limits)
- 0.68 adverts/min → CONGESTED (strict limits)
Recommended starting settings
- Min Interval: 0 (disabled), let adaptive mode do the work
- Bucket Capacity: 2-3 tokens for normal mesh propagation
- Adaptive Mode: On
- Penalty Box: On
',5)),e("div",$a,[e("button",{onClick:l[16]||(l[16]=B=>E.value=!1),class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors"}," Got it! ")])])])])):L("",!0)]))}}),Aa={class:"p-3 sm:p-6 space-y-4 sm:space-y-6"},Sa={class:"glass-card rounded-[15px] z-10 p-3 sm:p-4 border border-cyan-400 dark:border-primary/30 bg-cyan-500/10 dark:bg-primary/10"},ja={class:"text-cyan-700 dark:text-primary text-sm sm:text-base"},Ta={class:"mt-1 sm:mt-2 text-cyan-600 dark:text-primary/80"},Na={class:"glass-card rounded-[15px] p-3 sm:p-6"},Ba={class:"flex overflow-x-auto border-b border-stroke-subtle dark:border-stroke/10 mb-4 sm:mb-6 -mx-3 px-3 sm:mx-0 sm:px-0 scrollbar-hide"},Ea=["onClick"],La={class:"flex items-center gap-1 sm:gap-2"},Fa={key:0,class:"w-3.5 h-3.5 sm:w-4 sm:h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Pa={key:1,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},za={key:2,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Va={key:3,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Da={key:4,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Ia={key:5,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Ha={key:6,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Ua={key:7,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Ra={class:"min-h-[400px]"},Ka={key:0,class:"flex items-center justify-center py-12"},Oa={key:1,class:"flex items-center justify-center py-12"},qa={class:"text-center"},Wa={class:"text-content-secondary dark:text-content-muted text-sm mb-4"},Ga={key:2},Za=q({name:"ConfigurationView",__name:"Configuration",setup(I){const _=re(),i=m(Ae("configuration_activeTab","radio")),x=m(!1);te(i,p=>Se("configuration_activeTab",p));const g=[{id:"radio",label:"Radio Settings",icon:"radio"},{id:"repeater",label:"Repeater Settings",icon:"repeater"},{id:"advert",label:"Advert Limits",icon:"advert"},{id:"duty",label:"Duty Cycle",icon:"duty"},{id:"delays",label:"TX Delays",icon:"delays"},{id:"transport",label:"Regions/Keys",icon:"keys"},{id:"api-tokens",label:"API Tokens",icon:"tokens"},{id:"web",label:"Web Options",icon:"web"}];ae(async()=>{try{await _.fetchStats(),x.value=!0}catch(p){console.error("Failed to load configuration data:",p),x.value=!0}});function c(p){i.value=p}return(p,s)=>{const v=be("router-link");return o(),r("div",Aa,[s[14]||(s[14]=e("div",null,[e("h1",{class:"text-xl sm:text-2xl font-bold text-content-primary dark:text-content-primary"},"Configuration"),e("p",{class:"text-content-secondary dark:text-content-muted mt-1 sm:mt-2 text-sm sm:text-base"},"System configuration and settings")],-1)),e("div",Sa,[e("div",ja,[s[3]||(s[3]=e("strong",null,"CAD Calibration Tool Available",-1)),e("p",Ta,[s[2]||(s[2]=H(" Optimize your Channel Activity Detection settings. ",-1)),R(v,{to:"/cad-calibration",class:"underline hover:text-cyan-800 dark:hover:text-primary transition-colors"},{default:ve(()=>s[1]||(s[1]=[H(" Launch CAD Calibration Tool → ",-1)])),_:1,__:[1]})])])]),e("div",Na,[e("div",Ba,[(o(),r(U,null,J(g,f=>e("button",{key:f.id,onClick:h=>c(f.id),class:D(["px-3 sm:px-4 py-2 text-xs sm:text-sm font-medium transition-colors duration-200 border-b-2 mr-3 sm:mr-6 whitespace-nowrap flex-shrink-0",i.value===f.id?"text-cyan-500 dark:text-primary border-cyan-500 dark:border-primary":"text-content-secondary dark:text-content-muted border-transparent hover:text-content-primary dark:hover:text-content-primary hover:border-stroke-subtle dark:hover:border-stroke/30"])},[e("div",La,[f.icon==="radio"?(o(),r("svg",Fa,s[4]||(s[4]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8.111 16.404a5.5 5.5 0 017.778 0M12 20h.01m-7.08-7.071c3.904-3.905 10.236-3.905 14.141 0M1.394 9.822c5.716-5.716 14.976-5.716 20.692 0"},null,-1)]))):f.icon==="repeater"?(o(),r("svg",Pa,s[5]||(s[5]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14M5 12l4-4m-4 4l4 4"},null,-1)]))):f.icon==="advert"?(o(),r("svg",za,s[6]||(s[6]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},null,-1)]))):f.icon==="duty"?(o(),r("svg",Va,s[7]||(s[7]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)]))):f.icon==="delays"?(o(),r("svg",Da,s[8]||(s[8]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"},null,-1)]))):f.icon==="keys"?(o(),r("svg",Ia,s[9]||(s[9]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"},null,-1)]))):f.icon==="tokens"?(o(),r("svg",Ha,s[10]||(s[10]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"},null,-1)]))):f.icon==="web"?(o(),r("svg",Ua,s[11]||(s[11]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"},null,-1)]))):L("",!0),H(" "+u(f.label),1)])],10,Ea)),64))]),e("div",Ra,[!x.value&&X(_).isLoading?(o(),r("div",Ka,s[12]||(s[12]=[e("div",{class:"text-center"},[e("div",{class:"animate-spin w-8 h-8 border-2 border-stroke-subtle dark:border-stroke/20 border-t-cyan-500 dark:border-t-primary rounded-full mx-auto mb-4"}),e("div",{class:"text-content-secondary dark:text-content-muted"},"Loading configuration...")],-1)]))):X(_).error&&!x.value?(o(),r("div",Oa,[e("div",qa,[s[13]||(s[13]=e("div",{class:"text-red-500 dark:text-red-400 mb-2"},"Failed to load configuration",-1)),e("div",Wa,u(X(_).error),1),e("button",{onClick:s[0]||(s[0]=f=>X(_).fetchStats()),class:"px-4 py-2 bg-cyan-500/20 dark:bg-primary/20 hover:bg-cyan-500/30 dark:hover:bg-primary/30 text-cyan-900 dark:text-white rounded-lg border border-cyan-500/50 dark:border-primary/50 transition-colors"}," Retry ")])])):(o(),r("div",Ga,[S(e("div",null,[R(st,{key:"radio-settings"})],512),[[Z,i.value==="radio"]]),S(e("div",null,[R(Dt,{key:"repeater-settings"})],512),[[Z,i.value==="repeater"]]),S(e("div",null,[R(Ma,{key:"advert-settings"})],512),[[Z,i.value==="advert"]]),S(e("div",null,[R(Xt,{key:"duty-cycle"})],512),[[Z,i.value==="duty"]]),S(e("div",null,[R(mo,{key:"transmission-delays"})],512),[[Z,i.value==="delays"]]),S(e("div",null,[R(ms,{key:"transport-keys"})],512),[[Z,i.value==="transport"]]),S(e("div",null,[R(Is,{key:"api-tokens"})],512),[[Z,i.value==="api-tokens"]]),S(e("div",null,[R(mn,{key:"web-settings"})],512),[[Z,i.value==="web"]])]))])])])}}});export{Za as default};
diff --git a/repeater/web/html/assets/ConfirmDialog.vue_vue_type_script_setup_true_lang-CidOa_xU.js b/repeater/web/html/assets/ConfirmDialog.vue_vue_type_script_setup_true_lang-CidOa_xU.js
new file mode 100644
index 0000000..d688c42
--- /dev/null
+++ b/repeater/web/html/assets/ConfirmDialog.vue_vue_type_script_setup_true_lang-CidOa_xU.js
@@ -0,0 +1 @@
+import{a as p,b as n,g as m,e as t,s as g,t as s,j as d,p as l}from"./index-D0IT5vDS.js";const f={class:"flex items-center justify-between mb-4"},w={class:"text-xl font-semibold text-content-primary dark:text-content-primary"},v={class:"mb-6"},h={key:0,class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},y={key:1,class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},C={key:2,class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},B={class:"text-content-secondary dark:text-content-primary/80 text-base leading-relaxed"},j={class:"flex gap-3"},_=p({__name:"ConfirmDialog",props:{show:{type:Boolean},title:{default:"Confirm Action"},message:{},confirmText:{default:"Confirm"},cancelText:{default:"Cancel"},variant:{default:"warning"}},emits:["close","confirm"],setup(c,{emit:b}){const o=c,r=b,u=i=>{i.target===i.currentTarget&&r("close")},k={danger:"bg-red-100 dark:bg-red-500/20 border-red-500/30 text-red-600 dark:text-red-400",warning:"bg-yellow-100 dark:bg-yellow-500/20 border-yellow-500/30 text-yellow-600 dark:text-yellow-400",info:"bg-blue-500/20 border-blue-500/30 text-blue-600 dark:text-blue-400"},x={danger:"bg-red-500 hover:bg-red-600",warning:"bg-yellow-500 hover:bg-yellow-600",info:"bg-blue-500 hover:bg-blue-600"};return(i,e)=>o.show?(l(),n("div",{key:0,onClick:u,class:"fixed inset-0 bg-black/40 backdrop-blur-lg z-[99999] flex items-center justify-center p-4",style:{"backdrop-filter":"blur(8px) saturate(180%)",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"}},[t("div",{class:"bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[20px] p-6 w-full max-w-md border border-stroke-subtle dark:border-white/10",onClick:e[3]||(e[3]=g(()=>{},["stop"]))},[t("div",f,[t("h3",w,s(o.title),1),t("button",{onClick:e[0]||(e[0]=a=>r("close")),class:"text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors"},e[4]||(e[4]=[t("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),t("div",v,[t("div",{class:d(["inline-flex p-3 rounded-xl mb-4",k[o.variant]])},[o.variant==="danger"?(l(),n("svg",h,e[5]||(e[5]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"},null,-1)]))):o.variant==="warning"?(l(),n("svg",y,e[6]||(e[6]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"},null,-1)]))):(l(),n("svg",C,e[7]||(e[7]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)])))],2),t("p",B,s(o.message),1)]),t("div",j,[t("button",{onClick:e[1]||(e[1]=a=>r("close")),class:"flex-1 px-4 py-3 rounded-xl bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary transition-all duration-200 border border-stroke-subtle dark:border-stroke/10"},s(o.cancelText),1),t("button",{onClick:e[2]||(e[2]=a=>r("confirm")),class:d(["flex-1 px-4 py-3 rounded-xl text-white transition-all duration-200",x[o.variant]])},s(o.confirmText),3)])])])):m("",!0)}});export{_};
diff --git a/repeater/web/html/assets/Dashboard-DQfmgsLU.js b/repeater/web/html/assets/Dashboard-DQfmgsLU.js
new file mode 100644
index 0000000..45baf95
--- /dev/null
+++ b/repeater/web/html/assets/Dashboard-DQfmgsLU.js
@@ -0,0 +1,2 @@
+import{C as wt,a as Nt,L as Bt,P as Ft,b as Et,c as jt,i as It}from"./chart-B185MtDy.js";import{a as ct,r as B,c as Y,D as et,o as bt,E as dt,H as vt,b as l,e as t,t as n,g as k,n as ut,I as Lt,p as r,x as mt,J as gt,K as kt,f as st,F as H,h as Q,L as ft,M as Ut,i as Rt,u as pt,k as rt,N as Vt,T as Ht,l as zt,O as Xt,j as T,s as Gt,w as $t,q as Tt}from"./index-D0IT5vDS.js";import{u as Ot}from"./useSignalQuality-DvX3fQnP.js";import{g as Ct,s as St}from"./preferences-DtwbSSgO.js";const Wt={class:"sparkline-card"},Qt={class:"card-header"},qt={class:"card-title"},Kt={class:"card-values"},Jt={class:"card-chart"},Yt=ct({name:"ChartSparkline",__name:"ChartSparkline",props:{title:{},value:{},color:{},data:{default:()=>[]},showChart:{type:Boolean,default:!0},secondaryValue:{default:void 0},secondaryLabel:{default:""},secondaryColor:{default:""},secondaryData:{default:()=>[]}},setup(nt){wt.register(Nt,Bt,Ft,Et,jt,It);const _=nt,q=B(null),m=B(null),C=h=>{if(h.length<3)return h;const F=Math.min(15,Math.max(3,Math.floor(h.length*.2))),O=[];for(let S=0;SN+w,0)/g.length)}const G=Math.min(12,O.length),E=O.length/G,M=[];for(let S=0;S!_.data||_.data.length===0?[]:C(_.data)),A=Y(()=>!_.secondaryData||_.secondaryData.length===0?[]:C(_.secondaryData)),X=()=>{if(!q.value)return;const h=q.value.getContext("2d");if(!h)return;m.value&&(m.value.destroy(),m.value=null);const F=$.value;if(F.length<2)return;const O=[{data:F,borderColor:_.color,borderWidth:2.5,fill:!1,tension:.4,pointRadius:0,pointHoverRadius:0}],G=A.value;G.length>=2&&_.secondaryColor&&O.push({data:G,borderColor:_.secondaryColor,borderWidth:2,borderDash:[4,3],fill:!1,tension:.4,pointRadius:0,pointHoverRadius:0}),m.value=Lt(new wt(h,{type:"line",data:{labels:F.map((E,M)=>M.toString()),datasets:O},options:{responsive:!0,maintainAspectRatio:!1,animation:{duration:800,easing:"easeOutQuart"},plugins:{legend:{display:!1},tooltip:{enabled:!1}},scales:{x:{display:!1,grid:{display:!1}},y:{display:!1,grid:{display:!1},grace:"10%"}},elements:{line:{capBezierPoints:!0}}}}))},D=()=>{if(!m.value){X();return}const h=$.value;if(h.length<2)return;m.value.data.labels=h.map((O,G)=>G.toString()),m.value.data.datasets[0].data=h;const F=A.value;F.length>=2&&_.secondaryColor&&(m.value.data.datasets.length<2?m.value.data.datasets.push({data:F,borderColor:_.secondaryColor,borderWidth:2,borderDash:[4,3],fill:!1,tension:.4,pointRadius:0,pointHoverRadius:0}):m.value.data.datasets[1].data=F),m.value.update("default")};return et(()=>_.data,()=>{dt(()=>D())},{deep:!0}),et(()=>_.color,()=>{m.value&&(m.value.data.datasets[0].borderColor=_.color,m.value.update("none"))}),bt(()=>{dt(()=>X())}),vt(()=>{m.value&&(m.value.destroy(),m.value=null)}),(h,F)=>(r(),l("div",Wt,[t("div",Qt,[t("p",qt,n(h.title),1),t("div",Kt,[t("span",{class:"card-value",style:ut({color:h.color})},n(typeof h.value=="number"?h.value.toLocaleString():h.value),5),h.secondaryValue!==void 0?(r(),l("span",{key:0,class:"card-secondary-value",style:ut({color:h.secondaryColor})},n(h.secondaryLabel)+n(typeof h.secondaryValue=="number"?h.secondaryValue.toLocaleString():h.secondaryValue),5)):k("",!0)])]),t("div",Jt,[h.showChart?(r(),l("canvas",{key:0,ref_key:"canvasRef",ref:q},null,512)):k("",!0)])]))}}),xt=mt(Yt,[["__scopeId","data-v-814635af"]]),Zt={class:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-3 lg:gap-4 mb-5 stats-cards-container"},te=ct({name:"StatsCards",__name:"StatsCards",setup(nt){const _=gt(),q=kt(),m=B(null),C=B(null),$=B(!1),A=Y(()=>{const h=_.packetStats,F=_.systemStats,O=S=>{const x=Math.floor(S/86400),d=Math.floor(S%86400/3600),v=Math.floor(S%3600/60);return x>0?`${x}d ${d}h`:d>0?`${d}h ${v}m`:`${v}m`},G=h?.total_packets||0,E=h?.dropped_packets||0,M=G>0?Math.round(E/G*100):0;return{packetsReceived:G,packetsForwarded:h?.transmitted_packets||0,uptimeFormatted:F?O(F.uptime_seconds||0):"0m",uptimeHours:F?Math.floor((F.uptime_seconds||0)/3600):0,droppedPackets:E,dropPercent:`${M}%`,signalQuality:Math.round((h?.avg_rssi||0)+120),crcErrorCount:_.crcErrorCount}}),X=Y(()=>_.sparklineData),D=async()=>{if(!$.value)try{$.value=!0,await Promise.all([_.fetchSystemStats(),_.fetchPacketStats({hours:24})]),await dt()}catch(h){console.error("Error fetching stats:",h)}finally{$.value=!1}};return bt(async()=>{await _.initializeSparklineHistory(),D(),q.isConnected||(m.value=window.setInterval(D,3e4)),C.value=window.setInterval(()=>{_.interpolateRates()},6e4)}),et(()=>q.isConnected,h=>{h?m.value&&(clearInterval(m.value),m.value=null):m.value||(m.value=window.setInterval(D,3e4))}),vt(()=>{m.value&&clearInterval(m.value),C.value&&clearInterval(C.value)}),(h,F)=>(r(),l("div",Zt,[st(xt,{title:"Up Time",value:A.value.uptimeFormatted,color:"#EBA0FC",data:[],showChart:!1,class:"stat-card"},null,8,["value"]),st(xt,{title:"RX Packets",value:A.value.packetsReceived,color:"#AAE8E8",data:X.value.totalPackets,class:"stat-card"},null,8,["value","data"]),st(xt,{title:"Forward",value:A.value.packetsForwarded,color:"#FFC246",data:X.value.transmittedPackets,class:"stat-card"},null,8,["value","data"]),st(xt,{title:"Dropped",value:A.value.droppedPackets,color:"#FB787B",data:X.value.droppedPackets,class:"stat-card"},null,8,["value","data"]),st(xt,{title:"CRC Errors",value:A.value.crcErrorCount,color:"#F59E0B",data:X.value.crcErrors,class:"stat-card"},null,8,["value","data"])]))}}),ee=mt(te,[["__scopeId","data-v-84cee3fb"]]),se={class:"glass-card rounded-[10px] p-4 lg:p-6"},ae={class:"h-48 lg:h-56 relative"},ne={key:0,class:"absolute inset-0 flex items-center justify-center"},oe={key:1,class:"absolute inset-0 flex items-center justify-center"},re={class:"text-red-600 dark:text-red-400 text-sm lg:text-base"},le={key:2,class:"absolute inset-0 flex items-center justify-center"},ie={key:3,class:"h-full flex flex-col"},de={key:0,class:"absolute top-2 left-1/2 -translate-x-1/2 bg-white/95 dark:bg-surface-elevated border border-stroke-subtle dark:border-stroke rounded-lg px-3 py-2 z-10 pointer-events-none min-w-48"},ce={class:"text-content-primary dark:text-content-primary text-sm font-medium mb-1"},ue={class:"text-content-primary dark:text-content-primary"},pe={class:"flex-1 flex items-end justify-evenly gap-4 px-4"},me=["onMouseenter"],xe={class:"text-content-primary dark:text-content-primary text-xs sm:text-sm font-semibold text-center w-full",style:{"padding-bottom":"5px"}},ye={class:"text-content-secondary dark:text-content-muted text-xs mt-2 text-center"},be={key:0,class:"mt-4 flex flex-wrap justify-center gap-3 sm:gap-4 px-2 sm:px-4 text-[10px] sm:text-xs text-content-secondary dark:text-content-muted"},ve={class:"truncate text-left"},ge={key:1,class:"mt-3 text-xs text-content-secondary dark:text-content-muted text-center"},he=ct({name:"PacketTypesChart",__name:"PacketTypesChart",setup(nt){const _=B([]),q=gt(),m=kt(),C=B(!0),$=B(null),A=B(null),X=[{name:"Payload",types:["Plain Text Message","Group Text Message","Group Datagram","Multi-part Packet"],subColors:["#3B82F6","#60A5FA","#93C5FD","#BFDBFE"]},{name:"Requests",types:["Request","Response","Anonymous Request"],subColors:["#10B981","#34D399","#6EE7B7"]},{name:"Control",types:["Node Advertisement","Acknowledgment","Returned Path"],subColors:["#F59E0B","#FBBF24","#FCD34D"]},{name:"Routing",types:["Trace"],subColors:["#8B5CF6"]},{name:"Reserved",types:["Reserved Type 11","Reserved Type 12","Reserved Type 13"],subColors:["#6B7280","#9CA3AF","#D1D5DB"]}],D=Y(()=>X.map(x=>{const d=_.value.filter(v=>x.types.some(g=>v.name.includes(g)||v.name===g)).sort((v,g)=>g.count-v.count).map((v,g)=>({...v,color:x.subColors[g%x.subColors.length]}));return{name:x.name,color:x.subColors[0],items:d,total:d.reduce((v,g)=>v+g.count,0)}}).filter(x=>x.total>0)),h=Y(()=>Math.max(...D.value.map(x=>x.total),1)),F=Y(()=>D.value.reduce((x,d)=>x+d.total,0)),O=async()=>{try{$.value=null;const x=await ft.get("/packet_type_graph_data");if(x?.success&&x?.data){const d=x.data;if(d?.series){const v=[];d.series.forEach((g,N)=>{let w=0;g.data&&Array.isArray(g.data)&&(w=g.data.reduce((s,e)=>s+(e[1]||0),0)),w>0&&v.push({name:g.name||`Type ${g.type}`,type:g.type,count:w,color:""})}),_.value=v,C.value=!1}else $.value="No series data in server response",C.value=!1}else $.value="Invalid response from server",C.value=!1}catch(x){$.value=x instanceof Error?x.message:"Failed to load data",C.value=!1}},G={0:"Request",1:"Response",2:"Plain Text Message",3:"Acknowledgment",4:"Node Advertisement",5:"Group Text Message",6:"Group Datagram",7:"Anonymous Request",8:"Returned Path",9:"Trace",10:"Multi-part Packet",15:"Custom Packet"},E=()=>{const x=q.packetTypeBreakdown;!x||x.length===0||(_.value=x.map(d=>({name:G[Number(d.type)]||`Type ${d.type}`,type:d.type,count:d.count,color:""})),C.value=!1,$.value=null)},M=x=>Math.max(x/h.value*90,2),S=(x,d)=>d===0?0:x/d*100;return bt(()=>{O()}),et(()=>q.packetTypeBreakdown,()=>E(),{deep:!0,immediate:!0}),et(()=>m.isConnected,x=>{x||O()},{immediate:!0}),(x,d)=>(r(),l("div",se,[d[3]||(d[3]=t("div",{class:"flex items-baseline justify-between mb-3 lg:mb-4"},[t("h3",{class:"text-content-primary dark:text-content-primary text-lg lg:text-xl font-semibold"},"Packet Types"),t("p",{class:"text-content-secondary dark:text-content-muted text-xs lg:text-sm uppercase"},"Distribution by Type")],-1)),t("div",ae,[C.value?(r(),l("div",ne,d[1]||(d[1]=[t("div",{class:"text-content-secondary dark:text-content-primary text-sm lg:text-base"},"Loading packet types...",-1)]))):$.value?(r(),l("div",oe,[t("div",re,n($.value),1)])):D.value.length===0?(r(),l("div",le,d[2]||(d[2]=[t("div",{class:"text-content-secondary dark:text-content-primary text-sm lg:text-base"},"No packet data available",-1)]))):(r(),l("div",ie,[A.value?(r(),l("div",de,[t("div",ce,n(A.value.name)+" · "+n(A.value.total.toLocaleString()),1),(r(!0),l(H,null,Q(A.value.items,v=>(r(),l("div",{key:v.type,class:"flex justify-between gap-4 text-xs text-content-secondary dark:text-content-muted"},[t("span",null,n(v.name),1),t("span",ue,n(v.count.toLocaleString()),1)]))),128))])):k("",!0),t("div",pe,[(r(!0),l(H,null,Q(D.value,v=>(r(),l("div",{key:v.name,class:"flex flex-col items-center flex-1 max-w-32 h-full justify-end cursor-pointer",onMouseenter:g=>A.value=v,onMouseleave:d[0]||(d[0]=g=>A.value=null)},[t("span",xe,n(v.total.toLocaleString()),1),t("div",{class:"w-full rounded-[5px] transition-all duration-300 ease-out hover:opacity-90 overflow-hidden flex flex-col-reverse",style:ut({height:M(v.total)+"%",minHeight:"8px"})},[(r(!0),l(H,null,Q(v.items,g=>(r(),l("div",{key:g.type,style:ut({height:S(g.count,v.total)+"%",backgroundColor:g.color})},null,4))),128))],4),t("span",ye,n(v.name),1)],40,me))),128))])]))]),D.value.length>0?(r(),l("div",be,[(r(!0),l(H,null,Q(D.value,v=>(r(),l("div",{key:"legend-"+v.name,class:"flex flex-col gap-0.5 min-w-[100px] max-w-[140px] flex-shrink-0"},[(r(!0),l(H,null,Q(v.items,g=>(r(),l("div",{key:g.type,class:"flex items-center gap-1.5"},[t("span",{class:"w-2 h-2 rounded-sm shrink-0",style:ut({backgroundColor:g.color})},null,4),t("span",ve,n(g.name),1)]))),128))]))),128))])):k("",!0),D.value.length>0?(r(),l("div",ge," Total: "+n(F.value.toLocaleString())+" packets ",1)):k("",!0)]))}}),fe=mt(he,[["__scopeId","data-v-0948a4bb"]]),ke={class:"glass-card rounded-[10px] p-4 lg:p-6"},_e={class:"relative h-40 lg:h-48"},we={class:"mt-3 lg:mt-4 grid grid-cols-2 gap-3 lg:gap-4"},$e={class:"text-center"},Te={class:"text-lg lg:text-2xl font-bold text-content-primary dark:text-content-primary"},Ce={class:"text-center"},Se={class:"text-lg lg:text-2xl font-bold text-content-primary dark:text-content-primary"},Re={class:"mt-2 lg:mt-3 grid grid-cols-3 gap-2 lg:gap-3 text-center"},Pe={class:"text-xs lg:text-sm font-semibold text-accent-purple flex items-center justify-center gap-1"},Ae={key:0,class:"inline-block w-1.5 h-1.5 rounded-full bg-secondary opacity-70",title:"Early data - limited uptime"},De={class:"text-xs text-content-secondary dark:text-content-muted"},Me={class:"text-xs lg:text-sm font-semibold text-accent-red flex items-center justify-center gap-1"},Ne={key:0,class:"inline-block w-1.5 h-1.5 rounded-full bg-secondary opacity-70",title:"Early data - limited uptime"},Be={class:"text-xs text-content-secondary dark:text-content-muted"},Fe={class:"text-xs lg:text-sm font-semibold text-white"},Ee=ct({name:"AirtimeUtilizationChart",__name:"AirtimeUtilizationChart",setup(nt){const _=gt(),q=Ut(),m=B(null),C=B([]),$=B(!0),A=B(null),X=B(30),D=B({totalReceived:0,totalTransmitted:0,dropped:0,firstPacketTime:0}),h=B({sf:9,bwHz:62500,cr:5,preamble:17}),F=x=>{const{sf:d,bwHz:v,cr:g,preamble:N}=h.value,w=1,s=0,e=d>=11&&v<=125e3?1:0,u=v/1e3,i=Math.pow(2,d)/u,o=(N+4.25)*i,y=Math.max(8*x-4*d+28+16*w-20*s,0),f=4*(d-2*e),j=(8+Math.ceil(y/f)*g)*i;return o+j},O=x=>{if(x.airtime_ms!==void 0&&x.airtime_ms>0)return x.airtime_ms;const d=x.length??x.payload_length??32;return F(d)},G=(x,d=60)=>{if(x.length===0)return[];const v=1-Math.pow(.5,1/d),g=Math.min(x.length,Math.max(10,Math.floor(d/3)));let N=0,w=0;for(let s=0;s(N=v*s.rxUtil+(1-v)*N,w=v*s.txUtil+(1-v)*w,{...s,rxUtil:N,txUtil:w}))},E=Y(()=>{const x=_.packetStats?.total_packets||0,d=_.packetStats?.transmitted_packets||0,v=q.stats?.uptime_seconds||0,g=x||D.value.totalReceived,N=d||D.value.totalTransmitted,w=D.value.firstPacketTime>0?Math.floor(Date.now()/1e3)-D.value.firstPacketTime:0,s=v||w,e=Math.max(s/3600,.1);if(e<1){const R=Math.max(s/60,1);return{rxRate:{value:Math.round(g/R*100)/100,label:e<.5?"RX/min (early)":"RX/min"},txRate:{value:Math.round(N/R*100)/100,label:e<.5?"TX/min (early)":"TX/min"},confidence:"low"}}const i=Math.round(g/e*100)/100,o=Math.round(N/e*100)/100;let y,f;return e<6?(y=`RX/hr (${Math.round(e)}h)`,f="medium"):e<24?(y=`RX/hr (${Math.round(e)}h)`,f="high"):(y="RX/hr",f="high"),{rxRate:{value:i,label:y},txRate:{value:o,label:y.replace("RX","TX")},confidence:f}}),M=async()=>{$.value=!0;try{const N=Math.floor(Date.now()/1e3),w=N-24*3600;let s=0;try{const b=await ft.get("/stats");if(b.success&&b.data){const P=b.data,z=P.config;if(z?.radio){const L=z.radio;h.value={sf:L.spreading_factor??9,bwHz:L.bandwidth??62500,cr:L.coding_rate??5,preamble:L.preamble_length??17}}s=P.dropped_count??0}}catch{}const e=await ft.get("/filtered_packets",{start_timestamp:w,end_timestamp:N,limit:5e4});if(!e.success){C.value=[],$.value=!1,dt(()=>S());return}const u=e.data||[],i=new Float64Array(8640),o=new Float64Array(8640);let y=0,f=0,R=1/0;for(const b of u){const P=Math.floor((b.timestamp-w)/10);if(P<0||P>=8640)continue;const z=O(b),L=b.packet_origin;b.timestamp[b.rxUtil,b.txUtil]))*1.05;X.value=Math.max(5,Math.ceil(V/5)*5),$.value=!1,dt(()=>S())}catch(x){console.error("Failed to fetch airtime data:",x),C.value=[],$.value=!1,dt(()=>S())}},S=()=>{if(!m.value)return;const x=m.value,d=x.getContext("2d");if(!d)return;const v=x.parentElement;if(!v)return;const g=v.getBoundingClientRect(),N=g.width,w=g.height;x.width=N*window.devicePixelRatio,x.height=w*window.devicePixelRatio,x.style.width=N+"px",x.style.height=w+"px",d.scale(window.devicePixelRatio,window.devicePixelRatio);const s=20,e=45;if(d.clearRect(0,0,N,w),$.value){d.fillStyle="#666",d.font="16px system-ui",d.textAlign="center",d.fillText("Loading chart data...",N/2,w/2);return}if(C.value.length===0){d.fillStyle="#666",d.font="16px system-ui",d.textAlign="center",d.fillText("No data available",N/2,w/2);return}const u=N-e-s,i=w-s*2,o=X.value,y=X.value;d.strokeStyle="rgba(255, 255, 255, 0.1)",d.lineWidth=1,d.font="10px system-ui",d.textAlign="right";for(let f=0;f<=5;f++){const R=s+i*f/5;d.beginPath(),d.moveTo(e,R),d.lineTo(N-s,R),d.stroke();const j=o-f/5*y;d.fillStyle="rgba(255, 255, 255, 0.5)",d.fillText(`${j.toFixed(0)}%`,e-5,R+3)}for(let f=0;f<=6;f++){const R=e+u*f/6;d.beginPath(),d.moveTo(R,s),d.lineTo(R,w-s),d.stroke()}C.value.length>1&&(d.strokeStyle="#EBA0FC",d.lineWidth=2,d.beginPath(),C.value.forEach((f,R)=>{const j=e+u*R/(C.value.length-1),U=w-s-Math.min(f.rxUtil,X.value)/y*i;R===0?d.moveTo(j,U):d.lineTo(j,U)}),d.stroke()),C.value.length>1&&(d.strokeStyle="#FB787B",d.lineWidth=2,d.beginPath(),C.value.forEach((f,R)=>{const j=e+u*R/(C.value.length-1),U=w-s-Math.min(f.txUtil,X.value)/y*i;R===0?d.moveTo(j,U):d.lineTo(j,U)}),d.stroke())};return bt(()=>{M(),A.value=window.setInterval(M,3e4),dt(()=>{S(),setTimeout(()=>S(),100)}),window.addEventListener("resize",S)}),vt(()=>{A.value&&clearInterval(A.value),window.removeEventListener("resize",S)}),(x,d)=>(r(),l("div",ke,[d[3]||(d[3]=Rt('Airtime Utilization
Activity (Last 24 Hours)
',3)),t("div",_e,[t("canvas",{ref_key:"chartRef",ref:m,class:"absolute inset-0 w-full h-full"},null,512)]),t("div",we,[t("div",$e,[t("div",Te,n(pt(_).packetStats?.total_packets||D.value.totalReceived),1),d[0]||(d[0]=t("div",{class:"text-xs text-content-secondary dark:text-content-muted uppercase tracking-wide"},"Total Received",-1))]),t("div",Ce,[t("div",Se,n(pt(_).packetStats?.transmitted_packets||D.value.totalTransmitted),1),d[1]||(d[1]=t("div",{class:"text-xs text-content-secondary dark:text-content-muted uppercase tracking-wide"},"Total Transmitted",-1))])]),t("div",Re,[t("div",null,[t("div",Pe,[rt(n(E.value.rxRate.value)+" ",1),E.value.confidence==="low"?(r(),l("span",Ae)):k("",!0)]),t("div",De,n(E.value.rxRate.label),1)]),t("div",null,[t("div",Me,[rt(n(E.value.txRate.value)+" ",1),E.value.confidence==="low"?(r(),l("span",Ne)):k("",!0)]),t("div",Be,n(E.value.txRate.label),1)]),t("div",null,[t("div",Fe,n(pt(_).packetStats?.dropped_packets||D.value.dropped),1),d[2]||(d[2]=t("div",{class:"text-xs text-white/60"},"Dropped",-1))])])]))}}),je=mt(Ee,[["__scopeId","data-v-6bf3fe96"]]),Ie={class:"bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[20px] shadow-2xl border border-stroke-subtle dark:border-white/20 flex flex-col h-full overflow-hidden"},Le={class:"flex items-center justify-between p-8 pb-4 flex-shrink-0"},Ue={class:"text-content-secondary dark:text-content-muted text-sm"},Ve={class:"flex items-center gap-2"},He=["title"],ze={class:"flex-1 overflow-y-auto custom-scrollbar px-8"},Xe={class:"mb-6"},Ge={class:"glass-card bg-white/5 rounded-[15px] p-4"},Oe={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},We={class:"space-y-3"},Qe={class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},qe={class:"text-content-primary dark:text-content-primary font-mono text-sm"},Ke={class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},Je={class:"text-content-primary dark:text-content-primary font-mono text-xs break-all"},Ye={key:0,class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},Ze={class:"text-content-primary dark:text-content-primary font-mono text-xs"},ts={class:"space-y-3"},es={class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},ss={class:"text-content-primary dark:text-content-primary font-semibold"},as={class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},ns={class:"text-content-primary dark:text-content-primary font-semibold"},os={class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},rs={class:"mb-6"},ls={class:"bg-gray-50 dark:bg-white/5 rounded-[15px] p-4 border border-stroke-subtle dark:border-stroke/10"},is={class:"space-y-3"},ds={class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},cs={class:"text-content-primary dark:text-content-primary"},us={key:0,class:"pt-2"},ps={class:"glass-card bg-background-mute dark:bg-black/30 rounded-[10px] p-4 mb-4"},ms={class:"w-full overflow-x-auto"},xs={class:"text-content-primary dark:text-content-primary/90 text-xs font-mono whitespace-pre leading-relaxed min-w-full"},ys={class:"flex items-center justify-between mb-3"},bs={class:"text-content-secondary dark:text-content-primary/80 text-sm font-semibold"},vs={class:"text-content-muted dark:text-content-muted text-xs"},gs={class:"bg-background-mute dark:bg-black/40 rounded-[8px] p-3 mb-3"},hs={class:"font-mono text-xs text-content-primary dark:text-content-primary break-all whitespace-pre-wrap leading-relaxed"},fs={class:"bg-gray-50 dark:bg-white/5 rounded-[10px] overflow-hidden"},ks={key:0,class:"min-w-0"},_s={class:"text-cyan-500 text-sm font-mono break-words min-w-0"},ws={class:"text-content-primary dark:text-content-primary text-sm break-words min-w-0"},$s={class:"text-content-primary dark:text-content-primary text-sm font-semibold break-all min-w-0 overflow-hidden"},Ts=["title"],Cs={key:0,class:"text-orange-500 text-xs font-mono break-all min-w-0 overflow-hidden"},Ss=["title"],Rs={class:"grid grid-cols-2 gap-2"},Ps={class:"text-cyan-500 text-sm font-mono break-words"},As={class:"text-content-primary dark:text-content-primary text-sm break-words"},Ds=["title"],Ms={key:0},Ns=["title"],Bs={key:0,class:"text-content-muted dark:text-content-muted text-xs italic mt-2 px-1"},Fs={key:1,class:"py-2"},Es={class:"mb-6"},js={class:"bg-gray-50 dark:bg-white/5 rounded-[15px] p-4 border border-stroke-subtle dark:border-stroke/10"},Is={class:"space-y-4"},Ls={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},Us={class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},Vs={class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},Hs={key:0,class:"py-2"},zs={class:"bg-background-mute dark:bg-black/20 rounded-[10px] p-4"},Xs={class:"flex items-center flex-wrap gap-2"},Gs={class:"relative group"},Os={class:"relative px-3 py-2 bg-gradient-to-br from-blue-500/20 to-cyan-500/20 border border-cyan-400/40 rounded-lg transform transition-all hover:scale-105"},Ws={class:"font-mono text-xs font-semibold text-content-primary dark:text-content-primary/90"},Qs={class:"absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-2 py-1 bg-content-primary dark:bg-background/90 text-white dark:text-content-primary text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none whitespace-nowrap z-10"},qs={key:0,class:"mx-2 text-cyan-600 dark:text-cyan-400/60"},Ks={key:1,class:"py-2"},Js={class:"text-content-secondary dark:text-content-muted text-sm mb-2 flex items-center"},Ys={key:0,class:"w-4 h-4 ml-2 text-yellow-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Zs={key:1,class:"text-yellow-500 text-xs ml-1"},ta={class:"bg-background-mute dark:bg-black/20 rounded-[10px] p-4"},ea={class:"flex items-center flex-wrap gap-2"},sa={class:"relative group"},aa={key:0,class:"absolute -top-1 -right-1 w-2 h-2 bg-yellow-400 rounded-full animate-pulse"},na={class:"absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-2 py-1 bg-content-primary dark:bg-background/90 text-white dark:text-content-primary text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none whitespace-nowrap z-10"},oa={key:0,class:"mx-1 text-orange-600 dark:text-orange-400/60"},ra={class:"mb-6"},la={class:"glass-card bg-gray-50 dark:bg-white/5 rounded-[15px] p-4"},ia={class:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-4"},da={class:"text-center p-3 glass-card bg-background-mute dark:bg-black/20 rounded-[10px]"},ca={class:"text-lg font-bold text-content-primary dark:text-content-primary"},ua={class:"text-center p-3 glass-card bg-background-mute dark:bg-black/20 rounded-[10px]"},pa={class:"text-center p-3 glass-card bg-background-mute dark:bg-black/20 rounded-[10px]"},ma={class:"text-lg font-bold text-content-primary dark:text-content-primary"},xa={key:0,class:"mb-4"},ya={class:"flex items-center gap-3"},ba={class:"flex gap-1"},va={class:"text-content-secondary dark:text-content-primary/80 text-sm capitalize"},ga={key:1,class:"mb-4"},ha={key:2,class:"mb-4"},fa={class:"text-content-secondary dark:text-content-muted text-sm mb-3"},ka={class:"space-y-2"},_a={class:"flex items-center gap-3"},wa={class:"text-content-muted dark:text-content-muted text-sm"},$a={key:3,class:"mt-6 pt-4 border-t border-stroke-subtle dark:border-stroke/10"},Ta={class:"grid grid-cols-1 md:grid-cols-3 gap-3 mb-4"},Ca={class:"text-center p-3 glass-card bg-background-mute dark:bg-black/20 rounded-[10px]"},Sa={class:"text-2xl font-bold text-content-primary dark:text-content-primary"},Ra={class:"text-center p-3 glass-card bg-background-mute dark:bg-black/20 rounded-[10px]"},Pa={class:"text-2xl font-bold text-content-primary dark:text-content-primary"},Aa={class:"text-content-muted dark:text-content-muted text-xs mt-1"},Da={class:"text-center p-3 glass-card bg-background-mute dark:bg-black/20 rounded-[10px]"},Ma={class:"text-content-muted dark:text-content-muted text-xs mt-1"},Na={key:0,class:"glass-card bg-background-mute dark:bg-black/20 rounded-[10px] p-4"},Ba={class:"space-y-3"},Fa={class:"flex-shrink-0 w-16 text-right"},Ea={class:"text-content-secondary dark:text-content-muted text-xs"},ja={class:"flex-1 relative"},Ia={class:"h-8 rounded-lg overflow-hidden bg-background-mute dark:bg-stroke/5 relative"},La={class:"absolute inset-0 flex items-center px-3"},Ua={class:"text-content-primary dark:text-content-primary text-xs font-mono font-semibold"},Va={class:"flex-shrink-0 w-12 text-left"},Ha={class:"text-content-muted dark:text-content-muted text-xs"},za={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},Xa={class:"space-y-2"},Ga={class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},Oa={class:"text-content-primary dark:text-content-primary"},Wa={class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},Qa={class:"space-y-2"},qa={class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},Ka={key:0,class:"flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10"},Ja={class:"text-red-600 dark:text-red-400 text-sm"},Ya={class:"p-8 pt-4 border-t border-stroke-subtle dark:border-stroke/10 flex justify-end flex-shrink-0"},Za=ct({name:"PacketDetailsModal",__name:"PacketDetailsModal",props:{packet:{},isOpen:{type:Boolean},localHash:{}},emits:["close"],setup(nt,{emit:_}){const{getSignalQuality:q}=Ot(),m=nt,C=_,$=B(!1),A=s=>new Date(s*1e3).toLocaleString(),X=s=>s.transmitted?s.is_duplicate?"text-amber-600 dark:text-amber-400":s.drop_reason?"text-red-600 dark:text-red-400":"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400",D=s=>s.transmitted?s.is_duplicate?"Duplicate":s.drop_reason?"Dropped":"Forwarded":"Dropped",h=s=>({0:"Request",1:"Response",2:"Plain Text Message",3:"Acknowledgment",4:"Node Advertisement",5:"Group Text Message",6:"Group Datagram",7:"Anonymous Request",8:"Returned Path",9:"Trace",10:"Multi-part Packet",15:"Custom Packet"})[s]||`Unknown Type (${s})`,F=s=>({0:"Transport Flood",1:"Flood",2:"Direct",3:"Transport Direct"})[s]||`Unknown Route (${s})`,O=s=>{if(!s)return"None";const u=s.replace(/\s+/g,"").toUpperCase().match(/.{2}/g)||[],i=[];for(let o=0;o{try{let i=0;const o=e.length/2;if(o>=100){if(e.length>=i+64){const y=e.slice(i,i+64);s.push({name:"Public Key",byteRange:`${(u+i)/2}-${(u+i+63)/2}`,hexData:y.match(/.{8}/g)?.join(" ")||y,description:"Ed25519 public key of the node (32 bytes)",fields:[{bits:"0-255",name:"Ed25519 Public Key",value:`${y.slice(0,16)}...${y.slice(-16)}`,binary:"32 bytes (256 bits)"}]}),i+=64}if(e.length>=i+8){const y=e.slice(i,i+8),f=parseInt(y,16),R=new Date(f*1e3);s.push({name:"Timestamp",byteRange:`${(u+i)/2}-${(u+i+7)/2}`,hexData:y.match(/.{2}/g)?.join(" ")||y,description:"Unix timestamp of advertisement",fields:[{bits:"0-31",name:"Unix Timestamp",value:`${f} (${R.toLocaleString()})`,binary:f.toString(2).padStart(32,"0")}]}),i+=8}if(e.length>=i+128){const y=e.slice(i,i+128);s.push({name:"Signature",byteRange:`${(u+i)/2}-${(u+i+127)/2}`,hexData:y.match(/.{8}/g)?.join(" ")||y,description:"Ed25519 signature of public key, timestamp, and appdata",fields:[{bits:"0-511",name:"Ed25519 Signature",value:`${y.slice(0,16)}...${y.slice(-16)}`,binary:"64 bytes (512 bits)"}]}),i+=128}if(e.length>i){const y=e.slice(i);E(s,y,u+i)}}else s.push({name:"ADVERT AppData (Partial)",byteRange:`${u/2}-${u/2+o-1}`,hexData:e.match(/.{2}/g)?.join(" ")||e,description:`Partial ADVERT data - appears to be just AppData portion (${o} bytes)`,fields:[{bits:`0-${o*8-1}`,name:"Partial Data",value:`${o} bytes - attempting to decode as AppData`,binary:`${o} bytes (${o*8} bits)`}]}),E(s,e,u)}catch(i){s.push({name:"ADVERT Parse Error",byteRange:"N/A",hexData:e.slice(0,32)+"...",description:"Failed to parse ADVERT payload structure",fields:[{bits:"N/A",name:"Error",value:`Parse error: ${i instanceof Error?i.message:"Unknown error"}`,binary:"Invalid"}]})}},E=(s,e,u)=>{try{const i=e.length/2;s.push({name:"AppData",byteRange:`${u/2}-${u/2+i-1}`,hexData:e.match(/.{2}/g)?.join(" ")||e,description:`Node advertisement application data (${i} bytes)`,fields:[{bits:`0-${i*8-1}`,name:"Application Data",value:`${i} bytes (contains flags, location, name, etc.)`,binary:`${i} bytes (${i*8} bits)`}]});let o=0;if(e.length>=2){const y=parseInt(e.slice(o,o+2),16),f=[],R=!!(y&16),j=!!(y&32),U=!!(y&64),at=!!(y&128);if(y&1&&f.push("is chat node"),y&2&&f.push("is repeater"),y&4&&f.push("is room server"),y&8&&f.push("is sensor"),R&&f.push("has location"),j&&f.push("has feature 1"),U&&f.push("has feature 2"),at&&f.push("has name"),s.push({name:"AppData Flags",byteRange:`${(u+o)/2}`,hexData:`0x${e.slice(o,o+2)}`,description:"Flags indicating which optional fields are present",fields:[{bits:"0-7",name:"Flags",value:f.join(", ")||"none",binary:y.toString(2).padStart(8,"0")}]}),o+=2,R&&e.length>=o+16){const I=e.slice(o,o+8),K=[];for(let p=6;p>=0;p-=2)K.push(I.slice(p,p+2));const V=parseInt(K.join(""),16),b=V>2147483647?V-4294967296:V,P=b/1e6,z=e.slice(o+8,o+16),L=[];for(let p=6;p>=0;p-=2)L.push(z.slice(p,p+2));const tt=parseInt(L.join(""),16),J=tt>2147483647?tt-4294967296:tt,lt=J/1e6;s.push({name:"Location Data",byteRange:`${(u+o)/2}-${(u+o+15)/2}`,hexData:`${I.match(/.{2}/g)?.join(" ")||I} ${z.match(/.{2}/g)?.join(" ")||z}`,description:"GPS coordinates (latitude and longitude)",fields:[{bits:"0-31",name:"Latitude",value:`${P.toFixed(6)}° (raw: ${b})`,binary:b.toString(2).padStart(32,"0")},{bits:"32-63",name:"Longitude",value:`${lt.toFixed(6)}° (raw: ${J})`,binary:J.toString(2).padStart(32,"0")}]}),o+=16}if(j&&e.length>=o+4){const I=e.slice(o,o+4),K=parseInt(I,16);s.push({name:"Feature 1",byteRange:`${(u+o)/2}-${(u+o+3)/2}`,hexData:I.match(/.{2}/g)?.join(" ")||I,description:"Reserved feature 1 (2 bytes)",fields:[{bits:"0-15",name:"Feature 1 Value",value:`${K}`,binary:K.toString(2).padStart(16,"0")}]}),o+=4}if(U&&e.length>=o+4){const I=e.slice(o,o+4),K=parseInt(I,16);s.push({name:"Feature 2",byteRange:`${(u+o)/2}-${(u+o+3)/2}`,hexData:I.match(/.{2}/g)?.join(" ")||I,description:"Reserved feature 2 (2 bytes)",fields:[{bits:"0-15",name:"Feature 2 Value",value:`${K}`,binary:K.toString(2).padStart(16,"0")}]}),o+=4}if(at&&e.length>o){const I=e.slice(o),K=I.match(/.{2}/g)||[],V=K.map(b=>{const P=parseInt(b,16);return P>=32&&P<=126?String.fromCharCode(P):"."}).join("").replace(/\.+$/,"");s.push({name:"Node Name",byteRange:`${(u+o)/2}-${(u+e.length-1)/2}`,hexData:I.match(/.{2}/g)?.join(" ")||I,description:`Node name string (${K.length} bytes)`,fields:[{bits:`0-${K.length*8-1}`,name:"Node Name",value:`"${V}"`,binary:`ASCII text (${K.length} bytes)`}]})}}}catch(i){s.push({name:"AppData Parse Error",byteRange:"N/A",hexData:e.slice(0,Math.min(32,e.length)),description:"Failed to parse AppData structure",fields:[{bits:"N/A",name:"Error",value:`Parse error: ${i instanceof Error?i.message:"Unknown error"}`,binary:"Invalid"}]})}},M=s=>{if(!s)return[];if(Array.isArray(s))return s;if(typeof s=="string")try{return JSON.parse(s)}catch{return[]}return[]},S=s=>{const e=[];if(!s)return e;try{const u=s.raw_packet;if(u){const i=u.replace(/\s+/g,"").toUpperCase();let o=0;if(i.length>=2){const y=i.slice(o,o+2),f=parseInt(y,16),R=f&3,j=(f&60)>>2,U=(f&192)>>6,at={0:"Transport Flood",1:"Flood",2:"Direct",3:"Transport Direct"},I={0:"REQ",1:"RESPONSE",2:"TXT_MSG",3:"ACK",4:"ADVERT",5:"GRP_TXT",6:"GRP_DATA",7:"ANON_REQ",8:"PATH",9:"TRACE",10:"MULTIPART",15:"RAW_CUSTOM"};if(e.push({name:"Header",byteRange:"0",hexData:`0x${y}`,description:"Contains routing type, payload type, and payload version",fields:[{bits:"0-1",name:"Route Type",value:at[R]||"Unknown",binary:R.toString(2).padStart(2,"0")},{bits:"2-5",name:"Payload Type",value:I[j]||"Unknown",binary:j.toString(2).padStart(4,"0")},{bits:"6-7",name:"Version",value:U.toString(),binary:U.toString(2).padStart(2,"0")}]}),o+=2,(R===0||R===3)&&i.length>=o+8){const V=i.slice(o,o+8),b=parseInt(V.slice(0,4),16),P=parseInt(V.slice(4,8),16);e.push({name:"Transport Codes",byteRange:"1-4",hexData:`${V.slice(0,4)} ${V.slice(4,8)}`,description:"2x 16-bit transport codes for routing optimization",fields:[{bits:"0-15",name:"Code 1",value:b.toString(),binary:b.toString(2).padStart(16,"0")},{bits:"16-31",name:"Code 2",value:P.toString(),binary:P.toString(2).padStart(16,"0")}]}),o+=8}if(i.length>=o+2){const V=i.slice(o,o+2),b=parseInt(V,16),P=(b>>6)+1,z=b&63,L=z*P;if(e.push({name:"Path Length",byteRange:`${o/2}`,hexData:`0x${V}`,description:`${z} hop${z!==1?"s":""}, ${P}-byte hash${P>1?"es":""} (${L} bytes)`,fields:[{bits:"6-7",name:"Hash Size",value:`${P}-byte`,binary:(b>>6&3).toString(2).padStart(2,"0")},{bits:"0-5",name:"Hop Count",value:`${z}`,binary:(b&63).toString(2).padStart(6,"0")}]}),o+=2,L>0&&i.length>=o+L*2){const tt=i.slice(o,o+L*2),J=new RegExp(`.{${P*2}}`,"g"),lt=tt.match(J)||[];e.push({name:"Path Data",byteRange:`${o/2}-${(o+L*2-2)/2}`,hexData:lt.join(" ")||tt,description:`${z} × ${P}-byte routing hash${z!==1?"es":""}`,fields:lt.map((p,c)=>({bits:`${c*P*8}-${(c+1)*P*8-1}`,name:`Hop ${c+1}`,value:p.toUpperCase(),binary:`${P} byte${P>1?"s":""}`}))}),o+=L*2}}if(i.length>o){const V=i.slice(o),b=V.length/2;j===4?G(e,V,o):e.push({name:"Payload Data",byteRange:`${o/2}-${o/2+b-1}`,hexData:V.match(/.{2}/g)?.join(" ")||V,description:"Application data content",fields:[{bits:`0-${b*8-1}`,name:"Application Data",value:`${b} bytes`,binary:`${b} bytes (${b*8} bits)`}]})}}}else{if(s.header){const i=s.header.replace(/0x/gi,"").replace(/\s+/g,"").toUpperCase(),o=parseInt(i,16),y=o&3,f=(o&60)>>2,R=(o&192)>>6,j={0:"Transport Flood",1:"Flood",2:"Direct",3:"Transport Direct"},U={0:"REQ",1:"RESPONSE",2:"TXT_MSG",3:"ACK",4:"ADVERT",5:"GRP_TXT",6:"GRP_DATA",7:"ANON_REQ",8:"PATH",9:"TRACE",10:"MULTIPART",15:"RAW_CUSTOM"};e.push({name:"Header",byteRange:"0",hexData:`0x${i}`,description:"Contains routing type, payload type, and payload version",fields:[{bits:"0-1",name:"Route Type",value:j[y]||"Unknown",binary:y.toString(2).padStart(2,"0")},{bits:"2-5",name:"Payload Type",value:U[f]||"Unknown",binary:f.toString(2).padStart(4,"0")},{bits:"6-7",name:"Version",value:R.toString(),binary:R.toString(2).padStart(2,"0")}]}),s.transport_codes&&e.push({name:"Transport Codes",byteRange:"1-4",hexData:s.transport_codes,description:"2x 16-bit transport codes for routing optimization",fields:[{bits:"0-31",name:"Transport Codes",value:s.transport_codes,binary:"Available in separate field"}]}),s.original_path&&s.original_path.length>0&&e.push({name:"Original Path",byteRange:"?",hexData:s.original_path.join(" "),description:`Original routing path (${s.original_path.length} nodes)`,fields:[{bits:"0-?",name:"Path Nodes",value:`${s.original_path.length} nodes`,binary:"Available as node list"}]}),s.forwarded_path&&s.forwarded_path.length>0&&e.push({name:"Forwarded Path",byteRange:"?",hexData:s.forwarded_path.join(" "),description:`Forwarded routing path (${s.forwarded_path.length} nodes)`,fields:[{bits:"0-?",name:"Path Nodes",value:`${s.forwarded_path.length} nodes`,binary:"Available as node list"}]})}if(s.payload){const i=s.payload.replace(/\s+/g,"").toUpperCase(),o=i.length/2;s.type===4?G(e,i,0):e.push({name:"Payload Data",byteRange:`0-${o-1}`,hexData:i.match(/.{2}/g)?.join(" ")||i,description:`Application data content (${o} bytes)`,fields:[{bits:`0-${o*8-1}`,name:"Application Data",value:`${o} bytes`,binary:`${o} bytes (${o*8} bits)`}]})}}}catch{e.push({name:"Parse Error",byteRange:"N/A",hexData:"Error",description:"Unable to parse packet structure",fields:[{bits:"N/A",name:"Error",value:"Parse failed",binary:"Invalid"}]})}return e},x=(s,e)=>s==null||e==null?"text-content-muted dark:text-content-muted":q(e).color,d=s=>{if(s==null)return{level:0,className:"signal-none"};const e=q(s);let u,i;return e.bars>=5?(u=4,i="signal-excellent"):e.bars>=4?(u=3,i="signal-good"):e.bars>=2?(u=2,i="signal-fair"):e.bars>=1?(u=1,i="signal-poor"):(u=0,i="signal-none"),{level:u,className:i}},v=s=>{if(!s)return[];try{const e=JSON.parse(s);return Array.isArray(e)?e:[]}catch{return[]}},g=s=>s>=1e3?`${(s/1e3).toFixed(2)}s`:`${Math.round(s)}ms`,N=s=>{s.key==="Escape"&&C("close")},w=s=>{s.target===s.currentTarget&&C("close")};return et(()=>m.isOpen,s=>{s?document.body.style.overflow="hidden":document.body.style.overflow=""},{immediate:!0}),(s,e)=>(r(),Vt(Xt,{to:"body"},[st(Ht,{name:"modal",appear:""},{default:zt(()=>[s.isOpen&&s.packet?(r(),l("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center p-4 overflow-hidden",onClick:w,onKeydown:N,tabindex:"0"},[e[51]||(e[51]=t("div",{class:"absolute inset-0 bg-black/60 backdrop-blur-md pointer-events-none"},null,-1)),t("div",{class:"relative w-full max-w-4xl max-h-[90vh] flex flex-col",onClick:e[3]||(e[3]=Gt(()=>{},["stop"]))},[t("div",Ie,[t("div",Le,[t("div",null,[e[4]||(e[4]=t("h2",{class:"text-2xl font-bold text-content-primary dark:text-content-primary mb-1"},"Packet Details",-1)),t("p",Ue,n(h(s.packet.type))+" - "+n(F(s.packet.route)),1)]),t("div",Ve,[t("button",{onClick:e[0]||(e[0]=u=>$.value=!$.value),class:T(["flex items-center gap-2 px-3 py-1.5 rounded-lg transition-all duration-200",$.value?"bg-cyan-500/20 border border-cyan-400/30 text-cyan-600 dark:text-cyan-400":"bg-background-mute dark:bg-white/10 border border-stroke-subtle dark:border-stroke/20 text-content-secondary dark:text-content-muted"]),title:$.value?"Hide binary values":"Show binary values"},e[5]||(e[5]=[t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"})],-1),t("span",{class:"text-xs font-medium"},"Binary",-1)]),10,He),t("button",{onClick:e[1]||(e[1]=u=>C("close")),class:"w-8 h-8 flex items-center justify-center rounded-full bg-background-mute dark:bg-white/10 hover:bg-stroke-subtle dark:hover:bg-white/20 transition-colors duration-200 text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary"},e[6]||(e[6]=[t("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))])]),t("div",ze,[t("div",Xe,[e[13]||(e[13]=t("h3",{class:"text-lg font-semibold text-content-primary dark:text-content-primary mb-4 flex items-center"},[t("div",{class:"w-2 h-2 rounded-full bg-cyan-400 mr-3"}),rt(" Basic Information ")],-1)),t("div",Ge,[t("div",Oe,[t("div",We,[t("div",Qe,[e[7]||(e[7]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Timestamp",-1)),t("span",qe,n(A(s.packet.timestamp)),1)]),t("div",Ke,[e[8]||(e[8]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Packet Hash",-1)),t("span",Je,n(s.packet.packet_hash),1)]),s.packet.header?(r(),l("div",Ye,[e[9]||(e[9]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Header",-1)),t("span",Ze,n(s.packet.header),1)])):k("",!0)]),t("div",ts,[t("div",es,[e[10]||(e[10]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Type",-1)),t("span",ss,n(s.packet.type)+" ("+n(h(s.packet.type))+")",1)]),t("div",as,[e[11]||(e[11]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Route",-1)),t("span",ns,n(s.packet.route)+" ("+n(F(s.packet.route))+")",1)]),t("div",os,[e[12]||(e[12]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Status",-1)),t("span",{class:T(["font-semibold",X(s.packet)])},n(D(s.packet)),3)])])])])]),t("div",rs,[e[25]||(e[25]=t("h3",{class:"text-lg font-semibold text-content-primary dark:text-content-primary mb-4 flex items-center"},[t("div",{class:"w-2 h-2 rounded-full bg-orange-400 mr-3"}),rt(" Payload Data ")],-1)),t("div",ls,[t("div",is,[t("div",ds,[e[14]||(e[14]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Payload Length",-1)),t("span",cs,n(s.packet.payload_length||s.packet.length)+" bytes",1)]),s.packet.payload?(r(),l("div",us,[e[23]||(e[23]=t("div",{class:"text-content-secondary dark:text-content-muted text-sm mb-3"},"Payload Analysis",-1)),t("div",ps,[e[15]||(e[15]=t("div",{class:"text-content-secondary dark:text-content-muted text-xs mb-2 font-semibold"},"Raw Hex Data",-1)),t("div",ms,[t("pre",xs,n(O(s.packet.payload)),1)])]),(r(!0),l(H,null,Q(S(s.packet).filter(u=>!u.name.includes("Parse Error")),(u,i)=>(r(),l("div",{key:i,class:"mb-4"},[t("div",ys,[t("h4",bs,n(u.name),1),t("span",vs,"Bytes "+n(u.byteRange),1)]),t("div",gs,[t("div",hs,n(u.hexData),1)]),t("div",fs,[t("div",{class:T(["hidden md:grid gap-3 p-3 bg-background-mute dark:bg-white/10 text-content-secondary dark:text-content-muted text-xs font-semibold uppercase tracking-wide",$.value?"grid-cols-4":"grid-cols-3"])},[e[16]||(e[16]=t("div",{class:"min-w-0"},"Bits",-1)),e[17]||(e[17]=t("div",{class:"min-w-0"},"Field",-1)),e[18]||(e[18]=t("div",{class:"min-w-0"},"Value",-1)),$.value?(r(),l("div",ks,"Binary")):k("",!0)],2),(r(!0),l(H,null,Q(u.fields,(o,y)=>(r(),l("div",{key:y,class:T(["hidden md:grid gap-3 p-3 border-b border-stroke-subtle dark:border-stroke/5 last:border-b-0 hover:bg-background-mute dark:hover:bg-stroke/5 transition-colors",$.value?"grid-cols-4":"grid-cols-3"])},[t("div",_s,n(o.bits),1),t("div",ws,n(o.name),1),t("div",$s,[t("span",{class:"block",title:o.value},n(o.value),9,Ts)]),$.value?(r(),l("div",Cs,[t("span",{class:"block",title:o.binary},n(o.binary),9,Ss)])):k("",!0)],2))),128)),(r(!0),l(H,null,Q(u.fields,(o,y)=>(r(),l("div",{key:`mobile-${y}`,class:"md:hidden p-3 border-b border-stroke-subtle dark:border-stroke/5 last:border-b-0 space-y-2"},[t("div",Rs,[t("div",null,[e[19]||(e[19]=t("span",{class:"text-content-secondary dark:text-content-muted text-xs uppercase tracking-wide"},"Bits:",-1)),t("div",Ps,n(o.bits),1)]),t("div",null,[e[20]||(e[20]=t("span",{class:"text-content-secondary dark:text-content-muted text-xs uppercase tracking-wide"},"Field:",-1)),t("div",As,n(o.name),1)])]),t("div",null,[e[21]||(e[21]=t("span",{class:"text-content-secondary dark:text-content-muted text-xs uppercase tracking-wide"},"Value:",-1)),t("div",{class:"text-content-primary dark:text-content-primary text-sm font-semibold break-all",title:o.value},n(o.value),9,Ds)]),$.value?(r(),l("div",Ms,[e[22]||(e[22]=t("span",{class:"text-content-secondary dark:text-content-muted text-xs uppercase tracking-wide"},"Binary:",-1)),t("div",{class:"text-orange-500 text-xs font-mono break-all",title:o.binary},n(o.binary),9,Ns)])):k("",!0)]))),128))]),u.description?(r(),l("div",Bs,n(u.description),1)):k("",!0)]))),128))])):(r(),l("div",Fs,e[24]||(e[24]=[t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Payload:",-1),t("span",{class:"text-content-muted dark:text-content-muted ml-2"},"None",-1)])))])])]),t("div",Es,[e[33]||(e[33]=t("h3",{class:"text-lg font-semibold text-content-primary dark:text-content-primary mb-4 flex items-center"},[t("div",{class:"w-2 h-2 rounded-full bg-purple-400 mr-3"}),rt(" Path Information ")],-1)),t("div",js,[t("div",Is,[t("div",Ls,[t("div",Us,[e[26]||(e[26]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Source Hash",-1)),t("span",{class:T(["text-content-primary dark:text-content-primary font-mono text-xs",m.localHash&&s.packet.src_hash===m.localHash?"bg-cyan-400/20 text-cyan-600 dark:text-cyan-300 px-1 rounded":""])},n(s.packet.src_hash||"Unknown"),3)]),t("div",Vs,[e[27]||(e[27]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Destination Hash",-1)),t("span",{class:T(["text-content-primary dark:text-content-primary font-mono text-xs",m.localHash&&s.packet.dst_hash===m.localHash?"bg-cyan-400/20 text-cyan-600 dark:text-cyan-300 px-1 rounded":""])},n(s.packet.dst_hash||"Broadcast"),3)])]),M(s.packet.original_path).length>0?(r(),l("div",Hs,[e[29]||(e[29]=t("div",{class:"text-content-secondary dark:text-content-muted text-sm mb-2"},"Original Path",-1)),t("div",zs,[t("div",Xs,[(r(!0),l(H,null,Q(M(s.packet.original_path),(u,i)=>(r(),l("div",{key:i,class:"flex items-center"},[t("div",Gs,[t("div",Os,[t("div",Ws,n(u.toUpperCase()),1)]),t("div",Qs," Node: "+n(u.toUpperCase()),1)]),i0?(r(),l("div",Ks,[t("div",Js,[e[31]||(e[31]=rt(" Forwarded Path ",-1)),JSON.stringify(M(s.packet.original_path))!==JSON.stringify(M(s.packet.forwarded_path))?(r(),l("svg",Ys,e[30]||(e[30]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)]))):k("",!0),JSON.stringify(M(s.packet.original_path))!==JSON.stringify(M(s.packet.forwarded_path))?(r(),l("span",Zs,"(Modified)")):k("",!0)]),t("div",ta,[t("div",ea,[(r(!0),l(H,null,Q(M(s.packet.forwarded_path),(u,i)=>(r(),l("div",{key:i,class:"flex items-center"},[t("div",sa,[t("div",{class:T(["relative px-3 py-2 bg-gradient-to-br from-orange-500/20 to-yellow-500/20 border border-orange-500 dark:border-orange-400/40 rounded-lg transform transition-all hover:scale-105",m.localHash&&u===m.localHash?"bg-gradient-to-br from-yellow-400/30 to-orange-400/30 border-yellow-300 shadow-yellow-400/20 shadow-lg":"hover:border-orange-500 dark:border-orange-400/60"])},[t("div",{class:T(["font-mono text-xs font-semibold",m.localHash&&u===m.localHash?"text-yellow-200":"text-white/90"])},n(u.toUpperCase()),3),m.localHash&&u===m.localHash?(r(),l("div",aa)):k("",!0)],2),t("div",na,n(u),1)]),it("div",{key:u,class:T(["w-2 h-6 rounded-sm transition-all duration-300",u<=d(s.packet.rssi).level?{"signal-excellent":"bg-green-400","signal-good":"bg-cyan-400","signal-fair":"bg-yellow-400","signal-poor":"bg-red-400"}[d(s.packet.rssi).className]:"bg-stroke-subtle dark:bg-stroke/10"])},null,2)),64))]),t("span",va,n(d(s.packet.rssi).className.replace("signal-","")),1)])])):(r(),l("div",ga,e[40]||(e[40]=[t("div",{class:"text-content-secondary dark:text-content-muted text-sm mb-2"},"Signal Quality",-1),t("div",{class:"text-content-muted dark:text-content-muted text-sm italic"},"N/A (TX Packet)",-1)]))),s.packet.is_trace&&s.packet.path_snr_details&&s.packet.path_snr_details.length>0?(r(),l("div",ha,[t("div",fa,"Path SNR Details ("+n(s.packet.path_snr_details.length)+" hops)",1),t("div",ka,[(r(!0),l(H,null,Q(s.packet.path_snr_details,(u,i)=>(r(),l("div",{key:i,class:"flex items-center justify-between p-2 glass-card bg-background-mute dark:bg-black/20 rounded-[8px]"},[t("div",_a,[t("span",wa,n(i+1)+".",1),t("span",{class:T(["font-mono text-xs text-content-primary dark:text-content-primary",m.localHash&&u.hash===m.localHash?"bg-cyan-400/20 text-cyan-600 dark:text-cyan-300 px-1 rounded":""])},n(u.hash),3)]),t("span",{class:T(["text-sm font-bold",x(u.snr_db,null)])},n(u.snr_db.toFixed(1))+"dB ",3)]))),128))])])):k("",!0),s.packet.transmitted&&s.packet.lbt_attempts!==void 0?(r(),l("div",$a,[e[45]||(e[45]=t("div",{class:"text-content-secondary dark:text-content-muted text-sm mb-3 flex items-center"},[t("svg",{class:"w-4 h-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})]),rt(" Listen Before Talk (LBT) Metrics ")],-1)),t("div",Ta,[t("div",Ca,[e[41]||(e[41]=t("div",{class:"text-content-secondary dark:text-content-muted text-xs mb-1"},"CAD Attempts",-1)),t("div",Sa,n(s.packet.lbt_attempts),1)]),t("div",Ra,[e[42]||(e[42]=t("div",{class:"text-content-secondary dark:text-content-muted text-xs mb-1"},"Total LBT Delay",-1)),t("div",Pa,n(g(v(s.packet.lbt_backoff_delays_ms).reduce((u,i)=>u+i,0))),1),t("div",Aa,n(v(s.packet.lbt_backoff_delays_ms).length)+" backoffs ",1)]),t("div",Da,[e[43]||(e[43]=t("div",{class:"text-content-secondary dark:text-content-muted text-xs mb-1"},"Channel Status",-1)),t("div",{class:T(["text-lg font-bold",s.packet.lbt_channel_busy?"text-yellow-600 dark:text-yellow-400":"text-green-600 dark:text-green-400"])},n(s.packet.lbt_channel_busy?"BUSY":"CLEAR"),3),t("div",Ma,n(s.packet.lbt_channel_busy?"Waited for clear":"Immediate TX"),1)])]),v(s.packet.lbt_backoff_delays_ms).length>0?(r(),l("div",Na,[e[44]||(e[44]=t("div",{class:"text-content-secondary dark:text-content-muted text-xs mb-3 font-semibold"},"Backoff Pattern (Exponential with Jitter)",-1)),t("div",Ba,[(r(!0),l(H,null,Q(v(s.packet.lbt_backoff_delays_ms),(u,i)=>(r(),l("div",{key:i,class:"flex items-center gap-3"},[t("div",Fa,[t("span",Ea,"Attempt "+n(i+1),1)]),t("div",ja,[t("div",Ia,[t("div",{class:T(["h-full rounded-lg transition-all duration-300",[i===0?"bg-gradient-to-r from-cyan-500/50 to-cyan-600/50":i===1?"bg-gradient-to-r from-yellow-500/50 to-yellow-600/50":i===2?"bg-gradient-to-r from-orange-500/50 to-orange-600/50":"bg-gradient-to-r from-red-500/50 to-red-600/50"]]),style:ut({width:`${Math.min(100,u/Math.max(...v(s.packet.lbt_backoff_delays_ms))*100)}%`})},[t("div",La,[t("span",Ua,n(g(u)),1)])],6)])]),t("div",Va,[t("span",Ha,n(Math.round(u/v(s.packet.lbt_backoff_delays_ms).reduce((o,y)=>o+y,0)*100))+"% ",1)])]))),128))])])):k("",!0)])):k("",!0),t("div",za,[t("div",Xa,[t("div",Ga,[e[46]||(e[46]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"TX Delay",-1)),t("span",Oa,n(Number(s.packet.tx_delay_ms)>0?Number(s.packet.tx_delay_ms).toFixed(1)+"ms":"-"),1)]),t("div",Wa,[e[47]||(e[47]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Transmitted",-1)),t("span",{class:T(s.packet.transmitted?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400")},n(s.packet.transmitted?"Yes":"No"),3)])]),t("div",Qa,[t("div",qa,[e[48]||(e[48]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Is Duplicate",-1)),t("span",{class:T(s.packet.is_duplicate?"text-amber-600 dark:text-amber-400":"text-content-muted dark:text-content-muted")},n(s.packet.is_duplicate?"Yes":"No"),3)]),s.packet.drop_reason?(r(),l("div",Ka,[e[49]||(e[49]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Drop Reason",-1)),t("span",Ja,n(s.packet.drop_reason),1)])):k("",!0)])])])])]),t("div",Ya,[t("button",{onClick:e[2]||(e[2]=u=>C("close")),class:"px-6 py-2 bg-gradient-to-r from-cyan-500/20 to-cyan-400/20 hover:from-cyan-500/30 hover:to-cyan-400/30 border border-cyan-400/30 rounded-[10px] text-content-primary dark:text-content-primary transition-all duration-200 backdrop-blur-sm"}," Close ")])])])],32)):k("",!0)]),_:1})]))}}),tn=mt(Za,[["__scopeId","data-v-86263c2b"]]),en={class:"glass-card rounded-[20px] p-6"},sn={class:"flex flex-col lg:flex-row lg:justify-between lg:items-center mb-6 gap-4 filter-container"},an={class:"flex items-center gap-2 header-info relative"},nn={class:"text-content-secondary dark:text-content-muted text-sm packet-count"},on=["title"],rn={class:"hidden sm:inline"},ln={key:1,class:"text-accent-red text-sm error-indicator"},dn={class:"flex items-center gap-3 lg:flex filter-controls"},cn={class:"flex flex-col"},un=["value"],pn={class:"flex flex-col"},mn=["value"],xn={class:"flex flex-col"},yn={class:"flex flex-col reset-container"},bn=["disabled"],vn={class:"space-y-4 overflow-hidden"},gn={class:"space-y-4"},hn=["onClick"],fn={class:"hidden lg:grid grid-cols-12 gap-2 items-center"},kn={class:"col-span-1 text-content-primary dark:text-content-primary text-sm"},_n={class:"col-span-1 flex items-center gap-2"},wn={class:"flex flex-col"},$n={class:"text-content-primary dark:text-content-primary text-xs"},Tn=["title"],Cn={class:"col-span-2"},Sn={class:"col-span-1 text-content-primary dark:text-content-primary text-xs"},Rn={class:"col-span-2"},Pn={class:"space-y-1"},An={key:0,class:"flex items-center gap-0.5 flex-wrap"},Dn={key:0,class:"w-2.5 h-2.5 text-content-muted dark:text-content-muted/60",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Mn={key:0,class:"text-[9px] text-content-muted dark:text-content-muted ml-1"},Nn={key:1,class:"flex items-center gap-1"},Bn={class:"inline-block px-2 py-0.5 rounded bg-badge-cyan-bg text-badge-cyan-text text-xs font-mono"},Fn={class:"col-span-1 text-content-primary dark:text-content-primary text-xs"},En={class:"col-span-1 text-content-primary dark:text-content-primary text-xs"},jn={class:"col-span-1 text-content-primary dark:text-content-primary text-xs"},In={class:"col-span-1 text-content-primary dark:text-content-primary text-xs"},Ln={key:0,class:"flex items-center gap-1"},Un={class:"col-span-1"},Vn={key:0,class:"text-accent-red text-[8px] italic truncate"},Hn={class:"lg:hidden space-y-2"},zn={class:"flex items-center justify-between"},Xn={class:"flex items-center gap-2"},Gn={class:"flex flex-col"},On={class:"text-content-primary dark:text-content-primary text-sm font-medium"},Wn=["title"],Qn={class:"flex items-center gap-2 text-right"},qn={class:"text-content-secondary dark:text-content-muted text-xs"},Kn={class:"flex items-center justify-between"},Jn={class:"flex items-center gap-1.5"},Yn={key:0,class:"flex items-center gap-0.5"},Zn={key:0,class:"w-2.5 h-2.5 text-content-muted dark:text-content-muted/60",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},to={key:0,class:"text-[9px] text-content-muted dark:text-content-muted ml-1"},eo={class:"flex items-center gap-1"},so={class:"inline-block px-2 py-0.5 rounded bg-badge-cyan-bg text-badge-cyan-text text-xs font-mono font-semibold"},ao={class:"flex items-center gap-0.5 text-content-muted dark:text-content-muted/60"},no={key:0,class:"text-[9px] font-medium",title:"Multi-hop path"},oo={class:"flex items-center gap-1"},ro={class:"flex items-center gap-2"},lo={class:"flex items-center gap-1"},io={key:0,class:"flex gap-0.5"},co={class:"text-content-primary dark:text-content-primary text-xs"},uo={class:"flex items-center justify-between text-content-secondary dark:text-content-muted text-xs"},po={class:"flex items-center gap-3"},mo={class:"flex items-center gap-2"},xo={key:0,class:"flex items-center gap-1"},yo={key:0,class:"text-accent-red text-xs italic"},bo={key:0,class:"flex justify-between items-center mt-6 pt-4 border-t border-stroke-subtle dark:border-stroke pagination-container"},vo={class:"flex items-center gap-4 pagination-info"},go={class:"text-content-secondary dark:text-content-muted text-sm"},ho={key:0,class:"flex items-center gap-2 load-more-section"},fo=["disabled"],ko={class:"text-content-secondary dark:text-content-muted text-xs load-more-count"},_o={class:"flex items-center gap-2 pagination-controls"},wo=["disabled"],$o={class:"flex items-center gap-1 page-numbers"},To={key:1,class:"text-content-secondary dark:text-content-muted text-sm px-2 ellipsis"},Co=["onClick"],So={key:2,class:"text-content-secondary dark:text-content-muted text-sm px-2 ellipsis"},Ro=["disabled"],Po={key:1,class:"flex justify-center mt-6 pt-4 border-t border-stroke-subtle dark:border-stroke"},Ao={class:"flex items-center gap-4"},Do={class:"text-content-secondary dark:text-content-muted text-sm"},Mo={class:"text-content-secondary dark:text-content-muted text-xs"},No={key:2,class:"flex justify-center mt-6 pt-4 border-t border-stroke-subtle dark:border-stroke"},yt=10,it=1e3,Bo=ct({name:"PacketTable",__name:"PacketTable",setup(nt){const _=gt(),q=kt(),m=B(1),C=B(null),$=B(100),A=B(!1),X=B(!1);let D=null;et(()=>_.isLoading,p=>{p?(D&&(clearTimeout(D),D=null),X.value=!0):D=window.setTimeout(()=>{X.value=!1,D=null},600)});const h=B(null),F=B(!1),O=p=>{h.value=p,F.value=!0},G=()=>{F.value=!1,h.value=null},E=B(Ct("packetTable_selectedType","all")),M=B(Ct("packetTable_selectedRoute","all")),S=B(!1),x=B(null),d=["all","0","1","2","3","4","5","6","7","8","9","10","11"],v=["all","1","2"];et(E,p=>{St("packetTable_selectedType",p),m.value=1}),et(M,p=>{St("packetTable_selectedRoute",p),m.value=1}),et(S,()=>{m.value=1});const g=Y(()=>{let p=_.recentPackets;if(E.value!=="all"){const c=parseInt(E.value);p=p.filter(a=>a.type===c)}if(M.value!=="all"){const c=parseInt(M.value);p=p.filter(a=>a.route===c)}return S.value&&x.value!==null&&(p=p.filter(c=>c.timestamp>=x.value)),p}),N=Y(()=>{const p=(m.value-1)*yt,c=p+yt;return g.value.slice(p,c)}),w=Y(()=>Math.ceil(g.value.length/yt)),s=Y(()=>m.value===w.value),e=Y(()=>_.recentPackets.length>=$.value&&$.values.value&&e.value&&!A.value),i=p=>new Date(p*1e3).toLocaleTimeString(void 0,{hour12:!0}),o=p=>({0:"REQ",1:"RESPONSE",2:"TXT_MSG",3:"ACK",4:"ADVERT",5:"GRP_TXT",6:"GRP_DATA",7:"ANON_REQ",8:"PATH",9:"TRACE",10:"MULTI_PART",11:"CONTROL"})[p]||`TYPE_${p}`,y=p=>({0:"T-Flood",1:"Flood",2:"Direct",3:"T-Direct"})[p]||`Route ${p}`,f=p=>p.transmitted?"text-accent-green":"text-primary",R=p=>p.drop_reason?"Dropped":p.transmitted?"Forward":"Received",j=p=>p===1?"bg-badge-cyan-bg text-badge-cyan-text":"bg-badge-neutral-bg text-badge-neutral-text",U=p=>({0:"bg-primary",1:"bg-accent-green",2:"bg-secondary",3:"bg-accent-purple",4:"bg-accent-red",5:"bg-accent-cyan",6:"bg-primary",7:"bg-accent-purple",8:"bg-accent-green",9:"bg-secondary"})[p]||"bg-gray-500",at=p=>({0:"border-l-primary",1:"border-l-accent-green",2:"border-l-secondary",3:"border-l-accent-purple",4:"border-l-accent-red",5:"border-l-accent-cyan",6:"border-l-primary",7:"border-l-accent-purple",8:"border-l-accent-green",9:"border-l-secondary"})[p]||"border-l-gray-500",I=p=>!p.transmitted||!p.lbt_attempts||p.lbt_attempts===0?"bg-green-400":p.lbt_attempts===1?"bg-cyan-400":p.lbt_attempts===2?"bg-yellow-400":"bg-orange-400",K=p=>p>=1e3?(p/1e3).toFixed(2)+"s":p.toFixed(1)+"ms",V=p=>{if(!p)return[];if(Array.isArray(p))return p;if(typeof p=="string")try{const c=JSON.parse(p);return typeof c=="string"?JSON.parse(c):Array.isArray(c)?c:[]}catch{return[]}return[]},b=p=>{const c=V(p.original_path),a=V(p.forwarded_path),W=c.length>0?c:a;return W.length===0?null:{hops:W.length-1,nodes:W.map(ot=>ot.slice(-4).toUpperCase())}},P=p=>{if(p.type!==4||!p.payload)return null;try{const c=p.payload.replace(/\s+/g,"").toUpperCase();let a=c,W=0;if(c.length/2>=100)if(c.length>200)a=c.slice(200),W=0;else return null;if(a.length>=2){const Z=parseInt(a.slice(0,2),16);W+=2;const Pt=!!(Z&16),At=!!(Z&32),Dt=!!(Z&64);if(!!!(Z&128))return null;if(Pt&&a.length>=W+16&&(W+=16),At&&a.length>=W+4&&(W+=4),Dt&&a.length>=W+4&&(W+=4),a.length>W){const _t=(a.slice(W).match(/.{2}/g)||[]).map(Mt=>{const ht=parseInt(Mt,16);return ht>=32&&ht<=126?String.fromCharCode(ht):"."}).join("").replace(/\.*$/,"");return _t.length>0?_t:null}}}catch(c){console.error("Error parsing ADVERT node name:",c)}return null},z=()=>{E.value="all",M.value="all",S.value=!1,x.value=null,m.value=1},L=()=>{S.value?(S.value=!1,x.value=null):(S.value=!0,x.value=Date.now()/1e3),m.value=1},tt=Y(()=>x.value?new Date(x.value*1e3).toLocaleTimeString(void 0,{hour12:!0}):""),J=async p=>{try{const c=p||$.value;await _.fetchRecentPackets({limit:c})}catch(c){console.error("Error fetching packet data:",c)}},lt=async()=>{if(!(A.value||$.value>=it)){A.value=!0;try{const p=Math.min($.value+200,it);$.value=p,await J(p)}catch(p){console.error("Error loading more records:",p)}finally{A.value=!1}}};return bt(async()=>{await J(),q.isConnected||(C.value=window.setInterval(J,1e4))}),et(()=>q.isConnected,p=>{p?C.value&&(clearInterval(C.value),C.value=null):C.value||(C.value=window.setInterval(J,1e4))}),vt(()=>{C.value&&clearInterval(C.value),D&&clearTimeout(D)}),(p,c)=>(r(),l(H,null,[t("div",en,[t("div",sn,[t("div",an,[c[7]||(c[7]=t("h3",{class:"text-content-primary dark:text-content-primary text-xl font-semibold"},"Recent Packets",-1)),t("span",nn," ("+n(g.value.length)+" of "+n(pt(_).recentPackets.length)+") ",1),S.value?(r(),l("span",{key:0,class:"text-primary text-xs sm:text-sm bg-primary/10 px-2 py-1 rounded-md border border-primary/20 live-mode-badge whitespace-nowrap",title:`Filter activated at ${tt.value}`},[t("span",rn,"Live Mode (since "+n(tt.value)+")",1),c[6]||(c[6]=t("span",{class:"sm:hidden"},"Live",-1))],8,on)):k("",!0),pt(_).error?(r(),l("span",ln,n(pt(_).error),1)):k("",!0)]),t("div",dn,[t("div",cn,[c[8]||(c[8]=t("label",{class:"text-content-secondary dark:text-content-muted text-xs mb-1"},"Type",-1)),$t(t("select",{"onUpdate:modelValue":c[0]||(c[0]=a=>E.value=a),class:"glass-card border border-stroke-subtle dark:border-stroke rounded-[10px] px-3 py-2 text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary/20 transition-all duration-200 min-w-[120px] cursor-pointer hover:border-primary/50"},[(r(),l(H,null,Q(d,a=>t("option",{key:a,value:a,class:"bg-surface dark:bg-surface-elevated text-content-primary dark:text-content-primary"},n(a==="all"?"All Types":`Type ${a} (${o(parseInt(a))})`),9,un)),64))],512),[[Tt,E.value]])]),t("div",pn,[c[9]||(c[9]=t("label",{class:"text-content-secondary dark:text-content-muted text-xs mb-1"},"Route",-1)),$t(t("select",{"onUpdate:modelValue":c[1]||(c[1]=a=>M.value=a),class:"glass-card border border-stroke-subtle dark:border-stroke rounded-[10px] px-3 py-2 text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary/20 transition-all duration-200 min-w-[120px] cursor-pointer hover:border-primary/50"},[(r(),l(H,null,Q(v,a=>t("option",{key:a,value:a,class:"bg-surface dark:bg-surface-elevated text-content-primary dark:text-content-primary"},n(a==="all"?"All Routes":`Route ${a} (${y(parseInt(a))})`),9,mn)),64))],512),[[Tt,M.value]])]),t("div",xn,[c[10]||(c[10]=t("label",{class:"text-content-secondary dark:text-content-muted text-xs mb-1"},"Filter",-1)),t("button",{onClick:L,class:T(["glass-card border rounded-[10px] px-4 py-2 text-sm transition-all duration-200 focus:outline-none focus:ring-1 focus:ring-primary/20 min-w-[120px]",{"border-primary bg-primary/10 text-primary":S.value,"border-stroke-subtle dark:border-stroke text-content-secondary dark:text-content-muted hover:border-primary hover:text-content-primary dark:hover:text-content-primary hover:bg-primary/5":!S.value}])},n(S.value?"New Only":"Show New"),3)]),t("div",yn,[c[11]||(c[11]=t("label",{class:"text-transparent text-xs mb-1"},".",-1)),t("button",{onClick:z,class:T(["glass-card border border-stroke-subtle dark:border-stroke hover:border-primary rounded-[10px] px-4 py-2 text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary text-sm transition-all duration-200 focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary/20",{"opacity-50 cursor-not-allowed hover:border-stroke-subtle dark:hover:border-stroke hover:text-content-secondary dark:hover:text-content-muted":E.value==="all"&&M.value==="all"&&!S.value,"hover:bg-primary/10":E.value!=="all"||M.value!=="all"||S.value}]),disabled:E.value==="all"&&M.value==="all"&&!S.value}," Reset ",10,bn)])])]),c[25]||(c[25]=Rt('Time
Type
Route
LEN
Path/Hashes
RSSI
SNR
Score
TX Delay
Status
',1)),t("div",vn,[t("div",gn,[(r(!0),l(H,null,Q(N.value,(a,W)=>(r(),l("div",{key:`${a.packet_hash}_${a.timestamp}_${W}`,class:T(["packet-row border-b border-stroke-subtle dark:border-dark-border/50 pb-4 hover:bg-background-mute dark:hover:bg-stroke/5 transition-colors duration-150 cursor-pointer rounded-[10px] p-2 border-l-4",at(a.type)]),onClick:ot=>O(a)},[t("div",fn,[t("div",kn,n(i(a.timestamp)),1),t("div",_n,[t("div",{class:T(["w-2 h-2 rounded-full",U(a.type)])},null,2),t("div",wn,[t("span",$n,n(o(a.type)),1),a.type===4&&P(a)?(r(),l("span",{key:0,class:"text-accent-red/70 text-[10px] font-medium max-w-[80px] truncate",title:P(a)||void 0},n(P(a)),9,Tn)):k("",!0)])]),t("div",Cn,[t("span",{class:T(["inline-block px-2 py-1 rounded text-xs font-medium",j(a.route)])},n(y(a.route)),3)]),t("div",Sn,n(a.length)+"B",1),t("div",Rn,[t("div",Pn,[b(a)?(r(),l("div",An,[(r(!0),l(H,null,Q(b(a).nodes,(ot,Z)=>(r(),l(H,{key:Z},[t("span",{class:T(["inline-block px-1.5 py-0.5 rounded text-[10px] font-mono font-semibold",Z===0?"bg-badge-cyan-bg text-badge-cyan-text":"bg-gray-500/20 text-content-muted dark:text-content-muted"])},n(ot),3),Z0?(r(),l("span",Mn," ("+n(b(a).hops)+" hop"+n(b(a).hops>1?"s":"")+") ",1)):k("",!0)])):(r(),l("div",Nn,[t("span",Bn,n(a.src_hash?.slice(-4).toUpperCase()||"????"),1),c[13]||(c[13]=t("svg",{class:"w-3 h-3 text-content-muted dark:text-content-muted/60",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2.5",d:"M9 5l7 7-7 7"})],-1)),t("span",{class:T(["inline-block px-2 py-0.5 rounded text-xs font-mono",a.dst_hash?"bg-badge-cyan-bg text-badge-cyan-text":"bg-yellow-500/20 text-yellow-700 dark:text-yellow-300"])},n(a.dst_hash?a.dst_hash.slice(-4).toUpperCase():"BCAST"),3)]))])]),t("div",Fn,n(a.rssi!=null?a.rssi.toFixed(0):"N/A"),1),t("div",En,n(a.snr!=null?a.snr.toFixed(1)+"dB":"N/A"),1),t("div",jn,n(a.score!=null?a.score.toFixed(2):"N/A"),1),t("div",In,[Number(a.tx_delay_ms)>0?(r(),l("div",Ln,[a.transmitted?(r(),l("div",{key:0,class:T(["w-1.5 h-1.5 rounded-full flex-shrink-0",I(a)])},null,2)):k("",!0),t("span",null,n(K(Number(a.tx_delay_ms))),1)])):k("",!0)]),t("div",Un,[t("div",null,[t("span",{class:T(["text-xs font-medium",f(a)])},n(R(a)),3),a.drop_reason?(r(),l("p",Vn,n(a.drop_reason),1)):k("",!0)])])]),t("div",Hn,[t("div",zn,[t("div",Xn,[t("div",{class:T(["w-2 h-2 rounded-full flex-shrink-0",U(a.type)])},null,2),t("div",Gn,[t("span",On,n(o(a.type)),1),a.type===4&&P(a)?(r(),l("span",{key:0,class:"text-accent-red/70 text-[10px] font-medium leading-tight",title:P(a)||void 0},n(P(a)),9,Wn)):k("",!0)]),t("span",{class:T(["inline-block px-2 py-1 rounded text-xs font-medium ml-2",j(a.route)])},n(y(a.route)),3)]),t("div",Qn,[t("span",qn,n(i(a.timestamp)),1),t("span",{class:T(["text-xs font-medium",f(a)])},n(R(a)),3)])]),t("div",Kn,[t("div",Jn,[b(a)?(r(),l("div",Yn,[c[15]||(c[15]=t("span",{class:"text-content-muted dark:text-content-muted text-[10px] font-medium"},"PATH",-1)),(r(!0),l(H,null,Q(b(a).nodes,(ot,Z)=>(r(),l(H,{key:Z},[t("span",{class:T(["inline-block px-1.5 py-0.5 rounded text-[10px] font-mono font-semibold",Z===0?"bg-badge-cyan-bg text-badge-cyan-text":"bg-gray-500/20 text-content-muted dark:text-content-muted"])},n(ot),3),Z0?(r(),l("span",to," ("+n(b(a).hops)+" hop"+n(b(a).hops>1?"s":"")+") ",1)):k("",!0)])):(r(),l(H,{key:1},[t("div",eo,[c[16]||(c[16]=t("span",{class:"text-content-muted dark:text-content-muted text-[10px] font-medium"},"SRC",-1)),t("span",so,n(a.src_hash?.slice(-4)||"????"),1)]),t("div",ao,[c[18]||(c[18]=t("svg",{class:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2.5",d:"M9 5l7 7-7 7"})],-1)),a.route===1?(r(),l("span",no,c[17]||(c[17]=[t("svg",{class:"w-2.5 h-2.5 inline",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 5l7 7-7 7M5 5l7 7-7 7"})],-1)]))):k("",!0)]),t("div",oo,[t("span",{class:T(["inline-block px-2 py-0.5 rounded text-xs font-mono font-semibold",a.dst_hash?"bg-badge-cyan-bg text-badge-cyan-text":"bg-yellow-500/20 text-yellow-700 dark:text-yellow-300"])},n(a.dst_hash?a.dst_hash.slice(-4).toUpperCase():"BCAST"),3),c[19]||(c[19]=t("span",{class:"text-content-muted dark:text-content-muted text-[10px] font-medium"},"DST",-1))])],64))]),t("div",ro,[t("div",lo,[a.snr!=null?(r(),l("div",io,[t("div",{class:T(["w-1 h-3 rounded-sm",a.snr>=-10?"bg-green-400":"bg-white/20"])},null,2),t("div",{class:T(["w-1 h-4 rounded-sm",a.snr>=-5?"bg-green-400":"bg-white/20"])},null,2),t("div",{class:T(["w-1 h-5 rounded-sm",a.snr>=0?"bg-green-400":"bg-white/20"])},null,2),t("div",{class:T(["w-1 h-6 rounded-sm",a.snr>=10?"bg-green-400":"bg-white/20"])},null,2)])):k("",!0),t("span",co,n(a.rssi!=null?a.rssi.toFixed(0)+"dBm":"TX"),1)])])]),t("div",uo,[t("div",po,[t("span",null,n(a.length)+"B",1),t("span",null,"SNR: "+n(a.snr!=null?a.snr.toFixed(1)+"dB":"N/A"),1),t("span",null,"Score: "+n(a.score!=null?a.score.toFixed(2):"N/A"),1)]),t("div",mo,[Number(a.tx_delay_ms)>0?(r(),l("span",xo,[a.transmitted?(r(),l("div",{key:0,class:T(["w-1.5 h-1.5 rounded-full flex-shrink-0",I(a)])},null,2)):k("",!0),t("span",null,n(K(Number(a.tx_delay_ms))),1)])):k("",!0)])]),a.drop_reason?(r(),l("div",yo,n(a.drop_reason),1)):k("",!0)])],10,hn))),128))])]),w.value>1?(r(),l("div",bo,[t("div",vo,[t("span",go," Showing "+n((m.value-1)*yt+1)+" - "+n(Math.min(m.value*yt,g.value.length))+" of "+n(g.value.length)+" packets ",1),u.value?(r(),l("div",ho,[c[20]||(c[20]=t("span",{class:"text-content-secondary dark:text-content-muted text-xs"},"•",-1)),t("button",{onClick:lt,disabled:A.value,class:T(["glass-card border border-primary rounded-[8px] px-3 py-1.5 text-xs transition-all duration-200 focus:outline-none focus:ring-1 focus:ring-primary/20 hover:bg-primary/5",{"text-primary border-primary cursor-pointer":!A.value,"text-content-secondary dark:text-content-muted border-stroke-subtle dark:border-stroke cursor-not-allowed opacity-50":A.value}])},n(A.value?"Loading...":`Load ${Math.min(200,it-$.value)} more`),11,fo),t("span",ko,"("+n($.value)+"/"+n(it)+" max)",1)])):k("",!0)]),t("div",_o,[t("button",{onClick:c[2]||(c[2]=a=>m.value=m.value-1),disabled:m.value<=1,class:T(["glass-card border rounded-[10px] px-3 py-2 text-sm transition-all duration-200 focus:outline-none focus:ring-1 focus:ring-primary/20 prev-next-btn",{"border-stroke-subtle dark:border-stroke text-content-muted dark:text-content-muted cursor-not-allowed opacity-50":m.value<=1,"border-stroke-subtle dark:border-stroke text-content-primary dark:text-content-primary hover:border-primary hover:text-primary hover:bg-primary/5":m.value>1}])},c[21]||(c[21]=[t("span",{class:"hidden sm:inline"},"Previous",-1),t("span",{class:"sm:hidden"},"‹",-1)]),10,wo),t("div",$o,[m.value>3?(r(),l("button",{key:0,onClick:c[3]||(c[3]=a=>m.value=1),class:"glass-card border border-stroke-subtle dark:border-stroke hover:border-primary rounded-[8px] px-3 py-2 text-sm text-content-primary dark:text-content-primary hover:text-primary hover:bg-primary/5 transition-all duration-200 focus:outline-none focus:ring-1 focus:ring-primary/20"}," 1 ")):k("",!0),m.value>4?(r(),l("span",To,"...")):k("",!0),(r(!0),l(H,null,Q(Array.from({length:Math.min(5,w.value)},(a,W)=>Math.max(1,Math.min(m.value-2,w.value-4))+W).filter(a=>a<=w.value),a=>(r(),l("button",{key:a,onClick:W=>m.value=a,class:T(["glass-card border rounded-[8px] px-3 py-2 text-sm transition-all duration-200 focus:outline-none focus:ring-1 focus:ring-primary/20 page-number",{"border-primary bg-primary/10 text-primary":m.value===a,"border-stroke-subtle dark:border-stroke text-content-primary dark:text-content-primary hover:border-primary hover:text-primary hover:bg-primary/5":m.value!==a}])},n(a),11,Co))),128)),m.valuem.value=w.value),class:"glass-card border border-stroke-subtle dark:border-stroke hover:border-primary rounded-[8px] px-3 py-2 text-sm text-content-primary dark:text-content-primary hover:text-primary hover:bg-primary/5 transition-all duration-200 focus:outline-none focus:ring-1 focus:ring-primary/20"},n(w.value),1)):k("",!0)]),t("button",{onClick:c[5]||(c[5]=a=>m.value=m.value+1),disabled:m.value>=w.value,class:T(["glass-card border rounded-[10px] px-3 py-2 text-sm transition-all duration-200 focus:outline-none focus:ring-1 focus:ring-primary/20 prev-next-btn",{"border-stroke-subtle dark:border-stroke text-content-muted dark:text-content-muted cursor-not-allowed opacity-50":m.value>=w.value,"border-stroke-subtle dark:border-stroke text-content-primary dark:text-content-primary hover:border-primary hover:text-primary hover:bg-primary/5":m.value(r(),l("div",null,[st(ee),t("div",Eo,[st(je),st(fe)]),st(Fo)]))}});export{Xo as default};
diff --git a/repeater/web/html/assets/Help-CCI0ZxhR.js b/repeater/web/html/assets/Help-CCI0ZxhR.js
new file mode 100644
index 0000000..9fe16ac
--- /dev/null
+++ b/repeater/web/html/assets/Help-CCI0ZxhR.js
@@ -0,0 +1 @@
+import{a as e,b as r,i as o,p as n}from"./index-D0IT5vDS.js";const d=e({name:"HelpView",__name:"Help",setup(a){return(i,t)=>(n(),r("div",null,t[0]||(t[0]=[o('Help & Documentation
pyMC Repeater Wiki
Access documentation, setup guides, troubleshooting tips, and community resources on our official wiki.
Visit Wiki Documentation Opens in a new tab
',1)])))}});export{d as default};
diff --git a/repeater/web/html/assets/Login-BNn34coJ.js b/repeater/web/html/assets/Login-BNn34coJ.js
new file mode 100644
index 0000000..0821862
--- /dev/null
+++ b/repeater/web/html/assets/Login-BNn34coJ.js
@@ -0,0 +1 @@
+import{a as P,r as a,b as i,g,s as _,e,w as v,v as h,t as y,k as M,y as S,p as u,f as w,_ as $,i as N,G as j,C as B,z as D,m as I,A as L,B as C,x as U}from"./index-D0IT5vDS.js";const q={class:"glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/20 rounded-[15px] p-6 max-w-md w-full shadow-2xl"},E={key:0,class:"bg-red-500/10 border border-red-500/30 rounded-lg p-3"},z={class:"text-red-600 dark:text-red-400 text-sm"},T={key:1,class:"bg-green-500/10 border border-green-600/40 dark:border-green-500/30 rounded-lg p-3"},G={class:"text-green-600 dark:text-green-400 text-sm"},H={class:"flex justify-end gap-3 mt-6"},F=["disabled"],O=["disabled"],R={key:0,class:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"},A=P({name:"ChangePasswordModal",__name:"ChangePasswordModal",props:{isOpen:{type:Boolean},canSkip:{type:Boolean,default:!0}},emits:["close","success"],setup(V,{emit:x}){const p=x,l=a(""),s=a(""),d=a(""),o=a(!1),n=a(""),m=a(""),f=()=>{o.value||p("close")},k=()=>{p("close")},c=async()=>{if(n.value="",m.value="",s.value.length<8){n.value="New password must be at least 8 characters long";return}if(s.value!==d.value){n.value="Passwords do not match";return}if(s.value===l.value){n.value="New password must be different from current password";return}o.value=!0;try{const r=(await S.post("/auth/change_password",{current_password:l.value,new_password:s.value})).data;r&&r.success?(m.value=r.message||"Password changed successfully!",setTimeout(()=>{p("success"),p("close")},1500)):n.value=r?.error||"Failed to change password"}catch(t){console.error("Password change error:",t),n.value=t.response?.data?.error||"Failed to change password. Please try again."}finally{o.value=!1}};return(t,r)=>t.isOpen?(u(),i("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:_(f,["self"])},[e("div",q,[r[6]||(r[6]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary mb-2"},"Change Default Password",-1)),r[7]||(r[7]=e("p",{class:"text-content-secondary dark:text-content-muted text-sm mb-6"}," You're using the default password. Please change it to secure your account. ",-1)),e("form",{onSubmit:_(c,["prevent"]),class:"space-y-4"},[e("div",null,[r[3]||(r[3]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-primary/70 mb-2"},"Current Password",-1)),v(e("input",{"onUpdate:modelValue":r[0]||(r[0]=b=>l.value=b),type:"password",required:"",class:"w-full px-4 py-2 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary transition-colors",placeholder:"Enter current password"},null,512),[[h,l.value]])]),e("div",null,[r[4]||(r[4]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-primary/70 mb-2"},"New Password",-1)),v(e("input",{"onUpdate:modelValue":r[1]||(r[1]=b=>s.value=b),type:"password",required:"",minlength:"8",class:"w-full px-4 py-2 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary transition-colors",placeholder:"Enter new password (min 8 characters)"},null,512),[[h,s.value]])]),e("div",null,[r[5]||(r[5]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-primary/70 mb-2"},"Confirm New Password",-1)),v(e("input",{"onUpdate:modelValue":r[2]||(r[2]=b=>d.value=b),type:"password",required:"",minlength:"8",class:"w-full px-4 py-2 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary transition-colors",placeholder:"Confirm new password"},null,512),[[h,d.value]])]),n.value?(u(),i("div",E,[e("p",z,y(n.value),1)])):g("",!0),m.value?(u(),i("div",T,[e("p",G,y(m.value),1)])):g("",!0),e("div",H,[t.canSkip?(u(),i("button",{key:0,type:"button",onClick:k,disabled:o.value,class:"px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/10 transition-colors disabled:opacity-50"}," Skip for Now ",8,F)):g("",!0),e("button",{type:"submit",disabled:o.value,class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-white rounded-lg border border-primary/50 transition-colors disabled:opacity-50 flex items-center gap-2"},[o.value?(u(),i("div",R)):g("",!0),M(" "+y(o.value?"Changing...":"Change Password"),1)],8,O)])],32)])])):g("",!0)}}),Y={class:"min-h-screen bg-background dark:bg-background overflow-hidden relative flex items-start sm:items-center justify-center p-2 sm:p-4 pt-8 sm:pt-4"},J={class:"absolute top-4 right-4 z-20"},K={class:"login-card relative z-10 w-full max-w-md p-6 sm:p-10 rounded-[16px] sm:rounded-[24px] border-0 sm:border sm:border-stroke-subtle dark:sm:border-stroke/20 shadow-[0_8px_32px_0_rgba(0,0,0,0.1)] dark:shadow-[0_8px_32px_0_rgba(0,0,0,0.37)] backdrop-blur-xl"},Q={class:"relative login-content"},W={class:"form-group"},X={class:"relative"},Z=["disabled"],ee={class:"form-group"},te={class:"relative"},re=["disabled"],se={key:0,class:"bg-red-500/10 border border-red-500/30 rounded-[12px] p-2.5 sm:p-3.5 backdrop-blur-sm animate-shake"},oe={class:"text-red-600 dark:text-red-400 text-xs sm:text-sm font-medium"},ae=["disabled"],ne={key:0,class:"w-4 h-4 sm:w-5 sm:h-5 border-2 border-white border-t-transparent rounded-full animate-spin"},le={key:1,class:"w-4 h-4 sm:w-5 sm:h-5 group-hover:translate-x-1 transition-transform duration-300",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},de={class:"relative"},ie={class:"mt-6 sm:mt-8 pt-4 sm:pt-6 border-t border-stroke-subtle dark:border-stroke/10"},ue={class:"flex items-center justify-center gap-3"},pe={href:"https://github.com/rightup",target:"_blank",class:"inline-flex items-center justify-center w-9 h-9 sm:w-10 sm:h-10 rounded-xl bg-content-primary dark:bg-white/10 border border-stroke-subtle dark:border-stroke/20 hover:bg-primary/20 dark:hover:bg-primary/30 hover:border-primary/50 transition-all duration-300 hover:scale-110 group backdrop-blur-sm",title:"GitHub"},ce={href:"https://buymeacoffee.com/rightup",target:"_blank",class:"inline-flex items-center justify-center w-9 h-9 sm:w-10 sm:h-10 rounded-xl bg-content-primary dark:bg-white/10 border border-stroke-subtle dark:border-stroke/20 hover:bg-yellow-50 dark:hover:bg-yellow-500/20 hover:border-yellow-500/50 transition-all duration-300 hover:scale-110 group backdrop-blur-sm",title:"Buy Me a Coffee"},me=P({name:"LoginView",__name:"Login",setup(V){const x=I(),p=a("admin"),l=a(""),s=a(!1),d=a(""),o=a(!1),n=a(!1),m=async()=>{d.value="",s.value=!0;try{const c=L(),r=(await S.post("/auth/login",{username:p.value,password:l.value,client_id:c})).data;r.success&&r.token?l.value==="admin123"?(C(r.token),n.value=!0,o.value=!0):(C(r.token),x.push("/")):d.value=r.error||"Login failed"}catch(c){console.error("Login error:",c);const t=c;d.value=t.response?.data?.error||"Connection error. Please try again."}finally{s.value=!1}},f=()=>{o.value=!1,x.push("/")},k=()=>{o.value=!1,n.value&&x.push("/")};return(c,t)=>(u(),i("div",Y,[e("div",J,[w($)]),t[9]||(t[9]=e("div",{class:"bg-gradient-light dark:bg-gradient-dark absolute rounded-full -rotate-[24.22deg] w-[705px] h-[512px] blur-[120px] opacity-80 animate-pulse-slow -top-[79px] left-[575px] mix-blend-multiply dark:mix-blend-screen pointer-events-none"},null,-1)),t[10]||(t[10]=e("div",{class:"bg-gradient-light dark:bg-gradient-dark absolute rounded-full -rotate-[24.22deg] w-[705px] h-[512px] blur-[120px] opacity-75 animate-pulse-slower -top-[94px] -left-[92px] mix-blend-multiply dark:mix-blend-screen pointer-events-none"},null,-1)),t[11]||(t[11]=e("div",{class:"bg-gradient-light dark:bg-gradient-dark absolute rounded-full -rotate-[24.22deg] w-[705px] h-[512px] blur-[120px] opacity-80 animate-pulse-slowest top-[373px] left-[246px] mix-blend-multiply dark:mix-blend-screen pointer-events-none"},null,-1)),e("div",K,[t[8]||(t[8]=e("div",{class:"absolute inset-0 rounded-[24px] bg-gradient-to-br from-primary/3 dark:from-primary/5 to-transparent pointer-events-none"},null,-1)),e("div",Q,[t[7]||(t[7]=N('Sign in to access your dashboard
',1)),e("form",{onSubmit:_(m,["prevent"]),class:"space-y-4 sm:space-y-5"},[e("div",W,[t[3]||(t[3]=e("label",{for:"username",class:"block text-content-secondary dark:text-content-primary/90 text-xs sm:text-sm font-medium mb-2"}," Username ",-1)),e("div",X,[v(e("input",{id:"username","onUpdate:modelValue":t[0]||(t[0]=r=>p.value=r),type:"text",autocomplete:"username",required:"",class:"input-glass w-full px-3 sm:px-4 py-2.5 sm:py-3.5 rounded-[12px] text-content-primary dark:text-content-primary text-sm placeholder-gray-400 dark:placeholder-white/30 focus:outline-none focus:border-primary/50 transition-all duration-300",placeholder:"Enter username",disabled:s.value},null,8,Z),[[h,p.value]]),t[2]||(t[2]=e("div",{class:"absolute inset-0 rounded-[12px] pointer-events-none input-glow"},null,-1))])]),e("div",ee,[t[5]||(t[5]=e("label",{for:"password",class:"block text-content-secondary dark:text-content-primary/90 text-xs sm:text-sm font-medium mb-2"}," Password ",-1)),e("div",te,[v(e("input",{id:"password","onUpdate:modelValue":t[1]||(t[1]=r=>l.value=r),type:"password",autocomplete:"current-password",required:"",class:"input-glass w-full px-3 sm:px-4 py-2.5 sm:py-3.5 rounded-[12px] text-content-primary dark:text-content-primary text-sm placeholder-gray-400 dark:placeholder-white/30 focus:outline-none focus:border-primary/50 transition-all duration-300",placeholder:"Enter password",disabled:s.value},null,8,re),[[h,l.value]]),t[4]||(t[4]=e("div",{class:"absolute inset-0 rounded-[12px] pointer-events-none input-glow"},null,-1))])]),d.value?(u(),i("div",se,[e("p",oe,y(d.value),1)])):g("",!0),e("button",{type:"submit",disabled:s.value,class:"button-glass w-full relative overflow-hidden bg-primary/20 hover:bg-primary/30 active:scale-[0.98] text-primary dark:text-white font-semibold py-3 sm:py-4 px-4 rounded-[12px] border border-primary/50 hover:border-primary/60 transition-all duration-300 focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2 sm:gap-2.5 group mt-6 sm:mt-8 text-sm sm:text-base backdrop-blur-sm"},[s.value?(u(),i("div",ne)):(u(),i("svg",le,t[6]||(t[6]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M11 16l-4-4m0 0l4-4m-4 4h14m-5 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h7a3 3 0 013 3v1"},null,-1)]))),e("span",de,y(s.value?"Signing in...":"Sign In"),1)],8,ae)],32),e("div",ie,[e("div",ue,[e("a",pe,[w(j,{class:"w-5 h-5 sm:w-6 sm:h-6 text-white group-hover:text-primary transition-colors"})]),e("a",ce,[w(B,{class:"w-5 h-5 sm:w-6 sm:h-6 text-white group-hover:text-yellow-500 transition-colors"})])])])])]),w(A,{"is-open":o.value,"can-skip":!0,onClose:k,onSuccess:f},null,8,["is-open"])]))}}),ge=U(me,[["__scopeId","data-v-7d3a3377"]]);export{ge as default};
diff --git a/repeater/web/html/assets/Logs-DVI_WQtv.js b/repeater/web/html/assets/Logs-DVI_WQtv.js
new file mode 100644
index 0000000..cb6bac8
--- /dev/null
+++ b/repeater/web/html/assets/Logs-DVI_WQtv.js
@@ -0,0 +1 @@
+import{a as j,r as i,c as w,o as H,H as T,b as s,e as o,k as $,j as h,t as c,g as q,F as L,h as N,i as J,L as K,p as n}from"./index-D0IT5vDS.js";const P={class:"space-y-6"},Q={class:"glass-card backdrop-blur border border-stroke-subtle dark:border-white/10 rounded-[15px] p-6"},X={class:"flex items-center justify-between mb-4"},Y=["disabled"],Z={class:"bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4"},ee={class:"flex flex-wrap gap-2"},te=["onClick"],re={key:0,class:"w-px h-6 bg-stroke-subtle dark:bg-stroke/20 mx-2 self-center"},oe=["onClick"],se={class:"glass-card backdrop-blur border border-stroke-subtle dark:border-white/10 rounded-[15px] overflow-hidden"},ne={key:0,class:"p-8 text-center"},ae={key:1,class:"p-8 text-center"},le={class:"text-content-secondary dark:text-content-muted mb-4"},de={key:2,class:"max-h-[600px] overflow-y-auto"},ce={key:0,class:"p-8 text-center"},ie={key:1,class:"divide-y divide-gray-200 dark:divide-white/5"},ue={class:"flex-shrink-0 text-content-secondary dark:text-content-muted"},ge={class:"flex-shrink-0 px-2 py-1 text-xs font-medium rounded bg-blue-500/20 text-blue-600 dark:text-blue-400"},be={class:"text-content-primary dark:text-content-primary flex-1 break-all"},ve=j({name:"LogsView",__name:"Logs",setup(xe){const x=i([]),a=i(new Set),d=i(new Set(["DEBUG","INFO","WARNING","ERROR"])),v=i(new Set),p=i(new Set),m=i(!0),k=i(null);let u=null;const f=t=>{const e=t.match(/- ([^-]+) - (?:DEBUG|INFO|WARNING|ERROR) -/);return e?e[1].trim():"Unknown"},S=t=>{const e=t.match(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3} - [^-]+ - (?:DEBUG|INFO|WARNING|ERROR) - (.+)$/);return e?e[1]:t},R=(t,e)=>{if(t.size!==e.size)return!1;for(const r of t)if(!e.has(r))return!1;return!0},y=async()=>{try{const t=await K.getLogs();if(t.logs&&t.logs.length>0){x.value=t.logs;const e=new Set;x.value.forEach(b=>{const z=f(b.message);e.add(z)});const r=new Set;x.value.forEach(b=>{r.add(b.level)}),a.value.size===0&&(a.value=new Set(e));const l=!R(v.value,e),g=!R(p.value,r);l&&(v.value=e),g&&(p.value=r),k.value=null}}catch(t){console.error("Error loading logs:",t),k.value=t instanceof Error?t.message:"Failed to load logs"}finally{m.value=!1}},_=w(()=>x.value.filter(e=>{const r=f(e.message),l=a.value.has(r),g=d.value.has(e.level);return l&&g})),C=w(()=>Array.from(v.value).sort()),A=w(()=>{const t=["ERROR","WARNING","WARN","INFO","DEBUG"];return Array.from(p.value).sort((r,l)=>{const g=t.indexOf(r),b=t.indexOf(l);return g!==-1&&b!==-1?g-b:r.localeCompare(l)})}),I=t=>{d.value.has(t)?d.value.delete(t):d.value.add(t),d.value=new Set(d.value)},O=t=>new Date(t).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),B=t=>({ERROR:"text-red-600 dark:text-red-400 bg-red-900/20",WARNING:"text-yellow-600 dark:text-yellow-400 bg-yellow-900/20",WARN:"text-yellow-600 dark:text-yellow-400 bg-yellow-900/20",INFO:"text-blue-600 dark:text-blue-400 bg-blue-900/20",DEBUG:"text-gray-400 bg-gray-900/20"})[t]||"text-gray-400 bg-gray-900/20",E=(t,e)=>e?{ERROR:"bg-red-100 dark:bg-red-500/20 text-red-600 dark:text-red-400 border-red-500/50",WARNING:"bg-yellow-100 dark:bg-yellow-500/20 text-yellow-600 dark:text-yellow-400 border-yellow-500/50",WARN:"bg-yellow-100 dark:bg-yellow-500/20 text-yellow-600 dark:text-yellow-400 border-yellow-500/50",INFO:"bg-blue-500/20 text-blue-600 dark:text-blue-400 border-blue-500/50",DEBUG:"bg-gray-500/20 text-gray-400 border-gray-500/50"}[t]||"bg-primary/20 text-primary border-primary/50":"bg-background-mute dark:bg-white/5 text-content-muted dark:text-white/60 border-stroke-subtle dark:border-white/20 hover:bg-stroke-subtle dark:hover:bg-white/10",G=t=>{a.value.has(t)?a.value.delete(t):a.value.add(t),a.value=new Set(a.value)},F=()=>{a.value=new Set(v.value)},M=()=>{a.value=new Set},D=()=>{d.value=new Set(p.value)},U=()=>{d.value=new Set},W=()=>{u&&clearInterval(u),u=setInterval(y,5e3)},V=()=>{u&&(clearInterval(u),u=null)};return H(()=>{y(),W()}),T(()=>{V()}),(t,e)=>(n(),s("div",P,[o("div",Q,[o("div",X,[e[1]||(e[1]=o("div",null,[o("h1",{class:"text-content-primary dark:text-content-primary text-2xl font-semibold mb-2"},"System Logs"),o("p",{class:"text-content-secondary dark:text-content-muted"},"Real-time system events and diagnostics")],-1)),o("button",{onClick:y,disabled:m.value,class:"flex items-center gap-2 px-4 py-2 bg-primary/20 hover:bg-primary/30 text-primary border border-primary/50 rounded-lg transition-colors disabled:opacity-50"},[(n(),s("svg",{class:h(["w-4 h-4",{"animate-spin":m.value}]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e[0]||(e[0]=[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"},null,-1)]),2)),$(" "+c(m.value?"Loading...":"Refresh"),1)],8,Y)]),o("div",Z,[o("div",{class:"flex flex-wrap items-center gap-3 mb-4"},[e[2]||(e[2]=o("span",{class:"text-content-primary dark:text-content-primary font-medium"},"Filters:",-1)),o("button",{onClick:F,class:"px-3 py-1 text-xs bg-accent-green/20 hover:bg-accent-green/30 text-accent-green border border-accent-green/50 rounded transition-colors"}," All Loggers "),o("button",{onClick:M,class:"px-3 py-1 text-xs bg-accent-red/20 hover:bg-accent-red/30 text-accent-red border border-accent-red/50 rounded transition-colors"}," Clear Loggers "),e[3]||(e[3]=o("div",{class:"w-px h-4 bg-white/20 mx-1"},null,-1)),o("button",{onClick:D,class:"px-3 py-1 text-xs bg-accent-green/20 hover:bg-accent-green/30 text-accent-green border border-accent-green/50 rounded transition-colors"}," All Levels "),o("button",{onClick:U,class:"px-3 py-1 text-xs bg-accent-red/20 hover:bg-accent-red/30 text-accent-red border border-accent-red/50 rounded transition-colors"}," Clear Levels ")]),o("div",ee,[(n(!0),s(L,null,N(C.value,r=>(n(),s("button",{key:"logger-"+r,onClick:l=>G(r),class:h(["px-3 py-1 text-xs border rounded-full transition-colors",a.value.has(r)?"bg-primary/20 text-primary border-primary/50":"bg-background-mute dark:bg-white/5 text-content-secondary dark:text-content-muted border-stroke-subtle dark:border-stroke/20 hover:bg-stroke-subtle dark:hover:bg-white/10"])},c(r),11,te))),128)),C.value.length>0&&A.value.length>0?(n(),s("div",re)):q("",!0),(n(!0),s(L,null,N(A.value,r=>(n(),s("button",{key:"level-"+r,onClick:l=>I(r),class:h(["px-3 py-1 text-xs border rounded-full transition-colors font-medium",d.value.has(r)?E(r,!0):E(r,!1)])},c(r),11,oe))),128))])])]),o("div",se,[m.value&&x.value.length===0?(n(),s("div",ne,e[4]||(e[4]=[o("div",{class:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"},null,-1),o("p",{class:"text-content-secondary dark:text-content-muted"},"Loading system logs...",-1)]))):k.value?(n(),s("div",ae,[e[5]||(e[5]=o("div",{class:"text-red-600 dark:text-red-400 mb-4"},[o("svg",{class:"w-12 h-12 mx-auto mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})])],-1)),e[6]||(e[6]=o("h3",{class:"text-content-primary dark:text-content-primary text-lg font-medium mb-2"},"Error Loading Logs",-1)),o("p",le,c(k.value),1),o("button",{onClick:y,class:"px-4 py-2 bg-red-100 dark:bg-red-500/20 hover:bg-red-500/30 text-red-600 dark:text-red-400 border border-red-500/50 rounded-lg transition-colors"}," Try Again ")])):(n(),s("div",de,[_.value.length===0?(n(),s("div",ce,e[7]||(e[7]=[J('No Logs to Display
No logs match the current filter criteria.
',3)]))):(n(),s("div",ie,[(n(!0),s(L,null,N(_.value,(r,l)=>(n(),s("div",{key:l,class:"flex items-start gap-4 p-4 hover:bg-background-mute dark:hover:bg-stroke/5 transition-colors font-mono text-sm"},[o("span",ue," ["+c(O(r.timestamp))+"] ",1),o("span",ge,c(f(r.message)),1),o("span",{class:h(["flex-shrink-0 px-2 py-1 text-xs font-medium rounded",B(r.level)])},c(r.level),3),o("span",be,c(S(r.message)),1)]))),128))]))]))])]))}});export{ve as default};
diff --git a/repeater/web/html/assets/MessageDialog.vue_vue_type_script_setup_true_lang-C6ugQFfD.js b/repeater/web/html/assets/MessageDialog.vue_vue_type_script_setup_true_lang-C6ugQFfD.js
new file mode 100644
index 0000000..a505397
--- /dev/null
+++ b/repeater/web/html/assets/MessageDialog.vue_vue_type_script_setup_true_lang-C6ugQFfD.js
@@ -0,0 +1 @@
+import{a as k,b as o,g,e as r,j as a,t as p,s as x,p as s}from"./index-D0IT5vDS.js";const f={class:"mb-6"},m={key:0,class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},v={key:1,class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},h={key:2,class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},w={class:"text-content-secondary dark:text-content-primary/80 text-base leading-relaxed"},C={class:"flex"},B=k({__name:"MessageDialog",props:{show:{type:Boolean},message:{},variant:{default:"success"}},emits:["close"],setup(i,{emit:d}){const t=i,l=d,c=n=>{n.target===n.currentTarget&&l("close")},b={success:"bg-green-100 dark:bg-green-500/20 border-green-600/40 dark:border-green-500/30 text-green-600 dark:text-green-400",error:"bg-red-100 dark:bg-red-500/20 border-red-500/30 text-red-600 dark:text-red-400",info:"bg-blue-500/20 border-blue-500/30 text-blue-600 dark:text-blue-400"},u={success:"bg-green-500 hover:bg-green-600",error:"bg-red-500 hover:bg-red-600",info:"bg-blue-500 hover:bg-blue-600"};return(n,e)=>t.show?(s(),o("div",{key:0,onClick:c,class:"fixed inset-0 bg-black/40 backdrop-blur-lg z-[99999] flex items-center justify-center p-4",style:{"backdrop-filter":"blur(8px) saturate(180%)",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"}},[r("div",{class:"bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[20px] p-6 w-full max-w-md border border-stroke-subtle dark:border-white/10",onClick:e[1]||(e[1]=x(()=>{},["stop"]))},[r("div",f,[r("div",{class:a(["inline-flex p-3 rounded-xl mb-4",b[t.variant]])},[t.variant==="success"?(s(),o("svg",m,e[2]||(e[2]=[r("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"},null,-1)]))):t.variant==="error"?(s(),o("svg",v,e[3]||(e[3]=[r("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"},null,-1)]))):(s(),o("svg",h,e[4]||(e[4]=[r("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)])))],2),r("p",w,p(t.message),1)]),r("div",C,[r("button",{onClick:e[0]||(e[0]=y=>l("close")),class:a(["flex-1 px-4 py-3 rounded-xl text-white transition-all duration-200",u[t.variant]])}," OK ",2)])])])):g("",!0)}});export{B as _};
diff --git a/repeater/web/html/assets/Neighbors-Dp7tqjVr.js b/repeater/web/html/assets/Neighbors-Dp7tqjVr.js
new file mode 100644
index 0000000..c464c89
--- /dev/null
+++ b/repeater/web/html/assets/Neighbors-Dp7tqjVr.js
@@ -0,0 +1,65 @@
+import{a as bt,b as $,g as D,e as t,t as C,s as Lt,p as f,M as Yt,r as F,c as J,D as ht,N as Rt,f as it,T as Ft,l as Dt,O as jt,j as M,F as ct,h as gt,x as It,k as tt,o as Xt,P as te,i as ft,E as Pt,n as At,w as wt,Q as ie,q as Wt,v as le,L as Et}from"./index-D0IT5vDS.js";import{u as Ut}from"./useSignalQuality-DvX3fQnP.js";import{L as W}from"./leaflet-src-BtisrQHC.js";/* empty css */import{g as _t,s as Ct}from"./preferences-DtwbSSgO.js";import"./_commonjsHelpers-CqkleIqs.js";const de={class:"bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4 mb-6"},ce={class:"flex items-center gap-3"},ue={class:"flex-1 min-w-0"},pe={class:"text-content-primary dark:text-content-primary font-medium truncate"},ge={class:"text-content-secondary dark:text-content-muted text-sm font-mono"},me={key:0,class:"text-white/50 text-xs"},he={key:1,class:"text-white/50 text-xs"},be=bt({__name:"DeleteNeighborModal",props:{show:{type:Boolean},neighbor:{}},emits:["close","delete"],setup(A,{emit:o}){const r=A,i=o,e=()=>{r.neighbor&&(i("delete",r.neighbor.id),d())},d=()=>{i("close")},g=s=>{s.target===s.currentTarget&&d()};return(s,a)=>s.show&&s.neighbor?(f(),$("div",{key:0,onClick:g,class:"fixed inset-0 bg-black/80 backdrop-blur-lg z-[99999] flex items-center justify-center p-4",style:{"backdrop-filter":"blur(8px) saturate(180%)",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"}},[t("div",{class:"bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[20px] p-6 w-full max-w-md border border-stroke-subtle dark:border-white/10",onClick:a[0]||(a[0]=Lt(()=>{},["stop"]))},[t("div",{class:"flex items-center gap-3 mb-6"},[a[2]||(a[2]=t("svg",{class:"w-6 h-6 text-accent-red",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"})],-1)),a[3]||(a[3]=t("div",null,[t("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary"},"Delete Neighbor"),t("p",{class:"text-content-secondary dark:text-content-muted text-sm mt-1"}," Are you sure you want to delete this neighbor? ")],-1)),t("button",{onClick:d,class:"ml-auto text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors"},a[1]||(a[1]=[t("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),t("div",de,[t("div",ce,[t("div",ue,[t("div",pe,C(s.neighbor?.node_name||s.neighbor?.long_name||s.neighbor?.short_name||"Unknown"),1),t("div",ge," ID: "+C(s.neighbor?.node_num_hex||s.neighbor?.node_num||s.neighbor?.id||"N/A"),1),s.neighbor?.contact_type?(f(),$("div",me,C(s.neighbor.contact_type),1)):D("",!0),s.neighbor?.hw_model?(f(),$("div",he,C(s.neighbor.hw_model),1)):D("",!0)])])]),a[4]||(a[4]=t("div",{class:"bg-accent-red/10 border border-accent-red/30 rounded-lg p-4 mb-6"},[t("div",{class:"flex items-center gap-2 text-accent-red text-sm"},[t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})]),t("span",null,"This action cannot be undone")])],-1)),t("div",{class:"flex gap-3"},[t("button",{onClick:d,class:"flex-1 px-4 py-3 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary rounded-lg transition-colors"}," Cancel "),t("button",{onClick:e,class:"flex-1 px-4 py-3 bg-accent-red/20 hover:bg-accent-red/30 border border-accent-red/50 text-accent-red rounded-lg transition-colors font-medium"}," Delete ")])])])):D("",!0)}}),xe={class:"bg-gradient-to-r from-primary/20 to-accent-cyan/20 border-b border-stroke-subtle dark:border-stroke/10 px-6 py-4"},ye={class:"flex items-center justify-between"},ve={class:"flex items-center gap-3"},ke={key:0,class:"text-sm text-content-secondary dark:text-content-muted"},fe={class:"p-6"},we={key:0,class:"text-center py-8"},_e={key:1,class:"text-center py-8"},Ce={class:"text-content-secondary dark:text-content-muted text-sm"},$e={key:2,class:"space-y-4"},Me={class:"bg-background-mute dark:bg-background/50 border border-stroke-subtle dark:border-stroke/10 rounded-[15px] p-4"},Ae={class:"flex items-center justify-between mb-2"},Le={class:"flex items-baseline gap-2"},Te={class:"text-3xl font-bold text-content-primary dark:text-content-primary"},Ee={class:"grid grid-cols-2 gap-3"},Se={class:"bg-background-mute dark:bg-background/50 border border-stroke-subtle dark:border-stroke/10 rounded-[15px] p-4"},Be={class:"flex items-center gap-2 mb-2"},Ne={class:"flex gap-0.5"},Fe={class:"flex items-baseline gap-1"},De={class:"text-xl font-bold text-content-primary dark:text-content-primary"},Pe={class:"bg-background-mute dark:bg-background/50 border border-stroke-subtle dark:border-stroke/10 rounded-[15px] p-4"},ze={class:"flex items-baseline gap-1"},Re={class:"text-xl font-bold text-content-primary dark:text-content-primary"},je={class:"bg-background-mute dark:bg-background/50 border border-stroke-subtle dark:border-stroke/10 rounded-[15px] p-4"},Ie={class:"relative"},Ue={class:"flex items-center gap-2 overflow-x-auto pb-2"},Oe={key:0,class:"relative flex items-center"},Ve={key:0,class:"absolute left-1/2 -translate-x-1/2 animate-pulse"},He={class:"text-content-muted dark:text-content-muted text-xs mt-2 flex items-center justify-between"},Ze={key:0,class:"text-cyan-500 dark:text-primary animate-pulse"},We={class:"flex items-center justify-between text-xs text-content-muted dark:text-content-muted pt-2"},Qe=bt({__name:"PingResultModal",props:{show:{type:Boolean},nodeName:{default:null},result:{default:null},error:{default:null},loading:{type:Boolean,default:!1}},emits:["close"],setup(A,{emit:o}){const r=A,i=o,e=Yt(),{getSignalQuality:d}=Ut(),g=F(0),s=F(!1),a=J(()=>{const x=e.stats?.config?.radio?.spreading_factor??7,b=e.stats?.config?.radio?.bandwidth??125,L=e.stats?.config?.radio?.coding_rate??5,_=Math.pow(2,x)/b,k=8+4.25*(L-4)+20;return _*k}),w=J(()=>{if(!r.result)return{color:"text-gray-400",label:"Unknown"};const x=r.result.rtt_ms,b=a.value,L=r.result.path.length,k=2*b*L+500*L;return x{if(!r.result)return{bars:0,color:"text-gray-400"};const x=d(r.result.rssi);return{bars:x.bars,color:x.color}});ht(()=>r.result,x=>{if(x&&!s.value){s.value=!0,g.value=0;const b=x.path.length,_=1500/(b*2);let k=0;const P=b*2-2,I=()=>{k<=P?(g.value=k/P,k++,setTimeout(I,_)):(s.value=!1,g.value=1)};setTimeout(I,100)}},{immediate:!0});const v=J(()=>{if(!r.result||!s.value)return-1;const x=r.result.path.length;if(x<=1)return-1;const b=g.value,L=.5;if(b<=L)return b/L*(x-1);{const _=(b-L)/L;return(x-1)*(1-_)}}),S=()=>{i("close")};return(x,b)=>(f(),Rt(jt,{to:"body"},[it(Ft,{name:"modal"},{default:Dt(()=>[x.show?(f(),$("div",{key:0,class:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-[99999] p-4",onClick:Lt(S,["self"])},[t("div",{class:"glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/20 rounded-[20px] shadow-2xl w-full max-w-md overflow-hidden",onClick:b[0]||(b[0]=Lt(()=>{},["stop"]))},[t("div",xe,[t("div",ye,[t("div",ve,[b[2]||(b[2]=t("div",{class:"p-2 bg-cyan-400/20 dark:bg-primary/20 rounded-lg"},[t("svg",{class:"w-5 h-5 text-cyan-500 dark:text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8.111 16.404a5.5 5.5 0 017.778 0M12 20h.01m-7.08-7.071c3.904-3.905 10.236-3.905 14.141 0M1.394 9.393c5.857-5.857 15.355-5.857 21.213 0"})])],-1)),t("div",null,[b[1]||(b[1]=t("h2",{class:"text-xl font-bold text-content-primary dark:text-content-primary"},"Ping Result",-1)),x.nodeName?(f(),$("p",ke,C(x.nodeName),1)):D("",!0)])]),t("button",{onClick:S,class:"p-2 hover:bg-stroke-subtle dark:hover:bg-white/10 rounded-lg transition-colors text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary"},b[3]||(b[3]=[t("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))])]),t("div",fe,[x.loading?(f(),$("div",we,b[4]||(b[4]=[t("div",{class:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto mb-4"},null,-1),t("p",{class:"text-content-secondary dark:text-content-muted"},"Sending ping...",-1),t("p",{class:"text-content-muted dark:text-content-muted text-sm mt-1"},"Waiting for response...",-1)]))):x.error?(f(),$("div",_e,[b[5]||(b[5]=t("div",{class:"p-3 bg-accent-red/10 rounded-full w-16 h-16 mx-auto mb-4 flex items-center justify-center"},[t("svg",{class:"w-8 h-8 text-accent-red",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-1.964-1.333-2.732 0L3.268 16c-.77 1.333.192 3 1.732 3z"})])],-1)),b[6]||(b[6]=t("h3",{class:"text-accent-red font-semibold mb-2"},"Ping Failed",-1)),t("p",Ce,C(x.error),1)])):x.result?(f(),$("div",$e,[t("div",Me,[t("div",Ae,[b[7]||(b[7]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"Round-Trip Time",-1)),t("span",{class:M(["text-xs font-medium px-2 py-1 rounded-full",w.value.color,"bg-current/10"])},C(w.value.label),3)]),t("div",Le,[t("span",Te,C(x.result.rtt_ms.toFixed(2)),1),b[8]||(b[8]=t("span",{class:"text-content-secondary dark:text-content-muted"},"ms",-1))])]),t("div",Ee,[t("div",Se,[t("div",Be,[b[9]||(b[9]=t("span",{class:"text-content-secondary dark:text-content-muted text-sm"},"RSSI",-1)),t("div",Ne,[(f(),$(ct,null,gt(5,L=>t("div",{key:L,class:M(["w-1 h-3 rounded-sm",L<=m.value.bars?m.value.color:"bg-stroke-subtle dark:bg-stroke/10"])},null,2)),64))])]),t("div",Fe,[t("span",De,C(x.result.rssi),1),b[10]||(b[10]=t("span",{class:"text-content-secondary dark:text-content-muted text-xs"},"dBm",-1))])]),t("div",Pe,[b[12]||(b[12]=t("div",{class:"text-content-secondary dark:text-content-muted text-sm mb-2"},"SNR",-1)),t("div",ze,[t("span",Re,C(x.result.snr_db),1),b[11]||(b[11]=t("span",{class:"text-content-secondary dark:text-content-muted text-xs"},"dB",-1))])])]),t("div",je,[b[15]||(b[15]=t("div",{class:"text-content-secondary dark:text-content-muted text-sm mb-3"},"Network Path",-1)),t("div",Ie,[t("div",Ue,[(f(!0),$(ct,null,gt(x.result.path,(L,_)=>(f(),$("div",{key:_,class:"flex items-center gap-2 flex-shrink-0 relative"},[t("div",{class:M(["bg-cyan-400/20 dark:bg-primary/20 text-cyan-600 dark:text-primary border border-cyan-400/40 dark:border-primary/30 px-3 py-1.5 rounded-lg text-sm font-mono transition-all duration-300",s.value&&Math.floor(v.value)===_?"ring-2 ring-cyan-400/50 dark:ring-primary/50 scale-105":""])},C(L),3),_[s.value&&v.value>=_&&v.value<_+1?(f(),$("div",Ve,b[13]||(b[13]=[t("svg",{class:"w-3 h-3 text-cyan-500 dark:text-primary drop-shadow-[0_0_6px_rgba(6,182,212,0.8)] dark:drop-shadow-[0_0_6px_rgba(59,130,246,0.8)]",fill:"currentColor",viewBox:"0 0 24 24"},[t("circle",{cx:"12",cy:"12",r:"8"})],-1)]))):D("",!0)]),_:2},1024)])):D("",!0)]))),128))])]),t("div",He,[t("span",null,C(x.result.path.length)+" hop"+C(x.result.path.length!==1?"s":""),1),s.value?(f(),$("span",Ze,"● Tracing route...")):D("",!0)])]),t("div",We,[t("span",null,"Target: "+C(x.result.target_id),1),t("span",null,"Tag: #"+C(x.result.tag),1)])])):D("",!0)]),t("div",{class:"border-t border-stroke-subtle dark:border-stroke/10 px-6 py-4"},[t("button",{onClick:S,class:"w-full py-2.5 bg-gradient-to-r from-cyan-400 to-cyan-500 text-white hover:from-cyan-500 hover:to-cyan-600 dark:bg-primary/20 dark:text-primary dark:border dark:border-primary/30 dark:hover:bg-primary/30 dark:from-transparent dark:to-transparent rounded-lg font-medium transition-all shadow-[0_2px_12px_rgba(6,182,212,0.3)] dark:shadow-none"}," Close ")])])])):D("",!0)]),_:1})]))}}),qe=It(Qe,[["__scopeId","data-v-b206e10a"]]),Ke={class:"bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[20px] shadow-2xl border border-stroke-subtle dark:border-white/20 flex flex-col h-full overflow-hidden"},Ge={class:"flex items-center justify-between p-8 pb-4 flex-shrink-0"},Je={class:"flex-1 min-w-0"},Ye={class:"text-2xl font-bold text-content-primary dark:text-content-primary mb-1"},Xe={class:"text-content-secondary dark:text-content-muted text-sm font-mono break-all"},to={class:"flex items-center gap-2"},eo={class:"flex-1 overflow-y-auto custom-scrollbar px-8"},oo={class:"mb-6"},ro={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},no={class:"glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]"},so={class:"glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]"},ao={class:"text-content-primary dark:text-content-primary font-medium"},io={class:"glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]"},lo={class:"glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]"},co={class:"text-content-primary dark:text-content-primary font-medium"},uo={class:"mb-6"},po={class:"grid grid-cols-1 md:grid-cols-3 gap-4"},go={class:"glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]"},mo={class:"text-content-primary dark:text-content-primary font-medium"},ho={class:"glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]"},bo={class:"text-content-primary dark:text-content-primary font-medium"},xo={key:0,class:"glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]"},yo={class:"flex items-center gap-2"},vo={class:"flex gap-0.5"},ko={class:"mb-6"},fo={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},wo={class:"glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]"},_o={class:"text-content-primary dark:text-content-primary text-sm"},Co={class:"glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]"},$o={class:"text-content-primary dark:text-content-primary text-sm"},Mo={key:0,class:"mb-6"},Ao={class:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-4"},Lo={class:"glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]"},To={class:"text-content-primary dark:text-content-primary font-mono text-sm"},Eo={class:"glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]"},So={class:"text-content-primary dark:text-content-primary font-mono text-sm"},Bo={class:"glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]"},No={class:"text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1"},Fo={key:0,class:"text-content-primary dark:text-content-primary font-medium"},Do={class:"p-8 pt-4 border-t border-stroke-subtle dark:border-white/10 flex-shrink-0"},Po=bt({name:"NeighborDetailsModal",__name:"NeighborDetailsModal",props:{neighbor:{},isOpen:{type:Boolean},baseLatitude:{default:null},baseLongitude:{default:null}},emits:["close"],setup(A,{emit:o}){const{getSignalQuality:r}=Ut(),i=F("Copy"),e=A,d=o,g=F();let s=null;const a=y=>new Date(y*1e3).toLocaleString(),w=y=>y?`${y} dBm`:"N/A",m=y=>y?`${y.toFixed(1)} dB`:"N/A",v=y=>({0:"Transport Flood",1:"Flood",2:"Direct",3:"Transport Direct"})[y||0]||"Unknown",S=y=>({Unknown:"Unknown","Chat Node":"Chat Node",Repeater:"Repeater","Room Server":"Room Server","Hybrid Node":"Hybrid Node"})[y]||y,x=y=>({Unknown:"text-gray-600 dark:text-gray-400","Chat Node":"text-blue-600 dark:text-blue-400",Repeater:"text-emerald-600 dark:text-emerald-400","Room Server":"text-purple-600 dark:text-purple-400","Hybrid Node":"text-amber-600 dark:text-amber-400"})[y]||"text-gray-600 dark:text-gray-400",b=async()=>{if(!e.neighbor?.latitude||!e.neighbor?.longitude)return;const y=e.neighbor.latitude.toFixed(6),u=e.neighbor.longitude.toFixed(6),j=`${y}, ${u}`;try{await navigator.clipboard.writeText(j),i.value="Copied!",setTimeout(()=>{i.value="Copy"},2e3)}catch(K){console.error("Failed to copy coordinates:",K),i.value="Failed",setTimeout(()=>{i.value="Copy"},2e3)}},L=J(()=>{if(!e.neighbor?.latitude||!e.neighbor?.longitude||!e.baseLatitude||!e.baseLongitude)return null;const y=6371,u=(e.neighbor.latitude-e.baseLatitude)*Math.PI/180,j=(e.neighbor.longitude-e.baseLongitude)*Math.PI/180,K=Math.sin(u/2)*Math.sin(u/2)+Math.cos(e.baseLatitude*Math.PI/180)*Math.cos(e.neighbor.latitude*Math.PI/180)*Math.sin(j/2)*Math.sin(j/2),et=2*Math.atan2(Math.sqrt(K),Math.sqrt(1-K));return y*et}),_=J(()=>e.neighbor?.latitude!==null&&e.neighbor?.longitude!==null&&e.neighbor?.latitude!==0&&e.neighbor?.longitude!==0&&Math.abs(e.neighbor?.latitude??0)<=90&&Math.abs(e.neighbor?.longitude??0)<=180),k=()=>{if(!g.value||!e.neighbor||!_.value)return;s&&(s.remove(),s=null);const y=document.documentElement.classList.contains("dark");s=W.map(g.value,{center:[e.neighbor.latitude,e.neighbor.longitude],zoom:13,zoomControl:!0,attributionControl:!1});const u=y?"https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png":"https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png";W.tileLayer(u,{maxZoom:19,attribution:"© OpenStreetMap © CARTO"}).addTo(s);const j=W.divIcon({className:"custom-marker",html:`${e.neighbor.node_name?.charAt(0)||"?"}
`,iconSize:[32,32],iconAnchor:[16,16]});if(W.marker([e.neighbor.latitude,e.neighbor.longitude],{icon:j}).addTo(s).bindPopup(`${e.neighbor.node_name||"Unknown"}
${e.neighbor.pubkey.slice(0,8)}...`),e.baseLatitude!==null&&e.baseLongitude!==null&&e.baseLatitude!==0&&e.baseLongitude!==0&&Math.abs(e.baseLatitude)<=90&&Math.abs(e.baseLongitude)<=180){const et=W.divIcon({className:"custom-marker",html:'B
',iconSize:[32,32],iconAnchor:[16,16]});W.marker([e.baseLatitude,e.baseLongitude],{icon:et}).addTo(s).bindPopup("Base Station"),W.polyline([[e.baseLatitude,e.baseLongitude],[e.neighbor.latitude,e.neighbor.longitude]],{color:"#3b82f6",weight:2,opacity:.6,dashArray:"5, 10"}).addTo(s);const lt=W.latLngBounds([e.baseLatitude,e.baseLongitude],[e.neighbor.latitude,e.neighbor.longitude]);s.fitBounds(lt,{padding:[50,50]})}},P=y=>{y.key==="Escape"&&d("close")},I=y=>{y.target===y.currentTarget&&d("close")};ht(()=>e.isOpen,y=>{y?(document.body.style.overflow="hidden",setTimeout(()=>{_.value&&k()},100)):(document.body.style.overflow="",s&&(s.remove(),s=null))},{immediate:!0});const Z=J(()=>e.neighbor?.rssi?r(e.neighbor.rssi):null);return(y,u)=>(f(),Rt(jt,{to:"body"},[it(Ft,{name:"modal",appear:""},{default:Dt(()=>[y.isOpen&&y.neighbor?(f(),$("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center p-4 overflow-hidden",onClick:I,onKeydown:P,tabindex:"0"},[u[20]||(u[20]=t("div",{class:"absolute inset-0 bg-black/60 backdrop-blur-md pointer-events-none"},null,-1)),t("div",{class:"relative w-full max-w-4xl max-h-[90vh] flex flex-col",onClick:u[2]||(u[2]=Lt(()=>{},["stop"]))},[t("div",Ke,[t("div",Ge,[t("div",Je,[t("h2",Ye,C(y.neighbor.node_name||"Unknown Node"),1),t("p",Xe,C(y.neighbor.pubkey),1)]),t("div",to,[t("button",{onClick:u[0]||(u[0]=j=>d("close")),class:"w-8 h-8 flex items-center justify-center rounded-full bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors duration-200 text-gray-700 dark:text-white hover:text-gray-900 dark:hover:text-white"},u[3]||(u[3]=[t("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))])]),t("div",eo,[t("div",oo,[u[8]||(u[8]=t("h3",{class:"text-lg font-semibold text-content-primary dark:text-content-primary mb-4"},"Basic Information",-1)),t("div",ro,[t("div",no,[u[4]||(u[4]=t("div",{class:"text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1"},"Contact Type",-1)),t("div",{class:M(["font-medium",x(y.neighbor.contact_type)])},C(S(y.neighbor.contact_type)),3)]),t("div",so,[u[5]||(u[5]=t("div",{class:"text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1"},"Route Type",-1)),t("div",ao,C(v(y.neighbor.route_type)),1)]),t("div",io,[u[6]||(u[6]=t("div",{class:"text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1"},"Zero Hop",-1)),t("div",{class:M(["font-medium",y.neighbor.zero_hop?"text-green-600 dark:text-green-400":"text-gray-600 dark:text-gray-400"])},C(y.neighbor.zero_hop?"Yes":"No"),3)]),t("div",lo,[u[7]||(u[7]=t("div",{class:"text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1"},"Advert Count",-1)),t("div",co,C(y.neighbor.advert_count.toLocaleString()),1)])])]),t("div",uo,[u[12]||(u[12]=t("h3",{class:"text-lg font-semibold text-content-primary dark:text-content-primary mb-4"},"Signal Quality",-1)),t("div",po,[t("div",go,[u[9]||(u[9]=t("div",{class:"text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1"},"RSSI",-1)),t("div",mo,C(w(y.neighbor.rssi)),1)]),t("div",ho,[u[10]||(u[10]=t("div",{class:"text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1"},"SNR",-1)),t("div",bo,C(m(y.neighbor.snr)),1)]),Z.value?(f(),$("div",xo,[u[11]||(u[11]=t("div",{class:"text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1"},"Signal Strength",-1)),t("div",yo,[t("div",vo,[(f(),$(ct,null,gt(4,j=>t("div",{key:j,class:M(["w-1 h-3 rounded-sm",j<=Z.value.bars?Z.value.color:"bg-gray-300 dark:bg-gray-700"])},null,2)),64))]),t("span",{class:M(["text-sm font-medium",Z.value.color])},C(Z.value.quality),3)])])):D("",!0)])]),t("div",ko,[u[15]||(u[15]=t("h3",{class:"text-lg font-semibold text-content-primary dark:text-content-primary mb-4"},"Timeline",-1)),t("div",fo,[t("div",wo,[u[13]||(u[13]=t("div",{class:"text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1"},"First Seen",-1)),t("div",_o,C(a(y.neighbor.first_seen)),1)]),t("div",Co,[u[14]||(u[14]=t("div",{class:"text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1"},"Last Seen",-1)),t("div",$o,C(a(y.neighbor.last_seen)),1)])])]),_.value?(f(),$("div",Mo,[u[19]||(u[19]=t("h3",{class:"text-lg font-semibold text-content-primary dark:text-content-primary mb-4"},"Location",-1)),t("div",Ao,[t("div",Lo,[u[16]||(u[16]=t("div",{class:"text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1"},"Latitude",-1)),t("div",To,C(y.neighbor.latitude?.toFixed(6)),1)]),t("div",Eo,[u[17]||(u[17]=t("div",{class:"text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1"},"Longitude",-1)),t("div",So,C(y.neighbor.longitude?.toFixed(6)),1)]),t("div",Bo,[t("div",No,C(L.value!==null?"Distance":"Coordinates"),1),L.value!==null?(f(),$("div",Fo,C(L.value.toFixed(2))+" km ",1)):(f(),$("button",{key:1,onClick:b,class:"w-full px-3 py-1.5 bg-primary hover:bg-primary/90 dark:bg-gray-700 dark:hover:bg-gray-600 text-white text-sm font-medium rounded-lg transition-colors flex items-center justify-center gap-1.5"},[u[18]||(u[18]=t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})],-1)),tt(" "+C(i.value),1)]))])]),t("div",{ref_key:"mapContainer",ref:g,class:"w-full h-96 rounded-[12px] overflow-hidden border border-stroke-subtle dark:border-white/10"},null,512)])):D("",!0)]),t("div",Do,[t("button",{onClick:u[1]||(u[1]=j=>d("close")),class:"w-full px-4 py-2.5 bg-primary hover:bg-primary/90 dark:bg-gray-700 dark:hover:bg-gray-600 text-white font-medium rounded-lg transition-colors"}," Close ")])])])],32)):D("",!0)]),_:1})]))}}),zo=It(Po,[["__scopeId","data-v-5669a05a"]]),Qt=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],St=1,vt=8;class Ot{static from(o){if(!(o instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,i]=new Uint8Array(o,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");const e=i>>4;if(e!==St)throw new Error(`Got v${e} data when expected v${St}.`);const d=Qt[i&15];if(!d)throw new Error("Unrecognized array type.");const[g]=new Uint16Array(o,2,1),[s]=new Uint32Array(o,4,1);return new Ot(s,g,d,o)}constructor(o,r=64,i=Float64Array,e){if(isNaN(o)||o<0)throw new Error(`Unpexpected numItems value: ${o}.`);this.numItems=+o,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=i,this.IndexArrayType=o<65536?Uint16Array:Uint32Array;const d=Qt.indexOf(this.ArrayType),g=o*2*this.ArrayType.BYTES_PER_ELEMENT,s=o*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-s%8)%8;if(d<0)throw new Error(`Unexpected typed array class: ${i}.`);e&&e instanceof ArrayBuffer?(this.data=e,this.ids=new this.IndexArrayType(this.data,vt,o),this.coords=new this.ArrayType(this.data,vt+s+a,o*2),this._pos=o*2,this._finished=!0):(this.data=new ArrayBuffer(vt+g+s+a),this.ids=new this.IndexArrayType(this.data,vt,o),this.coords=new this.ArrayType(this.data,vt+s+a,o*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(St<<4)+d]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=o)}add(o,r){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=o,this.coords[this._pos++]=r,i}finish(){const o=this._pos>>1;if(o!==this.numItems)throw new Error(`Added ${o} items when expected ${this.numItems}.`);return zt(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(o,r,i,e){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:d,coords:g,nodeSize:s}=this,a=[0,d.length-1,0],w=[];for(;a.length;){const m=a.pop()||0,v=a.pop()||0,S=a.pop()||0;if(v-S<=s){for(let _=S;_<=v;_++){const k=g[2*_],P=g[2*_+1];k>=o&&k<=i&&P>=r&&P<=e&&w.push(d[_])}continue}const x=S+v>>1,b=g[2*x],L=g[2*x+1];b>=o&&b<=i&&L>=r&&L<=e&&w.push(d[x]),(m===0?o<=b:r<=L)&&(a.push(S),a.push(x-1),a.push(1-m)),(m===0?i>=b:e>=L)&&(a.push(x+1),a.push(v),a.push(1-m))}return w}within(o,r,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:e,coords:d,nodeSize:g}=this,s=[0,e.length-1,0],a=[],w=i*i;for(;s.length;){const m=s.pop()||0,v=s.pop()||0,S=s.pop()||0;if(v-S<=g){for(let _=S;_<=v;_++)qt(d[2*_],d[2*_+1],o,r)<=w&&a.push(e[_]);continue}const x=S+v>>1,b=d[2*x],L=d[2*x+1];qt(b,L,o,r)<=w&&a.push(e[x]),(m===0?o-i<=b:r-i<=L)&&(s.push(S),s.push(x-1),s.push(1-m)),(m===0?o+i>=b:r+i>=L)&&(s.push(x+1),s.push(v),s.push(1-m))}return a}}function zt(A,o,r,i,e,d){if(e-i<=r)return;const g=i+e>>1;ee(A,o,g,i,e,d),zt(A,o,r,i,g-1,1-d),zt(A,o,r,g+1,e,1-d)}function ee(A,o,r,i,e,d){for(;e>i;){if(e-i>600){const w=e-i+1,m=r-i+1,v=Math.log(w),S=.5*Math.exp(2*v/3),x=.5*Math.sqrt(v*S*(w-S)/w)*(m-w/2<0?-1:1),b=Math.max(i,Math.floor(r-m*S/w+x)),L=Math.min(e,Math.floor(r+(w-m)*S/w+x));ee(A,o,r,b,L,d)}const g=o[2*r+d];let s=i,a=e;for(kt(A,o,i,r),o[2*e+d]>g&&kt(A,o,i,e);sg;)a--}o[2*i+d]===g?kt(A,o,i,a):(a++,kt(A,o,a,e)),a<=r&&(i=a+1),r<=a&&(e=a-1)}}function kt(A,o,r,i){Bt(A,r,i),Bt(o,2*r,2*i),Bt(o,2*r+1,2*i+1)}function Bt(A,o,r){const i=A[o];A[o]=A[r],A[r]=i}function qt(A,o,r,i){const e=A-r,d=o-i;return e*e+d*d}const Ro={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:A=>A},Kt=Math.fround||(A=>o=>(A[0]=+o,A[0]))(new Float32Array(1)),mt=2,pt=3,Nt=4,ut=5,oe=6;class jo{constructor(o){this.options=Object.assign(Object.create(Ro),o),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(o){const{log:r,minZoom:i,maxZoom:e}=this.options;r&&console.time("total time");const d=`prepare ${o.length} points`;r&&console.time(d),this.points=o;const g=[];for(let a=0;a=i;a--){const w=+Date.now();s=this.trees[a]=this._createTree(this._cluster(s,a)),r&&console.log("z%d: %d clusters in %dms",a,s.numItems,+Date.now()-w)}return r&&console.timeEnd("total time"),this}getClusters(o,r){let i=((o[0]+180)%360+360)%360-180;const e=Math.max(-90,Math.min(90,o[1]));let d=o[2]===180?180:((o[2]+180)%360+360)%360-180;const g=Math.max(-90,Math.min(90,o[3]));if(o[2]-o[0]>=360)i=-180,d=180;else if(i>d){const v=this.getClusters([i,e,180,g],r),S=this.getClusters([-180,e,d,g],r);return v.concat(S)}const s=this.trees[this._limitZoom(r)],a=s.range($t(i),Mt(g),$t(d),Mt(e)),w=s.data,m=[];for(const v of a){const S=this.stride*v;m.push(w[S+ut]>1?Gt(w,S,this.clusterProps):this.points[w[S+pt]])}return m}getChildren(o){const r=this._getOriginId(o),i=this._getOriginZoom(o),e="No cluster with the specified id.",d=this.trees[i];if(!d)throw new Error(e);const g=d.data;if(r*this.stride>=g.length)throw new Error(e);const s=this.options.radius/(this.options.extent*Math.pow(2,i-1)),a=g[r*this.stride],w=g[r*this.stride+1],m=d.within(a,w,s),v=[];for(const S of m){const x=S*this.stride;g[x+Nt]===o&&v.push(g[x+ut]>1?Gt(g,x,this.clusterProps):this.points[g[x+pt]])}if(v.length===0)throw new Error(e);return v}getLeaves(o,r,i){r=r||10,i=i||0;const e=[];return this._appendLeaves(e,o,r,i,0),e}getTile(o,r,i){const e=this.trees[this._limitZoom(o)],d=Math.pow(2,o),{extent:g,radius:s}=this.options,a=s/g,w=(i-a)/d,m=(i+1+a)/d,v={features:[]};return this._addTileFeatures(e.range((r-a)/d,w,(r+1+a)/d,m),e.data,r,i,d,v),r===0&&this._addTileFeatures(e.range(1-a/d,w,1,m),e.data,d,i,d,v),r===d-1&&this._addTileFeatures(e.range(0,w,a/d,m),e.data,-1,i,d,v),v.features.length?v:null}getClusterExpansionZoom(o){let r=this._getOriginZoom(o)-1;for(;r<=this.options.maxZoom;){const i=this.getChildren(o);if(r++,i.length!==1)break;o=i[0].properties.cluster_id}return r}_appendLeaves(o,r,i,e,d){const g=this.getChildren(r);for(const s of g){const a=s.properties;if(a&&a.cluster?d+a.point_count<=e?d+=a.point_count:d=this._appendLeaves(o,a.cluster_id,i,e,d):d1;let m,v,S;if(w)m=re(r,a,this.clusterProps),v=r[a],S=r[a+1];else{const L=this.points[r[a+pt]];m=L.properties;const[_,k]=L.geometry.coordinates;v=$t(_),S=Mt(k)}const x={type:1,geometry:[[Math.round(this.options.extent*(v*d-i)),Math.round(this.options.extent*(S*d-e))]],tags:m};let b;w||this.options.generateId?b=r[a+pt]:b=this.points[r[a+pt]].id,b!==void 0&&(x.id=b),g.features.push(x)}}_limitZoom(o){return Math.max(this.options.minZoom,Math.min(Math.floor(+o),this.options.maxZoom+1))}_cluster(o,r){const{radius:i,extent:e,reduce:d,minPoints:g}=this.options,s=i/(e*Math.pow(2,r)),a=o.data,w=[],m=this.stride;for(let v=0;vr&&(_+=a[P+ut])}if(_>L&&_>=g){let k=S*L,P=x*L,I,Z=-1;const y=((v/m|0)<<5)+(r+1)+this.points.length;for(const u of b){const j=u*m;if(a[j+mt]<=r)continue;a[j+mt]=r;const K=a[j+ut];k+=a[j]*K,P+=a[j+1]*K,a[j+Nt]=y,d&&(I||(I=this._map(a,v,!0),Z=this.clusterProps.length,this.clusterProps.push(I)),d(I,this._map(a,j)))}a[v+Nt]=y,w.push(k/_,P/_,1/0,y,-1,_),d&&w.push(Z)}else{for(let k=0;k1)for(const k of b){const P=k*m;if(!(a[P+mt]<=r)){a[P+mt]=r;for(let I=0;I>5}_getOriginZoom(o){return(o-this.points.length)%32}_map(o,r,i){if(o[r+ut]>1){const g=this.clusterProps[o[r+oe]];return i?Object.assign({},g):g}const e=this.points[o[r+pt]].properties,d=this.options.map(e);return i&&d===e?Object.assign({},d):d}}function Gt(A,o,r){return{type:"Feature",id:A[o+pt],properties:re(A,o,r),geometry:{type:"Point",coordinates:[Io(A[o]),Uo(A[o+1])]}}}function re(A,o,r){const i=A[o+ut],e=i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?`${Math.round(i/100)/10}k`:i,d=A[o+oe],g=d===-1?{}:Object.assign({},r[d]);return Object.assign(g,{cluster:!0,cluster_id:A[o+pt],point_count:i,point_count_abbreviated:e})}function $t(A){return A/360+.5}function Mt(A){const o=Math.sin(A*Math.PI/180),r=.5-.25*Math.log((1+o)/(1-o))/Math.PI;return r<0?0:r>1?1:r}function Io(A){return(A-.5)*360}function Uo(A){const o=(180-A*360)*Math.PI/180;return 360*Math.atan(Math.exp(o))/Math.PI-90}const Oo={class:"map-container"},Vo={key:0,class:"flex items-center justify-center h-96 glass-card backdrop-blur border border-black/6 dark:border-white/10 rounded-[12px] shadow-sm dark:shadow-none"},Ho={class:"hidden sm:inline"},Zo={key:3,class:"map-legend"},Wo={class:"legend-footer"},Qo={key:4,class:"map-attribution"},qo=bt({__name:"NetworkMap",props:{adverts:{},baseLatitude:{default:null},baseLongitude:{default:null},showLegend:{type:Boolean,default:!0}},emits:["update:showLegend"],setup(A,{expose:o,emit:r}){typeof window<"u"&&!window.chrome&&(window.chrome={runtime:{}});const i=A,e=r,d=()=>{e("update:showLegend",!i.showLegend)},g=F();let s=null;const a=F(new Map);let w=null;const m=F(new Map),v=F([]),S=F(!0),x=F(60),b=F(14),L=F(document.documentElement.classList.contains("dark")),_=new MutationObserver(()=>{const E=document.documentElement.classList.contains("dark");E!==L.value&&(L.value=E,s&&K())}),k=J(()=>i.baseLatitude!==null&&i.baseLongitude!==null&&typeof i.baseLatitude=="number"&&typeof i.baseLongitude=="number"&&i.baseLatitude!==0&&i.baseLongitude!==0&&Math.abs(i.baseLatitude)<=90&&Math.abs(i.baseLongitude)<=180),P=E=>new Date(E*1e3).toLocaleString(),I=E=>E?`${E} dBm`:"N/A",Z=E=>E?`${E} dB`:"N/A",y=E=>({0:"Transport Flood",1:"Flood",2:"Direct",3:"Transport Direct"})[E||0]||"Unknown",u=(E,c,n,l)=>{const R=(n-E)*Math.PI/180,V=(l-c)*Math.PI/180,G=Math.sin(R/2)*Math.sin(R/2)+Math.cos(E*Math.PI/180)*Math.cos(n*Math.PI/180)*Math.sin(V/2)*Math.sin(V/2);return 6371*(2*Math.atan2(Math.sqrt(G),Math.sqrt(1-G)))},j=()=>{s&&(v.value.forEach(E=>{s&&E.remove()}),v.value.length=0,s.remove(),s=null),a.value.clear(),m.value.clear(),w=null},K=async()=>{const E=s?.getZoom()||11,c=s?.getCenter()||(k.value?[i.baseLatitude,i.baseLongitude]:[0,0]);j(),await Pt(),await at(),s&&s.setView(c,E)},et=E=>{const c=new Map;return E.filter(n=>n.latitude!==null&&n.longitude!==null).map(n=>{let l=n.latitude,B=n.longitude;const R=`${l.toFixed(6)}_${B.toFixed(6)}`,V=c.get(R)||0;if(c.set(R,V+1),V>0){const X=V*60*(Math.PI/180);l+=Math.sin(X)*.001*(V*.5),B+=Math.cos(X)*.001*(V*.5)}return{type:"Feature",properties:{advert:{...n,jittered_latitude:l,jittered_longitude:B}},geometry:{type:"Point",coordinates:[B,l]}}})},lt=E=>{w=new jo({radius:x.value,maxZoom:b.value,minPoints:2}),w.load(E)},at=async()=>{if(!g.value||!k.value){console.warn("Cannot initialize map: missing container or coordinates");return}j(),await Pt();const E=i.baseLatitude,c=i.baseLongitude;s=W.map(g.value,{center:[E,c],zoom:11,zoomControl:!0,attributionControl:!1,preferCanvas:!1});try{const n=L.value?"https://{s}.basemaps.cartocdn.com/dark_nolabels/{z}/{x}/{y}{r}.png":"https://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}{r}.png",l=L.value?"https://{s}.basemaps.cartocdn.com/dark_only_labels/{z}/{x}/{y}{r}.png":"https://{s}.basemaps.cartocdn.com/light_only_labels/{z}/{x}/{y}{r}.png",B=W.tileLayer(n,{maxZoom:19,attribution:'© OpenStreetMap contributors © CARTO',errorTileUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="}),R=W.tileLayer(l,{maxZoom:19,attribution:"",errorTileUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="});B.addTo(s),R.addTo(s)}catch(n){console.warn("Error loading tiles:",n)}try{const n=(z,H=!1)=>{const h=H?16:12;return W.divIcon({className:"custom-div-icon",html:``,iconSize:[h+4,h+4],iconAnchor:[(h+4)/2,(h+4)/2]})},l=z=>{const H=z<10?30:z<100?40:50;return W.divIcon({className:"custom-cluster-icon",html:`
+
+ ${z}
+
+ `,iconSize:[H,H],iconAnchor:[H/2,H/2]})},B=n("#ef4444",!0);W.marker([E,c],{icon:B}).addTo(s).bindPopup(`
+
+ Base Station
+ Base Station
+ ${E.toFixed(6)}, ${c.toFixed(6)}
+
+ `);const R={Unknown:"#9CA3AF","Chat Node":"#60A5FA",Repeater:"#A5E5B6","Room Server":"#EBA0FC","Hybrid Node":"#FFC246"},V=(z,H,h,p,T=0)=>{if(!s)return;const N=z.jittered_latitude||z.latitude,U=z.jittered_longitude||z.longitude;if(N===null||U===null)return;const O=z.route_type||0;let Y=p,ot=3,Q=.7,q;O===2?(Y="#A5E5B6",ot=4,Q=.9):O===1?(Y="#FFC246",q="10, 5",Q=.8):O===3?(Y="#059669",ot=5,Q=.95):O===0?(Y="#ea580c",q="12, 6",Q=.8):(Y="#9CA3AF",q="2, 5",Q=.6);const rt=[H,h],st=[N,U],dt=W.polyline([rt,st],{color:Y,weight:ot,opacity:0,dashArray:q,className:"connection-line"}).addTo(s),xt=W.polyline([rt,rt],{color:Y,weight:ot,opacity:0,dashArray:q,className:"connection-line animated-line"}).addTo(s);setTimeout(()=>{let Tt=0;const Vt=30;xt.setStyle({opacity:Q+.2});const Ht=()=>{Tt++;const Zt=Tt/Vt,ne=rt[0]+(st[0]-rt[0])*Zt,se=rt[1]+(st[1]-rt[1])*Zt;xt.setLatLngs([rt,[ne,se]]),Tt{s&&xt&&xt.remove(),dt.setStyle({opacity:Q}),dt.on("mouseover",()=>{dt.setStyle({weight:ot+2,opacity:Math.min(Q+.3,1)})}),dt.on("mouseout",()=>{dt.setStyle({weight:ot,opacity:Q})});const ae=u(H,h,N,U);dt.bindPopup(`
+
+ Connection to ${z.node_name||"Unknown Node"}
+ Distance: ${ae.toFixed(2)} km
+ Route: ${y(z.route_type)}
+ Signal: ${I(z.rssi)} / ${Z(z.snr)}
+
+ `),v.value.push(dt)},200)};Ht()},T)},G=()=>{if(!s||!w)return;const z=s.getBounds(),H=Math.floor(s.getZoom());m.value.forEach(p=>{s&&p.remove()}),m.value.clear(),v.value.forEach(p=>{s&&p.remove()}),v.value.length=0,w.getClusters([z.getWest(),z.getSouth(),z.getEast(),z.getNorth()],H).forEach(p=>{const[T,N]=p.geometry.coordinates,U=p.properties;if(U.cluster){const O=W.marker([N,T],{icon:l(U.point_count||0)}).addTo(s);O.on("click",()=>{if(s&&w){const st=w.getClusterExpansionZoom(U.cluster_id);s.setView([N,T],st)}});const ot=w.getLeaves(U.cluster_id,1/0).map(st=>`
+ • ${st.properties.advert.node_name||"Unknown Node"} (${st.properties.advert.contact_type})
+
`).join("");O.bindPopup(`
+
+
Cluster: ${U.point_count} nodes
+
+ ${ot}
+
+
+ Click to zoom in and separate nodes
+
+
+ `),m.value.set(`cluster-${U.cluster_id}`,O);const Q=u(E,c,N,T),q=Math.min(Math.floor(Q*5),200),rt={node_name:`Cluster of ${U.point_count} nodes`,contact_type:"Cluster",route_type:2,rssi:null,snr:null,jittered_latitude:N,jittered_longitude:T,latitude:N,longitude:T};V(rt,E,c,"#AAE8E8",q)}else{const O=U.advert,Y=R[O.contact_type]||R.Unknown,ot=n(Y),Q=N,q=T,rt=u(E,c,Q,q),st=W.marker([Q,q],{icon:ot}).addTo(s).bindPopup(`
+
+ ${O.node_name||"Unknown Node"}
+ Type: ${O.contact_type}
+ Distance: ${rt.toFixed(2)} km
+ Signal: ${I(O.rssi)} / ${Z(O.snr)}
+ Route: ${y(O.route_type)}
+ Last Seen: ${P(O.last_seen)}
+ ${O.jittered_latitude?'
Position adjusted to separate overlapping nodes':""}
+
+ `);a.value.set(O.pubkey,st),m.value.set(`node-${O.pubkey}`,st);const dt=Math.min(Math.floor(rt*5),200),xt={...O,jittered_latitude:Q,jittered_longitude:q};V(xt,E,c,Y,dt)}})},X=(z,H)=>{let h=0;et(i.adverts).forEach(T=>{const N=T.properties.advert;if(N.latitude!==null&&N.longitude!==null){const U=R[N.contact_type]||R.Unknown,O=n(U),Y=N.jittered_latitude||N.latitude,ot=N.jittered_longitude||N.longitude,Q=W.marker([Y,ot],{icon:O}).addTo(s).bindPopup(`
+
+ ${N.node_name||"Unknown Node"}
+ Type: ${N.contact_type}
+ Distance: ${u(z,H,Y,ot).toFixed(2)} km
+ Signal: ${I(N.rssi)} / ${Z(N.snr)}
+ Route: ${y(N.route_type)}
+ Last Seen: ${P(N.last_seen)}
+ ${N.jittered_latitude?'
Position adjusted to separate overlapping nodes':""}
+
+ `);a.value.set(N.pubkey,Q);const q=Q.getElement();q&&(q.style.opacity="0",q.style.transition="opacity 0.5s ease-out"),V(N,z,H,U,h),setTimeout(()=>{q&&(q.style.opacity="1")},h+1e3),h+=100}})};if(S.value&&i.adverts.length>0)try{const z=et(i.adverts);lt(z);const H=Math.min(14,s.getZoom());s.setZoom(H),setTimeout(()=>{try{G()}catch(h){console.warn("Error updating clusters:",h),X(E,c)}},100),s.on("moveend",()=>{try{G()}catch(h){console.warn("Error updating clusters on move:",h)}}),s.on("zoomend",()=>{try{G()}catch(h){console.warn("Error updating clusters on zoom:",h)}})}catch(z){console.warn("Error initializing clustering:",z),X(E,c)}else X(E,c);setTimeout(()=>{s&&s.invalidateSize()},1e3)}catch(n){console.error("Error initializing map:",n)}};return o({highlightNode:E=>{const c=a.value.get(E);if(c){const n=c.getElement();if(n){const l=n.querySelector("div");l&&l.classList.add("marker-highlight")}}},unhighlightNode:E=>{const c=a.value.get(E);if(c){const n=c.getElement();if(n){const l=n.querySelector("div");l&&l.classList.remove("marker-highlight")}}},initializeOpenStreetMap:at}),ht(()=>i.adverts,()=>{s&&k.value&&setTimeout(()=>{at()},100)},{immediate:!1}),Xt(()=>{_.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),k.value&&i.adverts.length>0&&setTimeout(()=>{at()},300)}),te(()=>{_.disconnect(),j()}),(E,c)=>(f(),$("div",Oo,[k.value?(f(),$("div",{key:1,ref_key:"mapContainer",ref:g,class:"leaflet-map-container h-96 w-full glass-card backdrop-blur border border-black/6 dark:border-white/10 rounded-[12px] overflow-hidden shadow-sm dark:shadow-none",style:{"min-height":"384px",position:"relative"}},null,512)):(f(),$("div",Vo,c[0]||(c[0]=[ft('No valid coordinates available
Configure base station location to view map
',1)]))),k.value&&E.adverts.length>0?(f(),$("button",{key:2,onClick:d,class:"absolute bottom-3 right-3 z-[1001] flex items-center gap-2 px-3 py-2 bg-black/40 border border-white/10 rounded-lg text-white/80 hover:bg-white/10 hover:text-white transition-colors text-sm backdrop-blur-sm"},[c[1]||(c[1]=t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})],-1)),t("span",Ho,C(E.showLegend?"Hide":"Show"),1)])):D("",!0),k.value&&E.adverts.length>0&&E.showLegend?(f(),$("div",Zo,[c[2]||(c[2]=ft('',2)),t("div",Wo,C(E.adverts.length)+" node"+C(E.adverts.length!==1?"s":"")+" visible ",1)])):D("",!0),k.value?(f(),$("div",Qo," © OpenStreetMap contributors © CARTO ")):D("",!0)]))}}),Ko=It(qo,[["__scopeId","data-v-a6a23e33"]]),Go={class:"relative","data-menu-container":""},Jt=bt({__name:"NeighborMenu",props:{neighbor:{},canPing:{type:Boolean}},emits:["ping","delete","show-details"],setup(A,{emit:o}){const r=window.__neighborMenuManager||{activeMenu:null,setActiveMenu:_=>{if(r.activeMenu&&r.activeMenu!==_)try{r.activeMenu.closeMenu()}catch(k){console.warn("Error closing previous menu:",k)}r.activeMenu=_}};window.__neighborMenuManager=r;const i=A,e=o,d=F(!1),g=F(),s=F({top:0,left:0}),a=()=>{d.value=!1,document.removeEventListener("click",x,!0),document.removeEventListener("keydown",b),r.activeMenu===w&&(r.activeMenu=null)},w={closeMenu:a},m=()=>{a(),e("ping",i.neighbor)},v=()=>{a(),e("show-details",i.neighbor)},S=()=>{a(),e("delete",i.neighbor)},x=_=>{_.target.closest("[data-menu-container]")||a()},b=_=>{_.key==="Escape"&&a()},L=async()=>{if(!d.value&&g.value){r.setActiveMenu(w);const _=g.value.getBoundingClientRect(),k=window.innerWidth,P=144,I=k<1024,Z=_.left+P>k-16;let y=_.left;I&&Z&&(y=_.right-P),y=Math.max(8,y),s.value={top:_.bottom+4,left:y},d.value=!0,await Pt(),document.addEventListener("click",x,!0),document.addEventListener("keydown",b)}else a()};return te(()=>{a()}),(_,k)=>(f(),$("div",Go,[t("button",{ref_key:"buttonRef",ref:g,onClick:L,class:M(["p-1 rounded hover:bg-stroke-subtle dark:hover:bg-white/10 transition-colors text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary/80",{"bg-background-mute dark:bg-stroke/10 text-content-primary dark:text-content-primary/80":d.value}]),"data-menu-container":""},k[0]||(k[0]=[t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z"})],-1)]),2),(f(),Rt(jt,{to:"body"},[d.value?(f(),$("div",{key:0,class:"fixed w-36 bg-white dark:bg-surface-elevated backdrop-blur-lg border border-stroke-subtle dark:border-white/20 rounded-[15px] shadow-2xl z-[999999]",style:At({top:s.value.top+"px",left:s.value.left+"px"}),"data-menu-container":""},[t("div",{class:"py-2"},[t("button",{onClick:v,class:"flex items-center gap-3 w-full px-4 py-3 text-sm text-content-primary dark:text-content-primary hover:bg-primary/10 transition-colors border-b border-stroke-subtle dark:border-white/10"},k[1]||(k[1]=[t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1),t("span",{class:"font-medium"},"Details",-1)])),t("button",{onClick:m,class:"flex items-center gap-3 w-full px-4 py-3 text-sm text-content-primary dark:text-content-primary hover:bg-primary/10 transition-colors border-b border-stroke-subtle dark:border-white/10"},k[2]||(k[2]=[t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8.111 16.404a5.5 5.5 0 017.778 0M12 20h.01m-7.08-7.071c3.904-3.905 10.236-3.905 14.141 0M1.394 9.393c5.857-5.857 15.355-5.857 21.213 0"})],-1),t("span",{class:"font-medium"},"Ping",-1)])),t("button",{onClick:S,class:"flex items-center gap-3 w-full px-4 py-3 text-sm text-accent-red hover:bg-accent-red/10 transition-colors"},k[3]||(k[3]=[t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1),t("span",{class:"font-medium"},"Delete",-1)]))])],4)):D("",!0)]))]))}}),Jo={class:"glass-card/30 backdrop-blur border border-stroke-subtle dark:border-white/10 rounded-[12px] p-6 shadow-sm dark:shadow-none"},Yo={class:"flex items-center justify-between mb-4"},Xo={class:"flex items-center gap-3"},tr={class:"text-content-primary dark:text-content-primary text-lg font-semibold"},er={class:"bg-background-mute dark:bg-white/10 text-content-secondary dark:text-content-primary text-xs px-2 py-1 rounded-full"},or={key:0,class:"text-content-muted dark:text-content-muted"},rr={key:0,class:"hidden lg:flex bg-background-mute dark:bg-surface-elevated/30 backdrop-blur rounded-lg border border-stroke-subtle dark:border-stroke/10 p-1"},nr={class:"hidden lg:block overflow-x-auto"},sr={class:"w-full"},ar={class:"bg-background-mute dark:bg-transparent"},ir={class:"flex items-center gap-1"},lr={class:"flex items-center gap-1"},dr={class:"flex items-center gap-1"},cr={class:"flex items-center gap-1"},ur={class:"flex items-center gap-1"},pr={class:"flex items-center gap-1"},gr={class:"flex items-center gap-1"},mr={class:"flex items-center gap-1"},hr={class:"flex items-center gap-1"},br={class:"bg-surface/50 dark:bg-transparent"},xr=["onMouseenter","onMouseleave"],yr=["onClick","title"],vr={key:0,class:"ml-1 text-xs"},kr={key:0,class:"flex items-center gap-3"},fr={class:"text-content-secondary dark:text-content-muted"},wr={class:"flex gap-1"},_r=["onClick"],Cr=["onClick"],$r={key:1,class:"text-content-muted"},Mr={class:"flex items-center gap-2"},Ar={class:"flex items-end gap-0.5"},Lr={class:"flex items-center gap-2"},Tr=["title"],Er=["title"],Sr={class:"lg:hidden space-y-3"},Br=["onClick"],Nr={class:"flex items-center justify-between mb-3"},Fr={class:"flex items-center gap-3"},Dr={class:"text-content-primary dark:text-content-primary font-medium text-base"},Pr={class:"flex items-center gap-2"},zr={class:"grid grid-cols-1 gap-3"},Rr={class:"grid grid-cols-2 gap-4"},jr=["onClick","title"],Ir={key:0,class:"ml-1 text-xs"},Ur={class:"flex items-center gap-2 justify-end"},Or={class:"flex items-end gap-0.5"},Vr={class:"grid grid-cols-2 gap-4"},Hr={class:"flex items-center gap-2"},Zr=["title"],Wr={class:"text-content-primary dark:text-content-primary text-sm block text-right"},Qr={key:0,class:"border-t border-white/10 pt-3"},qr={class:"flex items-center justify-between"},Kr={class:"text-content-secondary dark:text-content-muted text-sm font-mono"},Gr={class:"flex gap-2"},Jr=["onClick"],Yr=["onClick"],Xr={class:"grid grid-cols-3 gap-4 pt-3 border-t border-white/10"},tn={class:"text-center"},en={class:"text-content-primary dark:text-content-primary text-sm font-medium"},on={class:"text-center"},rn={class:"text-content-primary dark:text-content-primary text-sm font-medium"},nn={class:"text-center"},sn=["title"],an=bt({__name:"NeighborTable",props:{contactType:{},contactTypeKey:{},adverts:{},originalCount:{default:0},color:{},baseLatitude:{default:null},baseLongitude:{default:null},isCompactView:{type:Boolean,default:!1},isFirstTable:{type:Boolean,default:!1},showViewToggle:{type:Boolean,default:!1}},emits:["highlight-node","unhighlight-node","menu-ping","menu-delete","show-details","toggle-view"],setup(A,{emit:o}){const r=F(null),{getSignalQuality:i}=Ut(),e=F("advert_count"),d=F("desc"),g=A,s=o,a=c=>new Date(c*1e3).toLocaleString(),w=c=>`${c.slice(0,4)}...${c.slice(-4)}`,m=c=>{switch(c){case 2:return{text:"Direct",bgColor:"bg-green-100 dark:bg-green-500/20",borderColor:"border-green-500 dark:border-green-400/30",textColor:"text-green-600 dark:text-green-400"};case 3:return{text:"Transport Direct",bgColor:"bg-green-100 dark:bg-green-600/20",borderColor:"border-green-600/40 dark:border-green-500/30",textColor:"text-green-700 dark:text-green-500"};case 1:return{text:"Flood",bgColor:"bg-yellow-100 dark:bg-yellow-500/20",borderColor:"border-yellow-500 dark:border-yellow-400/30",textColor:"text-yellow-600 dark:text-yellow-400"};case 0:return{text:"Transport Flood",bgColor:"bg-orange-100 dark:bg-orange-500/20",borderColor:"border-orange-500 dark:border-orange-400/30",textColor:"text-orange-600 dark:text-orange-400"};default:return{text:"Unknown",bgColor:"bg-gray-500/20",borderColor:"border-gray-400/30",textColor:"text-gray-400"}}},v=c=>c?`${c} dBm`:"N/A",S=c=>c?`${c} dB`:"N/A",x=(c,n,l,B)=>{const V=(l-c)*Math.PI/180,G=(B-n)*Math.PI/180,X=Math.sin(V/2)*Math.sin(V/2)+Math.cos(c*Math.PI/180)*Math.cos(l*Math.PI/180)*Math.sin(G/2)*Math.sin(G/2);return 6371*(2*Math.atan2(Math.sqrt(X),Math.sqrt(1-X)))},b=c=>g.baseLatitude===null||g.baseLongitude===null||c.latitude===null||c.longitude===null?"N/A":`${x(g.baseLatitude,g.baseLongitude,c.latitude,c.longitude).toFixed(1)} km`,L=async c=>{try{return await navigator.clipboard.writeText(c),!0}catch{const n=document.createElement("textarea");return n.value=c,document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n),!0}},_=c=>{const n=Date.now(),l=c*1e3,B=n-l,R=Math.floor(B/1e3),V=Math.floor(R/60),G=Math.floor(V/60),X=Math.floor(G/24);return R<60?`${R}s ago`:V<60?`${V}m ago`:G<24?`${G}h ago`:`${X}d ago`},k=c=>{const n=Date.now(),l=c*1e3,B=n-l,R=Math.floor(B/(1e3*60*60));return R<1?{color:"text-green-600 dark:text-green-400"}:R<26?{color:"text-yellow-600 dark:text-yellow-400"}:{color:"text-red-600 dark:text-red-400"}},P=async(c,n)=>{const l=`${c.toFixed(6)}, ${n.toFixed(6)}`;await L(l)},I=(c,n)=>{const l=`https://www.google.com/maps?q=${c},${n}`;window.open(l,"_blank")},Z=async c=>{await L(c),r.value=c,setTimeout(()=>{r.value=null},2e3)},y=c=>{const n=i(c);return{bars:n.bars,color:n.color}},u=()=>g.isCompactView?"py-2 px-2":"py-4 px-3",j=()=>{s("toggle-view")},K=c=>{s("highlight-node",c)},et=c=>{s("unhighlight-node",c)},lt=c=>{s("menu-ping",c)},at=c=>{s("show-details",c)},yt=c=>{s("menu-delete",c)},nt=c=>{e.value===c?d.value=d.value==="asc"?"desc":"asc":(e.value=c,d.value=typeof g.adverts[0]?.[c]=="number"?"desc":"asc")},E=J(()=>e.value?[...g.adverts].sort((c,n)=>{const l=c[e.value],B=n[e.value];if(l==null)return 1;if(B==null)return-1;let R=0;return typeof l=="string"&&typeof B=="string"?R=l.localeCompare(B):typeof l=="number"&&typeof B=="number"?R=l-B:typeof l=="boolean"&&typeof B=="boolean"&&(R=l===B?0:l?1:-1),d.value==="asc"?R:-R}):g.adverts);return(c,n)=>(f(),$("div",Jo,[t("div",Yo,[t("div",Xo,[t("div",{class:"w-3 h-3 rounded-full border border-white/20",style:At({backgroundColor:c.color})},null,4),t("h3",tr,C(c.contactType),1),t("span",er,[tt(C(c.adverts.length)+" ",1),c.originalCount>0&&c.adverts.lengthnt("node_name")),class:M(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${u().split(" ")[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[t("div",ir,[n[12]||(n[12]=tt(" Node Name ",-1)),e.value==="node_name"?(f(),$("svg",{key:0,class:M(["w-3 h-3",d.value==="asc"?"":"rotate-180"]),fill:"currentColor",viewBox:"0 0 20 20"},n[11]||(n[11]=[t("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"},null,-1)]),2)):D("",!0)])],2),t("th",{onClick:n[1]||(n[1]=l=>nt("pubkey")),class:M(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${u().split(" ")[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[t("div",lr,[n[14]||(n[14]=tt(" Public Key ",-1)),e.value==="pubkey"?(f(),$("svg",{key:0,class:M(["w-3 h-3",d.value==="asc"?"":"rotate-180"]),fill:"currentColor",viewBox:"0 0 20 20"},n[13]||(n[13]=[t("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"},null,-1)]),2)):D("",!0)])],2),t("th",{class:M(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${u().split(" ")[1]} border-b border-stroke-subtle dark:border-white/5`)},"Location",2),t("th",{class:M(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${u().split(" ")[1]} border-b border-stroke-subtle dark:border-white/5`)},"Distance",2),t("th",{onClick:n[2]||(n[2]=l=>nt("route_type")),class:M(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${u().split(" ")[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[t("div",dr,[n[16]||(n[16]=tt(" Route Type ",-1)),e.value==="route_type"?(f(),$("svg",{key:0,class:M(["w-3 h-3",d.value==="asc"?"":"rotate-180"]),fill:"currentColor",viewBox:"0 0 20 20"},n[15]||(n[15]=[t("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"},null,-1)]),2)):D("",!0)])],2),t("th",{onClick:n[3]||(n[3]=l=>nt("zero_hop")),class:M(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${u().split(" ")[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[t("div",cr,[n[18]||(n[18]=tt(" Zero Hop ",-1)),e.value==="zero_hop"?(f(),$("svg",{key:0,class:M(["w-3 h-3",d.value==="asc"?"":"rotate-180"]),fill:"currentColor",viewBox:"0 0 20 20"},n[17]||(n[17]=[t("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"},null,-1)]),2)):D("",!0)])],2),t("th",{onClick:n[4]||(n[4]=l=>nt("rssi")),class:M(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${u().split(" ")[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[t("div",ur,[n[20]||(n[20]=tt(" RSSI ",-1)),e.value==="rssi"?(f(),$("svg",{key:0,class:M(["w-3 h-3",d.value==="asc"?"":"rotate-180"]),fill:"currentColor",viewBox:"0 0 20 20"},n[19]||(n[19]=[t("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"},null,-1)]),2)):D("",!0)])],2),t("th",{onClick:n[5]||(n[5]=l=>nt("snr")),class:M(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${u().split(" ")[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[t("div",pr,[n[22]||(n[22]=tt(" SNR ",-1)),e.value==="snr"?(f(),$("svg",{key:0,class:M(["w-3 h-3",d.value==="asc"?"":"rotate-180"]),fill:"currentColor",viewBox:"0 0 20 20"},n[21]||(n[21]=[t("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"},null,-1)]),2)):D("",!0)])],2),t("th",{onClick:n[6]||(n[6]=l=>nt("last_seen")),class:M(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${u().split(" ")[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[t("div",gr,[n[24]||(n[24]=tt(" Last Seen ",-1)),e.value==="last_seen"?(f(),$("svg",{key:0,class:M(["w-3 h-3",d.value==="asc"?"":"rotate-180"]),fill:"currentColor",viewBox:"0 0 20 20"},n[23]||(n[23]=[t("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"},null,-1)]),2)):D("",!0)])],2),t("th",{onClick:n[7]||(n[7]=l=>nt("first_seen")),class:M(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${u().split(" ")[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[t("div",mr,[n[26]||(n[26]=tt(" First Seen ",-1)),e.value==="first_seen"?(f(),$("svg",{key:0,class:M(["w-3 h-3",d.value==="asc"?"":"rotate-180"]),fill:"currentColor",viewBox:"0 0 20 20"},n[25]||(n[25]=[t("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"},null,-1)]),2)):D("",!0)])],2),t("th",{onClick:n[8]||(n[8]=l=>nt("advert_count")),class:M(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${u().split(" ")[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[t("div",hr,[n[28]||(n[28]=tt(" Advert Count ",-1)),e.value==="advert_count"?(f(),$("svg",{key:0,class:M(["w-3 h-3",d.value==="asc"?"":"rotate-180"]),fill:"currentColor",viewBox:"0 0 20 20"},n[27]||(n[27]=[t("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"},null,-1)]),2)):D("",!0)])],2)])]),t("tbody",br,[(f(!0),$(ct,null,gt(E.value,l=>(f(),$("tr",{key:l.id,class:"hover:bg-background-mute/50 dark:hover:bg-white/5 transition-colors",onMouseenter:B=>K(l.pubkey),onMouseleave:B=>et(l.pubkey)},[t("td",{class:M(u())},[it(Jt,{neighbor:l,onPing:lt,onShowDetails:at,onDelete:yt},null,8,["neighbor"])],2),t("td",{class:M(`${u()} text-content-primary dark:text-content-primary text-sm`)},C(l.node_name||"Unknown"),3),t("td",{class:M(`${u()} text-content-primary dark:text-content-primary text-sm font-mono`)},[t("button",{onClick:B=>Z(l.pubkey),class:M(["text-content-primary dark:text-content-primary hover:text-primary-light transition-colors cursor-pointer underline underline-offset-2 decoration-gray-400 dark:decoration-white/30 hover:decoration-primary-light/60",r.value===l.pubkey?"text-green-600 dark:text-green-400 decoration-green-400/60":""]),title:r.value===l.pubkey?"Copied!":"Click to copy full public key"},[tt(C(w(l.pubkey))+" ",1),r.value===l.pubkey?(f(),$("span",vr,"✓")):D("",!0)],10,yr)],2),t("td",{class:M(`${u()} text-content-primary dark:text-content-primary text-sm`)},[l.latitude!==null&&l.longitude!==null?(f(),$("div",kr,[t("span",fr,C(l.latitude.toFixed(4))+", "+C(l.longitude.toFixed(4)),1),t("div",wr,[t("button",{onClick:B=>P(l.latitude,l.longitude),class:"text-content-muted dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors cursor-pointer",title:"Copy coordinates to clipboard"},n[29]||(n[29]=[t("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:"currentColor","stroke-width":"2"}),t("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1",stroke:"currentColor","stroke-width":"2"})],-1)]),8,_r),t("button",{onClick:B=>I(l.latitude,l.longitude),class:"text-white/60 hover:text-blue-600 dark:text-blue-400 transition-colors cursor-pointer",title:"Open in Google Maps"},n[30]||(n[30]=[t("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("path",{d:"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z",stroke:"currentColor","stroke-width":"2"}),t("circle",{cx:"12",cy:"10",r:"3",stroke:"currentColor","stroke-width":"2"})],-1)]),8,Cr)])])):(f(),$("span",$r,"Unknown"))],2),t("td",{class:M(`${u()} text-content-primary dark:text-content-primary text-sm`)},C(b(l)),3),t("td",{class:M(`${u()} text-content-primary dark:text-content-primary text-sm`)},[t("span",{class:M(["inline-block px-2 py-1 rounded-full text-xs border transition-colors",m(l.route_type).bgColor,m(l.route_type).borderColor,m(l.route_type).textColor])},C(m(l.route_type).text),3)],2),t("td",{class:M(`${u()} text-content-primary dark:text-content-primary text-sm`)},[t("span",{class:M(["inline-block px-2 py-1 rounded-full text-xs border transition-colors",l.zero_hop?"bg-green-100 dark:bg-green-500/20 border-green-500 dark:border-green-400/30 text-green-600 dark:text-green-400":"bg-orange-100 dark:bg-orange-500/20 border-orange-500 dark:border-orange-400/30 text-orange-600 dark:text-orange-400"])},C(l.zero_hop?"Zero Hop":"Multi-Hop"),3)],2),t("td",{class:M(`${u()} text-content-primary dark:text-content-primary text-sm`)},[t("div",Mr,[t("div",Ar,[(f(),$(ct,null,gt(5,B=>t("div",{key:B,class:M(["w-1 transition-colors",B<=y(l.rssi).bars?y(l.rssi).color:"text-gray-600"]),style:At({height:`${4+B*2}px`})},n[31]||(n[31]=[t("div",{class:"w-full h-full bg-current rounded-sm"},null,-1)]),6)),64))]),t("span",{class:M(y(l.rssi).color)},C(v(l.rssi)),3)])],2),t("td",{class:M(`${u()} text-content-primary dark:text-content-primary text-sm`)},C(S(l.snr)),3),t("td",{class:M(`${u()} text-content-primary dark:text-content-primary text-sm`)},[t("div",Lr,[t("div",{class:M(["w-2 h-2 rounded-full",k(l.last_seen).color==="text-green-600 dark:text-green-400"?"bg-green-400":"",k(l.last_seen).color==="text-yellow-600 dark:text-yellow-400"?"bg-yellow-400":"",k(l.last_seen).color==="text-red-600 dark:text-red-400"?"bg-red-400":""])},null,2),t("span",{class:M([k(l.last_seen).color,"cursor-help"]),title:a(l.last_seen)},C(_(l.last_seen)),11,Tr)])],2),t("td",{class:M(`${u()} text-content-primary dark:text-content-primary text-sm`)},[t("span",{title:a(l.first_seen),class:"cursor-help"},C(_(l.first_seen)),9,Er)],2),t("td",{class:M(`${u()} text-content-primary dark:text-content-primary text-sm text-center`)},C(l.advert_count),3)],40,xr))),128))])])]),t("div",Sr,[(f(!0),$(ct,null,gt(E.value,l=>(f(),$("div",{key:l.id,class:"bg-surface/50 dark:bg-transparent border border-stroke-subtle dark:border-white/10 rounded-lg p-4 hover:bg-background-mute/50 dark:hover:bg-white/5 transition-colors",onClick:B=>K(l.pubkey)},[t("div",Nr,[t("div",Fr,[t("h4",Dr,C(l.node_name||"Unknown Node"),1),t("div",Pr,[t("span",{class:M(["inline-block px-2 py-1 rounded-full text-xs border",m(l.route_type).bgColor,m(l.route_type).borderColor,m(l.route_type).textColor])},C(m(l.route_type).text),3),t("span",{class:M(["inline-block px-2 py-1 rounded-full text-xs border",l.zero_hop?"bg-green-100 dark:bg-green-500/20 border-green-500 dark:border-green-400/30 text-green-600 dark:text-green-400":"bg-orange-100 dark:bg-orange-500/20 border-orange-500 dark:border-orange-400/30 text-orange-600 dark:text-orange-400"])},C(l.zero_hop?"Zero Hop":"Multi-Hop"),3)])]),it(Jt,{neighbor:l,onPing:lt,onShowDetails:at,onDelete:yt},null,8,["neighbor"])]),t("div",zr,[t("div",Rr,[t("div",null,[n[32]||(n[32]=t("div",{class:"text-content-muted text-xs mb-1"},"Public Key",-1)),t("button",{onClick:B=>Z(l.pubkey),class:M(["text-content-primary dark:text-content-primary hover:text-primary-light transition-colors cursor-pointer font-mono text-sm underline underline-offset-2 decoration-gray-400 dark:decoration-white/30 hover:decoration-primary-light/60 break-all",r.value===l.pubkey?"text-green-600 dark:text-green-400 decoration-green-400/60":""]),title:r.value===l.pubkey?"Copied!":"Click to copy full public key"},[tt(C(w(l.pubkey))+" ",1),r.value===l.pubkey?(f(),$("span",Ir,"✓")):D("",!0)],10,jr)]),t("div",null,[n[34]||(n[34]=t("div",{class:"text-content-muted text-xs mb-1"},"Signal",-1)),t("div",Ur,[t("div",Or,[(f(),$(ct,null,gt(5,B=>t("div",{key:B,class:M(["w-1.5 transition-colors",B<=y(l.rssi).bars?y(l.rssi).color:"text-gray-600"]),style:At({height:`${6+B*2}px`})},n[33]||(n[33]=[t("div",{class:"w-full h-full bg-current rounded-sm"},null,-1)]),6)),64))]),t("span",{class:M(`${y(l.rssi).color} text-sm font-medium`)},C(v(l.rssi)),3)])])]),t("div",Vr,[t("div",null,[n[35]||(n[35]=t("div",{class:"text-content-muted text-xs mb-1"},"Last Seen",-1)),t("div",Hr,[t("div",{class:M(["w-2 h-2 rounded-full",k(l.last_seen).color==="text-green-600 dark:text-green-400"?"bg-green-400":"",k(l.last_seen).color==="text-yellow-600 dark:text-yellow-400"?"bg-yellow-400":"",k(l.last_seen).color==="text-red-600 dark:text-red-400"?"bg-red-400":""])},null,2),t("span",{class:M(`${k(l.last_seen).color} text-sm`),title:a(l.last_seen)},C(_(l.last_seen)),11,Zr)])]),t("div",null,[n[36]||(n[36]=t("div",{class:"text-content-muted text-xs mb-1"},"Distance",-1)),t("span",Wr,C(b(l)),1)])]),l.latitude!==null&&l.longitude!==null?(f(),$("div",Qr,[n[39]||(n[39]=t("div",{class:"text-content-muted text-xs mb-1"},"Location",-1)),t("div",qr,[t("span",Kr,C(l.latitude.toFixed(4))+", "+C(l.longitude.toFixed(4)),1),t("div",Gr,[t("button",{onClick:B=>P(l.latitude,l.longitude),class:"text-content-muted dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors p-2 hover:bg-stroke-subtle dark:hover:bg-white/10 rounded-lg",title:"Copy coordinates"},n[37]||(n[37]=[t("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:"currentColor","stroke-width":"2"}),t("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1",stroke:"currentColor","stroke-width":"2"})],-1)]),8,Jr),t("button",{onClick:B=>I(l.latitude,l.longitude),class:"text-white/60 hover:text-blue-600 dark:text-blue-400 transition-colors p-2 hover:bg-white/10 rounded-lg",title:"Open in Maps"},n[38]||(n[38]=[t("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("path",{d:"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z",stroke:"currentColor","stroke-width":"2"}),t("circle",{cx:"12",cy:"10",r:"3",stroke:"currentColor","stroke-width":"2"})],-1)]),8,Yr)])])])):D("",!0),t("div",Xr,[t("div",tn,[n[40]||(n[40]=t("div",{class:"text-content-muted text-xs mb-1"},"SNR",-1)),t("span",en,C(S(l.snr)),1)]),t("div",on,[n[41]||(n[41]=t("div",{class:"text-content-muted text-xs mb-1"},"Adverts",-1)),t("span",rn,C(l.advert_count),1)]),t("div",nn,[n[42]||(n[42]=t("div",{class:"text-content-muted text-xs mb-1"},"First Seen",-1)),t("span",{class:"text-content-primary dark:text-content-primary text-sm",title:a(l.first_seen)},C(_(l.first_seen)),9,sn)])])])],8,Br))),128))])]))}}),ln={class:"space-y-6"},dn={key:0,class:"flex items-center justify-center py-12"},cn={key:1,class:"bg-red-50 dark:bg-accent-red/10 border border-red-300 dark:border-accent-red/20 rounded-[15px] p-6"},un={class:"flex items-center gap-3"},pn={class:"text-red-500 dark:text-accent-red/80 text-sm"},gn={key:0,class:""},mn={class:"flex items-center justify-between"},hn={class:"flex items-center gap-3"},bn={class:"hidden lg:flex bg-background-mute dark:bg-surface-elevated/30 backdrop-blur rounded-lg border border-stroke-subtle dark:border-stroke/10 mb p-1"},xn={class:"flex items-center gap-2"},yn={key:0,class:"ml-1 bg-accent-cyan/20 text-accent-cyan border border-accent-cyan/30 text-xs px-1.5 py-0.5 rounded-full font-medium"},vn={class:"bg-background dark:bg-background/30 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4 mt-4 space-y-4"},kn={class:"grid grid-cols-1 md:grid-cols-3 gap-4"},fn={key:1,class:"text-center py-12"},wn={key:2,class:"text-center py-12"},Tn=bt({name:"NeighborsView",__name:"Neighbors",setup(A){const o=Yt(),r={0:"Unknown",1:"Chat Node",2:"Repeater",3:"Room Server",4:"Hybrid Node"},i={0:"#6b7280",1:"#60a5fa",2:"#34d399",3:"#a855f7",4:"#f59e0b"},e=F({}),d=F(!0),g=F(null),s=F(_t("neighbors_compactView",!1)),a=F(_t("neighbors_showMapLegend",typeof window<"u"?window.innerWidth>=1024:!0)),w=F(_t("neighbors_showFilters",!1)),m=F(_t("neighbors_filters",{zeroHop:"all",routeType:"all",searchText:""}));ht(s,h=>Ct("neighbors_compactView",h)),ht(a,h=>Ct("neighbors_showMapLegend",h)),ht(w,h=>Ct("neighbors_showFilters",h)),ht(m,h=>Ct("neighbors_filters",h),{deep:!0});const v=F(!1),S=F(!1),x=F(!1),b=F(null),L=F(null),_=F(null),k=F(null),P=F(!1),I=F(null),Z=J(()=>{if(!k.value)return null;const h=k.value;return{id:h.id,pubkey:h.pubkey,node_name:h.node_name,contact_type:h.contact_type,latitude:h.latitude,longitude:h.longitude,rssi:h.rssi,snr:h.snr,route_type:h.route_type,last_seen:h.last_seen,first_seen:h.first_seen,advert_count:h.advert_count,timestamp:h.timestamp,is_repeater:h.is_repeater,is_new_neighbor:h.is_new_neighbor,zero_hop:h.zero_hop}}),y=J(()=>o.stats?.config?.repeater?.latitude),u=J(()=>o.stats?.config?.repeater?.longitude),j=h=>h.filter(p=>{if(m.value.zeroHop!=="all"){const T=p.zero_hop;if(m.value.zeroHop==="true"&&!T||m.value.zeroHop==="false"&&T)return!1}if(m.value.routeType!=="all"){const T=p.route_type;if(m.value.routeType==="direct"&&T!==2||m.value.routeType==="transport_direct"&&T!==3||m.value.routeType==="flood"&&T!==1||m.value.routeType==="transport_flood"&&T!==0)return!1}if(m.value.searchText){const T=m.value.searchText.toLowerCase(),N=p.node_name?.toLowerCase()||"",U=p.pubkey.toLowerCase();if(!N.includes(T)&&!U.includes(T))return!1}return!0}),K=()=>{m.value={zeroHop:"all",routeType:"all",searchText:""}},et=J(()=>m.value.zeroHop!=="all"||m.value.routeType!=="all"||m.value.searchText!==""),lt=J(()=>{const h={};for(const[p,T]of Object.entries(e.value))h[p]=j(T);return h}),at=J(()=>Object.entries(r).filter(([h])=>lt.value[h]?.length>0).sort(([h],[p])=>parseInt(h)-parseInt(p))),yt=J(()=>Object.values(e.value).flat().filter(h=>{const p=h.latitude,T=h.longitude;return p!=null&&p!==0&&T!==null&&T!==void 0&&T!==0&&typeof p=="number"&&typeof T=="number"&&!isNaN(p)&&!isNaN(T)&&h.zero_hop===!0})),nt=async h=>{try{const p=await Et.get(`/adverts_by_contact_type?contact_type=${encodeURIComponent(h)}&hours=168`);return p.success&&Array.isArray(p.data)?p.data:[]}catch(p){return console.error(`Error fetching adverts for contact type ${h}:`,p),[]}},E=async()=>{d.value=!0,g.value=null;try{e.value={};for(const[h,p]of Object.entries(r)){const T=await nt(p);T.length>0&&(e.value[h]=T)}}catch(h){console.error("Error loading adverts:",h),g.value=h instanceof Error?h.message:"Failed to load neighbor data"}finally{d.value=!1}},c=F(),n=h=>{c.value?.highlightNode(h)},l=h=>{c.value?.unhighlightNode(h)},B=async h=>{const p=h;b.value=null,L.value=null,x.value=!0,_.value=p.node_name||"Unknown Node",S.value=!0;try{const N=`0x${parseInt(p.pubkey.substring(0,2),16).toString(16).padStart(2,"0")}`;console.log(`Pinging neighbor ${p.node_name||"Unknown"} (${N})...`);const U=await Et.pingNeighbor(N,10);U.success&&U.data?(b.value=U.data,console.log("Ping successful:",U.data)):(L.value=U.error||"Unknown error occurred",console.error("Failed to ping neighbor:",U.error))}catch(T){console.error("Error pinging neighbor:",T),L.value=T instanceof Error?T.message:"Unknown error occurred"}finally{x.value=!1}},R=()=>{S.value=!1,b.value=null,L.value=null,_.value=null},V=h=>{k.value=h,v.value=!0},G=h=>{I.value=h,P.value=!0},X=()=>{P.value=!1,I.value=null},z=()=>{v.value=!1,k.value=null},H=async h=>{try{await Et.deleteAdvert(h),await E(),z()}catch(p){console.error("Error deleting neighbor:",p)}};return Xt(async()=>{await E()}),(h,p)=>(f(),$("div",ln,[d.value?(f(),$("div",dn,p[7]||(p[7]=[t("div",{class:"text-center"},[t("div",{class:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto mb-4"}),t("p",{class:"text-content-secondary dark:text-content-muted"},"Loading neighbor data...")],-1)]))):g.value?(f(),$("div",cn,[t("div",un,[p[9]||(p[9]=t("svg",{class:"w-5 h-5 text-red-600 dark:text-accent-red",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})],-1)),t("div",null,[p[8]||(p[8]=t("h3",{class:"text-red-600 dark:text-accent-red font-medium"},"Error Loading Neighbors",-1)),t("p",pn,C(g.value),1)])])])):(f(),$(ct,{key:2},[it(Ko,{ref_key:"networkMapRef",ref:c,adverts:yt.value,"base-latitude":y.value,"base-longitude":u.value,"show-legend":a.value,"onUpdate:showLegend":p[0]||(p[0]=T=>a.value=T)},null,8,["adverts","base-latitude","base-longitude","show-legend"]),Object.keys(e.value).length>0?(f(),$("div",gn,[t("div",mn,[p[14]||(p[14]=t("span",{class:"text-content-primary dark:text-content-primary text-lg font-semibold"},null,-1)),t("div",hn,[t("div",bn,[t("button",{onClick:p[1]||(p[1]=T=>s.value=!1),class:M(["p-2 rounded-md transition-colors",s.value?"text-content-secondary dark:text-content-muted hover:text-primary hover:bg-primary/10":"bg-primary/20 text-primary border border-primary/30"]),title:"Comfortable view"},p[10]||(p[10]=[t("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("rect",{x:"3",y:"3",width:"18",height:"6",rx:"2",stroke:"currentColor","stroke-width":"2"}),t("rect",{x:"3",y:"12",width:"18",height:"6",rx:"2",stroke:"currentColor","stroke-width":"2"})],-1)]),2),t("button",{onClick:p[2]||(p[2]=T=>s.value=!0),class:M(["p-2 rounded-md transition-colors",s.value?"bg-primary/20 text-primary border border-primary/30":"text-content-secondary dark:text-content-muted hover:text-primary hover:bg-primary/10"]),title:"Compact view"},p[11]||(p[11]=[t("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("rect",{x:"3",y:"3",width:"18",height:"4",rx:"2",stroke:"currentColor","stroke-width":"2"}),t("rect",{x:"3",y:"10",width:"18",height:"4",rx:"2",stroke:"currentColor","stroke-width":"2"}),t("rect",{x:"3",y:"17",width:"18",height:"4",rx:"2",stroke:"currentColor","stroke-width":"2"})],-1)]),2)]),t("div",xn,[t("button",{onClick:p[3]||(p[3]=T=>w.value=!w.value),class:M(["px-3 py-1.5 text-xs rounded-lg transition-colors border",et.value?"bg-primary/20 text-primary border-primary/30":"bg-background-mute dark:bg-white/10 text-content-secondary dark:text-content-primary border-stroke-subtle dark:border-stroke/20 hover:bg-stroke-subtle dark:hover:bg-white/20"])},[p[12]||(p[12]=t("svg",{class:"w-4 h-4 inline mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707v6.586a1 1 0 01-1.447.894l-4-2A1 1 0 717 18.586V13.414a1 1 0 00-.293-.707L.293 6.293A1 1 0 010 5.586V3a1 1 0 011-1z"})],-1)),p[13]||(p[13]=tt(" Filters ",-1)),et.value?(f(),$("span",yn," Active ")):D("",!0)],2),et.value?(f(),$("button",{key:0,onClick:K,class:"px-3 py-1.5 text-xs rounded-lg bg-background-mute dark:bg-white/10 text-content-secondary dark:text-content-primary border border-stroke-subtle dark:border-stroke/20 hover:bg-stroke-subtle dark:hover:bg-white/20 transition-colors"}," Clear Filters ")):D("",!0)])])]),wt(t("div",vn,[t("div",kn,[t("div",null,[p[16]||(p[16]=t("label",{class:"block text-xs font-medium text-content-secondary dark:text-content-muted mb-1"},"Zero Hop",-1)),wt(t("select",{"onUpdate:modelValue":p[4]||(p[4]=T=>m.value.zeroHop=T),class:"w-full bg-surface dark:bg-surface/50 border border-stroke-subtle dark:border-stroke/20 rounded-lg px-3 py-2 text-content-primary dark:text-content-primary text-sm focus:border-primary/50 focus:outline-none"},p[15]||(p[15]=[t("option",{value:"all"},"All Nodes",-1),t("option",{value:"true"},"Zero Hop Only",-1),t("option",{value:"false"},"Multi-Hop Only",-1)]),512),[[Wt,m.value.zeroHop]])]),t("div",null,[p[18]||(p[18]=t("label",{class:"block text-xs font-medium text-content-secondary dark:text-content-muted mb-1"},"Route Type",-1)),wt(t("select",{"onUpdate:modelValue":p[5]||(p[5]=T=>m.value.routeType=T),class:"w-full bg-surface dark:bg-surface/50 border border-stroke-subtle dark:border-stroke/20 rounded-lg px-3 py-2 text-content-primary dark:text-content-primary text-sm focus:border-primary/50 focus:outline-none"},p[17]||(p[17]=[ft('',5)]),512),[[Wt,m.value.routeType]])]),t("div",null,[p[19]||(p[19]=t("label",{class:"block text-xs font-medium text-content-secondary dark:text-content-muted mb-1"},"Search",-1)),wt(t("input",{"onUpdate:modelValue":p[6]||(p[6]=T=>m.value.searchText=T),type:"text",placeholder:"Node name or pubkey...",class:"w-full bg-surface dark:bg-surface/50 border border-stroke-subtle dark:border-stroke/20 rounded-lg px-3 py-2 text-content-primary dark:text-content-primary text-sm focus:border-primary/50 focus:outline-none placeholder-gray-400 dark:placeholder-white/40"},null,512),[[le,m.value.searchText]])])])],512),[[ie,w.value]])])):D("",!0),(f(!0),$(ct,null,gt(at.value,([T,N])=>(f(),$("div",{key:T,class:"space-y-6"},[it(an,{"contact-type":N,"contact-type-key":T,adverts:lt.value[T],"original-count":e.value[T]?.length||0,color:i[parseInt(T)],"base-latitude":y.value,"base-longitude":u.value,"is-compact-view":s.value,"is-first-table":!1,"show-view-toggle":!1,onHighlightNode:n,onUnhighlightNode:l,onMenuPing:B,onMenuDelete:V,onShowDetails:G},null,8,["contact-type","contact-type-key","adverts","original-count","color","base-latitude","base-longitude","is-compact-view"])]))),128)),at.value.length===0&&Object.keys(e.value).length===0?(f(),$("div",fn,[p[20]||(p[20]=ft('No Neighbors Found
No mesh neighbors have been discovered in your area yet.
',3)),t("button",{onClick:E,class:"mt-4 px-4 py-2 bg-primary/20 text-primary border border-primary/30 rounded-lg hover:bg-primary/30 transition-colors"}," Refresh ")])):at.value.length===0&&et.value?(f(),$("div",wn,[p[21]||(p[21]=ft('No neighbors match your filters
Try adjusting your filter criteria to see more results.
',3)),t("button",{onClick:K,class:"px-4 py-2 bg-primary/20 text-primary border border-primary/30 rounded-lg hover:bg-primary/30 transition-colors"}," Clear Filters ")])):D("",!0)],64)),it(be,{show:v.value,neighbor:Z.value,onClose:z,onDelete:H},null,8,["show","neighbor"]),it(qe,{show:S.value,"node-name":_.value,result:b.value,error:L.value,loading:x.value,onClose:R},null,8,["show","node-name","result","error","loading"]),it(zo,{"is-open":P.value,neighbor:I.value,"base-latitude":y.value,"base-longitude":u.value,onClose:X},null,8,["is-open","neighbor","base-latitude","base-longitude"])]))}});export{Tn as default};
diff --git a/repeater/web/html/assets/RoomServers-BzhrqUTJ.js b/repeater/web/html/assets/RoomServers-BzhrqUTJ.js
new file mode 100644
index 0000000..6d90b62
--- /dev/null
+++ b/repeater/web/html/assets/RoomServers-BzhrqUTJ.js
@@ -0,0 +1 @@
+import{a as ve,r as d,D as xe,o as be,L as x,b as s,e,f as Q,g as u,i as G,k as b,t as a,j as h,F as I,h as J,w as m,v,X as Y,s as Z,p as n}from"./index-D0IT5vDS.js";import{g as ye,s as ge}from"./preferences-DtwbSSgO.js";import{_ as ke}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-CidOa_xU.js";import{_ as fe}from"./MessageDialog.vue_vue_type_script_setup_true_lang-C6ugQFfD.js";const he={class:"p-6 space-y-6"},we={class:"relative overflow-hidden rounded-[20px] p-6 mb-6 glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10"},_e={class:"relative flex items-center justify-between"},Ce={key:0,class:"grid grid-cols-1 md:grid-cols-3 gap-4"},Me={class:"group relative overflow-hidden glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-5 hover:scale-[1.02] transition-all duration-300 cursor-pointer"},je={class:"relative flex items-center justify-between"},Le={class:"text-3xl font-bold text-content-primary dark:text-content-primary mb-1"},Se={class:"group relative overflow-hidden glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-5 hover:scale-[1.02] transition-all duration-300 cursor-pointer"},$e={class:"relative flex items-center justify-between"},Ae={class:"text-3xl font-bold text-primary mb-1"},Ve={class:"group relative overflow-hidden glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-5 hover:scale-[1.02] transition-all duration-300 cursor-pointer"},Be={class:"relative flex items-center justify-between"},Re={key:0,class:"w-6 h-6 text-accent-green",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ze={key:1,class:"w-6 h-6 text-accent-yellow",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Ee={class:"glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-6"},Fe={key:0,class:"flex items-center justify-center py-12"},De={key:1,class:"flex items-center justify-center py-12"},Ie={class:"text-center"},Ne={class:"text-content-secondary dark:text-content-muted text-sm mb-4"},Ue={key:2,class:"space-y-4"},He={class:"relative flex items-start justify-between"},Ke={class:"flex-1"},Oe={class:"flex items-center gap-3 mb-4"},Pe={class:"relative"},Te={key:0,class:"absolute inset-0 bg-accent-green/50 rounded-full animate-ping"},Ge={class:"text-xl font-bold text-content-primary dark:text-content-primary group-hover:text-primary transition-colors"},Je={key:0,class:"text-content-muted dark:text-content-muted text-sm"},qe={class:"grid grid-cols-1 md:grid-cols-2 gap-3 text-sm mb-3"},We={class:"text-content-primary dark:text-content-primary/90 ml-2"},Xe={class:"flex items-center gap-2"},Qe={key:0,class:"text-content-primary dark:text-content-primary/90 font-mono ml-2 text-xs"},Ye={key:1,class:"text-content-muted dark:text-content-muted ml-2 text-xs"},Ze=["onClick"],et={class:"text-content-primary dark:text-content-primary/90 ml-2"},tt={key:0},rt={class:"text-content-primary dark:text-content-primary/90 ml-2"},ot={key:0,class:"text-accent-green"},st={key:1,class:"text-content-muted dark:text-content-muted"},nt={key:2,class:"text-primary"},at={key:0,class:"text-xs text-content-muted dark:text-content-muted font-mono"},lt={class:"ml-4 flex flex-wrap gap-2"},dt=["onClick","disabled","title"],it=["onClick","disabled","title"],ut=["onClick"],ct=["onClick"],pt={key:3,class:"text-center py-12 text-content-secondary dark:text-content-muted"},mt={key:1,class:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4"},vt={class:"bg-white dark:bg-surface-elevated backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-6 max-w-2xl w-full max-h-[90vh] overflow-y-auto"},xt={class:"space-y-4"},bt={class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},yt={key:0},gt={key:1,class:"text-content-secondary dark:text-content-muted text-sm"},kt={class:"grid grid-cols-2 gap-4"},ft={class:"grid grid-cols-2 gap-4"},ht={key:2,class:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4"},wt={class:"bg-white dark:bg-surface-elevated backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-6 max-w-2xl w-full max-h-[90vh] overflow-y-auto"},_t={class:"space-y-4"},Ct=["value"],Mt={class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},jt={key:0},Lt={key:1,class:"text-content-secondary dark:text-content-muted text-sm"},St={class:"grid grid-cols-2 gap-4"},$t={class:"grid grid-cols-2 gap-4"},At={key:0,class:"fixed inset-0 bg-black/70 backdrop-blur-md flex items-center justify-center z-50 p-4"},Vt={class:"bg-white dark:bg-surface-elevated backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[20px] p-6 max-w-4xl w-full h-[85vh] flex flex-col shadow-2xl"},Bt={class:"relative overflow-hidden rounded-[15px] mb-6 p-5 bg-white/50 dark:bg-white/5 border border-stroke-subtle dark:border-white/10"},Rt={class:"relative flex items-center justify-between"},zt={class:"flex items-center gap-4"},Et={class:"text-content-secondary dark:text-content-muted text-sm flex items-center gap-2"},Ft={class:"text-primary font-semibold"},Dt={class:"flex items-center gap-2"},It={class:"bg-primary/30 px-1.5 py-0.5 rounded-full text-[10px]"},Nt={class:"flex-1 overflow-y-auto mb-4 space-y-3"},Ut={key:0,class:"flex items-center justify-center py-12"},Ht={key:1,class:"flex items-center justify-center py-12"},Kt={class:"text-center"},Ot={class:"text-content-secondary dark:text-content-muted text-sm mb-4"},Pt={key:2,class:"space-y-3"},Tt={class:"relative flex items-start justify-between gap-3"},Gt={class:"flex-1 min-w-0"},Jt={class:"flex items-center gap-2 mb-3"},qt={class:"flex items-center gap-2 flex-wrap"},Wt={key:0,class:"text-primary text-sm font-bold"},Xt={key:1,class:"text-primary/80 text-xs font-mono bg-primary/10 px-2 py-1 rounded-md border border-primary/20"},Qt={key:2,class:"text-content-muted dark:text-content-muted text-xs"},Yt={class:"text-content-secondary dark:text-content-muted text-xs flex items-center gap-1"},Zt={key:3,class:"text-content-muted dark:text-content-muted/50 text-[10px] font-mono bg-background-mute dark:bg-white/5 px-1.5 py-0.5 rounded"},er={class:"text-content-primary dark:text-content-primary/90 text-sm leading-relaxed break-words whitespace-pre-wrap bg-gray-50 dark:bg-white/5 p-3 rounded-[10px] border border-stroke-subtle dark:border-white/5"},tr=["onClick"],rr={key:0,class:"text-center pt-4"},or={key:1,class:"text-center pt-4"},sr={key:3,class:"flex items-center justify-center h-full"},nr={class:"relative overflow-hidden rounded-[15px] border-t border-stroke-subtle dark:border-white/20 pt-4 mt-4"},ar={class:"relative space-y-3"},lr={class:"flex gap-3"},dr={class:"flex-1 relative"},ir=["onKeydown"],ur=["disabled"],cr={key:1,class:"fixed inset-0 bg-black/70 backdrop-blur-md flex items-center justify-center z-[60] p-4"},pr={class:"bg-white dark:bg-surface-elevated backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-6 max-w-3xl w-full max-h-[80vh] flex flex-col"},mr={class:"flex items-center justify-between mb-4 pb-4 border-b border-stroke-subtle dark:border-white/10"},vr={class:"text-content-secondary dark:text-content-primary/70 text-sm mt-1"},xr={class:"text-primary"},br={class:"flex-1 overflow-y-auto space-y-3"},yr={key:0,class:"text-center py-12"},gr={class:"space-y-2"},kr={class:"flex items-center justify-between"},fr={class:"flex items-center gap-2"},hr={class:"text-content-primary dark:text-content-primary font-semibold"},wr={class:"flex items-center gap-2"},_r={class:"text-content-secondary dark:text-content-muted text-xs"},Cr=["onClick"],Mr={class:"space-y-1 text-xs"},jr={class:"flex items-center gap-2"},Lr={class:"text-primary font-mono bg-primary/10 px-2 py-0.5 rounded"},Sr={class:"flex items-center gap-2"},$r={class:"text-primary font-mono bg-primary/10 px-2 py-0.5 rounded text-[10px] break-all"},Ar={class:"flex items-center justify-between text-xs text-content-secondary dark:text-content-muted"},Vr={class:"flex items-center gap-4"},Br={key:0},Rr={key:1},zr={key:0},Ur=ve({name:"RoomServersView",__name:"RoomServers",setup(Er){const N=d(!1),j=d(null),c=d(null),L=d(!1),B=d(!1),l=d(null),w=d(!1),_=d(!1),S=d(new Set),R=d(!1),z=d(""),U=d(!1),H=d({message:"",variant:"success"}),K=d(!1),y=d(""),E=d(""),g=d([]),$=d(!1),C=d(null),k=d(""),F=d(ye("roomServers_messagesLimit",50)),D=d(0),O=d(!0);xe(F,o=>ge("roomServers_messagesLimit",o));const M=d([]),P=d(!1),p=d({name:"",identity_key:"",type:"room_server",settings:{node_name:"",latitude:0,longitude:0,admin_password:"",guest_password:""}});be(async()=>{await A()});async function A(){N.value=!0,j.value=null;try{const o=await x.getIdentities();o.success?c.value=o.data:j.value=o.error||"Failed to load identities"}catch(o){j.value=o instanceof Error?o.message:"Failed to load identities"}finally{N.value=!1}}async function ee(){try{const o=await x.createIdentity(p.value);o.success?(L.value=!1,q(),await A(),i(o.message||"Identity created successfully!","success")):i(`Failed to create identity: ${o.error}`,"error")}catch(o){i(`Error creating identity: ${o}`,"error")}}async function te(){try{const o=await x.updateIdentity(l.value);o.success?(B.value=!1,l.value=null,await A(),i(o.message||"Identity updated successfully!","success")):i(`Failed to update identity: ${o.error}`,"error")}catch(o){i(`Error updating identity: ${o}`,"error")}}function re(o){z.value=o,R.value=!0}async function oe(){const o=z.value;R.value=!1;try{const t=await x.deleteIdentity(o);t.success?(await A(),i(t.message||"Identity deleted successfully!","success")):i(`Failed to delete identity: ${t.error}`,"error")}catch(t){i(`Error deleting identity: ${t}`,"error")}finally{z.value=""}}function i(o,t){H.value={message:o,variant:t},U.value=!0}async function se(o){try{const t=await x.sendRoomServerAdvert(o);t.success?i(t.message||`Advert sent for '${o}'!`,"success"):i(`Failed to send advert: ${t.error}`,"error")}catch(t){i(`Error sending advert: ${t}`,"error")}}function ne(o){l.value=JSON.parse(JSON.stringify(o)),l.value.settings||(l.value.settings={}),l.value.settings.admin_password||(l.value.settings.admin_password=""),l.value.settings.guest_password||(l.value.settings.guest_password=""),_.value=!1,B.value=!0}function q(){p.value={name:"",identity_key:"",type:"room_server",settings:{node_name:"",latitude:0,longitude:0,admin_password:"",guest_password:""}},w.value=!1}function W(){L.value=!1,B.value=!1,l.value=null,w.value=!1,_.value=!1,q()}function ae(o){S.value.has(o)?S.value.delete(o):S.value.add(o)}async function le(o){y.value=o,K.value=!0,D.value=0,O.value=!0;const t=c.value?.configured.find(r=>r.name===o);E.value=t?.hash||"",await X(),await V(!0)}async function X(){try{console.log("Fetching ACL clients for room:",y.value,"hash:",E.value);const o=await x.getACLClients({identity_hash:E.value,identity_name:y.value});console.log("ACL clients response:",o),o.success&&o.data&&(M.value=o.data.clients||[],console.log("ACL clients loaded:",M.value.length))}catch(o){console.error("Failed to fetch ACL clients:",o)}}async function V(o=!1){o&&(D.value=0,g.value=[]),$.value=!0,C.value=null;try{const t=await x.getRoomMessages({room_name:y.value,limit:F.value,offset:D.value});if(t.success&&t.data){const r=t.data.messages||[];o?g.value=r:g.value=[...g.value,...r],O.value=r.length===F.value}else C.value=t.error||"Failed to load messages"}catch(t){C.value=t instanceof Error?t.message:"Failed to load messages"}finally{$.value=!1}}async function de(){D.value+=F.value,await V(!1)}async function T(){if(k.value.trim())try{const o=await x.postRoomMessage({room_name:y.value,message:k.value,author_pubkey:"server"});o.success?(k.value="",await V(!0)):i(`Failed to send message: ${o.error}`,"error")}catch(o){i(`Error sending message: ${o}`,"error")}}async function ie(o){if(confirm("Are you sure you want to delete this message?"))try{const t=await x.deleteRoomMessage({room_name:y.value,message_id:o});t.success?(await V(!0),i("Message deleted successfully","success")):i(`Failed to delete message: ${t.error}`,"error")}catch(t){i(`Error deleting message: ${t}`,"error")}}function ue(){K.value=!1,y.value="",E.value="",g.value=[],k.value="",C.value=null,M.value=[]}function ce(o){return o?new Date(o*1e3).toLocaleString():"Unknown"}async function pe(o,t){if(confirm("Are you sure you want to remove this client from the ACL?"))try{const r=await x.removeACLClient({public_key:o,identity_hash:t});r.success?(await X(),i("Client removed successfully","success")):i(`Failed to remove client: ${r.error}`,"error")}catch(r){i(`Error removing client: ${r}`,"error")}}return(o,t)=>(n(),s(I,null,[e("div",he,[e("div",we,[t[26]||(t[26]=e("div",{class:"absolute inset-0 bg-gradient-to-br from-primary/20 via-secondary/10 to-accent-purple/20 opacity-50"},null,-1)),t[27]||(t[27]=e("div",{class:"absolute inset-0 bg-gradient-to-tl from-accent-green/10 via-transparent to-primary/10 animate-pulse"},null,-1)),e("div",_e,[t[25]||(t[25]=G('Room Servers
Manage room server identities and messages
',1)),e("button",{onClick:t[0]||(t[0]=r=>L.value=!0),class:"group relative px-6 py-3 bg-gradient-to-r from-primary/30 to-secondary/30 hover:from-primary/40 hover:to-secondary/40 text-content-primary dark:text-content-primary rounded-[12px] border border-primary/50 transition-all hover:scale-105 hover:shadow-lg hover:shadow-primary/20"},t[24]||(t[24]=[e("span",{class:"flex items-center gap-2"},[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})]),b(" Add Room Server ")],-1)]))])]),c.value&&c.value.total_configured>0?(n(),s("div",Ce,[e("div",Me,[t[30]||(t[30]=e("div",{class:"absolute inset-0 bg-gradient-to-br from-white/5 to-transparent opacity-0 group-hover:opacity-100 transition-opacity"},null,-1)),e("div",je,[e("div",null,[t[28]||(t[28]=e("div",{class:"text-content-secondary dark:text-content-muted text-xs font-medium mb-2 uppercase tracking-wide"},"Total Configured",-1)),e("div",Le,a(c.value.total_configured),1)]),t[29]||(t[29]=e("div",{class:"bg-background-mute dark:bg-white/10 p-3 rounded-[12px] group-hover:bg-background-mute dark:group-hover:bg-stroke/20 transition-colors"},[e("svg",{class:"w-6 h-6 text-content-secondary dark:text-content-primary/70",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})])],-1))])]),e("div",Se,[t[33]||(t[33]=e("div",{class:"absolute inset-0 bg-gradient-to-br from-primary/10 to-transparent opacity-0 group-hover:opacity-100 transition-opacity"},null,-1)),e("div",$e,[e("div",null,[t[31]||(t[31]=e("div",{class:"text-content-secondary dark:text-content-muted text-xs font-medium mb-2 uppercase tracking-wide"},"Currently Registered",-1)),e("div",Ae,a(c.value.total_registered),1)]),t[32]||(t[32]=e("div",{class:"bg-primary/20 p-3 rounded-[12px] group-hover:bg-primary/30 transition-colors"},[e("svg",{class:"w-6 h-6 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"})])],-1))])]),e("div",Ve,[t[37]||(t[37]=e("div",{class:"absolute inset-0 bg-gradient-to-br from-accent-green/10 to-transparent opacity-0 group-hover:opacity-100 transition-opacity"},null,-1)),e("div",Be,[e("div",null,[t[34]||(t[34]=e("div",{class:"text-content-secondary dark:text-content-muted text-xs font-medium mb-2 uppercase tracking-wide"},"Status",-1)),e("div",{class:h(["text-3xl font-bold",c.value.total_registered===c.value.total_configured?"text-accent-green":"text-accent-yellow"])},a(c.value.total_registered===c.value.total_configured?"Synced":"Out of Sync"),3)]),e("div",{class:h(["p-3 rounded-[12px] transition-colors",c.value.total_registered===c.value.total_configured?"bg-accent-green/20 group-hover:bg-accent-green/30":"bg-accent-yellow/20 group-hover:bg-accent-yellow/30"])},[c.value.total_registered===c.value.total_configured?(n(),s("svg",Re,t[35]||(t[35]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)]))):(n(),s("svg",ze,t[36]||(t[36]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)])))],2)])])])):u("",!0),e("div",Ee,[N.value?(n(),s("div",Fe,t[38]||(t[38]=[e("div",{class:"text-center"},[e("div",{class:"animate-spin w-8 h-8 border-2 border-stroke-subtle dark:border-stroke/20 border-t-primary rounded-full mx-auto mb-4"}),e("div",{class:"text-content-secondary dark:text-content-primary/70"},"Loading room servers...")],-1)]))):j.value?(n(),s("div",De,[e("div",Ie,[t[39]||(t[39]=e("div",{class:"text-red-600 dark:text-red-400 mb-2"},"Failed to load room servers",-1)),e("div",Ne,a(j.value),1),e("button",{onClick:A,class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors"}," Retry ")])])):c.value&&c.value.configured.length>0?(n(),s("div",Ue,[(n(!0),s(I,null,J(c.value.configured,r=>(n(),s("div",{key:r.name,class:"group relative overflow-hidden glass-card backdrop-blur-xl rounded-[15px] p-5 border border-stroke-subtle dark:border-white/10 hover:border-primary/30 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300"},[t[46]||(t[46]=e("div",{class:"absolute inset-0 bg-gradient-to-r from-primary/5 to-transparent opacity-0 group-hover:opacity-100 transition-opacity"},null,-1)),e("div",He,[e("div",Ke,[e("div",Oe,[e("div",Pe,[r.registered?(n(),s("div",Te)):u("",!0),e("div",{class:h(["relative w-3 h-3 rounded-full",r.registered?"bg-accent-green":"bg-accent-red"])},null,2)]),e("h3",Ge,a(r.name),1),e("span",{class:h(["px-3 py-1 text-xs font-semibold rounded-full",r.registered?"bg-accent-green/20 text-accent-green border border-accent-green/30":"bg-accent-red/20 text-accent-red border border-accent-red/30"])},a(r.registered?"● Active":"○ Inactive"),3),r.hash?(n(),s("span",Je,a(r.hash),1)):u("",!0)]),e("div",qe,[e("div",null,[t[40]||(t[40]=e("span",{class:"text-content-muted dark:text-content-muted"},"Node Name:",-1)),e("span",We,a(r.settings?.node_name||"Not set"),1)]),e("div",Xe,[t[41]||(t[41]=e("span",{class:"text-content-muted dark:text-content-muted"},"Identity Key:",-1)),S.value.has(r.name)?(n(),s("span",Qe,a(r.identity_key),1)):(n(),s("span",Ye," •••••••••••••••• ")),e("button",{onClick:f=>ae(r.name),class:"text-primary/70 hover:text-primary text-xs underline"},a(S.value.has(r.name)?"Hide":"Show"),9,Ze)]),e("div",null,[t[42]||(t[42]=e("span",{class:"text-content-muted dark:text-content-muted"},"Location:",-1)),e("span",et,a(r.settings?.latitude||0)+", "+a(r.settings?.longitude||0),1)]),r.settings?.admin_password||r.settings?.guest_password?(n(),s("div",tt,[t[43]||(t[43]=e("span",{class:"text-content-muted dark:text-content-muted"},"Passwords:",-1)),e("span",rt,[r.settings?.admin_password?(n(),s("span",ot,"Admin")):u("",!0),r.settings?.admin_password&&r.settings?.guest_password?(n(),s("span",st," / ")):u("",!0),r.settings?.guest_password?(n(),s("span",nt,"Guest")):u("",!0)])])):u("",!0)]),r.address?(n(),s("div",at," Address: "+a(r.address),1)):u("",!0)]),e("div",lt,[e("button",{onClick:f=>le(r.name),disabled:!r.registered,class:h(["group px-4 py-2 rounded-[10px] text-xs font-medium transition-all duration-200 flex items-center gap-2",r.registered?"bg-secondary/20 hover:bg-secondary/30 text-secondary border border-secondary/30 hover:scale-105 hover:shadow-lg hover:shadow-secondary/20":"bg-background-mute dark:bg-white/5 text-content-muted dark:text-content-muted/60 cursor-not-allowed border border-stroke-subtle dark:border-stroke/10"]),title:r.registered?"Manage messages for this room":"Room server must be active to manage messages"},t[44]||(t[44]=[e("svg",{class:"w-4 h-4 group-hover:rotate-12 transition-transform",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})],-1),b(" Messages ",-1)]),10,dt),e("button",{onClick:f=>se(r.name),disabled:!r.registered,class:h(["group px-4 py-2 rounded-[10px] text-xs font-medium transition-all duration-200 flex items-center gap-2",r.registered?"bg-accent-green/20 hover:bg-accent-green/30 text-accent-green border border-accent-green/30 hover:scale-105 hover:shadow-lg hover:shadow-accent-green/20":"bg-background-mute dark:bg-white/5 text-content-muted dark:text-content-muted/60 cursor-not-allowed border border-stroke-subtle dark:border-stroke/10"]),title:r.registered?"Send advert for this room server":"Room server must be active to send advert"},t[45]||(t[45]=[e("svg",{class:"w-4 h-4 group-hover:scale-110 transition-transform",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 10V3L4 14h7v7l9-11h-7z"})],-1),b(" Send Advert ",-1)]),10,it),e("button",{onClick:f=>ne(r),class:"px-3 py-1 bg-primary/20 hover:bg-primary/30 text-primary rounded text-xs transition-colors"}," Edit ",8,ut),e("button",{onClick:f=>re(r.name),class:"px-3 py-1 bg-accent-red/20 hover:bg-accent-red/30 text-accent-red rounded text-xs transition-colors"}," Delete ",8,ct)])])]))),128))])):(n(),s("div",pt,[t[47]||(t[47]=e("svg",{class:"w-16 h-16 mx-auto mb-4 text-content-muted dark:text-content-muted/60",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"})],-1)),t[48]||(t[48]=e("p",{class:"text-lg mb-2"},"No room servers configured",-1)),t[49]||(t[49]=e("p",{class:"text-sm mb-4"},"Add your first room server to get started",-1)),e("button",{onClick:t[1]||(t[1]=r=>L.value=!0),class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-primary rounded-lg border border-primary/50 transition-colors"}," + Add Room Server ")]))]),L.value?(n(),s("div",mt,[e("div",vt,[t[60]||(t[60]=e("h2",{class:"text-xl font-bold text-content-primary dark:text-content-primary mb-4"},"Add Room Server",-1)),e("div",xt,[e("div",null,[t[50]||(t[50]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Name *",-1)),m(e("input",{"onUpdate:modelValue":t[2]||(t[2]=r=>p.value.name=r),type:"text",placeholder:"e.g., MainBBS",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[v,p.value.name]])]),e("div",null,[e("label",bt,[t[51]||(t[51]=b(" Identity Key (Optional) ",-1)),e("button",{onClick:t[3]||(t[3]=r=>w.value=!w.value),type:"button",class:"ml-2 text-primary/70 hover:text-primary text-xs underline"},a(w.value?"Hide":"Show/Edit"),1)]),w.value?(n(),s("div",yt,[m(e("input",{"onUpdate:modelValue":t[4]||(t[4]=r=>p.value.identity_key=r),type:"text",placeholder:"Leave empty to auto-generate",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary font-mono text-sm placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[v,p.value.identity_key]]),t[52]||(t[52]=e("p",{class:"text-content-secondary dark:text-content-muted text-xs mt-1"},"Leave empty to automatically generate a secure key",-1))])):(n(),s("div",gt," Will be auto-generated if not provided "))]),e("div",null,[t[53]||(t[53]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Node Name",-1)),m(e("input",{"onUpdate:modelValue":t[5]||(t[5]=r=>p.value.settings.node_name=r),type:"text",placeholder:"Display name for the room server",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[v,p.value.settings.node_name]])]),e("div",kt,[e("div",null,[t[54]||(t[54]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Latitude",-1)),m(e("input",{"onUpdate:modelValue":t[6]||(t[6]=r=>p.value.settings.latitude=r),type:"number",step:"0.000001",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[v,p.value.settings.latitude,void 0,{number:!0}]])]),e("div",null,[t[55]||(t[55]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Longitude",-1)),m(e("input",{"onUpdate:modelValue":t[7]||(t[7]=r=>p.value.settings.longitude=r),type:"number",step:"0.000001",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[v,p.value.settings.longitude,void 0,{number:!0}]])])]),e("div",ft,[e("div",null,[t[56]||(t[56]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Admin Password (Optional)",-1)),m(e("input",{"onUpdate:modelValue":t[8]||(t[8]=r=>p.value.settings.admin_password=r),type:"password",placeholder:"Leave empty for no password",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[v,p.value.settings.admin_password]]),t[57]||(t[57]=e("p",{class:"text-content-secondary dark:text-content-muted text-xs mt-1"},"Full access to room server",-1))]),e("div",null,[t[58]||(t[58]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Guest Password (Optional)",-1)),m(e("input",{"onUpdate:modelValue":t[9]||(t[9]=r=>p.value.settings.guest_password=r),type:"password",placeholder:"Leave empty for no password",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[v,p.value.settings.guest_password]]),t[59]||(t[59]=e("p",{class:"text-content-secondary dark:text-content-muted text-xs mt-1"},"Read-only access",-1))])])]),e("div",{class:"flex justify-end gap-3 mt-6"},[e("button",{onClick:W,class:"px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg transition-colors"}," Cancel "),e("button",{onClick:ee,class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-primary rounded-lg border border-primary/50 transition-colors"}," Create ")])])])):u("",!0),B.value&&l.value?(n(),s("div",ht,[e("div",wt,[t[72]||(t[72]=e("h2",{class:"text-xl font-bold text-content-primary dark:text-content-primary mb-4"},"Edit Room Server",-1)),e("div",_t,[e("div",null,[t[61]||(t[61]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Current Name",-1)),e("input",{value:l.value.name,disabled:"",type:"text",class:"w-full bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-muted dark:text-content-muted cursor-not-allowed"},null,8,Ct)]),e("div",null,[t[62]||(t[62]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"New Name (optional)",-1)),m(e("input",{"onUpdate:modelValue":t[10]||(t[10]=r=>l.value.new_name=r),type:"text",placeholder:"Leave empty to keep current name",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[v,l.value.new_name]])]),e("div",null,[e("label",Mt,[t[63]||(t[63]=b(" Identity Key (Optional) ",-1)),e("button",{onClick:t[11]||(t[11]=r=>_.value=!_.value),type:"button",class:"ml-2 text-primary/70 hover:text-primary text-xs underline"},a(_.value?"Hide":"Show/Edit"),1)]),_.value?(n(),s("div",jt,[m(e("input",{"onUpdate:modelValue":t[12]||(t[12]=r=>l.value.identity_key=r),type:"text",placeholder:"Leave empty to keep current key",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary font-mono text-sm placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[v,l.value.identity_key]]),t[64]||(t[64]=e("p",{class:"text-content-secondary dark:text-content-muted text-xs mt-1"},"Leave empty to keep the current identity key",-1))])):(n(),s("div",Lt,' Click "Show/Edit" to change the identity key '))]),e("div",null,[t[65]||(t[65]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Node Name",-1)),m(e("input",{"onUpdate:modelValue":t[13]||(t[13]=r=>l.value.settings.node_name=r),type:"text",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[v,l.value.settings.node_name]])]),e("div",St,[e("div",null,[t[66]||(t[66]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Latitude",-1)),m(e("input",{"onUpdate:modelValue":t[14]||(t[14]=r=>l.value.settings.latitude=r),type:"number",step:"0.000001",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[v,l.value.settings.latitude,void 0,{number:!0}]])]),e("div",null,[t[67]||(t[67]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Longitude",-1)),m(e("input",{"onUpdate:modelValue":t[15]||(t[15]=r=>l.value.settings.longitude=r),type:"number",step:"0.000001",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[v,l.value.settings.longitude,void 0,{number:!0}]])])]),e("div",$t,[e("div",null,[t[68]||(t[68]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Admin Password",-1)),m(e("input",{"onUpdate:modelValue":t[16]||(t[16]=r=>l.value.settings.admin_password=r),type:"password",placeholder:"Leave empty for no password",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[v,l.value.settings.admin_password]]),t[69]||(t[69]=e("p",{class:"text-content-secondary dark:text-content-muted text-xs mt-1"},"Full access to room server",-1))]),e("div",null,[t[70]||(t[70]=e("label",{class:"block text-content-secondary dark:text-content-primary/70 text-sm mb-2"},"Guest Password",-1)),m(e("input",{"onUpdate:modelValue":t[17]||(t[17]=r=>l.value.settings.guest_password=r),type:"password",placeholder:"Leave empty for no password",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary/50 transition-colors"},null,512),[[v,l.value.settings.guest_password]]),t[71]||(t[71]=e("p",{class:"text-content-secondary dark:text-content-muted text-xs mt-1"},"Read-only access",-1))])])]),e("div",{class:"flex justify-end gap-3 mt-6"},[e("button",{onClick:W,class:"px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg transition-colors"}," Cancel "),e("button",{onClick:te,class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-primary rounded-lg border border-primary/50 transition-colors"}," Update ")])])])):u("",!0)]),Q(ke,{show:R.value,title:"Delete Room Server",message:`Are you sure you want to delete '${z.value}'? This action cannot be undone.`,"confirm-text":"Delete","cancel-text":"Cancel",variant:"danger",onClose:t[18]||(t[18]=r=>R.value=!1),onConfirm:oe},null,8,["show","message"]),Q(fe,{show:U.value,message:H.value.message,variant:H.value.variant,onClose:t[19]||(t[19]=r=>U.value=!1)},null,8,["show","message","variant"]),K.value?(n(),s("div",At,[e("div",Vt,[e("div",Bt,[t[79]||(t[79]=e("div",{class:"absolute inset-0 bg-gradient-to-r from-secondary/20 via-primary/20 to-accent-purple/20"},null,-1)),t[80]||(t[80]=e("div",{class:"absolute inset-0 bg-gradient-to-br from-transparent via-white/5 to-transparent"},null,-1)),e("div",Rt,[e("div",zt,[t[75]||(t[75]=G('',1)),e("div",null,[t[74]||(t[74]=e("h2",{class:"text-2xl font-bold text-content-primary dark:text-content-primary mb-1"},"Room Messages",-1)),e("p",Et,[t[73]||(t[73]=e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})],-1)),e("span",Ft,a(y.value),1)])])]),e("div",Dt,[e("button",{onClick:t[20]||(t[20]=r=>P.value=!0),class:"group px-3 py-2 bg-primary/20 hover:bg-primary/30 text-primary rounded-[10px] text-xs font-medium transition-all hover:scale-105 border border-primary/30 flex items-center gap-2",title:"View active sessions"},[t[76]||(t[76]=e("svg",{class:"w-4 h-4 group-hover:scale-110 transition-transform",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"})],-1)),t[77]||(t[77]=e("span",{class:"hidden sm:inline"},"Sessions",-1)),e("span",It,a(M.value.length),1)]),e("button",{onClick:ue,class:"p-2 text-content-secondary dark:text-content-primary/70 hover:text-content-primary dark:hover:text-content-primary hover:bg-stroke-subtle dark:hover:bg-white/10 rounded-[10px] transition-all"},t[78]||(t[78]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))])])]),e("div",Nt,[$.value&&g.value.length===0?(n(),s("div",Ut,t[81]||(t[81]=[e("div",{class:"text-center"},[e("div",{class:"animate-spin w-8 h-8 border-2 border-stroke-subtle dark:border-stroke/20 border-t-primary rounded-full mx-auto mb-4"}),e("div",{class:"text-content-secondary dark:text-content-primary/70"},"Loading messages...")],-1)]))):C.value?(n(),s("div",Ht,[e("div",Kt,[t[82]||(t[82]=e("div",{class:"text-red-600 dark:text-red-400 mb-2"},"Failed to load messages",-1)),e("div",Ot,a(C.value),1),e("button",{onClick:t[21]||(t[21]=r=>V(!0)),class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors"}," Retry ")])])):g.value.length>0?(n(),s("div",Pt,[(n(!0),s(I,null,J(g.value,(r,f)=>(n(),s("div",{key:r.id||f,class:"group relative overflow-hidden glass-card backdrop-blur-xl rounded-[12px] p-4 border border-stroke-subtle dark:border-white/10 hover:border-secondary/30 transition-all duration-300 hover:shadow-lg hover:shadow-secondary/10"},[t[87]||(t[87]=e("div",{class:"absolute inset-0 bg-gradient-to-r from-secondary/5 to-transparent opacity-0 group-hover:opacity-100 transition-opacity"},null,-1)),e("div",Tt,[e("div",Gt,[e("div",Jt,[e("div",qt,[t[84]||(t[84]=e("div",{class:"w-6 h-6 rounded-full bg-gradient-to-br from-primary/30 to-secondary/30 flex items-center justify-center"},[e("svg",{class:"w-3 h-3 text-content-secondary dark:text-content-primary/70",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})])],-1)),r.author_name?(n(),s("span",Wt,a(r.author_name),1)):u("",!0),r.author_pubkey?(n(),s("span",Xt,a(r.author_pubkey.substring(0,8))+"... ",1)):(n(),s("span",Qt," Anonymous ")),t[85]||(t[85]=e("span",{class:"text-content-muted dark:text-content-muted/60 text-xs"},"•",-1)),e("span",Yt,[t[83]||(t[83]=e("svg",{class:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),b(" "+a(ce(r.timestamp)),1)]),r.id?(n(),s("span",Zt," #"+a(r.id),1)):u("",!0)])]),e("div",er,a(r.message_text),1)]),e("button",{onClick:me=>ie(r.id),class:"group/delete flex-shrink-0 p-2 bg-accent-red/10 hover:bg-accent-red/20 text-accent-red rounded-[8px] transition-all hover:scale-110 border border-accent-red/20",title:"Delete this message"},t[86]||(t[86]=[e("svg",{class:"w-4 h-4 group-hover/delete:rotate-12 transition-transform",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1)]),8,tr)])]))),128)),O.value&&!$.value?(n(),s("div",rr,[e("button",{onClick:de,class:"group px-6 py-2.5 bg-gradient-to-r from-gray-100 dark:from-white/5 to-gray-200 dark:to-white/10 hover:from-gray-200 dark:hover:from-white/10 hover:to-gray-300 dark:hover:to-white/15 text-content-primary dark:text-content-primary rounded-[10px] transition-all hover:scale-105 text-sm font-medium border border-stroke-subtle dark:border-stroke/10 flex items-center gap-2 mx-auto"},t[88]||(t[88]=[e("svg",{class:"w-4 h-4 group-hover:translate-y-1 transition-transform",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"})],-1),b(" Load More Messages ",-1)]))])):$.value?(n(),s("div",or,t[89]||(t[89]=[e("div",{class:"flex items-center justify-center gap-2 text-content-secondary dark:text-content-muted text-sm"},[e("div",{class:"animate-spin w-4 h-4 border-2 border-stroke-subtle dark:border-stroke/20 border-t-primary rounded-full"}),b(" Loading... ")],-1)]))):u("",!0)])):(n(),s("div",sr,t[90]||(t[90]=[G('No messages yet
Be the first to start the conversation
',1)])))]),e("div",nr,[t[93]||(t[93]=e("div",{class:"absolute inset-0 bg-gradient-to-t from-primary/5 to-transparent pointer-events-none"},null,-1)),e("div",ar,[e("div",lr,[e("div",dr,[m(e("textarea",{"onUpdate:modelValue":t[22]||(t[22]=r=>k.value=r),onKeydown:[Y(Z(T,["ctrl"]),["enter"]),Y(Z(T,["meta"]),["enter"])],placeholder:"Type your message... (Ctrl+Enter to send)",rows:"3",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-[12px] px-4 py-3 text-content-primary dark:text-content-primary text-sm placeholder-gray-500 dark:placeholder-white/30 focus:outline-none focus:border-primary/50 focus:bg-white dark:focus:bg-white/10 transition-all resize-none"},null,40,ir),[[v,k.value]])]),e("button",{onClick:T,disabled:!k.value.trim(),class:h(["group px-6 py-3 rounded-[12px] transition-all duration-200 flex items-center justify-center gap-2 font-medium",k.value.trim()?"bg-gradient-to-r from-primary/30 to-secondary/30 hover:from-primary/40 hover:to-secondary/40 text-content-primary dark:text-content-primary border border-primary/50 hover:scale-105 hover:shadow-lg hover:shadow-primary/20":"bg-background-mute dark:bg-white/5 text-content-muted dark:text-content-muted/60 cursor-not-allowed border border-stroke-subtle dark:border-stroke/10"])},t[91]||(t[91]=[e("svg",{class:"w-5 h-5 group-hover:translate-x-1 transition-transform",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})],-1),e("span",{class:"hidden sm:inline"},"Send",-1)]),10,ur)]),t[92]||(t[92]=e("p",{class:"text-content-secondary dark:text-content-muted/60 text-xs flex items-center gap-2"},[e("svg",{class:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})]),b(" Press Ctrl+Enter to send message quickly ")],-1))])])])])):u("",!0),P.value?(n(),s("div",cr,[e("div",pr,[e("div",mr,[e("div",null,[t[95]||(t[95]=e("h2",{class:"text-xl font-bold text-content-primary dark:text-content-primary"},"Active Sessions",-1)),e("p",vr,[t[94]||(t[94]=b("Room: ",-1)),e("span",xr,a(y.value),1)])]),e("button",{onClick:t[23]||(t[23]=r=>P.value=!1),class:"text-content-secondary dark:text-content-primary/70 hover:text-content-primary dark:hover:text-content-primary transition-colors"},t[96]||(t[96]=[e("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),e("div",br,[M.value.length===0?(n(),s("div",yr,t[97]||(t[97]=[e("div",{class:"text-content-secondary dark:text-content-muted"},"No active sessions found",-1)]))):u("",!0),(n(!0),s(I,null,J(M.value,(r,f)=>(n(),s("div",{key:r.public_key_full||f,class:"glass-card backdrop-blur-xl rounded-[10px] p-4 border border-stroke-subtle dark:border-white/10"},[e("div",gr,[e("div",kr,[e("div",fr,[e("span",hr,a(r.identity_name||"Unknown"),1),e("span",{class:h(["px-2 py-0.5 text-xs font-medium rounded",r.permissions==="admin"?"bg-accent-green/20 text-accent-green":"bg-secondary/20 text-secondary"])},a(r.permissions),3)]),e("div",wr,[e("span",_r,a(r.identity_type),1),e("button",{onClick:me=>pe(r.public_key_full,r.identity_hash),class:"px-2 py-1 bg-accent-red/20 hover:bg-accent-red/30 text-accent-red rounded text-xs transition-colors",title:"Remove client from ACL"}," Remove ",8,Cr)])]),e("div",Mr,[e("div",jr,[t[98]||(t[98]=e("span",{class:"text-content-secondary dark:text-content-muted"},"Short Key:",-1)),e("code",Lr,a(r.public_key),1)]),e("div",Sr,[t[99]||(t[99]=e("span",{class:"text-content-secondary dark:text-content-muted"},"Full Key:",-1)),e("code",$r,a(r.public_key_full),1)])]),e("div",Ar,[e("div",Vr,[r.address?(n(),s("span",Br,"📍 "+a(r.address),1)):u("",!0),r.last_login_success?(n(),s("span",Rr,"Last Login: "+a(new Date(r.last_login_success*1e3).toLocaleString()),1)):u("",!0)]),r.last_activity?(n(),s("span",zr,"Active: "+a(Math.floor((Date.now()/1e3-r.last_activity)/60))+"m ago",1)):u("",!0)])])]))),128))])])])):u("",!0)],64))}});export{Ur as default};
diff --git a/repeater/web/html/assets/Sessions-DSu8xKSv.js b/repeater/web/html/assets/Sessions-DSu8xKSv.js
new file mode 100644
index 0000000..95ef7a5
--- /dev/null
+++ b/repeater/web/html/assets/Sessions-DSu8xKSv.js
@@ -0,0 +1 @@
+import{a as B,r as c,o as V,L as g,c as N,b as o,e as t,g as l,t as n,F as i,h as k,w as D,q as z,j as d,k as F,p as r}from"./index-D0IT5vDS.js";const T={class:"p-6 space-y-6"},$={key:0,class:"grid grid-cols-1 md:grid-cols-4 gap-4"},E={class:"glass-card rounded-[15px] p-4"},H={class:"text-2xl font-bold text-content-primary dark:text-content-primary"},O={class:"glass-card rounded-[15px] p-4"},P={class:"text-2xl font-bold text-cyan-500 dark:text-primary"},G={class:"glass-card rounded-[15px] p-4"},q={class:"text-2xl font-bold text-green-700 dark:text-green-500 dark:text-accent-green"},U={class:"glass-card rounded-[15px] p-4"},J={class:"text-2xl font-bold text-yellow-500 dark:text-secondary"},K={class:"glass-card rounded-[15px] p-6"},Q={class:"flex flex-wrap border-b border-stroke-subtle dark:border-stroke/10 mb-6"},W=["onClick"],X={class:"flex items-center gap-2"},Y={key:0,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Z={key:1,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},tt={key:2,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},et={class:"min-h-[400px]"},st={key:0,class:"flex items-center justify-center py-12"},nt={key:1,class:"flex items-center justify-center py-12"},ot={class:"text-center"},rt={class:"text-content-secondary dark:text-content-muted text-sm mb-4"},at={key:2,class:"space-y-4"},dt={key:0,class:"text-center py-12 text-content-secondary dark:text-content-muted"},ct={key:1,class:"space-y-4"},lt={class:"flex items-start justify-between"},it={class:"flex-1 min-w-0"},xt={class:"flex items-center gap-2 flex-wrap mb-3"},ut={class:"text-lg font-semibold text-content-primary dark:text-content-primary truncate"},mt={class:"flex flex-wrap items-center gap-x-4 gap-y-2 text-sm"},pt={key:0,class:"flex items-center gap-1.5"},kt={class:"text-content-secondary dark:text-content-muted"},vt={key:1,class:"flex items-center gap-1.5"},yt={class:"text-content-secondary dark:text-content-muted"},_t={key:2,class:"text-content-secondary dark:text-content-muted font-mono text-xs"},bt={key:3,class:"text-content-muted dark:text-content-muted font-mono text-xs"},gt={key:0,class:"text-content-muted dark:text-content-muted text-xs mt-2 mb-0"},ht={class:"grid grid-cols-2 md:grid-cols-4 gap-4 mt-4"},ft={class:"text-content-primary dark:text-content-primary font-medium"},wt={class:"text-cyan-500 dark:text-primary font-medium"},Ct={class:"mt-3 flex items-center gap-2"},At={key:3,class:"space-y-4"},Lt={key:0,class:"text-center py-12 text-content-secondary dark:text-content-muted"},St={key:1,class:"overflow-x-auto"},Nt={class:"w-full"},Mt={class:"py-3"},Rt={class:"font-mono text-sm text-content-primary dark:text-content-primary"},It={class:"py-3"},jt={class:"font-mono text-xs text-content-secondary dark:text-content-muted"},Bt={class:"py-3"},Vt={class:"text-sm text-content-primary dark:text-content-primary"},Dt={class:"text-xs text-content-muted dark:text-content-muted"},zt={class:"py-3"},Ft={class:"py-3"},Tt={class:"text-sm text-content-secondary dark:text-content-muted"},$t={class:"py-3"},Et=["onClick"],Ht={key:4,class:"space-y-4"},Ot={class:"mb-4"},Pt=["value"],Gt={key:0,class:"text-center py-12 text-content-secondary dark:text-content-muted"},qt={key:1,class:"grid grid-cols-1 gap-4"},Ut={class:"flex items-start justify-between"},Jt={class:"flex-1"},Kt={class:"flex items-center gap-3 mb-3"},Qt={class:"text-content-primary dark:text-content-primary font-mono text-sm"},Wt={class:"grid grid-cols-1 md:grid-cols-2 gap-3 text-sm"},Xt={class:"text-content-primary dark:text-content-primary/90 font-mono ml-2"},Yt={class:"text-content-primary dark:text-content-primary/90 ml-2"},Zt={class:"text-content-primary dark:text-content-primary/90 ml-2"},te={class:"text-content-primary dark:text-content-primary/90 ml-2"},ee=["onClick"],se={class:"flex justify-end"},ne=["disabled"],ae=B({name:"SessionsView",__name:"Sessions",setup(oe){const u=c("overview"),w=c(!1),m=c(!1),v=c(null),h=c(null),p=c([]),x=c(null),y=c(null),M=[{id:"overview",label:"Overview",icon:"overview"},{id:"clients",label:"Authenticated Clients",icon:"clients"},{id:"identities",label:"By Identity",icon:"identities"}];V(async()=>{await _(),w.value=!0});async function _(){m.value=!0,v.value=null;try{const a=await g.getACLInfo();a.success&&(h.value=a.data);const s=await g.getACLClients();s.success&&s.data&&(p.value=s.data.clients||[]);const e=await g.getACLStats();e.success&&(x.value=e.data)}catch(a){v.value=a instanceof Error?a.message:"Failed to load ACL data",console.error("Error fetching ACL data:",a)}finally{m.value=!1}}async function C(a,s){if(confirm("Are you sure you want to remove this client from the ACL?"))try{const e=await g.removeACLClient({public_key:a,identity_hash:s});e.success?await _():alert(`Failed to remove client: ${e.error}`)}catch(e){alert(`Error removing client: ${e}`)}}function b(a){return a?new Date(a*1e3).toLocaleString():"Never"}function R(a){u.value=a}const A=N(()=>y.value?p.value.filter(a=>a.identity_name===y.value):p.value),f=N(()=>h.value?h.value.acls||[]:[]);function I(a){return a?.type==="companion"}function j(a){return a==="repeater"?"bg-cyan-500/20 dark:bg-primary/20 text-cyan-700 dark:text-primary":a==="companion"?"bg-violet-500/20 dark:bg-violet-400/20 text-violet-700 dark:text-violet-300":"bg-yellow-100 dark:bg-yellow-500/20 dark:bg-secondary/20 text-yellow-700 dark:text-secondary"}function L(a){return a==null?"N/A":typeof a=="boolean"?a?"✓":"✗":String(a)}return(a,s)=>(r(),o("div",T,[s[22]||(s[22]=t("div",null,[t("h1",{class:"text-2xl font-bold text-content-primary dark:text-content-primary"},"Sessions & Access Control"),t("p",{class:"text-content-secondary dark:text-content-muted mt-2"},"Manage authenticated clients and access control lists"),t("p",{class:"text-content-muted dark:text-content-muted text-sm mt-1"},"Repeater, room servers, and companion identities; companions do not accept client logins.")],-1)),x.value?(r(),o("div",$,[t("div",E,[s[1]||(s[1]=t("div",{class:"text-content-secondary dark:text-content-muted text-sm mb-1"},"Total Identities",-1)),t("div",H,n(x.value.total_identities),1)]),t("div",O,[s[2]||(s[2]=t("div",{class:"text-content-secondary dark:text-content-muted text-sm mb-1"},"Authenticated Clients",-1)),t("div",P,n(x.value.total_clients),1)]),t("div",G,[s[3]||(s[3]=t("div",{class:"text-content-secondary dark:text-content-muted text-sm mb-1"},"Admin Clients",-1)),t("div",q,n(x.value.admin_clients),1)]),t("div",U,[s[4]||(s[4]=t("div",{class:"text-content-secondary dark:text-content-muted text-sm mb-1"},"Guest Clients",-1)),t("div",J,n(x.value.guest_clients),1)])])):l("",!0),t("div",K,[t("div",Q,[(r(),o(i,null,k(M,e=>t("button",{key:e.id,onClick:S=>R(e.id),class:d(["px-4 py-2 text-sm font-medium transition-colors duration-200 border-b-2 mr-6 mb-2",u.value===e.id?"text-cyan-500 dark:text-primary border-cyan-500 dark:border-primary":"text-content-secondary dark:text-content-muted border-transparent hover:text-content-primary dark:hover:text-content-primary hover:border-stroke-subtle dark:hover:border-stroke/30"])},[t("div",X,[e.icon==="overview"?(r(),o("svg",Y,s[5]||(s[5]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"},null,-1)]))):e.icon==="clients"?(r(),o("svg",Z,s[6]||(s[6]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"},null,-1)]))):e.icon==="identities"?(r(),o("svg",tt,s[7]||(s[7]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M10 6H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V8a2 2 0 00-2-2h-5m-4 0V5a2 2 0 114 0v1m-4 0a2 2 0 104 0m-5 8a2 2 0 100-4 2 2 0 000 4zm0 0c1.306 0 2.417.835 2.83 2M9 14a3.001 3.001 0 00-2.83 2M15 11h3m-3 4h2"},null,-1)]))):l("",!0),F(" "+n(e.label),1)])],10,W)),64))]),t("div",et,[m.value&&!w.value?(r(),o("div",st,s[8]||(s[8]=[t("div",{class:"text-center"},[t("div",{class:"animate-spin w-8 h-8 border-2 border-stroke-subtle dark:border-stroke/20 border-t-cyan-500 dark:border-t-primary rounded-full mx-auto mb-4"}),t("div",{class:"text-content-secondary dark:text-content-muted"},"Loading ACL data...")],-1)]))):v.value?(r(),o("div",nt,[t("div",ot,[s[9]||(s[9]=t("div",{class:"text-red-500 dark:text-red-400 mb-2"},"Failed to load ACL data",-1)),t("div",rt,n(v.value),1),t("button",{onClick:_,class:"px-4 py-2 bg-cyan-500/20 dark:bg-primary/20 hover:bg-cyan-500/30 dark:hover:bg-primary/30 text-cyan-900 dark:text-white rounded-lg border border-cyan-500/50 dark:border-primary/50 transition-colors"}," Retry ")])])):u.value==="overview"?(r(),o("div",at,[f.value.length===0?(r(),o("div",dt," No identities configured ")):(r(),o("div",ct,[(r(!0),o(i,null,k(f.value,e=>(r(),o("div",{key:e.hash,class:"glass-card rounded-[10px] p-4 border border-stroke-subtle dark:border-white/10 hover:border-cyan-400 dark:hover:border-primary/30 transition-colors"},[t("div",lt,[t("div",it,[t("div",xt,[t("h3",ut,n(e.name),1),t("span",{class:d(["px-2 py-0.5 text-xs font-medium rounded shrink-0",j(e.type)])},n(e.type),3)]),I(e)?(r(),o(i,{key:0},[t("div",mt,[e.registered!==void 0?(r(),o("span",pt,[t("span",{class:d(["w-2 h-2 rounded-full shrink-0",e.registered?"bg-accent-green":"bg-accent-red"]),"aria-hidden":""},null,2),t("span",kt,"Registered: "+n(e.registered?"Active":"Inactive"),1)])):l("",!0),e.active!==void 0?(r(),o("span",vt,[t("span",{class:d(["w-2 h-2 rounded-full shrink-0",e.active?"bg-accent-green":"bg-accent-red"]),"aria-hidden":""},null,2),t("span",yt,"Bridge: "+n(e.active?"Connected":"Disconnected"),1)])):l("",!0),e.client_ip?(r(),o("span",_t," Client: "+n(e.client_ip),1)):l("",!0),e.hash?(r(),o("span",bt," Hash: "+n(e.hash),1)):l("",!0)]),e.last_seen!=null?(r(),o("p",gt," Last seen: "+n(b(e.last_seen)),1)):l("",!0)],64)):(r(),o(i,{key:1},[t("div",ht,[t("div",null,[s[10]||(s[10]=t("div",{class:"text-content-secondary dark:text-content-muted text-xs mb-1"},"Max Clients",-1)),t("div",ft,n(L(e.max_clients)),1)]),t("div",null,[s[11]||(s[11]=t("div",{class:"text-content-secondary dark:text-content-muted text-xs mb-1"},"Authenticated",-1)),t("div",wt,n(L(e.authenticated_clients)),1)]),t("div",null,[s[12]||(s[12]=t("div",{class:"text-content-secondary dark:text-content-muted text-xs mb-1"},"Admin Password",-1)),t("div",{class:d(e.has_admin_password?"text-green-700 dark:text-green-500 dark:text-accent-green":"text-red-500 dark:text-accent-red")},n(e.has_admin_password!=null?e.has_admin_password?"✓ Set":"✗ Not Set":"N/A"),3)]),t("div",null,[s[13]||(s[13]=t("div",{class:"text-content-secondary dark:text-content-muted text-xs mb-1"},"Guest Password",-1)),t("div",{class:d(e.has_guest_password?"text-green-700 dark:text-green-500 dark:text-accent-green":"text-red-500 dark:text-accent-red")},n(e.has_guest_password!=null?e.has_guest_password?"✓ Set":"✗ Not Set":"N/A"),3)])]),t("div",Ct,[s[14]||(s[14]=t("span",{class:"text-content-secondary dark:text-content-muted text-xs"},"Read-Only Access:",-1)),t("span",{class:d(e.allow_read_only?"text-green-700 dark:text-green-500 dark:text-accent-green":"text-red-500 dark:text-accent-red")},n(e.allow_read_only!=null?e.allow_read_only?"Allowed":"Disabled":"N/A"),3)])],64))])])]))),128))]))])):u.value==="clients"?(r(),o("div",At,[p.value.length===0?(r(),o("div",Lt," No authenticated clients ")):(r(),o("div",St,[t("table",Nt,[s[15]||(s[15]=t("thead",null,[t("tr",{class:"border-b border-stroke-subtle dark:border-stroke/10"},[t("th",{class:"text-left text-content-secondary dark:text-content-muted text-sm font-medium pb-3"},"Client"),t("th",{class:"text-left text-content-secondary dark:text-content-muted text-sm font-medium pb-3"},"Address"),t("th",{class:"text-left text-content-secondary dark:text-content-muted text-sm font-medium pb-3"},"Identity"),t("th",{class:"text-left text-content-secondary dark:text-content-muted text-sm font-medium pb-3"},"Permissions"),t("th",{class:"text-left text-content-secondary dark:text-content-muted text-sm font-medium pb-3"},"Last Activity"),t("th",{class:"text-left text-content-secondary dark:text-content-muted text-sm font-medium pb-3"},"Actions")])],-1)),t("tbody",null,[(r(!0),o(i,null,k(p.value,e=>(r(),o("tr",{key:e.public_key_full,class:"border-b border-stroke-subtle dark:border-white/5 hover:bg-gray-100/50 dark:hover:bg-white/5 transition-colors"},[t("td",Mt,[t("div",Rt,n(e.public_key),1)]),t("td",It,[t("div",jt,n(e.address),1)]),t("td",Bt,[t("div",Vt,n(e.identity_name),1),t("div",Dt,n(e.identity_hash),1)]),t("td",zt,[t("span",{class:d(["px-2 py-1 text-xs font-medium rounded",e.permissions==="admin"?"bg-green-100 dark:bg-green-500/20 dark:bg-accent-green/20 text-green-700 dark:text-accent-green":"bg-yellow-100 dark:bg-yellow-500/20 dark:bg-secondary/20 text-yellow-700 dark:text-secondary"])},n(e.permissions),3)]),t("td",Ft,[t("div",Tt,n(b(e.last_activity)),1)]),t("td",$t,[t("button",{onClick:S=>C(e.public_key_full,e.identity_hash),class:"px-3 py-1 bg-red-100 dark:bg-red-500/20 dark:bg-accent-red/20 hover:bg-red-500/30 dark:hover:bg-accent-red/30 text-red-600 dark:text-accent-red rounded text-xs transition-colors"}," Remove ",8,Et)])]))),128))])])]))])):u.value==="identities"?(r(),o("div",Ht,[t("div",Ot,[s[17]||(s[17]=t("label",{class:"block text-content-secondary dark:text-content-muted text-sm mb-2"},"Filter by Identity",-1)),D(t("select",{"onUpdate:modelValue":s[0]||(s[0]=e=>y.value=e),class:"bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-2 text-content-primary dark:text-content-primary focus:outline-none focus:border-cyan-500 dark:focus:border-primary/50 transition-colors"},[s[16]||(s[16]=t("option",{value:null},"All Identities",-1)),(r(!0),o(i,null,k(f.value,e=>(r(),o("option",{key:e.name,value:e.name},n(e.name)+" ("+n(e.authenticated_clients??0)+" clients) ",9,Pt))),128))],512),[[z,y.value]])]),A.value.length===0?(r(),o("div",Gt," No clients for selected identity ")):(r(),o("div",qt,[(r(!0),o(i,null,k(A.value,e=>(r(),o("div",{key:e.public_key_full,class:"glass-card rounded-[10px] p-4 border border-stroke-subtle dark:border-white/10"},[t("div",Ut,[t("div",Jt,[t("div",Kt,[t("span",{class:d(["px-2 py-1 text-xs font-medium rounded",e.permissions==="admin"?"bg-green-100 dark:bg-green-500/20 dark:bg-accent-green/20 text-green-700 dark:text-accent-green":"bg-yellow-100 dark:bg-yellow-500/20 dark:bg-secondary/20 text-yellow-700 dark:text-secondary"])},n(e.permissions),3),t("span",Qt,n(e.public_key),1)]),t("div",Wt,[t("div",null,[s[18]||(s[18]=t("span",{class:"text-content-secondary dark:text-content-muted"},"Address:",-1)),t("span",Xt,n(e.address),1)]),t("div",null,[s[19]||(s[19]=t("span",{class:"text-content-secondary dark:text-content-muted"},"Identity:",-1)),t("span",Yt,n(e.identity_name)+" ("+n(e.identity_hash)+")",1)]),t("div",null,[s[20]||(s[20]=t("span",{class:"text-content-secondary dark:text-content-muted"},"Last Activity:",-1)),t("span",Zt,n(b(e.last_activity)),1)]),t("div",null,[s[21]||(s[21]=t("span",{class:"text-content-secondary dark:text-content-muted"},"Last Login:",-1)),t("span",te,n(b(e.last_login_success)),1)])])]),t("button",{onClick:S=>C(e.public_key_full,e.identity_hash),class:"ml-4 px-3 py-1 bg-red-100 dark:bg-red-500/20 dark:bg-accent-red/20 hover:bg-red-500/30 dark:hover:bg-accent-red/30 text-red-600 dark:text-accent-red rounded text-xs transition-colors"}," Remove ",8,ee)])]))),128))]))])):l("",!0)])]),t("div",se,[t("button",{onClick:_,disabled:m.value,class:"px-4 py-2 bg-cyan-500/20 dark:bg-primary/20 hover:bg-cyan-500/30 dark:hover:bg-primary/30 text-cyan-900 dark:text-primary rounded-lg border border-cyan-500/50 dark:border-primary/50 transition-colors disabled:opacity-50"},n(m.value?"Refreshing...":"Refresh Data"),9,ne)])]))}});export{ae as default};
diff --git a/repeater/web/html/assets/Setup-DFGUHlPP.js b/repeater/web/html/assets/Setup-DFGUHlPP.js
new file mode 100644
index 0000000..2c2b8fc
--- /dev/null
+++ b/repeater/web/html/assets/Setup-DFGUHlPP.js
@@ -0,0 +1 @@
+import{d as A,r as l,c as P,a as W,o as I,b as a,e,f as B,_ as Y,t as i,u as o,n as J,g as k,F as N,h as z,i as K,w as h,v as C,j as _,k as V,l as q,T,m as Q,p as n,q as E,s as X,x as Z}from"./index-D0IT5vDS.js";const ee=A("setup",()=>{const m=l(1),r=l(5),y=l(`pyRpt${Math.floor(Math.random()*1e4).toString().padStart(4,"0")}`),b=l(null),v=l(null),x=l(""),f=l(""),w=l(!1),c=l({frequency:"915.0",spreading_factor:"7",bandwidth:"125",coding_rate:"5"}),R=l([]),j=l([]),g=l(!1),S=l(!1),u=l(null),t=P(()=>{switch(m.value){case 1:return!0;case 2:return y.value.trim().length>0;case 3:return b.value!==null;case 4:return w.value?c.value.frequency&&c.value.spreading_factor&&c.value.bandwidth&&c.value.coding_rate:v.value!==null;case 5:return x.value.length>=6&&x.value===f.value;default:return!1}}),s=P(()=>m.value>1),M=P(()=>m.value===r.value);async function F(){g.value=!0,u.value=null;try{const p=await(await fetch("/api/hardware_options")).json();if(p.error)throw new Error(p.error);R.value=p.hardware||[]}catch(d){u.value=d instanceof Error?d.message:"Failed to load hardware options",console.error("Error fetching hardware options:",d)}finally{g.value=!1}}async function H(){g.value=!0,u.value=null;try{const p=await(await fetch("/api/radio_presets")).json();if(p.error)throw new Error(p.error);j.value=p.presets||[]}catch(d){u.value=d instanceof Error?d.message:"Failed to load radio presets",console.error("Error fetching radio presets:",d)}finally{g.value=!1}}async function U(){if(!t.value)return{success:!1,error:"Please complete all required fields"};S.value=!0,u.value=null;try{const d=w.value?{title:"Custom Configuration",description:"Custom radio settings",frequency:c.value.frequency,spreading_factor:c.value.spreading_factor,bandwidth:c.value.bandwidth,coding_rate:c.value.coding_rate}:v.value,L=await(await fetch("/api/setup_wizard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({node_name:y.value.trim(),hardware_key:b.value?.key,radio_preset:d,admin_password:x.value})})).json();if(!L.success)throw new Error(L.error||"Setup failed");return{success:!0,data:L}}catch(d){const p=d instanceof Error?d.message:"Failed to complete setup";return u.value=p,{success:!1,error:p}}finally{S.value=!1}}function O(){t.value&&m.value=1&&d<=r.value&&(m.value=d)}function D(){m.value=1,y.value=`pyRpt${Math.floor(Math.random()*1e4).toString().padStart(4,"0")}`,b.value=null,v.value=null,w.value=!1,c.value={frequency:"915.0",spreading_factor:"7",bandwidth:"125",coding_rate:"5"},x.value="",f.value="",u.value=null}return{currentStep:m,totalSteps:r,nodeName:y,selectedHardware:b,selectedRadioPreset:v,useCustomRadio:w,customRadio:c,adminPassword:x,confirmPassword:f,hardwareOptions:R,radioPresets:j,isLoading:g,isSubmitting:S,error:u,canGoNext:t,canGoBack:s,isLastStep:M,fetchHardwareOptions:F,fetchRadioPresets:H,completeSetup:U,nextStep:O,previousStep:$,goToStep:G,reset:D}}),te={class:"min-h-screen bg-background dark:bg-background overflow-hidden relative flex items-center justify-center p-4"},re={class:"absolute top-4 right-4 z-20"},oe={class:"w-full max-w-4xl relative z-10"},se={class:"mb-8"},ae={class:"flex justify-between mb-2"},ne={class:"text-content-secondary dark:text-content-muted text-sm"},de={class:"text-content-secondary dark:text-content-muted text-sm"},ie={class:"h-2 bg-stroke-subtle dark:bg-stroke/10 rounded-full overflow-hidden"},le={class:"bg-white dark:bg-surface-elevated backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[20px] p-6 sm:p-8 md:p-12"},ue={class:"flex justify-center mb-8"},ce={class:"flex gap-2"},pe={class:"mb-8"},me={class:"text-2xl sm:text-3xl font-bold text-content-primary dark:text-content-primary mb-2 text-center"},be={key:0,class:"space-y-6 mt-8"},fe={key:1,class:"space-y-6 mt-8"},xe={class:"max-w-md mx-auto"},ke={key:2,class:"space-y-6 mt-8"},ve={key:0,class:"text-center text-content-secondary dark:text-content-muted"},ge={key:1,class:"text-center text-content-secondary dark:text-content-muted"},ye={key:2,class:"grid grid-cols-1 md:grid-cols-2 gap-4 max-w-3xl mx-auto"},he=["onClick"],we={class:"font-medium text-content-primary dark:text-content-primary mb-1"},_e={class:"text-sm text-content-secondary dark:text-content-muted"},Se={key:3,class:"space-y-6 mt-8"},Ce={key:0,class:"text-center text-content-secondary dark:text-content-muted"},Re={key:1,class:"text-center text-content-secondary dark:text-content-muted"},je={key:2,class:"max-w-5xl mx-auto"},Pe={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mb-4"},Me=["onClick"],Le={class:"relative z-10"},Be={class:"font-medium text-content-primary dark:text-content-primary mb-1 flex items-start justify-between gap-2"},Ne={class:"flex items-center gap-2"},ze={class:"text-2xl"},Ve={key:0,class:"text-primary flex-shrink-0"},qe={class:"text-xs text-content-secondary dark:text-content-muted mb-3"},Te={class:"grid grid-cols-2 gap-2 text-xs"},Ee={class:"bg-gray-50 dark:bg-white/5 rounded px-2 py-1"},Fe={class:"text-content-primary dark:text-content-primary/80 font-medium"},He={class:"bg-gray-50 dark:bg-white/5 rounded px-2 py-1"},Ue={class:"text-content-primary dark:text-content-primary/80 font-medium"},Oe={class:"bg-gray-50 dark:bg-white/5 rounded px-2 py-1"},$e={class:"text-content-primary dark:text-content-primary/80 font-medium"},Ge={class:"bg-gray-50 dark:bg-white/5 rounded px-2 py-1"},De={class:"text-content-primary dark:text-content-primary/80 font-medium"},Ae={class:"border-t border-stroke-subtle dark:border-stroke/10 pt-6"},We={class:"flex items-center justify-between mb-2"},Ie={key:0,class:"text-primary"},Ye={key:0,class:"mt-4 grid grid-cols-2 gap-4"},Je={key:4,class:"space-y-6 mt-8"},Ke={class:"max-w-md mx-auto space-y-4"},Qe={key:0,class:"text-red-600 dark:text-red-400 text-sm"},Xe={key:0,class:"mb-6 bg-red-500/10 border border-red-500/30 rounded-lg p-4 text-red-600 dark:text-red-200"},Ze={class:"flex justify-between gap-4"},et={key:1},tt=["disabled"],rt={key:0,class:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"},ot={key:1},st={key:2},at={key:3},nt={key:4,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},dt={class:"flex justify-center mb-6"},it={key:0,class:"w-16 h-16 rounded-full bg-green-100 dark:bg-green-500/20 flex items-center justify-center"},lt={key:1,class:"w-16 h-16 rounded-full bg-red-100 dark:bg-red-500/20 flex items-center justify-center"},ut={class:"text-2xl font-bold text-content-primary dark:text-content-primary text-center mb-4"},ct={class:"text-content-secondary dark:text-content-primary/70 text-center mb-6"},pt=W({name:"SetupView",__name:"Setup",setup(m){const r=ee(),y=Q(),b=l(!1),v=l(""),x=l(""),f=l("success"),w=u=>{const t=u.toLowerCase();return t.includes("australia")?"🇦🇺":t.includes("eu")||t.includes("uk")?"🇪🇺":t.includes("czech")?"🇨🇿":t.includes("new zealand")?"🇳🇿":t.includes("portugal")?"🇵🇹":t.includes("switzerland")?"🇨🇭":t.includes("usa")||t.includes("canada")?"🇺🇸":t.includes("vietnam")?"🇻🇳":"🌍"};I(async()=>{await Promise.all([r.fetchHardwareOptions(),r.fetchRadioPresets()])});const c=P(()=>r.currentStep/r.totalSteps*100);async function R(){if(r.isLastStep){const u=await r.completeSetup();u.success?(f.value="success",v.value="Setup Complete!",x.value="Your repeater has been configured successfully. The service is restarting now...",b.value=!0,setTimeout(()=>{b.value=!1,y.push("/login")},5e3)):(f.value="error",v.value="Setup Failed",x.value=u.error||"An unknown error occurred",b.value=!0)}else r.nextStep()}function j(){r.previousStep()}function g(){b.value=!1,f.value==="success"&&y.push("/login")}const S=["Welcome","Repeater Name","Hardware Selection","Radio Configuration","Security Setup"];return(u,t)=>(n(),a("div",te,[e("div",re,[B(Y)]),t[36]||(t[36]=e("div",{class:"bg-gradient-light dark:bg-gradient-dark absolute rounded-full -rotate-[24.22deg] w-[705px] h-[512px] blur-[120px] opacity-80 animate-pulse-slow -top-[79px] left-[575px] mix-blend-multiply dark:mix-blend-screen pointer-events-none"},null,-1)),t[37]||(t[37]=e("div",{class:"bg-gradient-light dark:bg-gradient-dark absolute rounded-full -rotate-[24.22deg] w-[705px] h-[512px] blur-[120px] opacity-75 animate-pulse-slower -top-[94px] -left-[92px] mix-blend-multiply dark:mix-blend-screen pointer-events-none"},null,-1)),t[38]||(t[38]=e("div",{class:"bg-gradient-light dark:bg-gradient-dark absolute rounded-full -rotate-[24.22deg] w-[705px] h-[512px] blur-[120px] opacity-80 animate-pulse-slowest top-[373px] left-[246px] mix-blend-multiply dark:mix-blend-screen pointer-events-none"},null,-1)),e("div",oe,[e("div",se,[e("div",ae,[e("span",ne,"Step "+i(o(r).currentStep)+" of "+i(o(r).totalSteps),1),e("span",de,i(Math.round(c.value))+"% Complete",1)]),e("div",ie,[e("div",{class:"h-full bg-gradient-to-r from-primary to-primary/80 transition-all duration-500",style:J({width:`${c.value}%`})},null,4)])]),e("div",le,[e("div",ue,[e("div",ce,[(n(!0),a(N,null,z(o(r).totalSteps,s=>(n(),a("div",{key:s,class:_(["w-10 h-10 rounded-full flex items-center justify-center text-sm font-medium transition-all",s===o(r).currentStep?"bg-primary text-white":s Welcome to your pyMC Repeater! Let's get you set up in just a few steps.
You'll configure:
- Repeater name and identification
- Hardware board selection
- Radio frequency and settings
- Admin password for secure access
',1)]))):o(r).currentStep===2?(n(),a("div",fe,[t[12]||(t[12]=e("p",{class:"text-content-secondary dark:text-content-primary/70 text-center mb-6"}," Choose a unique name for your repeater. This will be used for identification on the mesh network. ",-1)),e("div",xe,[t[10]||(t[10]=e("label",{class:"block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2"},"Repeater Name",-1)),h(e("input",{"onUpdate:modelValue":t[0]||(t[0]=s=>o(r).nodeName=s),type:"text",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-3 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent",placeholder:"e.g., pyRpt0001",maxlength:"32"},null,512),[[C,o(r).nodeName]]),t[11]||(t[11]=e("p",{class:"text-content-secondary dark:text-content-muted text-xs mt-2"}," Use letters, numbers, hyphens, or underscores (3-32 characters) ",-1))])])):o(r).currentStep===3?(n(),a("div",ke,[t[13]||(t[13]=e("p",{class:"text-content-secondary dark:text-content-primary/70 text-center mb-6"}," Select your hardware board type ",-1)),o(r).isLoading?(n(),a("div",ve," Loading hardware options... ")):o(r).hardwareOptions.length===0?(n(),a("div",ge," No hardware options available ")):(n(),a("div",ye,[(n(!0),a(N,null,z(o(r).hardwareOptions,s=>(n(),a("button",{key:s.key,onClick:M=>o(r).selectedHardware=s,class:_(["p-4 rounded-[12px] border transition-all duration-300 text-left backdrop-blur-sm",o(r).selectedHardware?.key===s.key?"bg-gradient-to-r from-primary/20 to-primary/10 border-primary/50 shadow-lg shadow-primary/20":"bg-background-mute dark:bg-white/5 border-stroke-subtle dark:border-stroke/10 hover:bg-stroke-subtle dark:hover:bg-white/10 hover:border-stroke dark:hover:border-stroke/20"])},[e("div",we,i(s.name),1),e("div",_e,i(s.description||s.key),1)],10,he))),128))]))])):o(r).currentStep===4?(n(),a("div",Se,[t[28]||(t[28]=e("p",{class:"text-content-secondary dark:text-content-primary/70 text-center mb-6"}," Choose a radio configuration preset for your region or create a custom configuration ",-1)),o(r).isLoading?(n(),a("div",Ce," Loading radio presets... ")):o(r).radioPresets.length===0?(n(),a("div",Re," No radio presets available ")):(n(),a("div",je,[e("div",Pe,[(n(!0),a(N,null,z(o(r).radioPresets,s=>(n(),a("button",{key:s.title,onClick:M=>{o(r).selectedRadioPreset=s,o(r).useCustomRadio=!1},class:_(["p-4 rounded-[12px] border transition-all duration-300 text-left backdrop-blur-sm relative overflow-hidden",!o(r).useCustomRadio&&o(r).selectedRadioPreset?.title===s.title?"bg-gradient-to-r from-primary/20 to-primary/10 border-primary/50 shadow-lg shadow-primary/20":"bg-background-mute dark:bg-white/5 border-stroke-subtle dark:border-stroke/10 hover:bg-stroke-subtle dark:hover:bg-white/10 hover:border-stroke dark:hover:border-stroke/20"])},[e("div",Le,[e("div",Be,[e("span",Ne,[e("span",ze,i(w(s.title)),1),e("span",null,i(s.title),1)]),!o(r).useCustomRadio&&o(r).selectedRadioPreset?.title===s.title?(n(),a("div",Ve,t[14]||(t[14]=[e("svg",{class:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20"},[e("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z","clip-rule":"evenodd"})],-1)]))):k("",!0)]),e("div",qe,i(s.description),1),e("div",Te,[e("div",Ee,[t[15]||(t[15]=e("div",{class:"text-content-muted dark:text-content-muted"},"Freq",-1)),e("div",Fe,i(s.frequency),1)]),e("div",He,[t[16]||(t[16]=e("div",{class:"text-content-muted dark:text-content-muted"},"BW",-1)),e("div",Ue,i(s.bandwidth),1)]),e("div",Oe,[t[17]||(t[17]=e("div",{class:"text-content-muted dark:text-content-muted"},"SF",-1)),e("div",$e,i(s.spreading_factor),1)]),e("div",Ge,[t[18]||(t[18]=e("div",{class:"text-content-muted dark:text-content-muted"},"CR",-1)),e("div",De,i(s.coding_rate),1)])])])],10,Me))),128))]),e("div",Ae,[e("button",{onClick:t[1]||(t[1]=s=>{o(r).useCustomRadio=!o(r).useCustomRadio,o(r).useCustomRadio&&(o(r).selectedRadioPreset=null)}),class:_(["w-full p-4 rounded-[12px] border transition-all duration-300 text-left backdrop-blur-sm",o(r).useCustomRadio?"bg-gradient-to-r from-primary/20 to-primary/10 border-primary/50 shadow-lg shadow-primary/20":"bg-background-mute dark:bg-white/5 border-stroke-subtle dark:border-stroke/10 hover:bg-stroke-subtle dark:hover:bg-white/10 hover:border-stroke dark:hover:border-stroke/20"])},[e("div",We,[t[20]||(t[20]=e("div",{class:"font-medium text-content-primary dark:text-content-primary flex items-center gap-2"},[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4"})]),V(" Custom Configuration ")],-1)),o(r).useCustomRadio?(n(),a("div",Ie,t[19]||(t[19]=[e("svg",{class:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20"},[e("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z","clip-rule":"evenodd"})],-1)]))):k("",!0)]),t[21]||(t[21]=e("div",{class:"text-xs text-content-secondary dark:text-content-muted"},"Manually configure frequency, bandwidth, spreading factor, and coding rate",-1))],2),B(T,{name:"slide"},{default:q(()=>[o(r).useCustomRadio?(n(),a("div",Ye,[e("div",null,[t[22]||(t[22]=e("label",{class:"block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2"},"Frequency (MHz)",-1)),h(e("input",{"onUpdate:modelValue":t[2]||(t[2]=s=>o(r).customRadio.frequency=s),type:"number",step:"0.1",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-[12px] px-4 py-2.5 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-transparent transition-all",placeholder:"915.0"},null,512),[[C,o(r).customRadio.frequency]])]),e("div",null,[t[23]||(t[23]=e("label",{class:"block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2"},"Bandwidth (kHz)",-1)),h(e("input",{"onUpdate:modelValue":t[3]||(t[3]=s=>o(r).customRadio.bandwidth=s),type:"number",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-[12px] px-4 py-2.5 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-transparent transition-all",placeholder:"125"},null,512),[[C,o(r).customRadio.bandwidth]])]),e("div",null,[t[25]||(t[25]=e("label",{class:"block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2"},"Spreading Factor",-1)),h(e("select",{"onUpdate:modelValue":t[4]||(t[4]=s=>o(r).customRadio.spreading_factor=s),class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-[12px] px-4 py-2.5 text-content-primary dark:text-content-primary focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-transparent transition-all"},t[24]||(t[24]=[e("option",{value:"7"},"7",-1),e("option",{value:"8"},"8",-1),e("option",{value:"9"},"9",-1),e("option",{value:"10"},"10",-1),e("option",{value:"11"},"11",-1),e("option",{value:"12"},"12",-1)]),512),[[E,o(r).customRadio.spreading_factor]])]),e("div",null,[t[27]||(t[27]=e("label",{class:"block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2"},"Coding Rate",-1)),h(e("select",{"onUpdate:modelValue":t[5]||(t[5]=s=>o(r).customRadio.coding_rate=s),class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-[12px] px-4 py-2.5 text-content-primary dark:text-content-primary focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-transparent transition-all"},t[26]||(t[26]=[e("option",{value:"5"},"4/5",-1),e("option",{value:"6"},"4/6",-1),e("option",{value:"7"},"4/7",-1),e("option",{value:"8"},"4/8",-1)]),512),[[E,o(r).customRadio.coding_rate]])])])):k("",!0)]),_:1})])]))])):o(r).currentStep===5?(n(),a("div",Je,[t[32]||(t[32]=e("p",{class:"text-content-secondary dark:text-content-primary/70 text-center mb-6"}," Set a secure admin password to protect your repeater ",-1)),e("div",Ke,[e("div",null,[t[29]||(t[29]=e("label",{class:"block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2"},"Admin Password",-1)),h(e("input",{"onUpdate:modelValue":t[6]||(t[6]=s=>o(r).adminPassword=s),type:"password",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-3 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent",placeholder:"Enter password (min 6 characters)",minlength:"6"},null,512),[[C,o(r).adminPassword]])]),e("div",null,[t[30]||(t[30]=e("label",{class:"block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2"},"Confirm Password",-1)),h(e("input",{"onUpdate:modelValue":t[7]||(t[7]=s=>o(r).confirmPassword=s),type:"password",class:"w-full bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg px-4 py-3 text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent",placeholder:"Confirm password"},null,512),[[C,o(r).confirmPassword]])]),o(r).adminPassword&&o(r).confirmPassword&&o(r).adminPassword!==o(r).confirmPassword?(n(),a("div",Qe," Passwords do not match ")):k("",!0),t[31]||(t[31]=e("div",{class:"bg-yellow-500/10 border border-yellow-500/30 rounded-lg p-3 text-sm text-yellow-800 dark:text-yellow-200"},[e("strong",null,"Important:"),V(" Remember this password - you'll need it to access the dashboard. ")],-1))])])):k("",!0)]),o(r).error?(n(),a("div",Xe,i(o(r).error),1)):k("",!0),e("div",Ze,[o(r).canGoBack?(n(),a("button",{key:0,onClick:j,class:"px-6 py-3 rounded-[12px] bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 text-content-primary dark:text-content-primary hover:bg-stroke-subtle dark:hover:bg-white/10 hover:border-stroke dark:hover:border-stroke/20 transition-all duration-300 font-medium"}," Back ")):(n(),a("div",et)),e("button",{onClick:R,disabled:!o(r).canGoNext||o(r).isSubmitting,class:_(["px-8 py-3 rounded-[12px] font-semibold transition-all duration-300 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",o(r).canGoNext&&!o(r).isSubmitting?"bg-gradient-to-r from-primary/20 to-primary/10 hover:from-primary/30 hover:to-primary/20 text-white border border-primary/30 hover:border-primary/50":"bg-background-mute dark:bg-stroke/5 text-content-muted dark:text-content-muted border border-stroke-subtle dark:border-stroke/10"])},[o(r).isSubmitting?(n(),a("div",rt)):k("",!0),o(r).isSubmitting?(n(),a("span",ot,"Setting up...")):o(r).isLastStep?(n(),a("span",st,"Complete Setup")):(n(),a("span",at,"Next")),!o(r).isSubmitting&&!o(r).isLastStep?(n(),a("svg",nt,t[33]||(t[33]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"},null,-1)]))):k("",!0)],10,tt)])])]),B(T,{name:"modal"},{default:q(()=>[b.value?(n(),a("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm",onClick:g},[e("div",{class:"bg-white dark:bg-surface-elevated backdrop-blur-xl max-w-md w-full p-8 rounded-[24px] border border-stroke-subtle dark:border-white/20 shadow-[0_8px_32px_0_rgba(0,0,0,0.37)]",onClick:t[8]||(t[8]=X(()=>{},["stop"]))},[e("div",dt,[f.value==="success"?(n(),a("div",it,t[34]||(t[34]=[e("svg",{class:"w-8 h-8 text-green-600 dark:text-green-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"})],-1)]))):(n(),a("div",lt,t[35]||(t[35]=[e("svg",{class:"w-8 h-8 text-red-600 dark:text-red-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])))]),e("h3",ut,i(v.value),1),e("p",ct,i(x.value),1),e("button",{onClick:g,class:_(["w-full px-6 py-3 rounded-lg font-medium transition-all",f.value==="success"?"bg-gradient-to-r from-primary/20 to-primary/10 hover:from-primary/30 hover:to-primary/20 text-white":"bg-gradient-to-r from-red-500/20 to-red-500/10 hover:from-red-500/30 hover:to-red-500/20 text-white"])},i(f.value==="success"?"Continue to Login":"Close"),3)])])):k("",!0)]),_:1})]))}}),bt=Z(pt,[["__scopeId","data-v-20a8772f"]]);export{bt as default};
diff --git a/repeater/web/html/assets/Statistics-BszK_T8m.js b/repeater/web/html/assets/Statistics-BszK_T8m.js
new file mode 100644
index 0000000..90f7a54
--- /dev/null
+++ b/repeater/web/html/assets/Statistics-BszK_T8m.js
@@ -0,0 +1 @@
+import{a as Oe,J as Le,K as ze,r as u,D as pe,c as me,o as He,E as ve,R as M,H as Je,b as h,e as a,g as B,w as Ue,q as je,F as ge,h as fe,f as G,u as xe,i as $e,t as Y,L as H,I as le,n as Ke,p as k,x as Ve}from"./index-D0IT5vDS.js";import{S as Z}from"./chartjs-adapter-date-fns.esm-DJElUt-M.js";import{g as Ie,s as Xe}from"./preferences-DtwbSSgO.js";import{C as q,a as We,L as Ge,P as Ye,b as Ze,c as qe,B as Qe,D as et,S as tt,p as at,d as st,e as rt,A as ot,f as lt,i as nt,T as it}from"./chart-B185MtDy.js";import{P as J}from"./plotly.min-DO11Gp-n.js";import"./_commonjsHelpers-CqkleIqs.js";const ct={class:"p-3 sm:p-6 space-y-4 sm:space-y-6"},dt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center gap-3"},ut={class:"flex items-center gap-2 sm:gap-3"},pt=["value"],mt={class:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4"},vt={class:"glass-card rounded-[15px] p-3 sm:p-6"},gt={class:"relative h-40 sm:h-48 rounded-lg p-2 sm:p-4"},ft={key:0,class:"absolute inset-0 flex items-center justify-center bg-white/50 dark:bg-white/5 backdrop-blur-xs z-20"},xt={key:1,class:"absolute inset-0 flex items-center justify-center bg-white/50 dark:bg-white/5 z-20"},bt={class:"grid grid-cols-1 lg:grid-cols-2 gap-4 sm:gap-6 items-stretch"},yt={class:"glass-card rounded-[15px] p-3 sm:p-6 flex flex-col"},ht={class:"relative flex-1 min-h-[12rem] sm:min-h-[16rem] rounded-lg"},kt={key:0,class:"absolute inset-0 flex items-center justify-center bg-white/50 dark:bg-white/5 backdrop-blur-xs z-20"},Ct={class:"glass-card rounded-[15px] p-3 sm:p-6 flex flex-col"},_t={class:"flex-1 flex flex-col justify-evenly"},wt={key:0,class:"flex items-center justify-center flex-1"},St={key:1,class:"flex items-center justify-center flex-1"},Tt={class:"w-28 sm:w-32 text-sm text-content-primary dark:text-content-primary truncate"},Rt={class:"flex-1 h-12 bg-background-mute dark:bg-stroke/10 rounded overflow-hidden"},Dt={class:"w-20 text-sm text-content-secondary dark:text-content-muted text-right tabular-nums"},Et={key:0,class:"glass-card rounded-[15px] p-6 sm:p-8 text-center"},Ft={key:1,class:"glass-card rounded-[15px] p-6 sm:p-8 text-center"},Mt={class:"text-content-secondary dark:text-content-muted text-sm"},Pt=Oe({name:"StatisticsView",__name:"Statistics",setup(Bt){q.register(We,Ge,Ye,Ze,qe,Qe,et,tt,at,st,rt,ot,lt,nt,it);const A=Le(),Q=ze(),N=u(null),ee=u(!1),ne=()=>{N.value||Q.isConnected||(N.value=window.setInterval(X,3e4))},ie=()=>{N.value&&(clearInterval(N.value),N.value=null)},T=()=>{const e=document.documentElement.classList.contains("dark");return{gridColor:e?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.1)",tickColor:e?"rgba(255, 255, 255, 0.7)":"rgba(0, 0, 0, 0.7)",legendColor:e?"rgba(255, 255, 255, 0.8)":"rgba(0, 0, 0, 0.8)",titleColor:e?"rgba(255, 255, 255, 0.8)":"rgba(0, 0, 0, 0.8)"}},v=u(Ie("statistics_selectedHours",24)),be=[{value:1,label:"1 Hour"},{value:6,label:"6 Hours"},{value:12,label:"12 Hours"},{value:24,label:"24 Hours"},{value:48,label:"2 Days"},{value:168,label:"1 Week"}];pe(v,e=>Xe("statistics_selectedHours",e));const R=u(null),O=u(null),U=u([]),D=u(null),te=u([]),j=u([]),$=u(!0),K=u(null),C=u({packetRate:!0,packetType:!0,noiseFloor:!1,routePie:!0,sparklines:!0}),L=u(!1),V=u(!1),z=u(!1),_=u(null),w=u(null),y=u(null),I=u(null),ae=u(null),se=u(null),E=u(null),ce=me(()=>{const e=A.packetStats;return e?{totalRx:e.total_packets||0,totalTx:e.transmitted_packets||0}:{totalRx:0,totalTx:0}}),re=(e,t)=>{if(e.length===0)return[];const o=Math.round(t*60*60*1e3/72),r=new Map;return e.forEach(([i,g])=>{let f=i;i>1e15?f=i/1e3:i>1e9&&i<1e12&&(f=i*1e3);const S=Math.floor(f/o)*o;r.has(S)||r.set(S,[]),r.get(S).push(g)}),Array.from(r.entries()).sort((i,g)=>i[0]-g[0]).map(([,i])=>i.reduce((g,f)=>g+f,0)/i.length)},oe=me(()=>{let e=[],t=[];if(R.value?.series){const s=R.value.series.find(r=>r.type==="rx_count"),o=R.value.series.find(r=>r.type==="tx_count");s?.data&&(e=re(s.data,v.value)),o?.data&&(t=re(o.data,v.value))}return{totalPackets:e,transmittedPackets:t,droppedPackets:[],crcErrors:re(j.value.map(s=>[s.timestamp>1e12?s.timestamp:s.timestamp*1e3,s.count]),v.value)}}),X=async()=>{try{$.value=!0,K.value=null,await Promise.all([A.fetchPacketStats({hours:v.value}),A.fetchSystemStats()]),$.value=!1,ye()}catch(e){K.value=e instanceof Error?e.message:"Failed to fetch data",$.value=!1}},ye=async()=>{C.value={packetRate:!0,packetType:!0,noiseFloor:!0,routePie:!0,sparklines:!0};const e=[he(),ke(),Ce(),_e(),we()];try{await Promise.allSettled(e),await ve(),!I.value||!ae.value?setTimeout(()=>{de()},100):de()}catch(t){console.error("Error loading chart data:",t)}},he=async()=>{try{const e=await H.get("/metrics_graph_data",{hours:v.value,resolution:"average",metrics:"rx_count,tx_count"});e?.success&&(R.value=e.data)}catch{R.value=null}},ke=async()=>{try{const e=await H.get("/packet_type_graph_data",{hours:v.value,resolution:"average",types:"all"});if(e?.success&&e.data){const t=e.data;U.value=t.series||[]}}catch{U.value=[]}},Ce=async()=>{try{const e=await H.get("/route_stats",{hours:v.value});e?.success&&e.data&&(D.value=e.data)}catch{D.value=null}},_e=async()=>{try{const e={hours:v.value},t=await H.get("/noise_floor_history",e);if(t.success&&t.data){const o=t.data.history||[];Array.isArray(o)&&o.length>0&&(O.value={chart_data:o.map(r=>({timestamp:r.timestamp||Date.now()/1e3,noise_floor_dbm:r.noise_floor_dbm||r.noise_floor||-120}))},Te())}}catch{O.value={chart_data:[]}}},we=async()=>{try{const e=await H.get("/crc_error_history",{hours:v.value});if(e?.success&&e.data){const t=e.data;j.value=t.history||[]}}catch{j.value=[]}},Se=()=>{C.value={packetRate:!0,packetType:!0,noiseFloor:!0,routePie:!0,sparklines:!0},ue(),L.value=!1,V.value=!1,z.value=!1,X()},Te=()=>{if(te.value=[],O.value?.chart_data&&O.value.chart_data.length>0){const e=O.value.chart_data;te.value=e.map(t=>({timestamp:t.timestamp*1e3,snr:null,rssi:null,noiseFloor:t.noise_floor_dbm}))}},de=()=>{if(!ee.value){ee.value=!0;try{Re(),De(),Ee(),Fe(),setTimeout(()=>{C.value={packetRate:!1,packetType:!1,noiseFloor:!1,routePie:!1,sparklines:!1},setTimeout(()=>{const e=M(_.value),t=M(w.value),s=M(y.value);e&&e.update("none"),t&&t.update("none"),s&&s.update("none")},50)},100)}catch(e){console.error("Error creating/updating charts:",e),ue()}finally{ee.value=!1}}},ue=()=>{try{_.value&&(_.value.destroy(),_.value=null),w.value&&(w.value.destroy(),w.value=null),y.value&&(y.value.destroy(),y.value=null),E.value&&J.purge(E.value)}catch(e){console.error("Error destroying charts:",e)}},Re=()=>{if(!I.value)return;const e=I.value.getContext("2d");if(!e)return;let t=[],s=[];if(R.value?.series){const p=R.value.series.find(c=>c.type==="rx_count"),b=R.value.series.find(c=>c.type==="tx_count");p?.data&&(t=p.data.map(([c,d])=>{let n=c;return c>1e15?n=c/1e3:c>1e12?n=c:c>1e9?n=c*1e3:n=Date.now(),{x:n,y:d}})),b?.data&&(s=b.data.map(([c,d])=>{let n=c;return c>1e15?n=c/1e3:c>1e12?n=c:c>1e9?n=c*1e3:n=Date.now(),{x:n,y:d}}))}if(t.length===0&&s.length===0){L.value=!0;return}L.value=!1,_.value&&(_.value.destroy(),_.value=null);const r=Math.round(v.value*60*60*1e3/72),i=p=>{if(p.length===0)return[];const b=new Map;return p.forEach(d=>{const n=Math.floor(d.x/r)*r;b.has(n)||b.set(n,[]),b.get(n).push(d.y)}),Array.from(b.entries()).map(([d,n])=>({x:d,y:n.reduce((F,W)=>F+W,0)/n.length})).sort((d,n)=>d.x-n.x)},g=(p,b=3)=>{if(p.lengthAe+Ne.y,0)/W.length;c.push({x:p[d].x,y:Be})}return c},f=g(i(t)),S=g(i(s)),P=[...f.map(p=>p.y),...S.map(p=>p.y)],l=Math.min(...P),m=Math.max(...P),x=m-l||m*.1||.001,Me=Math.max(0,l-x*.05),Pe=m+x*.05;try{const p=JSON.parse(JSON.stringify(f)),b=JSON.parse(JSON.stringify(S)),c=new q(e,{type:"line",data:{datasets:[{label:"TX/hr",data:b,borderColor:"#F59E0B",backgroundColor:"#F59E0B",borderWidth:2,fill:"origin",tension:.4,pointRadius:0,pointHoverRadius:3,order:1},{label:"RX/hr",data:p,borderColor:"#C084FC",backgroundColor:"#C084FC",borderWidth:2,fill:"origin",tension:.4,pointRadius:0,pointHoverRadius:3,order:2}]},options:{responsive:!0,maintainAspectRatio:!1,animation:{duration:0},interaction:{mode:"index",intersect:!1},plugins:{legend:{display:!1},title:{display:!1},tooltip:{enabled:!0,backgroundColor:"rgba(0, 0, 0, 0.8)",titleColor:"rgba(255, 255, 255, 0.9)",bodyColor:"rgba(255, 255, 255, 0.8)",borderColor:"rgba(255, 255, 255, 0.2)",borderWidth:1,padding:12,displayColors:!0,callbacks:{title:function(d){const n=d[0]?.parsed?.x;return n==null?"":new Date(n).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})},label:function(d){const n=d.dataset?.label||"",F=d.parsed?.y;return F==null?n:`${n}: ${F.toFixed(3)}`}}}},scales:{x:{type:"time",time:{unit:"hour",displayFormats:{hour:"HH:mm"}},min:Date.now()-v.value*3600*1e3,max:Date.now(),grid:{color:T().gridColor},ticks:{color:T().tickColor,maxTicksLimit:8}},y:{beginAtZero:!1,grid:{color:T().gridColor},ticks:{color:T().tickColor,callback:function(d){return typeof d=="number"?d.toFixed(3):d}},min:Me,max:Pe}}}});_.value=le(c)}catch(p){console.error("Error creating packet rate chart:",p),L.value=!0}},De=()=>{if(!ae.value)return;const e=ae.value.getContext("2d");if(!e)return;const t=[],s=[],o=["#60A5FA","#34D399","#FBBF24","#A78BFA","#F87171","#06B6D4","#84CC16","#F472B6","#10B981"];if(U.value.length>0)U.value.forEach(r=>{const i=r.data?r.data.reduce((g,f)=>g+f[1],0):0;i>0&&(t.push(r.name.replace(/\([^)]*\)/g,"").trim()),s.push(i))});else{V.value=!0;return}V.value=!1,w.value&&(w.value.destroy(),w.value=null);try{const r=JSON.parse(JSON.stringify(t)),i=JSON.parse(JSON.stringify(s)),g=new q(e,{type:"bar",data:{labels:r,datasets:[{data:i,backgroundColor:o.slice(0,i.length),borderRadius:8,borderSkipped:!1}]},options:{responsive:!0,maintainAspectRatio:!1,animation:{duration:0},plugins:{legend:{display:!1}},scales:{x:{grid:{display:!1},ticks:{color:"rgba(255, 255, 255, 0.7)",font:{size:10}}},y:{beginAtZero:!0,grid:{color:"rgba(255, 255, 255, 0.1)"},ticks:{color:"rgba(255, 255, 255, 0.7)"}}}}});w.value=le(g)}catch(r){console.error("Error creating packet type chart:",r),V.value=!0}},Ee=()=>{if(!se.value)return;const e=se.value.getContext("2d");if(!e)return;const t=te.value.map(l=>({x:l.timestamp,y:l.noiseFloor})).filter(l=>l.y!==null&&l.y!==void 0),s=t.map(l=>l.y),o=s.length>0?Math.min(...s):-120,r=s.length>0?Math.max(...s):-110,i=r-o||1,g=o-i*.05,f=r+i*.05;if(y.value)try{const l=M(y.value),m=JSON.parse(JSON.stringify(t));l.data.datasets[0]&&(l.data.datasets[0].data=m),l.options?.scales?.x&&(l.options.scales.x.min=Date.now()-v.value*3600*1e3,l.options.scales.x.max=Date.now()),l.update("active");return}catch{y.value.destroy(),y.value=null}const S=JSON.parse(JSON.stringify(t)),P=new q(e,{type:"scatter",data:{datasets:[{label:"Noise Floor (dBm)",data:S,borderWidth:0,backgroundColor:"rgba(245, 158, 11, 0.8)",pointRadius:3,pointHoverRadius:5,pointStyle:"circle"}]},options:{responsive:!0,maintainAspectRatio:!1,animation:{duration:0},interaction:{mode:"index",intersect:!1},plugins:{legend:{display:!0,position:"top",labels:{color:T().legendColor,usePointStyle:!0,padding:20}},tooltip:{enabled:!0,backgroundColor:"rgba(0, 0, 0, 0.8)",titleColor:"rgba(255, 255, 255, 0.9)",bodyColor:"rgba(255, 255, 255, 0.8)",borderColor:"rgba(255, 255, 255, 0.2)",borderWidth:1,padding:12,displayColors:!0,callbacks:{title:function(l){const m=l[0]?.parsed?.x;return m==null?"":new Date(m).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})},label:function(l){const m=l.dataset?.label||"",x=l.parsed?.y;return x==null?m:`${m}: ${x.toFixed(1)} dBm`}}}},scales:{x:{type:"time",time:{unit:"hour",displayFormats:{hour:"HH:mm"}},min:Date.now()-v.value*3600*1e3,max:Date.now(),grid:{color:T().gridColor},ticks:{color:T().tickColor,maxTicksLimit:8}},y:{type:"linear",display:!0,title:{display:!0,text:"Noise Floor (dBm)",color:T().titleColor},grid:{color:"rgba(245, 158, 11, 0.2)"},ticks:{color:"#F59E0B",callback:function(l){return typeof l=="number"?l.toFixed(1):l}},min:g,max:f}}}});y.value=le(P)},Fe=()=>{if(!E.value)return;if(!D.value||!D.value.route_totals){z.value=!0;return}z.value=!1;const e=D.value.route_totals,t=Object.keys(e),s=Object.values(e),o=["#3B82F6","#10B981","#F59E0B","#A78BFA","#F87171"];try{const r=JSON.parse(JSON.stringify(t)),i=JSON.parse(JSON.stringify(s)),g=i.reduce((m,x)=>m+x,0),f=i.map(m=>m/g*100),S=r.map((m,x)=>({type:"bar",name:m,x:[f[x]],y:[""],orientation:"h",marker:{color:o[x%o.length]},text:f[x]>=5?`${m} ${f[x].toFixed(0)}%`:"",textposition:"inside",textfont:{color:"white",size:11},hoverinfo:"none",insidetextanchor:"middle"})),P={paper_bgcolor:"rgba(0,0,0,0)",plot_bgcolor:"rgba(0,0,0,0)",font:{color:"rgba(255, 255, 255, 0.8)",size:11},margin:{t:10,b:60,l:10,r:10},barmode:"stack",showlegend:!0,legend:{orientation:"h",x:0,y:-.3,xanchor:"left",font:{color:"rgba(255, 255, 255, 0.8)",size:10}},xaxis:{showgrid:!1,showticklabels:!1,zeroline:!1,range:[0,100]},yaxis:{showgrid:!1,showticklabels:!1,zeroline:!1},hovermode:!1,bargap:0},l={responsive:!0,displayModeBar:!1,staticPlot:!0};J.newPlot(E.value,S,P,l)}catch(r){console.error("Error creating route treemap chart:",r),z.value=!0}};return He(async()=>{await ve(),X(),Q.isConnected||ne(),pe(()=>Q.isConnected,e=>{e?ie():ne()}),window.addEventListener("resize",()=>{setTimeout(()=>{M(_.value)?.resize(),M(w.value)?.resize(),M(y.value)?.resize(),E.value&&J.Plots&&J.Plots.resize(E.value)},100)})}),Je(()=>{ie(),_.value?.destroy(),w.value?.destroy(),y.value?.destroy(),E.value&&J.purge(E.value),window.removeEventListener("resize",()=>{})}),(e,t)=>(k(),h("div",ct,[a("div",dt,[t[2]||(t[2]=a("h2",{class:"text-xl sm:text-2xl font-bold text-content-primary dark:text-content-primary"},"Statistics",-1)),a("div",ut,[t[1]||(t[1]=a("label",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Time Range:",-1)),Ue(a("select",{"onUpdate:modelValue":t[0]||(t[0]=s=>v.value=s),onChange:Se,class:"bg-white dark:bg-white/10 border border-stroke-subtle dark:border-stroke/20 rounded-lg px-2 sm:px-3 py-1.5 sm:py-2 text-content-primary dark:text-content-primary text-xs sm:text-sm focus:outline-hidden focus:border-primary dark:focus:border-accent-purple/50 transition-colors"},[(k(),h(ge,null,fe(be,s=>a("option",{key:s.value,value:s.value,class:"bg-white dark:bg-gray-800 text-content-primary dark:text-content-primary"},Y(s.label),9,pt)),64))],544),[[je,v.value]])])]),a("div",mt,[G(Z,{title:"Total RX",value:ce.value.totalRx,color:"#AAE8E8",data:oe.value.totalPackets,loading:C.value.sparklines,variant:"classic"},null,8,["value","data","loading"]),G(Z,{title:"Total TX",value:ce.value.totalTx,color:"#FFC246",data:oe.value.transmittedPackets,loading:C.value.sparklines,variant:"classic"},null,8,["value","data","loading"]),G(Z,{title:"CRC Errors",value:j.value.reduce((s,o)=>s+o.count,0),color:"#F59E0B",data:oe.value.crcErrors,loading:C.value.sparklines,variant:"classic"},null,8,["value","data","loading"]),G(Z,{title:"Packet Hash Cache",value:xe(A).systemStats?.duplicate_cache_size??0,color:"#9F7AEA",data:[],loading:!1,variant:"smooth",subtitle:`Entries expire after ${(()=>{const s=xe(A).systemStats?.cache_ttl??3600,o=Math.floor(s/60);return o>=60?`${Math.floor(o/60)}h`:`${o}m`})()}`},null,8,["value","subtitle"])]),a("div",vt,[t[6]||(t[6]=a("h3",{class:"text-content-primary dark:text-content-primary text-lg sm:text-xl font-semibold mb-3 sm:mb-4"},"Performance Metrics",-1)),a("div",null,[t[5]||(t[5]=$e(' Packet Rate (RX/TX PER HOUR)
',2)),a("div",gt,[a("canvas",{ref_key:"packetRateCanvasRef",ref:I,class:"w-full h-full relative z-10"},null,512),C.value.packetRate?(k(),h("div",ft,t[3]||(t[3]=[a("div",{class:"text-center"},[a("div",{class:"animate-spin w-6 h-6 sm:w-8 sm:h-8 border-2 border-stroke-subtle dark:border-stroke/20 border-t-purple-600 dark:border-t-purple-400 rounded-full mx-auto mb-2"}),a("div",{class:"text-content-secondary dark:text-content-muted text-[10px] sm:text-xs"},"Loading packet rate data...")],-1)]))):B("",!0),L.value&&!C.value.packetRate?(k(),h("div",xt,t[4]||(t[4]=[a("div",{class:"text-center"},[a("div",{class:"text-red-700 dark:text-red-400 text-sm font-semibold mb-1"},"No Data Available"),a("div",{class:"text-content-secondary dark:text-content-muted text-xs"},"Packet rate data not found")],-1)]))):B("",!0)])])]),a("div",bt,[a("div",yt,[t[8]||(t[8]=a("h3",{class:"text-content-primary dark:text-content-primary text-lg sm:text-xl font-semibold mb-3 sm:mb-4"}," Noise Floor Over Time ",-1)),a("div",ht,[a("canvas",{ref_key:"signalMetricsCanvasRef",ref:se,class:"w-full h-full"},null,512),C.value.noiseFloor?(k(),h("div",kt,t[7]||(t[7]=[a("div",{class:"text-center"},[a("div",{class:"animate-spin w-6 h-6 sm:w-8 sm:h-8 border-2 border-stroke-subtle dark:border-stroke/20 border-t-amber-600 dark:border-t-amber-400 rounded-full mx-auto mb-2"}),a("div",{class:"text-content-secondary dark:text-content-muted text-[10px] sm:text-xs"},"Loading noise floor data...")],-1)]))):B("",!0)])]),a("div",Ct,[t[11]||(t[11]=a("h3",{class:"text-content-primary dark:text-content-primary text-lg sm:text-xl font-semibold mb-3 sm:mb-4"},"Route Distribution",-1)),a("div",_t,[C.value.routePie?(k(),h("div",wt,t[9]||(t[9]=[a("div",{class:"text-center"},[a("div",{class:"animate-spin w-6 h-6 border-2 border-stroke-subtle dark:border-stroke/20 border-t-green-600 dark:border-t-green-400 rounded-full mx-auto mb-2"}),a("div",{class:"text-content-secondary dark:text-content-muted text-xs"},"Loading route data...")],-1)]))):z.value?(k(),h("div",St,t[10]||(t[10]=[a("div",{class:"text-center"},[a("div",{class:"text-red-700 dark:text-red-400 text-sm font-semibold mb-1"},"No Data Available"),a("div",{class:"text-content-secondary dark:text-content-muted text-xs"},"Route statistics not found")],-1)]))):D.value?.route_totals?(k(!0),h(ge,{key:2},fe(D.value.route_totals,(s,o,r)=>(k(),h("div",{key:o,class:"flex items-center gap-3"},[a("div",Tt,Y(o),1),a("div",Rt,[a("div",{class:"h-full rounded transition-all duration-300",style:Ke({width:`${s/Math.max(...Object.values(D.value.route_totals))*100}%`,backgroundColor:["#3B82F6","#10B981","#F59E0B","#A78BFA","#F87171"][r%5]})},null,4)]),a("div",Dt,Y(s.toLocaleString()),1)]))),128)):B("",!0)])])]),$.value?(k(),h("div",Et,t[12]||(t[12]=[a("div",{class:"text-content-secondary dark:text-content-muted mb-2 text-sm"},"Loading statistics...",-1),a("div",{class:"animate-spin w-6 h-6 sm:w-8 sm:h-8 border-2 border-stroke-subtle dark:border-stroke/20 border-t-content-primary dark:border-t-white/70 rounded-full mx-auto"},null,-1)]))):B("",!0),K.value?(k(),h("div",Ft,[t[13]||(t[13]=a("div",{class:"text-red-700 dark:text-red-400 mb-2 text-sm font-semibold"},"Failed to load statistics",-1)),a("p",Mt,Y(K.value),1),a("button",{onClick:X,class:"mt-4 px-4 py-2 bg-primary hover:bg-primary/90 dark:bg-primary dark:hover:bg-primary/80 text-white font-medium rounded-lg border border-primary/20 dark:border-primary/30 transition-colors shadow-sm"}," Retry ")])):B("",!0)]))}}),Jt=Ve(Pt,[["__scopeId","data-v-8daccd7e"]]);export{Jt as default};
diff --git a/repeater/web/html/assets/SystemStats-DbE-CP6d.js b/repeater/web/html/assets/SystemStats-DbE-CP6d.js
new file mode 100644
index 0000000..b4fb7d1
--- /dev/null
+++ b/repeater/web/html/assets/SystemStats-DbE-CP6d.js
@@ -0,0 +1,2 @@
+const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/plotly.min-DO11Gp-n.js","assets/_commonjsHelpers-CqkleIqs.js"])))=>i.map(i=>d[i]);
+import{a as ot,r as u,c as W,E as N,o as nt,R as X,S as O,H as lt,b as d,e as t,g as v,f as A,t as o,F as Y,h as G,I as K,L as Q,j as V,p as i,x as dt}from"./index-D0IT5vDS.js";import{S as P}from"./chartjs-adapter-date-fns.esm-DJElUt-M.js";import{C as j,a as it,L as ct,P as ut,b as mt,c as vt,B as pt,D as xt,p as yt,d as gt,e as ft,A as bt,f as kt,i as ht,T as _t}from"./chart-B185MtDy.js";const Ct={class:"p-6 space-y-6"},wt={class:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4"},Ft={class:"grid grid-cols-1 lg:grid-cols-2 gap-6"},St={class:"glass-card rounded-[15px] p-6"},Ut={class:"relative h-32 bg-gray-100/50 dark:bg-white/5 rounded-lg p-4 mb-4 chart-container"},Bt={key:0,class:"absolute inset-0 flex items-center justify-center bg-white/50 dark:bg-white/5 backdrop-blur-sm z-20"},Et={key:1,class:"absolute inset-0 flex items-center justify-center bg-white/50 dark:bg-white/5 z-20"},At={key:0,class:"grid grid-cols-2 gap-4 text-sm"},Pt={class:"text-content-primary dark:text-content-primary font-semibold"},Lt={class:"text-content-primary dark:text-content-primary font-semibold"},Mt={class:"text-content-primary dark:text-content-primary font-semibold"},Dt={class:"text-content-primary dark:text-content-primary font-semibold"},Rt={class:"glass-card rounded-[15px] p-6"},Tt={class:"relative h-32 bg-gray-100/50 dark:bg-white/5 rounded-lg p-4 mb-4 chart-container"},zt={key:0,class:"absolute inset-0 flex items-center justify-center bg-white/50 dark:bg-white/5 backdrop-blur-sm z-20"},$t={key:1,class:"absolute inset-0 flex items-center justify-center bg-white/50 dark:bg-white/5 z-20"},It={key:0,class:"grid grid-cols-2 gap-4 text-sm"},Nt={class:"text-content-primary dark:text-content-primary font-semibold"},Ot={class:"text-content-primary dark:text-content-primary font-semibold"},Vt={class:"text-content-primary dark:text-content-primary font-semibold"},jt={class:"text-content-primary dark:text-content-primary font-semibold"},Ht={class:"grid grid-cols-1 lg:grid-cols-2 gap-6"},qt={class:"glass-card rounded-[15px] p-6"},Jt={class:"relative h-48"},Wt={key:0,class:"grid grid-cols-3 gap-4 text-sm mt-4"},Xt={class:"text-center"},Yt={class:"text-content-primary dark:text-content-primary font-semibold"},Gt={class:"text-center"},Kt={class:"font-semibold text-red-500 dark:text-red-400"},Qt={class:"text-center"},Zt={class:"font-semibold text-green-700 dark:text-green-400"},te={class:"glass-card rounded-[15px] p-6"},ee={key:0,class:"space-y-4"},ae={class:"grid grid-cols-2 gap-4 text-sm"},se={class:"text-content-primary dark:text-content-primary font-semibold"},re={class:"text-content-primary dark:text-content-primary font-semibold"},oe={class:"text-content-primary dark:text-content-primary font-semibold"},ne={class:"text-content-primary dark:text-content-primary font-semibold"},le={key:0,class:"pt-4 border-t border-stroke-subtle dark:border-stroke/10"},de={class:"grid grid-cols-2 gap-2 text-sm"},ie={class:"text-content-secondary dark:text-content-muted"},ce={class:"text-content-primary dark:text-content-primary font-semibold ml-1"},ue={class:"glass-card rounded-[15px] p-6"},me={key:0,class:"overflow-x-auto"},ve={class:"w-full text-sm"},pe={class:"text-content-secondary dark:text-content-primary/80 py-2 transition-all duration-300"},xe={class:"text-content-primary dark:text-content-primary font-semibold py-2 transition-all duration-300"},ye={class:"text-center text-orange-500 dark:text-orange-400 py-2 transition-all duration-300"},ge={class:"text-center text-green-700 dark:text-green-400 py-2 transition-all duration-300"},fe={class:"text-right text-content-secondary dark:text-content-primary/80 py-2 transition-all duration-300"},be={key:0,class:"mt-4 text-center text-content-secondary dark:text-content-muted text-sm transition-all duration-300"},ke={key:1,class:"text-center text-content-secondary dark:text-content-muted py-8"},he={key:0,class:"glass-card rounded-[15px] p-8 text-center"},_e={key:1,class:"glass-card rounded-[15px] p-8 text-center"},Ce={class:"text-content-secondary dark:text-content-muted text-sm"},we=ot({name:"SystemStatsView",__name:"SystemStats",setup(Fe){j.register(it,ct,ut,mt,vt,pt,xt,yt,gt,ft,bt,kt,ht,_t);const L=u(null),_=u(!0),C=u(null),s=u(null),b=u(null),x=u([]),M=u(null),p=u({cpuChart:!0,memoryChart:!0,diskChart:!1,processChart:!0}),D=u(!1),R=u(!1),y=u(null),g=u(null),T=u(null),z=u(null),k=u(null),B=W(()=>s.value?{cpuUsage:s.value.cpu.usage_percent,memoryUsage:s.value.memory.usage_percent,diskUsage:s.value.disk.usage_percent,uptime:s.value.system.uptime}:{cpuUsage:0,memoryUsage:0,diskUsage:0,uptime:0}),E=W(()=>x.value.length===0?{cpu:[],memory:[],disk:[],network:[]}:{cpu:x.value.map(a=>a.cpu.usage_percent),memory:x.value.map(a=>a.memory.usage_percent),disk:x.value.map(a=>a.disk.usage_percent),network:x.value.map(a=>a.network.bytes_recv/1024/1024)}),f=a=>{const e=["B","KB","MB","GB","TB"];if(a===0)return"0 B";const r=Math.floor(Math.log(a)/Math.log(1024));return parseFloat((a/Math.pow(1024,r)).toFixed(2))+" "+e[r]},Z=a=>{const e=Math.floor(a/86400),r=Math.floor(a%86400/3600),n=Math.floor(a%3600/60);return e>0?`${e}d ${r}h ${n}m`:r>0?`${r}h ${n}m`:`${n}m`},tt=async()=>{try{const a=await Q.get("/hardware_stats");if(a?.success&&a.data){const e=a.data;if(s.value=e,x.value.length===0)for(let n=0;n<12;n++)x.value.push(JSON.parse(JSON.stringify(e)));else x.value.push(e),x.value.length>20&&x.value.shift()}}catch(a){console.error("Failed to fetch hardware stats:",a),C.value="Failed to fetch hardware stats"}},et=async()=>{try{const a=await Q.get("/hardware_processes");a?.success&&a.data&&(M.value=b.value,b.value=a.data)}catch(a){console.error("Failed to fetch process stats:",a)}},$=(a,e)=>{if(!M.value)return!1;const r=M.value.processes.find(n=>n.pid===a.pid);return r?r[e]!==a[e]:!0},I=async()=>{try{_.value=!0,C.value=null,await Promise.all([tt(),et()]),_.value=!1,await N(),H()}catch(a){C.value=a instanceof Error?a.message:"Failed to fetch system data",_.value=!1}},H=()=>{s.value&&(at(),st(),rt())},at=()=>{if(!T.value||!s.value){p.value.cpuChart=!1;return}const a=T.value.getContext("2d");if(!a){p.value.cpuChart=!1;return}const e=s.value.cpu.usage_percent,r=100-e;if(y.value)try{y.value.data.datasets[0].data=[e,r],y.value.update("none");return}catch(m){console.warn("Failed to update CPU chart, recreating...",m),y.value.destroy(),y.value=null}const n=document.documentElement.classList.contains("dark"),h=n?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.1)",w=n?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.2)",F=n?"rgba(255, 255, 255, 0.6)":"rgba(0, 0, 0, 0.6)";try{const m=new j(a,{type:"doughnut",data:{labels:["Used","Available"],datasets:[{data:[e,r],backgroundColor:["#FFC246",h],borderColor:["#FFC246",w],borderWidth:2}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:"70%",animation:{animateRotate:!1,animateScale:!1,duration:0},plugins:{legend:{display:!1},tooltip:{callbacks:{label:function(c){return`${c.label}: ${c.parsed.toFixed(1)}%`}}}}},plugins:[{id:"centerText",beforeDraw:function(c){const l=c.ctx;l.save();const S=(c.chartArea.left+c.chartArea.right)/2,U=(c.chartArea.top+c.chartArea.bottom)/2;l.textAlign="center",l.textBaseline="middle",l.fillStyle="#FFC246",l.font="bold 18px sans-serif",l.fillText(`${e.toFixed(1)}%`,S,U-5),l.fillStyle=F,l.font="10px sans-serif",l.fillText("CPU",S,U+12),l.restore()}}]});y.value=K(m),D.value=!1,p.value.cpuChart=!1}catch(m){console.error("Error creating CPU chart:",m),D.value=!0,p.value.cpuChart=!1}},st=()=>{if(!z.value||!s.value){p.value.memoryChart=!1;return}const a=z.value.getContext("2d");if(!a){p.value.memoryChart=!1;return}const e=s.value.memory.usage_percent,r=100-e;if(g.value)try{g.value.data.datasets[0].data=[e,r],g.value.update("none");return}catch(m){console.warn("Failed to update Memory chart, recreating...",m),g.value.destroy(),g.value=null}const n=document.documentElement.classList.contains("dark"),h=n?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.1)",w=n?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.2)",F=n?"rgba(255, 255, 255, 0.6)":"rgba(0, 0, 0, 0.6)";try{const m=new j(a,{type:"doughnut",data:{labels:["Used","Available"],datasets:[{data:[e,r],backgroundColor:["#A5E5B6",h],borderColor:["#A5E5B6",w],borderWidth:2}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:"70%",animation:{animateRotate:!1,animateScale:!1,duration:0},plugins:{legend:{display:!1},tooltip:{callbacks:{label:function(c){return`${c.label}: ${c.parsed.toFixed(1)}%`}}}}},plugins:[{id:"centerText",beforeDraw:function(c){const l=c.ctx;l.save();const S=(c.chartArea.left+c.chartArea.right)/2,U=(c.chartArea.top+c.chartArea.bottom)/2;l.textAlign="center",l.textBaseline="middle",l.fillStyle="#A5E5B6",l.font="bold 18px sans-serif",l.fillText(`${e.toFixed(1)}%`,S,U-5),l.fillStyle=F,l.font="10px sans-serif",l.fillText("Memory",S,U+12),l.restore()}}]});g.value=K(m),R.value=!1,p.value.memoryChart=!1}catch(m){console.error("Error creating Memory chart:",m),R.value=!0,p.value.memoryChart=!1}},rt=()=>{if(!k.value||!s.value)return;const e=document.documentElement.classList.contains("dark")?"rgba(255, 255, 255, 0.8)":"rgba(0, 0, 0, 0.8)";try{O(()=>import("./plotly.min-DO11Gp-n.js").then(r=>r.p),__vite__mapDeps([0,1])).then(r=>{const n=r.default||r,h=s.value.disk,w=[{type:"pie",labels:["Used","Free"],values:[h.used,h.free],marker:{colors:["#FB787B","#A5E5B6"]},hovertemplate:"%{label}
Size: %{value}
Percentage: %{percent}",textinfo:"label+percent",textposition:"auto",hole:.4}],F={title:{text:"",font:{color:e}},paper_bgcolor:"rgba(0,0,0,0)",plot_bgcolor:"rgba(0,0,0,0)",font:{color:e,size:11},margin:{t:20,b:20,l:20,r:20},showlegend:!0,legend:{orientation:"h",x:0,y:-.2,font:{color:e,size:10}}},m={responsive:!0,displayModeBar:!1,staticPlot:!1};n.newPlot(k.value,w,F,m)})}catch(r){console.error("Error creating disk chart:",r)}},q=()=>{try{if(y.value&&(y.value.destroy(),y.value=null),g.value&&(g.value.destroy(),g.value=null),k.value)try{O(()=>import("./plotly.min-DO11Gp-n.js").then(a=>a.p),__vite__mapDeps([0,1])).then(a=>{const e=a?.default||a;e?.purge&&e.purge(k.value)}).catch(()=>{})}catch{}}catch(a){console.error("Error destroying charts:",a)}},J=new MutationObserver(a=>{a.forEach(e=>{e.attributeName==="class"&&(q(),N(()=>{H()}))})});return nt(async()=>{await N(),I(),L.value=window.setInterval(I,5e3),J.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),window.addEventListener("resize",()=>{setTimeout(()=>{X(y.value)?.resize(),X(g.value)?.resize();try{O(()=>import("./plotly.min-DO11Gp-n.js").then(a=>a.p),__vite__mapDeps([0,1])).then(a=>{const e=a?.default||a;e?.Plots&&e.Plots.resize(k.value)}).catch(()=>{})}catch{}},100)})}),lt(()=>{L.value&&clearInterval(L.value),J.disconnect(),q(),window.removeEventListener("resize",()=>{})}),(a,e)=>(i(),d("div",Ct,[e[28]||(e[28]=t("div",{class:"flex justify-between items-center"},[t("h2",{class:"text-2xl font-bold text-content-primary dark:text-content-primary"},"System Statistics"),t("div",{class:"text-content-secondary dark:text-content-muted text-sm"}," Updates every 5 seconds ")],-1)),t("div",wt,[A(P,{title:"CPU Usage",value:`${B.value.cpuUsage.toFixed(1)}%`,color:"#FFC246",data:E.value.cpu},null,8,["value","data"]),A(P,{title:"Memory Usage",value:`${B.value.memoryUsage.toFixed(1)}%`,color:"#A5E5B6",data:E.value.memory},null,8,["value","data"]),A(P,{title:"Disk Usage",value:`${B.value.diskUsage.toFixed(1)}%`,color:"#FB787B",data:E.value.disk},null,8,["value","data"]),A(P,{title:"Uptime",value:Z(B.value.uptime),color:"#EBA0FC",data:E.value.network},null,8,["value","data"])]),t("div",Ft,[t("div",St,[e[6]||(e[6]=t("h3",{class:"text-content-primary dark:text-content-primary text-xl font-semibold mb-4"},"CPU Performance",-1)),t("div",Ut,[t("canvas",{ref_key:"cpuCanvasRef",ref:T,class:"w-full h-full relative z-10"},null,512),p.value.cpuChart?(i(),d("div",Bt,e[0]||(e[0]=[t("div",{class:"text-center"},[t("div",{class:"animate-spin w-6 h-6 border-2 border-stroke-subtle dark:border-stroke/20 border-t-orange-400 rounded-full mx-auto mb-2"}),t("div",{class:"text-content-secondary dark:text-content-muted text-xs"},"Loading CPU data...")],-1)]))):v("",!0),D.value&&!p.value.cpuChart?(i(),d("div",Et,e[1]||(e[1]=[t("div",{class:"text-center"},[t("div",{class:"text-red-500 dark:text-red-400 text-sm mb-1"},"No Data Available"),t("div",{class:"text-content-secondary dark:text-content-muted text-xs"},"CPU data not found")],-1)]))):v("",!0)]),s.value?(i(),d("div",At,[t("div",null,[e[2]||(e[2]=t("div",{class:"text-content-secondary dark:text-content-muted"},"CPU Count",-1)),t("div",Pt,o(s.value.cpu.count)+" cores",1)]),t("div",null,[e[3]||(e[3]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Frequency",-1)),t("div",Lt,o(s.value.cpu.frequency.toFixed(0))+" MHz",1)]),t("div",null,[e[4]||(e[4]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Load (1m)",-1)),t("div",Mt,o(s.value.cpu.load_avg["1min"].toFixed(2)),1)]),t("div",null,[e[5]||(e[5]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Load (5m)",-1)),t("div",Dt,o(s.value.cpu.load_avg["5min"].toFixed(2)),1)])])):v("",!0)]),t("div",Rt,[e[13]||(e[13]=t("h3",{class:"text-content-primary dark:text-content-primary text-xl font-semibold mb-4"},"Memory Usage",-1)),t("div",Tt,[t("canvas",{ref_key:"memoryCanvasRef",ref:z,class:"w-full h-full relative z-10"},null,512),p.value.memoryChart?(i(),d("div",zt,e[7]||(e[7]=[t("div",{class:"text-center"},[t("div",{class:"animate-spin w-6 h-6 border-2 border-stroke-subtle dark:border-stroke/20 border-t-green-400 rounded-full mx-auto mb-2"}),t("div",{class:"text-content-secondary dark:text-content-muted text-xs"},"Loading memory data...")],-1)]))):v("",!0),R.value&&!p.value.memoryChart?(i(),d("div",$t,e[8]||(e[8]=[t("div",{class:"text-center"},[t("div",{class:"text-red-500 dark:text-red-400 text-sm mb-1"},"No Data Available"),t("div",{class:"text-content-secondary dark:text-content-muted text-xs"},"Memory data not found")],-1)]))):v("",!0)]),s.value?(i(),d("div",It,[t("div",null,[e[9]||(e[9]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Total",-1)),t("div",Nt,o(f(s.value.memory.total)),1)]),t("div",null,[e[10]||(e[10]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Used",-1)),t("div",Ot,o(f(s.value.memory.used)),1)]),t("div",null,[e[11]||(e[11]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Available",-1)),t("div",Vt,o(f(s.value.memory.available)),1)]),t("div",null,[e[12]||(e[12]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Usage",-1)),t("div",jt,o(s.value.memory.usage_percent.toFixed(1))+"%",1)])])):v("",!0)])]),t("div",Ht,[t("div",qt,[e[17]||(e[17]=t("h3",{class:"text-content-primary dark:text-content-primary text-xl font-semibold mb-4"},"Storage Usage",-1)),t("div",Jt,[t("div",{ref_key:"diskCanvasRef",ref:k,class:"w-full h-full"},null,512)]),s.value?(i(),d("div",Wt,[t("div",Xt,[e[14]||(e[14]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Total",-1)),t("div",Yt,o(f(s.value.disk.total)),1)]),t("div",Gt,[e[15]||(e[15]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Used",-1)),t("div",Kt,o(f(s.value.disk.used)),1)]),t("div",Qt,[e[16]||(e[16]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Free",-1)),t("div",Zt,o(f(s.value.disk.free)),1)])])):v("",!0)]),t("div",te,[e[23]||(e[23]=t("h3",{class:"text-content-primary dark:text-content-primary text-xl font-semibold mb-4"},"Network Statistics",-1)),s.value?(i(),d("div",ee,[t("div",ae,[t("div",null,[e[18]||(e[18]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Bytes Sent",-1)),t("div",se,o(f(s.value.network.bytes_sent)),1)]),t("div",null,[e[19]||(e[19]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Bytes Received",-1)),t("div",re,o(f(s.value.network.bytes_recv)),1)]),t("div",null,[e[20]||(e[20]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Packets Sent",-1)),t("div",oe,o(s.value.network.packets_sent.toLocaleString()),1)]),t("div",null,[e[21]||(e[21]=t("div",{class:"text-content-secondary dark:text-content-muted"},"Packets Received",-1)),t("div",ne,o(s.value.network.packets_recv.toLocaleString()),1)])]),s.value.temperatures&&Object.keys(s.value.temperatures).length>0?(i(),d("div",le,[e[22]||(e[22]=t("div",{class:"text-content-secondary dark:text-content-muted mb-2"},"System Temperatures",-1)),t("div",de,[(i(!0),d(Y,null,G(s.value.temperatures,(r,n)=>(i(),d("div",{key:n},[t("span",ie,o(n)+":",1),t("span",ce,o(r.toFixed(1))+"°C",1)]))),128))])])):v("",!0)])):v("",!0)])]),t("div",ue,[e[25]||(e[25]=t("h3",{class:"text-content-primary dark:text-content-primary text-xl font-semibold mb-4"},"Top Processes",-1)),b.value?.processes&&b.value.processes.length>0?(i(),d("div",me,[t("table",ve,[e[24]||(e[24]=t("thead",null,[t("tr",{class:"border-b border-stroke-subtle dark:border-stroke/10"},[t("th",{class:"text-left text-content-secondary dark:text-content-muted py-2"},"PID"),t("th",{class:"text-left text-content-secondary dark:text-content-muted py-2"},"Name"),t("th",{class:"text-center text-content-secondary dark:text-content-muted py-2"},"CPU %"),t("th",{class:"text-center text-content-secondary dark:text-content-muted py-2"},"Memory %"),t("th",{class:"text-right text-content-secondary dark:text-content-muted py-2"},"Memory")])],-1)),t("tbody",null,[(i(!0),d(Y,null,G(b.value.processes.slice(0,10),r=>(i(),d("tr",{key:r.pid,class:"border-b border-stroke-subtle dark:border-white/5 process-row"},[t("td",pe,o(r.pid),1),t("td",xe,o(r.name),1),t("td",ye,[t("span",{class:V(["cpu-value",{"value-updated":$(r,"cpu_percent")}])},o(r.cpu_percent.toFixed(1))+"% ",3)]),t("td",ge,[t("span",{class:V(["memory-value",{"value-updated":$(r,"memory_percent")}])},o(r.memory_percent.toFixed(1))+"% ",3)]),t("td",fe,[t("span",{class:V({"value-updated":$(r,"memory_mb")})},o(r.memory_mb.toFixed(1))+" MB ",3)])]))),128))])]),b.value.total_processes?(i(),d("div",be," Showing top 10 of "+o(b.value.total_processes)+" total processes ",1)):v("",!0)])):_.value?v("",!0):(i(),d("div",ke," No process data available "))]),_.value?(i(),d("div",he,e[26]||(e[26]=[t("div",{class:"text-content-secondary dark:text-content-muted mb-2"},"Loading system statistics...",-1),t("div",{class:"animate-spin w-8 h-8 border-2 border-stroke-subtle dark:border-stroke/20 border-t-gray-900 dark:border-t-white/70 rounded-full mx-auto"},null,-1)]))):v("",!0),C.value?(i(),d("div",_e,[e[27]||(e[27]=t("div",{class:"text-red-500 dark:text-red-400 mb-2"},"Failed to load system statistics",-1)),t("p",Ce,o(C.value),1),t("button",{onClick:I,class:"mt-4 px-4 py-2 bg-purple-500/20 dark:bg-accent-purple/20 hover:bg-purple-500/30 dark:hover:bg-accent-purple/30 text-content-primary dark:text-content-primary rounded-lg border border-purple-500/50 dark:border-accent-purple/50 transition-colors"}," Retry ")])):v("",!0)]))}}),Ee=dt(we,[["__scopeId","data-v-eab6d04d"]]);export{Ee as default};
diff --git a/repeater/web/html/assets/Terminal-CHr0ym4k.js b/repeater/web/html/assets/Terminal-CHr0ym4k.js
new file mode 100644
index 0000000..aa3078a
--- /dev/null
+++ b/repeater/web/html/assets/Terminal-CHr0ym4k.js
@@ -0,0 +1,184 @@
+import{L as J,a as zl,r as ut,o as Hl,a0 as Ul,P as Rn,D as ql,b as tt,e as Z,g as Yt,t as Is,w as Kl,v as Vl,X as Ji,j as Tn,s as jl,p as it,x as Gl}from"./index-D0IT5vDS.js";/**
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
+ * @license MIT
+ *
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
+ * @license MIT
+ *
+ * Originally forked from (with the author's permission):
+ * Fabrice Bellard's javascript vt100 for jslinux:
+ * http://bellard.org/jslinux/
+ * Copyright (c) 2011 Fabrice Bellard
+ */var oa=Object.defineProperty,Yl=Object.getOwnPropertyDescriptor,Xl=(t,e)=>{for(var i in e)oa(t,i,{get:e[i],enumerable:!0})},ue=(t,e,i,s)=>{for(var r=s>1?void 0:s?Yl(e,i):e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(r=(s?o(e,i,r):o(r))||r);return s&&r&&oa(e,i,r),r},P=(t,e)=>(i,s)=>e(i,s,t),Dn="Terminal input",pr={get:()=>Dn,set:t=>Dn=t},An="Too much output to announce, navigate to rows manually to read",vr={get:()=>An,set:t=>An=t};function Jl(t){return t.replace(/\r?\n/g,"\r")}function Zl(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function Ql(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function eh(t,e,i,s){if(t.stopPropagation(),t.clipboardData){let r=t.clipboardData.getData("text/plain");aa(r,e,i,s)}}function aa(t,e,i,s){t=Jl(t),t=Zl(t,i.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(t,!0),e.value=""}function la(t,e,i){let s=i.getBoundingClientRect(),r=t.clientX-s.left-10,n=t.clientY-s.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${r}px`,e.style.top=`${n}px`,e.style.zIndex="1000",e.focus()}function Pn(t,e,i,s,r){la(t,e,i),r&&s.rightClickSelect(t),e.value=s.selectionText,e.select()}function Kt(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function Ts(t,e=0,i=t.length){let s="";for(let r=e;r65535?(n-=65536,s+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):s+=String.fromCharCode(n)}return s}var th=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,i){let s=e.length;if(!s)return 0;let r=0,n=0;if(this._interim){let o=e.charCodeAt(n++);56320<=o&&o<=57343?i[r++]=(this._interim-55296)*1024+o-56320+65536:(i[r++]=this._interim,i[r++]=o),this._interim=0}for(let o=n;o=s)return this._interim=l,r;let h=e.charCodeAt(o);56320<=h&&h<=57343?i[r++]=(l-55296)*1024+h-56320+65536:(i[r++]=l,i[r++]=h);continue}l!==65279&&(i[r++]=l)}return r}},ih=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,i){let s=e.length;if(!s)return 0;let r=0,n,o,l,h,a=0,c=0;if(this.interim[0]){let d=!1,m=this.interim[0];m&=(m&224)===192?31:(m&240)===224?15:7;let y=0,k;for(;(k=this.interim[++y]&63)&&y<4;)m<<=6,m|=k;let R=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,D=R-y;for(;c=s)return 0;if(k=e[c++],(k&192)!==128){c--,d=!0;break}else this.interim[y++]=k,m<<=6,m|=k&63}d||(R===2?m<128?c--:i[r++]=m:R===3?m<2048||m>=55296&&m<=57343||m===65279||(i[r++]=m):m<65536||m>1114111||(i[r++]=m)),this.interim.fill(0)}let _=s-4,f=c;for(;f=s)return this.interim[0]=n,r;if(o=e[f++],(o&192)!==128){f--;continue}if(a=(n&31)<<6|o&63,a<128){f--;continue}i[r++]=a}else if((n&240)===224){if(f>=s)return this.interim[0]=n,r;if(o=e[f++],(o&192)!==128){f--;continue}if(f>=s)return this.interim[0]=n,this.interim[1]=o,r;if(l=e[f++],(l&192)!==128){f--;continue}if(a=(n&15)<<12|(o&63)<<6|l&63,a<2048||a>=55296&&a<=57343||a===65279)continue;i[r++]=a}else if((n&248)===240){if(f>=s)return this.interim[0]=n,r;if(o=e[f++],(o&192)!==128){f--;continue}if(f>=s)return this.interim[0]=n,this.interim[1]=o,r;if(l=e[f++],(l&192)!==128){f--;continue}if(f>=s)return this.interim[0]=n,this.interim[1]=o,this.interim[2]=l,r;if(h=e[f++],(h&192)!==128){f--;continue}if(a=(n&7)<<18|(o&63)<<12|(l&63)<<6|h&63,a<65536||a>1114111)continue;i[r++]=a}}return r}},ha="",Vt=" ",ji=class ca{constructor(){this.fg=0,this.bg=0,this.extended=new bs}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new ca;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},bs=class da{constructor(e=0,i=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new da(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ct=class ua extends ji{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new bs,this.combinedData=""}static fromCharData(e){let i=new ua;return i.setFromCharData(e),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Kt(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let i=!1;if(e[1].length>2)i=!0;else if(e[1].length===2){let s=e[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|e[2]<<22:i=!0}else i=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;i&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},$n="di$target",mr="di$dependencies",Os=new Map;function sh(t){return t[mr]||[]}function Ie(t){if(Os.has(t))return Os.get(t);let e=function(i,s,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");rh(e,i,r)};return e._id=t,Os.set(t,e),e}function rh(t,e,i){e[$n]===e?e[mr].push({id:t,index:i}):(e[mr]=[{id:t,index:i}],e[$n]=e)}var Ve=Ie("BufferService"),_a=Ie("CoreMouseService"),li=Ie("CoreService"),nh=Ie("CharsetService"),fn=Ie("InstantiationService"),fa=Ie("LogService"),je=Ie("OptionsService"),ga=Ie("OscLinkService"),oh=Ie("UnicodeService"),Gi=Ie("DecorationService"),wr=class{constructor(e,i,s){this._bufferService=e,this._optionsService=i,this._oscLinkService=s}provideLinks(e,i){let s=this._bufferService.buffer.lines.get(e-1);if(!s){i(void 0);return}let r=[],n=this._optionsService.rawOptions.linkHandler,o=new ct,l=s.getTrimmedLength(),h=-1,a=-1,c=!1;for(let _=0;_n?n.activate(y,k,d):ah(y,k),hover:(y,k)=>n?.hover?.(y,k,d),leave:(y,k)=>n?.leave?.(y,k,d)})}c=!1,o.hasExtendedAttrs()&&o.extended.urlId?(a=_,h=o.extended.urlId):(a=-1,h=-1)}}i(r)}};wr=ue([P(0,Ve),P(1,je),P(2,ga)],wr);function ah(t,e){if(confirm(`Do you want to navigate to ${e}?
+
+WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}var Ds=Ie("CharSizeService"),$t=Ie("CoreBrowserService"),gn=Ie("MouseService"),It=Ie("RenderService"),lh=Ie("SelectionService"),pa=Ie("CharacterJoinerService"),bi=Ie("ThemeService"),va=Ie("LinkProviderService"),hh=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?In.isErrorNoTelemetry(e)?new In(e.message+`
+
+`+e.stack):new Error(e.message+`
+
+`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(i=>{i(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},ch=new hh;function hs(t){dh(t)||ch.onUnexpectedError(t)}var Sr="Canceled";function dh(t){return t instanceof uh?!0:t instanceof Error&&t.name===Sr&&t.message===Sr}var uh=class extends Error{constructor(){super(Sr),this.name=this.message}};function _h(t){return new Error(`Illegal argument: ${t}`)}var In=class br extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof br)return e;let i=new br;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},yr=class ma extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,ma.prototype)}};function Xe(t,e=0){return t[t.length-(1+e)]}var fh;(t=>{function e(n){return n<0}t.isLessThan=e;function i(n){return n<=0}t.isLessThanOrEqual=i;function s(n){return n>0}t.isGreaterThan=s;function r(n){return n===0}t.isNeitherLessOrGreaterThan=r,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(fh||={});function gh(t,e){let i=this,s=!1,r;return function(){return s||(s=!0,e||(r=t.apply(i,arguments))),r}}var wa;(t=>{function e(S){return S&&typeof S=="object"&&typeof S[Symbol.iterator]=="function"}t.is=e;let i=Object.freeze([]);function s(){return i}t.empty=s;function*r(S){yield S}t.single=r;function n(S){return e(S)?S:r(S)}t.wrap=n;function o(S){return S||i}t.from=o;function*l(S){for(let L=S.length-1;L>=0;L--)yield S[L]}t.reverse=l;function h(S){return!S||S[Symbol.iterator]().next().done===!0}t.isEmpty=h;function a(S){return S[Symbol.iterator]().next().value}t.first=a;function c(S,L){let B=0;for(let $ of S)if(L($,B++))return!0;return!1}t.some=c;function _(S,L){for(let B of S)if(L(B))return B}t.find=_;function*f(S,L){for(let B of S)L(B)&&(yield B)}t.filter=f;function*d(S,L){let B=0;for(let $ of S)yield L($,B++)}t.map=d;function*m(S,L){let B=0;for(let $ of S)yield*L($,B++)}t.flatMap=m;function*y(...S){for(let L of S)yield*L}t.concat=y;function k(S,L,B){let $=B;for(let U of S)$=L($,U);return $}t.reduce=k;function*R(S,L,B=S.length){for(L<0&&(L+=S.length),B<0?B+=S.length:B>S.length&&(B=S.length);L1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function ph(...t){return re(()=>oi(t))}function re(t){return{dispose:gh(()=>{t()})}}var Sa=class ba{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{oi(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?ba.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};Sa.DISABLE_DISPOSED_WARNING=!1;var jt=Sa,j=class{constructor(){this._store=new jt,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};j.None=Object.freeze({dispose(){}});var Si=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},At=typeof window=="object"?window:globalThis,Cr=class xr{constructor(e){this.element=e,this.next=xr.Undefined,this.prev=xr.Undefined}};Cr.Undefined=new Cr(void 0);var oe=Cr,On=class{constructor(){this._first=oe.Undefined,this._last=oe.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===oe.Undefined}clear(){let e=this._first;for(;e!==oe.Undefined;){let i=e.next;e.prev=oe.Undefined,e.next=oe.Undefined,e=i}this._first=oe.Undefined,this._last=oe.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,i){let s=new oe(e);if(this._first===oe.Undefined)this._first=s,this._last=s;else if(i){let n=this._last;this._last=s,s.prev=n,n.next=s}else{let n=this._first;this._first=s,s.next=n,n.prev=s}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(s))}}shift(){if(this._first!==oe.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==oe.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==oe.Undefined&&e.next!==oe.Undefined){let i=e.prev;i.next=e.next,e.next.prev=i}else e.prev===oe.Undefined&&e.next===oe.Undefined?(this._first=oe.Undefined,this._last=oe.Undefined):e.next===oe.Undefined?(this._last=this._last.prev,this._last.next=oe.Undefined):e.prev===oe.Undefined&&(this._first=this._first.next,this._first.prev=oe.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==oe.Undefined;)yield e.element,e=e.next}},vh=globalThis.performance&&typeof globalThis.performance.now=="function",mh=class ya{static create(e){return new ya(e)}constructor(e){this._now=vh&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Fe;(t=>{t.None=()=>j.None;function e(v,u){return _(v,()=>{},0,void 0,!0,void 0,u)}t.defer=e;function i(v){return(u,p=null,g)=>{let w=!1,b;return b=v(C=>{if(!w)return b?b.dispose():w=!0,u.call(p,C)},null,g),w&&b.dispose(),b}}t.once=i;function s(v,u,p){return a((g,w=null,b)=>v(C=>g.call(w,u(C)),null,b),p)}t.map=s;function r(v,u,p){return a((g,w=null,b)=>v(C=>{u(C),g.call(w,C)},null,b),p)}t.forEach=r;function n(v,u,p){return a((g,w=null,b)=>v(C=>u(C)&&g.call(w,C),null,b),p)}t.filter=n;function o(v){return v}t.signal=o;function l(...v){return(u,p=null,g)=>{let w=ph(...v.map(b=>b(C=>u.call(p,C))));return c(w,g)}}t.any=l;function h(v,u,p,g){let w=p;return s(v,b=>(w=u(w,b),w),g)}t.reduce=h;function a(v,u){let p,g={onWillAddFirstListener(){p=v(w.fire,w)},onDidRemoveLastListener(){p?.dispose()}},w=new A(g);return u?.add(w),w.event}function c(v,u){return u instanceof Array?u.push(v):u&&u.add(v),v}function _(v,u,p=100,g=!1,w=!1,b,C){let x,M,F,K=0,z,pe={leakWarningThreshold:b,onWillAddFirstListener(){x=v(ne=>{K++,M=u(M,ne),g&&!F&&(q.fire(M),M=void 0),z=()=>{let O=M;M=void 0,F=void 0,(!g||K>1)&&q.fire(O),K=0},typeof p=="number"?(clearTimeout(F),F=setTimeout(z,p)):F===void 0&&(F=0,queueMicrotask(z))})},onWillRemoveListener(){w&&K>0&&z?.()},onDidRemoveLastListener(){z=void 0,x.dispose()}},q=new A(pe);return C?.add(q),q.event}t.debounce=_;function f(v,u=0,p){return t.debounce(v,(g,w)=>g?(g.push(w),g):[w],u,void 0,!0,void 0,p)}t.accumulate=f;function d(v,u=(g,w)=>g===w,p){let g=!0,w;return n(v,b=>{let C=g||!u(b,w);return g=!1,w=b,C},p)}t.latch=d;function m(v,u,p){return[t.filter(v,u,p),t.filter(v,g=>!u(g),p)]}t.split=m;function y(v,u=!1,p=[],g){let w=p.slice(),b=v(M=>{w?w.push(M):x.fire(M)});g&&g.add(b);let C=()=>{w?.forEach(M=>x.fire(M)),w=null},x=new A({onWillAddFirstListener(){b||(b=v(M=>x.fire(M)),g&&g.add(b))},onDidAddFirstListener(){w&&(u?setTimeout(C):C())},onDidRemoveLastListener(){b&&b.dispose(),b=null}});return g&&g.add(x),x.event}t.buffer=y;function k(v,u){return(p,g,w)=>{let b=u(new D);return v(function(C){let x=b.evaluate(C);x!==R&&p.call(g,x)},void 0,w)}}t.chain=k;let R=Symbol("HaltChainable");class D{constructor(){this.steps=[]}map(u){return this.steps.push(u),this}forEach(u){return this.steps.push(p=>(u(p),p)),this}filter(u){return this.steps.push(p=>u(p)?p:R),this}reduce(u,p){let g=p;return this.steps.push(w=>(g=u(g,w),g)),this}latch(u=(p,g)=>p===g){let p=!0,g;return this.steps.push(w=>{let b=p||!u(w,g);return p=!1,g=w,b?w:R}),this}evaluate(u){for(let p of this.steps)if(u=p(u),u===R)break;return u}}function T(v,u,p=g=>g){let g=(...x)=>C.fire(p(...x)),w=()=>v.on(u,g),b=()=>v.removeListener(u,g),C=new A({onWillAddFirstListener:w,onDidRemoveLastListener:b});return C.event}t.fromNodeEventEmitter=T;function S(v,u,p=g=>g){let g=(...x)=>C.fire(p(...x)),w=()=>v.addEventListener(u,g),b=()=>v.removeEventListener(u,g),C=new A({onWillAddFirstListener:w,onDidRemoveLastListener:b});return C.event}t.fromDOMEventEmitter=S;function L(v){return new Promise(u=>i(v)(u))}t.toPromise=L;function B(v){let u=new A;return v.then(p=>{u.fire(p)},()=>{u.fire(void 0)}).finally(()=>{u.dispose()}),u.event}t.fromPromise=B;function $(v,u){return v(p=>u.fire(p))}t.forward=$;function U(v,u,p){return u(p),v(g=>u(g))}t.runAndSubscribe=U;class Y{constructor(u,p){this._observable=u,this._counter=0,this._hasChanged=!1;let g={onWillAddFirstListener:()=>{u.addObserver(this)},onDidRemoveLastListener:()=>{u.removeObserver(this)}};this.emitter=new A(g),p&&p.add(this.emitter)}beginUpdate(u){this._counter++}handlePossibleChange(u){}handleChange(u,p){this._hasChanged=!0}endUpdate(u){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function le(v,u){return new Y(v,u).emitter.event}t.fromObservable=le;function W(v){return(u,p,g)=>{let w=0,b=!1,C={beginUpdate(){w++},endUpdate(){w--,w===0&&(v.reportChanges(),b&&(b=!1,u.call(p)))},handlePossibleChange(){},handleChange(){b=!0}};v.addObserver(C),v.reportChanges();let x={dispose(){v.removeObserver(C)}};return g instanceof jt?g.add(x):Array.isArray(g)&&g.push(x),x}}t.fromObservableLight=W})(Fe||={});var kr=class Lr{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${Lr._idPool++}`,Lr.all.add(this)}start(e){this._stopWatch=new mh,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};kr.all=new Set,kr._idPool=0;var wh=kr,Sh=-1,Ca=class xa{constructor(e,i,s=(xa._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,i){let s=this.threshold;if(s<=0||i{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[s,r]of this._stacks)(!e||i{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let l=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(l);let h=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],a=new xh(`${l}. HINT: Stack shows most frequent listener (${h[1]}-times)`,h[0]);return(this._options?.onListenerError||hs)(a),j.None}if(this._disposed)return j.None;i&&(e=e.bind(i));let r=new Fs(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=yh.create(),n=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Fs?(this._deliveryQueue??=new Eh,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let o=re(()=>{n?.(),this._removeListener(r)});return s instanceof jt?s.add(o):Array.isArray(s)&&s.push(o),o},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let i=this._listeners,s=i.indexOf(e);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,i[s]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Lh<=i.length){let n=0;for(let o=0;o0}},Eh=class{constructor(){this.i=-1,this.end=0}enqueue(e,i,s){this.i=0,this.end=s,this.current=e,this.value=i}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Br=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new A,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new A,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,i){if(this.getZoomLevel(i)===e)return;let s=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(s,e),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),e)}setFullscreen(e,i){if(this.isFullscreen(i)===e)return;let s=this.getWindowId(i);this.mapWindowIdToFullScreen.set(s,e),this._onDidChangeFullscreen.fire(s)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Br.INSTANCE=new Br;var pn=Br;function Mh(t,e,i){typeof e=="string"&&(e=t.matchMedia(e)),e.addEventListener("change",i)}pn.INSTANCE.onDidChangeZoomLevel;function Rh(t){return pn.INSTANCE.getZoomFactor(t)}pn.INSTANCE.onDidChangeFullscreen;var yi=typeof navigator=="object"?navigator.userAgent:"",Er=yi.indexOf("Firefox")>=0,Th=yi.indexOf("AppleWebKit")>=0,vn=yi.indexOf("Chrome")>=0,Dh=!vn&&yi.indexOf("Safari")>=0;yi.indexOf("Electron/")>=0;yi.indexOf("Android")>=0;var Ns=!1;if(typeof At.matchMedia=="function"){let t=At.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=At.matchMedia("(display-mode: fullscreen)");Ns=t.matches,Mh(At,t,({matches:i})=>{Ns&&e.matches||(Ns=i)})}var gi="en",Mr=!1,Rr=!1,cs=!1,La=!1,Zi,ds=gi,Fn=gi,Ah,Mt,ii=globalThis,Ze;typeof ii.vscode<"u"&&typeof ii.vscode.process<"u"?Ze=ii.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Ze=process);var Ph=typeof Ze?.versions?.electron=="string",$h=Ph&&Ze?.type==="renderer";if(typeof Ze=="object"){Mr=Ze.platform==="win32",Rr=Ze.platform==="darwin",cs=Ze.platform==="linux",cs&&Ze.env.SNAP&&Ze.env.SNAP_REVISION,Ze.env.CI||Ze.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Zi=gi,ds=gi;let t=Ze.env.VSCODE_NLS_CONFIG;if(t)try{let e=JSON.parse(t);Zi=e.userLocale,Fn=e.osLocale,ds=e.resolvedLanguage||gi,Ah=e.languagePack?.translationsConfigFile}catch{}La=!0}else typeof navigator=="object"&&!$h?(Mt=navigator.userAgent,Mr=Mt.indexOf("Windows")>=0,Rr=Mt.indexOf("Macintosh")>=0,(Mt.indexOf("Macintosh")>=0||Mt.indexOf("iPad")>=0||Mt.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,cs=Mt.indexOf("Linux")>=0,Mt?.indexOf("Mobi")>=0,ds=globalThis._VSCODE_NLS_LANGUAGE||gi,Zi=navigator.language.toLowerCase(),Fn=Zi):console.error("Unable to resolve platform.");var Ba=Mr,wt=Rr,Ih=cs,Nn=La,St=Mt,Ot=ds,Oh;(t=>{function e(){return Ot}t.value=e;function i(){return Ot.length===2?Ot==="en":Ot.length>=3?Ot[0]==="e"&&Ot[1]==="n"&&Ot[2]==="-":!1}t.isDefaultVariant=i;function s(){return Ot==="en"}t.isDefault=s})(Oh||={});var Fh=typeof ii.postMessage=="function"&&!ii.importScripts;(()=>{if(Fh){let t=[];ii.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=t.length;s{let s=++e;t.push({id:s,callback:i}),ii.postMessage({vscodeScheduleAsyncWork:s},"*")}}return t=>setTimeout(t)})();var Nh=!!(St&&St.indexOf("Chrome")>=0);St&&St.indexOf("Firefox")>=0;!Nh&&St&&St.indexOf("Safari")>=0;St&&St.indexOf("Edg/")>=0;St&&St.indexOf("Android")>=0;var ci=typeof navigator=="object"?navigator:{};Nn||document.queryCommandSupported&&document.queryCommandSupported("copy")||ci&&ci.clipboard&&ci.clipboard.writeText,Nn||ci&&ci.clipboard&&ci.clipboard.readText;var mn=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,i){this._keyCodeToStr[e]=i,this._strToKeyCode[i.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Ws=new mn,Wn=new mn,zn=new mn,Wh=new Array(230),Ea;(t=>{function e(l){return Ws.keyCodeToStr(l)}t.toString=e;function i(l){return Ws.strToKeyCode(l)}t.fromString=i;function s(l){return Wn.keyCodeToStr(l)}t.toUserSettingsUS=s;function r(l){return zn.keyCodeToStr(l)}t.toUserSettingsGeneral=r;function n(l){return Wn.strToKeyCode(l)||zn.strToKeyCode(l)}t.fromUserSettings=n;function o(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Ws.keyCodeToStr(l)}t.toElectronAccelerator=o})(Ea||={});var zh=class Ma{constructor(e,i,s,r,n){this.ctrlKey=e,this.shiftKey=i,this.altKey=s,this.metaKey=r,this.keyCode=n}equals(e){return e instanceof Ma&&this.ctrlKey===e.ctrlKey&&this.shiftKey===e.shiftKey&&this.altKey===e.altKey&&this.metaKey===e.metaKey&&this.keyCode===e.keyCode}getHashCode(){let e=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",s=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${e}${i}${s}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new Hh([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},Hh=class{constructor(t){if(t.length===0)throw _h("chords");this.chords=t}getHashCode(){let t="";for(let e=0,i=this.chords.length;e{function e(i){return i===t.None||i===t.Cancelled||i instanceof Jh?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Fe.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Ra})})(Xh||={});var Jh=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Ra:(this._emitter||(this._emitter=new A),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},wn=class{constructor(e,i){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof i=="number"&&this.setIfNotSet(e,i)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,i){if(this._isDisposed)throw new yr("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},i)}setIfNotSet(e,i){if(this._isDisposed)throw new yr("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},i))}},Zh=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,i,s=globalThis){if(this.isDisposed)throw new yr("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=s.setInterval(()=>{e()},i);this.disposable=re(()=>{s.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},Qh;(t=>{async function e(s){let r,n=await Promise.all(s.map(o=>o.then(l=>l,l=>{r||(r=l)})));if(typeof r<"u")throw r;return n}t.settled=e;function i(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}t.withAsyncBody=i})(Qh||={});var Kn=class rt{static fromArray(e){return new rt(i=>{i.emitMany(e)})}static fromPromise(e){return new rt(async i=>{i.emitMany(await e)})}static fromPromises(e){return new rt(async i=>{await Promise.all(e.map(async s=>i.emitOne(await s)))})}static merge(e){return new rt(async i=>{await Promise.all(e.map(async s=>{for await(let r of s)i.emitOne(r)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new A,queueMicrotask(async()=>{let s={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(e(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e(this._onReturn?.(),{done:!0,value:void 0})}}static map(e,i){return new rt(async s=>{for await(let r of e)s.emitOne(i(r))})}map(e){return rt.map(this,e)}static filter(e,i){return new rt(async s=>{for await(let r of e)i(r)&&s.emitOne(r)})}filter(e){return rt.filter(this,e)}static coalesce(e){return rt.filter(e,i=>!!i)}coalesce(){return rt.coalesce(this)}static async toPromise(e){let i=[];for await(let s of e)i.push(s);return i}toPromise(){return rt.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Kn.EMPTY=Kn.fromArray([]);var{getWindow:mt,getWindowId:ec,onDidRegisterWindow:tc}=function(){let t=new Map,e={window:At,disposables:new jt};t.set(At.vscodeWindowId,e);let i=new A,s=new A,r=new A;function n(o,l){return(typeof o=="number"?t.get(o):void 0)??(l?e:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(o){if(t.has(o.vscodeWindowId))return j.None;let l=new jt,h={window:o,disposables:l.add(new jt)};return t.set(o.vscodeWindowId,h),l.add(re(()=>{t.delete(o.vscodeWindowId),s.fire(o)})),l.add(H(o,Me.BEFORE_UNLOAD,()=>{r.fire(o)})),i.fire(h),l},getWindows(){return t.values()},getWindowsCount(){return t.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return t.has(o)},getWindowById:n,getWindow(o){let l=o;if(l?.ownerDocument?.defaultView)return l.ownerDocument.defaultView.window;let h=o;return h?.view?h.view.window:At},getDocument(o){return mt(o).document}}}(),ic=class{constructor(e,i,s,r){this._node=e,this._type=i,this._handler=s,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function H(t,e,i,s){return new ic(t,e,i,s)}var Vn=function(t,e,i,s){return H(t,e,i,s)},Sn,sc=class extends Zh{constructor(t){super(),this.defaultTarget=t&&mt(t)}cancelAndSet(t,e,i){return super.cancelAndSet(t,e,i??this.defaultTarget)}},jn=class{constructor(e,i=0){this._runner=e,this.priority=i,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){hs(e)}}static sort(e,i){return i.priority-e.priority}};(function(){let t=new Map,e=new Map,i=new Map,s=new Map,r=n=>{i.set(n,!1);let o=t.get(n)??[];for(e.set(n,o),t.set(n,[]),s.set(n,!0);o.length>0;)o.sort(jn.sort),o.shift().execute();s.set(n,!1)};Sn=(n,o,l=0)=>{let h=ec(n),a=new jn(o,l),c=t.get(h);return c||(c=[],t.set(h,c)),c.push(a),i.get(h)||(i.set(h,!0),n.requestAnimationFrame(()=>r(h))),a}})();function rc(t){let e=t.getBoundingClientRect(),i=mt(t);return{left:e.left+i.scrollX,top:e.top+i.scrollY,width:e.width,height:e.height}}var Me={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},nc=class{constructor(t){this.domNode=t,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(t){let e=Ge(t);this._maxWidth!==e&&(this._maxWidth=e,this.domNode.style.maxWidth=this._maxWidth)}setWidth(t){let e=Ge(t);this._width!==e&&(this._width=e,this.domNode.style.width=this._width)}setHeight(t){let e=Ge(t);this._height!==e&&(this._height=e,this.domNode.style.height=this._height)}setTop(t){let e=Ge(t);this._top!==e&&(this._top=e,this.domNode.style.top=this._top)}setLeft(t){let e=Ge(t);this._left!==e&&(this._left=e,this.domNode.style.left=this._left)}setBottom(t){let e=Ge(t);this._bottom!==e&&(this._bottom=e,this.domNode.style.bottom=this._bottom)}setRight(t){let e=Ge(t);this._right!==e&&(this._right=e,this.domNode.style.right=this._right)}setPaddingTop(t){let e=Ge(t);this._paddingTop!==e&&(this._paddingTop=e,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(t){let e=Ge(t);this._paddingLeft!==e&&(this._paddingLeft=e,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(t){let e=Ge(t);this._paddingBottom!==e&&(this._paddingBottom=e,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(t){let e=Ge(t);this._paddingRight!==e&&(this._paddingRight=e,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(t){let e=Ge(t);this._fontSize!==e&&(this._fontSize=e,this.domNode.style.fontSize=this._fontSize)}setFontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(t){this._fontFeatureSettings!==t&&(this._fontFeatureSettings=t,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(t){this._fontVariationSettings!==t&&(this._fontVariationSettings=t,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(t){this._textDecoration!==t&&(this._textDecoration=t,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(t){let e=Ge(t);this._lineHeight!==e&&(this._lineHeight=e,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(t){let e=Ge(t);this._letterSpacing!==e&&(this._letterSpacing=e,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(t){this._className!==t&&(this._className=t,this.domNode.className=this._className)}toggleClassName(t,e){this.domNode.classList.toggle(t,e),this._className=this.domNode.className}setDisplay(t){this._display!==t&&(this._display=t,this.domNode.style.display=this._display)}setPosition(t){this._position!==t&&(this._position=t,this.domNode.style.position=this._position)}setVisibility(t){this._visibility!==t&&(this._visibility=t,this.domNode.style.visibility=this._visibility)}setColor(t){this._color!==t&&(this._color=t,this.domNode.style.color=this._color)}setBackgroundColor(t){this._backgroundColor!==t&&(this._backgroundColor=t,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(t){this._layerHint!==t&&(this._layerHint=t,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(t){this._boxShadow!==t&&(this._boxShadow=t,this.domNode.style.boxShadow=t)}setContain(t){this._contain!==t&&(this._contain=t,this.domNode.style.contain=this._contain)}setAttribute(t,e){this.domNode.setAttribute(t,e)}removeAttribute(t){this.domNode.removeAttribute(t)}appendChild(t){this.domNode.appendChild(t.domNode)}removeChild(t){this.domNode.removeChild(t.domNode)}};function Ge(t){return typeof t=="number"?`${t}px`:t}function zi(t){return new nc(t)}var Ta=class{constructor(){this._hooks=new jt,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,i){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let s=this._onStopCallback;this._onStopCallback=null,e&&s&&s(i)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,i,s,r,n){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=n;let o=e;try{e.setPointerCapture(i),this._hooks.add(re(()=>{try{e.releasePointerCapture(i)}catch{}}))}catch{o=mt(e)}this._hooks.add(H(o,Me.POINTER_MOVE,l=>{if(l.buttons!==s){this.stopMonitoring(!0);return}l.preventDefault(),this._pointerMoveCallback(l)})),this._hooks.add(H(o,Me.POINTER_UP,l=>this.stopMonitoring(!0)))}};function oc(t,e,i){let s=null,r=null;if(typeof i.value=="function"?(s="value",r=i.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(s="get",r=i.get),!r)throw new Error("not supported");let n=`$memoize$${e}`;i[s]=function(...o){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,o)}),this[n]}}var pt;(t=>(t.Tap="-xterm-gesturetap",t.Change="-xterm-gesturechange",t.Start="-xterm-gesturestart",t.End="-xterm-gesturesend",t.Contextmenu="-xterm-gesturecontextmenu"))(pt||={});var $i=class Ne extends j{constructor(){super(),this.dispatched=!1,this.targets=new On,this.ignoreTargets=new On,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Fe.runAndSubscribe(tc,({window:e,disposables:i})=>{i.add(H(e.document,"touchstart",s=>this.onTouchStart(s),{passive:!1})),i.add(H(e.document,"touchend",s=>this.onTouchEnd(e,s))),i.add(H(e.document,"touchmove",s=>this.onTouchMove(s),{passive:!1}))},{window:At,disposables:this._store}))}static addTarget(e){if(!Ne.isTouchDevice())return j.None;Ne.INSTANCE||(Ne.INSTANCE=new Ne);let i=Ne.INSTANCE.targets.push(e);return re(i)}static ignoreTarget(e){if(!Ne.isTouchDevice())return j.None;Ne.INSTANCE||(Ne.INSTANCE=new Ne);let i=Ne.INSTANCE.ignoreTargets.push(e);return re(i)}static isTouchDevice(){return"ontouchstart"in At||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let s=0,r=e.targetTouches.length;s=Ne.HOLD_DELAY&&Math.abs(h.initialPageX-Xe(h.rollingPageX))<30&&Math.abs(h.initialPageY-Xe(h.rollingPageY))<30){let c=this.newGestureEvent(pt.Contextmenu,h.initialTarget);c.pageX=Xe(h.rollingPageX),c.pageY=Xe(h.rollingPageY),this.dispatchEvent(c)}else if(r===1){let c=Xe(h.rollingPageX),_=Xe(h.rollingPageY),f=Xe(h.rollingTimestamps)-h.rollingTimestamps[0],d=c-h.rollingPageX[0],m=_-h.rollingPageY[0],y=[...this.targets].filter(k=>h.initialTarget instanceof Node&&k.contains(h.initialTarget));this.inertia(e,y,s,Math.abs(d)/f,d>0?1:-1,c,Math.abs(m)/f,m>0?1:-1,_)}this.dispatchEvent(this.newGestureEvent(pt.End,h.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,i){let s=document.createEvent("CustomEvent");return s.initEvent(e,!1,!0),s.initialTarget=i,s.tapCount=0,s}dispatchEvent(e){if(e.type===pt.Tap){let i=new Date().getTime(),s=0;i-this._lastSetTapCountTime>Ne.CLEAR_TAP_COUNT_TIME?s=1:s=2,this._lastSetTapCountTime=i,e.tapCount=s}else(e.type===pt.Change||e.type===pt.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(let s of this.ignoreTargets)if(s.contains(e.initialTarget))return;let i=[];for(let s of this.targets)if(s.contains(e.initialTarget)){let r=0,n=e.initialTarget;for(;n&&n!==s;)r++,n=n.parentElement;i.push([r,s])}i.sort((s,r)=>s[0]-r[0]);for(let[s,r]of i)r.dispatchEvent(e),this.dispatched=!0}}inertia(e,i,s,r,n,o,l,h,a){this.handle=Sn(e,()=>{let c=Date.now(),_=c-s,f=0,d=0,m=!0;r+=Ne.SCROLL_FRICTION*_,l+=Ne.SCROLL_FRICTION*_,r>0&&(m=!1,f=n*r*_),l>0&&(m=!1,d=h*l*_);let y=this.newGestureEvent(pt.Change);y.translationX=f,y.translationY=d,i.forEach(k=>k.dispatchEvent(y)),m||this.inertia(e,i,c,r,n,o+f,l,h,a+d)})}onTouchMove(e){let i=Date.now();for(let s=0,r=e.changedTouches.length;s3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(n.pageX),o.rollingPageY.push(n.pageY),o.rollingTimestamps.push(i)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};$i.SCROLL_FRICTION=-.005,$i.HOLD_DELAY=700,$i.CLEAR_TAP_COUNT_TIME=400,ue([oc],$i,"isTouchDevice",1);var ac=$i,bn=class extends j{onclick(e,i){this._register(H(e,Me.CLICK,s=>i(new Qi(mt(e),s))))}onmousedown(e,i){this._register(H(e,Me.MOUSE_DOWN,s=>i(new Qi(mt(e),s))))}onmouseover(e,i){this._register(H(e,Me.MOUSE_OVER,s=>i(new Qi(mt(e),s))))}onmouseleave(e,i){this._register(H(e,Me.MOUSE_LEAVE,s=>i(new Qi(mt(e),s))))}onkeydown(e,i){this._register(H(e,Me.KEY_DOWN,s=>i(new Hn(s))))}onkeyup(e,i){this._register(H(e,Me.KEY_UP,s=>i(new Hn(s))))}oninput(e,i){this._register(H(e,Me.INPUT,i))}onblur(e,i){this._register(H(e,Me.BLUR,i))}onfocus(e,i){this._register(H(e,Me.FOCUS,i))}onchange(e,i){this._register(H(e,Me.CHANGE,i))}ignoreGesture(e){return ac.ignoreTarget(e)}},Gn=11,lc=class extends bn{constructor(t){super(),this._onActivate=t.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=t.bgWidth+"px",this.bgDomNode.style.height=t.bgHeight+"px",typeof t.top<"u"&&(this.bgDomNode.style.top="0px"),typeof t.left<"u"&&(this.bgDomNode.style.left="0px"),typeof t.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof t.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=t.className,this.domNode.style.position="absolute",this.domNode.style.width=Gn+"px",this.domNode.style.height=Gn+"px",typeof t.top<"u"&&(this.domNode.style.top=t.top+"px"),typeof t.left<"u"&&(this.domNode.style.left=t.left+"px"),typeof t.bottom<"u"&&(this.domNode.style.bottom=t.bottom+"px"),typeof t.right<"u"&&(this.domNode.style.right=t.right+"px"),this._pointerMoveMonitor=this._register(new Ta),this._register(Vn(this.bgDomNode,Me.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(Vn(this.domNode,Me.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new sc),this._pointerdownScheduleRepeatTimer=this._register(new wn)}_arrowPointerDown(t){if(!t.target||!(t.target instanceof Element))return;let e=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,mt(t))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(e,200),this._pointerMoveMonitor.startMonitoring(t.target,t.pointerId,t.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),t.preventDefault()}},hc=class Tr{constructor(e,i,s,r,n,o,l){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,s=s|0,r=r|0,n=n|0,o=o|0,l=l|0),this.rawScrollLeft=r,this.rawScrollTop=l,i<0&&(i=0),r+i>s&&(r=s-i),r<0&&(r=0),n<0&&(n=0),l+n>o&&(l=o-n),l<0&&(l=0),this.width=i,this.scrollWidth=s,this.scrollLeft=r,this.height=n,this.scrollHeight=o,this.scrollTop=l}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(e,i){return new Tr(this._forceIntegerValues,typeof e.width<"u"?e.width:this.width,typeof e.scrollWidth<"u"?e.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof e.height<"u"?e.height:this.height,typeof e.scrollHeight<"u"?e.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(e){return new Tr(this._forceIntegerValues,this.width,this.scrollWidth,typeof e.scrollLeft<"u"?e.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof e.scrollTop<"u"?e.scrollTop:this.rawScrollTop)}createScrollEvent(e,i){let s=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,n=this.scrollLeft!==e.scrollLeft,o=this.height!==e.height,l=this.scrollHeight!==e.scrollHeight,h=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:i,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:s,scrollWidthChanged:r,scrollLeftChanged:n,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:h}}},cc=class extends j{constructor(t){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new A),this.onScroll=this._onScroll.event,this._smoothScrollDuration=t.smoothScrollDuration,this._scheduleAtNextAnimationFrame=t.scheduleAtNextAnimationFrame,this._state=new hc(t.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(t){this._smoothScrollDuration=t}validateScrollPosition(t){return this._state.withScrollPosition(t)}getScrollDimensions(){return this._state}setScrollDimensions(t,e){let i=this._state.withScrollDimensions(t,e);this._setState(i,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(t){let e=this._state.withScrollPosition(t);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(e,!1)}setScrollPositionSmooth(t,e){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(t);if(this._smoothScrolling){t={scrollLeft:typeof t.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:t.scrollLeft,scrollTop:typeof t.scrollTop>"u"?this._smoothScrolling.to.scrollTop:t.scrollTop};let i=this._state.withScrollPosition(t);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let s;e?s=new Xn(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):s=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{let i=this._state.withScrollPosition(t);this._smoothScrolling=Xn.start(this._state,i,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let t=this._smoothScrolling.tick(),e=this._state.withScrollPosition(t);if(this._setState(e,!0),!!this._smoothScrolling){if(t.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(t,e){let i=this._state;i.equals(t)||(this._state=t,this._onScroll.fire(this._state.createScrollEvent(i,e)))}},Yn=class{constructor(e,i,s){this.scrollLeft=e,this.scrollTop=i,this.isDone=s}};function zs(t,e){let i=e-t;return function(s){return t+i*_c(s)}}function dc(t,e,i){return function(s){return s2.5*s){let r,n;return e{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},gc=140,Da=class extends bn{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new fc(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Ta),this._shouldRender=!0,this.domNode=zi(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(H(this.domNode.domNode,Me.POINTER_DOWN,i=>this._domNodePointerDown(i)))}_createArrow(e){let i=this._register(new lc(e));this.domNode.domNode.appendChild(i.bgDomNode),this.domNode.domNode.appendChild(i.domNode)}_createSlider(e,i,s,r){this.slider=zi(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(i),typeof s=="number"&&this.slider.setWidth(s),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(H(this.slider.domNode,Me.POINTER_DOWN,n=>{n.button===0&&(n.preventDefault(),this._sliderPointerDown(n))})),this.onclick(this.slider.domNode,n=>{n.leftButton&&n.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let i=this.domNode.domNode.getClientRects()[0].top,s=i+this._scrollbarState.getSliderPosition(),r=i+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),n=this._sliderPointerPosition(e);s<=n&&n<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let i,s;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")i=e.offsetX,s=e.offsetY;else{let n=rc(this.domNode.domNode);i=e.pageX-n.left,s=e.pageY-n.top}let r=this._pointerDownRelativePosition(i,s);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let i=this._sliderPointerPosition(e),s=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{let o=this._sliderOrthogonalPointerPosition(n),l=Math.abs(o-s);if(Ba&&l>gc){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let h=this._sliderPointerPosition(n)-i;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(h))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let i={};this.writeScrollPosition(i,e),this._scrollable.setScrollPositionNow(i)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},Aa=class Ar{constructor(e,i,s,r,n,o){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(s),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=n,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Ar(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let i=Math.round(e);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(e){let i=Math.round(e);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(e){let i=Math.round(e);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,i,s,r,n){let o=Math.max(0,s-e),l=Math.max(0,o-2*i),h=r>0&&r>s;if(!h)return{computedAvailableSize:Math.round(o),computedIsNeeded:h,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let a=Math.round(Math.max(20,Math.floor(s*l/r))),c=(l-a)/(r-s),_=n*c;return{computedAvailableSize:Math.round(o),computedIsNeeded:h,computedSliderSize:Math.round(a),computedSliderRatio:c,computedSliderPosition:Math.round(_)}}_refreshComputedValues(){let e=Ar._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=e.computedAvailableSize,this._computedIsNeeded=e.computedIsNeeded,this._computedSliderSize=e.computedSliderSize,this._computedSliderRatio=e.computedSliderRatio,this._computedSliderPosition=e.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let i=e-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let i=e-this._arrowSize,s=this._scrollPosition;return i0&&Math.abs(e.deltaY)>0)return 1;let s=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(s+=.25),i){let r=Math.abs(e.deltaX),n=Math.abs(e.deltaY),o=Math.abs(i.deltaX),l=Math.abs(i.deltaY),h=Math.max(Math.min(r,o),1),a=Math.max(Math.min(n,l),1),c=Math.max(r,o),_=Math.max(n,l);c%h===0&&_%a===0&&(s-=.5)}return Math.min(Math.max(s,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};Pr.INSTANCE=new Pr;var Sc=Pr,bc=class extends bn{constructor(t,e,i){super(),this._onScroll=this._register(new A),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new A),this.onWillScroll=this._onWillScroll.event,this._options=Cc(e),this._scrollable=i,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let s={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new vc(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new pc(this._scrollable,this._options,s)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(t),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=zi(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=zi(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=zi(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,r=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,r=>this._onMouseLeave(r)),this._hideTimeout=this._register(new wn),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=oi(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(t){this._verticalScrollbar.delegatePointerDown(t)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(t){this._scrollable.setScrollDimensions(t,!1)}updateClassName(t){this._options.className=t,wt&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(t){typeof t.handleMouseWheel<"u"&&(this._options.handleMouseWheel=t.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof t.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=t.mouseWheelScrollSensitivity),typeof t.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=t.fastScrollSensitivity),typeof t.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=t.scrollPredominantAxis),typeof t.horizontal<"u"&&(this._options.horizontal=t.horizontal),typeof t.vertical<"u"&&(this._options.vertical=t.vertical),typeof t.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=t.horizontalScrollbarSize),typeof t.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=t.verticalScrollbarSize),typeof t.scrollByPage<"u"&&(this._options.scrollByPage=t.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(t){this._revealOnScroll=t}delegateScrollFromMouseWheelEvent(t){this._onMouseWheel(new qn(t))}_setListeningToMouseWheel(t){if(this._mouseWheelToDispose.length>0!==t&&(this._mouseWheelToDispose=oi(this._mouseWheelToDispose),t)){let e=i=>{this._onMouseWheel(new qn(i))};this._mouseWheelToDispose.push(H(this._listenOnDomNode,Me.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(t){if(t.browserEvent?.defaultPrevented)return;let e=Sc.INSTANCE;e.acceptStandardWheelEvent(t);let i=!1;if(t.deltaY||t.deltaX){let r=t.deltaY*this._options.mouseWheelScrollSensitivity,n=t.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&n+r===0?n=r=0:Math.abs(r)>=Math.abs(n)?n=0:r=0),this._options.flipAxes&&([r,n]=[n,r]);let o=!wt&&t.browserEvent&&t.browserEvent.shiftKey;(this._options.scrollYToX||o)&&!n&&(n=r,r=0),t.browserEvent&&t.browserEvent.altKey&&(n=n*this._options.fastScrollSensitivity,r=r*this._options.fastScrollSensitivity);let l=this._scrollable.getFutureScrollPosition(),h={};if(r){let a=Jn*r,c=l.scrollTop-(a<0?Math.floor(a):Math.ceil(a));this._verticalScrollbar.writeScrollPosition(h,c)}if(n){let a=Jn*n,c=l.scrollLeft-(a<0?Math.floor(a):Math.ceil(a));this._horizontalScrollbar.writeScrollPosition(h,c)}h=this._scrollable.validateScrollPosition(h),(l.scrollLeft!==h.scrollLeft||l.scrollTop!==h.scrollTop)&&(this._options.mouseWheelSmoothScroll&&e.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(h):this._scrollable.setScrollPositionNow(h),i=!0)}let s=i;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(t.preventDefault(),t.stopPropagation())}_onDidScroll(t){this._shouldRender=this._horizontalScrollbar.onDidScroll(t)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(t)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let t=this._scrollable.getCurrentScrollPosition(),e=t.scrollTop>0,i=t.scrollLeft>0,s=i?" left":"",r=e?" top":"",n=i||e?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${n}${r}${s}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(t){this._mouseIsOver=!1,this._hide()}_onMouseOver(t){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),mc)}},yc=class extends bc{constructor(e,i,s){super(e,i,s)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Cc(t){let e={lazyRender:typeof t.lazyRender<"u"?t.lazyRender:!1,className:typeof t.className<"u"?t.className:"",useShadows:typeof t.useShadows<"u"?t.useShadows:!0,handleMouseWheel:typeof t.handleMouseWheel<"u"?t.handleMouseWheel:!0,flipAxes:typeof t.flipAxes<"u"?t.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof t.consumeMouseWheelIfScrollbarIsNeeded<"u"?t.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof t.alwaysConsumeMouseWheel<"u"?t.alwaysConsumeMouseWheel:!1,scrollYToX:typeof t.scrollYToX<"u"?t.scrollYToX:!1,mouseWheelScrollSensitivity:typeof t.mouseWheelScrollSensitivity<"u"?t.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof t.fastScrollSensitivity<"u"?t.fastScrollSensitivity:5,scrollPredominantAxis:typeof t.scrollPredominantAxis<"u"?t.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof t.mouseWheelSmoothScroll<"u"?t.mouseWheelSmoothScroll:!0,arrowSize:typeof t.arrowSize<"u"?t.arrowSize:11,listenOnDomNode:typeof t.listenOnDomNode<"u"?t.listenOnDomNode:null,horizontal:typeof t.horizontal<"u"?t.horizontal:1,horizontalScrollbarSize:typeof t.horizontalScrollbarSize<"u"?t.horizontalScrollbarSize:10,horizontalSliderSize:typeof t.horizontalSliderSize<"u"?t.horizontalSliderSize:0,horizontalHasArrows:typeof t.horizontalHasArrows<"u"?t.horizontalHasArrows:!1,vertical:typeof t.vertical<"u"?t.vertical:1,verticalScrollbarSize:typeof t.verticalScrollbarSize<"u"?t.verticalScrollbarSize:10,verticalHasArrows:typeof t.verticalHasArrows<"u"?t.verticalHasArrows:!1,verticalSliderSize:typeof t.verticalSliderSize<"u"?t.verticalSliderSize:0,scrollByPage:typeof t.scrollByPage<"u"?t.scrollByPage:!1};return e.horizontalSliderSize=typeof t.horizontalSliderSize<"u"?t.horizontalSliderSize:e.horizontalScrollbarSize,e.verticalSliderSize=typeof t.verticalSliderSize<"u"?t.verticalSliderSize:e.verticalScrollbarSize,wt&&(e.className+=" mac"),e}var $r=class extends j{constructor(e,i,s,r,n,o,l,h){super(),this._bufferService=s,this._optionsService=l,this._renderService=h,this._onRequestScrollLines=this._register(new A),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let a=this._register(new cc({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>Sn(r.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{a.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new yc(i,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},a)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(n.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Fe.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(re(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),i.appendChild(this._styleElement),this._register(re(()=>this._styleElement.remove())),this._register(Fe.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
+`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(c=>this._handleScroll(c)))}scrollLines(e){let i=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:i.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,i){i&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!i,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let i=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),s=i-this._bufferService.buffer.ydisp;s!==0&&(this._latestYDisp=i,this._onRequestScrollLines.fire(s)),this._isHandlingScroll=!1}};$r=ue([P(2,Ve),P(3,$t),P(4,_a),P(5,bi),P(6,je),P(7,It)],$r);var Ir=class extends j{constructor(e,i,s,r,n){super(),this._screenElement=e,this._bufferService=i,this._coreBrowserService=s,this._decorationService=r,this._renderService=n,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(o=>this._removeDecoration(o))),this._register(re(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let s=e.options.x??0;return s&&s>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_refreshStyle(e){let i=e.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let s=this._decorationElements.get(e);s||(s=this._createElement(e),e.element=s,this._decorationElements.set(e,s),this._container.appendChild(s),e.onDispose(()=>{this._decorationElements.delete(e),s.remove()})),s.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(s.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,s.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,s.style.top=`${i*this._renderService.dimensions.css.cell.height}px`,s.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(s)}}_refreshXPosition(e,i=e.element){if(!i)return;let s=e.options.x??0;(e.options.anchor||"left")==="right"?i.style.right=s?`${s*this._renderService.dimensions.css.cell.width}px`:"":i.style.left=s?`${s*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};Ir=ue([P(1,Ve),P(2,$t),P(3,Gi),P(4,It)],Ir);var xc=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let i of this._zones)if(i.color===e.options.overviewRulerOptions.color&&i.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(i,e.marker.line))return;if(this._lineAdjacentToZone(i,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(i,e.marker.line);return}}if(this._zonePoolIndex=e.startBufferLine&&i<=e.endBufferLine}_lineAdjacentToZone(e,i,s){return i>=e.startBufferLine-this._linePadding[s||"full"]&&i<=e.endBufferLine+this._linePadding[s||"full"]}_addLineToZone(e,i){e.startBufferLine=Math.min(e.startBufferLine,i),e.endBufferLine=Math.max(e.endBufferLine,i)}},_t={full:0,left:0,center:0,right:0},Ft={full:0,left:0,center:0,right:0},ki={full:0,left:0,center:0,right:0},ys=class extends j{constructor(e,i,s,r,n,o,l,h){super(),this._viewportElement=e,this._screenElement=i,this._bufferService=s,this._decorationService=r,this._renderService=n,this._optionsService=o,this._themeService=l,this._coreBrowserService=h,this._colorZoneStore=new xc,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(re(()=>this._canvas?.remove()));let a=this._canvas.getContext("2d");if(a)this._ctx=a;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),i=Math.ceil((this._canvas.width-1)/3);Ft.full=this._canvas.width,Ft.left=e,Ft.center=i,Ft.right=e,this._refreshDrawHeightConstants(),ki.full=1,ki.left=1,ki.center=1+Ft.left,ki.right=1+Ft.left+Ft.center}_refreshDrawHeightConstants(){_t.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,i=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);_t.left=i,_t.center=i,_t.right=i}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_t.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_t.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_t.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_t.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let i of this._decorationService.decorations)this._colorZoneStore.addDecoration(i);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let i of e)i.position!=="full"&&this._renderColorZone(i);for(let i of e)i.position==="full"&&this._renderColorZone(i);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(ki[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-_t[e.position||"full"]/2),Ft[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+_t[e.position||"full"]))}_queueRefresh(e,i){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=i||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};ys=ue([P(2,Ve),P(3,Gi),P(4,It),P(5,je),P(6,bi),P(7,$t)],ys);var E;(t=>(t.NUL="\0",t.SOH="",t.STX="",t.ETX="",t.EOT="",t.ENQ="",t.ACK="",t.BEL="\x07",t.BS="\b",t.HT=" ",t.LF=`
+`,t.VT="\v",t.FF="\f",t.CR="\r",t.SO="",t.SI="",t.DLE="",t.DC1="",t.DC2="",t.DC3="",t.DC4="",t.NAK="",t.SYN="",t.ETB="",t.CAN="",t.EM="",t.SUB="",t.ESC="\x1B",t.FS="",t.GS="",t.RS="",t.US="",t.SP=" ",t.DEL=""))(E||={});var us;(t=>(t.PAD="",t.HOP="",t.BPH="",t.NBH="",t.IND="",t.NEL="
",t.SSA="",t.ESA="",t.HTS="",t.HTJ="",t.VTS="",t.PLD="",t.PLU="",t.RI="",t.SS2="",t.SS3="",t.DCS="",t.PU1="",t.PU2="",t.STS="",t.CCH="",t.MW="",t.SPA="",t.EPA="",t.SOS="",t.SGCI="",t.SCI="",t.CSI="",t.ST="",t.OSC="",t.PM="",t.APC=""))(us||={});var Pa;(t=>t.ST=`${E.ESC}\\`)(Pa||={});var Or=class{constructor(e,i,s,r,n,o){this._textarea=e,this._compositionView=i,this._bufferService=s,this._optionsService=r,this._coreService=n,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let s;i.start+=this._dataAlreadySent.length,this._isComposing?s=this._textarea.value.substring(i.start,this._compositionPosition.start):s=this._textarea.value.substring(i.start),s.length>0&&this._coreService.triggerDataEvent(s,!0)}},0)}else{this._isSendingComposition=!1;let i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let i=this._textarea.value,s=i.replace(e,"");this._dataAlreadySent=s,i.length>e.length?this._coreService.triggerDataEvent(s,!0):i.lengththis.updateCompositionElements(!0),0)}}};Or=ue([P(2,Ve),P(3,je),P(4,li),P(5,It)],Or);var Re=0,Te=0,De=0,ce=0,Zn={css:"#00000000",rgba:0},Se;(t=>{function e(r,n,o,l){return l!==void 0?`#${Xt(r)}${Xt(n)}${Xt(o)}${Xt(l)}`:`#${Xt(r)}${Xt(n)}${Xt(o)}`}t.toCss=e;function i(r,n,o,l=255){return(r<<24|n<<16|o<<8|l)>>>0}t.toRgba=i;function s(r,n,o,l){return{css:t.toCss(r,n,o,l),rgba:t.toRgba(r,n,o,l)}}t.toColor=s})(Se||={});var ie;(t=>{function e(h,a){if(ce=(a.rgba&255)/255,ce===1)return{css:a.css,rgba:a.rgba};let c=a.rgba>>24&255,_=a.rgba>>16&255,f=a.rgba>>8&255,d=h.rgba>>24&255,m=h.rgba>>16&255,y=h.rgba>>8&255;Re=d+Math.round((c-d)*ce),Te=m+Math.round((_-m)*ce),De=y+Math.round((f-y)*ce);let k=Se.toCss(Re,Te,De),R=Se.toRgba(Re,Te,De);return{css:k,rgba:R}}t.blend=e;function i(h){return(h.rgba&255)===255}t.isOpaque=i;function s(h,a,c){let _=_s.ensureContrastRatio(h.rgba,a.rgba,c);if(_)return Se.toColor(_>>24&255,_>>16&255,_>>8&255)}t.ensureContrastRatio=s;function r(h){let a=(h.rgba|255)>>>0;return[Re,Te,De]=_s.toChannels(a),{css:Se.toCss(Re,Te,De),rgba:a}}t.opaque=r;function n(h,a){return ce=Math.round(a*255),[Re,Te,De]=_s.toChannels(h.rgba),{css:Se.toCss(Re,Te,De,ce),rgba:Se.toRgba(Re,Te,De,ce)}}t.opacity=n;function o(h,a){return ce=h.rgba&255,n(h,ce*a/255)}t.multiplyOpacity=o;function l(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}t.toColorRGB=l})(ie||={});var ae;(t=>{let e,i;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(e=n,e.globalCompositeOperation="copy",i=e.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return Re=parseInt(r.slice(1,2).repeat(2),16),Te=parseInt(r.slice(2,3).repeat(2),16),De=parseInt(r.slice(3,4).repeat(2),16),Se.toColor(Re,Te,De);case 5:return Re=parseInt(r.slice(1,2).repeat(2),16),Te=parseInt(r.slice(2,3).repeat(2),16),De=parseInt(r.slice(3,4).repeat(2),16),ce=parseInt(r.slice(4,5).repeat(2),16),Se.toColor(Re,Te,De,ce);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Re=parseInt(n[1]),Te=parseInt(n[2]),De=parseInt(n[3]),ce=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Se.toColor(Re,Te,De,ce);if(!e||!i)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=i,e.fillStyle=r,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[Re,Te,De,ce]=e.getImageData(0,0,1,1).data,ce!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Se.toRgba(Re,Te,De,ce),css:r}}t.toColor=s})(ae||={});var Ue;(t=>{function e(s){return i(s>>16&255,s>>8&255,s&255)}t.relativeLuminance=e;function i(s,r,n){let o=s/255,l=r/255,h=n/255,a=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),c=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),_=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return a*.2126+c*.7152+_*.0722}t.relativeLuminance2=i})(Ue||={});var _s;(t=>{function e(o,l){if(ce=(l&255)/255,ce===1)return l;let h=l>>24&255,a=l>>16&255,c=l>>8&255,_=o>>24&255,f=o>>16&255,d=o>>8&255;return Re=_+Math.round((h-_)*ce),Te=f+Math.round((a-f)*ce),De=d+Math.round((c-d)*ce),Se.toRgba(Re,Te,De)}t.blend=e;function i(o,l,h){let a=Ue.relativeLuminance(o>>8),c=Ue.relativeLuminance(l>>8);if(xt(a,c)>8));if(m>8));return m>k?d:y}return d}let _=r(o,l,h),f=xt(a,Ue.relativeLuminance(_>>8));if(f>8));return f>m?_:d}return _}}t.ensureContrastRatio=i;function s(o,l,h){let a=o>>24&255,c=o>>16&255,_=o>>8&255,f=l>>24&255,d=l>>16&255,m=l>>8&255,y=xt(Ue.relativeLuminance2(f,d,m),Ue.relativeLuminance2(a,c,_));for(;y0||d>0||m>0);)f-=Math.max(0,Math.ceil(f*.1)),d-=Math.max(0,Math.ceil(d*.1)),m-=Math.max(0,Math.ceil(m*.1)),y=xt(Ue.relativeLuminance2(f,d,m),Ue.relativeLuminance2(a,c,_));return(f<<24|d<<16|m<<8|255)>>>0}t.reduceLuminance=s;function r(o,l,h){let a=o>>24&255,c=o>>16&255,_=o>>8&255,f=l>>24&255,d=l>>16&255,m=l>>8&255,y=xt(Ue.relativeLuminance2(f,d,m),Ue.relativeLuminance2(a,c,_));for(;y>>0}t.increaseLuminance=r;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}t.toChannels=n})(_s||={});function Xt(t){let e=t.toString(16);return e.length<2?"0"+e:e}function xt(t,e){return t1){let c=this._getJoinedRanges(s,o,n,e,r);for(let _=0;_1){let a=this._getJoinedRanges(s,o,n,e,r);for(let c=0;c=W,C=p,x=this._workCell;if(d.length>0&&p===d[0][0]&&b){let N=d.shift(),be=this._isCellInSelection(N[0],i);for(T=N[0]+1;T=N[1],b?(w=!0,x=new kc(this._workCell,e.translateToString(!0,N[0],N[1]),N[1]-N[0]),C=N[1]-1,g=x.getWidth()):W=N[1]}let M=this._isCellInSelection(p,i),F=s&&p===o,K=u&&p>=c&&p<=_,z=!1;this._decorationService.forEachDecorationAtCell(p,i,void 0,N=>{z=!0});let pe=x.getChars()||Vt;if(pe===" "&&(x.isUnderline()||x.isOverline())&&(pe=" "),le=g*h-a.get(pe,x.isBold(),x.isItalic()),!k)k=this._document.createElement("span");else if(R&&(M&&Y||!M&&!Y&&x.bg===S)&&(M&&Y&&m.selectionForeground||x.fg===L)&&x.extended.ext===B&&K===$&&le===U&&!F&&!w&&!z&&b){x.isInvisible()?D+=Vt:D+=pe,R++;continue}else R&&(k.textContent=D),k=this._document.createElement("span"),R=0,D="";if(S=x.bg,L=x.fg,B=x.extended.ext,$=K,U=le,Y=M,w&&o>=p&&o<=C&&(o=p),!this._coreService.isCursorHidden&&F&&this._coreService.isCursorInitialized){if(v.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&v.push("xterm-cursor-blink"),v.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(n)switch(n){case"outline":v.push("xterm-cursor-outline");break;case"block":v.push("xterm-cursor-block");break;case"bar":v.push("xterm-cursor-bar");break;case"underline":v.push("xterm-cursor-underline");break}}if(x.isBold()&&v.push("xterm-bold"),x.isItalic()&&v.push("xterm-italic"),x.isDim()&&v.push("xterm-dim"),x.isInvisible()?D=Vt:D=x.getChars()||Vt,x.isUnderline()&&(v.push(`xterm-underline-${x.extended.underlineStyle}`),D===" "&&(D=" "),!x.isUnderlineColorDefault()))if(x.isUnderlineColorRGB())k.style.textDecorationColor=`rgb(${ji.toColorRGB(x.getUnderlineColor()).join(",")})`;else{let N=x.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&x.isBold()&&N<8&&(N+=8),k.style.textDecorationColor=m.ansi[N].css}x.isOverline()&&(v.push("xterm-overline"),D===" "&&(D=" ")),x.isStrikethrough()&&v.push("xterm-strikethrough"),K&&(k.style.textDecoration="underline");let q=x.getFgColor(),ne=x.getFgColorMode(),O=x.getBgColor(),I=x.getBgColorMode(),G=!!x.isInverse();if(G){let N=q;q=O,O=N;let be=ne;ne=I,I=be}let X,_e,Le=!1;this._decorationService.forEachDecorationAtCell(p,i,void 0,N=>{N.options.layer!=="top"&&Le||(N.backgroundColorRGB&&(I=50331648,O=N.backgroundColorRGB.rgba>>8&16777215,X=N.backgroundColorRGB),N.foregroundColorRGB&&(ne=50331648,q=N.foregroundColorRGB.rgba>>8&16777215,_e=N.foregroundColorRGB),Le=N.options.layer==="top")}),!Le&&M&&(X=this._coreBrowserService.isFocused?m.selectionBackgroundOpaque:m.selectionInactiveBackgroundOpaque,O=X.rgba>>8&16777215,I=50331648,Le=!0,m.selectionForeground&&(ne=50331648,q=m.selectionForeground.rgba>>8&16777215,_e=m.selectionForeground)),Le&&v.push("xterm-decoration-top");let Be;switch(I){case 16777216:case 33554432:Be=m.ansi[O],v.push(`xterm-bg-${O}`);break;case 50331648:Be=Se.toColor(O>>16,O>>8&255,O&255),this._addStyle(k,`background-color:#${Qn((O>>>0).toString(16),"0",6)}`);break;case 0:default:G?(Be=m.foreground,v.push("xterm-bg-257")):Be=m.background}switch(X||x.isDim()&&(X=ie.multiplyOpacity(Be,.5)),ne){case 16777216:case 33554432:x.isBold()&&q<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(q+=8),this._applyMinimumContrast(k,Be,m.ansi[q],x,X,void 0)||v.push(`xterm-fg-${q}`);break;case 50331648:let N=Se.toColor(q>>16&255,q>>8&255,q&255);this._applyMinimumContrast(k,Be,N,x,X,_e)||this._addStyle(k,`color:#${Qn(q.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(k,Be,m.foreground,x,X,_e)||G&&v.push("xterm-fg-257")}v.length&&(k.className=v.join(" "),v.length=0),!F&&!w&&!z&&b?R++:k.textContent=D,le!==this.defaultSpacing&&(k.style.letterSpacing=`${le}px`),f.push(k),p=C}return k&&R&&(k.textContent=D),f}_applyMinimumContrast(e,i,s,r,n,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||Ec(r.getCode()))return!1;let l=this._getContrastCache(r),h;if(!n&&!o&&(h=l.getColor(i.rgba,s.rgba)),h===void 0){let a=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);h=ie.ensureContrastRatio(n||i,o||s,a),l.setColor((n||i).rgba,(o||s).rgba,h??null)}return h?(this._addStyle(e,`color:${h.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,i){e.setAttribute("style",`${e.getAttribute("style")||""}${i};`)}_isCellInSelection(e,i){let s=this._selectionStart,r=this._selectionEnd;return!s||!r?!1:this._columnSelectMode?s[0]<=r[0]?e>=s[0]&&i>=s[1]&&e=s[1]&&e>=r[0]&&i<=r[1]:i>s[1]&&i=s[0]&&e=s[0]}};Fr=ue([P(1,pa),P(2,je),P(3,$t),P(4,li),P(5,Gi),P(6,bi)],Fr);function Qn(t,e,i){for(;t.length0&&(this._flat[r]=l),l}let n=e;i&&(n+="B"),s&&(n+="I");let o=this._holey.get(n);if(o===void 0){let l=0;i&&(l|=1),s&&(l|=2),o=this._measure(e,l),o>0&&this._holey.set(n,o)}return o}_measure(e,i){let s=this._measureElements[i];return s.textContent=e.repeat(32),s.offsetWidth/32}},Tc=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,i,s,r=!1){if(this.selectionStart=i,this.selectionEnd=s,!i||!s||i[0]===s[0]&&i[1]===s[1]){this.clear();return}let n=e.buffers.active.ydisp,o=i[1]-n,l=s[1]-n,h=Math.max(o,0),a=Math.min(l,e.rows-1);if(h>=e.rows||a<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=o,this.viewportEndRow=l,this.viewportCappedStartRow=h,this.viewportCappedEndRow=a,this.startCol=i[0],this.endCol=s[0]}isCellSelected(e,i,s){return this.hasSelection?(s-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?i>=this.startCol&&s>=this.viewportCappedStartRow&&i=this.viewportCappedStartRow&&i>=this.endCol&&s<=this.viewportCappedEndRow:s>this.viewportStartRow&&s=this.startCol&&i=this.startCol):!1}};function Dc(){return new Tc}var Hs="xterm-dom-renderer-owner-",st="xterm-rows",ts="xterm-fg-",eo="xterm-bg-",Li="xterm-focus",is="xterm-selection",Ac=1,Nr=class extends j{constructor(e,i,s,r,n,o,l,h,a,c,_,f,d,m){super(),this._terminal=e,this._document=i,this._element=s,this._screenElement=r,this._viewportElement=n,this._helperContainer=o,this._linkifier2=l,this._charSizeService=a,this._optionsService=c,this._bufferService=_,this._coreService=f,this._coreBrowserService=d,this._themeService=m,this._terminalClass=Ac++,this._rowElements=[],this._selectionRenderModel=Dc(),this.onRequestRedraw=this._register(new A).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(st),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(is),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=Mc(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(y=>this._injectCss(y))),this._injectCss(this._themeService.colors),this._rowFactory=h.createInstance(Fr,document),this._element.classList.add(Hs+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(y=>this._handleLinkHover(y))),this._register(this._linkifier2.onHideLinkUnderline(y=>this._handleLinkLeave(y))),this._register(re(()=>{this._element.classList.remove(Hs+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Rc(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let s of this._rowElements)s.style.width=`${this.dimensions.css.canvas.width}px`,s.style.height=`${this.dimensions.css.cell.height}px`,s.style.lineHeight=`${this.dimensions.css.cell.height}px`,s.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let i=`${this._terminalSelector} .${st} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=i,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let i=`${this._terminalSelector} .${st} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;i+=`${this._terminalSelector} .${st} .xterm-dim { color: ${ie.multiplyOpacity(e.foreground,.5).css};}`,i+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let s=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,n=`blink_block_${this._terminalClass}`;i+=`@keyframes ${s} { 50% { border-bottom-style: hidden; }}`,i+=`@keyframes ${r} { 50% { box-shadow: none; }}`,i+=`@keyframes ${n} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,i+=`${this._terminalSelector} .${st}.${Li} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${st}.${Li} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${st}.${Li} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${st} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${st} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${st} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${st} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${st} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,i+=`${this._terminalSelector} .${is} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${is} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${is} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,l]of e.ansi.entries())i+=`${this._terminalSelector} .${ts}${o} { color: ${l.css}; }${this._terminalSelector} .${ts}${o}.xterm-dim { color: ${ie.multiplyOpacity(l,.5).css}; }${this._terminalSelector} .${eo}${o} { background-color: ${l.css}; }`;i+=`${this._terminalSelector} .${ts}257 { color: ${ie.opaque(e.background).css}; }${this._terminalSelector} .${ts}257.xterm-dim { color: ${ie.multiplyOpacity(ie.opaque(e.background),.5).css}; }${this._terminalSelector} .${eo}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=i}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,i){for(let s=this._rowElements.length;s<=i;s++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,i){this._refreshRowElements(e,i),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Li),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Li),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,i,s){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,i,s),this.renderRows(0,this._bufferService.rows-1),!e||!i||(this._selectionRenderModel.update(this._terminal,e,i,s),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,n=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,l=this._selectionRenderModel.viewportCappedEndRow,h=this._document.createDocumentFragment();if(s){let a=e[0]>i[0];h.appendChild(this._createSelectionElement(o,a?i[0]:e[0],a?e[0]:i[0],l-o+1))}else{let a=r===o?e[0]:0,c=o===n?i[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(o,a,c));let _=l-o-1;if(h.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,_)),o!==l){let f=n===l?i[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(l,0,f))}}this._selectionContainer.appendChild(h)}_createSelectionElement(e,i,s,r=1){let n=this._document.createElement("div"),o=i*this.dimensions.css.cell.width,l=this.dimensions.css.cell.width*(s-i);return o+l>this.dimensions.css.canvas.width&&(l=this.dimensions.css.canvas.width-o),n.style.height=`${r*this.dimensions.css.cell.height}px`,n.style.top=`${e*this.dimensions.css.cell.height}px`,n.style.left=`${o}px`,n.style.width=`${l}px`,n}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,i){let s=this._bufferService.buffer,r=s.ybase+s.y,n=Math.min(s.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,l=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,h=this._optionsService.rawOptions.cursorInactiveStyle;for(let a=e;a<=i;a++){let c=a+s.ydisp,_=this._rowElements[a],f=s.lines.get(c);if(!_||!f)break;_.replaceChildren(...this._rowFactory.createRow(f,c,c===r,l,h,n,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Hs}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,i,s,r,n,o){s<0&&(e=0),r<0&&(i=0);let l=this._bufferService.rows-1;s=Math.max(Math.min(s,l),0),r=Math.max(Math.min(r,l),0),n=Math.min(n,this._bufferService.cols);let h=this._bufferService.buffer,a=h.ybase+h.y,c=Math.min(h.x,n-1),_=this._optionsService.rawOptions.cursorBlink,f=this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=s;m<=r;++m){let y=m+h.ydisp,k=this._rowElements[m],R=h.lines.get(y);if(!k||!R)break;k.replaceChildren(...this._rowFactory.createRow(R,y,y===a,f,d,c,_,this.dimensions.css.cell.width,this._widthCache,o?m===s?e:0:-1,o?(m===r?i:n)-1:-1))}}};Nr=ue([P(7,fn),P(8,Ds),P(9,je),P(10,Ve),P(11,li),P(12,$t),P(13,bi)],Nr);var Wr=class extends j{constructor(e,i,s){super(),this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=this._register(new A),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new $c(this._optionsService))}catch{this._measureStrategy=this._register(new Pc(e,i,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Wr=ue([P(2,je)],Wr);var $a=class extends j{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(t,e){t!==void 0&&t>0&&e!==void 0&&e>0&&(this._result.width=t,this._result.height=e)}},Pc=class extends $a{constructor(t,e,i){super(),this._document=t,this._parentElement=e,this._optionsService=i,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},$c=class extends $a{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let i=this._ctx.measureText("W");if(!("width"in i&&"fontBoundingBoxAscent"in i&&"fontBoundingBoxDescent"in i))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},Ic=class extends j{constructor(e,i,s){super(),this._textarea=e,this._window=i,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Oc(this._window)),this._onDprChange=this._register(new A),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new A),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(Fe.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(H(this._textarea,"focus",()=>this._isFocused=!0)),this._register(H(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},Oc=class extends j{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Si),this._onDprChange=this._register(new A),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(re(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=H(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},Fc=class extends j{constructor(){super(),this.linkProviders=[],this._register(re(()=>this.linkProviders.length=0))}registerLinkProvider(t){return this.linkProviders.push(t),{dispose:()=>{let e=this.linkProviders.indexOf(t);e!==-1&&this.linkProviders.splice(e,1)}}}};function yn(t,e,i){let s=i.getBoundingClientRect(),r=t.getComputedStyle(i),n=parseInt(r.getPropertyValue("padding-left")),o=parseInt(r.getPropertyValue("padding-top"));return[e.clientX-s.left-n,e.clientY-s.top-o]}function Nc(t,e,i,s,r,n,o,l,h){if(!n)return;let a=yn(t,e,i);if(a)return a[0]=Math.ceil((a[0]+(h?o/2:0))/o),a[1]=Math.ceil(a[1]/l),a[0]=Math.min(Math.max(a[0],1),s+(h?1:0)),a[1]=Math.min(Math.max(a[1],1),r),a}var zr=class{constructor(e,i){this._renderService=e,this._charSizeService=i}getCoords(e,i,s,r,n){return Nc(window,e,i,s,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,n)}getMouseReportCoords(e,i){let s=yn(window,e,i);if(this._charSizeService.hasValidSize)return s[0]=Math.min(Math.max(s[0],0),this._renderService.dimensions.css.canvas.width-1),s[1]=Math.min(Math.max(s[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(s[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(s[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(s[0]),y:Math.floor(s[1])}}};zr=ue([P(0,It),P(1,Ds)],zr);var Wc=class{constructor(e,i){this._renderCallback=e,this._coreBrowserService=i,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,i,s){this._rowCount=s,e=e!==void 0?e:0,i=i!==void 0?i:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,i):i,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},Ia={};Xl(Ia,{getSafariVersion:()=>Hc,isChromeOS:()=>Wa,isFirefox:()=>Oa,isIpad:()=>Uc,isIphone:()=>qc,isLegacyEdge:()=>zc,isLinux:()=>Cn,isMac:()=>xs,isNode:()=>As,isSafari:()=>Fa,isWindows:()=>Na});var As=typeof process<"u"&&"title"in process,Yi=As?"node":navigator.userAgent,Xi=As?"node":navigator.platform,Oa=Yi.includes("Firefox"),zc=Yi.includes("Edge"),Fa=/^((?!chrome|android).)*safari/i.test(Yi);function Hc(){if(!Fa)return 0;let t=Yi.match(/Version\/(\d+)/);return t===null||t.length<2?0:parseInt(t[1])}var xs=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Xi),Uc=Xi==="iPad",qc=Xi==="iPhone",Na=["Windows","Win16","Win32","WinCE"].includes(Xi),Cn=Xi.indexOf("Linux")>=0,Wa=/\bCrOS\b/.test(Yi),za=class{constructor(){this._tasks=[],this._i=0}enqueue(t){this._tasks.push(t),this._start()}flush(){for(;this._ir){s-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-e))}ms`),this._start();return}s=r}this.clear()}},Kc=class extends za{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let i=performance.now()+e;return{timeRemaining:()=>Math.max(0,i-performance.now())}}},Vc=class extends za{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},ks=!As&&"requestIdleCallback"in window?Vc:Kc,jc=class{constructor(){this._queue=new ks}set(t){this._queue.clear(),this._queue.enqueue(t)}flush(){this._queue.flush()}},Hr=class extends j{constructor(e,i,s,r,n,o,l,h,a){super(),this._rowCount=e,this._optionsService=s,this._charSizeService=r,this._coreService=n,this._coreBrowserService=h,this._renderer=this._register(new Si),this._pausedResizeTask=new jc,this._observerDisposable=this._register(new Si),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new A),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new A),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new A),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new A),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Wc((c,_)=>this._renderRows(c,_),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Gc(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(re(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(l.onResize(()=>this._fullRefresh())),this._register(l.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(l.cols,l.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(l.buffer.y,l.buffer.y,!0))),this._register(a.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,i),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,i)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,i){if("IntersectionObserver"in e){let s=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});s.observe(i),this._observerDisposable.value=re(()=>s.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,i,s=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),i=Math.max(i,r.end)),s||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,i,this._rowCount)}_renderRows(e,i){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}e=Math.min(e,this._rowCount-1),i=Math.min(i,this._rowCount-1),this._renderer.value.renderRows(e,i),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:i}),this._onRender.fire({start:e,end:i}),this._isNextRenderRedrawOnly=!0}}resize(e,i){this._rowCount=i,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(i=>this.refreshRows(i.start,i.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,i){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,i)):this._renderer.value.handleResize(e,i),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,i,s){this._selectionState.start=e,this._selectionState.end=i,this._selectionState.columnSelectMode=s,this._renderer.value?.handleSelectionChanged(e,i,s)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Hr=ue([P(2,je),P(3,Ds),P(4,li),P(5,Gi),P(6,Ve),P(7,$t),P(8,bi)],Hr);var Gc=class{constructor(t,e,i){this._coreBrowserService=t,this._coreService=e,this._onTimeout=i,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(t,e){this._isBuffering?(this._start=Math.min(this._start,t),this._end=Math.max(this._end,e)):(this._start=t,this._end=e,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let t={start:this._start,end:this._end};return this._isBuffering=!1,t}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function Yc(t,e,i,s){let r=i.buffer.x,n=i.buffer.y;if(!i.buffer.hasScrollback)return Zc(r,n,t,e,i,s)+Ps(n,e,i,s)+Qc(r,n,t,e,i,s);let o;if(n===e)return o=r>t?"D":"C",qi(Math.abs(r-t),Ui(o,s));o=n>e?"D":"C";let l=Math.abs(n-e),h=Jc(n>e?t:r,i)+(l-1)*i.cols+1+Xc(n>e?r:t);return qi(h,Ui(o,s))}function Xc(t,e){return t-1}function Jc(t,e){return e.cols-t}function Zc(t,e,i,s,r,n){return Ps(e,s,r,n).length===0?"":qi(Ua(t,e,t,e-ai(e,r),!1,r).length,Ui("D",n))}function Ps(t,e,i,s){let r=t-ai(t,i),n=e-ai(e,i),o=Math.abs(r-n)-ed(t,e,i);return qi(o,Ui(Ha(t,e),s))}function Qc(t,e,i,s,r,n){let o;Ps(e,s,r,n).length>0?o=s-ai(s,r):o=e;let l=s,h=td(t,e,i,s,r,n);return qi(Ua(t,o,i,l,h==="C",r).length,Ui(h,n))}function ed(t,e,i){let s=0,r=t-ai(t,i),n=e-ai(e,i);for(let o=0;o=0&&t0?o=s-ai(s,r):o=e,t=i&&oe?"A":"B"}function Ua(t,e,i,s,r,n){let o=t,l=e,h="";for(;(o!==i||l!==s)&&l>=0&&ln.cols-1?(h+=n.buffer.translateBufferLineToString(l,!1,t,o),o=0,t=0,l++):!r&&o<0&&(h+=n.buffer.translateBufferLineToString(l,!1,0,t+1),o=n.cols-1,t=o,l--);return h+n.buffer.translateBufferLineToString(l,!1,t,o)}function Ui(t,e){let i=e?"O":"[";return E.ESC+i+t}function qi(t,e){t=Math.floor(t);let i="";for(let s=0;sthis._bufferService.cols?t%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)-1]:[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[t,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[Math.max(t,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let t=this.selectionStart,e=this.selectionEnd;return!t||!e?!1:t[1]>e[1]||t[1]===e[1]&&t[0]>e[0]}handleTrim(t){return this.selectionStart&&(this.selectionStart[1]-=t),this.selectionEnd&&(this.selectionEnd[1]-=t),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function to(t,e){if(t.start.y>t.end.y)throw new Error(`Buffer range end (${t.end.x}, ${t.end.y}) cannot be before start (${t.start.x}, ${t.start.y})`);return e*(t.end.y-t.start.y)+(t.end.x-t.start.x+1)}var Us=50,sd=15,rd=50,nd=500,od=" ",ad=new RegExp(od,"g"),Ur=class extends j{constructor(e,i,s,r,n,o,l,h,a){super(),this._element=e,this._screenElement=i,this._linkifier=s,this._bufferService=r,this._coreService=n,this._mouseService=o,this._optionsService=l,this._renderService=h,this._coreBrowserService=a,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new ct,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new A),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new A),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new A),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new A),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new id(this._bufferService),this._activeSelectionMode=0,this._register(re(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!e||!i?!1:e[0]!==i[0]||e[1]!==i[1]}get selectionText(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;if(!e||!i)return"";let s=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===i[0])return"";let n=e[0]n.replace(ad," ")).join(Na?`\r
+`:`
+`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Cn&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let i=this._getMouseBufferCoords(e),s=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!s||!r||!i?!1:this._areCoordsInSelection(i,s,r)}isCellInSelection(e,i){let s=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!s||!r?!1:this._areCoordsInSelection([e,i],s,r)}_areCoordsInSelection(e,i,s){return e[1]>i[1]&&e[1]=i[0]&&e[0]=i[0]}_selectWordAtCursor(e,i){let s=this._linkifier.currentLink?.link?.range;if(s)return this._model.selectionStart=[s.start.x-1,s.start.y-1],this._model.selectionStartLength=to(s,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,i),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,i){this._model.clearSelection(),e=Math.max(e,0),i=Math.min(i,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,i],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let i=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(i)return i[0]--,i[1]--,i[1]+=this._bufferService.buffer.ydisp,i}_getMouseEventScrollAmount(e){let i=yn(this._coreBrowserService.window,e,this._screenElement)[1],s=this._renderService.dimensions.css.canvas.height;return i>=0&&i<=s?0:(i>s&&(i-=s),i=Math.min(Math.max(i,-Us),Us),i/=Us,i/Math.abs(i)+Math.round(i*(sd-1)))}shouldForceSelection(e){return xs?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),rd)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let i=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);i&&i.length!==this._model.selectionStart[0]&&i.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let i=this._getMouseBufferCoords(e);i&&(this._activeSelectionMode=2,this._selectLineAt(i[1]))}shouldColumnSelect(e){return e.altKey&&!(xs&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let i=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let s=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let i=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&ithis._handleTrim(i))}_convertViewportColToCharacterIndex(e,i){let s=i;for(let r=0;i>=r;r++){let n=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?s--:n>1&&i!==r&&(s+=n-1)}return s}setSelection(e,i,s){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,i],this._model.selectionStartLength=s,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,i,s=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let n=this._bufferService.buffer,o=n.lines.get(e[1]);if(!o)return;let l=n.translateBufferLineToString(e[1],!1),h=this._convertViewportColToCharacterIndex(o,e[0]),a=h,c=e[0]-h,_=0,f=0,d=0,m=0;if(l.charAt(h)===" "){for(;h>0&&l.charAt(h-1)===" ";)h--;for(;a1&&(m+=T-1,a+=T-1);R>0&&h>0&&!this._isCharWordSeparator(o.loadCell(R-1,this._workCell));){o.loadCell(R-1,this._workCell);let S=this._workCell.getChars().length;this._workCell.getWidth()===0?(_++,R--):S>1&&(d+=S-1,h-=S-1),h--,R--}for(;D1&&(m+=S-1,a+=S-1),a++,D++}}a++;let y=h+c-_+d,k=Math.min(this._bufferService.cols,a-h+_+f-d-m);if(!(!i&&l.slice(h,a).trim()==="")){if(s&&y===0&&o.getCodePoint(0)!==32){let R=n.lines.get(e[1]-1);if(R&&o.isWrapped&&R.getCodePoint(this._bufferService.cols-1)!==32){let D=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(D){let T=this._bufferService.cols-D.start;y-=T,k+=T}}}if(r&&y+k===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let R=n.lines.get(e[1]+1);if(R?.isWrapped&&R.getCodePoint(0)!==32){let D=this._getWordAt([0,e[1]+1],!1,!1,!0);D&&(k+=D.length)}}return{start:y,length:k}}}_selectWordAt(e,i){let s=this._getWordAt(e,i);if(s){for(;s.start<0;)s.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[s.start,e[1]],this._model.selectionStartLength=s.length}}_selectToWordAt(e){let i=this._getWordAt(e,!0);if(i){let s=e[1];for(;i.start<0;)i.start+=this._bufferService.cols,s--;if(!this._model.areSelectionValuesReversed())for(;i.start+i.length>this._bufferService.cols;)i.length-=this._bufferService.cols,s++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?i.start:i.start+i.length,s]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let i=this._bufferService.buffer.getWrappedRangeForLine(e),s={start:{x:0,y:i.first},end:{x:this._bufferService.cols-1,y:i.last}};this._model.selectionStart=[0,i.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=to(s,this._bufferService.cols)}};Ur=ue([P(3,Ve),P(4,li),P(5,gn),P(6,je),P(7,It),P(8,$t)],Ur);var io=class{constructor(){this._data={}}set(e,i,s){this._data[e]||(this._data[e]={}),this._data[e][i]=s}get(e,i){return this._data[e]?this._data[e][i]:void 0}clear(){this._data={}}},so=class{constructor(){this._color=new io,this._css=new io}setCss(e,i,s){this._css.set(e,i,s)}getCss(e,i){return this._css.get(e,i)}setColor(e,i,s){this._color.set(e,i,s)}getColor(e,i){return this._color.get(e,i)}clear(){this._color.clear(),this._css.clear()}},ye=Object.freeze((()=>{let t=[ae.toColor("#2e3436"),ae.toColor("#cc0000"),ae.toColor("#4e9a06"),ae.toColor("#c4a000"),ae.toColor("#3465a4"),ae.toColor("#75507b"),ae.toColor("#06989a"),ae.toColor("#d3d7cf"),ae.toColor("#555753"),ae.toColor("#ef2929"),ae.toColor("#8ae234"),ae.toColor("#fce94f"),ae.toColor("#729fcf"),ae.toColor("#ad7fa8"),ae.toColor("#34e2e2"),ae.toColor("#eeeeec")],e=[0,95,135,175,215,255];for(let i=0;i<216;i++){let s=e[i/36%6|0],r=e[i/6%6|0],n=e[i%6];t.push({css:Se.toCss(s,r,n),rgba:Se.toRgba(s,r,n)})}for(let i=0;i<24;i++){let s=8+i*10;t.push({css:Se.toCss(s,s,s),rgba:Se.toRgba(s,s,s)})}return t})()),Zt=ae.toColor("#ffffff"),Ii=ae.toColor("#000000"),ro=ae.toColor("#ffffff"),no=Ii,Bi={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},ld=Zt,qr=class extends j{constructor(e){super(),this._optionsService=e,this._contrastCache=new so,this._halfContrastCache=new so,this._onChangeColors=this._register(new A),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Zt,background:Ii,cursor:ro,cursorAccent:no,selectionForeground:void 0,selectionBackgroundTransparent:Bi,selectionBackgroundOpaque:ie.blend(Ii,Bi),selectionInactiveBackgroundTransparent:Bi,selectionInactiveBackgroundOpaque:ie.blend(Ii,Bi),scrollbarSliderBackground:ie.opacity(Zt,.2),scrollbarSliderHoverBackground:ie.opacity(Zt,.4),scrollbarSliderActiveBackground:ie.opacity(Zt,.5),overviewRulerBorder:Zt,ansi:ye.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let i=this._colors;if(i.foreground=Q(e.foreground,Zt),i.background=Q(e.background,Ii),i.cursor=ie.blend(i.background,Q(e.cursor,ro)),i.cursorAccent=ie.blend(i.background,Q(e.cursorAccent,no)),i.selectionBackgroundTransparent=Q(e.selectionBackground,Bi),i.selectionBackgroundOpaque=ie.blend(i.background,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundTransparent=Q(e.selectionInactiveBackground,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundOpaque=ie.blend(i.background,i.selectionInactiveBackgroundTransparent),i.selectionForeground=e.selectionForeground?Q(e.selectionForeground,Zn):void 0,i.selectionForeground===Zn&&(i.selectionForeground=void 0),ie.isOpaque(i.selectionBackgroundTransparent)&&(i.selectionBackgroundTransparent=ie.opacity(i.selectionBackgroundTransparent,.3)),ie.isOpaque(i.selectionInactiveBackgroundTransparent)&&(i.selectionInactiveBackgroundTransparent=ie.opacity(i.selectionInactiveBackgroundTransparent,.3)),i.scrollbarSliderBackground=Q(e.scrollbarSliderBackground,ie.opacity(i.foreground,.2)),i.scrollbarSliderHoverBackground=Q(e.scrollbarSliderHoverBackground,ie.opacity(i.foreground,.4)),i.scrollbarSliderActiveBackground=Q(e.scrollbarSliderActiveBackground,ie.opacity(i.foreground,.5)),i.overviewRulerBorder=Q(e.overviewRulerBorder,ld),i.ansi=ye.slice(),i.ansi[0]=Q(e.black,ye[0]),i.ansi[1]=Q(e.red,ye[1]),i.ansi[2]=Q(e.green,ye[2]),i.ansi[3]=Q(e.yellow,ye[3]),i.ansi[4]=Q(e.blue,ye[4]),i.ansi[5]=Q(e.magenta,ye[5]),i.ansi[6]=Q(e.cyan,ye[6]),i.ansi[7]=Q(e.white,ye[7]),i.ansi[8]=Q(e.brightBlack,ye[8]),i.ansi[9]=Q(e.brightRed,ye[9]),i.ansi[10]=Q(e.brightGreen,ye[10]),i.ansi[11]=Q(e.brightYellow,ye[11]),i.ansi[12]=Q(e.brightBlue,ye[12]),i.ansi[13]=Q(e.brightMagenta,ye[13]),i.ansi[14]=Q(e.brightCyan,ye[14]),i.ansi[15]=Q(e.brightWhite,ye[15]),e.extendedAnsi){let s=Math.min(i.ansi.length-16,e.extendedAnsi.length);for(let r=0;rn.index-o.index),s=[];for(let n of i){let o=this._services.get(n.id);if(!o)throw new Error(`[createInstance] ${t.name} depends on UNKNOWN service ${n.id._id}.`);s.push(o)}let r=i.length>0?i[0].index:e.length;if(e.length!==r)throw new Error(`[createInstance] First service dependency of ${t.name} at position ${r+1} conflicts with ${e.length} static arguments`);return new t(...e,...s)}},dd={trace:0,debug:1,info:2,warn:3,error:4,off:5},ud="xterm.js: ",Kr=class extends j{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=dd[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;ithis._length)for(let i=this._length;i=e;r--)this._array[this._getCyclicIndex(r+s.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;rthis._maxLength){let r=this._length+s.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=s.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,i,s){if(!(i<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+s<0)throw new Error("Cannot shift elements in list beyond index 0");if(s>0){for(let n=i-1;n>=0;n--)this.set(e+n+s,this.get(e+n));let r=e+i+s-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r>22,i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):s]}set(e,i){this._data[e*V+1]=i[0],i[1].length>1?(this._combined[e]=i[1],this._data[e*V+0]=e|2097152|i[2]<<22):this._data[e*V+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(e){return this._data[e*V+0]>>22}hasWidth(e){return this._data[e*V+0]&12582912}getFg(e){return this._data[e*V+1]}getBg(e){return this._data[e*V+2]}hasContent(e){return this._data[e*V+0]&4194303}getCodePoint(e){let i=this._data[e*V+0];return i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):i&2097151}isCombined(e){return this._data[e*V+0]&2097152}getString(e){let i=this._data[e*V+0];return i&2097152?this._combined[e]:i&2097151?Kt(i&2097151):""}isProtected(e){return this._data[e*V+2]&536870912}loadCell(e,i){return ss=e*V,i.content=this._data[ss+0],i.fg=this._data[ss+1],i.bg=this._data[ss+2],i.content&2097152&&(i.combinedData=this._combined[e]),i.bg&268435456&&(i.extended=this._extendedAttrs[e]),i}setCell(e,i){i.content&2097152&&(this._combined[e]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[e]=i.extended),this._data[e*V+0]=i.content,this._data[e*V+1]=i.fg,this._data[e*V+2]=i.bg}setCellFromCodepoint(e,i,s,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*V+0]=i|s<<22,this._data[e*V+1]=r.fg,this._data[e*V+2]=r.bg}addCodepointToCell(e,i,s){let r=this._data[e*V+0];r&2097152?this._combined[e]+=Kt(i):r&2097151?(this._combined[e]=Kt(r&2097151)+Kt(i),r&=-2097152,r|=2097152):r=i|1<<22,s&&(r&=-12582913,r|=s<<22),this._data[e*V+0]=r}insertCells(e,i,s){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,s),i=0;--n)this.setCell(e+i+n,this.loadCell(e+n,r));for(let n=0;nthis.length){if(this._data.buffer.byteLength>=s*4)this._data=new Uint32Array(this._data.buffer,0,s);else{let r=new Uint32Array(s);r.set(this._data),this._data=r}for(let r=this.length;r=e&&delete this._combined[l]}let n=Object.keys(this._extendedAttrs);for(let o=0;o=e&&delete this._extendedAttrs[l]}}return this.length=e,s*4*qs=0;--e)if(this._data[e*V+0]&4194303)return e+(this._data[e*V+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*V+0]&4194303||this._data[e*V+2]&50331648)return e+(this._data[e*V+0]>>22);return 0}copyCellsFrom(e,i,s,r,n){let o=e._data;if(n)for(let h=r-1;h>=0;h--){for(let a=0;a=i&&(this._combined[a-i+s]=e._combined[a])}}translateToString(e,i,s,r){i=i??0,s=s??this.length,e&&(s=Math.min(s,this.getTrimmedLength())),r&&(r.length=0);let n="";for(;i>22||1}return r&&r.push(i),n}};function _d(t,e,i,s,r,n){let o=[];for(let l=0;l=l&&s0&&(k>_||c[k].getTrimmedLength()===0);k--)y++;y>0&&(o.push(l+c.length-y),o.push(y)),l+=c.length-1}return o}function fd(t,e){let i=[],s=0,r=e[s],n=0;for(let o=0;oKi(t,a,e)).reduce((h,a)=>h+a),n=0,o=0,l=0;for(;lh&&(n-=h,o++);let a=t[o].getWidth(n-1)===2;a&&n--;let c=a?i-1:i;s.push(c),l+=c}return s}function Ki(t,e,i){if(e===t.length-1)return t[e].getTrimmedLength();let s=!t[e].hasContent(i-1)&&t[e].getWidth(i-1)===1,r=t[e+1].getWidth(0)===2;return s&&r?i-1:i}var Ka=class Va{constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=Va._nextId++,this._onDispose=this.register(new A),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),oi(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};Ka._nextId=1;var vd=Ka,ke={},Qt=ke.B;ke[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};ke.A={"#":"£"};ke.B=void 0;ke[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};ke.C=ke[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ke.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};ke.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};ke.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};ke.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};ke.E=ke[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};ke.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};ke.H=ke[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ke["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var ao=4294967295,lo=class{constructor(t,e,i){this._hasScrollback=t,this._optionsService=e,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=me.clone(),this.savedCharset=Qt,this.markers=[],this._nullCell=ct.fromCharData([0,ha,1,0]),this._whitespaceCell=ct.fromCharData([0,Vt,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new ks,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new oo(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new bs),this._nullCell}getWhitespaceCell(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new bs),this._whitespaceCell}getBlankLine(t,e){return new Oi(this._bufferService.cols,this.getNullCell(t),e)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let t=this.ybase+this.y-this.ydisp;return t>=0&&tao?ao:e}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=me);let e=this._rows;for(;e--;)this.lines.push(this.getBlankLine(t))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new oo(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,e){let i=this.getNullCell(me),s=0,r=this._getCorrectBufferLength(e);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new Oi(t,i)));else for(let o=this._rows;o>e;o--)this.lines.length>e+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=r}this.x=Math.min(this.x,t-1),this.y=Math.min(this.y,e-1),n&&(this.y+=n),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=e-1,this._isReflowEnabled&&(this._reflow(t,e),this._cols>t))for(let n=0;n.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let t=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,t=!1);let e=0;for(;this._memoryCleanupPosition100)return!0;return t}get _isReflowEnabled(){let t=this._optionsService.rawOptions.windowsPty;return t&&t.buildNumber?this._hasScrollback&&t.backend==="conpty"&&t.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(t,e){this._cols!==t&&(t>this._cols?this._reflowLarger(t,e):this._reflowSmaller(t,e))}_reflowLarger(t,e){let i=this._optionsService.rawOptions.reflowCursorLine,s=_d(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(me),i);if(s.length>0){let r=fd(this.lines,s);gd(this.lines,r.layout),this._reflowLargerAdjustViewport(t,e,r.countRemoved)}}_reflowLargerAdjustViewport(t,e,i){let s=this.getNullCell(me),r=i;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=t)continue;let h=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),h.unshift(l);if(!i){let T=this.ybase+this.y;if(T>=o&&T0&&(r.push({start:o+h.length+n,newLines:d}),n+=d.length),h.push(...d);let m=c.length-1,y=c[m];y===0&&(m--,y=c[m]);let k=h.length-_-1,R=a;for(;k>=0;){let T=Math.min(R,y);if(h[m]===void 0)break;if(h[m].copyCellsFrom(h[k],R-T,y-T,T,!0),y-=T,y===0&&(m--,y=c[m]),R-=T,R===0){k--;let S=Math.max(k,0);R=Ki(h,S,this._cols)}}for(let T=0;T0;)this.ybase===0?this.y0){let o=[],l=[];for(let y=0;y=0;y--)if(_&&_.start>a+f){for(let k=_.newLines.length-1;k>=0;k--)this.lines.set(y--,_.newLines[k]);y++,o.push({index:a+1,amount:_.newLines.length}),f+=_.newLines.length,_=r[++c]}else this.lines.set(y,l[a--]);let d=0;for(let y=o.length-1;y>=0;y--)o[y].index+=d,this.lines.onInsertEmitter.fire(o[y]),d+=o[y].amount;let m=Math.max(0,h+n-this.lines.maxLength);m>0&&this.lines.onTrimEmitter.fire(m)}}translateBufferLineToString(t,e,i=0,s){let r=this.lines.get(t);return r?r.translateToString(e,i,s):""}getWrappedRangeForLine(t){let e=t,i=t;for(;e>0&&this.lines.get(e).isWrapped;)e--;for(;i+10;);return t>=this._cols?this._cols-1:t<0?0:t}nextStop(t){for(t==null&&(t=this.x);!this.tabs[++t]&&t=this._cols?this._cols-1:t<0?0:t}clearMarkers(t){this._isClearing=!0;for(let e=0;e{e.line-=i,e.line<0&&e.dispose()})),e.register(this.lines.onInsert(i=>{e.line>=i.index&&(e.line+=i.amount)})),e.register(this.lines.onDelete(i=>{e.line>=i.index&&e.linei.index&&(e.line-=i.amount)})),e.register(e.onDispose(()=>this._removeMarker(e))),e}_removeMarker(t){this._isClearing||this.markers.splice(this.markers.indexOf(t),1)}},md=class extends j{constructor(e,i){super(),this._optionsService=e,this._bufferService=i,this._onBufferActivate=this._register(new A),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new lo(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new lo(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,i){this._normal.resize(e,i),this._alt.resize(e,i),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},ja=2,Ga=1,Vr=class extends j{constructor(t){super(),this.isUserScrolling=!1,this._onResize=this._register(new A),this.onResize=this._onResize.event,this._onScroll=this._register(new A),this.onScroll=this._onScroll.event,this.cols=Math.max(t.rawOptions.cols||0,ja),this.rows=Math.max(t.rawOptions.rows||0,Ga),this.buffers=this._register(new md(t,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(t,e){let i=this.cols!==t,s=this.rows!==e;this.cols=t,this.rows=e,this.buffers.resize(t,e),this._onResize.fire({cols:t,rows:e,colsChanged:i,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(t,e=!1){let i=this.buffer,s;s=this._cachedBlankLine,(!s||s.length!==this.cols||s.getFg(0)!==t.fg||s.getBg(0)!==t.bg)&&(s=i.getBlankLine(t,e),this._cachedBlankLine=s),s.isWrapped=e;let r=i.ybase+i.scrollTop,n=i.ybase+i.scrollBottom;if(i.scrollTop===0){let o=i.lines.isFull;n===i.lines.length-1?o?i.lines.recycle().copyFrom(s):i.lines.push(s.clone()):i.lines.splice(n+1,0,s.clone()),o?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let o=n-r+1;i.lines.shiftElements(r+1,o-1,-1),i.lines.set(n,s.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(t,e){let i=this.buffer;if(t<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else t+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let s=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+t,i.ybase),0),s!==i.ydisp&&(e||this._onScroll.fire(i.ydisp))}};Vr=ue([P(0,je)],Vr);var di={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:xs,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},wd=["normal","bold","100","200","300","400","500","600","700","800","900"],Sd=class extends j{constructor(e){super(),this._onOptionChange=this._register(new A),this.onOptionChange=this._onOptionChange.event;let i={...di};for(let s in e)if(s in i)try{let r=e[s];i[s]=this._sanitizeAndValidateOption(s,r)}catch(r){console.error(r)}this.rawOptions=i,this.options={...i},this._setupOptions(),this._register(re(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,i){return this.onOptionChange(s=>{s===e&&i(this.rawOptions[e])})}onMultipleOptionChange(e,i){return this.onOptionChange(s=>{e.indexOf(s)!==-1&&i()})}_setupOptions(){let e=s=>{if(!(s in di))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},i=(s,r)=>{if(!(s in di))throw new Error(`No option with key "${s}"`);r=this._sanitizeAndValidateOption(s,r),this.rawOptions[s]!==r&&(this.rawOptions[s]=r,this._onOptionChange.fire(s))};for(let s in this.rawOptions){let r={get:e.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this.options,s,r)}}_sanitizeAndValidateOption(e,i){switch(e){case"cursorStyle":if(i||(i=di[e]),!bd(i))throw new Error(`"${i}" is not a valid value for ${e}`);break;case"wordSeparator":i||(i=di[e]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=wd.includes(i)?i:di[e];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${e} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(i*10)/10));break;case"scrollback":if(i=Math.min(i,4294967295),i<0)throw new Error(`${e} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${e} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{};break}return i}};function bd(t){return t==="block"||t==="underline"||t==="bar"}function Fi(t,e=5){if(typeof t!="object")return t;let i=Array.isArray(t)?[]:{};for(let s in t)i[s]=e<=1?t[s]:t[s]&&Fi(t[s],e-1);return i}var ho=Object.freeze({insertMode:!1}),co=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),jr=class extends j{constructor(e,i,s){super(),this._bufferService=e,this._logService=i,this._optionsService=s,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new A),this.onData=this._onData.event,this._onUserInput=this._register(new A),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new A),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new A),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Fi(ho),this.decPrivateModes=Fi(co)}reset(){this.modes=Fi(ho),this.decPrivateModes=Fi(co)}triggerDataEvent(e,i=!1){if(this._optionsService.rawOptions.disableStdin)return;let s=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&s.ybase!==s.ydisp&&this._onRequestScrollToBottom.fire(),i&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(i=>i.charCodeAt(0))),this._onBinary.fire(e))}};jr=ue([P(0,Ve),P(1,fa),P(2,je)],jr);var uo={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:t=>t.button===4||t.action!==1?!1:(t.ctrl=!1,t.alt=!1,t.shift=!1,!0)},VT200:{events:19,restrict:t=>t.action!==32},DRAG:{events:23,restrict:t=>!(t.action===32&&t.button===3)},ANY:{events:31,restrict:t=>!0}};function Ks(t,e){let i=(t.ctrl?16:0)|(t.shift?4:0)|(t.alt?8:0);return t.button===4?(i|=64,i|=t.action):(i|=t.button&3,t.button&4&&(i|=64),t.button&8&&(i|=128),t.action===32?i|=32:t.action===0&&!e&&(i|=3)),i}var Vs=String.fromCharCode,_o={DEFAULT:t=>{let e=[Ks(t,!1)+32,t.col+32,t.row+32];return e[0]>255||e[1]>255||e[2]>255?"":`\x1B[M${Vs(e[0])}${Vs(e[1])}${Vs(e[2])}`},SGR:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${Ks(t,!0)};${t.col};${t.row}${e}`},SGR_PIXELS:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${Ks(t,!0)};${t.x};${t.y}${e}`}},Gr=class extends j{constructor(t,e,i){super(),this._bufferService=t,this._coreService=e,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new A),this.onProtocolChange=this._onProtocolChange.event;for(let s of Object.keys(uo))this.addProtocol(s,uo[s]);for(let s of Object.keys(_o))this.addEncoding(s,_o[s]);this.reset()}addProtocol(t,e){this._protocols[t]=e}addEncoding(t,e){this._encodings[t]=e}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(t){if(!this._protocols[t])throw new Error(`unknown protocol "${t}"`);this._activeProtocol=t,this._onProtocolChange.fire(this._protocols[t].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(t){if(!this._encodings[t])throw new Error(`unknown encoding "${t}"`);this._activeEncoding=t}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(t,e,i){if(t.deltaY===0||t.shiftKey||e===void 0||i===void 0)return 0;let s=e/i,r=this._applyScrollModifier(t.deltaY,t);return t.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=s+0,Math.abs(t.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(t,e){return e.altKey||e.ctrlKey||e.shiftKey?t*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:t*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(t){if(t.col<0||t.col>=this._bufferService.cols||t.row<0||t.row>=this._bufferService.rows||t.button===4&&t.action===32||t.button===3&&t.action!==32||t.button!==4&&(t.action===2||t.action===3)||(t.col++,t.row++,t.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,t,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(t))return!1;let e=this._encodings[this._activeEncoding](t);return e&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(e):this._coreService.triggerDataEvent(e,!0)),this._lastEvent=t,!0}explainEvents(t){return{down:!!(t&1),up:!!(t&2),drag:!!(t&4),move:!!(t&8),wheel:!!(t&16)}}_equalEvents(t,e,i){if(i){if(t.x!==e.x||t.y!==e.y)return!1}else if(t.col!==e.col||t.row!==e.row)return!1;return!(t.button!==e.button||t.action!==e.action||t.ctrl!==e.ctrl||t.alt!==e.alt||t.shift!==e.shift)}};Gr=ue([P(0,Ve),P(1,li),P(2,je)],Gr);var js=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],yd=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],Ce;function Cd(t,e){let i=0,s=e.length-1,r;if(te[s][1])return!1;for(;s>=i;)if(r=i+s>>1,t>e[r][1])i=r+1;else if(t=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,i){let s=this.wcwidth(e),r=s===0&&i!==0;if(r){let n=ei.extractWidth(i);n===0?r=!1:n>s&&(s=n)}return ei.createPropertyValue(0,s,r)}},ei=class fs{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new A,this.onChange=this._onChange.event;let e=new xd;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!==0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,i,s=!1){return(e&16777215)<<3|(i&3)<<1|(s?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let i=0,s=0,r=e.length;for(let n=0;n=r)return i+this.wcwidth(o);let a=e.charCodeAt(n);56320<=a&&a<=57343?o=(o-55296)*1024+a-56320+65536:i+=this.wcwidth(a)}let l=this.charProperties(o,s),h=fs.extractWidth(l);fs.extractShouldJoin(l)&&(h-=fs.extractWidth(s)),i+=h,s=l}return i}charProperties(e,i){return this._activeProvider.charProperties(e,i)}},kd=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,i){this._charsets[e]=i,this.glevel===e&&(this.charset=i)}};function fo(t){let e=t.buffer.lines.get(t.buffer.ybase+t.buffer.y-1)?.get(t.cols-1),i=t.buffer.lines.get(t.buffer.ybase+t.buffer.y);i&&e&&(i.isWrapped=e[3]!==0&&e[3]!==32)}var Ei=2147483647,Ld=256,Ya=class Yr{constructor(e=32,i=32){if(this.maxLength=e,this.maxSubParamsLength=i,i>Ld)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(e){let i=new Yr;if(!e.length)return i;for(let s=Array.isArray(e[0])?1:0;s>8,r=this._subParamsIdx[i]&255;r-s>0&&e.push(Array.prototype.slice.call(this._subParams,s,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>Ei?Ei:e}addSubParam(e){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>Ei?Ei:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let i=this._subParamsIdx[e]>>8,s=this._subParamsIdx[e]&255;return s-i>0?this._subParams.subarray(i,s):null}getSubParamsAll(){let e={};for(let i=0;i>8,r=this._subParamsIdx[i]&255;r-s>0&&(e[i]=this._subParams.slice(s,r))}return e}addDigit(e){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,r=s[i-1];s[i-1]=~r?Math.min(r*10+e,Ei):e}},Mi=[],Bd=class{constructor(){this._state=0,this._active=Mi,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,i){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(i),{dispose:()=>{let r=s.indexOf(i);r!==-1&&s.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Mi}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=Mi,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Mi,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,i,s){if(!this._active.length)this._handlerFb(this._id,"PUT",Ts(e,i,s));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,i,s)}start(){this.reset(),this._state=1}put(e,i,s){if(this._state!==3){if(this._state===1)for(;i0&&this._put(e,i,s)}}end(e,i=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let s=!1,r=this._active.length-1,n=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,s=i,n=this._stack.fallThrough,this._stack.paused=!1),!n&&s===!1){for(;r>=0&&(s=this._active[r].end(e),s!==!0);r--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,s;r--}for(;r>=0;r--)if(s=this._active[r].end(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,s}this._active=Mi,this._id=-1,this._state=0}}},Je=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,i,s){this._hitLimit||(this._data+=Ts(e,i,s),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let i=!1;if(this._hitLimit)i=!1;else if(e&&(i=this._handler(this._data),i instanceof Promise))return i.then(s=>(this._data="",this._hitLimit=!1,s));return this._data="",this._hitLimit=!1,i}},Ri=[],Ed=class{constructor(){this._handlers=Object.create(null),this._active=Ri,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Ri}registerHandler(e,i){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(i),{dispose:()=>{let r=s.indexOf(i);r!==-1&&s.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=Ri,this._ident=0}hook(e,i){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Ri,!this._active.length)this._handlerFb(this._ident,"HOOK",i);else for(let s=this._active.length-1;s>=0;s--)this._active[s].hook(i)}put(e,i,s){if(!this._active.length)this._handlerFb(this._ident,"PUT",Ts(e,i,s));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,i,s)}unhook(e,i=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let s=!1,r=this._active.length-1,n=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,s=i,n=this._stack.fallThrough,this._stack.paused=!1),!n&&s===!1){for(;r>=0&&(s=this._active[r].unhook(e),s!==!0);r--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,s;r--}for(;r>=0;r--)if(s=this._active[r].unhook(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,s}this._active=Ri,this._ident=0}},Ni=new Ya;Ni.addParam(0);var go=class{constructor(t){this._handler=t,this._data="",this._params=Ni,this._hitLimit=!1}hook(t){this._params=t.length>1||t.params[0]?t.clone():Ni,this._data="",this._hitLimit=!1}put(t,e,i){this._hitLimit||(this._data+=Ts(t,e,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(t){let e=!1;if(this._hitLimit)e=!1;else if(t&&(e=this._handler(this._data,this._params),e instanceof Promise))return e.then(i=>(this._params=Ni,this._data="",this._hitLimit=!1,i));return this._params=Ni,this._data="",this._hitLimit=!1,e}},Md=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,i){this.table.fill(e<<4|i)}add(e,i,s,r){this.table[i<<8|e]=s<<4|r}addMany(e,i,s,r){for(let n=0;nh),i=(l,h)=>e.slice(l,h),s=i(32,127),r=i(0,24);r.push(25),r.push.apply(r,i(28,32));let n=i(0,14),o;t.setDefault(1,0),t.addMany(s,0,2,0);for(o in n)t.addMany([24,26,153,154],o,3,0),t.addMany(i(128,144),o,3,0),t.addMany(i(144,152),o,3,0),t.add(156,o,0,0),t.add(27,o,11,1),t.add(157,o,4,8),t.addMany([152,158,159],o,0,7),t.add(155,o,11,3),t.add(144,o,11,9);return t.addMany(r,0,3,0),t.addMany(r,1,3,1),t.add(127,1,0,1),t.addMany(r,8,0,8),t.addMany(r,3,3,3),t.add(127,3,0,3),t.addMany(r,4,3,4),t.add(127,4,0,4),t.addMany(r,6,3,6),t.addMany(r,5,3,5),t.add(127,5,0,5),t.addMany(r,2,3,2),t.add(127,2,0,2),t.add(93,1,4,8),t.addMany(s,8,5,8),t.add(127,8,5,8),t.addMany([156,27,24,26,7],8,6,0),t.addMany(i(28,32),8,0,8),t.addMany([88,94,95],1,0,7),t.addMany(s,7,0,7),t.addMany(r,7,0,7),t.add(156,7,0,0),t.add(127,7,0,7),t.add(91,1,11,3),t.addMany(i(64,127),3,7,0),t.addMany(i(48,60),3,8,4),t.addMany([60,61,62,63],3,9,4),t.addMany(i(48,60),4,8,4),t.addMany(i(64,127),4,7,0),t.addMany([60,61,62,63],4,0,6),t.addMany(i(32,64),6,0,6),t.add(127,6,0,6),t.addMany(i(64,127),6,0,0),t.addMany(i(32,48),3,9,5),t.addMany(i(32,48),5,9,5),t.addMany(i(48,64),5,0,6),t.addMany(i(64,127),5,7,0),t.addMany(i(32,48),4,9,5),t.addMany(i(32,48),1,9,2),t.addMany(i(32,48),2,9,2),t.addMany(i(48,127),2,10,0),t.addMany(i(48,80),1,10,0),t.addMany(i(81,88),1,10,0),t.addMany([89,90,92],1,10,0),t.addMany(i(96,127),1,10,0),t.add(80,1,11,9),t.addMany(r,9,0,9),t.add(127,9,0,9),t.addMany(i(28,32),9,0,9),t.addMany(i(32,48),9,9,12),t.addMany(i(48,60),9,8,10),t.addMany([60,61,62,63],9,9,10),t.addMany(r,11,0,11),t.addMany(i(32,128),11,0,11),t.addMany(i(28,32),11,0,11),t.addMany(r,10,0,10),t.add(127,10,0,10),t.addMany(i(28,32),10,0,10),t.addMany(i(48,60),10,8,10),t.addMany([60,61,62,63],10,0,11),t.addMany(i(32,48),10,9,12),t.addMany(r,12,0,12),t.add(127,12,0,12),t.addMany(i(28,32),12,0,12),t.addMany(i(32,48),12,9,12),t.addMany(i(48,64),12,0,11),t.addMany(i(64,127),12,12,13),t.addMany(i(64,127),10,12,13),t.addMany(i(64,127),9,12,13),t.addMany(r,13,13,13),t.addMany(s,13,13,13),t.add(127,13,0,13),t.addMany([27,156,24,26],13,14,0),t.add(lt,0,2,0),t.add(lt,8,5,8),t.add(lt,6,0,6),t.add(lt,11,0,11),t.add(lt,13,13,13),t}(),Td=class extends j{constructor(e=Rd){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new Ya,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,s,r)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,s)=>{},this._escHandlerFb=i=>{},this._errorHandlerFb=i=>i,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(re(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Bd),this._dcsParser=this._register(new Ed),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,i=[64,126]){let s=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=e.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let n=0;no||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(i[0]>r||r>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return s<<=8,s|=r,s}identToString(e){let i=[];for(;e;)i.push(String.fromCharCode(e&255)),e>>=8;return i.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,i){let s=this._identifier(e,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);let r=this._escHandlers[s];return r.push(i),{dispose:()=>{let n=r.indexOf(i);n!==-1&&r.splice(n,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,i){this._executeHandlers[e.charCodeAt(0)]=i}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,i){let s=this._identifier(e);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);let r=this._csiHandlers[s];return r.push(i),{dispose:()=>{let n=r.indexOf(i);n!==-1&&r.splice(n,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,i){return this._dcsParser.registerHandler(this._identifier(e),i)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,i){return this._oscParser.registerHandler(e,i)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,i,s,r,n){this._parseStack.state=e,this._parseStack.handlers=i,this._parseStack.handlerPos=s,this._parseStack.transition=r,this._parseStack.chunkPos=n}parse(e,i,s){let r=0,n=0,o=0,l;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let h=this._parseStack.handlers,a=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&a>-1){for(;a>=0&&(l=h[a](this._params),l!==!0);a--)if(l instanceof Promise)return this._parseStack.handlerPos=a,l}this._parseStack.handlers=[];break;case 4:if(s===!1&&a>-1){for(;a>=0&&(l=h[a](),l!==!0);a--)if(l instanceof Promise)return this._parseStack.handlerPos=a,l}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],l=this._dcsParser.unhook(r!==24&&r!==26,s),l)return l;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],l=this._oscParser.end(r!==24&&r!==26,s),l)return l;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let h=o;h>4){case 2:for(let d=h+1;;++d){if(d>=i||(r=e[d])<32||r>126&&r=i||(r=e[d])<32||r>126&&r=i||(r=e[d])<32||r>126&&r=i||(r=e[d])<32||r>126&&r=0&&(l=a[c](this._params),l!==!0);c--)if(l instanceof Promise)return this._preserveStack(3,a,c,n,h),l;c<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++h47&&r<60);h--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let _=this._escHandlers[this._collect<<8|r],f=_?_.length-1:-1;for(;f>=0&&(l=_[f](),l!==!0);f--)if(l instanceof Promise)return this._preserveStack(4,_,f,n,h),l;f<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let d=h+1;;++d)if(d>=i||(r=e[d])===24||r===26||r===27||r>127&&r=i||(r=e[d])<32||r>127&&r>4:n>>8}return s}}function Gs(t,e){let i=t.toString(16),s=i.length<2?"0"+i:i;switch(e){case 4:return i[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function Pd(t,e=16){let[i,s,r]=t;return`rgb:${Gs(i,e)}/${Gs(s,e)}/${Gs(r,e)}`}var $d={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Nt=131072,vo=10;function mo(t,e){if(t>24)return e.setWinLines||!1;switch(t){case 1:return!!e.restoreWin;case 2:return!!e.minimizeWin;case 3:return!!e.setWinPosition;case 4:return!!e.setWinSizePixels;case 5:return!!e.raiseWin;case 6:return!!e.lowerWin;case 7:return!!e.refreshWin;case 8:return!!e.setWinSizeChars;case 9:return!!e.maximizeWin;case 10:return!!e.fullscreenWin;case 11:return!!e.getWinState;case 13:return!!e.getWinPosition;case 14:return!!e.getWinSizePixels;case 15:return!!e.getScreenSizePixels;case 16:return!!e.getCellSizePixels;case 18:return!!e.getWinSizeChars;case 19:return!!e.getScreenSizeChars;case 20:return!!e.getIconTitle;case 21:return!!e.getWinTitle;case 22:return!!e.pushTitle;case 23:return!!e.popTitle;case 24:return!!e.setWinLines}return!1}var wo=5e3,So=0,Id=class extends j{constructor(t,e,i,s,r,n,o,l,h=new Td){super(),this._bufferService=t,this._charsetService=e,this._coreService=i,this._logService=s,this._optionsService=r,this._oscLinkService=n,this._coreMouseService=o,this._unicodeService=l,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new th,this._utf8Decoder=new ih,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=me.clone(),this._eraseAttrDataInternal=me.clone(),this._onRequestBell=this._register(new A),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new A),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new A),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new A),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new A),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new A),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new A),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new A),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new A),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new A),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new A),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new A),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new A),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new Xr(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(a=>this._activeBuffer=a.activeBuffer)),this._parser.setCsiHandlerFallback((a,c)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(a),params:c.toArray()})}),this._parser.setEscHandlerFallback(a=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(a)})}),this._parser.setExecuteHandlerFallback(a=>{this._logService.debug("Unknown EXECUTE code: ",{code:a})}),this._parser.setOscHandlerFallback((a,c,_)=>{this._logService.debug("Unknown OSC code: ",{identifier:a,action:c,data:_})}),this._parser.setDcsHandlerFallback((a,c,_)=>{c==="HOOK"&&(_=_.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(a),action:c,payload:_})}),this._parser.setPrintHandler((a,c,_)=>this.print(a,c,_)),this._parser.registerCsiHandler({final:"@"},a=>this.insertChars(a)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},a=>this.scrollLeft(a)),this._parser.registerCsiHandler({final:"A"},a=>this.cursorUp(a)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},a=>this.scrollRight(a)),this._parser.registerCsiHandler({final:"B"},a=>this.cursorDown(a)),this._parser.registerCsiHandler({final:"C"},a=>this.cursorForward(a)),this._parser.registerCsiHandler({final:"D"},a=>this.cursorBackward(a)),this._parser.registerCsiHandler({final:"E"},a=>this.cursorNextLine(a)),this._parser.registerCsiHandler({final:"F"},a=>this.cursorPrecedingLine(a)),this._parser.registerCsiHandler({final:"G"},a=>this.cursorCharAbsolute(a)),this._parser.registerCsiHandler({final:"H"},a=>this.cursorPosition(a)),this._parser.registerCsiHandler({final:"I"},a=>this.cursorForwardTab(a)),this._parser.registerCsiHandler({final:"J"},a=>this.eraseInDisplay(a,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},a=>this.eraseInDisplay(a,!0)),this._parser.registerCsiHandler({final:"K"},a=>this.eraseInLine(a,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},a=>this.eraseInLine(a,!0)),this._parser.registerCsiHandler({final:"L"},a=>this.insertLines(a)),this._parser.registerCsiHandler({final:"M"},a=>this.deleteLines(a)),this._parser.registerCsiHandler({final:"P"},a=>this.deleteChars(a)),this._parser.registerCsiHandler({final:"S"},a=>this.scrollUp(a)),this._parser.registerCsiHandler({final:"T"},a=>this.scrollDown(a)),this._parser.registerCsiHandler({final:"X"},a=>this.eraseChars(a)),this._parser.registerCsiHandler({final:"Z"},a=>this.cursorBackwardTab(a)),this._parser.registerCsiHandler({final:"`"},a=>this.charPosAbsolute(a)),this._parser.registerCsiHandler({final:"a"},a=>this.hPositionRelative(a)),this._parser.registerCsiHandler({final:"b"},a=>this.repeatPrecedingCharacter(a)),this._parser.registerCsiHandler({final:"c"},a=>this.sendDeviceAttributesPrimary(a)),this._parser.registerCsiHandler({prefix:">",final:"c"},a=>this.sendDeviceAttributesSecondary(a)),this._parser.registerCsiHandler({final:"d"},a=>this.linePosAbsolute(a)),this._parser.registerCsiHandler({final:"e"},a=>this.vPositionRelative(a)),this._parser.registerCsiHandler({final:"f"},a=>this.hVPosition(a)),this._parser.registerCsiHandler({final:"g"},a=>this.tabClear(a)),this._parser.registerCsiHandler({final:"h"},a=>this.setMode(a)),this._parser.registerCsiHandler({prefix:"?",final:"h"},a=>this.setModePrivate(a)),this._parser.registerCsiHandler({final:"l"},a=>this.resetMode(a)),this._parser.registerCsiHandler({prefix:"?",final:"l"},a=>this.resetModePrivate(a)),this._parser.registerCsiHandler({final:"m"},a=>this.charAttributes(a)),this._parser.registerCsiHandler({final:"n"},a=>this.deviceStatus(a)),this._parser.registerCsiHandler({prefix:"?",final:"n"},a=>this.deviceStatusPrivate(a)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},a=>this.softReset(a)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},a=>this.setCursorStyle(a)),this._parser.registerCsiHandler({final:"r"},a=>this.setScrollRegion(a)),this._parser.registerCsiHandler({final:"s"},a=>this.saveCursor(a)),this._parser.registerCsiHandler({final:"t"},a=>this.windowOptions(a)),this._parser.registerCsiHandler({final:"u"},a=>this.restoreCursor(a)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},a=>this.insertColumns(a)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},a=>this.deleteColumns(a)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},a=>this.selectProtected(a)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},a=>this.requestMode(a,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},a=>this.requestMode(a,!1)),this._parser.setExecuteHandler(E.BEL,()=>this.bell()),this._parser.setExecuteHandler(E.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(E.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(E.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(E.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(E.BS,()=>this.backspace()),this._parser.setExecuteHandler(E.HT,()=>this.tab()),this._parser.setExecuteHandler(E.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(E.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(us.IND,()=>this.index()),this._parser.setExecuteHandler(us.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(us.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Je(a=>(this.setTitle(a),this.setIconName(a),!0))),this._parser.registerOscHandler(1,new Je(a=>this.setIconName(a))),this._parser.registerOscHandler(2,new Je(a=>this.setTitle(a))),this._parser.registerOscHandler(4,new Je(a=>this.setOrReportIndexedColor(a))),this._parser.registerOscHandler(8,new Je(a=>this.setHyperlink(a))),this._parser.registerOscHandler(10,new Je(a=>this.setOrReportFgColor(a))),this._parser.registerOscHandler(11,new Je(a=>this.setOrReportBgColor(a))),this._parser.registerOscHandler(12,new Je(a=>this.setOrReportCursorColor(a))),this._parser.registerOscHandler(104,new Je(a=>this.restoreIndexedColor(a))),this._parser.registerOscHandler(110,new Je(a=>this.restoreFgColor(a))),this._parser.registerOscHandler(111,new Je(a=>this.restoreBgColor(a))),this._parser.registerOscHandler(112,new Je(a=>this.restoreCursorColor(a))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let a in ke)this._parser.registerEscHandler({intermediates:"(",final:a},()=>this.selectCharset("("+a)),this._parser.registerEscHandler({intermediates:")",final:a},()=>this.selectCharset(")"+a)),this._parser.registerEscHandler({intermediates:"*",final:a},()=>this.selectCharset("*"+a)),this._parser.registerEscHandler({intermediates:"+",final:a},()=>this.selectCharset("+"+a)),this._parser.registerEscHandler({intermediates:"-",final:a},()=>this.selectCharset("-"+a)),this._parser.registerEscHandler({intermediates:".",final:a},()=>this.selectCharset("."+a)),this._parser.registerEscHandler({intermediates:"/",final:a},()=>this.selectCharset("/"+a));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(a=>(this._logService.error("Parsing error: ",a),a)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new go((a,c)=>this.requestStatusString(a,c)))}getAttrData(){return this._curAttrData}_preserveStack(t,e,i,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=t,this._parseStack.cursorStartY=e,this._parseStack.decodedLength=i,this._parseStack.position=s}_logSlowResolvingAsync(t){this._logService.logLevel<=3&&Promise.race([t,new Promise((e,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),wo))]).catch(e=>{if(e!=="#SLOW_TIMEOUT")throw e;console.warn(`async parser handler taking longer than ${wo} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(t,e){let i,s=this._activeBuffer.x,r=this._activeBuffer.y,n=0,o=this._parseStack.paused;if(o){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,e))return this._logSlowResolvingAsync(i),i;s=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,t.length>Nt&&(n=this._parseStack.position+Nt)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof t=="string"?` "${t}"`:` "${Array.prototype.map.call(t,a=>String.fromCharCode(a)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof t=="string"?t.split("").map(a=>a.charCodeAt(0)):t),this._parseBuffer.lengthNt)for(let a=n;a0&&_.getWidth(this._activeBuffer.x-1)===2&&_.setCellFromCodepoint(this._activeBuffer.x-1,0,1,c);let f=this._parser.precedingJoinState;for(let d=e;dl){if(h){let R=_,D=this._activeBuffer.x-k;for(this._activeBuffer.x=k,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),k>0&&_ instanceof Oi&&_.copyCellsFrom(R,D,0,k,!1);D=0;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,c);continue}if(a&&(_.insertCells(this._activeBuffer.x,r-k,this._activeBuffer.getNullCell(c)),_.getWidth(l-1)===2&&_.setCellFromCodepoint(l-1,0,1,c)),_.setCellFromCodepoint(this._activeBuffer.x++,s,r,c),r>0)for(;--r;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,c)}this._parser.precedingJoinState=f,this._activeBuffer.x0&&_.getWidth(this._activeBuffer.x)===0&&!_.hasContent(this._activeBuffer.x)&&_.setCellFromCodepoint(this._activeBuffer.x,0,1,c),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(t,e){return t.final==="t"&&!t.prefix&&!t.intermediates?this._parser.registerCsiHandler(t,i=>mo(i.params[0],this._optionsService.rawOptions.windowOptions)?e(i):!0):this._parser.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._parser.registerDcsHandler(t,new go(e))}registerEscHandler(t,e){return this._parser.registerEscHandler(t,e)}registerOscHandler(t,e){return this._parser.registerOscHandler(t,new Je(e))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-t),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(t=this._bufferService.cols-1){this._activeBuffer.x=Math.min(t,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(t,e){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=t,this._activeBuffer.y=this._activeBuffer.scrollTop+e):(this._activeBuffer.x=t,this._activeBuffer.y=e),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(t,e){this._restrictCursor(),this._setCursor(this._activeBuffer.x+t,this._activeBuffer.y+e)}cursorUp(t){let e=this._activeBuffer.y-this._activeBuffer.scrollTop;return e>=0?this._moveCursor(0,-Math.min(e,t.params[0]||1)):this._moveCursor(0,-(t.params[0]||1)),!0}cursorDown(t){let e=this._activeBuffer.scrollBottom-this._activeBuffer.y;return e>=0?this._moveCursor(0,Math.min(e,t.params[0]||1)):this._moveCursor(0,t.params[0]||1),!0}cursorForward(t){return this._moveCursor(t.params[0]||1,0),!0}cursorBackward(t){return this._moveCursor(-(t.params[0]||1),0),!0}cursorNextLine(t){return this.cursorDown(t),this._activeBuffer.x=0,!0}cursorPrecedingLine(t){return this.cursorUp(t),this._activeBuffer.x=0,!0}cursorCharAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(t){return this._setCursor(t.length>=2?(t.params[1]||1)-1:0,(t.params[0]||1)-1),!0}charPosAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(t){return this._moveCursor(t.params[0]||1,0),!0}linePosAbsolute(t){return this._setCursor(this._activeBuffer.x,(t.params[0]||1)-1),!0}vPositionRelative(t){return this._moveCursor(0,t.params[0]||1),!0}hVPosition(t){return this.cursorPosition(t),!0}tabClear(t){let e=t.params[0];return e===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:e===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(t){let e=t.params[0];return e===1&&(this._curAttrData.bg|=536870912),(e===2||e===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(t,e,i,s=!1,r=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);n.replaceCells(e,i,this._activeBuffer.getNullCell(this._eraseAttrData()),r),s&&(n.isWrapped=!1)}_resetBufferLine(t,e=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),e),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+t),i.isWrapped=!1)}eraseInDisplay(t,e=!1){this._restrictCursor(this._bufferService.cols);let i;switch(t.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);i=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+i)?.getTrimmedLength(););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(0)}break;case 3:let s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,0),this._onScroll.fire(0));break}return!0}eraseInLine(t,e=!1){switch(this._restrictCursor(this._bufferService.cols),t.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,e);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,e);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(t){this._restrictCursor();let e=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y65535?2:1}let h=l;for(let a=1;a0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(E.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(E.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(t){return t.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(E.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(E.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(t.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(E.ESC+"[>83;40003;0c")),!0}_is(t){return(this._optionsService.rawOptions.termName+"").indexOf(t)===0}setMode(t){for(let e=0;e(y[y.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",y[y.SET=1]="SET",y[y.RESET=2]="RESET",y[y.PERMANENTLY_SET=3]="PERMANENTLY_SET",y[y.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(i||={});let s=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:n}=this._coreMouseService,o=this._coreService,{buffers:l,cols:h}=this._bufferService,{active:a,alt:c}=l,_=this._optionsService.rawOptions,f=(y,k)=>(o.triggerDataEvent(`${E.ESC}[${e?"":"?"}${y};${k}$y`),!0),d=y=>y?1:2,m=t.params[0];return e?m===2?f(m,4):m===4?f(m,d(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,d(_.convertEol)):f(m,0):m===1?f(m,d(s.applicationCursorKeys)):m===3?f(m,_.windowOptions.setWinLines?h===80?2:h===132?1:0:0):m===6?f(m,d(s.origin)):m===7?f(m,d(s.wraparound)):m===8?f(m,3):m===9?f(m,d(r==="X10")):m===12?f(m,d(_.cursorBlink)):m===25?f(m,d(!o.isCursorHidden)):m===45?f(m,d(s.reverseWraparound)):m===66?f(m,d(s.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,d(r==="VT200")):m===1002?f(m,d(r==="DRAG")):m===1003?f(m,d(r==="ANY")):m===1004?f(m,d(s.sendFocus)):m===1005?f(m,4):m===1006?f(m,d(n==="SGR")):m===1015?f(m,4):m===1016?f(m,d(n==="SGR_PIXELS")):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,d(a===c)):m===2004?f(m,d(s.bracketedPasteMode)):m===2026?f(m,d(s.synchronizedOutput)):f(m,0)}_updateAttrColor(t,e,i,s,r){return e===2?(t|=50331648,t&=-16777216,t|=ji.fromColorRGB([i,s,r])):e===5&&(t&=-50331904,t|=33554432|i&255),t}_extractColor(t,e,i){let s=[0,0,-1,0,0,0],r=0,n=0;do{if(s[n+r]=t.params[e+n],t.hasSubParams(e+n)){let o=t.getSubParams(e+n),l=0;do s[1]===5&&(r=1),s[n+l+1+r]=o[l];while(++l=2||s[1]===2&&n+r>=5)break;s[1]&&(r=1)}while(++n+e5)&&(t=1),e.extended.underlineStyle=t,e.fg|=268435456,t===0&&(e.fg&=-268435457),e.updateExtended()}_processSGR0(t){t.fg=me.fg,t.bg=me.bg,t.extended=t.extended.clone(),t.extended.underlineStyle=0,t.extended.underlineColor&=-67108864,t.updateExtended()}charAttributes(t){if(t.length===1&&t.params[0]===0)return this._processSGR0(this._curAttrData),!0;let e=t.length,i,s=this._curAttrData;for(let r=0;r=30&&i<=37?(s.fg&=-50331904,s.fg|=16777216|i-30):i>=40&&i<=47?(s.bg&=-50331904,s.bg|=16777216|i-40):i>=90&&i<=97?(s.fg&=-50331904,s.fg|=16777216|i-90|8):i>=100&&i<=107?(s.bg&=-50331904,s.bg|=16777216|i-100|8):i===0?this._processSGR0(s):i===1?s.fg|=134217728:i===3?s.bg|=67108864:i===4?(s.fg|=268435456,this._processUnderline(t.hasSubParams(r)?t.getSubParams(r)[0]:1,s)):i===5?s.fg|=536870912:i===7?s.fg|=67108864:i===8?s.fg|=1073741824:i===9?s.fg|=2147483648:i===2?s.bg|=134217728:i===21?this._processUnderline(2,s):i===22?(s.fg&=-134217729,s.bg&=-134217729):i===23?s.bg&=-67108865:i===24?(s.fg&=-268435457,this._processUnderline(0,s)):i===25?s.fg&=-536870913:i===27?s.fg&=-67108865:i===28?s.fg&=-1073741825:i===29?s.fg&=2147483647:i===39?(s.fg&=-67108864,s.fg|=me.fg&16777215):i===49?(s.bg&=-67108864,s.bg|=me.bg&16777215):i===38||i===48||i===58?r+=this._extractColor(t,r,s):i===53?s.bg|=1073741824:i===55?s.bg&=-1073741825:i===59?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):i===100?(s.fg&=-67108864,s.fg|=me.fg&16777215,s.bg&=-67108864,s.bg|=me.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(t){switch(t.params[0]){case 5:this._coreService.triggerDataEvent(`${E.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${E.ESC}[${e};${i}R`);break}return!0}deviceStatusPrivate(t){switch(t.params[0]){case 6:let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${E.ESC}[?${e};${i}R`);break}return!0}softReset(t){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=me.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(t){let e=t.length===0?1:t.params[0];if(e===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(e){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let i=e%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(t){let e=t.params[0]||1,i;return(t.length<2||(i=t.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>e&&(this._activeBuffer.scrollTop=e-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(t){if(!mo(t.params[0],this._optionsService.rawOptions.windowOptions))return!0;let e=t.length>1?t.params[1]:0;switch(t.params[0]){case 14:e!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${E.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(e===0||e===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>vo&&this._windowTitleStack.shift()),(e===0||e===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>vo&&this._iconNameStack.shift());break;case 23:(e===0||e===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(e===0||e===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(t){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(t){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(t){return this._windowTitle=t,this._onTitleChange.fire(t),!0}setIconName(t){return this._iconName=t,!0}setOrReportIndexedColor(t){let e=[],i=t.split(";");for(;i.length>1;){let s=i.shift(),r=i.shift();if(/^\d+$/.exec(s)){let n=parseInt(s);if(bo(n))if(r==="?")e.push({type:0,index:n});else{let o=po(r);o&&e.push({type:1,index:n,color:o})}}}return e.length&&this._onColor.fire(e),!0}setHyperlink(t){let e=t.indexOf(";");if(e===-1)return!0;let i=t.slice(0,e).trim(),s=t.slice(e+1);return s?this._createHyperlink(i,s):i.trim()?!1:this._finishHyperlink()}_createHyperlink(t,e){this._getCurrentLinkId()&&this._finishHyperlink();let i=t.split(":"),s,r=i.findIndex(n=>n.startsWith("id="));return r!==-1&&(s=i[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:e}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(t,e){let i=t.split(";");for(let s=0;s=this._specialColors.length);++s,++e)if(i[s]==="?")this._onColor.fire([{type:0,index:this._specialColors[e]}]);else{let r=po(i[s]);r&&this._onColor.fire([{type:1,index:this._specialColors[e],color:r}])}return!0}setOrReportFgColor(t){return this._setOrReportSpecialColor(t,0)}setOrReportBgColor(t){return this._setOrReportSpecialColor(t,1)}setOrReportCursorColor(t){return this._setOrReportSpecialColor(t,2)}restoreIndexedColor(t){if(!t)return this._onColor.fire([{type:2}]),!0;let e=[],i=t.split(";");for(let s=0;s=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let t=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,t,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=me.clone(),this._eraseAttrDataInternal=me.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(t){return this._charsetService.setgLevel(t),!0}screenAlignmentPattern(){let t=new ct;t.content=1<<22|69,t.fg=this._curAttrData.fg,t.bg=this._curAttrData.bg,this._setCursor(0,0);for(let e=0;e(this._coreService.triggerDataEvent(`${E.ESC}${o}${E.ESC}\\`),!0),s=this._bufferService.buffer,r=this._optionsService.rawOptions;return i(t==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:t==='"p'?'P1$r61;1"p':t==="r"?`P1$r${s.scrollTop+1};${s.scrollBottom+1}r`:t==="m"?"P1$r0m":t===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(t,e){this._dirtyRowTracker.markRangeDirty(t,e)}},Xr=class{constructor(t){this._bufferService=t,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(t){tthis.end&&(this.end=t)}markRangeDirty(t,e){t>e&&(So=t,t=e,e=So),tthis.end&&(this.end=e)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Xr=ue([P(0,Ve)],Xr);function bo(t){return 0<=t&&t<256}var Od=5e7,yo=12,Fd=50,Nd=class extends j{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new A),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,i){if(i!==void 0&&this._syncCalls>i){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let s;for(;s=this._writeBuffer.shift();){this._action(s);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,i){if(this._pendingData>Od)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i)}_innerWrite(e=0,i=!0){let s=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],n=this._action(r,i);if(n){let l=h=>performance.now()-s>=yo?setTimeout(()=>this._innerWrite(0,h)):this._innerWrite(s,h);n.catch(h=>(queueMicrotask(()=>{throw h}),Promise.resolve(!1))).then(l);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-s>=yo)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>Fd&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},Jr=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let i=this._bufferService.buffer;if(e.id===void 0){let h=i.addMarker(i.ybase+i.y),a={data:e,id:this._nextId++,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(a,h)),this._dataByLinkId.set(a.id,a),a.id}let s=e,r=this._getEntryIdKey(s),n=this._entriesWithId.get(r);if(n)return this.addLineToLink(n.id,i.ybase+i.y),n.id;let o=i.addMarker(i.ybase+i.y),l={id:this._nextId++,key:this._getEntryIdKey(s),data:s,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(l,o)),this._entriesWithId.set(l.key,l),this._dataByLinkId.set(l.id,l),l.id}addLineToLink(e,i){let s=this._dataByLinkId.get(e);if(s&&s.lines.every(r=>r.line!==i)){let r=this._bufferService.buffer.addMarker(i);s.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(s,r))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,i){let s=e.lines.indexOf(i);s!==-1&&(e.lines.splice(s,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Jr=ue([P(0,Ve)],Jr);var Co=!1,Wd=class extends j{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Si),this._onBinary=this._register(new A),this.onBinary=this._onBinary.event,this._onData=this._register(new A),this.onData=this._onData.event,this._onLineFeed=this._register(new A),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new A),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new A),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new A),this._instantiationService=new cd,this.optionsService=this._register(new Sd(e)),this._instantiationService.setService(je,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Vr)),this._instantiationService.setService(Ve,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Kr)),this._instantiationService.setService(fa,this._logService),this.coreService=this._register(this._instantiationService.createInstance(jr)),this._instantiationService.setService(li,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Gr)),this._instantiationService.setService(_a,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(ei)),this._instantiationService.setService(oh,this.unicodeService),this._charsetService=this._instantiationService.createInstance(kd),this._instantiationService.setService(nh,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Jr),this._instantiationService.setService(ga,this._oscLinkService),this._inputHandler=this._register(new Id(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Fe.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Fe.forward(this._bufferService.onResize,this._onResize)),this._register(Fe.forward(this.coreService.onData,this._onData)),this._register(Fe.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new Nd((i,s)=>this._inputHandler.parse(i,s))),this._register(Fe.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new A),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let i in e)this.optionsService.options[i]=e[i]}write(e,i){this._writeBuffer.write(e,i)}writeSync(e,i){this._logService.logLevel<=3&&!Co&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Co=!0),this._writeBuffer.writeSync(e,i)}input(e,i=!0){this.coreService.triggerDataEvent(e,i)}resize(e,i){isNaN(e)||isNaN(i)||(e=Math.max(e,ja),i=Math.max(i,Ga),this._bufferService.resize(e,i))}scroll(e,i=!1){this._bufferService.scroll(e,i)}scrollLines(e,i){this._bufferService.scrollLines(e,i)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i)}registerEscHandler(e,i){return this._inputHandler.registerEscHandler(e,i)}registerDcsHandler(e,i){return this._inputHandler.registerDcsHandler(e,i)}registerCsiHandler(e,i){return this._inputHandler.registerCsiHandler(e,i)}registerOscHandler(e,i){return this._inputHandler.registerOscHandler(e,i)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,i=this.optionsService.rawOptions.windowsPty;i&&i.buildNumber!==void 0&&i.buildNumber!==void 0?e=i.backend==="conpty"&&i.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(fo.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(fo(this._bufferService),!1))),this._windowsWrappingHeuristics.value=re(()=>{for(let i of e)i.dispose()})}}},zd={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function Hd(t,e,i,s){let r={type:0,cancel:!1,key:void 0},n=(t.shiftKey?1:0)|(t.altKey?2:0)|(t.ctrlKey?4:0)|(t.metaKey?8:0);switch(t.keyCode){case 0:t.key==="UIKeyInputUpArrow"?e?r.key=E.ESC+"OA":r.key=E.ESC+"[A":t.key==="UIKeyInputLeftArrow"?e?r.key=E.ESC+"OD":r.key=E.ESC+"[D":t.key==="UIKeyInputRightArrow"?e?r.key=E.ESC+"OC":r.key=E.ESC+"[C":t.key==="UIKeyInputDownArrow"&&(e?r.key=E.ESC+"OB":r.key=E.ESC+"[B");break;case 8:r.key=t.ctrlKey?"\b":E.DEL,t.altKey&&(r.key=E.ESC+r.key);break;case 9:if(t.shiftKey){r.key=E.ESC+"[Z";break}r.key=E.HT,r.cancel=!0;break;case 13:r.key=t.altKey?E.ESC+E.CR:E.CR,r.cancel=!0;break;case 27:r.key=E.ESC,t.altKey&&(r.key=E.ESC+E.ESC),r.cancel=!0;break;case 37:if(t.metaKey)break;n?r.key=E.ESC+"[1;"+(n+1)+"D":e?r.key=E.ESC+"OD":r.key=E.ESC+"[D";break;case 39:if(t.metaKey)break;n?r.key=E.ESC+"[1;"+(n+1)+"C":e?r.key=E.ESC+"OC":r.key=E.ESC+"[C";break;case 38:if(t.metaKey)break;n?r.key=E.ESC+"[1;"+(n+1)+"A":e?r.key=E.ESC+"OA":r.key=E.ESC+"[A";break;case 40:if(t.metaKey)break;n?r.key=E.ESC+"[1;"+(n+1)+"B":e?r.key=E.ESC+"OB":r.key=E.ESC+"[B";break;case 45:!t.shiftKey&&!t.ctrlKey&&(r.key=E.ESC+"[2~");break;case 46:n?r.key=E.ESC+"[3;"+(n+1)+"~":r.key=E.ESC+"[3~";break;case 36:n?r.key=E.ESC+"[1;"+(n+1)+"H":e?r.key=E.ESC+"OH":r.key=E.ESC+"[H";break;case 35:n?r.key=E.ESC+"[1;"+(n+1)+"F":e?r.key=E.ESC+"OF":r.key=E.ESC+"[F";break;case 33:t.shiftKey?r.type=2:t.ctrlKey?r.key=E.ESC+"[5;"+(n+1)+"~":r.key=E.ESC+"[5~";break;case 34:t.shiftKey?r.type=3:t.ctrlKey?r.key=E.ESC+"[6;"+(n+1)+"~":r.key=E.ESC+"[6~";break;case 112:n?r.key=E.ESC+"[1;"+(n+1)+"P":r.key=E.ESC+"OP";break;case 113:n?r.key=E.ESC+"[1;"+(n+1)+"Q":r.key=E.ESC+"OQ";break;case 114:n?r.key=E.ESC+"[1;"+(n+1)+"R":r.key=E.ESC+"OR";break;case 115:n?r.key=E.ESC+"[1;"+(n+1)+"S":r.key=E.ESC+"OS";break;case 116:n?r.key=E.ESC+"[15;"+(n+1)+"~":r.key=E.ESC+"[15~";break;case 117:n?r.key=E.ESC+"[17;"+(n+1)+"~":r.key=E.ESC+"[17~";break;case 118:n?r.key=E.ESC+"[18;"+(n+1)+"~":r.key=E.ESC+"[18~";break;case 119:n?r.key=E.ESC+"[19;"+(n+1)+"~":r.key=E.ESC+"[19~";break;case 120:n?r.key=E.ESC+"[20;"+(n+1)+"~":r.key=E.ESC+"[20~";break;case 121:n?r.key=E.ESC+"[21;"+(n+1)+"~":r.key=E.ESC+"[21~";break;case 122:n?r.key=E.ESC+"[23;"+(n+1)+"~":r.key=E.ESC+"[23~";break;case 123:n?r.key=E.ESC+"[24;"+(n+1)+"~":r.key=E.ESC+"[24~";break;default:if(t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey)t.keyCode>=65&&t.keyCode<=90?r.key=String.fromCharCode(t.keyCode-64):t.keyCode===32?r.key=E.NUL:t.keyCode>=51&&t.keyCode<=55?r.key=String.fromCharCode(t.keyCode-51+27):t.keyCode===56?r.key=E.DEL:t.keyCode===219?r.key=E.ESC:t.keyCode===220?r.key=E.FS:t.keyCode===221&&(r.key=E.GS);else if((!i||s)&&t.altKey&&!t.metaKey){let o=zd[t.keyCode]?.[t.shiftKey?1:0];if(o)r.key=E.ESC+o;else if(t.keyCode>=65&&t.keyCode<=90){let l=t.ctrlKey?t.keyCode-64:t.keyCode+32,h=String.fromCharCode(l);t.shiftKey&&(h=h.toUpperCase()),r.key=E.ESC+h}else if(t.keyCode===32)r.key=E.ESC+(t.ctrlKey?E.NUL:" ");else if(t.key==="Dead"&&t.code.startsWith("Key")){let l=t.code.slice(3,4);t.shiftKey||(l=l.toLowerCase()),r.key=E.ESC+l,r.cancel=!0}}else i&&!t.altKey&&!t.ctrlKey&&!t.shiftKey&&t.metaKey?t.keyCode===65&&(r.type=1):t.key&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&t.keyCode>=48&&t.key.length===1?r.key=t.key:t.key&&t.ctrlKey&&(t.key==="_"&&(r.key=E.US),t.key==="@"&&(r.key=E.NUL));break}return r}var ge=0,Ud=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new ks,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new ks,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((n,o)=>this._getKey(n)-this._getKey(o)),i=0,s=0,r=new Array(this._array.length+this._insertedValues.length);for(let n=0;n=this._array.length||this._getKey(e[i])<=this._getKey(this._array[s])?(r[n]=e[i],i++):r[n]=this._array[s++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let i=this._getKey(e);if(i===void 0||(ge=this._search(i),ge===-1)||this._getKey(this._array[ge])!==i)return!1;do if(this._array[ge]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(ge),!0;while(++gen-o),i=0,s=new Array(this._array.length-e.length),r=0;for(let n=0;n0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(ge=this._search(e),!(ge<0||ge>=this._array.length)&&this._getKey(this._array[ge])===e))do yield this._array[ge];while(++ge=this._array.length)&&this._getKey(this._array[ge])===e))do i(this._array[ge]);while(++ge=i;){let r=i+s>>1,n=this._getKey(this._array[r]);if(n>e)s=r-1;else if(n0&&this._getKey(this._array[r-1])===e;)r--;return r}}return i}},Ys=0,xo=0,qd=class extends j{constructor(){super(),this._decorations=new Ud(t=>t?.marker.line),this._onDecorationRegistered=this._register(new A),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new A),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(re(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(t){if(t.marker.isDisposed)return;let e=new Kd(t);if(e){let i=e.marker.onDispose(()=>e.dispose()),s=e.onDispose(()=>{s.dispose(),e&&(this._decorations.delete(e)&&this._onDecorationRemoved.fire(e),i.dispose())});this._decorations.insert(e),this._onDecorationRegistered.fire(e)}return e}reset(){for(let t of this._decorations.values())t.dispose();this._decorations.clear()}*getDecorationsAtCell(t,e,i){let s=0,r=0;for(let n of this._decorations.getKeyIterator(e))s=n.options.x??0,r=s+(n.options.width??1),t>=s&&t{Ys=r.options.x??0,xo=Ys+(r.options.width??1),t>=Ys&&t=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let n=r-this._lastRefreshMs,o=this._debounceThresholdMS-n;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i)}},ko=20,Ls=class extends j{constructor(t,e,i,s){super(),this._terminal=t,this._coreBrowserService=i,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;nthis._handleBoundaryFocus(n,0),this._bottomBoundaryFocusListener=n=>this._handleBoundaryFocus(n,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new jd(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(n=>this._handleResize(n.rows))),this._register(this._terminal.onRender(n=>this._refreshRows(n.start,n.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(n=>this._handleChar(n))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
+`))),this._register(this._terminal.onA11yTab(n=>this._handleTab(n))),this._register(this._terminal.onKey(n=>this._handleKey(n.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(H(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(re(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(t){for(let e=0;e0?this._charsToConsume.shift()!==t&&(this._charsToAnnounce+=t):this._charsToAnnounce+=t,t===`
+`&&(this._liveRegionLineCount++,this._liveRegionLineCount===ko+1&&(this._liveRegion.textContent+=vr.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(t){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(t)||this._charsToConsume.push(t)}_refreshRows(t,e){this._liveRegionDebouncer.refresh(t,e,this._terminal.rows)}_renderRows(t,e){let i=this._terminal.buffer,s=i.lines.length.toString();for(let r=t;r<=e;r++){let n=i.lines.get(i.ydisp+r),o=[],l=n?.translateToString(!0,void 0,void 0,o)||"",h=(i.ydisp+r+1).toString(),a=this._rowElements[r];a&&(l.length===0?(a.textContent=" ",this._rowColumns.set(a,[0,1])):(a.textContent=l,this._rowColumns.set(a,o)),a.setAttribute("aria-posinset",h),a.setAttribute("aria-setsize",s),this._alignRowWidth(a))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(t,e){let i=t.target,s=this._rowElements[e===0?1:this._rowElements.length-2],r=i.getAttribute("aria-posinset"),n=e===0?"1":`${this._terminal.buffer.lines.length}`;if(r===n||t.relatedTarget!==s)return;let o,l;if(e===0?(o=i,l=this._rowElements.pop(),this._rowContainer.removeChild(l)):(o=this._rowElements.shift(),l=i,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),l.removeEventListener("focus",this._bottomBoundaryFocusListener),e===0){let h=this._createAccessibilityTreeNode();this._rowElements.unshift(h),this._rowContainer.insertAdjacentElement("afterbegin",h)}else{let h=this._createAccessibilityTreeNode();this._rowElements.push(h),this._rowContainer.appendChild(h)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(e===0?-1:1),this._rowElements[e===0?1:this._rowElements.length-2].focus(),t.preventDefault(),t.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let t=this._coreBrowserService.mainDocument.getSelection();if(!t)return;if(t.isCollapsed){this._rowContainer.contains(t.anchorNode)&&this._terminal.clearSelection();return}if(!t.anchorNode||!t.focusNode){console.error("anchorNode and/or focusNode are null");return}let e={node:t.anchorNode,offset:t.anchorOffset},i={node:t.focusNode,offset:t.focusOffset};if((e.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||e.node===i.node&&e.offset>i.offset)&&([e,i]=[i,e]),e.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(e={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(e.node))return;let s=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:s,offset:s.textContent?.length??0}),!this._rowContainer.contains(i.node))return;let r=({node:l,offset:h})=>{let a=l instanceof Text?l.parentNode:l,c=parseInt(a?.getAttribute("aria-posinset"),10)-1;if(isNaN(c))return console.warn("row is invalid. Race condition?"),null;let _=this._rowColumns.get(a);if(!_)return console.warn("columns is null. Race condition?"),null;let f=h<_.length?_[h]:_.slice(-1)[0]+1;return f>=this._terminal.cols&&(++c,f=0),{row:c,column:f}},n=r(e),o=r(i);if(!(!n||!o)){if(n.row>o.row||n.row===o.row&&n.column>=o.column)throw new Error("invalid range");this._terminal.select(n.column,n.row,(o.row-n.row)*this._terminal.cols-n.column+o.column)}}_handleResize(t){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;et;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let t=this._coreBrowserService.mainDocument.createElement("div");return t.setAttribute("role","listitem"),t.tabIndex=-1,this._refreshRowDimensions(t),t}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let t=0;t{oi(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(H(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(H(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(H(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(H(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(t){this._lastMouseEvent=t;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;let i=t.composedPath();for(let s=0;s{s?.forEach(r=>{r.link.dispose&&r.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=t.y);let i=!1;for(let[s,r]of this._linkProviderService.linkProviders.entries())e?this._activeProviderReplies?.get(s)&&(i=this._checkLinkProviderResult(s,t,i)):r.provideLinks(t.y,n=>{if(this._isMouseOut)return;let o=n?.map(l=>({link:l}));this._activeProviderReplies?.set(s,o),i=this._checkLinkProviderResult(s,t,i),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(t.y,this._activeProviderReplies)})}_removeIntersectingLinks(t,e){let i=new Set;for(let s=0;st?this._bufferService.cols:o.link.range.end.x;for(let a=l;a<=h;a++){if(i.has(a)){r.splice(n--,1);break}i.add(a)}}}}_checkLinkProviderResult(t,e,i){if(!this._activeProviderReplies)return i;let s=this._activeProviderReplies.get(t),r=!1;for(let n=0;nthis._linkAtPosition(o.link,e));n&&(i=!0,this._handleNewLink(n))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let n=0;nthis._linkAtPosition(l.link,e));if(o){i=!0,this._handleNewLink(o);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(t){if(!this._currentLink)return;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);e&&this._mouseDownLink&&Gd(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(t,this._currentLink.link.text)}_clearCurrentLink(t,e){!this._currentLink||!this._lastMouseEvent||(!t||!e||this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,oi(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(t){if(!this._lastMouseEvent)return;let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(t.link,e)&&(this._currentLink=t,this._currentLink.state={decorations:{underline:t.link.decorations===void 0?!0:t.link.decorations.underline,pointerCursor:t.link.decorations===void 0?!0:t.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,t.link,this._lastMouseEvent),t.link.decorations={},Object.defineProperties(t.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:i=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:i=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(t.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let s=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(s,r),this._lastMouseEvent)){let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._askForLink(n,!1)}})))}_linkHover(t,e,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&t.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(i,e.text)}_fireUnderlineEvent(t,e){let i=t.range,s=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-s-1,i.end.x,i.end.y-s-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(t,e,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&t.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(i,e.text)}_linkAtPosition(t,e){let i=t.range.start.y*this._bufferService.cols+t.range.start.x,s=t.range.end.y*this._bufferService.cols+t.range.end.x,r=e.y*this._bufferService.cols+e.x;return i<=r&&r<=s}_positionFromMouseEvent(t,e,i){let s=i.getCoords(t,e,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(t,e,i,s,r){return{x1:t,y1:e,x2:i,y2:s,cols:this._bufferService.cols,fg:r}}};Zr=ue([P(1,gn),P(2,It),P(3,Ve),P(4,va)],Zr);function Gd(t,e){return t.text===e.text&&t.range.start.x===e.range.start.x&&t.range.start.y===e.range.start.y&&t.range.end.x===e.range.end.x&&t.range.end.y===e.range.end.y}var Yd=class extends Wd{constructor(e={}){super(e),this._linkifier=this._register(new Si),this.browser=Ia,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Si),this._onCursorMove=this._register(new A),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new A),this.onKey=this._onKey.event,this._onRender=this._register(new A),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new A),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new A),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new A),this.onBell=this._onBell.event,this._onFocus=this._register(new A),this._onBlur=this._register(new A),this._onA11yCharEmitter=this._register(new A),this._onA11yTabEmitter=this._register(new A),this._onWillOpen=this._register(new A),this._setup(),this._decorationService=this._instantiationService.createInstance(qd),this._instantiationService.setService(Gi,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Fc),this._instantiationService.setService(va,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(wr)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(i=>this.refresh(i?.start??0,i?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(i=>this._reportWindowsOptions(i))),this._register(this._inputHandler.onColor(i=>this._handleColorEvent(i))),this._register(Fe.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Fe.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Fe.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Fe.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(i=>this._afterResize(i.cols,i.rows))),this._register(re(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let i of e){let s,r="";switch(i.index){case 256:s="foreground",r="10";break;case 257:s="background",r="11";break;case 258:s="cursor",r="12";break;default:s="ansi",r="4;"+i.index}switch(i.type){case 0:let n=ie.toColorRGB(s==="ansi"?this._themeService.colors.ansi[i.index]:this._themeService.colors[s]);this.coreService.triggerDataEvent(`${E.ESC}]${r};${Pd(n)}${Pa.ST}`);break;case 1:if(s==="ansi")this._themeService.modifyColors(o=>o.ansi[i.index]=Se.toColor(...i.color));else{let o=s;this._themeService.modifyColors(l=>l[o]=Se.toColor(...i.color))}break;case 2:this._themeService.restoreColor(i.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Ls,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(E.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(E.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,i=this.buffer.lines.get(e);if(!i)return;let s=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,n=i.getWidth(s),o=this._renderService.dimensions.css.cell.width*n,l=this.buffer.y*this._renderService.dimensions.css.cell.height,h=s*this._renderService.dimensions.css.cell.width;this.textarea.style.left=h+"px",this.textarea.style.top=l+"px",this.textarea.style.width=o+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(H(this.element,"copy",i=>{this.hasSelection()&&Ql(i,this._selectionService)}));let e=i=>eh(i,this.textarea,this.coreService,this.optionsService);this._register(H(this.textarea,"paste",e)),this._register(H(this.element,"paste",e)),Oa?this._register(H(this.element,"mousedown",i=>{i.button===2&&Pn(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(H(this.element,"contextmenu",i=>{Pn(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Cn&&this._register(H(this.element,"auxclick",i=>{i.button===1&&la(i,this.textarea,this.screenElement)}))}_bindKeys(){this._register(H(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(H(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(H(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(H(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(H(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(H(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(H(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let i=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(H(this.screenElement,"mousemove",n=>this.updateCursorStyle(n))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement);let s=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",pr.get()),Wa||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>s.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Ic,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService($t,this._coreBrowserService),this._register(H(this.textarea,"focus",n=>this._handleTextAreaFocus(n))),this._register(H(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Wr,this._document,this._helperContainer),this._instantiationService.setService(Ds,this._charSizeService),this._themeService=this._instantiationService.createInstance(qr),this._instantiationService.setService(bi,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Cs),this._instantiationService.setService(pa,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Hr,this.rows,this.screenElement)),this._instantiationService.setService(It,this._renderService),this._register(this._renderService.onRenderedViewportChange(n=>this._onRender.fire(n))),this.onResize(n=>this._renderService.resize(n.cols,n.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Or,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(zr),this._instantiationService.setService(gn,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Zr,this.screenElement));this.element.appendChild(i);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance($r,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(n=>{super.scrollLines(n,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Ur,this.element,this.screenElement,r)),this._instantiationService.setService(lh,this._selectionService),this._register(this._selectionService.onRequestScrollLines(n=>this.scrollLines(n.amount,n.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(n=>this._renderService.handleSelectionChanged(n.start,n.end,n.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(n=>{this.textarea.value=n,this.textarea.focus(),this.textarea.select()})),this._register(Fe.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Ir,this.screenElement)),this._register(H(this.element,"mousedown",n=>this._selectionService.handleMouseDown(n))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Ls,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",n=>this._handleScreenReaderModeOptionChange(n))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ys,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",n=>{!this._overviewRulerRenderer&&n&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ys,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Nr,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,i=this.element;function s(o){let l=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!l)return!1;let h,a;switch(o.overrideType||o.type){case"mousemove":a=32,o.buttons===void 0?(h=3,o.button!==void 0&&(h=o.button<3?o.button:3)):h=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":a=0,h=o.button<3?o.button:3;break;case"mousedown":a=1,h=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let c=o.deltaY;if(c===0||e.coreMouseService.consumeWheelEvent(o,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;a=c<0?0:1,h=4;break;default:return!1}return a===void 0||h===void 0||h>4?!1:e.coreMouseService.triggerMouseEvent({col:l.col,row:l.row,x:l.x,y:l.y,button:h,action:a,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},n={mouseup:o=>(s(o),o.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(o)),wheel:o=>(s(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&s(o)},mousemove:o=>{o.buttons||s(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),o&8?r.mousemove||(i.addEventListener("mousemove",n.mousemove),r.mousemove=n.mousemove):(i.removeEventListener("mousemove",r.mousemove),r.mousemove=null),o&16?r.wheel||(i.addEventListener("wheel",n.wheel,{passive:!1}),r.wheel=n.wheel):(i.removeEventListener("wheel",r.wheel),r.wheel=null),o&2?r.mouseup||(r.mouseup=n.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),o&4?r.mousedrag||(r.mousedrag=n.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(H(i,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return s(o),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(o)})),this._register(H(i,"wheel",o=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(o,!0);let l=E.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(l,!0),this.cancel(o,!0)}}},{passive:!1}))}refresh(e,i){this._renderService?.refreshRows(e,i)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,i){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,i),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i)}paste(e){aa(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let i=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),i}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,i,s){this._selectionService.setSelection(e,i,s)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,i){this._selectionService?.selectLines(e,i)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let i=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!i&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!i&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let s=Hd(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),s.type===3||s.type===2){let r=this.rows-1;return this.scrollLines(s.type===2?-r:r),this.cancel(e,!0)}if(s.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(s.cancel&&this.cancel(e,!0),!s.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((s.key===E.ETX||s.key===E.CR)&&(this.textarea.value=""),this._onKey.fire({key:s.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(s.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,i){let s=e.isMac&&!this.options.macOptionIsMeta&&i.altKey&&!i.ctrlKey&&!i.metaKey||e.isWindows&&i.altKey&&i.ctrlKey&&!i.metaKey||e.isWindows&&i.getModifierState("AltGraph");return i.type==="keypress"?s:s&&(!i.keyCode||i.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Xd(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let i;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)i=e.charCode;else if(e.which===null||e.which===void 0)i=e.keyCode;else if(e.which!==0&&e.charCode!==0)i=e.which;else return!1;return!i||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(i=String.fromCharCode(i),this._onKey.fire({key:i,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let i=e.data;return this.coreService.triggerDataEvent(i,!0),this.cancel(e),!0}return!1}resize(e,i){if(e===this.cols&&i===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,i)}_afterResize(e,i){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e=0;e--)this._addons[e].instance.dispose()}loadAddon(e,i){let s={instance:i,dispose:i.dispose,isDisposed:!1};this._addons.push(s),i.dispose=()=>this._wrappedAddonDispose(s),i.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let i=-1;for(let s=0;s=this._line.length))return i?(this._line.loadCell(e,i),i):this._line.loadCell(e,new ct)}translateToString(e,i,s){return this._line.translateToString(e,i,s)}},Lo=class{constructor(t,e){this._buffer=t,this.type=e}init(t){return this._buffer=t,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(t){let e=this._buffer.lines.get(t);if(e)return new Zd(e)}getNullCell(){return new ct}},Qd=class extends j{constructor(t){super(),this._core=t,this._onBufferChange=this._register(new A),this.onBufferChange=this._onBufferChange.event,this._normal=new Lo(this._core.buffers.normal,"normal"),this._alternate=new Lo(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},eu=class{constructor(t){this._core=t}registerCsiHandler(t,e){return this._core.registerCsiHandler(t,i=>e(i.toArray()))}addCsiHandler(t,e){return this.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._core.registerDcsHandler(t,(i,s)=>e(i,s.toArray()))}addDcsHandler(t,e){return this.registerDcsHandler(t,e)}registerEscHandler(t,e){return this._core.registerEscHandler(t,e)}addEscHandler(t,e){return this.registerEscHandler(t,e)}registerOscHandler(t,e){return this._core.registerOscHandler(t,e)}addOscHandler(t,e){return this.registerOscHandler(t,e)}},tu=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},iu=["cols","rows"],ft=0,su=class extends j{constructor(t){super(),this._core=this._register(new Yd(t)),this._addonManager=this._register(new Jd),this._publicOptions={...this._core.options};let e=s=>this._core.options[s],i=(s,r)=>{this._checkReadonlyOptions(s),this._core.options[s]=r};for(let s in this._core.options){let r={get:e.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this._publicOptions,s,r)}}_checkReadonlyOptions(t){if(iu.includes(t))throw new Error(`Option "${t}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new eu(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new tu(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new Qd(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let t=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any";break}return{applicationCursorKeysMode:t.applicationCursorKeys,applicationKeypadMode:t.applicationKeypad,bracketedPasteMode:t.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:t.origin,reverseWraparoundMode:t.reverseWraparound,sendFocusMode:t.sendFocus,synchronizedOutputMode:t.synchronizedOutput,wraparoundMode:t.wraparound}}get options(){return this._publicOptions}set options(t){for(let e in t)this._publicOptions[e]=t[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(t,e=!0){this._core.input(t,e)}resize(t,e){this._verifyIntegers(t,e),this._core.resize(t,e)}open(t){this._core.open(t)}attachCustomKeyEventHandler(t){this._core.attachCustomKeyEventHandler(t)}attachCustomWheelEventHandler(t){this._core.attachCustomWheelEventHandler(t)}registerLinkProvider(t){return this._core.registerLinkProvider(t)}registerCharacterJoiner(t){return this._checkProposedApi(),this._core.registerCharacterJoiner(t)}deregisterCharacterJoiner(t){this._checkProposedApi(),this._core.deregisterCharacterJoiner(t)}registerMarker(t=0){return this._verifyIntegers(t),this._core.registerMarker(t)}registerDecoration(t){return this._checkProposedApi(),this._verifyPositiveIntegers(t.x??0,t.width??0,t.height??0),this._core.registerDecoration(t)}hasSelection(){return this._core.hasSelection()}select(t,e,i){this._verifyIntegers(t,e,i),this._core.select(t,e,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(t,e){this._verifyIntegers(t,e),this._core.selectLines(t,e)}dispose(){super.dispose()}scrollLines(t){this._verifyIntegers(t),this._core.scrollLines(t)}scrollPages(t){this._verifyIntegers(t),this._core.scrollPages(t)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(t){this._verifyIntegers(t),this._core.scrollToLine(t)}clear(){this._core.clear()}write(t,e){this._core.write(t,e)}writeln(t,e){this._core.write(t),this._core.write(`\r
+`,e)}paste(t){this._core.paste(t)}refresh(t,e){this._verifyIntegers(t,e),this._core.refresh(t,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(t){this._addonManager.loadAddon(this,t)}static get strings(){return{get promptLabel(){return pr.get()},set promptLabel(t){pr.set(t)},get tooMuchOutput(){return vr.get()},set tooMuchOutput(t){vr.set(t)}}}_verifyIntegers(...t){for(ft of t)if(ft===1/0||isNaN(ft)||ft%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...t){for(ft of t)if(ft&&(ft===1/0||isNaN(ft)||ft%1!==0||ft<0))throw new Error("This API only accepts positive integers")}};/**
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
+ * @license MIT
+ *
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
+ * @license MIT
+ *
+ * Originally forked from (with the author's permission):
+ * Fabrice Bellard's javascript vt100 for jslinux:
+ * http://bellard.org/jslinux/
+ * Copyright (c) 2011 Fabrice Bellard
+ */var ru=2,nu=1,ou=class{activate(t){this._terminal=t}dispose(){}fit(){let t=this.proposeDimensions();if(!t||!this._terminal||isNaN(t.cols)||isNaN(t.rows))return;let e=this._terminal._core;(this._terminal.rows!==t.rows||this._terminal.cols!==t.cols)&&(e._renderService.clear(),this._terminal.resize(t.cols,t.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let e=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),r=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),o={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},l=o.top+o.bottom,h=o.right+o.left,a=s-l,c=r-h-e;return{cols:Math.max(ru,Math.floor(c/t.css.cell.width)),rows:Math.max(nu,Math.floor(a/t.css.cell.height))}}};/**
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
+ * @license MIT
+ *
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
+ * @license MIT
+ *
+ * Originally forked from (with the author's permission):
+ * Fabrice Bellard's javascript vt100 for jslinux:
+ * http://bellard.org/jslinux/
+ * Copyright (c) 2011 Fabrice Bellard
+ */var au=class{constructor(t,e,i,s={}){this._terminal=t,this._regex=e,this._handler=i,this._options=s}provideLinks(t,e){let i=hu.computeLink(t,this._regex,this._terminal,this._handler);e(this._addCallbacks(i))}_addCallbacks(t){return t.map(e=>(e.leave=this._options.leave,e.hover=(i,s)=>{if(this._options.hover){let{range:r}=e;this._options.hover(i,s,r)}},e))}};function lu(t){try{let e=new URL(t),i=e.password&&e.username?`${e.protocol}//${e.username}:${e.password}@${e.host}`:e.username?`${e.protocol}//${e.username}@${e.host}`:`${e.protocol}//${e.host}`;return t.toLocaleLowerCase().startsWith(i.toLocaleLowerCase())}catch{return!1}}var hu=class gs{static computeLink(e,i,s,r){let n=new RegExp(i.source,(i.flags||"")+"g"),[o,l]=gs._getWindowedLineStrings(e-1,s),h=o.join(""),a,c=[];for(;a=n.exec(h);){let _=a[0];if(!lu(_))continue;let[f,d]=gs._mapStrIdx(s,l,0,a.index),[m,y]=gs._mapStrIdx(s,f,d,_.length);if(f===-1||d===-1||m===-1||y===-1)continue;let k={start:{x:d+1,y:f+1},end:{x:y,y:m+1}};c.push({range:k,text:_,activate:r})}return c}static _getWindowedLineStrings(e,i){let s,r=e,n=e,o=0,l="",h=[];if(s=i.buffer.active.getLine(e)){let a=s.translateToString(!0);if(s.isWrapped&&a[0]!==" "){for(o=0;(s=i.buffer.active.getLine(--r))&&o<2048&&(l=s.translateToString(!0),o+=l.length,h.push(l),!(!s.isWrapped||l.indexOf(" ")!==-1)););h.reverse()}for(h.push(a),o=0;(s=i.buffer.active.getLine(++n))&&s.isWrapped&&o<2048&&(l=s.translateToString(!0),o+=l.length,h.push(l),l.indexOf(" ")===-1););}return[h,r]}static _mapStrIdx(e,i,s,r){let n=e.buffer.active,o=n.getNullCell(),l=s;for(;r;){let h=n.getLine(i);if(!h)return[-1,-1];for(let a=l;a`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function du(t,e){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}var uu=class{constructor(t=du,e={}){this._handler=t,this._options=e}activate(t){this._terminal=t;let e=this._options,i=e.urlRegex||cu;this._linkProvider=this._terminal.registerLinkProvider(new au(this._terminal,i,this._handler,e))}dispose(){this._linkProvider?.dispose()}};/**
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
+ * @license MIT
+ *
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
+ * @license MIT
+ *
+ * Originally forked from (with the author's permission):
+ * Fabrice Bellard's javascript vt100 for jslinux:
+ * http://bellard.org/jslinux/
+ * Copyright (c) 2011 Fabrice Bellard
+ */var _u=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?Bo.isErrorNoTelemetry(t)?new Bo(t.message+`
+
+`+t.stack):new Error(t.message+`
+
+`+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(e=>{e(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},fu=new _u;function Xs(t){gu(t)||fu.onUnexpectedError(t)}var Qr="Canceled";function gu(t){return t instanceof pu?!0:t instanceof Error&&t.name===Qr&&t.message===Qr}var pu=class extends Error{constructor(){super(Qr),this.name=this.message}},Bo=class en extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof en)return e;let i=new en;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},vu;(t=>{function e(n){return n<0}t.isLessThan=e;function i(n){return n<=0}t.isLessThanOrEqual=i;function s(n){return n>0}t.isGreaterThan=s;function r(n){return n===0}t.isNeitherLessOrGreaterThan=r,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(vu||={});function mu(t,e){let i=this,s=!1,r;return function(){return s||(s=!0,e||(r=t.apply(i,arguments))),r}}var Xa;(t=>{function e(S){return S&&typeof S=="object"&&typeof S[Symbol.iterator]=="function"}t.is=e;let i=Object.freeze([]);function s(){return i}t.empty=s;function*r(S){yield S}t.single=r;function n(S){return e(S)?S:r(S)}t.wrap=n;function o(S){return S||i}t.from=o;function*l(S){for(let L=S.length-1;L>=0;L--)yield S[L]}t.reverse=l;function h(S){return!S||S[Symbol.iterator]().next().done===!0}t.isEmpty=h;function a(S){return S[Symbol.iterator]().next().value}t.first=a;function c(S,L){let B=0;for(let $ of S)if(L($,B++))return!0;return!1}t.some=c;function _(S,L){for(let B of S)if(L(B))return B}t.find=_;function*f(S,L){for(let B of S)L(B)&&(yield B)}t.filter=f;function*d(S,L){let B=0;for(let $ of S)yield L($,B++)}t.map=d;function*m(S,L){let B=0;for(let $ of S)yield*L($,B++)}t.flatMap=m;function*y(...S){for(let L of S)yield*L}t.concat=y;function k(S,L,B){let $=B;for(let U of S)$=L($,U);return $}t.reduce=k;function*R(S,L,B=S.length){for(L<0&&(L+=S.length),B<0?B+=S.length:B>S.length&&(B=S.length);L1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function Ja(...t){return Ci(()=>Hi(t))}function Ci(t){return{dispose:mu(()=>{t()})}}var Za=class Qa{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Hi(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?Qa.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};Za.DISABLE_DISPOSED_WARNING=!1;var xn=Za,Gt=class{constructor(){this._store=new xn,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Gt.None=Object.freeze({dispose(){}});var Bs=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},wu=globalThis.performance&&typeof globalThis.performance.now=="function",Su=class el{static create(e){return new el(e)}constructor(e){this._now=wu&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},kn;(t=>{t.None=()=>Gt.None;function e(v,u){return _(v,()=>{},0,void 0,!0,void 0,u)}t.defer=e;function i(v){return(u,p=null,g)=>{let w=!1,b;return b=v(C=>{if(!w)return b?b.dispose():w=!0,u.call(p,C)},null,g),w&&b.dispose(),b}}t.once=i;function s(v,u,p){return a((g,w=null,b)=>v(C=>g.call(w,u(C)),null,b),p)}t.map=s;function r(v,u,p){return a((g,w=null,b)=>v(C=>{u(C),g.call(w,C)},null,b),p)}t.forEach=r;function n(v,u,p){return a((g,w=null,b)=>v(C=>u(C)&&g.call(w,C),null,b),p)}t.filter=n;function o(v){return v}t.signal=o;function l(...v){return(u,p=null,g)=>{let w=Ja(...v.map(b=>b(C=>u.call(p,C))));return c(w,g)}}t.any=l;function h(v,u,p,g){let w=p;return s(v,b=>(w=u(w,b),w),g)}t.reduce=h;function a(v,u){let p,g={onWillAddFirstListener(){p=v(w.fire,w)},onDidRemoveLastListener(){p?.dispose()}},w=new vt(g);return u?.add(w),w.event}function c(v,u){return u instanceof Array?u.push(v):u&&u.add(v),v}function _(v,u,p=100,g=!1,w=!1,b,C){let x,M,F,K=0,z,pe={leakWarningThreshold:b,onWillAddFirstListener(){x=v(ne=>{K++,M=u(M,ne),g&&!F&&(q.fire(M),M=void 0),z=()=>{let O=M;M=void 0,F=void 0,(!g||K>1)&&q.fire(O),K=0},typeof p=="number"?(clearTimeout(F),F=setTimeout(z,p)):F===void 0&&(F=0,queueMicrotask(z))})},onWillRemoveListener(){w&&K>0&&z?.()},onDidRemoveLastListener(){z=void 0,x.dispose()}},q=new vt(pe);return C?.add(q),q.event}t.debounce=_;function f(v,u=0,p){return t.debounce(v,(g,w)=>g?(g.push(w),g):[w],u,void 0,!0,void 0,p)}t.accumulate=f;function d(v,u=(g,w)=>g===w,p){let g=!0,w;return n(v,b=>{let C=g||!u(b,w);return g=!1,w=b,C},p)}t.latch=d;function m(v,u,p){return[t.filter(v,u,p),t.filter(v,g=>!u(g),p)]}t.split=m;function y(v,u=!1,p=[],g){let w=p.slice(),b=v(M=>{w?w.push(M):x.fire(M)});g&&g.add(b);let C=()=>{w?.forEach(M=>x.fire(M)),w=null},x=new vt({onWillAddFirstListener(){b||(b=v(M=>x.fire(M)),g&&g.add(b))},onDidAddFirstListener(){w&&(u?setTimeout(C):C())},onDidRemoveLastListener(){b&&b.dispose(),b=null}});return g&&g.add(x),x.event}t.buffer=y;function k(v,u){return(p,g,w)=>{let b=u(new D);return v(function(C){let x=b.evaluate(C);x!==R&&p.call(g,x)},void 0,w)}}t.chain=k;let R=Symbol("HaltChainable");class D{constructor(){this.steps=[]}map(u){return this.steps.push(u),this}forEach(u){return this.steps.push(p=>(u(p),p)),this}filter(u){return this.steps.push(p=>u(p)?p:R),this}reduce(u,p){let g=p;return this.steps.push(w=>(g=u(g,w),g)),this}latch(u=(p,g)=>p===g){let p=!0,g;return this.steps.push(w=>{let b=p||!u(w,g);return p=!1,g=w,b?w:R}),this}evaluate(u){for(let p of this.steps)if(u=p(u),u===R)break;return u}}function T(v,u,p=g=>g){let g=(...x)=>C.fire(p(...x)),w=()=>v.on(u,g),b=()=>v.removeListener(u,g),C=new vt({onWillAddFirstListener:w,onDidRemoveLastListener:b});return C.event}t.fromNodeEventEmitter=T;function S(v,u,p=g=>g){let g=(...x)=>C.fire(p(...x)),w=()=>v.addEventListener(u,g),b=()=>v.removeEventListener(u,g),C=new vt({onWillAddFirstListener:w,onDidRemoveLastListener:b});return C.event}t.fromDOMEventEmitter=S;function L(v){return new Promise(u=>i(v)(u))}t.toPromise=L;function B(v){let u=new vt;return v.then(p=>{u.fire(p)},()=>{u.fire(void 0)}).finally(()=>{u.dispose()}),u.event}t.fromPromise=B;function $(v,u){return v(p=>u.fire(p))}t.forward=$;function U(v,u,p){return u(p),v(g=>u(g))}t.runAndSubscribe=U;class Y{constructor(u,p){this._observable=u,this._counter=0,this._hasChanged=!1;let g={onWillAddFirstListener:()=>{u.addObserver(this)},onDidRemoveLastListener:()=>{u.removeObserver(this)}};this.emitter=new vt(g),p&&p.add(this.emitter)}beginUpdate(u){this._counter++}handlePossibleChange(u){}handleChange(u,p){this._hasChanged=!0}endUpdate(u){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function le(v,u){return new Y(v,u).emitter.event}t.fromObservable=le;function W(v){return(u,p,g)=>{let w=0,b=!1,C={beginUpdate(){w++},endUpdate(){w--,w===0&&(v.reportChanges(),b&&(b=!1,u.call(p)))},handlePossibleChange(){},handleChange(){b=!0}};v.addObserver(C),v.reportChanges();let x={dispose(){v.removeObserver(C)}};return g instanceof xn?g.add(x):Array.isArray(g)&&g.push(x),x}}t.fromObservableLight=W})(kn||={});var tn=class sn{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${sn._idPool++}`,sn.all.add(this)}start(e){this._stopWatch=new Su,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};tn.all=new Set,tn._idPool=0;var bu=tn,yu=-1,tl=class il{constructor(e,i,s=(il._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,i){let s=this.threshold;if(s<=0||i{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[s,r]of this._stacks)(!e||i{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let l=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(l);let h=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],a=new Lu(`${l}. HINT: Stack shows most frequent listener (${h[1]}-times)`,h[0]);return(this._options?.onListenerError||Xs)(a),Gt.None}if(this._disposed)return Gt.None;i&&(e=e.bind(i));let r=new Js(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=xu.create(),n=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Js?(this._deliveryQueue??=new Ru,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let o=Ci(()=>{n?.(),this._removeListener(r)});return s instanceof xn?s.add(o):Array.isArray(s)&&s.push(o),o},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let i=this._listeners,s=i.indexOf(e);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,i[s]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Eu<=i.length){let n=0;for(let o=0;o0}},Ru=class{constructor(){this.i=-1,this.end=0}enqueue(t,e,i){this.i=0,this.end=i,this.current=t,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},rl=Object.freeze(function(t,e){let i=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(i)}}}),Tu;(t=>{function e(i){return i===t.None||i===t.Cancelled||i instanceof Du?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:kn.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:rl})})(Tu||={});var Du=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?rl:(this._emitter||(this._emitter=new vt),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},pi="en",Zs=!1,rs,ps=pi,Eo=pi,Au,Rt,si=globalThis,Qe;typeof si.vscode<"u"&&typeof si.vscode.process<"u"?Qe=si.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Qe=process);var Pu=typeof Qe?.versions?.electron=="string",$u=Pu&&Qe?.type==="renderer";if(typeof Qe=="object"){Qe.platform,Qe.platform,Zs=Qe.platform==="linux",Zs&&Qe.env.SNAP&&Qe.env.SNAP_REVISION,Qe.env.CI||Qe.env.BUILD_ARTIFACTSTAGINGDIRECTORY,rs=pi,ps=pi;let t=Qe.env.VSCODE_NLS_CONFIG;if(t)try{let e=JSON.parse(t);rs=e.userLocale,Eo=e.osLocale,ps=e.resolvedLanguage||pi,Au=e.languagePack?.translationsConfigFile}catch{}}else typeof navigator=="object"&&!$u?(Rt=navigator.userAgent,Rt.indexOf("Windows")>=0,Rt.indexOf("Macintosh")>=0,(Rt.indexOf("Macintosh")>=0||Rt.indexOf("iPad")>=0||Rt.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Zs=Rt.indexOf("Linux")>=0,Rt?.indexOf("Mobi")>=0,ps=globalThis._VSCODE_NLS_LANGUAGE||pi,rs=navigator.language.toLowerCase(),Eo=rs):console.error("Unable to resolve platform.");var bt=Rt,Wt=ps,Iu;(t=>{function e(){return Wt}t.value=e;function i(){return Wt.length===2?Wt==="en":Wt.length>=3?Wt[0]==="e"&&Wt[1]==="n"&&Wt[2]==="-":!1}t.isDefaultVariant=i;function s(){return Wt==="en"}t.isDefault=s})(Iu||={});var Ou=typeof si.postMessage=="function"&&!si.importScripts;(()=>{if(Ou){let t=[];si.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=t.length;s{let s=++e;t.push({id:s,callback:i}),si.postMessage({vscodeScheduleAsyncWork:s},"*")}}return t=>setTimeout(t)})();var Fu=!!(bt&&bt.indexOf("Chrome")>=0);bt&&bt.indexOf("Firefox")>=0;!Fu&&bt&&bt.indexOf("Safari")>=0;bt&&bt.indexOf("Edg/")>=0;bt&&bt.indexOf("Android")>=0;function nl(t,e=0,i){let s=setTimeout(()=>{t()},e);return Ci(()=>{clearTimeout(s)})}var Nu;(t=>{async function e(s){let r,n=await Promise.all(s.map(o=>o.then(l=>l,l=>{r||(r=l)})));if(typeof r<"u")throw r;return n}t.settled=e;function i(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}t.withAsyncBody=i})(Nu||={});var Mo=class nt{static fromArray(e){return new nt(i=>{i.emitMany(e)})}static fromPromise(e){return new nt(async i=>{i.emitMany(await e)})}static fromPromises(e){return new nt(async i=>{await Promise.all(e.map(async s=>i.emitOne(await s)))})}static merge(e){return new nt(async i=>{await Promise.all(e.map(async s=>{for await(let r of s)i.emitOne(r)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new vt,queueMicrotask(async()=>{let s={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(e(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e(this._onReturn?.(),{done:!0,value:void 0})}}static map(e,i){return new nt(async s=>{for await(let r of e)s.emitOne(i(r))})}map(e){return nt.map(this,e)}static filter(e,i){return new nt(async s=>{for await(let r of e)i(r)&&s.emitOne(r)})}filter(e){return nt.filter(this,e)}static coalesce(e){return nt.filter(e,i=>!!i)}coalesce(){return nt.coalesce(this)}static async toPromise(e){let i=[];for await(let s of e)i.push(s);return i}toPromise(){return nt.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Mo.EMPTY=Mo.fromArray([]);var Wu=class extends Gt{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new Bs),this._linesCacheDisposables=this._register(new Bs),this._register(Ci(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=Ja(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=nl(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,i){this._linesCache&&(this._linesCache[e]=i)}translateBufferLineToStringWithWrap(e,i){let s=[],r=[0],n=this._terminal.buffer.active.getLine(e);for(;n;){let o=this._terminal.buffer.active.getLine(e+1),l=o?o.isWrapped:!1,h=n.translateToString(!l&&i);if(l&&o){let a=n.getCell(n.length-1);a&&a.getCode()===0&&a.getWidth()===1&&o.getCell(0)?.getWidth()===2&&(h=h.slice(0,-1))}if(s.push(h),l)r.push(r[r.length-1]+h.length);else break;e++,n=o}return[s.join(""),r]}},zu=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return this._lastSearchOptions?e?this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord:!1:!0}shouldUpdateHighlighting(e,i){return i?.decorations?this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||this.didOptionsChange(i):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},Hu=class{constructor(e,i){this._terminal=e,this._lineCache=i}find(e,i,s,r){if(!e||e.length===0){this._terminal.clearSelection();return}if(s>this._terminal.cols)throw new Error(`Invalid col: ${s} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let n={startRow:i,startCol:s},o=this._findInLine(e,n,r);if(!o)for(let l=i+1;l=0&&(h.startRow=c,a=this._findInLine(e,h,i,l),!a);c--);}if(!a&&n!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let c=this._terminal.buffer.active.baseY+this._terminal.rows-1;c>=n&&(h.startRow=c,a=this._findInLine(e,h,i,l),!a);c--);return a}_isWholeWord(e,i,s){return(e===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(i[e-1]))&&(e+s.length===i.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(i[e+s.length]))}_findInLine(e,i,s={},r=!1){let n=i.startRow,o=i.startCol;if(this._terminal.buffer.active.getLine(n)?.isWrapped){if(r){i.startCol+=this._terminal.cols;return}return i.startRow--,i.startCol+=this._terminal.cols,this._findInLine(e,i,s)}let l=this._lineCache.getLineFromCache(n);l||(l=this._lineCache.translateBufferLineToStringWithWrap(n,!0),this._lineCache.setLineInCache(n,l));let[h,a]=l,c=this._bufferColsToStringOffset(n,o),_=e,f=h;s.regex||(_=s.caseSensitive?e:e.toLowerCase(),f=s.caseSensitive?h:h.toLowerCase());let d=-1;if(s.regex){let m=RegExp(_,s.caseSensitive?"g":"gi"),y;if(r)for(;y=m.exec(f.slice(0,c));)d=m.lastIndex-y[0].length,e=y[0],m.lastIndex-=e.length-1;else y=m.exec(f.slice(c)),y&&y[0].length>0&&(d=c+(m.lastIndex-y[0].length),e=y[0])}else r?c-_.length>=0&&(d=f.lastIndexOf(_,c-_.length)):d=f.indexOf(_,c);if(d>=0){if(s.wholeWord&&!this._isWholeWord(d,f,e))return;let m=0;for(;m=a[m+1];)m++;let y=m;for(;y=a[y+1];)y++;let k=d-a[m],R=d+e.length-a[y],D=this._stringLengthToBufferSize(n+m,k),T=this._stringLengthToBufferSize(n+y,R)-D+this._terminal.cols*(y-m);return{term:e,col:D,row:n+m,size:T}}}_stringLengthToBufferSize(e,i){let s=this._terminal.buffer.active.getLine(e);if(!s)return 0;for(let r=0;r1&&(i-=o.length-1);let l=s.getCell(r+1);l&&l.getWidth()===0&&i++}return i}_bufferColsToStringOffset(e,i){let s=e,r=0,n=this._terminal.buffer.active.getLine(s);for(;i>0&&n;){for(let o=0;othis.clearHighlightDecorations()))}createHighlightDecorations(t,e){this.clearHighlightDecorations();for(let i of t){let s=this._createResultDecorations(i,e,!1);if(s)for(let r of s)this._storeDecoration(r,i)}}createActiveDecoration(t,e){let i=this._createResultDecorations(t,e,!0);if(i)return{decorations:i,match:t,dispose(){Hi(i)}}}clearHighlightDecorations(){Hi(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(t,e){this._highlightedLines.add(t.marker.line),this._highlightDecorations.push({decoration:t,match:e,dispose(){t.dispose()}})}_applyStyles(t,e,i){t.classList.contains("xterm-find-result-decoration")||(t.classList.add("xterm-find-result-decoration"),e&&(t.style.outline=`1px solid ${e}`)),i&&t.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(t,e,i){let s=[],r=t.col,n=t.size,o=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+t.row;for(;n>0;){let h=Math.min(this._terminal.cols-r,n);s.push([o,r,h]),r=0,n-=h,o++}let l=[];for(let h of s){let a=this._terminal.registerMarker(h[0]),c=this._terminal.registerDecoration({marker:a,x:h[1],width:h[2],backgroundColor:i?e.activeMatchBackground:e.matchBackground,overviewRulerOptions:this._highlightedLines.has(a.line)?void 0:{color:i?e.activeMatchColorOverviewRuler:e.matchOverviewRuler,position:"center"}});if(c){let _=[];_.push(a),_.push(c.onRender(f=>this._applyStyles(f,i?e.activeMatchBorder:e.matchBorder,!1))),_.push(c.onDispose(()=>Hi(_))),l.push(c)}}return l.length===0?void 0:l}},qu=class extends Gt{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new vt)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(t){this._selectedDecoration=t}updateResults(t,e){this._searchResults=t.slice(0,e)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(t){for(let e=0;ethis._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Ci(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=nl(()=>{let t=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(t,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(t){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),t||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(t,e,i){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=e,this._state.shouldUpdateHighlighting(t,e)&&this._highlightAllMatches(t,e);let s=this._findNextAndSelect(t,e,i);return this._fireResults(e),this._state.cachedSearchTerm=t,s}_highlightAllMatches(t,e){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(t)){this.clearDecorations();return}this.clearDecorations(!0);let i=[],s,r=this._engine.find(t,0,0,e);for(;r&&(s?.row!==r.row||s?.col!==r.col)&&!(i.length>=this._highlightLimit);)s=r,i.push(s),r=this._engine.find(t,s.col+s.term.length>=this._terminal.cols?s.row+1:s.row,s.col+s.term.length>=this._terminal.cols?0:s.col+1,e);this._resultTracker.updateResults(i,this._highlightLimit),e.decorations&&this._decorationManager.createHighlightDecorations(i,e.decorations)}_findNextAndSelect(t,e,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(t))return this._terminal.clearSelection(),this.clearDecorations(),!1;let s=this._engine.findNextWithSelection(t,e,this._state.cachedSearchTerm);return this._selectResult(s,e?.decorations,i?.noScroll)}findPrevious(t,e,i){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=e,this._state.shouldUpdateHighlighting(t,e)&&this._highlightAllMatches(t,e);let s=this._findPreviousAndSelect(t,e,i);return this._fireResults(e),this._state.cachedSearchTerm=t,s}_fireResults(t){this._resultTracker.fireResultsChanged(!!t?.decorations)}_findPreviousAndSelect(t,e,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(t))return this._terminal.clearSelection(),this.clearDecorations(),!1;let s=this._engine.findPreviousWithSelection(t,e,this._state.cachedSearchTerm);return this._selectResult(s,e?.decorations,i?.noScroll)}_selectResult(t,e,i){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!t)return this._terminal.clearSelection(),!1;if(this._terminal.select(t.col,t.row,t.size),e){let s=this._decorationManager.createActiveDecoration(t,e);s&&(this._resultTracker.selectedDecoration=s)}if(!i&&(t.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||t.rowe[s][1])return!1;for(;s>=i;)if(r=i+s>>1,t>e[r][1])i=r+1;else if(t=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,i){let s=this.wcwidth(e),r=s===0&&i!==0;if(r){let n=Ms.extractWidth(i);n===0?r=!1:n>s&&(s=n)}return Ms.createPropertyValue(0,s,r)}},Yu=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?Ro.isErrorNoTelemetry(t)?new Ro(t.message+`
+
+`+t.stack):new Error(t.message+`
+
+`+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(e=>{e(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},Xu=new Yu;function er(t){Ju(t)||Xu.onUnexpectedError(t)}var rn="Canceled";function Ju(t){return t instanceof Zu?!0:t instanceof Error&&t.name===rn&&t.message===rn}var Zu=class extends Error{constructor(){super(rn),this.name=this.message}},Ro=class nn extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof nn)return e;let i=new nn;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}};function Qu(t,e){let i=this,s=!1,r;return function(){return s||(s=!0,e||(r=t.apply(i,arguments))),r}}var e_;(t=>{function e(n){return n<0}t.isLessThan=e;function i(n){return n<=0}t.isLessThanOrEqual=i;function s(n){return n>0}t.isGreaterThan=s;function r(n){return n===0}t.isNeitherLessOrGreaterThan=r,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(e_||={});var ol;(t=>{function e(S){return S&&typeof S=="object"&&typeof S[Symbol.iterator]=="function"}t.is=e;let i=Object.freeze([]);function s(){return i}t.empty=s;function*r(S){yield S}t.single=r;function n(S){return e(S)?S:r(S)}t.wrap=n;function o(S){return S||i}t.from=o;function*l(S){for(let L=S.length-1;L>=0;L--)yield S[L]}t.reverse=l;function h(S){return!S||S[Symbol.iterator]().next().done===!0}t.isEmpty=h;function a(S){return S[Symbol.iterator]().next().value}t.first=a;function c(S,L){let B=0;for(let $ of S)if(L($,B++))return!0;return!1}t.some=c;function _(S,L){for(let B of S)if(L(B))return B}t.find=_;function*f(S,L){for(let B of S)L(B)&&(yield B)}t.filter=f;function*d(S,L){let B=0;for(let $ of S)yield L($,B++)}t.map=d;function*m(S,L){let B=0;for(let $ of S)yield*L($,B++)}t.flatMap=m;function*y(...S){for(let L of S)yield*L}t.concat=y;function k(S,L,B){let $=B;for(let U of S)$=L($,U);return $}t.reduce=k;function*R(S,L,B=S.length){for(L<0&&(L+=S.length),B<0?B+=S.length:B>S.length&&(B=S.length);L1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function t_(...t){return ll(()=>al(t))}function ll(t){return{dispose:Qu(()=>{t()})}}var hl=class cl{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{al(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?cl.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};hl.DISABLE_DISPOSED_WARNING=!1;var Ln=hl,Es=class{constructor(){this._store=new Ln,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};Es.None=Object.freeze({dispose(){}});var i_=globalThis.performance&&typeof globalThis.performance.now=="function",s_=class dl{static create(e){return new dl(e)}constructor(e){this._now=i_&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},r_;(t=>{t.None=()=>Es.None;function e(v,u){return _(v,()=>{},0,void 0,!0,void 0,u)}t.defer=e;function i(v){return(u,p=null,g)=>{let w=!1,b;return b=v(C=>{if(!w)return b?b.dispose():w=!0,u.call(p,C)},null,g),w&&b.dispose(),b}}t.once=i;function s(v,u,p){return a((g,w=null,b)=>v(C=>g.call(w,u(C)),null,b),p)}t.map=s;function r(v,u,p){return a((g,w=null,b)=>v(C=>{u(C),g.call(w,C)},null,b),p)}t.forEach=r;function n(v,u,p){return a((g,w=null,b)=>v(C=>u(C)&&g.call(w,C),null,b),p)}t.filter=n;function o(v){return v}t.signal=o;function l(...v){return(u,p=null,g)=>{let w=t_(...v.map(b=>b(C=>u.call(p,C))));return c(w,g)}}t.any=l;function h(v,u,p,g){let w=p;return s(v,b=>(w=u(w,b),w),g)}t.reduce=h;function a(v,u){let p,g={onWillAddFirstListener(){p=v(w.fire,w)},onDidRemoveLastListener(){p?.dispose()}},w=new Ht(g);return u?.add(w),w.event}function c(v,u){return u instanceof Array?u.push(v):u&&u.add(v),v}function _(v,u,p=100,g=!1,w=!1,b,C){let x,M,F,K=0,z,pe={leakWarningThreshold:b,onWillAddFirstListener(){x=v(ne=>{K++,M=u(M,ne),g&&!F&&(q.fire(M),M=void 0),z=()=>{let O=M;M=void 0,F=void 0,(!g||K>1)&&q.fire(O),K=0},typeof p=="number"?(clearTimeout(F),F=setTimeout(z,p)):F===void 0&&(F=0,queueMicrotask(z))})},onWillRemoveListener(){w&&K>0&&z?.()},onDidRemoveLastListener(){z=void 0,x.dispose()}},q=new Ht(pe);return C?.add(q),q.event}t.debounce=_;function f(v,u=0,p){return t.debounce(v,(g,w)=>g?(g.push(w),g):[w],u,void 0,!0,void 0,p)}t.accumulate=f;function d(v,u=(g,w)=>g===w,p){let g=!0,w;return n(v,b=>{let C=g||!u(b,w);return g=!1,w=b,C},p)}t.latch=d;function m(v,u,p){return[t.filter(v,u,p),t.filter(v,g=>!u(g),p)]}t.split=m;function y(v,u=!1,p=[],g){let w=p.slice(),b=v(M=>{w?w.push(M):x.fire(M)});g&&g.add(b);let C=()=>{w?.forEach(M=>x.fire(M)),w=null},x=new Ht({onWillAddFirstListener(){b||(b=v(M=>x.fire(M)),g&&g.add(b))},onDidAddFirstListener(){w&&(u?setTimeout(C):C())},onDidRemoveLastListener(){b&&b.dispose(),b=null}});return g&&g.add(x),x.event}t.buffer=y;function k(v,u){return(p,g,w)=>{let b=u(new D);return v(function(C){let x=b.evaluate(C);x!==R&&p.call(g,x)},void 0,w)}}t.chain=k;let R=Symbol("HaltChainable");class D{constructor(){this.steps=[]}map(u){return this.steps.push(u),this}forEach(u){return this.steps.push(p=>(u(p),p)),this}filter(u){return this.steps.push(p=>u(p)?p:R),this}reduce(u,p){let g=p;return this.steps.push(w=>(g=u(g,w),g)),this}latch(u=(p,g)=>p===g){let p=!0,g;return this.steps.push(w=>{let b=p||!u(w,g);return p=!1,g=w,b?w:R}),this}evaluate(u){for(let p of this.steps)if(u=p(u),u===R)break;return u}}function T(v,u,p=g=>g){let g=(...x)=>C.fire(p(...x)),w=()=>v.on(u,g),b=()=>v.removeListener(u,g),C=new Ht({onWillAddFirstListener:w,onDidRemoveLastListener:b});return C.event}t.fromNodeEventEmitter=T;function S(v,u,p=g=>g){let g=(...x)=>C.fire(p(...x)),w=()=>v.addEventListener(u,g),b=()=>v.removeEventListener(u,g),C=new Ht({onWillAddFirstListener:w,onDidRemoveLastListener:b});return C.event}t.fromDOMEventEmitter=S;function L(v){return new Promise(u=>i(v)(u))}t.toPromise=L;function B(v){let u=new Ht;return v.then(p=>{u.fire(p)},()=>{u.fire(void 0)}).finally(()=>{u.dispose()}),u.event}t.fromPromise=B;function $(v,u){return v(p=>u.fire(p))}t.forward=$;function U(v,u,p){return u(p),v(g=>u(g))}t.runAndSubscribe=U;class Y{constructor(u,p){this._observable=u,this._counter=0,this._hasChanged=!1;let g={onWillAddFirstListener:()=>{u.addObserver(this)},onDidRemoveLastListener:()=>{u.removeObserver(this)}};this.emitter=new Ht(g),p&&p.add(this.emitter)}beginUpdate(u){this._counter++}handlePossibleChange(u){}handleChange(u,p){this._hasChanged=!0}endUpdate(u){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function le(v,u){return new Y(v,u).emitter.event}t.fromObservable=le;function W(v){return(u,p,g)=>{let w=0,b=!1,C={beginUpdate(){w++},endUpdate(){w--,w===0&&(v.reportChanges(),b&&(b=!1,u.call(p)))},handlePossibleChange(){},handleChange(){b=!0}};v.addObserver(C),v.reportChanges();let x={dispose(){v.removeObserver(C)}};return g instanceof Ln?g.add(x):Array.isArray(g)&&g.push(x),x}}t.fromObservableLight=W})(r_||={});var on=class an{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${an._idPool++}`,an.all.add(this)}start(e){this._stopWatch=new s_,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};on.all=new Set,on._idPool=0;var n_=on,o_=-1,ul=class _l{constructor(e,i,s=(_l._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,i){let s=this.threshold;if(s<=0||i{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[s,r]of this._stacks)(!e||i{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let l=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(l);let h=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],a=new c_(`${l}. HINT: Stack shows most frequent listener (${h[1]}-times)`,h[0]);return(this._options?.onListenerError||er)(a),Es.None}if(this._disposed)return Es.None;i&&(e=e.bind(i));let r=new tr(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=l_.create(),n=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof tr?(this._deliveryQueue??=new f_,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let o=ll(()=>{n?.(),this._removeListener(r)});return s instanceof Ln?s.add(o):Array.isArray(s)&&s.push(o),o},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let i=this._listeners,s=i.indexOf(e);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,i[s]=void 0;let r=this._deliveryQueue.current===this;if(this._size*u_<=i.length){let n=0;for(let o=0;o0}},f_=class{constructor(){this.i=-1,this.end=0}enqueue(t,e,i){this.i=0,this.end=i,this.current=t,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Ms=class vs{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Ht,this.onChange=this._onChange.event;let e=new Gu;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!==0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,i,s=!1){return(e&16777215)<<3|(i&3)<<1|(s?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let i=0,s=0,r=e.length;for(let n=0;n=r)return i+this.wcwidth(o);let a=e.charCodeAt(n);56320<=a&&a<=57343?o=(o-55296)*1024+a-56320+65536:i+=this.wcwidth(a)}let l=this.charProperties(o,s),h=vs.extractWidth(l);vs.extractShouldJoin(l)&&(h-=vs.extractWidth(s)),i+=h,s=l}return i}charProperties(e,i){return this._activeProvider.charProperties(e,i)}},ir=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],g_=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],sr=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],p_=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]],kt;function To(t,e){let i=0,s=e.length-1,r;if(te[s][1])return!1;for(;s>=i;)if(r=i+s>>1,t>e[r][1])i=r+1;else if(ti&&(i=r)}return Ms.createPropertyValue(0,i,s)}},m_=class{activate(t){t.unicode.register(new v_)}dispose(){}};/**
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
+ * @license MIT
+ *
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
+ * @license MIT
+ *
+ * Originally forked from (with the author's permission):
+ * Fabrice Bellard's javascript vt100 for jslinux:
+ * http://bellard.org/jslinux/
+ * Copyright (c) 2011 Fabrice Bellard
+ */var w_=(t,e,i,s)=>{for(var r=e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(r=o(r)||r);return r},S_=(t,e)=>(i,s)=>e(i,s,t),b_=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?Do.isErrorNoTelemetry(t)?new Do(t.message+`
+
+`+t.stack):new Error(t.message+`
+
+`+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(e=>{e(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},y_=new b_;function rr(t){C_(t)||y_.onUnexpectedError(t)}var ln="Canceled";function C_(t){return t instanceof x_?!0:t instanceof Error&&t.name===ln&&t.message===ln}var x_=class extends Error{constructor(){super(ln),this.name=this.message}},Do=class hn extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof hn)return e;let i=new hn;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},k_;(t=>{function e(n){return n<0}t.isLessThan=e;function i(n){return n<=0}t.isLessThanOrEqual=i;function s(n){return n>0}t.isGreaterThan=s;function r(n){return n===0}t.isNeitherLessOrGreaterThan=r,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(k_||={});function L_(t,e){let i=this,s=!1,r;return function(){return s||(s=!0,e||(r=t.apply(i,arguments))),r}}var gl;(t=>{function e(S){return S&&typeof S=="object"&&typeof S[Symbol.iterator]=="function"}t.is=e;let i=Object.freeze([]);function s(){return i}t.empty=s;function*r(S){yield S}t.single=r;function n(S){return e(S)?S:r(S)}t.wrap=n;function o(S){return S||i}t.from=o;function*l(S){for(let L=S.length-1;L>=0;L--)yield S[L]}t.reverse=l;function h(S){return!S||S[Symbol.iterator]().next().done===!0}t.isEmpty=h;function a(S){return S[Symbol.iterator]().next().value}t.first=a;function c(S,L){let B=0;for(let $ of S)if(L($,B++))return!0;return!1}t.some=c;function _(S,L){for(let B of S)if(L(B))return B}t.find=_;function*f(S,L){for(let B of S)L(B)&&(yield B)}t.filter=f;function*d(S,L){let B=0;for(let $ of S)yield L($,B++)}t.map=d;function*m(S,L){let B=0;for(let $ of S)yield*L($,B++)}t.flatMap=m;function*y(...S){for(let L of S)yield*L}t.concat=y;function k(S,L,B){let $=B;for(let U of S)$=L($,U);return $}t.reduce=k;function*R(S,L,B=S.length){for(L<0&&(L+=S.length),B<0?B+=S.length:B>S.length&&(B=S.length);L1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function vl(...t){return We(()=>pl(t))}function We(t){return{dispose:L_(()=>{t()})}}var ml=class wl{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{pl(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?wl.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};ml.DISABLE_DISPOSED_WARNING=!1;var wi=ml,dt=class{constructor(){this._store=new wi,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};dt.None=Object.freeze({dispose(){}});var Ti=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},Bn=typeof process<"u"&&"title"in process,$s=Bn?"node":navigator.userAgent,B_=Bn?"node":navigator.platform,E_=$s.includes("Firefox"),M_=$s.includes("Edge"),Sl=/^((?!chrome|android).)*safari/i.test($s);function R_(){if(!Sl)return 0;let t=$s.match(/Version\/(\d+)/);return t===null||t.length<2?0:parseInt(t[1])}B_.indexOf("Linux")>=0;var T_="",Ae=0,Pe=0,$e=0,de=0,ot={css:"#00000000",rgba:0},Ke;(t=>{function e(r,n,o,l){return l!==void 0?`#${Jt(r)}${Jt(n)}${Jt(o)}${Jt(l)}`:`#${Jt(r)}${Jt(n)}${Jt(o)}`}t.toCss=e;function i(r,n,o,l=255){return(r<<24|n<<16|o<<8|l)>>>0}t.toRgba=i;function s(r,n,o,l){return{css:t.toCss(r,n,o,l),rgba:t.toRgba(r,n,o,l)}}t.toColor=s})(Ke||={});var Wi;(t=>{function e(h,a){if(de=(a.rgba&255)/255,de===1)return{css:a.css,rgba:a.rgba};let c=a.rgba>>24&255,_=a.rgba>>16&255,f=a.rgba>>8&255,d=h.rgba>>24&255,m=h.rgba>>16&255,y=h.rgba>>8&255;Ae=d+Math.round((c-d)*de),Pe=m+Math.round((_-m)*de),$e=y+Math.round((f-y)*de);let k=Ke.toCss(Ae,Pe,$e),R=Ke.toRgba(Ae,Pe,$e);return{css:k,rgba:R}}t.blend=e;function i(h){return(h.rgba&255)===255}t.isOpaque=i;function s(h,a,c){let _=ri.ensureContrastRatio(h.rgba,a.rgba,c);if(_)return Ke.toColor(_>>24&255,_>>16&255,_>>8&255)}t.ensureContrastRatio=s;function r(h){let a=(h.rgba|255)>>>0;return[Ae,Pe,$e]=ri.toChannels(a),{css:Ke.toCss(Ae,Pe,$e),rgba:a}}t.opaque=r;function n(h,a){return de=Math.round(a*255),[Ae,Pe,$e]=ri.toChannels(h.rgba),{css:Ke.toCss(Ae,Pe,$e,de),rgba:Ke.toRgba(Ae,Pe,$e,de)}}t.opacity=n;function o(h,a){return de=h.rgba&255,n(h,de*a/255)}t.multiplyOpacity=o;function l(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}t.toColorRGB=l})(Wi||={});var D_;(t=>{let e,i;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(e=n,e.globalCompositeOperation="copy",i=e.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return Ae=parseInt(r.slice(1,2).repeat(2),16),Pe=parseInt(r.slice(2,3).repeat(2),16),$e=parseInt(r.slice(3,4).repeat(2),16),Ke.toColor(Ae,Pe,$e);case 5:return Ae=parseInt(r.slice(1,2).repeat(2),16),Pe=parseInt(r.slice(2,3).repeat(2),16),$e=parseInt(r.slice(3,4).repeat(2),16),de=parseInt(r.slice(4,5).repeat(2),16),Ke.toColor(Ae,Pe,$e,de);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Ae=parseInt(n[1]),Pe=parseInt(n[2]),$e=parseInt(n[3]),de=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Ke.toColor(Ae,Pe,$e,de);if(!e||!i)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=i,e.fillStyle=r,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[Ae,Pe,$e,de]=e.getImageData(0,0,1,1).data,de!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ke.toRgba(Ae,Pe,$e,de),css:r}}t.toColor=s})(D_||={});var qe;(t=>{function e(s){return i(s>>16&255,s>>8&255,s&255)}t.relativeLuminance=e;function i(s,r,n){let o=s/255,l=r/255,h=n/255,a=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),c=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),_=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return a*.2126+c*.7152+_*.0722}t.relativeLuminance2=i})(qe||={});var ri;(t=>{function e(o,l){if(de=(l&255)/255,de===1)return l;let h=l>>24&255,a=l>>16&255,c=l>>8&255,_=o>>24&255,f=o>>16&255,d=o>>8&255;return Ae=_+Math.round((h-_)*de),Pe=f+Math.round((a-f)*de),$e=d+Math.round((c-d)*de),Ke.toRgba(Ae,Pe,$e)}t.blend=e;function i(o,l,h){let a=qe.relativeLuminance(o>>8),c=qe.relativeLuminance(l>>8);if(Lt(a,c)>8));if(m>8));return m>k?d:y}return d}let _=r(o,l,h),f=Lt(a,qe.relativeLuminance(_>>8));if(f>8));return f>m?_:d}return _}}t.ensureContrastRatio=i;function s(o,l,h){let a=o>>24&255,c=o>>16&255,_=o>>8&255,f=l>>24&255,d=l>>16&255,m=l>>8&255,y=Lt(qe.relativeLuminance2(f,d,m),qe.relativeLuminance2(a,c,_));for(;y0||d>0||m>0);)f-=Math.max(0,Math.ceil(f*.1)),d-=Math.max(0,Math.ceil(d*.1)),m-=Math.max(0,Math.ceil(m*.1)),y=Lt(qe.relativeLuminance2(f,d,m),qe.relativeLuminance2(a,c,_));return(f<<24|d<<16|m<<8|255)>>>0}t.reduceLuminance=s;function r(o,l,h){let a=o>>24&255,c=o>>16&255,_=o>>8&255,f=l>>24&255,d=l>>16&255,m=l>>8&255,y=Lt(qe.relativeLuminance2(f,d,m),qe.relativeLuminance2(a,c,_));for(;y>>0}t.increaseLuminance=r;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}t.toChannels=n})(ri||={});function Jt(t){let e=t.toString(16);return e.length<2?"0"+e:e}function Lt(t,e){return t=128512&&t<=128591||t>=127744&&t<=128511||t>=128640&&t<=128767||t>=9728&&t<=9983||t>=9984&&t<=10175||t>=65024&&t<=65039||t>=129280&&t<=129535||t>=127462&&t<=127487}function O_(t,e,i,s){return e===1&&i>Math.ceil(s*1.5)&&t!==void 0&&t>255&&!I_(t)&&!En(t)&&!P_(t)}function bl(t){return En(t)||$_(t)}function F_(){return{css:{canvas:ns(),cell:ns()},device:{canvas:ns(),cell:ns(),char:{width:0,height:0,left:0,top:0}}}}function ns(){return{width:0,height:0}}function N_(t,e,i=0){return(t-(Math.round(e)*2-i))%(Math.round(e)*2)}var Oe=0,Ee=0,gt=!1,Bt=!1,os=!1,Ye,nr=0,W_=class{constructor(t,e,i,s,r,n){this._terminal=t,this._optionService=e,this._selectionRenderModel=i,this._decorationService=s,this._coreBrowserService=r,this._themeService=n,this.result={fg:0,bg:0,ext:0}}resolve(t,e,i,s){if(this.result.bg=t.bg,this.result.fg=t.fg,this.result.ext=t.bg&268435456?t.extended.ext:0,Ee=0,Oe=0,Bt=!1,gt=!1,os=!1,Ye=this._themeService.colors,nr=0,t.getCode()!==0&&t.extended.underlineStyle===4){let r=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));nr=e*s%(Math.round(r)*2)}if(this._decorationService.forEachDecorationAtCell(e,i,"bottom",r=>{r.backgroundColorRGB&&(Ee=r.backgroundColorRGB.rgba>>8&16777215,Bt=!0),r.foregroundColorRGB&&(Oe=r.foregroundColorRGB.rgba>>8&16777215,gt=!0)}),os=this._selectionRenderModel.isCellSelected(this._terminal,e,i),os){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Ee=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Ee=(this.result.fg&16777215)<<8|255;break;case 0:default:Ee=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Ee=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Ee=(this.result.bg&16777215)<<8|255;break}Ee=ri.blend(Ee,(this._coreBrowserService.isFocused?Ye.selectionBackgroundOpaque:Ye.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Ee=(this._coreBrowserService.isFocused?Ye.selectionBackgroundOpaque:Ye.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Bt=!0,Ye.selectionForeground&&(Oe=Ye.selectionForeground.rgba>>8&16777215,gt=!0),bl(t.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Oe=(this._coreBrowserService.isFocused?Ye.selectionBackgroundOpaque:Ye.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Oe=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Oe=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Oe=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Oe=(this.result.fg&16777215)<<8|255;break;case 0:default:Oe=this._themeService.colors.foreground.rgba}Oe=ri.blend(Oe,(this._coreBrowserService.isFocused?Ye.selectionBackgroundOpaque:Ye.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}gt=!0}}this._decorationService.forEachDecorationAtCell(e,i,"top",r=>{r.backgroundColorRGB&&(Ee=r.backgroundColorRGB.rgba>>8&16777215,Bt=!0),r.foregroundColorRGB&&(Oe=r.foregroundColorRGB.rgba>>8&16777215,gt=!0)}),Bt&&(os?Ee=t.bg&-16777216&-134217729|Ee|50331648:Ee=t.bg&-16777216|Ee|50331648),gt&&(Oe=t.fg&-16777216&-67108865|Oe|50331648),this.result.fg&67108864&&(Bt&&!gt&&((this.result.bg&50331648)===0?Oe=this.result.fg&-134217728|Ye.background.rgba>>8&16777215&16777215|50331648:Oe=this.result.fg&-134217728|this.result.bg&67108863,gt=!0),!Bt&>&&((this.result.fg&50331648)===0?Ee=this.result.bg&-67108864|Ye.foreground.rgba>>8&16777215&16777215|50331648:Ee=this.result.bg&-67108864|this.result.fg&67108863,Bt=!0)),Ye=void 0,this.result.bg=Bt?Ee:this.result.bg,this.result.fg=gt?Oe:this.result.fg,this.result.ext&=536870911,this.result.ext|=nr<<29&3758096384}},z_=.5,yl=E_||M_?"bottom":"ideographic",H_={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},U_={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},q_={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(t,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"║":{1:(t,e)=>`M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1`},"╒":{1:(t,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╓":{1:(t,e)=>`M${.5-t},1 L${.5-t},.5 L1,.5 M${.5+t},.5 L${.5+t},1`},"╔":{1:(t,e)=>`M1,${.5-e} L${.5-t},${.5-e} L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1`},"╕":{1:(t,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"╖":{1:(t,e)=>`M${.5+t},1 L${.5+t},.5 L0,.5 M${.5-t},.5 L${.5-t},1`},"╗":{1:(t,e)=>`M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M0,${.5-e} L${.5+t},${.5-e} L${.5+t},1`},"╘":{1:(t,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"╙":{1:(t,e)=>`M1,.5 L${.5-t},.5 L${.5-t},0 M${.5+t},.5 L${.5+t},0`},"╚":{1:(t,e)=>`M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0 M1,${.5+e} L${.5-t},${.5+e} L${.5-t},0`},"╛":{1:(t,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"╜":{1:(t,e)=>`M0,.5 L${.5+t},.5 L${.5+t},0 M${.5-t},.5 L${.5-t},0`},"╝":{1:(t,e)=>`M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0 M0,${.5+e} L${.5+t},${.5+e} L${.5+t},0`},"╞":{1:(t,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╟":{1:(t,e)=>`M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1 M${.5+t},.5 L1,.5`},"╠":{1:(t,e)=>`M${.5-t},0 L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1 M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0`},"╡":{1:(t,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"╢":{1:(t,e)=>`M0,.5 L${.5-t},.5 M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1`},"╣":{1:(t,e)=>`M${.5+t},0 L${.5+t},1 M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0`},"╤":{1:(t,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"╥":{1:(t,e)=>`M0,.5 L1,.5 M${.5-t},.5 L${.5-t},1 M${.5+t},.5 L${.5+t},1`},"╦":{1:(t,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1`},"╧":{1:(t,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╨":{1:(t,e)=>`M0,.5 L1,.5 M${.5-t},.5 L${.5-t},0 M${.5+t},.5 L${.5+t},0`},"╩":{1:(t,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0 M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0`},"╪":{1:(t,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╫":{1:(t,e)=>`M0,.5 L1,.5 M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1`},"╬":{1:(t,e)=>`M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1 M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0 M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(t,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"╮":{1:(t,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"╯":{1:(t,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"╰":{1:(t,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}},Vi={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};Vi[""]=Vi[""];Vi[""]=Vi[""];function K_(t,e,i,s,r,n,o,l){let h=H_[e];if(h)return V_(t,h,i,s,r,n),!0;let a=U_[e];if(a)return j_(t,a,i,s,r,n),!0;let c=q_[e];if(c)return G_(t,c,i,s,r,n,l),!0;let _=Vi[e];return _?(Y_(t,_,i,s,r,n,o,l),!0):!1}function V_(t,e,i,s,r,n){for(let o=0;o7&&parseInt(l.slice(7,9),16)||1;else if(l.startsWith("rgba"))[m,y,k,R]=l.substring(5,l.length-1).split(",").map(D=>parseFloat(D));else throw new Error(`Unexpected fillStyle color format "${l}" when drawing pattern glyph`);for(let D=0;Dt.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(t,e)=>t.lineTo(e[0],e[1]),M:(t,e)=>t.moveTo(e[0],e[1])};function xl(t,e,i,s,r,n,o,l=0,h=0){let a=t.map(c=>parseFloat(c)||parseInt(c));if(a.length<2)throw new Error("Too few arguments for instruction");for(let c=0;cr){s-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-e))}ms`),this._start();return}s=r}this.clear()}},X_=class extends kl{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let e=performance.now()+t;return{timeRemaining:()=>Math.max(0,e-performance.now())}}},J_=class extends kl{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},Z_=!Bn&&"requestIdleCallback"in window?J_:X_,vi=class Ll{constructor(){this.fg=0,this.bg=0,this.extended=new Bl}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new Ll;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Bl=class El{constructor(e=0,i=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new El(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Q_=globalThis.performance&&typeof globalThis.performance.now=="function",ef=class Ml{static create(e){return new Ml(e)}constructor(e){this._now=Q_&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Pt;(t=>{t.None=()=>dt.None;function e(v,u){return _(v,()=>{},0,void 0,!0,void 0,u)}t.defer=e;function i(v){return(u,p=null,g)=>{let w=!1,b;return b=v(C=>{if(!w)return b?b.dispose():w=!0,u.call(p,C)},null,g),w&&b.dispose(),b}}t.once=i;function s(v,u,p){return a((g,w=null,b)=>v(C=>g.call(w,u(C)),null,b),p)}t.map=s;function r(v,u,p){return a((g,w=null,b)=>v(C=>{u(C),g.call(w,C)},null,b),p)}t.forEach=r;function n(v,u,p){return a((g,w=null,b)=>v(C=>u(C)&&g.call(w,C),null,b),p)}t.filter=n;function o(v){return v}t.signal=o;function l(...v){return(u,p=null,g)=>{let w=vl(...v.map(b=>b(C=>u.call(p,C))));return c(w,g)}}t.any=l;function h(v,u,p,g){let w=p;return s(v,b=>(w=u(w,b),w),g)}t.reduce=h;function a(v,u){let p,g={onWillAddFirstListener(){p=v(w.fire,w)},onDidRemoveLastListener(){p?.dispose()}},w=new se(g);return u?.add(w),w.event}function c(v,u){return u instanceof Array?u.push(v):u&&u.add(v),v}function _(v,u,p=100,g=!1,w=!1,b,C){let x,M,F,K=0,z,pe={leakWarningThreshold:b,onWillAddFirstListener(){x=v(ne=>{K++,M=u(M,ne),g&&!F&&(q.fire(M),M=void 0),z=()=>{let O=M;M=void 0,F=void 0,(!g||K>1)&&q.fire(O),K=0},typeof p=="number"?(clearTimeout(F),F=setTimeout(z,p)):F===void 0&&(F=0,queueMicrotask(z))})},onWillRemoveListener(){w&&K>0&&z?.()},onDidRemoveLastListener(){z=void 0,x.dispose()}},q=new se(pe);return C?.add(q),q.event}t.debounce=_;function f(v,u=0,p){return t.debounce(v,(g,w)=>g?(g.push(w),g):[w],u,void 0,!0,void 0,p)}t.accumulate=f;function d(v,u=(g,w)=>g===w,p){let g=!0,w;return n(v,b=>{let C=g||!u(b,w);return g=!1,w=b,C},p)}t.latch=d;function m(v,u,p){return[t.filter(v,u,p),t.filter(v,g=>!u(g),p)]}t.split=m;function y(v,u=!1,p=[],g){let w=p.slice(),b=v(M=>{w?w.push(M):x.fire(M)});g&&g.add(b);let C=()=>{w?.forEach(M=>x.fire(M)),w=null},x=new se({onWillAddFirstListener(){b||(b=v(M=>x.fire(M)),g&&g.add(b))},onDidAddFirstListener(){w&&(u?setTimeout(C):C())},onDidRemoveLastListener(){b&&b.dispose(),b=null}});return g&&g.add(x),x.event}t.buffer=y;function k(v,u){return(p,g,w)=>{let b=u(new D);return v(function(C){let x=b.evaluate(C);x!==R&&p.call(g,x)},void 0,w)}}t.chain=k;let R=Symbol("HaltChainable");class D{constructor(){this.steps=[]}map(u){return this.steps.push(u),this}forEach(u){return this.steps.push(p=>(u(p),p)),this}filter(u){return this.steps.push(p=>u(p)?p:R),this}reduce(u,p){let g=p;return this.steps.push(w=>(g=u(g,w),g)),this}latch(u=(p,g)=>p===g){let p=!0,g;return this.steps.push(w=>{let b=p||!u(w,g);return p=!1,g=w,b?w:R}),this}evaluate(u){for(let p of this.steps)if(u=p(u),u===R)break;return u}}function T(v,u,p=g=>g){let g=(...x)=>C.fire(p(...x)),w=()=>v.on(u,g),b=()=>v.removeListener(u,g),C=new se({onWillAddFirstListener:w,onDidRemoveLastListener:b});return C.event}t.fromNodeEventEmitter=T;function S(v,u,p=g=>g){let g=(...x)=>C.fire(p(...x)),w=()=>v.addEventListener(u,g),b=()=>v.removeEventListener(u,g),C=new se({onWillAddFirstListener:w,onDidRemoveLastListener:b});return C.event}t.fromDOMEventEmitter=S;function L(v){return new Promise(u=>i(v)(u))}t.toPromise=L;function B(v){let u=new se;return v.then(p=>{u.fire(p)},()=>{u.fire(void 0)}).finally(()=>{u.dispose()}),u.event}t.fromPromise=B;function $(v,u){return v(p=>u.fire(p))}t.forward=$;function U(v,u,p){return u(p),v(g=>u(g))}t.runAndSubscribe=U;class Y{constructor(u,p){this._observable=u,this._counter=0,this._hasChanged=!1;let g={onWillAddFirstListener:()=>{u.addObserver(this)},onDidRemoveLastListener:()=>{u.removeObserver(this)}};this.emitter=new se(g),p&&p.add(this.emitter)}beginUpdate(u){this._counter++}handlePossibleChange(u){}handleChange(u,p){this._hasChanged=!0}endUpdate(u){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function le(v,u){return new Y(v,u).emitter.event}t.fromObservable=le;function W(v){return(u,p,g)=>{let w=0,b=!1,C={beginUpdate(){w++},endUpdate(){w--,w===0&&(v.reportChanges(),b&&(b=!1,u.call(p)))},handlePossibleChange(){},handleChange(){b=!0}};v.addObserver(C),v.reportChanges();let x={dispose(){v.removeObserver(C)}};return g instanceof wi?g.add(x):Array.isArray(g)&&g.push(x),x}}t.fromObservableLight=W})(Pt||={});var cn=class dn{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${dn._idPool++}`,dn.all.add(this)}start(e){this._stopWatch=new ef,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};cn.all=new Set,cn._idPool=0;var tf=cn,sf=-1,Rl=class Tl{constructor(e,i,s=(Tl._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,i){let s=this.threshold;if(s<=0||i{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[s,r]of this._stacks)(!e||i{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let o=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(o);let l=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],h=new af(`${o}. HINT: Stack shows most frequent listener (${l[1]}-times)`,l[0]);return(this._options?.onListenerError||rr)(h),dt.None}if(this._disposed)return dt.None;e&&(t=t.bind(e));let s=new or(t),r;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=nf.create(),r=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof or?(this._deliveryQueue??=new df,this._listeners=[this._listeners,s]):this._listeners.push(s):(this._options?.onWillAddFirstListener?.(this),this._listeners=s,this._options?.onDidAddFirstListener?.(this)),this._size++;let n=We(()=>{r?.(),this._removeListener(s)});return i instanceof wi?i.add(n):Array.isArray(i)&&i.push(n),n},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let e=this._listeners,i=e.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,e[i]=void 0;let s=this._deliveryQueue.current===this;if(this._size*hf<=e.length){let r=0;for(let n=0;n0}},df=class{constructor(){this.i=-1,this.end=0}enqueue(t,e,i){this.i=0,this.end=i,this.current=t,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Oo={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},Di=2,Ai,Ut=class fi{constructor(e,i,s){this._document=e,this._config=i,this._unicodeService=s,this._didWarmUp=!1,this._cacheMap=new Io,this._cacheMapCombined=new Io,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new vi,this._textureSize=512,this._onAddTextureAtlasCanvas=new se,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new se,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=Al(e,this._config.deviceCellWidth*4+Di*2,this._config.deviceCellHeight+Di*2),this._tmpCtx=we(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let e=new Z_;for(let i=33;i<126;i++)e.enqueue(()=>{if(!this._cacheMap.get(i,0,0,0)){let s=this._drawToCache(i,0,0,0,!1,void 0);this._cacheMap.set(i,0,0,0,s)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(fi.maxAtlasPages&&this._pages.length>=Math.max(4,fi.maxAtlasPages)){let i=this._pages.filter(a=>a.canvas.width*2<=(fi.maxTextureSize||4096)).sort((a,c)=>c.canvas.width!==a.canvas.width?c.canvas.width-a.canvas.width:c.percentageUsed-a.percentageUsed),s=-1,r=0;for(let a=0;aa.glyphs[0].texturePage).sort((a,c)=>a>c?1:-1),l=this.pages.length-n.length,h=this._mergePages(n,l);h.version++;for(let a=o.length-1;a>=0;a--)this._deletePage(o[a]);this.pages.push(h),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(h.canvas)}let e=new ar(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,i){let s=e[0].canvas.width*2,r=new ar(this._document,s,e);for(let[n,o]of e.entries()){let l=n*o.canvas.width%s,h=Math.floor(n/2)*o.canvas.height;r.ctx.drawImage(o.canvas,l,h);for(let c of o.glyphs)c.texturePage=i,c.sizeClipSpace.x=c.size.x/s,c.sizeClipSpace.y=c.size.y/s,c.texturePosition.x+=l,c.texturePosition.y+=h,c.texturePositionClipSpace.x=c.texturePosition.x/s,c.texturePositionClipSpace.y=c.texturePosition.y/s;this._onRemoveTextureAtlasCanvas.fire(o.canvas);let a=this._activePages.indexOf(o);a!==-1&&this._activePages.splice(a,1)}return r}_deletePage(e){this._pages.splice(e,1);for(let i=e;i=this._config.colors.ansi.length)throw new Error("No color found for idx "+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,i,s,r){if(this._config.allowTransparency)return ot;let n;switch(e){case 16777216:case 33554432:n=this._getColorFromAnsiIndex(i);break;case 50331648:let o=vi.toColorRGB(i);n=Ke.toColor(o[0],o[1],o[2]);break;case 0:default:s?n=Wi.opaque(this._config.colors.foreground):n=this._config.colors.background;break}return this._config.allowTransparency||(n=Wi.opaque(n)),n}_getForegroundColor(e,i,s,r,n,o,l,h,a,c){let _=this._getMinimumContrastColor(e,i,s,r,n,o,l,a,h,c);if(_)return _;let f;switch(n){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&a&&o<8&&(o+=8),f=this._getColorFromAnsiIndex(o);break;case 50331648:let d=vi.toColorRGB(o);f=Ke.toColor(d[0],d[1],d[2]);break;case 0:default:l?f=this._config.colors.background:f=this._config.colors.foreground}return this._config.allowTransparency&&(f=Wi.opaque(f)),h&&(f=Wi.multiplyOpacity(f,z_)),f}_resolveBackgroundRgba(e,i,s){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;case 0:default:return s?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,i,s,r){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&i<8&&(i+=8),this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;case 0:default:return s?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,i,s,r,n,o,l,h,a,c){if(this._config.minimumContrastRatio===1||c)return;let _=this._getContrastCache(a),f=_.getColor(e,r);if(f!==void 0)return f||void 0;let d=this._resolveBackgroundRgba(i,s,l),m=this._resolveForegroundRgba(n,o,l,h),y=ri.ensureContrastRatio(d,m,this._config.minimumContrastRatio/(a?2:1));if(!y){_.setColor(e,r,null);return}let k=Ke.toColor(y>>24&255,y>>16&255,y>>8&255);return _.setColor(e,r,k),k}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,i,s,r,n,o){let l=typeof e=="number"?String.fromCharCode(e):e;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display="none",o.append(this._tmpCanvas));let h=Math.min(this._config.deviceCellWidth*Math.max(l.length,2)+Di*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width=M?M*2-ne:M-ne;ne>=M||N===0?(this._tmpCtx.setLineDash([Math.round(M),Math.round(M)]),this._tmpCtx.moveTo(I+N,z),this._tmpCtx.lineTo(G,z)):(this._tmpCtx.setLineDash([Math.round(M),Math.round(M)]),this._tmpCtx.moveTo(I,z),this._tmpCtx.lineTo(I+N,z),this._tmpCtx.moveTo(I+N+M,z),this._tmpCtx.lineTo(G,z)),ne=N_(G-I,M,ne);break;case 5:let be=.6,fe=.3,ee=G-I,He=Math.floor(be*ee),ve=Math.floor(fe*ee),hi=ee-He-ve;this._tmpCtx.setLineDash([He,ve,hi]),this._tmpCtx.moveTo(I,z),this._tmpCtx.lineTo(G,z);break;case 1:default:this._tmpCtx.moveTo(I,z),this._tmpCtx.lineTo(G,z);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!v&&this._config.fontSize>=12&&!this._config.allowTransparency&&l!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let O=this._tmpCtx.measureText(l);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in O&&O.actualBoundingBoxDescent>0){this._tmpCtx.save();let I=new Path2D;I.rect(K,z-Math.ceil(M/2),this._config.deviceCellWidth*p,q-z+Math.ceil(M/2)),this._tmpCtx.clip(I),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=L.css,this._tmpCtx.strokeText(l,W,W+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(k){let M=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),F=M%2===1?.5:0;this._tmpCtx.lineWidth=M,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(W,W+F),this._tmpCtx.lineTo(W+this._config.deviceCharWidth*p,W+F),this._tmpCtx.stroke()}if(v||this._tmpCtx.fillText(l,W,W+this._config.deviceCharHeight),l==="_"&&!this._config.allowTransparency){let M=lr(this._tmpCtx.getImageData(W,W,this._config.deviceCellWidth,this._config.deviceCellHeight),L,le,u);if(M)for(let F=1;F<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=L.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(l,W,W+this._config.deviceCharHeight-F),M=lr(this._tmpCtx.getImageData(W,W,this._config.deviceCellWidth,this._config.deviceCellHeight),L,le,u),!!M);F++);}if(y){let M=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),F=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=M,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(W,W+Math.floor(this._config.deviceCharHeight/2)-F),this._tmpCtx.lineTo(W+this._config.deviceCharWidth*p,W+Math.floor(this._config.deviceCharHeight/2)-F),this._tmpCtx.stroke()}this._tmpCtx.restore();let g=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),w;if(this._config.allowTransparency?w=uf(g):w=lr(g,L,le,u),w)return Oo;let b=this._findGlyphBoundingBox(g,this._workBoundingBox,h,Y,v,W),C,x;for(;;){if(this._activePages.length===0){let M=this._createNewPage();C=M,x=M.currentRow,x.height=b.size.y;break}C=this._activePages[this._activePages.length-1],x=C.currentRow;for(let M of this._activePages)b.size.y<=M.currentRow.height&&(C=M,x=M.currentRow);for(let M=this._activePages.length-1;M>=0;M--)for(let F of this._activePages[M].fixedRows)F.height<=x.height&&b.size.y<=F.height&&(C=this._activePages[M],x=F);if(b.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new ar(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),C=this._overflowSizePage,x=this._overflowSizePage.currentRow,x.x+b.size.x>=C.canvas.width&&(x.x=0,x.y+=x.height,x.height=0);break}if(x.y+b.size.y>=C.canvas.height||x.height>b.size.y+2){let M=!1;if(C.currentRow.y+C.currentRow.height+b.size.y>=C.canvas.height){let F;for(let K of this._activePages)if(K.currentRow.y+K.currentRow.height+b.size.y=fi.maxAtlasPages&&x.y+b.size.y<=C.canvas.height&&x.height>=b.size.y&&x.x+b.size.x<=C.canvas.width)M=!0;else{let K=this._createNewPage();C=K,x=K.currentRow,x.height=b.size.y,M=!0}}M||(C.currentRow.height>0&&C.fixedRows.push(C.currentRow),x={x:0,y:C.currentRow.y+C.currentRow.height,height:b.size.y},C.fixedRows.push(x),C.currentRow={x:0,y:x.y+x.height,height:0})}if(x.x+b.size.x<=C.canvas.width)break;x===C.currentRow?(x.x=0,x.y+=x.height,x.height=0):C.fixedRows.splice(C.fixedRows.indexOf(x),1)}return b.texturePage=this._pages.indexOf(C),b.texturePosition.x=x.x,b.texturePosition.y=x.y,b.texturePositionClipSpace.x=x.x/C.canvas.width,b.texturePositionClipSpace.y=x.y/C.canvas.height,b.sizeClipSpace.x/=C.canvas.width,b.sizeClipSpace.y/=C.canvas.height,x.height=Math.max(x.height,b.size.y),x.x+=b.size.x,C.ctx.putImageData(g,b.texturePosition.x-this._workBoundingBox.left,b.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,b.size.x,b.size.y),C.addGlyph(b),C.version++,b}_findGlyphBoundingBox(e,i,s,r,n,o){i.top=0;let l=r?this._config.deviceCellHeight:this._tmpCanvas.height,h=r?this._config.deviceCellWidth:s,a=!1;for(let c=0;c=o;c--){for(let _=0;_=0;c--){for(let _=0;_>>24,n=e.rgba>>>16&255,o=e.rgba>>>8&255,l=i.rgba>>>24,h=i.rgba>>>16&255,a=i.rgba>>>8&255,c=Math.floor((Math.abs(r-l)+Math.abs(n-h)+Math.abs(o-a))/12),_=!0;for(let f=0;f0)return!1;return!0}function Al(t,e,i){let s=t.createElement("canvas");return s.width=e,s.height=i,s}function _f(t,e,i,s,r,n,o,l){let h={foreground:n.foreground,background:n.background,cursor:ot,cursorAccent:ot,selectionForeground:ot,selectionBackgroundTransparent:ot,selectionBackgroundOpaque:ot,selectionInactiveBackgroundTransparent:ot,selectionInactiveBackgroundOpaque:ot,overviewRulerBorder:ot,scrollbarSliderBackground:ot,scrollbarSliderHoverBackground:ot,scrollbarSliderActiveBackground:ot,ansi:n.ansi.slice(),contrastCache:n.contrastCache,halfContrastCache:n.halfContrastCache};return{customGlyphs:r.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:l,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,deviceCellWidth:t,deviceCellHeight:e,deviceCharWidth:i,deviceCharHeight:s,fontFamily:r.fontFamily,fontSize:r.fontSize,fontWeight:r.fontWeight,fontWeightBold:r.fontWeightBold,allowTransparency:r.allowTransparency,drawBoldTextInBrightColors:r.drawBoldTextInBrightColors,minimumContrastRatio:r.minimumContrastRatio,colors:h}}function Fo(t,e){for(let i=0;i=0){if(Fo(d.config,a))return d.atlas;d.ownedBy.length===1?(d.atlas.dispose(),ht.splice(f,1)):d.ownedBy.splice(m,1);break}}for(let f=0;f{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(t=as){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let e=as-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0){this._restartInterval(e);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let e=as-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},as)},t)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function Wo(t,e,i){let s=new e.ResizeObserver(r=>{let n=r.find(h=>h.target===t);if(!n)return;if(!("devicePixelContentBoxSize"in n)){s?.disconnect(),s=void 0;return}let o=n.devicePixelContentBoxSize[0].inlineSize,l=n.devicePixelContentBoxSize[0].blockSize;o>0&&l>0&&i(o,l)});try{s.observe(t,{box:["device-pixel-content-box"]})}catch{s.disconnect(),s=void 0}return We(()=>s?.disconnect())}function pf(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}var zo=class $l extends vi{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Bl,this.combinedData=""}static fromCharData(e){let i=new $l;return i.setFromCharData(e),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?pf(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let i=!1;if(e[1].length>2)i=!0;else if(e[1].length===2){let s=e[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|e[2]<<22:i=!0}else i=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;i&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Il=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function Ol(t,e,i){let s=we(t.createProgram());if(t.attachShader(s,we(Ho(t,t.VERTEX_SHADER,e))),t.attachShader(s,we(Ho(t,t.FRAGMENT_SHADER,i))),t.linkProgram(s),t.getProgramParameter(s,t.LINK_STATUS))return s;console.error(t.getProgramInfoLog(s)),t.deleteProgram(s)}function Ho(t,e,i){let s=we(t.createShader(e));if(t.shaderSource(s,i),t.compileShader(s),t.getShaderParameter(s,t.COMPILE_STATUS))return s;console.error(t.getShaderInfoLog(s)),t.deleteShader(s)}function vf(t,e){let i=Math.min(t.length*2,e),s=new Float32Array(i);for(let r=0;rr.deleteProgram(this._program))),this._projectionLocation=we(r.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=we(r.getUniformLocation(this._program,"u_resolution")),this._textureLocation=we(r.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=r.createVertexArray(),r.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=r.createBuffer();this._register(We(()=>r.deleteBuffer(o))),r.bindBuffer(r.ARRAY_BUFFER,o),r.bufferData(r.ARRAY_BUFFER,n,r.STATIC_DRAW),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let l=new Uint8Array([0,1,2,3]),h=r.createBuffer();this._register(We(()=>r.deleteBuffer(h))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,h),r.bufferData(r.ELEMENT_ARRAY_BUFFER,l,r.STATIC_DRAW),this._attributesBuffer=we(r.createBuffer()),this._register(We(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,2,r.FLOAT,!1,ui,0),r.vertexAttribDivisor(2,1),r.enableVertexAttribArray(3),r.vertexAttribPointer(3,2,r.FLOAT,!1,ui,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(3,1),r.enableVertexAttribArray(4),r.vertexAttribPointer(4,1,r.FLOAT,!1,ui,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(4,1),r.enableVertexAttribArray(5),r.vertexAttribPointer(5,2,r.FLOAT,!1,ui,5*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(5,1),r.enableVertexAttribArray(6),r.vertexAttribPointer(6,2,r.FLOAT,!1,ui,7*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(6,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,ui,9*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.useProgram(this._program);let a=new Int32Array(Ut.maxAtlasPages);for(let c=0;cr.deleteTexture(_.texture))),r.activeTexture(r.TEXTURE0+c),r.bindTexture(r.TEXTURE_2D,_.texture),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[c]=_}r.enable(r.BLEND),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,e,i,s,r,n,o,l,h){this._updateCell(this._vertices.attributes,t,e,i,s,r,n,o,l,h)}_updateCell(t,e,i,s,r,n,o,l,h,a){if(he=(i*this._terminal.cols+e)*qt,s===0||s===void 0){t.fill(0,he,he+qt-1-bf);return}this._atlas&&(l&&l.length>1?te=this._atlas.getRasterizedGlyphCombinedChar(l,r,n,o,!1,this._terminal.element):te=this._atlas.getRasterizedGlyph(s,r,n,o,!1,this._terminal.element),hr=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),r!==a&&te.offset.x>hr?(Pi=te.offset.x-hr,t[he]=-(te.offset.x-Pi)+this._dimensions.device.char.left,t[he+1]=-te.offset.y+this._dimensions.device.char.top,t[he+2]=(te.size.x-Pi)/this._dimensions.device.canvas.width,t[he+3]=te.size.y/this._dimensions.device.canvas.height,t[he+4]=te.texturePage,t[he+5]=te.texturePositionClipSpace.x+Pi/this._atlas.pages[te.texturePage].canvas.width,t[he+6]=te.texturePositionClipSpace.y,t[he+7]=te.sizeClipSpace.x-Pi/this._atlas.pages[te.texturePage].canvas.width,t[he+8]=te.sizeClipSpace.y):(t[he]=-te.offset.x+this._dimensions.device.char.left,t[he+1]=-te.offset.y+this._dimensions.device.char.top,t[he+2]=te.size.x/this._dimensions.device.canvas.width,t[he+3]=te.size.y/this._dimensions.device.canvas.height,t[he+4]=te.texturePage,t[he+5]=te.texturePositionClipSpace.x,t[he+6]=te.texturePositionClipSpace.y,t[he+7]=te.sizeClipSpace.x,t[he+8]=te.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&O_(s,h,te.size.x,this._dimensions.device.cell.width)&&(t[he+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,e=t.cols*t.rows*qt;this._vertices.count!==e?this._vertices.attributes=new Float32Array(e):this._vertices.attributes.fill(0);let i=0;for(;i=t.rows||h<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=l,this.viewportCappedEndRow=h,this.startCol=e[0],this.endCol=i[0]}isCellSelected(t,e,i){return this.hasSelection?(i-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?e>=this.startCol&&i>=this.viewportCappedStartRow&&e=this.viewportCappedStartRow&&e>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i=this.startCol&&e=this.startCol):!1}};function xf(){return new Cf}var Rs=4,ms=1,ws=2,cr=3,kf=2147483648,Lf=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=xf()}resize(t,e){let i=t*e*Rs;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(e))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},Bf=`#version 300 es
+layout (location = 0) in vec2 a_position;
+layout (location = 1) in vec2 a_size;
+layout (location = 2) in vec4 a_color;
+layout (location = 3) in vec2 a_unitquad;
+
+uniform mat4 u_projection;
+
+out vec4 v_color;
+
+void main() {
+ vec2 zeroToOne = a_position + (a_unitquad * a_size);
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
+ v_color = a_color;
+}`,Ef=`#version 300 es
+precision lowp float;
+
+in vec4 v_color;
+
+out vec4 outColor;
+
+void main() {
+ outColor = v_color;
+}`,Dt=8,dr=Dt*Float32Array.BYTES_PER_ELEMENT,Mf=20*Dt,Uo=class{constructor(){this.attributes=new Float32Array(Mf),this.count=0}},Et=0,qo=0,Ko=0,Vo=0,jo=0,Go=0,Yo=0,Rf=class extends dt{constructor(t,e,i,s){super(),this._terminal=t,this._gl=e,this._dimensions=i,this._themeService=s,this._vertices=new Uo,this._verticesCursor=new Uo;let r=this._gl;this._program=we(Ol(r,Bf,Ef)),this._register(We(()=>r.deleteProgram(this._program))),this._projectionLocation=we(r.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=r.createVertexArray(),r.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=r.createBuffer();this._register(We(()=>r.deleteBuffer(o))),r.bindBuffer(r.ARRAY_BUFFER,o),r.bufferData(r.ARRAY_BUFFER,n,r.STATIC_DRAW),r.enableVertexAttribArray(3),r.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let l=new Uint8Array([0,1,2,3]),h=r.createBuffer();this._register(We(()=>r.deleteBuffer(h))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,h),r.bufferData(r.ELEMENT_ARRAY_BUFFER,l,r.STATIC_DRAW),this._attributesBuffer=we(r.createBuffer()),this._register(We(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,r.FLOAT,!1,dr,0),r.vertexAttribDivisor(0,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,dr,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,4,r.FLOAT,!1,dr,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(2,1),this._updateCachedColors(s.colors),this._register(this._themeService.onChangeColors(a=>{this._updateCachedColors(a),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(t){let e=this._gl;e.useProgram(this._program),e.bindVertexArray(this._vertexArrayObject),e.uniformMatrix4fv(this._projectionLocation,!1,Il),e.bindBuffer(e.ARRAY_BUFFER,this._attributesBuffer),e.bufferData(e.ARRAY_BUFFER,t.attributes,e.DYNAMIC_DRAW),e.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,e.UNSIGNED_BYTE,0,t.count)}handleResize(){this._updateViewportRectangle()}setDimensions(t){this._dimensions=t}_updateCachedColors(t){this._bgFloat=this._colorToFloat32Array(t.background),this._cursorFloat=this._colorToFloat32Array(t.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(t){let e=this._terminal,i=this._vertices,s=1,r,n,o,l,h,a,c,_,f,d,m;for(r=0;r>24&255)/255,jo=(Et>>16&255)/255,Go=(Et>>8&255)/255,Yo=1,this._addRectangle(t.attributes,e,qo,Ko,(n-r)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Vo,jo,Go,Yo)}_addRectangle(t,e,i,s,r,n,o,l,h,a){t[e]=i/this._dimensions.device.canvas.width,t[e+1]=s/this._dimensions.device.canvas.height,t[e+2]=r/this._dimensions.device.canvas.width,t[e+3]=n/this._dimensions.device.canvas.height,t[e+4]=o,t[e+5]=l,t[e+6]=h,t[e+7]=a}_addRectangleFloat(t,e,i,s,r,n,o){t[e]=i/this._dimensions.device.canvas.width,t[e+1]=s/this._dimensions.device.canvas.height,t[e+2]=r/this._dimensions.device.canvas.width,t[e+3]=n/this._dimensions.device.canvas.height,t[e+4]=o[0],t[e+5]=o[1],t[e+6]=o[2],t[e+7]=o[3]}_colorToFloat32Array(t){return new Float32Array([(t.rgba>>24&255)/255,(t.rgba>>16&255)/255,(t.rgba>>8&255)/255,(t.rgba&255)/255])}},Tf=class extends dt{constructor(t,e,i,s,r,n,o,l){super(),this._container=e,this._alpha=r,this._coreBrowserService=n,this._optionsService=o,this._themeService=l,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(h=>{this._refreshCharAtlas(t,h),this.reset(t)})),this._register(We(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=we(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(t){}handleFocus(t){}handleCursorMove(t){}handleGridChanged(t,e,i){}handleSelectionChanged(t,e,i,s=!1){}_setTransparency(t,e){if(e===this._alpha)return;let i=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(t,this._themeService.colors),this.handleGridChanged(t,0,t.rows-1)}_refreshCharAtlas(t,e){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=Pl(t,this._optionsService.rawOptions,e,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(t,e){this._deviceCellWidth=e.device.cell.width,this._deviceCellHeight=e.device.cell.height,this._deviceCharWidth=e.device.char.width,this._deviceCharHeight=e.device.char.height,this._deviceCharLeft=e.device.char.left,this._deviceCharTop=e.device.char.top,this._canvas.width=e.device.canvas.width,this._canvas.height=e.device.canvas.height,this._canvas.style.width=`${e.css.canvas.width}px`,this._canvas.style.height=`${e.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(t,this._themeService.colors)}_fillBottomLineAtCells(t,e,i=1){this._ctx.fillRect(t*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(t,e,i,s){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(t,e,i,s){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=yl,this._clipCell(i,s,e.getWidth()),this._ctx.fillText(e.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,s*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(t,e,i){this._ctx.beginPath(),this._ctx.rect(t*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(t,e,i){let s=e?t.options.fontWeightBold:t.options.fontWeight;return`${i?"italic":""} ${s} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}},Df=class extends Tf{constructor(t,e,i,s,r,n,o){super(i,t,"link",e,!0,r,n,o),this._register(s.onShowLinkUnderline(l=>this._handleShowLinkUnderline(l))),this._register(s.onHideLinkUnderline(l=>this._handleHideLinkUnderline(l)))}resize(t,e){super.resize(t,e),this._state=void 0}reset(t){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let t=this._state.y2-this._state.y1-1;t>0&&this._clearCells(0,this._state.y1+1,this._state.cols,t),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(t){if(t.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:t.fg!==void 0&&ff(t.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[t.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,t.y1===t.y2)this._fillBottomLineAtCells(t.x1,t.y1,t.x2-t.x1);else{this._fillBottomLineAtCells(t.x1,t.y1,t.cols-t.x1);for(let e=t.y1+1;e=0;xi.indexOf("AppleWebKit")>=0;var Pf=xi.indexOf("Chrome")>=0;!Pf&&xi.indexOf("Safari")>=0;xi.indexOf("Electron/")>=0;xi.indexOf("Android")>=0;var ur=!1;if(typeof ti.matchMedia=="function"){let t=ti.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=ti.matchMedia("(display-mode: fullscreen)");ur=t.matches,Af(ti,t,({matches:i})=>{ur&&e.matches||(ur=i)})}var mi="en",_r=!1,Nl=!1,ls,Ss=mi,Xo=mi,$f,Tt,ni=globalThis,et;typeof ni.vscode<"u"&&typeof ni.vscode.process<"u"?et=ni.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(et=process);var If=typeof et?.versions?.electron=="string",Of=If&&et?.type==="renderer";if(typeof et=="object"){et.platform,et.platform,_r=et.platform==="linux",_r&&et.env.SNAP&&et.env.SNAP_REVISION,et.env.CI||et.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ls=mi,Ss=mi;let t=et.env.VSCODE_NLS_CONFIG;if(t)try{let e=JSON.parse(t);ls=e.userLocale,Xo=e.osLocale,Ss=e.resolvedLanguage||mi,$f=e.languagePack?.translationsConfigFile}catch{}Nl=!0}else typeof navigator=="object"&&!Of?(Tt=navigator.userAgent,Tt.indexOf("Windows")>=0,Tt.indexOf("Macintosh")>=0,(Tt.indexOf("Macintosh")>=0||Tt.indexOf("iPad")>=0||Tt.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,_r=Tt.indexOf("Linux")>=0,Tt?.indexOf("Mobi")>=0,Ss=globalThis._VSCODE_NLS_LANGUAGE||mi,ls=navigator.language.toLowerCase(),Xo=ls):console.error("Unable to resolve platform.");var Jo=Nl,yt=Tt,zt=Ss,Ff;(t=>{function e(){return zt}t.value=e;function i(){return zt.length===2?zt==="en":zt.length>=3?zt[0]==="e"&&zt[1]==="n"&&zt[2]==="-":!1}t.isDefaultVariant=i;function s(){return zt==="en"}t.isDefault=s})(Ff||={});var Nf=typeof ni.postMessage=="function"&&!ni.importScripts;(()=>{if(Nf){let t=[];ni.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=t.length;s{let s=++e;t.push({id:s,callback:i}),ni.postMessage({vscodeScheduleAsyncWork:s},"*")}}return t=>setTimeout(t)})();var Wf=!!(yt&&yt.indexOf("Chrome")>=0);yt&&yt.indexOf("Firefox")>=0;!Wf&&yt&&yt.indexOf("Safari")>=0;yt&&yt.indexOf("Edg/")>=0;yt&&yt.indexOf("Android")>=0;var _i=typeof navigator=="object"?navigator:{};Jo||document.queryCommandSupported&&document.queryCommandSupported("copy")||_i&&_i.clipboard&&_i.clipboard.writeText,Jo||_i&&_i.clipboard&&_i.clipboard.readText;var Mn=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(t,e){this._keyCodeToStr[t]=e,this._strToKeyCode[e.toLowerCase()]=t}keyCodeToStr(t){return this._keyCodeToStr[t]}strToKeyCode(t){return this._strToKeyCode[t.toLowerCase()]||0}},fr=new Mn,Zo=new Mn,Qo=new Mn;new Array(230);var zf;(t=>{function e(l){return fr.keyCodeToStr(l)}t.toString=e;function i(l){return fr.strToKeyCode(l)}t.fromString=i;function s(l){return Zo.keyCodeToStr(l)}t.toUserSettingsUS=s;function r(l){return Qo.keyCodeToStr(l)}t.toUserSettingsGeneral=r;function n(l){return Zo.strToKeyCode(l)||Qo.strToKeyCode(l)}t.fromUserSettings=n;function o(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return fr.keyCodeToStr(l)}t.toElectronAccelerator=o})(zf||={});var Wl=Object.freeze(function(t,e){let i=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(i)}}}),Hf;(t=>{function e(i){return i===t.None||i===t.Cancelled||i instanceof Uf?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Pt.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Wl})})(Hf||={});var Uf=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Wl:(this._emitter||(this._emitter=new se),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},qf;(t=>{async function e(s){let r,n=await Promise.all(s.map(o=>o.then(l=>l,l=>{r||(r=l)})));if(typeof r<"u")throw r;return n}t.settled=e;function i(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}t.withAsyncBody=i})(qf||={});var ea=class at{static fromArray(e){return new at(i=>{i.emitMany(e)})}static fromPromise(e){return new at(async i=>{i.emitMany(await e)})}static fromPromises(e){return new at(async i=>{await Promise.all(e.map(async s=>i.emitOne(await s)))})}static merge(e){return new at(async i=>{await Promise.all(e.map(async s=>{for await(let r of s)i.emitOne(r)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new se,queueMicrotask(async()=>{let s={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(e(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e(this._onReturn?.(),{done:!0,value:void 0})}}static map(e,i){return new at(async s=>{for await(let r of e)s.emitOne(i(r))})}map(e){return at.map(this,e)}static filter(e,i){return new at(async s=>{for await(let r of e)i(r)&&s.emitOne(r)})}filter(e){return at.filter(this,e)}static coalesce(e){return at.filter(e,i=>!!i)}coalesce(){return at.coalesce(this)}static async toPromise(e){let i=[];for await(let s of e)i.push(s);return i}toPromise(){return at.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};ea.EMPTY=ea.fromArray([]);var{getWindow:Kf}=function(){let t=new Map,e={window:ti,disposables:new wi};t.set(ti.vscodeWindowId,e);let i=new se,s=new se,r=new se;function n(o,l){return(typeof o=="number"?t.get(o):void 0)??(l?e:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(o){if(t.has(o.vscodeWindowId))return dt.None;let l=new wi,h={window:o,disposables:l.add(new wi)};return t.set(o.vscodeWindowId,h),l.add(We(()=>{t.delete(o.vscodeWindowId),s.fire(o)})),l.add(_n(o,jf.BEFORE_UNLOAD,()=>{r.fire(o)})),i.fire(h),l},getWindows(){return t.values()},getWindowsCount(){return t.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return t.has(o)},getWindowById:n,getWindow(o){let l=o;if(l?.ownerDocument?.defaultView)return l.ownerDocument.defaultView.window;let h=o;return h?.view?h.view.window:ti},getDocument(o){return Kf(o).document}}}(),Vf=class{constructor(t,e,i,s){this._node=t,this._type=e,this._handler=i,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function _n(t,e,i,s){return new Vf(t,e,i,s)}var jf={BEFORE_UNLOAD:"beforeunload"},Gf=class extends dt{constructor(t,e,i,s,r,n,o,l,h){super(),this._terminal=t,this._characterJoinerService=e,this._charSizeService=i,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._optionsService=o,this._themeService=l,this._cursorBlinkStateManager=new Ti,this._charAtlasDisposable=this._register(new Ti),this._observerDisposable=this._register(new Ti),this._model=new Lf,this._workCell=new zo,this._workCell2=new zo,this._rectangleRenderer=this._register(new Ti),this._glyphRenderer=this._register(new Ti),this._onChangeTextureAtlas=this._register(new se),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new se),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new se),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new se),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new se),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let a={antialias:!1,depth:!1,preserveDrawingBuffer:h};if(this._gl=this._canvas.getContext("webgl2",a),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new W_(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new Df(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=F_(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(_n(this._canvas,"webglcontextlost",c=>{console.log("webglcontextlost event received"),c.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(c)},3e3)})),this._register(_n(this._canvas,"webglcontextrestored",c=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,No(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=Wo(this._canvas,this._coreBrowserService.window,(c,_)=>this._setCanvasDevicePixelDimensions(c,_)),this._register(this._coreBrowserService.onWindowChange(c=>{this._observerDisposable.value=Wo(this._canvas,c,(_,f)=>this._setCanvasDevicePixelDimensions(_,f))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(We(()=>{for(let c of this._renderLayers)c.dispose();this._canvas.parentElement?.removeChild(this._canvas),No(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(t,e){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let i of this._renderLayers)i.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let t of this._renderLayers)t.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let t of this._renderLayers)t.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(t,e,i){for(let s of this._renderLayers)s.handleSelectionChanged(this._terminal,t,e,i);this._model.selection.update(this._core,t,e,i),this._requestRedrawViewport()}handleCursorMove(){for(let t of this._renderLayers)t.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new Rf(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new yf(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let t=Pl(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==t&&(this._onChangeTextureAtlas.fire(t.pages[0].canvas),this._charAtlasDisposable.value=vl(Pt.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Pt.forward(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=t,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(t){this._model.clear(),t&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let t of this._renderLayers)t.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(t,e){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let i of this._renderLayers)i.handleGridChanged(this._terminal,t,e);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(t,e),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new gf(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,e){let i=this._core,s=this._workCell,r,n,o,l,h,a,c=0,_=!0,f,d,m,y,k,R,D,T,S;t=ta(t,i.rows-1,0),e=ta(e,i.rows-1,0);let L=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",B=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,$=B-i.buffer.ydisp,U=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),Y=-1,le=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let W=!1;for(n=t;n<=e;n++)for(o=n+i.buffer.ydisp,l=i.buffer.lines.get(o),this._model.lineLengths[n]=0,m=B===o,c=0,h=this._characterJoinerService.getJoinedCharacters(o),T=0;T=c,f=T,h.length>0&&T===h[0][0]&&_){d=h.shift();let v=this._model.selection.isCellSelected(this._terminal,d[0],o);for(D=d[0]+1;D=d[1],_?(a=!0,s=new Yf(s,l.translateToString(!0,d[0],d[1]),d[1]-d[0]),f=d[1]-1):c=d[1]}if(y=s.getChars(),k=s.getCode(),D=(n*i.cols+T)*Rs,this._cellColorResolver.resolve(s,T,o,this.dimensions.device.cell.width),le&&o===B&&(T===U&&(this._model.cursor={x:U,y:$,width:s.getWidth(),style:this._coreBrowserService.isFocused?L:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},Y=U+s.getWidth()-1),T>=U&&T<=Y&&(this._coreBrowserService.isFocused&&L==="block"||this._coreBrowserService.isFocused===!1&&i.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),k!==0&&(this._model.lineLengths[n]=T+1),!(this._model.cells[D]===k&&this._model.cells[D+ms]===this._cellColorResolver.result.bg&&this._model.cells[D+ws]===this._cellColorResolver.result.fg&&this._model.cells[D+cr]===this._cellColorResolver.result.ext)&&(W=!0,y.length>1&&(k|=kf),this._model.cells[D]=k,this._model.cells[D+ms]=this._cellColorResolver.result.bg,this._model.cells[D+ws]=this._cellColorResolver.result.fg,this._model.cells[D+cr]=this._cellColorResolver.result.ext,R=s.getWidth(),this._glyphRenderer.value.updateCell(T,n,k,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,y,R,r),a)){for(s=this._workCell,T++;T<=f;T++)S=(n*i.cols+T)*Rs,this._glyphRenderer.value.updateCell(T,n,0,0,0,0,T_,0,0),this._model.cells[S]=0,this._model.cells[S+ms]=this._cellColorResolver.result.bg,this._model.cells[S+ws]=this._cellColorResolver.result.fg,this._model.cells[S+cr]=this._cellColorResolver.result.ext;T--}}W&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(t,e){this._canvas.width===t&&this._canvas.height===e||(this._canvas.width=t,this._canvas.height=e,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let t=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:t,end:t})}},Yf=class extends vi{constructor(t,e,i){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=e,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function ta(t,e,i=0){return Math.max(Math.min(t,e),i)}var ia="di$target",sa="di$dependencies",gr=new Map;function Ct(t){if(gr.has(t))return gr.get(t);let e=function(i,s,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Xf(e,i,r)};return e._id=t,gr.set(t,e),e}function Xf(t,e,i){e[ia]===e?e[sa].push({id:t,index:i}):(e[sa]=[{id:t,index:i}],e[ia]=e)}Ct("BufferService");Ct("CoreMouseService");Ct("CoreService");Ct("CharsetService");Ct("InstantiationService");Ct("LogService");var Jf=Ct("OptionsService");Ct("OscLinkService");Ct("UnicodeService");Ct("DecorationService");var Zf={trace:0,debug:1,info:2,warn:3,error:4,off:5},Qf="xterm.js: ",ra=class extends dt{constructor(t){super(),this._optionsService=t,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Zf[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let e=0;ethis.activate(t)));return}this._terminal=t;let i=e.coreService,s=e.optionsService,r=e,n=r._renderService,o=r._characterJoinerService,l=r._charSizeService,h=r._coreBrowserService,a=r._decorationService;r._logService;let c=r._themeService;this._renderer=this._register(new Gf(t,o,l,h,i,a,s,c,this._preserveDrawingBuffer)),this._register(Pt.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Pt.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Pt.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Pt.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this._register(We(()=>{if(this._terminal._core._store._isDisposed)return;let _=this._terminal._core._renderService;_.setRenderer(this._terminal._core._createRenderer()),_.handleResize(t.cols,t.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};class ze{aliases;usage;matches(e){const i=e.toLowerCase();return i===this.name.toLowerCase()||(this.aliases?.some(s=>i===s.toLowerCase())??!1)}writeLine(e,i,s){s?e.writeln(`${s}${i}\x1B[0m`):e.writeln(i)}writeSuccess(e,i){e.writeln(`\x1B[1;32m✓\x1B[0m ${i}`)}writeError(e,i){e.writeln(`\x1B[1;31m✗ Error:\x1B[0m ${i}`)}writeInfo(e,i){e.writeln(`\x1B[90m${i}\x1B[0m`)}startLoading(e,i){const s=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];let r=0,n=!0;const o=setInterval(()=>{if(!n){clearInterval(o);return}e.write(`\r\x1B[36m${s[r]}\x1B[0m ${i}`),r=(r+1)%s.length},80);return()=>{n=!1,clearInterval(o),e.write("\r\x1B[K")}}}class tg extends ze{constructor(e){super(),this.commands=e}name="help";description="Show available commands";aliases=["?","h"];execute({term:e,writePrompt:i}){e.writeln(""),e.writeln("\x1B[1;33mAvailable Commands:\x1B[0m"),e.writeln(""),this.commands.forEach(s=>{const r=s.aliases?.length?` (${s.aliases.join(", ")})`:"";e.writeln(` \x1B[1;36m${s.name.padEnd(15)}\x1B[0m ${s.description}${r}`)}),e.writeln(""),e.writeln("\x1B[90mTip: Use Tab for autocomplete, ↑↓ for history, Ctrl+F to search\x1B[0m"),i()}}class ig extends ze{name="clear";description="Clear terminal screen";aliases=["cls"];execute({term:e,writePrompt:i}){e.clear(),i()}}class sg extends ze{name="status";description="Show repeater status";aliases=["st"];async execute({term:e,writePrompt:i}){const s=this.startLoading(e,"Fetching status...");try{const r=await J.get("/stats");s();const n=r.success&&r.data?r.data:r;if(n&&typeof n=="object"){this.writeSuccess(e,"Repeater Status:"),e.writeln("");for(const[o,l]of Object.entries(n))e.writeln(` \x1B[36m${o.padEnd(20)}\x1B[0m ${l}`)}else this.writeError(e,"No status data available")}catch(r){s(),this.writeError(e,r instanceof Error?r.message:"Failed to fetch status")}i()}}class rg extends ze{name="uptime";description="Show system uptime";async execute({term:e,writePrompt:i}){const s=this.startLoading(e,"Fetching uptime...");try{const r=await J.get("/stats");s();const o=(r.data||r).uptime_seconds||0,l=this.formatUptime(o);this.writeSuccess(e,l)}catch(r){s(),this.writeError(e,`Failed to get uptime: ${r}`)}i()}formatUptime(e){const i=Math.floor(e/86400),s=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return i>0?`${i}d ${s}h ${r}m`:s>0?`${s}h ${r}m`:`${r}m`}}class ng extends ze{name="packets";description="Show packet statistics";isMobile(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<768}async execute({term:e,writePrompt:i}){const s=this.startLoading(e,"Fetching packet stats...");try{const r=await J.get("/stats");s();const n=r.data||r;this.writeLine(e,""),this.isMobile()?(this.writeLine(e," \x1B[1;36mPacket Statistics\x1B[0m"),this.writeLine(e," \x1B[90mRX:\x1B[0m "+(n.rx_count||0)),this.writeLine(e," \x1B[90mTX:\x1B[0m "+(n.tx_count||0)),this.writeLine(e," \x1B[90mForward:\x1B[0m "+(n.forwarded_count||0)),this.writeLine(e," \x1B[90mDropped:\x1B[0m "+(n.dropped_count||0))):(this.writeLine(e," \x1B[36m┌──────────┬──────────┐\x1B[0m"),this.writeLine(e," \x1B[36m│\x1B[0m \x1B[1mMetric\x1B[0m \x1B[36m│\x1B[0m \x1B[1mCount\x1B[0m \x1B[36m│\x1B[0m"),this.writeLine(e," \x1B[36m├──────────┼──────────┤\x1B[0m"),this.writeLine(e,` \x1B[36m│\x1B[0m RX \x1B[36m│\x1B[0m ${String(n.rx_count||0).padStart(8)} \x1B[36m│\x1B[0m`),this.writeLine(e,` \x1B[36m│\x1B[0m TX \x1B[36m│\x1B[0m ${String(n.tx_count||0).padStart(8)} \x1B[36m│\x1B[0m`),this.writeLine(e,` \x1B[36m│\x1B[0m Forward \x1B[36m│\x1B[0m ${String(n.forwarded_count||0).padStart(8)} \x1B[36m│\x1B[0m`),this.writeLine(e,` \x1B[36m│\x1B[0m Dropped \x1B[36m│\x1B[0m ${String(n.dropped_count||0).padStart(8)} \x1B[36m│\x1B[0m`),this.writeLine(e," \x1B[36m└──────────┴──────────┘\x1B[0m")),this.writeLine(e,"")}catch(r){s(),this.writeError(e,`Failed to get packet stats: ${r}`)}i()}}class og extends ze{name="board";description="Show board information";async execute({term:e,writePrompt:i}){const s=this.startLoading(e,"Fetching board info...");try{const r=await J.get("/stats");s();const o=(r.data||r).board_info||"pyMC_Repeater (Linux/RPi)";this.writeSuccess(e,o)}catch{s(),this.writeSuccess(e,"pyMC_Repeater (Linux/RPi)")}i()}}class ag extends ze{name="advert";description="Send neighbor advert immediately";async execute({term:e,writePrompt:i}){const s=this.startLoading(e,"Sending advert...");try{const r=await J.post("/send_advert",{},{timeout:1e4});s(),r.success?this.writeSuccess(e,r.data||"Advert sent successfully"):this.writeError(e,r.error||"Failed to send advert")}catch(r){s(),this.writeError(e,`Failed to send advert: ${r}`)}i()}}class lg extends ze{name="get";description="Get configuration values (name, freq, tx, mode, duty, etc.)";matches(e){const i=e.toLowerCase();return i==="get"||i.startsWith("get ")}async execute({term:e,args:i,writePrompt:s}){const r=i[0]?.toLowerCase();if(!r){this.writeError(e,"Usage: get "),this.writeLine(e,""),this.writeInfo(e,"Available parameters:"),this.writeLine(e,""),this.writeLine(e," \x1B[36mname\x1B[0m Node name"),this.writeLine(e," \x1B[36mrole\x1B[0m Node role"),this.writeLine(e," \x1B[36mlat\x1B[0m Latitude"),this.writeLine(e," \x1B[36mlon\x1B[0m Longitude"),this.writeLine(e," \x1B[36mfreq\x1B[0m Frequency (MHz)"),this.writeLine(e," \x1B[36mtx\x1B[0m TX power (dBm)"),this.writeLine(e," \x1B[36mbw\x1B[0m Bandwidth (kHz)"),this.writeLine(e," \x1B[36msf\x1B[0m Spreading factor"),this.writeLine(e," \x1B[36mcr\x1B[0m Coding rate"),this.writeLine(e," \x1B[36mradio\x1B[0m All radio settings"),this.writeLine(e," \x1B[36mtxdelay\x1B[0m TX delay factor"),this.writeLine(e," \x1B[36mdirect.txdelay\x1B[0m Direct TX delay"),this.writeLine(e," \x1B[36mrxdelay\x1B[0m RX delay base"),this.writeLine(e," \x1B[36maf\x1B[0m Airtime factor"),this.writeLine(e," \x1B[36mmode\x1B[0m Repeater mode"),this.writeLine(e," \x1B[36mrepeat\x1B[0m Repeat on/off"),this.writeLine(e," \x1B[36mflood.max\x1B[0m Max flood hops"),this.writeLine(e," \x1B[36madvert.interval\x1B[0m Advert interval"),this.writeLine(e," \x1B[36mduty\x1B[0m Duty cycle enabled"),this.writeLine(e," \x1B[36mduty.max\x1B[0m Max airtime %"),this.writeLine(e," \x1B[36mpublic.key\x1B[0m Public key"),this.writeLine(e,""),s();return}const n=this.startLoading(e,"Fetching configuration...");try{const o=await J.get("/stats");n();const l=o.data||o,h=l.config||{},a=h.radio||{},c=h.repeater||{},_=h.delays||{},f=h.duty_cycle||{};let d="";switch(r){case"name":d=h.node_name||"Unknown";break;case"role":d="repeater";break;case"lat":d=c.latitude!=null?String(c.latitude):"not set";break;case"lon":d=c.longitude!=null?String(c.longitude):"not set";break;case"freq":d=a.frequency?`${(a.frequency/1e6).toFixed(3)} MHz`:"?";break;case"tx":d=a.tx_power!=null?`${a.tx_power}dBm`:"?";break;case"bw":d=a.bandwidth?`${a.bandwidth/1e3} kHz`:"?";break;case"sf":d=a.spreading_factor!=null?String(a.spreading_factor):"?";break;case"cr":d=a.coding_rate!=null?`4/${a.coding_rate}`:"?";break;case"radio":if(a.frequency){this.writeSuccess(e,"Radio Configuration:"),this.writeLine(e,""),this.writeLine(e,` \x1B[36mFrequency:\x1B[0m ${(a.frequency/1e6).toFixed(3)} MHz`),this.writeLine(e,` \x1B[36mBandwidth:\x1B[0m ${a.bandwidth/1e3} kHz`),this.writeLine(e,` \x1B[36mSpreading Factor:\x1B[0m ${a.spreading_factor}`),this.writeLine(e,` \x1B[36mCoding Rate:\x1B[0m 4/${a.coding_rate}`),this.writeLine(e,` \x1B[36mTX Power:\x1B[0m ${a.tx_power}dBm`),this.writeLine(e,""),s();return}else d="Radio configuration not available";break;case"af":case"txdelay":d=_.tx_delay_factor!=null?String(_.tx_delay_factor):"\x1B[90mnot set (default: 1.0)\x1B[0m";break;case"direct.txdelay":d=_.direct_tx_delay_factor!=null?String(_.direct_tx_delay_factor):"\x1B[90mnot set (default: 0.5)\x1B[0m";break;case"rxdelay":d=_.rx_delay_base!=null?`${_.rx_delay_base}s`:"\x1B[90mnot set (default: 0.0s)\x1B[0m";break;case"mode":d=c.mode!=null?c.mode:"\x1B[90mnot set (default: forward)\x1B[0m";break;case"repeat":c.mode!=null?d=c.mode==="forward"?"on":"off":d="\x1B[90mnot set (default: on)\x1B[0m";break;case"flood.max":d=c.max_flood_hops!=null?String(c.max_flood_hops):"\x1B[90mnot set (default: 3)\x1B[0m";break;case"flood.advert.interval":d=c.send_advert_interval_hours!=null?`${c.send_advert_interval_hours}h`:"\x1B[90mnot set\x1B[0m";break;case"advert.interval":d=c.advert_interval_minutes!=null?`${c.advert_interval_minutes}m`:"\x1B[90mnot set (default: 120m)\x1B[0m";break;case"duty":case"duty.enabled":d=f.enforcement_enabled!=null?f.enforcement_enabled?"on":"off":"\x1B[90mnot set (default: off)\x1B[0m";break;case"duty.max":d=f.max_airtime_percent!=null?`${f.max_airtime_percent}%`:"\x1B[90mnot set\x1B[0m";break;case"public.key":d=l.public_key||"\x1B[90mnot available\x1B[0m";break;case"prv.key":this.writeWarning(e,"Private key not exposed via API for security"),this.writeInfo(e,"Check /etc/pymc_repeater/config.yaml"),s();return;case"guest.password":case"allow.read.only":this.writeWarning(e,"Security settings not exposed via API"),this.writeInfo(e,"Check /etc/pymc_repeater/config.yaml"),s();return;default:this.writeError(e,`Unknown parameter: ${r}`),this.writeLine(e,""),this.writeInfo(e,"Available parameters:"),this.writeInfo(e," Identity: name, role, lat, lon"),this.writeInfo(e," Radio: freq, tx, bw, sf, cr, radio"),this.writeInfo(e," Timing: txdelay, direct.txdelay, rxdelay, af"),this.writeInfo(e," Repeater: mode, repeat, flood.max, advert.interval"),this.writeInfo(e," Duty: duty, duty.max"),this.writeInfo(e," Security: public.key"),s();return}this.writeSuccess(e,d)}catch(o){n(),this.writeError(e,`Failed to get ${r}: ${o}`)}s()}writeWarning(e,i){e.writeln(`\x1B[1;33m⚠ Warning:\x1B[0m ${i}`)}}class hg extends ze{name="set";description="Set configuration values (tx, txdelay, mode, duty, etc.)";matches(e){const i=e.toLowerCase();return i==="set"||i.startsWith("set ")}async execute({term:e,args:i,writePrompt:s}){const r=i[0]?.toLowerCase(),n=i.slice(1).join(" ").trim();if(!r){this.writeError(e,"Usage: set "),this.writeLine(e,""),this.writeInfo(e,"Available parameters:"),this.writeLine(e,""),this.writeLine(e," \x1B[33mRadio:\x1B[0m"),this.writeLine(e," \x1B[36mtx <2-30>\x1B[0m TX power in dBm"),this.writeLine(e," \x1B[36mfreq \x1B[0m Frequency (100-1000 MHz) *restart required*"),this.writeLine(e," \x1B[36mbw \x1B[0m Bandwidth (7.8-500 kHz) *restart required*"),this.writeLine(e," \x1B[36msf <5-12>\x1B[0m Spreading factor *restart required*"),this.writeLine(e," \x1B[36mcr <5-8>\x1B[0m Coding rate (for 4/5 to 4/8) *restart required*"),this.writeLine(e,""),this.writeLine(e," \x1B[33mTiming:\x1B[0m"),this.writeLine(e," \x1B[36mtxdelay <0.0-5.0>\x1B[0m TX delay factor"),this.writeLine(e," \x1B[36mdirect.txdelay <0.0-5.0>\x1B[0m Direct TX delay factor"),this.writeLine(e," \x1B[36mrxdelay \x1B[0m RX delay base (>= 0)"),this.writeLine(e,""),this.writeLine(e," \x1B[33mIdentity:\x1B[0m"),this.writeLine(e," \x1B[36mname \x1B[0m Node name"),this.writeLine(e," \x1B[36mlat <-90 to 90>\x1B[0m Latitude"),this.writeLine(e," \x1B[36mlon <-180 to 180>\x1B[0m Longitude"),this.writeLine(e,""),this.writeLine(e," \x1B[33mRepeater:\x1B[0m"),this.writeLine(e," \x1B[36mmode \x1B[0m Repeater mode"),this.writeLine(e," \x1B[36mduty \x1B[0m Duty cycle enforcement"),this.writeLine(e," \x1B[36mflood.max <0-64>\x1B[0m Max flood hops"),this.writeLine(e," \x1B[36madvert.interval \x1B[0m Local advert interval"),this.writeLine(e,""),s();return}const o=this.startLoading(e,"Updating configuration...");try{let l;switch(r){case"tx":{const a=parseInt(n);if(isNaN(a)||a<2||a>30){o(),this.writeError(e,"TX power must be 2-30 dBm"),s();return}l=await J.post("/update_radio_config",{tx_power:a},{timeout:3e4});break}case"freq":{const a=parseFloat(n);if(isNaN(a)||a<100||a>1e3){o(),this.writeError(e,"Frequency must be 100-1000 MHz"),s();return}l=await J.post("/update_radio_config",{frequency:a*1e6},{timeout:3e4});break}case"bw":{const a=parseFloat(n),c=[7.8,10.4,15.6,20.8,31.25,41.7,62.5,125,250,500];if(isNaN(a)||!c.includes(a)){o(),this.writeError(e,`Bandwidth must be one of: ${c.join(", ")} kHz`),s();return}l=await J.post("/update_radio_config",{bandwidth:a*1e3},{timeout:3e4});break}case"sf":{const a=parseInt(n);if(isNaN(a)||a<5||a>12){o(),this.writeError(e,"Spreading factor must be 5-12"),s();return}l=await J.post("/update_radio_config",{spreading_factor:a},{timeout:3e4});break}case"cr":{const a=parseInt(n);if(isNaN(a)||a<5||a>8){o(),this.writeError(e,"Coding rate must be 5-8 (for 4/5 to 4/8)"),s();return}l=await J.post("/update_radio_config",{coding_rate:a},{timeout:3e4});break}case"af":case"txdelay":{const a=parseFloat(n);if(isNaN(a)||a<0||a>5){o(),this.writeError(e,"TX delay factor must be 0.0-5.0"),s();return}l=await J.post("/update_radio_config",{tx_delay_factor:a},{timeout:3e4});break}case"direct.txdelay":{const a=parseFloat(n);if(isNaN(a)||a<0||a>5){o(),this.writeError(e,"Direct TX delay factor must be 0.0-5.0"),s();return}l=await J.post("/update_radio_config",{direct_tx_delay_factor:a},{timeout:3e4});break}case"rxdelay":{const a=parseFloat(n);if(isNaN(a)||a<0){o(),this.writeError(e,"RX delay must be >= 0"),s();return}l=await J.post("/update_radio_config",{rx_delay_base:a},{timeout:3e4});break}case"name":{if(!n.trim()){o(),this.writeError(e,"Node name cannot be empty"),s();return}l=await J.post("/update_radio_config",{node_name:n.trim()},{timeout:3e4});break}case"lat":{const a=parseFloat(n);if(isNaN(a)||a<-90||a>90){o(),this.writeError(e,"Latitude must be -90 to 90"),s();return}l=await J.post("/update_radio_config",{latitude:a},{timeout:3e4});break}case"lon":{const a=parseFloat(n);if(isNaN(a)||a<-180||a>180){o(),this.writeError(e,"Longitude must be -180 to 180"),s();return}l=await J.post("/update_radio_config",{longitude:a},{timeout:3e4});break}case"mode":{const a=n.toLowerCase();if(a!=="forward"&&a!=="monitor"){o(),this.writeError(e,'Mode must be "forward" or "monitor"'),this.writeLine(e,""),this.writeInfo(e,"Valid values:"),this.writeLine(e," \x1B[36mforward\x1B[0m - Forward packets"),this.writeLine(e," \x1B[36mmonitor\x1B[0m - Monitor only (no forwarding)"),s();return}l=await J.post("/set_mode",{mode:a},{timeout:3e4}),l.data&&(l.data.applied=[`mode=${a}`],l.data.persisted=!0,l.data.live_update=!0);break}case"duty":{const a=n.toLowerCase();if(a!=="on"&&a!=="off"){o(),this.writeError(e,'Duty cycle must be "on" or "off"'),this.writeLine(e,""),this.writeInfo(e,"Valid values:"),this.writeLine(e," \x1B[36mon\x1B[0m - Enable duty cycle enforcement"),this.writeLine(e," \x1B[36moff\x1B[0m - Disable duty cycle enforcement"),s();return}const c=a==="on";l=await J.post("/set_duty_cycle",{enabled:c},{timeout:3e4}),l.data&&(l.data.applied=[`duty=${a}`],l.data.persisted=!0,l.data.live_update=!0);break}case"flood.max":{const a=parseInt(n);if(isNaN(a)||a<0||a>64){o(),this.writeError(e,"Max flood hops must be 0-64"),s();return}l=await J.post("/update_radio_config",{max_flood_hops:a},{timeout:3e4});break}case"flood.advert.interval":{const a=parseInt(n);if(isNaN(a)||a!==0&&(a<3||a>48)){o(),this.writeError(e,"Flood advert interval must be 0 (off) or 3-48 hours"),s();return}l=await J.post("/update_radio_config",{flood_advert_interval_hours:a},{timeout:3e4});break}case"advert.interval":{const a=parseInt(n);if(isNaN(a)||a!==0&&(a<1||a>10080)){o(),this.writeError(e,"Advert interval must be 0 (off) or 1-10080 minutes"),s();return}l=await J.post("/update_radio_config",{advert_interval_minutes:a},{timeout:3e4});break}case"log":o(),this.writeWarning(e,"Log level configuration not yet implemented"),this.writeInfo(e,"Backend endpoint /set_log_level does not exist"),s();return;default:o(),this.writeError(e,`Unknown parameter: ${r}`),this.writeLine(e,""),this.writeInfo(e,'Type "set" without arguments to see available parameters'),s();return}o();const h=l.data||l;l.success?(h.applied&&h.applied.length>0?this.writeSuccess(e,`Configuration updated: ${h.applied.join(", ")}`):this.writeSuccess(e,"Configuration updated"),h.restart_required?(this.writeLine(e,""),this.writeWarning(e,"⚠ Service restart required for changes to take effect"),this.writeInfo(e,"Run: sudo systemctl restart pymc_repeater")):h.message&&!h.live_update&&(this.writeLine(e,""),this.writeInfo(e,h.message))):this.writeError(e,l.error||"Failed to update configuration")}catch(l){o(),this.writeError(e,`Failed to update ${r}: ${l}`)}this.writeLine(e,""),s()}writeWarning(e,i){e.writeln(`\x1B[1;33m⚠ Warning:\x1B[0m ${i}`)}}class cg extends ze{name="identities";description="List all identities";aliases=["id","ids"];isMobile(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<768}async execute({term:e,writePrompt:i}){const s=this.startLoading(e,"Fetching identities...");try{const r=await J.getIdentities();s();let n=[];if(r.success&&r.data){const o=r.data,l=o.registered||[],h=o.configured||[];n=h.length>0?h:l}else Array.isArray(r)&&(n=r);n.length===0?this.writeInfo(e,"No identities found"):(this.writeSuccess(e,`Found \x1B[1m${n.length}\x1B[0m identit${n.length===1?"y":"ies"}`),e.writeln(""),this.isMobile()?n.forEach((o,l)=>{e.writeln(`\x1B[1;36m[${l+1}] ${o.name||"Unnamed"}\x1B[0m`),e.writeln(` \x1B[90mType:\x1B[0m ${o.type||"-"}`),e.writeln(` \x1B[90mHash:\x1B[0m ${o.hash||"-"}`),e.writeln(` \x1B[90mAddress:\x1B[0m ${o.address||"-"}`),e.writeln(` \x1B[90mRegistered:\x1B[0m ${o.registered?"\x1B[32myes\x1B[0m":"\x1B[31mno\x1B[0m"}`),l{const h=(l+1).toString().padEnd(2),a=(o.name||"Unnamed").padEnd(27),c=(o.type||"-").padEnd(13),_=(o.hash||"-").padEnd(4),f=(o.address||"-").padEnd(7),d=(o.registered?"yes":"no").padEnd(10);e.writeln(`\x1B[36m│\x1B[0m ${h} \x1B[36m│\x1B[0m \x1B[1m${a}\x1B[0m \x1B[36m│\x1B[0m ${c} \x1B[36m│\x1B[0m ${_} \x1B[36m│\x1B[0m ${f} \x1B[36m│\x1B[0m ${d} \x1B[36m│\x1B[0m`)}),e.writeln("\x1B[36m└────┴─────────────────────────────┴───────────────┴──────┴─────────┴────────────┘\x1B[0m")))}catch(r){s(),this.writeError(e,r instanceof Error?r.message:"Failed to fetch identities")}i()}}class dg extends ze{name="keys";description="List transport keys";async execute({term:e,writePrompt:i}){const s=this.startLoading(e,"Fetching transport keys...");try{const r=await J.getTransportKeys();s();const n=r.success&&r.data?r.data:r,o=Array.isArray(n)?n:[];o.length===0?this.writeInfo(e,"No transport keys found"):(this.writeSuccess(e,`Found \x1B[1m${o.length}\x1B[0m transport key${o.length===1?"":"s"}`),e.writeln(""),o.forEach((l,h)=>{e.writeln(`\x1B[36m${(h+1).toString().padStart(2)}.\x1B[0m \x1B[1m${l.name||"Unnamed"}\x1B[0m`),l.flood_policy&&e.writeln(` Policy: \x1B[90m${l.flood_policy}\x1B[0m`),l.parent_id&&e.writeln(` Parent: \x1B[90m${l.parent_id}\x1B[0m`),h{if(e.writeln(`\x1B[1;36m[${l+1}] ${o.node_name||"Unknown"}\x1B[0m`),e.writeln(` \x1B[90mPubKey:\x1B[0m ${o.pubkey?.substring(0,8)||"----"}`),e.writeln(` \x1B[90mType:\x1B[0m ${o.contact_type||"-"}`),o.last_seen){const h=new Date(o.last_seen*1e3).toLocaleString("en-US",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1});e.writeln(` \x1B[90mLast Seen:\x1B[0m ${h}`)}o.rssi&&e.writeln(` \x1B[90mRSSI:\x1B[0m ${o.rssi}`),o.snr&&e.writeln(` \x1B[90mSNR:\x1B[0m ${o.snr}`),e.writeln(` \x1B[90mAdverts:\x1B[0m ${o.advert_count||0}`),e.writeln(` \x1B[90mDirect:\x1B[0m ${o.zero_hop?"\x1B[32myes\x1B[0m":"\x1B[31mno\x1B[0m"}`),l{const h=(l+1).toString().padEnd(2),a=(o.node_name||"Unknown").padEnd(20),c=(o.pubkey?.substring(0,4)||"----").padEnd(6),_=(o.contact_type||"-").padEnd(12),f=o.last_seen?new Date(o.last_seen*1e3).toLocaleString("en-US",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).padEnd(20):"-".padEnd(20),d=(o.rssi?`${o.rssi}`:"-").padEnd(8),m=(o.snr?`${o.snr}`:"-").padEnd(4),y=(o.advert_count?.toString()||"0").padEnd(6),k=(o.zero_hop?"yes":"no").padEnd(6);e.writeln(`\x1B[36m│\x1B[0m ${h} \x1B[36m│\x1B[0m \x1B[1m${a}\x1B[0m \x1B[36m│\x1B[0m ${c} \x1B[36m│\x1B[0m ${_} \x1B[36m│\x1B[0m ${f} \x1B[36m│\x1B[0m ${d} \x1B[36m│\x1B[0m ${m} \x1B[36m│\x1B[0m ${y} \x1B[36m│\x1B[0m ${k} \x1B[36m│\x1B[0m`)}),e.writeln("\x1B[36m└────┴──────────────────────┴────────┴──────────────┴──────────────────────┴──────────┴──────┴────────┴────────┘\x1B[0m")),n.length>10&&(e.writeln(""),e.writeln(`\x1B[90m... and ${n.length-10} more neighbors\x1B[0m`)))}catch(r){s(),this.writeError(e,r instanceof Error?r.message:"Failed to fetch neighbors")}i()}}class _g extends ze{name="acl";description="Show ACL statistics";async execute({term:e,writePrompt:i}){const s=this.startLoading(e,"Fetching ACL stats...");try{const r=await J.getACLStats();s();const n=r.success&&r.data?r.data:r;if(n&&typeof n=="object"){this.writeSuccess(e,"ACL Statistics:"),e.writeln("");const o=(l,h=" ")=>{if(typeof l=="object"&&l!==null&&!Array.isArray(l))for(const[a,c]of Object.entries(l))typeof c=="object"&&c!==null?(e.writeln(`${h}\x1B[90m${a}:\x1B[0m`),o(c,h+" ")):e.writeln(`${h}\x1B[90m${a.padEnd(18)}\x1B[0m ${c}`);else e.writeln(`${h}${l}`)};for(const[l,h]of Object.entries(n))typeof h=="object"&&h!==null?(e.writeln(` \x1B[36m${l}\x1B[0m`),o(h," ")):e.writeln(` \x1B[36m${l.padEnd(20)}\x1B[0m ${h}`)}else this.writeError(e,"No ACL data available")}catch(r){s(),this.writeError(e,r instanceof Error?r.message:"Failed to fetch ACL stats")}i()}}class fg extends ze{name="rooms";description="List room servers";isMobile(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<768}async execute({term:e,writePrompt:i}){const s=this.startLoading(e,"Fetching room stats...");try{const r=await J.getRoomStats();s();let n=[];r.success&&r.data?n=r.data.rooms||(Array.isArray(r.data)?r.data:[]):Array.isArray(r)&&(n=r),n.length===0?this.writeInfo(e,"No room servers found"):(this.writeSuccess(e,`Found \x1B[1m${n.length}\x1B[0m room server${n.length===1?"":"s"}`),e.writeln(""),this.isMobile()?n.forEach((o,l)=>{e.writeln(`\x1B[1;36m[${l+1}] ${o.room_name||"Unnamed"}\x1B[0m`),e.writeln(` \x1B[90mMessages:\x1B[0m ${o.total_messages||0}`),e.writeln(` \x1B[90mTotal Clients:\x1B[0m ${o.total_clients||0}`),e.writeln(` \x1B[90mActive Clients:\x1B[0m ${o.active_clients||0}`),e.writeln(` \x1B[90mSync:\x1B[0m ${o.sync_running?"\x1B[32mrunning\x1B[0m":"\x1B[31mstopped\x1B[0m"}`),l{const h=(l+1).toString().padEnd(2),a=(o.room_name||"Unnamed").padEnd(27),c=(o.total_messages?.toString()||"0").padEnd(8),_=(o.total_clients?.toString()||"0").padEnd(12),f=(o.active_clients?.toString()||"0").padEnd(14),d=(o.sync_running?"running":"stopped").padEnd(8);e.writeln(`\x1B[36m│\x1B[0m ${h} \x1B[36m│\x1B[0m \x1B[1m${a}\x1B[0m \x1B[36m│\x1B[0m ${c} \x1B[36m│\x1B[0m ${_} \x1B[36m│\x1B[0m ${f} \x1B[36m│\x1B[0m ${d} \x1B[36m│\x1B[0m`)}),e.writeln("\x1B[36m└────┴─────────────────────────────┴──────────┴──────────────┴────────────────┴──────────┘\x1B[0m")))}catch(r){s(),this.writeError(e,r instanceof Error?r.message:"Failed to fetch room stats")}i()}}class gg extends ze{name="restart";description="Restart the pymc-repeater service";aliases=["reboot"];matches(e){const i=e.toLowerCase();return i==="restart"||i==="reboot"}async execute({term:e,writePrompt:i}){this.writeLine(e,""),this.writeLine(e,"\x1B[33m⚠️ This will restart the repeater service!\x1B[0m"),this.writeLine(e,""),this.writeInfo(e,"Attempting to restart service...");const s=this.startLoading(e,"Restarting...");try{const r=await J.post("/restart_service",{},{timeout:1e4});s(),r.success?(this.writeLine(e,""),this.writeSuccess(e,r.message||"Service restart initiated"),this.writeLine(e,""),this.writeInfo(e,"The service will restart momentarily. You may need to refresh this page.")):(this.writeLine(e,""),this.writeError(e,"Restart failed: "+(r.error||r.message||"Unknown error")),this.writeLine(e,""),this.writeInfo(e,"You may need to manually restart: sudo systemctl restart pymc-repeater"))}catch(r){s(),this.writeLine(e,"");const n=r;if(n.code==="ERR_NETWORK"||n.message?.includes("Network error")||n.message?.includes("ECONNRESET")||n.code==="ECONNRESET"){this.writeSuccess(e,"Service restart initiated successfully"),this.writeLine(e,""),await this.waitForServiceRestart(e,i);return}else n.code==="ECONNABORTED"||n.message?.includes("timeout")?(this.writeLine(e,"\x1B[33m⚠️ Request timed out - service may be restarting\x1B[0m"),this.writeLine(e,""),this.writeInfo(e,"Refresh the page in a few seconds to reconnect.")):n.response?.status===403||n.response?.status===401?(this.writeError(e,"Permission denied. Polkit rules may need configuration."),this.writeLine(e,""),this.writeInfo(e,"Run: sudo bash -c 'mkdir -p /etc/polkit-1/rules.d && cat > /etc/polkit-1/rules.d/10-pymc-repeater.rules <0;a--)e.write(`\r\x1B[36m⏳\x1B[0m Restarting service... ${a}s`),await new Promise(c=>setTimeout(c,1e3));e.write("\r\x1B[K");let o=4,l=0;const h="\r\x1B[36m⏳\x1B[0m Verifying restart (attempt ";for(;o<20;){l++,e.write(`${h}${l})... `);try{if((await fetch(`${window.location.protocol}//${window.location.host}/api/stats`,{signal:AbortSignal.timeout(3e3)})).ok){e.write("\r\x1B[K"),this.writeLine(e,""),this.writeSuccess(e,`Service is back online! (took ~${o}s)`),this.writeLine(e,""),i();return}}catch(a){const c=a;c.code&&!["ERR_NETWORK","ECONNREFUSED","ECONNRESET"].includes(c.code)&&e.write(`[${c.code}] `)}await new Promise(a=>setTimeout(a,1*1e3)),o+=1}e.write("\r\x1B[K"),this.writeLine(e,""),this.writeLine(e,"\x1B[33m⚠️ Service did not respond within 20 seconds\x1B[0m"),this.writeLine(e,""),this.writeInfo(e,"The service may still be starting. Try: status"),this.writeLine(e,""),i()}}class pg extends ze{name="ping";description="Ping a neighbor node to measure latency and signal quality";usage="ping [timeout_seconds]";async execute({term:e,args:i,writePrompt:s}){if(i.length===0){this.writeError(e,"Missing target node"),e.writeln(""),this.writeInfo(e,`Usage: ${this.usage}`),e.writeln(""),this.writeInfo(e,"Examples:"),this.writeInfo(e," ping MyNeighbor - Ping node by name"),this.writeInfo(e," ping 0xb5 - Ping node by pubkey hash"),this.writeInfo(e," ping MyNeighbor 20 - Ping with 20s timeout"),s();return}const r=i[0],n=i.length>1?parseInt(i[1]):10;if(isNaN(n)||n<1||n>60){this.writeError(e,"Invalid timeout. Must be between 1-60 seconds"),s();return}let o=null;const l=r.match(/^(0x)?([0-9a-fA-F]{1,2})$/);if(l)o=`0x${l[2].padStart(2,"0")}`;else{const a=this.startLoading(e,"Resolving target...");try{const c=["Chat Node","Repeater","Room Server","Hybrid Node","Unknown"];let _=!1;for(const f of c)try{const d=await J.get("/adverts_by_contact_type",{contact_type:f,hours:168}),m=d.success&&d.data?d.data:d,k=(Array.isArray(m)?m:[]).find(R=>R.node_name&&R.node_name.toLowerCase()===r.toLowerCase());if(k&&k.pubkey){o=`0x${k.pubkey.substring(0,2)}`,_=!0;break}}catch{continue}if(a(),!_){this.writeError(e,`Node '${r}' not found in neighbors`),e.writeln(""),this.writeInfo(e,"Try: neighbors - to list available nodes"),s();return}}catch(c){a(),this.writeError(e,`Failed to resolve target: ${c}`),s();return}}this.writeLine(e,`\x1B[36mPinging ${r} (${o}) with ${n}s timeout...\x1B[0m`),e.writeln("");const h=this.startLoading(e,"Waiting for response...");try{const a=await J.pingNeighbor(o,n);if(h(),a.success&&a.data){const c=a.data;this.writeSuccess(e,`Reply from ${r} (${c.target_id})`),e.writeln("");let _="\x1B[32m";if(c.rtt_ms>500?_="\x1B[31m":c.rtt_ms>250&&(_="\x1B[33m"),e.writeln(` \x1B[1mRound-Trip Time:\x1B[0m ${_}${c.rtt_ms.toFixed(2)} ms\x1B[0m`),e.writeln(` \x1B[1mRSSI:\x1B[0m ${c.rssi} dBm`),e.writeln(` \x1B[1mSNR:\x1B[0m ${c.snr_db} dB`),c.path&&c.path.length>0){const m=c.path.join(" → "),y=c.path.length;e.writeln(` \x1B[1mPath:\x1B[0m ${m}`),e.writeln(` \x1B[1mHops:\x1B[0m ${y}`)}e.writeln("");let f="Excellent",d="\x1B[32m";c.rtt_ms>500||c.rssi<-120?(f="Poor",d="\x1B[31m"):c.rtt_ms>250||c.rssi<-100?(f="Fair",d="\x1B[33m"):(c.rtt_ms>100||c.rssi<-80)&&(f="Good",d="\x1B[36m"),e.writeln(` \x1B[1mLink Quality:\x1B[0m ${d}${f}\x1B[0m`)}else this.writeError(e,a.error||"Ping failed")}catch(a){h(),this.writeError(e,`Ping failed: ${a.message||a}`)}e.writeln(""),s()}}async function na(){try{const t=["Chat Node","Repeater","Room Server","Hybrid Node","Unknown"],e=[];for(const i of t)try{const s=await J.get("/adverts_by_contact_type",{contact_type:i,hours:168}),r=s.success&&s.data?s.data:s;(Array.isArray(r)?r:[]).forEach(o=>{o.node_name&&!e.includes(o.node_name)&&e.push(o.node_name)})}catch{continue}return e.sort()}catch{return[]}}class vg{commands=[];constructor(){const e=new ig,i=new sg,s=new rg,r=new ng,n=new og,o=new ag,l=new lg,h=new hg,a=new cg,c=new dg,_=new ug,f=new _g,d=new fg,m=new gg,y=new pg,k=new tg([e,i,s,r,n,o,l,h,a,c,_,f,d,m,y]);this.commands=[k,e,i,s,r,n,o,l,h,a,c,_,f,d,m,y]}findCommand(e){return this.commands.find(i=>i.matches(e))}getAllCommands(){return this.commands}getCommandNames(){return this.commands.map(e=>e.name)}}const mg={class:"space-y-4 md:space-y-6"},wg={class:"glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-3 md:p-4"},Sg={class:"flex items-center justify-between"},bg={class:"flex items-center gap-2 md:gap-3"},yg=["title"],Cg={key:0,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},xg={key:1,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},kg={class:"hidden sm:inline"},Lg=["title"],Bg={class:"hidden sm:inline"},Eg=["title"],Mg={key:0,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Rg={key:1,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Tg={class:"hidden sm:inline"},Dg={key:0,class:"glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-4"},Ag={class:"flex items-center gap-3"},Pg=["onKeydown"],$g={key:1,class:"absolute top-4 right-4 bg-black/80 backdrop-blur-sm px-3 py-2 rounded-lg border border-primary/30 flex items-center gap-2"},Ig=zl({name:"TerminalView",__name:"Terminal",setup(t){const{theme:e}=Ul(),i={background:"#1A1E1F",foreground:"#e0e0e0",cursor:"#00d9ff",cursorAccent:"#000000",selectionBackground:"#00d9ff40",selectionForeground:"#ffffff",black:"#000000",red:"#ff6b6b",green:"#51cf66",yellow:"#ffd93d",blue:"#00d9ff",magenta:"#e599f7",cyan:"#00d9ff",white:"#e0e0e0",brightBlack:"#6c757d",brightRed:"#ff8787",brightGreen:"#69db7c",brightYellow:"#ffe066",brightBlue:"#74c0fc",brightMagenta:"#f3a6ff",brightCyan:"#3bc9db",brightWhite:"#ffffff"},s={background:"#F3F4F6",foreground:"#1f2937",cursor:"#0D7377",cursorAccent:"#ffffff",selectionBackground:"#0D737740",selectionForeground:"#000000",black:"#1f2937",red:"#dc2626",green:"#15803d",yellow:"#a16207",blue:"#0D7377",magenta:"#7c3aed",cyan:"#0e7490",white:"#f3f4f6",brightBlack:"#6b7280",brightRed:"#ef4444",brightGreen:"#22c55e",brightYellow:"#eab308",brightBlue:"#0891b2",brightMagenta:"#a855f7",brightCyan:"#06b6d4",brightWhite:"#ffffff"},r=ut(null),n=ut(null),o=ut(null),l=ut(""),h=ut(!1),a=ut(!1),c=ut(!1),_=ut(!1),f=ut(!1);ut(0);let d=null,m=null,y=null,k="";const R=[];let D=-1,T="";const S=new vg,L=S.getCommandNames();let B=[],$=0;const U={get:["name","role","lat","lon","freq","tx","bw","sf","cr","radio","txdelay","direct.txdelay","rxdelay","af","mode","repeat","flood.max","advert.interval","duty","duty.max","public.key"],set:["tx","freq","bw","sf","cr","txdelay","direct.txdelay","rxdelay","name","lat","lon","mode","duty","flood.max","advert.interval","flood.advert.interval"],ping:[]},Y={set:{mode:["forward","monitor"],duty:["on","off"]}},le={get:{name:"Node name",role:"Node role",lat:"Latitude",lon:"Longitude",freq:"Frequency (MHz)",tx:"TX power (dBm)",bw:"Bandwidth (kHz)",sf:"Spreading factor",cr:"Coding rate",radio:"All radio settings",txdelay:"TX delay factor","direct.txdelay":"Direct TX delay",rxdelay:"RX delay base",af:"Airtime factor",mode:"Repeater mode",repeat:"Repeat on/off","flood.max":"Max flood hops","advert.interval":"Advert interval",duty:"Duty cycle enabled","duty.max":"Max airtime %","public.key":"Public key"},set:{tx:"TX power (2-30 dBm)",freq:"Frequency (100-1000 MHz) *restart required*",bw:"Bandwidth (7.8-500 kHz) *restart required*",sf:"Spreading factor (5-12) *restart required*",cr:"Coding rate (5-8) *restart required*",txdelay:"TX delay factor (0.0-5.0)","direct.txdelay":"Direct TX delay (0.0-5.0)",rxdelay:"RX delay base (>= 0)",name:"Node name",lat:"Latitude (-90 to 90)",lon:"Longitude (-180 to 180)",mode:"Repeater mode (forward/monitor)",duty:"Duty cycle (on/off)","flood.max":"Max flood hops (0-64)","advert.interval":"Advert interval (0 or 1-10080 mins)","flood.advert.interval":"Flood advert (0 or 3-48 hrs)"},ping:{}};Hl(()=>{if(!r.value)return;c.value=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);const O=window.innerWidth<768;d=new su({cursorBlink:!1,cursorStyle:"underline",cursorWidth:3,fontFamily:'"JetBrains Mono", "Fira Code", Menlo, Monaco, "Courier New", monospace',fontSize:O?11:13,fontWeight:"400",fontWeightBold:"700",lineHeight:1.3,letterSpacing:.5,smoothScrollDuration:50,scrollSensitivity:3,fastScrollSensitivity:5,allowProposedApi:!0,screenReaderMode:c.value,theme:e.value==="dark"?i:s,scrollback:1e4,tabStopWidth:4,macOptionIsMeta:!0}),m=new ou,d.loadAddon(m);try{const fe=new eg;d.loadAddon(fe)}catch{console.warn("WebGL addon failed to load, falling back to canvas renderer")}const I=new uu((fe,ee)=>{window.open(ee,"_blank")});d.loadAddon(I);const G=new m_;if(d.loadAddon(G),d.unicode.activeVersion="11",y=new Ku,d.loadAddon(y),d.open(r.value),m.fit(),d.focus(),c.value&&n.value){const fe=n.value,ee=()=>{fe.focus({preventScroll:!1})};r.value?.addEventListener("click",ee),r.value?.addEventListener("touchstart",ee),fe.addEventListener("input",()=>{setTimeout(()=>{d?.scrollToBottom()},10)}),Rn(()=>{r.value?.removeEventListener("click",ee),r.value?.removeEventListener("touchstart",ee)})}const X=e.value==="dark"?"\x1B[1;37m":"\x1B[1;90m",_e=(e.value==="dark","\x1B[1;36m"),Le=(e.value==="dark","\x1B[90m"),Be="\x1B[36m",N="\x1B[0m";d.writeln(""),d.writeln(`${X} ██████ ██ ██ ███ ███ ██████${N}`),d.writeln(`${X} ██ ██ ██ ██ ████ ████ ██ ${N}`),d.writeln(`${X} ██████ ████ ██ ████ ██ ██ ${N}`),d.writeln(`${X} ██ ██ ██ ██ ██ ██ ${N}`),d.writeln(`${X} ██ ██ ██ ██ ██████${N}`),d.writeln(""),d.writeln(`${_e} Repeater Terminal${N}`),d.writeln(""),d.writeln(`${Le} Type ${Be}help${Le} for available commands${N}`),d.writeln(""),W(),d.onData(fe=>{p(fe)});const be=new ResizeObserver(()=>{m?.fit()});be.observe(r.value),Rn(()=>{be.disconnect(),d?.dispose()})});const W=()=>{d?.write(`\r
+\x1B[1;36m❯\x1B[0m `)},v=O=>{if(!(!d||!O)){d.write(`\x1B[90m${O}\x1B[0m`);for(let I=0;I{if(!(!d||!T)){for(let O=0;O{if(!d)return;const I=O.charCodeAt(0);if(I===13){u(),d.write(`\r
+`),k.trim()?(w(k.trim()),R.push(k.trim()),D=R.length):W(),k="";return}if(I===127){k.length>0&&(u(),k=k.slice(0,-1),d.write("\b \b"),g());return}if(I===3){u(),d.write(`^C\r
+`),k="",W();return}if(I===12){d.clear(),k="",W();return}if(I===6){h.value=!h.value;return}if(O==="\x1B[A"){R.length>0&&D>0&&(u(),D--,d.write("\r\x1B[K"),W(),k=R[D],d.write(k));return}if(O==="\x1B[B"){u(),D2&&Y[_e]){const N=X[1]?.toLowerCase(),be=X.slice(2).join(" ").toLowerCase(),fe=Y[_e][N];if(fe){const ee=fe.filter(He=>He.toLowerCase().startsWith(be));if(ee.length===1){const He=X.slice(2).join(" "),ve=ee[0].slice(He.length);k+=ve,d.write(ve)}else ee.length>1&&(d.write(`\r
+\r
+\x1B[33mAvailable values:\x1B[0m\r
+\r
+`),ee.forEach(He=>{d.writeln(` \x1B[36m${He}\x1B[0m`)}),W(),d.write(k));return}}if(X.length>1&&U[_e]){if(_e==="ping"){const fe=X.slice(1).join(" ").toLowerCase(),ee=Date.now();ee-$>3e4&&na().then(ve=>{B=ve,$=ee,U.ping=ve});const He=B.filter(ve=>ve.toLowerCase().startsWith(fe));if(He.length===1){const ve=X.slice(1).join(" "),hi=He[0].slice(ve.length)+" ";k+=hi,d.write(hi)}else He.length>1?(d.write(`\r
+\r
+\x1B[33mAvailable neighbors:\x1B[0m\r
+\r
+`),He.forEach(ve=>{d.writeln(` \x1B[36m${ve}\x1B[0m`)}),W(),d.write(k)):B.length===0&&fe===""&&(d.write(`\r
+\r
+\x1B[33mFetching neighbors...\x1B[0m\r
+`),na().then(ve=>{B=ve,$=ee,U.ping=ve,d.write(`\r
+\x1B[33mAvailable neighbors:\x1B[0m\r
+\r
+`),ve.forEach(hi=>{d.writeln(` \x1B[36m${hi}\x1B[0m`)}),W(),d.write(k)}).catch(()=>{d.write(`\r
+\x1B[31mFailed to fetch neighbors\x1B[0m\r
+`),W(),d.write(k)}));return}const N=X.slice(1).join(" ").toLowerCase(),be=U[_e].filter(fe=>fe.toLowerCase().startsWith(N));if(be.length===1){const fe=X.slice(1).join(" "),ee=be[0].slice(fe.length)+" ";k+=ee,d.write(ee)}else if(be.length>1){d.write(`\r
+\r
+\x1B[33mAvailable parameters:\x1B[0m\r
+\r
+`);const fe=le[_e]||{};be.forEach(ee=>{const He=fe[ee]||"",ve=ee.padEnd(20);d.writeln(` \x1B[36m${ve}\x1B[0m\x1B[90m${He}\x1B[0m`)}),W(),d.write(k)}return}const Be=S.getAllCommands().filter(N=>!!(N.name.toLowerCase().startsWith(G)||N.aliases?.some(be=>be.toLowerCase().startsWith(G))));if(Be.length===1){const N=Be[0].name.slice(k.length)+" ";k+=N,d.write(N)}else Be.length>1&&(d.write(`\r
+\r
+\x1B[33mAvailable commands:\x1B[0m\r
+\r
+`),Be.forEach(N=>{const be=N.aliases&&N.aliases.length>0?` (${N.aliases.join(", ")})`:"";d.writeln(` \x1B[36m${N.name.padEnd(15)}\x1B[0m ${N.description}${be}`)}),W(),d.write(k));return}I>=32&&I<127&&(u(),k+=O,d.write(O),c.value||g())},g=()=>{if(k.length===0){T="";return}const O=L.filter(I=>I.startsWith(k.toLowerCase()));O.length===1&&O[0]!==k?(T=O[0].slice(k.length),v(T)):T=""},w=async O=>{if(!d)return;const I=O.trim(),[G,...X]=I.split(/\s+/),_e=S.findCommand(G);if(_e)try{await _e.execute({term:d,args:X,writePrompt:W})}catch(Le){console.error("Command execution error:",Le),d.writeln(`\x1B[1;31m✗ Error:\x1B[0m ${Le instanceof Error?Le.message:"Command failed"}`),W()}else d.writeln(`\x1B[1;31m✗ Unknown command:\x1B[0m ${G}`),d.writeln("\x1B[90mType \x1B[36mhelp\x1B[90m for available commands\x1B[0m"),W()},b=()=>{!y||!l.value||y.findNext(l.value,{caseSensitive:!1})},C=()=>{!y||!l.value||y.findPrevious(l.value,{caseSensitive:!1})},x=()=>{h.value=!1,l.value="",d?.focus()},M=async()=>{if(o.value){if(_.value)try{document.exitFullscreen&&await document.exitFullscreen(),_.value=!1}catch(O){console.error("Failed to exit fullscreen:",O)}else try{o.value.requestFullscreen&&await o.value.requestFullscreen(),_.value=!0,setTimeout(()=>{c.value&&n.value?n.value.focus():d&&d.focus()},100)}catch(O){console.error("Failed to enter fullscreen:",O)}setTimeout(()=>{m?.fit()},100)}},F=()=>{f.value=!f.value,f.value&&c.value&&setTimeout(()=>{window.scrollTo(0,1)},100),setTimeout(()=>{c.value&&n.value?n.value.focus():d?.focus(),m?.fit()},150)},K=()=>{f.value=!1,setTimeout(()=>{m?.fit()},100)};ql(e,O=>{d&&(d.options.theme=O==="dark"?i:s)}),typeof document<"u"&&(document.addEventListener("fullscreenchange",()=>{_.value=!!document.fullscreenElement,setTimeout(()=>m?.fit(),100)}),document.addEventListener("keydown",O=>{O.key==="Escape"&&f.value&&!_.value&&K()}),document.addEventListener("keydown",O=>{O.key==="Escape"&&f.value&&!_.value&&K()}));const z=()=>{c.value&&n.value&&n.value.focus()},pe=O=>{const I=O.target,G=I.value;if(G&&d){const X=G.slice(-1);p(X)}I.value=""},q=()=>{d&&p("\r"),n.value&&(n.value.value="")},ne=()=>{d&&p(""),n.value&&(n.value.value="")};return(O,I)=>(it(),tt("div",mg,[Z("div",wg,[Z("div",Sg,[I[8]||(I[8]=Z("div",null,[Z("h1",{class:"text-content-primary dark:text-content-primary text-lg md:text-xl font-semibold"},"Terminal"),Z("p",{class:"text-content-secondary dark:text-content-muted text-sm hidden md:block"},"Interactive command-line interface")],-1)),Z("div",bg,[c.value?(it(),tt("button",{key:0,onClick:F,class:"flex items-center gap-2 px-3 py-2 bg-accent-purple/20 hover:bg-accent-purple/30 text-accent-purple border border-accent-purple/50 rounded-lg transition-colors",title:f.value?"Exit fullscreen":"Enter fullscreen"},[f.value?(it(),tt("svg",xg,I[3]||(I[3]=[Z("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"},null,-1)]))):(it(),tt("svg",Cg,I[2]||(I[2]=[Z("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"},null,-1)]))),Z("span",kg,Is(f.value?"Exit":"Fullscreen"),1)],8,yg)):Yt("",!0),c.value?Yt("",!0):(it(),tt("button",{key:1,onClick:F,class:"flex items-center gap-2 px-3 py-2 md:px-4 bg-accent-purple/20 hover:bg-accent-purple/30 text-accent-purple border border-accent-purple/50 rounded-lg transition-colors",title:f.value?"Exit full window":"Full window"},[I[4]||(I[4]=Z("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[Z("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"})],-1)),Z("span",Bg,Is(f.value?"Exit Window":"Full Window"),1)],8,Lg)),c.value?Yt("",!0):(it(),tt("button",{key:2,onClick:M,class:"flex items-center gap-2 px-3 py-2 md:px-4 bg-accent-purple/20 hover:bg-accent-purple/30 text-accent-purple border border-accent-purple/50 rounded-lg transition-colors",title:_.value?"Exit fullscreen":"Fullscreen"},[_.value?(it(),tt("svg",Rg,I[6]||(I[6]=[Z("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"},null,-1)]))):(it(),tt("svg",Mg,I[5]||(I[5]=[Z("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"},null,-1)]))),Z("span",Tg,Is(_.value?"Exit Full":"Fullscreen"),1)],8,Eg)),Z("button",{onClick:I[0]||(I[0]=G=>h.value=!h.value),class:"flex items-center gap-2 px-3 py-2 md:px-4 bg-primary/20 hover:bg-primary/30 text-primary border border-primary/50 rounded-lg transition-colors"},I[7]||(I[7]=[Z("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[Z("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})],-1),Z("span",{class:"hidden sm:inline"},"Search",-1)]))])])]),h.value?(it(),tt("div",Dg,[Z("div",Ag,[Kl(Z("input",{"onUpdate:modelValue":I[1]||(I[1]=G=>l.value=G),onKeydown:[Ji(b,["enter"]),Ji(x,["esc"])],type:"text",placeholder:"Search terminal output...",class:"flex-1 px-4 py-2 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 outline-none focus:border-primary/50 transition-colors"},null,544),[[Vl,l.value]]),Z("button",{onClick:C,class:"px-3 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary transition-colors",title:"Previous (Shift+Enter)"}," ↑ "),Z("button",{onClick:b,class:"px-3 py-2 bg-primary/20 hover:bg-primary/30 border border-primary/50 rounded-lg text-primary transition-colors",title:"Next (Enter)"}," ↓ "),Z("button",{onClick:x,class:"px-3 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary transition-colors"}," ✕ ")])])):Yt("",!0),Z("div",{ref_key:"terminalContainerRef",ref:o,class:Tn(["bg-surface dark:bg-surface-elevated/80 backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] overflow-hidden relative",{"fullscreen-terminal":_.value,"full-window-terminal":f.value}])},[f.value&&!_.value?(it(),tt("button",{key:0,onClick:K,class:"absolute top-4 right-4 z-50 p-2 bg-black/80 backdrop-blur-sm hover:bg-black/90 text-white border border-white/20 rounded-lg transition-colors",title:"Exit full window (ESC)"},I[9]||(I[9]=[Z("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[Z("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))):Yt("",!0),Z("div",{ref_key:"terminalRef",ref:r,class:Tn(["terminal-container",{"fullscreen-content":_.value}]),onClick:z,onTouchstart:z},[c.value?(it(),tt("input",{key:0,ref_key:"mobileInputRef",ref:n,type:"text",class:"mobile-keyboard-input",onInput:pe,onKeydown:[Ji(jl(q,["prevent"]),["enter"]),Ji(ne,["delete"])],inputmode:"text",autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellcheck:"false"},null,40,Pg)):Yt("",!0)],34),a.value?(it(),tt("div",$g,I[10]||(I[10]=[Z("div",{class:"w-2 h-2 bg-primary rounded-full animate-pulse"},null,-1),Z("span",{class:"text-primary text-sm font-medium"},"Processing...",-1)]))):Yt("",!0)],2)]))}}),wv=Gl(Ig,[["__scopeId","data-v-7ea2281b"]]);export{wv as default};
diff --git a/repeater/web/html/assets/chartjs-adapter-date-fns.esm-DJElUt-M.js b/repeater/web/html/assets/chartjs-adapter-date-fns.esm-DJElUt-M.js
new file mode 100644
index 0000000..a1864e8
--- /dev/null
+++ b/repeater/web/html/assets/chartjs-adapter-date-fns.esm-DJElUt-M.js
@@ -0,0 +1,6 @@
+import{a as Ae,c as j,b as O,e as I,g as U,t as Z,n as ye,F as ge,p as Y,x as Ge}from"./index-D0IT5vDS.js";import{g as Ve}from"./chart-B185MtDy.js";const ze={class:"sparkline-card"},je={class:"card-header"},Ue={class:"card-title"},Ze={key:0,class:"card-subtitle"},Je={key:0,class:"card-chart"},Ke={key:0,class:"chart-loader"},Se={key:1,class:"chart-text"},et={class:"percent-value"},tt=["id","viewBox"],nt=["d","fill"],rt=["d","stroke"],J=100,K=40,at=Ae({name:"SparklineChart",__name:"Sparkline",props:{title:{},value:{},color:{},data:{default:()=>[]},showChart:{type:Boolean,default:!0},variant:{default:"smooth"},loading:{type:Boolean,default:!1},centerText:{default:""},subtitle:{default:""}},setup(r){const e=r,t=i=>{if(i.length<3)return i;const d=Math.min(15,Math.max(3,Math.floor(i.length*.2))),f=[];for(let D=0;DR+H,0)/k.length)}const y=Math.min(10,f.length),T=f.length/y,N=[];for(let D=0;D!e.data||e.data.length===0?[]:e.variant==="smooth"?t(e.data):e.data),a=i=>{if(i.length<2)return"";const d=Math.max(...i),f=Math.min(...i),y=d-f||1,T=e.variant==="classic"?4:2;let N="";return i.forEach((D,P)=>{const l=P/(i.length-1)*J,w=(D-f)/y,k=T+(K-T*2)*(1-w);if(P===0)N+=`M ${l.toFixed(2)} ${k.toFixed(2)}`;else{const H=((P-1)/(i.length-1)*J+l)/2;N+=` Q ${H.toFixed(2)} ${k.toFixed(2)} ${l.toFixed(2)} ${k.toFixed(2)}`}}),N},s=j(()=>a(n.value)),o=j(()=>s.value?`${s.value} L ${J} ${K} L 0 ${K} Z`:""),c=j(()=>`sparkline-${e.title.replace(/\s+/g,"-").toLowerCase()}`);return(i,d)=>(Y(),O("div",ze,[I("div",je,[I("div",null,[I("p",Ue,Z(i.title),1),i.subtitle?(Y(),O("p",Ze,Z(i.subtitle),1)):U("",!0)]),I("span",{class:"card-value",style:ye({color:i.color})},Z(typeof i.value=="number"?i.value.toLocaleString():i.value),5)]),i.showChart?(Y(),O("div",Je,[i.loading&&i.variant==="classic"?(Y(),O("div",Ke,[I("div",{class:"loader-spinner",style:ye({borderTopColor:i.color})},null,4)])):i.centerText?(Y(),O("div",Se,[I("span",et,Z(i.centerText),1)])):(Y(),O("svg",{key:2,id:c.value,class:"chart-svg",viewBox:`0 0 ${J} ${K}`,preserveAspectRatio:"none"},[i.variant==="classic"?(Y(),O(ge,{key:0},[n.value.length>1?(Y(),O("path",{key:0,d:o.value,fill:i.color,"fill-opacity":"0.8",class:"sparkline-path"},null,8,nt)):U("",!0)],64)):(Y(),O(ge,{key:1},[n.value.length>1?(Y(),O("path",{key:0,d:s.value,stroke:i.color,"stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round",fill:"none",class:"sparkline-path"},null,8,rt)):U("",!0)],64))],8,tt))])):U("",!0)]))}}),Vr=Ge(at,[["__scopeId","data-v-257cbdca"]]),Te=6048e5,st=864e5,G=6e4,V=36e5,ot=1e3,pe=Symbol.for("constructDateFrom");function p(r,e){return typeof r=="function"?r(e):r&&typeof r=="object"&&pe in r?r[pe](e):r instanceof Date?new r.constructor(e):new Date(e)}function u(r,e){return p(e||r,r)}function ne(r,e,t){const n=u(r,t?.in);return isNaN(e)?p(t?.in||r,NaN):(e&&n.setDate(n.getDate()+e),n)}function ce(r,e,t){const n=u(r,t?.in);if(isNaN(e))return p(r,NaN);if(!e)return n;const a=n.getDate(),s=p(r,n.getTime());s.setMonth(n.getMonth()+e+1,0);const o=s.getDate();return a>=o?s:(n.setFullYear(s.getFullYear(),s.getMonth(),a),n)}function ue(r,e,t){return p(r,+u(r)+e)}function it(r,e,t){return ue(r,e*V)}let ct={};function F(){return ct}function W(r,e){const t=F(),n=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,a=u(r,e?.in),s=a.getDay(),o=(s=s.getTime()?n+1:t.getTime()>=c.getTime()?n:n-1}function ee(r){const e=u(r),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+r-+t}function C(r,...e){const t=p.bind(null,e.find(n=>typeof n=="object"));return e.map(t)}function se(r,e){const t=u(r,e?.in);return t.setHours(0,0,0,0),t}function Oe(r,e,t){const[n,a]=C(t?.in,r,e),s=se(n),o=se(a),c=+s-ee(s),i=+o-ee(o);return Math.round((c-i)/st)}function ut(r,e){const t=Pe(r,e),n=p(r,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Q(n)}function dt(r,e,t){const n=u(r,t?.in);return n.setTime(n.getTime()+e*G),n}function lt(r,e,t){return ce(r,e*3,t)}function ft(r,e,t){return ue(r,e*1e3)}function ht(r,e,t){return ne(r,e*7,t)}function mt(r,e,t){return ce(r,e*12,t)}function A(r,e){const t=+u(r)-+u(e);return t<0?-1:t>0?1:t}function wt(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function Ye(r){return!(!wt(r)&&typeof r!="number"||isNaN(+u(r)))}function yt(r,e,t){const[n,a]=C(t?.in,r,e),s=n.getFullYear()-a.getFullYear(),o=n.getMonth()-a.getMonth();return s*12+o}function gt(r,e,t){const[n,a]=C(t?.in,r,e);return n.getFullYear()-a.getFullYear()}function ve(r,e,t){const[n,a]=C(t?.in,r,e),s=be(n,a),o=Math.abs(Oe(n,a));n.setDate(n.getDate()-s*o);const c=+(be(n,a)===-s),i=s*(o-c);return i===0?0:i}function be(r,e){const t=r.getFullYear()-e.getFullYear()||r.getMonth()-e.getMonth()||r.getDate()-e.getDate()||r.getHours()-e.getHours()||r.getMinutes()-e.getMinutes()||r.getSeconds()-e.getSeconds()||r.getMilliseconds()-e.getMilliseconds();return t<0?-1:t>0?1:t}function z(r){return e=>{const n=(r?Math[r]:Math.trunc)(e);return n===0?0:n}}function pt(r,e,t){const[n,a]=C(t?.in,r,e),s=(+n-+a)/V;return z(t?.roundingMethod)(s)}function de(r,e){return+u(r)-+u(e)}function bt(r,e,t){const n=de(r,e)/G;return z(t?.roundingMethod)(n)}function _e(r,e){const t=u(r,e?.in);return t.setHours(23,59,59,999),t}function We(r,e){const t=u(r,e?.in),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function xt(r,e){const t=u(r,e?.in);return+_e(t,e)==+We(t,e)}function Ne(r,e,t){const[n,a,s]=C(t?.in,r,r,e),o=A(a,s),c=Math.abs(yt(a,s));if(c<1)return 0;a.getMonth()===1&&a.getDate()>27&&a.setDate(30),a.setMonth(a.getMonth()-o*c);let i=A(a,s)===-o;xt(n)&&c===1&&A(n,s)===1&&(i=!1);const d=o*(c-+i);return d===0?0:d}function Mt(r,e,t){const n=Ne(r,e,t)/3;return z(t?.roundingMethod)(n)}function Dt(r,e,t){const n=de(r,e)/1e3;return z(t?.roundingMethod)(n)}function kt(r,e,t){const n=ve(r,e,t)/7;return z(t?.roundingMethod)(n)}function Tt(r,e,t){const[n,a]=C(t?.in,r,e),s=A(n,a),o=Math.abs(gt(n,a));n.setFullYear(1584),a.setFullYear(1584);const c=A(n,a)===-s,i=s*(o-+c);return i===0?0:i}function Pt(r,e){const t=u(r,e?.in),n=t.getMonth(),a=n-n%3;return t.setMonth(a,1),t.setHours(0,0,0,0),t}function Ot(r,e){const t=u(r,e?.in);return t.setDate(1),t.setHours(0,0,0,0),t}function Yt(r,e){const t=u(r,e?.in),n=t.getFullYear();return t.setFullYear(n+1,0,0),t.setHours(23,59,59,999),t}function Ee(r,e){const t=u(r,e?.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}function vt(r,e){const t=u(r,e?.in);return t.setMinutes(59,59,999),t}function _t(r,e){const t=F(),n=t.weekStartsOn??t.locale?.options?.weekStartsOn??0,a=u(r,e?.in),s=a.getDay(),o=(s{let n;const a=Ht[r];return typeof a=="string"?n=a:e===1?n=a.one:n=a.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+n:n+" ago":n};function re(r){return(e={})=>{const t=e.width?String(e.width):r.defaultWidth;return r.formats[t]||r.formats[r.defaultWidth]}}const Ft={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Ct={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},It={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Lt={date:re({formats:Ft,defaultWidth:"full"}),time:re({formats:Ct,defaultWidth:"full"}),dateTime:re({formats:It,defaultWidth:"full"})},Qt={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Rt=(r,e,t,n)=>Qt[r];function B(r){return(e,t)=>{const n=t?.context?String(t.context):"standalone";let a;if(n==="formatting"&&r.formattingValues){const o=r.defaultFormattingWidth||r.defaultWidth,c=t?.width?String(t.width):o;a=r.formattingValues[c]||r.formattingValues[o]}else{const o=r.defaultWidth,c=t?.width?String(t.width):r.defaultWidth;a=r.values[c]||r.values[o]}const s=r.argumentCallback?r.argumentCallback(e):e;return a[s]}}const Bt={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Xt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},$t={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},At={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Gt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Vt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},zt=(r,e)=>{const t=Number(r),n=t%100;if(n>20||n<10)switch(n%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},jt={ordinalNumber:zt,era:B({values:Bt,defaultWidth:"wide"}),quarter:B({values:Xt,defaultWidth:"wide",argumentCallback:r=>r-1}),month:B({values:$t,defaultWidth:"wide"}),day:B({values:At,defaultWidth:"wide"}),dayPeriod:B({values:Gt,defaultWidth:"wide",formattingValues:Vt,defaultFormattingWidth:"wide"})};function X(r){return(e,t={})=>{const n=t.width,a=n&&r.matchPatterns[n]||r.matchPatterns[r.defaultMatchWidth],s=e.match(a);if(!s)return null;const o=s[0],c=n&&r.parsePatterns[n]||r.parsePatterns[r.defaultParseWidth],i=Array.isArray(c)?Zt(c,y=>y.test(o)):Ut(c,y=>y.test(o));let d;d=r.valueCallback?r.valueCallback(i):i,d=t.valueCallback?t.valueCallback(d):d;const f=e.slice(o.length);return{value:d,rest:f}}}function Ut(r,e){for(const t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&e(r[t]))return t}function Zt(r,e){for(let t=0;t{const n=e.match(r.matchPattern);if(!n)return null;const a=n[0],s=e.match(r.parsePattern);if(!s)return null;let o=r.valueCallback?r.valueCallback(s[0]):s[0];o=t.valueCallback?t.valueCallback(o):o;const c=e.slice(a.length);return{value:o,rest:c}}}const Kt=/^(\d+)(th|st|nd|rd)?/i,St=/\d+/i,en={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},tn={any:[/^b/i,/^(a|c)/i]},nn={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},rn={any:[/1/i,/2/i,/3/i,/4/i]},an={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},sn={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},on={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},cn={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},un={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},dn={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},ln={ordinalNumber:Jt({matchPattern:Kt,parsePattern:St,valueCallback:r=>parseInt(r,10)}),era:X({matchPatterns:en,defaultMatchWidth:"wide",parsePatterns:tn,defaultParseWidth:"any"}),quarter:X({matchPatterns:nn,defaultMatchWidth:"wide",parsePatterns:rn,defaultParseWidth:"any",valueCallback:r=>r+1}),month:X({matchPatterns:an,defaultMatchWidth:"wide",parsePatterns:sn,defaultParseWidth:"any"}),day:X({matchPatterns:on,defaultMatchWidth:"wide",parsePatterns:cn,defaultParseWidth:"any"}),dayPeriod:X({matchPatterns:un,defaultMatchWidth:"any",parsePatterns:dn,defaultParseWidth:"any"})},He={code:"en-US",formatDistance:qt,formatLong:Lt,formatRelative:Rt,localize:jt,match:ln,options:{weekStartsOn:0,firstWeekContainsDate:1}};function fn(r,e){const t=u(r,e?.in);return Oe(t,Ee(t))+1}function qe(r,e){const t=u(r,e?.in),n=+Q(t)-+ut(t);return Math.round(n/Te)+1}function le(r,e){const t=u(r,e?.in),n=t.getFullYear(),a=F(),s=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,o=p(e?.in||r,0);o.setFullYear(n+1,0,s),o.setHours(0,0,0,0);const c=W(o,e),i=p(e?.in||r,0);i.setFullYear(n,0,s),i.setHours(0,0,0,0);const d=W(i,e);return+t>=+c?n+1:+t>=+d?n:n-1}function hn(r,e){const t=F(),n=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,a=le(r,e),s=p(e?.in||r,0);return s.setFullYear(a,0,n),s.setHours(0,0,0,0),W(s,e)}function Fe(r,e){const t=u(r,e?.in),n=+W(t,e)-+hn(t,e);return Math.round(n/Te)+1}function m(r,e){const t=r<0?"-":"",n=Math.abs(r).toString().padStart(e,"0");return t+n}const E={y(r,e){const t=r.getFullYear(),n=t>0?t:1-t;return m(e==="yy"?n%100:n,e.length)},M(r,e){const t=r.getMonth();return e==="M"?String(t+1):m(t+1,2)},d(r,e){return m(r.getDate(),e.length)},a(r,e){const t=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(r,e){return m(r.getHours()%12||12,e.length)},H(r,e){return m(r.getHours(),e.length)},m(r,e){return m(r.getMinutes(),e.length)},s(r,e){return m(r.getSeconds(),e.length)},S(r,e){const t=e.length,n=r.getMilliseconds(),a=Math.trunc(n*Math.pow(10,t-3));return m(a,e.length)}},L={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},xe={G:function(r,e,t){const n=r.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(n,{width:"abbreviated"});case"GGGGG":return t.era(n,{width:"narrow"});case"GGGG":default:return t.era(n,{width:"wide"})}},y:function(r,e,t){if(e==="yo"){const n=r.getFullYear(),a=n>0?n:1-n;return t.ordinalNumber(a,{unit:"year"})}return E.y(r,e)},Y:function(r,e,t,n){const a=le(r,n),s=a>0?a:1-a;if(e==="YY"){const o=s%100;return m(o,2)}return e==="Yo"?t.ordinalNumber(s,{unit:"year"}):m(s,e.length)},R:function(r,e){const t=Pe(r);return m(t,e.length)},u:function(r,e){const t=r.getFullYear();return m(t,e.length)},Q:function(r,e,t){const n=Math.ceil((r.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return m(n,2);case"Qo":return t.ordinalNumber(n,{unit:"quarter"});case"QQQ":return t.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(n,{width:"wide",context:"formatting"})}},q:function(r,e,t){const n=Math.ceil((r.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return m(n,2);case"qo":return t.ordinalNumber(n,{unit:"quarter"});case"qqq":return t.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(n,{width:"wide",context:"standalone"})}},M:function(r,e,t){const n=r.getMonth();switch(e){case"M":case"MM":return E.M(r,e);case"Mo":return t.ordinalNumber(n+1,{unit:"month"});case"MMM":return t.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(n,{width:"wide",context:"formatting"})}},L:function(r,e,t){const n=r.getMonth();switch(e){case"L":return String(n+1);case"LL":return m(n+1,2);case"Lo":return t.ordinalNumber(n+1,{unit:"month"});case"LLL":return t.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(n,{width:"wide",context:"standalone"})}},w:function(r,e,t,n){const a=Fe(r,n);return e==="wo"?t.ordinalNumber(a,{unit:"week"}):m(a,e.length)},I:function(r,e,t){const n=qe(r);return e==="Io"?t.ordinalNumber(n,{unit:"week"}):m(n,e.length)},d:function(r,e,t){return e==="do"?t.ordinalNumber(r.getDate(),{unit:"date"}):E.d(r,e)},D:function(r,e,t){const n=fn(r);return e==="Do"?t.ordinalNumber(n,{unit:"dayOfYear"}):m(n,e.length)},E:function(r,e,t){const n=r.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(n,{width:"short",context:"formatting"});case"EEEE":default:return t.day(n,{width:"wide",context:"formatting"})}},e:function(r,e,t,n){const a=r.getDay(),s=(a-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return m(s,2);case"eo":return t.ordinalNumber(s,{unit:"day"});case"eee":return t.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(a,{width:"short",context:"formatting"});case"eeee":default:return t.day(a,{width:"wide",context:"formatting"})}},c:function(r,e,t,n){const a=r.getDay(),s=(a-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return m(s,e.length);case"co":return t.ordinalNumber(s,{unit:"day"});case"ccc":return t.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(a,{width:"narrow",context:"standalone"});case"cccccc":return t.day(a,{width:"short",context:"standalone"});case"cccc":default:return t.day(a,{width:"wide",context:"standalone"})}},i:function(r,e,t){const n=r.getDay(),a=n===0?7:n;switch(e){case"i":return String(a);case"ii":return m(a,e.length);case"io":return t.ordinalNumber(a,{unit:"day"});case"iii":return t.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(n,{width:"short",context:"formatting"});case"iiii":default:return t.day(n,{width:"wide",context:"formatting"})}},a:function(r,e,t){const a=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(r,e,t){const n=r.getHours();let a;switch(n===12?a=L.noon:n===0?a=L.midnight:a=n/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(r,e,t){const n=r.getHours();let a;switch(n>=17?a=L.evening:n>=12?a=L.afternoon:n>=4?a=L.morning:a=L.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(r,e,t){if(e==="ho"){let n=r.getHours()%12;return n===0&&(n=12),t.ordinalNumber(n,{unit:"hour"})}return E.h(r,e)},H:function(r,e,t){return e==="Ho"?t.ordinalNumber(r.getHours(),{unit:"hour"}):E.H(r,e)},K:function(r,e,t){const n=r.getHours()%12;return e==="Ko"?t.ordinalNumber(n,{unit:"hour"}):m(n,e.length)},k:function(r,e,t){let n=r.getHours();return n===0&&(n=24),e==="ko"?t.ordinalNumber(n,{unit:"hour"}):m(n,e.length)},m:function(r,e,t){return e==="mo"?t.ordinalNumber(r.getMinutes(),{unit:"minute"}):E.m(r,e)},s:function(r,e,t){return e==="so"?t.ordinalNumber(r.getSeconds(),{unit:"second"}):E.s(r,e)},S:function(r,e){return E.S(r,e)},X:function(r,e,t){const n=r.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return De(n);case"XXXX":case"XX":return q(n);case"XXXXX":case"XXX":default:return q(n,":")}},x:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"x":return De(n);case"xxxx":case"xx":return q(n);case"xxxxx":case"xxx":default:return q(n,":")}},O:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Me(n,":");case"OOOO":default:return"GMT"+q(n,":")}},z:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Me(n,":");case"zzzz":default:return"GMT"+q(n,":")}},t:function(r,e,t){const n=Math.trunc(+r/1e3);return m(n,e.length)},T:function(r,e,t){return m(+r,e.length)}};function Me(r,e=""){const t=r>0?"-":"+",n=Math.abs(r),a=Math.trunc(n/60),s=n%60;return s===0?t+String(a):t+String(a)+e+m(s,2)}function De(r,e){return r%60===0?(r>0?"-":"+")+m(Math.abs(r)/60,2):q(r,e)}function q(r,e=""){const t=r>0?"-":"+",n=Math.abs(r),a=m(Math.trunc(n/60),2),s=m(n%60,2);return t+a+e+s}const ke=(r,e)=>{switch(r){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},Ce=(r,e)=>{switch(r){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},mn=(r,e)=>{const t=r.match(/(P+)(p+)?/)||[],n=t[1],a=t[2];if(!a)return ke(r,e);let s;switch(n){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;case"PPPP":default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",ke(n,e)).replace("{{time}}",Ce(a,e))},oe={p:Ce,P:mn},wn=/^D+$/,yn=/^Y+$/,gn=["D","DD","YY","YYYY"];function Ie(r){return wn.test(r)}function Le(r){return yn.test(r)}function ie(r,e,t){const n=pn(r,e,t);if(console.warn(n),gn.includes(r))throw new RangeError(n)}function pn(r,e,t){const n=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${e}\`) for formatting ${n} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const bn=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,xn=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Mn=/^'([^]*?)'?$/,Dn=/''/g,kn=/[a-zA-Z]/;function Tn(r,e,t){const n=F(),a=t?.locale??n.locale??He,s=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,o=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,c=u(r,t?.in);if(!Ye(c))throw new RangeError("Invalid time value");let i=e.match(xn).map(f=>{const y=f[0];if(y==="p"||y==="P"){const T=oe[y];return T(f,a.formatLong)}return f}).join("").match(bn).map(f=>{if(f==="''")return{isToken:!1,value:"'"};const y=f[0];if(y==="'")return{isToken:!1,value:Pn(f)};if(xe[y])return{isToken:!0,value:f};if(y.match(kn))throw new RangeError("Format string contains an unescaped latin alphabet character `"+y+"`");return{isToken:!1,value:f}});a.localize.preprocessor&&(i=a.localize.preprocessor(c,i));const d={firstWeekContainsDate:s,weekStartsOn:o,locale:a};return i.map(f=>{if(!f.isToken)return f.value;const y=f.value;(!t?.useAdditionalWeekYearTokens&&Le(y)||!t?.useAdditionalDayOfYearTokens&&Ie(y))&&ie(y,e,String(r));const T=xe[y[0]];return T(c,y,a.localize,d)}).join("")}function Pn(r){const e=r.match(Mn);return e?e[1].replace(Dn,"'"):r}function On(){return Object.assign({},F())}function Yn(r,e){const t=u(r,e?.in).getDay();return t===0?7:t}function vn(r,e){const t=_n(e)?new e(0):p(e,0);return t.setFullYear(r.getFullYear(),r.getMonth(),r.getDate()),t.setHours(r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()),t}function _n(r){return typeof r=="function"&&r.prototype?.constructor===r}const Wn=10;class Qe{subPriority=0;validate(e,t){return!0}}class Nn extends Qe{constructor(e,t,n,a,s){super(),this.value=e,this.validateValue=t,this.setValue=n,this.priority=a,s&&(this.subPriority=s)}validate(e,t){return this.validateValue(e,this.value,t)}set(e,t,n){return this.setValue(e,t,this.value,n)}}class En extends Qe{priority=Wn;subPriority=-1;constructor(e,t){super(),this.context=e||(n=>p(t,n))}set(e,t){return t.timestampIsSet?e:p(e,vn(e,this.context))}}class h{run(e,t,n,a){const s=this.parse(e,t,n,a);return s?{setter:new Nn(s.value,this.validate,this.set,this.priority,this.subPriority),rest:s.rest}:null}validate(e,t,n){return!0}}class Hn extends h{priority=140;parse(e,t,n){switch(t){case"G":case"GG":case"GGG":return n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"});case"GGGGG":return n.era(e,{width:"narrow"});case"GGGG":default:return n.era(e,{width:"wide"})||n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"})}}set(e,t,n){return t.era=n,e.setFullYear(n,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["R","u","t","T"]}const x={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},v={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function M(r,e){return r&&{value:e(r.value),rest:r.rest}}function g(r,e){const t=e.match(r);return t?{value:parseInt(t[0],10),rest:e.slice(t[0].length)}:null}function _(r,e){const t=e.match(r);if(!t)return null;if(t[0]==="Z")return{value:0,rest:e.slice(1)};const n=t[1]==="+"?1:-1,a=t[2]?parseInt(t[2],10):0,s=t[3]?parseInt(t[3],10):0,o=t[5]?parseInt(t[5],10):0;return{value:n*(a*V+s*G+o*ot),rest:e.slice(t[0].length)}}function Re(r){return g(x.anyDigitsSigned,r)}function b(r,e){switch(r){case 1:return g(x.singleDigit,e);case 2:return g(x.twoDigits,e);case 3:return g(x.threeDigits,e);case 4:return g(x.fourDigits,e);default:return g(new RegExp("^\\d{1,"+r+"}"),e)}}function te(r,e){switch(r){case 1:return g(x.singleDigitSigned,e);case 2:return g(x.twoDigitsSigned,e);case 3:return g(x.threeDigitsSigned,e);case 4:return g(x.fourDigitsSigned,e);default:return g(new RegExp("^-?\\d{1,"+r+"}"),e)}}function fe(r){switch(r){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function Be(r,e){const t=e>0,n=t?e:1-e;let a;if(n<=50)a=r||100;else{const s=n+50,o=Math.trunc(s/100)*100,c=r>=s%100;a=r+o-(c?100:0)}return t?a:1-a}function Xe(r){return r%400===0||r%4===0&&r%100!==0}class qn extends h{priority=130;incompatibleTokens=["Y","R","u","w","I","i","e","c","t","T"];parse(e,t,n){const a=s=>({year:s,isTwoDigitYear:t==="yy"});switch(t){case"y":return M(b(4,e),a);case"yo":return M(n.ordinalNumber(e,{unit:"year"}),a);default:return M(b(t.length,e),a)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n){const a=e.getFullYear();if(n.isTwoDigitYear){const o=Be(n.year,a);return e.setFullYear(o,0,1),e.setHours(0,0,0,0),e}const s=!("era"in t)||t.era===1?n.year:1-n.year;return e.setFullYear(s,0,1),e.setHours(0,0,0,0),e}}class Fn extends h{priority=130;parse(e,t,n){const a=s=>({year:s,isTwoDigitYear:t==="YY"});switch(t){case"Y":return M(b(4,e),a);case"Yo":return M(n.ordinalNumber(e,{unit:"year"}),a);default:return M(b(t.length,e),a)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n,a){const s=le(e,a);if(n.isTwoDigitYear){const c=Be(n.year,s);return e.setFullYear(c,0,a.firstWeekContainsDate),e.setHours(0,0,0,0),W(e,a)}const o=!("era"in t)||t.era===1?n.year:1-n.year;return e.setFullYear(o,0,a.firstWeekContainsDate),e.setHours(0,0,0,0),W(e,a)}incompatibleTokens=["y","R","u","Q","q","M","L","I","d","D","i","t","T"]}class Cn extends h{priority=130;parse(e,t){return te(t==="R"?4:t.length,e)}set(e,t,n){const a=p(e,0);return a.setFullYear(n,0,4),a.setHours(0,0,0,0),Q(a)}incompatibleTokens=["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]}class In extends h{priority=130;parse(e,t){return te(t==="u"?4:t.length,e)}set(e,t,n){return e.setFullYear(n,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["G","y","Y","R","w","I","i","e","c","t","T"]}class Ln extends h{priority=120;parse(e,t,n){switch(t){case"Q":case"QQ":return b(t.length,e);case"Qo":return n.ordinalNumber(e,{unit:"quarter"});case"QQQ":return n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return n.quarter(e,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(e,{width:"wide",context:"formatting"})||n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=1&&t<=4}set(e,t,n){return e.setMonth((n-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]}class Qn extends h{priority=120;parse(e,t,n){switch(t){case"q":case"qq":return b(t.length,e);case"qo":return n.ordinalNumber(e,{unit:"quarter"});case"qqq":return n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return n.quarter(e,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(e,{width:"wide",context:"standalone"})||n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=1&&t<=4}set(e,t,n){return e.setMonth((n-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]}class Rn extends h{incompatibleTokens=["Y","R","q","Q","L","w","I","D","i","e","c","t","T"];priority=110;parse(e,t,n){const a=s=>s-1;switch(t){case"M":return M(g(x.month,e),a);case"MM":return M(b(2,e),a);case"Mo":return M(n.ordinalNumber(e,{unit:"month"}),a);case"MMM":return n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return n.month(e,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(e,{width:"wide",context:"formatting"})||n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.setMonth(n,1),e.setHours(0,0,0,0),e}}class Bn extends h{priority=110;parse(e,t,n){const a=s=>s-1;switch(t){case"L":return M(g(x.month,e),a);case"LL":return M(b(2,e),a);case"Lo":return M(n.ordinalNumber(e,{unit:"month"}),a);case"LLL":return n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return n.month(e,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(e,{width:"wide",context:"standalone"})||n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.setMonth(n,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]}function Xn(r,e,t){const n=u(r,t?.in),a=Fe(n,t)-e;return n.setDate(n.getDate()-a*7),u(n,t?.in)}class $n extends h{priority=100;parse(e,t,n){switch(t){case"w":return g(x.week,e);case"wo":return n.ordinalNumber(e,{unit:"week"});default:return b(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n,a){return W(Xn(e,n,a),a)}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","i","t","T"]}function An(r,e,t){const n=u(r,t?.in),a=qe(n,t)-e;return n.setDate(n.getDate()-a*7),n}class Gn extends h{priority=100;parse(e,t,n){switch(t){case"I":return g(x.week,e);case"Io":return n.ordinalNumber(e,{unit:"week"});default:return b(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n){return Q(An(e,n))}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]}const Vn=[31,28,31,30,31,30,31,31,30,31,30,31],zn=[31,29,31,30,31,30,31,31,30,31,30,31];class jn extends h{priority=90;subPriority=1;parse(e,t,n){switch(t){case"d":return g(x.date,e);case"do":return n.ordinalNumber(e,{unit:"date"});default:return b(t.length,e)}}validate(e,t){const n=e.getFullYear(),a=Xe(n),s=e.getMonth();return a?t>=1&&t<=zn[s]:t>=1&&t<=Vn[s]}set(e,t,n){return e.setDate(n),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","w","I","D","i","e","c","t","T"]}class Un extends h{priority=90;subpriority=1;parse(e,t,n){switch(t){case"D":case"DD":return g(x.dayOfYear,e);case"Do":return n.ordinalNumber(e,{unit:"date"});default:return b(t.length,e)}}validate(e,t){const n=e.getFullYear();return Xe(n)?t>=1&&t<=366:t>=1&&t<=365}set(e,t,n){return e.setMonth(0,n),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]}function he(r,e,t){const n=F(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=u(r,t?.in),o=s.getDay(),i=(e%7+7)%7,d=7-a,f=e<0||e>6?e-(o+d)%7:(i+d)%7-(o+d)%7;return ne(s,f,t)}class Zn extends h{priority=90;parse(e,t,n){switch(t){case"E":case"EE":case"EEE":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return n.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"EEEE":default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,a){return e=he(e,n,a),e.setHours(0,0,0,0),e}incompatibleTokens=["D","i","e","c","t","T"]}class Jn extends h{priority=90;parse(e,t,n,a){const s=o=>{const c=Math.floor((o-1)/7)*7;return(o+a.weekStartsOn+6)%7+c};switch(t){case"e":case"ee":return M(b(t.length,e),s);case"eo":return M(n.ordinalNumber(e,{unit:"day"}),s);case"eee":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"eeeee":return n.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"eeee":default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,a){return e=he(e,n,a),e.setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]}class Kn extends h{priority=90;parse(e,t,n,a){const s=o=>{const c=Math.floor((o-1)/7)*7;return(o+a.weekStartsOn+6)%7+c};switch(t){case"c":case"cc":return M(b(t.length,e),s);case"co":return M(n.ordinalNumber(e,{unit:"day"}),s);case"ccc":return n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});case"ccccc":return n.day(e,{width:"narrow",context:"standalone"});case"cccccc":return n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});case"cccc":default:return n.day(e,{width:"wide",context:"standalone"})||n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,a){return e=he(e,n,a),e.setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]}function Sn(r,e,t){const n=u(r,t?.in),a=Yn(n,t),s=e-a;return ne(n,s,t)}class er extends h{priority=90;parse(e,t,n){const a=s=>s===0?7:s;switch(t){case"i":case"ii":return b(t.length,e);case"io":return n.ordinalNumber(e,{unit:"day"});case"iii":return M(n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"}),a);case"iiiii":return M(n.day(e,{width:"narrow",context:"formatting"}),a);case"iiiiii":return M(n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"}),a);case"iiii":default:return M(n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"}),a)}}validate(e,t){return t>=1&&t<=7}set(e,t,n){return e=Sn(e,n),e.setHours(0,0,0,0),e}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]}class tr extends h{priority=80;parse(e,t,n){switch(t){case"a":case"aa":case"aaa":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return n.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,n){return e.setHours(fe(n),0,0,0),e}incompatibleTokens=["b","B","H","k","t","T"]}class nr extends h{priority=80;parse(e,t,n){switch(t){case"b":case"bb":case"bbb":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return n.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,n){return e.setHours(fe(n),0,0,0),e}incompatibleTokens=["a","B","H","k","t","T"]}class rr extends h{priority=80;parse(e,t,n){switch(t){case"B":case"BB":case"BBB":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return n.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,n){return e.setHours(fe(n),0,0,0),e}incompatibleTokens=["a","b","t","T"]}class ar extends h{priority=70;parse(e,t,n){switch(t){case"h":return g(x.hour12h,e);case"ho":return n.ordinalNumber(e,{unit:"hour"});default:return b(t.length,e)}}validate(e,t){return t>=1&&t<=12}set(e,t,n){const a=e.getHours()>=12;return a&&n<12?e.setHours(n+12,0,0,0):!a&&n===12?e.setHours(0,0,0,0):e.setHours(n,0,0,0),e}incompatibleTokens=["H","K","k","t","T"]}class sr extends h{priority=70;parse(e,t,n){switch(t){case"H":return g(x.hour23h,e);case"Ho":return n.ordinalNumber(e,{unit:"hour"});default:return b(t.length,e)}}validate(e,t){return t>=0&&t<=23}set(e,t,n){return e.setHours(n,0,0,0),e}incompatibleTokens=["a","b","h","K","k","t","T"]}class or extends h{priority=70;parse(e,t,n){switch(t){case"K":return g(x.hour11h,e);case"Ko":return n.ordinalNumber(e,{unit:"hour"});default:return b(t.length,e)}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.getHours()>=12&&n<12?e.setHours(n+12,0,0,0):e.setHours(n,0,0,0),e}incompatibleTokens=["h","H","k","t","T"]}class ir extends h{priority=70;parse(e,t,n){switch(t){case"k":return g(x.hour24h,e);case"ko":return n.ordinalNumber(e,{unit:"hour"});default:return b(t.length,e)}}validate(e,t){return t>=1&&t<=24}set(e,t,n){const a=n<=24?n%24:n;return e.setHours(a,0,0,0),e}incompatibleTokens=["a","b","h","H","K","t","T"]}class cr extends h{priority=60;parse(e,t,n){switch(t){case"m":return g(x.minute,e);case"mo":return n.ordinalNumber(e,{unit:"minute"});default:return b(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setMinutes(n,0,0),e}incompatibleTokens=["t","T"]}class ur extends h{priority=50;parse(e,t,n){switch(t){case"s":return g(x.second,e);case"so":return n.ordinalNumber(e,{unit:"second"});default:return b(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setSeconds(n,0),e}incompatibleTokens=["t","T"]}class dr extends h{priority=30;parse(e,t){const n=a=>Math.trunc(a*Math.pow(10,-t.length+3));return M(b(t.length,e),n)}set(e,t,n){return e.setMilliseconds(n),e}incompatibleTokens=["t","T"]}class lr extends h{priority=10;parse(e,t){switch(t){case"X":return _(v.basicOptionalMinutes,e);case"XX":return _(v.basic,e);case"XXXX":return _(v.basicOptionalSeconds,e);case"XXXXX":return _(v.extendedOptionalSeconds,e);case"XXX":default:return _(v.extended,e)}}set(e,t,n){return t.timestampIsSet?e:p(e,e.getTime()-ee(e)-n)}incompatibleTokens=["t","T","x"]}class fr extends h{priority=10;parse(e,t){switch(t){case"x":return _(v.basicOptionalMinutes,e);case"xx":return _(v.basic,e);case"xxxx":return _(v.basicOptionalSeconds,e);case"xxxxx":return _(v.extendedOptionalSeconds,e);case"xxx":default:return _(v.extended,e)}}set(e,t,n){return t.timestampIsSet?e:p(e,e.getTime()-ee(e)-n)}incompatibleTokens=["t","T","X"]}class hr extends h{priority=40;parse(e){return Re(e)}set(e,t,n){return[p(e,n*1e3),{timestampIsSet:!0}]}incompatibleTokens="*"}class mr extends h{priority=20;parse(e){return Re(e)}set(e,t,n){return[p(e,n),{timestampIsSet:!0}]}incompatibleTokens="*"}const wr={G:new Hn,y:new qn,Y:new Fn,R:new Cn,u:new In,Q:new Ln,q:new Qn,M:new Rn,L:new Bn,w:new $n,I:new Gn,d:new jn,D:new Un,E:new Zn,e:new Jn,c:new Kn,i:new er,a:new tr,b:new nr,B:new rr,h:new ar,H:new sr,K:new or,k:new ir,m:new cr,s:new ur,S:new dr,X:new lr,x:new fr,t:new hr,T:new mr},yr=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,gr=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,pr=/^'([^]*?)'?$/,br=/''/g,xr=/\S/,Mr=/[a-zA-Z]/;function Dr(r,e,t,n){const a=()=>p(n?.in||t,NaN),s=On(),o=n?.locale??s.locale??He,c=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0;if(!e)return r?a():u(t,n?.in);const d={firstWeekContainsDate:c,weekStartsOn:i,locale:o},f=[new En(n?.in,t)],y=e.match(gr).map(l=>{const w=l[0];if(w in oe){const k=oe[w];return k(l,o.formatLong)}return l}).join("").match(yr),T=[];for(let l of y){!n?.useAdditionalWeekYearTokens&&Le(l)&&ie(l,e,r),!n?.useAdditionalDayOfYearTokens&&Ie(l)&&ie(l,e,r);const w=l[0],k=wr[w];if(k){const{incompatibleTokens:R}=k;if(Array.isArray(R)){const me=T.find(we=>R.includes(we.token)||we.token===w);if(me)throw new RangeError(`The format string mustn't contain \`${me.fullToken}\` and \`${l}\` at the same time`)}else if(k.incompatibleTokens==="*"&&T.length>0)throw new RangeError(`The format string mustn't contain \`${l}\` and any other token at the same time`);T.push({token:w,fullToken:l});const H=k.run(r,l,o.match,d);if(!H)return a();f.push(H.setter),r=H.rest}else{if(w.match(Mr))throw new RangeError("Format string contains an unescaped latin alphabet character `"+w+"`");if(l==="''"?l="'":w==="'"&&(l=kr(l)),r.indexOf(l)===0)r=r.slice(l.length);else return a()}}if(r.length>0&&xr.test(r))return a();const N=f.map(l=>l.priority).sort((l,w)=>w-l).filter((l,w,k)=>k.indexOf(l)===w).map(l=>f.filter(w=>w.priority===l).sort((w,k)=>k.subPriority-w.subPriority)).map(l=>l[0]);let D=u(t,n?.in);if(isNaN(+D))return a();const P={};for(const l of N){if(!l.validate(D,d))return a();const w=l.set(D,P,d);Array.isArray(w)?(D=w[0],Object.assign(P,w[1])):D=w}return D}function kr(r){return r.match(pr)[1].replace(br,"'")}function Tr(r,e){const t=u(r,e?.in);return t.setMinutes(0,0,0),t}function Pr(r,e){const t=u(r,e?.in);return t.setSeconds(0,0),t}function Or(r,e){const t=u(r,e?.in);return t.setMilliseconds(0),t}function Yr(r,e){const t=()=>p(e?.in,NaN),n=e?.additionalDigits??2,a=Nr(r);let s;if(a.date){const d=Er(a.date,n);s=Hr(d.restDateString,d.year)}if(!s||isNaN(+s))return t();const o=+s;let c=0,i;if(a.time&&(c=qr(a.time),isNaN(c)))return t();if(a.timezone){if(i=Fr(a.timezone),isNaN(i))return t()}else{const d=new Date(o+c),f=u(0,e?.in);return f.setFullYear(d.getUTCFullYear(),d.getUTCMonth(),d.getUTCDate()),f.setHours(d.getUTCHours(),d.getUTCMinutes(),d.getUTCSeconds(),d.getUTCMilliseconds()),f}return u(o+c+i,e?.in)}const S={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},vr=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,_r=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Wr=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Nr(r){const e={},t=r.split(S.dateTimeDelimiter);let n;if(t.length>2)return e;if(/:/.test(t[0])?n=t[0]:(e.date=t[0],n=t[1],S.timeZoneDelimiter.test(e.date)&&(e.date=r.split(S.timeZoneDelimiter)[0],n=r.substr(e.date.length,r.length))),n){const a=S.timezone.exec(n);a?(e.time=n.replace(a[1],""),e.timezone=a[1]):e.time=n}return e}function Er(r,e){const t=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),n=r.match(t);if(!n)return{year:NaN,restDateString:""};const a=n[1]?parseInt(n[1]):null,s=n[2]?parseInt(n[2]):null;return{year:s===null?a:s*100,restDateString:r.slice((n[1]||n[2]).length)}}function Hr(r,e){if(e===null)return new Date(NaN);const t=r.match(vr);if(!t)return new Date(NaN);const n=!!t[4],a=$(t[1]),s=$(t[2])-1,o=$(t[3]),c=$(t[4]),i=$(t[5])-1;if(n)return Rr(e,c,i)?Cr(e,c,i):new Date(NaN);{const d=new Date(0);return!Lr(e,s,o)||!Qr(e,a)?new Date(NaN):(d.setUTCFullYear(e,s,Math.max(a,o)),d)}}function $(r){return r?parseInt(r):1}function qr(r){const e=r.match(_r);if(!e)return NaN;const t=ae(e[1]),n=ae(e[2]),a=ae(e[3]);return Br(t,n,a)?t*V+n*G+a*1e3:NaN}function ae(r){return r&&parseFloat(r.replace(",","."))||0}function Fr(r){if(r==="Z")return 0;const e=r.match(Wr);if(!e)return 0;const t=e[1]==="+"?-1:1,n=parseInt(e[2]),a=e[3]&&parseInt(e[3])||0;return Xr(n,a)?t*(n*V+a*G):NaN}function Cr(r,e,t){const n=new Date(0);n.setUTCFullYear(r,0,4);const a=n.getUTCDay()||7,s=(e-1)*7+t+1-a;return n.setUTCDate(n.getUTCDate()+s),n}const Ir=[31,null,31,30,31,30,31,31,30,31,30,31];function $e(r){return r%400===0||r%4===0&&r%100!==0}function Lr(r,e,t){return e>=0&&e<=11&&t>=1&&t<=(Ir[e]||($e(r)?29:28))}function Qr(r,e){return e>=1&&e<=($e(r)?366:365)}function Rr(r,e,t){return e>=1&&e<=53&&t>=0&&t<=6}function Br(r,e,t){return r===24?e===0&&t===0:t>=0&&t<60&&e>=0&&e<60&&r>=0&&r<25}function Xr(r,e){return e>=0&&e<=59}/*!
+ * chartjs-adapter-date-fns v3.0.0
+ * https://www.chartjs.org
+ * (c) 2022 chartjs-adapter-date-fns Contributors
+ * Released under the MIT license
+ */const $r={datetime:"MMM d, yyyy, h:mm:ss aaaa",millisecond:"h:mm:ss.SSS aaaa",second:"h:mm:ss aaaa",minute:"h:mm aaaa",hour:"ha",day:"MMM d",week:"PP",month:"MMM yyyy",quarter:"qqq - yyyy",year:"yyyy"};Ve._date.override({_id:"date-fns",formats:function(){return $r},parse:function(r,e){if(r===null||typeof r>"u")return null;const t=typeof r;return t==="number"||r instanceof Date?r=u(r):t==="string"&&(typeof e=="string"?r=Dr(r,e,new Date,this.options):r=Yr(r,this.options)),Ye(r)?r.getTime():null},format:function(r,e){return Tn(r,e,this.options)},add:function(r,e,t){switch(t){case"millisecond":return ue(r,e);case"second":return ft(r,e);case"minute":return dt(r,e);case"hour":return it(r,e);case"day":return ne(r,e);case"week":return ht(r,e);case"month":return ce(r,e);case"quarter":return lt(r,e);case"year":return mt(r,e);default:return r}},diff:function(r,e,t){switch(t){case"millisecond":return de(r,e);case"second":return Dt(r,e);case"minute":return bt(r,e);case"hour":return pt(r,e);case"day":return ve(r,e);case"week":return kt(r,e);case"month":return Ne(r,e);case"quarter":return Mt(r,e);case"year":return Tt(r,e);default:return 0}},startOf:function(r,e,t){switch(e){case"second":return Or(r);case"minute":return Pr(r);case"hour":return Tr(r);case"day":return se(r);case"week":return W(r);case"isoWeek":return W(r,{weekStartsOn:+t});case"month":return Ot(r);case"quarter":return Pt(r);case"year":return Ee(r);default:return r}},endOf:function(r,e){switch(e){case"second":return Et(r);case"minute":return Wt(r);case"hour":return vt(r);case"day":return _e(r);case"week":return _t(r);case"month":return We(r);case"quarter":return Nt(r);case"year":return Yt(r);default:return r}}});export{Vr as S};
diff --git a/repeater/web/html/assets/index-D0IT5vDS.js b/repeater/web/html/assets/index-D0IT5vDS.js
new file mode 100644
index 0000000..a07315f
--- /dev/null
+++ b/repeater/web/html/assets/index-D0IT5vDS.js
@@ -0,0 +1,35 @@
+const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Setup-DFGUHlPP.js","assets/Setup-RshMWyiL.css","assets/Login-BNn34coJ.js","assets/Login-BiyTDci2.css","assets/Dashboard-DQfmgsLU.js","assets/chart-B185MtDy.js","assets/useSignalQuality-DvX3fQnP.js","assets/preferences-DtwbSSgO.js","assets/Dashboard-CZYwlk3m.css","assets/Neighbors-Dp7tqjVr.js","assets/leaflet-src-BtisrQHC.js","assets/_commonjsHelpers-CqkleIqs.js","assets/Neighbors-BPsas1hQ.css","assets/leaflet-Dgihpmma.css","assets/Statistics-BszK_T8m.js","assets/chartjs-adapter-date-fns.esm-DJElUt-M.js","assets/chartjs-adapter-date-fns-kwjCs6JU.css","assets/plotly.min-DO11Gp-n.js","assets/Statistics-C56LjnFt.css","assets/SystemStats-DbE-CP6d.js","assets/SystemStats-B8-MXEai.css","assets/Configuration-jnqusIoi.js","assets/ConfirmDialog.vue_vue_type_script_setup_true_lang-CidOa_xU.js","assets/Configuration-DCyoN75P.css","assets/CADCalibration-BxVQoh3t.js","assets/CADCalibration-DnmufMQ0.css","assets/RoomServers-BzhrqUTJ.js","assets/MessageDialog.vue_vue_type_script_setup_true_lang-C6ugQFfD.js","assets/Companions-dNR-ED8E.js","assets/Terminal-CHr0ym4k.js","assets/Terminal-NOfYg9Od.css"])))=>i.map(i=>d[i]);
+(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();/**
+* @vue/shared v3.5.18
+* (c) 2018-present Yuxi (Evan) You and Vue contributors
+* @license MIT
+**//*! #__NO_SIDE_EFFECTS__ */function so(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Se={},xn=[],Et=()=>{},Ic=()=>!1,Gr=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),oo=e=>e.startsWith("onUpdate:"),$e=Object.assign,io=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},Dc=Object.prototype.hasOwnProperty,ke=(e,t)=>Dc.call(e,t),ie=Array.isArray,wn=e=>ar(e)==="[object Map]",Mn=e=>ar(e)==="[object Set]",Ho=e=>ar(e)==="[object Date]",fe=e=>typeof e=="function",Pe=e=>typeof e=="string",At=e=>typeof e=="symbol",Ae=e=>e!==null&&typeof e=="object",pa=e=>(Ae(e)||fe(e))&&fe(e.then)&&fe(e.catch),ha=Object.prototype.toString,ar=e=>ha.call(e),$c=e=>ar(e).slice(8,-1),ma=e=>ar(e)==="[object Object]",ao=e=>Pe(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,qn=so(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),zr=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},Vc=/-(\w)/g,dt=zr(e=>e.replace(Vc,(t,n)=>n?n.toUpperCase():"")),Fc=/\B([A-Z])/g,Xt=zr(e=>e.replace(Fc,"-$1").toLowerCase()),Jr=zr(e=>e.charAt(0).toUpperCase()+e.slice(1)),ps=zr(e=>e?`on${Jr(e)}`:""),Gt=(e,t)=>!Object.is(e,t),Sr=(e,...t)=>{for(let n=0;n{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},Ir=e=>{const t=parseFloat(e);return isNaN(t)?e:t},Bc=e=>{const t=Pe(e)?Number(e):NaN;return isNaN(t)?e:t};let jo;const Yr=()=>jo||(jo=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Pn(e){if(ie(e)){const t={};for(let n=0;n{if(n){const r=n.split(jc);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function ce(e){let t="";if(Pe(e))t=e;else if(ie(e))for(let n=0;nhn(n,t))}const ya=e=>!!(e&&e.__v_isRef===!0),W=e=>Pe(e)?e:e==null?"":ie(e)||Ae(e)&&(e.toString===ha||!fe(e.toString))?ya(e)?W(e.value):JSON.stringify(e,va,2):String(e),va=(e,t)=>ya(t)?va(e,t.value):wn(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,s],o)=>(n[hs(r,o)+" =>"]=s,n),{})}:Mn(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>hs(n))}:At(t)?hs(t):Ae(t)&&!ie(t)&&!ma(t)?String(t):t,hs=(e,t="")=>{var n;return At(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/**
+* @vue/reactivity v3.5.18
+* (c) 2018-present Yuxi (Evan) You and Vue contributors
+* @license MIT
+**/let He;class ba{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=He,!t&&He&&(this.index=(He.scopes||(He.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,n;if(this.scopes)for(t=0,n=this.scopes.length;t0&&--this._on===0&&(He=this.prevScope,this.prevScope=void 0)}stop(t){if(this._active){this._active=!1;let n,r;for(n=0,r=this.effects.length;n0)return;if(Wn){let t=Wn;for(Wn=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Kn;){let t=Kn;for(Kn=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(r){e||(e=r)}t=n}}if(e)throw e}function Ea(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Sa(e){let t,n=e.depsTail,r=n;for(;r;){const s=r.prevDep;r.version===-1?(r===n&&(n=s),fo(r),zc(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=s}e.deps=t,e.depsTail=n}function Ds(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Aa(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Aa(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===er)||(e.globalVersion=er,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Ds(e))))return;e.flags|=2;const t=e.dep,n=Te,r=ft;Te=e,ft=!0;try{Ea(e);const s=e.fn(e._value);(t.version===0||Gt(s,e._value))&&(e.flags|=128,e._value=s,t.version++)}catch(s){throw t.version++,s}finally{Te=n,ft=r,Sa(e),e.flags&=-3}}function fo(e,t=!1){const{dep:n,prevSub:r,nextSub:s}=e;if(r&&(r.nextSub=s,e.prevSub=void 0),s&&(s.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let o=n.computed.deps;o;o=o.nextDep)fo(o,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function zc(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let ft=!0;const Ra=[];function Dt(){Ra.push(ft),ft=!1}function $t(){const e=Ra.pop();ft=e===void 0?!0:e}function Uo(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Te;Te=void 0;try{t()}finally{Te=n}}}let er=0;class Jc{constructor(t,n){this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class po{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(t){if(!Te||!ft||Te===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Te)n=this.activeLink=new Jc(Te,this),Te.deps?(n.prevDep=Te.depsTail,Te.depsTail.nextDep=n,Te.depsTail=n):Te.deps=Te.depsTail=n,Ta(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const r=n.nextDep;r.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=r),n.prevDep=Te.depsTail,n.nextDep=void 0,Te.depsTail.nextDep=n,Te.depsTail=n,Te.deps===n&&(Te.deps=r)}return n}trigger(t){this.version++,er++,this.notify(t)}notify(t){co();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{uo()}}}function Ta(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let r=t.deps;r;r=r.nextDep)Ta(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Dr=new WeakMap,dn=Symbol(""),$s=Symbol(""),tr=Symbol("");function je(e,t,n){if(ft&&Te){let r=Dr.get(e);r||Dr.set(e,r=new Map);let s=r.get(n);s||(r.set(n,s=new po),s.map=r,s.key=n),s.track()}}function Lt(e,t,n,r,s,o){const i=Dr.get(e);if(!i){er++;return}const a=l=>{l&&l.trigger()};if(co(),t==="clear")i.forEach(a);else{const l=ie(e),u=l&&ao(n);if(l&&n==="length"){const c=Number(r);i.forEach((d,f)=>{(f==="length"||f===tr||!At(f)&&f>=c)&&a(d)})}else switch((n!==void 0||i.has(void 0))&&a(i.get(n)),u&&a(i.get(tr)),t){case"add":l?u&&a(i.get("length")):(a(i.get(dn)),wn(e)&&a(i.get($s)));break;case"delete":l||(a(i.get(dn)),wn(e)&&a(i.get($s)));break;case"set":wn(e)&&a(i.get(dn));break}}uo()}function Yc(e,t){const n=Dr.get(e);return n&&n.get(t)}function vn(e){const t=_e(e);return t===e?t:(je(t,"iterate",tr),lt(e)?t:t.map(Fe))}function Qr(e){return je(e=_e(e),"iterate",tr),e}const Qc={__proto__:null,[Symbol.iterator](){return gs(this,Symbol.iterator,Fe)},concat(...e){return vn(this).concat(...e.map(t=>ie(t)?vn(t):t))},entries(){return gs(this,"entries",e=>(e[1]=Fe(e[1]),e))},every(e,t){return Tt(this,"every",e,t,void 0,arguments)},filter(e,t){return Tt(this,"filter",e,t,n=>n.map(Fe),arguments)},find(e,t){return Tt(this,"find",e,t,Fe,arguments)},findIndex(e,t){return Tt(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Tt(this,"findLast",e,t,Fe,arguments)},findLastIndex(e,t){return Tt(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Tt(this,"forEach",e,t,void 0,arguments)},includes(...e){return ys(this,"includes",e)},indexOf(...e){return ys(this,"indexOf",e)},join(e){return vn(this).join(e)},lastIndexOf(...e){return ys(this,"lastIndexOf",e)},map(e,t){return Tt(this,"map",e,t,void 0,arguments)},pop(){return Dn(this,"pop")},push(...e){return Dn(this,"push",e)},reduce(e,...t){return qo(this,"reduce",e,t)},reduceRight(e,...t){return qo(this,"reduceRight",e,t)},shift(){return Dn(this,"shift")},some(e,t){return Tt(this,"some",e,t,void 0,arguments)},splice(...e){return Dn(this,"splice",e)},toReversed(){return vn(this).toReversed()},toSorted(e){return vn(this).toSorted(e)},toSpliced(...e){return vn(this).toSpliced(...e)},unshift(...e){return Dn(this,"unshift",e)},values(){return gs(this,"values",Fe)}};function gs(e,t,n){const r=Qr(e),s=r[t]();return r!==e&&!lt(e)&&(s._next=s.next,s.next=()=>{const o=s._next();return o.value&&(o.value=n(o.value)),o}),s}const Xc=Array.prototype;function Tt(e,t,n,r,s,o){const i=Qr(e),a=i!==e&&!lt(e),l=i[t];if(l!==Xc[t]){const d=l.apply(e,o);return a?Fe(d):d}let u=n;i!==e&&(a?u=function(d,f){return n.call(this,Fe(d),f,e)}:n.length>2&&(u=function(d,f){return n.call(this,d,f,e)}));const c=l.call(i,u,r);return a&&s?s(c):c}function qo(e,t,n,r){const s=Qr(e);let o=n;return s!==e&&(lt(e)?n.length>3&&(o=function(i,a,l){return n.call(this,i,a,l,e)}):o=function(i,a,l){return n.call(this,i,Fe(a),l,e)}),s[t](o,...r)}function ys(e,t,n){const r=_e(e);je(r,"iterate",tr);const s=r[t](...n);return(s===-1||s===!1)&&go(n[0])?(n[0]=_e(n[0]),r[t](...n)):s}function Dn(e,t,n=[]){Dt(),co();const r=_e(e)[t].apply(e,n);return uo(),$t(),r}const eu=so("__proto__,__v_isRef,__isVue"),Oa=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(At));function tu(e){At(e)||(e=String(e));const t=_e(this);return je(t,"has",e),t.hasOwnProperty(e)}class Ma{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,r){if(n==="__v_skip")return t.__v_skip;const s=this._isReadonly,o=this._isShallow;if(n==="__v_isReactive")return!s;if(n==="__v_isReadonly")return s;if(n==="__v_isShallow")return o;if(n==="__v_raw")return r===(s?o?du:Ia:o?Na:La).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const i=ie(t);if(!s){let l;if(i&&(l=Qc[n]))return l;if(n==="hasOwnProperty")return tu}const a=Reflect.get(t,n,Ie(t)?t:r);return(At(n)?Oa.has(n):eu(n))||(s||je(t,"get",n),o)?a:Ie(a)?i&&ao(n)?a:a.value:Ae(a)?s?$a(a):lr(a):a}}class Pa extends Ma{constructor(t=!1){super(!1,t)}set(t,n,r,s){let o=t[n];if(!this._isShallow){const l=Jt(o);if(!lt(r)&&!Jt(r)&&(o=_e(o),r=_e(r)),!ie(t)&&Ie(o)&&!Ie(r))return l?!1:(o.value=r,!0)}const i=ie(t)&&ao(n)?Number(n)e,br=e=>Reflect.getPrototypeOf(e);function iu(e,t,n){return function(...r){const s=this.__v_raw,o=_e(s),i=wn(o),a=e==="entries"||e===Symbol.iterator&&i,l=e==="keys"&&i,u=s[e](...r),c=n?Vs:t?$r:Fe;return!t&&je(o,"iterate",l?$s:dn),{next(){const{value:d,done:f}=u.next();return f?{value:d,done:f}:{value:a?[c(d[0]),c(d[1])]:c(d),done:f}},[Symbol.iterator](){return this}}}}function Cr(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function au(e,t){const n={get(s){const o=this.__v_raw,i=_e(o),a=_e(s);e||(Gt(s,a)&&je(i,"get",s),je(i,"get",a));const{has:l}=br(i),u=t?Vs:e?$r:Fe;if(l.call(i,s))return u(o.get(s));if(l.call(i,a))return u(o.get(a));o!==i&&o.get(s)},get size(){const s=this.__v_raw;return!e&&je(_e(s),"iterate",dn),Reflect.get(s,"size",s)},has(s){const o=this.__v_raw,i=_e(o),a=_e(s);return e||(Gt(s,a)&&je(i,"has",s),je(i,"has",a)),s===a?o.has(s):o.has(s)||o.has(a)},forEach(s,o){const i=this,a=i.__v_raw,l=_e(a),u=t?Vs:e?$r:Fe;return!e&&je(l,"iterate",dn),a.forEach((c,d)=>s.call(o,u(c),u(d),i))}};return $e(n,e?{add:Cr("add"),set:Cr("set"),delete:Cr("delete"),clear:Cr("clear")}:{add(s){!t&&!lt(s)&&!Jt(s)&&(s=_e(s));const o=_e(this);return br(o).has.call(o,s)||(o.add(s),Lt(o,"add",s,s)),this},set(s,o){!t&&!lt(o)&&!Jt(o)&&(o=_e(o));const i=_e(this),{has:a,get:l}=br(i);let u=a.call(i,s);u||(s=_e(s),u=a.call(i,s));const c=l.call(i,s);return i.set(s,o),u?Gt(o,c)&&Lt(i,"set",s,o):Lt(i,"add",s,o),this},delete(s){const o=_e(this),{has:i,get:a}=br(o);let l=i.call(o,s);l||(s=_e(s),l=i.call(o,s)),a&&a.call(o,s);const u=o.delete(s);return l&&Lt(o,"delete",s,void 0),u},clear(){const s=_e(this),o=s.size!==0,i=s.clear();return o&&Lt(s,"clear",void 0,void 0),i}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=iu(s,e,t)}),n}function ho(e,t){const n=au(e,t);return(r,s,o)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?r:Reflect.get(ke(n,s)&&s in r?n:r,s,o)}const lu={get:ho(!1,!1)},cu={get:ho(!1,!0)},uu={get:ho(!0,!1)};const La=new WeakMap,Na=new WeakMap,Ia=new WeakMap,du=new WeakMap;function fu(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function pu(e){return e.__v_skip||!Object.isExtensible(e)?0:fu($c(e))}function lr(e){return Jt(e)?e:mo(e,!1,ru,lu,La)}function Da(e){return mo(e,!1,ou,cu,Na)}function $a(e){return mo(e,!0,su,uu,Ia)}function mo(e,t,n,r,s){if(!Ae(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const o=pu(e);if(o===0)return e;const i=s.get(e);if(i)return i;const a=new Proxy(e,o===2?r:n);return s.set(e,a),a}function zt(e){return Jt(e)?zt(e.__v_raw):!!(e&&e.__v_isReactive)}function Jt(e){return!!(e&&e.__v_isReadonly)}function lt(e){return!!(e&&e.__v_isShallow)}function go(e){return e?!!e.__v_raw:!1}function _e(e){const t=e&&e.__v_raw;return t?_e(t):e}function yo(e){return!ke(e,"__v_skip")&&Object.isExtensible(e)&&Is(e,"__v_skip",!0),e}const Fe=e=>Ae(e)?lr(e):e,$r=e=>Ae(e)?$a(e):e;function Ie(e){return e?e.__v_isRef===!0:!1}function Z(e){return Va(e,!1)}function hu(e){return Va(e,!0)}function Va(e,t){return Ie(e)?e:new mu(e,t)}class mu{constructor(t,n){this.dep=new po,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:_e(t),this._value=n?t:Fe(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||lt(t)||Jt(t);t=r?t:_e(t),Gt(t,n)&&(this._rawValue=t,this._value=r?t:Fe(t),this.dep.trigger())}}function de(e){return Ie(e)?e.value:e}const gu={get:(e,t,n)=>t==="__v_raw"?e:de(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const s=e[t];return Ie(s)&&!Ie(n)?(s.value=n,!0):Reflect.set(e,t,n,r)}};function Fa(e){return zt(e)?e:new Proxy(e,gu)}function yu(e){const t=ie(e)?new Array(e.length):{};for(const n in e)t[n]=bu(e,n);return t}class vu{constructor(t,n,r){this._object=t,this._key=n,this._defaultValue=r,this.__v_isRef=!0,this._value=void 0}get value(){const t=this._object[this._key];return this._value=t===void 0?this._defaultValue:t}set value(t){this._object[this._key]=t}get dep(){return Yc(_e(this._object),this._key)}}function bu(e,t,n){const r=e[t];return Ie(r)?r:new vu(e,t,n)}class Cu{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new po(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=er-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Te!==this)return ka(this,!0),!0}get value(){const t=this.dep.track();return Aa(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function _u(e,t,n=!1){let r,s;return fe(e)?r=e:(r=e.get,s=e.set),new Cu(r,s,n)}const _r={},Vr=new WeakMap;let on;function xu(e,t=!1,n=on){if(n){let r=Vr.get(n);r||Vr.set(n,r=[]),r.push(e)}}function wu(e,t,n=Se){const{immediate:r,deep:s,once:o,scheduler:i,augmentJob:a,call:l}=n,u=M=>s?M:lt(M)||s===!1||s===0?Nt(M,1):Nt(M);let c,d,f,y,h=!1,v=!1;if(Ie(e)?(d=()=>e.value,h=lt(e)):zt(e)?(d=()=>u(e),h=!0):ie(e)?(v=!0,h=e.some(M=>zt(M)||lt(M)),d=()=>e.map(M=>{if(Ie(M))return M.value;if(zt(M))return u(M);if(fe(M))return l?l(M,2):M()})):fe(e)?t?d=l?()=>l(e,2):e:d=()=>{if(f){Dt();try{f()}finally{$t()}}const M=on;on=c;try{return l?l(e,3,[y]):e(y)}finally{on=M}}:d=Et,t&&s){const M=d,V=s===!0?1/0:s;d=()=>Nt(M(),V)}const w=_a(),S=()=>{c.stop(),w&&w.active&&io(w.effects,c)};if(o&&t){const M=t;t=(...V)=>{M(...V),S()}}let L=v?new Array(e.length).fill(_r):_r;const R=M=>{if(!(!(c.flags&1)||!c.dirty&&!M))if(t){const V=c.run();if(s||h||(v?V.some((Y,q)=>Gt(Y,L[q])):Gt(V,L))){f&&f();const Y=on;on=c;try{const q=[V,L===_r?void 0:v&&L[0]===_r?[]:L,y];L=V,l?l(t,3,q):t(...q)}finally{on=Y}}}else c.run()};return a&&a(R),c=new xa(d),c.scheduler=i?()=>i(R,!1):R,y=M=>xu(M,!1,c),f=c.onStop=()=>{const M=Vr.get(c);if(M){if(l)l(M,4);else for(const V of M)V();Vr.delete(c)}},t?r?R(!0):L=c.run():i?i(R.bind(null,!0),!0):c.run(),S.pause=c.pause.bind(c),S.resume=c.resume.bind(c),S.stop=S,S}function Nt(e,t=1/0,n){if(t<=0||!Ae(e)||e.__v_skip||(n=n||new Set,n.has(e)))return e;if(n.add(e),t--,Ie(e))Nt(e.value,t,n);else if(ie(e))for(let r=0;r{Nt(r,t,n)});else if(ma(e)){for(const r in e)Nt(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&Nt(e[r],t,n)}return e}/**
+* @vue/runtime-core v3.5.18
+* (c) 2018-present Yuxi (Evan) You and Vue contributors
+* @license MIT
+**/function cr(e,t,n,r){try{return r?e(...r):e()}catch(s){ur(s,t,n)}}function pt(e,t,n,r){if(fe(e)){const s=cr(e,t,n,r);return s&&pa(s)&&s.catch(o=>{ur(o,t,n)}),s}if(ie(e)){const s=[];for(let o=0;o>>1,s=ze[r],o=nr(s);o=nr(n)?ze.push(e):ze.splice(Eu(t),0,e),e.flags|=1,Ha()}}function Ha(){Fr||(Fr=Ba.then(Ua))}function Su(e){ie(e)?kn.push(...e):Ut&&e.id===-1?Ut.splice(Cn+1,0,e):e.flags&1||(kn.push(e),e.flags|=1),Ha()}function Ko(e,t,n=xt+1){for(;nnr(n)-nr(r));if(kn.length=0,Ut){Ut.push(...t);return}for(Ut=t,Cn=0;Cne.id==null?e.flags&2?-1:1/0:e.id;function Ua(e){try{for(xt=0;xt