diff --git a/repeater/web/html/assets/CADCalibration-BB8Y2fH_.js b/repeater/web/html/assets/CADCalibration-BB8Y2fH_.js new file mode 100644 index 0000000..8685922 --- /dev/null +++ b/repeater/web/html/assets/CADCalibration-BB8Y2fH_.js @@ -0,0 +1 @@ +import{r as e}from"./chunk-DECur_0Z.js";import{Ct as t,D as n,E as r,St as i,Y as a,f as o,g as s,k as c,l,m as u,o as d,p as f,r as p,s as m,u as h}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{l as ee,t as g}from"./api-C0ctTLHN.js";import{t as te}from"./system-Dx7MrhAz.js";import{t as _}from"./_plugin-vue_export-helper-TcpyXLsZ.js";import{n as ne}from"./index-BpKhPa08.js";import{t as v}from"./plotly.min-B8UFpwnE.js";var y=e(v(),1),re={class:`p-6 space-y-6`},b={class:`glass-card rounded-[15px] p-6`},x={class:`flex justify-center`},S={class:`flex gap-4`},ie=[`disabled`],ae=[`disabled`],oe={class:`glass-card rounded-[15px] p-6 space-y-4`},se={class:`text-content-primary dark:text-content-primary`},ce={class:`flex items-center justify-between gap-4 px-4 bg-primary/10 border border-primary/30 rounded-lg h-[52px] overflow-hidden`},le={key:0,class:`text-content-primary dark:text-primary text-sm`},ue={key:1,class:`text-content-muted dark:text-content-muted text-sm italic`},de={key:2,class:`text-content-primary dark:text-content-primary text-sm`},fe={key:3,class:`text-content-secondary dark:text-content-muted text-sm`},pe={class:`space-y-2`},me={class:`w-full bg-white/10 rounded-full h-2`},he={class:`text-content-secondary dark:text-content-muted text-sm`},C={class:`grid grid-cols-2 md:grid-cols-4 gap-4`},w={class:`glass-card rounded-[15px] p-4 text-center`},T={class:`text-2xl font-bold text-primary`},E={class:`glass-card rounded-[15px] p-4 text-center`},D={class:`text-2xl font-bold text-primary`},O={class:`glass-card rounded-[15px] p-4 text-center`},k={class:`text-2xl font-bold text-primary`},A={class:`glass-card rounded-[15px] p-4 text-center`},j={class:`text-2xl font-bold text-primary`},M=_(s({name:`CADCalibrationView`,__name:`CADCalibration`,setup(e){let s=te(),_=d(()=>document.documentElement.classList.contains(`dark`)),v=()=>{let e=_.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)`}},M=a(!1),N=a(null),P=a(null),F=a({}),I=a(null),L=a([]),R=a({}),z=a(`Ready to start calibration`),B=a(0),V=a(0),H=a(0),U=a(0),W=a(0),G=a(0),K=a(null),q=a(!1),J=a(!1),Y=a(!1),X=a(!1),Z=null,ge={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 _e(){let e=v(),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`}],n={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};y.default.newPlot(`plotly-chart`,t,n,ge)}function ve(){if(Object.keys(F.value).length===0)return;let e=Object.values(F.value),t=[],n=[],r=[];for(let i of e)t.push(i.det_peak),n.push(i.det_min),r.push(i.detection_rate);let i={x:[t],y:[n],"marker.color":[r],hovertemplate:`Peak: %{x}
Min: %{y}
Detection Rate: %{marker.color:.1f}%
Status: Tested
`};y.default.restyle(`plotly-chart`,i,[0])}async function ye(){try{let e=await g.post(`/cad-calibration-start`,{samples:10,delay_ms:50});if(e.success)M.value=!0,N.value=Date.now(),s.setCadCalibrationRunning(!0),F.value={},L.value=[],R.value={},I.value=null,q.value=!1,J.value=!1,Y.value=!1,X.value=!1,H.value=0,U.value=0,W.value=0,G.value=0,B.value=0,V.value=0,Z=setInterval(()=>{N.value&&(G.value=Math.floor((Date.now()-N.value)/1e3))},1e3),be();else throw Error(e.error||`Failed to start calibration`)}catch(e){z.value=`Error: ${e instanceof Error?e.message:`Unknown error`}`}}async function Q(){try{(await g.post(`/cad-calibration-stop`)).success&&(M.value=!1,s.setCadCalibrationRunning(!1),P.value&&=(P.value.close(),null),Z&&=(clearInterval(Z),null))}catch(e){console.error(`Failed to stop calibration:`,e)}}function be(){P.value&&P.value.close();let e=ee(),t=e?`?token=${encodeURIComponent(e)}`:``;P.value=new EventSource(`/api/cad-calibration-stream${t}`),P.value.onmessage=function(e){try{xe(JSON.parse(e.data))}catch(e){console.error(`Failed to parse SSE data:`,e)}},P.value.onerror=function(e){console.error(`SSE connection error:`,e),M.value||(P.value&&=(P.value.close(),null))}}function xe(e){switch(e.type){case`status`:z.value=e.message||`Status update`,e.test_ranges&&(K.value=e.test_ranges,q.value=!0);break;case`progress`:B.value=e.current||0,V.value=e.total||0,H.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){let t=`${e.det_peak}_${e.det_min}`;F.value[t]={det_peak:e.det_peak,det_min:e.det_min,detection_rate:e.detection_rate,detections:e.detections,samples:e.samples},ve(),Se()}break;case`complete`:case`completed`:M.value=!1,z.value=e.message||`Calibration completed`,s.setCadCalibrationRunning(!1),Ce(),P.value&&=(P.value.close(),null),Z&&=(clearInterval(Z),null);break;case`error`:z.value=`Error: ${e.message}`,s.setCadCalibrationRunning(!1),Q();break}}function Se(){let e=Object.values(F.value).map(e=>e.detection_rate);e.length!==0&&(U.value=Math.max(...e),W.value=e.reduce((e,t)=>e+t,0)/e.length)}function Ce(){J.value=!0;let e=null,t=0;for(let n of Object.values(F.value))n.detection_rate>t&&(t=n.detection_rate,e=n);I.value=e,e&&t>0?(Y.value=!0,X.value=!1):(Y.value=!1,X.value=!0)}let $=a(!1);async function we(){if(!I.value){z.value=`Error: No calibration results to save`;return}try{let e=await g.post(`/save_cad_settings`,{peak:I.value.det_peak,min_val:I.value.det_min,detection_rate:I.value.detection_rate});if(e.success)$.value=!0;else throw Error(e.error||`Failed to save settings`)}catch(e){z.value=`Error: Failed to save settings: ${e instanceof Error?e.message:`Unknown error`}`}}return r(()=>{_e()}),n(()=>{P.value&&P.value.close(),Z&&clearInterval(Z),s.setCadCalibrationRunning(!1),document.getElementById(`plotly-chart`)&&y.default.purge(`plotly-chart`)}),(e,n)=>(c(),h(p,null,[m(`div`,re,[n[13]||=m(`div`,null,[m(`h1`,{class:`text-2xl font-bold text-content-primary dark:text-content-primary`},` CAD Calibration Tool `),m(`p`,{class:`text-content-secondary dark:text-content-muted mt-2`},` Channel Activity Detection calibration `)],-1),m(`div`,b,[m(`div`,x,[m(`div`,S,[m(`button`,{onClick:ye,disabled:M.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`},[...n[1]||=[o(`
Start Calibration
Begin testing
`,2)]],8,ie),m(`button`,{onClick:Q,disabled:!M.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`},[...n[2]||=[o(`
Stop
Halt calibration
`,2)]],8,ae)])])]),m(`div`,oe,[m(`div`,se,t(z.value),1),m(`div`,ce,[!J.value&&q.value&&K.value?(c(),h(`div`,le,[n[3]||=m(`strong`,null,`Configuration:`,-1),f(` SF`+t(K.value.spreading_factor)+` | Peak: `+t(K.value.peak_min)+`–`+t(K.value.peak_max)+` | Min: `+t(K.value.min_min)+`–`+t(K.value.min_max)+` | `+t((K.value.peak_max-K.value.peak_min+1)*(K.value.min_max-K.value.min_min+1))+` tests `,1)])):J.value?Y.value&&I.value?(c(),h(`div`,de,[n[4]||=m(`span`,{class:`text-accent-green font-medium`},`Optimal settings found — `,-1),n[5]||=f(` Peak: `,-1),m(`strong`,null,t(I.value.det_peak),1),n[6]||=f(`, Min: `,-1),m(`strong`,null,t(I.value.det_min),1),n[7]||=f(`, Rate: `,-1),m(`strong`,null,t(I.value.detection_rate.toFixed(1))+`%`,1)])):X.value?(c(),h(`div`,fe,` No optimal settings found. Consider running calibration again. `)):l(``,!0):(c(),h(`div`,ue,` Awaiting calibration… `)),Y.value&&I.value?(c(),h(`button`,{key:4,onClick:we,class:`btn-primary flex-shrink-0 flex items-center gap-2`},[...n[8]||=[m(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[m(`path`,{d:`M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`})],-1),f(` Save Settings `,-1)]])):l(``,!0)]),m(`div`,pe,[m(`div`,me,[m(`div`,{class:`bg-gradient-to-r from-primary to-accent-green h-2 rounded-full transition-all duration-300`,style:i({width:V.value>0?`${B.value/V.value*100}%`:`0%`})},null,4)]),m(`div`,he,t(B.value)+` / `+t(V.value)+` tests completed `,1)])]),m(`div`,C,[m(`div`,w,[m(`div`,T,t(H.value),1),n[9]||=m(`div`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Tests Completed`,-1)]),m(`div`,E,[m(`div`,D,t(U.value.toFixed(1))+`%`,1),n[10]||=m(`div`,{class:`text-content-secondary dark:text-content-muted text-sm`},` Best Detection Rate `,-1)]),m(`div`,O,[m(`div`,k,t(W.value.toFixed(1))+`%`,1),n[11]||=m(`div`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Average Rate`,-1)]),m(`div`,A,[m(`div`,j,t(G.value)+`s`,1),n[12]||=m(`div`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Elapsed Time`,-1)])]),n[14]||=m(`div`,{class:`glass-card rounded-[15px] p-6`},[m(`div`,{id:`plotly-chart`,class:`w-full h-96`})],-1)]),u(ne,{modelValue:$.value,"onUpdate:modelValue":n[0]||=e=>$.value=e,title:`CAD Calibration Saved: Restart Required`,message:`In order for the CAD Calibration settings to take effect and the noise floor to return to normal, the service needs to be restarted.`},null,8,[`modelValue`])],64))}}),[[`__scopeId`,`data-v-950ea1f9`]]);export{M as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/CADCalibration-C0vsymGt.css b/repeater/web/html/assets/CADCalibration-C4Y61LYy.css similarity index 68% rename from repeater/web/html/assets/CADCalibration-C0vsymGt.css rename to repeater/web/html/assets/CADCalibration-C4Y61LYy.css index 98a57f1..cae1726 100644 --- a/repeater/web/html/assets/CADCalibration-C0vsymGt.css +++ b/repeater/web/html/assets/CADCalibration-C4Y61LYy.css @@ -1 +1 @@ -.glass-card[data-v-ecd318db]{background:var(--color-glass-bg);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border:1px solid var(--color-glass-border);box-shadow:var(--color-glass-shadow)} +.glass-card[data-v-950ea1f9]{background:var(--color-glass-bg);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border:1px solid var(--color-glass-border);box-shadow:var(--color-glass-shadow)} diff --git a/repeater/web/html/assets/CADCalibration-nHiYlOIH.js b/repeater/web/html/assets/CADCalibration-nHiYlOIH.js deleted file mode 100644 index 7188408..0000000 --- a/repeater/web/html/assets/CADCalibration-nHiYlOIH.js +++ /dev/null @@ -1 +0,0 @@ -import{r as e}from"./chunk-DECur_0Z.js";import{Ct as t,D as n,E as r,St as i,Y as a,f as o,g as s,k as c,l,m as u,o as d,p as f,r as p,s as m,u as h}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{l as ee,t as g}from"./api-DBiYn0RS.js";import{t as te}from"./system-BfTzQTOF.js";import{t as _}from"./_plugin-vue_export-helper-TcpyXLsZ.js";import{t as v}from"./plotly.min-YhyN9SYa.js";import{t as ne}from"./RestartModal-DDp7H13-.js";var y=e(v(),1),re={class:`p-6 space-y-6`},b={class:`glass-card rounded-[15px] p-6`},x={class:`flex justify-center`},S={class:`flex gap-4`},ie=[`disabled`],ae=[`disabled`],oe={class:`glass-card rounded-[15px] p-6 space-y-4`},se={class:`text-content-primary dark:text-content-primary`},ce={class:`flex items-center justify-between gap-4 px-4 bg-primary/10 border border-primary/30 rounded-lg h-[52px] overflow-hidden`},le={key:0,class:`text-content-primary dark:text-primary text-sm`},ue={key:1,class:`text-content-muted dark:text-content-muted text-sm italic`},de={key:2,class:`text-content-primary dark:text-content-primary text-sm`},fe={key:3,class:`text-content-secondary dark:text-content-muted text-sm`},pe={class:`space-y-2`},me={class:`w-full bg-white/10 rounded-full h-2`},he={class:`text-content-secondary dark:text-content-muted text-sm`},C={class:`grid grid-cols-2 md:grid-cols-4 gap-4`},w={class:`glass-card rounded-[15px] p-4 text-center`},T={class:`text-2xl font-bold text-primary`},E={class:`glass-card rounded-[15px] p-4 text-center`},D={class:`text-2xl font-bold text-primary`},O={class:`glass-card rounded-[15px] p-4 text-center`},k={class:`text-2xl font-bold text-primary`},A={class:`glass-card rounded-[15px] p-4 text-center`},j={class:`text-2xl font-bold text-primary`},M=_(s({name:`CADCalibrationView`,__name:`CADCalibration`,setup(e){let s=te(),_=d(()=>document.documentElement.classList.contains(`dark`)),v=()=>{let e=_.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)`}},M=a(!1),N=a(null),P=a(null),F=a({}),I=a(null),L=a([]),R=a({}),z=a(`Ready to start calibration`),B=a(0),V=a(0),H=a(0),U=a(0),W=a(0),G=a(0),K=a(null),q=a(!1),J=a(!1),Y=a(!1),X=a(!1),Z=null,ge={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 _e(){let e=v(),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`}],n={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};y.default.newPlot(`plotly-chart`,t,n,ge)}function ve(){if(Object.keys(F.value).length===0)return;let e=Object.values(F.value),t=[],n=[],r=[];for(let i of e)t.push(i.det_peak),n.push(i.det_min),r.push(i.detection_rate);let i={x:[t],y:[n],"marker.color":[r],hovertemplate:`Peak: %{x}
Min: %{y}
Detection Rate: %{marker.color:.1f}%
Status: Tested
`};y.default.restyle(`plotly-chart`,i,[0])}async function ye(){try{let e=await g.post(`/cad-calibration-start`,{samples:10,delay_ms:50});if(e.success)M.value=!0,N.value=Date.now(),s.setCadCalibrationRunning(!0),F.value={},L.value=[],R.value={},I.value=null,q.value=!1,J.value=!1,Y.value=!1,X.value=!1,H.value=0,U.value=0,W.value=0,G.value=0,B.value=0,V.value=0,Z=setInterval(()=>{N.value&&(G.value=Math.floor((Date.now()-N.value)/1e3))},1e3),be();else throw Error(e.error||`Failed to start calibration`)}catch(e){z.value=`Error: ${e instanceof Error?e.message:`Unknown error`}`}}async function Q(){try{(await g.post(`/cad-calibration-stop`)).success&&(M.value=!1,s.setCadCalibrationRunning(!1),P.value&&=(P.value.close(),null),Z&&=(clearInterval(Z),null))}catch(e){console.error(`Failed to stop calibration:`,e)}}function be(){P.value&&P.value.close();let e=ee(),t=e?`?token=${encodeURIComponent(e)}`:``;P.value=new EventSource(`/api/cad-calibration-stream${t}`),P.value.onmessage=function(e){try{xe(JSON.parse(e.data))}catch(e){console.error(`Failed to parse SSE data:`,e)}},P.value.onerror=function(e){console.error(`SSE connection error:`,e),M.value||(P.value&&=(P.value.close(),null))}}function xe(e){switch(e.type){case`status`:z.value=e.message||`Status update`,e.test_ranges&&(K.value=e.test_ranges,q.value=!0);break;case`progress`:B.value=e.current||0,V.value=e.total||0,H.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){let t=`${e.det_peak}_${e.det_min}`;F.value[t]={det_peak:e.det_peak,det_min:e.det_min,detection_rate:e.detection_rate,detections:e.detections,samples:e.samples},ve(),Se()}break;case`complete`:case`completed`:M.value=!1,z.value=e.message||`Calibration completed`,s.setCadCalibrationRunning(!1),Ce(),P.value&&=(P.value.close(),null),Z&&=(clearInterval(Z),null);break;case`error`:z.value=`Error: ${e.message}`,s.setCadCalibrationRunning(!1),Q();break}}function Se(){let e=Object.values(F.value).map(e=>e.detection_rate);e.length!==0&&(U.value=Math.max(...e),W.value=e.reduce((e,t)=>e+t,0)/e.length)}function Ce(){J.value=!0;let e=null,t=0;for(let n of Object.values(F.value))n.detection_rate>t&&(t=n.detection_rate,e=n);I.value=e,e&&t>0?(Y.value=!0,X.value=!1):(Y.value=!1,X.value=!0)}let $=a(!1);async function we(){if(!I.value){z.value=`Error: No calibration results to save`;return}try{let e=await g.post(`/save_cad_settings`,{peak:I.value.det_peak,min_val:I.value.det_min,detection_rate:I.value.detection_rate});if(e.success)$.value=!0;else throw Error(e.error||`Failed to save settings`)}catch(e){z.value=`Error: Failed to save settings: ${e instanceof Error?e.message:`Unknown error`}`}}return r(()=>{_e()}),n(()=>{P.value&&P.value.close(),Z&&clearInterval(Z),s.setCadCalibrationRunning(!1),document.getElementById(`plotly-chart`)&&y.default.purge(`plotly-chart`)}),(e,n)=>(c(),h(p,null,[m(`div`,re,[n[13]||=m(`div`,null,[m(`h1`,{class:`text-2xl font-bold text-content-primary dark:text-content-primary`},` CAD Calibration Tool `),m(`p`,{class:`text-content-secondary dark:text-content-muted mt-2`},` Channel Activity Detection calibration `)],-1),m(`div`,b,[m(`div`,x,[m(`div`,S,[m(`button`,{onClick:ye,disabled:M.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`},[...n[1]||=[o(`
Start Calibration
Begin testing
`,2)]],8,ie),m(`button`,{onClick:Q,disabled:!M.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`},[...n[2]||=[o(`
Stop
Halt calibration
`,2)]],8,ae)])])]),m(`div`,oe,[m(`div`,se,t(z.value),1),m(`div`,ce,[!J.value&&q.value&&K.value?(c(),h(`div`,le,[n[3]||=m(`strong`,null,`Configuration:`,-1),f(` SF`+t(K.value.spreading_factor)+` | Peak: `+t(K.value.peak_min)+`–`+t(K.value.peak_max)+` | Min: `+t(K.value.min_min)+`–`+t(K.value.min_max)+` | `+t((K.value.peak_max-K.value.peak_min+1)*(K.value.min_max-K.value.min_min+1))+` tests `,1)])):J.value?Y.value&&I.value?(c(),h(`div`,de,[n[4]||=m(`span`,{class:`text-accent-green font-medium`},`Optimal settings found — `,-1),n[5]||=f(` Peak: `,-1),m(`strong`,null,t(I.value.det_peak),1),n[6]||=f(`, Min: `,-1),m(`strong`,null,t(I.value.det_min),1),n[7]||=f(`, Rate: `,-1),m(`strong`,null,t(I.value.detection_rate.toFixed(1))+`%`,1)])):X.value?(c(),h(`div`,fe,` No optimal settings found. Consider running calibration again. `)):l(``,!0):(c(),h(`div`,ue,` Awaiting calibration… `)),Y.value&&I.value?(c(),h(`button`,{key:4,onClick:we,class:`btn-primary flex-shrink-0 flex items-center gap-2`},[...n[8]||=[m(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[m(`path`,{d:`M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`})],-1),f(` Save Settings `,-1)]])):l(``,!0)]),m(`div`,pe,[m(`div`,me,[m(`div`,{class:`bg-gradient-to-r from-primary to-accent-green h-2 rounded-full transition-all duration-300`,style:i({width:V.value>0?`${B.value/V.value*100}%`:`0%`})},null,4)]),m(`div`,he,t(B.value)+` / `+t(V.value)+` tests completed `,1)])]),m(`div`,C,[m(`div`,w,[m(`div`,T,t(H.value),1),n[9]||=m(`div`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Tests Completed`,-1)]),m(`div`,E,[m(`div`,D,t(U.value.toFixed(1))+`%`,1),n[10]||=m(`div`,{class:`text-content-secondary dark:text-content-muted text-sm`},` Best Detection Rate `,-1)]),m(`div`,O,[m(`div`,k,t(W.value.toFixed(1))+`%`,1),n[11]||=m(`div`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Average Rate`,-1)]),m(`div`,A,[m(`div`,j,t(G.value)+`s`,1),n[12]||=m(`div`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Elapsed Time`,-1)])]),n[14]||=m(`div`,{class:`glass-card rounded-[15px] p-6`},[m(`div`,{id:`plotly-chart`,class:`w-full h-96`})],-1)]),u(ne,{modelValue:$.value,"onUpdate:modelValue":n[0]||=e=>$.value=e,title:`CAD Calibration Saved: Restart Required`,message:`In order for the CAD Calibration settings to take effect and the noise floor to return to normal, the service needs to be restarted.`},null,8,[`modelValue`])],64))}}),[[`__scopeId`,`data-v-ecd318db`]]);export{M as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/ChartCard-CzDm8sMP.js b/repeater/web/html/assets/ChartCard-Cqs_1Frf.js similarity index 99% rename from repeater/web/html/assets/ChartCard-CzDm8sMP.js rename to repeater/web/html/assets/ChartCard-Cqs_1Frf.js index 6ba79d6..36fb4d0 100644 --- a/repeater/web/html/assets/ChartCard-CzDm8sMP.js +++ b/repeater/web/html/assets/ChartCard-Cqs_1Frf.js @@ -1,3 +1,3 @@ -import{Ct as e,M as t,R as n,Y as r,g as i,k as a,l as o,m as s,s as c,u as l,w as u}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{t as d}from"./api-DBiYn0RS.js";import{t as f}from"./Spinner-CYvUNW0P.js";function p(e){return e+.5|0}var m=(e,t,n)=>Math.max(Math.min(e,n),t);function h(e){return m(p(e*2.55),0,255)}function g(e){return m(p(e*255),0,255)}function _(e){return m(p(e/2.55)/100,0,1)}function v(e){return m(p(e*100),0,100)}var y={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},b=[...`0123456789ABCDEF`],x=e=>b[e&15],S=e=>b[(e&240)>>4]+b[e&15],C=e=>(e&240)>>4==(e&15),w=e=>C(e.r)&&C(e.g)&&C(e.b)&&C(e.a);function T(e){var t=e.length,n;return e[0]===`#`&&(t===4||t===5?n={r:255&y[e[1]]*17,g:255&y[e[2]]*17,b:255&y[e[3]]*17,a:t===5?y[e[4]]*17:255}:(t===7||t===9)&&(n={r:y[e[1]]<<4|y[e[2]],g:y[e[3]]<<4|y[e[4]],b:y[e[5]]<<4|y[e[6]],a:t===9?y[e[7]]<<4|y[e[8]]:255})),n}var E=(e,t)=>e<255?t(e):``;function D(e){var t=w(e)?x:S;return e?`#`+t(e.r)+t(e.g)+t(e.b)+E(e.a,t):void 0}var ee=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function O(e,t,n){let r=t*Math.min(n,1-n),i=(t,i=(t+e/30)%12)=>n-r*Math.max(Math.min(i-3,9-i,1),-1);return[i(0),i(8),i(4)]}function te(e,t,n){let r=(r,i=(r+e/60)%6)=>n-n*t*Math.max(Math.min(i,4-i,1),0);return[r(5),r(3),r(1)]}function ne(e,t,n){let r=O(e,1,.5),i;for(t+n>1&&(i=1/(t+n),t*=i,n*=i),i=0;i<3;i++)r[i]*=1-t-n,r[i]+=t;return r}function re(e,t,n,r,i){return e===i?(t-n)/r+(t.5?l/(2-i-a):l/(i+a),s=re(t,n,r,l,i),s=s*60+.5),[s|0,c||0,o]}function ae(e,t,n,r){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,r)).map(g)}function oe(e,t,n){return ae(O,e,t,n)}function se(e,t,n){return ae(ne,e,t,n)}function ce(e,t,n){return ae(te,e,t,n)}function le(e){return(e%360+360)%360}function ue(e){let t=ee.exec(e),n=255,r;if(!t)return;t[5]!==r&&(n=t[6]?h(+t[5]):g(+t[5]));let i=le(+t[2]),a=t[3]/100,o=t[4]/100;return r=t[1]===`hwb`?se(i,a,o):t[1]===`hsv`?ce(i,a,o):oe(i,a,o),{r:r[0],g:r[1],b:r[2],a:n}}function de(e,t){var n=ie(e);n[0]=le(n[0]+t),n=oe(n),e.r=n[0],e.g=n[1],e.b=n[2]}function fe(e){if(!e)return;let t=ie(e),n=t[0],r=v(t[1]),i=v(t[2]);return e.a<255?`hsla(${n}, ${r}%, ${i}%, ${_(e.a)})`:`hsl(${n}, ${r}%, ${i}%)`}var pe={x:`dark`,Z:`light`,Y:`re`,X:`blu`,W:`gr`,V:`medium`,U:`slate`,A:`ee`,T:`ol`,S:`or`,B:`ra`,C:`lateg`,D:`ights`,R:`in`,Q:`turquois`,E:`hi`,P:`ro`,O:`al`,N:`le`,M:`de`,L:`yello`,F:`en`,K:`ch`,G:`arks`,H:`ea`,I:`ightg`,J:`wh`},me={OiceXe:`f0f8ff`,antiquewEte:`faebd7`,aqua:`ffff`,aquamarRe:`7fffd4`,azuY:`f0ffff`,beige:`f5f5dc`,bisque:`ffe4c4`,black:`0`,blanKedOmond:`ffebcd`,Xe:`ff`,XeviTet:`8a2be2`,bPwn:`a52a2a`,burlywood:`deb887`,caMtXe:`5f9ea0`,KartYuse:`7fff00`,KocTate:`d2691e`,cSO:`ff7f50`,cSnflowerXe:`6495ed`,cSnsilk:`fff8dc`,crimson:`dc143c`,cyan:`ffff`,xXe:`8b`,xcyan:`8b8b`,xgTMnPd:`b8860b`,xWay:`a9a9a9`,xgYF:`6400`,xgYy:`a9a9a9`,xkhaki:`bdb76b`,xmagFta:`8b008b`,xTivegYF:`556b2f`,xSange:`ff8c00`,xScEd:`9932cc`,xYd:`8b0000`,xsOmon:`e9967a`,xsHgYF:`8fbc8f`,xUXe:`483d8b`,xUWay:`2f4f4f`,xUgYy:`2f4f4f`,xQe:`ced1`,xviTet:`9400d3`,dAppRk:`ff1493`,dApskyXe:`bfff`,dimWay:`696969`,dimgYy:`696969`,dodgerXe:`1e90ff`,fiYbrick:`b22222`,flSOwEte:`fffaf0`,foYstWAn:`228b22`,fuKsia:`ff00ff`,gaRsbSo:`dcdcdc`,ghostwEte:`f8f8ff`,gTd:`ffd700`,gTMnPd:`daa520`,Way:`808080`,gYF:`8000`,gYFLw:`adff2f`,gYy:`808080`,honeyMw:`f0fff0`,hotpRk:`ff69b4`,RdianYd:`cd5c5c`,Rdigo:`4b0082`,ivSy:`fffff0`,khaki:`f0e68c`,lavFMr:`e6e6fa`,lavFMrXsh:`fff0f5`,lawngYF:`7cfc00`,NmoncEffon:`fffacd`,ZXe:`add8e6`,ZcSO:`f08080`,Zcyan:`e0ffff`,ZgTMnPdLw:`fafad2`,ZWay:`d3d3d3`,ZgYF:`90ee90`,ZgYy:`d3d3d3`,ZpRk:`ffb6c1`,ZsOmon:`ffa07a`,ZsHgYF:`20b2aa`,ZskyXe:`87cefa`,ZUWay:`778899`,ZUgYy:`778899`,ZstAlXe:`b0c4de`,ZLw:`ffffe0`,lime:`ff00`,limegYF:`32cd32`,lRF:`faf0e6`,magFta:`ff00ff`,maPon:`800000`,VaquamarRe:`66cdaa`,VXe:`cd`,VScEd:`ba55d3`,VpurpN:`9370db`,VsHgYF:`3cb371`,VUXe:`7b68ee`,VsprRggYF:`fa9a`,VQe:`48d1cc`,VviTetYd:`c71585`,midnightXe:`191970`,mRtcYam:`f5fffa`,mistyPse:`ffe4e1`,moccasR:`ffe4b5`,navajowEte:`ffdead`,navy:`80`,Tdlace:`fdf5e6`,Tive:`808000`,TivedBb:`6b8e23`,Sange:`ffa500`,SangeYd:`ff4500`,ScEd:`da70d6`,pOegTMnPd:`eee8aa`,pOegYF:`98fb98`,pOeQe:`afeeee`,pOeviTetYd:`db7093`,papayawEp:`ffefd5`,pHKpuff:`ffdab9`,peru:`cd853f`,pRk:`ffc0cb`,plum:`dda0dd`,powMrXe:`b0e0e6`,purpN:`800080`,YbeccapurpN:`663399`,Yd:`ff0000`,Psybrown:`bc8f8f`,PyOXe:`4169e1`,saddNbPwn:`8b4513`,sOmon:`fa8072`,sandybPwn:`f4a460`,sHgYF:`2e8b57`,sHshell:`fff5ee`,siFna:`a0522d`,silver:`c0c0c0`,skyXe:`87ceeb`,UXe:`6a5acd`,UWay:`708090`,UgYy:`708090`,snow:`fffafa`,sprRggYF:`ff7f`,stAlXe:`4682b4`,tan:`d2b48c`,teO:`8080`,tEstN:`d8bfd8`,tomato:`ff6347`,Qe:`40e0d0`,viTet:`ee82ee`,JHt:`f5deb3`,wEte:`ffffff`,wEtesmoke:`f5f5f5`,Lw:`ffff00`,LwgYF:`9acd32`};function he(){let e={},t=Object.keys(me),n=Object.keys(pe),r,i,a,o,s;for(r=0;r>16&255,a>>8&255,a&255]}return e}var ge;function _e(e){ge||(ge=he(),ge.transparent=[0,0,0,0]);let t=ge[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}var ve=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function ye(e){let t=ve.exec(e),n=255,r,i,a;if(t){if(t[7]!==r){let e=+t[7];n=t[8]?h(e):m(e*255,0,255)}return r=+t[1],i=+t[3],a=+t[5],r=255&(t[2]?h(r):m(r,0,255)),i=255&(t[4]?h(i):m(i,0,255)),a=255&(t[6]?h(a):m(a,0,255)),{r,g:i,b:a,a:n}}}function be(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${_(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}var xe=e=>e<=.0031308?e*12.92:e**(1/2.4)*1.055-.055,Se=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4;function Ce(e,t,n){let r=Se(_(e.r)),i=Se(_(e.g)),a=Se(_(e.b));return{r:g(xe(r+n*(Se(_(t.r))-r))),g:g(xe(i+n*(Se(_(t.g))-i))),b:g(xe(a+n*(Se(_(t.b))-a))),a:e.a+n*(t.a-e.a)}}function we(e,t,n){if(e){let r=ie(e);r[t]=Math.max(0,Math.min(r[t]+r[t]*n,t===0?360:1)),r=oe(r),e.r=r[0],e.g=r[1],e.b=r[2]}}function Te(e,t){return e&&Object.assign(t||{},e)}function Ee(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=g(e[3]))):(t=Te(e,{r:0,g:0,b:0,a:1}),t.a=g(t.a)),t}function De(e){return e.charAt(0)===`r`?ye(e):ue(e)}var Oe=class e{constructor(t){if(t instanceof e)return t;let n=typeof t,r;n===`object`?r=Ee(t):n===`string`&&(r=T(t)||_e(t)||De(t)),this._rgb=r,this._valid=!!r}get valid(){return this._valid}get rgb(){var e=Te(this._rgb);return e&&(e.a=_(e.a)),e}set rgb(e){this._rgb=Ee(e)}rgbString(){return this._valid?be(this._rgb):void 0}hexString(){return this._valid?D(this._rgb):void 0}hslString(){return this._valid?fe(this._rgb):void 0}mix(e,t){if(e){let n=this.rgb,r=e.rgb,i,a=t===i?.5:t,o=2*a-1,s=n.a-r.a,c=((o*s===-1?o:(o+s)/(1+o*s))+1)/2;i=1-c,n.r=255&c*n.r+i*r.r+.5,n.g=255&c*n.g+i*r.g+.5,n.b=255&c*n.b+i*r.b+.5,n.a=a*n.a+(1-a)*r.a,this.rgb=n}return this}interpolate(e,t){return e&&(this._rgb=Ce(this._rgb,e._rgb,t)),this}clone(){return new e(this.rgb)}alpha(e){return this._rgb.a=g(e),this}clearer(e){let t=this._rgb;return t.a*=1-e,this}greyscale(){let e=this._rgb;return e.r=e.g=e.b=p(e.r*.3+e.g*.59+e.b*.11),this}opaquer(e){let t=this._rgb;return t.a*=1+e,this}negate(){let e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return we(this._rgb,2,e),this}darken(e){return we(this._rgb,2,-e),this}saturate(e){return we(this._rgb,1,e),this}desaturate(e){return we(this._rgb,1,-e),this}rotate(e){return de(this._rgb,e),this}};function ke(){}var Ae=(()=>{let e=0;return()=>e++})();function k(e){return e==null}function A(e){if(Array.isArray&&Array.isArray(e))return!0;let t=Object.prototype.toString.call(e);return t.slice(0,7)===`[object`&&t.slice(-6)===`Array]`}function j(e){return e!==null&&Object.prototype.toString.call(e)===`[object Object]`}function M(e){return(typeof e==`number`||e instanceof Number)&&isFinite(+e)}function N(e,t){return M(e)?e:t}function P(e,t){return e===void 0?t:e}var je=(e,t)=>typeof e==`string`&&e.endsWith(`%`)?parseFloat(e)/100:+e/t,Me=(e,t)=>typeof e==`string`&&e.endsWith(`%`)?parseFloat(e)/100*t:+e;function F(e,t,n){if(e&&typeof e.call==`function`)return e.apply(n,t)}function I(e,t,n,r){let i,a,o;if(A(e))if(a=e.length,r)for(i=a-1;i>=0;i--)t.call(n,e[i],i);else for(i=0;ie,x:e=>e.x,y:e=>e.y};function Ve(e){let t=e.split(`.`),n=[],r=``;for(let e of t)r+=e,r.endsWith(`\\`)?r=r.slice(0,-1)+`.`:(n.push(r),r=``);return n}function He(e){let t=Ve(e);return e=>{for(let n of t){if(n===``)break;e&&=e[n]}return e}}function Ue(e,t){return(Be[t]||(Be[t]=He(t)))(e)}function We(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Ge=e=>e!==void 0,Ke=e=>typeof e==`function`,qe=(e,t)=>{if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0};function Je(e){return e.type===`mouseup`||e.type===`click`||e.type===`contextmenu`}var L=Math.PI,R=2*L,Ye=R+L,Xe=1/0,Ze=L/180,z=L/2,Qe=L/4,$e=L*2/3,et=Math.log10,B=Math.sign;function tt(e,t,n){return Math.abs(e-t)e-t).pop(),t}function it(e){return typeof e==`symbol`||typeof e==`object`&&!!e&&!(Symbol.toPrimitive in e||`toString`in e||`valueOf`in e)}function at(e){return!it(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function ot(e,t){let n=Math.round(e);return n-t<=e&&n+t>=e}function st(e,t,n){let r,i,a;for(r=0,i=e.length;rc&&l=Math.min(t,n)-r&&e<=Math.max(t,n)+r}function ht(e,t,n){n||=(n=>e[n]1;)a=i+r>>1,n(a)?i=a:r=a;return{lo:i,hi:r}}var gt=(e,t,n,r)=>ht(e,n,r?r=>{let i=e[r][t];return ie[r][t]ht(e,n,r=>e[r][t]>=n);function vt(e,t,n){let r=0,i=e.length;for(;rr&&e[i-1]>n;)i--;return r>0||i{let n=`_onData`+We(t),r=e[t];Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value(...t){let i=r.apply(this,t);return e._chartjs.listeners.forEach(e=>{typeof e[n]==`function`&&e[n](...t)}),i}})})}function xt(e,t){let n=e._chartjs;if(!n)return;let r=n.listeners,i=r.indexOf(t);i!==-1&&r.splice(i,1),!(r.length>0)&&(yt.forEach(t=>{delete e[t]}),delete e._chartjs)}function St(e){let t=new Set(e);return t.size===e.length?e:Array.from(t)}var Ct=function(){return typeof window>`u`?function(e){return e()}:window.requestAnimationFrame}();function wt(e,t){let n=[],r=!1;return function(...i){n=i,r||(r=!0,Ct.call(window,()=>{r=!1,e.apply(t,n)}))}}function Tt(e,t){let n;return function(...r){return t?(clearTimeout(n),n=setTimeout(e,t,r)):e.apply(this,r),t}}var Et=e=>e===`start`?`left`:e===`end`?`right`:`center`,G=(e,t,n)=>e===`start`?t:e===`end`?n:(t+n)/2,Dt=(e,t,n,r)=>e===(r?`left`:`right`)?n:e===`center`?(t+n)/2:t;function Ot(e,t,n){let r=t.length,i=0,a=r;if(e._sorted){let{iScale:o,vScale:s,_parsed:c}=e,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,u=o.axis,{min:d,max:f,minDefined:p,maxDefined:m}=o.getUserBounds();if(p){if(i=Math.min(gt(c,u,d).lo,n?r:gt(t,u,o.getPixelForValue(d)).lo),l){let e=c.slice(0,i+1).reverse().findIndex(e=>!k(e[s.axis]));i-=Math.max(0,e)}i=U(i,0,r-1)}if(m){let e=Math.max(gt(c,o.axis,f,!0).hi+1,n?0:gt(t,u,o.getPixelForValue(f),!0).hi+1);if(l){let t=c.slice(e-1).findIndex(e=>!k(e[s.axis]));e+=Math.max(0,t)}a=U(e,i,r)-i}else a=r-i}return{start:i,count:a}}function kt(e){let{xScale:t,yScale:n,_scaleRanges:r}=e,i={xmin:t.min,xmax:t.max,ymin:n.min,ymax:n.max};if(!r)return e._scaleRanges=i,!0;let a=r.xmin!==t.min||r.xmax!==t.max||r.ymin!==n.min||r.ymax!==n.max;return Object.assign(r,i),a}var At=e=>e===0||e===1,jt=(e,t,n)=>-(2**(10*--e)*Math.sin((e-t)*R/n)),Mt=(e,t,n)=>2**(-10*e)*Math.sin((e-t)*R/n)+1,Nt={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-(--e*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>--e*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*z)+1,easeOutSine:e=>Math.sin(e*z),easeInOutSine:e=>-.5*(Math.cos(L*e)-1),easeInExpo:e=>e===0?0:2**(10*(e-1)),easeOutExpo:e=>e===1?1:-(2**(-10*e))+1,easeInOutExpo:e=>At(e)?e:e<.5?.5*2**(10*(e*2-1)):.5*(-(2**(-10*(e*2-1)))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1- --e*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>At(e)?e:jt(e,.075,.3),easeOutElastic:e=>At(e)?e:Mt(e,.075,.3),easeInOutElastic(e){let t=.1125,n=.45;return At(e)?e:e<.5?.5*jt(e*2,t,n):.5+.5*Mt(e*2-1,t,n)},easeInBack(e){let t=1.70158;return e*e*((t+1)*e-t)},easeOutBack(e){let t=1.70158;return--e*e*((t+1)*e+t)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-Nt.easeOutBounce(1-e),easeOutBounce(e){let t=7.5625,n=2.75;return e<1/n?t*e*e:e<2/n?t*(e-=1.5/n)*e+.75:e<2.5/n?t*(e-=2.25/n)*e+.9375:t*(e-=2.625/n)*e+.984375},easeInOutBounce:e=>e<.5?Nt.easeInBounce(e*2)*.5:Nt.easeOutBounce(e*2-1)*.5+.5};function Pt(e){if(e&&typeof e==`object`){let t=e.toString();return t===`[object CanvasPattern]`||t===`[object CanvasGradient]`}return!1}function Ft(e){return Pt(e)?e:new Oe(e)}function It(e){return Pt(e)?e:new Oe(e).saturate(.5).darken(.1).hexString()}var Lt=[`x`,`y`,`borderWidth`,`radius`,`tension`],Rt=[`color`,`borderColor`,`backgroundColor`];function zt(e){e.set(`animation`,{delay:void 0,duration:1e3,easing:`easeOutQuart`,fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe(`animation`,{_fallback:!1,_indexable:!1,_scriptable:e=>e!==`onProgress`&&e!==`onComplete`&&e!==`fn`}),e.set(`animations`,{colors:{type:`color`,properties:Rt},numbers:{type:`number`,properties:Lt}}),e.describe(`animations`,{_fallback:`animation`}),e.set(`transitions`,{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:`transparent`},visible:{type:`boolean`,duration:0}}},hide:{animations:{colors:{to:`transparent`},visible:{type:`boolean`,easing:`linear`,fn:e=>e|0}}}})}function Bt(e){e.set(`layout`,{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}var Vt=new Map;function Ht(e,t){t||={};let n=e+JSON.stringify(t),r=Vt.get(n);return r||(r=new Intl.NumberFormat(e,t),Vt.set(n,r)),r}function Ut(e,t,n){return Ht(t,n).format(e)}var Wt={values(e){return A(e)?e:``+e},numeric(e,t,n){if(e===0)return`0`;let r=this.chart.options.locale,i,a=e;if(n.length>1){let t=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(t<1e-4||t>0x38d7ea4c68000)&&(i=`scientific`),a=Gt(e,n)}let o=et(Math.abs(a)),s=isNaN(o)?1:Math.max(Math.min(-1*Math.floor(o),20),0),c={notation:i,minimumFractionDigits:s,maximumFractionDigits:s};return Object.assign(c,this.options.ticks.format),Ut(e,r,c)},logarithmic(e,t,n){if(e===0)return`0`;let r=n[t].significand||e/10**Math.floor(et(e));return[1,2,3,5,10,15].includes(r)||t>.8*n.length?Wt.numeric.call(this,e,t,n):``}};function Gt(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var Kt={formatters:Wt};function qt(e){e.set(`scale`,{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:`ticks`,clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(e,t)=>t.lineWidth,tickColor:(e,t)=>t.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:``,padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:``,padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Kt.formatters.values,minor:{},major:{},align:`center`,crossAlign:`near`,showLabelBackdrop:!1,backdropColor:`rgba(255, 255, 255, 0.75)`,backdropPadding:2}}),e.route(`scale.ticks`,`color`,``,`color`),e.route(`scale.grid`,`color`,``,`borderColor`),e.route(`scale.border`,`color`,``,`borderColor`),e.route(`scale.title`,`color`,``,`color`),e.describe(`scale`,{_fallback:!1,_scriptable:e=>!e.startsWith(`before`)&&!e.startsWith(`after`)&&e!==`callback`&&e!==`parser`,_indexable:e=>e!==`borderDash`&&e!==`tickBorderDash`&&e!==`dash`}),e.describe(`scales`,{_fallback:`scale`}),e.describe(`scale.ticks`,{_scriptable:e=>e!==`backdropPadding`&&e!==`callback`,_indexable:e=>e!==`backdropPadding`})}var Jt=Object.create(null),Yt=Object.create(null);function Xt(e,t){if(!t)return e;let n=t.split(`.`);for(let t=0,r=n.length;te.chart.platform.getDevicePixelRatio(),this.elements={},this.events=[`mousemove`,`mouseout`,`click`,`touchstart`,`touchmove`],this.font={family:`'Helvetica Neue', 'Helvetica', 'Arial', sans-serif`,size:12,style:`normal`,lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(e,t)=>It(t.backgroundColor),this.hoverBorderColor=(e,t)=>It(t.borderColor),this.hoverColor=(e,t)=>It(t.color),this.indexAxis=`x`,this.interaction={mode:`nearest`,intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(e),this.apply(t)}set(e,t){return Zt(this,e,t)}get(e){return Xt(this,e)}describe(e,t){return Zt(Yt,e,t)}override(e,t){return Zt(Jt,e,t)}route(e,t,n,r){let i=Xt(this,e),a=Xt(this,n),o=`_`+t;Object.defineProperties(i,{[o]:{value:i[t],writable:!0},[t]:{enumerable:!0,get(){let e=this[o],t=a[r];return j(e)?Object.assign({},t,e):P(e,t)},set(e){this[o]=e}}})}apply(e){e.forEach(e=>e(this))}}({_scriptable:e=>!e.startsWith(`on`),_indexable:e=>e!==`events`,hover:{_fallback:`interaction`},interaction:{_scriptable:!1,_indexable:!1}},[zt,Bt,qt]);function Qt(e){return!e||k(e.size)||k(e.family)?null:(e.style?e.style+` `:``)+(e.weight?e.weight+` `:``)+e.size+`px `+e.family}function $t(e,t,n,r,i){let a=t[i];return a||(a=t[i]=e.measureText(i).width,n.push(i)),a>r&&(r=a),r}function en(e,t,n,r){r||={};let i=r.data=r.data||{},a=r.garbageCollect=r.garbageCollect||[];r.font!==t&&(i=r.data={},a=r.garbageCollect=[],r.font=t),e.save(),e.font=t;let o=0,s=n.length,c,l,u,d,f;for(c=0;cn.length){for(c=0;c0&&e.stroke()}}function on(e,t,n){return n||=.5,!t||e&&e.x>t.left-n&&e.xt.top-n&&e.y0&&a.strokeColor!==``,c,l;for(e.save(),e.font=i.string,dn(e,a),c=0;c+e||0;function bn(e,t){let n={},r=j(t),i=r?Object.keys(t):t,a=j(e)?r?n=>P(e[n],e[t[n]]):t=>e[t]:()=>e;for(let e of i)n[e]=yn(a(e));return n}function xn(e){return bn(e,{top:`y`,right:`x`,bottom:`y`,left:`x`})}function Sn(e){return bn(e,[`topLeft`,`topRight`,`bottomLeft`,`bottomRight`])}function q(e){let t=xn(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function J(e,t){e||={},t||=K.font;let n=P(e.size,t.size);typeof n==`string`&&(n=parseInt(n,10));let r=P(e.style,t.style);r&&!(``+r).match(_n)&&(console.warn(`Invalid font style specified: "`+r+`"`),r=void 0);let i={family:P(e.family,t.family),lineHeight:vn(P(e.lineHeight,t.lineHeight),n),size:n,style:r,weight:P(e.weight,t.weight),string:``};return i.string=Qt(i),i}function Cn(e,t,n,r){let i=!0,a,o,s;for(a=0,o=e.length;an&&e===0?0:e+t;return{min:o(r,-Math.abs(a)),max:o(i,a)}}function Tn(e,t){return Object.assign(Object.create(e),t)}function En(e,t=[``],n,r,i=()=>e[0]){let a=n||e;return r===void 0&&(r=Hn(`_fallback`,e)),new Proxy({[Symbol.toStringTag]:`Object`,_cacheable:!0,_scopes:e,_rootScopes:a,_fallback:r,_getTarget:i,override:n=>En([n,...e],t,a,r)},{deleteProperty(t,n){return delete t[n],delete t._keys,delete e[0][n],!0},get(n,r){return jn(n,r,()=>Vn(r,t,e,n))},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e._scopes[0],t)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(e,t){return Un(e).includes(t)},ownKeys(e){return Un(e)},set(e,t,n){let r=e._storage||=i();return e[t]=r[t]=n,delete e._keys,!0}})}function Dn(e,t,n,r){let i={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:On(e,r),setContext:t=>Dn(e,t,n,r),override:i=>Dn(e.override(i),t,n,r)};return new Proxy(i,{deleteProperty(t,n){return delete t[n],delete e[n],!0},get(e,t,n){return jn(e,t,()=>Mn(e,t,n))},getOwnPropertyDescriptor(t,n){return t._descriptors.allKeys?Reflect.has(e,n)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,n)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(t,n){return Reflect.has(e,n)},ownKeys(){return Reflect.ownKeys(e)},set(t,n,r){return e[n]=r,delete t[n],!0}})}function On(e,t={scriptable:!0,indexable:!0}){let{_scriptable:n=t.scriptable,_indexable:r=t.indexable,_allKeys:i=t.allKeys}=e;return{allKeys:i,scriptable:n,indexable:r,isScriptable:Ke(n)?n:()=>n,isIndexable:Ke(r)?r:()=>r}}var kn=(e,t)=>e?e+We(t):t,An=(e,t)=>j(t)&&e!==`adapters`&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function jn(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t===`constructor`)return e[t];let r=n();return e[t]=r,r}function Mn(e,t,n){let{_proxy:r,_context:i,_subProxy:a,_descriptors:o}=e,s=r[t];return Ke(s)&&o.isScriptable(t)&&(s=Nn(t,s,e,n)),A(s)&&s.length&&(s=Pn(t,s,e,o.isIndexable)),An(t,s)&&(s=Dn(s,i,a&&a[t],o)),s}function Nn(e,t,n,r){let{_proxy:i,_context:a,_subProxy:o,_stack:s}=n;if(s.has(e))throw Error(`Recursion detected: `+Array.from(s).join(`->`)+`->`+e);s.add(e);let c=t(a,o||r);return s.delete(e),An(e,c)&&(c=Rn(i._scopes,i,e,c)),c}function Pn(e,t,n,r){let{_proxy:i,_context:a,_subProxy:o,_descriptors:s}=n;if(a.index!==void 0&&r(e))return t[a.index%t.length];if(j(t[0])){let n=t,r=i._scopes.filter(e=>e!==n);t=[];for(let c of n){let n=Rn(r,i,e,c);t.push(Dn(n,a,o&&o[e],s))}}return t}function Fn(e,t,n){return Ke(e)?e(t,n):e}var In=(e,t)=>e===!0?t:typeof e==`string`?Ue(t,e):void 0;function Ln(e,t,n,r,i){for(let a of t){let t=In(n,a);if(t){e.add(t);let a=Fn(t._fallback,n,i);if(a!==void 0&&a!==n&&a!==r)return a}else if(t===!1&&r!==void 0&&n!==r)return null}return!1}function Rn(e,t,n,r){let i=t._rootScopes,a=Fn(t._fallback,n,r),o=[...e,...i],s=new Set;s.add(r);let c=zn(s,o,n,a||n,r);return c===null||a!==void 0&&a!==n&&(c=zn(s,o,a,c,r),c===null)?!1:En(Array.from(s),[``],i,a,()=>Bn(t,n,r))}function zn(e,t,n,r,i){for(;n;)n=Ln(e,t,n,r,i);return n}function Bn(e,t,n){let r=e._getTarget();t in r||(r[t]={});let i=r[t];return A(i)&&j(n)?n:i||{}}function Vn(e,t,n,r){let i;for(let a of t)if(i=Hn(kn(a,e),n),i!==void 0)return An(e,i)?Rn(n,r,e,i):i}function Hn(e,t){for(let n of t){if(!n)continue;let t=n[e];if(t!==void 0)return t}}function Un(e){let t=e._keys;return t||=e._keys=Wn(e._scopes),t}function Wn(e){let t=new Set;for(let n of e)for(let e of Object.keys(n).filter(e=>!e.startsWith(`_`)))t.add(e);return Array.from(t)}var Gn=2**-52||1e-14,Kn=(e,t)=>te===`x`?`y`:`x`;function Jn(e,t,n,r){let i=e.skip?t:e,a=t,o=n.skip?t:n,s=dt(a,i),c=dt(o,a),l=s/(s+c),u=c/(s+c);l=isNaN(l)?0:l,u=isNaN(u)?0:u;let d=r*l,f=r*u;return{previous:{x:a.x-d*(o.x-i.x),y:a.y-d*(o.y-i.y)},next:{x:a.x+f*(o.x-i.x),y:a.y+f*(o.y-i.y)}}}function Yn(e,t,n){let r=e.length,i,a,o,s,c,l=Kn(e,0);for(let u=0;u!e.skip)),t.cubicInterpolationMode===`monotone`)Zn(e,i);else{let n=r?e[e.length-1]:e[0];for(a=0,o=e.length;ae.ownerDocument.defaultView.getComputedStyle(e,null);function ar(e,t){return ir(e).getPropertyValue(t)}var or=[`top`,`right`,`bottom`,`left`];function sr(e,t,n){let r={};n=n?`-`+n:``;for(let i=0;i<4;i++){let a=or[i];r[a]=parseFloat(e[t+`-`+a+n])||0}return r.width=r.left+r.right,r.height=r.top+r.bottom,r}var cr=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function lr(e,t){let n=e.touches,r=n&&n.length?n[0]:e,{offsetX:i,offsetY:a}=r,o=!1,s,c;if(cr(i,a,e.target))s=i,c=a;else{let e=t.getBoundingClientRect();s=r.clientX-e.left,c=r.clientY-e.top,o=!0}return{x:s,y:c,box:o}}function ur(e,t){if(`native`in e)return e;let{canvas:n,currentDevicePixelRatio:r}=t,i=ir(n),a=i.boxSizing===`border-box`,o=sr(i,`padding`),s=sr(i,`border`,`width`),{x:c,y:l,box:u}=lr(e,n),d=o.left+(u&&s.left),f=o.top+(u&&s.top),{width:p,height:m}=t;return a&&(p-=o.width+s.width,m-=o.height+s.height),{x:Math.round((c-d)/p*n.width/r),y:Math.round((l-f)/m*n.height/r)}}function dr(e,t,n){let r,i;if(t===void 0||n===void 0){let a=e&&nr(e);if(!a)t=e.clientWidth,n=e.clientHeight;else{let e=a.getBoundingClientRect(),o=ir(a),s=sr(o,`border`,`width`),c=sr(o,`padding`);t=e.width-c.width-s.width,n=e.height-c.height-s.height,r=rr(o.maxWidth,a,`clientWidth`),i=rr(o.maxHeight,a,`clientHeight`)}}return{width:t,height:n,maxWidth:r||Xe,maxHeight:i||Xe}}var fr=e=>Math.round(e*10)/10;function pr(e,t,n,r){let i=ir(e),a=sr(i,`margin`),o=rr(i.maxWidth,e,`clientWidth`)||Xe,s=rr(i.maxHeight,e,`clientHeight`)||Xe,c=dr(e,t,n),{width:l,height:u}=c;if(i.boxSizing===`content-box`){let e=sr(i,`border`,`width`),t=sr(i,`padding`);l-=t.width+e.width,u-=t.height+e.height}return l=Math.max(0,l-a.width),u=Math.max(0,r?l/r:u-a.height),l=fr(Math.min(l,o,c.maxWidth)),u=fr(Math.min(u,s,c.maxHeight)),l&&!u&&(u=fr(l/2)),(t!==void 0||n!==void 0)&&r&&c.height&&u>c.height&&(u=c.height,l=fr(Math.floor(u*r))),{width:l,height:u}}function mr(e,t,n){let r=t||1,i=fr(e.height*r),a=fr(e.width*r);e.height=fr(e.height),e.width=fr(e.width);let o=e.canvas;return o.style&&(n||!o.style.height&&!o.style.width)&&(o.style.height=`${e.height}px`,o.style.width=`${e.width}px`),e.currentDevicePixelRatio!==r||o.height!==i||o.width!==a?(e.currentDevicePixelRatio=r,o.height=i,o.width=a,e.ctx.setTransform(r,0,0,r,0,0),!0):!1}var hr=function(){let e=!1;try{let t={get passive(){return e=!0,!1}};tr()&&(window.addEventListener(`test`,null,t),window.removeEventListener(`test`,null,t))}catch{}return e}();function gr(e,t){let n=ar(e,t),r=n&&n.match(/^(\d+)(\.\d+)?px$/);return r?+r[1]:void 0}function _r(e,t,n,r){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function vr(e,t,n,r){return{x:e.x+n*(t.x-e.x),y:r===`middle`?n<.5?e.y:t.y:r===`after`?n<1?e.y:t.y:n>0?t.y:e.y}}function yr(e,t,n,r){let i={x:e.cp2x,y:e.cp2y},a={x:t.cp1x,y:t.cp1y},o=_r(e,i,n),s=_r(i,a,n),c=_r(a,t,n);return _r(_r(o,s,n),_r(s,c,n),n)}var br=function(e,t){return{x(n){return e+e+t-n},setWidth(e){t=e},textAlign(e){return e===`center`?e:e===`right`?`left`:`right`},xPlus(e,t){return e-t},leftForLtr(e,t){return e-t}}},xr=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function Sr(e,t,n){return e?br(t,n):xr()}function Cr(e,t){let n,r;(t===`ltr`||t===`rtl`)&&(n=e.canvas.style,r=[n.getPropertyValue(`direction`),n.getPropertyPriority(`direction`)],n.setProperty(`direction`,t,`important`),e.prevTextDirection=r)}function wr(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty(`direction`,t[0],t[1]))}function Tr(e){return e===`angle`?{between:pt,compare:ft,normalize:H}:{between:W,compare:(e,t)=>e-t,normalize:e=>e}}function Er({start:e,end:t,count:n,loop:r,style:i}){return{start:e%n,end:t%n,loop:r&&(t-e+1)%n===0,style:i}}function Dr(e,t,n){let{property:r,start:i,end:a}=n,{between:o,normalize:s}=Tr(r),c=t.length,{start:l,end:u,loop:d}=e,f,p;if(d){for(l+=c,u+=c,f=0,p=c;fc(i,y,_)&&s(i,y)!==0,x=()=>s(a,_)===0||c(a,y,_),S=()=>h||b(),C=()=>!h||x();for(let e=u,n=u;e<=d;++e)v=t[e%o],!v.skip&&(_=l(v[r]),_!==y&&(h=c(_,i,a),g===null&&S()&&(g=s(_,i)===0?e:n),g!==null&&C()&&(m.push(Er({start:g,end:e,loop:f,count:o,style:p})),g=null),n=e,y=_));return g!==null&&m.push(Er({start:g,end:d,loop:f,count:o,style:p})),m}function kr(e,t){let n=[],r=e.segments;for(let i=0;ii&&e[a%t].skip;)a--;return a%=t,{start:i,end:a}}function jr(e,t,n,r){let i=e.length,a=[],o=t,s=e[t],c;for(c=t+1;c<=n;++c){let n=e[c%i];n.skip||n.stop?s.skip||(r=!1,a.push({start:t%i,end:(c-1)%i,loop:r}),t=o=n.stop?c:null):(o=c,s.skip&&(t=c)),s=n}return o!==null&&a.push({start:t%i,end:o%i,loop:r}),a}function Mr(e,t){let n=e.points,r=e.options.spanGaps,i=n.length;if(!i)return[];let a=!!e._loop,{start:o,end:s}=Ar(n,i,a,r);return r===!0?Nr(e,[{start:o,end:s,loop:a}],n,t):Nr(e,jr(n,o,sr({chart:e,initial:t.initial,numSteps:a,currentStep:Math.min(n-t.start,a)}))}_refresh(){this._request||=(this._running=!0,Ct.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let t=0;this._charts.forEach((n,r)=>{if(!n.running||!n.items.length)return;let i=n.items,a=i.length-1,o=!1,s;for(;a>=0;--a)s=i[a],s._active?(s._total>n.duration&&(n.duration=s._total),s.tick(e),o=!0):(i[a]=i[i.length-1],i.pop());o&&(r.draw(),this._notify(r,n,e,`progress`)),i.length||(n.running=!1,this._notify(r,n,e,`complete`),n.initial=!1),t+=i.length}),this._lastDate=e,t===0&&(this._running=!1)}_getAnims(e){let t=this._charts,n=t.get(e);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,n)),n}listen(e,t,n){this._getAnims(e).listeners[t].push(n)}add(e,t){!t||!t.length||this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){let t=this._charts.get(e);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((e,t)=>Math.max(e,t._duration),0),this._refresh())}running(e){if(!this._running)return!1;let t=this._charts.get(e);return!(!t||!t.running||!t.items.length)}stop(e){let t=this._charts.get(e);if(!t||!t.items.length)return;let n=t.items,r=n.length-1;for(;r>=0;--r)n[r].cancel();t.items=[],this._notify(e,t,Date.now(),`complete`)}remove(e){return this._charts.delete(e)}},Vr=`transparent`,Hr={boolean(e,t,n){return n>.5?t:e},color(e,t,n){let r=Ft(e||Vr),i=r.valid&&Ft(t||Vr);return i&&i.valid?i.mix(r,n).hexString():t},number(e,t,n){return e+(t-e)*n}},Ur=class{constructor(e,t,n,r){let i=t[n];r=Cn([e.to,r,i,e.from]);let a=Cn([e.from,i,r]);this._active=!0,this._fn=e.fn||Hr[e.type||typeof a],this._easing=Nt[e.easing]||Nt.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=n,this._from=a,this._to=r,this._promises=void 0}active(){return this._active}update(e,t,n){if(this._active){this._notify(!1);let r=this._target[this._prop],i=n-this._start,a=this._duration-i;this._start=n,this._duration=Math.floor(Math.max(a,e.duration)),this._total+=i,this._loop=!!e.loop,this._to=Cn([e.to,t,r,e.from]),this._from=Cn([e.from,r,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){let t=e-this._start,n=this._duration,r=this._prop,i=this._from,a=this._loop,o=this._to,s;if(this._active=i!==o&&(a||t1?2-s:s,s=this._easing(Math.min(1,Math.max(0,s))),this._target[r]=this._fn(i,o,s)}wait(){let e=this._promises||=[];return new Promise((t,n)=>{e.push({res:t,rej:n})})}_notify(e){let t=e?`res`:`rej`,n=this._promises||[];for(let e=0;e{let i=e[r];if(!j(i))return;let a={};for(let e of t)a[e]=i[e];(A(i.properties)&&i.properties||[r]).forEach(e=>{(e===r||!n.has(e))&&n.set(e,a)})})}_animateOptions(e,t){let n=t.options,r=Kr(e,n);if(!r)return[];let i=this._createAnimations(r,n);return n.$shared&&Gr(e.options.$animations,n).then(()=>{e.options=n},()=>{}),i}_createAnimations(e,t){let n=this._properties,r=[],i=e.$animations||={},a=Object.keys(t),o=Date.now(),s;for(s=a.length-1;s>=0;--s){let c=a[s];if(c.charAt(0)===`$`)continue;if(c===`options`){r.push(...this._animateOptions(e,t));continue}let l=t[c],u=i[c],d=n.get(c);if(u)if(d&&u.active()){u.update(d,l,o);continue}else u.cancel();if(!d||!d.duration){e[c]=l;continue}i[c]=u=new Ur(d,e,c,l),r.push(u)}return r}update(e,t){if(this._properties.size===0){Object.assign(e,t);return}let n=this._createAnimations(e,t);if(n.length)return Br.add(this._chart,n),!0}};function Gr(e,t){let n=[],r=Object.keys(t);for(let t=0;t0||!n&&t<0)return i.index}return null}function ii(e,t){let{chart:n,_cachedMeta:r}=e,i=n._stacks||={},{iScale:a,vScale:o,index:s}=r,c=a.axis,l=o.axis,u=ei(a,o,r),d=t.length,f;for(let e=0;en[e].axis===t).shift()}function oi(e,t){return Tn(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:`default`,type:`dataset`})}function si(e,t,n){return Tn(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:`default`,type:`data`})}function ci(e,t){let n=e.controller.index,r=e.vScale&&e.vScale.axis;if(r){t||=e._parsed;for(let e of t){let t=e._stacks;if(!t||t[r]===void 0||t[r][n]===void 0)return;delete t[r][n],t[r]._visualValues!==void 0&&t[r]._visualValues[n]!==void 0&&delete t[r]._visualValues[n]}}}var li=e=>e===`reset`||e===`none`,ui=(e,t)=>t?e:Object.assign({},e),di=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:Xr(n,!0),values:null},fi=class{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(e,t){this.chart=e,this._ctx=e.ctx,this.index=t,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){let e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=$r(e.vScale,e),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled(`filler`)&&console.warn(`Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options`)}updateIndex(e){this.index!==e&&ci(this._cachedMeta),this.index=e}linkScales(){let e=this.chart,t=this._cachedMeta,n=this.getDataset(),r=(e,t,n,r)=>e===`x`?t:e===`r`?r:n,i=t.xAxisID=P(n.xAxisID,ai(e,`x`)),a=t.yAxisID=P(n.yAxisID,ai(e,`y`)),o=t.rAxisID=P(n.rAxisID,ai(e,`r`)),s=t.indexAxis,c=t.iAxisID=r(s,i,a,o),l=t.vAxisID=r(s,a,i,o);t.xScale=this.getScaleForId(i),t.yScale=this.getScaleForId(a),t.rScale=this.getScaleForId(o),t.iScale=this.getScaleForId(c),t.vScale=this.getScaleForId(l)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){let t=this._cachedMeta;return e===t.iScale?t.vScale:t.iScale}reset(){this._update(`reset`)}_destroy(){let e=this._cachedMeta;this._data&&xt(this._data,this),e._stacked&&ci(e)}_dataCheck(){let e=this.getDataset(),t=e.data||=[],n=this._data;if(j(t)){let e=this._cachedMeta;this._data=Qr(t,e)}else if(n!==t){if(n){xt(n,this);let e=this._cachedMeta;ci(e),e._parsed=[]}t&&Object.isExtensible(t)&&bt(t,this),this._syncList=[],this._data=t}}addElements(){let e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){let t=this._cachedMeta,n=this.getDataset(),r=!1;this._dataCheck();let i=t._stacked;t._stacked=$r(t.vScale,t),t.stack!==n.stack&&(r=!0,ci(t),t.stack=n.stack),this._resyncElements(e),(r||i!==t._stacked)&&(ii(this,t._parsed),t._stacked=$r(t.vScale,t))}configure(){let e=this.chart.config,t=e.datasetScopeKeys(this._type),n=e.getOptionScopes(this.getDataset(),t,!0);this.options=e.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,t){let{_cachedMeta:n,_data:r}=this,{iScale:i,_stacked:a}=n,o=i.axis,s=e===0&&t===r.length?!0:n._sorted,c=e>0&&n._parsed[e-1],l,u,d;if(this._parsing===!1)n._parsed=r,n._sorted=!0,d=r;else{d=A(r[e])?this.parseArrayData(n,r,e,t):j(r[e])?this.parseObjectData(n,r,e,t):this.parsePrimitiveData(n,r,e,t);let i=()=>u[o]===null||c&&u[o]t||u=0;--d)if(!p()){this.updateRangeFromParsed(c,e,f,s);break}}return c}getAllParsedValues(e){let t=this._cachedMeta._parsed,n=[],r,i,a;for(r=0,i=t.length;r=0&&ethis.getContext(n,r,t),u);return p.$shared&&(p.$shared=s,i[a]=Object.freeze(ui(p,s))),p}_resolveAnimations(e,t,n){let r=this.chart,i=this._cachedDataOpts,a=`animation-${t}`,o=i[a];if(o)return o;let s;if(r.options.animation!==!1){let r=this.chart.config,i=r.datasetAnimationScopeKeys(this._type,t),a=r.getOptionScopes(this.getDataset(),i);s=r.createResolver(a,this.getContext(e,n,t))}let c=new Wr(r,s&&s.animations);return s&&s._cacheable&&(i[a]=Object.freeze(c)),c}getSharedOptions(e){if(e.$shared)return this._sharedOptions||=Object.assign({},e)}includeOptions(e,t){return!t||li(e)||this.chart._animationsDisabled}_getSharedOptions(e,t){let n=this.resolveDataElementOptions(e,t),r=this._sharedOptions,i=this.getSharedOptions(n),a=this.includeOptions(t,i)||i!==r;return this.updateSharedOptions(i,t,n),{sharedOptions:i,includeOptions:a}}updateElement(e,t,n,r){li(r)?Object.assign(e,n):this._resolveAnimations(t,r).update(e,n)}updateSharedOptions(e,t,n){e&&!li(t)&&this._resolveAnimations(void 0,t).update(e,n)}_setStyle(e,t,n,r){e.active=r;let i=this.getStyle(t,r);this._resolveAnimations(t,n,r).update(e,{options:!r&&this.getSharedOptions(i)||i})}removeHoverStyle(e,t,n){this._setStyle(e,n,`active`,!1)}setHoverStyle(e,t,n){this._setStyle(e,n,`active`,!0)}_removeDatasetHoverStyle(){let e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,`active`,!1)}_setDatasetHoverStyle(){let e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,`active`,!0)}_resyncElements(e){let t=this._data,n=this._cachedMeta.data;for(let[e,t,n]of this._syncList)this[e](t,n);this._syncList=[];let r=n.length,i=t.length,a=Math.min(i,r);a&&this.parse(0,a),i>r?this._insertElements(r,i-r,e):i{for(e.length+=t,o=e.length-1;o>=a;o--)e[o]=e[o-t]};for(s(i),o=e;oe-t))}return e._cache.$bar}function mi(e){let t=e.iScale,n=pi(t,e.type),r=t._length,i,a,o,s,c=()=>{o===32767||o===-32768||(Ge(s)&&(r=Math.min(r,Math.abs(o-s)||r)),s=o)};for(i=0,a=n.length;i0?i[e-1]:null,s=eMath.abs(s)&&(c=s,l=o),t[n.axis]=l,t._custom={barStart:c,barEnd:l,start:i,end:a,min:o,max:s}}function vi(e,t,n,r){return A(e)?_i(e,t,n,r):t[n.axis]=n.parse(e,r),t}function yi(e,t,n,r){let i=e.iScale,a=e.vScale,o=i.getLabels(),s=i===a,c=[],l,u,d,f;for(l=n,u=n+r;l=n?1:-1):B(e)}function Si(e){let t,n,r,i,a;return e.horizontal?(t=e.base>e.x,n=`left`,r=`right`):(t=e.basee.controller.options.grouped),i=n.options.stacked,a=[],o=this._cachedMeta.controller.getParsed(t),s=o&&o[n.axis],c=e=>{let t=e._parsed.find(e=>e[n.axis]===s),r=t&&t[e.vScale.axis];if(k(r)||isNaN(r))return!0};for(let n of r)if(!(t!==void 0&&c(n))&&((i===!1||a.indexOf(n.stack)===-1||i===void 0&&n.stack===void 0)&&a.push(n.stack),n.index===e))break;return a.length||a.push(void 0),a}_getStackCount(e){return this._getStacks(void 0,e).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let e=this.chart.scales,t=this.chart.options.indexAxis;return Object.keys(e).filter(n=>e[n].axis===t).shift()}_getAxis(){let e={},t=this.getFirstScaleIdForIndexAxis();for(let n of this.chart.data.datasets)e[P(this.chart.options.indexAxis===`x`?n.xAxisID:n.yAxisID,t)]=!0;return Object.keys(e)}_getStackIndex(e,t,n){let r=this._getStacks(e,n),i=t===void 0?-1:r.indexOf(t);return i===-1?r.length-1:i}_getRuler(){let e=this.options,t=this._cachedMeta,n=t.iScale,r=[],i,a;for(i=0,a=t.data.length;ipt(e,s,c,!0)?1:Math.max(t,t*n,r,r*n),m=(e,t,r)=>pt(e,s,c,!0)?-1:Math.min(t,t*n,r,r*n),h=p(0,l,d),g=p(z,u,f),_=m(L,l,d),v=m(L+z,u,f);r=(h-_)/2,i=(g-v)/2,a=-(h+_)/2,o=-(g+v)/2}return{ratioX:r,ratioY:i,offsetX:a,offsetY:o}}var Ai=class extends fi{static id=`doughnut`;static defaults={datasetElementType:!1,dataElementType:`arc`,animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:`number`,properties:[`circumference`,`endAngle`,`innerRadius`,`outerRadius`,`startAngle`,`x`,`y`,`offset`,`borderWidth`,`spacing`]}},cutout:`50%`,rotation:0,circumference:360,radius:`100%`,spacing:0,indexAxis:`r`};static descriptors={_scriptable:e=>e!==`spacing`,_indexable:e=>e!==`spacing`&&!e.startsWith(`borderDash`)&&!e.startsWith(`hoverBorderDash`)};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){let t=e.data,{labels:{pointStyle:n,textAlign:r,color:i,useBorderRadius:a,borderRadius:o}}=e.legend.options;return t.labels.length&&t.datasets.length?t.labels.map((t,s)=>{let c=e.getDatasetMeta(0).controller.getStyle(s);return{text:t,fillStyle:c.backgroundColor,fontColor:i,hidden:!e.getDataVisibility(s),lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:c.borderWidth,strokeStyle:c.borderColor,textAlign:r,pointStyle:n,borderRadius:a&&(o||c.borderRadius),index:s}}):[]}},onClick(e,t,n){n.chart.toggleDataVisibility(t.index),n.chart.update()}}}};constructor(e,t){super(e,t),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,t){let n=this.getDataset().data,r=this._cachedMeta;if(this._parsing===!1)r._parsed=n;else{let i=e=>+n[e];if(j(n[e])){let{key:e=`value`}=this._parsing;i=t=>+Ue(n[t],e)}let a,o;for(a=e,o=e+t;a0&&!isNaN(e)?Math.abs(e)/t*R:0}getLabelAndValue(e){let t=this._cachedMeta,n=this.chart,r=n.data.labels||[],i=Ut(t._parsed[e],n.options.locale);return{label:r[e]||``,value:i}}getMaxBorderWidth(e){let t=0,n=this.chart,r,i,a,o,s;if(!e){for(r=0,i=n.data.datasets.length;r0&&this.getParsed(t-1);for(let n=0;n=_){v.skip=!0;continue}let b=this.getParsed(n),x=k(b[f]),S=v[d]=a.getPixelForValue(b[d],n),C=v[f]=i||x?o.getBasePixel():o.getPixelForValue(s?this.applyStack(o,b,s):b[f],n);v.skip=isNaN(S)||isNaN(C)||x,v.stop=n>0&&Math.abs(b[d]-y[d])>h,m&&(v.parsed=b,v.raw=c.data[n]),u&&(v.options=l||this.resolveDataElementOptions(n,p.active?`active`:r)),g||this.updateElement(p,n,v,r),y=b}}getMaxOverflow(){let e=this._cachedMeta,t=e.dataset,n=t.options&&t.options.borderWidth||0,r=e.data||[];if(!r.length)return n;let i=r[0].size(this.resolveDataElementOptions(0)),a=r[r.length-1].size(this.resolveDataElementOptions(r.length-1));return Math.max(n,i,a)/2}draw(){let e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}},Mi=class extends fi{static id=`scatter`;static defaults={datasetElementType:!1,dataElementType:`point`,showLine:!1,fill:!1};static overrides={interaction:{mode:`point`},scales:{x:{type:`linear`},y:{type:`linear`}}};getLabelAndValue(e){let t=this._cachedMeta,n=this.chart.data.labels||[],{xScale:r,yScale:i}=t,a=this.getParsed(e),o=r.getLabelForValue(a.x),s=i.getLabelForValue(a.y);return{label:n[e]||``,value:`(`+o+`, `+s+`)`}}update(e){let t=this._cachedMeta,{data:n=[]}=t,r=this.chart._animationsDisabled,{start:i,count:a}=Ot(t,n,r);if(this._drawStart=i,this._drawCount=a,kt(t)&&(i=0,a=n.length),this.options.showLine){this.datasetElementType||this.addElements();let{dataset:i,_dataset:a}=t;i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!a._decimated,i.points=n;let o=this.resolveDatasetElementOptions(e);o.segment=this.options.segment,this.updateElement(i,void 0,{animated:!r,options:o},e)}else this.datasetElementType&&=(delete t.dataset,!1);this.updateElements(n,i,a,e)}addElements(){let{showLine:e}=this.options;!this.datasetElementType&&e&&(this.datasetElementType=this.chart.registry.getElement(`line`)),super.addElements()}updateElements(e,t,n,r){let i=r===`reset`,{iScale:a,vScale:o,_stacked:s,_dataset:c}=this._cachedMeta,l=this.resolveDataElementOptions(t,r),u=this.getSharedOptions(l),d=this.includeOptions(r,u),f=a.axis,p=o.axis,{spanGaps:m,segment:h}=this.options,g=at(m)?m:1/0,_=this.chart._animationsDisabled||i||r===`none`,v=t>0&&this.getParsed(t-1);for(let l=t;l0&&Math.abs(n[f]-v[f])>g,h&&(m.parsed=n,m.raw=c.data[l]),d&&(m.options=u||this.resolveDataElementOptions(l,t.active?`active`:r)),_||this.updateElement(t,l,m,r),v=n}this.updateSharedOptions(u,r,l)}getMaxOverflow(){let e=this._cachedMeta,t=e.data||[];if(!this.options.showLine){let e=0;for(let n=t.length-1;n>=0;--n)e=Math.max(e,t[n].size(this.resolveDataElementOptions(n))/2);return e>0&&e}let n=e.dataset,r=n.options&&n.options.borderWidth||0;if(!t.length)return r;let i=t[0].size(this.resolveDataElementOptions(0)),a=t[t.length-1].size(this.resolveDataElementOptions(t.length-1));return Math.max(r,i,a)/2}};function Ni(){throw Error(`This method is not implemented: Check that a complete date adapter is provided.`)}var Pi={_date:class e{static override(t){Object.assign(e.prototype,t)}options;constructor(e){this.options=e||{}}init(){}formats(){return Ni()}parse(){return Ni()}format(){return Ni()}add(){return Ni()}diff(){return Ni()}startOf(){return Ni()}endOf(){return Ni()}}};function Fi(e,t,n,r){let{controller:i,data:a,_sorted:o}=e,s=i._cachedMeta.iScale,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(s&&t===s.axis&&t!==`r`&&o&&a.length){let o=s._reversePixels?_t:gt;if(!r){let r=o(a,t,n);if(c){let{vScale:t}=i._cachedMeta,{_parsed:n}=e,a=n.slice(0,r.lo+1).reverse().findIndex(e=>!k(e[t.axis]));r.lo-=Math.max(0,a);let o=n.slice(r.hi).findIndex(e=>!k(e[t.axis]));r.hi+=Math.max(0,o)}return r}else if(i._sharedOptions){let e=a[0],r=typeof e.getRange==`function`&&e.getRange(t);if(r){let e=o(a,t,n-r),i=o(a,t,n+r);return{lo:e.lo,hi:i.hi}}}}return{lo:0,hi:a.length-1}}function Ii(e,t,n,r,i){let a=e.getSortedVisibleDatasetMetas(),o=n[t];for(let e=0,n=a.length;e{e[o]&&e[o](t[n],i)&&(a.push({element:e,datasetIndex:r,index:c}),s||=e.inRange(t.x,t.y,i))}),r&&!s?[]:a}var Ui={evaluateInteractionItems:Ii,modes:{index(e,t,n,r){let i=ur(t,e),a=n.axis||`x`,o=n.includeInvisible||!1,s=n.intersect?Ri(e,i,a,r,o):Vi(e,i,a,!1,r,o),c=[];return s.length?(e.getSortedVisibleDatasetMetas().forEach(e=>{let t=s[0].index,n=e.data[t];n&&!n.skip&&c.push({element:n,datasetIndex:e.index,index:t})}),c):[]},dataset(e,t,n,r){let i=ur(t,e),a=n.axis||`xy`,o=n.includeInvisible||!1,s=n.intersect?Ri(e,i,a,r,o):Vi(e,i,a,!1,r,o);if(s.length>0){let t=s[0].datasetIndex,n=e.getDatasetMeta(t).data;s=[];for(let e=0;ee.pos===t)}function Ki(e,t){return e.filter(e=>Wi.indexOf(e.pos)===-1&&e.box.axis===t)}function qi(e,t){return e.sort((e,n)=>{let r=t?n:e,i=t?e:n;return r.weight===i.weight?r.index-i.index:r.weight-i.weight})}function Ji(e){let t=[],n,r,i,a,o,s;for(n=0,r=(e||[]).length;ne.box.fullSize),!0),r=qi(Gi(t,`left`),!0),i=qi(Gi(t,`right`)),a=qi(Gi(t,`top`),!0),o=qi(Gi(t,`bottom`)),s=Ki(t,`x`),c=Ki(t,`y`);return{fullSize:n,leftAndTop:r.concat(a),rightAndBottom:i.concat(c).concat(o).concat(s),chartArea:Gi(t,`chartArea`),vertical:r.concat(i).concat(c),horizontal:a.concat(o).concat(s)}}function Qi(e,t,n,r){return Math.max(e[n],t[n])+Math.max(e[r],t[r])}function $i(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function ea(e,t,n,r){let{pos:i,box:a}=n,o=e.maxPadding;if(!j(i)){n.size&&(e[i]-=n.size);let t=r[n.stack]||{size:0,count:1};t.size=Math.max(t.size,n.horizontal?a.height:a.width),n.size=t.size/t.count,e[i]+=n.size}a.getPadding&&$i(o,a.getPadding());let s=Math.max(0,t.outerWidth-Qi(o,e,`left`,`right`)),c=Math.max(0,t.outerHeight-Qi(o,e,`top`,`bottom`)),l=s!==e.w,u=c!==e.h;return e.w=s,e.h=c,n.horizontal?{same:l,other:u}:{same:u,other:l}}function ta(e){let t=e.maxPadding;function n(n){let r=Math.max(t[n]-e[n],0);return e[n]+=r,r}e.y+=n(`top`),e.x+=n(`left`),n(`right`),n(`bottom`)}function na(e,t){let n=t.maxPadding;function r(e){let r={left:0,top:0,right:0,bottom:0};return e.forEach(e=>{r[e]=Math.max(t[e],n[e])}),r}return r(e?[`left`,`right`]:[`top`,`bottom`])}function ra(e,t,n,r){let i=[],a,o,s,c,l,u;for(a=0,o=e.length,l=0;a{typeof e.beforeLayout==`function`&&e.beforeLayout()});let u=c.reduce((e,t)=>t.box.options&&t.box.options.display===!1?e:e+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:n,padding:i,availableWidth:a,availableHeight:o,vBoxMaxWidth:a/2/u,hBoxMaxHeight:o/2}),f=Object.assign({},i);$i(f,q(r));let p=Object.assign({maxPadding:f,w:a,h:o,x:i.left,y:i.top},i),m=Xi(c.concat(l),d);ra(s.fullSize,p,d,m),ra(c,p,d,m),ra(l,p,d,m)&&ra(c,p,d,m),ta(p),aa(s.leftAndTop,p,d,m),p.x+=p.w,p.y+=p.h,aa(s.rightAndBottom,p,d,m),e.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},I(s.chartArea,t=>{let n=t.box;Object.assign(n,e.chartArea),n.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}},oa=class{acquireContext(e,t){}releaseContext(e){return!1}addEventListener(e,t,n){}removeEventListener(e,t,n){}getDevicePixelRatio(){return 1}getMaximumSize(e,t,n,r){return t=Math.max(0,t||e.width),n||=e.height,{width:t,height:Math.max(0,r?Math.floor(t/r):n)}}isAttached(e){return!0}updateConfig(e){}},sa=class extends oa{acquireContext(e){return e&&e.getContext&&e.getContext(`2d`)||null}updateConfig(e){e.options.animation=!1}},ca=`$chartjs`,la={touchstart:`mousedown`,touchmove:`mousemove`,touchend:`mouseup`,pointerenter:`mouseenter`,pointerdown:`mousedown`,pointermove:`mousemove`,pointerup:`mouseup`,pointerleave:`mouseout`,pointerout:`mouseout`},ua=e=>e===null||e===``;function da(e,t){let n=e.style,r=e.getAttribute(`height`),i=e.getAttribute(`width`);if(e[ca]={initial:{height:r,width:i,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||`block`,n.boxSizing=n.boxSizing||`border-box`,ua(i)){let t=gr(e,`width`);t!==void 0&&(e.width=t)}if(ua(r))if(e.style.height===``)e.height=e.width/(t||2);else{let t=gr(e,`height`);t!==void 0&&(e.height=t)}return e}var fa=hr?{passive:!0}:!1;function pa(e,t,n){e&&e.addEventListener(t,n,fa)}function ma(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,fa)}function ha(e,t){let n=la[e.type]||e.type,{x:r,y:i}=ur(e,t);return{type:n,chart:t,native:e,x:r===void 0?null:r,y:i===void 0?null:i}}function ga(e,t){for(let n of e)if(n===t||n.contains(t))return!0}function _a(e,t,n){let r=e.canvas,i=new MutationObserver(e=>{let t=!1;for(let n of e)t||=ga(n.addedNodes,r),t&&=!ga(n.removedNodes,r);t&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}function va(e,t,n){let r=e.canvas,i=new MutationObserver(e=>{let t=!1;for(let n of e)t||=ga(n.removedNodes,r),t&&=!ga(n.addedNodes,r);t&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}var ya=new Map,ba=0;function xa(){let e=window.devicePixelRatio;e!==ba&&(ba=e,ya.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function Sa(e,t){ya.size||window.addEventListener(`resize`,xa),ya.set(e,t)}function Ca(e){ya.delete(e),ya.size||window.removeEventListener(`resize`,xa)}function wa(e,t,n){let r=e.canvas,i=r&&nr(r);if(!i)return;let a=wt((e,t)=>{let r=i.clientWidth;n(e,t),r{let t=e[0],n=t.contentRect.width,r=t.contentRect.height;n===0&&r===0||a(n,r)});return o.observe(i),Sa(e,a),o}function Ta(e,t,n){n&&n.disconnect(),t===`resize`&&Ca(e)}function Ea(e,t,n){let r=e.canvas,i=wt(t=>{e.ctx!==null&&n(ha(t,e))},e);return pa(r,t,i),i}var Da=class extends oa{acquireContext(e,t){let n=e&&e.getContext&&e.getContext(`2d`);return n&&n.canvas===e?(da(e,t),n):null}releaseContext(e){let t=e.canvas;if(!t[ca])return!1;let n=t[ca].initial;[`height`,`width`].forEach(e=>{let r=n[e];k(r)?t.removeAttribute(e):t.setAttribute(e,r)});let r=n.style||{};return Object.keys(r).forEach(e=>{t.style[e]=r[e]}),t.width=t.width,delete t[ca],!0}addEventListener(e,t,n){this.removeEventListener(e,t);let r=e.$proxies||={};r[t]=({attach:_a,detach:va,resize:wa}[t]||Ea)(e,t,n)}removeEventListener(e,t){let n=e.$proxies||={},r=n[t];r&&(({attach:Ta,detach:Ta,resize:Ta}[t]||ma)(e,t,r),n[t]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,n,r){return pr(e,t,n,r)}isAttached(e){let t=e&&nr(e);return!!(t&&t.isConnected)}};function Oa(e){return!tr()||typeof OffscreenCanvas<`u`&&e instanceof OffscreenCanvas?sa:Da}var ka=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(e){let{x:t,y:n}=this.getProps([`x`,`y`],e);return{x:t,y:n}}hasValue(){return at(this.x)&&at(this.y)}getProps(e,t){let n=this.$animations;if(!t||!n)return this;let r={};return e.forEach(e=>{r[e]=n[e]&&n[e].active()?n[e]._to:this[e]}),r}};function Aa(e,t){let n=e.options.ticks,r=ja(e),i=Math.min(n.maxTicksLimit||r,r),a=n.major.enabled?Na(t):[],o=a.length,s=a[0],c=a[o-1],l=[];if(o>i)return Pa(t,l,a,o/i),l;let u=Ma(a,t,i);if(o>0){let e,n,r=o>1?Math.round((c-s)/(o-1)):null;for(Fa(t,l,u,k(r)?0:s-r,s),e=0,n=o-1;ei)return t}return Math.max(i,1)}function Na(e){let t=[],n,r;for(n=0,r=e.length;ne===`left`?`right`:e===`right`?`left`:e,Ra=(e,t,n)=>t===`top`||t===`left`?e[t]+n:e[t]-n,za=(e,t)=>Math.min(t||e,e);function Ba(e,t){let n=[],r=e.length/t,i=e.length,a=0;for(;ao+s)))return c}function Ha(e,t){I(e,e=>{let n=e.gc,r=n.length/2,i;if(r>t){for(i=0;in?n:t,n=r&&t>n?t:n,{min:N(t,N(n,t)),max:N(n,N(t,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||=this._computeLabelItems(e)}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){F(this.options.beforeUpdate,[this])}update(e,t,n){let{beginAtZero:r,grace:i,ticks:a}=this.options,o=a.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=t,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||=(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=wn(this,i,r),!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let s=o=i||n<=1||!this.isHorizontal()){this.labelRotation=r;return}let l=this._getLabelSizes(),u=l.widest.width,d=l.highest.height,f=U(this.chart.width-u,0,this.maxWidth);o=e.offset?this.maxWidth/n:f/(n-1),u+6>o&&(o=f/(n-(e.offset?.5:1)),s=this.maxHeight-Ua(e.grid)-t.padding-Wa(e.title,this.chart.options.font),c=Math.sqrt(u*u+d*d),a=ct(Math.min(Math.asin(U((l.highest.height+6)/o,-1,1)),Math.asin(U(s/c,-1,1))-Math.asin(U(d/c,-1,1)))),a=Math.max(r,Math.min(i,a))),this.labelRotation=a}afterCalculateLabelRotation(){F(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){F(this.options.beforeFit,[this])}fit(){let e={width:0,height:0},{chart:t,options:{ticks:n,title:r,grid:i}}=this,a=this._isVisible(),o=this.isHorizontal();if(a){let a=Wa(r,t.options.font);if(o?(e.width=this.maxWidth,e.height=Ua(i)+a):(e.height=this.maxHeight,e.width=Ua(i)+a),n.display&&this.ticks.length){let{first:t,last:r,widest:i,highest:a}=this._getLabelSizes(),s=n.padding*2,c=V(this.labelRotation),l=Math.cos(c),u=Math.sin(c);if(o){let t=n.mirror?0:u*i.width+l*a.height;e.height=Math.min(this.maxHeight,e.height+t+s)}else{let t=n.mirror?0:l*i.width+u*a.height;e.width=Math.min(this.maxWidth,e.width+t+s)}this._calculatePadding(t,r,u,l)}}this._handleMargins(),o?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,t,n,r){let{ticks:{align:i,padding:a},position:o}=this.options,s=this.labelRotation!==0,c=o!==`top`&&this.axis===`x`;if(this.isHorizontal()){let o=this.getPixelForTick(0)-this.left,l=this.right-this.getPixelForTick(this.ticks.length-1),u=0,d=0;s?c?(u=r*e.width,d=n*t.height):(u=n*e.height,d=r*t.width):i===`start`?d=t.width:i===`end`?u=e.width:i!==`inner`&&(u=e.width/2,d=t.width/2),this.paddingLeft=Math.max((u-o+a)*this.width/(this.width-o),0),this.paddingRight=Math.max((d-l+a)*this.width/(this.width-l),0)}else{let n=t.height/2,r=e.height/2;i===`start`?(n=0,r=e.height):i===`end`&&(n=t.height,r=0),this.paddingTop=n+a,this.paddingBottom=r+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){F(this.options.afterFit,[this])}isHorizontal(){let{axis:e,position:t}=this.options;return t===`top`||t===`bottom`||e===`x`}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let t,n;for(t=0,n=e.length;t({width:a[e]||0,height:o[e]||0});return{first:C(0),last:C(t-1),widest:C(x),highest:C(S),widths:a,heights:o}}getLabelForValue(e){return e}getPixelForValue(e,t){return NaN}getValueForPixel(e){}getPixelForTick(e){let t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);let t=this._startPixel+e*this._length;return mt(this._alignToPixels?tn(this.chart,t,0):t)}getDecimalForPixel(e){let t=(e-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:e,max:t}=this;return e<0&&t<0?t:e>0&&t>0?e:0}getContext(e){let t=this.ticks||[];if(e>=0&&eo*r?o/n:s/r:s*r0:!!e}_computeGridLineItems(e){let t=this.axis,n=this.chart,r=this.options,{grid:i,position:a,border:o}=r,s=i.offset,c=this.isHorizontal(),l=this.ticks.length+(s?1:0),u=Ua(i),d=[],f=o.setContext(this.getContext()),p=f.display?f.width:0,m=p/2,h=function(e){return tn(n,e,p)},g,_,v,y,b,x,S,C,w,T,E,D;if(a===`top`)g=h(this.bottom),x=this.bottom-u,C=g-m,T=h(e.top)+m,D=e.bottom;else if(a===`bottom`)g=h(this.top),T=e.top,D=h(e.bottom)-m,x=g+m,C=this.top+u;else if(a===`left`)g=h(this.right),b=this.right-u,S=g-m,w=h(e.left)+m,E=e.right;else if(a===`right`)g=h(this.left),w=e.left,E=h(e.right)-m,b=g+m,S=this.left+u;else if(t===`x`){if(a===`center`)g=h((e.top+e.bottom)/2+.5);else if(j(a)){let e=Object.keys(a)[0],t=a[e];g=h(this.chart.scales[e].getPixelForValue(t))}T=e.top,D=e.bottom,x=g+m,C=x+u}else if(t===`y`){if(a===`center`)g=h((e.left+e.right)/2);else if(j(a)){let e=Object.keys(a)[0],t=a[e];g=h(this.chart.scales[e].getPixelForValue(t))}b=g-m,S=b-u,w=e.left,E=e.right}let ee=P(r.ticks.maxTicksLimit,l),O=Math.max(1,Math.ceil(l/ee));for(_=0;_0&&(a-=r/2);break}f={left:a,top:i,width:r+t.width,height:n+t.height,color:e.backdropColor}}h.push({label:y,font:w,textOffset:D,options:{rotation:m,color:n,strokeColor:s,strokeWidth:l,textAlign:d,textBaseline:ee,translation:[b,x],backdrop:f}})}return h}_getXAxisLabelAlignment(){let{position:e,ticks:t}=this.options;if(-V(this.labelRotation))return e===`top`?`left`:`right`;let n=`center`;return t.align===`start`?n=`left`:t.align===`end`?n=`right`:t.align===`inner`&&(n=`inner`),n}_getYAxisLabelAlignment(e){let{position:t,ticks:{crossAlign:n,mirror:r,padding:i}}=this.options,a=this._getLabelSizes(),o=e+i,s=a.widest.width,c,l;return t===`left`?r?(l=this.right+i,n===`near`?c=`left`:n===`center`?(c=`center`,l+=s/2):(c=`right`,l+=s)):(l=this.right-o,n===`near`?c=`right`:n===`center`?(c=`center`,l-=s/2):(c=`left`,l=this.left)):t===`right`?r?(l=this.left+i,n===`near`?c=`right`:n===`center`?(c=`center`,l-=s/2):(c=`left`,l-=s)):(l=this.left+o,n===`near`?c=`left`:n===`center`?(c=`center`,l+=s/2):(c=`right`,l=this.right)):c=`right`,{textAlign:c,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;let e=this.chart,t=this.options.position;if(t===`left`||t===`right`)return{top:0,left:this.left,bottom:e.height,right:this.right};if(t===`top`||t===`bottom`)return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){let{ctx:e,options:{backgroundColor:t},left:n,top:r,width:i,height:a}=this;t&&(e.save(),e.fillStyle=t,e.fillRect(n,r,i,a),e.restore())}getLineWidthForValue(e){let t=this.options.grid;if(!this._isVisible()||!t.display)return 0;let n=this.ticks.findIndex(t=>t.value===e);return n>=0?t.setContext(this.getContext(n)).lineWidth:0}drawGrid(e){let t=this.options.grid,n=this.ctx,r=this._gridLineItems||=this._computeGridLineItems(e),i,a,o=(e,t,r)=>{!r.width||!r.color||(n.save(),n.lineWidth=r.width,n.strokeStyle=r.color,n.setLineDash(r.borderDash||[]),n.lineDashOffset=r.borderDashOffset,n.beginPath(),n.moveTo(e.x,e.y),n.lineTo(t.x,t.y),n.stroke(),n.restore())};if(t.display)for(i=0,a=r.length;i{this.draw(e)}}]:[{z:r,draw:e=>{this.drawBackground(),this.drawGrid(e),this.drawTitle()}},{z:i,draw:()=>{this.drawBorder()}},{z:n,draw:e=>{this.drawLabels(e)}}]}getMatchingVisibleMetas(e){let t=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+`AxisID`,r=[],i,a;for(i=0,a=t.length;i{let r=n.split(`.`),i=r.pop(),a=[e].concat(r).join(`.`),o=t[n].split(`.`),s=o.pop(),c=o.join(`.`);K.route(a,i,c,s)})}function $a(e){return`id`in e&&`defaults`in e}var X=new class{constructor(){this.controllers=new Xa(fi,`datasets`,!0),this.elements=new Xa(ka,`elements`),this.plugins=new Xa(Object,`plugins`),this.scales=new Xa(Ya,`scales`),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each(`register`,e)}remove(...e){this._each(`unregister`,e)}addControllers(...e){this._each(`register`,e,this.controllers)}addElements(...e){this._each(`register`,e,this.elements)}addPlugins(...e){this._each(`register`,e,this.plugins)}addScales(...e){this._each(`register`,e,this.scales)}getController(e){return this._get(e,this.controllers,`controller`)}getElement(e){return this._get(e,this.elements,`element`)}getPlugin(e){return this._get(e,this.plugins,`plugin`)}getScale(e){return this._get(e,this.scales,`scale`)}removeControllers(...e){this._each(`unregister`,e,this.controllers)}removeElements(...e){this._each(`unregister`,e,this.elements)}removePlugins(...e){this._each(`unregister`,e,this.plugins)}removeScales(...e){this._each(`unregister`,e,this.scales)}_each(e,t,n){[...t].forEach(t=>{let r=n||this._getRegistryForType(t);n||r.isForType(t)||r===this.plugins&&t.id?this._exec(e,r,t):I(t,t=>{let r=n||this._getRegistryForType(t);this._exec(e,r,t)})})}_exec(e,t,n){let r=We(e);F(n[`before`+r],[],n),t[e](n),F(n[`after`+r],[],n)}_getRegistryForType(e){for(let t=0;te.filter(e=>!t.some(t=>e.plugin.id===t.plugin.id));this._notify(r(t,n),e,`stop`),this._notify(r(n,t),e,`start`)}};function to(e){let t={},n=[],r=Object.keys(X.plugins.items);for(let e=0;e1&&co(e[0].toLowerCase());if(t)return t}throw Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function fo(e,t,n){if(n[t+`AxisID`]===e)return{axis:t}}function po(e,t){if(t.data&&t.data.datasets){let n=t.data.datasets.filter(t=>t.xAxisID===e||t.yAxisID===e);if(n.length)return fo(e,`x`,n[0])||fo(e,`y`,n[0])}return{}}function mo(e,t){let n=Jt[e.type]||{scales:{}},r=t.scales||{},i=ao(e.type,t),a=Object.create(null);return Object.keys(r).forEach(t=>{let o=r[t];if(!j(o))return console.error(`Invalid scale configuration for scale: ${t}`);if(o._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${t}`);let s=uo(t,o,po(t,e),K.scales[o.type]),c=so(s,i),l=n.scales||{};a[t]=Re(Object.create(null),[{axis:s},o,l[s],l[c]])}),e.data.datasets.forEach(n=>{let i=n.type||e.type,o=n.indexAxis||ao(i,t),s=(Jt[i]||{}).scales||{};Object.keys(s).forEach(e=>{let t=oo(e,o),i=n[t+`AxisID`]||t;a[i]=a[i]||Object.create(null),Re(a[i],[{axis:t},r[i],s[e]])})}),Object.keys(a).forEach(e=>{let t=a[e];Re(t,[K.scales[t.type],K.scale])}),a}function ho(e){let t=e.options||={};t.plugins=P(t.plugins,{}),t.scales=mo(e,t)}function go(e){return e||={},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function _o(e){return e||={},e.data=go(e.data),ho(e),e}var vo=new Map,yo=new Set;function bo(e,t){let n=vo.get(e);return n||(n=t(),vo.set(e,n),yo.add(n)),n}var xo=(e,t,n)=>{let r=Ue(t,n);r!==void 0&&e.add(r)},So=class{constructor(e){this._config=_o(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=go(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){let e=this._config;this.clearCache(),ho(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return bo(e,()=>[[`datasets.${e}`,``]])}datasetAnimationScopeKeys(e,t){return bo(`${e}.transition.${t}`,()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,``]])}datasetElementScopeKeys(e,t){return bo(`${e}-${t}`,()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,``]])}pluginScopeKeys(e){let t=e.id,n=this.type;return bo(`${n}-plugin-${t}`,()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,t){let n=this._scopeCache,r=n.get(e);return(!r||t)&&(r=new Map,n.set(e,r)),r}getOptionScopes(e,t,n){let{options:r,type:i}=this,a=this._cachedScopes(e,n),o=a.get(t);if(o)return o;let s=new Set;t.forEach(t=>{e&&(s.add(e),t.forEach(t=>xo(s,e,t))),t.forEach(e=>xo(s,r,e)),t.forEach(e=>xo(s,Jt[i]||{},e)),t.forEach(e=>xo(s,K,e)),t.forEach(e=>xo(s,Yt,e))});let c=Array.from(s);return c.length===0&&c.push(Object.create(null)),yo.has(t)&&a.set(t,c),c}chartOptionScopes(){let{options:e,type:t}=this;return[e,Jt[t]||{},K.datasets[t]||{},{type:t},K,Yt]}resolveNamedOptions(e,t,n,r=[``]){let i={$shared:!0},{resolver:a,subPrefixes:o}=Co(this._resolverCache,e,r),s=a;if(To(a,t)){i.$shared=!1,n=Ke(n)?n():n;let t=this.createResolver(e,n,o);s=Dn(a,n,t)}for(let e of t)i[e]=s[e];return i}createResolver(e,t,n=[``],r){let{resolver:i}=Co(this._resolverCache,e,n);return j(t)?Dn(i,t,void 0,r):i}};function Co(e,t,n){let r=e.get(t);r||(r=new Map,e.set(t,r));let i=n.join(),a=r.get(i);return a||(a={resolver:En(t,n),subPrefixes:n.filter(e=>!e.toLowerCase().includes(`hover`))},r.set(i,a)),a}var wo=e=>j(e)&&Object.getOwnPropertyNames(e).some(t=>Ke(e[t]));function To(e,t){let{isScriptable:n,isIndexable:r}=On(e);for(let i of t){let t=n(i),a=r(i),o=(a||t)&&e[i];if(t&&(Ke(o)||wo(o))||a&&A(o))return!0}return!1}var Eo=`4.5.1`,Do=[`top`,`bottom`,`left`,`right`,`chartArea`];function Oo(e,t){return e===`top`||e===`bottom`||Do.indexOf(e)===-1&&t===`x`}function ko(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}function Ao(e){let t=e.chart,n=t.options.animation;t.notifyPlugins(`afterRender`),F(n&&n.onComplete,[e],t)}function jo(e){let t=e.chart,n=t.options.animation;F(n&&n.onProgress,[e],t)}function Mo(e){return tr()&&typeof e==`string`?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}var No={},Po=e=>{let t=Mo(e);return Object.values(No).filter(e=>e.canvas===t).pop()};function Fo(e,t,n){let r=Object.keys(e);for(let i of r){let r=+i;if(r>=t){let a=e[i];delete e[i],(n>0||r>t)&&(e[r+n]=a)}}}function Io(e,t,n,r){return!n||e.type===`mouseout`?null:r?t:e}var Lo=class{static defaults=K;static instances=No;static overrides=Jt;static registry=X;static version=Eo;static getChart=Po;static register(...e){X.add(...e),Ro()}static unregister(...e){X.remove(...e),Ro()}constructor(e,t){let n=this.config=new So(t),r=Mo(e),i=Po(r);if(i)throw Error(`Canvas is already in use. Chart with ID '`+i.id+`' must be destroyed before the canvas with ID '`+i.canvas.id+`' can be reused.`);let a=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||(Oa(r))),this.platform.updateConfig(n);let o=this.platform.acquireContext(r,a.aspectRatio),s=o&&o.canvas,c=s&&s.height,l=s&&s.width;if(this.id=Ae(),this.ctx=o,this.canvas=s,this.width=l,this.height=c,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new eo,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Tt(e=>this.update(e),a.resizeDelay||0),this._dataChanges=[],No[this.id]=this,!o||!s){console.error(`Failed to create chart: can't acquire context from the given item`);return}Br.listen(this,`complete`,Ao),Br.listen(this,`progress`,jo),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:e,maintainAspectRatio:t},width:n,height:r,_aspectRatio:i}=this;return k(e)?t&&i?i:r?n/r:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return X}_initialize(){return this.notifyPlugins(`beforeInit`),this.options.responsive?this.resize():mr(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins(`afterInit`),this}clear(){return nn(this.canvas,this.ctx),this}stop(){return Br.stop(this),this}resize(e,t){Br.running(this)?this._resizeBeforeDraw={width:e,height:t}:this._resize(e,t)}_resize(e,t){let n=this.options,r=this.canvas,i=n.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(r,e,t,i),o=n.devicePixelRatio||this.platform.getDevicePixelRatio(),s=this.width?`resize`:`attach`;this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,mr(this,o,!0)&&(this.notifyPlugins(`resize`,{size:a}),F(n.onResize,[this,a],this),this.attached&&this._doResize(s)&&this.render())}ensureScalesHaveIDs(){I(this.options.scales||{},(e,t)=>{e.id=t})}buildOrUpdateScales(){let e=this.options,t=e.scales,n=this.scales,r=Object.keys(n).reduce((e,t)=>(e[t]=!1,e),{}),i=[];t&&(i=i.concat(Object.keys(t).map(e=>{let n=t[e],r=uo(e,n),i=r===`r`,a=r===`x`;return{options:n,dposition:i?`chartArea`:a?`bottom`:`left`,dtype:i?`radialLinear`:a?`category`:`linear`}}))),I(i,t=>{let i=t.options,a=i.id,o=uo(a,i),s=P(i.type,t.dtype);(i.position===void 0||Oo(i.position,o)!==Oo(t.dposition))&&(i.position=t.dposition),r[a]=!0;let c=null;a in n&&n[a].type===s?c=n[a]:(c=new(X.getScale(s))({id:a,type:s,ctx:this.ctx,chart:this}),n[c.id]=c),c.init(i,e)}),I(r,(e,t)=>{e||delete n[t]}),I(n,e=>{Y.configure(this,e,e.options),Y.addBox(this,e)})}_updateMetasets(){let e=this._metasets,t=this.data.datasets.length,n=e.length;if(e.sort((e,t)=>e.index-t.index),n>t){for(let e=t;et.length&&delete this._stacks,e.forEach((e,n)=>{t.filter(t=>t===e._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){let e=[],t=this.data.datasets,n,r;for(this._removeUnreferencedMetasets(),n=0,r=t.length;n{this.getDatasetMeta(t).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins(`reset`)}update(e){let t=this.config;t.update();let n=this._options=t.createResolver(t.chartOptionScopes(),this.getContext()),r=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins(`beforeUpdate`,{mode:e,cancelable:!0})===!1)return;let i=this.buildOrUpdateControllers();this.notifyPlugins(`beforeElementsUpdate`);let a=0;for(let e=0,t=this.data.datasets.length;e{e.reset()}),this._updateDatasets(e),this.notifyPlugins(`afterUpdate`,{mode:e}),this._layers.sort(ko(`z`,`_idx`));let{_active:o,_lastEvent:s}=this;s?this._eventHandler(s,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){I(this.scales,e=>{Y.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let e=this.options;(!qe(new Set(Object.keys(this._listeners)),new Set(e.events))||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:e}=this,t=this._getUniformDataChanges()||[];for(let{method:n,start:r,count:i}of t)Fo(e,r,n===`_removeElements`?-i:i)}_getUniformDataChanges(){let e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];let t=this.data.datasets.length,n=t=>new Set(e.filter(e=>e[0]===t).map((e,t)=>t+`,`+e.splice(1).join(`,`))),r=n(0);for(let e=1;ee.split(`,`)).map(e=>({method:e[1],start:+e[2],count:+e[3]}))}_updateLayout(e){if(this.notifyPlugins(`beforeLayout`,{cancelable:!0})===!1)return;Y.update(this,this.width,this.height,e);let t=this.chartArea,n=t.width<=0||t.height<=0;this._layers=[],I(this.boxes,e=>{n&&e.position===`chartArea`||(e.configure&&e.configure(),this._layers.push(...e._layers()))},this),this._layers.forEach((e,t)=>{e._idx=t}),this.notifyPlugins(`afterLayout`)}_updateDatasets(e){if(this.notifyPlugins(`beforeDatasetsUpdate`,{mode:e,cancelable:!0})!==!1){for(let e=0,t=this.data.datasets.length;e=0;--t)this._drawDataset(e[t]);this.notifyPlugins(`afterDatasetsDraw`)}_drawDataset(e){let t=this.ctx,n={meta:e,index:e.index,cancelable:!0},r=zr(this,e);this.notifyPlugins(`beforeDatasetDraw`,n)!==!1&&(r&&sn(t,r),e.controller.draw(),r&&cn(t),n.cancelable=!1,this.notifyPlugins(`afterDatasetDraw`,n))}isPointInArea(e){return on(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,n,r){let i=Ui.modes[t];return typeof i==`function`?i(this,e,n,r):[]}getDatasetMeta(e){let t=this.data.datasets[e],n=this._metasets,r=n.filter(e=>e&&e._dataset===t).pop();return r||(r={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:t&&t.order||0,index:e,_dataset:t,_parsed:[],_sorted:!1},n.push(r)),r}getContext(){return this.$context||=Tn(null,{chart:this,type:`chart`})}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){let t=this.data.datasets[e];if(!t)return!1;let n=this.getDatasetMeta(e);return typeof n.hidden==`boolean`?!n.hidden:!t.hidden}setDatasetVisibility(e,t){let n=this.getDatasetMeta(e);n.hidden=!t}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,t,n){let r=n?`show`:`hide`,i=this.getDatasetMeta(e),a=i.controller._resolveAnimations(void 0,r);Ge(t)?(i.data[t].hidden=!n,this.update()):(this.setDatasetVisibility(e,n),a.update(i,{visible:n}),this.update(t=>t.datasetIndex===e?r:void 0))}hide(e,t){this._updateVisibility(e,t,!1)}show(e,t){this._updateVisibility(e,t,!0)}_destroyDatasetMeta(e){let t=this._metasets[e];t&&t.controller&&t.controller._destroy(),delete this._metasets[e]}_stop(){let e,t;for(this.stop(),Br.remove(this),e=0,t=this.data.datasets.length;e{t.addEventListener(this,n,r),e[n]=r},r=(e,t,n)=>{e.offsetX=t,e.offsetY=n,this._eventHandler(e)};I(this.options.events,e=>n(e,r))}bindResponsiveEvents(){this._responsiveListeners||={};let e=this._responsiveListeners,t=this.platform,n=(n,r)=>{t.addEventListener(this,n,r),e[n]=r},r=(n,r)=>{e[n]&&(t.removeEventListener(this,n,r),delete e[n])},i=(e,t)=>{this.canvas&&this.resize(e,t)},a,o=()=>{r(`attach`,o),this.attached=!0,this.resize(),n(`resize`,i),n(`detach`,a)};a=()=>{this.attached=!1,r(`resize`,i),this._stop(),this._resize(0,0),n(`attach`,o)},t.isAttached(this.canvas)?o():a()}unbindEvents(){I(this._listeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._listeners={},I(this._responsiveListeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,t,n){let r=n?`set`:`remove`,i,a,o,s;for(t===`dataset`&&(i=this.getDatasetMeta(e[0].datasetIndex),i.controller[`_`+r+`DatasetHoverStyle`]()),o=0,s=e.length;o{let n=this.getDatasetMeta(e);if(!n)throw Error(`No dataset found at index `+e);return{datasetIndex:e,element:n.data[t],index:t}});Ne(n,t)||(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,t))}notifyPlugins(e,t,n){return this._plugins.notify(this,e,t,n)}isPluginEnabled(e){return this._plugins._cache.filter(t=>t.plugin.id===e).length===1}_updateHoverStyles(e,t,n){let r=this.options.hover,i=(e,t)=>e.filter(e=>!t.some(t=>e.datasetIndex===t.datasetIndex&&e.index===t.index)),a=i(t,e),o=n?e:i(e,t);a.length&&this.updateHoverStyle(a,r.mode,!1),o.length&&r.mode&&this.updateHoverStyle(o,r.mode,!0)}_eventHandler(e,t){let n={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},r=t=>(t.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins(`beforeEvent`,n,r)===!1)return;let i=this._handleEvent(e,t,n.inChartArea);return n.cancelable=!1,this.notifyPlugins(`afterEvent`,n,r),(i||n.changed)&&this.render(),this}_handleEvent(e,t,n){let{_active:r=[],options:i}=this,a=t,o=this._getActiveElements(e,r,n,a),s=Je(e),c=Io(e,this._lastEvent,n,s);n&&(this._lastEvent=null,F(i.onHover,[e,o,this],this),s&&F(i.onClick,[e,o,this],this));let l=!Ne(o,r);return(l||t)&&(this._active=o,this._updateHoverStyles(o,r,t)),this._lastEvent=c,l}_getActiveElements(e,t,n,r){if(e.type===`mouseout`)return[];if(!n)return t;let i=this.options.hover;return this.getElementsAtEventForMode(e,i.mode,i,r)}};function Ro(){return I(Lo.instances,e=>e._plugins.invalidate())}function zo(e,t,n){let{startAngle:r,x:i,y:a,outerRadius:o,innerRadius:s,options:c}=t,{borderWidth:l,borderJoinStyle:u}=c,d=Math.min(l/o,H(r-n));if(e.beginPath(),e.arc(i,a,o-l/2,r+d/2,n-d/2),s>0){let t=Math.min(l/s,H(r-n));e.arc(i,a,s+l/2,n-t/2,r+t/2,!0)}else{let t=Math.min(l/2,o*H(r-n));if(u===`round`)e.arc(i,a,t,n-L/2,r+L/2,!0);else if(u===`bevel`){let o=2*t*t,s=-o*Math.cos(n+L/2)+i,c=-o*Math.sin(n+L/2)+a,l=o*Math.cos(r+L/2)+i,u=o*Math.sin(r+L/2)+a;e.lineTo(s,c),e.lineTo(l,u)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip(`evenodd`)}function Bo(e,t,n){let{startAngle:r,pixelMargin:i,x:a,y:o,outerRadius:s,innerRadius:c}=t,l=i/s;e.beginPath(),e.arc(a,o,s,r-l,n+l),c>i?(l=i/c,e.arc(a,o,c,n+l,r-l,!0)):e.arc(a,o,i,n+z,r-z),e.closePath(),e.clip()}function Vo(e){return bn(e,[`outerStart`,`outerEnd`,`innerStart`,`innerEnd`])}function Ho(e,t,n,r){let i=Vo(e.options.borderRadius),a=(n-t)/2,o=Math.min(a,r*t/2),s=e=>{let t=(n-Math.min(a,e))*r/2;return U(e,0,Math.min(a,t))};return{outerStart:s(i.outerStart),outerEnd:s(i.outerEnd),innerStart:U(i.innerStart,0,o),innerEnd:U(i.innerEnd,0,o)}}function Uo(e,t,n,r){return{x:n+e*Math.cos(t),y:r+e*Math.sin(t)}}function Wo(e,t,n,r,i,a){let{x:o,y:s,startAngle:c,pixelMargin:l,innerRadius:u}=t,d=Math.max(t.outerRadius+r+n-l,0),f=u>0?u+r+n+l:0,p=0,m=i-c;if(r){let e=((u>0?u-r:0)+(d>0?d-r:0))/2;p=(m-(e===0?m:m*e/(e+r)))/2}let h=(m-Math.max(.001,m*d-n/L)/d)/2,g=c+h+p,_=i-h-p,{outerStart:v,outerEnd:y,innerStart:b,innerEnd:x}=Ho(t,f,d,_-g),S=d-v,C=d-y,w=g+v/S,T=_-y/C,E=f+b,D=f+x,ee=g+b/E,O=_-x/D;if(e.beginPath(),a){let t=(w+T)/2;if(e.arc(o,s,d,w,t),e.arc(o,s,d,t,T),y>0){let t=Uo(C,T,o,s);e.arc(t.x,t.y,y,T,_+z)}let n=Uo(D,_,o,s);if(e.lineTo(n.x,n.y),x>0){let t=Uo(D,O,o,s);e.arc(t.x,t.y,x,_+z,O+Math.PI)}let r=(_-x/f+(g+b/f))/2;if(e.arc(o,s,f,_-x/f,r,!0),e.arc(o,s,f,r,g+b/f,!0),b>0){let t=Uo(E,ee,o,s);e.arc(t.x,t.y,b,ee+Math.PI,g-z)}let i=Uo(S,g,o,s);if(e.lineTo(i.x,i.y),v>0){let t=Uo(S,w,o,s);e.arc(t.x,t.y,v,g-z,w)}}else{e.moveTo(o,s);let t=Math.cos(w)*d+o,n=Math.sin(w)*d+s;e.lineTo(t,n);let r=Math.cos(T)*d+o,i=Math.sin(T)*d+s;e.lineTo(r,i)}e.closePath()}function Go(e,t,n,r,i){let{fullCircles:a,startAngle:o,circumference:s}=t,c=t.endAngle;if(a){Wo(e,t,n,r,c,i);for(let t=0;t=L&&p===0&&u!==`miter`&&zo(e,t,h),a||(Wo(e,t,n,r,h,i),e.stroke())}var qo=class extends ka{static id=`arc`;static defaults={borderAlign:`center`,borderColor:`#fff`,borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:`backgroundColor`};static descriptors={_scriptable:!0,_indexable:e=>e!==`borderDash`};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(e){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,t,n){let{angle:r,distance:i}=ut(this.getProps([`x`,`y`],n),{x:e,y:t}),{startAngle:a,endAngle:o,innerRadius:s,outerRadius:c,circumference:l}=this.getProps([`startAngle`,`endAngle`,`innerRadius`,`outerRadius`,`circumference`],n),u=(this.options.spacing+this.options.borderWidth)/2,d=P(l,o-a),f=pt(r,a,o)&&a!==o,p=d>=R||f,m=W(i,s+u,c+u);return p&&m}getCenterPoint(e){let{x:t,y:n,startAngle:r,endAngle:i,innerRadius:a,outerRadius:o}=this.getProps([`x`,`y`,`startAngle`,`endAngle`,`innerRadius`,`outerRadius`],e),{offset:s,spacing:c}=this.options,l=(r+i)/2,u=(a+o+c+s)/2;return{x:t+Math.cos(l)*u,y:n+Math.sin(l)*u}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){let{options:t,circumference:n}=this,r=(t.offset||0)/4,i=(t.spacing||0)/2,a=t.circular;if(this.pixelMargin=t.borderAlign===`inner`?.33:0,this.fullCircles=n>R?Math.floor(n/R):0,n===0||this.innerRadius<0||this.outerRadius<0)return;e.save();let o=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(o)*r,Math.sin(o)*r);let s=r*(1-Math.sin(Math.min(L,n||0)));e.fillStyle=t.backgroundColor,e.strokeStyle=t.borderColor,Go(e,this,s,i,a),Ko(e,this,s,i,a),e.restore()}};function Jo(e,t,n=t){e.lineCap=P(n.borderCapStyle,t.borderCapStyle),e.setLineDash(P(n.borderDash,t.borderDash)),e.lineDashOffset=P(n.borderDashOffset,t.borderDashOffset),e.lineJoin=P(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=P(n.borderWidth,t.borderWidth),e.strokeStyle=P(n.borderColor,t.borderColor)}function Yo(e,t,n){e.lineTo(n.x,n.y)}function Xo(e){return e.stepped?ln:e.tension||e.cubicInterpolationMode===`monotone`?un:Yo}function Zo(e,t,n={}){let r=e.length,{start:i=0,end:a=r-1}=n,{start:o,end:s}=t,c=Math.max(i,o),l=Math.min(a,s),u=is&&a>s;return{count:r,start:c,loop:t.loop,ilen:l(o+(l?s-e:e))%a,y=()=>{h!==g&&(e.lineTo(u,g),e.lineTo(u,h),e.lineTo(u,_))};for(c&&(p=i[v(0)],e.moveTo(p.x,p.y)),f=0;f<=s;++f){if(p=i[v(f)],p.skip)continue;let t=p.x,n=p.y,r=t|0;r===m?(ng&&(g=n),u=(d*u+t)/++d):(y(),e.lineTo(t,n),m=r,d=0,h=g=n),_=n}y()}function es(e){let t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!==`monotone`&&!t.stepped&&!n?$o:Qo}function ts(e){return e.stepped?vr:e.tension||e.cubicInterpolationMode===`monotone`?yr:_r}function ns(e,t,n,r){let i=t._path;i||(i=t._path=new Path2D,t.path(i,n,r)&&i.closePath()),Jo(e,t.options),e.stroke(i)}function rs(e,t,n,r){let{segments:i,options:a}=t,o=es(t);for(let s of i)Jo(e,a,s.style),e.beginPath(),o(e,t,s,{start:n,end:n+r-1})&&e.closePath(),e.stroke()}var is=typeof Path2D==`function`;function as(e,t,n,r){is&&!t.options.segment?ns(e,t,n,r):rs(e,t,n,r)}var os=class extends ka{static id=`line`;static defaults={borderCapStyle:`butt`,borderDash:[],borderDashOffset:0,borderJoinStyle:`miter`,borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:`default`,fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:`backgroundColor`,borderColor:`borderColor`};static descriptors={_scriptable:!0,_indexable:e=>e!==`borderDash`&&e!==`fill`};constructor(e){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,e&&Object.assign(this,e)}updateControlPoints(e,t){let n=this.options;if((n.tension||n.cubicInterpolationMode===`monotone`)&&!n.stepped&&!this._pointsUpdated){let r=n.spanGaps?this._loop:this._fullLoop;er(this._points,n,e,r,t),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||=Mr(this,this.options.segment)}first(){let e=this.segments,t=this.points;return e.length&&t[e[0].start]}last(){let e=this.segments,t=this.points,n=e.length;return n&&t[e[n-1].end]}interpolate(e,t){let n=this.options,r=e[t],i=this.points,a=kr(this,{property:t,start:r,end:r});if(!a.length)return;let o=[],s=ts(n),c,l;for(c=0,l=a.length;c{t=Ss(e,t,i);let o=i[e],s=i[t];r===null?n!==null&&(a.push({x:n,y:o.y}),a.push({x:n,y:s.y})):(a.push({x:o.x,y:r}),a.push({x:s.x,y:r}))}),a}function Ss(e,t,n){for(;t>e;t--){let e=n[t];if(!isNaN(e.x)&&!isNaN(e.y))break}return t}function Cs(e,t,n,r){return e&&t?r(e[n],t[n]):e?e[n]:t?t[n]:0}function ws(e,t){let n=[],r=!1;return A(e)?(r=!0,n=e):n=xs(e,t),n.length?new os({points:n,options:{tension:0},_loop:r,_fullLoop:r}):null}function Ts(e){return e&&e.fill!==!1}function Es(e,t,n){let r=e[t].fill,i=[t],a;if(!n)return r;for(;r!==!1&&i.indexOf(r)===-1;){if(!M(r))return r;if(a=e[r],!a)return!1;if(a.visible)return r;i.push(r),r=a.fill}return!1}function Ds(e,t,n){let r=js(e);if(j(r))return isNaN(r.value)?!1:r;let i=parseFloat(r);return M(i)&&Math.floor(i)===i?Os(r[0],t,i,n):[`origin`,`start`,`end`,`stack`,`shape`].indexOf(r)>=0&&r}function Os(e,t,n,r){return(e===`-`||e===`+`)&&(n=t+n),n===t||n<0||n>=r?!1:n}function ks(e,t){let n=null;return e===`start`?n=t.bottom:e===`end`?n=t.top:j(e)?n=t.getPixelForValue(e.value):t.getBasePixel&&(n=t.getBasePixel()),n}function As(e,t,n){let r;return r=e===`start`?n:e===`end`?t.options.reverse?t.min:t.max:j(e)?e.value:t.getBaseValue(),r}function js(e){let t=e.options,n=t.fill,r=P(n&&n.target,n);return r===void 0&&(r=!!t.backgroundColor),r===!1||r===null?!1:r===!0?`origin`:r}function Ms(e){let{scale:t,index:n,line:r}=e,i=[],a=r.segments,o=r.points,s=Ns(t,n);s.push(ws({x:null,y:t.bottom},r));for(let e=0;e=0;--t){let n=i[t].$filler;n&&(n.line.updateControlPoints(a,n.axis),r&&n.fill&&Hs(e.ctx,n,a))}},beforeDatasetsDraw(e,t,n){if(n.drawTime!==`beforeDatasetsDraw`)return;let r=e.getSortedVisibleDatasetMetas();for(let t=r.length-1;t>=0;--t){let n=r[t].$filler;Ts(n)&&Hs(e.ctx,n,e.chartArea)}},beforeDatasetDraw(e,t,n){let r=t.meta.$filler;!Ts(r)||n.drawTime!==`beforeDatasetDraw`||Hs(e.ctx,r,e.chartArea)},defaults:{propagate:!0,drawTime:`beforeDatasetDraw`}},Xs=(e,t)=>{let{boxHeight:n=t,boxWidth:r=t}=e;return e.usePointStyle&&(n=Math.min(n,t),r=e.pointStyleWidth||Math.min(r,t)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(t,n)}},Zs=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index,Qs=class extends ka{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t,n){this.maxWidth=e,this.maxHeight=t,this._margins=n,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){let e=this.options.labels||{},t=F(e.generateLabels,[this.chart],this)||[];e.filter&&(t=t.filter(t=>e.filter(t,this.chart.data))),e.sort&&(t=t.sort((t,n)=>e.sort(t,n,this.chart.data))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){let{options:e,ctx:t}=this;if(!e.display){this.width=this.height=0;return}let n=e.labels,r=J(n.font),i=r.size,a=this._computeTitleHeight(),{boxWidth:o,itemHeight:s}=Xs(n,i),c,l;t.font=r.string,this.isHorizontal()?(c=this.maxWidth,l=this._fitRows(a,i,o,s)+10):(l=this.maxHeight,c=this._fitCols(a,r,o,s)+10),this.width=Math.min(c,e.maxWidth||this.maxWidth),this.height=Math.min(l,e.maxHeight||this.maxHeight)}_fitRows(e,t,n,r){let{ctx:i,maxWidth:a,options:{labels:{padding:o}}}=this,s=this.legendHitBoxes=[],c=this.lineWidths=[0],l=r+o,u=e;i.textAlign=`left`,i.textBaseline=`middle`;let d=-1,f=-l;return this.legendItems.forEach((e,p)=>{let m=n+t/2+i.measureText(e.text).width;(p===0||c[c.length-1]+m+2*o>a)&&(u+=l,c[c.length-(p>0?0:1)]=0,f+=l,d++),s[p]={left:0,top:f,row:d,width:m,height:r},c[c.length-1]+=m+o}),u}_fitCols(e,t,n,r){let{ctx:i,maxHeight:a,options:{labels:{padding:o}}}=this,s=this.legendHitBoxes=[],c=this.columnSizes=[],l=a-e,u=o,d=0,f=0,p=0,m=0;return this.legendItems.forEach((e,a)=>{let{itemWidth:h,itemHeight:g}=$s(n,t,i,e,r);a>0&&f+g+2*o>l&&(u+=d+o,c.push({width:d,height:f}),p+=d+o,m++,d=f=0),s[a]={left:p,top:f,col:m,width:h,height:g},d=Math.max(d,h),f+=g+o}),u+=d,c.push({width:d,height:f}),u}adjustHitBoxes(){if(!this.options.display)return;let e=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:n,labels:{padding:r},rtl:i}}=this,a=Sr(i,this.left,this.width);if(this.isHorizontal()){let i=0,o=G(n,this.left+r,this.right-this.lineWidths[i]);for(let s of t)i!==s.row&&(i=s.row,o=G(n,this.left+r,this.right-this.lineWidths[i])),s.top+=this.top+e+r,s.left=a.leftForLtr(a.x(o),s.width),o+=s.width+r}else{let i=0,o=G(n,this.top+e+r,this.bottom-this.columnSizes[i].height);for(let s of t)s.col!==i&&(i=s.col,o=G(n,this.top+e+r,this.bottom-this.columnSizes[i].height)),s.top=o,s.left+=this.left+r,s.left=a.leftForLtr(a.x(s.left),s.width),o+=s.height+r}}isHorizontal(){return this.options.position===`top`||this.options.position===`bottom`}draw(){if(this.options.display){let e=this.ctx;sn(e,this),this._draw(),cn(e)}}_draw(){let{options:e,columnSizes:t,lineWidths:n,ctx:r}=this,{align:i,labels:a}=e,o=K.color,s=Sr(e.rtl,this.left,this.width),c=J(a.font),{padding:l}=a,u=c.size,d=u/2,f;this.drawTitle(),r.textAlign=s.textAlign(`left`),r.textBaseline=`middle`,r.lineWidth=.5,r.font=c.string;let{boxWidth:p,boxHeight:m,itemHeight:h}=Xs(a,u),g=function(e,t,n){if(isNaN(p)||p<=0||isNaN(m)||m<0)return;r.save();let i=P(n.lineWidth,1);if(r.fillStyle=P(n.fillStyle,o),r.lineCap=P(n.lineCap,`butt`),r.lineDashOffset=P(n.lineDashOffset,0),r.lineJoin=P(n.lineJoin,`miter`),r.lineWidth=i,r.strokeStyle=P(n.strokeStyle,o),r.setLineDash(P(n.lineDash,[])),a.usePointStyle)an(r,{radius:m*Math.SQRT2/2,pointStyle:n.pointStyle,rotation:n.rotation,borderWidth:i},s.xPlus(e,p/2),t+d,a.pointStyleWidth&&p);else{let a=t+Math.max((u-m)/2,0),o=s.leftForLtr(e,p),c=Sn(n.borderRadius);r.beginPath(),Object.values(c).some(e=>e!==0)?hn(r,{x:o,y:a,w:p,h:m,radius:c}):r.rect(o,a,p,m),r.fill(),i!==0&&r.stroke()}r.restore()},_=function(e,t,n){mn(r,n.text,e,t+h/2,c,{strikethrough:n.hidden,textAlign:s.textAlign(n.textAlign)})},v=this.isHorizontal(),y=this._computeTitleHeight();f=v?{x:G(i,this.left+l,this.right-n[0]),y:this.top+l+y,line:0}:{x:this.left+l,y:G(i,this.top+y+l,this.bottom-t[0].height),line:0},Cr(this.ctx,e.textDirection);let b=h+l;this.legendItems.forEach((o,u)=>{r.strokeStyle=o.fontColor,r.fillStyle=o.fontColor;let m=r.measureText(o.text).width,h=s.textAlign(o.textAlign||=a.textAlign),x=p+d+m,S=f.x,C=f.y;if(s.setWidth(this.width),v?u>0&&S+x+l>this.right&&(C=f.y+=b,f.line++,S=f.x=G(i,this.left+l,this.right-n[f.line])):u>0&&C+b>this.bottom&&(S=f.x=S+t[f.line].width+l,f.line++,C=f.y=G(i,this.top+y+l,this.bottom-t[f.line].height)),g(s.x(S),C,o),S=Dt(h,S+p+d,v?S+x:this.right,e.rtl),_(s.x(S),C,o),v)f.x+=x+l;else if(typeof o.text!=`string`){let e=c.lineHeight;f.y+=nc(o,e)+l}else f.y+=b}),wr(this.ctx,e.textDirection)}drawTitle(){let e=this.options,t=e.title,n=J(t.font),r=q(t.padding);if(!t.display)return;let i=Sr(e.rtl,this.left,this.width),a=this.ctx,o=t.position,s=n.size/2,c=r.top+s,l,u=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),l=this.top+c,u=G(e.align,u,this.right-d);else{let t=this.columnSizes.reduce((e,t)=>Math.max(e,t.height),0);l=c+G(e.align,this.top,this.bottom-t-e.labels.padding-this._computeTitleHeight())}let f=G(o,u,u+d);a.textAlign=i.textAlign(Et(o)),a.textBaseline=`middle`,a.strokeStyle=t.color,a.fillStyle=t.color,a.font=n.string,mn(a,t.text,f,l,n)}_computeTitleHeight(){let e=this.options.title,t=J(e.font),n=q(e.padding);return e.display?t.lineHeight+n.height:0}_getLegendItemAt(e,t){let n,r,i;if(W(e,this.left,this.right)&&W(t,this.top,this.bottom)){for(i=this.legendHitBoxes,n=0;ne.length>t.length?e:t)),t+n.size/2+r.measureText(i).width}function tc(e,t,n){let r=e;return typeof t.text!=`string`&&(r=nc(t,n)),r}function nc(e,t){return t*(e.text?e.text.length:0)}function rc(e,t){return!!((e===`mousemove`||e===`mouseout`)&&(t.onHover||t.onLeave)||t.onClick&&(e===`click`||e===`mouseup`))}var ic={id:`legend`,_element:Qs,start(e,t,n){let r=e.legend=new Qs({ctx:e.ctx,options:n,chart:e});Y.configure(e,r,n),Y.addBox(e,r)},stop(e){Y.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){let r=e.legend;Y.configure(e,r,n),r.options=n},afterUpdate(e){let t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:`top`,align:`center`,fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){let r=t.datasetIndex,i=n.chart;i.isDatasetVisible(r)?(i.hide(r),t.hidden=!0):(i.show(r),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){let t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:i,color:a,useBorderRadius:o,borderRadius:s}}=e.legend.options;return e._getSortedDatasetMetas().map(e=>{let c=e.controller.getStyle(n?0:void 0),l=q(c.borderWidth);return{text:t[e.index].label,fillStyle:c.backgroundColor,fontColor:a,hidden:!e.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(l.width+l.height)/4,strokeStyle:c.borderColor,pointStyle:r||c.pointStyle,rotation:c.rotation,textAlign:i||c.textAlign,borderRadius:o&&(s||c.borderRadius),datasetIndex:e.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:`center`,text:``}},descriptors:{_scriptable:e=>!e.startsWith(`on`),labels:{_scriptable:e=>![`generateLabels`,`filter`,`sort`].includes(e)}}},ac=class extends ka{constructor(e){super(),this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t){let n=this.options;if(this.left=0,this.top=0,!n.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=e,this.height=this.bottom=t;let r=A(n.text)?n.text.length:1;this._padding=q(n.padding);let i=r*J(n.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=i:this.width=i}isHorizontal(){let e=this.options.position;return e===`top`||e===`bottom`}_drawArgs(e){let{top:t,left:n,bottom:r,right:i,options:a}=this,o=a.align,s=0,c,l,u;return this.isHorizontal()?(l=G(o,n,i),u=t+e,c=i-n):(a.position===`left`?(l=n+e,u=G(o,r,t),s=L*-.5):(l=i-e,u=G(o,t,r),s=L*.5),c=r-t),{titleX:l,titleY:u,maxWidth:c,rotation:s}}draw(){let e=this.ctx,t=this.options;if(!t.display)return;let n=J(t.font),r=n.lineHeight/2+this._padding.top,{titleX:i,titleY:a,maxWidth:o,rotation:s}=this._drawArgs(r);mn(e,t.text,0,0,n,{color:t.color,maxWidth:o,rotation:s,textAlign:Et(t.align),textBaseline:`middle`,translation:[i,a]})}};function oc(e,t){let n=new ac({ctx:e.ctx,options:t,chart:e});Y.configure(e,n,t),Y.addBox(e,n),e.titleBlock=n}var sc={id:`title`,_element:ac,start(e,t,n){oc(e,n)},stop(e){let t=e.titleBlock;Y.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){let r=e.titleBlock;Y.configure(e,r,n),r.options=n},defaults:{align:`center`,display:!1,font:{weight:`bold`},fullSize:!0,padding:10,position:`top`,text:``,weight:2e3},defaultRoutes:{color:`color`},descriptors:{_scriptable:!0,_indexable:!1}},cc={average(e){if(!e.length)return!1;let t,n,r=new Set,i=0,a=0;for(t=0,n=e.length;te+t)/r.size,y:i/a}},nearest(e,t){if(!e.length)return!1;let n=t.x,r=t.y,i=1/0,a,o,s;for(a=0,o=e.length;aMath.max(Math.min(e,n),t);function h(e){return m(p(e*2.55),0,255)}function g(e){return m(p(e*255),0,255)}function _(e){return m(p(e/2.55)/100,0,1)}function v(e){return m(p(e*100),0,100)}var y={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},b=[...`0123456789ABCDEF`],x=e=>b[e&15],S=e=>b[(e&240)>>4]+b[e&15],C=e=>(e&240)>>4==(e&15),w=e=>C(e.r)&&C(e.g)&&C(e.b)&&C(e.a);function T(e){var t=e.length,n;return e[0]===`#`&&(t===4||t===5?n={r:255&y[e[1]]*17,g:255&y[e[2]]*17,b:255&y[e[3]]*17,a:t===5?y[e[4]]*17:255}:(t===7||t===9)&&(n={r:y[e[1]]<<4|y[e[2]],g:y[e[3]]<<4|y[e[4]],b:y[e[5]]<<4|y[e[6]],a:t===9?y[e[7]]<<4|y[e[8]]:255})),n}var E=(e,t)=>e<255?t(e):``;function D(e){var t=w(e)?x:S;return e?`#`+t(e.r)+t(e.g)+t(e.b)+E(e.a,t):void 0}var ee=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function O(e,t,n){let r=t*Math.min(n,1-n),i=(t,i=(t+e/30)%12)=>n-r*Math.max(Math.min(i-3,9-i,1),-1);return[i(0),i(8),i(4)]}function te(e,t,n){let r=(r,i=(r+e/60)%6)=>n-n*t*Math.max(Math.min(i,4-i,1),0);return[r(5),r(3),r(1)]}function ne(e,t,n){let r=O(e,1,.5),i;for(t+n>1&&(i=1/(t+n),t*=i,n*=i),i=0;i<3;i++)r[i]*=1-t-n,r[i]+=t;return r}function re(e,t,n,r,i){return e===i?(t-n)/r+(t.5?l/(2-i-a):l/(i+a),s=re(t,n,r,l,i),s=s*60+.5),[s|0,c||0,o]}function ae(e,t,n,r){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,r)).map(g)}function oe(e,t,n){return ae(O,e,t,n)}function se(e,t,n){return ae(ne,e,t,n)}function ce(e,t,n){return ae(te,e,t,n)}function le(e){return(e%360+360)%360}function ue(e){let t=ee.exec(e),n=255,r;if(!t)return;t[5]!==r&&(n=t[6]?h(+t[5]):g(+t[5]));let i=le(+t[2]),a=t[3]/100,o=t[4]/100;return r=t[1]===`hwb`?se(i,a,o):t[1]===`hsv`?ce(i,a,o):oe(i,a,o),{r:r[0],g:r[1],b:r[2],a:n}}function de(e,t){var n=ie(e);n[0]=le(n[0]+t),n=oe(n),e.r=n[0],e.g=n[1],e.b=n[2]}function fe(e){if(!e)return;let t=ie(e),n=t[0],r=v(t[1]),i=v(t[2]);return e.a<255?`hsla(${n}, ${r}%, ${i}%, ${_(e.a)})`:`hsl(${n}, ${r}%, ${i}%)`}var pe={x:`dark`,Z:`light`,Y:`re`,X:`blu`,W:`gr`,V:`medium`,U:`slate`,A:`ee`,T:`ol`,S:`or`,B:`ra`,C:`lateg`,D:`ights`,R:`in`,Q:`turquois`,E:`hi`,P:`ro`,O:`al`,N:`le`,M:`de`,L:`yello`,F:`en`,K:`ch`,G:`arks`,H:`ea`,I:`ightg`,J:`wh`},me={OiceXe:`f0f8ff`,antiquewEte:`faebd7`,aqua:`ffff`,aquamarRe:`7fffd4`,azuY:`f0ffff`,beige:`f5f5dc`,bisque:`ffe4c4`,black:`0`,blanKedOmond:`ffebcd`,Xe:`ff`,XeviTet:`8a2be2`,bPwn:`a52a2a`,burlywood:`deb887`,caMtXe:`5f9ea0`,KartYuse:`7fff00`,KocTate:`d2691e`,cSO:`ff7f50`,cSnflowerXe:`6495ed`,cSnsilk:`fff8dc`,crimson:`dc143c`,cyan:`ffff`,xXe:`8b`,xcyan:`8b8b`,xgTMnPd:`b8860b`,xWay:`a9a9a9`,xgYF:`6400`,xgYy:`a9a9a9`,xkhaki:`bdb76b`,xmagFta:`8b008b`,xTivegYF:`556b2f`,xSange:`ff8c00`,xScEd:`9932cc`,xYd:`8b0000`,xsOmon:`e9967a`,xsHgYF:`8fbc8f`,xUXe:`483d8b`,xUWay:`2f4f4f`,xUgYy:`2f4f4f`,xQe:`ced1`,xviTet:`9400d3`,dAppRk:`ff1493`,dApskyXe:`bfff`,dimWay:`696969`,dimgYy:`696969`,dodgerXe:`1e90ff`,fiYbrick:`b22222`,flSOwEte:`fffaf0`,foYstWAn:`228b22`,fuKsia:`ff00ff`,gaRsbSo:`dcdcdc`,ghostwEte:`f8f8ff`,gTd:`ffd700`,gTMnPd:`daa520`,Way:`808080`,gYF:`8000`,gYFLw:`adff2f`,gYy:`808080`,honeyMw:`f0fff0`,hotpRk:`ff69b4`,RdianYd:`cd5c5c`,Rdigo:`4b0082`,ivSy:`fffff0`,khaki:`f0e68c`,lavFMr:`e6e6fa`,lavFMrXsh:`fff0f5`,lawngYF:`7cfc00`,NmoncEffon:`fffacd`,ZXe:`add8e6`,ZcSO:`f08080`,Zcyan:`e0ffff`,ZgTMnPdLw:`fafad2`,ZWay:`d3d3d3`,ZgYF:`90ee90`,ZgYy:`d3d3d3`,ZpRk:`ffb6c1`,ZsOmon:`ffa07a`,ZsHgYF:`20b2aa`,ZskyXe:`87cefa`,ZUWay:`778899`,ZUgYy:`778899`,ZstAlXe:`b0c4de`,ZLw:`ffffe0`,lime:`ff00`,limegYF:`32cd32`,lRF:`faf0e6`,magFta:`ff00ff`,maPon:`800000`,VaquamarRe:`66cdaa`,VXe:`cd`,VScEd:`ba55d3`,VpurpN:`9370db`,VsHgYF:`3cb371`,VUXe:`7b68ee`,VsprRggYF:`fa9a`,VQe:`48d1cc`,VviTetYd:`c71585`,midnightXe:`191970`,mRtcYam:`f5fffa`,mistyPse:`ffe4e1`,moccasR:`ffe4b5`,navajowEte:`ffdead`,navy:`80`,Tdlace:`fdf5e6`,Tive:`808000`,TivedBb:`6b8e23`,Sange:`ffa500`,SangeYd:`ff4500`,ScEd:`da70d6`,pOegTMnPd:`eee8aa`,pOegYF:`98fb98`,pOeQe:`afeeee`,pOeviTetYd:`db7093`,papayawEp:`ffefd5`,pHKpuff:`ffdab9`,peru:`cd853f`,pRk:`ffc0cb`,plum:`dda0dd`,powMrXe:`b0e0e6`,purpN:`800080`,YbeccapurpN:`663399`,Yd:`ff0000`,Psybrown:`bc8f8f`,PyOXe:`4169e1`,saddNbPwn:`8b4513`,sOmon:`fa8072`,sandybPwn:`f4a460`,sHgYF:`2e8b57`,sHshell:`fff5ee`,siFna:`a0522d`,silver:`c0c0c0`,skyXe:`87ceeb`,UXe:`6a5acd`,UWay:`708090`,UgYy:`708090`,snow:`fffafa`,sprRggYF:`ff7f`,stAlXe:`4682b4`,tan:`d2b48c`,teO:`8080`,tEstN:`d8bfd8`,tomato:`ff6347`,Qe:`40e0d0`,viTet:`ee82ee`,JHt:`f5deb3`,wEte:`ffffff`,wEtesmoke:`f5f5f5`,Lw:`ffff00`,LwgYF:`9acd32`};function he(){let e={},t=Object.keys(me),n=Object.keys(pe),r,i,a,o,s;for(r=0;r>16&255,a>>8&255,a&255]}return e}var ge;function _e(e){ge||(ge=he(),ge.transparent=[0,0,0,0]);let t=ge[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}var ve=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function ye(e){let t=ve.exec(e),n=255,r,i,a;if(t){if(t[7]!==r){let e=+t[7];n=t[8]?h(e):m(e*255,0,255)}return r=+t[1],i=+t[3],a=+t[5],r=255&(t[2]?h(r):m(r,0,255)),i=255&(t[4]?h(i):m(i,0,255)),a=255&(t[6]?h(a):m(a,0,255)),{r,g:i,b:a,a:n}}}function be(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${_(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}var xe=e=>e<=.0031308?e*12.92:e**(1/2.4)*1.055-.055,Se=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4;function Ce(e,t,n){let r=Se(_(e.r)),i=Se(_(e.g)),a=Se(_(e.b));return{r:g(xe(r+n*(Se(_(t.r))-r))),g:g(xe(i+n*(Se(_(t.g))-i))),b:g(xe(a+n*(Se(_(t.b))-a))),a:e.a+n*(t.a-e.a)}}function we(e,t,n){if(e){let r=ie(e);r[t]=Math.max(0,Math.min(r[t]+r[t]*n,t===0?360:1)),r=oe(r),e.r=r[0],e.g=r[1],e.b=r[2]}}function Te(e,t){return e&&Object.assign(t||{},e)}function Ee(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=g(e[3]))):(t=Te(e,{r:0,g:0,b:0,a:1}),t.a=g(t.a)),t}function De(e){return e.charAt(0)===`r`?ye(e):ue(e)}var Oe=class e{constructor(t){if(t instanceof e)return t;let n=typeof t,r;n===`object`?r=Ee(t):n===`string`&&(r=T(t)||_e(t)||De(t)),this._rgb=r,this._valid=!!r}get valid(){return this._valid}get rgb(){var e=Te(this._rgb);return e&&(e.a=_(e.a)),e}set rgb(e){this._rgb=Ee(e)}rgbString(){return this._valid?be(this._rgb):void 0}hexString(){return this._valid?D(this._rgb):void 0}hslString(){return this._valid?fe(this._rgb):void 0}mix(e,t){if(e){let n=this.rgb,r=e.rgb,i,a=t===i?.5:t,o=2*a-1,s=n.a-r.a,c=((o*s===-1?o:(o+s)/(1+o*s))+1)/2;i=1-c,n.r=255&c*n.r+i*r.r+.5,n.g=255&c*n.g+i*r.g+.5,n.b=255&c*n.b+i*r.b+.5,n.a=a*n.a+(1-a)*r.a,this.rgb=n}return this}interpolate(e,t){return e&&(this._rgb=Ce(this._rgb,e._rgb,t)),this}clone(){return new e(this.rgb)}alpha(e){return this._rgb.a=g(e),this}clearer(e){let t=this._rgb;return t.a*=1-e,this}greyscale(){let e=this._rgb;return e.r=e.g=e.b=p(e.r*.3+e.g*.59+e.b*.11),this}opaquer(e){let t=this._rgb;return t.a*=1+e,this}negate(){let e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return we(this._rgb,2,e),this}darken(e){return we(this._rgb,2,-e),this}saturate(e){return we(this._rgb,1,e),this}desaturate(e){return we(this._rgb,1,-e),this}rotate(e){return de(this._rgb,e),this}};function ke(){}var Ae=(()=>{let e=0;return()=>e++})();function k(e){return e==null}function A(e){if(Array.isArray&&Array.isArray(e))return!0;let t=Object.prototype.toString.call(e);return t.slice(0,7)===`[object`&&t.slice(-6)===`Array]`}function j(e){return e!==null&&Object.prototype.toString.call(e)===`[object Object]`}function M(e){return(typeof e==`number`||e instanceof Number)&&isFinite(+e)}function N(e,t){return M(e)?e:t}function P(e,t){return e===void 0?t:e}var je=(e,t)=>typeof e==`string`&&e.endsWith(`%`)?parseFloat(e)/100:+e/t,Me=(e,t)=>typeof e==`string`&&e.endsWith(`%`)?parseFloat(e)/100*t:+e;function F(e,t,n){if(e&&typeof e.call==`function`)return e.apply(n,t)}function I(e,t,n,r){let i,a,o;if(A(e))if(a=e.length,r)for(i=a-1;i>=0;i--)t.call(n,e[i],i);else for(i=0;ie,x:e=>e.x,y:e=>e.y};function Ve(e){let t=e.split(`.`),n=[],r=``;for(let e of t)r+=e,r.endsWith(`\\`)?r=r.slice(0,-1)+`.`:(n.push(r),r=``);return n}function He(e){let t=Ve(e);return e=>{for(let n of t){if(n===``)break;e&&=e[n]}return e}}function Ue(e,t){return(Be[t]||(Be[t]=He(t)))(e)}function We(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Ge=e=>e!==void 0,Ke=e=>typeof e==`function`,qe=(e,t)=>{if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0};function Je(e){return e.type===`mouseup`||e.type===`click`||e.type===`contextmenu`}var L=Math.PI,R=2*L,Ye=R+L,Xe=1/0,Ze=L/180,z=L/2,Qe=L/4,$e=L*2/3,et=Math.log10,B=Math.sign;function tt(e,t,n){return Math.abs(e-t)e-t).pop(),t}function it(e){return typeof e==`symbol`||typeof e==`object`&&!!e&&!(Symbol.toPrimitive in e||`toString`in e||`valueOf`in e)}function at(e){return!it(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function ot(e,t){let n=Math.round(e);return n-t<=e&&n+t>=e}function st(e,t,n){let r,i,a;for(r=0,i=e.length;rc&&l=Math.min(t,n)-r&&e<=Math.max(t,n)+r}function ht(e,t,n){n||=(n=>e[n]1;)a=i+r>>1,n(a)?i=a:r=a;return{lo:i,hi:r}}var gt=(e,t,n,r)=>ht(e,n,r?r=>{let i=e[r][t];return ie[r][t]ht(e,n,r=>e[r][t]>=n);function vt(e,t,n){let r=0,i=e.length;for(;rr&&e[i-1]>n;)i--;return r>0||i{let n=`_onData`+We(t),r=e[t];Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value(...t){let i=r.apply(this,t);return e._chartjs.listeners.forEach(e=>{typeof e[n]==`function`&&e[n](...t)}),i}})})}function xt(e,t){let n=e._chartjs;if(!n)return;let r=n.listeners,i=r.indexOf(t);i!==-1&&r.splice(i,1),!(r.length>0)&&(yt.forEach(t=>{delete e[t]}),delete e._chartjs)}function St(e){let t=new Set(e);return t.size===e.length?e:Array.from(t)}var Ct=function(){return typeof window>`u`?function(e){return e()}:window.requestAnimationFrame}();function wt(e,t){let n=[],r=!1;return function(...i){n=i,r||(r=!0,Ct.call(window,()=>{r=!1,e.apply(t,n)}))}}function Tt(e,t){let n;return function(...r){return t?(clearTimeout(n),n=setTimeout(e,t,r)):e.apply(this,r),t}}var Et=e=>e===`start`?`left`:e===`end`?`right`:`center`,G=(e,t,n)=>e===`start`?t:e===`end`?n:(t+n)/2,Dt=(e,t,n,r)=>e===(r?`left`:`right`)?n:e===`center`?(t+n)/2:t;function Ot(e,t,n){let r=t.length,i=0,a=r;if(e._sorted){let{iScale:o,vScale:s,_parsed:c}=e,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,u=o.axis,{min:d,max:f,minDefined:p,maxDefined:m}=o.getUserBounds();if(p){if(i=Math.min(gt(c,u,d).lo,n?r:gt(t,u,o.getPixelForValue(d)).lo),l){let e=c.slice(0,i+1).reverse().findIndex(e=>!k(e[s.axis]));i-=Math.max(0,e)}i=U(i,0,r-1)}if(m){let e=Math.max(gt(c,o.axis,f,!0).hi+1,n?0:gt(t,u,o.getPixelForValue(f),!0).hi+1);if(l){let t=c.slice(e-1).findIndex(e=>!k(e[s.axis]));e+=Math.max(0,t)}a=U(e,i,r)-i}else a=r-i}return{start:i,count:a}}function kt(e){let{xScale:t,yScale:n,_scaleRanges:r}=e,i={xmin:t.min,xmax:t.max,ymin:n.min,ymax:n.max};if(!r)return e._scaleRanges=i,!0;let a=r.xmin!==t.min||r.xmax!==t.max||r.ymin!==n.min||r.ymax!==n.max;return Object.assign(r,i),a}var At=e=>e===0||e===1,jt=(e,t,n)=>-(2**(10*--e)*Math.sin((e-t)*R/n)),Mt=(e,t,n)=>2**(-10*e)*Math.sin((e-t)*R/n)+1,Nt={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-(--e*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>--e*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*z)+1,easeOutSine:e=>Math.sin(e*z),easeInOutSine:e=>-.5*(Math.cos(L*e)-1),easeInExpo:e=>e===0?0:2**(10*(e-1)),easeOutExpo:e=>e===1?1:-(2**(-10*e))+1,easeInOutExpo:e=>At(e)?e:e<.5?.5*2**(10*(e*2-1)):.5*(-(2**(-10*(e*2-1)))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1- --e*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>At(e)?e:jt(e,.075,.3),easeOutElastic:e=>At(e)?e:Mt(e,.075,.3),easeInOutElastic(e){let t=.1125,n=.45;return At(e)?e:e<.5?.5*jt(e*2,t,n):.5+.5*Mt(e*2-1,t,n)},easeInBack(e){let t=1.70158;return e*e*((t+1)*e-t)},easeOutBack(e){let t=1.70158;return--e*e*((t+1)*e+t)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-Nt.easeOutBounce(1-e),easeOutBounce(e){let t=7.5625,n=2.75;return e<1/n?t*e*e:e<2/n?t*(e-=1.5/n)*e+.75:e<2.5/n?t*(e-=2.25/n)*e+.9375:t*(e-=2.625/n)*e+.984375},easeInOutBounce:e=>e<.5?Nt.easeInBounce(e*2)*.5:Nt.easeOutBounce(e*2-1)*.5+.5};function Pt(e){if(e&&typeof e==`object`){let t=e.toString();return t===`[object CanvasPattern]`||t===`[object CanvasGradient]`}return!1}function Ft(e){return Pt(e)?e:new Oe(e)}function It(e){return Pt(e)?e:new Oe(e).saturate(.5).darken(.1).hexString()}var Lt=[`x`,`y`,`borderWidth`,`radius`,`tension`],Rt=[`color`,`borderColor`,`backgroundColor`];function zt(e){e.set(`animation`,{delay:void 0,duration:1e3,easing:`easeOutQuart`,fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe(`animation`,{_fallback:!1,_indexable:!1,_scriptable:e=>e!==`onProgress`&&e!==`onComplete`&&e!==`fn`}),e.set(`animations`,{colors:{type:`color`,properties:Rt},numbers:{type:`number`,properties:Lt}}),e.describe(`animations`,{_fallback:`animation`}),e.set(`transitions`,{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:`transparent`},visible:{type:`boolean`,duration:0}}},hide:{animations:{colors:{to:`transparent`},visible:{type:`boolean`,easing:`linear`,fn:e=>e|0}}}})}function Bt(e){e.set(`layout`,{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}var Vt=new Map;function Ht(e,t){t||={};let n=e+JSON.stringify(t),r=Vt.get(n);return r||(r=new Intl.NumberFormat(e,t),Vt.set(n,r)),r}function Ut(e,t,n){return Ht(t,n).format(e)}var Wt={values(e){return A(e)?e:``+e},numeric(e,t,n){if(e===0)return`0`;let r=this.chart.options.locale,i,a=e;if(n.length>1){let t=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(t<1e-4||t>0x38d7ea4c68000)&&(i=`scientific`),a=Gt(e,n)}let o=et(Math.abs(a)),s=isNaN(o)?1:Math.max(Math.min(-1*Math.floor(o),20),0),c={notation:i,minimumFractionDigits:s,maximumFractionDigits:s};return Object.assign(c,this.options.ticks.format),Ut(e,r,c)},logarithmic(e,t,n){if(e===0)return`0`;let r=n[t].significand||e/10**Math.floor(et(e));return[1,2,3,5,10,15].includes(r)||t>.8*n.length?Wt.numeric.call(this,e,t,n):``}};function Gt(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var Kt={formatters:Wt};function qt(e){e.set(`scale`,{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:`ticks`,clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(e,t)=>t.lineWidth,tickColor:(e,t)=>t.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:``,padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:``,padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Kt.formatters.values,minor:{},major:{},align:`center`,crossAlign:`near`,showLabelBackdrop:!1,backdropColor:`rgba(255, 255, 255, 0.75)`,backdropPadding:2}}),e.route(`scale.ticks`,`color`,``,`color`),e.route(`scale.grid`,`color`,``,`borderColor`),e.route(`scale.border`,`color`,``,`borderColor`),e.route(`scale.title`,`color`,``,`color`),e.describe(`scale`,{_fallback:!1,_scriptable:e=>!e.startsWith(`before`)&&!e.startsWith(`after`)&&e!==`callback`&&e!==`parser`,_indexable:e=>e!==`borderDash`&&e!==`tickBorderDash`&&e!==`dash`}),e.describe(`scales`,{_fallback:`scale`}),e.describe(`scale.ticks`,{_scriptable:e=>e!==`backdropPadding`&&e!==`callback`,_indexable:e=>e!==`backdropPadding`})}var Jt=Object.create(null),Yt=Object.create(null);function Xt(e,t){if(!t)return e;let n=t.split(`.`);for(let t=0,r=n.length;te.chart.platform.getDevicePixelRatio(),this.elements={},this.events=[`mousemove`,`mouseout`,`click`,`touchstart`,`touchmove`],this.font={family:`'Helvetica Neue', 'Helvetica', 'Arial', sans-serif`,size:12,style:`normal`,lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(e,t)=>It(t.backgroundColor),this.hoverBorderColor=(e,t)=>It(t.borderColor),this.hoverColor=(e,t)=>It(t.color),this.indexAxis=`x`,this.interaction={mode:`nearest`,intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(e),this.apply(t)}set(e,t){return Zt(this,e,t)}get(e){return Xt(this,e)}describe(e,t){return Zt(Yt,e,t)}override(e,t){return Zt(Jt,e,t)}route(e,t,n,r){let i=Xt(this,e),a=Xt(this,n),o=`_`+t;Object.defineProperties(i,{[o]:{value:i[t],writable:!0},[t]:{enumerable:!0,get(){let e=this[o],t=a[r];return j(e)?Object.assign({},t,e):P(e,t)},set(e){this[o]=e}}})}apply(e){e.forEach(e=>e(this))}}({_scriptable:e=>!e.startsWith(`on`),_indexable:e=>e!==`events`,hover:{_fallback:`interaction`},interaction:{_scriptable:!1,_indexable:!1}},[zt,Bt,qt]);function Qt(e){return!e||k(e.size)||k(e.family)?null:(e.style?e.style+` `:``)+(e.weight?e.weight+` `:``)+e.size+`px `+e.family}function $t(e,t,n,r,i){let a=t[i];return a||(a=t[i]=e.measureText(i).width,n.push(i)),a>r&&(r=a),r}function en(e,t,n,r){r||={};let i=r.data=r.data||{},a=r.garbageCollect=r.garbageCollect||[];r.font!==t&&(i=r.data={},a=r.garbageCollect=[],r.font=t),e.save(),e.font=t;let o=0,s=n.length,c,l,u,d,f;for(c=0;cn.length){for(c=0;c0&&e.stroke()}}function on(e,t,n){return n||=.5,!t||e&&e.x>t.left-n&&e.xt.top-n&&e.y0&&a.strokeColor!==``,c,l;for(e.save(),e.font=i.string,dn(e,a),c=0;c+e||0;function bn(e,t){let n={},r=j(t),i=r?Object.keys(t):t,a=j(e)?r?n=>P(e[n],e[t[n]]):t=>e[t]:()=>e;for(let e of i)n[e]=yn(a(e));return n}function xn(e){return bn(e,{top:`y`,right:`x`,bottom:`y`,left:`x`})}function Sn(e){return bn(e,[`topLeft`,`topRight`,`bottomLeft`,`bottomRight`])}function q(e){let t=xn(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function J(e,t){e||={},t||=K.font;let n=P(e.size,t.size);typeof n==`string`&&(n=parseInt(n,10));let r=P(e.style,t.style);r&&!(``+r).match(_n)&&(console.warn(`Invalid font style specified: "`+r+`"`),r=void 0);let i={family:P(e.family,t.family),lineHeight:vn(P(e.lineHeight,t.lineHeight),n),size:n,style:r,weight:P(e.weight,t.weight),string:``};return i.string=Qt(i),i}function Cn(e,t,n,r){let i=!0,a,o,s;for(a=0,o=e.length;an&&e===0?0:e+t;return{min:o(r,-Math.abs(a)),max:o(i,a)}}function Tn(e,t){return Object.assign(Object.create(e),t)}function En(e,t=[``],n,r,i=()=>e[0]){let a=n||e;return r===void 0&&(r=Hn(`_fallback`,e)),new Proxy({[Symbol.toStringTag]:`Object`,_cacheable:!0,_scopes:e,_rootScopes:a,_fallback:r,_getTarget:i,override:n=>En([n,...e],t,a,r)},{deleteProperty(t,n){return delete t[n],delete t._keys,delete e[0][n],!0},get(n,r){return jn(n,r,()=>Vn(r,t,e,n))},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e._scopes[0],t)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(e,t){return Un(e).includes(t)},ownKeys(e){return Un(e)},set(e,t,n){let r=e._storage||=i();return e[t]=r[t]=n,delete e._keys,!0}})}function Dn(e,t,n,r){let i={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:On(e,r),setContext:t=>Dn(e,t,n,r),override:i=>Dn(e.override(i),t,n,r)};return new Proxy(i,{deleteProperty(t,n){return delete t[n],delete e[n],!0},get(e,t,n){return jn(e,t,()=>Mn(e,t,n))},getOwnPropertyDescriptor(t,n){return t._descriptors.allKeys?Reflect.has(e,n)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,n)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(t,n){return Reflect.has(e,n)},ownKeys(){return Reflect.ownKeys(e)},set(t,n,r){return e[n]=r,delete t[n],!0}})}function On(e,t={scriptable:!0,indexable:!0}){let{_scriptable:n=t.scriptable,_indexable:r=t.indexable,_allKeys:i=t.allKeys}=e;return{allKeys:i,scriptable:n,indexable:r,isScriptable:Ke(n)?n:()=>n,isIndexable:Ke(r)?r:()=>r}}var kn=(e,t)=>e?e+We(t):t,An=(e,t)=>j(t)&&e!==`adapters`&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function jn(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t===`constructor`)return e[t];let r=n();return e[t]=r,r}function Mn(e,t,n){let{_proxy:r,_context:i,_subProxy:a,_descriptors:o}=e,s=r[t];return Ke(s)&&o.isScriptable(t)&&(s=Nn(t,s,e,n)),A(s)&&s.length&&(s=Pn(t,s,e,o.isIndexable)),An(t,s)&&(s=Dn(s,i,a&&a[t],o)),s}function Nn(e,t,n,r){let{_proxy:i,_context:a,_subProxy:o,_stack:s}=n;if(s.has(e))throw Error(`Recursion detected: `+Array.from(s).join(`->`)+`->`+e);s.add(e);let c=t(a,o||r);return s.delete(e),An(e,c)&&(c=Rn(i._scopes,i,e,c)),c}function Pn(e,t,n,r){let{_proxy:i,_context:a,_subProxy:o,_descriptors:s}=n;if(a.index!==void 0&&r(e))return t[a.index%t.length];if(j(t[0])){let n=t,r=i._scopes.filter(e=>e!==n);t=[];for(let c of n){let n=Rn(r,i,e,c);t.push(Dn(n,a,o&&o[e],s))}}return t}function Fn(e,t,n){return Ke(e)?e(t,n):e}var In=(e,t)=>e===!0?t:typeof e==`string`?Ue(t,e):void 0;function Ln(e,t,n,r,i){for(let a of t){let t=In(n,a);if(t){e.add(t);let a=Fn(t._fallback,n,i);if(a!==void 0&&a!==n&&a!==r)return a}else if(t===!1&&r!==void 0&&n!==r)return null}return!1}function Rn(e,t,n,r){let i=t._rootScopes,a=Fn(t._fallback,n,r),o=[...e,...i],s=new Set;s.add(r);let c=zn(s,o,n,a||n,r);return c===null||a!==void 0&&a!==n&&(c=zn(s,o,a,c,r),c===null)?!1:En(Array.from(s),[``],i,a,()=>Bn(t,n,r))}function zn(e,t,n,r,i){for(;n;)n=Ln(e,t,n,r,i);return n}function Bn(e,t,n){let r=e._getTarget();t in r||(r[t]={});let i=r[t];return A(i)&&j(n)?n:i||{}}function Vn(e,t,n,r){let i;for(let a of t)if(i=Hn(kn(a,e),n),i!==void 0)return An(e,i)?Rn(n,r,e,i):i}function Hn(e,t){for(let n of t){if(!n)continue;let t=n[e];if(t!==void 0)return t}}function Un(e){let t=e._keys;return t||=e._keys=Wn(e._scopes),t}function Wn(e){let t=new Set;for(let n of e)for(let e of Object.keys(n).filter(e=>!e.startsWith(`_`)))t.add(e);return Array.from(t)}var Gn=2**-52||1e-14,Kn=(e,t)=>te===`x`?`y`:`x`;function Jn(e,t,n,r){let i=e.skip?t:e,a=t,o=n.skip?t:n,s=dt(a,i),c=dt(o,a),l=s/(s+c),u=c/(s+c);l=isNaN(l)?0:l,u=isNaN(u)?0:u;let d=r*l,f=r*u;return{previous:{x:a.x-d*(o.x-i.x),y:a.y-d*(o.y-i.y)},next:{x:a.x+f*(o.x-i.x),y:a.y+f*(o.y-i.y)}}}function Yn(e,t,n){let r=e.length,i,a,o,s,c,l=Kn(e,0);for(let u=0;u!e.skip)),t.cubicInterpolationMode===`monotone`)Zn(e,i);else{let n=r?e[e.length-1]:e[0];for(a=0,o=e.length;ae.ownerDocument.defaultView.getComputedStyle(e,null);function ar(e,t){return ir(e).getPropertyValue(t)}var or=[`top`,`right`,`bottom`,`left`];function sr(e,t,n){let r={};n=n?`-`+n:``;for(let i=0;i<4;i++){let a=or[i];r[a]=parseFloat(e[t+`-`+a+n])||0}return r.width=r.left+r.right,r.height=r.top+r.bottom,r}var cr=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function lr(e,t){let n=e.touches,r=n&&n.length?n[0]:e,{offsetX:i,offsetY:a}=r,o=!1,s,c;if(cr(i,a,e.target))s=i,c=a;else{let e=t.getBoundingClientRect();s=r.clientX-e.left,c=r.clientY-e.top,o=!0}return{x:s,y:c,box:o}}function ur(e,t){if(`native`in e)return e;let{canvas:n,currentDevicePixelRatio:r}=t,i=ir(n),a=i.boxSizing===`border-box`,o=sr(i,`padding`),s=sr(i,`border`,`width`),{x:c,y:l,box:u}=lr(e,n),d=o.left+(u&&s.left),f=o.top+(u&&s.top),{width:p,height:m}=t;return a&&(p-=o.width+s.width,m-=o.height+s.height),{x:Math.round((c-d)/p*n.width/r),y:Math.round((l-f)/m*n.height/r)}}function dr(e,t,n){let r,i;if(t===void 0||n===void 0){let a=e&&nr(e);if(!a)t=e.clientWidth,n=e.clientHeight;else{let e=a.getBoundingClientRect(),o=ir(a),s=sr(o,`border`,`width`),c=sr(o,`padding`);t=e.width-c.width-s.width,n=e.height-c.height-s.height,r=rr(o.maxWidth,a,`clientWidth`),i=rr(o.maxHeight,a,`clientHeight`)}}return{width:t,height:n,maxWidth:r||Xe,maxHeight:i||Xe}}var fr=e=>Math.round(e*10)/10;function pr(e,t,n,r){let i=ir(e),a=sr(i,`margin`),o=rr(i.maxWidth,e,`clientWidth`)||Xe,s=rr(i.maxHeight,e,`clientHeight`)||Xe,c=dr(e,t,n),{width:l,height:u}=c;if(i.boxSizing===`content-box`){let e=sr(i,`border`,`width`),t=sr(i,`padding`);l-=t.width+e.width,u-=t.height+e.height}return l=Math.max(0,l-a.width),u=Math.max(0,r?l/r:u-a.height),l=fr(Math.min(l,o,c.maxWidth)),u=fr(Math.min(u,s,c.maxHeight)),l&&!u&&(u=fr(l/2)),(t!==void 0||n!==void 0)&&r&&c.height&&u>c.height&&(u=c.height,l=fr(Math.floor(u*r))),{width:l,height:u}}function mr(e,t,n){let r=t||1,i=fr(e.height*r),a=fr(e.width*r);e.height=fr(e.height),e.width=fr(e.width);let o=e.canvas;return o.style&&(n||!o.style.height&&!o.style.width)&&(o.style.height=`${e.height}px`,o.style.width=`${e.width}px`),e.currentDevicePixelRatio!==r||o.height!==i||o.width!==a?(e.currentDevicePixelRatio=r,o.height=i,o.width=a,e.ctx.setTransform(r,0,0,r,0,0),!0):!1}var hr=function(){let e=!1;try{let t={get passive(){return e=!0,!1}};tr()&&(window.addEventListener(`test`,null,t),window.removeEventListener(`test`,null,t))}catch{}return e}();function gr(e,t){let n=ar(e,t),r=n&&n.match(/^(\d+)(\.\d+)?px$/);return r?+r[1]:void 0}function _r(e,t,n,r){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function vr(e,t,n,r){return{x:e.x+n*(t.x-e.x),y:r===`middle`?n<.5?e.y:t.y:r===`after`?n<1?e.y:t.y:n>0?t.y:e.y}}function yr(e,t,n,r){let i={x:e.cp2x,y:e.cp2y},a={x:t.cp1x,y:t.cp1y},o=_r(e,i,n),s=_r(i,a,n),c=_r(a,t,n);return _r(_r(o,s,n),_r(s,c,n),n)}var br=function(e,t){return{x(n){return e+e+t-n},setWidth(e){t=e},textAlign(e){return e===`center`?e:e===`right`?`left`:`right`},xPlus(e,t){return e-t},leftForLtr(e,t){return e-t}}},xr=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function Sr(e,t,n){return e?br(t,n):xr()}function Cr(e,t){let n,r;(t===`ltr`||t===`rtl`)&&(n=e.canvas.style,r=[n.getPropertyValue(`direction`),n.getPropertyPriority(`direction`)],n.setProperty(`direction`,t,`important`),e.prevTextDirection=r)}function wr(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty(`direction`,t[0],t[1]))}function Tr(e){return e===`angle`?{between:pt,compare:ft,normalize:H}:{between:W,compare:(e,t)=>e-t,normalize:e=>e}}function Er({start:e,end:t,count:n,loop:r,style:i}){return{start:e%n,end:t%n,loop:r&&(t-e+1)%n===0,style:i}}function Dr(e,t,n){let{property:r,start:i,end:a}=n,{between:o,normalize:s}=Tr(r),c=t.length,{start:l,end:u,loop:d}=e,f,p;if(d){for(l+=c,u+=c,f=0,p=c;fc(i,y,_)&&s(i,y)!==0,x=()=>s(a,_)===0||c(a,y,_),S=()=>h||b(),C=()=>!h||x();for(let e=u,n=u;e<=d;++e)v=t[e%o],!v.skip&&(_=l(v[r]),_!==y&&(h=c(_,i,a),g===null&&S()&&(g=s(_,i)===0?e:n),g!==null&&C()&&(m.push(Er({start:g,end:e,loop:f,count:o,style:p})),g=null),n=e,y=_));return g!==null&&m.push(Er({start:g,end:d,loop:f,count:o,style:p})),m}function kr(e,t){let n=[],r=e.segments;for(let i=0;ii&&e[a%t].skip;)a--;return a%=t,{start:i,end:a}}function jr(e,t,n,r){let i=e.length,a=[],o=t,s=e[t],c;for(c=t+1;c<=n;++c){let n=e[c%i];n.skip||n.stop?s.skip||(r=!1,a.push({start:t%i,end:(c-1)%i,loop:r}),t=o=n.stop?c:null):(o=c,s.skip&&(t=c)),s=n}return o!==null&&a.push({start:t%i,end:o%i,loop:r}),a}function Mr(e,t){let n=e.points,r=e.options.spanGaps,i=n.length;if(!i)return[];let a=!!e._loop,{start:o,end:s}=Ar(n,i,a,r);return r===!0?Nr(e,[{start:o,end:s,loop:a}],n,t):Nr(e,jr(n,o,sr({chart:e,initial:t.initial,numSteps:a,currentStep:Math.min(n-t.start,a)}))}_refresh(){this._request||=(this._running=!0,Ct.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let t=0;this._charts.forEach((n,r)=>{if(!n.running||!n.items.length)return;let i=n.items,a=i.length-1,o=!1,s;for(;a>=0;--a)s=i[a],s._active?(s._total>n.duration&&(n.duration=s._total),s.tick(e),o=!0):(i[a]=i[i.length-1],i.pop());o&&(r.draw(),this._notify(r,n,e,`progress`)),i.length||(n.running=!1,this._notify(r,n,e,`complete`),n.initial=!1),t+=i.length}),this._lastDate=e,t===0&&(this._running=!1)}_getAnims(e){let t=this._charts,n=t.get(e);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,n)),n}listen(e,t,n){this._getAnims(e).listeners[t].push(n)}add(e,t){!t||!t.length||this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){let t=this._charts.get(e);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((e,t)=>Math.max(e,t._duration),0),this._refresh())}running(e){if(!this._running)return!1;let t=this._charts.get(e);return!(!t||!t.running||!t.items.length)}stop(e){let t=this._charts.get(e);if(!t||!t.items.length)return;let n=t.items,r=n.length-1;for(;r>=0;--r)n[r].cancel();t.items=[],this._notify(e,t,Date.now(),`complete`)}remove(e){return this._charts.delete(e)}},Vr=`transparent`,Hr={boolean(e,t,n){return n>.5?t:e},color(e,t,n){let r=Ft(e||Vr),i=r.valid&&Ft(t||Vr);return i&&i.valid?i.mix(r,n).hexString():t},number(e,t,n){return e+(t-e)*n}},Ur=class{constructor(e,t,n,r){let i=t[n];r=Cn([e.to,r,i,e.from]);let a=Cn([e.from,i,r]);this._active=!0,this._fn=e.fn||Hr[e.type||typeof a],this._easing=Nt[e.easing]||Nt.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=n,this._from=a,this._to=r,this._promises=void 0}active(){return this._active}update(e,t,n){if(this._active){this._notify(!1);let r=this._target[this._prop],i=n-this._start,a=this._duration-i;this._start=n,this._duration=Math.floor(Math.max(a,e.duration)),this._total+=i,this._loop=!!e.loop,this._to=Cn([e.to,t,r,e.from]),this._from=Cn([e.from,r,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){let t=e-this._start,n=this._duration,r=this._prop,i=this._from,a=this._loop,o=this._to,s;if(this._active=i!==o&&(a||t1?2-s:s,s=this._easing(Math.min(1,Math.max(0,s))),this._target[r]=this._fn(i,o,s)}wait(){let e=this._promises||=[];return new Promise((t,n)=>{e.push({res:t,rej:n})})}_notify(e){let t=e?`res`:`rej`,n=this._promises||[];for(let e=0;e{let i=e[r];if(!j(i))return;let a={};for(let e of t)a[e]=i[e];(A(i.properties)&&i.properties||[r]).forEach(e=>{(e===r||!n.has(e))&&n.set(e,a)})})}_animateOptions(e,t){let n=t.options,r=Kr(e,n);if(!r)return[];let i=this._createAnimations(r,n);return n.$shared&&Gr(e.options.$animations,n).then(()=>{e.options=n},()=>{}),i}_createAnimations(e,t){let n=this._properties,r=[],i=e.$animations||={},a=Object.keys(t),o=Date.now(),s;for(s=a.length-1;s>=0;--s){let c=a[s];if(c.charAt(0)===`$`)continue;if(c===`options`){r.push(...this._animateOptions(e,t));continue}let l=t[c],u=i[c],d=n.get(c);if(u)if(d&&u.active()){u.update(d,l,o);continue}else u.cancel();if(!d||!d.duration){e[c]=l;continue}i[c]=u=new Ur(d,e,c,l),r.push(u)}return r}update(e,t){if(this._properties.size===0){Object.assign(e,t);return}let n=this._createAnimations(e,t);if(n.length)return Br.add(this._chart,n),!0}};function Gr(e,t){let n=[],r=Object.keys(t);for(let t=0;t0||!n&&t<0)return i.index}return null}function ii(e,t){let{chart:n,_cachedMeta:r}=e,i=n._stacks||={},{iScale:a,vScale:o,index:s}=r,c=a.axis,l=o.axis,u=ei(a,o,r),d=t.length,f;for(let e=0;en[e].axis===t).shift()}function oi(e,t){return Tn(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:`default`,type:`dataset`})}function si(e,t,n){return Tn(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:`default`,type:`data`})}function ci(e,t){let n=e.controller.index,r=e.vScale&&e.vScale.axis;if(r){t||=e._parsed;for(let e of t){let t=e._stacks;if(!t||t[r]===void 0||t[r][n]===void 0)return;delete t[r][n],t[r]._visualValues!==void 0&&t[r]._visualValues[n]!==void 0&&delete t[r]._visualValues[n]}}}var li=e=>e===`reset`||e===`none`,ui=(e,t)=>t?e:Object.assign({},e),di=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:Xr(n,!0),values:null},fi=class{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(e,t){this.chart=e,this._ctx=e.ctx,this.index=t,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){let e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=$r(e.vScale,e),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled(`filler`)&&console.warn(`Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options`)}updateIndex(e){this.index!==e&&ci(this._cachedMeta),this.index=e}linkScales(){let e=this.chart,t=this._cachedMeta,n=this.getDataset(),r=(e,t,n,r)=>e===`x`?t:e===`r`?r:n,i=t.xAxisID=P(n.xAxisID,ai(e,`x`)),a=t.yAxisID=P(n.yAxisID,ai(e,`y`)),o=t.rAxisID=P(n.rAxisID,ai(e,`r`)),s=t.indexAxis,c=t.iAxisID=r(s,i,a,o),l=t.vAxisID=r(s,a,i,o);t.xScale=this.getScaleForId(i),t.yScale=this.getScaleForId(a),t.rScale=this.getScaleForId(o),t.iScale=this.getScaleForId(c),t.vScale=this.getScaleForId(l)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){let t=this._cachedMeta;return e===t.iScale?t.vScale:t.iScale}reset(){this._update(`reset`)}_destroy(){let e=this._cachedMeta;this._data&&xt(this._data,this),e._stacked&&ci(e)}_dataCheck(){let e=this.getDataset(),t=e.data||=[],n=this._data;if(j(t)){let e=this._cachedMeta;this._data=Qr(t,e)}else if(n!==t){if(n){xt(n,this);let e=this._cachedMeta;ci(e),e._parsed=[]}t&&Object.isExtensible(t)&&bt(t,this),this._syncList=[],this._data=t}}addElements(){let e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){let t=this._cachedMeta,n=this.getDataset(),r=!1;this._dataCheck();let i=t._stacked;t._stacked=$r(t.vScale,t),t.stack!==n.stack&&(r=!0,ci(t),t.stack=n.stack),this._resyncElements(e),(r||i!==t._stacked)&&(ii(this,t._parsed),t._stacked=$r(t.vScale,t))}configure(){let e=this.chart.config,t=e.datasetScopeKeys(this._type),n=e.getOptionScopes(this.getDataset(),t,!0);this.options=e.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,t){let{_cachedMeta:n,_data:r}=this,{iScale:i,_stacked:a}=n,o=i.axis,s=e===0&&t===r.length?!0:n._sorted,c=e>0&&n._parsed[e-1],l,u,d;if(this._parsing===!1)n._parsed=r,n._sorted=!0,d=r;else{d=A(r[e])?this.parseArrayData(n,r,e,t):j(r[e])?this.parseObjectData(n,r,e,t):this.parsePrimitiveData(n,r,e,t);let i=()=>u[o]===null||c&&u[o]t||u=0;--d)if(!p()){this.updateRangeFromParsed(c,e,f,s);break}}return c}getAllParsedValues(e){let t=this._cachedMeta._parsed,n=[],r,i,a;for(r=0,i=t.length;r=0&&ethis.getContext(n,r,t),u);return p.$shared&&(p.$shared=s,i[a]=Object.freeze(ui(p,s))),p}_resolveAnimations(e,t,n){let r=this.chart,i=this._cachedDataOpts,a=`animation-${t}`,o=i[a];if(o)return o;let s;if(r.options.animation!==!1){let r=this.chart.config,i=r.datasetAnimationScopeKeys(this._type,t),a=r.getOptionScopes(this.getDataset(),i);s=r.createResolver(a,this.getContext(e,n,t))}let c=new Wr(r,s&&s.animations);return s&&s._cacheable&&(i[a]=Object.freeze(c)),c}getSharedOptions(e){if(e.$shared)return this._sharedOptions||=Object.assign({},e)}includeOptions(e,t){return!t||li(e)||this.chart._animationsDisabled}_getSharedOptions(e,t){let n=this.resolveDataElementOptions(e,t),r=this._sharedOptions,i=this.getSharedOptions(n),a=this.includeOptions(t,i)||i!==r;return this.updateSharedOptions(i,t,n),{sharedOptions:i,includeOptions:a}}updateElement(e,t,n,r){li(r)?Object.assign(e,n):this._resolveAnimations(t,r).update(e,n)}updateSharedOptions(e,t,n){e&&!li(t)&&this._resolveAnimations(void 0,t).update(e,n)}_setStyle(e,t,n,r){e.active=r;let i=this.getStyle(t,r);this._resolveAnimations(t,n,r).update(e,{options:!r&&this.getSharedOptions(i)||i})}removeHoverStyle(e,t,n){this._setStyle(e,n,`active`,!1)}setHoverStyle(e,t,n){this._setStyle(e,n,`active`,!0)}_removeDatasetHoverStyle(){let e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,`active`,!1)}_setDatasetHoverStyle(){let e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,`active`,!0)}_resyncElements(e){let t=this._data,n=this._cachedMeta.data;for(let[e,t,n]of this._syncList)this[e](t,n);this._syncList=[];let r=n.length,i=t.length,a=Math.min(i,r);a&&this.parse(0,a),i>r?this._insertElements(r,i-r,e):i{for(e.length+=t,o=e.length-1;o>=a;o--)e[o]=e[o-t]};for(s(i),o=e;oe-t))}return e._cache.$bar}function mi(e){let t=e.iScale,n=pi(t,e.type),r=t._length,i,a,o,s,c=()=>{o===32767||o===-32768||(Ge(s)&&(r=Math.min(r,Math.abs(o-s)||r)),s=o)};for(i=0,a=n.length;i0?i[e-1]:null,s=eMath.abs(s)&&(c=s,l=o),t[n.axis]=l,t._custom={barStart:c,barEnd:l,start:i,end:a,min:o,max:s}}function vi(e,t,n,r){return A(e)?_i(e,t,n,r):t[n.axis]=n.parse(e,r),t}function yi(e,t,n,r){let i=e.iScale,a=e.vScale,o=i.getLabels(),s=i===a,c=[],l,u,d,f;for(l=n,u=n+r;l=n?1:-1):B(e)}function Si(e){let t,n,r,i,a;return e.horizontal?(t=e.base>e.x,n=`left`,r=`right`):(t=e.basee.controller.options.grouped),i=n.options.stacked,a=[],o=this._cachedMeta.controller.getParsed(t),s=o&&o[n.axis],c=e=>{let t=e._parsed.find(e=>e[n.axis]===s),r=t&&t[e.vScale.axis];if(k(r)||isNaN(r))return!0};for(let n of r)if(!(t!==void 0&&c(n))&&((i===!1||a.indexOf(n.stack)===-1||i===void 0&&n.stack===void 0)&&a.push(n.stack),n.index===e))break;return a.length||a.push(void 0),a}_getStackCount(e){return this._getStacks(void 0,e).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let e=this.chart.scales,t=this.chart.options.indexAxis;return Object.keys(e).filter(n=>e[n].axis===t).shift()}_getAxis(){let e={},t=this.getFirstScaleIdForIndexAxis();for(let n of this.chart.data.datasets)e[P(this.chart.options.indexAxis===`x`?n.xAxisID:n.yAxisID,t)]=!0;return Object.keys(e)}_getStackIndex(e,t,n){let r=this._getStacks(e,n),i=t===void 0?-1:r.indexOf(t);return i===-1?r.length-1:i}_getRuler(){let e=this.options,t=this._cachedMeta,n=t.iScale,r=[],i,a;for(i=0,a=t.data.length;ipt(e,s,c,!0)?1:Math.max(t,t*n,r,r*n),m=(e,t,r)=>pt(e,s,c,!0)?-1:Math.min(t,t*n,r,r*n),h=p(0,l,d),g=p(z,u,f),_=m(L,l,d),v=m(L+z,u,f);r=(h-_)/2,i=(g-v)/2,a=-(h+_)/2,o=-(g+v)/2}return{ratioX:r,ratioY:i,offsetX:a,offsetY:o}}var Ai=class extends fi{static id=`doughnut`;static defaults={datasetElementType:!1,dataElementType:`arc`,animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:`number`,properties:[`circumference`,`endAngle`,`innerRadius`,`outerRadius`,`startAngle`,`x`,`y`,`offset`,`borderWidth`,`spacing`]}},cutout:`50%`,rotation:0,circumference:360,radius:`100%`,spacing:0,indexAxis:`r`};static descriptors={_scriptable:e=>e!==`spacing`,_indexable:e=>e!==`spacing`&&!e.startsWith(`borderDash`)&&!e.startsWith(`hoverBorderDash`)};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){let t=e.data,{labels:{pointStyle:n,textAlign:r,color:i,useBorderRadius:a,borderRadius:o}}=e.legend.options;return t.labels.length&&t.datasets.length?t.labels.map((t,s)=>{let c=e.getDatasetMeta(0).controller.getStyle(s);return{text:t,fillStyle:c.backgroundColor,fontColor:i,hidden:!e.getDataVisibility(s),lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:c.borderWidth,strokeStyle:c.borderColor,textAlign:r,pointStyle:n,borderRadius:a&&(o||c.borderRadius),index:s}}):[]}},onClick(e,t,n){n.chart.toggleDataVisibility(t.index),n.chart.update()}}}};constructor(e,t){super(e,t),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,t){let n=this.getDataset().data,r=this._cachedMeta;if(this._parsing===!1)r._parsed=n;else{let i=e=>+n[e];if(j(n[e])){let{key:e=`value`}=this._parsing;i=t=>+Ue(n[t],e)}let a,o;for(a=e,o=e+t;a0&&!isNaN(e)?Math.abs(e)/t*R:0}getLabelAndValue(e){let t=this._cachedMeta,n=this.chart,r=n.data.labels||[],i=Ut(t._parsed[e],n.options.locale);return{label:r[e]||``,value:i}}getMaxBorderWidth(e){let t=0,n=this.chart,r,i,a,o,s;if(!e){for(r=0,i=n.data.datasets.length;r0&&this.getParsed(t-1);for(let n=0;n=_){v.skip=!0;continue}let b=this.getParsed(n),x=k(b[f]),S=v[d]=a.getPixelForValue(b[d],n),C=v[f]=i||x?o.getBasePixel():o.getPixelForValue(s?this.applyStack(o,b,s):b[f],n);v.skip=isNaN(S)||isNaN(C)||x,v.stop=n>0&&Math.abs(b[d]-y[d])>h,m&&(v.parsed=b,v.raw=c.data[n]),u&&(v.options=l||this.resolveDataElementOptions(n,p.active?`active`:r)),g||this.updateElement(p,n,v,r),y=b}}getMaxOverflow(){let e=this._cachedMeta,t=e.dataset,n=t.options&&t.options.borderWidth||0,r=e.data||[];if(!r.length)return n;let i=r[0].size(this.resolveDataElementOptions(0)),a=r[r.length-1].size(this.resolveDataElementOptions(r.length-1));return Math.max(n,i,a)/2}draw(){let e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}},Mi=class extends fi{static id=`scatter`;static defaults={datasetElementType:!1,dataElementType:`point`,showLine:!1,fill:!1};static overrides={interaction:{mode:`point`},scales:{x:{type:`linear`},y:{type:`linear`}}};getLabelAndValue(e){let t=this._cachedMeta,n=this.chart.data.labels||[],{xScale:r,yScale:i}=t,a=this.getParsed(e),o=r.getLabelForValue(a.x),s=i.getLabelForValue(a.y);return{label:n[e]||``,value:`(`+o+`, `+s+`)`}}update(e){let t=this._cachedMeta,{data:n=[]}=t,r=this.chart._animationsDisabled,{start:i,count:a}=Ot(t,n,r);if(this._drawStart=i,this._drawCount=a,kt(t)&&(i=0,a=n.length),this.options.showLine){this.datasetElementType||this.addElements();let{dataset:i,_dataset:a}=t;i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!a._decimated,i.points=n;let o=this.resolveDatasetElementOptions(e);o.segment=this.options.segment,this.updateElement(i,void 0,{animated:!r,options:o},e)}else this.datasetElementType&&=(delete t.dataset,!1);this.updateElements(n,i,a,e)}addElements(){let{showLine:e}=this.options;!this.datasetElementType&&e&&(this.datasetElementType=this.chart.registry.getElement(`line`)),super.addElements()}updateElements(e,t,n,r){let i=r===`reset`,{iScale:a,vScale:o,_stacked:s,_dataset:c}=this._cachedMeta,l=this.resolveDataElementOptions(t,r),u=this.getSharedOptions(l),d=this.includeOptions(r,u),f=a.axis,p=o.axis,{spanGaps:m,segment:h}=this.options,g=at(m)?m:1/0,_=this.chart._animationsDisabled||i||r===`none`,v=t>0&&this.getParsed(t-1);for(let l=t;l0&&Math.abs(n[f]-v[f])>g,h&&(m.parsed=n,m.raw=c.data[l]),d&&(m.options=u||this.resolveDataElementOptions(l,t.active?`active`:r)),_||this.updateElement(t,l,m,r),v=n}this.updateSharedOptions(u,r,l)}getMaxOverflow(){let e=this._cachedMeta,t=e.data||[];if(!this.options.showLine){let e=0;for(let n=t.length-1;n>=0;--n)e=Math.max(e,t[n].size(this.resolveDataElementOptions(n))/2);return e>0&&e}let n=e.dataset,r=n.options&&n.options.borderWidth||0;if(!t.length)return r;let i=t[0].size(this.resolveDataElementOptions(0)),a=t[t.length-1].size(this.resolveDataElementOptions(t.length-1));return Math.max(r,i,a)/2}};function Ni(){throw Error(`This method is not implemented: Check that a complete date adapter is provided.`)}var Pi={_date:class e{static override(t){Object.assign(e.prototype,t)}options;constructor(e){this.options=e||{}}init(){}formats(){return Ni()}parse(){return Ni()}format(){return Ni()}add(){return Ni()}diff(){return Ni()}startOf(){return Ni()}endOf(){return Ni()}}};function Fi(e,t,n,r){let{controller:i,data:a,_sorted:o}=e,s=i._cachedMeta.iScale,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(s&&t===s.axis&&t!==`r`&&o&&a.length){let o=s._reversePixels?_t:gt;if(!r){let r=o(a,t,n);if(c){let{vScale:t}=i._cachedMeta,{_parsed:n}=e,a=n.slice(0,r.lo+1).reverse().findIndex(e=>!k(e[t.axis]));r.lo-=Math.max(0,a);let o=n.slice(r.hi).findIndex(e=>!k(e[t.axis]));r.hi+=Math.max(0,o)}return r}else if(i._sharedOptions){let e=a[0],r=typeof e.getRange==`function`&&e.getRange(t);if(r){let e=o(a,t,n-r),i=o(a,t,n+r);return{lo:e.lo,hi:i.hi}}}}return{lo:0,hi:a.length-1}}function Ii(e,t,n,r,i){let a=e.getSortedVisibleDatasetMetas(),o=n[t];for(let e=0,n=a.length;e{e[o]&&e[o](t[n],i)&&(a.push({element:e,datasetIndex:r,index:c}),s||=e.inRange(t.x,t.y,i))}),r&&!s?[]:a}var Ui={evaluateInteractionItems:Ii,modes:{index(e,t,n,r){let i=ur(t,e),a=n.axis||`x`,o=n.includeInvisible||!1,s=n.intersect?Ri(e,i,a,r,o):Vi(e,i,a,!1,r,o),c=[];return s.length?(e.getSortedVisibleDatasetMetas().forEach(e=>{let t=s[0].index,n=e.data[t];n&&!n.skip&&c.push({element:n,datasetIndex:e.index,index:t})}),c):[]},dataset(e,t,n,r){let i=ur(t,e),a=n.axis||`xy`,o=n.includeInvisible||!1,s=n.intersect?Ri(e,i,a,r,o):Vi(e,i,a,!1,r,o);if(s.length>0){let t=s[0].datasetIndex,n=e.getDatasetMeta(t).data;s=[];for(let e=0;ee.pos===t)}function Ki(e,t){return e.filter(e=>Wi.indexOf(e.pos)===-1&&e.box.axis===t)}function qi(e,t){return e.sort((e,n)=>{let r=t?n:e,i=t?e:n;return r.weight===i.weight?r.index-i.index:r.weight-i.weight})}function Ji(e){let t=[],n,r,i,a,o,s;for(n=0,r=(e||[]).length;ne.box.fullSize),!0),r=qi(Gi(t,`left`),!0),i=qi(Gi(t,`right`)),a=qi(Gi(t,`top`),!0),o=qi(Gi(t,`bottom`)),s=Ki(t,`x`),c=Ki(t,`y`);return{fullSize:n,leftAndTop:r.concat(a),rightAndBottom:i.concat(c).concat(o).concat(s),chartArea:Gi(t,`chartArea`),vertical:r.concat(i).concat(c),horizontal:a.concat(o).concat(s)}}function Qi(e,t,n,r){return Math.max(e[n],t[n])+Math.max(e[r],t[r])}function $i(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function ea(e,t,n,r){let{pos:i,box:a}=n,o=e.maxPadding;if(!j(i)){n.size&&(e[i]-=n.size);let t=r[n.stack]||{size:0,count:1};t.size=Math.max(t.size,n.horizontal?a.height:a.width),n.size=t.size/t.count,e[i]+=n.size}a.getPadding&&$i(o,a.getPadding());let s=Math.max(0,t.outerWidth-Qi(o,e,`left`,`right`)),c=Math.max(0,t.outerHeight-Qi(o,e,`top`,`bottom`)),l=s!==e.w,u=c!==e.h;return e.w=s,e.h=c,n.horizontal?{same:l,other:u}:{same:u,other:l}}function ta(e){let t=e.maxPadding;function n(n){let r=Math.max(t[n]-e[n],0);return e[n]+=r,r}e.y+=n(`top`),e.x+=n(`left`),n(`right`),n(`bottom`)}function na(e,t){let n=t.maxPadding;function r(e){let r={left:0,top:0,right:0,bottom:0};return e.forEach(e=>{r[e]=Math.max(t[e],n[e])}),r}return r(e?[`left`,`right`]:[`top`,`bottom`])}function ra(e,t,n,r){let i=[],a,o,s,c,l,u;for(a=0,o=e.length,l=0;a{typeof e.beforeLayout==`function`&&e.beforeLayout()});let u=c.reduce((e,t)=>t.box.options&&t.box.options.display===!1?e:e+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:n,padding:i,availableWidth:a,availableHeight:o,vBoxMaxWidth:a/2/u,hBoxMaxHeight:o/2}),f=Object.assign({},i);$i(f,q(r));let p=Object.assign({maxPadding:f,w:a,h:o,x:i.left,y:i.top},i),m=Xi(c.concat(l),d);ra(s.fullSize,p,d,m),ra(c,p,d,m),ra(l,p,d,m)&&ra(c,p,d,m),ta(p),aa(s.leftAndTop,p,d,m),p.x+=p.w,p.y+=p.h,aa(s.rightAndBottom,p,d,m),e.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},I(s.chartArea,t=>{let n=t.box;Object.assign(n,e.chartArea),n.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}},oa=class{acquireContext(e,t){}releaseContext(e){return!1}addEventListener(e,t,n){}removeEventListener(e,t,n){}getDevicePixelRatio(){return 1}getMaximumSize(e,t,n,r){return t=Math.max(0,t||e.width),n||=e.height,{width:t,height:Math.max(0,r?Math.floor(t/r):n)}}isAttached(e){return!0}updateConfig(e){}},sa=class extends oa{acquireContext(e){return e&&e.getContext&&e.getContext(`2d`)||null}updateConfig(e){e.options.animation=!1}},ca=`$chartjs`,la={touchstart:`mousedown`,touchmove:`mousemove`,touchend:`mouseup`,pointerenter:`mouseenter`,pointerdown:`mousedown`,pointermove:`mousemove`,pointerup:`mouseup`,pointerleave:`mouseout`,pointerout:`mouseout`},ua=e=>e===null||e===``;function da(e,t){let n=e.style,r=e.getAttribute(`height`),i=e.getAttribute(`width`);if(e[ca]={initial:{height:r,width:i,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||`block`,n.boxSizing=n.boxSizing||`border-box`,ua(i)){let t=gr(e,`width`);t!==void 0&&(e.width=t)}if(ua(r))if(e.style.height===``)e.height=e.width/(t||2);else{let t=gr(e,`height`);t!==void 0&&(e.height=t)}return e}var fa=hr?{passive:!0}:!1;function pa(e,t,n){e&&e.addEventListener(t,n,fa)}function ma(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,fa)}function ha(e,t){let n=la[e.type]||e.type,{x:r,y:i}=ur(e,t);return{type:n,chart:t,native:e,x:r===void 0?null:r,y:i===void 0?null:i}}function ga(e,t){for(let n of e)if(n===t||n.contains(t))return!0}function _a(e,t,n){let r=e.canvas,i=new MutationObserver(e=>{let t=!1;for(let n of e)t||=ga(n.addedNodes,r),t&&=!ga(n.removedNodes,r);t&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}function va(e,t,n){let r=e.canvas,i=new MutationObserver(e=>{let t=!1;for(let n of e)t||=ga(n.removedNodes,r),t&&=!ga(n.addedNodes,r);t&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}var ya=new Map,ba=0;function xa(){let e=window.devicePixelRatio;e!==ba&&(ba=e,ya.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function Sa(e,t){ya.size||window.addEventListener(`resize`,xa),ya.set(e,t)}function Ca(e){ya.delete(e),ya.size||window.removeEventListener(`resize`,xa)}function wa(e,t,n){let r=e.canvas,i=r&&nr(r);if(!i)return;let a=wt((e,t)=>{let r=i.clientWidth;n(e,t),r{let t=e[0],n=t.contentRect.width,r=t.contentRect.height;n===0&&r===0||a(n,r)});return o.observe(i),Sa(e,a),o}function Ta(e,t,n){n&&n.disconnect(),t===`resize`&&Ca(e)}function Ea(e,t,n){let r=e.canvas,i=wt(t=>{e.ctx!==null&&n(ha(t,e))},e);return pa(r,t,i),i}var Da=class extends oa{acquireContext(e,t){let n=e&&e.getContext&&e.getContext(`2d`);return n&&n.canvas===e?(da(e,t),n):null}releaseContext(e){let t=e.canvas;if(!t[ca])return!1;let n=t[ca].initial;[`height`,`width`].forEach(e=>{let r=n[e];k(r)?t.removeAttribute(e):t.setAttribute(e,r)});let r=n.style||{};return Object.keys(r).forEach(e=>{t.style[e]=r[e]}),t.width=t.width,delete t[ca],!0}addEventListener(e,t,n){this.removeEventListener(e,t);let r=e.$proxies||={};r[t]=({attach:_a,detach:va,resize:wa}[t]||Ea)(e,t,n)}removeEventListener(e,t){let n=e.$proxies||={},r=n[t];r&&(({attach:Ta,detach:Ta,resize:Ta}[t]||ma)(e,t,r),n[t]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,n,r){return pr(e,t,n,r)}isAttached(e){let t=e&&nr(e);return!!(t&&t.isConnected)}};function Oa(e){return!tr()||typeof OffscreenCanvas<`u`&&e instanceof OffscreenCanvas?sa:Da}var ka=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(e){let{x:t,y:n}=this.getProps([`x`,`y`],e);return{x:t,y:n}}hasValue(){return at(this.x)&&at(this.y)}getProps(e,t){let n=this.$animations;if(!t||!n)return this;let r={};return e.forEach(e=>{r[e]=n[e]&&n[e].active()?n[e]._to:this[e]}),r}};function Aa(e,t){let n=e.options.ticks,r=ja(e),i=Math.min(n.maxTicksLimit||r,r),a=n.major.enabled?Na(t):[],o=a.length,s=a[0],c=a[o-1],l=[];if(o>i)return Pa(t,l,a,o/i),l;let u=Ma(a,t,i);if(o>0){let e,n,r=o>1?Math.round((c-s)/(o-1)):null;for(Fa(t,l,u,k(r)?0:s-r,s),e=0,n=o-1;ei)return t}return Math.max(i,1)}function Na(e){let t=[],n,r;for(n=0,r=e.length;ne===`left`?`right`:e===`right`?`left`:e,Ra=(e,t,n)=>t===`top`||t===`left`?e[t]+n:e[t]-n,za=(e,t)=>Math.min(t||e,e);function Ba(e,t){let n=[],r=e.length/t,i=e.length,a=0;for(;ao+s)))return c}function Ha(e,t){I(e,e=>{let n=e.gc,r=n.length/2,i;if(r>t){for(i=0;in?n:t,n=r&&t>n?t:n,{min:N(t,N(n,t)),max:N(n,N(t,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||=this._computeLabelItems(e)}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){F(this.options.beforeUpdate,[this])}update(e,t,n){let{beginAtZero:r,grace:i,ticks:a}=this.options,o=a.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=t,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||=(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=wn(this,i,r),!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let s=o=i||n<=1||!this.isHorizontal()){this.labelRotation=r;return}let l=this._getLabelSizes(),u=l.widest.width,d=l.highest.height,f=U(this.chart.width-u,0,this.maxWidth);o=e.offset?this.maxWidth/n:f/(n-1),u+6>o&&(o=f/(n-(e.offset?.5:1)),s=this.maxHeight-Ua(e.grid)-t.padding-Wa(e.title,this.chart.options.font),c=Math.sqrt(u*u+d*d),a=ct(Math.min(Math.asin(U((l.highest.height+6)/o,-1,1)),Math.asin(U(s/c,-1,1))-Math.asin(U(d/c,-1,1)))),a=Math.max(r,Math.min(i,a))),this.labelRotation=a}afterCalculateLabelRotation(){F(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){F(this.options.beforeFit,[this])}fit(){let e={width:0,height:0},{chart:t,options:{ticks:n,title:r,grid:i}}=this,a=this._isVisible(),o=this.isHorizontal();if(a){let a=Wa(r,t.options.font);if(o?(e.width=this.maxWidth,e.height=Ua(i)+a):(e.height=this.maxHeight,e.width=Ua(i)+a),n.display&&this.ticks.length){let{first:t,last:r,widest:i,highest:a}=this._getLabelSizes(),s=n.padding*2,c=V(this.labelRotation),l=Math.cos(c),u=Math.sin(c);if(o){let t=n.mirror?0:u*i.width+l*a.height;e.height=Math.min(this.maxHeight,e.height+t+s)}else{let t=n.mirror?0:l*i.width+u*a.height;e.width=Math.min(this.maxWidth,e.width+t+s)}this._calculatePadding(t,r,u,l)}}this._handleMargins(),o?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,t,n,r){let{ticks:{align:i,padding:a},position:o}=this.options,s=this.labelRotation!==0,c=o!==`top`&&this.axis===`x`;if(this.isHorizontal()){let o=this.getPixelForTick(0)-this.left,l=this.right-this.getPixelForTick(this.ticks.length-1),u=0,d=0;s?c?(u=r*e.width,d=n*t.height):(u=n*e.height,d=r*t.width):i===`start`?d=t.width:i===`end`?u=e.width:i!==`inner`&&(u=e.width/2,d=t.width/2),this.paddingLeft=Math.max((u-o+a)*this.width/(this.width-o),0),this.paddingRight=Math.max((d-l+a)*this.width/(this.width-l),0)}else{let n=t.height/2,r=e.height/2;i===`start`?(n=0,r=e.height):i===`end`&&(n=t.height,r=0),this.paddingTop=n+a,this.paddingBottom=r+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){F(this.options.afterFit,[this])}isHorizontal(){let{axis:e,position:t}=this.options;return t===`top`||t===`bottom`||e===`x`}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let t,n;for(t=0,n=e.length;t({width:a[e]||0,height:o[e]||0});return{first:C(0),last:C(t-1),widest:C(x),highest:C(S),widths:a,heights:o}}getLabelForValue(e){return e}getPixelForValue(e,t){return NaN}getValueForPixel(e){}getPixelForTick(e){let t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);let t=this._startPixel+e*this._length;return mt(this._alignToPixels?tn(this.chart,t,0):t)}getDecimalForPixel(e){let t=(e-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:e,max:t}=this;return e<0&&t<0?t:e>0&&t>0?e:0}getContext(e){let t=this.ticks||[];if(e>=0&&eo*r?o/n:s/r:s*r0:!!e}_computeGridLineItems(e){let t=this.axis,n=this.chart,r=this.options,{grid:i,position:a,border:o}=r,s=i.offset,c=this.isHorizontal(),l=this.ticks.length+(s?1:0),u=Ua(i),d=[],f=o.setContext(this.getContext()),p=f.display?f.width:0,m=p/2,h=function(e){return tn(n,e,p)},g,_,v,y,b,x,S,C,w,T,E,D;if(a===`top`)g=h(this.bottom),x=this.bottom-u,C=g-m,T=h(e.top)+m,D=e.bottom;else if(a===`bottom`)g=h(this.top),T=e.top,D=h(e.bottom)-m,x=g+m,C=this.top+u;else if(a===`left`)g=h(this.right),b=this.right-u,S=g-m,w=h(e.left)+m,E=e.right;else if(a===`right`)g=h(this.left),w=e.left,E=h(e.right)-m,b=g+m,S=this.left+u;else if(t===`x`){if(a===`center`)g=h((e.top+e.bottom)/2+.5);else if(j(a)){let e=Object.keys(a)[0],t=a[e];g=h(this.chart.scales[e].getPixelForValue(t))}T=e.top,D=e.bottom,x=g+m,C=x+u}else if(t===`y`){if(a===`center`)g=h((e.left+e.right)/2);else if(j(a)){let e=Object.keys(a)[0],t=a[e];g=h(this.chart.scales[e].getPixelForValue(t))}b=g-m,S=b-u,w=e.left,E=e.right}let ee=P(r.ticks.maxTicksLimit,l),O=Math.max(1,Math.ceil(l/ee));for(_=0;_0&&(a-=r/2);break}f={left:a,top:i,width:r+t.width,height:n+t.height,color:e.backdropColor}}h.push({label:y,font:w,textOffset:D,options:{rotation:m,color:n,strokeColor:s,strokeWidth:l,textAlign:d,textBaseline:ee,translation:[b,x],backdrop:f}})}return h}_getXAxisLabelAlignment(){let{position:e,ticks:t}=this.options;if(-V(this.labelRotation))return e===`top`?`left`:`right`;let n=`center`;return t.align===`start`?n=`left`:t.align===`end`?n=`right`:t.align===`inner`&&(n=`inner`),n}_getYAxisLabelAlignment(e){let{position:t,ticks:{crossAlign:n,mirror:r,padding:i}}=this.options,a=this._getLabelSizes(),o=e+i,s=a.widest.width,c,l;return t===`left`?r?(l=this.right+i,n===`near`?c=`left`:n===`center`?(c=`center`,l+=s/2):(c=`right`,l+=s)):(l=this.right-o,n===`near`?c=`right`:n===`center`?(c=`center`,l-=s/2):(c=`left`,l=this.left)):t===`right`?r?(l=this.left+i,n===`near`?c=`right`:n===`center`?(c=`center`,l-=s/2):(c=`left`,l-=s)):(l=this.left+o,n===`near`?c=`left`:n===`center`?(c=`center`,l+=s/2):(c=`right`,l=this.right)):c=`right`,{textAlign:c,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;let e=this.chart,t=this.options.position;if(t===`left`||t===`right`)return{top:0,left:this.left,bottom:e.height,right:this.right};if(t===`top`||t===`bottom`)return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){let{ctx:e,options:{backgroundColor:t},left:n,top:r,width:i,height:a}=this;t&&(e.save(),e.fillStyle=t,e.fillRect(n,r,i,a),e.restore())}getLineWidthForValue(e){let t=this.options.grid;if(!this._isVisible()||!t.display)return 0;let n=this.ticks.findIndex(t=>t.value===e);return n>=0?t.setContext(this.getContext(n)).lineWidth:0}drawGrid(e){let t=this.options.grid,n=this.ctx,r=this._gridLineItems||=this._computeGridLineItems(e),i,a,o=(e,t,r)=>{!r.width||!r.color||(n.save(),n.lineWidth=r.width,n.strokeStyle=r.color,n.setLineDash(r.borderDash||[]),n.lineDashOffset=r.borderDashOffset,n.beginPath(),n.moveTo(e.x,e.y),n.lineTo(t.x,t.y),n.stroke(),n.restore())};if(t.display)for(i=0,a=r.length;i{this.draw(e)}}]:[{z:r,draw:e=>{this.drawBackground(),this.drawGrid(e),this.drawTitle()}},{z:i,draw:()=>{this.drawBorder()}},{z:n,draw:e=>{this.drawLabels(e)}}]}getMatchingVisibleMetas(e){let t=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+`AxisID`,r=[],i,a;for(i=0,a=t.length;i{let r=n.split(`.`),i=r.pop(),a=[e].concat(r).join(`.`),o=t[n].split(`.`),s=o.pop(),c=o.join(`.`);K.route(a,i,c,s)})}function $a(e){return`id`in e&&`defaults`in e}var X=new class{constructor(){this.controllers=new Xa(fi,`datasets`,!0),this.elements=new Xa(ka,`elements`),this.plugins=new Xa(Object,`plugins`),this.scales=new Xa(Ya,`scales`),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each(`register`,e)}remove(...e){this._each(`unregister`,e)}addControllers(...e){this._each(`register`,e,this.controllers)}addElements(...e){this._each(`register`,e,this.elements)}addPlugins(...e){this._each(`register`,e,this.plugins)}addScales(...e){this._each(`register`,e,this.scales)}getController(e){return this._get(e,this.controllers,`controller`)}getElement(e){return this._get(e,this.elements,`element`)}getPlugin(e){return this._get(e,this.plugins,`plugin`)}getScale(e){return this._get(e,this.scales,`scale`)}removeControllers(...e){this._each(`unregister`,e,this.controllers)}removeElements(...e){this._each(`unregister`,e,this.elements)}removePlugins(...e){this._each(`unregister`,e,this.plugins)}removeScales(...e){this._each(`unregister`,e,this.scales)}_each(e,t,n){[...t].forEach(t=>{let r=n||this._getRegistryForType(t);n||r.isForType(t)||r===this.plugins&&t.id?this._exec(e,r,t):I(t,t=>{let r=n||this._getRegistryForType(t);this._exec(e,r,t)})})}_exec(e,t,n){let r=We(e);F(n[`before`+r],[],n),t[e](n),F(n[`after`+r],[],n)}_getRegistryForType(e){for(let t=0;te.filter(e=>!t.some(t=>e.plugin.id===t.plugin.id));this._notify(r(t,n),e,`stop`),this._notify(r(n,t),e,`start`)}};function to(e){let t={},n=[],r=Object.keys(X.plugins.items);for(let e=0;e1&&co(e[0].toLowerCase());if(t)return t}throw Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function fo(e,t,n){if(n[t+`AxisID`]===e)return{axis:t}}function po(e,t){if(t.data&&t.data.datasets){let n=t.data.datasets.filter(t=>t.xAxisID===e||t.yAxisID===e);if(n.length)return fo(e,`x`,n[0])||fo(e,`y`,n[0])}return{}}function mo(e,t){let n=Jt[e.type]||{scales:{}},r=t.scales||{},i=ao(e.type,t),a=Object.create(null);return Object.keys(r).forEach(t=>{let o=r[t];if(!j(o))return console.error(`Invalid scale configuration for scale: ${t}`);if(o._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${t}`);let s=uo(t,o,po(t,e),K.scales[o.type]),c=so(s,i),l=n.scales||{};a[t]=Re(Object.create(null),[{axis:s},o,l[s],l[c]])}),e.data.datasets.forEach(n=>{let i=n.type||e.type,o=n.indexAxis||ao(i,t),s=(Jt[i]||{}).scales||{};Object.keys(s).forEach(e=>{let t=oo(e,o),i=n[t+`AxisID`]||t;a[i]=a[i]||Object.create(null),Re(a[i],[{axis:t},r[i],s[e]])})}),Object.keys(a).forEach(e=>{let t=a[e];Re(t,[K.scales[t.type],K.scale])}),a}function ho(e){let t=e.options||={};t.plugins=P(t.plugins,{}),t.scales=mo(e,t)}function go(e){return e||={},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function _o(e){return e||={},e.data=go(e.data),ho(e),e}var vo=new Map,yo=new Set;function bo(e,t){let n=vo.get(e);return n||(n=t(),vo.set(e,n),yo.add(n)),n}var xo=(e,t,n)=>{let r=Ue(t,n);r!==void 0&&e.add(r)},So=class{constructor(e){this._config=_o(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=go(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){let e=this._config;this.clearCache(),ho(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return bo(e,()=>[[`datasets.${e}`,``]])}datasetAnimationScopeKeys(e,t){return bo(`${e}.transition.${t}`,()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,``]])}datasetElementScopeKeys(e,t){return bo(`${e}-${t}`,()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,``]])}pluginScopeKeys(e){let t=e.id,n=this.type;return bo(`${n}-plugin-${t}`,()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,t){let n=this._scopeCache,r=n.get(e);return(!r||t)&&(r=new Map,n.set(e,r)),r}getOptionScopes(e,t,n){let{options:r,type:i}=this,a=this._cachedScopes(e,n),o=a.get(t);if(o)return o;let s=new Set;t.forEach(t=>{e&&(s.add(e),t.forEach(t=>xo(s,e,t))),t.forEach(e=>xo(s,r,e)),t.forEach(e=>xo(s,Jt[i]||{},e)),t.forEach(e=>xo(s,K,e)),t.forEach(e=>xo(s,Yt,e))});let c=Array.from(s);return c.length===0&&c.push(Object.create(null)),yo.has(t)&&a.set(t,c),c}chartOptionScopes(){let{options:e,type:t}=this;return[e,Jt[t]||{},K.datasets[t]||{},{type:t},K,Yt]}resolveNamedOptions(e,t,n,r=[``]){let i={$shared:!0},{resolver:a,subPrefixes:o}=Co(this._resolverCache,e,r),s=a;if(To(a,t)){i.$shared=!1,n=Ke(n)?n():n;let t=this.createResolver(e,n,o);s=Dn(a,n,t)}for(let e of t)i[e]=s[e];return i}createResolver(e,t,n=[``],r){let{resolver:i}=Co(this._resolverCache,e,n);return j(t)?Dn(i,t,void 0,r):i}};function Co(e,t,n){let r=e.get(t);r||(r=new Map,e.set(t,r));let i=n.join(),a=r.get(i);return a||(a={resolver:En(t,n),subPrefixes:n.filter(e=>!e.toLowerCase().includes(`hover`))},r.set(i,a)),a}var wo=e=>j(e)&&Object.getOwnPropertyNames(e).some(t=>Ke(e[t]));function To(e,t){let{isScriptable:n,isIndexable:r}=On(e);for(let i of t){let t=n(i),a=r(i),o=(a||t)&&e[i];if(t&&(Ke(o)||wo(o))||a&&A(o))return!0}return!1}var Eo=`4.5.1`,Do=[`top`,`bottom`,`left`,`right`,`chartArea`];function Oo(e,t){return e===`top`||e===`bottom`||Do.indexOf(e)===-1&&t===`x`}function ko(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}function Ao(e){let t=e.chart,n=t.options.animation;t.notifyPlugins(`afterRender`),F(n&&n.onComplete,[e],t)}function jo(e){let t=e.chart,n=t.options.animation;F(n&&n.onProgress,[e],t)}function Mo(e){return tr()&&typeof e==`string`?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}var No={},Po=e=>{let t=Mo(e);return Object.values(No).filter(e=>e.canvas===t).pop()};function Fo(e,t,n){let r=Object.keys(e);for(let i of r){let r=+i;if(r>=t){let a=e[i];delete e[i],(n>0||r>t)&&(e[r+n]=a)}}}function Io(e,t,n,r){return!n||e.type===`mouseout`?null:r?t:e}var Lo=class{static defaults=K;static instances=No;static overrides=Jt;static registry=X;static version=Eo;static getChart=Po;static register(...e){X.add(...e),Ro()}static unregister(...e){X.remove(...e),Ro()}constructor(e,t){let n=this.config=new So(t),r=Mo(e),i=Po(r);if(i)throw Error(`Canvas is already in use. Chart with ID '`+i.id+`' must be destroyed before the canvas with ID '`+i.canvas.id+`' can be reused.`);let a=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||(Oa(r))),this.platform.updateConfig(n);let o=this.platform.acquireContext(r,a.aspectRatio),s=o&&o.canvas,c=s&&s.height,l=s&&s.width;if(this.id=Ae(),this.ctx=o,this.canvas=s,this.width=l,this.height=c,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new eo,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Tt(e=>this.update(e),a.resizeDelay||0),this._dataChanges=[],No[this.id]=this,!o||!s){console.error(`Failed to create chart: can't acquire context from the given item`);return}Br.listen(this,`complete`,Ao),Br.listen(this,`progress`,jo),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:e,maintainAspectRatio:t},width:n,height:r,_aspectRatio:i}=this;return k(e)?t&&i?i:r?n/r:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return X}_initialize(){return this.notifyPlugins(`beforeInit`),this.options.responsive?this.resize():mr(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins(`afterInit`),this}clear(){return nn(this.canvas,this.ctx),this}stop(){return Br.stop(this),this}resize(e,t){Br.running(this)?this._resizeBeforeDraw={width:e,height:t}:this._resize(e,t)}_resize(e,t){let n=this.options,r=this.canvas,i=n.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(r,e,t,i),o=n.devicePixelRatio||this.platform.getDevicePixelRatio(),s=this.width?`resize`:`attach`;this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,mr(this,o,!0)&&(this.notifyPlugins(`resize`,{size:a}),F(n.onResize,[this,a],this),this.attached&&this._doResize(s)&&this.render())}ensureScalesHaveIDs(){I(this.options.scales||{},(e,t)=>{e.id=t})}buildOrUpdateScales(){let e=this.options,t=e.scales,n=this.scales,r=Object.keys(n).reduce((e,t)=>(e[t]=!1,e),{}),i=[];t&&(i=i.concat(Object.keys(t).map(e=>{let n=t[e],r=uo(e,n),i=r===`r`,a=r===`x`;return{options:n,dposition:i?`chartArea`:a?`bottom`:`left`,dtype:i?`radialLinear`:a?`category`:`linear`}}))),I(i,t=>{let i=t.options,a=i.id,o=uo(a,i),s=P(i.type,t.dtype);(i.position===void 0||Oo(i.position,o)!==Oo(t.dposition))&&(i.position=t.dposition),r[a]=!0;let c=null;a in n&&n[a].type===s?c=n[a]:(c=new(X.getScale(s))({id:a,type:s,ctx:this.ctx,chart:this}),n[c.id]=c),c.init(i,e)}),I(r,(e,t)=>{e||delete n[t]}),I(n,e=>{Y.configure(this,e,e.options),Y.addBox(this,e)})}_updateMetasets(){let e=this._metasets,t=this.data.datasets.length,n=e.length;if(e.sort((e,t)=>e.index-t.index),n>t){for(let e=t;et.length&&delete this._stacks,e.forEach((e,n)=>{t.filter(t=>t===e._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){let e=[],t=this.data.datasets,n,r;for(this._removeUnreferencedMetasets(),n=0,r=t.length;n{this.getDatasetMeta(t).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins(`reset`)}update(e){let t=this.config;t.update();let n=this._options=t.createResolver(t.chartOptionScopes(),this.getContext()),r=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins(`beforeUpdate`,{mode:e,cancelable:!0})===!1)return;let i=this.buildOrUpdateControllers();this.notifyPlugins(`beforeElementsUpdate`);let a=0;for(let e=0,t=this.data.datasets.length;e{e.reset()}),this._updateDatasets(e),this.notifyPlugins(`afterUpdate`,{mode:e}),this._layers.sort(ko(`z`,`_idx`));let{_active:o,_lastEvent:s}=this;s?this._eventHandler(s,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){I(this.scales,e=>{Y.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let e=this.options;(!qe(new Set(Object.keys(this._listeners)),new Set(e.events))||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:e}=this,t=this._getUniformDataChanges()||[];for(let{method:n,start:r,count:i}of t)Fo(e,r,n===`_removeElements`?-i:i)}_getUniformDataChanges(){let e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];let t=this.data.datasets.length,n=t=>new Set(e.filter(e=>e[0]===t).map((e,t)=>t+`,`+e.splice(1).join(`,`))),r=n(0);for(let e=1;ee.split(`,`)).map(e=>({method:e[1],start:+e[2],count:+e[3]}))}_updateLayout(e){if(this.notifyPlugins(`beforeLayout`,{cancelable:!0})===!1)return;Y.update(this,this.width,this.height,e);let t=this.chartArea,n=t.width<=0||t.height<=0;this._layers=[],I(this.boxes,e=>{n&&e.position===`chartArea`||(e.configure&&e.configure(),this._layers.push(...e._layers()))},this),this._layers.forEach((e,t)=>{e._idx=t}),this.notifyPlugins(`afterLayout`)}_updateDatasets(e){if(this.notifyPlugins(`beforeDatasetsUpdate`,{mode:e,cancelable:!0})!==!1){for(let e=0,t=this.data.datasets.length;e=0;--t)this._drawDataset(e[t]);this.notifyPlugins(`afterDatasetsDraw`)}_drawDataset(e){let t=this.ctx,n={meta:e,index:e.index,cancelable:!0},r=zr(this,e);this.notifyPlugins(`beforeDatasetDraw`,n)!==!1&&(r&&sn(t,r),e.controller.draw(),r&&cn(t),n.cancelable=!1,this.notifyPlugins(`afterDatasetDraw`,n))}isPointInArea(e){return on(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,n,r){let i=Ui.modes[t];return typeof i==`function`?i(this,e,n,r):[]}getDatasetMeta(e){let t=this.data.datasets[e],n=this._metasets,r=n.filter(e=>e&&e._dataset===t).pop();return r||(r={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:t&&t.order||0,index:e,_dataset:t,_parsed:[],_sorted:!1},n.push(r)),r}getContext(){return this.$context||=Tn(null,{chart:this,type:`chart`})}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){let t=this.data.datasets[e];if(!t)return!1;let n=this.getDatasetMeta(e);return typeof n.hidden==`boolean`?!n.hidden:!t.hidden}setDatasetVisibility(e,t){let n=this.getDatasetMeta(e);n.hidden=!t}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,t,n){let r=n?`show`:`hide`,i=this.getDatasetMeta(e),a=i.controller._resolveAnimations(void 0,r);Ge(t)?(i.data[t].hidden=!n,this.update()):(this.setDatasetVisibility(e,n),a.update(i,{visible:n}),this.update(t=>t.datasetIndex===e?r:void 0))}hide(e,t){this._updateVisibility(e,t,!1)}show(e,t){this._updateVisibility(e,t,!0)}_destroyDatasetMeta(e){let t=this._metasets[e];t&&t.controller&&t.controller._destroy(),delete this._metasets[e]}_stop(){let e,t;for(this.stop(),Br.remove(this),e=0,t=this.data.datasets.length;e{t.addEventListener(this,n,r),e[n]=r},r=(e,t,n)=>{e.offsetX=t,e.offsetY=n,this._eventHandler(e)};I(this.options.events,e=>n(e,r))}bindResponsiveEvents(){this._responsiveListeners||={};let e=this._responsiveListeners,t=this.platform,n=(n,r)=>{t.addEventListener(this,n,r),e[n]=r},r=(n,r)=>{e[n]&&(t.removeEventListener(this,n,r),delete e[n])},i=(e,t)=>{this.canvas&&this.resize(e,t)},a,o=()=>{r(`attach`,o),this.attached=!0,this.resize(),n(`resize`,i),n(`detach`,a)};a=()=>{this.attached=!1,r(`resize`,i),this._stop(),this._resize(0,0),n(`attach`,o)},t.isAttached(this.canvas)?o():a()}unbindEvents(){I(this._listeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._listeners={},I(this._responsiveListeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,t,n){let r=n?`set`:`remove`,i,a,o,s;for(t===`dataset`&&(i=this.getDatasetMeta(e[0].datasetIndex),i.controller[`_`+r+`DatasetHoverStyle`]()),o=0,s=e.length;o{let n=this.getDatasetMeta(e);if(!n)throw Error(`No dataset found at index `+e);return{datasetIndex:e,element:n.data[t],index:t}});Ne(n,t)||(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,t))}notifyPlugins(e,t,n){return this._plugins.notify(this,e,t,n)}isPluginEnabled(e){return this._plugins._cache.filter(t=>t.plugin.id===e).length===1}_updateHoverStyles(e,t,n){let r=this.options.hover,i=(e,t)=>e.filter(e=>!t.some(t=>e.datasetIndex===t.datasetIndex&&e.index===t.index)),a=i(t,e),o=n?e:i(e,t);a.length&&this.updateHoverStyle(a,r.mode,!1),o.length&&r.mode&&this.updateHoverStyle(o,r.mode,!0)}_eventHandler(e,t){let n={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},r=t=>(t.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins(`beforeEvent`,n,r)===!1)return;let i=this._handleEvent(e,t,n.inChartArea);return n.cancelable=!1,this.notifyPlugins(`afterEvent`,n,r),(i||n.changed)&&this.render(),this}_handleEvent(e,t,n){let{_active:r=[],options:i}=this,a=t,o=this._getActiveElements(e,r,n,a),s=Je(e),c=Io(e,this._lastEvent,n,s);n&&(this._lastEvent=null,F(i.onHover,[e,o,this],this),s&&F(i.onClick,[e,o,this],this));let l=!Ne(o,r);return(l||t)&&(this._active=o,this._updateHoverStyles(o,r,t)),this._lastEvent=c,l}_getActiveElements(e,t,n,r){if(e.type===`mouseout`)return[];if(!n)return t;let i=this.options.hover;return this.getElementsAtEventForMode(e,i.mode,i,r)}};function Ro(){return I(Lo.instances,e=>e._plugins.invalidate())}function zo(e,t,n){let{startAngle:r,x:i,y:a,outerRadius:o,innerRadius:s,options:c}=t,{borderWidth:l,borderJoinStyle:u}=c,d=Math.min(l/o,H(r-n));if(e.beginPath(),e.arc(i,a,o-l/2,r+d/2,n-d/2),s>0){let t=Math.min(l/s,H(r-n));e.arc(i,a,s+l/2,n-t/2,r+t/2,!0)}else{let t=Math.min(l/2,o*H(r-n));if(u===`round`)e.arc(i,a,t,n-L/2,r+L/2,!0);else if(u===`bevel`){let o=2*t*t,s=-o*Math.cos(n+L/2)+i,c=-o*Math.sin(n+L/2)+a,l=o*Math.cos(r+L/2)+i,u=o*Math.sin(r+L/2)+a;e.lineTo(s,c),e.lineTo(l,u)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip(`evenodd`)}function Bo(e,t,n){let{startAngle:r,pixelMargin:i,x:a,y:o,outerRadius:s,innerRadius:c}=t,l=i/s;e.beginPath(),e.arc(a,o,s,r-l,n+l),c>i?(l=i/c,e.arc(a,o,c,n+l,r-l,!0)):e.arc(a,o,i,n+z,r-z),e.closePath(),e.clip()}function Vo(e){return bn(e,[`outerStart`,`outerEnd`,`innerStart`,`innerEnd`])}function Ho(e,t,n,r){let i=Vo(e.options.borderRadius),a=(n-t)/2,o=Math.min(a,r*t/2),s=e=>{let t=(n-Math.min(a,e))*r/2;return U(e,0,Math.min(a,t))};return{outerStart:s(i.outerStart),outerEnd:s(i.outerEnd),innerStart:U(i.innerStart,0,o),innerEnd:U(i.innerEnd,0,o)}}function Uo(e,t,n,r){return{x:n+e*Math.cos(t),y:r+e*Math.sin(t)}}function Wo(e,t,n,r,i,a){let{x:o,y:s,startAngle:c,pixelMargin:l,innerRadius:u}=t,d=Math.max(t.outerRadius+r+n-l,0),f=u>0?u+r+n+l:0,p=0,m=i-c;if(r){let e=((u>0?u-r:0)+(d>0?d-r:0))/2;p=(m-(e===0?m:m*e/(e+r)))/2}let h=(m-Math.max(.001,m*d-n/L)/d)/2,g=c+h+p,_=i-h-p,{outerStart:v,outerEnd:y,innerStart:b,innerEnd:x}=Ho(t,f,d,_-g),S=d-v,C=d-y,w=g+v/S,T=_-y/C,E=f+b,D=f+x,ee=g+b/E,O=_-x/D;if(e.beginPath(),a){let t=(w+T)/2;if(e.arc(o,s,d,w,t),e.arc(o,s,d,t,T),y>0){let t=Uo(C,T,o,s);e.arc(t.x,t.y,y,T,_+z)}let n=Uo(D,_,o,s);if(e.lineTo(n.x,n.y),x>0){let t=Uo(D,O,o,s);e.arc(t.x,t.y,x,_+z,O+Math.PI)}let r=(_-x/f+(g+b/f))/2;if(e.arc(o,s,f,_-x/f,r,!0),e.arc(o,s,f,r,g+b/f,!0),b>0){let t=Uo(E,ee,o,s);e.arc(t.x,t.y,b,ee+Math.PI,g-z)}let i=Uo(S,g,o,s);if(e.lineTo(i.x,i.y),v>0){let t=Uo(S,w,o,s);e.arc(t.x,t.y,v,g-z,w)}}else{e.moveTo(o,s);let t=Math.cos(w)*d+o,n=Math.sin(w)*d+s;e.lineTo(t,n);let r=Math.cos(T)*d+o,i=Math.sin(T)*d+s;e.lineTo(r,i)}e.closePath()}function Go(e,t,n,r,i){let{fullCircles:a,startAngle:o,circumference:s}=t,c=t.endAngle;if(a){Wo(e,t,n,r,c,i);for(let t=0;t=L&&p===0&&u!==`miter`&&zo(e,t,h),a||(Wo(e,t,n,r,h,i),e.stroke())}var qo=class extends ka{static id=`arc`;static defaults={borderAlign:`center`,borderColor:`#fff`,borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:`backgroundColor`};static descriptors={_scriptable:!0,_indexable:e=>e!==`borderDash`};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(e){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,t,n){let{angle:r,distance:i}=ut(this.getProps([`x`,`y`],n),{x:e,y:t}),{startAngle:a,endAngle:o,innerRadius:s,outerRadius:c,circumference:l}=this.getProps([`startAngle`,`endAngle`,`innerRadius`,`outerRadius`,`circumference`],n),u=(this.options.spacing+this.options.borderWidth)/2,d=P(l,o-a),f=pt(r,a,o)&&a!==o,p=d>=R||f,m=W(i,s+u,c+u);return p&&m}getCenterPoint(e){let{x:t,y:n,startAngle:r,endAngle:i,innerRadius:a,outerRadius:o}=this.getProps([`x`,`y`,`startAngle`,`endAngle`,`innerRadius`,`outerRadius`],e),{offset:s,spacing:c}=this.options,l=(r+i)/2,u=(a+o+c+s)/2;return{x:t+Math.cos(l)*u,y:n+Math.sin(l)*u}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){let{options:t,circumference:n}=this,r=(t.offset||0)/4,i=(t.spacing||0)/2,a=t.circular;if(this.pixelMargin=t.borderAlign===`inner`?.33:0,this.fullCircles=n>R?Math.floor(n/R):0,n===0||this.innerRadius<0||this.outerRadius<0)return;e.save();let o=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(o)*r,Math.sin(o)*r);let s=r*(1-Math.sin(Math.min(L,n||0)));e.fillStyle=t.backgroundColor,e.strokeStyle=t.borderColor,Go(e,this,s,i,a),Ko(e,this,s,i,a),e.restore()}};function Jo(e,t,n=t){e.lineCap=P(n.borderCapStyle,t.borderCapStyle),e.setLineDash(P(n.borderDash,t.borderDash)),e.lineDashOffset=P(n.borderDashOffset,t.borderDashOffset),e.lineJoin=P(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=P(n.borderWidth,t.borderWidth),e.strokeStyle=P(n.borderColor,t.borderColor)}function Yo(e,t,n){e.lineTo(n.x,n.y)}function Xo(e){return e.stepped?ln:e.tension||e.cubicInterpolationMode===`monotone`?un:Yo}function Zo(e,t,n={}){let r=e.length,{start:i=0,end:a=r-1}=n,{start:o,end:s}=t,c=Math.max(i,o),l=Math.min(a,s),u=is&&a>s;return{count:r,start:c,loop:t.loop,ilen:l(o+(l?s-e:e))%a,y=()=>{h!==g&&(e.lineTo(u,g),e.lineTo(u,h),e.lineTo(u,_))};for(c&&(p=i[v(0)],e.moveTo(p.x,p.y)),f=0;f<=s;++f){if(p=i[v(f)],p.skip)continue;let t=p.x,n=p.y,r=t|0;r===m?(ng&&(g=n),u=(d*u+t)/++d):(y(),e.lineTo(t,n),m=r,d=0,h=g=n),_=n}y()}function es(e){let t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!==`monotone`&&!t.stepped&&!n?$o:Qo}function ts(e){return e.stepped?vr:e.tension||e.cubicInterpolationMode===`monotone`?yr:_r}function ns(e,t,n,r){let i=t._path;i||(i=t._path=new Path2D,t.path(i,n,r)&&i.closePath()),Jo(e,t.options),e.stroke(i)}function rs(e,t,n,r){let{segments:i,options:a}=t,o=es(t);for(let s of i)Jo(e,a,s.style),e.beginPath(),o(e,t,s,{start:n,end:n+r-1})&&e.closePath(),e.stroke()}var is=typeof Path2D==`function`;function as(e,t,n,r){is&&!t.options.segment?ns(e,t,n,r):rs(e,t,n,r)}var os=class extends ka{static id=`line`;static defaults={borderCapStyle:`butt`,borderDash:[],borderDashOffset:0,borderJoinStyle:`miter`,borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:`default`,fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:`backgroundColor`,borderColor:`borderColor`};static descriptors={_scriptable:!0,_indexable:e=>e!==`borderDash`&&e!==`fill`};constructor(e){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,e&&Object.assign(this,e)}updateControlPoints(e,t){let n=this.options;if((n.tension||n.cubicInterpolationMode===`monotone`)&&!n.stepped&&!this._pointsUpdated){let r=n.spanGaps?this._loop:this._fullLoop;er(this._points,n,e,r,t),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||=Mr(this,this.options.segment)}first(){let e=this.segments,t=this.points;return e.length&&t[e[0].start]}last(){let e=this.segments,t=this.points,n=e.length;return n&&t[e[n-1].end]}interpolate(e,t){let n=this.options,r=e[t],i=this.points,a=kr(this,{property:t,start:r,end:r});if(!a.length)return;let o=[],s=ts(n),c,l;for(c=0,l=a.length;c{t=Ss(e,t,i);let o=i[e],s=i[t];r===null?n!==null&&(a.push({x:n,y:o.y}),a.push({x:n,y:s.y})):(a.push({x:o.x,y:r}),a.push({x:s.x,y:r}))}),a}function Ss(e,t,n){for(;t>e;t--){let e=n[t];if(!isNaN(e.x)&&!isNaN(e.y))break}return t}function Cs(e,t,n,r){return e&&t?r(e[n],t[n]):e?e[n]:t?t[n]:0}function ws(e,t){let n=[],r=!1;return A(e)?(r=!0,n=e):n=xs(e,t),n.length?new os({points:n,options:{tension:0},_loop:r,_fullLoop:r}):null}function Ts(e){return e&&e.fill!==!1}function Es(e,t,n){let r=e[t].fill,i=[t],a;if(!n)return r;for(;r!==!1&&i.indexOf(r)===-1;){if(!M(r))return r;if(a=e[r],!a)return!1;if(a.visible)return r;i.push(r),r=a.fill}return!1}function Ds(e,t,n){let r=js(e);if(j(r))return isNaN(r.value)?!1:r;let i=parseFloat(r);return M(i)&&Math.floor(i)===i?Os(r[0],t,i,n):[`origin`,`start`,`end`,`stack`,`shape`].indexOf(r)>=0&&r}function Os(e,t,n,r){return(e===`-`||e===`+`)&&(n=t+n),n===t||n<0||n>=r?!1:n}function ks(e,t){let n=null;return e===`start`?n=t.bottom:e===`end`?n=t.top:j(e)?n=t.getPixelForValue(e.value):t.getBasePixel&&(n=t.getBasePixel()),n}function As(e,t,n){let r;return r=e===`start`?n:e===`end`?t.options.reverse?t.min:t.max:j(e)?e.value:t.getBaseValue(),r}function js(e){let t=e.options,n=t.fill,r=P(n&&n.target,n);return r===void 0&&(r=!!t.backgroundColor),r===!1||r===null?!1:r===!0?`origin`:r}function Ms(e){let{scale:t,index:n,line:r}=e,i=[],a=r.segments,o=r.points,s=Ns(t,n);s.push(ws({x:null,y:t.bottom},r));for(let e=0;e=0;--t){let n=i[t].$filler;n&&(n.line.updateControlPoints(a,n.axis),r&&n.fill&&Hs(e.ctx,n,a))}},beforeDatasetsDraw(e,t,n){if(n.drawTime!==`beforeDatasetsDraw`)return;let r=e.getSortedVisibleDatasetMetas();for(let t=r.length-1;t>=0;--t){let n=r[t].$filler;Ts(n)&&Hs(e.ctx,n,e.chartArea)}},beforeDatasetDraw(e,t,n){let r=t.meta.$filler;!Ts(r)||n.drawTime!==`beforeDatasetDraw`||Hs(e.ctx,r,e.chartArea)},defaults:{propagate:!0,drawTime:`beforeDatasetDraw`}},Xs=(e,t)=>{let{boxHeight:n=t,boxWidth:r=t}=e;return e.usePointStyle&&(n=Math.min(n,t),r=e.pointStyleWidth||Math.min(r,t)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(t,n)}},Zs=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index,Qs=class extends ka{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t,n){this.maxWidth=e,this.maxHeight=t,this._margins=n,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){let e=this.options.labels||{},t=F(e.generateLabels,[this.chart],this)||[];e.filter&&(t=t.filter(t=>e.filter(t,this.chart.data))),e.sort&&(t=t.sort((t,n)=>e.sort(t,n,this.chart.data))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){let{options:e,ctx:t}=this;if(!e.display){this.width=this.height=0;return}let n=e.labels,r=J(n.font),i=r.size,a=this._computeTitleHeight(),{boxWidth:o,itemHeight:s}=Xs(n,i),c,l;t.font=r.string,this.isHorizontal()?(c=this.maxWidth,l=this._fitRows(a,i,o,s)+10):(l=this.maxHeight,c=this._fitCols(a,r,o,s)+10),this.width=Math.min(c,e.maxWidth||this.maxWidth),this.height=Math.min(l,e.maxHeight||this.maxHeight)}_fitRows(e,t,n,r){let{ctx:i,maxWidth:a,options:{labels:{padding:o}}}=this,s=this.legendHitBoxes=[],c=this.lineWidths=[0],l=r+o,u=e;i.textAlign=`left`,i.textBaseline=`middle`;let d=-1,f=-l;return this.legendItems.forEach((e,p)=>{let m=n+t/2+i.measureText(e.text).width;(p===0||c[c.length-1]+m+2*o>a)&&(u+=l,c[c.length-(p>0?0:1)]=0,f+=l,d++),s[p]={left:0,top:f,row:d,width:m,height:r},c[c.length-1]+=m+o}),u}_fitCols(e,t,n,r){let{ctx:i,maxHeight:a,options:{labels:{padding:o}}}=this,s=this.legendHitBoxes=[],c=this.columnSizes=[],l=a-e,u=o,d=0,f=0,p=0,m=0;return this.legendItems.forEach((e,a)=>{let{itemWidth:h,itemHeight:g}=$s(n,t,i,e,r);a>0&&f+g+2*o>l&&(u+=d+o,c.push({width:d,height:f}),p+=d+o,m++,d=f=0),s[a]={left:p,top:f,col:m,width:h,height:g},d=Math.max(d,h),f+=g+o}),u+=d,c.push({width:d,height:f}),u}adjustHitBoxes(){if(!this.options.display)return;let e=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:n,labels:{padding:r},rtl:i}}=this,a=Sr(i,this.left,this.width);if(this.isHorizontal()){let i=0,o=G(n,this.left+r,this.right-this.lineWidths[i]);for(let s of t)i!==s.row&&(i=s.row,o=G(n,this.left+r,this.right-this.lineWidths[i])),s.top+=this.top+e+r,s.left=a.leftForLtr(a.x(o),s.width),o+=s.width+r}else{let i=0,o=G(n,this.top+e+r,this.bottom-this.columnSizes[i].height);for(let s of t)s.col!==i&&(i=s.col,o=G(n,this.top+e+r,this.bottom-this.columnSizes[i].height)),s.top=o,s.left+=this.left+r,s.left=a.leftForLtr(a.x(s.left),s.width),o+=s.height+r}}isHorizontal(){return this.options.position===`top`||this.options.position===`bottom`}draw(){if(this.options.display){let e=this.ctx;sn(e,this),this._draw(),cn(e)}}_draw(){let{options:e,columnSizes:t,lineWidths:n,ctx:r}=this,{align:i,labels:a}=e,o=K.color,s=Sr(e.rtl,this.left,this.width),c=J(a.font),{padding:l}=a,u=c.size,d=u/2,f;this.drawTitle(),r.textAlign=s.textAlign(`left`),r.textBaseline=`middle`,r.lineWidth=.5,r.font=c.string;let{boxWidth:p,boxHeight:m,itemHeight:h}=Xs(a,u),g=function(e,t,n){if(isNaN(p)||p<=0||isNaN(m)||m<0)return;r.save();let i=P(n.lineWidth,1);if(r.fillStyle=P(n.fillStyle,o),r.lineCap=P(n.lineCap,`butt`),r.lineDashOffset=P(n.lineDashOffset,0),r.lineJoin=P(n.lineJoin,`miter`),r.lineWidth=i,r.strokeStyle=P(n.strokeStyle,o),r.setLineDash(P(n.lineDash,[])),a.usePointStyle)an(r,{radius:m*Math.SQRT2/2,pointStyle:n.pointStyle,rotation:n.rotation,borderWidth:i},s.xPlus(e,p/2),t+d,a.pointStyleWidth&&p);else{let a=t+Math.max((u-m)/2,0),o=s.leftForLtr(e,p),c=Sn(n.borderRadius);r.beginPath(),Object.values(c).some(e=>e!==0)?hn(r,{x:o,y:a,w:p,h:m,radius:c}):r.rect(o,a,p,m),r.fill(),i!==0&&r.stroke()}r.restore()},_=function(e,t,n){mn(r,n.text,e,t+h/2,c,{strikethrough:n.hidden,textAlign:s.textAlign(n.textAlign)})},v=this.isHorizontal(),y=this._computeTitleHeight();f=v?{x:G(i,this.left+l,this.right-n[0]),y:this.top+l+y,line:0}:{x:this.left+l,y:G(i,this.top+y+l,this.bottom-t[0].height),line:0},Cr(this.ctx,e.textDirection);let b=h+l;this.legendItems.forEach((o,u)=>{r.strokeStyle=o.fontColor,r.fillStyle=o.fontColor;let m=r.measureText(o.text).width,h=s.textAlign(o.textAlign||=a.textAlign),x=p+d+m,S=f.x,C=f.y;if(s.setWidth(this.width),v?u>0&&S+x+l>this.right&&(C=f.y+=b,f.line++,S=f.x=G(i,this.left+l,this.right-n[f.line])):u>0&&C+b>this.bottom&&(S=f.x=S+t[f.line].width+l,f.line++,C=f.y=G(i,this.top+y+l,this.bottom-t[f.line].height)),g(s.x(S),C,o),S=Dt(h,S+p+d,v?S+x:this.right,e.rtl),_(s.x(S),C,o),v)f.x+=x+l;else if(typeof o.text!=`string`){let e=c.lineHeight;f.y+=nc(o,e)+l}else f.y+=b}),wr(this.ctx,e.textDirection)}drawTitle(){let e=this.options,t=e.title,n=J(t.font),r=q(t.padding);if(!t.display)return;let i=Sr(e.rtl,this.left,this.width),a=this.ctx,o=t.position,s=n.size/2,c=r.top+s,l,u=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),l=this.top+c,u=G(e.align,u,this.right-d);else{let t=this.columnSizes.reduce((e,t)=>Math.max(e,t.height),0);l=c+G(e.align,this.top,this.bottom-t-e.labels.padding-this._computeTitleHeight())}let f=G(o,u,u+d);a.textAlign=i.textAlign(Et(o)),a.textBaseline=`middle`,a.strokeStyle=t.color,a.fillStyle=t.color,a.font=n.string,mn(a,t.text,f,l,n)}_computeTitleHeight(){let e=this.options.title,t=J(e.font),n=q(e.padding);return e.display?t.lineHeight+n.height:0}_getLegendItemAt(e,t){let n,r,i;if(W(e,this.left,this.right)&&W(t,this.top,this.bottom)){for(i=this.legendHitBoxes,n=0;ne.length>t.length?e:t)),t+n.size/2+r.measureText(i).width}function tc(e,t,n){let r=e;return typeof t.text!=`string`&&(r=nc(t,n)),r}function nc(e,t){return t*(e.text?e.text.length:0)}function rc(e,t){return!!((e===`mousemove`||e===`mouseout`)&&(t.onHover||t.onLeave)||t.onClick&&(e===`click`||e===`mouseup`))}var ic={id:`legend`,_element:Qs,start(e,t,n){let r=e.legend=new Qs({ctx:e.ctx,options:n,chart:e});Y.configure(e,r,n),Y.addBox(e,r)},stop(e){Y.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){let r=e.legend;Y.configure(e,r,n),r.options=n},afterUpdate(e){let t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:`top`,align:`center`,fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){let r=t.datasetIndex,i=n.chart;i.isDatasetVisible(r)?(i.hide(r),t.hidden=!0):(i.show(r),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){let t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:i,color:a,useBorderRadius:o,borderRadius:s}}=e.legend.options;return e._getSortedDatasetMetas().map(e=>{let c=e.controller.getStyle(n?0:void 0),l=q(c.borderWidth);return{text:t[e.index].label,fillStyle:c.backgroundColor,fontColor:a,hidden:!e.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(l.width+l.height)/4,strokeStyle:c.borderColor,pointStyle:r||c.pointStyle,rotation:c.rotation,textAlign:i||c.textAlign,borderRadius:o&&(s||c.borderRadius),datasetIndex:e.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:`center`,text:``}},descriptors:{_scriptable:e=>!e.startsWith(`on`),labels:{_scriptable:e=>![`generateLabels`,`filter`,`sort`].includes(e)}}},ac=class extends ka{constructor(e){super(),this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t){let n=this.options;if(this.left=0,this.top=0,!n.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=e,this.height=this.bottom=t;let r=A(n.text)?n.text.length:1;this._padding=q(n.padding);let i=r*J(n.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=i:this.width=i}isHorizontal(){let e=this.options.position;return e===`top`||e===`bottom`}_drawArgs(e){let{top:t,left:n,bottom:r,right:i,options:a}=this,o=a.align,s=0,c,l,u;return this.isHorizontal()?(l=G(o,n,i),u=t+e,c=i-n):(a.position===`left`?(l=n+e,u=G(o,r,t),s=L*-.5):(l=i-e,u=G(o,t,r),s=L*.5),c=r-t),{titleX:l,titleY:u,maxWidth:c,rotation:s}}draw(){let e=this.ctx,t=this.options;if(!t.display)return;let n=J(t.font),r=n.lineHeight/2+this._padding.top,{titleX:i,titleY:a,maxWidth:o,rotation:s}=this._drawArgs(r);mn(e,t.text,0,0,n,{color:t.color,maxWidth:o,rotation:s,textAlign:Et(t.align),textBaseline:`middle`,translation:[i,a]})}};function oc(e,t){let n=new ac({ctx:e.ctx,options:t,chart:e});Y.configure(e,n,t),Y.addBox(e,n),e.titleBlock=n}var sc={id:`title`,_element:ac,start(e,t,n){oc(e,n)},stop(e){let t=e.titleBlock;Y.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){let r=e.titleBlock;Y.configure(e,r,n),r.options=n},defaults:{align:`center`,display:!1,font:{weight:`bold`},fullSize:!0,padding:10,position:`top`,text:``,weight:2e3},defaultRoutes:{color:`color`},descriptors:{_scriptable:!0,_indexable:!1}},cc={average(e){if(!e.length)return!1;let t,n,r=new Set,i=0,a=0;for(t=0,n=e.length;te+t)/r.size,y:i/a}},nearest(e,t){if(!e.length)return!1;let n=t.x,r=t.y,i=1/0,a,o,s;for(a=0,o=e.length;a-1?e.split(` `):e}function uc(e,t){let{element:n,datasetIndex:r,index:i}=t,a=e.getDatasetMeta(r).controller,{label:o,value:s}=a.getLabelAndValue(i);return{chart:e,label:o,parsed:a.getParsed(i),raw:e.data.datasets[r].data[i],formattedValue:s,dataset:a.getDataset(),dataIndex:i,datasetIndex:r,element:n}}function dc(e,t){let n=e.chart.ctx,{body:r,footer:i,title:a}=e,{boxWidth:o,boxHeight:s}=t,c=J(t.bodyFont),l=J(t.titleFont),u=J(t.footerFont),d=a.length,f=i.length,p=r.length,m=q(t.padding),h=m.height,g=0,_=r.reduce((e,t)=>e+t.before.length+t.lines.length+t.after.length,0);if(_+=e.beforeBody.length+e.afterBody.length,d&&(h+=d*l.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),_){let e=t.displayColors?Math.max(s,c.lineHeight):c.lineHeight;h+=p*e+(_-p)*c.lineHeight+(_-1)*t.bodySpacing}f&&(h+=t.footerMarginTop+f*u.lineHeight+(f-1)*t.footerSpacing);let v=0,y=function(e){g=Math.max(g,n.measureText(e).width+v)};return n.save(),n.font=l.string,I(e.title,y),n.font=c.string,I(e.beforeBody.concat(e.afterBody),y),v=t.displayColors?o+2+t.boxPadding:0,I(r,e=>{I(e.before,y),I(e.lines,y),I(e.after,y)}),v=0,n.font=u.string,I(e.footer,y),n.restore(),g+=m.width,{width:g,height:h}}function fc(e,t){let{y:n,height:r}=t;return ne.height-r/2?`bottom`:`center`}function pc(e,t,n,r){let{x:i,width:a}=r,o=n.caretSize+n.caretPadding;if(e===`left`&&i+a+o>t.width||e===`right`&&i-a-o<0)return!0}function mc(e,t,n,r){let{x:i,width:a}=n,{width:o,chartArea:{left:s,right:c}}=e,l=`center`;return r===`center`?l=i<=(s+c)/2?`left`:`right`:i<=a/2?l=`left`:i>=o-a/2&&(l=`right`),pc(l,e,t,n)&&(l=`center`),l}function hc(e,t,n){let r=n.yAlign||t.yAlign||fc(e,n);return{xAlign:n.xAlign||t.xAlign||mc(e,t,n,r),yAlign:r}}function gc(e,t){let{x:n,width:r}=e;return t===`right`?n-=r:t===`center`&&(n-=r/2),n}function _c(e,t,n){let{y:r,height:i}=e;return t===`top`?r+=n:t===`bottom`?r-=i+n:r-=i/2,r}function vc(e,t,n,r){let{caretSize:i,caretPadding:a,cornerRadius:o}=e,{xAlign:s,yAlign:c}=n,l=i+a,{topLeft:u,topRight:d,bottomLeft:f,bottomRight:p}=Sn(o),m=gc(t,s),h=_c(t,c,l);return c===`center`?s===`left`?m+=l:s===`right`&&(m-=l):s===`left`?m-=Math.max(u,f)+i:s===`right`&&(m+=Math.max(d,p)+i),{x:U(m,0,r.width-t.width),y:U(h,0,r.height-t.height)}}function yc(e,t,n){let r=q(n.padding);return t===`center`?e.x+e.width/2:t===`right`?e.x+e.width-r.right:e.x+r.left}function bc(e){return Z([],lc(e))}function xc(e,t,n){return Tn(e,{tooltip:t,tooltipItems:n,type:`tooltip`})}function Sc(e,t){let n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}var Cc={beforeTitle:ke,title(e){if(e.length>0){let t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode===`dataset`)return t.dataset.label||``;if(t.label)return t.label;if(r>0&&t.dataIndex{let t={before:[],lines:[],after:[]},i=Sc(n,e);Z(t.before,lc(Q(i,`beforeLabel`,this,e))),Z(t.lines,Q(i,`label`,this,e)),Z(t.after,lc(Q(i,`afterLabel`,this,e))),r.push(t)}),r}getAfterBody(e,t){return bc(Q(t.callbacks,`afterBody`,this,e))}getFooter(e,t){let{callbacks:n}=t,r=Q(n,`beforeFooter`,this,e),i=Q(n,`footer`,this,e),a=Q(n,`afterFooter`,this,e),o=[];return o=Z(o,lc(r)),o=Z(o,lc(i)),o=Z(o,lc(a)),o}_createItems(e){let t=this._active,n=this.chart.data,r=[],i=[],a=[],o=[],s,c;for(s=0,c=t.length;se.filter(t,r,i,n))),e.itemSort&&(o=o.sort((t,r)=>e.itemSort(t,r,n))),I(o,t=>{let n=Sc(e.callbacks,t);r.push(Q(n,`labelColor`,this,t)),i.push(Q(n,`labelPointStyle`,this,t)),a.push(Q(n,`labelTextColor`,this,t))}),this.labelColors=r,this.labelPointStyles=i,this.labelTextColors=a,this.dataPoints=o,o}update(e,t){let n=this.options.setContext(this.getContext()),r=this._active,i,a=[];if(!r.length)this.opacity!==0&&(i={opacity:0});else{let e=cc[n.position].call(this,r,this._eventPosition);a=this._createItems(n),this.title=this.getTitle(a,n),this.beforeBody=this.getBeforeBody(a,n),this.body=this.getBody(a,n),this.afterBody=this.getAfterBody(a,n),this.footer=this.getFooter(a,n);let t=this._size=dc(this,n),o=Object.assign({},e,t),s=hc(this.chart,n,o),c=vc(n,o,s,this.chart);this.xAlign=s.xAlign,this.yAlign=s.yAlign,i={opacity:1,x:c.x,y:c.y,width:t.width,height:t.height,caretX:e.x,caretY:e.y}}this._tooltipItems=a,this.$context=void 0,i&&this._resolveAnimations().update(this,i),e&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:t})}drawCaret(e,t,n,r){let i=this.getCaretPosition(e,n,r);t.lineTo(i.x1,i.y1),t.lineTo(i.x2,i.y2),t.lineTo(i.x3,i.y3)}getCaretPosition(e,t,n){let{xAlign:r,yAlign:i}=this,{caretSize:a,cornerRadius:o}=n,{topLeft:s,topRight:c,bottomLeft:l,bottomRight:u}=Sn(o),{x:d,y:f}=e,{width:p,height:m}=t,h,g,_,v,y,b;return i===`center`?(y=f+m/2,r===`left`?(h=d,g=h-a,v=y+a,b=y-a):(h=d+p,g=h+a,v=y-a,b=y+a),_=h):(g=r===`left`?d+Math.max(s,l)+a:r===`right`?d+p-Math.max(c,u)-a:this.caretX,i===`top`?(v=f,y=v-a,h=g-a,_=g+a):(v=f+m,y=v+a,h=g+a,_=g-a),b=v),{x1:h,x2:g,x3:_,y1:v,y2:y,y3:b}}drawTitle(e,t,n){let r=this.title,i=r.length,a,o,s;if(i){let c=Sr(n.rtl,this.x,this.width);for(e.x=yc(this,n.titleAlign,n),t.textAlign=c.textAlign(n.titleAlign),t.textBaseline=`middle`,a=J(n.titleFont),o=n.titleSpacing,t.fillStyle=n.titleColor,t.font=a.string,s=0;se!==0)?(e.beginPath(),e.fillStyle=i.multiKeyBackground,hn(e,{x:t,y:p,w:c,h:s,radius:o}),e.fill(),e.stroke(),e.fillStyle=a.backgroundColor,e.beginPath(),hn(e,{x:n,y:p+1,w:c-2,h:s-2,radius:o}),e.fill()):(e.fillStyle=i.multiKeyBackground,e.fillRect(t,p,c,s),e.strokeRect(t,p,c,s),e.fillStyle=a.backgroundColor,e.fillRect(n,p+1,c-2,s-2))}e.fillStyle=this.labelTextColors[n]}drawBody(e,t,n){let{body:r}=this,{bodySpacing:i,bodyAlign:a,displayColors:o,boxHeight:s,boxWidth:c,boxPadding:l}=n,u=J(n.bodyFont),d=u.lineHeight,f=0,p=Sr(n.rtl,this.x,this.width),m=function(n){t.fillText(n,p.x(e.x+f),e.y+d/2),e.y+=d+i},h=p.textAlign(a),g,_,v,y,b,x,S;for(t.textAlign=a,t.textBaseline=`middle`,t.font=u.string,e.x=yc(this,h,n),t.fillStyle=n.bodyColor,I(this.beforeBody,m),f=o&&h!==`right`?a===`center`?c/2+l:c+2+l:0,y=0,x=r.length;y0&&t.stroke()}_updateAnimationTarget(e){let t=this.chart,n=this.$animations,r=n&&n.x,i=n&&n.y;if(r||i){let n=cc[e.position].call(this,this._active,this._eventPosition);if(!n)return;let a=this._size=dc(this,e),o=Object.assign({},n,this._size),s=hc(t,e,o),c=vc(e,o,s,t);(r._to!==c.x||i._to!==c.y)&&(this.xAlign=s.xAlign,this.yAlign=s.yAlign,this.width=a.width,this.height=a.height,this.caretX=n.x,this.caretY=n.y,this._resolveAnimations().update(this,c))}}_willRender(){return!!this.opacity}draw(e){let t=this.options.setContext(this.getContext()),n=this.opacity;if(!n)return;this._updateAnimationTarget(t);let r={width:this.width,height:this.height},i={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;let a=q(t.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&o&&(e.save(),e.globalAlpha=n,this.drawBackground(i,e,r,t),Cr(e,t.textDirection),i.y+=a.top,this.drawTitle(i,e,t),this.drawBody(i,e,t),this.drawFooter(i,e,t),wr(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){let n=this._active,r=e.map(({datasetIndex:e,index:t})=>{let n=this.chart.getDatasetMeta(e);if(!n)throw Error(`Cannot find a dataset at index `+e);return{datasetIndex:e,element:n.data[t],index:t}}),i=!Ne(n,r),a=this._positionChanged(r,t);(i||a)&&(this._active=r,this._eventPosition=t,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,t,n=!0){if(t&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let r=this.options,i=this._active||[],a=this._getActiveElements(e,i,t,n),o=this._positionChanged(a,e),s=t||!Ne(a,i)||o;return s&&(this._active=a,(r.enabled||r.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,t))),s}_getActiveElements(e,t,n,r){let i=this.options;if(e.type===`mouseout`)return[];if(!r)return t.filter(e=>this.chart.data.datasets[e.datasetIndex]&&this.chart.getDatasetMeta(e.datasetIndex).controller.getParsed(e.index)!==void 0);let a=this.chart.getElementsAtEventForMode(e,i.mode,i,n);return i.reverse&&a.reverse(),a}_positionChanged(e,t){let{caretX:n,caretY:r,options:i}=this,a=cc[i.position].call(this,e,t);return a!==!1&&(n!==a.x||r!==a.y)}},Tc={id:`tooltip`,_element:wc,positioners:cc,afterInit(e,t,n){n&&(e.tooltip=new wc({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){let t=e.tooltip;if(t&&t._willRender()){let n={tooltip:t};if(e.notifyPlugins(`beforeTooltipDraw`,{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins(`afterTooltipDraw`,n)}},afterEvent(e,t){if(e.tooltip){let n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:`average`,backgroundColor:`rgba(0,0,0,0.8)`,titleColor:`#fff`,titleFont:{weight:`bold`},titleSpacing:2,titleMarginBottom:6,titleAlign:`left`,bodyColor:`#fff`,bodySpacing:2,bodyFont:{},bodyAlign:`left`,footerColor:`#fff`,footerSpacing:2,footerMarginTop:6,footerFont:{weight:`bold`},footerAlign:`left`,padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:`#fff`,displayColors:!0,boxPadding:0,borderColor:`rgba(0,0,0,0)`,borderWidth:0,animation:{duration:400,easing:`easeOutQuart`},animations:{numbers:{type:`number`,properties:[`x`,`y`,`width`,`height`,`caretX`,`caretY`]},opacity:{easing:`linear`,duration:200}},callbacks:Cc},defaultRoutes:{bodyFont:`font`,footerFont:`font`,titleFont:`font`},descriptors:{_scriptable:e=>e!==`filter`&&e!==`itemSort`&&e!==`external`,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:`animation`}},additionalOptionScopes:[`interaction`]},Ec=(e,t,n,r)=>(typeof t==`string`?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function Dc(e,t,n,r){let i=e.indexOf(t);return i===-1?Ec(e,t,n,r):i===e.lastIndexOf(t)?i:n}var Oc=(e,t)=>e===null?null:U(Math.round(e),0,t);function kc(e){let t=this.getLabels();return e>=0&&et.length-1?null:this.getPixelForValue(t[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}};function jc(e,t){let n=[],{bounds:r,step:i,min:a,max:o,precision:s,count:c,maxTicks:l,maxDigits:u,includeBounds:d}=e,f=i||1,p=l-1,{min:m,max:h}=t,g=!k(a),_=!k(o),v=!k(c),y=(h-m)/(u+1),b=nt((h-m)/p/f)*f,x,S,C,w;if(b<1e-14&&!g&&!_)return[{value:m},{value:h}];w=Math.ceil(h/b)-Math.floor(m/b),w>p&&(b=nt(w*b/p/f)*f),k(s)||(x=10**s,b=Math.ceil(b*x)/x),r===`ticks`?(S=Math.floor(m/b)*b,C=Math.ceil(h/b)*b):(S=m,C=h),g&&_&&i&&ot((o-a)/i,b/1e3)?(w=Math.round(Math.min((o-a)/b,l)),b=(o-a)/w,S=a,C=o):v?(S=g?a:S,C=_?o:C,w=c-1,b=(C-S)/w):(w=(C-S)/b,w=tt(w,Math.round(w),b/1e3)?Math.round(w):Math.ceil(w));let T=Math.max(lt(b),lt(S));x=10**(k(s)?T:s),S=Math.round(S*x)/x,C=Math.round(C*x)/x;let E=0;for(g&&(d&&S!==a?(n.push({value:a}),So)break;n.push({value:e})}return _&&d&&C!==o?n.length&&tt(n[n.length-1].value,o,Mc(o,y,e))?n[n.length-1].value=o:n.push({value:o}):(!_||C===o)&&n.push({value:C}),n}function Mc(e,t,{horizontal:n,minRotation:r}){let i=V(r),a=(n?Math.sin(i):Math.cos(i))||.001,o=.75*t*(``+e).length;return Math.min(t/a,o)}var Nc=class extends Ya{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,t){return k(e)||(typeof e==`number`||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){let{beginAtZero:e}=this.options,{minDefined:t,maxDefined:n}=this.getUserBounds(),{min:r,max:i}=this,a=e=>r=t?r:e,o=e=>i=n?i:e;if(e){let e=B(r),t=B(i);e<0&&t<0?o(0):e>0&&t>0&&a(0)}if(r===i){let t=i===0?1:Math.abs(i*.05);o(i+t),e||a(r-t)}this.min=r,this.max=i}getTickLimit(){let{maxTicksLimit:e,stepSize:t}=this.options.ticks,n;return t?(n=Math.ceil(this.max/t)-Math.floor(this.min/t)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${t} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e||=11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return 1/0}buildTicks(){let e=this.options,t=e.ticks,n=this.getTickLimit();n=Math.max(2,n);let r=jc({maxTicks:n,bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:t.includeBounds!==!1},this._range||this);return e.bounds===`ticks`&&st(r,this,`value`),e.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){let e=this.ticks,t=this.min,n=this.max;if(super.configure(),this.options.offset&&e.length){let r=(n-t)/Math.max(e.length-1,1)/2;t-=r,n+=r}this._startValue=t,this._endValue=n,this._valueRange=n-t}getLabelForValue(e){return Ut(e,this.chart.options.locale,this.options.ticks.format)}},Pc=class extends Nc{static id=`linear`;static defaults={ticks:{callback:Kt.formatters.numeric}};determineDataLimits(){let{min:e,max:t}=this.getMinMax(!0);this.min=M(e)?e:0,this.max=M(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){let e=this.isHorizontal(),t=e?this.width:this.height,n=V(this.options.ticks.minRotation),r=(e?Math.sin(n):Math.cos(n))||.001,i=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,i.lineHeight/r))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}},Fc=e=>Math.floor(et(e)),Ic=(e,t)=>10**(Fc(e)+t);function Lc(e){return e/10**Fc(e)==1}function Rc(e,t,n){let r=10**n,i=Math.floor(e/r);return Math.ceil(t/r)-i}function zc(e,t){let n=Fc(t-e);for(;Rc(e,t,n)>10;)n++;for(;Rc(e,t,n)<10;)n--;return Math.min(n,Fc(e))}function Bc(e,{min:t,max:n}){t=N(e.min,t);let r=[],i=Fc(t),a=zc(t,n),o=a<0?10**Math.abs(a):1,s=10**a,c=i>a?10**i:0,l=Math.round((t-c)*o)/o,u=Math.floor((t-c)/s/10)*s*10,d=Math.floor((l-u)/10**a),f=N(e.min,Math.round((c+u+d*10**a)*o)/o);for(;f=10?d=d<15?15:20:d++,d>=20&&(a++,d=2,o=a>=0?1:o),f=Math.round((c+u+d*10**a)*o)/o;let p=N(e.max,f);return r.push({value:p,major:Lc(p),significand:d}),r}(class extends Ya{static id=`logarithmic`;static defaults={ticks:{callback:Kt.formatters.logarithmic,major:{enabled:!0}}};constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,t){let n=Nc.prototype.parse.apply(this,[e,t]);if(n===0){this._zero=!0;return}return M(n)&&n>0?n:null}determineDataLimits(){let{min:e,max:t}=this.getMinMax(!0);this.min=M(e)?Math.max(0,e):null,this.max=M(t)?Math.max(0,t):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!M(this._userMin)&&(this.min=e===Ic(this.min,0)?Ic(this.min,-1):Ic(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:e,maxDefined:t}=this.getUserBounds(),n=this.min,r=this.max,i=t=>n=e?n:t,a=e=>r=t?r:e;n===r&&(n<=0?(i(1),a(10)):(i(Ic(n,-1)),a(Ic(r,1)))),n<=0&&i(Ic(r,-1)),r<=0&&a(Ic(n,1)),this.min=n,this.max=r}buildTicks(){let e=this.options,t=Bc({min:this._userMin,max:this._userMax},this);return e.bounds===`ticks`&&st(t,this,`value`),e.reverse?(t.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),t}getLabelForValue(e){return e===void 0?`0`:Ut(e,this.chart.options.locale,this.options.ticks.format)}configure(){let e=this.min;super.configure(),this._startValue=et(e),this._valueRange=et(this.max)-et(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(et(e)-this._startValue)/this._valueRange)}getValueForPixel(e){let t=this.getDecimalForPixel(e);return 10**(this._startValue+t*this._valueRange)}});function Vc(e){let t=e.ticks;if(t.display&&e.display){let e=q(t.backdropPadding);return P(t.font&&t.font.size,K.font.size)+e.height}return 0}function Hc(e,t,n){return n=A(n)?n:[n],{w:en(e,t.string,n),h:n.length*t.lineHeight}}function Uc(e,t,n,r,i){return e===r||e===i?{start:t-n/2,end:t+n/2}:ei?{start:t-n,end:t}:{start:t,end:t+n}}function Wc(e){let t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},n=Object.assign({},t),r=[],i=[],a=e._pointLabels.length,o=e.options.pointLabels,s=o.centerPointLabels?L/a:0;for(let c=0;ct.r&&(s=(r.end-t.r)/a,e.r=Math.max(e.r,t.r+s)),i.startt.b&&(c=(i.end-t.b)/o,e.b=Math.max(e.b,t.b+c))}function Kc(e,t,n){let r=e.drawingArea,{extra:i,additionalAngle:a,padding:o,size:s}=n,c=e.getPointPosition(t,r+i+o,a),l=Math.round(ct(H(c.angle+z))),u=Zc(c.y,s.h,l),d=Yc(l),f=Xc(c.x,s.w,d);return{visible:!0,x:c.x,y:u,textAlign:d,left:f,top:u,right:f+s.w,bottom:u+s.h}}function qc(e,t){if(!t)return!0;let{left:n,top:r,right:i,bottom:a}=e;return!(on({x:n,y:r},t)||on({x:n,y:a},t)||on({x:i,y:r},t)||on({x:i,y:a},t))}function Jc(e,t,n){let r=[],i=e._pointLabels.length,a=e.options,{centerPointLabels:o,display:s}=a.pointLabels,c={extra:Vc(a)/2,additionalAngle:o?L/i:0},l;for(let a=0;a270||n<90)&&(e-=t),e}function Qc(e,t,n){let{left:r,top:i,right:a,bottom:o}=n,{backdropColor:s}=t;if(!k(s)){let n=Sn(t.borderRadius),c=q(t.backdropPadding);e.fillStyle=s;let l=r-c.left,u=i-c.top,d=a-r+c.width,f=o-i+c.height;Object.values(n).some(e=>e!==0)?(e.beginPath(),hn(e,{x:l,y:u,w:d,h:f,radius:n}),e.fill()):e.fillRect(l,u,d,f)}}function $c(e,t){let{ctx:n,options:{pointLabels:r}}=e;for(let i=t-1;i>=0;i--){let t=e._pointLabelItems[i];if(!t.visible)continue;let a=r.setContext(e.getPointLabelContext(i));Qc(n,a,t);let o=J(a.font),{x:s,y:c,textAlign:l}=t;mn(n,e._pointLabels[i],s,c+o.lineHeight/2,o,{color:a.color,textAlign:l,textBaseline:`middle`})}}function el(e,t,n,r){let{ctx:i}=e;if(n)i.arc(e.xCenter,e.yCenter,t,0,R);else{let n=e.getPointPosition(0,t);i.moveTo(n.x,n.y);for(let a=1;a{let n=F(this.options.pointLabels.callback,[e,t],this);return n||n===0?n:``}).filter((e,t)=>this.chart.getDataVisibility(t))}fit(){let e=this.options;e.display&&e.pointLabels.display?Wc(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,t,n,r){this.xCenter+=Math.floor((e-t)/2),this.yCenter+=Math.floor((n-r)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,t,n,r))}getIndexAngle(e){let t=R/(this._pointLabels.length||1),n=this.options.startAngle||0;return H(e*t+V(n))}getDistanceFromCenterForValue(e){if(k(e))return NaN;let t=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*t:(e-this.min)*t}getValueForDistanceFromCenter(e){if(k(e))return NaN;let t=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(e){let t=this._pointLabels||[];if(e>=0&&e{if(t!==0||t===0&&this.min<0){s=this.getDistanceFromCenterForValue(e.value);let n=this.getContext(t),o=r.setContext(n),c=i.setContext(n);tl(this,o,s,a,c)}}),n.display){for(e.save(),o=a-1;o>=0;o--){let r=n.setContext(this.getPointLabelContext(o)),{color:i,lineWidth:a}=r;!a||!i||(e.lineWidth=a,e.strokeStyle=i,e.setLineDash(r.borderDash),e.lineDashOffset=r.borderDashOffset,s=this.getDistanceFromCenterForValue(t.reverse?this.min:this.max),c=this.getPointPosition(o,s),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(c.x,c.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){let e=this.ctx,t=this.options,n=t.ticks;if(!n.display)return;let r=this.getIndexAngle(0),i,a;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(r),e.textAlign=`center`,e.textBaseline=`middle`,this.ticks.forEach((r,o)=>{if(o===0&&this.min>=0&&!t.reverse)return;let s=n.setContext(this.getContext(o)),c=J(s.font);if(i=this.getDistanceFromCenterForValue(this.ticks[o].value),s.showLabelBackdrop){e.font=c.string,a=e.measureText(r.label).width,e.fillStyle=s.backdropColor;let t=q(s.backdropPadding);e.fillRect(-a/2-t.left,-i-c.size/2-t.top,a+t.width,c.size+t.height)}mn(e,r.label,0,-i,c,{color:s.color,strokeColor:s.textStrokeColor,strokeWidth:s.textStrokeWidth})}),e.restore()}drawTitle(){}});var rl={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},$=Object.keys(rl);function il(e,t){return e-t}function al(e,t){if(k(t))return null;let n=e._adapter,{parser:r,round:i,isoWeekday:a}=e._parseOpts,o=t;return typeof r==`function`&&(o=r(o)),M(o)||(o=typeof r==`string`?n.parse(o,r):n.parse(o)),o===null?null:(i&&(o=i===`week`&&(at(a)||a===!0)?n.startOf(o,`isoWeek`,a):n.startOf(o,i)),+o)}function ol(e,t,n,r){let i=$.length;for(let a=$.indexOf(e);a=$.indexOf(n);a--){let n=$[a];if(rl[n].common&&e._adapter.diff(i,r,n)>=t-1)return n}return $[n?$.indexOf(n):0]}function cl(e){for(let t=$.indexOf(e)+1,n=$.length;t=t?n[r]:n[i];e[a]=!0}}function ul(e,t,n,r){let i=e._adapter,a=+i.startOf(t[0].value,r),o=t[t.length-1].value,s,c;for(s=a;s<=o;s=+i.add(s,1,r))c=n[s],c>=0&&(t[c].major=!0);return t}function dl(e,t,n){let r=[],i={},a=t.length,o,s;for(o=0;o+e.value))}initOffsets(e=[]){let t=0,n=0,r,i;this.options.offset&&e.length&&(r=this.getDecimalForValue(e[0]),t=e.length===1?1-r:(this.getDecimalForValue(e[1])-r)/2,i=this.getDecimalForValue(e[e.length-1]),n=e.length===1?i:(i-this.getDecimalForValue(e[e.length-2]))/2);let a=e.length<3?.5:.25;t=U(t,0,a),n=U(n,0,a),this._offsets={start:t,end:n,factor:1/(t+1+n)}}_generate(){let e=this._adapter,t=this.min,n=this.max,r=this.options,i=r.time,a=i.unit||ol(i.minUnit,t,n,this._getLabelCapacity(t)),o=P(r.ticks.stepSize,1),s=a===`week`?i.isoWeekday:!1,c=at(s)||s===!0,l={},u=t,d,f;if(c&&(u=+e.startOf(u,`isoWeek`,s)),u=+e.startOf(u,c?`day`:a),e.diff(n,t,a)>1e5*o)throw Error(t+` and `+n+` are too far apart with stepSize of `+o+` `+a);let p=r.ticks.source===`data`&&this.getDataTimestamps();for(d=u,f=0;d+e)}getLabelForValue(e){let t=this._adapter,n=this.options.time;return n.tooltipFormat?t.format(e,n.tooltipFormat):t.format(e,n.displayFormats.datetime)}format(e,t){let n=this.options.time.displayFormats,r=this._unit,i=t||n[r];return this._adapter.format(e,i)}_tickFormatFunction(e,t,n,r){let i=this.options,a=i.ticks.callback;if(a)return F(a,[e,t,n],this);let o=i.time.displayFormats,s=this._unit,c=this._majorUnit,l=s&&o[s],u=c&&o[c],d=n[t],f=c&&u&&d&&d.major;return this._adapter.format(e,r||(f?u:l))}generateTickLabels(e){let t,n,r;for(t=0,n=e.length;t0?o:1}getDataTimestamps(){let e=this._cache.data||[],t,n;if(e.length)return e;let r=this.getMatchingVisibleMetas();if(this._normalized&&r.length)return this._cache.data=r[0].controller.getAllParsedValues(this);for(t=0,n=r.length;t=e[r].pos&&t<=e[i].pos&&({lo:r,hi:i}=gt(e,`pos`,t)),{pos:a,time:s}=e[r],{pos:o,time:c}=e[i]):(t>=e[r].time&&t<=e[i].time&&({lo:r,hi:i}=gt(e,`time`,t)),{time:a,pos:s}=e[r],{time:o,pos:c}=e[i]);let l=o-a;return l?s+(c-s)*(t-a)/l:s}(class extends fl{static id=`timeseries`;static defaults=fl.defaults;constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let e=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(e);this._minPos=pl(t,this.min),this._tableRange=pl(t,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){let{min:t,max:n}=this,r=[],i=[],a,o,s,c,l;for(a=0,o=e.length;a=t&&c<=n&&r.push(c);if(r.length<2)return[{time:t,pos:0},{time:n,pos:1}];for(a=0,o=r.length;ae-t)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;let t=this.getDataTimestamps(),n=this.getLabelTimestamps();return e=t.length&&n.length?this.normalize(t.concat(n)):t.length?t:n,e=this._cache.all=e,e}getDecimalForValue(e){return(pl(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){let t=this._offsets,n=this.getDecimalForPixel(e)/t.factor-t.end;return pl(this._table,n*this._tableRange+this._minPos,!0)}});async function ml(e,t,n={}){let{connectTimeoutMs:r=15e3,idleTimeoutMs:i=5e3,onPhaseChange:a}=n,o=new AbortController,s=!1,c=null,l=setTimeout(()=>{s||o.abort(Error(`Connection timeout`))},r),u=()=>{c&&clearTimeout(c),c=setTimeout(()=>{o.abort(Error(`Stream stalled`))},i)};a?.(`connecting`);try{return await d.get(e,t,{signal:o.signal,timeout:0,onDownloadProgress:e=>{!s&&(e.loaded??0)>0?(s=!0,clearTimeout(l),a?.(`receiving`),u()):s&&u()}})}finally{clearTimeout(l),c&&clearTimeout(c)}}var hl={class:`relative`},gl={key:0,class:`absolute inset-0 flex flex-col items-center justify-center bg-surface/80 backdrop-blur-sm z-10`},_l={key:0,class:`mt-2 text-sm text-content-secondary`},vl={key:1,class:`absolute top-3 right-3 flex items-center gap-1.5 z-10`},yl={key:2,class:`absolute inset-0 flex flex-col items-center justify-center bg-surface/80 backdrop-blur-sm z-10`},bl={class:`text-xs text-content-secondary mt-1 max-w-[12rem] text-center`},xl={key:0,class:`mt-2 text-xs text-content-muted`},Sl=i({__name:`ChartCard`,props:{isLoading:{type:Boolean},isUpdating:{type:Boolean},error:{},status:{},autoRetryMs:{}},emits:[`retry`],setup(i,{emit:d}){let p=i,m=d,h=r(0),g=null,_=null,v=()=>{g&&=(clearInterval(g),null),_&&=(clearTimeout(_),null),h.value=0};return n(()=>p.error,e=>{if(v(),!e)return;let t=p.autoRetryMs??3e4;h.value=Math.round(t/1e3),g=setInterval(()=>{h.value=Math.max(0,h.value-1),h.value===0&&v()},1e3),_=setTimeout(()=>{v(),m(`retry`)},t)}),u(v),(n,r)=>(a(),l(`div`,hl,[t(n.$slots,`default`),i.isLoading?(a(),l(`div`,gl,[s(f),i.status?(a(),l(`p`,_l,e(i.status),1)):o(``,!0)])):i.isUpdating&&!i.error?(a(),l(`div`,vl,[s(f,{size:`xs`,color:`current`,class:`text-content-muted`}),r[1]||=c(`span`,{class:`text-xs text-content-muted`},`Updating`,-1)])):o(``,!0),i.error&&!i.isLoading?(a(),l(`div`,yl,[r[2]||=c(`svg`,{xmlns:`http://www.w3.org/2000/svg`,class:`w-8 h-8 text-accent-red mb-2`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,"stroke-width":`2`},[c(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,d:`M12 9v4m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z`})],-1),r[3]||=c(`p`,{class:`text-sm font-semibold text-content-primary`},`Loading Failed`,-1),c(`p`,bl,e(i.error),1),c(`button`,{class:`btn-secondary mt-3 text-xs px-3 py-1.5`,onClick:r[0]||=e=>m(`retry`)},`Retry`),h.value>0?(a(),l(`p`,xl,`Retrying in `+e(h.value)+`s`,1)):o(``,!0)])):o(``,!0)]))}});export{ic as _,vs as a,Ai as c,Pc as d,cs as f,Ys as g,Pi as h,Oi as i,ji as l,fl as m,ml as n,Ac as o,Mi as p,qo as r,Lo as s,Sl as t,os as u,sc as v,Tc as y}; \ No newline at end of file diff --git a/repeater/web/html/assets/Companions-BWlxamyY.js b/repeater/web/html/assets/Companions-BWlxamyY.js new file mode 100644 index 0000000..45e5bbe --- /dev/null +++ b/repeater/web/html/assets/Companions-BWlxamyY.js @@ -0,0 +1 @@ +import{Ct as e,E as t,R as n,S as r,V as i,Y as a,c as o,f as ee,g as s,i as c,j as l,k as u,l as d,m as f,nt as p,o as m,p as h,r as g,s as _,u as v,xt as y}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{a as b,i as x,s as S,u as C}from"./runtime-dom.esm-bundler-fKU3dih-.js";import{t as w}from"./api-C0ctTLHN.js";import{t as T}from"./Spinner-CYvUNW0P.js";import{n as E}from"./index-BpKhPa08.js";import{t as D}from"./ConfirmDialog-XtZRdfP5.js";import{t as O}from"./MessageDialog-Bs1UHPdw.js";var k={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`},A={id:`import-modal-description`,class:`text-content-secondary dark:text-content-muted text-sm mb-4`},j={class:`mb-4`},M={class:`flex items-center gap-2 mb-2`},N={key:0,class:`text-content-muted dark:text-content-muted text-xs mb-2`},P={key:1,class:`flex flex-wrap gap-3 ml-6`},F=[`value`],I={class:`text-content-primary dark:text-content-primary text-sm capitalize`},L={class:`border-t border-stroke-subtle dark:border-white/10 pt-4 mt-4 mb-4`},R={class:`flex flex-wrap gap-3 mb-2`},z=[`value`],B={class:`text-content-primary dark:text-content-primary text-sm`},V={class:`flex flex-wrap items-center gap-2 mt-2`},H={class:`flex items-center gap-2`},te={key:1,class:`text-content-muted dark:text-content-muted text-sm`},ne={class:`border-t border-stroke-subtle dark:border-white/10 pt-4 mt-4 mb-4`},re={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`},U={key:1,class:`text-content-muted dark:text-content-muted text-sm mb-4`},ae={class:`flex justify-end gap-3`},W=[`disabled`],G=[`disabled`],K=s({name:`ImportRepeaterContactsModal`,__name:`ImportRepeaterContactsModal`,props:{isOpen:{type:Boolean},companionName:{}},emits:[`close`,`imported`],setup(t,{emit:ee}){let s=[`companion`,`repeater`,`room_server`,`sensor`],f=[{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),y=t,T=ee,E=a(!1),D=a(null),O=a(!0),K=a([]),q=a(null),J=a(``),Y=a(``),X=a(null),oe=a(null);function Z(){let e=q.value;if(e===null||e===`custom`){if(e===`custom`){let e=J.value;if(e===``||e===null)return;let t=Number(e);return Number.isInteger(t)&&t>=1?t:void 0}return}return e}function Q(){let e=Y.value;if(e===``||e===null)return;let t=Number(e);return Number.isInteger(t)&&t>=1?t:void 0}function se(){O.value=!0,K.value=[],q.value=null,J.value=``,Y.value=``,D.value=null}n(()=>y.isOpen,e=>{e&&(se(),r(()=>{oe.value?.focus()}))}),n(q,e=>{e===`custom`&&r(()=>{X.value?.focus()})});let ce=m(()=>{let e=O.value?`All types`:K.value.map(e=>e.replace(`_`,` `)).join(`, `),t,n=q.value;if(n===null)t=`all time`;else if(n===`custom`){let e=Z();t=e===void 0?`custom`:`last ${e} hours`}else t=n===24?`last 24 hours`:n===168?`last 7 days`:n===720?`last 30 days`:`all time`;let r=Q(),i=r===void 0?`no limit`:`max ${r} contacts`;return`Import: ${e}, ${t}, ${i}.`});function le(){if(q.value===`custom`){let e=Z();if(e===void 0||e<1)return`Custom recency must be at least 1 hour.`}let e=Q();if(Y.value!==``&&(e===void 0||e<1))return`Limit must be at least 1.`;if(!O.value&&K.value.length===0)return`Select at least one contact type or use All types.`;if(!O.value){let e=K.value.filter(e=>!s.includes(e));if(e.length>0)return`Invalid contact type: ${e.join(`, `)}`}return null}async function ue(){D.value=null;let e=le();if(e){D.value=e;return}let t={companion_name:y.companionName};!O.value&&K.value.length>0&&(t.contact_types=[...K.value]);let n=Z();n!==void 0&&(t.hours=n);let r=Q();r!==void 0&&(t.limit=r),E.value=!0;try{let e=await w.importRepeaterContacts(t);e.success&&e.data?(T(`imported`,e.data.imported),T(`close`)):D.value=e.error||`Import failed.`}catch(e){D.value=e instanceof Error?e.message:`Import failed.`}finally{E.value=!1}}function de(e){e.key===`Escape`&&T(`close`)}return(n,r)=>(u(),o(c,{to:`body`},[t.isOpen?(u(),v(`div`,{key:0,class:`fixed inset-0 bg-black/50 backdrop-blur-lg flex items-center justify-center z-[350] p-4`,onClick:r[7]||=C(e=>T(`close`),[`self`]),onKeydown:de},[_(`div`,k,[r[18]||=_(`h2`,{class:`text-xl font-bold text-content-primary dark:text-content-primary mb-4`},` Import repeater contacts `,-1),_(`p`,A,[r[8]||=h(` Seed `,-1),_(`strong`,null,e(t.companionName),1),r[9]||=h(` with contacts from the repeater's adverts. Results are ordered by most recent first. `,-1)]),_(`div`,j,[r[11]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},` Contact types `,-1),_(`label`,M,[i(_(`input`,{ref_key:`firstFocusRef`,ref:oe,"onUpdate:modelValue":r[0]||=e=>O.value=e,type:`checkbox`,class:`rounded border-stroke-subtle dark:border-stroke/20 text-primary focus:ring-primary/50`},null,512),[[x,O.value]]),r[10]||=_(`span`,{class:`text-content-primary dark:text-content-primary text-sm`},`All types`,-1)]),O.value?(u(),v(`p`,N,` Uncheck to filter by type (repeater, companion, room server, sensor). `)):d(``,!0),O.value?d(``,!0):(u(),v(`div`,P,[(u(),v(g,null,l(s,t=>_(`label`,{key:t,class:`flex items-center gap-2`},[i(_(`input`,{"onUpdate:modelValue":r[1]||=e=>K.value=e,type:`checkbox`,value:t,class:`rounded border-stroke-subtle dark:border-stroke/20 text-primary focus:ring-primary/50`},null,8,F),[[x,K.value]]),_(`span`,I,e(t.replace(`_`,` `)),1)])),64))]))]),_(`div`,L,[r[13]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},` Recency `,-1),_(`div`,R,[(u(!0),v(g,null,l(p(f),t=>(u(),v(`label`,{key:t.label,class:`flex items-center gap-2`},[i(_(`input`,{"onUpdate:modelValue":r[2]||=e=>q.value=e,type:`radio`,value:t.value,class:`border-stroke-subtle dark:border-stroke/20 text-primary focus:ring-primary/50`},null,8,z),[[b,q.value]]),_(`span`,B,e(t.label),1)]))),128))]),_(`div`,V,[_(`label`,H,[i(_(`input`,{"onUpdate:modelValue":r[3]||=e=>q.value=e,type:`radio`,value:`custom`,class:`border-stroke-subtle dark:border-stroke/20 text-primary focus:ring-primary/50`},null,512),[[b,q.value]]),r[12]||=_(`span`,{class:`text-content-primary dark:text-content-primary text-sm`},`Custom:`,-1)]),q.value===`custom`?i((u(),v(`input`,{key:0,ref_key:`customHoursInputRef`,ref:X,"onUpdate:modelValue":r[4]||=e=>J.value=e,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)),[[S,J.value,void 0,{number:!0}]]):d(``,!0),q.value===`custom`?(u(),v(`span`,te,`hours`)):d(``,!0)])]),_(`div`,ne,[r[16]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},` Max contacts (optional) `,-1),_(`div`,re,[r[14]||=_(`span`,{class:`text-content-muted dark:text-content-muted text-sm`},`Import at most`,-1),i(_(`input`,{"onUpdate:modelValue":r[5]||=e=>Y.value=e,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),[[S,Y.value,void 0,{number:!0}]]),r[15]||=_(`span`,{class:`text-content-muted dark:text-content-muted text-sm`},`contacts`,-1)]),r[17]||=_(`p`,{class:`text-content-muted dark:text-content-muted text-xs mt-1`},` Leave empty for no cap. Server caps at companion max. `,-1)]),D.value?(u(),v(`div`,ie,e(D.value),1)):d(``,!0),D.value?d(``,!0):(u(),v(`p`,U,e(ce.value),1)),_(`div`,ae,[_(`button`,{type:`button`,disabled:E.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]||=e=>T(`close`)},` Cancel `,8,W),_(`button`,{type:`button`,disabled:E.value,class:`btn-primary`,onClick:ue},e(E.value?`Importing…`:`Import`),9,G)])])],32)):d(``,!0)]))}}),q={class:`p-6 space-y-6`},J={key:0,class:`grid grid-cols-1 md:grid-cols-3 gap-4`},Y={class:`glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-5`},X={class:`flex items-center justify-between`},oe={class:`text-3xl font-bold text-content-primary dark:text-content-primary mb-1`},Z={class:`glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-5`},Q={class:`flex items-center justify-between`},se={class:`text-3xl font-bold text-primary mb-1`},ce={class:`glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-5`},le={class:`flex items-center justify-between`},ue={key:0,class:`w-6 h-6 text-accent-green`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},de={key:1,class:`w-6 h-6 text-accent-yellow`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},fe={class:`glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-6`},pe={key:0,class:`flex items-center justify-center py-12`},me={class:`text-center`},he={key:1,class:`flex items-center justify-center py-12`},ge={class:`text-center`},_e={class:`text-content-secondary dark:text-content-muted text-sm mb-4`},ve={key:2,class:`space-y-4`},ye={class:`flex items-start justify-between`},be={class:`flex-1`},xe={class:`flex items-center gap-3 mb-4`},Se={class:`relative`},Ce={key:0,class:`absolute inset-0 bg-accent-green/50 rounded-full animate-ping`},we={class:`text-xl font-bold text-content-primary dark:text-content-primary`},Te={key:0,class:`text-content-muted dark:text-content-muted text-sm`},Ee={class:`grid grid-cols-1 md:grid-cols-2 gap-3 text-sm mb-3`},De={class:`text-content-primary dark:text-content-primary/90 ml-2`},Oe={class:`text-content-primary dark:text-content-primary/90 ml-2`},ke={class:`text-content-primary dark:text-content-primary/90 ml-2`},Ae={class:`flex items-center gap-2`},je={key:0,class:`text-content-primary dark:text-content-primary/90 font-mono ml-2 text-xs`},Me={key:1,class:`text-content-muted dark:text-content-muted ml-2 text-xs`},Ne=[`onClick`],Pe={class:`text-xs text-content-muted dark:text-content-muted`},Fe={key:0,class:`ml-2 font-mono text-content-primary dark:text-content-primary/90 break-all`},Ie={key:1,class:`ml-2 text-content-muted dark:text-content-muted`},Le={class:`ml-4 flex flex-wrap gap-2`},Re=[`onClick`],ze=[`onClick`],Be=[`onClick`],Ve={key:3,class:`text-center py-12 text-content-secondary dark:text-content-muted`},He={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`},Ue={class:`space-y-4`},We={class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},Ge={key:0},Ke={key:1,class:`text-content-secondary dark:text-content-muted text-sm`},qe={class:`grid grid-cols-2 gap-4`},Je={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`},Ye={class:`space-y-4`},Xe={class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},Ze={key:0},Qe={class:`grid grid-cols-2 gap-4`},$e=5050,et=1,tt=65535,nt=s({name:`CompanionsView`,__name:`Companions`,setup(n){let r=a(!1),s=a(null),p=a(null),b=a(!1),x=a(!1),k=a(!1),A=a(null),j=a(``),M=a(!1),N=a(!1),P=a(new Set),F=a(!1),I=a(``),L=a(!1),R=a(``),z=a(!1),B=a({message:``,variant:`success`}),V=a({name:``,identity_key:``,type:`companion`,settings:{node_name:``,tcp_port:5e3,bind_address:`0.0.0.0`}});t(async()=>{await H()});async function H(){r.value=!0,s.value=null;try{let e=await w.getIdentities();e.success?p.value=e.data:s.value=e.error||`Failed to load identities`}catch(e){s.value=e instanceof Error?e.message:`Failed to load identities`}finally{r.value=!1}}async function te(){try{let e=await w.createIdentity({...V.value,settings:{node_name:V.value.settings.node_name||V.value.name,tcp_port:V.value.settings.tcp_port??5e3,bind_address:V.value.settings.bind_address||`0.0.0.0`}});e.success?(b.value=!1,W(),await H(),U(e.message||`Companion created successfully!`,`success`)):U(`Failed to create companion: ${e.error}`,`error`)}catch(e){U(`Error creating companion: ${e}`,`error`)}}async function ne(){let e={name:j.value,identity_key:A.value.identity_key,type:`companion`,settings:{node_name:A.value.settings?.node_name,tcp_port:A.value.settings?.tcp_port,bind_address:A.value.settings?.bind_address}};A.value.name!==j.value&&(e.new_name=A.value.name);try{let t=await w.updateIdentity(e);t.success?(x.value=!1,A.value=null,await H(),k.value=!0):U(`Failed to update companion: ${t.error}`,`error`)}catch(e){U(`Error updating companion: ${e}`,`error`)}}function re(e){I.value=e,F.value=!0}async function ie(){let e=I.value;F.value=!1;try{let t=await w.deleteIdentity(e,`companion`);t.success?(await H(),U(t.message||`Companion deleted successfully!`,`success`)):U(`Failed to delete companion: ${t.error}`,`error`)}catch(e){U(`Error deleting companion: ${e}`,`error`)}finally{I.value=``}}function U(e,t){B.value={message:e,variant:t},z.value=!0}function ae(e){A.value=JSON.parse(JSON.stringify(e)),j.value=A.value.name,delete A.value.new_name,A.value.settings||(A.value.settings={node_name:``,tcp_port:5e3,bind_address:`0.0.0.0`}),N.value=!1,x.value=!0}function W(){V.value={name:``,identity_key:``,type:`companion`,settings:{node_name:``,tcp_port:5e3,bind_address:`0.0.0.0`}},M.value=!1}function G(){b.value=!1,x.value=!1,A.value=null,M.value=!1,N.value=!1,W()}function nt(e){P.value.has(e)?P.value.delete(e):P.value.add(e)}let rt=()=>p.value?.configured_companions??[],it=m(()=>p.value?.configured_companions?.length??0),at=m(()=>p.value?.configured_companions?.filter(e=>e.registered).length??0),$=m(()=>at.value===it.value);function ot(){let e=rt();if(e.length===0)return $e;let t=e.map(e=>e.settings?.tcp_port??5e3),n=Math.max(...t)+1;return Math.min(tt,Math.max(et,n))}function st(){W(),V.value.settings.tcp_port=ot(),b.value=!0}function ct(e){R.value=e,L.value=!0}function lt(){L.value=!1,R.value=``}function ut(e){U(`Imported ${e} contact${e===1?``:`s`}.`,`success`),lt()}return(t,n)=>(u(),v(g,null,[_(`div`,q,[_(`div`,{class:`relative overflow-hidden rounded-[20px] p-6 mb-6 glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10`},[n[18]||=_(`div`,{class:`absolute inset-0 bg-gradient-to-br from-primary/20 via-secondary/10 to-accent-purple/20 opacity-50`},null,-1),n[19]||=_(`div`,{class:`absolute inset-0 bg-gradient-to-tl from-accent-green/10 via-transparent to-primary/10 animate-pulse`},null,-1),_(`div`,{class:`relative flex items-center justify-between`},[n[17]||=ee(`

Companions

Manage companion identities (TCP frame server)

`,1),_(`button`,{onClick:st,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`},[...n[16]||=[_(`span`,{class:`flex items-center gap-2`},[_(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[_(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 4v16m8-8H4`})]),h(` Add Companion `)],-1)]])])]),p.value&&it.value>0?(u(),v(`div`,J,[_(`div`,Y,[_(`div`,X,[_(`div`,null,[n[20]||=_(`div`,{class:`text-content-secondary dark:text-content-muted text-xs font-medium mb-2 uppercase tracking-wide`},` Total Configured `,-1),_(`div`,oe,e(it.value),1)]),n[21]||=_(`div`,{class:`bg-background-mute dark:bg-white/10 p-3 rounded-[12px]`},[_(`svg`,{class:`w-6 h-6 text-content-secondary dark:text-content-primary/70`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[_(`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)])]),_(`div`,Z,[_(`div`,Q,[_(`div`,null,[n[22]||=_(`div`,{class:`text-content-secondary dark:text-content-muted text-xs font-medium mb-2 uppercase tracking-wide`},` Currently Registered `,-1),_(`div`,se,e(at.value),1)]),n[23]||=_(`div`,{class:`bg-primary/20 p-3 rounded-[12px]`},[_(`svg`,{class:`w-6 h-6 text-primary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[_(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M5 13l4 4L19 7`})])],-1)])]),_(`div`,ce,[_(`div`,le,[_(`div`,null,[n[24]||=_(`div`,{class:`text-content-secondary dark:text-content-muted text-xs font-medium mb-2 uppercase tracking-wide`},` Status `,-1),_(`div`,{class:y([`text-3xl font-bold`,$.value?`text-accent-green`:`text-accent-yellow`])},e($.value?`Synced`:`Out of Sync`),3)]),_(`div`,{class:y([`p-3 rounded-[12px]`,$.value?`bg-accent-green/20`:`bg-accent-yellow/20`])},[$.value?(u(),v(`svg`,ue,[...n[25]||=[_(`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)]])):(u(),v(`svg`,de,[...n[26]||=[_(`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)])])])):d(``,!0),_(`div`,fe,[r.value?(u(),v(`div`,pe,[_(`div`,me,[f(T,{class:`mx-auto mb-4`}),n[27]||=_(`div`,{class:`text-content-secondary dark:text-content-primary/70`},` Loading companions... `,-1)])])):s.value?(u(),v(`div`,he,[_(`div`,ge,[n[28]||=_(`div`,{class:`text-red-600 dark:text-red-400 mb-2`},`Failed to load companions`,-1),_(`div`,_e,e(s.value),1),_(`button`,{onClick:H,class:`btn-primary`},` Retry `)])])):p.value&&rt().length>0?(u(),v(`div`,ve,[(u(!0),v(g,null,l(rt(),t=>(u(),v(`div`,{key:t.name,class:`glass-card backdrop-blur-xl rounded-[15px] p-5 border border-stroke-subtle dark:border-white/10`},[_(`div`,ye,[_(`div`,be,[_(`div`,xe,[_(`div`,Se,[t.registered?(u(),v(`div`,Ce)):d(``,!0),_(`div`,{class:y([`relative w-3 h-3 rounded-full`,t.registered?`bg-accent-green`:`bg-accent-red`])},null,2)]),_(`h3`,we,e(t.name),1),_(`span`,{class:y([`px-3 py-1 text-xs font-semibold rounded-full`,t.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`])},e(t.registered?`● Active`:`○ Inactive`),3),t.hash?(u(),v(`span`,Te,e(t.hash),1)):d(``,!0)]),_(`div`,Ee,[_(`div`,null,[n[29]||=_(`span`,{class:`text-content-muted dark:text-content-muted`},`Node Name:`,-1),_(`span`,De,e(t.settings?.node_name||t.name),1)]),_(`div`,null,[n[30]||=_(`span`,{class:`text-content-muted dark:text-content-muted`},`TCP Port:`,-1),_(`span`,Oe,e(t.settings?.tcp_port??5e3),1)]),_(`div`,null,[n[31]||=_(`span`,{class:`text-content-muted dark:text-content-muted`},`Bind Address:`,-1),_(`span`,ke,e(t.settings?.bind_address||`0.0.0.0`),1)]),_(`div`,Ae,[n[32]||=_(`span`,{class:`text-content-muted dark:text-content-muted`},`Identity Key:`,-1),P.value.has(t.name)?(u(),v(`span`,je,e(t.identity_key),1)):(u(),v(`span`,Me,`••••••••••••••••`)),_(`button`,{onClick:e=>nt(t.name),class:`text-primary/70 hover:text-primary text-xs underline`},e(P.value.has(t.name)?`Hide`:`Show`),9,Ne)])]),_(`div`,Pe,[n[33]||=_(`span`,{class:`text-content-muted dark:text-content-muted`},`Public Key:`,-1),t.public_key?(u(),v(`span`,Fe,e(t.public_key),1)):(u(),v(`span`,Ie,`—`))])]),_(`div`,Le,[_(`button`,{onClick:e=>ct(t.name),class:`btn-primary-xs`},` Import contacts `,8,Re),_(`button`,{onClick:e=>ae(t),class:`btn-primary-xs`},` Edit `,8,ze),_(`button`,{onClick:e=>re(t.name),class:`btn-danger-xs`},` Delete `,8,Be)])])]))),128))])):(u(),v(`div`,Ve,[n[34]||=_(`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`},[_(`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),n[35]||=_(`p`,{class:`text-lg mb-2`},`No companions configured`,-1),n[36]||=_(`p`,{class:`text-sm mb-4`},` Add a companion to run a TCP frame server for firmware or other clients `,-1),_(`button`,{onClick:st,class:`btn-primary`},` + Add Companion `)]))]),(u(),o(c,{to:`body`},[b.value?(u(),v(`div`,{key:0,class:`fixed inset-0 bg-black/50 backdrop-blur-lg flex items-center justify-center z-[300] p-4`,onClick:n[6]||=C(e=>b.value=!1,[`self`])},[_(`div`,He,[n[43]||=_(`h2`,{class:`text-xl font-bold text-content-primary dark:text-content-primary mb-4`},` Add Companion `,-1),_(`div`,Ue,[_(`div`,null,[n[37]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},`Name *`,-1),i(_(`input`,{"onUpdate:modelValue":n[0]||=e=>V.value.name=e,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),[[S,V.value.name]])]),_(`div`,null,[_(`label`,We,[n[38]||=h(` Identity Key (Optional) `,-1),_(`button`,{onClick:n[1]||=e=>M.value=!M.value,type:`button`,class:`ml-2 text-primary/70 hover:text-primary text-xs underline`},e(M.value?`Hide`:`Show/Edit`),1)]),M.value?(u(),v(`div`,Ge,[i(_(`input`,{"onUpdate:modelValue":n[2]||=e=>V.value.identity_key=e,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),[[S,V.value.identity_key]]),n[39]||=_(`p`,{class:`text-content-secondary dark:text-content-muted text-xs mt-1`},` 32 or 64 bytes hex. Leave empty to auto-generate. `,-1)])):(u(),v(`div`,Ke,` Will be auto-generated if not provided `))]),_(`div`,null,[n[40]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},`Node Name`,-1),i(_(`input`,{"onUpdate:modelValue":n[3]||=e=>V.value.settings.node_name=e,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),[[S,V.value.settings.node_name]])]),_(`div`,qe,[_(`div`,null,[n[41]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},`TCP Port`,-1),i(_(`input`,{"onUpdate:modelValue":n[4]||=e=>V.value.settings.tcp_port=e,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),[[S,V.value.settings.tcp_port,void 0,{number:!0}]])]),_(`div`,null,[n[42]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},`Bind Address`,-1),i(_(`input`,{"onUpdate:modelValue":n[5]||=e=>V.value.settings.bind_address=e,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),[[S,V.value.settings.bind_address]])])])]),_(`div`,{class:`flex justify-end gap-3 mt-6`},[_(`button`,{onClick:G,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 `),_(`button`,{onClick:te,class:`btn-primary`},` Create `)])])])):d(``,!0)])),(u(),o(c,{to:`body`},[x.value&&A.value?(u(),v(`div`,{key:0,class:`fixed inset-0 bg-black/50 backdrop-blur-lg flex items-center justify-center z-[300] p-4`,onClick:C(G,[`self`])},[_(`div`,Je,[n[49]||=_(`h2`,{class:`text-xl font-bold text-content-primary dark:text-content-primary mb-4`},` Edit Companion `,-1),_(`div`,Ye,[_(`div`,null,[n[44]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},`Name *`,-1),i(_(`input`,{"onUpdate:modelValue":n[7]||=e=>A.value.name=e,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),[[S,A.value.name]])]),_(`div`,null,[_(`label`,Xe,[n[45]||=h(` Identity Key (Optional) `,-1),_(`button`,{onClick:n[8]||=e=>N.value=!N.value,type:`button`,class:`ml-2 text-primary/70 hover:text-primary text-xs underline`},e(N.value?`Hide`:`Show/Edit`),1)]),N.value?(u(),v(`div`,Ze,[i(_(`input`,{"onUpdate:modelValue":n[9]||=e=>A.value.identity_key=e,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),[[S,A.value.identity_key]])])):d(``,!0)]),_(`div`,null,[n[46]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},`Node Name`,-1),i(_(`input`,{"onUpdate:modelValue":n[10]||=e=>A.value.settings.node_name=e,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),[[S,A.value.settings.node_name]])]),_(`div`,Qe,[_(`div`,null,[n[47]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},`TCP Port`,-1),i(_(`input`,{"onUpdate:modelValue":n[11]||=e=>A.value.settings.tcp_port=e,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),[[S,A.value.settings.tcp_port,void 0,{number:!0}]])]),_(`div`,null,[n[48]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},`Bind Address`,-1),i(_(`input`,{"onUpdate:modelValue":n[12]||=e=>A.value.settings.bind_address=e,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),[[S,A.value.settings.bind_address]])])])]),_(`div`,{class:`flex justify-end gap-3 mt-6`},[_(`button`,{onClick:G,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 `),_(`button`,{onClick:ne,class:`btn-primary`},` Update `)])])])):d(``,!0)]))]),f(K,{"is-open":L.value,"companion-name":R.value,onClose:lt,onImported:ut},null,8,[`is-open`,`companion-name`]),f(D,{show:F.value,title:`Delete Companion`,message:`Are you sure you want to delete '${I.value}'? Restart required to fully remove.`,"confirm-text":`Delete`,"cancel-text":`Cancel`,variant:`danger`,onClose:n[13]||=e=>F.value=!1,onConfirm:ie},null,8,[`show`,`message`]),f(O,{show:z.value,message:B.value.message,variant:B.value.variant,onClose:n[14]||=e=>z.value=!1},null,8,[`show`,`message`,`variant`]),f(E,{modelValue:k.value,"onUpdate:modelValue":n[15]||=e=>k.value=e,message:`Companion settings have been saved. A service restart is required for the changes to take effect.`},null,8,[`modelValue`])],64))}});export{nt as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/Companions-DMtu-VdK.js b/repeater/web/html/assets/Companions-DMtu-VdK.js deleted file mode 100644 index 68ed765..0000000 --- a/repeater/web/html/assets/Companions-DMtu-VdK.js +++ /dev/null @@ -1 +0,0 @@ -import{Ct as e,E as t,R as n,S as r,V as i,Y as a,c as o,f as ee,g as s,i as c,j as l,k as u,l as d,m as f,nt as p,o as m,p as h,r as g,s as _,u as v,xt as y}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{t as b}from"./api-DBiYn0RS.js";import{t as x}from"./Spinner-CYvUNW0P.js";import{d as S,g as C,p as w,u as T}from"./index-CG181k2K.js";import{t as E}from"./RestartModal-DDp7H13-.js";import{t as D}from"./ConfirmDialog-DZJrcPub.js";import{t as O}from"./MessageDialog-CgmXx0Yp.js";var k={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`},A={id:`import-modal-description`,class:`text-content-secondary dark:text-content-muted text-sm mb-4`},j={class:`mb-4`},M={class:`flex items-center gap-2 mb-2`},N={key:0,class:`text-content-muted dark:text-content-muted text-xs mb-2`},P={key:1,class:`flex flex-wrap gap-3 ml-6`},F=[`value`],I={class:`text-content-primary dark:text-content-primary text-sm capitalize`},L={class:`border-t border-stroke-subtle dark:border-white/10 pt-4 mt-4 mb-4`},R={class:`flex flex-wrap gap-3 mb-2`},z=[`value`],B={class:`text-content-primary dark:text-content-primary text-sm`},V={class:`flex flex-wrap items-center gap-2 mt-2`},H={class:`flex items-center gap-2`},te={key:1,class:`text-content-muted dark:text-content-muted text-sm`},ne={class:`border-t border-stroke-subtle dark:border-white/10 pt-4 mt-4 mb-4`},re={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`},U={key:1,class:`text-content-muted dark:text-content-muted text-sm mb-4`},ae={class:`flex justify-end gap-3`},W=[`disabled`],G=[`disabled`],K=s({name:`ImportRepeaterContactsModal`,__name:`ImportRepeaterContactsModal`,props:{isOpen:{type:Boolean},companionName:{}},emits:[`close`,`imported`],setup(t,{emit:ee}){let s=[`companion`,`repeater`,`room_server`,`sensor`],f=[{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),y=t,x=ee,E=a(!1),D=a(null),O=a(!0),K=a([]),q=a(null),J=a(``),Y=a(``),X=a(null),oe=a(null);function Z(){let e=q.value;if(e===null||e===`custom`){if(e===`custom`){let e=J.value;if(e===``||e===null)return;let t=Number(e);return Number.isInteger(t)&&t>=1?t:void 0}return}return e}function Q(){let e=Y.value;if(e===``||e===null)return;let t=Number(e);return Number.isInteger(t)&&t>=1?t:void 0}function se(){O.value=!0,K.value=[],q.value=null,J.value=``,Y.value=``,D.value=null}n(()=>y.isOpen,e=>{e&&(se(),r(()=>{oe.value?.focus()}))}),n(q,e=>{e===`custom`&&r(()=>{X.value?.focus()})});let ce=m(()=>{let e=O.value?`All types`:K.value.map(e=>e.replace(`_`,` `)).join(`, `),t,n=q.value;if(n===null)t=`all time`;else if(n===`custom`){let e=Z();t=e===void 0?`custom`:`last ${e} hours`}else t=n===24?`last 24 hours`:n===168?`last 7 days`:n===720?`last 30 days`:`all time`;let r=Q(),i=r===void 0?`no limit`:`max ${r} contacts`;return`Import: ${e}, ${t}, ${i}.`});function le(){if(q.value===`custom`){let e=Z();if(e===void 0||e<1)return`Custom recency must be at least 1 hour.`}let e=Q();if(Y.value!==``&&(e===void 0||e<1))return`Limit must be at least 1.`;if(!O.value&&K.value.length===0)return`Select at least one contact type or use All types.`;if(!O.value){let e=K.value.filter(e=>!s.includes(e));if(e.length>0)return`Invalid contact type: ${e.join(`, `)}`}return null}async function ue(){D.value=null;let e=le();if(e){D.value=e;return}let t={companion_name:y.companionName};!O.value&&K.value.length>0&&(t.contact_types=[...K.value]);let n=Z();n!==void 0&&(t.hours=n);let r=Q();r!==void 0&&(t.limit=r),E.value=!0;try{let e=await b.importRepeaterContacts(t);e.success&&e.data?(x(`imported`,e.data.imported),x(`close`)):D.value=e.error||`Import failed.`}catch(e){D.value=e instanceof Error?e.message:`Import failed.`}finally{E.value=!1}}function de(e){e.key===`Escape`&&x(`close`)}return(n,r)=>(u(),o(c,{to:`body`},[t.isOpen?(u(),v(`div`,{key:0,class:`fixed inset-0 bg-black/50 backdrop-blur-lg flex items-center justify-center z-[350] p-4`,onClick:r[7]||=C(e=>x(`close`),[`self`]),onKeydown:de},[_(`div`,k,[r[18]||=_(`h2`,{class:`text-xl font-bold text-content-primary dark:text-content-primary mb-4`},` Import repeater contacts `,-1),_(`p`,A,[r[8]||=h(` Seed `,-1),_(`strong`,null,e(t.companionName),1),r[9]||=h(` with contacts from the repeater's adverts. Results are ordered by most recent first. `,-1)]),_(`div`,j,[r[11]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},` Contact types `,-1),_(`label`,M,[i(_(`input`,{ref_key:`firstFocusRef`,ref:oe,"onUpdate:modelValue":r[0]||=e=>O.value=e,type:`checkbox`,class:`rounded border-stroke-subtle dark:border-stroke/20 text-primary focus:ring-primary/50`},null,512),[[T,O.value]]),r[10]||=_(`span`,{class:`text-content-primary dark:text-content-primary text-sm`},`All types`,-1)]),O.value?(u(),v(`p`,N,` Uncheck to filter by type (repeater, companion, room server, sensor). `)):d(``,!0),O.value?d(``,!0):(u(),v(`div`,P,[(u(),v(g,null,l(s,t=>_(`label`,{key:t,class:`flex items-center gap-2`},[i(_(`input`,{"onUpdate:modelValue":r[1]||=e=>K.value=e,type:`checkbox`,value:t,class:`rounded border-stroke-subtle dark:border-stroke/20 text-primary focus:ring-primary/50`},null,8,F),[[T,K.value]]),_(`span`,I,e(t.replace(`_`,` `)),1)])),64))]))]),_(`div`,L,[r[13]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},` Recency `,-1),_(`div`,R,[(u(!0),v(g,null,l(p(f),t=>(u(),v(`label`,{key:t.label,class:`flex items-center gap-2`},[i(_(`input`,{"onUpdate:modelValue":r[2]||=e=>q.value=e,type:`radio`,value:t.value,class:`border-stroke-subtle dark:border-stroke/20 text-primary focus:ring-primary/50`},null,8,z),[[S,q.value]]),_(`span`,B,e(t.label),1)]))),128))]),_(`div`,V,[_(`label`,H,[i(_(`input`,{"onUpdate:modelValue":r[3]||=e=>q.value=e,type:`radio`,value:`custom`,class:`border-stroke-subtle dark:border-stroke/20 text-primary focus:ring-primary/50`},null,512),[[S,q.value]]),r[12]||=_(`span`,{class:`text-content-primary dark:text-content-primary text-sm`},`Custom:`,-1)]),q.value===`custom`?i((u(),v(`input`,{key:0,ref_key:`customHoursInputRef`,ref:X,"onUpdate:modelValue":r[4]||=e=>J.value=e,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)),[[w,J.value,void 0,{number:!0}]]):d(``,!0),q.value===`custom`?(u(),v(`span`,te,`hours`)):d(``,!0)])]),_(`div`,ne,[r[16]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},` Max contacts (optional) `,-1),_(`div`,re,[r[14]||=_(`span`,{class:`text-content-muted dark:text-content-muted text-sm`},`Import at most`,-1),i(_(`input`,{"onUpdate:modelValue":r[5]||=e=>Y.value=e,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),[[w,Y.value,void 0,{number:!0}]]),r[15]||=_(`span`,{class:`text-content-muted dark:text-content-muted text-sm`},`contacts`,-1)]),r[17]||=_(`p`,{class:`text-content-muted dark:text-content-muted text-xs mt-1`},` Leave empty for no cap. Server caps at companion max. `,-1)]),D.value?(u(),v(`div`,ie,e(D.value),1)):d(``,!0),D.value?d(``,!0):(u(),v(`p`,U,e(ce.value),1)),_(`div`,ae,[_(`button`,{type:`button`,disabled:E.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]||=e=>x(`close`)},` Cancel `,8,W),_(`button`,{type:`button`,disabled:E.value,class:`btn-primary`,onClick:ue},e(E.value?`Importing…`:`Import`),9,G)])])],32)):d(``,!0)]))}}),q={class:`p-6 space-y-6`},J={key:0,class:`grid grid-cols-1 md:grid-cols-3 gap-4`},Y={class:`glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-5`},X={class:`flex items-center justify-between`},oe={class:`text-3xl font-bold text-content-primary dark:text-content-primary mb-1`},Z={class:`glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-5`},Q={class:`flex items-center justify-between`},se={class:`text-3xl font-bold text-primary mb-1`},ce={class:`glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-5`},le={class:`flex items-center justify-between`},ue={key:0,class:`w-6 h-6 text-accent-green`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},de={key:1,class:`w-6 h-6 text-accent-yellow`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},fe={class:`glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-6`},pe={key:0,class:`flex items-center justify-center py-12`},me={class:`text-center`},he={key:1,class:`flex items-center justify-center py-12`},ge={class:`text-center`},_e={class:`text-content-secondary dark:text-content-muted text-sm mb-4`},ve={key:2,class:`space-y-4`},ye={class:`flex items-start justify-between`},be={class:`flex-1`},xe={class:`flex items-center gap-3 mb-4`},Se={class:`relative`},Ce={key:0,class:`absolute inset-0 bg-accent-green/50 rounded-full animate-ping`},we={class:`text-xl font-bold text-content-primary dark:text-content-primary`},Te={key:0,class:`text-content-muted dark:text-content-muted text-sm`},Ee={class:`grid grid-cols-1 md:grid-cols-2 gap-3 text-sm mb-3`},De={class:`text-content-primary dark:text-content-primary/90 ml-2`},Oe={class:`text-content-primary dark:text-content-primary/90 ml-2`},ke={class:`text-content-primary dark:text-content-primary/90 ml-2`},Ae={class:`flex items-center gap-2`},je={key:0,class:`text-content-primary dark:text-content-primary/90 font-mono ml-2 text-xs`},Me={key:1,class:`text-content-muted dark:text-content-muted ml-2 text-xs`},Ne=[`onClick`],Pe={class:`text-xs text-content-muted dark:text-content-muted`},Fe={key:0,class:`ml-2 font-mono text-content-primary dark:text-content-primary/90 break-all`},Ie={key:1,class:`ml-2 text-content-muted dark:text-content-muted`},Le={class:`ml-4 flex flex-wrap gap-2`},Re=[`onClick`],ze=[`onClick`],Be=[`onClick`],Ve={key:3,class:`text-center py-12 text-content-secondary dark:text-content-muted`},He={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`},Ue={class:`space-y-4`},We={class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},Ge={key:0},Ke={key:1,class:`text-content-secondary dark:text-content-muted text-sm`},qe={class:`grid grid-cols-2 gap-4`},Je={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`},Ye={class:`space-y-4`},Xe={class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},Ze={key:0},Qe={class:`grid grid-cols-2 gap-4`},$e=5050,et=1,tt=65535,nt=s({name:`CompanionsView`,__name:`Companions`,setup(n){let r=a(!1),s=a(null),p=a(null),S=a(!1),T=a(!1),k=a(!1),A=a(null),j=a(``),M=a(!1),N=a(!1),P=a(new Set),F=a(!1),I=a(``),L=a(!1),R=a(``),z=a(!1),B=a({message:``,variant:`success`}),V=a({name:``,identity_key:``,type:`companion`,settings:{node_name:``,tcp_port:5e3,bind_address:`0.0.0.0`}});t(async()=>{await H()});async function H(){r.value=!0,s.value=null;try{let e=await b.getIdentities();e.success?p.value=e.data:s.value=e.error||`Failed to load identities`}catch(e){s.value=e instanceof Error?e.message:`Failed to load identities`}finally{r.value=!1}}async function te(){try{let e=await b.createIdentity({...V.value,settings:{node_name:V.value.settings.node_name||V.value.name,tcp_port:V.value.settings.tcp_port??5e3,bind_address:V.value.settings.bind_address||`0.0.0.0`}});e.success?(S.value=!1,W(),await H(),U(e.message||`Companion created successfully!`,`success`)):U(`Failed to create companion: ${e.error}`,`error`)}catch(e){U(`Error creating companion: ${e}`,`error`)}}async function ne(){let e={name:j.value,identity_key:A.value.identity_key,type:`companion`,settings:{node_name:A.value.settings?.node_name,tcp_port:A.value.settings?.tcp_port,bind_address:A.value.settings?.bind_address}};A.value.name!==j.value&&(e.new_name=A.value.name);try{let t=await b.updateIdentity(e);t.success?(T.value=!1,A.value=null,await H(),k.value=!0):U(`Failed to update companion: ${t.error}`,`error`)}catch(e){U(`Error updating companion: ${e}`,`error`)}}function re(e){I.value=e,F.value=!0}async function ie(){let e=I.value;F.value=!1;try{let t=await b.deleteIdentity(e,`companion`);t.success?(await H(),U(t.message||`Companion deleted successfully!`,`success`)):U(`Failed to delete companion: ${t.error}`,`error`)}catch(e){U(`Error deleting companion: ${e}`,`error`)}finally{I.value=``}}function U(e,t){B.value={message:e,variant:t},z.value=!0}function ae(e){A.value=JSON.parse(JSON.stringify(e)),j.value=A.value.name,delete A.value.new_name,A.value.settings||(A.value.settings={node_name:``,tcp_port:5e3,bind_address:`0.0.0.0`}),N.value=!1,T.value=!0}function W(){V.value={name:``,identity_key:``,type:`companion`,settings:{node_name:``,tcp_port:5e3,bind_address:`0.0.0.0`}},M.value=!1}function G(){S.value=!1,T.value=!1,A.value=null,M.value=!1,N.value=!1,W()}function nt(e){P.value.has(e)?P.value.delete(e):P.value.add(e)}let rt=()=>p.value?.configured_companions??[],it=m(()=>p.value?.configured_companions?.length??0),at=m(()=>p.value?.configured_companions?.filter(e=>e.registered).length??0),$=m(()=>at.value===it.value);function ot(){let e=rt();if(e.length===0)return $e;let t=e.map(e=>e.settings?.tcp_port??5e3),n=Math.max(...t)+1;return Math.min(tt,Math.max(et,n))}function st(){W(),V.value.settings.tcp_port=ot(),S.value=!0}function ct(e){R.value=e,L.value=!0}function lt(){L.value=!1,R.value=``}function ut(e){U(`Imported ${e} contact${e===1?``:`s`}.`,`success`),lt()}return(t,n)=>(u(),v(g,null,[_(`div`,q,[_(`div`,{class:`relative overflow-hidden rounded-[20px] p-6 mb-6 glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10`},[n[18]||=_(`div`,{class:`absolute inset-0 bg-gradient-to-br from-primary/20 via-secondary/10 to-accent-purple/20 opacity-50`},null,-1),n[19]||=_(`div`,{class:`absolute inset-0 bg-gradient-to-tl from-accent-green/10 via-transparent to-primary/10 animate-pulse`},null,-1),_(`div`,{class:`relative flex items-center justify-between`},[n[17]||=ee(`

Companions

Manage companion identities (TCP frame server)

`,1),_(`button`,{onClick:st,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`},[...n[16]||=[_(`span`,{class:`flex items-center gap-2`},[_(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[_(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 4v16m8-8H4`})]),h(` Add Companion `)],-1)]])])]),p.value&&it.value>0?(u(),v(`div`,J,[_(`div`,Y,[_(`div`,X,[_(`div`,null,[n[20]||=_(`div`,{class:`text-content-secondary dark:text-content-muted text-xs font-medium mb-2 uppercase tracking-wide`},` Total Configured `,-1),_(`div`,oe,e(it.value),1)]),n[21]||=_(`div`,{class:`bg-background-mute dark:bg-white/10 p-3 rounded-[12px]`},[_(`svg`,{class:`w-6 h-6 text-content-secondary dark:text-content-primary/70`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[_(`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)])]),_(`div`,Z,[_(`div`,Q,[_(`div`,null,[n[22]||=_(`div`,{class:`text-content-secondary dark:text-content-muted text-xs font-medium mb-2 uppercase tracking-wide`},` Currently Registered `,-1),_(`div`,se,e(at.value),1)]),n[23]||=_(`div`,{class:`bg-primary/20 p-3 rounded-[12px]`},[_(`svg`,{class:`w-6 h-6 text-primary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[_(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M5 13l4 4L19 7`})])],-1)])]),_(`div`,ce,[_(`div`,le,[_(`div`,null,[n[24]||=_(`div`,{class:`text-content-secondary dark:text-content-muted text-xs font-medium mb-2 uppercase tracking-wide`},` Status `,-1),_(`div`,{class:y([`text-3xl font-bold`,$.value?`text-accent-green`:`text-accent-yellow`])},e($.value?`Synced`:`Out of Sync`),3)]),_(`div`,{class:y([`p-3 rounded-[12px]`,$.value?`bg-accent-green/20`:`bg-accent-yellow/20`])},[$.value?(u(),v(`svg`,ue,[...n[25]||=[_(`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)]])):(u(),v(`svg`,de,[...n[26]||=[_(`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)])])])):d(``,!0),_(`div`,fe,[r.value?(u(),v(`div`,pe,[_(`div`,me,[f(x,{class:`mx-auto mb-4`}),n[27]||=_(`div`,{class:`text-content-secondary dark:text-content-primary/70`},` Loading companions... `,-1)])])):s.value?(u(),v(`div`,he,[_(`div`,ge,[n[28]||=_(`div`,{class:`text-red-600 dark:text-red-400 mb-2`},`Failed to load companions`,-1),_(`div`,_e,e(s.value),1),_(`button`,{onClick:H,class:`btn-primary`},` Retry `)])])):p.value&&rt().length>0?(u(),v(`div`,ve,[(u(!0),v(g,null,l(rt(),t=>(u(),v(`div`,{key:t.name,class:`glass-card backdrop-blur-xl rounded-[15px] p-5 border border-stroke-subtle dark:border-white/10`},[_(`div`,ye,[_(`div`,be,[_(`div`,xe,[_(`div`,Se,[t.registered?(u(),v(`div`,Ce)):d(``,!0),_(`div`,{class:y([`relative w-3 h-3 rounded-full`,t.registered?`bg-accent-green`:`bg-accent-red`])},null,2)]),_(`h3`,we,e(t.name),1),_(`span`,{class:y([`px-3 py-1 text-xs font-semibold rounded-full`,t.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`])},e(t.registered?`● Active`:`○ Inactive`),3),t.hash?(u(),v(`span`,Te,e(t.hash),1)):d(``,!0)]),_(`div`,Ee,[_(`div`,null,[n[29]||=_(`span`,{class:`text-content-muted dark:text-content-muted`},`Node Name:`,-1),_(`span`,De,e(t.settings?.node_name||t.name),1)]),_(`div`,null,[n[30]||=_(`span`,{class:`text-content-muted dark:text-content-muted`},`TCP Port:`,-1),_(`span`,Oe,e(t.settings?.tcp_port??5e3),1)]),_(`div`,null,[n[31]||=_(`span`,{class:`text-content-muted dark:text-content-muted`},`Bind Address:`,-1),_(`span`,ke,e(t.settings?.bind_address||`0.0.0.0`),1)]),_(`div`,Ae,[n[32]||=_(`span`,{class:`text-content-muted dark:text-content-muted`},`Identity Key:`,-1),P.value.has(t.name)?(u(),v(`span`,je,e(t.identity_key),1)):(u(),v(`span`,Me,`••••••••••••••••`)),_(`button`,{onClick:e=>nt(t.name),class:`text-primary/70 hover:text-primary text-xs underline`},e(P.value.has(t.name)?`Hide`:`Show`),9,Ne)])]),_(`div`,Pe,[n[33]||=_(`span`,{class:`text-content-muted dark:text-content-muted`},`Public Key:`,-1),t.public_key?(u(),v(`span`,Fe,e(t.public_key),1)):(u(),v(`span`,Ie,`—`))])]),_(`div`,Le,[_(`button`,{onClick:e=>ct(t.name),class:`btn-primary-xs`},` Import contacts `,8,Re),_(`button`,{onClick:e=>ae(t),class:`btn-primary-xs`},` Edit `,8,ze),_(`button`,{onClick:e=>re(t.name),class:`btn-danger-xs`},` Delete `,8,Be)])])]))),128))])):(u(),v(`div`,Ve,[n[34]||=_(`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`},[_(`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),n[35]||=_(`p`,{class:`text-lg mb-2`},`No companions configured`,-1),n[36]||=_(`p`,{class:`text-sm mb-4`},` Add a companion to run a TCP frame server for firmware or other clients `,-1),_(`button`,{onClick:st,class:`btn-primary`},` + Add Companion `)]))]),(u(),o(c,{to:`body`},[S.value?(u(),v(`div`,{key:0,class:`fixed inset-0 bg-black/50 backdrop-blur-lg flex items-center justify-center z-[300] p-4`,onClick:n[6]||=C(e=>S.value=!1,[`self`])},[_(`div`,He,[n[43]||=_(`h2`,{class:`text-xl font-bold text-content-primary dark:text-content-primary mb-4`},` Add Companion `,-1),_(`div`,Ue,[_(`div`,null,[n[37]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},`Name *`,-1),i(_(`input`,{"onUpdate:modelValue":n[0]||=e=>V.value.name=e,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),[[w,V.value.name]])]),_(`div`,null,[_(`label`,We,[n[38]||=h(` Identity Key (Optional) `,-1),_(`button`,{onClick:n[1]||=e=>M.value=!M.value,type:`button`,class:`ml-2 text-primary/70 hover:text-primary text-xs underline`},e(M.value?`Hide`:`Show/Edit`),1)]),M.value?(u(),v(`div`,Ge,[i(_(`input`,{"onUpdate:modelValue":n[2]||=e=>V.value.identity_key=e,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),[[w,V.value.identity_key]]),n[39]||=_(`p`,{class:`text-content-secondary dark:text-content-muted text-xs mt-1`},` 32 or 64 bytes hex. Leave empty to auto-generate. `,-1)])):(u(),v(`div`,Ke,` Will be auto-generated if not provided `))]),_(`div`,null,[n[40]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},`Node Name`,-1),i(_(`input`,{"onUpdate:modelValue":n[3]||=e=>V.value.settings.node_name=e,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),[[w,V.value.settings.node_name]])]),_(`div`,qe,[_(`div`,null,[n[41]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},`TCP Port`,-1),i(_(`input`,{"onUpdate:modelValue":n[4]||=e=>V.value.settings.tcp_port=e,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),[[w,V.value.settings.tcp_port,void 0,{number:!0}]])]),_(`div`,null,[n[42]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},`Bind Address`,-1),i(_(`input`,{"onUpdate:modelValue":n[5]||=e=>V.value.settings.bind_address=e,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),[[w,V.value.settings.bind_address]])])])]),_(`div`,{class:`flex justify-end gap-3 mt-6`},[_(`button`,{onClick:G,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 `),_(`button`,{onClick:te,class:`btn-primary`},` Create `)])])])):d(``,!0)])),(u(),o(c,{to:`body`},[T.value&&A.value?(u(),v(`div`,{key:0,class:`fixed inset-0 bg-black/50 backdrop-blur-lg flex items-center justify-center z-[300] p-4`,onClick:C(G,[`self`])},[_(`div`,Je,[n[49]||=_(`h2`,{class:`text-xl font-bold text-content-primary dark:text-content-primary mb-4`},` Edit Companion `,-1),_(`div`,Ye,[_(`div`,null,[n[44]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},`Name *`,-1),i(_(`input`,{"onUpdate:modelValue":n[7]||=e=>A.value.name=e,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),[[w,A.value.name]])]),_(`div`,null,[_(`label`,Xe,[n[45]||=h(` Identity Key (Optional) `,-1),_(`button`,{onClick:n[8]||=e=>N.value=!N.value,type:`button`,class:`ml-2 text-primary/70 hover:text-primary text-xs underline`},e(N.value?`Hide`:`Show/Edit`),1)]),N.value?(u(),v(`div`,Ze,[i(_(`input`,{"onUpdate:modelValue":n[9]||=e=>A.value.identity_key=e,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),[[w,A.value.identity_key]])])):d(``,!0)]),_(`div`,null,[n[46]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},`Node Name`,-1),i(_(`input`,{"onUpdate:modelValue":n[10]||=e=>A.value.settings.node_name=e,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),[[w,A.value.settings.node_name]])]),_(`div`,Qe,[_(`div`,null,[n[47]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},`TCP Port`,-1),i(_(`input`,{"onUpdate:modelValue":n[11]||=e=>A.value.settings.tcp_port=e,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),[[w,A.value.settings.tcp_port,void 0,{number:!0}]])]),_(`div`,null,[n[48]||=_(`label`,{class:`block text-content-secondary dark:text-content-primary/70 text-sm mb-2`},`Bind Address`,-1),i(_(`input`,{"onUpdate:modelValue":n[12]||=e=>A.value.settings.bind_address=e,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),[[w,A.value.settings.bind_address]])])])]),_(`div`,{class:`flex justify-end gap-3 mt-6`},[_(`button`,{onClick:G,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 `),_(`button`,{onClick:ne,class:`btn-primary`},` Update `)])])])):d(``,!0)]))]),f(K,{"is-open":L.value,"companion-name":R.value,onClose:lt,onImported:ut},null,8,[`is-open`,`companion-name`]),f(D,{show:F.value,title:`Delete Companion`,message:`Are you sure you want to delete '${I.value}'? Restart required to fully remove.`,"confirm-text":`Delete`,"cancel-text":`Cancel`,variant:`danger`,onClose:n[13]||=e=>F.value=!1,onConfirm:ie},null,8,[`show`,`message`]),f(O,{show:z.value,message:B.value.message,variant:B.value.variant,onClose:n[14]||=e=>z.value=!1},null,8,[`show`,`message`,`variant`]),f(E,{modelValue:k.value,"onUpdate:modelValue":n[15]||=e=>k.value=e,message:`Companion settings have been saved. A service restart is required for the changes to take effect.`},null,8,[`modelValue`])],64))}});export{nt as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/Configuration-BkPRUvKr.js b/repeater/web/html/assets/Configuration-BkPRUvKr.js new file mode 100644 index 0000000..722a225 --- /dev/null +++ b/repeater/web/html/assets/Configuration-BkPRUvKr.js @@ -0,0 +1 @@ +import{B as e,Ct as t,D as n,E as r,J as i,N as a,R as o,S as s,V as c,Y as l,c as u,f as d,g as f,i as p,j as m,k as h,l as g,m as _,nt as v,o as y,p as b,r as x,s as S,u as C,w,xt as T,z as E}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{a as D,l as O,o as k,s as A,t as j,u as M}from"./runtime-dom.esm-bundler-fKU3dih-.js";import{g as N,m as P,r as F,t as I,v as L,y as R}from"./api-C0ctTLHN.js";import{t as ee}from"./system-Dx7MrhAz.js";import{t as z}from"./dataService-CLvdg62X.js";import{t as B}from"./_plugin-vue_export-helper-TcpyXLsZ.js";import{t as V}from"./Spinner-CYvUNW0P.js";import{n as te}from"./index-BpKhPa08.js";import{t as H}from"./ConfirmDialog-XtZRdfP5.js";import{t as U}from"./LocationPicker-Beqlkai5.js";import{c as W,d as G,n as K,t as q}from"./formatters-Cc4UJmeb.js";import{n as J,t as ne}from"./preferences-6MHglq--.js";var re={key:0,class:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`},Y={class:`modal-card max-w-md`},X={class:`flex items-start gap-3 mb-4`},Z={class:`mt-1 text-sm text-content-secondary dark:text-content-muted`},Q={class:`modal-actions`},$=[`disabled`],ie=[`disabled`],ae=[`disabled`],oe=f({__name:`UnsavedChangesModal`,props:{show:{type:Boolean},isSaving:{type:Boolean},label:{}},emits:[`discard`,`save`,`cancel`],setup(n){return(r,i)=>(h(),u(p,{to:`body`},[_(j,{"enter-active-class":`transition-opacity duration-200`,"enter-from-class":`opacity-0`,"leave-active-class":`transition-opacity duration-200`,"leave-to-class":`opacity-0`},{default:e(()=>[n.show?(h(),C(`div`,re,[S(`div`,Y,[S(`div`,X,[i[4]||=S(`div`,{class:`flex-shrink-0 w-10 h-10 rounded-full bg-amber-100 dark:bg-amber-900/30 flex items-center justify-center`},[S(`svg`,{class:`w-5 h-5 text-amber-600 dark:text-amber-400`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 9v2m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z`})])],-1),S(`div`,null,[i[3]||=S(`h3`,{class:`text-base font-semibold text-content-primary dark:text-content-primary`},` Unsaved Changes `,-1),S(`p`,Z,t(n.label?n.label:`Settings`)+` have not been saved. What would you like to do? `,1)])]),S(`div`,Q,[S(`button`,{onClick:i[0]||=e=>r.$emit(`cancel`),disabled:n.isSaving,class:`modal-btn-cancel`},` Keep Editing `,8,$),S(`button`,{onClick:i[1]||=e=>r.$emit(`discard`),disabled:n.isSaving,class:`modal-btn-danger`},` Discard `,8,ie),S(`button`,{onClick:i[2]||=e=>r.$emit(`save`),disabled:n.isSaving,class:`modal-btn-primary`},t(n.isSaving?`Saving…`:`Save Settings`),9,ae)])])])):g(``,!0)]),_:1})]))}});function se(e,t,n,r){let i=l(!1),a=l(null),o=l(null);P((t,n,r)=>{e.value?(i.value=!0,a.value=()=>r(),o.value=()=>r(!1)):r()});function s(t){e.value?(i.value=!0,a.value=t,o.value=null):t()}function c(){n(),i.value=!1,o.value=null,a.value&&=(a.value(),null)}async function u(){await r()&&(i.value=!1,o.value=null,a.value&&=(a.value(),null))}function d(){i.value=!1,o.value&&=(o.value(),null),a.value=null}return{showUnsavedModal:i,requestLeave:s,handleDiscard:c,handleSave:u,handleCancel:d}}var ce={class:`space-y-12`},le={class:`cfg-page-heading flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3`},ue={class:`flex items-center gap-2 flex-shrink-0`},de=[`disabled`],fe=[`disabled`],pe={key:0,class:`bg-red-100 dark:bg-red-500/20 border border-red-500/50 rounded-lg p-3`},me={class:`text-red-600 dark:text-red-400 text-sm`},he={class:`cfg-section space-y-3`},ge={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`},_e={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},ve={key:1,class:`flex items-center gap-2`},ye={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`},be={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},xe={key:1},Se=[`value`],Ce={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`},we={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},Te={key:1},Ee=[`value`],De={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`},Oe={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},ke={key:1,class:`flex items-center gap-2`},Ae={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`},je={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},Me={key:1},Ne={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1`},Pe={class:`text-content-primary dark:text-content-primary font-mono text-sm`},Fe={class:`cfg-section space-y-3`},Ie={class:`flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3`},Le={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`},Re={class:`text-content-primary dark:text-content-primary font-mono text-sm`},ze={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1`},Be={class:`text-content-primary dark:text-content-primary font-mono text-sm`},Ve=f({__name:`RadioSettings`,setup(e,{expose:n}){let r=N(),i=ee(),a=y(()=>i.stats?.config?.radio||{}),s=y(()=>i.stats?.config?.radio?.cad??{}),u=l(!1),d=l(!1),f=l(null),p=l(!1),b=l(0),w=l(0),T=l(0),E=l(0),D=l(0),O=l(0),j=[{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`}];o(a,e=>{e&&!u.value&&(b.value=e.frequency?Number((e.frequency/1e6).toFixed(3)):0,w.value=e.spreading_factor??0,T.value=e.bandwidth?Number((e.bandwidth/1e3).toFixed(1)):0,E.value=e.tx_power??0,D.value=e.coding_rate??0,O.value=e.preamble_length??0)},{immediate:!0});let M=y(()=>{let e=a.value.frequency;return e?(e/1e6).toFixed(3)+` MHz`:`Not set`}),P=y(()=>{let e=a.value.bandwidth;return e?(e/1e3).toFixed(1)+` kHz`:`Not set`}),F=y(()=>{let e=a.value.tx_power;return e===void 0?`Not set`:e+` dBm`}),L=y(()=>{let e=a.value.coding_rate;return e?`4/`+e:`Not set`}),R=y(()=>{let e=a.value.preamble_length;return e?e+` symbols`:`Not set`}),z=y(()=>a.value.spreading_factor??`Not set`),B=()=>{u.value=!0,f.value=null},V=()=>{u.value=!1,f.value=null;let e=a.value;b.value=e.frequency?Number((e.frequency/1e6).toFixed(3)):0,w.value=e.spreading_factor??0,T.value=e.bandwidth?Number((e.bandwidth/1e3).toFixed(1)):0,E.value=e.tx_power??0,D.value=e.coding_rate??0,O.value=e.preamble_length??0},H=async({silent:e=!1}={})=>{d.value=!0,f.value=null;try{let t={};b.value&&(t.frequency=b.value*1e6),w.value&&(t.spreading_factor=w.value),T.value&&(t.bandwidth=T.value*1e3),E.value&&(t.tx_power=E.value),D.value&&(t.coding_rate=D.value);let n=(await I.post(`/update_radio_config`,t)).data;if(n.message||n.persisted)return u.value=!1,await i.fetchStats(),e||(p.value=!0),!0;n.error?f.value=n.error:f.value=`Unknown response from server`}catch(e){console.error(`Failed to update radio settings:`,e),f.value=e.response?.data?.error||`Failed to update settings`}finally{d.value=!1}return!1},{showUnsavedModal:U,requestLeave:W,handleDiscard:G,handleSave:K,handleCancel:q}=se(u,d,V,()=>H());return n({requestLeave:W,isEditing:u}),(e,n)=>(h(),C(x,null,[_(te,{modelValue:p.value,"onUpdate:modelValue":n[0]||=e=>p.value=e,title:`Radio Settings Changes require a restart.`,message:`Restart Now?`},null,8,[`modelValue`]),_(oe,{show:v(U),"is-saving":d.value,label:`Radio Settings`,onDiscard:v(G),onSave:v(K),onCancel:v(q)},null,8,[`show`,`is-saving`,`onDiscard`,`onSave`,`onCancel`]),S(`div`,ce,[S(`div`,le,[n[8]||=S(`div`,null,[S(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2`},`Radio Settings`),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Configure LoRa radio parameters and frequency presets`)],-1),S(`div`,ue,[u.value?(h(),C(x,{key:1},[S(`button`,{onClick:V,disabled:d.value,class:`cfg-btn-secondary`},` Cancel `,8,de),S(`button`,{onClick:n[1]||=e=>H(),disabled:d.value,class:`cfg-btn-primary`},t(d.value?`Saving...`:`Save Changes`),9,fe)],64)):(h(),C(`button`,{key:0,onClick:B,class:`cfg-btn-primary`},` Edit Settings `))])]),f.value?(h(),C(`div`,pe,[S(`p`,me,t(f.value),1)])):g(``,!0),S(`div`,he,[S(`div`,ge,[n[10]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Frequency`,-1),u.value?(h(),C(`div`,ve,[c(S(`input`,{"onUpdate:modelValue":n[2]||=e=>b.value=e,type:`number`,step:`0.001`,min:`100`,max:`1000`,class:`cfg-input w-32`},null,512),[[A,b.value,void 0,{number:!0}]]),n[9]||=S(`span`,{class:`text-content-muted dark:text-content-muted text-sm`},`MHz`,-1)])):(h(),C(`div`,_e,t(M.value),1))]),S(`div`,ye,[n[11]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Spreading Factor`,-1),u.value?(h(),C(`div`,xe,[c(S(`select`,{"onUpdate:modelValue":n[3]||=e=>w.value=e,class:`cfg-select`},[(h(),C(x,null,m([5,6,7,8,9,10,11,12],e=>S(`option`,{key:e,value:e},t(e),9,Se)),64))],512),[[k,w.value,void 0,{number:!0}]])])):(h(),C(`div`,be,t(z.value),1))]),S(`div`,Ce,[n[12]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Bandwidth`,-1),u.value?(h(),C(`div`,Te,[c(S(`select`,{"onUpdate:modelValue":n[4]||=e=>T.value=e,class:`cfg-select`},[(h(),C(x,null,m(j,e=>S(`option`,{key:e.value,value:e.value},t(e.label),9,Ee)),64))],512),[[k,T.value,void 0,{number:!0}]])])):(h(),C(`div`,we,t(P.value),1))]),S(`div`,De,[n[14]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`TX Power`,-1),u.value?(h(),C(`div`,ke,[c(S(`input`,{"onUpdate:modelValue":n[5]||=e=>E.value=e,type:`number`,min:`2`,max:`30`,class:`cfg-input w-20`},null,512),[[A,E.value,void 0,{number:!0}]]),n[13]||=S(`span`,{class:`text-content-muted dark:text-content-muted text-sm`},`dBm`,-1)])):(h(),C(`div`,Oe,t(F.value),1))]),S(`div`,Ae,[n[16]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Coding Rate`,-1),u.value?(h(),C(`div`,Me,[c(S(`select`,{"onUpdate:modelValue":n[6]||=e=>D.value=e,class:`cfg-select`},[...n[15]||=[S(`option`,{value:5},`4/5`,-1),S(`option`,{value:6},`4/6`,-1),S(`option`,{value:7},`4/7`,-1),S(`option`,{value:8},`4/8`,-1)]],512),[[k,D.value,void 0,{number:!0}]])])):(h(),C(`div`,je,t(L.value),1))]),S(`div`,Ne,[n[17]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Preamble Length`,-1),S(`span`,Pe,t(R.value),1)])]),S(`div`,Fe,[S(`div`,Ie,[n[18]||=S(`div`,null,[S(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2`},`CAD Calibration`),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Channel Activity Detection: Run Calibration to update`),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm mt-1`},`These settings tune the receivers ability to detect channel status prior to transmission`)],-1),S(`button`,{onClick:n[7]||=e=>v(r).push(`/cad-calibration`),class:`cfg-btn-secondary flex-shrink-0`},` Run Calibration `)]),n[21]||=S(`div`,{class:`pt-2`},null,-1),S(`div`,Le,[n[19]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Peak Threshold`,-1),S(`span`,Re,t(s.value.peak_threshold??`Not calibrated`),1)]),S(`div`,ze,[n[20]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Min Threshold`,-1),S(`span`,Be,t(s.value.min_threshold??`Not calibrated`),1)])])])],64))}}),He={class:`space-y-12`},Ue={class:`cfg-page-heading flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3`},We={class:`flex items-center gap-2 flex-shrink-0`},Ge=[`disabled`],Ke=[`disabled`],qe={key:0,class:`bg-green-100 dark:bg-green-500/10 border border-green-300 dark:border-green-500/30 rounded-lg p-3`},Je={class:`text-green-700 dark:text-green-400 text-sm`},Ye={key:1,class:`bg-red-100 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30 rounded-lg p-3`},Xe={class:`text-red-700 dark:text-red-400 text-sm`},Ze={class:`cfg-section space-y-3`},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`},$e={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm break-all`},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`},tt={class:`text-content-primary dark:text-content-primary font-mono text-xs break-all`},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`},rt={class:`flex items-center gap-2 min-w-0 sm:justify-end`},it={class:`text-content-primary dark:text-content-primary font-mono text-xs break-all sm:text-right min-w-0`},at={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`},ot={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`},ct={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},lt={class:`flex flex-col py-2 gap-2`},ut={class:`flex flex-col sm:flex-row sm:justify-between sm:items-start gap-1`},dt={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm sm:ml-4`},ft={key:1,class:`flex items-center gap-2`},pt={class:`cfg-section space-y-3`},mt={class:`pb-2`},ht={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`},_t={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1`},vt={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},yt={class:`bg-surface dark:bg-surface-elevated border border-stroke-subtle dark:border-stroke/20 rounded-[15px] shadow-2xl w-full max-w-md p-6 space-y-4`},bt={class:`block text-sm font-medium text-content-secondary dark:text-content-muted mb-2`},xt=[`maxlength`,`disabled`],St={key:0,class:`text-red-500 text-xs mt-1`},Ct={key:1,class:`text-content-muted dark:text-content-muted text-xs mt-1`},wt=[`disabled`],Tt={key:0,class:`mt-2 bg-amber-500/10 border border-amber-500/30 rounded-lg p-3`},Et={key:0,class:`flex items-center gap-3 bg-blue-500/10 border border-blue-500/30 rounded-lg p-3`},Dt={class:`text-blue-700 dark:text-blue-400 text-xs font-medium`},Ot={class:`text-blue-600 dark:text-blue-500 text-xs mt-0.5`},kt={key:1,class:`bg-red-500/10 border border-red-500/30 rounded-lg p-3`},At={class:`text-red-600 dark:text-red-400 text-sm`},jt={key:2,class:`bg-green-500/10 border border-green-600/40 dark:border-green-500/30 rounded-lg p-3 space-y-2`},Mt={class:`text-green-600 dark:text-green-400 text-sm font-medium`},Nt={class:`font-mono text-xs break-all text-content-primary dark:text-content-primary`},Pt={key:3,class:`bg-amber-500/10 border border-amber-500/30 rounded-lg p-3`},Ft={class:`flex gap-2 mt-3`},It=[`disabled`],Lt=[`disabled`],Rt={class:`flex justify-end gap-3 mt-6`},zt=[`disabled`],Bt=[`disabled`],Vt=f({__name:`RepeaterSettings`,setup(e,{expose:n}){let r=ee(),i=y(()=>r.stats?.config||{}),a=y(()=>i.value.repeater||{}),s=y(()=>r.stats),d=l(!1),f=l(!1),m=l(null),E=l(null),D=l(!1),O=l(``),j=l(0),N=l(0),P=l(0),F=l(1),L=y(()=>i.value.mesh||{});o([i,a,L],()=>{if(!d.value){O.value=i.value.node_name||``,j.value=a.value.latitude||0,N.value=a.value.longitude||0,P.value=a.value.send_advert_interval_hours||0;let e=L.value.path_hash_mode;F.value=e===0||e===1||e===2?e+1:1}},{immediate:!0});let R=y(()=>i.value.node_name||`Not set`),z=y(()=>s.value?.local_hash||`Not available`),B=y(()=>{let e=s.value?.public_key;return!e||e===`Not set`?`Not set`:e}),V=y(()=>{let e=a.value.latitude;return e&&e!==0?e.toFixed(6):`Not set`}),te=y(()=>{let e=a.value.longitude;return e&&e!==0?e.toFixed(6):`Not set`}),H=y(()=>{let e=a.value.mode;return e?e===`no_tx`?`No TX`:e.charAt(0).toUpperCase()+e.slice(1):`Not set`}),W=y(()=>{let e=a.value.send_advert_interval_hours;return e===void 0?`Not set`:e===0?`Disabled`:e+` hour`+(e===1?``:`s`)}),G=y(()=>{let e=L.value.path_hash_mode;return e===0||e===1||e===2?e+1+(e===0?` byte`:` bytes`):`Not set`}),K=()=>{d.value=!0,m.value=null,E.value=null},q=()=>{d.value=!1,m.value=null,O.value=i.value.node_name||``,j.value=a.value.latitude||0,N.value=a.value.longitude||0,P.value=a.value.send_advert_interval_hours||0;let e=L.value.path_hash_mode;F.value=e===0||e===1||e===2?e+1:1},J=async()=>{f.value=!0,m.value=null,E.value=null;try{let e={};O.value&&(e.node_name=O.value),e.latitude=j.value,e.longitude=N.value,e.flood_advert_interval_hours=P.value,e.path_hash_mode=F.value-1;let t=(await I.post(`/update_radio_config`,e)).data;t.message||t.persisted?(E.value=t.message||`Settings saved successfully`,d.value=!1,await r.fetchStats(),setTimeout(()=>{E.value=null},3e3)):t.error?m.value=t.error:m.value=`Unknown response from server`}catch(e){console.error(`Failed to update repeater settings:`,e),m.value=e.response?.data?.error||`Failed to update settings`}finally{f.value=!1}},ne=()=>{D.value=!0},re=e=>{j.value=e.latitude,N.value=e.longitude},Y=l(!1),X=l(``),Z=l(!1),Q=l(null),$=l(null),ie=l(!1),ae=l(!1),ce=l(!1),le=l(0),ue=null,de=y(()=>ce.value?8:4),fe=y(()=>{let e=X.value.trim();return!e||e.length>de.value?!1:/^[0-9a-fA-F]+$/.test(e)}),pe=y(()=>{let e=X.value.trim().length;return e===0?``:e===1?`Very fast — ~16 attempts on average`:e===2?`Fast — ~256 attempts on average`:e===3?`Moderate — ~4,096 attempts, a few seconds`:e===4?`Slow — ~65,536 attempts, may take 10-30 seconds`:e===5?`Very slow — ~1 million attempts, could take minutes`:e===6?`Extremely slow — ~16 million attempts, could take a very long time`:e===7?`Extreme — ~268 million attempts, may not complete`:`Extreme — ~4 billion attempts, extremely unlikely to complete`}),me=()=>{le.value=0,ue=setInterval(()=>{le.value++},1e3)},he=()=>{ue&&=(clearInterval(ue),null)};w(()=>he());let ge=()=>{X.value=``,Q.value=null,$.value=null,ie.value=!1,ce.value=!1,Y.value=!0},_e=async()=>{Z.value=!0,$.value=null,Q.value=null,me();try{let e=await I.generateVanityKey(X.value.trim());e.success&&e.data?Q.value=e.data:$.value=e.error||`Generation failed`}catch(e){let t=e;$.value=t.response?.data?.error||t.message||`Generation failed`}finally{he(),Z.value=!1}},ve=async()=>{if(Q.value){ae.value=!0,$.value=null;try{let e=await I.generateVanityKey(X.value.trim(),!0);e.success&&e.data?(Q.value=e.data,ie.value=!1,Y.value=!1,E.value=`New identity key applied. Restart the repeater for the change to take effect.`,await r.fetchStats(),setTimeout(()=>{E.value=null},8e3)):$.value=e.error||`Failed to apply key`}catch(e){let t=e;$.value=t.response?.data?.error||t.message||`Failed to apply key`}finally{ae.value=!1}}},{showUnsavedModal:ye,requestLeave:be,handleDiscard:xe,handleSave:Se,handleCancel:Ce}=se(d,f,q,async()=>(await J(),!d.value));return n({requestLeave:be,isEditing:d}),(e,n)=>(h(),C(x,null,[_(oe,{show:v(ye),"is-saving":f.value,label:`Repeater Settings`,onDiscard:v(xe),onSave:v(Se),onCancel:v(Ce)},null,8,[`show`,`is-saving`,`onDiscard`,`onSave`,`onCancel`]),S(`div`,He,[S(`div`,Ue,[n[13]||=S(`div`,null,[S(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2`},`Repeater Settings`),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Configure repeater identity, location, and network settings`)],-1),S(`div`,We,[d.value?(h(),C(x,{key:1},[S(`button`,{onClick:q,disabled:f.value,class:`cfg-btn-secondary`},` Cancel `,8,Ge),S(`button`,{onClick:J,disabled:f.value,class:`cfg-btn-primary`},t(f.value?`Saving...`:`Save Changes`),9,Ke)],64)):(h(),C(`button`,{key:0,onClick:K,class:`cfg-btn-primary`},` Edit Settings `))])]),E.value?(h(),C(`div`,qe,[S(`p`,Je,t(E.value),1)])):g(``,!0),m.value?(h(),C(`div`,Ye,[S(`p`,Xe,t(m.value),1)])):g(``,!0),S(`div`,Ze,[n[23]||=S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary pb-2`},`General Settings`,-1),S(`div`,Qe,[n[14]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Node Name`,-1),d.value?c((h(),C(`input`,{key:1,"onUpdate:modelValue":n[0]||=e=>O.value=e,type:`text`,maxlength:`50`,class:`cfg-input w-full sm:w-64`,placeholder:`Enter node name`},null,512)),[[A,O.value]]):(h(),C(`div`,$e,t(R.value),1))]),S(`div`,et,[n[15]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Local Hash`,-1),S(`span`,tt,t(z.value),1)]),S(`div`,nt,[n[16]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm flex-shrink-0`},`Public Key`,-1),S(`div`,rt,[S(`span`,it,t(B.value),1),d.value?(h(),C(`button`,{key:0,onClick:ge,class:`flex-shrink-0 px-2 py-1 text-xs bg-primary/10 hover:bg-primary/20 text-content-secondary dark:text-content-muted rounded border border-primary/30 transition-colors whitespace-nowrap`},` Generate New Key `)):g(``,!0)])]),S(`div`,at,[n[17]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Mode`,-1),S(`span`,ot,t(H.value),1)]),S(`div`,st,[n[19]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Path hash length`,-1),d.value?c((h(),C(`select`,{key:1,"onUpdate:modelValue":n[1]||=e=>F.value=e,class:`cfg-select w-full sm:w-32`},[...n[18]||=[S(`option`,{value:1},`1 byte`,-1),S(`option`,{value:2},`2 bytes`,-1),S(`option`,{value:3},`3 bytes`,-1)]],512)),[[k,F.value,void 0,{number:!0}]]):(h(),C(`div`,ct,t(G.value),1))]),S(`div`,lt,[S(`div`,ut,[n[21]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Periodic Advertisement Interval`,-1),d.value?(h(),C(`div`,ft,[c(S(`input`,{"onUpdate:modelValue":n[2]||=e=>P.value=e,type:`number`,min:`0`,max:`48`,class:`cfg-input w-20`},null,512),[[A,P.value,void 0,{number:!0}]]),n[20]||=S(`span`,{class:`text-content-muted dark:text-content-muted text-sm`},`hours`,-1)])):(h(),C(`div`,dt,t(W.value),1))]),n[22]||=S(`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)])]),S(`div`,pt,[S(`div`,mt,[n[25]||=S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-3`},`Location Settings`,-1),d.value?(h(),C(`button`,{key:0,onClick:ne,class:`btn-primary flex items-center gap-2`,title:`Pick location on map`},[...n[24]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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`}),S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 11a3 3 0 11-6 0 3 3 0 016 0z`})],-1),b(` Pick Location on Map `,-1)]])):g(``,!0)]),S(`div`,ht,[n[26]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Manual Latitude`,-1),d.value?c((h(),C(`input`,{key:1,"onUpdate:modelValue":n[3]||=e=>j.value=e,type:`number`,step:`0.000001`,min:`-90`,max:`90`,class:`cfg-input w-full sm:w-48`},null,512)),[[A,j.value,void 0,{number:!0}]]):(h(),C(`div`,gt,t(V.value),1))]),S(`div`,_t,[n[27]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Manual Longitude`,-1),d.value?c((h(),C(`input`,{key:1,"onUpdate:modelValue":n[4]||=e=>N.value=e,type:`number`,step:`0.000001`,min:`-180`,max:`180`,class:`cfg-input w-full sm:w-48`},null,512)),[[A,N.value,void 0,{number:!0}]]):(h(),C(`div`,vt,t(te.value),1))])]),_(U,{"is-open":D.value,latitude:j.value,longitude:N.value,onClose:n[5]||=e=>D.value=!1,onSelect:re},null,8,[`is-open`,`latitude`,`longitude`]),(h(),u(p,{to:`body`},[Y.value?(h(),C(`div`,{key:0,class:`fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm`,onClick:n[12]||=M(e=>Y.value=!1,[`self`])},[S(`div`,yt,[n[35]||=S(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary`},` Generate Vanity Identity Key `,-1),n[36]||=S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},` Generate a new Ed25519 identity key whose public key starts with your chosen hex prefix (0-9, A-F). Longer prefixes take more time to find. `,-1),S(`div`,null,[S(`label`,bt,`Hex Prefix (1-`+t(de.value)+` characters)`,1),c(S(`input`,{"onUpdate:modelValue":n[6]||=e=>X.value=e,type:`text`,maxlength:de.value,placeholder:`e.g. F8A1`,disabled:Z.value,class:`cfg-input py-2 placeholder-gray-400 dark:placeholder-white/40 font-mono uppercase disabled:opacity-50`},null,8,xt),[[A,X.value]]),X.value&&!fe.value?(h(),C(`p`,St,` Enter 1-`+t(de.value)+` valid hex characters (0-9, A-F) `,1)):pe.value?(h(),C(`p`,Ct,t(pe.value),1)):g(``,!0)]),S(`div`,null,[S(`button`,{onClick:n[7]||=e=>ce.value=!ce.value,disabled:Z.value,class:`text-xs text-content-muted dark:text-content-muted hover:text-content-secondary dark:hover:text-content-secondary transition-colors disabled:opacity-50 flex items-center gap-1`},[(h(),C(`svg`,{class:T([`w-3 h-3 transition-transform`,{"rotate-90":ce.value}]),fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[...n[28]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M9 5l7 7-7 7`},null,-1)]],2)),n[29]||=b(` Advanced `,-1)],8,wt),ce.value?(h(),C(`div`,Tt,[...n[30]||=[S(`p`,{class:`text-amber-600 dark:text-amber-400 text-xs font-medium`},` Extended prefix mode (up to 8 characters) `,-1),S(`p`,{class:`text-amber-600 dark:text-amber-500 text-xs mt-1`},` Prefixes longer than 4 characters require exponentially more attempts and can take a very long time or may not complete at all. The request may time out. `,-1)]])):g(``,!0)]),Z.value?(h(),C(`div`,Et,[n[31]||=S(`svg`,{class:`animate-spin h-5 w-5 text-blue-500 flex-shrink-0`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`},[S(`circle`,{class:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,"stroke-width":`4`}),S(`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`})],-1),S(`div`,null,[S(`p`,Dt,` Searching for key with prefix "`+t(X.value.toUpperCase())+`"... `,1),S(`p`,Ot,` Elapsed: `+t(le.value)+`s `,1)])])):g(``,!0),$.value?(h(),C(`div`,kt,[S(`p`,At,t($.value),1)])):g(``,!0),Q.value?(h(),C(`div`,jt,[S(`p`,Mt,` Key found in `+t(Q.value.attempts.toLocaleString())+` attempts `,1),S(`div`,null,[n[32]||=S(`span`,{class:`text-xs text-content-muted dark:text-content-muted`},`Public Key:`,-1),S(`p`,Nt,t(Q.value.public_hex),1)])])):g(``,!0),ie.value&&Q.value?(h(),C(`div`,Pt,[n[33]||=S(`p`,{class:`text-amber-600 dark:text-amber-400 text-sm font-medium`},` Warning: This will replace your current identity key. `,-1),n[34]||=S(`p`,{class:`text-amber-600 dark:text-amber-500 text-xs mt-1`},` Your node address and public key will change. Other nodes will need to re-discover you. This cannot be undone unless you have a backup. `,-1),S(`div`,Ft,[S(`button`,{onClick:ve,disabled:ae.value,class:`px-3 py-1.5 bg-red-600 hover:bg-red-700 text-white rounded-lg text-xs transition-colors disabled:opacity-50`},t(ae.value?`Applying...`:`Confirm Replace Key`),9,It),S(`button`,{onClick:n[8]||=e=>ie.value=!1,disabled:ae.value,class:`px-3 py-1.5 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 text-xs transition-colors`},` Cancel `,8,Lt)])])):g(``,!0),S(`div`,Rt,[S(`button`,{onClick:n[9]||=e=>Y.value=!1,disabled:Z.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`},` Close `,8,zt),Q.value?(h(),C(x,{key:1},[S(`button`,{onClick:n[10]||=e=>{Q.value=null,$.value=null},class:`btn-primary`},` Try Again `),ie.value?g(``,!0):(h(),C(`button`,{key:0,onClick:n[11]||=e=>ie.value=!0,class:`px-4 py-2 bg-red-600/20 hover:bg-red-600/30 text-red-600 dark:text-red-400 rounded-lg border border-red-500/50 text-sm transition-colors`},` Apply Key `))],64)):(h(),C(`button`,{key:0,onClick:_e,disabled:!fe.value||Z.value,class:`btn-primary`},t(Z.value?`Generating...`:`Generate`),9,Bt))])])])):g(``,!0)]))])],64))}}),Ht={class:`space-y-12`},Ut={class:`cfg-page-heading flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3`},Wt={class:`flex items-center gap-2 flex-shrink-0`},Gt=[`disabled`],Kt=[`disabled`],qt={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`},Jt={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`},Yt={class:`cfg-section`},Xt={class:`space-y-3`},Zt={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`},Qt={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},$t={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1`},en={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},tn=f({__name:`DutyCycle`,setup(e,{expose:n}){let r=ee(),i=y(()=>r.stats?.config?.duty_cycle||{}),a=y(()=>{let e=i.value.max_airtime_percent;return typeof e==`number`?e.toFixed(1)+`%`:e&&typeof e==`object`&&`parsedValue`in e?(e.parsedValue||0).toFixed(1)+`%`:`Not set`}),o=y(()=>i.value.enforcement_enabled?`Enabled`:`Disabled`),s=l(!1),u=l(!1),d=l(``),f=l(``),p=l(0),m=l(!0),b=()=>{let e=i.value.max_airtime_percent;typeof e==`number`?p.value=e:e&&typeof e==`object`&&`parsedValue`in e?p.value=e.parsedValue||0:p.value=6,m.value=i.value.enforcement_enabled!==!1,s.value=!0,d.value=``,f.value=``},w=()=>{s.value=!1,d.value=``,f.value=``},{showUnsavedModal:T,requestLeave:E,handleDiscard:D,handleSave:O,handleCancel:j}=se(s,u,w,async()=>(await M(),!s.value));n({requestLeave:E,isEditing:s});let M=async()=>{u.value=!0,f.value=``,d.value=``;try{let e=(await F.post(`/api/update_duty_cycle_config`,{max_airtime_percent:p.value,enforcement_enabled:m.value})).data;e.message||e.persisted?(d.value=e.message||`Settings saved successfully`,s.value=!1,await r.fetchStats(),setTimeout(()=>{d.value=``},3e3)):f.value=`Failed to save settings`}catch(e){console.error(`Failed to save duty cycle settings:`,e),f.value=e.response?.data?.error||`Failed to save settings`}finally{u.value=!1}};return(e,n)=>(h(),C(x,null,[_(oe,{show:v(T),"is-saving":u.value,label:`Duty Cycle settings`,onDiscard:v(D),onSave:v(O),onCancel:v(j)},null,8,[`show`,`is-saving`,`onDiscard`,`onSave`,`onCancel`]),S(`div`,Ht,[S(`div`,Ut,[n[2]||=S(`div`,null,[S(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2`},`Duty Cycle`),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Configure duty cycle limits for channel activity`)],-1),S(`div`,Wt,[s.value?(h(),C(x,{key:1},[S(`button`,{onClick:w,disabled:u.value,class:`cfg-btn-secondary`},` Cancel `,8,Gt),S(`button`,{onClick:M,disabled:u.value,class:`cfg-btn-primary`},t(u.value?`Saving...`:`Save Changes`),9,Kt)],64)):(h(),C(`button`,{key:0,onClick:b,class:`cfg-btn-primary`},` Edit Settings `))])]),d.value?(h(),C(`div`,qt,t(d.value),1)):g(``,!0),f.value?(h(),C(`div`,Jt,t(f.value),1)):g(``,!0),S(`div`,Yt,[S(`div`,Xt,[S(`div`,Zt,[n[3]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Max Airtime %`,-1),s.value?c((h(),C(`input`,{key:1,"onUpdate:modelValue":n[0]||=e=>p.value=e,type:`number`,step:`0.1`,min:`0.1`,max:`100`,class:`cfg-input w-full sm:w-32`},null,512)),[[A,p.value,void 0,{number:!0}]]):(h(),C(`div`,Qt,t(a.value),1))]),S(`div`,$t,[n[5]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Enforcement`,-1),s.value?c((h(),C(`select`,{key:1,"onUpdate:modelValue":n[1]||=e=>m.value=e,class:`cfg-select w-full sm:w-32`},[...n[4]||=[S(`option`,{value:!0},`Enabled`,-1),S(`option`,{value:!1},`Disabled`,-1)]],512)),[[k,m.value]]):(h(),C(`div`,en,t(o.value),1))])])])])],64))}}),nn={class:`space-y-12`},rn={class:`cfg-page-heading flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3`},an={class:`flex items-center gap-2 flex-shrink-0`},on=[`disabled`],sn=[`disabled`],cn={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`},ln={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`},un={class:`cfg-section space-y-3`},dn={class:`flex flex-col sm:flex-row sm:items-center sm:justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-3`},fn={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm flex-shrink-0`},pn={class:`flex flex-col sm:flex-row sm:items-center sm:justify-between py-2 gap-3`},mn={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm flex-shrink-0`},hn=f({__name:`TransmissionDelays`,setup(e,{expose:n}){let r=ee(),i=y(()=>r.stats?.config?.delays||{}),a=y(()=>{let e=i.value.tx_delay_factor;if(typeof e==`number`)return e.toFixed(2)+`x`;if(e&&typeof e==`object`&&`parsedValue`in e){let t=e.parsedValue;if(typeof t==`number`)return t.toFixed(2)+`x`}return`Not set`}),o=y(()=>{let e=i.value.direct_tx_delay_factor;return typeof e==`number`?e.toFixed(2)+`s`:`Not set`}),s=l(!1),u=l(!1),d=l(``),f=l(``),p=l(0),m=l(0),b=()=>{let e=i.value.tx_delay_factor;e&&typeof e==`object`&&`parsedValue`in e?p.value=e.parsedValue||1:typeof e==`number`?p.value=e:p.value=1;let t=i.value.direct_tx_delay_factor;m.value=typeof t==`number`?t:.5,s.value=!0,d.value=``,f.value=``},w=()=>{s.value=!1,d.value=``,f.value=``},T=async()=>{u.value=!0,f.value=``,d.value=``;try{let e=(await F.post(`/api/update_radio_config`,{tx_delay_factor:p.value,direct_tx_delay_factor:m.value})).data,t=e?.data??e;e.success||t.persisted||t.message?(d.value=t.message||`Settings saved successfully`,s.value=!1,await r.fetchStats(),setTimeout(()=>{d.value=``},3e3)):f.value=`Failed to save settings`}catch(e){console.error(`Failed to save delay settings:`,e),f.value=e.response?.data?.error||`Failed to save settings`}finally{u.value=!1}},{showUnsavedModal:E,requestLeave:D,handleDiscard:O,handleSave:k,handleCancel:j}=se(s,u,w,async()=>(await T(),!s.value));return n({requestLeave:D,isEditing:s}),(e,n)=>(h(),C(x,null,[_(oe,{show:v(E),"is-saving":u.value,label:`TX Delay settings`,onDiscard:v(O),onSave:v(k),onCancel:v(j)},null,8,[`show`,`is-saving`,`onDiscard`,`onSave`,`onCancel`]),S(`div`,nn,[S(`div`,rn,[n[2]||=S(`div`,null,[S(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2`},`TX Delays`),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Configure transmission delay factors for flood and direct packets`)],-1),S(`div`,an,[s.value?(h(),C(x,{key:1},[S(`button`,{onClick:w,disabled:u.value,class:`cfg-btn-secondary`},` Cancel `,8,on),S(`button`,{onClick:T,disabled:u.value,class:`cfg-btn-primary`},t(u.value?`Saving...`:`Save Changes`),9,sn)],64)):(h(),C(`button`,{key:0,onClick:b,class:`cfg-btn-primary`},` Edit Settings `))])]),d.value?(h(),C(`div`,cn,t(d.value),1)):g(``,!0),f.value?(h(),C(`div`,ln,t(f.value),1)):g(``,!0),S(`div`,un,[S(`div`,dn,[n[3]||=S(`div`,{class:`flex flex-col gap-1`},[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Flood TX Delay Factor`),S(`span`,{class:`text-content-muted dark:text-content-muted text-xs`},`Scales the airtime-based random transmit window for flood packets. Higher values increase delay spread for collision avoidance.`)],-1),s.value?c((h(),C(`input`,{key:1,"onUpdate:modelValue":n[0]||=e=>p.value=e,type:`number`,step:`0.1`,min:`0`,max:`5`,class:`cfg-input w-full sm:w-32 flex-shrink-0`},null,512)),[[A,p.value,void 0,{number:!0}]]):(h(),C(`div`,fn,t(a.value),1))]),S(`div`,pn,[n[4]||=S(`div`,{class:`flex flex-col gap-1`},[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Direct TX Delay Factor`),S(`span`,{class:`text-content-muted dark:text-content-muted text-xs`},`Fixed delay in seconds before transmitting direct-routed packets. Applied as-is with no randomisation.`)],-1),s.value?c((h(),C(`input`,{key:1,"onUpdate:modelValue":n[1]||=e=>m.value=e,type:`number`,step:`0.1`,min:`0`,max:`5`,class:`cfg-input w-full sm:w-32 flex-shrink-0`},null,512)),[[A,m.value,void 0,{number:!0}]]):(h(),C(`div`,mn,t(o.value),1))])])])],64))}}),gn=L(`treeState`,()=>{let e=i(new Set),t=i({value:null}),n=t=>{e.add(t)},r=t=>{e.delete(t)};return{expandedNodes:e,selectedNodeId:t,addExpandedNode:n,removeExpandedNode:r,isNodeExpanded:t=>e.has(t),setSelectedNode:e=>{t.value=e},toggleExpanded:t=>{e.has(t)?r(t):n(t)}}}),_n={class:`select-none`},vn={class:`flex-shrink-0`},yn={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`},bn={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`},xn={key:0,class:`hidden sm:flex items-center gap-1 ml-2`},Sn={class:`relative group`},Cn=[`title`],wn={key:0,class:`text-xs font-mono text-content-secondary dark:text-white/50 bg-stroke-subtle/40 dark:bg-white/5 px-1.5 py-0.5 rounded border border-stroke-subtle dark:border-white/10`},Tn={class:`flex justify-between items-start mb-4`},En={class:`bg-black/20 border border-white/10 rounded-md p-4 mb-4`},Dn={class:`text-sm font-mono text-white/80 break-all leading-relaxed`},On={class:`flex items-center gap-2 sm:gap-3 ml-auto flex-shrink-0`},kn={key:0,class:`hidden sm:flex items-center gap-1`},An=[`title`],jn={key:1,class:`hidden sm:flex items-center gap-1`},Mn={key:3,class:`hidden sm:inline-block px-2 py-1 bg-stroke-subtle dark:bg-white/10 text-content-secondary dark:text-white/60 text-xs rounded-full ml-1`},Nn={key:0,class:`space-y-1`},Pn=B(f({__name:`TreeNode`,props:{node:{},selectedNodeId:{},level:{},disabled:{type:Boolean},unlocked:{type:Boolean}},emits:[`select`,`edit`,`delete`],setup(n,{emit:r}){let i=n,o=r,s=gn(),c=l(!1),d=y({get:()=>s.isNodeExpanded(i.node.id),set:e=>{e?s.addExpandedNode(i.node.id):s.removeExpandedNode(i.node.id)}}),f=y(()=>i.node.children.length>0);function p(){i.unlocked&&E(),f.value&&w()}function w(){f.value&&(d.value=!d.value)}function E(){o(`select`,i.node.id)}function D(e){o(`select`,e)}function O(e){o(`edit`,e)}function k(e){o(`delete`,e)}function A(e){e.stopPropagation(),c.value=!c.value}function N(e){e.stopPropagation(),i.node.transport_key&&window.navigator?.clipboard&&window.navigator.clipboard.writeText(i.node.transport_key)}return(r,s)=>{let l=a(`TreeNode`,!0);return h(),C(`div`,_n,[S(`div`,{class:T([`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 border transition-colors duration-150`,i.disabled?`opacity-50`:``,i.unlocked&&n.selectedNodeId===n.node.id?`bg-primary/10 border-primary/30 text-content-primary dark:text-white`:`cfg-card text-content-primary dark:text-white/80`,i.unlocked&&n.selectedNodeId!==n.node.id?`hover:bg-stroke-subtle/40 dark:hover:bg-white/5 hover:border-stroke dark:hover:border-white/15`:``,f.value&&!i.disabled?`cursor-pointer`:``,`ml-${n.level*4}`]),onClick:s[5]||=M(e=>!i.disabled&&p(),[`stop`])},[S(`div`,{class:`flex-shrink-0 w-3 h-3 sm:w-4 sm:h-4 flex items-center justify-center`,onClick:M(w,[`stop`])},[f.value?(h(),C(`svg`,{key:0,class:T([`w-2.5 h-2.5 sm:w-3 sm:h-3 transition-transform duration-200`,d.value?`rotate-90`:`rotate-0`]),fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[...s[6]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M9 5l7 7-7 7`},null,-1)]],2)):g(``,!0)]),S(`div`,vn,[i.node.name.startsWith(`#`)?(h(),C(`svg`,yn,[...s[7]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M7 20l4-16m2 16l4-16M6 9h14M4 15h14`},null,-1)]])):(h(),C(`svg`,bn,[...s[8]||=[S(`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)]]))]),S(`span`,{class:T([`font-mono text-xs sm:text-sm transition-colors duration-200 break-all`,n.selectedNodeId===n.node.id?`text-primary font-medium`:``])},t(n.node.name.startsWith(`#`)?n.node.name.slice(1):n.node.name),3),n.node.transport_key?(h(),C(`div`,xn,[S(`div`,Sn,[S(`button`,{onClick:A,class:`p-1 rounded hover:bg-stroke-subtle dark:hover:bg-white/10 transition-colors`,title:c.value?`Hide full key`:`Show full key`},[...s[9]||=[S(`svg`,{class:`w-3 h-3 text-content-muted dark:text-white/60 hover:text-content-secondary dark:hover:text-white/80`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 12a3 3 0 11-6 0 3 3 0 016 0z`}),S(`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,Cn),c.value?g(``,!0):(h(),C(`span`,wn,t(v(G)(n.node.transport_key)),1)),c.value?(h(),C(`div`,{key:1,class:`fixed inset-0 z-[300] flex items-center justify-center bg-black/70 backdrop-blur-md`,onClick:s[2]||=e=>c.value=!1},[S(`div`,{class:`bg-black/20 border border-white/20 rounded-lg shadow-lg p-6 max-w-2xl w-full mx-4`,onClick:s[1]||=M(()=>{},[`stop`])},[S(`div`,Tn,[s[11]||=S(`h3`,{class:`text-lg font-semibold text-white`},`Transport Key`,-1),S(`button`,{onClick:s[0]||=e=>c.value=!1,class:`text-white/60 hover:text-white transition-colors`},[...s[10]||=[S(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),S(`div`,En,[S(`div`,Dn,t(n.node.transport_key),1)]),S(`div`,{class:`flex justify-end`},[S(`button`,{onClick:N,class:`btn-success flex items-center gap-2`,title:`Copy to clipboard`},[...s[12]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),b(` Copy Key `,-1)]])])])])):g(``,!0)])])):g(``,!0),S(`div`,On,[n.node.last_used?(h(),C(`div`,kn,[s[13]||=S(`span`,{class:`text-xs text-content-muted dark:text-white/40`},`Last Heard:`,-1),S(`span`,{class:`text-xs text-content-secondary dark:text-white/50`,title:n.node.last_used.toLocaleString()},t(v(W)(n.node.last_used)),9,An)])):(h(),C(`div`,jn,[...s[14]||=[S(`span`,{class:`text-xs text-content-muted dark:text-white/30`},`Last Heard:`,-1),S(`span`,{class:`text-xs text-content-muted dark:text-white/30 italic`},`Never`,-1)]])),S(`span`,{class:T([`text-[10px] sm:text-xs`,n.node.floodPolicy===`allow`?`text-accent-green/80`:`text-accent-red/80`])},` Flood: `+t(n.node.floodPolicy===`allow`?`Allow`:`Deny`),3),i.unlocked?(h(),C(x,{key:2},[S(`button`,{onClick:s[3]||=M(e=>o(`edit`,n.node.id),[`stop`]),class:`px-2 py-0.5 text-[10px] sm:text-xs bg-primary/10 hover:bg-primary/20 text-content-secondary dark:text-content-muted rounded border border-primary/30 transition-colors whitespace-nowrap`},` Edit `),S(`button`,{onClick:s[4]||=M(e=>o(`delete`,n.node.id),[`stop`]),class:`p-1 text-accent-red/50 hover:text-accent-red transition-colors`,title:`Delete`},[...s[15]||=[S(`svg`,{class:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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)]])],64)):g(``,!0),f.value&&!i.unlocked?(h(),C(`span`,Mn,t(n.node.children.length),1)):g(``,!0)])],2),_(j,{"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:e(()=>[d.value&&n.node.children.length>0?(h(),C(`div`,Nn,[(h(!0),C(x,null,m(n.node.children,e=>(h(),u(l,{key:e.id,node:e,"selected-node-id":n.selectedNodeId,level:n.level+1,disabled:i.disabled,unlocked:i.unlocked,onSelect:D,onEdit:O,onDelete:k},null,8,[`node`,`selected-node-id`,`level`,`disabled`,`unlocked`]))),128))])):g(``,!0)]),_:1})])}}}),[[`__scopeId`,`data-v-dad29312`]]),Fn={class:`modal-card max-w-md`},In={class:`flex items-center justify-between mb-6`},Ln={class:`text-content-secondary dark:text-content-muted text-sm mt-1`},Rn={key:0},zn={class:`text-primary font-mono`},Bn={key:1},Vn={class:`pb-2`},Hn={class:`flex bg-background-mute dark:bg-stroke/5 rounded-lg border border-stroke-subtle dark:border-stroke/20 p-0.5`},Un={for:`keyName`,class:`block text-sm font-medium text-content-primary dark:text-content-primary mb-2`},Wn={class:`flex items-center`},Gn={key:0,class:`px-3 py-3 bg-secondary/10 border border-r-0 border-secondary/30 rounded-l-lg text-secondary text-sm font-mono`},Kn=[`placeholder`],qn={key:0,class:`text-content-muted dark:text-content-muted text-xs mt-1`},Jn={class:`pt-1 border-t border-stroke-subtle dark:border-stroke/10`},Yn={class:`flex bg-background-mute dark:bg-stroke/5 rounded-lg border border-stroke-subtle dark:border-stroke/20 p-0.5`},Xn={class:`flex gap-3 pt-4`},Zn=[`disabled`],Qn=f({__name:`AddKeyModal`,props:{show:{type:Boolean},selectedNodeName:{},selectedNodeId:{}},emits:[`close`,`add`],setup(e,{emit:n}){let r=e,i=n,a=l(``),o=l(`allow`),s=l(`region`),d=y(()=>s.value===`region`),f=y(()=>({type:d.value?`Region`:`Private Key`,description:d.value?`Regional organisational key`:`Individual assigned key`})),m=y(()=>a.value.trim().length>0),_=()=>{m.value&&(i(`add`,{name:d.value?`#${a.value.trim()}`:a.value.trim(),floodPolicy:o.value,parentId:r.selectedNodeId}),a.value=``,o.value=`allow`,s.value=`region`)},v=()=>{a.value=``,o.value=`allow`,s.value=`region`,i(`close`)};return(n,i)=>(h(),u(p,{to:`body`},[e.show?(h(),C(`div`,{key:0,onClick:i[5]||=M(e=>v(),[`self`]),class:`modal-backdrop`},[S(`div`,Fn,[S(`div`,In,[S(`div`,null,[i[7]||=S(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary`},` Add New Entry `,-1),S(`p`,Ln,[r.selectedNodeName?(h(),C(`span`,Rn,[i[6]||=b(` Add to: `,-1),S(`span`,zn,t(r.selectedNodeName),1)])):(h(),C(`span`,Bn,` Add to root level (#uk) `))])]),S(`button`,{onClick:v,class:`text-white/60 hover:text-white transition-colors`},[...i[8]||=[S(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),S(`form`,{onSubmit:M(_,[`prevent`]),class:`space-y-5`},[S(`div`,Vn,[i[9]||=S(`label`,{class:`block text-sm font-medium text-content-primary dark:text-content-primary mb-2`},` Entry Type `,-1),S(`div`,Hn,[S(`button`,{type:`button`,onClick:i[0]||=e=>s.value=`region`,class:T([`flex-1 px-3 py-1.5 text-xs font-medium rounded transition-colors`,s.value===`region`?`bg-secondary/20 text-secondary border border-secondary/50`:`text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-secondary`])},` REGION `,2),S(`button`,{type:`button`,onClick:i[1]||=e=>s.value=`privateKey`,class:T([`flex-1 px-3 py-1.5 text-xs font-medium rounded transition-colors`,s.value===`privateKey`?`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`])},` PRIVATE KEY `,2)])]),S(`div`,null,[S(`label`,Un,t(f.value.type)+` Name `,1),S(`div`,Wn,[d.value?(h(),C(`span`,Gn,`#`)):g(``,!0),c(S(`input`,{id:`keyName`,"onUpdate:modelValue":i[2]||=e=>a.value=e,type:`text`,placeholder:d.value?`e.g., uk, au, us`:`Enter key name`,class:T([`flex-1 px-4 py-3 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 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`,d.value?`rounded-r-lg`:`rounded-lg`]),autocomplete:`off`},null,10,Kn),[[A,a.value]])]),d.value?(h(),C(`p`,qn,` The # prefix is added automatically for regions. `)):g(``,!0)]),S(`div`,Jn,[i[10]||=S(`label`,{class:`block text-sm font-medium text-content-primary dark:text-content-primary mb-3 pt-4`},` Flood Policy `,-1),S(`div`,Yn,[S(`button`,{type:`button`,onClick:i[3]||=e=>o.value=`allow`,class:T([`flex-1 px-3 py-1.5 text-xs font-medium rounded transition-colors`,o.value===`allow`?`bg-accent-green/10 text-accent-green border border-accent-green/20`:`text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-secondary`])},` ALLOW `,2),S(`button`,{type:`button`,onClick:i[4]||=e=>o.value=`deny`,class:T([`flex-1 px-3 py-1.5 text-xs font-medium rounded transition-colors`,o.value===`deny`?`bg-accent-red/10 text-accent-red border border-accent-red/20`:`text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-secondary`])},` DENY `,2)])]),S(`div`,Xn,[S(`button`,{type:`button`,onClick:v,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(`button`,{type:`submit`,disabled:!m.value,class:T([`flex-1 px-4 py-3 rounded-lg transition-colors font-medium`,m.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 `+t(f.value.type),11,Zn)])],32)])])):g(``,!0)]))}});function $n(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`&&`BYTES_PER_ELEMENT`in e&&e.BYTES_PER_ELEMENT===1}function er(e,t,n=``){let r=$n(e),i=e?.length,a=t!==void 0;if(!r||a&&i!==t){let o=n&&`"${n}" `,s=a?` of length ${t}`:``,c=r?`length=${i}`:`type=${typeof e}`,l=o+`expected Uint8Array`+s+`, got `+c;throw r?RangeError(l):TypeError(l)}return e}function tr(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function nr(e,t){er(e,void 0,`digestInto() output`);let n=t.outputLen;if(e.length=`+n)}function rr(...e){for(let t=0;t>>t}new Uint8Array(new Uint32Array([287454020]).buffer)[0],typeof Uint8Array.from([]).toHex==`function`&&Uint8Array.fromHex;function or(e,t={}){let n=(t,n)=>e(n).update(t).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.canXOF=r.canXOF,n.create=t=>e(t),Object.assign(n,t),Object.freeze(n)}var sr=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function cr(e,t,n){return e&t^~e&n}function lr(e,t,n){return e&t^e&n^t&n}var ur=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,n,r){this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=ir(this.buffer)}update(e){tr(this),er(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length;for(let a=0;ar-a&&(this.process(n,0),a=0);for(let e=a;el.length)throw Error(`_sha2: outputLen bigger than state`);for(let e=0;e>pr&fr)}:{h:Number(e>>pr&fr)|0,l:Number(e&fr)|0}}function hr(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let a=0;a>>3;_r[e]=(ar(n,17)^ar(n,19)^n>>>10)+_r[e-7]+r+_r[e-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=ar(o,6)^ar(o,11)^ar(o,25),u=l+t+cr(o,s,c)+gr[e]+_r[e]|0,d=(ar(n,2)^ar(n,13)^ar(n,22))+lr(n,r,i)|0;l=c,c=s,s=o,o=a+u|0,a=i,i=r,r=n,n=u+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,a,o,s,c,l)}roundClean(){rr(_r)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),rr(this.buffer)}},yr=class extends vr{A=dr[0]|0;B=dr[1]|0;C=dr[2]|0;D=dr[3]|0;E=dr[4]|0;F=dr[5]|0;G=dr[6]|0;H=dr[7]|0;constructor(){super(32)}},br=hr(`0x428a2f98d728ae22.0x7137449123ef65cd.0xb5c0fbcfec4d3b2f.0xe9b5dba58189dbbc.0x3956c25bf348b538.0x59f111f1b605d019.0x923f82a4af194f9b.0xab1c5ed5da6d8118.0xd807aa98a3030242.0x12835b0145706fbe.0x243185be4ee4b28c.0x550c7dc3d5ffb4e2.0x72be5d74f27b896f.0x80deb1fe3b1696b1.0x9bdc06a725c71235.0xc19bf174cf692694.0xe49b69c19ef14ad2.0xefbe4786384f25e3.0x0fc19dc68b8cd5b5.0x240ca1cc77ac9c65.0x2de92c6f592b0275.0x4a7484aa6ea6e483.0x5cb0a9dcbd41fbd4.0x76f988da831153b5.0x983e5152ee66dfab.0xa831c66d2db43210.0xb00327c898fb213f.0xbf597fc7beef0ee4.0xc6e00bf33da88fc2.0xd5a79147930aa725.0x06ca6351e003826f.0x142929670a0e6e70.0x27b70a8546d22ffc.0x2e1b21385c26c926.0x4d2c6dfc5ac42aed.0x53380d139d95b3df.0x650a73548baf63de.0x766a0abb3c77b2a8.0x81c2c92e47edaee6.0x92722c851482353b.0xa2bfe8a14cf10364.0xa81a664bbc423001.0xc24b8b70d0f89791.0xc76c51a30654be30.0xd192e819d6ef5218.0xd69906245565a910.0xf40e35855771202a.0x106aa07032bbd1b8.0x19a4c116b8d2d0c8.0x1e376c085141ab53.0x2748774cdf8eeb99.0x34b0bcb5e19b48a8.0x391c0cb3c5c95a63.0x4ed8aa4ae3418acb.0x5b9cca4f7763e373.0x682e6ff3d6b2b8a3.0x748f82ee5defb2fc.0x78a5636f43172f60.0x84c87814a1f0ab72.0x8cc702081a6439ec.0x90befffa23631e28.0xa4506cebde82bde9.0xbef9a3f7b2c67915.0xc67178f2e372532b.0xca273eceea26619c.0xd186b8c721c0c207.0xeada7dd6cde0eb1e.0xf57d4f7fee6ed178.0x06f067aa72176fba.0x0a637dc5a2c898a6.0x113f9804bef90dae.0x1b710b35131c471b.0x28db77f523047d84.0x32caab7b40c72493.0x3c9ebe0a15c9bebc.0x431d67c49c100d4c.0x4cc5d4becb3e42b6.0x597f299cfc657e2a.0x5fcb6fab3ad6faec.0x6c44198c4a475817`.split(`.`).map(e=>BigInt(e)));br[0],br[1];var xr=or(()=>new yr,sr(1)),Sr={class:`modal-card max-w-lg`},Cr={class:`flex items-center justify-between mb-6`},wr={class:`text-content-secondary dark:text-content-muted text-sm mt-1`},Tr={class:`text-primary font-mono`},Er={class:`pb-2`},Dr={class:`flex bg-background-mute dark:bg-stroke/5 rounded-lg border border-stroke-subtle dark:border-stroke/20 p-0.5`},Or={for:`keyName`,class:`block text-sm font-medium text-content-primary dark:text-content-primary mb-2`},kr={class:`flex items-center`},Ar={key:0,class:`px-3 py-3 bg-secondary/10 border border-r-0 border-secondary/30 rounded-l-lg text-secondary text-sm font-mono`},jr=[`placeholder`],Mr={key:0,class:`text-content-muted dark:text-content-muted text-xs mt-1`},Nr={key:1,class:`mt-3 bg-background-mute dark:bg-black/20 border border-stroke-subtle dark:border-stroke/10 rounded-md p-3`},Pr={class:`flex items-center justify-between mb-1.5`},Fr={class:`text-xs font-mono text-content-primary dark:text-content-primary/80 break-all`},Ir={key:0,class:`text-xs text-amber-500 dark:text-amber-400 mt-1`},Lr={key:0,class:`mt-1 bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-3`},Rr={class:`flex items-center justify-between`},zr={class:`text-right`},Br={class:`text-sm text-content-secondary dark:text-content-muted`},Vr={class:`text-xs text-content-muted dark:text-content-muted`},Hr={class:`pt-1 border-t border-stroke-subtle dark:border-stroke/10`},Ur={class:`flex bg-background-mute dark:bg-stroke/5 rounded-lg border border-stroke-subtle dark:border-stroke/20 p-0.5`},Wr={class:`flex gap-3 pt-4`},Gr=[`disabled`],Kr=f({__name:`EditKeyModal`,props:{show:{type:Boolean},node:{}},emits:[`close`,`save`],setup(e,{emit:n}){let r=e,i=n,a=l(``),s=l(`allow`),d=l(`region`),f=y(()=>d.value===`region`),m=y(()=>({type:f.value?`Region`:`Private Key`,description:f.value?`Regional organisational key`:`Individual assigned key`}));o(()=>r.node,e=>{if(e){let t=e.name.startsWith(`#`);d.value=t?`region`:`privateKey`,a.value=t?e.name.slice(1):e.name,s.value=e.floodPolicy}else a.value=``,s.value=`allow`,d.value=`region`},{immediate:!0});let _=y(()=>a.value.trim().length>0&&r.node),x=y(()=>{let e=a.value.trim();return e?f.value?`#${e}`:e:r.node?.name||``}),w=y(()=>r.node?r.node.name.startsWith(`#`)?r.node.name.slice(1):r.node.name:``),D=y(()=>a.value.trim()!==w.value);function O(e){let t=e.startsWith(`#`)?e:`#${e}`,n=xr(new TextEncoder().encode(t)).slice(0,16),r=``;return n.forEach(e=>{r+=String.fromCharCode(e)}),btoa(r)}let k=l(null);E(()=>{let e=a.value.trim();if(!f.value||!e){k.value=null;return}k.value=O(e)});let j=e=>{window.navigator?.clipboard&&window.navigator.clipboard.writeText(e)},N=()=>{if(!_.value||!r.node)return;let e=f.value?`#${a.value.trim()}`:a.value.trim(),t=f.value&&D.value?k.value??O(a.value.trim()):void 0;i(`save`,{id:r.node.id,name:e,floodPolicy:s.value,transportKey:t}),P()},P=()=>{i(`close`)};return(n,r)=>(h(),u(p,{to:`body`},[e.show?(h(),C(`div`,{key:0,onClick:r[6]||=M(e=>P(),[`self`]),class:`modal-backdrop`},[S(`div`,Sr,[S(`div`,Cr,[S(`div`,null,[r[8]||=S(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary`},` Edit Entry `,-1),S(`p`,wr,[r[7]||=b(` Modify `,-1),S(`span`,Tr,t(x.value),1)])]),S(`button`,{onClick:P,class:`text-white/60 hover:text-white transition-colors`},[...r[9]||=[S(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),S(`form`,{onSubmit:M(N,[`prevent`]),class:`space-y-5`},[S(`div`,Er,[r[10]||=S(`label`,{class:`block text-sm font-medium text-content-primary dark:text-content-primary mb-2`},` Entry Type `,-1),S(`div`,Dr,[S(`button`,{type:`button`,onClick:r[0]||=e=>d.value=`region`,class:T([`flex-1 px-3 py-1.5 text-xs font-medium rounded transition-colors`,d.value===`region`?`bg-secondary/20 text-secondary border border-secondary/50`:`text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-secondary`])},` REGION `,2),S(`button`,{type:`button`,onClick:r[1]||=e=>d.value=`privateKey`,class:T([`flex-1 px-3 py-1.5 text-xs font-medium rounded transition-colors`,d.value===`privateKey`?`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`])},` PRIVATE KEY `,2)])]),S(`div`,null,[S(`label`,Or,t(m.value.type)+` Name `,1),S(`div`,kr,[f.value?(h(),C(`span`,Ar,`#`)):g(``,!0),c(S(`input`,{id:`keyName`,"onUpdate:modelValue":r[2]||=e=>a.value=e,type:`text`,placeholder:f.value?`e.g., uk, au, us`:`Enter key name`,class:T([`flex-1 px-4 py-3 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 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`,f.value?`rounded-r-lg`:`rounded-lg`]),autocomplete:`off`},null,10,jr),[[A,a.value]])]),f.value?(h(),C(`p`,Mr,` The # prefix is added automatically for regions. `)):g(``,!0),f.value&&e.node?.transport_key?(h(),C(`div`,Nr,[S(`div`,Pr,[r[12]||=S(`span`,{class:`text-xs font-medium text-content-secondary dark:text-content-muted`},`Transport Key`,-1),D.value?g(``,!0):(h(),C(`button`,{key:0,type:`button`,onClick:r[3]||=t=>j(e.node.transport_key||``),class:`text-xs text-accent-green hover:text-accent-green/80 flex items-center gap-1`,title:`Copy to clipboard`},[...r[11]||=[S(`svg`,{class:`w-3 h-3`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),b(` Copy `,-1)]]))]),S(`div`,Fr,t(k.value??e.node.transport_key),1),D.value?(h(),C(`div`,Ir,` Updated for "`+t(x.value)+`" `,1)):g(``,!0)])):g(``,!0)]),e.node?.last_used?(h(),C(`div`,Lr,[S(`div`,Rr,[r[13]||=S(`div`,{class:`flex items-center gap-2`},[S(`svg`,{class:`w-4 h-4 text-primary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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`})]),S(`span`,{class:`text-sm font-medium text-content-primary dark:text-content-primary`},`Last Used`)],-1),S(`div`,zr,[S(`div`,Br,t(e.node.last_used.toLocaleDateString())+` at `+t(e.node.last_used.toLocaleTimeString()),1),S(`div`,Vr,t(v(W)(e.node.last_used)),1)])])])):g(``,!0),S(`div`,Hr,[r[14]||=S(`label`,{class:`block text-sm font-medium text-content-primary dark:text-content-primary mb-3 pt-4`},` Flood Policy `,-1),S(`div`,Ur,[S(`button`,{type:`button`,onClick:r[4]||=e=>s.value=`allow`,class:T([`flex-1 px-3 py-1.5 text-xs font-medium rounded transition-colors`,s.value===`allow`?`bg-accent-green/10 text-accent-green border border-accent-green/20`:`text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-secondary`])},` ALLOW `,2),S(`button`,{type:`button`,onClick:r[5]||=e=>s.value=`deny`,class:T([`flex-1 px-3 py-1.5 text-xs font-medium rounded transition-colors`,s.value===`deny`?`bg-accent-red/10 text-accent-red border border-accent-red/20`:`text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-secondary`])},` DENY `,2)])]),S(`div`,Wr,[S(`button`,{type:`button`,onClick:P,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(`button`,{type:`submit`,disabled:!_.value,class:T([`flex-1 px-4 py-3 rounded-lg transition-colors font-medium`,_.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`])},` Done `,10,Gr)])],32)])])):g(``,!0)]))}}),qr={class:`modal-card max-w-lg`},Jr={class:`flex items-center gap-3 mb-6`},Yr={class:`text-content-secondary dark:text-content-muted text-sm mt-1`},Xr={class:`text-accent-red font-mono`},Zr={key:0,class:`bg-accent-red/10 border border-accent-red/30 rounded-lg p-4 mb-6`},Qr={class:`flex items-start gap-3`},$r={class:`flex-1`},ei={class:`text-accent-red font-medium text-sm mb-2`},ti={class:`space-y-1 max-h-32 overflow-y-auto`},ni={key:0,class:`w-3 h-3 text-secondary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},ri={key:1,class:`w-3 h-3 text-accent-green`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},ii={class:`font-mono`},ai={key:0,class:`text-content-secondary dark:text-content-muted text-xs`},oi={key:1,class:`mb-6`},si={class:`mb-3`},ci={class:`relative`},li={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`},ui={key:0,class:`text-center py-4 text-content-secondary dark:text-content-muted text-sm`},di={class:`relative`},fi=[`value`],pi={class:`flex items-center gap-2 flex-1`},mi={class:`text-content-primary dark:text-content-primary font-mono text-sm`},hi={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`},gi={class:`flex gap-3`},_i=f({__name:`DeleteConfirmModal`,props:{show:{type:Boolean},node:{},allNodes:{}},emits:[`close`,`delete-all`,`move-children`],setup(e,{emit:n}){let r=e,i=n,a=l(null),o=l(``),s=e=>{let t=[],n=e=>{for(let r of e.children)t.push(r),n(r)};return n(e),t},d=y(()=>r.node?s(r.node):[]),f=y(()=>{if(!r.node)return[];let e=new Set([r.node.id,...d.value.map(e=>e.id)]),t=n=>{let r=[];for(let i of n)i.name.startsWith(`#`)&&!e.has(i.id)&&r.push(i),i.children.length>0&&r.push(...t(i.children));return r};return t(r.allNodes)}),_=y(()=>{if(!o.value.trim())return f.value;let e=o.value.toLowerCase();return f.value.filter(t=>t.name.toLowerCase().includes(e))}),v=()=>{r.node&&(i(`delete-all`,r.node.id),E())},w=()=>{!r.node||!a.value||(i(`move-children`,{nodeId:r.node.id,targetParentId:a.value}),E())},E=()=>{a.value=null,o.value=``,i(`close`)};return(n,r)=>(h(),u(p,{to:`body`},[e.show&&e.node?(h(),C(`div`,{key:0,onClick:r[2]||=M(e=>E(),[`self`]),class:`modal-backdrop-heavy`},[S(`div`,qr,[S(`div`,Jr,[r[6]||=S(`svg`,{class:`w-6 h-6 text-accent-red`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`div`,null,[r[4]||=S(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary`},` Confirm Deletion `,-1),S(`p`,Yr,[r[3]||=b(` Deleting `,-1),S(`span`,Xr,t(e.node?.name),1)])]),S(`button`,{onClick:E,class:`ml-auto text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors`},[...r[5]||=[S(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),d.value.length>0?(h(),C(`div`,Zr,[S(`div`,Qr,[r[9]||=S(`svg`,{class:`w-5 h-5 text-accent-red flex-shrink-0 mt-0.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`div`,$r,[S(`h4`,ei,` This will affect `+t(d.value.length)+` child `+t(d.value.length===1?`entry`:`entries`)+`: `,1),S(`div`,ti,[(h(!0),C(x,null,m(d.value.slice(0,10),e=>(h(),C(`div`,{key:e.id,class:`flex items-center gap-2 text-xs text-content-secondary dark:text-content-primary/80`},[e.name.startsWith(`#`)?(h(),C(`svg`,ni,[...r[7]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M7 20l4-16m2 16l4-16M6 9h14M4 15h14`},null,-1)]])):(h(),C(`svg`,ri,[...r[8]||=[S(`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)]])),S(`span`,ii,t(e.name),1),S(`span`,{class:T([`px-1 py-0.5 text-xs rounded`,e.floodPolicy===`allow`?`bg-accent-green/20 text-accent-green`:`bg-accent-red/20 text-accent-red`])},t(e.floodPolicy),3)]))),128)),d.value.length>10?(h(),C(`div`,ai,` ...and `+t(d.value.length-10)+` more `,1)):g(``,!0)])])])])):g(``,!0),d.value.length>0&&f.value.length>0?(h(),C(`div`,oi,[r[13]||=S(`h4`,{class:`text-content-primary dark:text-content-primary font-medium text-sm mb-3`},` Move children to another region: `,-1),S(`div`,si,[S(`div`,ci,[r[10]||=S(`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`},[S(`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),c(S(`input`,{"onUpdate:modelValue":r[0]||=e=>o.value=e,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),[[A,o.value]])])]),S(`div`,li,[_.value.length===0?(h(),C(`div`,ui,t(o.value?`No regions match your search`:`No available regions`),1)):g(``,!0),(h(!0),C(x,null,m(_.value,e=>(h(),C(`label`,{key:e.id,class:`flex items-center gap-3 p-2 rounded cursor-pointer hover:bg-stroke-subtle dark:hover:bg-white/10 transition-colors group`},[S(`div`,di,[c(S(`input`,{type:`radio`,value:e.id,"onUpdate:modelValue":r[1]||=e=>a.value=e,class:`sr-only peer`},null,8,fi),[[D,a.value]]),r[11]||=S(`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`},[S(`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)]),S(`div`,pi,[r[12]||=S(`svg`,{class:`w-4 h-4 text-secondary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M7 20l4-16m2 16l4-16M6 9h14M4 15h14`})],-1),S(`span`,mi,t(e.name),1),e.children.length>0?(h(),C(`span`,hi,t(e.children.length),1)):g(``,!0)])]))),128))])])):g(``,!0),S(`div`,gi,[S(`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 `),d.value.length>0&&a.value?(h(),C(`button`,{key:0,onClick:w,class:`modal-btn-primary`},` Move & Delete `)):g(``,!0),S(`button`,{onClick:v,class:`modal-btn-danger`},t(d.value.length>0?`Delete All`:`Delete`),1)])])])):g(``,!0)]))}}),vi={class:`space-y-12`},yi={class:`cfg-page-heading flex flex-col sm:flex-row sm:justify-between sm:items-start gap-3`},bi={class:`flex items-center gap-2 flex-shrink-0`},xi=[`disabled`],Si=[`disabled`],Ci=[`disabled`],wi={key:0,class:`bg-red-100 dark:bg-red-500/20 border border-red-500/50 rounded-lg p-3`},Ti={class:`text-red-600 dark:text-red-400 text-sm`},Ei={class:`cfg-section`},Di={class:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3`},Oi={key:0,class:`text-xs text-content-muted dark:text-content-muted pb-1`},ki={key:1,class:`flex items-center justify-center py-8`},Ai={key:2,class:`text-center py-8`},ji={class:`text-content-secondary dark:text-content-muted text-sm`},Mi={key:3,class:`text-center py-8`},Ni={key:4,class:`space-y-2`},Pi=f({name:`TransportKeys`,__name:`TransportKeys`,setup(e,{expose:n}){let i=gn(),a=ee(),s=l(!1),c=l(!1),d=l(null),f=-1;function p(){return f--}let w=l(`deny`),E=`deny`;o(y(()=>a.stats?.config?.mesh?.unscoped_flood_allow??null),e=>{e!==null&&!s.value&&(w.value=e?`allow`:`deny`)},{immediate:!0});let D=l([]),O=null,k=l(!1),A=l(null),j=l(!1),M=l(!1),N=l(!1),P=l(null),F=l(null);function L(e){return e.map(e=>({...e,children:L(e.children)}))}function R(e,t){let n=[];for(let r of e)n.push({node:r,parentId:t}),n.push(...R(r.children,r.id));return n}function z(e,t){for(let n of e){if(n.id===t)return n;let e=z(n.children,t);if(e)return e}return null}function B(e,t){let n=e.findIndex(e=>e.id===t);if(n!==-1)return e.splice(n,1),!0;for(let n of e)if(B(n.children,t))return!0;return!1}let te=e=>{let t=new Map,n=[];return e.forEach(e=>{t.set(e.id,{id:e.id,name:e.name,floodPolicy:e.flood_policy,transport_key:e.transport_key,last_used:e.last_used?new Date(e.last_used*1e3):void 0,parent_id:e.parent_id,children:[]})}),t.forEach(e=>{e.parent_id&&t.has(e.parent_id)?t.get(e.parent_id).children.push(e):n.push(e)}),n},H=async()=>{k.value=!0,A.value=null;try{let e=await I.getTransportKeys();e.success&&e.data?D.value=te(e.data):A.value=e.error||`Failed to load regions`}catch(e){A.value=e instanceof Error?e.message:`Unknown error occurred`}finally{k.value=!1}};r(H);function U(){O=L(D.value),E=w.value,s.value=!0,d.value=null}function W(){O&&(D.value=L(O)),w.value=E,O=null,s.value=!1,d.value=null,i.setSelectedNode(null)}async function G(){c.value=!0,d.value=null;try{let e=R(D.value),t=O?R(O):[],n=new Map(t.map(({node:e})=>[e.id,e])),r=e.filter(({node:e})=>e.id>0),o=e.filter(({node:e})=>e.id<0),c=new Set(r.map(({node:e})=>e.id));for(let{node:e}of t)c.has(e.id)||await I.deleteTransportKey(e.id);let l=new Map,u=[...o],d=u.length*2;for(;u.length&&d-- >0;){let e=u.findIndex(({parentId:e})=>e===void 0||e>0||e<0&&l.has(e));if(e===-1)break;let{node:t,parentId:n}=u.splice(e,1)[0],r=n===void 0?void 0:n>0?n:l.get(n),i=await I.createTransportKey(t.name,t.floodPolicy,t.transport_key,r);i.success&&i.data?.id&&l.set(t.id,i.data.id)}for(let{node:e}of r){let t=n.get(e.id);t&&(e.name!==t.name||e.floodPolicy!==t.floodPolicy||e.transport_key!==t.transport_key)&&await I.updateTransportKey(e.id,e.name,e.floodPolicy,e.transport_key)}w.value!==E&&await I.updateUnscopedFloodPolicy(w.value===`allow`),await H(),await a.fetchStats(),O=null,s.value=!1,i.setSelectedNode(null)}catch(e){d.value=e instanceof Error?e.message:`Save failed`}finally{c.value=!1}}function K(e){i.setSelectedNode(e)}function q(){let e=i.selectedNodeId.value;return e?z(D.value,e)?.name:void 0}function J(){j.value=!0}function ne(e){let t={id:p(),name:e.name,floodPolicy:e.floodPolicy,children:[]};if(e.parentId){let n=z(D.value,e.parentId);n?n.children.push(t):D.value.push(t)}else D.value.push(t);j.value=!1}function re(e){let t=z(D.value,e);t&&(P.value=t,M.value=!0)}function Y(e){let t=z(D.value,e.id);t&&(t.name=e.name,t.floodPolicy=e.floodPolicy,e.transportKey!==void 0&&(t.transport_key=e.transportKey)),M.value=!1,P.value=null}function X(){M.value=!1,P.value=null}function Z(e){let t=z(D.value,e);t&&(F.value=t,N.value=!0)}function Q(e){B(D.value,e),i.setSelectedNode(null),N.value=!1,F.value=null}function $(e){let t=z(D.value,e.nodeId);if(t?.children.length){let n=z(D.value,e.targetParentId);n?n.children.push(...t.children):D.value.push(...t.children)}B(D.value,e.nodeId),i.setSelectedNode(null),N.value=!1,F.value=null}function ie(e){w.value=e}let{showUnsavedModal:ae,requestLeave:ce,handleDiscard:le,handleSave:ue,handleCancel:de}=se(s,c,W,async()=>(await G(),!s.value));return n({requestLeave:ce,isEditing:s}),(e,n)=>(h(),C(x,null,[_(oe,{show:v(ae),"is-saving":c.value,label:`Region Configuration`,onDiscard:v(le),onSave:v(ue),onCancel:v(de)},null,8,[`show`,`is-saving`,`onDiscard`,`onSave`,`onCancel`]),S(`div`,vi,[S(`div`,yi,[n[6]||=S(`div`,null,[S(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2`},` Region Configuration `),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},` Manage regional key hierarchy `)],-1),S(`div`,bi,[s.value?(h(),C(`button`,{key:0,onClick:J,class:`cfg-btn-secondary flex items-center gap-1.5`,disabled:c.value},[...n[5]||=[S(`svg`,{class:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 4v16m8-8H4`})],-1),b(` Add Region `,-1)]],8,xi)):g(``,!0),s.value?(h(),C(x,{key:2},[S(`button`,{onClick:W,disabled:c.value,class:`cfg-btn-secondary`},`Cancel`,8,Si),S(`button`,{onClick:G,disabled:c.value,class:`cfg-btn-primary`},t(c.value?`Saving…`:`Save Changes`),9,Ci)],64)):(h(),C(`button`,{key:1,onClick:U,class:`cfg-btn-primary`},`Edit Settings`))])]),d.value?(h(),C(`div`,wi,[S(`p`,Ti,t(d.value),1)])):g(``,!0),S(`div`,Ei,[S(`div`,Di,[n[7]||=S(`div`,null,[S(`h4`,{class:`text-xs sm:text-sm font-medium text-content-primary dark:text-content-primary mb-1`},` Unscoped Flood Policy (*) `),S(`p`,{class:`text-content-secondary dark:text-content-muted text-[10px] sm:text-xs`},` Allow or Deny unscoped flood packets `)],-1),S(`div`,{class:T([`flex bg-background-mute dark:bg-stroke/5 rounded-lg border border-stroke-subtle dark:border-stroke/20 p-0.5 sm:p-1`,s.value?``:`opacity-50 pointer-events-none`])},[S(`button`,{onClick:n[0]||=e=>ie(`deny`),class:T([`px-2 sm:px-3 py-1 text-[10px] sm:text-xs font-medium rounded transition-colors`,w.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),S(`button`,{onClick:n[1]||=e=>ie(`allow`),class:T([`px-2 sm:px-3 py-1 text-[10px] sm:text-xs font-medium rounded transition-colors`,w.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)],2)])]),S(`div`,{class:`cfg-section space-y-4`,onClick:n[2]||=e=>s.value&&v(i).setSelectedNode(null)},[n[11]||=S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary`},`Regions`,-1),s.value?(h(),C(`p`,Oi,` To add a child region, click on a region to select it, then click "Add Region". `)):g(``,!0),k.value?(h(),C(`div`,ki,[_(V),n[8]||=S(`span`,{class:`ml-2 text-content-secondary dark:text-content-muted`},`Loading regions…`,-1)])):A.value?(h(),C(`div`,Ai,[n[9]||=S(`div`,{class:`text-accent-red mb-2`},`⚠️ Error loading regions`,-1),S(`div`,ji,t(A.value),1),S(`button`,{onClick:H,class:`btn-success mt-4`},` Retry `)])):D.value.length===0?(h(),C(`div`,Mi,[...n[10]||=[S(`div`,{class:`text-content-muted dark:text-content-muted mb-2`},`No regions found`,-1),S(`div`,{class:`text-content-muted dark:text-content-muted/60 text-sm`},` Click "Edit Settings" then "Add Region" to get started `,-1)]])):(h(),C(`div`,Ni,[(h(!0),C(x,null,m(D.value,e=>(h(),u(Pn,{key:e.id,node:e,"selected-node-id":v(i).selectedNodeId.value,level:0,unlocked:s.value,onSelect:K,onEdit:re,onDelete:Z},null,8,[`node`,`selected-node-id`,`unlocked`]))),128))]))]),_(Qn,{show:j.value,"selected-node-name":q(),"selected-node-id":v(i).selectedNodeId.value||void 0,onClose:n[3]||=e=>j.value=!1,onAdd:ne},null,8,[`show`,`selected-node-name`,`selected-node-id`]),_(Kr,{show:M.value,node:P.value,onClose:X,onSave:Y},null,8,[`show`,`node`]),_(_i,{show:N.value,node:F.value,"all-nodes":D.value,onClose:n[4]||=e=>{N.value=!1,F.value=null},onDeleteAll:Q,onMoveChildren:$},null,8,[`show`,`node`,`all-nodes`])])],64))}}),Fi={class:`space-y-12`},Ii={class:`cfg-page-heading flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3`},Li={key:0,class:`bg-red-500/10 border border-red-500/30 rounded-lg p-4`},Ri={class:`flex items-center gap-2 text-red-600 dark:text-red-400`},zi={key:1,class:`flex items-center justify-center py-12`},Bi={class:`text-center`},Vi={key:2,class:`space-y-3`},Hi={class:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3`},Ui={class:`flex-1`},Wi={class:`flex items-center gap-2 sm:gap-3`},Gi={class:`min-w-0 flex-1`},Ki={class:`text-content-primary dark:text-content-primary font-medium text-sm sm:text-base break-all`},qi={class:`flex flex-col sm:flex-row sm:items-center sm:gap-4 mt-1 text-xs text-content-secondary dark:text-content-muted`},Ji={class:`truncate`},Yi={class:`truncate`},Xi=[`onClick`,`disabled`],Zi={key:3,class:`text-center py-12`},Qi={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`},$i={class:`space-y-4`},ea={class:`flex justify-end gap-3 mt-6`},ta=[`disabled`],na=[`disabled`],ra={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`},ia={class:`space-y-4`},aa={class:`flex gap-2`},oa=[`value`],sa={class:`bg-blue-500/10 border border-blue-500/30 rounded-lg p-4`},ca={class:`block bg-blue-500/20 px-3 py-2 rounded text-xs text-blue-100 font-mono overflow-x-auto`},la=f({name:`APITokens`,__name:`APITokens`,setup(e){let n=l([]),i=l(!1),a=l(null),o=l(!1),s=l(``),u=l(null),f=l(!1),p=l(!1),v=l(null),w=async()=>{i.value=!0,a.value=null;try{let e=await I.get(`/auth/tokens`);n.value=(e.data||e).tokens||[]}catch(e){console.error(`Failed to fetch API tokens:`,e),a.value=e instanceof Error?e.message:`Failed to fetch tokens`}finally{i.value=!1}},T=async()=>{if(!s.value.trim()){a.value=`Token name is required`;return}i.value=!0,a.value=null;try{let e=await I.post(`/auth/tokens`,{name:s.value.trim()});u.value=(e.data||e).token||null,o.value=!1,f.value=!0,s.value=``,await w()}catch(e){console.error(`Failed to create API token:`,e),a.value=e instanceof Error?e.message:`Failed to create token`}finally{i.value=!1}},E=(e,t)=>{v.value={id:e,name:t},p.value=!0},D=async()=>{if(v.value){i.value=!0,a.value=null;try{await I.delete(`/auth/tokens/${v.value.id}`),await w(),p.value=!1,v.value=null}catch(e){console.error(`Failed to revoke API token:`,e),a.value=e instanceof Error?e.message:`Failed to revoke token`}finally{i.value=!1}}},k=()=>{o.value=!1,s.value=``,a.value=null},j=()=>{f.value=!1,u.value=null},N=()=>{u.value&&navigator.clipboard.writeText(u.value)},P=e=>e?new Date(e*1e3).toLocaleString():`Never`,F=y(()=>`${window.location.origin}/api/stats`);return r(()=>{w()}),(e,r)=>(h(),C(x,null,[S(`div`,Fi,[S(`div`,Ii,[r[5]||=S(`div`,null,[S(`h2`,{class:`text-lg sm:text-xl font-semibold text-content-primary dark:text-content-primary`},` API Tokens `),S(`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),S(`button`,{onClick:r[0]||=e=>o.value=!0,class:`cfg-btn-primary flex items-center justify-center gap-2`},[...r[4]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 4v16m8-8H4`})],-1),b(` Create Token `,-1)]])]),r[20]||=d(`

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),a.value?(h(),C(`div`,Li,[S(`div`,Ri,[r[6]||=S(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),b(` `+t(a.value),1)])])):g(``,!0),i.value&&n.value.length===0?(h(),C(`div`,zi,[S(`div`,Bi,[_(V,{class:`mx-auto mb-4`}),r[7]||=S(`div`,{class:`text-content-secondary dark:text-content-muted`},`Loading tokens...`,-1)])])):n.value.length>0?(h(),C(`div`,Vi,[(h(!0),C(x,null,m(n.value,e=>(h(),C(`div`,{key:e.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`},[S(`div`,Hi,[S(`div`,Ui,[S(`div`,Wi,[r[8]||=S(`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`},[S(`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),S(`div`,Gi,[S(`h3`,Ki,t(e.name),1),S(`div`,qi,[S(`span`,Ji,`Created: `+t(P(e.created_at)),1),S(`span`,Yi,`Last used: `+t(P(e.last_used)),1)])])])]),S(`button`,{onClick:t=>E(e.id,e.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,Xi)])]))),128))])):(h(),C(`div`,Zi,[r[9]||=S(`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`},[S(`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),r[10]||=S(`h3`,{class:`text-content-primary dark:text-content-primary font-medium mb-2`},`No API Tokens`,-1),r[11]||=S(`p`,{class:`text-content-secondary dark:text-content-muted text-sm mb-4`},` Create a token to enable API access `,-1),S(`button`,{onClick:r[1]||=e=>o.value=!0,class:`cfg-btn-primary`},` Create Your First Token `)])),o.value?(h(),C(`div`,{key:4,class:`fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm`,onClick:M(k,[`self`])},[S(`div`,Qi,[r[14]||=S(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary mb-4`},` Create API Token `,-1),S(`div`,$i,[S(`div`,null,[r[12]||=S(`label`,{class:`block text-sm font-medium text-content-secondary dark:text-content-muted mb-2`},`Token Name`,-1),c(S(`input`,{"onUpdate:modelValue":r[2]||=e=>s.value=e,type:`text`,placeholder:`e.g., Production Server, CI/CD Pipeline`,class:`cfg-input placeholder-gray-400 dark:placeholder-white/40`,onKeydown:O(T,[`enter`])},null,544),[[A,s.value]]),r[13]||=S(`p`,{class:`text-xs text-content-muted dark:text-content-muted mt-1`},` Give your token a descriptive name to identify its purpose `,-1)]),S(`div`,ea,[S(`button`,{onClick:k,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,ta),S(`button`,{onClick:T,disabled:i.value||!s.value.trim(),class:`btn-primary`},t(i.value?`Creating...`:`Create Token`),9,na)])])])])):g(``,!0),f.value&&u.value?(h(),C(`div`,{key:5,class:`fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm`,onClick:M(j,[`self`])},[S(`div`,ra,[r[19]||=S(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary mb-4`},` Token Created Successfully `,-1),S(`div`,ia,[r[18]||=d(`
Save this token now! For security reasons, it will not be shown again.
`,1),S(`div`,null,[r[16]||=S(`label`,{class:`block text-sm font-medium text-content-secondary dark:text-content-muted mb-2`},`Your API Token`,-1),S(`div`,aa,[S(`input`,{value:u.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,oa),S(`button`,{onClick:N,class:`btn-primary flex items-center gap-2`,title:`Copy to clipboard`},[...r[15]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),b(` Copy `,-1)]])])]),S(`div`,sa,[r[17]||=S(`p`,{class:`text-sm text-blue-200 mb-2`},[S(`strong`,null,`Usage Example:`)],-1),S(`code`,ca,` curl -H "X-API-Key: `+t(u.value)+`" `+t(F.value),1)]),S(`div`,{class:`flex justify-end mt-6`},[S(`button`,{onClick:j,class:`btn-primary`},` Done `)])])])])):g(``,!0)]),_(H,{show:p.value,title:`Revoke API Token`,message:`Are you sure you want to revoke the token '${v.value?.name}'? This action cannot be undone.`,"confirm-text":`Revoke`,"cancel-text":`Cancel`,variant:`danger`,onConfirm:D,onClose:r[3]||=e=>p.value=!1},null,8,[`show`,`message`])],64))}}),ua={class:`space-y-12`},da={class:`cfg-section`},fa={class:`space-y-4`},pa={class:`flex items-center justify-between`},ma=[`disabled`],ha={class:`cfg-section`},ga={class:`space-y-4`},_a={class:`space-y-3`},va=[`checked`,`disabled`],ya=[`checked`,`disabled`],ba={class:`flex items-start gap-3`},xa={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`},Sa={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`},Ca={class:`flex-1`},wa={class:`text-sm font-medium text-content-primary dark:text-content-primary`},Ta={key:0,class:`text-xs text-green-600 dark:text-green-400 mt-1`},Ea={key:1,class:`p-4 bg-amber-500/10 border border-amber-500/30 rounded-lg`},Da={class:`flex items-start justify-between gap-3`},Oa=[`disabled`],ka={key:0,class:`animate-spin h-4 w-4`,fill:`none`,viewBox:`0 0 24 24`},Aa={key:1,class:`w-4 h-4`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`},ja={class:`flex items-center space-x-2`},Ma={key:0,class:`w-5 h-5 text-green-600 dark:text-green-400`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`},Na={key:1,class:`w-5 h-5 text-red-600 dark:text-red-400`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`},Pa=f({name:`WebSettings`,__name:`WebSettings`,setup(e){let{stats:n}=R(ee()),a=l(!1),o=l(``),s=l(!1),c=l(!1),u=l(!1),f=l(!1),p=l(!0),m=i({cors_enabled:!1,use_default_frontend:!0}),_=y(()=>s.value?`bg-green-500/10 border-green-600/40 dark:border-green-500/30`:`bg-red-500/10 border-red-500/30`);async function v(){try{p.value=!0;let e=await I.get(`/check_pymc_console`);e.success&&e.data&&(f.value=e.data.exists)}catch(e){console.error(`Failed to check PyMC Console:`,e),f.value=!1}finally{p.value=!1}}function w(){let e=n.value?.config?.web||{};m.cors_enabled=e.cors_enabled===!0;let t=e.web_path;m.use_default_frontend=!t||t===``}async function E(){a.value=!0,o.value=``;try{let e={web:{cors_enabled:m.cors_enabled}};m.use_default_frontend?e.web.web_path=null:e.web.web_path=`/opt/pymc_console/web/html`;let t=await I.post(`/update_web_config`,e);t.success?(A(`Settings saved successfully`,!0),c.value=!0):A(t.error||`Failed to save settings`,!1)}catch(e){console.error(`Failed to save web settings:`,e),A(e.message||`Failed to save settings`,!1)}finally{a.value=!1}}async function D(){m.cors_enabled=!m.cors_enabled,await E()}async function O(){m.use_default_frontend=!0,await E()}async function k(){if(!f.value){A(`PyMC Console is not installed. Please install it before switching.`,!1);return}m.use_default_frontend=!1,await E()}function A(e,t){o.value=e,s.value=t,setTimeout(()=>{o.value=``},5e3)}async function j(){u.value=!0,o.value=``;try{let e=await I.post(`/restart_service`,{});e.success?(A(`Service restart initiated. Page will reload...`,!0),c.value=!1,setTimeout(()=>{window.location.reload()},2e3)):A(e.error||`Failed to restart service`,!1)}catch(e){e.code===`ERR_NETWORK`||e.message?.includes(`Network error`)?(A(`Service restarting... Page will reload`,!0),c.value=!1,setTimeout(()=>{window.location.reload()},3e3)):(console.error(`Failed to restart service:`,e),A(e.message||`Failed to restart service`,!1))}finally{u.value=!1}}return r(()=>{w(),v()}),(e,n)=>(h(),C(`div`,ua,[n[14]||=S(`div`,{class:`cfg-page-heading flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3`},[S(`div`,null,[S(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2`},`Web Options`),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Configure CORS policy and web frontend selection`)])],-1),S(`div`,da,[n[1]||=S(`div`,{class:`flex items-start justify-between mb-4`},[S(`div`,null,[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},` CORS Settings `),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},` Control cross-origin resource sharing for API access `)])],-1),S(`div`,fa,[S(`div`,pa,[n[0]||=S(`div`,null,[S(`label`,{class:`text-sm font-medium text-content-primary dark:text-content-primary`},`Enable CORS`),S(`p`,{class:`text-xs text-content-secondary dark:text-content-muted mt-1`},` Allow web frontends from different origins to access the API `)],-1),S(`button`,{onClick:D,disabled:a.value,class:T([`relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2`,m.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`,a.value?`opacity-50 cursor-not-allowed`:`cursor-pointer`])},[S(`span`,{class:T([`inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg`,m.cors_enabled?`translate-x-5`:`translate-x-0.5`])},null,2)],10,ma)])])]),S(`div`,ha,[n[11]||=S(`div`,{class:`flex items-start justify-between mb-4`},[S(`div`,null,[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},` Web Frontend `),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},` Choose which web interface to use `)])],-1),S(`div`,ga,[S(`div`,_a,[S(`label`,{class:T([`flex items-start space-x-3 p-4 bg-background-mute dark:bg-background/30 rounded-lg border-2 cursor-pointer transition-all`,m.use_default_frontend?`border-accent-cyan bg-accent-cyan/10`:`border-stroke-subtle dark:border-stroke/10 hover:border-accent-cyan/50`])},[S(`input`,{type:`radio`,name:`frontend`,checked:m.use_default_frontend,onChange:O,disabled:a.value,class:`mt-1 h-4 w-4 text-accent-cyan focus:ring-accent-cyan focus:ring-offset-background`},null,40,va),n[2]||=S(`div`,{class:`flex-1`},[S(`div`,{class:`text-sm font-medium text-content-primary dark:text-content-primary`},` Default Frontend `),S(`div`,{class:`text-xs text-content-secondary dark:text-content-muted mt-1`},` Built-in pyMC Repeater web interface `),S(`div`,{class:`text-xs text-content-muted dark:text-content-muted/60 mt-1 font-mono`},` Built-in `)],-1)],2),S(`label`,{class:T([`flex items-start space-x-3 p-4 bg-background-mute dark:bg-background/30 rounded-lg border-2 transition-all`,f.value?`cursor-pointer`:`opacity-50 cursor-not-allowed`,m.use_default_frontend?`border-stroke-subtle dark:border-stroke/10 hover:border-accent-cyan/50`:`border-accent-cyan bg-accent-cyan/10`])},[S(`input`,{type:`radio`,name:`frontend`,checked:!m.use_default_frontend,onChange:k,disabled:a.value||!f.value,class:`mt-1 h-4 w-4 text-accent-cyan focus:ring-accent-cyan focus:ring-offset-background`},null,40,ya),n[3]||=d(`
PyMC Console
@Treehouse⚡
Alternative web interface for pyMC Repeater
/opt/pymc_console/web/html
`,1)],2)]),p.value?g(``,!0):(h(),C(`div`,{key:0,class:T([`p-4 rounded-lg border`,f.value?`bg-green-500/5 border-green-500/20`:`bg-accent-cyan/5 border-accent-cyan/20`])},[S(`div`,ba,[f.value?(h(),C(`svg`,xa,[...n[4]||=[S(`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)]])):(h(),C(`svg`,Sa,[...n[5]||=[S(`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)]])),S(`div`,Ca,[S(`h4`,wa,t(f.value?`PyMC Console has been detected`:`PyMC Console Not Installed`),1),f.value?(h(),C(`p`,Ta,[...n[6]||=[b(` PyMC Console is installed at `,-1),S(`code`,{class:`text-green-700 dark:text-green-300`},`/opt/pymc_console/web/html`,-1)]])):(h(),C(x,{key:1},[n[7]||=d(`

PyMC Console must be installed at /opt/pymc_console/web/html before selecting this option.

PyMC Console Install Instructions `,2)],64))])])],2)),c.value?(h(),C(`div`,Ea,[S(`div`,Da,[n[10]||=d(`

Service restart required

Web frontend changes will take effect after restarting the pymc-repeater service.

`,1),S(`button`,{onClick:j,disabled:u.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`},[u.value?(h(),C(`svg`,ka,[...n[8]||=[S(`circle`,{class:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,"stroke-width":`4`},null,-1),S(`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)]])):(h(),C(`svg`,Aa,[...n[9]||=[S(`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)]])),b(` `+t(u.value?`Restarting...`:`Restart Now`),1)],8,Oa)])])):g(``,!0)])]),o.value?(h(),C(`div`,{key:0,class:T([`p-4 rounded-lg border`,_.value])},[S(`div`,ja,[s.value?(h(),C(`svg`,Ma,[...n[12]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M5 13l4 4L19 7`},null,-1)]])):(h(),C(`svg`,Na,[...n[13]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`},null,-1)]])),S(`span`,{class:T(s.value?`text-green-600 dark:text-green-400`:`text-red-600 dark:text-red-400`)},t(o.value),3)])],2)):g(``,!0)]))}}),Fa={ref:`rootEl`,class:`space-y-12`},Ia={class:`cfg-page-heading flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3`},La={class:`flex items-center gap-2 flex-shrink-0`},Ra=[`disabled`],za=[`disabled`],Ba={key:0,class:`bg-accent-green/20 border border-accent-green/50 rounded-lg p-3 text-accent-green text-sm`},Va={key:1,class:`bg-accent-red/20 border border-accent-red/50 rounded-lg p-3 text-accent-red text-sm`},Ha={class:`cfg-section space-y-3`},Ua={key:0,class:`flex items-center justify-center py-4`},Wa={key:1,class:`text-center py-4`},Ga={class:`grid grid-cols-2 sm:grid-cols-4 gap-3`},Ka={class:`text-center p-2 bg-white dark:bg-white/5 rounded-lg border border-stroke-subtle dark:border-white/10`},qa={class:`text-center p-2 bg-white dark:bg-white/5 rounded-lg border border-stroke-subtle dark:border-white/10`},Ja={class:`text-lg font-mono text-content-primary dark:text-content-primary`},Ya={class:`text-center p-2 bg-white dark:bg-white/5 rounded-lg border border-stroke-subtle dark:border-white/10`},Xa={class:`text-lg font-mono text-accent-green`},Za={class:`text-center p-2 bg-white dark:bg-white/5 rounded-lg border border-stroke-subtle dark:border-white/10`},Qa={class:`text-lg font-mono text-accent-red`},$a={key:0,class:`mt-2 p-2 bg-accent-red/10 rounded-lg border border-accent-red/20`},eo={key:1,class:`mt-2 p-2 bg-secondary/10 rounded-lg border border-secondary/20`},to={class:`font-medium`},no={class:`font-mono text-[10px] opacity-70`},ro={class:`text-[10px]`},io={class:`cfg-section space-y-3`},ao={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`},oo={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},so={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`},co={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},lo={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`},uo={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},fo={key:1,class:`flex items-center gap-2`},po={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1`},mo={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},ho={key:1,class:`flex items-center gap-2`},go={class:`cfg-section space-y-3`},_o={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`},vo={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},yo={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`},bo={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},xo={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`},So={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},Co={key:1,class:`flex items-center gap-2`},wo={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`},To={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},Eo={key:1,class:`flex items-center gap-2`},Do={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1`},Oo={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},ko={key:1,class:`flex items-center gap-2`},Ao={class:`cfg-section space-y-3`},jo={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`},Mo={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},No={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`},Po={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},Fo={key:1,class:`flex items-center gap-2`},Io={class:`py-2`},Lo={class:`grid grid-cols-3 gap-2 mt-2`},Ro={class:`text-center p-2 bg-white dark:bg-white/5 rounded-lg border border-stroke-subtle dark:border-white/10`},zo={key:0,class:`font-mono text-sm text-content-primary dark:text-content-primary`},Bo={class:`text-center p-2 bg-white dark:bg-white/5 rounded-lg border border-stroke-subtle dark:border-white/10`},Vo={key:0,class:`font-mono text-sm text-content-primary dark:text-content-primary`},Ho={class:`text-center p-2 bg-white dark:bg-white/5 rounded-lg border border-stroke-subtle dark:border-white/10`},Uo={key:0,class:`font-mono text-sm text-content-primary dark:text-content-primary`},Wo={class:`p-6 space-y-4`},Go={class:`flex justify-between items-start`},Ko={class:`flex justify-end pt-4 border-t border-stroke-subtle dark:border-stroke/20`},qo=f({__name:`AdvertSettings`,setup(e,{expose:n}){let i=ee(),a=y(()=>i.stats?.config?.repeater||{}),u=y(()=>a.value.advert_rate_limit||{}),f=y(()=>a.value.advert_penalty_box||{}),p=y(()=>a.value.advert_adaptive||{}),w=y(()=>p.value.thresholds||{}),E=l(!1),D=l(!1),O=l(``),j=l(``),N=l(!1),P=l(!1),I=l(null),L=l(!0),R=l(2),z=l(1),B=l(10),te=l(60),H=l(!0),U=l(2),W=l(12),G=l(6),K=l(2),q=l(24),J=l(!0),ne=l(.1),re=l(5),Y=l(.05),X=l(.2),Z=l(.5),Q=async()=>{P.value=!0;try{let e=await F.get(`/api/advert_rate_limit_stats`);e.data?.success&&(I.value=e.data.data)}catch(e){console.error(`Failed to fetch rate limit stats:`,e)}finally{P.value=!1}};o([u,f,p],()=>{E.value||(L.value=u.value.enabled??!1,R.value=u.value.bucket_capacity??2,z.value=u.value.refill_tokens??1,B.value=Math.round((u.value.refill_interval_seconds??36e3)/3600),te.value=Math.round((u.value.min_interval_seconds??0)/60),H.value=f.value.enabled??!1,U.value=f.value.violation_threshold??2,W.value=Math.round((f.value.violation_decay_seconds??43200)/3600),G.value=Math.round((f.value.base_penalty_seconds??21600)/3600),K.value=f.value.penalty_multiplier??2,q.value=Math.round((f.value.max_penalty_seconds??86400)/3600),J.value=p.value.enabled??!1,ne.value=p.value.ewma_alpha??.1,re.value=Math.round((p.value.hysteresis_seconds??300)/60),Y.value=w.value.quiet_max??.05,X.value=w.value.normal_max??.2,Z.value=w.value.busy_max??.5)},{immediate:!0}),r(()=>{Q()});let $=()=>{L.value=u.value.enabled??!1,R.value=u.value.bucket_capacity??2,z.value=u.value.refill_tokens??1,B.value=Math.round((u.value.refill_interval_seconds??36e3)/3600),te.value=Math.round((u.value.min_interval_seconds??0)/60),H.value=f.value.enabled??!1,U.value=f.value.violation_threshold??2,W.value=Math.round((f.value.violation_decay_seconds??43200)/3600),G.value=Math.round((f.value.base_penalty_seconds??21600)/3600),K.value=f.value.penalty_multiplier??2,q.value=Math.round((f.value.max_penalty_seconds??86400)/3600),J.value=p.value.enabled??!1,ne.value=p.value.ewma_alpha??.1,re.value=Math.round((p.value.hysteresis_seconds??300)/60),Y.value=w.value.quiet_max??.05,X.value=w.value.normal_max??.2,Z.value=w.value.busy_max??.5},ie=()=>{E.value=!0,O.value=``,j.value=``},ae=()=>{E.value=!1,O.value=``,j.value=``,$()},ce=async()=>{D.value=!0,j.value=``,O.value=``;try{let e={rate_limit_enabled:L.value,bucket_capacity:R.value,refill_tokens:z.value,refill_interval_seconds:B.value*3600,min_interval_seconds:te.value*60,penalty_enabled:H.value,violation_threshold:U.value,violation_decay_seconds:W.value*3600,base_penalty_seconds:G.value*3600,penalty_multiplier:K.value,max_penalty_seconds:q.value*3600,adaptive_enabled:J.value,ewma_alpha:ne.value,hysteresis_seconds:re.value*60,quiet_max:Y.value,normal_max:X.value,busy_max:Z.value},t=(await F.post(`/api/update_advert_rate_limit_config`,e)).data;t.success?(O.value=t.data?.message||`Settings saved successfully`,await i.fetchStats(),await Q(),await s(),$(),E.value=!1,setTimeout(()=>{O.value=``},3e3)):(j.value=t.error||`Failed to save settings`,console.error(`[AdvertSettings] Save failed:`,t.error))}catch(e){console.error(`Failed to save advert settings:`,e),j.value=e.response?.data?.error||`Failed to save settings`}finally{D.value=!1}},{showUnsavedModal:le,requestLeave:ue,handleDiscard:de,handleSave:fe,handleCancel:pe}=se(E,D,ae,async()=>(await ce(),!E.value));n({requestLeave:ue,isEditing:E});let me=y(()=>I.value?.adaptive?.current_tier||`unknown`),he=y(()=>{switch(me.value){case`quiet`:return`bg-accent-green/20 text-accent-green border-accent-green/50`;case`normal`:return`bg-accent-cyan/20 text-accent-cyan border-accent-cyan/50`;case`busy`:return`bg-secondary/20 text-secondary border-secondary/50`;case`congested`:return`bg-accent-red/20 text-accent-red border-accent-red/50`;default:return`bg-background-mute text-content-muted border-stroke-subtle`}});return(e,n)=>(h(),C(x,null,[_(oe,{show:v(le),"is-saving":D.value,label:`Advert Limit settings`,onDiscard:v(de),onSave:v(fe),onCancel:v(pe)},null,8,[`show`,`is-saving`,`onDiscard`,`onSave`,`onCancel`]),S(`div`,Fa,[S(`div`,Ia,[n[20]||=S(`div`,null,[S(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2`},`Advert Limits`),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Configure advertisement rate limiting and adaptive controls`)],-1),S(`div`,La,[S(`button`,{onClick:n[0]||=e=>N.value=!0,class:`self-stretch flex items-center justify-center px-3 text-xs bg-primary/10 hover:bg-primary/20 text-primary rounded-lg border border-primary/30 transition-colors`,title:`How rate limiting works`},[...n[19]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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.value?(h(),C(x,{key:1},[S(`button`,{onClick:ae,disabled:D.value,class:`cfg-btn-secondary`},` Cancel `,8,Ra),S(`button`,{onClick:ce,disabled:D.value,class:`cfg-btn-primary`},t(D.value?`Saving...`:`Save Changes`),9,za)],64)):(h(),C(`button`,{key:0,onClick:ie,class:`cfg-btn-primary`},` Edit Settings `))])]),O.value?(h(),C(`div`,Ba,t(O.value),1)):g(``,!0),j.value?(h(),C(`div`,Va,t(j.value),1)):g(``,!0),S(`div`,Ha,[n[29]||=S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary`},` Current Status `,-1),P.value&&!I.value?(h(),C(`div`,Ua,[_(V,{size:`sm`}),n[21]||=S(`span`,{class:`ml-2 text-sm text-content-muted`},`Loading stats...`,-1)])):I.value?(h(),C(x,{key:2},[S(`div`,Ga,[S(`div`,Ka,[n[23]||=S(`div`,{class:`text-xs text-content-muted dark:text-content-muted`},`Mesh Tier`,-1),S(`div`,{class:T([`mt-1 px-2 py-0.5 rounded border text-xs font-medium inline-block`,he.value])},t(me.value.toUpperCase()),3)]),S(`div`,qa,[n[24]||=S(`div`,{class:`text-xs text-content-muted dark:text-content-muted`},`Adverts/min`,-1),S(`div`,Ja,t(I.value.metrics?.adverts_per_min_ewma?.toFixed(2)||`0.00`),1)]),S(`div`,Ya,[n[25]||=S(`div`,{class:`text-xs text-content-muted dark:text-content-muted`},`Allowed`,-1),S(`div`,Xa,t(I.value.stats?.adverts_allowed||0),1)]),S(`div`,Za,[n[26]||=S(`div`,{class:`text-xs text-content-muted dark:text-content-muted`},`Dropped`,-1),S(`div`,Qa,t(I.value.stats?.adverts_dropped||0),1)])]),Object.keys(I.value.active_penalties||{}).length>0?(h(),C(`div`,$a,[n[27]||=S(`div`,{class:`text-xs font-medium text-accent-red mb-1`},` Active Penalties `,-1),(h(!0),C(x,null,m(I.value.active_penalties,(e,n)=>(h(),C(`div`,{key:n,class:`text-xs font-mono text-accent-red`},t(n)+`... - `+t(Math.round(e))+`s remaining `,1))),128))])):g(``,!0),I.value.recent_drops&&I.value.recent_drops.length>0?(h(),C(`div`,eo,[n[28]||=S(`div`,{class:`text-xs font-medium text-secondary mb-1`},` Recently Dropped Adverts `,-1),(h(!0),C(x,null,m(I.value.recent_drops,(e,n)=>(h(),C(`div`,{key:n,class:`text-xs text-secondary py-0.5`},[S(`span`,to,t(e.name),1),S(`span`,no,`(`+t(e.pubkey)+`...)`,1),S(`span`,ro,` - `+t(e.reason)+` (`+t(e.seconds_ago)+`s ago)`,1)]))),128))])):g(``,!0)],64)):(h(),C(`div`,Wa,[...n[22]||=[S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},` Stats not available. Click "Refresh Stats" to load. `,-1)]])),n[30]||=d(`

There are three layers of advert rate limit control: 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.

`,1)]),S(`div`,io,[n[38]||=S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary flex items-center gap-2`},[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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`})]),b(` Token Bucket Rate Limiting `)],-1),n[39]||=S(`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),S(`div`,ao,[n[32]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Rate Limiting`,-1),E.value?c((h(),C(`select`,{key:1,"onUpdate:modelValue":n[1]||=e=>L.value=e,class:`cfg-select w-full sm:w-32`},[...n[31]||=[S(`option`,{value:!0},`Enabled`,-1),S(`option`,{value:!1},`Disabled`,-1)]],512)),[[k,L.value]]):(h(),C(`div`,oo,t(L.value?`Enabled`:`Disabled`),1))]),S(`div`,so,[n[33]||=S(`div`,null,[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Bucket Capacity`),S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},`Max burst size (adverts)`)],-1),E.value?c((h(),C(`input`,{key:1,"onUpdate:modelValue":n[2]||=e=>R.value=e,type:`number`,min:`1`,max:`10`,class:`cfg-input w-full sm:w-24`},null,512)),[[A,R.value,void 0,{number:!0}]]):(h(),C(`div`,co,t(R.value),1))]),S(`div`,lo,[n[35]||=S(`div`,null,[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Refill Interval`),S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},` Time between token refills `)],-1),E.value?(h(),C(`div`,fo,[c(S(`input`,{"onUpdate:modelValue":n[3]||=e=>B.value=e,type:`number`,min:`1`,max:`48`,class:`cfg-input w-20`},null,512),[[A,B.value,void 0,{number:!0}]]),n[34]||=S(`span`,{class:`text-content-muted text-sm`},`hours`,-1)])):(h(),C(`div`,uo,t(B.value)+` hours `,1))]),S(`div`,po,[n[37]||=S(`div`,null,[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Minimum Interval`),S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},` Hard minimum between adverts `)],-1),E.value?(h(),C(`div`,ho,[c(S(`input`,{"onUpdate:modelValue":n[4]||=e=>te.value=e,type:`number`,min:`0`,max:`1440`,class:`cfg-input w-20`},null,512),[[A,te.value,void 0,{number:!0}]]),n[36]||=S(`span`,{class:`text-content-muted text-sm`},`min`,-1)])):(h(),C(`div`,mo,t(te.value)+` min `,1))])]),S(`div`,go,[n[49]||=S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary flex items-center gap-2`},[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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`})]),b(` Penalty Box (Repeat Offenders) `)],-1),n[50]||=S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},` Applies escalating cooldowns to pubkeys that repeatedly violate limits. `,-1),S(`div`,_o,[n[41]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Penalty Box`,-1),E.value?c((h(),C(`select`,{key:1,"onUpdate:modelValue":n[5]||=e=>H.value=e,class:`cfg-select w-full sm:w-32`},[...n[40]||=[S(`option`,{value:!0},`Enabled`,-1),S(`option`,{value:!1},`Disabled`,-1)]],512)),[[k,H.value]]):(h(),C(`div`,vo,t(H.value?`Enabled`:`Disabled`),1))]),S(`div`,yo,[n[42]||=S(`div`,null,[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Violation Threshold`),S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},` Violations before penalty `)],-1),E.value?c((h(),C(`input`,{key:1,"onUpdate:modelValue":n[6]||=e=>U.value=e,type:`number`,min:`1`,max:`10`,class:`cfg-input w-full sm:w-24`},null,512)),[[A,U.value,void 0,{number:!0}]]):(h(),C(`div`,bo,t(U.value),1))]),S(`div`,xo,[n[44]||=S(`div`,null,[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Base Penalty Duration`),S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},`First penalty duration`)],-1),E.value?(h(),C(`div`,Co,[c(S(`input`,{"onUpdate:modelValue":n[7]||=e=>G.value=e,type:`number`,min:`1`,max:`48`,class:`cfg-input w-20`},null,512),[[A,G.value,void 0,{number:!0}]]),n[43]||=S(`span`,{class:`text-content-muted text-sm`},`hours`,-1)])):(h(),C(`div`,So,t(G.value)+` hours `,1))]),S(`div`,wo,[n[46]||=S(`div`,null,[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Penalty Multiplier`),S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},`Escalation factor`)],-1),E.value?(h(),C(`div`,Eo,[c(S(`input`,{"onUpdate:modelValue":n[8]||=e=>K.value=e,type:`number`,min:`1`,max:`5`,step:`0.5`,class:`cfg-input w-20`},null,512),[[A,K.value,void 0,{number:!0}]]),n[45]||=S(`span`,{class:`text-content-muted text-sm`},`x`,-1)])):(h(),C(`div`,To,t(K.value)+`x `,1))]),S(`div`,Do,[n[48]||=S(`div`,null,[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Max Penalty Duration`),S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},`Maximum cooldown cap`)],-1),E.value?(h(),C(`div`,ko,[c(S(`input`,{"onUpdate:modelValue":n[9]||=e=>q.value=e,type:`number`,min:`1`,max:`168`,class:`cfg-input w-20`},null,512),[[A,q.value,void 0,{number:!0}]]),n[47]||=S(`span`,{class:`text-content-muted text-sm`},`hours`,-1)])):(h(),C(`div`,Oo,t(q.value)+` hours `,1))])]),S(`div`,Ao,[n[60]||=S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary flex items-center gap-2`},[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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`})]),b(` Adaptive Rate Limiting `)],-1),S(`div`,jo,[n[52]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Adaptive Mode`,-1),E.value?c((h(),C(`select`,{key:1,"onUpdate:modelValue":n[10]||=e=>J.value=e,class:`cfg-select w-full sm:w-32`},[...n[51]||=[S(`option`,{value:!0},`Enabled`,-1),S(`option`,{value:!1},`Disabled`,-1)]],512)),[[k,J.value]]):(h(),C(`div`,Mo,t(J.value?`Enabled`:`Disabled`),1))]),S(`div`,No,[n[54]||=S(`div`,null,[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Tier Change Delay`),S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},`Prevents tier flapping`)],-1),E.value?(h(),C(`div`,Fo,[c(S(`input`,{"onUpdate:modelValue":n[11]||=e=>re.value=e,type:`number`,min:`0`,max:`60`,class:`cfg-input w-20`},null,512),[[A,re.value,void 0,{number:!0}]]),n[53]||=S(`span`,{class:`text-content-muted text-sm`},`min`,-1)])):(h(),C(`div`,Po,t(re.value)+` min `,1))]),S(`div`,Io,[n[58]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm mb-2 block`},`Activity Tier Thresholds (adverts/min)`,-1),S(`div`,Lo,[S(`div`,Ro,[n[55]||=S(`div`,{class:`text-xs text-accent-green mb-1`},`Quiet Max`,-1),E.value?c((h(),C(`input`,{key:1,"onUpdate:modelValue":n[12]||=e=>Y.value=e,type:`number`,min:`0`,max:`1`,step:`0.01`,class:`cfg-input w-full py-1 text-center`},null,512)),[[A,Y.value,void 0,{number:!0}]]):(h(),C(`div`,zo,t(Y.value),1))]),S(`div`,Bo,[n[56]||=S(`div`,{class:`text-xs text-accent-cyan mb-1`},`Normal Max`,-1),E.value?c((h(),C(`input`,{key:1,"onUpdate:modelValue":n[13]||=e=>X.value=e,type:`number`,min:`0`,max:`5`,step:`0.01`,class:`cfg-input w-full py-1 text-center`},null,512)),[[A,X.value,void 0,{number:!0}]]):(h(),C(`div`,Vo,t(X.value),1))]),S(`div`,Ho,[n[57]||=S(`div`,{class:`text-xs text-secondary mb-1`},`Busy Max`,-1),E.value?c((h(),C(`input`,{key:1,"onUpdate:modelValue":n[14]||=e=>Z.value=e,type:`number`,min:`0`,max:`10`,step:`0.01`,class:`cfg-input w-full py-1 text-center`},null,512)),[[A,Z.value,void 0,{number:!0}]]):(h(),C(`div`,Uo,t(Z.value),1))])]),n[59]||=S(`p`,{class:`text-xs text-content-muted dark:text-content-muted mt-2`},` Above Busy Max = Congested tier (strictest limiting) `,-1)])]),N.value?(h(),C(`div`,{key:2,class:`fixed inset-0 bg-black/50 flex items-start justify-center z-50 p-4 overflow-y-auto`,onClick:n[18]||=M(e=>N.value=!1,[`self`])},[S(`div`,{class:`bg-background dark:bg-background-dark rounded-lg shadow-xl max-w-3xl w-full my-8`,onClick:n[17]||=M(()=>{},[`stop`])},[S(`div`,Wo,[S(`div`,Go,[n[62]||=S(`h2`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary`},` How Advert Rate Limiting Works `,-1),S(`button`,{onClick:n[15]||=e=>N.value=!1,class:`text-content-muted hover:text-content-primary dark:text-content-muted dark:hover:text-content-primary`},[...n[61]||=[S(`svg`,{class:`w-6 h-6`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),n[63]||=d(`

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),S(`div`,Ko,[S(`button`,{onClick:n[16]||=e=>N.value=!1,class:`btn-primary`},` Got it! `)])])])])):g(``,!0)],512)],64))}}),Jo={class:`modal-card max-w-2xl w-full max-h-[90vh] overflow-y-auto`},Yo={class:`flex items-center justify-between mb-7`},Xo={class:`text-xl font-semibold text-content-primary dark:text-content-primary`},Zo={class:`text-content-secondary dark:text-content-muted text-sm mt-1`},Qo={class:`grid grid-cols-2 gap-5 items-end`},$o={class:`flex items-center gap-3 pb-1.5`},es={key:0,class:`grid grid-cols-2 gap-5`},ts={class:`grid grid-cols-2 gap-5 items-end`},ns={class:`flex items-center gap-3 pb-1.5`},rs={class:`grid grid-cols-2 gap-x-5 gap-y-0`},is=[`aria-hidden`],as={class:`grid grid-cols-2 gap-5 items-center pt-4`},os={class:`flex items-center gap-3`},ss={class:`flex items-center gap-6`},cs={class:`flex items-center gap-3`},ls={class:`flex items-center gap-3`},us={class:`flex flex-wrap gap-2`},ds=[`onClick`],fs={class:`modal-actions`},ps=[`disabled`],ms=f({__name:`BrokerEditModal`,props:{show:{type:Boolean},broker:{},isNew:{type:Boolean}},emits:[`done`,`cancel`],setup(n,{emit:r}){let i=[`REQ`,`RESPONSE`,`TXT_MSG`,`ACK`,`ADVERT`,`GRP_TXT`,`GRP_DATA`,`ANON_REQ`,`PATH`,`TRACE`,`RAW_CUSTOM`],a=n,s=r;function d(e){return{...e,tls:{...e.tls},disallowedInput:[...e.disallowedInput??[]]}}let f=l({_id:0,enabled:!0,name:``,host:``,port:443,format:`letsmesh`,use_jwt_auth:!1,transport:`websockets`,disallowedInput:[],retain_status:!1,tls:{enabled:!0,insecure:!1}});o(()=>a.broker,e=>{e&&(f.value=d(e))},{immediate:!0});let v=y(()=>{let e=f.value;return e.name.trim()!==``&&e.host.trim()!==``&&e.port>=1&&e.port<=65535&&(!e.use_jwt_auth||(e.audience?.trim()??``)!==``)});function w(){let e=f.value;(!e.audience||e.audience===e.host)&&(e.audience=e.host)}function E(e){f.value.disallowedInput||(f.value.disallowedInput=[]);let t=f.value.disallowedInput.indexOf(e);t===-1?f.value.disallowedInput.push(e):f.value.disallowedInput.splice(t,1)}function D(){v.value&&s(`done`,d(f.value))}function O(){s(`cancel`)}return(r,a)=>(h(),u(p,{to:`body`},[_(j,{"enter-active-class":`transition-opacity duration-200`,"enter-from-class":`opacity-0`,"leave-active-class":`transition-opacity duration-200`,"leave-to-class":`opacity-0`},{default:e(()=>[n.show&&n.broker?(h(),C(`div`,{key:0,class:`modal-backdrop`,onClick:a[14]||=M(e=>O(),[`self`])},[S(`div`,Jo,[S(`div`,Yo,[S(`div`,null,[S(`h3`,Xo,t(n.isNew?`Add Broker`:`Edit Broker`),1),S(`p`,Zo,t(n.isNew?`Configure a new MQTT broker`:`Editing ${n.broker.name||`(unnamed)`}`),1)]),S(`button`,{onClick:O,class:`text-content-secondary dark:text-white/60 hover:text-content-primary dark:hover:text-white transition-colors`},[...a[15]||=[S(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),S(`form`,{onSubmit:M(D,[`prevent`]),class:`modal-form`},[S(`div`,null,[a[16]||=S(`label`,{class:`modal-field-label`},[b(` Name `),S(`span`,{class:`text-red-500`},`*`)],-1),c(S(`input`,{"onUpdate:modelValue":a[0]||=e=>f.value.name=e,type:`text`,placeholder:`Broker Name`,class:`modal-input`},null,512),[[A,f.value.name]])]),S(`div`,Qo,[S(`div`,null,[a[18]||=S(`label`,{class:`modal-field-label`},[b(` Format `),S(`span`,{class:`text-red-500`},`*`)],-1),c(S(`select`,{"onUpdate:modelValue":a[1]||=e=>f.value.format=e,class:`modal-select`},[...a[17]||=[S(`option`,{value:`meshcoretomqtt`},`Meshcoretomqtt`,-1),S(`option`,{value:`letsmesh`},`Letsmesh`,-1),S(`option`,{value:`waev`},`Waev`,-1),S(`option`,{value:`mqtt`},`pyMC`,-1)]],512),[[k,f.value.format]])]),S(`div`,$o,[S(`button`,{type:`button`,onClick:a[2]||=e=>f.value.enabled=!f.value.enabled,class:T([`relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full transition-colors duration-200 ease-in-out focus:outline-none`,f.value.enabled?`bg-primary`:`bg-gray-200 dark:bg-white/15`])},[S(`span`,{class:T([`pointer-events-none absolute top-0.5 left-0.5 inline-block h-4 w-4 transform rounded-full bg-white shadow transition duration-200 ease-in-out`,f.value.enabled?`translate-x-4`:`translate-x-0`])},null,2)],2),a[19]||=S(`span`,{class:`text-sm font-medium text-content-primary dark:text-content-primary`},`Enabled`,-1)])]),f.value.format===`mqtt`?(h(),C(`div`,es,[S(`div`,null,[a[20]||=S(`label`,{class:`modal-field-label`},[b(` MQTT Base Topic `),S(`span`,{class:`font-normal text-content-muted dark:text-content-muted/60 ml-1`},`(e.g. meshcore/repeater)`)],-1),c(S(`input`,{"onUpdate:modelValue":a[3]||=e=>f.value.base_topic=e,placeholder:`meshcore/repeater`,class:`modal-input`},null,512),[[A,f.value.base_topic]])]),a[21]||=S(`div`,null,null,-1)])):g(``,!0),S(`div`,ts,[S(`div`,null,[a[23]||=S(`label`,{class:`modal-field-label`},[b(` Transport `),S(`span`,{class:`text-red-500`},`*`)],-1),c(S(`select`,{"onUpdate:modelValue":a[4]||=e=>f.value.transport=e,class:`modal-select`},[...a[22]||=[S(`option`,{value:`websockets`},`Websockets`,-1),S(`option`,{value:`tcp`},`TCP`,-1)]],512),[[k,f.value.transport]])]),S(`div`,ns,[S(`button`,{type:`button`,onClick:a[5]||=e=>f.value.use_jwt_auth=!f.value.use_jwt_auth,class:T([`relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full transition-colors duration-200 ease-in-out focus:outline-none`,f.value.use_jwt_auth?`bg-primary`:`bg-gray-200 dark:bg-white/15`])},[S(`span`,{class:T([`pointer-events-none absolute top-0.5 left-0.5 inline-block h-4 w-4 transform rounded-full bg-white shadow transition duration-200 ease-in-out`,f.value.use_jwt_auth?`translate-x-4`:`translate-x-0`])},null,2)],2),a[24]||=S(`span`,{class:`text-sm font-medium text-content-primary dark:text-content-primary`},`Use JWT Auth`,-1)])]),S(`div`,rs,[S(`div`,null,[a[25]||=S(`label`,{class:`modal-field-label`},[b(` Host `),S(`span`,{class:`text-red-500`},`*`)],-1),c(S(`input`,{"onUpdate:modelValue":a[6]||=e=>f.value.host=e,type:`text`,placeholder:`mqtt.myserver.com`,onBlur:w,class:`modal-input font-mono`},null,544),[[A,f.value.host]])]),S(`div`,null,[f.value.use_jwt_auth?(h(),C(x,{key:0},[a[26]||=S(`label`,{class:`modal-field-label`},[b(` Audience `),S(`span`,{class:`text-red-500`},`*`),S(`span`,{class:`font-normal text-content-muted dark:text-content-muted/60 ml-1`},`(usually same as host)`)],-1),c(S(`input`,{"onUpdate:modelValue":a[7]||=e=>f.value.audience=e,type:`text`,placeholder:`mqtt.myserver.com`,class:`modal-input font-mono`},null,512),[[A,f.value.audience]])],64)):(h(),C(x,{key:1},[a[27]||=S(`label`,{class:`modal-field-label`},[b(` Username `),S(`span`,{class:`font-normal text-content-muted dark:text-content-muted/60 ml-1`},`(blank = anonymous)`)],-1),a[28]||=S(`input`,{type:`text`,autocomplete:`username`,style:{display:`none`}},null,-1),c(S(`input`,{autocomplete:`username`,"onUpdate:modelValue":a[8]||=e=>f.value.username=e,type:`text`,placeholder:`username`,class:`modal-input`},null,512),[[A,f.value.username]])],64))]),S(`div`,null,[a[29]||=S(`label`,{class:`modal-field-label`},[b(` Port `),S(`span`,{class:`text-red-500`},`*`),S(`span`,{class:`font-normal text-content-muted dark:text-content-muted/60 ml-1`},`(443 WS, 1883 TCP)`)],-1),c(S(`input`,{"onUpdate:modelValue":a[9]||=e=>f.value.port=e,type:`number`,min:`0`,max:`65535`,class:`modal-input font-mono`},null,512),[[A,f.value.port,void 0,{number:!0}]])]),S(`div`,{class:T(f.value.use_jwt_auth?`invisible pointer-events-none`:``),"aria-hidden":f.value.use_jwt_auth?`true`:void 0},[a[30]||=S(`label`,{class:`modal-field-label`},`Password`,-1),a[31]||=S(`input`,{type:`password`,autocomplete:`current-password`,style:{display:`none`}},null,-1),c(S(`input`,{autocomplete:`new-password`,"onUpdate:modelValue":a[10]||=e=>f.value.password=e,type:`password`,readonly:``,onfocus:`this.removeAttribute('readonly');`,onblur:`this.setAttribute('readonly', true);`,class:`modal-input`},null,512),[[A,f.value.password]])],10,is)]),S(`div`,as,[S(`div`,os,[S(`button`,{type:`button`,onClick:a[11]||=e=>f.value.retain_status=!f.value.retain_status,class:T([`relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full transition-colors duration-200 ease-in-out focus:outline-none`,f.value.retain_status?`bg-primary`:`bg-gray-200 dark:bg-white/15`])},[S(`span`,{class:T([`pointer-events-none absolute top-0.5 left-0.5 inline-block h-4 w-4 transform rounded-full bg-white shadow transition duration-200 ease-in-out`,f.value.retain_status?`translate-x-4`:`translate-x-0`])},null,2)],2),a[32]||=S(`div`,null,[S(`span`,{class:`text-sm font-medium text-content-primary dark:text-content-primary`},`Retain Status`),S(`span`,{class:`text-xs text-content-muted dark:text-content-muted/60 ml-1`},`(MQTT retained)`)],-1)]),S(`div`,ss,[S(`div`,cs,[S(`button`,{type:`button`,onClick:a[12]||=e=>f.value.tls.enabled=!f.value.tls.enabled,class:T([`relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full transition-colors duration-200 ease-in-out focus:outline-none`,f.value.tls.enabled?`bg-primary`:`bg-gray-200 dark:bg-white/15`])},[S(`span`,{class:T([`pointer-events-none absolute top-0.5 left-0.5 inline-block h-4 w-4 transform rounded-full bg-white shadow transition duration-200 ease-in-out`,f.value.tls.enabled?`translate-x-4`:`translate-x-0`])},null,2)],2),a[33]||=S(`span`,{class:`text-sm font-medium text-content-primary dark:text-content-primary`},`TLS`,-1)]),S(`div`,ls,[S(`button`,{type:`button`,onClick:a[13]||=e=>f.value.tls.insecure=!f.value.tls.insecure,class:T([`relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full transition-colors duration-200 ease-in-out focus:outline-none`,f.value.tls.insecure?`bg-amber-500`:`bg-gray-200 dark:bg-white/15`])},[S(`span`,{class:T([`pointer-events-none absolute top-0.5 left-0.5 inline-block h-4 w-4 transform rounded-full bg-white shadow transition duration-200 ease-in-out`,f.value.tls.insecure?`translate-x-4`:`translate-x-0`])},null,2)],2),a[34]||=S(`span`,{class:`text-sm font-medium text-content-primary dark:text-content-primary`},`Insecure`,-1)])])]),S(`div`,null,[a[35]||=S(`label`,{class:`modal-field-label`},[b(` Block Packet Types `),S(`span`,{class:`text-content-secondary dark:text-content-muted font-normal text-xs ml-1`},`(prevent publishing to broker)`)],-1),S(`div`,us,[(h(),C(x,null,m(i,e=>S(`button`,{key:e,type:`button`,onClick:t=>E(e),class:T([`px-2.5 py-1 rounded text-xs font-mono font-medium border transition-colors`,f.value.disallowedInput?.includes(e)?`bg-red-100 dark:bg-red-900/30 border-red-300 dark:border-red-700/50 text-red-700 dark:text-red-400`:`bg-background-mute dark:bg-white/5 border-stroke-subtle dark:border-stroke/10 text-content-secondary dark:text-content-muted hover:border-primary/40`])},t(e),11,ds)),64))]),a[36]||=S(`p`,{class:`mt-2 text-xs text-content-secondary dark:text-content-muted`},[S(`span`,{class:`text-red-600 dark:text-red-400 font-medium`},`Red = blocked.`),b(` Leave all unselected to publish all packet types. `)],-1)]),S(`div`,fs,[S(`button`,{type:`button`,onClick:O,class:`modal-btn-cancel`},` Cancel `),S(`button`,{type:`submit`,disabled:!v.value,class:T([`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`])},` Done `,10,ps)])],32)])])):g(``,!0)]),_:1})]))}}),hs={class:`space-y-12`},gs={class:`cfg-page-heading flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3`},_s={class:`flex items-center gap-2 flex-shrink-0`},vs=[`disabled`],ys=[`disabled`],bs={key:0,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`},xs={class:`cfg-section`},Ss={key:0,class:`text-sm text-content-secondary dark:text-content-muted`},Cs={key:1,class:`space-y-3`},ws={class:`flex items-center gap-2`},Ts={key:0,class:`space-y-2`},Es=[`title`],Ds={key:1,class:`text-sm text-content-muted dark:text-content-muted/60 italic`},Os={class:`cfg-card p-6`},ks={key:0,class:`grid grid-cols-1 sm:grid-cols-2 gap-x-8 gap-y-3`},As={class:`flex flex-col py-1 border-b border-stroke-subtle dark:border-stroke/10`},js={class:`text-content-primary dark:text-content-primary font-mono text-sm mt-0.5`},Ms={class:`flex flex-col py-1 border-b border-stroke-subtle dark:border-stroke/10`},Ns={class:`text-content-primary dark:text-content-primary text-sm mt-0.5`},Ps={class:`flex flex-col py-1`},Fs={class:`text-content-primary dark:text-content-primary text-sm mt-0.5`},Is={class:`flex flex-col py-1`},Ls={class:`text-content-primary dark:text-content-primary text-sm mt-0.5`},Rs={key:1,class:`space-y-3`},zs={class:`grid grid-cols-1 sm:grid-cols-2 gap-3`},Bs={class:`cfg-card p-6`},Vs={class:`flex items-start justify-between mb-4`},Hs={key:0,class:`flex items-center gap-2 flex-shrink-0 ml-4`},Us={class:`relative`},Ws={key:0,class:`absolute right-0 top-full mt-1 z-20 w-72 rounded-lg shadow-lg border border-stroke-subtle dark:border-stroke/20 bg-white dark:bg-[var(--color-surface)] overflow-hidden`},Gs={key:0,class:`px-3 py-3 text-xs text-content-secondary dark:text-content-muted italic`},Ks={key:1,class:`px-3 py-3 text-xs text-red-600 dark:text-red-400`},qs={key:2,class:`px-3 py-3 text-xs text-content-secondary dark:text-content-muted italic`},Js={key:3,class:`py-1`},Ys=[`onClick`],Xs={class:`min-w-0 flex-1`},Zs={class:`text-sm font-medium text-content-primary dark:text-content-primary group-hover:text-primary transition-colors`},Qs={class:`text-xs text-content-secondary dark:text-content-muted`},$s=[`onClick`,`title`],ec=[`href`],tc={key:0,class:`bg-background-mute/40 dark:bg-background/20 border-t border-stroke-subtle dark:border-stroke/10`},nc=[`onClick`],rc={class:`min-w-0 flex-1`},ic={class:`text-xs font-medium text-content-primary dark:text-content-primary truncate`},ac={class:`text-[11px] font-mono text-content-secondary dark:text-content-muted truncate`},oc={key:0,class:`flex flex-col items-center justify-center py-8 rounded-lg border-2 border-dashed border-stroke-subtle dark:border-stroke/20 text-content-secondary dark:text-content-muted`},sc={key:0,class:`text-xs mt-0.5 opacity-70`},cc={key:1,class:`space-y-2`},lc={class:`flex items-center gap-3 px-4 py-2.5`},uc={class:`min-w-0 flex-1 flex items-center gap-2 flex-wrap`},dc={class:`text-sm font-medium text-content-primary dark:text-content-primary`},fc={class:`text-xs font-mono text-content-secondary dark:text-content-muted`},pc={key:0,class:`flex items-center gap-1.5 flex-shrink-0`},mc=[`onClick`],hc=[`onClick`],gc=B(f({__name:`LetsMeshSettings`,setup(i,{expose:a}){let s=ee(),u=y(()=>s.stats?.config?.mqtt_brokers||{}),d=l([]),f=l(!1),p=l(``),w=l(null);function E(e){return{...e,tls:{...e.tls},disallowedInput:[...e.disallowedInput??[]]}}let D=l(!1),O=l(!1),k=l(``),N=l(!1),P=l(null),I=l(!1),L=l(``),R=l(300),z=l(``),B=l(``),V=l([]),H=l(null),U=l(!1),W=l(null),G=l({_id:0,enabled:!0,name:``,host:``,port:443,format:`letsmesh`,use_jwt_auth:!1,transport:`websockets`,disallowedInput:[],retain_status:!1,tls:{enabled:!0,insecure:!1}}),K=l(!1),q=l(null),J=l(!1);async function ne(){if(!J.value){J.value=!0;try{let e=await F.get(`/api/mqtt_status`);e.data?.success&&(q.value=e.data.data)}catch{}finally{J.value=!1}}}let re=1;function Y(e={}){return{_id:re++,enabled:e.enabled??!0,name:e.name??``,host:e.host??``,port:e.port??0,audience:e.audience??``,format:e.format??`letsmesh`,use_jwt_auth:e.use_jwt_auth??!1,username:e.username??``,password:e.password??``,transport:e.transport??`websockets`,disallowedInput:Array.isArray(e.disallowedInput)?[...e.disallowedInput]:[],retain_status:e.retain_status??!1,base_topic:e.base_topic??``,tls:{enabled:e.tls?.enabled??!1,insecure:e.tls?.insecure??!1}}}function X(){let e=u.value;L.value=e.iata_code??``,R.value=e.status_interval??300,z.value=e.owner??``,B.value=e.email??``,V.value=Array.isArray(e.brokers)?e.brokers.map(e=>Y(e)):[]}o(u,()=>{D.value||X()},{immediate:!0});function Z(){return{iata_code:L.value,status_interval:R.value,owner:z.value,email:B.value,brokers:V.value.map(e=>{let t={name:e.name,enabled:e.enabled,transport:e.transport,host:e.host,port:e.port,use_jwt_auth:e.use_jwt_auth,format:e.format,disallowed_packet_types:e.disallowedInput,base_topic:e.base_topic,retain_status:e.retain_status,tls:{enabled:e.tls?.enabled??!1,insecure:e.tls?.insecure??!1}};return e.use_jwt_auth?{...t,audience:e.audience}:{...t,username:e.username,password:e.password}})}}async function Q(){try{let e=(await F.post(`/api/update_mqtt_config`,Z())).data;return e?.success?(await s.fetchStats(),await ne(),{success:!0}):{success:!1,error:e?.error||`Save failed`}}catch(e){let t=e;return{success:!1,error:t?.response?.data?.error||t?.message||`Request failed`}}}function $(){X(),P.value={iata:L.value,interval:R.value,owner:z.value,email:B.value,brokers:V.value.map(E)},D.value=!0,k.value=``}function ie(){P.value&&(L.value=P.value.iata,R.value=P.value.interval,z.value=P.value.owner,B.value=P.value.email,V.value=P.value.brokers.map(E)),H.value=null,U.value=!1,W.value=null,I.value=!1,D.value=!1,P.value=null,k.value=``}async function ae(){if(H.value!==null){let e=G.value;if(!e.name.trim()||!e.host.trim()){k.value=`Please complete or cancel the open broker edit before saving.`;return}de()}O.value=!0,k.value=``;let e=await Q();O.value=!1,e.success?(D.value=!1,I.value=!1,P.value=null,N.value=!0):k.value=e.error}function ce(){H.value!==null&&ue();let e=Y();V.value.push(e),W.value=null,U.value=!0,G.value=E(e),H.value=e._id}function le(e){H.value!==null&&H.value!==e._id&&ue(),W.value=E(e),U.value=!1,G.value=E(e),H.value=e._id}function ue(){if(U.value&&H.value!==null)V.value=V.value.filter(e=>e._id!==H.value);else if(W.value){let e=V.value.findIndex(e=>e._id===W.value._id);e!==-1&&V.value.splice(e,1,E(W.value))}H.value=null,U.value=!1,W.value=null}function de(){let e=G.value,t=V.value.findIndex(t=>t._id===e._id);t!==-1&&V.value.splice(t,1,E(e)),H.value=null,U.value=!1,W.value=null}function fe(e){G.value=e,de()}function pe(e){V.value=V.value.filter(t=>t._id!==e),H.value===e&&(H.value=null,U.value=!1,W.value=null)}function me(e){K.value=!1,w.value=null,H.value!==null&&ue(),e.brokers.forEach(e=>V.value.push(Y(e)))}function he(e){K.value=!1,w.value=null,H.value!==null&&ue(),V.value.push(Y(e))}function ge(e){w.value=w.value===e?null:e}async function _e(){f.value=!0,p.value=``;try{let e=(await F.get(`/api/broker_presets`)).data;e?.success&&Array.isArray(e.data)?d.value=e.data:(d.value=[],p.value=e?.error||`Failed to load broker presets`)}catch(e){d.value=[],e?.response?.status===404?p.value=``:p.value=`Could not reach repeater for broker presets`}finally{f.value=!1}}let ve=y(()=>{let e=G.value;return e.name.trim()!==``&&e.host.trim()!==``&&e.port>=1&&e.port<=65535&&(!e.use_jwt_auth||(e.audience?.trim()??``)!==``)});async function ye(){H.value!==null&&ve.value&&de(),O.value=!0,k.value=``;let e=await Q();return O.value=!1,e.success?(D.value=!1,I.value=!1,P.value=null,N.value=!0,!0):(k.value=e.error??`Save failed`,!1)}let{showUnsavedModal:be,requestLeave:xe,handleDiscard:Se,handleSave:Ce,handleCancel:we}=se(D,O,ie,ye);a({requestLeave:xe,isEditing:D});let Te=null;return r(()=>{ne(),_e(),Te=setInterval(ne,5e3)}),n(()=>{Te&&clearInterval(Te)}),(n,r)=>(h(),C(x,null,[_(te,{modelValue:N.value,"onUpdate:modelValue":r[0]||=e=>N.value=e,message:`Broker settings have been saved. A service restart is required for the changes to take effect.`},null,8,[`modelValue`]),_(ms,{show:H.value!==null,broker:H.value===null?null:G.value,"is-new":U.value,onDone:fe,onCancel:ue},null,8,[`show`,`broker`,`is-new`]),_(oe,{show:v(be),"is-saving":O.value,label:`Broker settings`,onDiscard:v(Se),onSave:v(Ce),onCancel:v(we)},null,8,[`show`,`is-saving`,`onDiscard`,`onSave`,`onCancel`]),S(`div`,hs,[S(`div`,gs,[r[8]||=S(`div`,null,[S(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2`},` Observer Configuration `),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},` Configure LetsMesh observer settings, MQTT brokers, and connection status `)],-1),S(`div`,_s,[D.value?(h(),C(x,{key:1},[S(`button`,{onClick:ie,disabled:O.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,vs),S(`button`,{onClick:ae,disabled:O.value,class:`btn-primary`},t(O.value?`Saving…`:`Save Settings`),9,ys)],64)):(h(),C(`button`,{key:0,onClick:$,class:`btn-primary`},` Edit Settings `))])]),k.value?(h(),C(`div`,bs,t(k.value),1)):g(``,!0),S(`div`,xs,[r[10]||=S(`div`,{class:`mb-4`},[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},`Observer Status`),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},`Live LetsMesh broker connection state`)],-1),q.value?(h(),C(`div`,Cs,[S(`div`,ws,[r[9]||=S(`span`,{class:`text-sm text-content-secondary dark:text-content-muted w-36`},`Handler`,-1),S(`span`,{class:T([`inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium`,q.value.handler_active?`bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400`:`bg-gray-100 dark:bg-gray-800/50 text-gray-500 dark:text-gray-400`])},[S(`span`,{class:T([`w-1.5 h-1.5 rounded-full`,q.value.handler_active?`bg-green-500`:`bg-gray-400`])},null,2),b(` `+t(q.value.handler_active?`Active`:`Inactive`),1)],2)]),q.value.brokers.length?(h(),C(`div`,Ts,[(h(!0),C(x,null,m(q.value.brokers,e=>(h(),C(`div`,{key:e.host,class:`flex items-center gap-2`},[S(`span`,{class:`text-sm text-content-secondary dark:text-content-muted w-36 truncate`,title:e.name},t(e.name),9,Es),S(`span`,{class:T([`inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium`,e.status.connected?`bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400`:e.status.reconnecting?`bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400`:`bg-red-100 dark:bg-red-900/30 text-red-600 dark:text-red-400`])},[S(`span`,{class:T([`w-1.5 h-1.5 rounded-full`,e.status.connected?`bg-green-500`:e.status.reconnecting?`bg-amber-500`:`bg-red-500`])},null,2),b(` `+t(e.status.connected?`Connected`:e.status.reconnecting?`Reconnecting…`:`Disconnected`),1)],2)]))),128))])):(h(),C(`div`,Ds,`No broker connections configured.`))])):(h(),C(`div`,Ss,` Status unavailable — service may not be running. `))]),S(`div`,Os,[r[19]||=S(`div`,{class:`mb-4`},[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},`Observer Setup`),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},`IATA code, status interval, and owner details`)],-1),S(`div`,null,[D.value?g(``,!0):(h(),C(`div`,ks,[S(`div`,As,[r[11]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`IATA Code`,-1),S(`span`,js,t(u.value.iata_code||`—`),1)]),S(`div`,Ms,[r[12]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Status Interval`,-1),S(`span`,Ns,t(u.value.status_interval??300)+`s`,1)]),S(`div`,Ps,[r[13]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Owner`,-1),S(`span`,Fs,t(u.value.owner||`—`),1)]),S(`div`,Is,[r[14]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Email`,-1),S(`span`,Ls,t(u.value.email||`—`),1)])])),D.value?(h(),C(`div`,Rs,[S(`div`,zs,[S(`div`,null,[r[15]||=S(`label`,{class:`block text-xs sm:text-sm text-content-secondary dark:text-content-muted mb-1`},[b(` IATA Code `),S(`span`,{class:`text-content-muted dark:text-content-muted/60 text-xs`},`(e.g. SFO, LHR)`)],-1),c(S(`input`,{"onUpdate:modelValue":r[1]||=e=>L.value=e,type:`text`,maxlength:`10`,placeholder:`TEST`,class:`cfg-input font-mono`},null,512),[[A,L.value]])]),S(`div`,null,[r[16]||=S(`label`,{class:`block text-xs sm:text-sm text-content-secondary dark:text-content-muted mb-1`},[b(` Status Interval `),S(`span`,{class:`text-content-muted dark:text-content-muted/60 text-xs`},`(seconds, min 60)`)],-1),c(S(`input`,{"onUpdate:modelValue":r[2]||=e=>R.value=e,type:`number`,min:`60`,max:`3600`,class:`cfg-input font-mono`},null,512),[[A,R.value,void 0,{number:!0}]])]),S(`div`,null,[r[17]||=S(`label`,{class:`block text-xs sm:text-sm text-content-secondary dark:text-content-muted mb-1`},`Owner Companion Pubkey`,-1),c(S(`input`,{"onUpdate:modelValue":r[3]||=e=>z.value=e,type:`text`,placeholder:`Optional`,class:`cfg-input`},null,512),[[A,z.value]])]),S(`div`,null,[r[18]||=S(`label`,{class:`block text-xs sm:text-sm text-content-secondary dark:text-content-muted mb-1`},`Email`,-1),c(S(`input`,{"onUpdate:modelValue":r[4]||=e=>B.value=e,type:`email`,placeholder:`Optional`,class:`cfg-input`},null,512),[[A,B.value]])])])])):g(``,!0)])]),S(`div`,Bs,[S(`div`,Vs,[r[27]||=S(`div`,null,[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},`Broker Settings`),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},`MQTT brokers for observer publishing`)],-1),D.value?(h(),C(`div`,Hs,[S(`div`,Us,[S(`button`,{onClick:r[5]||=e=>K.value=!K.value,class:`inline-flex items-center gap-1.5 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`},[r[21]||=b(` From Template `,-1),(h(),C(`svg`,{class:T([`w-3 h-3 transition-transform`,K.value?`rotate-180`:``]),fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[...r[20]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M19 9l-7 7-7-7`},null,-1)]],2))]),_(j,{name:`dropdown`},{default:e(()=>[K.value?(h(),C(`div`,Ws,[r[25]||=S(`div`,{class:`px-3 py-2 border-b border-stroke-subtle dark:border-stroke/10`},[S(`p`,{class:`text-xs font-medium text-content-secondary dark:text-content-muted uppercase tracking-wide`},`Known Networks`)],-1),f.value?(h(),C(`div`,Gs,` Loading presets… `)):p.value?(h(),C(`div`,Ks,t(p.value),1)):d.value.length?(h(),C(`div`,Js,[(h(!0),C(x,null,m(d.value,e=>(h(),C(`div`,{key:e.id,class:`border-b border-stroke-subtle dark:border-stroke/10 last:border-b-0`},[S(`div`,{class:`flex items-center gap-2 px-3 py-2.5 hover:bg-background-mute dark:hover:bg-background/30 cursor-pointer group`,onClick:t=>me(e)},[S(`div`,Xs,[S(`p`,Zs,t(e.name),1),S(`p`,Qs,t(e.brokers.length)+` broker`+t(e.brokers.length===1?``:`s`),1)]),e.brokers.length>1?(h(),C(`button`,{key:0,onClick:M(t=>ge(e.id),[`stop`]),title:w.value===e.id?`Hide individual brokers`:`Pick individual brokers`,class:`flex-shrink-0 p-1 rounded hover:bg-primary/10 text-content-secondary dark:text-content-muted hover:text-primary transition-colors`},[(h(),C(`svg`,{class:T([`w-3.5 h-3.5 transition-transform`,w.value===e.id?`rotate-180`:``]),fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[...r[22]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M19 9l-7 7-7-7`},null,-1)]],2))],8,$s)):g(``,!0),e.website?(h(),C(`a`,{key:1,href:e.website,target:`_blank`,rel:`noopener noreferrer`,title:`Visit website`,class:`flex-shrink-0 p-1 rounded hover:bg-primary/10 text-content-secondary dark:text-content-muted hover:text-primary transition-colors`,onClick:r[6]||=M(()=>{},[`stop`])},[...r[23]||=[S(`svg`,{class:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14`})],-1)]],8,ec)):g(``,!0)],8,Ys),w.value===e.id&&e.brokers.length>1?(h(),C(`div`,tc,[(h(!0),C(x,null,m(e.brokers,(n,i)=>(h(),C(`div`,{key:`${e.id}-${i}`,class:`flex items-center gap-2 pl-6 pr-3 py-2 hover:bg-background-mute dark:hover:bg-background/30 cursor-pointer`,onClick:e=>he(n)},[S(`div`,rc,[S(`p`,ic,t(n.name),1),S(`p`,ac,t(n.host)+`:`+t(n.port),1)]),r[24]||=S(`span`,{class:`flex-shrink-0 inline-flex items-center justify-center w-5 h-5 rounded bg-primary/10 text-primary text-xs font-bold`,title:`Add only this broker`},`+`,-1)],8,nc))),128))])):g(``,!0)]))),128))])):(h(),C(`div`,qs,` No bundled presets. Use "Add" to configure manually. `))])):g(``,!0)]),_:1}),K.value?(h(),C(`div`,{key:0,class:`fixed inset-0 z-10`,onClick:r[7]||=e=>K.value=!1})):g(``,!0)]),S(`button`,{onClick:ce,class:`btn-primary inline-flex items-center gap-1.5`},[...r[26]||=[S(`svg`,{class:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 4v16m8-8H4`})],-1),b(` Add `,-1)]])])):g(``,!0)]),V.value.length?(h(),C(`div`,cc,[(h(!0),C(x,null,m(V.value,e=>(h(),C(`div`,{key:e._id,class:`cfg-card overflow-hidden`},[S(`div`,lc,[S(`div`,uc,[S(`span`,{class:T([`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium`,e.enabled?`bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400`:`bg-red-100 dark:bg-red-900/30 text-red-600 dark:text-red-400`])},[S(`span`,{class:T([`w-1.5 h-1.5 rounded-full`,e.enabled?`bg-green-500`:`bg-red-500`])},null,2),b(` `+t(e.enabled?`Enabled`:`Disabled`),1)],2),S(`span`,dc,t(e.name||`(unnamed)`),1),S(`span`,fc,t(e.host||`—`)+`:`+t(e.port),1)]),D.value?(h(),C(`div`,pc,[S(`button`,{onClick:t=>le(e),class:`px-2.5 py-1 text-xs bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded border border-primary/50 transition-colors`},` Edit `,8,mc),S(`button`,{onClick:t=>pe(e._id),title:`Remove`,class:`p-1.5 rounded hover:bg-red-500/10 dark:hover:bg-red-900/20 text-content-secondary dark:text-content-muted hover:text-red-600 dark:hover:text-red-400 transition-colors`},[...r[30]||=[S(`svg`,{class:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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,hc)])):g(``,!0)])]))),128))])):(h(),C(`div`,oc,[r[28]||=S(`svg`,{class:`w-7 h-7 mb-2 opacity-40`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`1.5`,d:`M5 12h14M5 12l4-4m-4 4l4 4`})],-1),r[29]||=S(`p`,{class:`text-sm`},`No brokers configured`,-1),D.value?(h(),C(`p`,sc,`Use Add or From Template above`)):g(``,!0)]))])])],64))}}),[[`__scopeId`,`data-v-de709eb9`]]),_c={class:`space-y-12`},vc={key:0,class:`rounded-lg border-2 border-red-500/50 dark:border-red-400/40 bg-red-100 dark:bg-red-500/10 p-4`},yc={class:`cfg-section`},bc=[`disabled`],xc={key:0,class:`flex items-center gap-2`},Sc={key:1,class:`flex items-center gap-2`},Cc={key:0,class:`text-xs text-green-600 dark:text-green-400 mt-2`},wc={key:1,class:`text-xs text-red-500 dark:text-red-400 mt-2`},Tc={class:`cfg-section`},Ec={key:0},Dc={key:1,class:`rounded-lg border-2 border-red-500/50 dark:border-red-400/40 bg-red-50 dark:bg-red-500/10 p-4`},Oc={class:`flex items-start gap-3`},kc={class:`flex-1`},Ac={class:`text-xs text-red-600 dark:text-red-400/80 mt-1`},jc={class:`flex gap-2 mt-3`},Mc=[`disabled`],Nc=[`disabled`],Pc={key:2,class:`text-xs text-green-600 dark:text-green-400 mt-2`},Fc={key:3,class:`text-xs text-red-500 dark:text-red-400 mt-2`},Ic={class:`cfg-section`},Lc={class:`space-y-3`},Rc={class:`flex items-center gap-3 cursor-pointer px-4 py-3 bg-background-mute dark:bg-background/30 rounded-lg border-2 border-dashed border-stroke-subtle dark:border-stroke/20 hover:border-cyan-500/50 dark:hover:border-primary/50 transition-colors`},zc={class:`text-sm text-content-secondary dark:text-content-muted`},Bc={key:0,class:`bg-background-mute dark:bg-background/30 rounded-lg p-4 border border-stroke-subtle dark:border-stroke/10`},Vc={key:0,class:`text-xs text-content-secondary dark:text-content-muted space-y-1 mb-3`},Hc={class:`font-mono`},Uc={class:`font-mono`},Wc={key:0,class:`text-amber-600 dark:text-amber-400 font-medium`},Gc={key:1,class:`text-content-muted`},Kc={class:`text-xs text-content-secondary dark:text-content-muted`},qc={class:`font-mono`},Jc={key:1},Yc={key:2,class:`rounded-lg border-2 border-amber-500/50 dark:border-amber-400/40 bg-amber-50 dark:bg-amber-500/10 p-4`},Xc={class:`flex items-start gap-3`},Zc={class:`flex-1`},Qc={class:`text-xs text-amber-700 dark:text-amber-300/80 mt-1`},$c={class:`flex gap-2 mt-3`},el=[`disabled`],tl=[`disabled`],nl={key:3,class:`text-xs text-green-600 dark:text-green-400 mt-2`},rl={key:4,class:`text-xs text-red-500 dark:text-red-400 mt-2`},il={class:`cfg-section`},al={key:0},ol={key:1,class:`rounded-lg border-2 border-red-500/50 dark:border-red-400/40 bg-red-50 dark:bg-red-500/10 p-4`},sl={class:`flex items-start gap-3`},cl={class:`flex-1`},ll={class:`text-xs text-red-600 dark:text-red-400/80 mt-1`},ul={class:`flex gap-2 mt-3`},dl=[`disabled`],fl=[`disabled`],pl={key:2,class:`bg-background-mute dark:bg-background/30 rounded-lg p-4 border border-stroke-subtle dark:border-stroke/10 space-y-2`},ml={class:`flex items-center justify-between`},hl={class:`text-xs text-content-secondary dark:text-content-muted space-y-1`},gl={class:`font-mono`},_l={key:0},vl={class:`font-mono`},yl={key:1},bl={class:`font-mono text-[10px] break-all`},xl={key:3,class:`text-xs text-red-500 dark:text-red-400 mt-2`},Sl=f({__name:`BackupRestore`,setup(e){let n=y(()=>window.location.protocol===`http:`),r=l(!1),i=l(``),a=l(``);async function o(){r.value=!0,i.value=``,a.value=``;try{let e=await I.exportConfig(!1);if(!e.success||!e.data){a.value=e.error||`Export failed`;return}let t=new Blob([JSON.stringify(e.data,null,2)],{type:`application/json`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`pymc-repeater-settings-${(e.data.meta?.exported_at||new Date().toISOString()).replace(/[:.]/g,`-`)}.json`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n),i.value=`Settings exported successfully (secrets redacted).`}catch(e){a.value=e instanceof Error?e.message:`Export failed`}finally{r.value=!1}}let s=l(!1),c=l(!1),u=l(``),f=l(``);async function p(){c.value=!0,u.value=``,f.value=``;try{let e=await I.exportConfig(!0);if(!e.success||!e.data){f.value=e.error||`Export failed`;return}let t=new Blob([JSON.stringify(e.data,null,2)],{type:`application/json`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`pymc-repeater-full-backup-${(e.data.meta?.exported_at||new Date().toISOString()).replace(/[:.]/g,`-`)}.json`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n),u.value=`Full backup exported (includes all secrets).`,s.value=!1}catch(e){f.value=e instanceof Error?e.message:`Export failed`}finally{c.value=!1}}let m=l(null),v=l(null),w=l(!1),T=l(!1),E=l(``),D=l(``),O=l(null),k=y(()=>v.value?.config?Object.keys(v.value.config).join(`, `):``),A=y(()=>{let e=v.value?.meta?.includes_secrets;return e===!0||e===`true`});function j(e){let t=e.target.files?.[0];if(!t)return;m.value=t,v.value=null,w.value=!1,E.value=``,D.value=``;let n=new FileReader;n.onload=e=>{try{let t=JSON.parse(e.target?.result);t.config&&typeof t.config==`object`?v.value={meta:t.meta,config:t.config}:typeof t==`object`&&!Array.isArray(t)?v.value={config:t}:D.value=`Invalid file format — expected a JSON config object.`}catch{D.value=`Invalid JSON file.`}},n.readAsText(t)}function M(){w.value=!1,v.value=null,m.value=null,O.value&&(O.value.value=``)}async function N(){if(v.value?.config){T.value=!0,E.value=``,D.value=``;try{let e=await I.importConfig(v.value.config);if(e.success){let t=e.data,n=e.message||t?.message||`Configuration imported.`;t?.restart_required&&(n+=` A service restart is required for radio changes to take effect.`),E.value=n,w.value=!1,v.value=null,m.value=null,O.value&&(O.value.value=``)}else D.value=e.error||`Import failed`}catch(e){D.value=e instanceof Error?e.message:`Import failed`}finally{T.value=!1}}}let P=l(!1),F=l(!1),L=l(null),R=l(``);async function ee(){F.value=!0,R.value=``;try{let e=await I.exportIdentityKey();if(!e.success||!e.data){R.value=e.error||`Export failed`;return}L.value=e.data;let t=new Blob([e.data.identity_key_hex],{type:`text/plain`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`pymc-identity-${e.data.node_address||`key`}.hex`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}catch(e){R.value=e instanceof Error?e.message:`Export failed`}finally{F.value=!1}}return(e,l)=>(h(),C(`div`,_c,[l[39]||=S(`div`,{class:`cfg-page-heading flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3`},[S(`div`,null,[S(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2`},`Backup & Restore`),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Export, import, and restore your repeater configuration`)])],-1),n.value?(h(),C(`div`,vc,[...l[6]||=[d(`

Unencrypted Connection

This page is served over HTTP, not HTTPS. Exported data (including identity keys) will be transmitted in plain text. Only use these features on a trusted local network.

`,1)]])):g(``,!0),S(`div`,yc,[l[9]||=S(`div`,{class:`flex items-start justify-between mb-4`},[S(`div`,null,[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},` Export Settings `),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},[b(` Download the current configuration as a JSON file. Passwords, JWT secrets, and identity keys are `),S(`strong`,null,`redacted`),b(`. Safe to share or use as a template for other devices. `)])])],-1),S(`button`,{onClick:o,disabled:r.value,class:`cfg-btn-primary`},[r.value?(h(),C(`span`,xc,[_(V,{size:`sm`,color:`current`,class:`inline-block`}),l[7]||=b(` Exporting… `,-1)])):(h(),C(`span`,Sc,[...l[8]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4`})],-1),b(` Export Settings `,-1)]]))],8,bc),i.value?(h(),C(`p`,Cc,t(i.value),1)):g(``,!0),a.value?(h(),C(`p`,wc,t(a.value),1)):g(``,!0)]),S(`div`,Tc,[l[15]||=d(`

Full Backup

Download a complete backup including all passwords, JWT secrets, and identity keys. Required for restoring to a new device or recovering from a failed SD card.

Contains sensitive data. The backup file will include plain-text passwords and private keys. Store it securely and never share it.

`,2),s.value?g(``,!0):(h(),C(`div`,Ec,[S(`button`,{onClick:l[0]||=e=>s.value=!0,class:`px-4 py-2 bg-red-500/20 dark:bg-red-400/20 hover:bg-red-500/30 dark:hover:bg-red-400/30 text-red-900 dark:text-red-200 rounded-lg border border-red-500/50 dark:border-red-400/40 transition-colors text-sm`},[...l[10]||=[S(`span`,{class:`flex items-center gap-2`},[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z`})]),b(` Full Backup `)],-1)]])])),s.value?(h(),C(`div`,Dc,[S(`div`,Oc,[l[14]||=S(`svg`,{class:`w-5 h-5 text-red-600 dark:text-red-400 shrink-0 mt-0.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`div`,kc,[l[13]||=S(`h4`,{class:`text-sm font-semibold text-red-700 dark:text-red-400`},` Confirm Full Backup `,-1),S(`p`,Ac,[l[11]||=b(` This will export `,-1),l[12]||=S(`strong`,null,`all secrets in plain text`,-1),b(` including admin/guest passwords, JWT secret, and your repeater's private identity key`+t(n.value?` over an unencrypted HTTP connection`:``)+`. `,1)]),S(`div`,jc,[S(`button`,{onClick:p,disabled:c.value,class:`px-4 py-2 bg-red-600 hover:bg-red-700 dark:bg-red-500 dark:hover:bg-red-600 text-white rounded-lg transition-colors text-sm disabled:opacity-50`},t(c.value?`Exporting…`:`Yes, Export Full Backup`),9,Mc),S(`button`,{onClick:l[1]||=e=>s.value=!1,disabled:c.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 text-sm`},` Cancel `,8,Nc)])])])])):g(``,!0),u.value?(h(),C(`p`,Pc,t(u.value),1)):g(``,!0),f.value?(h(),C(`p`,Fc,t(f.value),1)):g(``,!0)]),S(`div`,Ic,[l[29]||=S(`div`,{class:`flex items-start justify-between mb-4`},[S(`div`,null,[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},` Import Configuration `),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},[b(` Restore configuration from a previously exported JSON file. Importing a `),S(`strong`,null,`full backup`),b(` will also restore passwords and identity keys. Importing a `),S(`strong`,null,`settings export`),b(` will only update non-sensitive settings. `)])])],-1),S(`div`,Lc,[S(`label`,Rc,[l[16]||=S(`svg`,{class:`w-5 h-5 text-content-secondary dark:text-content-muted`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12`})],-1),S(`span`,zc,t(m.value?m.value.name:`Choose a config JSON file…`),1),S(`input`,{ref_key:`fileInputRef`,ref:O,type:`file`,accept:`.json,application/json`,class:`hidden`,onChange:j},null,544)]),v.value?(h(),C(`div`,Bc,[l[20]||=S(`h4`,{class:`text-sm font-medium text-content-primary dark:text-content-primary mb-2`},` Import Preview `,-1),v.value.meta?(h(),C(`div`,Vc,[S(`p`,null,[l[17]||=b(` Exported: `,-1),S(`span`,Hc,t(v.value.meta.exported_at),1)]),S(`p`,null,[l[18]||=b(` Version: `,-1),S(`span`,Uc,t(v.value.meta.version),1)]),v.value.meta.includes_secrets===`true`||v.value.meta.includes_secrets===!0?(h(),C(`p`,Wc,` ⚠ Full backup — will restore passwords and identity keys `)):(h(),C(`p`,Gc,` Settings only — existing secrets will not be changed `))])):g(``,!0),S(`p`,Kc,[l[19]||=b(` Sections: `,-1),S(`span`,qc,t(k.value),1)])])):g(``,!0),v.value&&!w.value?(h(),C(`div`,Jc,[S(`button`,{onClick:l[2]||=e=>w.value=!0,class:`px-4 py-2 bg-amber-500/20 dark:bg-amber-400/20 hover:bg-amber-500/30 dark:hover:bg-amber-400/30 text-amber-900 dark:text-amber-200 rounded-lg border border-amber-500/50 dark:border-amber-400/40 transition-colors text-sm`},` Review & Import `)])):g(``,!0),w.value?(h(),C(`div`,Yc,[S(`div`,Xc,[l[28]||=S(`svg`,{class:`w-5 h-5 text-amber-600 dark:text-amber-400 shrink-0 mt-0.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`div`,Zc,[l[27]||=S(`h4`,{class:`text-sm font-semibold text-amber-800 dark:text-amber-300`},` Confirm Import `,-1),S(`p`,Qc,[l[24]||=b(` This will overwrite current settings for: `,-1),S(`strong`,null,t(k.value),1),l[25]||=b(`. `,-1),A.value?(h(),C(x,{key:0},[l[21]||=b(` This is a full backup — `,-1),l[22]||=S(`strong`,null,`passwords, JWT secrets, and identity keys will also be overwritten`,-1),l[23]||=b(`. `,-1)],64)):(h(),C(x,{key:1},[b(` Passwords and identity keys will not be changed. `)],64)),l[26]||=b(` Some changes (radio settings) require a service restart. `,-1)]),S(`div`,$c,[S(`button`,{onClick:N,disabled:T.value,class:`px-4 py-2 bg-amber-600 hover:bg-amber-700 dark:bg-amber-500 dark:hover:bg-amber-600 text-white rounded-lg transition-colors text-sm disabled:opacity-50`},t(T.value?`Importing…`:`Yes, Import`),9,el),S(`button`,{onClick:M,disabled:T.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 text-sm`},` Cancel `,8,tl)])])])])):g(``,!0),E.value?(h(),C(`p`,nl,t(E.value),1)):g(``,!0),D.value?(h(),C(`p`,rl,t(D.value),1)):g(``,!0)])]),S(`div`,il,[l[38]||=d(`

Export Identity Key

Download the repeater's private identity key for backup. This key determines the node's address and cryptographic identity on the mesh.

Sensitive data. The identity key is the repeater's private key. Anyone with this key can impersonate your node. Store the exported file securely and never share it.

`,2),P.value?g(``,!0):(h(),C(`div`,al,[S(`button`,{onClick:l[3]||=e=>P.value=!0,class:`px-4 py-2 bg-red-500/20 dark:bg-red-400/20 hover:bg-red-500/30 dark:hover:bg-red-400/30 text-red-900 dark:text-red-200 rounded-lg border border-red-500/50 dark:border-red-400/40 transition-colors text-sm`},[...l[30]||=[S(`span`,{class:`flex items-center gap-2`},[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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`})]),b(` Export Identity Key `)],-1)]])])),P.value&&!L.value?(h(),C(`div`,ol,[S(`div`,sl,[l[32]||=S(`svg`,{class:`w-5 h-5 text-red-600 dark:text-red-400 shrink-0 mt-0.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`div`,cl,[l[31]||=S(`h4`,{class:`text-sm font-semibold text-red-700 dark:text-red-400`},`Are you sure?`,-1),S(`p`,ll,` This will transmit your private key `+t(n.value?`over an unencrypted HTTP connection. `:``)+` and download it as a file. `,1),S(`div`,ul,[S(`button`,{onClick:ee,disabled:F.value,class:`px-4 py-2 bg-red-600 hover:bg-red-700 dark:bg-red-500 dark:hover:bg-red-600 text-white rounded-lg transition-colors text-sm disabled:opacity-50`},t(F.value?`Exporting…`:`Yes, Export Key`),9,dl),S(`button`,{onClick:l[4]||=e=>P.value=!1,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 text-sm`},` Cancel `,8,fl)])])])])):g(``,!0),L.value?(h(),C(`div`,pl,[S(`div`,ml,[l[33]||=S(`h4`,{class:`text-sm font-medium text-content-primary dark:text-content-primary`},` Key Exported `,-1),S(`button`,{onClick:l[5]||=e=>{L.value=null,P.value=!1},class:`text-xs text-content-muted hover:text-content-secondary transition-colors`},` Dismiss `)]),S(`div`,hl,[S(`p`,null,[l[34]||=b(` Key length: `,-1),S(`span`,gl,t(L.value.key_length_bytes)+` bytes`,1)]),L.value.node_address?(h(),C(`p`,_l,[l[35]||=b(` Node address: `,-1),S(`span`,vl,t(L.value.node_address),1)])):g(``,!0),L.value.public_key_hex?(h(),C(`p`,yl,[l[36]||=b(` Public key: `,-1),S(`span`,bl,t(L.value.public_key_hex),1)])):g(``,!0)]),l[37]||=S(`p`,{class:`text-xs text-green-600 dark:text-green-400`},`File downloaded successfully.`,-1)])):g(``,!0),R.value?(h(),C(`p`,xl,t(R.value),1)):g(``,!0)])]))}}),Cl={class:`space-y-12`},wl={class:`cfg-page-heading flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3`},Tl={class:`flex items-center gap-2 flex-shrink-0`},El={class:`cfg-section`},Dl={class:`flex items-start justify-between mb-4`},Ol=[`disabled`],kl={key:0,class:`flex items-center gap-1.5`},Al={key:1},jl={key:0,class:`grid grid-cols-2 sm:grid-cols-4 gap-3 mb-6`},Ml={class:`bg-background-mute dark:bg-background/30 rounded-lg p-3 border border-stroke-subtle dark:border-stroke/10`},Nl={class:`text-lg font-semibold text-content-primary dark:text-content-primary font-mono`},Pl={class:`bg-background-mute dark:bg-background/30 rounded-lg p-3 border border-stroke-subtle dark:border-stroke/10`},Fl={class:`text-lg font-semibold text-content-primary dark:text-content-primary font-mono`},Il={class:`bg-background-mute dark:bg-background/30 rounded-lg p-3 border border-stroke-subtle dark:border-stroke/10`},Ll={class:`text-lg font-semibold text-content-primary dark:text-content-primary font-mono`},Rl={class:`bg-background-mute dark:bg-background/30 rounded-lg p-3 border border-stroke-subtle dark:border-stroke/10`},zl={class:`text-lg font-semibold text-content-primary dark:text-content-primary font-mono`},Bl={key:1,class:`flex items-center justify-center py-12`},Vl={class:`text-center`},Hl={key:2,class:`rounded-lg border border-red-500/30 dark:border-red-400/30 bg-red-50 dark:bg-red-500/10 p-3 mb-4`},Ul={class:`text-xs text-red-700 dark:text-red-400`},Wl={key:3},Gl={class:`overflow-x-auto`},Kl={class:`w-full text-sm`},ql={class:`py-2.5 pr-4`},Jl={class:`font-mono text-content-primary dark:text-content-primary`},Yl={class:`py-2.5 pr-4 text-right`},Xl={class:`font-mono text-content-secondary dark:text-content-muted`},Zl={class:`py-2.5 pr-4 text-right hidden sm:table-cell`},Ql={key:0,class:`text-xs text-content-muted`},$l={class:`text-content-muted/60 ml-1`},eu={key:1,class:`text-xs text-content-muted/50`},tu={key:2,class:`text-xs text-content-muted/50`},nu={class:`py-2.5 text-right`},ru=[`onClick`,`disabled`],iu={key:0,class:`flex items-center gap-1`},au={key:1},ou={key:1,class:`text-xs text-content-muted/50`},su={class:`flex items-start gap-3 mb-5`},cu={class:`flex-1 min-w-0`},lu={class:`text-lg font-semibold text-content-primary dark:text-content-primary`},uu={class:`text-sm text-content-secondary dark:text-content-muted mt-1`},du={class:`text-content-primary dark:text-content-primary`},fu={class:`text-content-primary dark:text-content-primary font-mono`},pu={class:`flex gap-3`},mu=[`disabled`],hu=[`disabled`],gu={class:`cfg-section`},_u={class:`flex flex-wrap gap-3`},vu=[`disabled`],yu=[`disabled`],bu={class:`flex items-center gap-2`},xu={key:0,class:`text-xs text-green-600 dark:text-green-400 mt-3`},Su={key:1,class:`text-xs text-green-600 dark:text-green-400 mt-3`},Cu=f({__name:`DatabaseManagement`,setup(e){let n=new Set([`packets`,`adverts`,`noise_floor`,`crc_errors`,`room_messages`,`room_client_sync`,`companion_contacts`,`companion_channels`,`companion_messages`,`companion_prefs`]),i=l(!1),a=l(!1),o=l(``),s=l(null),c=l({}),d=l(null),f=l(``),w=l(!1),T=l(``),E=y(()=>s.value?s.value.tables.reduce((e,t)=>e+t.row_count,0):0);function D(e){return n.has(e)}function O(e,t){return!e||!t?0:Math.max(1,Math.round((t-e)/86400))}async function k(){a.value=!0,o.value=``;try{let e=await I.getDbStats();e.success&&e.data?s.value=e.data:o.value=e.error||`Failed to load database stats`}catch(e){o.value=e instanceof Error?e.message:`Failed to load database stats`}finally{a.value=!1}}function A(e,t){f.value=``,d.value={table:e,rowCount:t,executing:!1}}async function j(){if(!d.value)return;let{table:e}=d.value;d.value.executing=!0,f.value=``;try{let t=e===`all`?`all`:[e];e!==`all`&&(c.value[e]=!0);let n=await I.purgeTable(t);if(n.success){let t=n.data||{};f.value=`Deleted ${Object.values(t).reduce((e,t)=>e+(t.deleted||0),0).toLocaleString()} rows${e===`all`?` from all tables`:` from ${e}`}.`,d.value=null,await k()}else o.value=n.error||`Purge failed`,d.value=null}catch(e){o.value=e instanceof Error?e.message:`Purge failed`,d.value=null}finally{e!==`all`&&(c.value[e]=!1)}}async function N(){w.value=!0,T.value=``,o.value=``;try{let e=await I.vacuumDb();if(e.success&&e.data){let t=e.data.freed_bytes;T.value=t>0?`Compacted database — freed ${q(t)} (${q(e.data.size_before)} → ${q(e.data.size_after)}).`:`Database already compact (${q(e.data.size_after)}).`,await k()}else o.value=e.error||`Vacuum failed`}catch(e){o.value=e instanceof Error?e.message:`Vacuum failed`}finally{w.value=!1}}return r(k),(e,n)=>(h(),C(`div`,Cl,[S(`div`,wl,[n[5]||=S(`div`,null,[S(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2`},`Database`),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`View database statistics and perform maintenance`)],-1),S(`div`,Tl,[S(`button`,{onClick:n[0]||=e=>i.value=!i.value,class:`cfg-btn-primary`},t(i.value?`Lock`:`Unlock`),1)])]),S(`div`,El,[S(`div`,Dl,[n[7]||=S(`div`,null,[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},` Database Overview `),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},` Storage usage and table statistics for the repeater database. `)],-1),S(`button`,{onClick:k,disabled:a.value,class:`cfg-btn-secondary`},[a.value?(h(),C(`span`,kl,[_(V,{size:`xs`,color:`current`,class:`inline-block`}),n[6]||=b(` Loading… `,-1)])):(h(),C(`span`,Al,`Refresh`))],8,Ol)]),s.value?(h(),C(`div`,jl,[S(`div`,Ml,[n[8]||=S(`p`,{class:`text-xs text-content-muted mb-1`},`Database Size`,-1),S(`p`,Nl,t(v(q)(s.value.database_size_bytes)),1)]),S(`div`,Pl,[n[9]||=S(`p`,{class:`text-xs text-content-muted mb-1`},`RRD Metrics`,-1),S(`p`,Fl,t(v(q)(s.value.rrd_size_bytes)),1)]),S(`div`,Il,[n[10]||=S(`p`,{class:`text-xs text-content-muted mb-1`},`Total Size`,-1),S(`p`,Ll,t(v(q)(s.value.database_size_bytes+s.value.rrd_size_bytes)),1)]),S(`div`,Rl,[n[11]||=S(`p`,{class:`text-xs text-content-muted mb-1`},`Total Rows`,-1),S(`p`,zl,t(E.value.toLocaleString()),1)])])):g(``,!0),a.value&&!s.value?(h(),C(`div`,Bl,[S(`div`,Vl,[_(V,{class:`mx-auto mb-4`}),n[12]||=S(`div`,{class:`text-content-secondary dark:text-content-muted`},`Loading database info…`,-1)])])):g(``,!0),o.value?(h(),C(`div`,Hl,[S(`p`,Ul,t(o.value),1)])):g(``,!0),s.value&&s.value.tables.length>0?(h(),C(`div`,Wl,[S(`div`,Gl,[S(`table`,Kl,[n[14]||=S(`thead`,null,[S(`tr`,{class:`border-b border-stroke-subtle dark:border-stroke/10`},[S(`th`,{class:`text-left py-2 pr-4 text-xs font-medium text-content-muted uppercase tracking-wider`},` Table `),S(`th`,{class:`text-right py-2 pr-4 text-xs font-medium text-content-muted uppercase tracking-wider`},` Rows `),S(`th`,{class:`text-right py-2 pr-4 text-xs font-medium text-content-muted uppercase tracking-wider hidden sm:table-cell`},` Date Range `),S(`th`,{class:`text-right py-2 text-xs font-medium text-content-muted uppercase tracking-wider`},` Actions `)])],-1),S(`tbody`,null,[(h(!0),C(x,null,m(s.value.tables,e=>(h(),C(`tr`,{key:e.name,class:`border-b border-stroke-subtle/50 dark:border-stroke/5`},[S(`td`,ql,[S(`span`,Jl,t(e.name),1)]),S(`td`,Yl,[S(`span`,Xl,t(e.row_count.toLocaleString()),1)]),S(`td`,Zl,[e.has_timestamp&&e.row_count>0?(h(),C(`span`,Ql,[b(t(v(K)(e.oldest_timestamp))+` — `+t(v(K)(e.newest_timestamp))+` `,1),S(`span`,$l,`(`+t(O(e.oldest_timestamp,e.newest_timestamp))+`d)`,1)])):e.row_count===0?(h(),C(`span`,eu,`—`)):(h(),C(`span`,tu,`n/a`))]),S(`td`,nu,[i.value&&D(e.name)&&e.row_count>0?(h(),C(`button`,{key:0,onClick:t=>A(e.name,e.row_count),disabled:c.value[e.name],class:`px-2.5 py-1 bg-red-500/10 dark:bg-red-400/10 hover:bg-red-500/20 dark:hover:bg-red-400/20 text-red-700 dark:text-red-400 rounded border border-red-500/30 dark:border-red-400/20 transition-colors text-xs disabled:opacity-50`},[c.value[e.name]?(h(),C(`span`,iu,[_(V,{size:`xs`,color:`current`,class:`inline-block`}),n[13]||=b(` Purging… `,-1)])):(h(),C(`span`,au,`Empty`))],8,ru)):D(e.name)?g(``,!0):(h(),C(`span`,ou,`—`))])]))),128))])])])])):g(``,!0)]),(h(),u(p,{to:`body`},[d.value?(h(),C(`div`,{key:0,class:`modal-backdrop-heavy`,onClick:n[3]||=M(e=>!d.value.executing&&(d.value=null),[`self`])},[S(`div`,{class:`modal-card max-w-lg`,onClick:n[2]||=M(()=>{},[`stop`])},[S(`div`,su,[n[20]||=S(`div`,{class:`flex-shrink-0 w-10 h-10 rounded-full bg-red-500/15 flex items-center justify-center`},[S(`svg`,{class:`w-5 h-5 text-red-500 dark:text-red-400`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`div`,cu,[S(`h3`,lu,t(d.value.table===`all`?`Purge All Tables`:`Purge "${d.value.table}"`),1),S(`p`,uu,[d.value.table===`all`?(h(),C(x,{key:0},[n[15]||=b(` This will permanently delete `,-1),n[16]||=S(`strong`,{class:`text-content-primary dark:text-content-primary`},`all data`,-1),b(` from every data table (`+t(E.value.toLocaleString())+` rows total). This cannot be undone. `,1)],64)):(h(),C(x,{key:1},[n[17]||=b(` This will permanently delete `,-1),S(`strong`,du,t(d.value.rowCount.toLocaleString())+` rows`,1),n[18]||=b(` from `,-1),S(`strong`,fu,t(d.value.table),1),n[19]||=b(`. This cannot be undone. `,-1)],64))])])]),S(`div`,pu,[S(`button`,{onClick:n[1]||=e=>d.value=null,disabled:d.value.executing,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 `,8,mu),S(`button`,{onClick:j,disabled:d.value.executing,class:`flex-1 px-4 py-3 bg-red-500/20 hover:bg-red-500/30 border border-red-500/50 text-red-600 dark:text-red-400 rounded-lg transition-colors font-medium disabled:opacity-50`},t(d.value.executing?`Purging…`:`Yes, Delete Data`),9,hu)])])])):g(``,!0)])),S(`div`,gu,[n[23]||=S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-4`},` Maintenance `,-1),S(`div`,_u,[S(`button`,{onClick:n[4]||=e=>A(`all`,E.value),disabled:!s.value||E.value===0||!i.value,class:`px-4 py-2 bg-red-500/20 dark:bg-red-400/20 hover:bg-red-500/30 dark:hover:bg-red-400/30 text-red-900 dark:text-red-200 rounded-lg border border-red-500/50 dark:border-red-400/40 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed`},[...n[21]||=[S(`span`,{class:`flex items-center gap-2`},[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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`})]),b(` Purge All Data `)],-1)]],8,vu),S(`button`,{onClick:N,disabled:w.value||!s.value,class:`cfg-btn-primary`},[S(`span`,bu,[n[22]||=S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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`})],-1),b(` `+t(w.value?`Compacting…`:`Compact Database`),1)])],8,yu)]),T.value?(h(),C(`p`,xu,t(T.value),1)):g(``,!0),f.value?(h(),C(`p`,Su,t(f.value),1)):g(``,!0)])]))}}),wu={class:`space-y-12`},Tu={class:`cfg-section`},Eu={class:`flex items-start justify-between mb-4`},Du={class:`flex items-center gap-2`},Ou=[`disabled`],ku={key:0,class:`flex items-center gap-1.5`},Au={key:1},ju=[`disabled`],Mu={key:0,class:`flex items-center gap-1.5`},Nu={key:1},Pu={key:0,class:`mb-4 p-3 rounded-lg bg-red-500/10 border border-red-500/30 text-red-600 dark:text-red-400 text-sm`},Fu={key:1,class:`mb-4`},Iu={class:`bg-background-mute dark:bg-background/30 rounded-lg p-3 border border-stroke-subtle dark:border-stroke/10 inline-block`},Lu={class:`text-lg font-semibold text-content-primary dark:text-content-primary font-mono`},Ru={key:2,class:`p-4 rounded-lg bg-cyan-500/10 dark:bg-primary/10 border border-cyan-400/30 dark:border-primary/30`},zu={key:3},Bu=[`innerHTML`],Vu={class:`font-semibold text-sm`},Hu={class:`text-sm mt-0.5 opacity-80`},Uu={class:`grid grid-cols-2 sm:grid-cols-3 gap-3 mb-6`},Wu={key:0,class:`bg-background-mute dark:bg-background/30 rounded-lg p-3 border border-stroke-subtle dark:border-stroke/10`},Gu={class:`text-lg font-semibold text-content-primary dark:text-content-primary font-mono`},Ku={key:1,class:`bg-background-mute dark:bg-background/30 rounded-lg p-3 border border-stroke-subtle dark:border-stroke/10`},qu={class:`text-lg font-semibold text-content-primary dark:text-content-primary font-mono`},Ju={key:2,class:`bg-background-mute dark:bg-background/30 rounded-lg p-3 border border-stroke-subtle dark:border-stroke/10`},Yu={class:`text-lg font-semibold text-content-primary dark:text-content-primary font-mono`},Xu={key:0,class:`mb-6`},Zu={class:`space-y-2`},Qu={class:`flex items-start justify-between gap-3`},$u={class:`flex items-center gap-2 min-w-0`},ed={class:`shrink-0 text-xs font-medium text-content-muted w-5 text-right`},td={class:`text-right shrink-0`},nd={class:`text-xs text-content-muted`},rd={class:`mt-1.5 ml-7`},id={class:`text-xs font-mono text-content-secondary dark:text-content-muted break-all`},ad={key:0,class:`text-xs text-content-muted mt-0.5`},od={key:1,class:`mb-6 p-4 rounded-lg bg-green-500/10 border border-green-500/30 text-sm flex items-center gap-3`},sd={key:2},cd={key:0,class:`overflow-x-auto rounded-lg border border-stroke-subtle dark:border-stroke/10`},ld={class:`w-full text-sm`},ud={class:`px-3 py-2 text-content-muted font-mono text-xs`},dd={class:`px-3 py-2 text-content-primary dark:text-content-primary font-mono text-xs break-all`},fd={class:`px-3 py-2 text-right font-mono text-xs text-content-secondary dark:text-content-muted whitespace-nowrap`},pd={class:`px-3 py-2 text-right font-mono text-xs text-content-secondary dark:text-content-muted`},md={key:4,class:`py-8 text-center text-content-muted text-sm`},hd=B(f({__name:`MemoryDebug`,setup(n){let i=l(!1),a=l(!1),o=l(``),s=l(null),c=l(!1),u=l(null),f=l(!1),p=y(()=>s.value&&(s.value.current_top_20||s.value.growth_since_baseline));async function v(){i.value=!0,o.value=``;try{let e=await I.get(`memory_debug`);e.success&&e.data?(c.value=!!e.data.tracing,u.value=e.data.rss_mb??null,(e.data.current_top_20||e.data.growth_since_baseline)&&(s.value=e.data)):o.value=e.error||`Failed to fetch memory status`}catch(e){o.value=e instanceof Error?e.message:`Failed to fetch memory status`}finally{i.value=!1}}async function w(){a.value=!0,o.value=``;let e=c.value?`stop`:`start`;try{let t=await I.post(`memory_debug`,{action:e});t.success&&t.data?(c.value=!!t.data.tracing,e===`stop`&&(s.value=null,u.value=null)):o.value=t.error||`Failed to ${e} tracing`}catch(t){o.value=t instanceof Error?t.message:`Failed to ${e} tracing`}finally{a.value=!1,c.value&&await v()}}function E(e){return e.size_diff_kb>=100?`critical`:e.size_diff_kb>=10?`warning`:e.size_diff_kb>=1?`low`:`ok`}function D(e){let t=E(e);return t===`critical`?`Investigate`:t===`warning`?`Watch`:t===`low`?`Minor`:`Normal`}function O(e){let t=E(e);return t===`critical`?`bg-red-500/20 text-red-700 dark:text-red-400 border border-red-500/30`:t===`warning`?`bg-amber-500/20 text-amber-700 dark:text-amber-400 border border-amber-500/30`:t===`low`?`bg-blue-500/15 text-blue-600 dark:text-blue-400 border border-blue-500/20`:`bg-green-500/15 text-green-700 dark:text-green-400 border border-green-500/20`}function k(e){let t=E(e);return t===`critical`?`border-red-500/40 dark:border-red-500/30 bg-red-500/5 dark:bg-red-500/5`:t===`warning`?`border-amber-500/40 dark:border-amber-500/30 bg-amber-500/5 dark:bg-amber-500/5`:t===`low`?`border-stroke-subtle dark:border-stroke/10 bg-background-mute/50 dark:bg-background/20`:`border-stroke-subtle/50 dark:border-stroke/5 bg-background-mute/30 dark:bg-background/10 opacity-60`}function A(e){let t=E(e);return t===`critical`?`text-red-600 dark:text-red-400`:t===`warning`?`text-amber-600 dark:text-amber-400`:t===`low`?`text-blue-600 dark:text-blue-400`:`text-green-600 dark:text-green-500`}function M(e){return e>=1024?`${(e/1024).toFixed(1)} MB`:e>=10?`${Math.round(e)} KB`:`${e.toFixed(1)} KB`}function N(e){return e.replace(/.*\/site-packages\//,``).replace(/.*\/lib\/python[^/]*\//,``).replace(/.*\/repeater\//,`repeater/`)}let P=y(()=>s.value?.growth_since_baseline?s.value.growth_since_baseline.reduce((e,t)=>e+t.size_diff_kb,0):0),F=y(()=>P.value>=500?`critical`:P.value>=50?`warning`:P.value>=5?`low`:`ok`),L=y(()=>{let e=F.value;return e===`critical`?`border-red-500/40 dark:border-red-500/30 bg-red-500/10 dark:bg-red-500/10 text-red-800 dark:text-red-300`:e===`warning`?`border-amber-500/40 dark:border-amber-500/30 bg-amber-500/10 dark:bg-amber-500/10 text-amber-800 dark:text-amber-300`:e===`low`?`border-blue-500/30 bg-blue-500/10 dark:bg-blue-500/10 text-blue-800 dark:text-blue-300`:`border-green-500/30 bg-green-500/10 dark:bg-green-500/10 text-green-800 dark:text-green-300`}),R=y(()=>{let e=F.value;return e===`critical`?``:e===`warning`?``:e===`low`?``:``}),ee=y(()=>{let e=F.value;return e===`critical`?`Significant memory growth detected`:e===`warning`?`Some memory growth detected`:e===`low`?`Minor memory growth — likely normal`:`Memory looks healthy`}),z=y(()=>{let e=M(P.value),t=F.value;return t===`critical`?`Total growth: ${e}. Red items below need attention.`:t===`warning`?`Total growth: ${e}. Orange items below may need attention over time.`:t===`low`?`Total growth: ${e}. Nothing to worry about right now.`:`No significant growth since tracing started.`});return r(v),(n,r)=>(h(),C(`div`,wu,[r[15]||=S(`div`,{class:`cfg-page-heading flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3`},[S(`div`,null,[S(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2`},`Memory`),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Diagnose memory usage and trace allocations`)])],-1),S(`div`,Tu,[S(`div`,Eu,[r[2]||=S(`div`,null,[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},` Memory Diagnostics `),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},` Trace memory allocations to find leaks. Tracing adds overhead — only enable when needed. `)],-1),S(`div`,Du,[c.value&&p.value?(h(),C(`button`,{key:0,onClick:v,disabled:i.value,class:`cfg-btn-secondary`},[i.value?(h(),C(`span`,ku,[_(V,{size:`xs`,color:`current`,class:`inline-block`}),r[1]||=b(` Checking… `,-1)])):(h(),C(`span`,Au,`Check Again`))],8,Ou)):g(``,!0),S(`button`,{onClick:w,disabled:a.value,class:T([`px-3 py-1.5 rounded-lg border text-sm transition-colors disabled:opacity-50`,c.value?`bg-red-500/20 hover:bg-red-500/30 text-red-700 dark:text-red-400 border-red-500/50`:`bg-green-500/20 hover:bg-green-500/30 text-green-700 dark:text-green-400 border-green-500/50`])},[a.value?(h(),C(`span`,Mu,[_(V,{size:`xs`,color:`current`,class:`inline-block`}),b(` `+t(c.value?`Stopping…`:`Starting…`),1)])):(h(),C(`span`,Nu,t(c.value?`Stop Tracing`:`Start Tracing`),1))],10,ju)])]),o.value?(h(),C(`div`,Pu,t(o.value),1)):g(``,!0),!c.value&&u.value!==null&&!i.value?(h(),C(`div`,Fu,[S(`div`,Iu,[r[3]||=S(`p`,{class:`text-xs text-content-muted mb-1`},`Current Memory (RSS)`,-1),S(`p`,Lu,t(u.value)+` MB`,1)])])):g(``,!0),c.value&&!p.value&&!i.value?(h(),C(`div`,Ru,[...r[4]||=[d(`
Tracing active

Memory tracing is running. Let the repeater run for a few minutes, then click Check Again to see which parts of the code are using more memory.

`,2)]])):g(``,!0),s.value&&p.value?(h(),C(`div`,zu,[S(`div`,{class:T([`mb-5 p-4 rounded-lg border flex items-start gap-3`,L.value])},[S(`div`,{class:`mt-0.5`,innerHTML:R.value},null,8,Bu),S(`div`,null,[S(`p`,Vu,t(ee.value),1),S(`p`,Hu,t(z.value),1)])],2),S(`div`,Uu,[s.value.rss_mb===void 0?g(``,!0):(h(),C(`div`,Wu,[r[5]||=S(`p`,{class:`text-xs text-content-muted mb-1`},`Total Memory Used`,-1),S(`p`,Gu,t(s.value.rss_mb)+` MB`,1)])),s.value.traced_current_mb===void 0?g(``,!0):(h(),C(`div`,Ku,[r[6]||=S(`p`,{class:`text-xs text-content-muted mb-1`},`Tracked Now`,-1),S(`p`,qu,t(s.value.traced_current_mb)+` MB`,1)])),s.value.traced_peak_mb===void 0?g(``,!0):(h(),C(`div`,Ju,[r[7]||=S(`p`,{class:`text-xs text-content-muted mb-1`},`Peak Tracked`,-1),S(`p`,Yu,t(s.value.traced_peak_mb)+` MB`,1)]))]),s.value.growth_since_baseline&&s.value.growth_since_baseline.length>0?(h(),C(`div`,Xu,[r[8]||=S(`h4`,{class:`text-sm font-semibold text-content-primary dark:text-content-primary mb-1`},`Memory Growth Breakdown`,-1),r[9]||=S(`p`,{class:`text-xs text-content-muted mb-3`},` Items at the top with red/orange tags are the most likely cause of memory issues. Green items are normal and can be ignored. `,-1),S(`div`,Zu,[(h(!0),C(x,null,m(s.value.growth_since_baseline,(e,n)=>(h(),C(`div`,{key:n,class:T([`rounded-lg border p-3 transition-colors`,k(e)])},[S(`div`,Qu,[S(`div`,$u,[S(`span`,ed,t(n+1),1),S(`span`,{class:T([`shrink-0 inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-semibold`,O(e)])},t(D(e)),3)]),S(`div`,td,[S(`span`,{class:T([`font-mono text-sm font-semibold`,A(e)])},`+`+t(M(e.size_diff_kb)),3),S(`p`,nd,t(M(e.current_size_kb))+` total`,1)])]),S(`div`,rd,[S(`p`,id,t(N(e.file)),1),e.count_diff===0?g(``,!0):(h(),C(`p`,ad,t(e.count_diff>0?`+`:``)+t(e.count_diff)+` new allocation`+t(Math.abs(e.count_diff)===1?``:`s`),1))])],2))),128))])])):s.value.growth_since_baseline&&s.value.growth_since_baseline.length===0?(h(),C(`div`,od,[...r[10]||=[S(`svg`,{class:`w-5 h-5 text-green-600 dark:text-green-400 shrink-0`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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`})],-1),S(`span`,{class:`text-green-700 dark:text-green-400`},`No memory growth detected. Everything looks healthy.`,-1)]])):g(``,!0),s.value.current_top_20&&s.value.current_top_20.length>0?(h(),C(`div`,sd,[S(`button`,{onClick:r[0]||=e=>f.value=!f.value,class:`flex items-center gap-2 text-sm font-semibold text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors mb-3`},[(h(),C(`svg`,{class:T([`w-4 h-4 transition-transform`,{"rotate-90":f.value}]),fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[...r[11]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M9 5l7 7-7 7`},null,-1)]],2)),r[12]||=b(` Advanced: Current Top Allocations `,-1)]),_(j,{name:`expand`},{default:e(()=>[f.value?(h(),C(`div`,cd,[S(`table`,ld,[r[13]||=S(`thead`,null,[S(`tr`,{class:`bg-background-mute dark:bg-background/30 text-left`},[S(`th`,{class:`px-3 py-2 text-xs font-medium text-content-muted`},`#`),S(`th`,{class:`px-3 py-2 text-xs font-medium text-content-muted`},`Location`),S(`th`,{class:`px-3 py-2 text-xs font-medium text-content-muted text-right`},`Size`),S(`th`,{class:`px-3 py-2 text-xs font-medium text-content-muted text-right`},`Count`)])],-1),S(`tbody`,null,[(h(!0),C(x,null,m(s.value.current_top_20,(e,n)=>(h(),C(`tr`,{key:n,class:`border-t border-stroke-subtle/50 dark:border-stroke/5 hover:bg-background-mute/50 dark:hover:bg-background/20 transition-colors`},[S(`td`,ud,t(n+1),1),S(`td`,dd,t(N(e.file)),1),S(`td`,fd,t(M(e.size_kb)),1),S(`td`,pd,t(e.count),1)]))),128))])])])):g(``,!0)]),_:1})])):g(``,!0)])):g(``,!0),!i.value&&!a.value&&!c.value&&!p.value&&!o.value&&u.value===null?(h(),C(`div`,md,[...r[14]||=[b(` Click `,-1),S(`strong`,null,`Start Tracing`,-1),b(` to enable memory diagnostics. `,-1),S(`br`,null,null,-1),S(`span`,{class:`text-xs`},`Tracing uses extra memory — remember to stop it when done.`,-1)]])):g(``,!0)])]))}}),[[`__scopeId`,`data-v-00e540ed`]]),gd={class:`p-3 sm:p-6 space-y-4 sm:space-y-6`},_d={class:`flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3`},vd={class:`glass-card rounded-[15px] p-3 sm:p-6 mt-4 sm:mt-6`},yd={class:`relative -mx-3 sm:mx-0 mb-4 sm:mb-6`},bd={key:0,class:`absolute left-0 top-0 bottom-[1px] w-12 z-10 flex items-center`},xd={key:0,class:`absolute right-0 top-0 bottom-[1px] w-12 z-10 flex items-center justify-end`},Sd=[`onClick`],Cd={class:`flex items-center gap-1 sm:gap-2`},wd={key:0,class:`w-3.5 h-3.5 sm:w-4 sm:h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Td={key:1,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Ed={key:2,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Dd={key:3,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Od={key:4,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},kd={key:5,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Ad={key:6,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},jd={key:7,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Md={key:8,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Nd={key:9,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Pd={key:10,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Fd={key:11,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Id={class:`min-h-[400px]`},Ld={key:0,class:`flex items-center justify-center py-12`},Rd={class:`text-center`},zd={key:1,class:`flex items-center justify-center py-12`},Bd={class:`text-center`},Vd={class:`text-content-secondary dark:text-content-muted text-sm mb-4`},Hd={key:2},Ud={key:0},Wd={key:1},Gd={key:2},Kd={key:3},qd={key:4},Jd={key:5},Yd={key:6},Xd={key:7},Zd={key:8},Qd={key:9},$d={key:10},ef={key:11},tf=B(f({name:`ConfigurationView`,__name:`Configuration`,setup(n){let i=ee(),c=z(),d=l(ne(`configuration_activeTab`,`radio`)),f=l(!1),p=l(null),y=l(!1),w=l(!1),E=l(null),D=l(null),O=l(null),k=l(null),A=l(null),M=l(null),N=l(null),P={radio:E,repeater:D,advert:O,duty:k,delays:A,transport:M,observer:N};function F(){let e=P[d.value]?.value;if(!e)return!1;let t=e.isEditing;return typeof t==`boolean`?t:t.value}function I(e){let t=P[d.value]?.value;t?t.requestLeave(e):e()}function L(){if(!p.value)return;let e=p.value;w.value=e.scrollLeft>4,y.value=e.scrollLeftJ(`configuration_activeTab`,e));let B=[{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:`Region Configuration`,icon:`keys`},{id:`api-tokens`,label:`API Tokens`,icon:`tokens`},{id:`web`,label:`Web Options`,icon:`web`},{id:`observer`,label:`Observer`,icon:`observer`},{id:`backup`,label:`Backup`,icon:`backup`},{id:`database`,label:`Database`,icon:`database`},{id:`memory`,label:`Memory`,icon:`memory`}];r(async()=>{if(i.stats)f.value=!0;else try{await c.ensure(`stats`)}catch(e){console.error(`Failed to load configuration data:`,e)}finally{f.value=!0}s(()=>L())});function te(e){if(e!==d.value&&F()){I(()=>{d.value=e});return}d.value=e}return(n,r)=>{let o=a(`router-link`);return h(),C(`div`,gd,[S(`div`,_d,[r[4]||=S(`div`,null,[S(`h1`,{class:`text-xl sm:text-2xl font-bold text-content-primary dark:text-content-primary`},` Configuration `),S(`p`,{class:`text-content-secondary dark:text-content-muted mt-1 sm:mt-2 text-sm sm:text-base`},` System configuration and settings `)],-1),f.value&&!(v(i).stats?.config?.radio)?.cad?.peak_threshold?(h(),u(o,{key:0,to:`/cad-calibration`,class:`flex-shrink-0 flex items-center gap-4 px-5 py-3 min-w-[280px] rounded-xl border border-primary/30 bg-primary/10 text-primary hover:bg-primary/20 transition-colors`},{default:e(()=>[...r[3]||=[S(`svg`,{class:`w-5 h-5 flex-shrink-0`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M13 10V3L4 14h7v7l9-11h-7z`})],-1),S(`div`,null,[S(`div`,{class:`text-sm font-semibold`},`CAD Calibration Available`),S(`div`,{class:`text-xs text-primary/70`},`Optimise CAD settings →`)],-1)]]),_:1})):g(``,!0)]),S(`div`,vd,[S(`div`,yd,[_(j,{name:`tab-fade`},{default:e(()=>[w.value?(h(),C(`div`,bd,[r[6]||=S(`div`,{class:`tab-fade-left absolute inset-0 pointer-events-none`},null,-1),S(`button`,{onClick:r[0]||=e=>R(`left`),class:`relative z-10 ml-1.5 w-6 h-6 flex items-center justify-center rounded-full bg-surface shadow-md border border-stroke-subtle dark:border-stroke/30 text-content-muted`},[...r[5]||=[S(`svg`,{class:`w-3 h-3`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2.5`,d:`M15 19l-7-7 7-7`})],-1)]])])):g(``,!0)]),_:1}),_(j,{name:`tab-fade`},{default:e(()=>[y.value?(h(),C(`div`,xd,[r[8]||=S(`div`,{class:`tab-fade-right absolute inset-0 pointer-events-none`},null,-1),S(`button`,{onClick:r[1]||=e=>R(`right`),class:`relative z-10 mr-1.5 w-6 h-6 flex items-center justify-center rounded-full bg-surface shadow-md border border-stroke-subtle dark:border-stroke/30 text-content-muted`},[...r[7]||=[S(`svg`,{class:`w-3 h-3`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2.5`,d:`M9 5l7 7-7 7`})],-1)]])])):g(``,!0)]),_:1}),S(`div`,{ref_key:`tabsContainer`,ref:p,onScroll:L,class:`flex overflow-x-auto border-b border-stroke-subtle dark:border-stroke px-3 sm:px-0 scrollbar-hide`},[(h(),C(x,null,m(B,e=>S(`button`,{key:e.id,onClick:t=>te(e.id),class:T([`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`,d.value===e.id?`text-primary 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`])},[S(`div`,Cd,[e.icon===`radio`?(h(),C(`svg`,wd,[...r[9]||=[S(`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)]])):e.icon===`repeater`?(h(),C(`svg`,Td,[...r[10]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M5 12h14M5 12l4-4m-4 4l4 4`},null,-1)]])):e.icon===`advert`?(h(),C(`svg`,Ed,[...r[11]||=[S(`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)]])):e.icon===`duty`?(h(),C(`svg`,Dd,[...r[12]||=[S(`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)]])):e.icon===`delays`?(h(),C(`svg`,Od,[...r[13]||=[S(`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)]])):e.icon===`keys`?(h(),C(`svg`,kd,[...r[14]||=[S(`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.icon===`tokens`?(h(),C(`svg`,Ad,[...r[15]||=[S(`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)]])):e.icon===`web`?(h(),C(`svg`,jd,[...r[16]||=[S(`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)]])):e.icon===`observer`?(h(),C(`svg`,Md,[...r[17]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M3.055 11H5a2 2 0 012 2v1a2 2 0 002 2 2 2 0 012 2v2.945M8 3.935V5.5A2.5 2.5 0 0010.5 8h.5a2 2 0 012 2 2 2 0 104 0 2 2 0 012-2h1.064M15 20.488V18a2 2 0 012-2h3.064M21 12a9 9 0 11-18 0 9 9 0 0118 0z`},null,-1)]])):e.icon===`backup`?(h(),C(`svg`,Nd,[...r[18]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4`},null,-1)]])):e.icon===`database`?(h(),C(`svg`,Pd,[...r[19]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4`},null,-1)]])):e.icon===`memory`?(h(),C(`svg`,Fd,[...r[20]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z`},null,-1)]])):g(``,!0),b(` `+t(e.label),1)])],10,Sd)),64))],544)]),S(`div`,Id,[!f.value&&v(i).isLoading?(h(),C(`div`,Ld,[S(`div`,Rd,[_(V,{class:`mx-auto mb-4`}),r[21]||=S(`div`,{class:`text-content-secondary dark:text-content-muted`},` Loading configuration... `,-1)])])):f.value&&!v(i).stats?(h(),C(`div`,zd,[S(`div`,Bd,[r[22]||=S(`div`,{class:`text-accent-red mb-2`},`Failed to load configuration`,-1),S(`div`,Vd,t(v(i).error),1),S(`button`,{onClick:r[2]||=e=>v(i).fetchStats(),class:`btn-primary`},` Retry `)])])):(h(),C(`div`,Hd,[d.value===`radio`?(h(),C(`div`,Ud,[_(Ve,{ref_key:`radioRef`,ref:E,key:`radio-settings`},null,512)])):g(``,!0),d.value===`repeater`?(h(),C(`div`,Wd,[_(Vt,{ref_key:`repeaterRef`,ref:D,key:`repeater-settings`},null,512)])):g(``,!0),d.value===`advert`?(h(),C(`div`,Gd,[_(qo,{ref_key:`advertRef`,ref:O,key:`advert-settings`},null,512)])):g(``,!0),d.value===`duty`?(h(),C(`div`,Kd,[_(tn,{ref_key:`dutyRef`,ref:k,key:`duty-cycle`},null,512)])):g(``,!0),d.value===`delays`?(h(),C(`div`,qd,[_(hn,{ref_key:`delaysRef`,ref:A,key:`transmission-delays`},null,512)])):g(``,!0),d.value===`transport`?(h(),C(`div`,Jd,[_(Pi,{ref_key:`transportRef`,ref:M,key:`transport-keys`},null,512)])):g(``,!0),d.value===`api-tokens`?(h(),C(`div`,Yd,[_(la,{key:`api-tokens`})])):g(``,!0),d.value===`web`?(h(),C(`div`,Xd,[_(Pa,{key:`web-settings`})])):g(``,!0),d.value===`observer`?(h(),C(`div`,Zd,[_(gc,{ref_key:`letsMeshRef`,ref:N,key:`letsmesh-settings`},null,512)])):g(``,!0),d.value===`backup`?(h(),C(`div`,Qd,[_(Sl,{key:`backup-restore`})])):g(``,!0),d.value===`database`?(h(),C(`div`,$d,[_(Cu,{key:`database-management`})])):g(``,!0),d.value===`memory`?(h(),C(`div`,ef,[_(hd,{key:`memory-debug`})])):g(``,!0)]))])])])}}}),[[`__scopeId`,`data-v-aef8d875`]]);export{tf as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/Configuration-D5-XdhcR.js b/repeater/web/html/assets/Configuration-D5-XdhcR.js deleted file mode 100644 index 3038eaf..0000000 --- a/repeater/web/html/assets/Configuration-D5-XdhcR.js +++ /dev/null @@ -1 +0,0 @@ -import{B as e,Ct as t,D as n,E as r,J as i,N as a,R as o,S as s,V as c,Y as l,c as u,f as d,g as f,i as p,j as m,k as h,l as g,m as _,nt as v,o as y,p as b,r as x,s as S,u as C,w,xt as T,z as E}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{n as D,r as O}from"./pinia-DP0dFoGY.js";import{g as k,m as A,r as j,t as M}from"./api-DBiYn0RS.js";import{t as N}from"./system-BfTzQTOF.js";import{t as P}from"./dataService-KNFTsxUb.js";import{t as F}from"./_plugin-vue_export-helper-TcpyXLsZ.js";import{t as I}from"./Spinner-CYvUNW0P.js";import{d as L,f as R,g as z,h as B,l as V,p as H}from"./index-CG181k2K.js";import{t as ee}from"./RestartModal-DDp7H13-.js";import{t as U}from"./ConfirmDialog-DZJrcPub.js";import{t as W}from"./LocationPicker-B5L5Ju6J.js";import{c as G,d as K,n as q,t as J}from"./formatters-Cc4UJmeb.js";import{n as te,t as ne}from"./preferences-6MHglq--.js";var re={key:0,class:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`},Y={class:`modal-card max-w-md`},X={class:`flex items-start gap-3 mb-4`},Z={class:`mt-1 text-sm text-content-secondary dark:text-content-muted`},Q={class:`modal-actions`},$=[`disabled`],ie=[`disabled`],ae=[`disabled`],oe=f({__name:`UnsavedChangesModal`,props:{show:{type:Boolean},isSaving:{type:Boolean},label:{}},emits:[`discard`,`save`,`cancel`],setup(n){return(r,i)=>(h(),u(p,{to:`body`},[_(V,{"enter-active-class":`transition-opacity duration-200`,"enter-from-class":`opacity-0`,"leave-active-class":`transition-opacity duration-200`,"leave-to-class":`opacity-0`},{default:e(()=>[n.show?(h(),C(`div`,re,[S(`div`,Y,[S(`div`,X,[i[4]||=S(`div`,{class:`flex-shrink-0 w-10 h-10 rounded-full bg-amber-100 dark:bg-amber-900/30 flex items-center justify-center`},[S(`svg`,{class:`w-5 h-5 text-amber-600 dark:text-amber-400`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 9v2m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z`})])],-1),S(`div`,null,[i[3]||=S(`h3`,{class:`text-base font-semibold text-content-primary dark:text-content-primary`},` Unsaved Changes `,-1),S(`p`,Z,t(n.label?n.label:`Settings`)+` have not been saved. What would you like to do? `,1)])]),S(`div`,Q,[S(`button`,{onClick:i[0]||=e=>r.$emit(`cancel`),disabled:n.isSaving,class:`modal-btn-cancel`},` Keep Editing `,8,$),S(`button`,{onClick:i[1]||=e=>r.$emit(`discard`),disabled:n.isSaving,class:`modal-btn-danger`},` Discard `,8,ie),S(`button`,{onClick:i[2]||=e=>r.$emit(`save`),disabled:n.isSaving,class:`modal-btn-primary`},t(n.isSaving?`Saving…`:`Save Settings`),9,ae)])])])):g(``,!0)]),_:1})]))}});function se(e,t,n,r){let i=l(!1),a=l(null),o=l(null);A((t,n,r)=>{e.value?(i.value=!0,a.value=()=>r(),o.value=()=>r(!1)):r()});function s(t){e.value?(i.value=!0,a.value=t,o.value=null):t()}function c(){n(),i.value=!1,o.value=null,a.value&&=(a.value(),null)}async function u(){await r()&&(i.value=!1,o.value=null,a.value&&=(a.value(),null))}function d(){i.value=!1,o.value&&=(o.value(),null),a.value=null}return{showUnsavedModal:i,requestLeave:s,handleDiscard:c,handleSave:u,handleCancel:d}}var ce={class:`space-y-12`},le={class:`cfg-page-heading flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3`},ue={class:`flex items-center gap-2 flex-shrink-0`},de=[`disabled`],fe=[`disabled`],pe={key:0,class:`bg-red-100 dark:bg-red-500/20 border border-red-500/50 rounded-lg p-3`},me={class:`text-red-600 dark:text-red-400 text-sm`},he={class:`cfg-section space-y-3`},ge={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`},_e={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},ve={key:1,class:`flex items-center gap-2`},ye={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`},be={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},xe={key:1},Se=[`value`],Ce={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`},we={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},Te={key:1},Ee=[`value`],De={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`},Oe={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},ke={key:1,class:`flex items-center gap-2`},Ae={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`},je={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},Me={key:1},Ne={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1`},Pe={class:`text-content-primary dark:text-content-primary font-mono text-sm`},Fe={class:`cfg-section space-y-3`},Ie={class:`flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3`},Le={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`},Re={class:`text-content-primary dark:text-content-primary font-mono text-sm`},ze={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1`},Be={class:`text-content-primary dark:text-content-primary font-mono text-sm`},Ve=f({__name:`RadioSettings`,setup(e,{expose:n}){let r=k(),i=N(),a=y(()=>i.stats?.config?.radio||{}),s=y(()=>i.stats?.config?.radio?.cad??{}),u=l(!1),d=l(!1),f=l(null),p=l(!1),b=l(0),w=l(0),T=l(0),E=l(0),D=l(0),O=l(0),A=[{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`}];o(a,e=>{e&&!u.value&&(b.value=e.frequency?Number((e.frequency/1e6).toFixed(3)):0,w.value=e.spreading_factor??0,T.value=e.bandwidth?Number((e.bandwidth/1e3).toFixed(1)):0,E.value=e.tx_power??0,D.value=e.coding_rate??0,O.value=e.preamble_length??0)},{immediate:!0});let j=y(()=>{let e=a.value.frequency;return e?(e/1e6).toFixed(3)+` MHz`:`Not set`}),P=y(()=>{let e=a.value.bandwidth;return e?(e/1e3).toFixed(1)+` kHz`:`Not set`}),F=y(()=>{let e=a.value.tx_power;return e===void 0?`Not set`:e+` dBm`}),I=y(()=>{let e=a.value.coding_rate;return e?`4/`+e:`Not set`}),L=y(()=>{let e=a.value.preamble_length;return e?e+` symbols`:`Not set`}),z=y(()=>a.value.spreading_factor??`Not set`),B=()=>{u.value=!0,f.value=null},V=()=>{u.value=!1,f.value=null;let e=a.value;b.value=e.frequency?Number((e.frequency/1e6).toFixed(3)):0,w.value=e.spreading_factor??0,T.value=e.bandwidth?Number((e.bandwidth/1e3).toFixed(1)):0,E.value=e.tx_power??0,D.value=e.coding_rate??0,O.value=e.preamble_length??0},U=async({silent:e=!1}={})=>{d.value=!0,f.value=null;try{let t={};b.value&&(t.frequency=b.value*1e6),w.value&&(t.spreading_factor=w.value),T.value&&(t.bandwidth=T.value*1e3),E.value&&(t.tx_power=E.value),D.value&&(t.coding_rate=D.value);let n=(await M.post(`/update_radio_config`,t)).data;if(n.message||n.persisted)return u.value=!1,await i.fetchStats(),e||(p.value=!0),!0;n.error?f.value=n.error:f.value=`Unknown response from server`}catch(e){console.error(`Failed to update radio settings:`,e),f.value=e.response?.data?.error||`Failed to update settings`}finally{d.value=!1}return!1},{showUnsavedModal:W,requestLeave:G,handleDiscard:K,handleSave:q,handleCancel:J}=se(u,d,V,()=>U());return n({requestLeave:G,isEditing:u}),(e,n)=>(h(),C(x,null,[_(ee,{modelValue:p.value,"onUpdate:modelValue":n[0]||=e=>p.value=e,title:`Radio Settings Changes require a restart.`,message:`Restart Now?`},null,8,[`modelValue`]),_(oe,{show:v(W),"is-saving":d.value,label:`Radio Settings`,onDiscard:v(K),onSave:v(q),onCancel:v(J)},null,8,[`show`,`is-saving`,`onDiscard`,`onSave`,`onCancel`]),S(`div`,ce,[S(`div`,le,[n[8]||=S(`div`,null,[S(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2`},`Radio Settings`),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Configure LoRa radio parameters and frequency presets`)],-1),S(`div`,ue,[u.value?(h(),C(x,{key:1},[S(`button`,{onClick:V,disabled:d.value,class:`cfg-btn-secondary`},` Cancel `,8,de),S(`button`,{onClick:n[1]||=e=>U(),disabled:d.value,class:`cfg-btn-primary`},t(d.value?`Saving...`:`Save Changes`),9,fe)],64)):(h(),C(`button`,{key:0,onClick:B,class:`cfg-btn-primary`},` Edit Settings `))])]),f.value?(h(),C(`div`,pe,[S(`p`,me,t(f.value),1)])):g(``,!0),S(`div`,he,[S(`div`,ge,[n[10]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Frequency`,-1),u.value?(h(),C(`div`,ve,[c(S(`input`,{"onUpdate:modelValue":n[2]||=e=>b.value=e,type:`number`,step:`0.001`,min:`100`,max:`1000`,class:`cfg-input w-32`},null,512),[[H,b.value,void 0,{number:!0}]]),n[9]||=S(`span`,{class:`text-content-muted dark:text-content-muted text-sm`},`MHz`,-1)])):(h(),C(`div`,_e,t(j.value),1))]),S(`div`,ye,[n[11]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Spreading Factor`,-1),u.value?(h(),C(`div`,xe,[c(S(`select`,{"onUpdate:modelValue":n[3]||=e=>w.value=e,class:`cfg-select`},[(h(),C(x,null,m([5,6,7,8,9,10,11,12],e=>S(`option`,{key:e,value:e},t(e),9,Se)),64))],512),[[R,w.value,void 0,{number:!0}]])])):(h(),C(`div`,be,t(z.value),1))]),S(`div`,Ce,[n[12]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Bandwidth`,-1),u.value?(h(),C(`div`,Te,[c(S(`select`,{"onUpdate:modelValue":n[4]||=e=>T.value=e,class:`cfg-select`},[(h(),C(x,null,m(A,e=>S(`option`,{key:e.value,value:e.value},t(e.label),9,Ee)),64))],512),[[R,T.value,void 0,{number:!0}]])])):(h(),C(`div`,we,t(P.value),1))]),S(`div`,De,[n[14]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`TX Power`,-1),u.value?(h(),C(`div`,ke,[c(S(`input`,{"onUpdate:modelValue":n[5]||=e=>E.value=e,type:`number`,min:`2`,max:`30`,class:`cfg-input w-20`},null,512),[[H,E.value,void 0,{number:!0}]]),n[13]||=S(`span`,{class:`text-content-muted dark:text-content-muted text-sm`},`dBm`,-1)])):(h(),C(`div`,Oe,t(F.value),1))]),S(`div`,Ae,[n[16]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Coding Rate`,-1),u.value?(h(),C(`div`,Me,[c(S(`select`,{"onUpdate:modelValue":n[6]||=e=>D.value=e,class:`cfg-select`},[...n[15]||=[S(`option`,{value:5},`4/5`,-1),S(`option`,{value:6},`4/6`,-1),S(`option`,{value:7},`4/7`,-1),S(`option`,{value:8},`4/8`,-1)]],512),[[R,D.value,void 0,{number:!0}]])])):(h(),C(`div`,je,t(I.value),1))]),S(`div`,Ne,[n[17]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Preamble Length`,-1),S(`span`,Pe,t(L.value),1)])]),S(`div`,Fe,[S(`div`,Ie,[n[18]||=S(`div`,null,[S(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2`},`CAD Calibration`),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Channel Activity Detection: Run Calibration to update`),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm mt-1`},`These settings tune the receivers ability to detect channel status prior to transmission`)],-1),S(`button`,{onClick:n[7]||=e=>v(r).push(`/cad-calibration`),class:`cfg-btn-secondary flex-shrink-0`},` Run Calibration `)]),n[21]||=S(`div`,{class:`pt-2`},null,-1),S(`div`,Le,[n[19]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Peak Threshold`,-1),S(`span`,Re,t(s.value.peak_threshold??`Not calibrated`),1)]),S(`div`,ze,[n[20]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Min Threshold`,-1),S(`span`,Be,t(s.value.min_threshold??`Not calibrated`),1)])])])],64))}}),He={class:`space-y-12`},Ue={class:`cfg-page-heading flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3`},We={class:`flex items-center gap-2 flex-shrink-0`},Ge=[`disabled`],Ke=[`disabled`],qe={key:0,class:`bg-green-100 dark:bg-green-500/10 border border-green-300 dark:border-green-500/30 rounded-lg p-3`},Je={class:`text-green-700 dark:text-green-400 text-sm`},Ye={key:1,class:`bg-red-100 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30 rounded-lg p-3`},Xe={class:`text-red-700 dark:text-red-400 text-sm`},Ze={class:`cfg-section space-y-3`},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`},$e={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm break-all`},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`},tt={class:`text-content-primary dark:text-content-primary font-mono text-xs break-all`},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`},rt={class:`flex items-center gap-2 min-w-0 sm:justify-end`},it={class:`text-content-primary dark:text-content-primary font-mono text-xs break-all sm:text-right min-w-0`},at={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`},ot={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`},ct={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},lt={class:`flex flex-col py-2 gap-2`},ut={class:`flex flex-col sm:flex-row sm:justify-between sm:items-start gap-1`},dt={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm sm:ml-4`},ft={key:1,class:`flex items-center gap-2`},pt={class:`cfg-section space-y-3`},mt={class:`pb-2`},ht={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`},_t={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1`},vt={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},yt={class:`bg-surface dark:bg-surface-elevated border border-stroke-subtle dark:border-stroke/20 rounded-[15px] shadow-2xl w-full max-w-md p-6 space-y-4`},bt={class:`block text-sm font-medium text-content-secondary dark:text-content-muted mb-2`},xt=[`maxlength`,`disabled`],St={key:0,class:`text-red-500 text-xs mt-1`},Ct={key:1,class:`text-content-muted dark:text-content-muted text-xs mt-1`},wt=[`disabled`],Tt={key:0,class:`mt-2 bg-amber-500/10 border border-amber-500/30 rounded-lg p-3`},Et={key:0,class:`flex items-center gap-3 bg-blue-500/10 border border-blue-500/30 rounded-lg p-3`},Dt={class:`text-blue-700 dark:text-blue-400 text-xs font-medium`},Ot={class:`text-blue-600 dark:text-blue-500 text-xs mt-0.5`},kt={key:1,class:`bg-red-500/10 border border-red-500/30 rounded-lg p-3`},At={class:`text-red-600 dark:text-red-400 text-sm`},jt={key:2,class:`bg-green-500/10 border border-green-600/40 dark:border-green-500/30 rounded-lg p-3 space-y-2`},Mt={class:`text-green-600 dark:text-green-400 text-sm font-medium`},Nt={class:`font-mono text-xs break-all text-content-primary dark:text-content-primary`},Pt={key:3,class:`bg-amber-500/10 border border-amber-500/30 rounded-lg p-3`},Ft={class:`flex gap-2 mt-3`},It=[`disabled`],Lt=[`disabled`],Rt={class:`flex justify-end gap-3 mt-6`},zt=[`disabled`],Bt=[`disabled`],Vt=f({__name:`RepeaterSettings`,setup(e,{expose:n}){let r=N(),i=y(()=>r.stats?.config||{}),a=y(()=>i.value.repeater||{}),s=y(()=>r.stats),d=l(!1),f=l(!1),m=l(null),E=l(null),D=l(!1),O=l(``),k=l(0),A=l(0),j=l(0),P=l(1),F=y(()=>i.value.mesh||{});o([i,a,F],()=>{if(!d.value){O.value=i.value.node_name||``,k.value=a.value.latitude||0,A.value=a.value.longitude||0,j.value=a.value.send_advert_interval_hours||0;let e=F.value.path_hash_mode;P.value=e===0||e===1||e===2?e+1:1}},{immediate:!0});let I=y(()=>i.value.node_name||`Not set`),L=y(()=>s.value?.local_hash||`Not available`),B=y(()=>{let e=s.value?.public_key;return!e||e===`Not set`?`Not set`:e}),V=y(()=>{let e=a.value.latitude;return e&&e!==0?e.toFixed(6):`Not set`}),ee=y(()=>{let e=a.value.longitude;return e&&e!==0?e.toFixed(6):`Not set`}),U=y(()=>{let e=a.value.mode;return e?e===`no_tx`?`No TX`:e.charAt(0).toUpperCase()+e.slice(1):`Not set`}),G=y(()=>{let e=a.value.send_advert_interval_hours;return e===void 0?`Not set`:e===0?`Disabled`:e+` hour`+(e===1?``:`s`)}),K=y(()=>{let e=F.value.path_hash_mode;return e===0||e===1||e===2?e+1+(e===0?` byte`:` bytes`):`Not set`}),q=()=>{d.value=!0,m.value=null,E.value=null},J=()=>{d.value=!1,m.value=null,O.value=i.value.node_name||``,k.value=a.value.latitude||0,A.value=a.value.longitude||0,j.value=a.value.send_advert_interval_hours||0;let e=F.value.path_hash_mode;P.value=e===0||e===1||e===2?e+1:1},te=async()=>{f.value=!0,m.value=null,E.value=null;try{let e={};O.value&&(e.node_name=O.value),e.latitude=k.value,e.longitude=A.value,e.flood_advert_interval_hours=j.value,e.path_hash_mode=P.value-1;let t=(await M.post(`/update_radio_config`,e)).data;t.message||t.persisted?(E.value=t.message||`Settings saved successfully`,d.value=!1,await r.fetchStats(),setTimeout(()=>{E.value=null},3e3)):t.error?m.value=t.error:m.value=`Unknown response from server`}catch(e){console.error(`Failed to update repeater settings:`,e),m.value=e.response?.data?.error||`Failed to update settings`}finally{f.value=!1}},ne=()=>{D.value=!0},re=e=>{k.value=e.latitude,A.value=e.longitude},Y=l(!1),X=l(``),Z=l(!1),Q=l(null),$=l(null),ie=l(!1),ae=l(!1),ce=l(!1),le=l(0),ue=null,de=y(()=>ce.value?8:4),fe=y(()=>{let e=X.value.trim();return!e||e.length>de.value?!1:/^[0-9a-fA-F]+$/.test(e)}),pe=y(()=>{let e=X.value.trim().length;return e===0?``:e===1?`Very fast — ~16 attempts on average`:e===2?`Fast — ~256 attempts on average`:e===3?`Moderate — ~4,096 attempts, a few seconds`:e===4?`Slow — ~65,536 attempts, may take 10-30 seconds`:e===5?`Very slow — ~1 million attempts, could take minutes`:e===6?`Extremely slow — ~16 million attempts, could take a very long time`:e===7?`Extreme — ~268 million attempts, may not complete`:`Extreme — ~4 billion attempts, extremely unlikely to complete`}),me=()=>{le.value=0,ue=setInterval(()=>{le.value++},1e3)},he=()=>{ue&&=(clearInterval(ue),null)};w(()=>he());let ge=()=>{X.value=``,Q.value=null,$.value=null,ie.value=!1,ce.value=!1,Y.value=!0},_e=async()=>{Z.value=!0,$.value=null,Q.value=null,me();try{let e=await M.generateVanityKey(X.value.trim());e.success&&e.data?Q.value=e.data:$.value=e.error||`Generation failed`}catch(e){let t=e;$.value=t.response?.data?.error||t.message||`Generation failed`}finally{he(),Z.value=!1}},ve=async()=>{if(Q.value){ae.value=!0,$.value=null;try{let e=await M.generateVanityKey(X.value.trim(),!0);e.success&&e.data?(Q.value=e.data,ie.value=!1,Y.value=!1,E.value=`New identity key applied. Restart the repeater for the change to take effect.`,await r.fetchStats(),setTimeout(()=>{E.value=null},8e3)):$.value=e.error||`Failed to apply key`}catch(e){let t=e;$.value=t.response?.data?.error||t.message||`Failed to apply key`}finally{ae.value=!1}}},{showUnsavedModal:ye,requestLeave:be,handleDiscard:xe,handleSave:Se,handleCancel:Ce}=se(d,f,J,async()=>(await te(),!d.value));return n({requestLeave:be,isEditing:d}),(e,n)=>(h(),C(x,null,[_(oe,{show:v(ye),"is-saving":f.value,label:`Repeater Settings`,onDiscard:v(xe),onSave:v(Se),onCancel:v(Ce)},null,8,[`show`,`is-saving`,`onDiscard`,`onSave`,`onCancel`]),S(`div`,He,[S(`div`,Ue,[n[13]||=S(`div`,null,[S(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2`},`Repeater Settings`),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Configure repeater identity, location, and network settings`)],-1),S(`div`,We,[d.value?(h(),C(x,{key:1},[S(`button`,{onClick:J,disabled:f.value,class:`cfg-btn-secondary`},` Cancel `,8,Ge),S(`button`,{onClick:te,disabled:f.value,class:`cfg-btn-primary`},t(f.value?`Saving...`:`Save Changes`),9,Ke)],64)):(h(),C(`button`,{key:0,onClick:q,class:`cfg-btn-primary`},` Edit Settings `))])]),E.value?(h(),C(`div`,qe,[S(`p`,Je,t(E.value),1)])):g(``,!0),m.value?(h(),C(`div`,Ye,[S(`p`,Xe,t(m.value),1)])):g(``,!0),S(`div`,Ze,[n[23]||=S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary pb-2`},`General Settings`,-1),S(`div`,Qe,[n[14]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Node Name`,-1),d.value?c((h(),C(`input`,{key:1,"onUpdate:modelValue":n[0]||=e=>O.value=e,type:`text`,maxlength:`50`,class:`cfg-input w-full sm:w-64`,placeholder:`Enter node name`},null,512)),[[H,O.value]]):(h(),C(`div`,$e,t(I.value),1))]),S(`div`,et,[n[15]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Local Hash`,-1),S(`span`,tt,t(L.value),1)]),S(`div`,nt,[n[16]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm flex-shrink-0`},`Public Key`,-1),S(`div`,rt,[S(`span`,it,t(B.value),1),d.value?(h(),C(`button`,{key:0,onClick:ge,class:`flex-shrink-0 px-2 py-1 text-xs bg-primary/10 hover:bg-primary/20 text-content-secondary dark:text-content-muted rounded border border-primary/30 transition-colors whitespace-nowrap`},` Generate New Key `)):g(``,!0)])]),S(`div`,at,[n[17]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Mode`,-1),S(`span`,ot,t(U.value),1)]),S(`div`,st,[n[19]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Path hash length`,-1),d.value?c((h(),C(`select`,{key:1,"onUpdate:modelValue":n[1]||=e=>P.value=e,class:`cfg-select w-full sm:w-32`},[...n[18]||=[S(`option`,{value:1},`1 byte`,-1),S(`option`,{value:2},`2 bytes`,-1),S(`option`,{value:3},`3 bytes`,-1)]],512)),[[R,P.value,void 0,{number:!0}]]):(h(),C(`div`,ct,t(K.value),1))]),S(`div`,lt,[S(`div`,ut,[n[21]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Periodic Advertisement Interval`,-1),d.value?(h(),C(`div`,ft,[c(S(`input`,{"onUpdate:modelValue":n[2]||=e=>j.value=e,type:`number`,min:`0`,max:`48`,class:`cfg-input w-20`},null,512),[[H,j.value,void 0,{number:!0}]]),n[20]||=S(`span`,{class:`text-content-muted dark:text-content-muted text-sm`},`hours`,-1)])):(h(),C(`div`,dt,t(G.value),1))]),n[22]||=S(`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)])]),S(`div`,pt,[S(`div`,mt,[n[25]||=S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-3`},`Location Settings`,-1),d.value?(h(),C(`button`,{key:0,onClick:ne,class:`btn-primary flex items-center gap-2`,title:`Pick location on map`},[...n[24]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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`}),S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 11a3 3 0 11-6 0 3 3 0 016 0z`})],-1),b(` Pick Location on Map `,-1)]])):g(``,!0)]),S(`div`,ht,[n[26]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Manual Latitude`,-1),d.value?c((h(),C(`input`,{key:1,"onUpdate:modelValue":n[3]||=e=>k.value=e,type:`number`,step:`0.000001`,min:`-90`,max:`90`,class:`cfg-input w-full sm:w-48`},null,512)),[[H,k.value,void 0,{number:!0}]]):(h(),C(`div`,gt,t(V.value),1))]),S(`div`,_t,[n[27]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Manual Longitude`,-1),d.value?c((h(),C(`input`,{key:1,"onUpdate:modelValue":n[4]||=e=>A.value=e,type:`number`,step:`0.000001`,min:`-180`,max:`180`,class:`cfg-input w-full sm:w-48`},null,512)),[[H,A.value,void 0,{number:!0}]]):(h(),C(`div`,vt,t(ee.value),1))])]),_(W,{"is-open":D.value,latitude:k.value,longitude:A.value,onClose:n[5]||=e=>D.value=!1,onSelect:re},null,8,[`is-open`,`latitude`,`longitude`]),(h(),u(p,{to:`body`},[Y.value?(h(),C(`div`,{key:0,class:`fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm`,onClick:n[12]||=z(e=>Y.value=!1,[`self`])},[S(`div`,yt,[n[35]||=S(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary`},` Generate Vanity Identity Key `,-1),n[36]||=S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},` Generate a new Ed25519 identity key whose public key starts with your chosen hex prefix (0-9, A-F). Longer prefixes take more time to find. `,-1),S(`div`,null,[S(`label`,bt,`Hex Prefix (1-`+t(de.value)+` characters)`,1),c(S(`input`,{"onUpdate:modelValue":n[6]||=e=>X.value=e,type:`text`,maxlength:de.value,placeholder:`e.g. F8A1`,disabled:Z.value,class:`cfg-input py-2 placeholder-gray-400 dark:placeholder-white/40 font-mono uppercase disabled:opacity-50`},null,8,xt),[[H,X.value]]),X.value&&!fe.value?(h(),C(`p`,St,` Enter 1-`+t(de.value)+` valid hex characters (0-9, A-F) `,1)):pe.value?(h(),C(`p`,Ct,t(pe.value),1)):g(``,!0)]),S(`div`,null,[S(`button`,{onClick:n[7]||=e=>ce.value=!ce.value,disabled:Z.value,class:`text-xs text-content-muted dark:text-content-muted hover:text-content-secondary dark:hover:text-content-secondary transition-colors disabled:opacity-50 flex items-center gap-1`},[(h(),C(`svg`,{class:T([`w-3 h-3 transition-transform`,{"rotate-90":ce.value}]),fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[...n[28]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M9 5l7 7-7 7`},null,-1)]],2)),n[29]||=b(` Advanced `,-1)],8,wt),ce.value?(h(),C(`div`,Tt,[...n[30]||=[S(`p`,{class:`text-amber-600 dark:text-amber-400 text-xs font-medium`},` Extended prefix mode (up to 8 characters) `,-1),S(`p`,{class:`text-amber-600 dark:text-amber-500 text-xs mt-1`},` Prefixes longer than 4 characters require exponentially more attempts and can take a very long time or may not complete at all. The request may time out. `,-1)]])):g(``,!0)]),Z.value?(h(),C(`div`,Et,[n[31]||=S(`svg`,{class:`animate-spin h-5 w-5 text-blue-500 flex-shrink-0`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`},[S(`circle`,{class:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,"stroke-width":`4`}),S(`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`})],-1),S(`div`,null,[S(`p`,Dt,` Searching for key with prefix "`+t(X.value.toUpperCase())+`"... `,1),S(`p`,Ot,` Elapsed: `+t(le.value)+`s `,1)])])):g(``,!0),$.value?(h(),C(`div`,kt,[S(`p`,At,t($.value),1)])):g(``,!0),Q.value?(h(),C(`div`,jt,[S(`p`,Mt,` Key found in `+t(Q.value.attempts.toLocaleString())+` attempts `,1),S(`div`,null,[n[32]||=S(`span`,{class:`text-xs text-content-muted dark:text-content-muted`},`Public Key:`,-1),S(`p`,Nt,t(Q.value.public_hex),1)])])):g(``,!0),ie.value&&Q.value?(h(),C(`div`,Pt,[n[33]||=S(`p`,{class:`text-amber-600 dark:text-amber-400 text-sm font-medium`},` Warning: This will replace your current identity key. `,-1),n[34]||=S(`p`,{class:`text-amber-600 dark:text-amber-500 text-xs mt-1`},` Your node address and public key will change. Other nodes will need to re-discover you. This cannot be undone unless you have a backup. `,-1),S(`div`,Ft,[S(`button`,{onClick:ve,disabled:ae.value,class:`px-3 py-1.5 bg-red-600 hover:bg-red-700 text-white rounded-lg text-xs transition-colors disabled:opacity-50`},t(ae.value?`Applying...`:`Confirm Replace Key`),9,It),S(`button`,{onClick:n[8]||=e=>ie.value=!1,disabled:ae.value,class:`px-3 py-1.5 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 text-xs transition-colors`},` Cancel `,8,Lt)])])):g(``,!0),S(`div`,Rt,[S(`button`,{onClick:n[9]||=e=>Y.value=!1,disabled:Z.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`},` Close `,8,zt),Q.value?(h(),C(x,{key:1},[S(`button`,{onClick:n[10]||=e=>{Q.value=null,$.value=null},class:`btn-primary`},` Try Again `),ie.value?g(``,!0):(h(),C(`button`,{key:0,onClick:n[11]||=e=>ie.value=!0,class:`px-4 py-2 bg-red-600/20 hover:bg-red-600/30 text-red-600 dark:text-red-400 rounded-lg border border-red-500/50 text-sm transition-colors`},` Apply Key `))],64)):(h(),C(`button`,{key:0,onClick:_e,disabled:!fe.value||Z.value,class:`btn-primary`},t(Z.value?`Generating...`:`Generate`),9,Bt))])])])):g(``,!0)]))])],64))}}),Ht={class:`space-y-12`},Ut={class:`cfg-page-heading flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3`},Wt={class:`flex items-center gap-2 flex-shrink-0`},Gt=[`disabled`],Kt=[`disabled`],qt={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`},Jt={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`},Yt={class:`cfg-section`},Xt={class:`space-y-3`},Zt={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`},Qt={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},$t={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1`},en={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},tn=f({__name:`DutyCycle`,setup(e,{expose:n}){let r=N(),i=y(()=>r.stats?.config?.duty_cycle||{}),a=y(()=>{let e=i.value.max_airtime_percent;return typeof e==`number`?e.toFixed(1)+`%`:e&&typeof e==`object`&&`parsedValue`in e?(e.parsedValue||0).toFixed(1)+`%`:`Not set`}),o=y(()=>i.value.enforcement_enabled?`Enabled`:`Disabled`),s=l(!1),u=l(!1),d=l(``),f=l(``),p=l(0),m=l(!0),b=()=>{let e=i.value.max_airtime_percent;typeof e==`number`?p.value=e:e&&typeof e==`object`&&`parsedValue`in e?p.value=e.parsedValue||0:p.value=6,m.value=i.value.enforcement_enabled!==!1,s.value=!0,d.value=``,f.value=``},w=()=>{s.value=!1,d.value=``,f.value=``},{showUnsavedModal:T,requestLeave:E,handleDiscard:D,handleSave:O,handleCancel:k}=se(s,u,w,async()=>(await A(),!s.value));n({requestLeave:E,isEditing:s});let A=async()=>{u.value=!0,f.value=``,d.value=``;try{let e=(await j.post(`/api/update_duty_cycle_config`,{max_airtime_percent:p.value,enforcement_enabled:m.value})).data;e.message||e.persisted?(d.value=e.message||`Settings saved successfully`,s.value=!1,await r.fetchStats(),setTimeout(()=>{d.value=``},3e3)):f.value=`Failed to save settings`}catch(e){console.error(`Failed to save duty cycle settings:`,e),f.value=e.response?.data?.error||`Failed to save settings`}finally{u.value=!1}};return(e,n)=>(h(),C(x,null,[_(oe,{show:v(T),"is-saving":u.value,label:`Duty Cycle settings`,onDiscard:v(D),onSave:v(O),onCancel:v(k)},null,8,[`show`,`is-saving`,`onDiscard`,`onSave`,`onCancel`]),S(`div`,Ht,[S(`div`,Ut,[n[2]||=S(`div`,null,[S(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2`},`Duty Cycle`),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Configure duty cycle limits for channel activity`)],-1),S(`div`,Wt,[s.value?(h(),C(x,{key:1},[S(`button`,{onClick:w,disabled:u.value,class:`cfg-btn-secondary`},` Cancel `,8,Gt),S(`button`,{onClick:A,disabled:u.value,class:`cfg-btn-primary`},t(u.value?`Saving...`:`Save Changes`),9,Kt)],64)):(h(),C(`button`,{key:0,onClick:b,class:`cfg-btn-primary`},` Edit Settings `))])]),d.value?(h(),C(`div`,qt,t(d.value),1)):g(``,!0),f.value?(h(),C(`div`,Jt,t(f.value),1)):g(``,!0),S(`div`,Yt,[S(`div`,Xt,[S(`div`,Zt,[n[3]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Max Airtime %`,-1),s.value?c((h(),C(`input`,{key:1,"onUpdate:modelValue":n[0]||=e=>p.value=e,type:`number`,step:`0.1`,min:`0.1`,max:`100`,class:`cfg-input w-full sm:w-32`},null,512)),[[H,p.value,void 0,{number:!0}]]):(h(),C(`div`,Qt,t(a.value),1))]),S(`div`,$t,[n[5]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Enforcement`,-1),s.value?c((h(),C(`select`,{key:1,"onUpdate:modelValue":n[1]||=e=>m.value=e,class:`cfg-select w-full sm:w-32`},[...n[4]||=[S(`option`,{value:!0},`Enabled`,-1),S(`option`,{value:!1},`Disabled`,-1)]],512)),[[R,m.value]]):(h(),C(`div`,en,t(o.value),1))])])])])],64))}}),nn={class:`space-y-12`},rn={class:`cfg-page-heading flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3`},an={class:`flex items-center gap-2 flex-shrink-0`},on=[`disabled`],sn=[`disabled`],cn={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`},ln={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`},un={class:`cfg-section space-y-3`},dn={class:`flex flex-col sm:flex-row sm:items-center sm:justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-3`},fn={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm flex-shrink-0`},pn={class:`flex flex-col sm:flex-row sm:items-center sm:justify-between py-2 gap-3`},mn={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm flex-shrink-0`},hn=f({__name:`TransmissionDelays`,setup(e,{expose:n}){let r=N(),i=y(()=>r.stats?.config?.delays||{}),a=y(()=>{let e=i.value.tx_delay_factor;if(typeof e==`number`)return e.toFixed(2)+`x`;if(e&&typeof e==`object`&&`parsedValue`in e){let t=e.parsedValue;if(typeof t==`number`)return t.toFixed(2)+`x`}return`Not set`}),o=y(()=>{let e=i.value.direct_tx_delay_factor;return typeof e==`number`?e.toFixed(2)+`s`:`Not set`}),s=l(!1),u=l(!1),d=l(``),f=l(``),p=l(0),m=l(0),b=()=>{let e=i.value.tx_delay_factor;e&&typeof e==`object`&&`parsedValue`in e?p.value=e.parsedValue||1:typeof e==`number`?p.value=e:p.value=1;let t=i.value.direct_tx_delay_factor;m.value=typeof t==`number`?t:.5,s.value=!0,d.value=``,f.value=``},w=()=>{s.value=!1,d.value=``,f.value=``},T=async()=>{u.value=!0,f.value=``,d.value=``;try{let e=(await j.post(`/api/update_radio_config`,{tx_delay_factor:p.value,direct_tx_delay_factor:m.value})).data,t=e?.data??e;e.success||t.persisted||t.message?(d.value=t.message||`Settings saved successfully`,s.value=!1,await r.fetchStats(),setTimeout(()=>{d.value=``},3e3)):f.value=`Failed to save settings`}catch(e){console.error(`Failed to save delay settings:`,e),f.value=e.response?.data?.error||`Failed to save settings`}finally{u.value=!1}},{showUnsavedModal:E,requestLeave:D,handleDiscard:O,handleSave:k,handleCancel:A}=se(s,u,w,async()=>(await T(),!s.value));return n({requestLeave:D,isEditing:s}),(e,n)=>(h(),C(x,null,[_(oe,{show:v(E),"is-saving":u.value,label:`TX Delay settings`,onDiscard:v(O),onSave:v(k),onCancel:v(A)},null,8,[`show`,`is-saving`,`onDiscard`,`onSave`,`onCancel`]),S(`div`,nn,[S(`div`,rn,[n[2]||=S(`div`,null,[S(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2`},`TX Delays`),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Configure transmission delay factors for flood and direct packets`)],-1),S(`div`,an,[s.value?(h(),C(x,{key:1},[S(`button`,{onClick:w,disabled:u.value,class:`cfg-btn-secondary`},` Cancel `,8,on),S(`button`,{onClick:T,disabled:u.value,class:`cfg-btn-primary`},t(u.value?`Saving...`:`Save Changes`),9,sn)],64)):(h(),C(`button`,{key:0,onClick:b,class:`cfg-btn-primary`},` Edit Settings `))])]),d.value?(h(),C(`div`,cn,t(d.value),1)):g(``,!0),f.value?(h(),C(`div`,ln,t(f.value),1)):g(``,!0),S(`div`,un,[S(`div`,dn,[n[3]||=S(`div`,{class:`flex flex-col gap-1`},[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Flood TX Delay Factor`),S(`span`,{class:`text-content-muted dark:text-content-muted text-xs`},`Scales the airtime-based random transmit window for flood packets. Higher values increase delay spread for collision avoidance.`)],-1),s.value?c((h(),C(`input`,{key:1,"onUpdate:modelValue":n[0]||=e=>p.value=e,type:`number`,step:`0.1`,min:`0`,max:`5`,class:`cfg-input w-full sm:w-32 flex-shrink-0`},null,512)),[[H,p.value,void 0,{number:!0}]]):(h(),C(`div`,fn,t(a.value),1))]),S(`div`,pn,[n[4]||=S(`div`,{class:`flex flex-col gap-1`},[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Direct TX Delay Factor`),S(`span`,{class:`text-content-muted dark:text-content-muted text-xs`},`Fixed delay in seconds before transmitting direct-routed packets. Applied as-is with no randomisation.`)],-1),s.value?c((h(),C(`input`,{key:1,"onUpdate:modelValue":n[1]||=e=>m.value=e,type:`number`,step:`0.1`,min:`0`,max:`5`,class:`cfg-input w-full sm:w-32 flex-shrink-0`},null,512)),[[H,m.value,void 0,{number:!0}]]):(h(),C(`div`,mn,t(o.value),1))])])])],64))}}),gn=D(`treeState`,()=>{let e=i(new Set),t=i({value:null}),n=t=>{e.add(t)},r=t=>{e.delete(t)};return{expandedNodes:e,selectedNodeId:t,addExpandedNode:n,removeExpandedNode:r,isNodeExpanded:t=>e.has(t),setSelectedNode:e=>{t.value=e},toggleExpanded:t=>{e.has(t)?r(t):n(t)}}}),_n={class:`select-none`},vn={class:`flex-shrink-0`},yn={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`},bn={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`},xn={key:0,class:`hidden sm:flex items-center gap-1 ml-2`},Sn={class:`relative group`},Cn=[`title`],wn={key:0,class:`text-xs font-mono text-content-secondary dark:text-white/50 bg-stroke-subtle/40 dark:bg-white/5 px-1.5 py-0.5 rounded border border-stroke-subtle dark:border-white/10`},Tn={class:`flex justify-between items-start mb-4`},En={class:`bg-black/20 border border-white/10 rounded-md p-4 mb-4`},Dn={class:`text-sm font-mono text-white/80 break-all leading-relaxed`},On={class:`flex items-center gap-2 sm:gap-3 ml-auto flex-shrink-0`},kn={key:0,class:`hidden sm:flex items-center gap-1`},An=[`title`],jn={key:1,class:`hidden sm:flex items-center gap-1`},Mn={key:3,class:`hidden sm:inline-block px-2 py-1 bg-stroke-subtle dark:bg-white/10 text-content-secondary dark:text-white/60 text-xs rounded-full ml-1`},Nn={key:0,class:`space-y-1`},Pn=F(f({__name:`TreeNode`,props:{node:{},selectedNodeId:{},level:{},disabled:{type:Boolean},unlocked:{type:Boolean}},emits:[`select`,`edit`,`delete`],setup(n,{emit:r}){let i=n,o=r,s=gn(),c=l(!1),d=y({get:()=>s.isNodeExpanded(i.node.id),set:e=>{e?s.addExpandedNode(i.node.id):s.removeExpandedNode(i.node.id)}}),f=y(()=>i.node.children.length>0);function p(){i.unlocked&&E(),f.value&&w()}function w(){f.value&&(d.value=!d.value)}function E(){o(`select`,i.node.id)}function D(e){o(`select`,e)}function O(e){o(`edit`,e)}function k(e){o(`delete`,e)}function A(e){e.stopPropagation(),c.value=!c.value}function j(e){e.stopPropagation(),i.node.transport_key&&window.navigator?.clipboard&&window.navigator.clipboard.writeText(i.node.transport_key)}return(r,s)=>{let l=a(`TreeNode`,!0);return h(),C(`div`,_n,[S(`div`,{class:T([`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 border transition-colors duration-150`,i.disabled?`opacity-50`:``,i.unlocked&&n.selectedNodeId===n.node.id?`bg-primary/10 border-primary/30 text-content-primary dark:text-white`:`cfg-card text-content-primary dark:text-white/80`,i.unlocked&&n.selectedNodeId!==n.node.id?`hover:bg-stroke-subtle/40 dark:hover:bg-white/5 hover:border-stroke dark:hover:border-white/15`:``,f.value&&!i.disabled?`cursor-pointer`:``,`ml-${n.level*4}`]),onClick:s[5]||=z(e=>!i.disabled&&p(),[`stop`])},[S(`div`,{class:`flex-shrink-0 w-3 h-3 sm:w-4 sm:h-4 flex items-center justify-center`,onClick:z(w,[`stop`])},[f.value?(h(),C(`svg`,{key:0,class:T([`w-2.5 h-2.5 sm:w-3 sm:h-3 transition-transform duration-200`,d.value?`rotate-90`:`rotate-0`]),fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[...s[6]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M9 5l7 7-7 7`},null,-1)]],2)):g(``,!0)]),S(`div`,vn,[i.node.name.startsWith(`#`)?(h(),C(`svg`,yn,[...s[7]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M7 20l4-16m2 16l4-16M6 9h14M4 15h14`},null,-1)]])):(h(),C(`svg`,bn,[...s[8]||=[S(`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)]]))]),S(`span`,{class:T([`font-mono text-xs sm:text-sm transition-colors duration-200 break-all`,n.selectedNodeId===n.node.id?`text-primary font-medium`:``])},t(n.node.name.startsWith(`#`)?n.node.name.slice(1):n.node.name),3),n.node.transport_key?(h(),C(`div`,xn,[S(`div`,Sn,[S(`button`,{onClick:A,class:`p-1 rounded hover:bg-stroke-subtle dark:hover:bg-white/10 transition-colors`,title:c.value?`Hide full key`:`Show full key`},[...s[9]||=[S(`svg`,{class:`w-3 h-3 text-content-muted dark:text-white/60 hover:text-content-secondary dark:hover:text-white/80`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 12a3 3 0 11-6 0 3 3 0 016 0z`}),S(`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,Cn),c.value?g(``,!0):(h(),C(`span`,wn,t(v(K)(n.node.transport_key)),1)),c.value?(h(),C(`div`,{key:1,class:`fixed inset-0 z-[300] flex items-center justify-center bg-black/70 backdrop-blur-md`,onClick:s[2]||=e=>c.value=!1},[S(`div`,{class:`bg-black/20 border border-white/20 rounded-lg shadow-lg p-6 max-w-2xl w-full mx-4`,onClick:s[1]||=z(()=>{},[`stop`])},[S(`div`,Tn,[s[11]||=S(`h3`,{class:`text-lg font-semibold text-white`},`Transport Key`,-1),S(`button`,{onClick:s[0]||=e=>c.value=!1,class:`text-white/60 hover:text-white transition-colors`},[...s[10]||=[S(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),S(`div`,En,[S(`div`,Dn,t(n.node.transport_key),1)]),S(`div`,{class:`flex justify-end`},[S(`button`,{onClick:j,class:`btn-success flex items-center gap-2`,title:`Copy to clipboard`},[...s[12]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),b(` Copy Key `,-1)]])])])])):g(``,!0)])])):g(``,!0),S(`div`,On,[n.node.last_used?(h(),C(`div`,kn,[s[13]||=S(`span`,{class:`text-xs text-content-muted dark:text-white/40`},`Last Heard:`,-1),S(`span`,{class:`text-xs text-content-secondary dark:text-white/50`,title:n.node.last_used.toLocaleString()},t(v(G)(n.node.last_used)),9,An)])):(h(),C(`div`,jn,[...s[14]||=[S(`span`,{class:`text-xs text-content-muted dark:text-white/30`},`Last Heard:`,-1),S(`span`,{class:`text-xs text-content-muted dark:text-white/30 italic`},`Never`,-1)]])),S(`span`,{class:T([`text-[10px] sm:text-xs`,n.node.floodPolicy===`allow`?`text-accent-green/80`:`text-accent-red/80`])},` Flood: `+t(n.node.floodPolicy===`allow`?`Allow`:`Deny`),3),i.unlocked?(h(),C(x,{key:2},[S(`button`,{onClick:s[3]||=z(e=>o(`edit`,n.node.id),[`stop`]),class:`px-2 py-0.5 text-[10px] sm:text-xs bg-primary/10 hover:bg-primary/20 text-content-secondary dark:text-content-muted rounded border border-primary/30 transition-colors whitespace-nowrap`},` Edit `),S(`button`,{onClick:s[4]||=z(e=>o(`delete`,n.node.id),[`stop`]),class:`p-1 text-accent-red/50 hover:text-accent-red transition-colors`,title:`Delete`},[...s[15]||=[S(`svg`,{class:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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)]])],64)):g(``,!0),f.value&&!i.unlocked?(h(),C(`span`,Mn,t(n.node.children.length),1)):g(``,!0)])],2),_(V,{"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:e(()=>[d.value&&n.node.children.length>0?(h(),C(`div`,Nn,[(h(!0),C(x,null,m(n.node.children,e=>(h(),u(l,{key:e.id,node:e,"selected-node-id":n.selectedNodeId,level:n.level+1,disabled:i.disabled,unlocked:i.unlocked,onSelect:D,onEdit:O,onDelete:k},null,8,[`node`,`selected-node-id`,`level`,`disabled`,`unlocked`]))),128))])):g(``,!0)]),_:1})])}}}),[[`__scopeId`,`data-v-dad29312`]]),Fn={class:`modal-card max-w-md`},In={class:`flex items-center justify-between mb-6`},Ln={class:`text-content-secondary dark:text-content-muted text-sm mt-1`},Rn={key:0},zn={class:`text-primary font-mono`},Bn={key:1},Vn={class:`pb-2`},Hn={class:`flex bg-background-mute dark:bg-stroke/5 rounded-lg border border-stroke-subtle dark:border-stroke/20 p-0.5`},Un={for:`keyName`,class:`block text-sm font-medium text-content-primary dark:text-content-primary mb-2`},Wn={class:`flex items-center`},Gn={key:0,class:`px-3 py-3 bg-secondary/10 border border-r-0 border-secondary/30 rounded-l-lg text-secondary text-sm font-mono`},Kn=[`placeholder`],qn={key:0,class:`text-content-muted dark:text-content-muted text-xs mt-1`},Jn={class:`pt-1 border-t border-stroke-subtle dark:border-stroke/10`},Yn={class:`flex bg-background-mute dark:bg-stroke/5 rounded-lg border border-stroke-subtle dark:border-stroke/20 p-0.5`},Xn={class:`flex gap-3 pt-4`},Zn=[`disabled`],Qn=f({__name:`AddKeyModal`,props:{show:{type:Boolean},selectedNodeName:{},selectedNodeId:{}},emits:[`close`,`add`],setup(e,{emit:n}){let r=e,i=n,a=l(``),o=l(`allow`),s=l(`region`),d=y(()=>s.value===`region`),f=y(()=>({type:d.value?`Region`:`Private Key`,description:d.value?`Regional organisational key`:`Individual assigned key`})),m=y(()=>a.value.trim().length>0),_=()=>{m.value&&(i(`add`,{name:d.value?`#${a.value.trim()}`:a.value.trim(),floodPolicy:o.value,parentId:r.selectedNodeId}),a.value=``,o.value=`allow`,s.value=`region`)},v=()=>{a.value=``,o.value=`allow`,s.value=`region`,i(`close`)};return(n,i)=>(h(),u(p,{to:`body`},[e.show?(h(),C(`div`,{key:0,onClick:i[5]||=z(e=>v(),[`self`]),class:`modal-backdrop`},[S(`div`,Fn,[S(`div`,In,[S(`div`,null,[i[7]||=S(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary`},` Add New Entry `,-1),S(`p`,Ln,[r.selectedNodeName?(h(),C(`span`,Rn,[i[6]||=b(` Add to: `,-1),S(`span`,zn,t(r.selectedNodeName),1)])):(h(),C(`span`,Bn,` Add to root level (#uk) `))])]),S(`button`,{onClick:v,class:`text-white/60 hover:text-white transition-colors`},[...i[8]||=[S(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),S(`form`,{onSubmit:z(_,[`prevent`]),class:`space-y-5`},[S(`div`,Vn,[i[9]||=S(`label`,{class:`block text-sm font-medium text-content-primary dark:text-content-primary mb-2`},` Entry Type `,-1),S(`div`,Hn,[S(`button`,{type:`button`,onClick:i[0]||=e=>s.value=`region`,class:T([`flex-1 px-3 py-1.5 text-xs font-medium rounded transition-colors`,s.value===`region`?`bg-secondary/20 text-secondary border border-secondary/50`:`text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-secondary`])},` REGION `,2),S(`button`,{type:`button`,onClick:i[1]||=e=>s.value=`privateKey`,class:T([`flex-1 px-3 py-1.5 text-xs font-medium rounded transition-colors`,s.value===`privateKey`?`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`])},` PRIVATE KEY `,2)])]),S(`div`,null,[S(`label`,Un,t(f.value.type)+` Name `,1),S(`div`,Wn,[d.value?(h(),C(`span`,Gn,`#`)):g(``,!0),c(S(`input`,{id:`keyName`,"onUpdate:modelValue":i[2]||=e=>a.value=e,type:`text`,placeholder:d.value?`e.g., uk, au, us`:`Enter key name`,class:T([`flex-1 px-4 py-3 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 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`,d.value?`rounded-r-lg`:`rounded-lg`]),autocomplete:`off`},null,10,Kn),[[H,a.value]])]),d.value?(h(),C(`p`,qn,` The # prefix is added automatically for regions. `)):g(``,!0)]),S(`div`,Jn,[i[10]||=S(`label`,{class:`block text-sm font-medium text-content-primary dark:text-content-primary mb-3 pt-4`},` Flood Policy `,-1),S(`div`,Yn,[S(`button`,{type:`button`,onClick:i[3]||=e=>o.value=`allow`,class:T([`flex-1 px-3 py-1.5 text-xs font-medium rounded transition-colors`,o.value===`allow`?`bg-accent-green/10 text-accent-green border border-accent-green/20`:`text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-secondary`])},` ALLOW `,2),S(`button`,{type:`button`,onClick:i[4]||=e=>o.value=`deny`,class:T([`flex-1 px-3 py-1.5 text-xs font-medium rounded transition-colors`,o.value===`deny`?`bg-accent-red/10 text-accent-red border border-accent-red/20`:`text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-secondary`])},` DENY `,2)])]),S(`div`,Xn,[S(`button`,{type:`button`,onClick:v,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(`button`,{type:`submit`,disabled:!m.value,class:T([`flex-1 px-4 py-3 rounded-lg transition-colors font-medium`,m.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 `+t(f.value.type),11,Zn)])],32)])])):g(``,!0)]))}});function $n(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`&&`BYTES_PER_ELEMENT`in e&&e.BYTES_PER_ELEMENT===1}function er(e,t,n=``){let r=$n(e),i=e?.length,a=t!==void 0;if(!r||a&&i!==t){let o=n&&`"${n}" `,s=a?` of length ${t}`:``,c=r?`length=${i}`:`type=${typeof e}`,l=o+`expected Uint8Array`+s+`, got `+c;throw r?RangeError(l):TypeError(l)}return e}function tr(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function nr(e,t){er(e,void 0,`digestInto() output`);let n=t.outputLen;if(e.length=`+n)}function rr(...e){for(let t=0;t>>t}new Uint8Array(new Uint32Array([287454020]).buffer)[0],typeof Uint8Array.from([]).toHex==`function`&&Uint8Array.fromHex;function or(e,t={}){let n=(t,n)=>e(n).update(t).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.canXOF=r.canXOF,n.create=t=>e(t),Object.assign(n,t),Object.freeze(n)}var sr=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function cr(e,t,n){return e&t^~e&n}function lr(e,t,n){return e&t^e&n^t&n}var ur=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,n,r){this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=ir(this.buffer)}update(e){tr(this),er(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length;for(let a=0;ar-a&&(this.process(n,0),a=0);for(let e=a;el.length)throw Error(`_sha2: outputLen bigger than state`);for(let e=0;e>pr&fr)}:{h:Number(e>>pr&fr)|0,l:Number(e&fr)|0}}function hr(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let a=0;a>>3;_r[e]=(ar(n,17)^ar(n,19)^n>>>10)+_r[e-7]+r+_r[e-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=ar(o,6)^ar(o,11)^ar(o,25),u=l+t+cr(o,s,c)+gr[e]+_r[e]|0,d=(ar(n,2)^ar(n,13)^ar(n,22))+lr(n,r,i)|0;l=c,c=s,s=o,o=a+u|0,a=i,i=r,r=n,n=u+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,a,o,s,c,l)}roundClean(){rr(_r)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),rr(this.buffer)}},yr=class extends vr{A=dr[0]|0;B=dr[1]|0;C=dr[2]|0;D=dr[3]|0;E=dr[4]|0;F=dr[5]|0;G=dr[6]|0;H=dr[7]|0;constructor(){super(32)}},br=hr(`0x428a2f98d728ae22.0x7137449123ef65cd.0xb5c0fbcfec4d3b2f.0xe9b5dba58189dbbc.0x3956c25bf348b538.0x59f111f1b605d019.0x923f82a4af194f9b.0xab1c5ed5da6d8118.0xd807aa98a3030242.0x12835b0145706fbe.0x243185be4ee4b28c.0x550c7dc3d5ffb4e2.0x72be5d74f27b896f.0x80deb1fe3b1696b1.0x9bdc06a725c71235.0xc19bf174cf692694.0xe49b69c19ef14ad2.0xefbe4786384f25e3.0x0fc19dc68b8cd5b5.0x240ca1cc77ac9c65.0x2de92c6f592b0275.0x4a7484aa6ea6e483.0x5cb0a9dcbd41fbd4.0x76f988da831153b5.0x983e5152ee66dfab.0xa831c66d2db43210.0xb00327c898fb213f.0xbf597fc7beef0ee4.0xc6e00bf33da88fc2.0xd5a79147930aa725.0x06ca6351e003826f.0x142929670a0e6e70.0x27b70a8546d22ffc.0x2e1b21385c26c926.0x4d2c6dfc5ac42aed.0x53380d139d95b3df.0x650a73548baf63de.0x766a0abb3c77b2a8.0x81c2c92e47edaee6.0x92722c851482353b.0xa2bfe8a14cf10364.0xa81a664bbc423001.0xc24b8b70d0f89791.0xc76c51a30654be30.0xd192e819d6ef5218.0xd69906245565a910.0xf40e35855771202a.0x106aa07032bbd1b8.0x19a4c116b8d2d0c8.0x1e376c085141ab53.0x2748774cdf8eeb99.0x34b0bcb5e19b48a8.0x391c0cb3c5c95a63.0x4ed8aa4ae3418acb.0x5b9cca4f7763e373.0x682e6ff3d6b2b8a3.0x748f82ee5defb2fc.0x78a5636f43172f60.0x84c87814a1f0ab72.0x8cc702081a6439ec.0x90befffa23631e28.0xa4506cebde82bde9.0xbef9a3f7b2c67915.0xc67178f2e372532b.0xca273eceea26619c.0xd186b8c721c0c207.0xeada7dd6cde0eb1e.0xf57d4f7fee6ed178.0x06f067aa72176fba.0x0a637dc5a2c898a6.0x113f9804bef90dae.0x1b710b35131c471b.0x28db77f523047d84.0x32caab7b40c72493.0x3c9ebe0a15c9bebc.0x431d67c49c100d4c.0x4cc5d4becb3e42b6.0x597f299cfc657e2a.0x5fcb6fab3ad6faec.0x6c44198c4a475817`.split(`.`).map(e=>BigInt(e)));br[0],br[1];var xr=or(()=>new yr,sr(1)),Sr={class:`modal-card max-w-lg`},Cr={class:`flex items-center justify-between mb-6`},wr={class:`text-content-secondary dark:text-content-muted text-sm mt-1`},Tr={class:`text-primary font-mono`},Er={class:`pb-2`},Dr={class:`flex bg-background-mute dark:bg-stroke/5 rounded-lg border border-stroke-subtle dark:border-stroke/20 p-0.5`},Or={for:`keyName`,class:`block text-sm font-medium text-content-primary dark:text-content-primary mb-2`},kr={class:`flex items-center`},Ar={key:0,class:`px-3 py-3 bg-secondary/10 border border-r-0 border-secondary/30 rounded-l-lg text-secondary text-sm font-mono`},jr=[`placeholder`],Mr={key:0,class:`text-content-muted dark:text-content-muted text-xs mt-1`},Nr={key:1,class:`mt-3 bg-background-mute dark:bg-black/20 border border-stroke-subtle dark:border-stroke/10 rounded-md p-3`},Pr={class:`flex items-center justify-between mb-1.5`},Fr={class:`text-xs font-mono text-content-primary dark:text-content-primary/80 break-all`},Ir={key:0,class:`text-xs text-amber-500 dark:text-amber-400 mt-1`},Lr={key:0,class:`mt-1 bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-3`},Rr={class:`flex items-center justify-between`},zr={class:`text-right`},Br={class:`text-sm text-content-secondary dark:text-content-muted`},Vr={class:`text-xs text-content-muted dark:text-content-muted`},Hr={class:`pt-1 border-t border-stroke-subtle dark:border-stroke/10`},Ur={class:`flex bg-background-mute dark:bg-stroke/5 rounded-lg border border-stroke-subtle dark:border-stroke/20 p-0.5`},Wr={class:`flex gap-3 pt-4`},Gr=[`disabled`],Kr=f({__name:`EditKeyModal`,props:{show:{type:Boolean},node:{}},emits:[`close`,`save`],setup(e,{emit:n}){let r=e,i=n,a=l(``),s=l(`allow`),d=l(`region`),f=y(()=>d.value===`region`),m=y(()=>({type:f.value?`Region`:`Private Key`,description:f.value?`Regional organisational key`:`Individual assigned key`}));o(()=>r.node,e=>{if(e){let t=e.name.startsWith(`#`);d.value=t?`region`:`privateKey`,a.value=t?e.name.slice(1):e.name,s.value=e.floodPolicy}else a.value=``,s.value=`allow`,d.value=`region`},{immediate:!0});let _=y(()=>a.value.trim().length>0&&r.node),x=y(()=>{let e=a.value.trim();return e?f.value?`#${e}`:e:r.node?.name||``}),w=y(()=>r.node?r.node.name.startsWith(`#`)?r.node.name.slice(1):r.node.name:``),D=y(()=>a.value.trim()!==w.value);function O(e){let t=e.startsWith(`#`)?e:`#${e}`,n=xr(new TextEncoder().encode(t)).slice(0,16),r=``;return n.forEach(e=>{r+=String.fromCharCode(e)}),btoa(r)}let k=l(null);E(()=>{let e=a.value.trim();if(!f.value||!e){k.value=null;return}k.value=O(e)});let A=e=>{window.navigator?.clipboard&&window.navigator.clipboard.writeText(e)},j=()=>{if(!_.value||!r.node)return;let e=f.value?`#${a.value.trim()}`:a.value.trim(),t=f.value&&D.value?k.value??O(a.value.trim()):void 0;i(`save`,{id:r.node.id,name:e,floodPolicy:s.value,transportKey:t}),M()},M=()=>{i(`close`)};return(n,r)=>(h(),u(p,{to:`body`},[e.show?(h(),C(`div`,{key:0,onClick:r[6]||=z(e=>M(),[`self`]),class:`modal-backdrop`},[S(`div`,Sr,[S(`div`,Cr,[S(`div`,null,[r[8]||=S(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary`},` Edit Entry `,-1),S(`p`,wr,[r[7]||=b(` Modify `,-1),S(`span`,Tr,t(x.value),1)])]),S(`button`,{onClick:M,class:`text-white/60 hover:text-white transition-colors`},[...r[9]||=[S(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),S(`form`,{onSubmit:z(j,[`prevent`]),class:`space-y-5`},[S(`div`,Er,[r[10]||=S(`label`,{class:`block text-sm font-medium text-content-primary dark:text-content-primary mb-2`},` Entry Type `,-1),S(`div`,Dr,[S(`button`,{type:`button`,onClick:r[0]||=e=>d.value=`region`,class:T([`flex-1 px-3 py-1.5 text-xs font-medium rounded transition-colors`,d.value===`region`?`bg-secondary/20 text-secondary border border-secondary/50`:`text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-secondary`])},` REGION `,2),S(`button`,{type:`button`,onClick:r[1]||=e=>d.value=`privateKey`,class:T([`flex-1 px-3 py-1.5 text-xs font-medium rounded transition-colors`,d.value===`privateKey`?`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`])},` PRIVATE KEY `,2)])]),S(`div`,null,[S(`label`,Or,t(m.value.type)+` Name `,1),S(`div`,kr,[f.value?(h(),C(`span`,Ar,`#`)):g(``,!0),c(S(`input`,{id:`keyName`,"onUpdate:modelValue":r[2]||=e=>a.value=e,type:`text`,placeholder:f.value?`e.g., uk, au, us`:`Enter key name`,class:T([`flex-1 px-4 py-3 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 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`,f.value?`rounded-r-lg`:`rounded-lg`]),autocomplete:`off`},null,10,jr),[[H,a.value]])]),f.value?(h(),C(`p`,Mr,` The # prefix is added automatically for regions. `)):g(``,!0),f.value&&e.node?.transport_key?(h(),C(`div`,Nr,[S(`div`,Pr,[r[12]||=S(`span`,{class:`text-xs font-medium text-content-secondary dark:text-content-muted`},`Transport Key`,-1),D.value?g(``,!0):(h(),C(`button`,{key:0,type:`button`,onClick:r[3]||=t=>A(e.node.transport_key||``),class:`text-xs text-accent-green hover:text-accent-green/80 flex items-center gap-1`,title:`Copy to clipboard`},[...r[11]||=[S(`svg`,{class:`w-3 h-3`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),b(` Copy `,-1)]]))]),S(`div`,Fr,t(k.value??e.node.transport_key),1),D.value?(h(),C(`div`,Ir,` Updated for "`+t(x.value)+`" `,1)):g(``,!0)])):g(``,!0)]),e.node?.last_used?(h(),C(`div`,Lr,[S(`div`,Rr,[r[13]||=S(`div`,{class:`flex items-center gap-2`},[S(`svg`,{class:`w-4 h-4 text-primary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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`})]),S(`span`,{class:`text-sm font-medium text-content-primary dark:text-content-primary`},`Last Used`)],-1),S(`div`,zr,[S(`div`,Br,t(e.node.last_used.toLocaleDateString())+` at `+t(e.node.last_used.toLocaleTimeString()),1),S(`div`,Vr,t(v(G)(e.node.last_used)),1)])])])):g(``,!0),S(`div`,Hr,[r[14]||=S(`label`,{class:`block text-sm font-medium text-content-primary dark:text-content-primary mb-3 pt-4`},` Flood Policy `,-1),S(`div`,Ur,[S(`button`,{type:`button`,onClick:r[4]||=e=>s.value=`allow`,class:T([`flex-1 px-3 py-1.5 text-xs font-medium rounded transition-colors`,s.value===`allow`?`bg-accent-green/10 text-accent-green border border-accent-green/20`:`text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-secondary`])},` ALLOW `,2),S(`button`,{type:`button`,onClick:r[5]||=e=>s.value=`deny`,class:T([`flex-1 px-3 py-1.5 text-xs font-medium rounded transition-colors`,s.value===`deny`?`bg-accent-red/10 text-accent-red border border-accent-red/20`:`text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-secondary`])},` DENY `,2)])]),S(`div`,Wr,[S(`button`,{type:`button`,onClick:M,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(`button`,{type:`submit`,disabled:!_.value,class:T([`flex-1 px-4 py-3 rounded-lg transition-colors font-medium`,_.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`])},` Done `,10,Gr)])],32)])])):g(``,!0)]))}}),qr={class:`modal-card max-w-lg`},Jr={class:`flex items-center gap-3 mb-6`},Yr={class:`text-content-secondary dark:text-content-muted text-sm mt-1`},Xr={class:`text-accent-red font-mono`},Zr={key:0,class:`bg-accent-red/10 border border-accent-red/30 rounded-lg p-4 mb-6`},Qr={class:`flex items-start gap-3`},$r={class:`flex-1`},ei={class:`text-accent-red font-medium text-sm mb-2`},ti={class:`space-y-1 max-h-32 overflow-y-auto`},ni={key:0,class:`w-3 h-3 text-secondary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},ri={key:1,class:`w-3 h-3 text-accent-green`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},ii={class:`font-mono`},ai={key:0,class:`text-content-secondary dark:text-content-muted text-xs`},oi={key:1,class:`mb-6`},si={class:`mb-3`},ci={class:`relative`},li={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`},ui={key:0,class:`text-center py-4 text-content-secondary dark:text-content-muted text-sm`},di={class:`relative`},fi=[`value`],pi={class:`flex items-center gap-2 flex-1`},mi={class:`text-content-primary dark:text-content-primary font-mono text-sm`},hi={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`},gi={class:`flex gap-3`},_i=f({__name:`DeleteConfirmModal`,props:{show:{type:Boolean},node:{},allNodes:{}},emits:[`close`,`delete-all`,`move-children`],setup(e,{emit:n}){let r=e,i=n,a=l(null),o=l(``),s=e=>{let t=[],n=e=>{for(let r of e.children)t.push(r),n(r)};return n(e),t},d=y(()=>r.node?s(r.node):[]),f=y(()=>{if(!r.node)return[];let e=new Set([r.node.id,...d.value.map(e=>e.id)]),t=n=>{let r=[];for(let i of n)i.name.startsWith(`#`)&&!e.has(i.id)&&r.push(i),i.children.length>0&&r.push(...t(i.children));return r};return t(r.allNodes)}),_=y(()=>{if(!o.value.trim())return f.value;let e=o.value.toLowerCase();return f.value.filter(t=>t.name.toLowerCase().includes(e))}),v=()=>{r.node&&(i(`delete-all`,r.node.id),E())},w=()=>{!r.node||!a.value||(i(`move-children`,{nodeId:r.node.id,targetParentId:a.value}),E())},E=()=>{a.value=null,o.value=``,i(`close`)};return(n,r)=>(h(),u(p,{to:`body`},[e.show&&e.node?(h(),C(`div`,{key:0,onClick:r[2]||=z(e=>E(),[`self`]),class:`modal-backdrop-heavy`},[S(`div`,qr,[S(`div`,Jr,[r[6]||=S(`svg`,{class:`w-6 h-6 text-accent-red`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`div`,null,[r[4]||=S(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary`},` Confirm Deletion `,-1),S(`p`,Yr,[r[3]||=b(` Deleting `,-1),S(`span`,Xr,t(e.node?.name),1)])]),S(`button`,{onClick:E,class:`ml-auto text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors`},[...r[5]||=[S(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),d.value.length>0?(h(),C(`div`,Zr,[S(`div`,Qr,[r[9]||=S(`svg`,{class:`w-5 h-5 text-accent-red flex-shrink-0 mt-0.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`div`,$r,[S(`h4`,ei,` This will affect `+t(d.value.length)+` child `+t(d.value.length===1?`entry`:`entries`)+`: `,1),S(`div`,ti,[(h(!0),C(x,null,m(d.value.slice(0,10),e=>(h(),C(`div`,{key:e.id,class:`flex items-center gap-2 text-xs text-content-secondary dark:text-content-primary/80`},[e.name.startsWith(`#`)?(h(),C(`svg`,ni,[...r[7]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M7 20l4-16m2 16l4-16M6 9h14M4 15h14`},null,-1)]])):(h(),C(`svg`,ri,[...r[8]||=[S(`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)]])),S(`span`,ii,t(e.name),1),S(`span`,{class:T([`px-1 py-0.5 text-xs rounded`,e.floodPolicy===`allow`?`bg-accent-green/20 text-accent-green`:`bg-accent-red/20 text-accent-red`])},t(e.floodPolicy),3)]))),128)),d.value.length>10?(h(),C(`div`,ai,` ...and `+t(d.value.length-10)+` more `,1)):g(``,!0)])])])])):g(``,!0),d.value.length>0&&f.value.length>0?(h(),C(`div`,oi,[r[13]||=S(`h4`,{class:`text-content-primary dark:text-content-primary font-medium text-sm mb-3`},` Move children to another region: `,-1),S(`div`,si,[S(`div`,ci,[r[10]||=S(`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`},[S(`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),c(S(`input`,{"onUpdate:modelValue":r[0]||=e=>o.value=e,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),[[H,o.value]])])]),S(`div`,li,[_.value.length===0?(h(),C(`div`,ui,t(o.value?`No regions match your search`:`No available regions`),1)):g(``,!0),(h(!0),C(x,null,m(_.value,e=>(h(),C(`label`,{key:e.id,class:`flex items-center gap-3 p-2 rounded cursor-pointer hover:bg-stroke-subtle dark:hover:bg-white/10 transition-colors group`},[S(`div`,di,[c(S(`input`,{type:`radio`,value:e.id,"onUpdate:modelValue":r[1]||=e=>a.value=e,class:`sr-only peer`},null,8,fi),[[L,a.value]]),r[11]||=S(`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`},[S(`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)]),S(`div`,pi,[r[12]||=S(`svg`,{class:`w-4 h-4 text-secondary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M7 20l4-16m2 16l4-16M6 9h14M4 15h14`})],-1),S(`span`,mi,t(e.name),1),e.children.length>0?(h(),C(`span`,hi,t(e.children.length),1)):g(``,!0)])]))),128))])])):g(``,!0),S(`div`,gi,[S(`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 `),d.value.length>0&&a.value?(h(),C(`button`,{key:0,onClick:w,class:`modal-btn-primary`},` Move & Delete `)):g(``,!0),S(`button`,{onClick:v,class:`modal-btn-danger`},t(d.value.length>0?`Delete All`:`Delete`),1)])])])):g(``,!0)]))}}),vi={class:`space-y-12`},yi={class:`cfg-page-heading flex flex-col sm:flex-row sm:justify-between sm:items-start gap-3`},bi={class:`flex items-center gap-2 flex-shrink-0`},xi=[`disabled`],Si=[`disabled`],Ci=[`disabled`],wi={key:0,class:`bg-red-100 dark:bg-red-500/20 border border-red-500/50 rounded-lg p-3`},Ti={class:`text-red-600 dark:text-red-400 text-sm`},Ei={class:`cfg-section`},Di={class:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3`},Oi={key:0,class:`text-xs text-content-muted dark:text-content-muted pb-1`},ki={key:1,class:`flex items-center justify-center py-8`},Ai={key:2,class:`text-center py-8`},ji={class:`text-content-secondary dark:text-content-muted text-sm`},Mi={key:3,class:`text-center py-8`},Ni={key:4,class:`space-y-2`},Pi=f({name:`TransportKeys`,__name:`TransportKeys`,setup(e,{expose:n}){let i=gn(),a=N(),s=l(!1),c=l(!1),d=l(null),f=-1;function p(){return f--}let w=l(`deny`),E=`deny`;o(y(()=>a.stats?.config?.mesh?.unscoped_flood_allow??null),e=>{e!==null&&!s.value&&(w.value=e?`allow`:`deny`)},{immediate:!0});let D=l([]),O=null,k=l(!1),A=l(null),j=l(!1),P=l(!1),F=l(!1),L=l(null),R=l(null);function z(e){return e.map(e=>({...e,children:z(e.children)}))}function B(e,t){let n=[];for(let r of e)n.push({node:r,parentId:t}),n.push(...B(r.children,r.id));return n}function V(e,t){for(let n of e){if(n.id===t)return n;let e=V(n.children,t);if(e)return e}return null}function H(e,t){let n=e.findIndex(e=>e.id===t);if(n!==-1)return e.splice(n,1),!0;for(let n of e)if(H(n.children,t))return!0;return!1}let ee=e=>{let t=new Map,n=[];return e.forEach(e=>{t.set(e.id,{id:e.id,name:e.name,floodPolicy:e.flood_policy,transport_key:e.transport_key,last_used:e.last_used?new Date(e.last_used*1e3):void 0,parent_id:e.parent_id,children:[]})}),t.forEach(e=>{e.parent_id&&t.has(e.parent_id)?t.get(e.parent_id).children.push(e):n.push(e)}),n},U=async()=>{k.value=!0,A.value=null;try{let e=await M.getTransportKeys();e.success&&e.data?D.value=ee(e.data):A.value=e.error||`Failed to load regions`}catch(e){A.value=e instanceof Error?e.message:`Unknown error occurred`}finally{k.value=!1}};r(U);function W(){O=z(D.value),E=w.value,s.value=!0,d.value=null}function G(){O&&(D.value=z(O)),w.value=E,O=null,s.value=!1,d.value=null,i.setSelectedNode(null)}async function K(){c.value=!0,d.value=null;try{let e=B(D.value),t=O?B(O):[],n=new Map(t.map(({node:e})=>[e.id,e])),r=e.filter(({node:e})=>e.id>0),o=e.filter(({node:e})=>e.id<0),c=new Set(r.map(({node:e})=>e.id));for(let{node:e}of t)c.has(e.id)||await M.deleteTransportKey(e.id);let l=new Map,u=[...o],d=u.length*2;for(;u.length&&d-- >0;){let e=u.findIndex(({parentId:e})=>e===void 0||e>0||e<0&&l.has(e));if(e===-1)break;let{node:t,parentId:n}=u.splice(e,1)[0],r=n===void 0?void 0:n>0?n:l.get(n),i=await M.createTransportKey(t.name,t.floodPolicy,t.transport_key,r);i.success&&i.data?.id&&l.set(t.id,i.data.id)}for(let{node:e}of r){let t=n.get(e.id);t&&(e.name!==t.name||e.floodPolicy!==t.floodPolicy||e.transport_key!==t.transport_key)&&await M.updateTransportKey(e.id,e.name,e.floodPolicy,e.transport_key)}w.value!==E&&await M.updateUnscopedFloodPolicy(w.value===`allow`),await U(),await a.fetchStats(),O=null,s.value=!1,i.setSelectedNode(null)}catch(e){d.value=e instanceof Error?e.message:`Save failed`}finally{c.value=!1}}function q(e){i.setSelectedNode(e)}function J(){let e=i.selectedNodeId.value;return e?V(D.value,e)?.name:void 0}function te(){j.value=!0}function ne(e){let t={id:p(),name:e.name,floodPolicy:e.floodPolicy,children:[]};if(e.parentId){let n=V(D.value,e.parentId);n?n.children.push(t):D.value.push(t)}else D.value.push(t);j.value=!1}function re(e){let t=V(D.value,e);t&&(L.value=t,P.value=!0)}function Y(e){let t=V(D.value,e.id);t&&(t.name=e.name,t.floodPolicy=e.floodPolicy,e.transportKey!==void 0&&(t.transport_key=e.transportKey)),P.value=!1,L.value=null}function X(){P.value=!1,L.value=null}function Z(e){let t=V(D.value,e);t&&(R.value=t,F.value=!0)}function Q(e){H(D.value,e),i.setSelectedNode(null),F.value=!1,R.value=null}function $(e){let t=V(D.value,e.nodeId);if(t?.children.length){let n=V(D.value,e.targetParentId);n?n.children.push(...t.children):D.value.push(...t.children)}H(D.value,e.nodeId),i.setSelectedNode(null),F.value=!1,R.value=null}function ie(e){w.value=e}let{showUnsavedModal:ae,requestLeave:ce,handleDiscard:le,handleSave:ue,handleCancel:de}=se(s,c,G,async()=>(await K(),!s.value));return n({requestLeave:ce,isEditing:s}),(e,n)=>(h(),C(x,null,[_(oe,{show:v(ae),"is-saving":c.value,label:`Region Configuration`,onDiscard:v(le),onSave:v(ue),onCancel:v(de)},null,8,[`show`,`is-saving`,`onDiscard`,`onSave`,`onCancel`]),S(`div`,vi,[S(`div`,yi,[n[6]||=S(`div`,null,[S(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2`},` Region Configuration `),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},` Manage regional key hierarchy `)],-1),S(`div`,bi,[s.value?(h(),C(`button`,{key:0,onClick:te,class:`cfg-btn-secondary flex items-center gap-1.5`,disabled:c.value},[...n[5]||=[S(`svg`,{class:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 4v16m8-8H4`})],-1),b(` Add Region `,-1)]],8,xi)):g(``,!0),s.value?(h(),C(x,{key:2},[S(`button`,{onClick:G,disabled:c.value,class:`cfg-btn-secondary`},`Cancel`,8,Si),S(`button`,{onClick:K,disabled:c.value,class:`cfg-btn-primary`},t(c.value?`Saving…`:`Save Changes`),9,Ci)],64)):(h(),C(`button`,{key:1,onClick:W,class:`cfg-btn-primary`},`Edit Settings`))])]),d.value?(h(),C(`div`,wi,[S(`p`,Ti,t(d.value),1)])):g(``,!0),S(`div`,Ei,[S(`div`,Di,[n[7]||=S(`div`,null,[S(`h4`,{class:`text-xs sm:text-sm font-medium text-content-primary dark:text-content-primary mb-1`},` Unscoped Flood Policy (*) `),S(`p`,{class:`text-content-secondary dark:text-content-muted text-[10px] sm:text-xs`},` Allow or Deny unscoped flood packets `)],-1),S(`div`,{class:T([`flex bg-background-mute dark:bg-stroke/5 rounded-lg border border-stroke-subtle dark:border-stroke/20 p-0.5 sm:p-1`,s.value?``:`opacity-50 pointer-events-none`])},[S(`button`,{onClick:n[0]||=e=>ie(`deny`),class:T([`px-2 sm:px-3 py-1 text-[10px] sm:text-xs font-medium rounded transition-colors`,w.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),S(`button`,{onClick:n[1]||=e=>ie(`allow`),class:T([`px-2 sm:px-3 py-1 text-[10px] sm:text-xs font-medium rounded transition-colors`,w.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)],2)])]),S(`div`,{class:`cfg-section space-y-4`,onClick:n[2]||=e=>s.value&&v(i).setSelectedNode(null)},[n[11]||=S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary`},`Regions`,-1),s.value?(h(),C(`p`,Oi,` To add a child region, click on a region to select it, then click "Add Region". `)):g(``,!0),k.value?(h(),C(`div`,ki,[_(I),n[8]||=S(`span`,{class:`ml-2 text-content-secondary dark:text-content-muted`},`Loading regions…`,-1)])):A.value?(h(),C(`div`,Ai,[n[9]||=S(`div`,{class:`text-accent-red mb-2`},`⚠️ Error loading regions`,-1),S(`div`,ji,t(A.value),1),S(`button`,{onClick:U,class:`btn-success mt-4`},` Retry `)])):D.value.length===0?(h(),C(`div`,Mi,[...n[10]||=[S(`div`,{class:`text-content-muted dark:text-content-muted mb-2`},`No regions found`,-1),S(`div`,{class:`text-content-muted dark:text-content-muted/60 text-sm`},` Click "Edit Settings" then "Add Region" to get started `,-1)]])):(h(),C(`div`,Ni,[(h(!0),C(x,null,m(D.value,e=>(h(),u(Pn,{key:e.id,node:e,"selected-node-id":v(i).selectedNodeId.value,level:0,unlocked:s.value,onSelect:q,onEdit:re,onDelete:Z},null,8,[`node`,`selected-node-id`,`unlocked`]))),128))]))]),_(Qn,{show:j.value,"selected-node-name":J(),"selected-node-id":v(i).selectedNodeId.value||void 0,onClose:n[3]||=e=>j.value=!1,onAdd:ne},null,8,[`show`,`selected-node-name`,`selected-node-id`]),_(Kr,{show:P.value,node:L.value,onClose:X,onSave:Y},null,8,[`show`,`node`]),_(_i,{show:F.value,node:R.value,"all-nodes":D.value,onClose:n[4]||=e=>{F.value=!1,R.value=null},onDeleteAll:Q,onMoveChildren:$},null,8,[`show`,`node`,`all-nodes`])])],64))}}),Fi={class:`space-y-12`},Ii={class:`cfg-page-heading flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3`},Li={key:0,class:`bg-red-500/10 border border-red-500/30 rounded-lg p-4`},Ri={class:`flex items-center gap-2 text-red-600 dark:text-red-400`},zi={key:1,class:`flex items-center justify-center py-12`},Bi={class:`text-center`},Vi={key:2,class:`space-y-3`},Hi={class:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3`},Ui={class:`flex-1`},Wi={class:`flex items-center gap-2 sm:gap-3`},Gi={class:`min-w-0 flex-1`},Ki={class:`text-content-primary dark:text-content-primary font-medium text-sm sm:text-base break-all`},qi={class:`flex flex-col sm:flex-row sm:items-center sm:gap-4 mt-1 text-xs text-content-secondary dark:text-content-muted`},Ji={class:`truncate`},Yi={class:`truncate`},Xi=[`onClick`,`disabled`],Zi={key:3,class:`text-center py-12`},Qi={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`},$i={class:`space-y-4`},ea={class:`flex justify-end gap-3 mt-6`},ta=[`disabled`],na=[`disabled`],ra={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`},ia={class:`space-y-4`},aa={class:`flex gap-2`},oa=[`value`],sa={class:`bg-blue-500/10 border border-blue-500/30 rounded-lg p-4`},ca={class:`block bg-blue-500/20 px-3 py-2 rounded text-xs text-blue-100 font-mono overflow-x-auto`},la=f({name:`APITokens`,__name:`APITokens`,setup(e){let n=l([]),i=l(!1),a=l(null),o=l(!1),s=l(``),u=l(null),f=l(!1),p=l(!1),v=l(null),w=async()=>{i.value=!0,a.value=null;try{let e=await M.get(`/auth/tokens`);n.value=(e.data||e).tokens||[]}catch(e){console.error(`Failed to fetch API tokens:`,e),a.value=e instanceof Error?e.message:`Failed to fetch tokens`}finally{i.value=!1}},T=async()=>{if(!s.value.trim()){a.value=`Token name is required`;return}i.value=!0,a.value=null;try{let e=await M.post(`/auth/tokens`,{name:s.value.trim()});u.value=(e.data||e).token||null,o.value=!1,f.value=!0,s.value=``,await w()}catch(e){console.error(`Failed to create API token:`,e),a.value=e instanceof Error?e.message:`Failed to create token`}finally{i.value=!1}},E=(e,t)=>{v.value={id:e,name:t},p.value=!0},D=async()=>{if(v.value){i.value=!0,a.value=null;try{await M.delete(`/auth/tokens/${v.value.id}`),await w(),p.value=!1,v.value=null}catch(e){console.error(`Failed to revoke API token:`,e),a.value=e instanceof Error?e.message:`Failed to revoke token`}finally{i.value=!1}}},O=()=>{o.value=!1,s.value=``,a.value=null},k=()=>{f.value=!1,u.value=null},A=()=>{u.value&&navigator.clipboard.writeText(u.value)},j=e=>e?new Date(e*1e3).toLocaleString():`Never`,N=y(()=>`${window.location.origin}/api/stats`);return r(()=>{w()}),(e,r)=>(h(),C(x,null,[S(`div`,Fi,[S(`div`,Ii,[r[5]||=S(`div`,null,[S(`h2`,{class:`text-lg sm:text-xl font-semibold text-content-primary dark:text-content-primary`},` API Tokens `),S(`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),S(`button`,{onClick:r[0]||=e=>o.value=!0,class:`cfg-btn-primary flex items-center justify-center gap-2`},[...r[4]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 4v16m8-8H4`})],-1),b(` Create Token `,-1)]])]),r[20]||=d(`

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),a.value?(h(),C(`div`,Li,[S(`div`,Ri,[r[6]||=S(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),b(` `+t(a.value),1)])])):g(``,!0),i.value&&n.value.length===0?(h(),C(`div`,zi,[S(`div`,Bi,[_(I,{class:`mx-auto mb-4`}),r[7]||=S(`div`,{class:`text-content-secondary dark:text-content-muted`},`Loading tokens...`,-1)])])):n.value.length>0?(h(),C(`div`,Vi,[(h(!0),C(x,null,m(n.value,e=>(h(),C(`div`,{key:e.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`},[S(`div`,Hi,[S(`div`,Ui,[S(`div`,Wi,[r[8]||=S(`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`},[S(`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),S(`div`,Gi,[S(`h3`,Ki,t(e.name),1),S(`div`,qi,[S(`span`,Ji,`Created: `+t(j(e.created_at)),1),S(`span`,Yi,`Last used: `+t(j(e.last_used)),1)])])])]),S(`button`,{onClick:t=>E(e.id,e.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,Xi)])]))),128))])):(h(),C(`div`,Zi,[r[9]||=S(`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`},[S(`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),r[10]||=S(`h3`,{class:`text-content-primary dark:text-content-primary font-medium mb-2`},`No API Tokens`,-1),r[11]||=S(`p`,{class:`text-content-secondary dark:text-content-muted text-sm mb-4`},` Create a token to enable API access `,-1),S(`button`,{onClick:r[1]||=e=>o.value=!0,class:`cfg-btn-primary`},` Create Your First Token `)])),o.value?(h(),C(`div`,{key:4,class:`fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm`,onClick:z(O,[`self`])},[S(`div`,Qi,[r[14]||=S(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary mb-4`},` Create API Token `,-1),S(`div`,$i,[S(`div`,null,[r[12]||=S(`label`,{class:`block text-sm font-medium text-content-secondary dark:text-content-muted mb-2`},`Token Name`,-1),c(S(`input`,{"onUpdate:modelValue":r[2]||=e=>s.value=e,type:`text`,placeholder:`e.g., Production Server, CI/CD Pipeline`,class:`cfg-input placeholder-gray-400 dark:placeholder-white/40`,onKeydown:B(T,[`enter`])},null,544),[[H,s.value]]),r[13]||=S(`p`,{class:`text-xs text-content-muted dark:text-content-muted mt-1`},` Give your token a descriptive name to identify its purpose `,-1)]),S(`div`,ea,[S(`button`,{onClick:O,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,ta),S(`button`,{onClick:T,disabled:i.value||!s.value.trim(),class:`btn-primary`},t(i.value?`Creating...`:`Create Token`),9,na)])])])])):g(``,!0),f.value&&u.value?(h(),C(`div`,{key:5,class:`fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm`,onClick:z(k,[`self`])},[S(`div`,ra,[r[19]||=S(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary mb-4`},` Token Created Successfully `,-1),S(`div`,ia,[r[18]||=d(`
Save this token now! For security reasons, it will not be shown again.
`,1),S(`div`,null,[r[16]||=S(`label`,{class:`block text-sm font-medium text-content-secondary dark:text-content-muted mb-2`},`Your API Token`,-1),S(`div`,aa,[S(`input`,{value:u.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,oa),S(`button`,{onClick:A,class:`btn-primary flex items-center gap-2`,title:`Copy to clipboard`},[...r[15]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),b(` Copy `,-1)]])])]),S(`div`,sa,[r[17]||=S(`p`,{class:`text-sm text-blue-200 mb-2`},[S(`strong`,null,`Usage Example:`)],-1),S(`code`,ca,` curl -H "X-API-Key: `+t(u.value)+`" `+t(N.value),1)]),S(`div`,{class:`flex justify-end mt-6`},[S(`button`,{onClick:k,class:`btn-primary`},` Done `)])])])])):g(``,!0)]),_(U,{show:p.value,title:`Revoke API Token`,message:`Are you sure you want to revoke the token '${v.value?.name}'? This action cannot be undone.`,"confirm-text":`Revoke`,"cancel-text":`Cancel`,variant:`danger`,onConfirm:D,onClose:r[3]||=e=>p.value=!1},null,8,[`show`,`message`])],64))}}),ua={class:`space-y-12`},da={class:`cfg-section`},fa={class:`space-y-4`},pa={class:`flex items-center justify-between`},ma=[`disabled`],ha={class:`cfg-section`},ga={class:`space-y-4`},_a={class:`space-y-3`},va=[`checked`,`disabled`],ya=[`checked`,`disabled`],ba={class:`flex items-start gap-3`},xa={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`},Sa={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`},Ca={class:`flex-1`},wa={class:`text-sm font-medium text-content-primary dark:text-content-primary`},Ta={key:0,class:`text-xs text-green-600 dark:text-green-400 mt-1`},Ea={key:1,class:`p-4 bg-amber-500/10 border border-amber-500/30 rounded-lg`},Da={class:`flex items-start justify-between gap-3`},Oa=[`disabled`],ka={key:0,class:`animate-spin h-4 w-4`,fill:`none`,viewBox:`0 0 24 24`},Aa={key:1,class:`w-4 h-4`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`},ja={class:`flex items-center space-x-2`},Ma={key:0,class:`w-5 h-5 text-green-600 dark:text-green-400`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`},Na={key:1,class:`w-5 h-5 text-red-600 dark:text-red-400`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`},Pa=f({name:`WebSettings`,__name:`WebSettings`,setup(e){let{stats:n}=O(N()),a=l(!1),o=l(``),s=l(!1),c=l(!1),u=l(!1),f=l(!1),p=l(!0),m=i({cors_enabled:!1,use_default_frontend:!0}),_=y(()=>s.value?`bg-green-500/10 border-green-600/40 dark:border-green-500/30`:`bg-red-500/10 border-red-500/30`);async function v(){try{p.value=!0;let e=await M.get(`/check_pymc_console`);e.success&&e.data&&(f.value=e.data.exists)}catch(e){console.error(`Failed to check PyMC Console:`,e),f.value=!1}finally{p.value=!1}}function w(){let e=n.value?.config?.web||{};m.cors_enabled=e.cors_enabled===!0;let t=e.web_path;m.use_default_frontend=!t||t===``}async function E(){a.value=!0,o.value=``;try{let e={web:{cors_enabled:m.cors_enabled}};m.use_default_frontend?e.web.web_path=null:e.web.web_path=`/opt/pymc_console/web/html`;let t=await M.post(`/update_web_config`,e);t.success?(j(`Settings saved successfully`,!0),c.value=!0):j(t.error||`Failed to save settings`,!1)}catch(e){console.error(`Failed to save web settings:`,e),j(e.message||`Failed to save settings`,!1)}finally{a.value=!1}}async function D(){m.cors_enabled=!m.cors_enabled,await E()}async function k(){m.use_default_frontend=!0,await E()}async function A(){if(!f.value){j(`PyMC Console is not installed. Please install it before switching.`,!1);return}m.use_default_frontend=!1,await E()}function j(e,t){o.value=e,s.value=t,setTimeout(()=>{o.value=``},5e3)}async function P(){u.value=!0,o.value=``;try{let e=await M.post(`/restart_service`,{});e.success?(j(`Service restart initiated. Page will reload...`,!0),c.value=!1,setTimeout(()=>{window.location.reload()},2e3)):j(e.error||`Failed to restart service`,!1)}catch(e){e.code===`ERR_NETWORK`||e.message?.includes(`Network error`)?(j(`Service restarting... Page will reload`,!0),c.value=!1,setTimeout(()=>{window.location.reload()},3e3)):(console.error(`Failed to restart service:`,e),j(e.message||`Failed to restart service`,!1))}finally{u.value=!1}}return r(()=>{w(),v()}),(e,n)=>(h(),C(`div`,ua,[n[14]||=S(`div`,{class:`cfg-page-heading flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3`},[S(`div`,null,[S(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2`},`Web Options`),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Configure CORS policy and web frontend selection`)])],-1),S(`div`,da,[n[1]||=S(`div`,{class:`flex items-start justify-between mb-4`},[S(`div`,null,[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},` CORS Settings `),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},` Control cross-origin resource sharing for API access `)])],-1),S(`div`,fa,[S(`div`,pa,[n[0]||=S(`div`,null,[S(`label`,{class:`text-sm font-medium text-content-primary dark:text-content-primary`},`Enable CORS`),S(`p`,{class:`text-xs text-content-secondary dark:text-content-muted mt-1`},` Allow web frontends from different origins to access the API `)],-1),S(`button`,{onClick:D,disabled:a.value,class:T([`relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2`,m.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`,a.value?`opacity-50 cursor-not-allowed`:`cursor-pointer`])},[S(`span`,{class:T([`inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg`,m.cors_enabled?`translate-x-5`:`translate-x-0.5`])},null,2)],10,ma)])])]),S(`div`,ha,[n[11]||=S(`div`,{class:`flex items-start justify-between mb-4`},[S(`div`,null,[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},` Web Frontend `),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},` Choose which web interface to use `)])],-1),S(`div`,ga,[S(`div`,_a,[S(`label`,{class:T([`flex items-start space-x-3 p-4 bg-background-mute dark:bg-background/30 rounded-lg border-2 cursor-pointer transition-all`,m.use_default_frontend?`border-accent-cyan bg-accent-cyan/10`:`border-stroke-subtle dark:border-stroke/10 hover:border-accent-cyan/50`])},[S(`input`,{type:`radio`,name:`frontend`,checked:m.use_default_frontend,onChange:k,disabled:a.value,class:`mt-1 h-4 w-4 text-accent-cyan focus:ring-accent-cyan focus:ring-offset-background`},null,40,va),n[2]||=S(`div`,{class:`flex-1`},[S(`div`,{class:`text-sm font-medium text-content-primary dark:text-content-primary`},` Default Frontend `),S(`div`,{class:`text-xs text-content-secondary dark:text-content-muted mt-1`},` Built-in pyMC Repeater web interface `),S(`div`,{class:`text-xs text-content-muted dark:text-content-muted/60 mt-1 font-mono`},` Built-in `)],-1)],2),S(`label`,{class:T([`flex items-start space-x-3 p-4 bg-background-mute dark:bg-background/30 rounded-lg border-2 transition-all`,f.value?`cursor-pointer`:`opacity-50 cursor-not-allowed`,m.use_default_frontend?`border-stroke-subtle dark:border-stroke/10 hover:border-accent-cyan/50`:`border-accent-cyan bg-accent-cyan/10`])},[S(`input`,{type:`radio`,name:`frontend`,checked:!m.use_default_frontend,onChange:A,disabled:a.value||!f.value,class:`mt-1 h-4 w-4 text-accent-cyan focus:ring-accent-cyan focus:ring-offset-background`},null,40,ya),n[3]||=d(`
PyMC Console
@Treehouse⚡
Alternative web interface for pyMC Repeater
/opt/pymc_console/web/html
`,1)],2)]),p.value?g(``,!0):(h(),C(`div`,{key:0,class:T([`p-4 rounded-lg border`,f.value?`bg-green-500/5 border-green-500/20`:`bg-accent-cyan/5 border-accent-cyan/20`])},[S(`div`,ba,[f.value?(h(),C(`svg`,xa,[...n[4]||=[S(`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)]])):(h(),C(`svg`,Sa,[...n[5]||=[S(`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)]])),S(`div`,Ca,[S(`h4`,wa,t(f.value?`PyMC Console has been detected`:`PyMC Console Not Installed`),1),f.value?(h(),C(`p`,Ta,[...n[6]||=[b(` PyMC Console is installed at `,-1),S(`code`,{class:`text-green-700 dark:text-green-300`},`/opt/pymc_console/web/html`,-1)]])):(h(),C(x,{key:1},[n[7]||=d(`

PyMC Console must be installed at /opt/pymc_console/web/html before selecting this option.

PyMC Console Install Instructions `,2)],64))])])],2)),c.value?(h(),C(`div`,Ea,[S(`div`,Da,[n[10]||=d(`

Service restart required

Web frontend changes will take effect after restarting the pymc-repeater service.

`,1),S(`button`,{onClick:P,disabled:u.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`},[u.value?(h(),C(`svg`,ka,[...n[8]||=[S(`circle`,{class:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,"stroke-width":`4`},null,-1),S(`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)]])):(h(),C(`svg`,Aa,[...n[9]||=[S(`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)]])),b(` `+t(u.value?`Restarting...`:`Restart Now`),1)],8,Oa)])])):g(``,!0)])]),o.value?(h(),C(`div`,{key:0,class:T([`p-4 rounded-lg border`,_.value])},[S(`div`,ja,[s.value?(h(),C(`svg`,Ma,[...n[12]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M5 13l4 4L19 7`},null,-1)]])):(h(),C(`svg`,Na,[...n[13]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`},null,-1)]])),S(`span`,{class:T(s.value?`text-green-600 dark:text-green-400`:`text-red-600 dark:text-red-400`)},t(o.value),3)])],2)):g(``,!0)]))}}),Fa={ref:`rootEl`,class:`space-y-12`},Ia={class:`cfg-page-heading flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3`},La={class:`flex items-center gap-2 flex-shrink-0`},Ra=[`disabled`],za=[`disabled`],Ba={key:0,class:`bg-accent-green/20 border border-accent-green/50 rounded-lg p-3 text-accent-green text-sm`},Va={key:1,class:`bg-accent-red/20 border border-accent-red/50 rounded-lg p-3 text-accent-red text-sm`},Ha={class:`cfg-section space-y-3`},Ua={key:0,class:`flex items-center justify-center py-4`},Wa={key:1,class:`text-center py-4`},Ga={class:`grid grid-cols-2 sm:grid-cols-4 gap-3`},Ka={class:`text-center p-2 bg-white dark:bg-white/5 rounded-lg border border-stroke-subtle dark:border-white/10`},qa={class:`text-center p-2 bg-white dark:bg-white/5 rounded-lg border border-stroke-subtle dark:border-white/10`},Ja={class:`text-lg font-mono text-content-primary dark:text-content-primary`},Ya={class:`text-center p-2 bg-white dark:bg-white/5 rounded-lg border border-stroke-subtle dark:border-white/10`},Xa={class:`text-lg font-mono text-accent-green`},Za={class:`text-center p-2 bg-white dark:bg-white/5 rounded-lg border border-stroke-subtle dark:border-white/10`},Qa={class:`text-lg font-mono text-accent-red`},$a={key:0,class:`mt-2 p-2 bg-accent-red/10 rounded-lg border border-accent-red/20`},eo={key:1,class:`mt-2 p-2 bg-secondary/10 rounded-lg border border-secondary/20`},to={class:`font-medium`},no={class:`font-mono text-[10px] opacity-70`},ro={class:`text-[10px]`},io={class:`cfg-section space-y-3`},ao={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`},oo={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},so={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`},co={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},lo={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`},uo={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},fo={key:1,class:`flex items-center gap-2`},po={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1`},mo={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},ho={key:1,class:`flex items-center gap-2`},go={class:`cfg-section space-y-3`},_o={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`},vo={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},yo={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`},bo={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},xo={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`},So={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},Co={key:1,class:`flex items-center gap-2`},wo={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`},To={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},Eo={key:1,class:`flex items-center gap-2`},Do={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1`},Oo={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},ko={key:1,class:`flex items-center gap-2`},Ao={class:`cfg-section space-y-3`},jo={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`},Mo={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},No={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`},Po={key:0,class:`text-content-primary dark:text-content-primary font-mono text-sm`},Fo={key:1,class:`flex items-center gap-2`},Io={class:`py-2`},Lo={class:`grid grid-cols-3 gap-2 mt-2`},Ro={class:`text-center p-2 bg-white dark:bg-white/5 rounded-lg border border-stroke-subtle dark:border-white/10`},zo={key:0,class:`font-mono text-sm text-content-primary dark:text-content-primary`},Bo={class:`text-center p-2 bg-white dark:bg-white/5 rounded-lg border border-stroke-subtle dark:border-white/10`},Vo={key:0,class:`font-mono text-sm text-content-primary dark:text-content-primary`},Ho={class:`text-center p-2 bg-white dark:bg-white/5 rounded-lg border border-stroke-subtle dark:border-white/10`},Uo={key:0,class:`font-mono text-sm text-content-primary dark:text-content-primary`},Wo={class:`p-6 space-y-4`},Go={class:`flex justify-between items-start`},Ko={class:`flex justify-end pt-4 border-t border-stroke-subtle dark:border-stroke/20`},qo=f({__name:`AdvertSettings`,setup(e,{expose:n}){let i=N(),a=y(()=>i.stats?.config?.repeater||{}),u=y(()=>a.value.advert_rate_limit||{}),f=y(()=>a.value.advert_penalty_box||{}),p=y(()=>a.value.advert_adaptive||{}),w=y(()=>p.value.thresholds||{}),E=l(!1),D=l(!1),O=l(``),k=l(``),A=l(!1),M=l(!1),P=l(null),F=l(!0),L=l(2),B=l(1),V=l(10),ee=l(60),U=l(!0),W=l(2),G=l(12),K=l(6),q=l(2),J=l(24),te=l(!0),ne=l(.1),re=l(5),Y=l(.05),X=l(.2),Z=l(.5),Q=async()=>{M.value=!0;try{let e=await j.get(`/api/advert_rate_limit_stats`);e.data?.success&&(P.value=e.data.data)}catch(e){console.error(`Failed to fetch rate limit stats:`,e)}finally{M.value=!1}};o([u,f,p],()=>{E.value||(F.value=u.value.enabled??!1,L.value=u.value.bucket_capacity??2,B.value=u.value.refill_tokens??1,V.value=Math.round((u.value.refill_interval_seconds??36e3)/3600),ee.value=Math.round((u.value.min_interval_seconds??0)/60),U.value=f.value.enabled??!1,W.value=f.value.violation_threshold??2,G.value=Math.round((f.value.violation_decay_seconds??43200)/3600),K.value=Math.round((f.value.base_penalty_seconds??21600)/3600),q.value=f.value.penalty_multiplier??2,J.value=Math.round((f.value.max_penalty_seconds??86400)/3600),te.value=p.value.enabled??!1,ne.value=p.value.ewma_alpha??.1,re.value=Math.round((p.value.hysteresis_seconds??300)/60),Y.value=w.value.quiet_max??.05,X.value=w.value.normal_max??.2,Z.value=w.value.busy_max??.5)},{immediate:!0}),r(()=>{Q()});let $=()=>{F.value=u.value.enabled??!1,L.value=u.value.bucket_capacity??2,B.value=u.value.refill_tokens??1,V.value=Math.round((u.value.refill_interval_seconds??36e3)/3600),ee.value=Math.round((u.value.min_interval_seconds??0)/60),U.value=f.value.enabled??!1,W.value=f.value.violation_threshold??2,G.value=Math.round((f.value.violation_decay_seconds??43200)/3600),K.value=Math.round((f.value.base_penalty_seconds??21600)/3600),q.value=f.value.penalty_multiplier??2,J.value=Math.round((f.value.max_penalty_seconds??86400)/3600),te.value=p.value.enabled??!1,ne.value=p.value.ewma_alpha??.1,re.value=Math.round((p.value.hysteresis_seconds??300)/60),Y.value=w.value.quiet_max??.05,X.value=w.value.normal_max??.2,Z.value=w.value.busy_max??.5},ie=()=>{E.value=!0,O.value=``,k.value=``},ae=()=>{E.value=!1,O.value=``,k.value=``,$()},ce=async()=>{D.value=!0,k.value=``,O.value=``;try{let e={rate_limit_enabled:F.value,bucket_capacity:L.value,refill_tokens:B.value,refill_interval_seconds:V.value*3600,min_interval_seconds:ee.value*60,penalty_enabled:U.value,violation_threshold:W.value,violation_decay_seconds:G.value*3600,base_penalty_seconds:K.value*3600,penalty_multiplier:q.value,max_penalty_seconds:J.value*3600,adaptive_enabled:te.value,ewma_alpha:ne.value,hysteresis_seconds:re.value*60,quiet_max:Y.value,normal_max:X.value,busy_max:Z.value},t=(await j.post(`/api/update_advert_rate_limit_config`,e)).data;t.success?(O.value=t.data?.message||`Settings saved successfully`,await i.fetchStats(),await Q(),await s(),$(),E.value=!1,setTimeout(()=>{O.value=``},3e3)):(k.value=t.error||`Failed to save settings`,console.error(`[AdvertSettings] Save failed:`,t.error))}catch(e){console.error(`Failed to save advert settings:`,e),k.value=e.response?.data?.error||`Failed to save settings`}finally{D.value=!1}},{showUnsavedModal:le,requestLeave:ue,handleDiscard:de,handleSave:fe,handleCancel:pe}=se(E,D,ae,async()=>(await ce(),!E.value));n({requestLeave:ue,isEditing:E});let me=y(()=>P.value?.adaptive?.current_tier||`unknown`),he=y(()=>{switch(me.value){case`quiet`:return`bg-accent-green/20 text-accent-green border-accent-green/50`;case`normal`:return`bg-accent-cyan/20 text-accent-cyan border-accent-cyan/50`;case`busy`:return`bg-secondary/20 text-secondary border-secondary/50`;case`congested`:return`bg-accent-red/20 text-accent-red border-accent-red/50`;default:return`bg-background-mute text-content-muted border-stroke-subtle`}});return(e,n)=>(h(),C(x,null,[_(oe,{show:v(le),"is-saving":D.value,label:`Advert Limit settings`,onDiscard:v(de),onSave:v(fe),onCancel:v(pe)},null,8,[`show`,`is-saving`,`onDiscard`,`onSave`,`onCancel`]),S(`div`,Fa,[S(`div`,Ia,[n[20]||=S(`div`,null,[S(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2`},`Advert Limits`),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Configure advertisement rate limiting and adaptive controls`)],-1),S(`div`,La,[S(`button`,{onClick:n[0]||=e=>A.value=!0,class:`self-stretch flex items-center justify-center px-3 text-xs bg-primary/10 hover:bg-primary/20 text-primary rounded-lg border border-primary/30 transition-colors`,title:`How rate limiting works`},[...n[19]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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.value?(h(),C(x,{key:1},[S(`button`,{onClick:ae,disabled:D.value,class:`cfg-btn-secondary`},` Cancel `,8,Ra),S(`button`,{onClick:ce,disabled:D.value,class:`cfg-btn-primary`},t(D.value?`Saving...`:`Save Changes`),9,za)],64)):(h(),C(`button`,{key:0,onClick:ie,class:`cfg-btn-primary`},` Edit Settings `))])]),O.value?(h(),C(`div`,Ba,t(O.value),1)):g(``,!0),k.value?(h(),C(`div`,Va,t(k.value),1)):g(``,!0),S(`div`,Ha,[n[29]||=S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary`},` Current Status `,-1),M.value&&!P.value?(h(),C(`div`,Ua,[_(I,{size:`sm`}),n[21]||=S(`span`,{class:`ml-2 text-sm text-content-muted`},`Loading stats...`,-1)])):P.value?(h(),C(x,{key:2},[S(`div`,Ga,[S(`div`,Ka,[n[23]||=S(`div`,{class:`text-xs text-content-muted dark:text-content-muted`},`Mesh Tier`,-1),S(`div`,{class:T([`mt-1 px-2 py-0.5 rounded border text-xs font-medium inline-block`,he.value])},t(me.value.toUpperCase()),3)]),S(`div`,qa,[n[24]||=S(`div`,{class:`text-xs text-content-muted dark:text-content-muted`},`Adverts/min`,-1),S(`div`,Ja,t(P.value.metrics?.adverts_per_min_ewma?.toFixed(2)||`0.00`),1)]),S(`div`,Ya,[n[25]||=S(`div`,{class:`text-xs text-content-muted dark:text-content-muted`},`Allowed`,-1),S(`div`,Xa,t(P.value.stats?.adverts_allowed||0),1)]),S(`div`,Za,[n[26]||=S(`div`,{class:`text-xs text-content-muted dark:text-content-muted`},`Dropped`,-1),S(`div`,Qa,t(P.value.stats?.adverts_dropped||0),1)])]),Object.keys(P.value.active_penalties||{}).length>0?(h(),C(`div`,$a,[n[27]||=S(`div`,{class:`text-xs font-medium text-accent-red mb-1`},` Active Penalties `,-1),(h(!0),C(x,null,m(P.value.active_penalties,(e,n)=>(h(),C(`div`,{key:n,class:`text-xs font-mono text-accent-red`},t(n)+`... - `+t(Math.round(e))+`s remaining `,1))),128))])):g(``,!0),P.value.recent_drops&&P.value.recent_drops.length>0?(h(),C(`div`,eo,[n[28]||=S(`div`,{class:`text-xs font-medium text-secondary mb-1`},` Recently Dropped Adverts `,-1),(h(!0),C(x,null,m(P.value.recent_drops,(e,n)=>(h(),C(`div`,{key:n,class:`text-xs text-secondary py-0.5`},[S(`span`,to,t(e.name),1),S(`span`,no,`(`+t(e.pubkey)+`...)`,1),S(`span`,ro,` - `+t(e.reason)+` (`+t(e.seconds_ago)+`s ago)`,1)]))),128))])):g(``,!0)],64)):(h(),C(`div`,Wa,[...n[22]||=[S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},` Stats not available. Click "Refresh Stats" to load. `,-1)]])),n[30]||=d(`

There are three layers of advert rate limit control: 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.

`,1)]),S(`div`,io,[n[38]||=S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary flex items-center gap-2`},[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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`})]),b(` Token Bucket Rate Limiting `)],-1),n[39]||=S(`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),S(`div`,ao,[n[32]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Rate Limiting`,-1),E.value?c((h(),C(`select`,{key:1,"onUpdate:modelValue":n[1]||=e=>F.value=e,class:`cfg-select w-full sm:w-32`},[...n[31]||=[S(`option`,{value:!0},`Enabled`,-1),S(`option`,{value:!1},`Disabled`,-1)]],512)),[[R,F.value]]):(h(),C(`div`,oo,t(F.value?`Enabled`:`Disabled`),1))]),S(`div`,so,[n[33]||=S(`div`,null,[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Bucket Capacity`),S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},`Max burst size (adverts)`)],-1),E.value?c((h(),C(`input`,{key:1,"onUpdate:modelValue":n[2]||=e=>L.value=e,type:`number`,min:`1`,max:`10`,class:`cfg-input w-full sm:w-24`},null,512)),[[H,L.value,void 0,{number:!0}]]):(h(),C(`div`,co,t(L.value),1))]),S(`div`,lo,[n[35]||=S(`div`,null,[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Refill Interval`),S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},` Time between token refills `)],-1),E.value?(h(),C(`div`,fo,[c(S(`input`,{"onUpdate:modelValue":n[3]||=e=>V.value=e,type:`number`,min:`1`,max:`48`,class:`cfg-input w-20`},null,512),[[H,V.value,void 0,{number:!0}]]),n[34]||=S(`span`,{class:`text-content-muted text-sm`},`hours`,-1)])):(h(),C(`div`,uo,t(V.value)+` hours `,1))]),S(`div`,po,[n[37]||=S(`div`,null,[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Minimum Interval`),S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},` Hard minimum between adverts `)],-1),E.value?(h(),C(`div`,ho,[c(S(`input`,{"onUpdate:modelValue":n[4]||=e=>ee.value=e,type:`number`,min:`0`,max:`1440`,class:`cfg-input w-20`},null,512),[[H,ee.value,void 0,{number:!0}]]),n[36]||=S(`span`,{class:`text-content-muted text-sm`},`min`,-1)])):(h(),C(`div`,mo,t(ee.value)+` min `,1))])]),S(`div`,go,[n[49]||=S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary flex items-center gap-2`},[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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`})]),b(` Penalty Box (Repeat Offenders) `)],-1),n[50]||=S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},` Applies escalating cooldowns to pubkeys that repeatedly violate limits. `,-1),S(`div`,_o,[n[41]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Penalty Box`,-1),E.value?c((h(),C(`select`,{key:1,"onUpdate:modelValue":n[5]||=e=>U.value=e,class:`cfg-select w-full sm:w-32`},[...n[40]||=[S(`option`,{value:!0},`Enabled`,-1),S(`option`,{value:!1},`Disabled`,-1)]],512)),[[R,U.value]]):(h(),C(`div`,vo,t(U.value?`Enabled`:`Disabled`),1))]),S(`div`,yo,[n[42]||=S(`div`,null,[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Violation Threshold`),S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},` Violations before penalty `)],-1),E.value?c((h(),C(`input`,{key:1,"onUpdate:modelValue":n[6]||=e=>W.value=e,type:`number`,min:`1`,max:`10`,class:`cfg-input w-full sm:w-24`},null,512)),[[H,W.value,void 0,{number:!0}]]):(h(),C(`div`,bo,t(W.value),1))]),S(`div`,xo,[n[44]||=S(`div`,null,[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Base Penalty Duration`),S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},`First penalty duration`)],-1),E.value?(h(),C(`div`,Co,[c(S(`input`,{"onUpdate:modelValue":n[7]||=e=>K.value=e,type:`number`,min:`1`,max:`48`,class:`cfg-input w-20`},null,512),[[H,K.value,void 0,{number:!0}]]),n[43]||=S(`span`,{class:`text-content-muted text-sm`},`hours`,-1)])):(h(),C(`div`,So,t(K.value)+` hours `,1))]),S(`div`,wo,[n[46]||=S(`div`,null,[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Penalty Multiplier`),S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},`Escalation factor`)],-1),E.value?(h(),C(`div`,Eo,[c(S(`input`,{"onUpdate:modelValue":n[8]||=e=>q.value=e,type:`number`,min:`1`,max:`5`,step:`0.5`,class:`cfg-input w-20`},null,512),[[H,q.value,void 0,{number:!0}]]),n[45]||=S(`span`,{class:`text-content-muted text-sm`},`x`,-1)])):(h(),C(`div`,To,t(q.value)+`x `,1))]),S(`div`,Do,[n[48]||=S(`div`,null,[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Max Penalty Duration`),S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},`Maximum cooldown cap`)],-1),E.value?(h(),C(`div`,ko,[c(S(`input`,{"onUpdate:modelValue":n[9]||=e=>J.value=e,type:`number`,min:`1`,max:`168`,class:`cfg-input w-20`},null,512),[[H,J.value,void 0,{number:!0}]]),n[47]||=S(`span`,{class:`text-content-muted text-sm`},`hours`,-1)])):(h(),C(`div`,Oo,t(J.value)+` hours `,1))])]),S(`div`,Ao,[n[60]||=S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary flex items-center gap-2`},[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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`})]),b(` Adaptive Rate Limiting `)],-1),S(`div`,jo,[n[52]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Adaptive Mode`,-1),E.value?c((h(),C(`select`,{key:1,"onUpdate:modelValue":n[10]||=e=>te.value=e,class:`cfg-select w-full sm:w-32`},[...n[51]||=[S(`option`,{value:!0},`Enabled`,-1),S(`option`,{value:!1},`Disabled`,-1)]],512)),[[R,te.value]]):(h(),C(`div`,Mo,t(te.value?`Enabled`:`Disabled`),1))]),S(`div`,No,[n[54]||=S(`div`,null,[S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Tier Change Delay`),S(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},`Prevents tier flapping`)],-1),E.value?(h(),C(`div`,Fo,[c(S(`input`,{"onUpdate:modelValue":n[11]||=e=>re.value=e,type:`number`,min:`0`,max:`60`,class:`cfg-input w-20`},null,512),[[H,re.value,void 0,{number:!0}]]),n[53]||=S(`span`,{class:`text-content-muted text-sm`},`min`,-1)])):(h(),C(`div`,Po,t(re.value)+` min `,1))]),S(`div`,Io,[n[58]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm mb-2 block`},`Activity Tier Thresholds (adverts/min)`,-1),S(`div`,Lo,[S(`div`,Ro,[n[55]||=S(`div`,{class:`text-xs text-accent-green mb-1`},`Quiet Max`,-1),E.value?c((h(),C(`input`,{key:1,"onUpdate:modelValue":n[12]||=e=>Y.value=e,type:`number`,min:`0`,max:`1`,step:`0.01`,class:`cfg-input w-full py-1 text-center`},null,512)),[[H,Y.value,void 0,{number:!0}]]):(h(),C(`div`,zo,t(Y.value),1))]),S(`div`,Bo,[n[56]||=S(`div`,{class:`text-xs text-accent-cyan mb-1`},`Normal Max`,-1),E.value?c((h(),C(`input`,{key:1,"onUpdate:modelValue":n[13]||=e=>X.value=e,type:`number`,min:`0`,max:`5`,step:`0.01`,class:`cfg-input w-full py-1 text-center`},null,512)),[[H,X.value,void 0,{number:!0}]]):(h(),C(`div`,Vo,t(X.value),1))]),S(`div`,Ho,[n[57]||=S(`div`,{class:`text-xs text-secondary mb-1`},`Busy Max`,-1),E.value?c((h(),C(`input`,{key:1,"onUpdate:modelValue":n[14]||=e=>Z.value=e,type:`number`,min:`0`,max:`10`,step:`0.01`,class:`cfg-input w-full py-1 text-center`},null,512)),[[H,Z.value,void 0,{number:!0}]]):(h(),C(`div`,Uo,t(Z.value),1))])]),n[59]||=S(`p`,{class:`text-xs text-content-muted dark:text-content-muted mt-2`},` Above Busy Max = Congested tier (strictest limiting) `,-1)])]),A.value?(h(),C(`div`,{key:2,class:`fixed inset-0 bg-black/50 flex items-start justify-center z-50 p-4 overflow-y-auto`,onClick:n[18]||=z(e=>A.value=!1,[`self`])},[S(`div`,{class:`bg-background dark:bg-background-dark rounded-lg shadow-xl max-w-3xl w-full my-8`,onClick:n[17]||=z(()=>{},[`stop`])},[S(`div`,Wo,[S(`div`,Go,[n[62]||=S(`h2`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary`},` How Advert Rate Limiting Works `,-1),S(`button`,{onClick:n[15]||=e=>A.value=!1,class:`text-content-muted hover:text-content-primary dark:text-content-muted dark:hover:text-content-primary`},[...n[61]||=[S(`svg`,{class:`w-6 h-6`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),n[63]||=d(`

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),S(`div`,Ko,[S(`button`,{onClick:n[16]||=e=>A.value=!1,class:`btn-primary`},` Got it! `)])])])])):g(``,!0)],512)],64))}}),Jo={class:`modal-card max-w-2xl w-full max-h-[90vh] overflow-y-auto`},Yo={class:`flex items-center justify-between mb-7`},Xo={class:`text-xl font-semibold text-content-primary dark:text-content-primary`},Zo={class:`text-content-secondary dark:text-content-muted text-sm mt-1`},Qo={class:`grid grid-cols-2 gap-5 items-end`},$o={class:`flex items-center gap-3 pb-1.5`},es={key:0,class:`grid grid-cols-2 gap-5`},ts={class:`grid grid-cols-2 gap-5 items-end`},ns={class:`flex items-center gap-3 pb-1.5`},rs={class:`grid grid-cols-2 gap-x-5 gap-y-0`},is=[`aria-hidden`],as={class:`grid grid-cols-2 gap-5 items-center pt-4`},os={class:`flex items-center gap-3`},ss={class:`flex items-center gap-6`},cs={class:`flex items-center gap-3`},ls={class:`flex items-center gap-3`},us={class:`flex flex-wrap gap-2`},ds=[`onClick`],fs={class:`modal-actions`},ps=[`disabled`],ms=f({__name:`BrokerEditModal`,props:{show:{type:Boolean},broker:{},isNew:{type:Boolean}},emits:[`done`,`cancel`],setup(n,{emit:r}){let i=[`REQ`,`RESPONSE`,`TXT_MSG`,`ACK`,`ADVERT`,`GRP_TXT`,`GRP_DATA`,`ANON_REQ`,`PATH`,`TRACE`,`RAW_CUSTOM`],a=n,s=r;function d(e){return{...e,tls:{...e.tls},disallowedInput:[...e.disallowedInput??[]]}}let f=l({_id:0,enabled:!0,name:``,host:``,port:443,format:`letsmesh`,use_jwt_auth:!1,transport:`websockets`,disallowedInput:[],retain_status:!1,tls:{enabled:!0,insecure:!1}});o(()=>a.broker,e=>{e&&(f.value=d(e))},{immediate:!0});let v=y(()=>{let e=f.value;return e.name.trim()!==``&&e.host.trim()!==``&&e.port>=1&&e.port<=65535&&(!e.use_jwt_auth||(e.audience?.trim()??``)!==``)});function w(){let e=f.value;(!e.audience||e.audience===e.host)&&(e.audience=e.host)}function E(e){f.value.disallowedInput||(f.value.disallowedInput=[]);let t=f.value.disallowedInput.indexOf(e);t===-1?f.value.disallowedInput.push(e):f.value.disallowedInput.splice(t,1)}function D(){v.value&&s(`done`,d(f.value))}function O(){s(`cancel`)}return(r,a)=>(h(),u(p,{to:`body`},[_(V,{"enter-active-class":`transition-opacity duration-200`,"enter-from-class":`opacity-0`,"leave-active-class":`transition-opacity duration-200`,"leave-to-class":`opacity-0`},{default:e(()=>[n.show&&n.broker?(h(),C(`div`,{key:0,class:`modal-backdrop`,onClick:a[14]||=z(e=>O(),[`self`])},[S(`div`,Jo,[S(`div`,Yo,[S(`div`,null,[S(`h3`,Xo,t(n.isNew?`Add Broker`:`Edit Broker`),1),S(`p`,Zo,t(n.isNew?`Configure a new MQTT broker`:`Editing ${n.broker.name||`(unnamed)`}`),1)]),S(`button`,{onClick:O,class:`text-content-secondary dark:text-white/60 hover:text-content-primary dark:hover:text-white transition-colors`},[...a[15]||=[S(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),S(`form`,{onSubmit:z(D,[`prevent`]),class:`modal-form`},[S(`div`,null,[a[16]||=S(`label`,{class:`modal-field-label`},[b(` Name `),S(`span`,{class:`text-red-500`},`*`)],-1),c(S(`input`,{"onUpdate:modelValue":a[0]||=e=>f.value.name=e,type:`text`,placeholder:`Broker Name`,class:`modal-input`},null,512),[[H,f.value.name]])]),S(`div`,Qo,[S(`div`,null,[a[18]||=S(`label`,{class:`modal-field-label`},[b(` Format `),S(`span`,{class:`text-red-500`},`*`)],-1),c(S(`select`,{"onUpdate:modelValue":a[1]||=e=>f.value.format=e,class:`modal-select`},[...a[17]||=[S(`option`,{value:`meshcoretomqtt`},`Meshcoretomqtt`,-1),S(`option`,{value:`letsmesh`},`Letsmesh`,-1),S(`option`,{value:`waev`},`Waev`,-1),S(`option`,{value:`mqtt`},`pyMC`,-1)]],512),[[R,f.value.format]])]),S(`div`,$o,[S(`button`,{type:`button`,onClick:a[2]||=e=>f.value.enabled=!f.value.enabled,class:T([`relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full transition-colors duration-200 ease-in-out focus:outline-none`,f.value.enabled?`bg-primary`:`bg-gray-200 dark:bg-white/15`])},[S(`span`,{class:T([`pointer-events-none absolute top-0.5 left-0.5 inline-block h-4 w-4 transform rounded-full bg-white shadow transition duration-200 ease-in-out`,f.value.enabled?`translate-x-4`:`translate-x-0`])},null,2)],2),a[19]||=S(`span`,{class:`text-sm font-medium text-content-primary dark:text-content-primary`},`Enabled`,-1)])]),f.value.format===`mqtt`?(h(),C(`div`,es,[S(`div`,null,[a[20]||=S(`label`,{class:`modal-field-label`},[b(` MQTT Base Topic `),S(`span`,{class:`font-normal text-content-muted dark:text-content-muted/60 ml-1`},`(e.g. meshcore/repeater)`)],-1),c(S(`input`,{"onUpdate:modelValue":a[3]||=e=>f.value.base_topic=e,placeholder:`meshcore/repeater`,class:`modal-input`},null,512),[[H,f.value.base_topic]])]),a[21]||=S(`div`,null,null,-1)])):g(``,!0),S(`div`,ts,[S(`div`,null,[a[23]||=S(`label`,{class:`modal-field-label`},[b(` Transport `),S(`span`,{class:`text-red-500`},`*`)],-1),c(S(`select`,{"onUpdate:modelValue":a[4]||=e=>f.value.transport=e,class:`modal-select`},[...a[22]||=[S(`option`,{value:`websockets`},`Websockets`,-1),S(`option`,{value:`tcp`},`TCP`,-1)]],512),[[R,f.value.transport]])]),S(`div`,ns,[S(`button`,{type:`button`,onClick:a[5]||=e=>f.value.use_jwt_auth=!f.value.use_jwt_auth,class:T([`relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full transition-colors duration-200 ease-in-out focus:outline-none`,f.value.use_jwt_auth?`bg-primary`:`bg-gray-200 dark:bg-white/15`])},[S(`span`,{class:T([`pointer-events-none absolute top-0.5 left-0.5 inline-block h-4 w-4 transform rounded-full bg-white shadow transition duration-200 ease-in-out`,f.value.use_jwt_auth?`translate-x-4`:`translate-x-0`])},null,2)],2),a[24]||=S(`span`,{class:`text-sm font-medium text-content-primary dark:text-content-primary`},`Use JWT Auth`,-1)])]),S(`div`,rs,[S(`div`,null,[a[25]||=S(`label`,{class:`modal-field-label`},[b(` Host `),S(`span`,{class:`text-red-500`},`*`)],-1),c(S(`input`,{"onUpdate:modelValue":a[6]||=e=>f.value.host=e,type:`text`,placeholder:`mqtt.myserver.com`,onBlur:w,class:`modal-input font-mono`},null,544),[[H,f.value.host]])]),S(`div`,null,[f.value.use_jwt_auth?(h(),C(x,{key:0},[a[26]||=S(`label`,{class:`modal-field-label`},[b(` Audience `),S(`span`,{class:`text-red-500`},`*`),S(`span`,{class:`font-normal text-content-muted dark:text-content-muted/60 ml-1`},`(usually same as host)`)],-1),c(S(`input`,{"onUpdate:modelValue":a[7]||=e=>f.value.audience=e,type:`text`,placeholder:`mqtt.myserver.com`,class:`modal-input font-mono`},null,512),[[H,f.value.audience]])],64)):(h(),C(x,{key:1},[a[27]||=S(`label`,{class:`modal-field-label`},[b(` Username `),S(`span`,{class:`font-normal text-content-muted dark:text-content-muted/60 ml-1`},`(blank = anonymous)`)],-1),a[28]||=S(`input`,{type:`text`,autocomplete:`username`,style:{display:`none`}},null,-1),c(S(`input`,{autocomplete:`username`,"onUpdate:modelValue":a[8]||=e=>f.value.username=e,type:`text`,placeholder:`username`,class:`modal-input`},null,512),[[H,f.value.username]])],64))]),S(`div`,null,[a[29]||=S(`label`,{class:`modal-field-label`},[b(` Port `),S(`span`,{class:`text-red-500`},`*`),S(`span`,{class:`font-normal text-content-muted dark:text-content-muted/60 ml-1`},`(443 WS, 1883 TCP)`)],-1),c(S(`input`,{"onUpdate:modelValue":a[9]||=e=>f.value.port=e,type:`number`,min:`0`,max:`65535`,class:`modal-input font-mono`},null,512),[[H,f.value.port,void 0,{number:!0}]])]),S(`div`,{class:T(f.value.use_jwt_auth?`invisible pointer-events-none`:``),"aria-hidden":f.value.use_jwt_auth?`true`:void 0},[a[30]||=S(`label`,{class:`modal-field-label`},`Password`,-1),a[31]||=S(`input`,{type:`password`,autocomplete:`current-password`,style:{display:`none`}},null,-1),c(S(`input`,{autocomplete:`new-password`,"onUpdate:modelValue":a[10]||=e=>f.value.password=e,type:`password`,readonly:``,onfocus:`this.removeAttribute('readonly');`,onblur:`this.setAttribute('readonly', true);`,class:`modal-input`},null,512),[[H,f.value.password]])],10,is)]),S(`div`,as,[S(`div`,os,[S(`button`,{type:`button`,onClick:a[11]||=e=>f.value.retain_status=!f.value.retain_status,class:T([`relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full transition-colors duration-200 ease-in-out focus:outline-none`,f.value.retain_status?`bg-primary`:`bg-gray-200 dark:bg-white/15`])},[S(`span`,{class:T([`pointer-events-none absolute top-0.5 left-0.5 inline-block h-4 w-4 transform rounded-full bg-white shadow transition duration-200 ease-in-out`,f.value.retain_status?`translate-x-4`:`translate-x-0`])},null,2)],2),a[32]||=S(`div`,null,[S(`span`,{class:`text-sm font-medium text-content-primary dark:text-content-primary`},`Retain Status`),S(`span`,{class:`text-xs text-content-muted dark:text-content-muted/60 ml-1`},`(MQTT retained)`)],-1)]),S(`div`,ss,[S(`div`,cs,[S(`button`,{type:`button`,onClick:a[12]||=e=>f.value.tls.enabled=!f.value.tls.enabled,class:T([`relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full transition-colors duration-200 ease-in-out focus:outline-none`,f.value.tls.enabled?`bg-primary`:`bg-gray-200 dark:bg-white/15`])},[S(`span`,{class:T([`pointer-events-none absolute top-0.5 left-0.5 inline-block h-4 w-4 transform rounded-full bg-white shadow transition duration-200 ease-in-out`,f.value.tls.enabled?`translate-x-4`:`translate-x-0`])},null,2)],2),a[33]||=S(`span`,{class:`text-sm font-medium text-content-primary dark:text-content-primary`},`TLS`,-1)]),S(`div`,ls,[S(`button`,{type:`button`,onClick:a[13]||=e=>f.value.tls.insecure=!f.value.tls.insecure,class:T([`relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full transition-colors duration-200 ease-in-out focus:outline-none`,f.value.tls.insecure?`bg-amber-500`:`bg-gray-200 dark:bg-white/15`])},[S(`span`,{class:T([`pointer-events-none absolute top-0.5 left-0.5 inline-block h-4 w-4 transform rounded-full bg-white shadow transition duration-200 ease-in-out`,f.value.tls.insecure?`translate-x-4`:`translate-x-0`])},null,2)],2),a[34]||=S(`span`,{class:`text-sm font-medium text-content-primary dark:text-content-primary`},`Insecure`,-1)])])]),S(`div`,null,[a[35]||=S(`label`,{class:`modal-field-label`},[b(` Block Packet Types `),S(`span`,{class:`text-content-secondary dark:text-content-muted font-normal text-xs ml-1`},`(prevent publishing to broker)`)],-1),S(`div`,us,[(h(),C(x,null,m(i,e=>S(`button`,{key:e,type:`button`,onClick:t=>E(e),class:T([`px-2.5 py-1 rounded text-xs font-mono font-medium border transition-colors`,f.value.disallowedInput?.includes(e)?`bg-red-100 dark:bg-red-900/30 border-red-300 dark:border-red-700/50 text-red-700 dark:text-red-400`:`bg-background-mute dark:bg-white/5 border-stroke-subtle dark:border-stroke/10 text-content-secondary dark:text-content-muted hover:border-primary/40`])},t(e),11,ds)),64))]),a[36]||=S(`p`,{class:`mt-2 text-xs text-content-secondary dark:text-content-muted`},[S(`span`,{class:`text-red-600 dark:text-red-400 font-medium`},`Red = blocked.`),b(` Leave all unselected to publish all packet types. `)],-1)]),S(`div`,fs,[S(`button`,{type:`button`,onClick:O,class:`modal-btn-cancel`},` Cancel `),S(`button`,{type:`submit`,disabled:!v.value,class:T([`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`])},` Done `,10,ps)])],32)])])):g(``,!0)]),_:1})]))}}),hs={class:`space-y-12`},gs={class:`cfg-page-heading flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3`},_s={class:`flex items-center gap-2 flex-shrink-0`},vs=[`disabled`],ys=[`disabled`],bs={key:0,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`},xs={class:`cfg-section`},Ss={key:0,class:`text-sm text-content-secondary dark:text-content-muted`},Cs={key:1,class:`space-y-3`},ws={class:`flex items-center gap-2`},Ts={key:0,class:`space-y-2`},Es=[`title`],Ds={key:1,class:`text-sm text-content-muted dark:text-content-muted/60 italic`},Os={class:`cfg-card p-6`},ks={key:0,class:`grid grid-cols-1 sm:grid-cols-2 gap-x-8 gap-y-3`},As={class:`flex flex-col py-1 border-b border-stroke-subtle dark:border-stroke/10`},js={class:`text-content-primary dark:text-content-primary font-mono text-sm mt-0.5`},Ms={class:`flex flex-col py-1 border-b border-stroke-subtle dark:border-stroke/10`},Ns={class:`text-content-primary dark:text-content-primary text-sm mt-0.5`},Ps={class:`flex flex-col py-1`},Fs={class:`text-content-primary dark:text-content-primary text-sm mt-0.5`},Is={class:`flex flex-col py-1`},Ls={class:`text-content-primary dark:text-content-primary text-sm mt-0.5`},Rs={key:1,class:`space-y-3`},zs={class:`grid grid-cols-1 sm:grid-cols-2 gap-3`},Bs={class:`cfg-card p-6`},Vs={class:`flex items-start justify-between mb-4`},Hs={key:0,class:`flex items-center gap-2 flex-shrink-0 ml-4`},Us={class:`relative`},Ws={key:0,class:`absolute right-0 top-full mt-1 z-20 w-72 rounded-lg shadow-lg border border-stroke-subtle dark:border-stroke/20 bg-white dark:bg-[var(--color-surface)] overflow-hidden`},Gs={key:0,class:`px-3 py-3 text-xs text-content-secondary dark:text-content-muted italic`},Ks={key:1,class:`px-3 py-3 text-xs text-red-600 dark:text-red-400`},qs={key:2,class:`px-3 py-3 text-xs text-content-secondary dark:text-content-muted italic`},Js={key:3,class:`py-1`},Ys=[`onClick`],Xs={class:`min-w-0 flex-1`},Zs={class:`text-sm font-medium text-content-primary dark:text-content-primary group-hover:text-primary transition-colors`},Qs={class:`text-xs text-content-secondary dark:text-content-muted`},$s=[`onClick`,`title`],ec=[`href`],tc={key:0,class:`bg-background-mute/40 dark:bg-background/20 border-t border-stroke-subtle dark:border-stroke/10`},nc=[`onClick`],rc={class:`min-w-0 flex-1`},ic={class:`text-xs font-medium text-content-primary dark:text-content-primary truncate`},ac={class:`text-[11px] font-mono text-content-secondary dark:text-content-muted truncate`},oc={key:0,class:`flex flex-col items-center justify-center py-8 rounded-lg border-2 border-dashed border-stroke-subtle dark:border-stroke/20 text-content-secondary dark:text-content-muted`},sc={key:0,class:`text-xs mt-0.5 opacity-70`},cc={key:1,class:`space-y-2`},lc={class:`flex items-center gap-3 px-4 py-2.5`},uc={class:`min-w-0 flex-1 flex items-center gap-2 flex-wrap`},dc={class:`text-sm font-medium text-content-primary dark:text-content-primary`},fc={class:`text-xs font-mono text-content-secondary dark:text-content-muted`},pc={key:0,class:`flex items-center gap-1.5 flex-shrink-0`},mc=[`onClick`],hc=[`onClick`],gc=F(f({__name:`LetsMeshSettings`,setup(i,{expose:a}){let s=N(),u=y(()=>s.stats?.config?.mqtt_brokers||{}),d=l([]),f=l(!1),p=l(``),w=l(null);function E(e){return{...e,tls:{...e.tls},disallowedInput:[...e.disallowedInput??[]]}}let D=l(!1),O=l(!1),k=l(``),A=l(!1),M=l(null),P=l(!1),F=l(``),I=l(300),L=l(``),R=l(``),B=l([]),U=l(null),W=l(!1),G=l(null),K=l({_id:0,enabled:!0,name:``,host:``,port:443,format:`letsmesh`,use_jwt_auth:!1,transport:`websockets`,disallowedInput:[],retain_status:!1,tls:{enabled:!0,insecure:!1}}),q=l(!1),J=l(null),te=l(!1);async function ne(){if(!te.value){te.value=!0;try{let e=await j.get(`/api/mqtt_status`);e.data?.success&&(J.value=e.data.data)}catch{}finally{te.value=!1}}}let re=1;function Y(e={}){return{_id:re++,enabled:e.enabled??!0,name:e.name??``,host:e.host??``,port:e.port??0,audience:e.audience??``,format:e.format??`letsmesh`,use_jwt_auth:e.use_jwt_auth??!1,username:e.username??``,password:e.password??``,transport:e.transport??`websockets`,disallowedInput:Array.isArray(e.disallowedInput)?[...e.disallowedInput]:[],retain_status:e.retain_status??!1,base_topic:e.base_topic??``,tls:{enabled:e.tls?.enabled??!1,insecure:e.tls?.insecure??!1}}}function X(){let e=u.value;F.value=e.iata_code??``,I.value=e.status_interval??300,L.value=e.owner??``,R.value=e.email??``,B.value=Array.isArray(e.brokers)?e.brokers.map(e=>Y(e)):[]}o(u,()=>{D.value||X()},{immediate:!0});function Z(){return{iata_code:F.value,status_interval:I.value,owner:L.value,email:R.value,brokers:B.value.map(e=>{let t={name:e.name,enabled:e.enabled,transport:e.transport,host:e.host,port:e.port,use_jwt_auth:e.use_jwt_auth,format:e.format,disallowed_packet_types:e.disallowedInput,base_topic:e.base_topic,retain_status:e.retain_status,tls:{enabled:e.tls?.enabled??!1,insecure:e.tls?.insecure??!1}};return e.use_jwt_auth?{...t,audience:e.audience}:{...t,username:e.username,password:e.password}})}}async function Q(){try{let e=(await j.post(`/api/update_mqtt_config`,Z())).data;return e?.success?(await s.fetchStats(),await ne(),{success:!0}):{success:!1,error:e?.error||`Save failed`}}catch(e){let t=e;return{success:!1,error:t?.response?.data?.error||t?.message||`Request failed`}}}function $(){X(),M.value={iata:F.value,interval:I.value,owner:L.value,email:R.value,brokers:B.value.map(E)},D.value=!0,k.value=``}function ie(){M.value&&(F.value=M.value.iata,I.value=M.value.interval,L.value=M.value.owner,R.value=M.value.email,B.value=M.value.brokers.map(E)),U.value=null,W.value=!1,G.value=null,P.value=!1,D.value=!1,M.value=null,k.value=``}async function ae(){if(U.value!==null){let e=K.value;if(!e.name.trim()||!e.host.trim()){k.value=`Please complete or cancel the open broker edit before saving.`;return}de()}O.value=!0,k.value=``;let e=await Q();O.value=!1,e.success?(D.value=!1,P.value=!1,M.value=null,A.value=!0):k.value=e.error}function ce(){U.value!==null&&ue();let e=Y();B.value.push(e),G.value=null,W.value=!0,K.value=E(e),U.value=e._id}function le(e){U.value!==null&&U.value!==e._id&&ue(),G.value=E(e),W.value=!1,K.value=E(e),U.value=e._id}function ue(){if(W.value&&U.value!==null)B.value=B.value.filter(e=>e._id!==U.value);else if(G.value){let e=B.value.findIndex(e=>e._id===G.value._id);e!==-1&&B.value.splice(e,1,E(G.value))}U.value=null,W.value=!1,G.value=null}function de(){let e=K.value,t=B.value.findIndex(t=>t._id===e._id);t!==-1&&B.value.splice(t,1,E(e)),U.value=null,W.value=!1,G.value=null}function fe(e){K.value=e,de()}function pe(e){B.value=B.value.filter(t=>t._id!==e),U.value===e&&(U.value=null,W.value=!1,G.value=null)}function me(e){q.value=!1,w.value=null,U.value!==null&&ue(),e.brokers.forEach(e=>B.value.push(Y(e)))}function he(e){q.value=!1,w.value=null,U.value!==null&&ue(),B.value.push(Y(e))}function ge(e){w.value=w.value===e?null:e}async function _e(){f.value=!0,p.value=``;try{let e=(await j.get(`/api/broker_presets`)).data;e?.success&&Array.isArray(e.data)?d.value=e.data:(d.value=[],p.value=e?.error||`Failed to load broker presets`)}catch(e){d.value=[],e?.response?.status===404?p.value=``:p.value=`Could not reach repeater for broker presets`}finally{f.value=!1}}let ve=y(()=>{let e=K.value;return e.name.trim()!==``&&e.host.trim()!==``&&e.port>=1&&e.port<=65535&&(!e.use_jwt_auth||(e.audience?.trim()??``)!==``)});async function ye(){U.value!==null&&ve.value&&de(),O.value=!0,k.value=``;let e=await Q();return O.value=!1,e.success?(D.value=!1,P.value=!1,M.value=null,A.value=!0,!0):(k.value=e.error??`Save failed`,!1)}let{showUnsavedModal:be,requestLeave:xe,handleDiscard:Se,handleSave:Ce,handleCancel:we}=se(D,O,ie,ye);a({requestLeave:xe,isEditing:D});let Te=null;return r(()=>{ne(),_e(),Te=setInterval(ne,5e3)}),n(()=>{Te&&clearInterval(Te)}),(n,r)=>(h(),C(x,null,[_(ee,{modelValue:A.value,"onUpdate:modelValue":r[0]||=e=>A.value=e,message:`Broker settings have been saved. A service restart is required for the changes to take effect.`},null,8,[`modelValue`]),_(ms,{show:U.value!==null,broker:U.value===null?null:K.value,"is-new":W.value,onDone:fe,onCancel:ue},null,8,[`show`,`broker`,`is-new`]),_(oe,{show:v(be),"is-saving":O.value,label:`Broker settings`,onDiscard:v(Se),onSave:v(Ce),onCancel:v(we)},null,8,[`show`,`is-saving`,`onDiscard`,`onSave`,`onCancel`]),S(`div`,hs,[S(`div`,gs,[r[8]||=S(`div`,null,[S(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2`},` Observer Configuration `),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},` Configure LetsMesh observer settings, MQTT brokers, and connection status `)],-1),S(`div`,_s,[D.value?(h(),C(x,{key:1},[S(`button`,{onClick:ie,disabled:O.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,vs),S(`button`,{onClick:ae,disabled:O.value,class:`btn-primary`},t(O.value?`Saving…`:`Save Settings`),9,ys)],64)):(h(),C(`button`,{key:0,onClick:$,class:`btn-primary`},` Edit Settings `))])]),k.value?(h(),C(`div`,bs,t(k.value),1)):g(``,!0),S(`div`,xs,[r[10]||=S(`div`,{class:`mb-4`},[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},`Observer Status`),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},`Live LetsMesh broker connection state`)],-1),J.value?(h(),C(`div`,Cs,[S(`div`,ws,[r[9]||=S(`span`,{class:`text-sm text-content-secondary dark:text-content-muted w-36`},`Handler`,-1),S(`span`,{class:T([`inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium`,J.value.handler_active?`bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400`:`bg-gray-100 dark:bg-gray-800/50 text-gray-500 dark:text-gray-400`])},[S(`span`,{class:T([`w-1.5 h-1.5 rounded-full`,J.value.handler_active?`bg-green-500`:`bg-gray-400`])},null,2),b(` `+t(J.value.handler_active?`Active`:`Inactive`),1)],2)]),J.value.brokers.length?(h(),C(`div`,Ts,[(h(!0),C(x,null,m(J.value.brokers,e=>(h(),C(`div`,{key:e.host,class:`flex items-center gap-2`},[S(`span`,{class:`text-sm text-content-secondary dark:text-content-muted w-36 truncate`,title:e.name},t(e.name),9,Es),S(`span`,{class:T([`inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium`,e.status.connected?`bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400`:e.status.reconnecting?`bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400`:`bg-red-100 dark:bg-red-900/30 text-red-600 dark:text-red-400`])},[S(`span`,{class:T([`w-1.5 h-1.5 rounded-full`,e.status.connected?`bg-green-500`:e.status.reconnecting?`bg-amber-500`:`bg-red-500`])},null,2),b(` `+t(e.status.connected?`Connected`:e.status.reconnecting?`Reconnecting…`:`Disconnected`),1)],2)]))),128))])):(h(),C(`div`,Ds,`No broker connections configured.`))])):(h(),C(`div`,Ss,` Status unavailable — service may not be running. `))]),S(`div`,Os,[r[19]||=S(`div`,{class:`mb-4`},[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},`Observer Setup`),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},`IATA code, status interval, and owner details`)],-1),S(`div`,null,[D.value?g(``,!0):(h(),C(`div`,ks,[S(`div`,As,[r[11]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`IATA Code`,-1),S(`span`,js,t(u.value.iata_code||`—`),1)]),S(`div`,Ms,[r[12]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Status Interval`,-1),S(`span`,Ns,t(u.value.status_interval??300)+`s`,1)]),S(`div`,Ps,[r[13]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Owner`,-1),S(`span`,Fs,t(u.value.owner||`—`),1)]),S(`div`,Is,[r[14]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Email`,-1),S(`span`,Ls,t(u.value.email||`—`),1)])])),D.value?(h(),C(`div`,Rs,[S(`div`,zs,[S(`div`,null,[r[15]||=S(`label`,{class:`block text-xs sm:text-sm text-content-secondary dark:text-content-muted mb-1`},[b(` IATA Code `),S(`span`,{class:`text-content-muted dark:text-content-muted/60 text-xs`},`(e.g. SFO, LHR)`)],-1),c(S(`input`,{"onUpdate:modelValue":r[1]||=e=>F.value=e,type:`text`,maxlength:`10`,placeholder:`TEST`,class:`cfg-input font-mono`},null,512),[[H,F.value]])]),S(`div`,null,[r[16]||=S(`label`,{class:`block text-xs sm:text-sm text-content-secondary dark:text-content-muted mb-1`},[b(` Status Interval `),S(`span`,{class:`text-content-muted dark:text-content-muted/60 text-xs`},`(seconds, min 60)`)],-1),c(S(`input`,{"onUpdate:modelValue":r[2]||=e=>I.value=e,type:`number`,min:`60`,max:`3600`,class:`cfg-input font-mono`},null,512),[[H,I.value,void 0,{number:!0}]])]),S(`div`,null,[r[17]||=S(`label`,{class:`block text-xs sm:text-sm text-content-secondary dark:text-content-muted mb-1`},`Owner Companion Pubkey`,-1),c(S(`input`,{"onUpdate:modelValue":r[3]||=e=>L.value=e,type:`text`,placeholder:`Optional`,class:`cfg-input`},null,512),[[H,L.value]])]),S(`div`,null,[r[18]||=S(`label`,{class:`block text-xs sm:text-sm text-content-secondary dark:text-content-muted mb-1`},`Email`,-1),c(S(`input`,{"onUpdate:modelValue":r[4]||=e=>R.value=e,type:`email`,placeholder:`Optional`,class:`cfg-input`},null,512),[[H,R.value]])])])])):g(``,!0)])]),S(`div`,Bs,[S(`div`,Vs,[r[27]||=S(`div`,null,[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},`Broker Settings`),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},`MQTT brokers for observer publishing`)],-1),D.value?(h(),C(`div`,Hs,[S(`div`,Us,[S(`button`,{onClick:r[5]||=e=>q.value=!q.value,class:`inline-flex items-center gap-1.5 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`},[r[21]||=b(` From Template `,-1),(h(),C(`svg`,{class:T([`w-3 h-3 transition-transform`,q.value?`rotate-180`:``]),fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[...r[20]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M19 9l-7 7-7-7`},null,-1)]],2))]),_(V,{name:`dropdown`},{default:e(()=>[q.value?(h(),C(`div`,Ws,[r[25]||=S(`div`,{class:`px-3 py-2 border-b border-stroke-subtle dark:border-stroke/10`},[S(`p`,{class:`text-xs font-medium text-content-secondary dark:text-content-muted uppercase tracking-wide`},`Known Networks`)],-1),f.value?(h(),C(`div`,Gs,` Loading presets… `)):p.value?(h(),C(`div`,Ks,t(p.value),1)):d.value.length?(h(),C(`div`,Js,[(h(!0),C(x,null,m(d.value,e=>(h(),C(`div`,{key:e.id,class:`border-b border-stroke-subtle dark:border-stroke/10 last:border-b-0`},[S(`div`,{class:`flex items-center gap-2 px-3 py-2.5 hover:bg-background-mute dark:hover:bg-background/30 cursor-pointer group`,onClick:t=>me(e)},[S(`div`,Xs,[S(`p`,Zs,t(e.name),1),S(`p`,Qs,t(e.brokers.length)+` broker`+t(e.brokers.length===1?``:`s`),1)]),e.brokers.length>1?(h(),C(`button`,{key:0,onClick:z(t=>ge(e.id),[`stop`]),title:w.value===e.id?`Hide individual brokers`:`Pick individual brokers`,class:`flex-shrink-0 p-1 rounded hover:bg-primary/10 text-content-secondary dark:text-content-muted hover:text-primary transition-colors`},[(h(),C(`svg`,{class:T([`w-3.5 h-3.5 transition-transform`,w.value===e.id?`rotate-180`:``]),fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[...r[22]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M19 9l-7 7-7-7`},null,-1)]],2))],8,$s)):g(``,!0),e.website?(h(),C(`a`,{key:1,href:e.website,target:`_blank`,rel:`noopener noreferrer`,title:`Visit website`,class:`flex-shrink-0 p-1 rounded hover:bg-primary/10 text-content-secondary dark:text-content-muted hover:text-primary transition-colors`,onClick:r[6]||=z(()=>{},[`stop`])},[...r[23]||=[S(`svg`,{class:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14`})],-1)]],8,ec)):g(``,!0)],8,Ys),w.value===e.id&&e.brokers.length>1?(h(),C(`div`,tc,[(h(!0),C(x,null,m(e.brokers,(n,i)=>(h(),C(`div`,{key:`${e.id}-${i}`,class:`flex items-center gap-2 pl-6 pr-3 py-2 hover:bg-background-mute dark:hover:bg-background/30 cursor-pointer`,onClick:e=>he(n)},[S(`div`,rc,[S(`p`,ic,t(n.name),1),S(`p`,ac,t(n.host)+`:`+t(n.port),1)]),r[24]||=S(`span`,{class:`flex-shrink-0 inline-flex items-center justify-center w-5 h-5 rounded bg-primary/10 text-primary text-xs font-bold`,title:`Add only this broker`},`+`,-1)],8,nc))),128))])):g(``,!0)]))),128))])):(h(),C(`div`,qs,` No bundled presets. Use "Add" to configure manually. `))])):g(``,!0)]),_:1}),q.value?(h(),C(`div`,{key:0,class:`fixed inset-0 z-10`,onClick:r[7]||=e=>q.value=!1})):g(``,!0)]),S(`button`,{onClick:ce,class:`btn-primary inline-flex items-center gap-1.5`},[...r[26]||=[S(`svg`,{class:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 4v16m8-8H4`})],-1),b(` Add `,-1)]])])):g(``,!0)]),B.value.length?(h(),C(`div`,cc,[(h(!0),C(x,null,m(B.value,e=>(h(),C(`div`,{key:e._id,class:`cfg-card overflow-hidden`},[S(`div`,lc,[S(`div`,uc,[S(`span`,{class:T([`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium`,e.enabled?`bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400`:`bg-red-100 dark:bg-red-900/30 text-red-600 dark:text-red-400`])},[S(`span`,{class:T([`w-1.5 h-1.5 rounded-full`,e.enabled?`bg-green-500`:`bg-red-500`])},null,2),b(` `+t(e.enabled?`Enabled`:`Disabled`),1)],2),S(`span`,dc,t(e.name||`(unnamed)`),1),S(`span`,fc,t(e.host||`—`)+`:`+t(e.port),1)]),D.value?(h(),C(`div`,pc,[S(`button`,{onClick:t=>le(e),class:`px-2.5 py-1 text-xs bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded border border-primary/50 transition-colors`},` Edit `,8,mc),S(`button`,{onClick:t=>pe(e._id),title:`Remove`,class:`p-1.5 rounded hover:bg-red-500/10 dark:hover:bg-red-900/20 text-content-secondary dark:text-content-muted hover:text-red-600 dark:hover:text-red-400 transition-colors`},[...r[30]||=[S(`svg`,{class:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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,hc)])):g(``,!0)])]))),128))])):(h(),C(`div`,oc,[r[28]||=S(`svg`,{class:`w-7 h-7 mb-2 opacity-40`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`1.5`,d:`M5 12h14M5 12l4-4m-4 4l4 4`})],-1),r[29]||=S(`p`,{class:`text-sm`},`No brokers configured`,-1),D.value?(h(),C(`p`,sc,`Use Add or From Template above`)):g(``,!0)]))])])],64))}}),[[`__scopeId`,`data-v-de709eb9`]]),_c={class:`space-y-12`},vc={key:0,class:`rounded-lg border-2 border-red-500/50 dark:border-red-400/40 bg-red-100 dark:bg-red-500/10 p-4`},yc={class:`cfg-section`},bc=[`disabled`],xc={key:0,class:`flex items-center gap-2`},Sc={key:1,class:`flex items-center gap-2`},Cc={key:0,class:`text-xs text-green-600 dark:text-green-400 mt-2`},wc={key:1,class:`text-xs text-red-500 dark:text-red-400 mt-2`},Tc={class:`cfg-section`},Ec={key:0},Dc={key:1,class:`rounded-lg border-2 border-red-500/50 dark:border-red-400/40 bg-red-50 dark:bg-red-500/10 p-4`},Oc={class:`flex items-start gap-3`},kc={class:`flex-1`},Ac={class:`text-xs text-red-600 dark:text-red-400/80 mt-1`},jc={class:`flex gap-2 mt-3`},Mc=[`disabled`],Nc=[`disabled`],Pc={key:2,class:`text-xs text-green-600 dark:text-green-400 mt-2`},Fc={key:3,class:`text-xs text-red-500 dark:text-red-400 mt-2`},Ic={class:`cfg-section`},Lc={class:`space-y-3`},Rc={class:`flex items-center gap-3 cursor-pointer px-4 py-3 bg-background-mute dark:bg-background/30 rounded-lg border-2 border-dashed border-stroke-subtle dark:border-stroke/20 hover:border-cyan-500/50 dark:hover:border-primary/50 transition-colors`},zc={class:`text-sm text-content-secondary dark:text-content-muted`},Bc={key:0,class:`bg-background-mute dark:bg-background/30 rounded-lg p-4 border border-stroke-subtle dark:border-stroke/10`},Vc={key:0,class:`text-xs text-content-secondary dark:text-content-muted space-y-1 mb-3`},Hc={class:`font-mono`},Uc={class:`font-mono`},Wc={key:0,class:`text-amber-600 dark:text-amber-400 font-medium`},Gc={key:1,class:`text-content-muted`},Kc={class:`text-xs text-content-secondary dark:text-content-muted`},qc={class:`font-mono`},Jc={key:1},Yc={key:2,class:`rounded-lg border-2 border-amber-500/50 dark:border-amber-400/40 bg-amber-50 dark:bg-amber-500/10 p-4`},Xc={class:`flex items-start gap-3`},Zc={class:`flex-1`},Qc={class:`text-xs text-amber-700 dark:text-amber-300/80 mt-1`},$c={class:`flex gap-2 mt-3`},el=[`disabled`],tl=[`disabled`],nl={key:3,class:`text-xs text-green-600 dark:text-green-400 mt-2`},rl={key:4,class:`text-xs text-red-500 dark:text-red-400 mt-2`},il={class:`cfg-section`},al={key:0},ol={key:1,class:`rounded-lg border-2 border-red-500/50 dark:border-red-400/40 bg-red-50 dark:bg-red-500/10 p-4`},sl={class:`flex items-start gap-3`},cl={class:`flex-1`},ll={class:`text-xs text-red-600 dark:text-red-400/80 mt-1`},ul={class:`flex gap-2 mt-3`},dl=[`disabled`],fl=[`disabled`],pl={key:2,class:`bg-background-mute dark:bg-background/30 rounded-lg p-4 border border-stroke-subtle dark:border-stroke/10 space-y-2`},ml={class:`flex items-center justify-between`},hl={class:`text-xs text-content-secondary dark:text-content-muted space-y-1`},gl={class:`font-mono`},_l={key:0},vl={class:`font-mono`},yl={key:1},bl={class:`font-mono text-[10px] break-all`},xl={key:3,class:`text-xs text-red-500 dark:text-red-400 mt-2`},Sl=f({__name:`BackupRestore`,setup(e){let n=y(()=>window.location.protocol===`http:`),r=l(!1),i=l(``),a=l(``);async function o(){r.value=!0,i.value=``,a.value=``;try{let e=await M.exportConfig(!1);if(!e.success||!e.data){a.value=e.error||`Export failed`;return}let t=new Blob([JSON.stringify(e.data,null,2)],{type:`application/json`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`pymc-repeater-settings-${(e.data.meta?.exported_at||new Date().toISOString()).replace(/[:.]/g,`-`)}.json`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n),i.value=`Settings exported successfully (secrets redacted).`}catch(e){a.value=e instanceof Error?e.message:`Export failed`}finally{r.value=!1}}let s=l(!1),c=l(!1),u=l(``),f=l(``);async function p(){c.value=!0,u.value=``,f.value=``;try{let e=await M.exportConfig(!0);if(!e.success||!e.data){f.value=e.error||`Export failed`;return}let t=new Blob([JSON.stringify(e.data,null,2)],{type:`application/json`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`pymc-repeater-full-backup-${(e.data.meta?.exported_at||new Date().toISOString()).replace(/[:.]/g,`-`)}.json`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n),u.value=`Full backup exported (includes all secrets).`,s.value=!1}catch(e){f.value=e instanceof Error?e.message:`Export failed`}finally{c.value=!1}}let m=l(null),v=l(null),w=l(!1),T=l(!1),E=l(``),D=l(``),O=l(null),k=y(()=>v.value?.config?Object.keys(v.value.config).join(`, `):``),A=y(()=>{let e=v.value?.meta?.includes_secrets;return e===!0||e===`true`});function j(e){let t=e.target.files?.[0];if(!t)return;m.value=t,v.value=null,w.value=!1,E.value=``,D.value=``;let n=new FileReader;n.onload=e=>{try{let t=JSON.parse(e.target?.result);t.config&&typeof t.config==`object`?v.value={meta:t.meta,config:t.config}:typeof t==`object`&&!Array.isArray(t)?v.value={config:t}:D.value=`Invalid file format — expected a JSON config object.`}catch{D.value=`Invalid JSON file.`}},n.readAsText(t)}function N(){w.value=!1,v.value=null,m.value=null,O.value&&(O.value.value=``)}async function P(){if(v.value?.config){T.value=!0,E.value=``,D.value=``;try{let e=await M.importConfig(v.value.config);if(e.success){let t=e.data,n=e.message||t?.message||`Configuration imported.`;t?.restart_required&&(n+=` A service restart is required for radio changes to take effect.`),E.value=n,w.value=!1,v.value=null,m.value=null,O.value&&(O.value.value=``)}else D.value=e.error||`Import failed`}catch(e){D.value=e instanceof Error?e.message:`Import failed`}finally{T.value=!1}}}let F=l(!1),L=l(!1),R=l(null),z=l(``);async function B(){L.value=!0,z.value=``;try{let e=await M.exportIdentityKey();if(!e.success||!e.data){z.value=e.error||`Export failed`;return}R.value=e.data;let t=new Blob([e.data.identity_key_hex],{type:`text/plain`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`pymc-identity-${e.data.node_address||`key`}.hex`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}catch(e){z.value=e instanceof Error?e.message:`Export failed`}finally{L.value=!1}}return(e,l)=>(h(),C(`div`,_c,[l[39]||=S(`div`,{class:`cfg-page-heading flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3`},[S(`div`,null,[S(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2`},`Backup & Restore`),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Export, import, and restore your repeater configuration`)])],-1),n.value?(h(),C(`div`,vc,[...l[6]||=[d(`

Unencrypted Connection

This page is served over HTTP, not HTTPS. Exported data (including identity keys) will be transmitted in plain text. Only use these features on a trusted local network.

`,1)]])):g(``,!0),S(`div`,yc,[l[9]||=S(`div`,{class:`flex items-start justify-between mb-4`},[S(`div`,null,[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},` Export Settings `),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},[b(` Download the current configuration as a JSON file. Passwords, JWT secrets, and identity keys are `),S(`strong`,null,`redacted`),b(`. Safe to share or use as a template for other devices. `)])])],-1),S(`button`,{onClick:o,disabled:r.value,class:`cfg-btn-primary`},[r.value?(h(),C(`span`,xc,[_(I,{size:`sm`,color:`current`,class:`inline-block`}),l[7]||=b(` Exporting… `,-1)])):(h(),C(`span`,Sc,[...l[8]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4`})],-1),b(` Export Settings `,-1)]]))],8,bc),i.value?(h(),C(`p`,Cc,t(i.value),1)):g(``,!0),a.value?(h(),C(`p`,wc,t(a.value),1)):g(``,!0)]),S(`div`,Tc,[l[15]||=d(`

Full Backup

Download a complete backup including all passwords, JWT secrets, and identity keys. Required for restoring to a new device or recovering from a failed SD card.

Contains sensitive data. The backup file will include plain-text passwords and private keys. Store it securely and never share it.

`,2),s.value?g(``,!0):(h(),C(`div`,Ec,[S(`button`,{onClick:l[0]||=e=>s.value=!0,class:`px-4 py-2 bg-red-500/20 dark:bg-red-400/20 hover:bg-red-500/30 dark:hover:bg-red-400/30 text-red-900 dark:text-red-200 rounded-lg border border-red-500/50 dark:border-red-400/40 transition-colors text-sm`},[...l[10]||=[S(`span`,{class:`flex items-center gap-2`},[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z`})]),b(` Full Backup `)],-1)]])])),s.value?(h(),C(`div`,Dc,[S(`div`,Oc,[l[14]||=S(`svg`,{class:`w-5 h-5 text-red-600 dark:text-red-400 shrink-0 mt-0.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`div`,kc,[l[13]||=S(`h4`,{class:`text-sm font-semibold text-red-700 dark:text-red-400`},` Confirm Full Backup `,-1),S(`p`,Ac,[l[11]||=b(` This will export `,-1),l[12]||=S(`strong`,null,`all secrets in plain text`,-1),b(` including admin/guest passwords, JWT secret, and your repeater's private identity key`+t(n.value?` over an unencrypted HTTP connection`:``)+`. `,1)]),S(`div`,jc,[S(`button`,{onClick:p,disabled:c.value,class:`px-4 py-2 bg-red-600 hover:bg-red-700 dark:bg-red-500 dark:hover:bg-red-600 text-white rounded-lg transition-colors text-sm disabled:opacity-50`},t(c.value?`Exporting…`:`Yes, Export Full Backup`),9,Mc),S(`button`,{onClick:l[1]||=e=>s.value=!1,disabled:c.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 text-sm`},` Cancel `,8,Nc)])])])])):g(``,!0),u.value?(h(),C(`p`,Pc,t(u.value),1)):g(``,!0),f.value?(h(),C(`p`,Fc,t(f.value),1)):g(``,!0)]),S(`div`,Ic,[l[29]||=S(`div`,{class:`flex items-start justify-between mb-4`},[S(`div`,null,[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},` Import Configuration `),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},[b(` Restore configuration from a previously exported JSON file. Importing a `),S(`strong`,null,`full backup`),b(` will also restore passwords and identity keys. Importing a `),S(`strong`,null,`settings export`),b(` will only update non-sensitive settings. `)])])],-1),S(`div`,Lc,[S(`label`,Rc,[l[16]||=S(`svg`,{class:`w-5 h-5 text-content-secondary dark:text-content-muted`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12`})],-1),S(`span`,zc,t(m.value?m.value.name:`Choose a config JSON file…`),1),S(`input`,{ref_key:`fileInputRef`,ref:O,type:`file`,accept:`.json,application/json`,class:`hidden`,onChange:j},null,544)]),v.value?(h(),C(`div`,Bc,[l[20]||=S(`h4`,{class:`text-sm font-medium text-content-primary dark:text-content-primary mb-2`},` Import Preview `,-1),v.value.meta?(h(),C(`div`,Vc,[S(`p`,null,[l[17]||=b(` Exported: `,-1),S(`span`,Hc,t(v.value.meta.exported_at),1)]),S(`p`,null,[l[18]||=b(` Version: `,-1),S(`span`,Uc,t(v.value.meta.version),1)]),v.value.meta.includes_secrets===`true`||v.value.meta.includes_secrets===!0?(h(),C(`p`,Wc,` ⚠ Full backup — will restore passwords and identity keys `)):(h(),C(`p`,Gc,` Settings only — existing secrets will not be changed `))])):g(``,!0),S(`p`,Kc,[l[19]||=b(` Sections: `,-1),S(`span`,qc,t(k.value),1)])])):g(``,!0),v.value&&!w.value?(h(),C(`div`,Jc,[S(`button`,{onClick:l[2]||=e=>w.value=!0,class:`px-4 py-2 bg-amber-500/20 dark:bg-amber-400/20 hover:bg-amber-500/30 dark:hover:bg-amber-400/30 text-amber-900 dark:text-amber-200 rounded-lg border border-amber-500/50 dark:border-amber-400/40 transition-colors text-sm`},` Review & Import `)])):g(``,!0),w.value?(h(),C(`div`,Yc,[S(`div`,Xc,[l[28]||=S(`svg`,{class:`w-5 h-5 text-amber-600 dark:text-amber-400 shrink-0 mt-0.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`div`,Zc,[l[27]||=S(`h4`,{class:`text-sm font-semibold text-amber-800 dark:text-amber-300`},` Confirm Import `,-1),S(`p`,Qc,[l[24]||=b(` This will overwrite current settings for: `,-1),S(`strong`,null,t(k.value),1),l[25]||=b(`. `,-1),A.value?(h(),C(x,{key:0},[l[21]||=b(` This is a full backup — `,-1),l[22]||=S(`strong`,null,`passwords, JWT secrets, and identity keys will also be overwritten`,-1),l[23]||=b(`. `,-1)],64)):(h(),C(x,{key:1},[b(` Passwords and identity keys will not be changed. `)],64)),l[26]||=b(` Some changes (radio settings) require a service restart. `,-1)]),S(`div`,$c,[S(`button`,{onClick:P,disabled:T.value,class:`px-4 py-2 bg-amber-600 hover:bg-amber-700 dark:bg-amber-500 dark:hover:bg-amber-600 text-white rounded-lg transition-colors text-sm disabled:opacity-50`},t(T.value?`Importing…`:`Yes, Import`),9,el),S(`button`,{onClick:N,disabled:T.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 text-sm`},` Cancel `,8,tl)])])])])):g(``,!0),E.value?(h(),C(`p`,nl,t(E.value),1)):g(``,!0),D.value?(h(),C(`p`,rl,t(D.value),1)):g(``,!0)])]),S(`div`,il,[l[38]||=d(`

Export Identity Key

Download the repeater's private identity key for backup. This key determines the node's address and cryptographic identity on the mesh.

Sensitive data. The identity key is the repeater's private key. Anyone with this key can impersonate your node. Store the exported file securely and never share it.

`,2),F.value?g(``,!0):(h(),C(`div`,al,[S(`button`,{onClick:l[3]||=e=>F.value=!0,class:`px-4 py-2 bg-red-500/20 dark:bg-red-400/20 hover:bg-red-500/30 dark:hover:bg-red-400/30 text-red-900 dark:text-red-200 rounded-lg border border-red-500/50 dark:border-red-400/40 transition-colors text-sm`},[...l[30]||=[S(`span`,{class:`flex items-center gap-2`},[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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`})]),b(` Export Identity Key `)],-1)]])])),F.value&&!R.value?(h(),C(`div`,ol,[S(`div`,sl,[l[32]||=S(`svg`,{class:`w-5 h-5 text-red-600 dark:text-red-400 shrink-0 mt-0.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`div`,cl,[l[31]||=S(`h4`,{class:`text-sm font-semibold text-red-700 dark:text-red-400`},`Are you sure?`,-1),S(`p`,ll,` This will transmit your private key `+t(n.value?`over an unencrypted HTTP connection. `:``)+` and download it as a file. `,1),S(`div`,ul,[S(`button`,{onClick:B,disabled:L.value,class:`px-4 py-2 bg-red-600 hover:bg-red-700 dark:bg-red-500 dark:hover:bg-red-600 text-white rounded-lg transition-colors text-sm disabled:opacity-50`},t(L.value?`Exporting…`:`Yes, Export Key`),9,dl),S(`button`,{onClick:l[4]||=e=>F.value=!1,disabled:L.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 text-sm`},` Cancel `,8,fl)])])])])):g(``,!0),R.value?(h(),C(`div`,pl,[S(`div`,ml,[l[33]||=S(`h4`,{class:`text-sm font-medium text-content-primary dark:text-content-primary`},` Key Exported `,-1),S(`button`,{onClick:l[5]||=e=>{R.value=null,F.value=!1},class:`text-xs text-content-muted hover:text-content-secondary transition-colors`},` Dismiss `)]),S(`div`,hl,[S(`p`,null,[l[34]||=b(` Key length: `,-1),S(`span`,gl,t(R.value.key_length_bytes)+` bytes`,1)]),R.value.node_address?(h(),C(`p`,_l,[l[35]||=b(` Node address: `,-1),S(`span`,vl,t(R.value.node_address),1)])):g(``,!0),R.value.public_key_hex?(h(),C(`p`,yl,[l[36]||=b(` Public key: `,-1),S(`span`,bl,t(R.value.public_key_hex),1)])):g(``,!0)]),l[37]||=S(`p`,{class:`text-xs text-green-600 dark:text-green-400`},`File downloaded successfully.`,-1)])):g(``,!0),z.value?(h(),C(`p`,xl,t(z.value),1)):g(``,!0)])]))}}),Cl={class:`space-y-12`},wl={class:`cfg-page-heading flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3`},Tl={class:`flex items-center gap-2 flex-shrink-0`},El={class:`cfg-section`},Dl={class:`flex items-start justify-between mb-4`},Ol=[`disabled`],kl={key:0,class:`flex items-center gap-1.5`},Al={key:1},jl={key:0,class:`grid grid-cols-2 sm:grid-cols-4 gap-3 mb-6`},Ml={class:`bg-background-mute dark:bg-background/30 rounded-lg p-3 border border-stroke-subtle dark:border-stroke/10`},Nl={class:`text-lg font-semibold text-content-primary dark:text-content-primary font-mono`},Pl={class:`bg-background-mute dark:bg-background/30 rounded-lg p-3 border border-stroke-subtle dark:border-stroke/10`},Fl={class:`text-lg font-semibold text-content-primary dark:text-content-primary font-mono`},Il={class:`bg-background-mute dark:bg-background/30 rounded-lg p-3 border border-stroke-subtle dark:border-stroke/10`},Ll={class:`text-lg font-semibold text-content-primary dark:text-content-primary font-mono`},Rl={class:`bg-background-mute dark:bg-background/30 rounded-lg p-3 border border-stroke-subtle dark:border-stroke/10`},zl={class:`text-lg font-semibold text-content-primary dark:text-content-primary font-mono`},Bl={key:1,class:`flex items-center justify-center py-12`},Vl={class:`text-center`},Hl={key:2,class:`rounded-lg border border-red-500/30 dark:border-red-400/30 bg-red-50 dark:bg-red-500/10 p-3 mb-4`},Ul={class:`text-xs text-red-700 dark:text-red-400`},Wl={key:3},Gl={class:`overflow-x-auto`},Kl={class:`w-full text-sm`},ql={class:`py-2.5 pr-4`},Jl={class:`font-mono text-content-primary dark:text-content-primary`},Yl={class:`py-2.5 pr-4 text-right`},Xl={class:`font-mono text-content-secondary dark:text-content-muted`},Zl={class:`py-2.5 pr-4 text-right hidden sm:table-cell`},Ql={key:0,class:`text-xs text-content-muted`},$l={class:`text-content-muted/60 ml-1`},eu={key:1,class:`text-xs text-content-muted/50`},tu={key:2,class:`text-xs text-content-muted/50`},nu={class:`py-2.5 text-right`},ru=[`onClick`,`disabled`],iu={key:0,class:`flex items-center gap-1`},au={key:1},ou={key:1,class:`text-xs text-content-muted/50`},su={class:`flex items-start gap-3 mb-5`},cu={class:`flex-1 min-w-0`},lu={class:`text-lg font-semibold text-content-primary dark:text-content-primary`},uu={class:`text-sm text-content-secondary dark:text-content-muted mt-1`},du={class:`text-content-primary dark:text-content-primary`},fu={class:`text-content-primary dark:text-content-primary font-mono`},pu={class:`flex gap-3`},mu=[`disabled`],hu=[`disabled`],gu={class:`cfg-section`},_u={class:`flex flex-wrap gap-3`},vu=[`disabled`],yu=[`disabled`],bu={class:`flex items-center gap-2`},xu={key:0,class:`text-xs text-green-600 dark:text-green-400 mt-3`},Su={key:1,class:`text-xs text-green-600 dark:text-green-400 mt-3`},Cu=f({__name:`DatabaseManagement`,setup(e){let n=new Set([`packets`,`adverts`,`noise_floor`,`crc_errors`,`room_messages`,`room_client_sync`,`companion_contacts`,`companion_channels`,`companion_messages`,`companion_prefs`]),i=l(!1),a=l(!1),o=l(``),s=l(null),c=l({}),d=l(null),f=l(``),w=l(!1),T=l(``),E=y(()=>s.value?s.value.tables.reduce((e,t)=>e+t.row_count,0):0);function D(e){return n.has(e)}function O(e,t){return!e||!t?0:Math.max(1,Math.round((t-e)/86400))}async function k(){a.value=!0,o.value=``;try{let e=await M.getDbStats();e.success&&e.data?s.value=e.data:o.value=e.error||`Failed to load database stats`}catch(e){o.value=e instanceof Error?e.message:`Failed to load database stats`}finally{a.value=!1}}function A(e,t){f.value=``,d.value={table:e,rowCount:t,executing:!1}}async function j(){if(!d.value)return;let{table:e}=d.value;d.value.executing=!0,f.value=``;try{let t=e===`all`?`all`:[e];e!==`all`&&(c.value[e]=!0);let n=await M.purgeTable(t);if(n.success){let t=n.data||{};f.value=`Deleted ${Object.values(t).reduce((e,t)=>e+(t.deleted||0),0).toLocaleString()} rows${e===`all`?` from all tables`:` from ${e}`}.`,d.value=null,await k()}else o.value=n.error||`Purge failed`,d.value=null}catch(e){o.value=e instanceof Error?e.message:`Purge failed`,d.value=null}finally{e!==`all`&&(c.value[e]=!1)}}async function N(){w.value=!0,T.value=``,o.value=``;try{let e=await M.vacuumDb();if(e.success&&e.data){let t=e.data.freed_bytes;T.value=t>0?`Compacted database — freed ${J(t)} (${J(e.data.size_before)} → ${J(e.data.size_after)}).`:`Database already compact (${J(e.data.size_after)}).`,await k()}else o.value=e.error||`Vacuum failed`}catch(e){o.value=e instanceof Error?e.message:`Vacuum failed`}finally{w.value=!1}}return r(k),(e,n)=>(h(),C(`div`,Cl,[S(`div`,wl,[n[5]||=S(`div`,null,[S(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2`},`Database`),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`View database statistics and perform maintenance`)],-1),S(`div`,Tl,[S(`button`,{onClick:n[0]||=e=>i.value=!i.value,class:`cfg-btn-primary`},t(i.value?`Lock`:`Unlock`),1)])]),S(`div`,El,[S(`div`,Dl,[n[7]||=S(`div`,null,[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},` Database Overview `),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},` Storage usage and table statistics for the repeater database. `)],-1),S(`button`,{onClick:k,disabled:a.value,class:`cfg-btn-secondary`},[a.value?(h(),C(`span`,kl,[_(I,{size:`xs`,color:`current`,class:`inline-block`}),n[6]||=b(` Loading… `,-1)])):(h(),C(`span`,Al,`Refresh`))],8,Ol)]),s.value?(h(),C(`div`,jl,[S(`div`,Ml,[n[8]||=S(`p`,{class:`text-xs text-content-muted mb-1`},`Database Size`,-1),S(`p`,Nl,t(v(J)(s.value.database_size_bytes)),1)]),S(`div`,Pl,[n[9]||=S(`p`,{class:`text-xs text-content-muted mb-1`},`RRD Metrics`,-1),S(`p`,Fl,t(v(J)(s.value.rrd_size_bytes)),1)]),S(`div`,Il,[n[10]||=S(`p`,{class:`text-xs text-content-muted mb-1`},`Total Size`,-1),S(`p`,Ll,t(v(J)(s.value.database_size_bytes+s.value.rrd_size_bytes)),1)]),S(`div`,Rl,[n[11]||=S(`p`,{class:`text-xs text-content-muted mb-1`},`Total Rows`,-1),S(`p`,zl,t(E.value.toLocaleString()),1)])])):g(``,!0),a.value&&!s.value?(h(),C(`div`,Bl,[S(`div`,Vl,[_(I,{class:`mx-auto mb-4`}),n[12]||=S(`div`,{class:`text-content-secondary dark:text-content-muted`},`Loading database info…`,-1)])])):g(``,!0),o.value?(h(),C(`div`,Hl,[S(`p`,Ul,t(o.value),1)])):g(``,!0),s.value&&s.value.tables.length>0?(h(),C(`div`,Wl,[S(`div`,Gl,[S(`table`,Kl,[n[14]||=S(`thead`,null,[S(`tr`,{class:`border-b border-stroke-subtle dark:border-stroke/10`},[S(`th`,{class:`text-left py-2 pr-4 text-xs font-medium text-content-muted uppercase tracking-wider`},` Table `),S(`th`,{class:`text-right py-2 pr-4 text-xs font-medium text-content-muted uppercase tracking-wider`},` Rows `),S(`th`,{class:`text-right py-2 pr-4 text-xs font-medium text-content-muted uppercase tracking-wider hidden sm:table-cell`},` Date Range `),S(`th`,{class:`text-right py-2 text-xs font-medium text-content-muted uppercase tracking-wider`},` Actions `)])],-1),S(`tbody`,null,[(h(!0),C(x,null,m(s.value.tables,e=>(h(),C(`tr`,{key:e.name,class:`border-b border-stroke-subtle/50 dark:border-stroke/5`},[S(`td`,ql,[S(`span`,Jl,t(e.name),1)]),S(`td`,Yl,[S(`span`,Xl,t(e.row_count.toLocaleString()),1)]),S(`td`,Zl,[e.has_timestamp&&e.row_count>0?(h(),C(`span`,Ql,[b(t(v(q)(e.oldest_timestamp))+` — `+t(v(q)(e.newest_timestamp))+` `,1),S(`span`,$l,`(`+t(O(e.oldest_timestamp,e.newest_timestamp))+`d)`,1)])):e.row_count===0?(h(),C(`span`,eu,`—`)):(h(),C(`span`,tu,`n/a`))]),S(`td`,nu,[i.value&&D(e.name)&&e.row_count>0?(h(),C(`button`,{key:0,onClick:t=>A(e.name,e.row_count),disabled:c.value[e.name],class:`px-2.5 py-1 bg-red-500/10 dark:bg-red-400/10 hover:bg-red-500/20 dark:hover:bg-red-400/20 text-red-700 dark:text-red-400 rounded border border-red-500/30 dark:border-red-400/20 transition-colors text-xs disabled:opacity-50`},[c.value[e.name]?(h(),C(`span`,iu,[_(I,{size:`xs`,color:`current`,class:`inline-block`}),n[13]||=b(` Purging… `,-1)])):(h(),C(`span`,au,`Empty`))],8,ru)):D(e.name)?g(``,!0):(h(),C(`span`,ou,`—`))])]))),128))])])])])):g(``,!0)]),(h(),u(p,{to:`body`},[d.value?(h(),C(`div`,{key:0,class:`modal-backdrop-heavy`,onClick:n[3]||=z(e=>!d.value.executing&&(d.value=null),[`self`])},[S(`div`,{class:`modal-card max-w-lg`,onClick:n[2]||=z(()=>{},[`stop`])},[S(`div`,su,[n[20]||=S(`div`,{class:`flex-shrink-0 w-10 h-10 rounded-full bg-red-500/15 flex items-center justify-center`},[S(`svg`,{class:`w-5 h-5 text-red-500 dark:text-red-400`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`div`,cu,[S(`h3`,lu,t(d.value.table===`all`?`Purge All Tables`:`Purge "${d.value.table}"`),1),S(`p`,uu,[d.value.table===`all`?(h(),C(x,{key:0},[n[15]||=b(` This will permanently delete `,-1),n[16]||=S(`strong`,{class:`text-content-primary dark:text-content-primary`},`all data`,-1),b(` from every data table (`+t(E.value.toLocaleString())+` rows total). This cannot be undone. `,1)],64)):(h(),C(x,{key:1},[n[17]||=b(` This will permanently delete `,-1),S(`strong`,du,t(d.value.rowCount.toLocaleString())+` rows`,1),n[18]||=b(` from `,-1),S(`strong`,fu,t(d.value.table),1),n[19]||=b(`. This cannot be undone. `,-1)],64))])])]),S(`div`,pu,[S(`button`,{onClick:n[1]||=e=>d.value=null,disabled:d.value.executing,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 `,8,mu),S(`button`,{onClick:j,disabled:d.value.executing,class:`flex-1 px-4 py-3 bg-red-500/20 hover:bg-red-500/30 border border-red-500/50 text-red-600 dark:text-red-400 rounded-lg transition-colors font-medium disabled:opacity-50`},t(d.value.executing?`Purging…`:`Yes, Delete Data`),9,hu)])])])):g(``,!0)])),S(`div`,gu,[n[23]||=S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-4`},` Maintenance `,-1),S(`div`,_u,[S(`button`,{onClick:n[4]||=e=>A(`all`,E.value),disabled:!s.value||E.value===0||!i.value,class:`px-4 py-2 bg-red-500/20 dark:bg-red-400/20 hover:bg-red-500/30 dark:hover:bg-red-400/30 text-red-900 dark:text-red-200 rounded-lg border border-red-500/50 dark:border-red-400/40 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed`},[...n[21]||=[S(`span`,{class:`flex items-center gap-2`},[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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`})]),b(` Purge All Data `)],-1)]],8,vu),S(`button`,{onClick:N,disabled:w.value||!s.value,class:`cfg-btn-primary`},[S(`span`,bu,[n[22]||=S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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`})],-1),b(` `+t(w.value?`Compacting…`:`Compact Database`),1)])],8,yu)]),T.value?(h(),C(`p`,xu,t(T.value),1)):g(``,!0),f.value?(h(),C(`p`,Su,t(f.value),1)):g(``,!0)])]))}}),wu={class:`space-y-12`},Tu={class:`cfg-section`},Eu={class:`flex items-start justify-between mb-4`},Du={class:`flex items-center gap-2`},Ou=[`disabled`],ku={key:0,class:`flex items-center gap-1.5`},Au={key:1},ju=[`disabled`],Mu={key:0,class:`flex items-center gap-1.5`},Nu={key:1},Pu={key:0,class:`mb-4 p-3 rounded-lg bg-red-500/10 border border-red-500/30 text-red-600 dark:text-red-400 text-sm`},Fu={key:1,class:`mb-4`},Iu={class:`bg-background-mute dark:bg-background/30 rounded-lg p-3 border border-stroke-subtle dark:border-stroke/10 inline-block`},Lu={class:`text-lg font-semibold text-content-primary dark:text-content-primary font-mono`},Ru={key:2,class:`p-4 rounded-lg bg-cyan-500/10 dark:bg-primary/10 border border-cyan-400/30 dark:border-primary/30`},zu={key:3},Bu=[`innerHTML`],Vu={class:`font-semibold text-sm`},Hu={class:`text-sm mt-0.5 opacity-80`},Uu={class:`grid grid-cols-2 sm:grid-cols-3 gap-3 mb-6`},Wu={key:0,class:`bg-background-mute dark:bg-background/30 rounded-lg p-3 border border-stroke-subtle dark:border-stroke/10`},Gu={class:`text-lg font-semibold text-content-primary dark:text-content-primary font-mono`},Ku={key:1,class:`bg-background-mute dark:bg-background/30 rounded-lg p-3 border border-stroke-subtle dark:border-stroke/10`},qu={class:`text-lg font-semibold text-content-primary dark:text-content-primary font-mono`},Ju={key:2,class:`bg-background-mute dark:bg-background/30 rounded-lg p-3 border border-stroke-subtle dark:border-stroke/10`},Yu={class:`text-lg font-semibold text-content-primary dark:text-content-primary font-mono`},Xu={key:0,class:`mb-6`},Zu={class:`space-y-2`},Qu={class:`flex items-start justify-between gap-3`},$u={class:`flex items-center gap-2 min-w-0`},ed={class:`shrink-0 text-xs font-medium text-content-muted w-5 text-right`},td={class:`text-right shrink-0`},nd={class:`text-xs text-content-muted`},rd={class:`mt-1.5 ml-7`},id={class:`text-xs font-mono text-content-secondary dark:text-content-muted break-all`},ad={key:0,class:`text-xs text-content-muted mt-0.5`},od={key:1,class:`mb-6 p-4 rounded-lg bg-green-500/10 border border-green-500/30 text-sm flex items-center gap-3`},sd={key:2},cd={key:0,class:`overflow-x-auto rounded-lg border border-stroke-subtle dark:border-stroke/10`},ld={class:`w-full text-sm`},ud={class:`px-3 py-2 text-content-muted font-mono text-xs`},dd={class:`px-3 py-2 text-content-primary dark:text-content-primary font-mono text-xs break-all`},fd={class:`px-3 py-2 text-right font-mono text-xs text-content-secondary dark:text-content-muted whitespace-nowrap`},pd={class:`px-3 py-2 text-right font-mono text-xs text-content-secondary dark:text-content-muted`},md={key:4,class:`py-8 text-center text-content-muted text-sm`},hd=F(f({__name:`MemoryDebug`,setup(n){let i=l(!1),a=l(!1),o=l(``),s=l(null),c=l(!1),u=l(null),f=l(!1),p=y(()=>s.value&&(s.value.current_top_20||s.value.growth_since_baseline));async function v(){i.value=!0,o.value=``;try{let e=await M.get(`memory_debug`);e.success&&e.data?(c.value=!!e.data.tracing,u.value=e.data.rss_mb??null,(e.data.current_top_20||e.data.growth_since_baseline)&&(s.value=e.data)):o.value=e.error||`Failed to fetch memory status`}catch(e){o.value=e instanceof Error?e.message:`Failed to fetch memory status`}finally{i.value=!1}}async function w(){a.value=!0,o.value=``;let e=c.value?`stop`:`start`;try{let t=await M.post(`memory_debug`,{action:e});t.success&&t.data?(c.value=!!t.data.tracing,e===`stop`&&(s.value=null,u.value=null)):o.value=t.error||`Failed to ${e} tracing`}catch(t){o.value=t instanceof Error?t.message:`Failed to ${e} tracing`}finally{a.value=!1,c.value&&await v()}}function E(e){return e.size_diff_kb>=100?`critical`:e.size_diff_kb>=10?`warning`:e.size_diff_kb>=1?`low`:`ok`}function D(e){let t=E(e);return t===`critical`?`Investigate`:t===`warning`?`Watch`:t===`low`?`Minor`:`Normal`}function O(e){let t=E(e);return t===`critical`?`bg-red-500/20 text-red-700 dark:text-red-400 border border-red-500/30`:t===`warning`?`bg-amber-500/20 text-amber-700 dark:text-amber-400 border border-amber-500/30`:t===`low`?`bg-blue-500/15 text-blue-600 dark:text-blue-400 border border-blue-500/20`:`bg-green-500/15 text-green-700 dark:text-green-400 border border-green-500/20`}function k(e){let t=E(e);return t===`critical`?`border-red-500/40 dark:border-red-500/30 bg-red-500/5 dark:bg-red-500/5`:t===`warning`?`border-amber-500/40 dark:border-amber-500/30 bg-amber-500/5 dark:bg-amber-500/5`:t===`low`?`border-stroke-subtle dark:border-stroke/10 bg-background-mute/50 dark:bg-background/20`:`border-stroke-subtle/50 dark:border-stroke/5 bg-background-mute/30 dark:bg-background/10 opacity-60`}function A(e){let t=E(e);return t===`critical`?`text-red-600 dark:text-red-400`:t===`warning`?`text-amber-600 dark:text-amber-400`:t===`low`?`text-blue-600 dark:text-blue-400`:`text-green-600 dark:text-green-500`}function j(e){return e>=1024?`${(e/1024).toFixed(1)} MB`:e>=10?`${Math.round(e)} KB`:`${e.toFixed(1)} KB`}function N(e){return e.replace(/.*\/site-packages\//,``).replace(/.*\/lib\/python[^/]*\//,``).replace(/.*\/repeater\//,`repeater/`)}let P=y(()=>s.value?.growth_since_baseline?s.value.growth_since_baseline.reduce((e,t)=>e+t.size_diff_kb,0):0),F=y(()=>P.value>=500?`critical`:P.value>=50?`warning`:P.value>=5?`low`:`ok`),L=y(()=>{let e=F.value;return e===`critical`?`border-red-500/40 dark:border-red-500/30 bg-red-500/10 dark:bg-red-500/10 text-red-800 dark:text-red-300`:e===`warning`?`border-amber-500/40 dark:border-amber-500/30 bg-amber-500/10 dark:bg-amber-500/10 text-amber-800 dark:text-amber-300`:e===`low`?`border-blue-500/30 bg-blue-500/10 dark:bg-blue-500/10 text-blue-800 dark:text-blue-300`:`border-green-500/30 bg-green-500/10 dark:bg-green-500/10 text-green-800 dark:text-green-300`}),R=y(()=>{let e=F.value;return e===`critical`?``:e===`warning`?``:e===`low`?``:``}),z=y(()=>{let e=F.value;return e===`critical`?`Significant memory growth detected`:e===`warning`?`Some memory growth detected`:e===`low`?`Minor memory growth — likely normal`:`Memory looks healthy`}),B=y(()=>{let e=j(P.value),t=F.value;return t===`critical`?`Total growth: ${e}. Red items below need attention.`:t===`warning`?`Total growth: ${e}. Orange items below may need attention over time.`:t===`low`?`Total growth: ${e}. Nothing to worry about right now.`:`No significant growth since tracing started.`});return r(v),(n,r)=>(h(),C(`div`,wu,[r[15]||=S(`div`,{class:`cfg-page-heading flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3`},[S(`div`,null,[S(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2`},`Memory`),S(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Diagnose memory usage and trace allocations`)])],-1),S(`div`,Tu,[S(`div`,Eu,[r[2]||=S(`div`,null,[S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-1`},` Memory Diagnostics `),S(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},` Trace memory allocations to find leaks. Tracing adds overhead — only enable when needed. `)],-1),S(`div`,Du,[c.value&&p.value?(h(),C(`button`,{key:0,onClick:v,disabled:i.value,class:`cfg-btn-secondary`},[i.value?(h(),C(`span`,ku,[_(I,{size:`xs`,color:`current`,class:`inline-block`}),r[1]||=b(` Checking… `,-1)])):(h(),C(`span`,Au,`Check Again`))],8,Ou)):g(``,!0),S(`button`,{onClick:w,disabled:a.value,class:T([`px-3 py-1.5 rounded-lg border text-sm transition-colors disabled:opacity-50`,c.value?`bg-red-500/20 hover:bg-red-500/30 text-red-700 dark:text-red-400 border-red-500/50`:`bg-green-500/20 hover:bg-green-500/30 text-green-700 dark:text-green-400 border-green-500/50`])},[a.value?(h(),C(`span`,Mu,[_(I,{size:`xs`,color:`current`,class:`inline-block`}),b(` `+t(c.value?`Stopping…`:`Starting…`),1)])):(h(),C(`span`,Nu,t(c.value?`Stop Tracing`:`Start Tracing`),1))],10,ju)])]),o.value?(h(),C(`div`,Pu,t(o.value),1)):g(``,!0),!c.value&&u.value!==null&&!i.value?(h(),C(`div`,Fu,[S(`div`,Iu,[r[3]||=S(`p`,{class:`text-xs text-content-muted mb-1`},`Current Memory (RSS)`,-1),S(`p`,Lu,t(u.value)+` MB`,1)])])):g(``,!0),c.value&&!p.value&&!i.value?(h(),C(`div`,Ru,[...r[4]||=[d(`
Tracing active

Memory tracing is running. Let the repeater run for a few minutes, then click Check Again to see which parts of the code are using more memory.

`,2)]])):g(``,!0),s.value&&p.value?(h(),C(`div`,zu,[S(`div`,{class:T([`mb-5 p-4 rounded-lg border flex items-start gap-3`,L.value])},[S(`div`,{class:`mt-0.5`,innerHTML:R.value},null,8,Bu),S(`div`,null,[S(`p`,Vu,t(z.value),1),S(`p`,Hu,t(B.value),1)])],2),S(`div`,Uu,[s.value.rss_mb===void 0?g(``,!0):(h(),C(`div`,Wu,[r[5]||=S(`p`,{class:`text-xs text-content-muted mb-1`},`Total Memory Used`,-1),S(`p`,Gu,t(s.value.rss_mb)+` MB`,1)])),s.value.traced_current_mb===void 0?g(``,!0):(h(),C(`div`,Ku,[r[6]||=S(`p`,{class:`text-xs text-content-muted mb-1`},`Tracked Now`,-1),S(`p`,qu,t(s.value.traced_current_mb)+` MB`,1)])),s.value.traced_peak_mb===void 0?g(``,!0):(h(),C(`div`,Ju,[r[7]||=S(`p`,{class:`text-xs text-content-muted mb-1`},`Peak Tracked`,-1),S(`p`,Yu,t(s.value.traced_peak_mb)+` MB`,1)]))]),s.value.growth_since_baseline&&s.value.growth_since_baseline.length>0?(h(),C(`div`,Xu,[r[8]||=S(`h4`,{class:`text-sm font-semibold text-content-primary dark:text-content-primary mb-1`},`Memory Growth Breakdown`,-1),r[9]||=S(`p`,{class:`text-xs text-content-muted mb-3`},` Items at the top with red/orange tags are the most likely cause of memory issues. Green items are normal and can be ignored. `,-1),S(`div`,Zu,[(h(!0),C(x,null,m(s.value.growth_since_baseline,(e,n)=>(h(),C(`div`,{key:n,class:T([`rounded-lg border p-3 transition-colors`,k(e)])},[S(`div`,Qu,[S(`div`,$u,[S(`span`,ed,t(n+1),1),S(`span`,{class:T([`shrink-0 inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-semibold`,O(e)])},t(D(e)),3)]),S(`div`,td,[S(`span`,{class:T([`font-mono text-sm font-semibold`,A(e)])},`+`+t(j(e.size_diff_kb)),3),S(`p`,nd,t(j(e.current_size_kb))+` total`,1)])]),S(`div`,rd,[S(`p`,id,t(N(e.file)),1),e.count_diff===0?g(``,!0):(h(),C(`p`,ad,t(e.count_diff>0?`+`:``)+t(e.count_diff)+` new allocation`+t(Math.abs(e.count_diff)===1?``:`s`),1))])],2))),128))])])):s.value.growth_since_baseline&&s.value.growth_since_baseline.length===0?(h(),C(`div`,od,[...r[10]||=[S(`svg`,{class:`w-5 h-5 text-green-600 dark:text-green-400 shrink-0`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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`})],-1),S(`span`,{class:`text-green-700 dark:text-green-400`},`No memory growth detected. Everything looks healthy.`,-1)]])):g(``,!0),s.value.current_top_20&&s.value.current_top_20.length>0?(h(),C(`div`,sd,[S(`button`,{onClick:r[0]||=e=>f.value=!f.value,class:`flex items-center gap-2 text-sm font-semibold text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors mb-3`},[(h(),C(`svg`,{class:T([`w-4 h-4 transition-transform`,{"rotate-90":f.value}]),fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[...r[11]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M9 5l7 7-7 7`},null,-1)]],2)),r[12]||=b(` Advanced: Current Top Allocations `,-1)]),_(V,{name:`expand`},{default:e(()=>[f.value?(h(),C(`div`,cd,[S(`table`,ld,[r[13]||=S(`thead`,null,[S(`tr`,{class:`bg-background-mute dark:bg-background/30 text-left`},[S(`th`,{class:`px-3 py-2 text-xs font-medium text-content-muted`},`#`),S(`th`,{class:`px-3 py-2 text-xs font-medium text-content-muted`},`Location`),S(`th`,{class:`px-3 py-2 text-xs font-medium text-content-muted text-right`},`Size`),S(`th`,{class:`px-3 py-2 text-xs font-medium text-content-muted text-right`},`Count`)])],-1),S(`tbody`,null,[(h(!0),C(x,null,m(s.value.current_top_20,(e,n)=>(h(),C(`tr`,{key:n,class:`border-t border-stroke-subtle/50 dark:border-stroke/5 hover:bg-background-mute/50 dark:hover:bg-background/20 transition-colors`},[S(`td`,ud,t(n+1),1),S(`td`,dd,t(N(e.file)),1),S(`td`,fd,t(j(e.size_kb)),1),S(`td`,pd,t(e.count),1)]))),128))])])])):g(``,!0)]),_:1})])):g(``,!0)])):g(``,!0),!i.value&&!a.value&&!c.value&&!p.value&&!o.value&&u.value===null?(h(),C(`div`,md,[...r[14]||=[b(` Click `,-1),S(`strong`,null,`Start Tracing`,-1),b(` to enable memory diagnostics. `,-1),S(`br`,null,null,-1),S(`span`,{class:`text-xs`},`Tracing uses extra memory — remember to stop it when done.`,-1)]])):g(``,!0)])]))}}),[[`__scopeId`,`data-v-00e540ed`]]),gd={class:`p-3 sm:p-6 space-y-4 sm:space-y-6`},_d={class:`flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3`},vd={class:`glass-card rounded-[15px] p-3 sm:p-6 mt-4 sm:mt-6`},yd={class:`relative -mx-3 sm:mx-0 mb-4 sm:mb-6`},bd={key:0,class:`absolute left-0 top-0 bottom-[1px] w-12 z-10 flex items-center`},xd={key:0,class:`absolute right-0 top-0 bottom-[1px] w-12 z-10 flex items-center justify-end`},Sd=[`onClick`],Cd={class:`flex items-center gap-1 sm:gap-2`},wd={key:0,class:`w-3.5 h-3.5 sm:w-4 sm:h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Td={key:1,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Ed={key:2,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Dd={key:3,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Od={key:4,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},kd={key:5,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Ad={key:6,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},jd={key:7,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Md={key:8,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Nd={key:9,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Pd={key:10,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Fd={key:11,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Id={class:`min-h-[400px]`},Ld={key:0,class:`flex items-center justify-center py-12`},Rd={class:`text-center`},zd={key:1,class:`flex items-center justify-center py-12`},Bd={class:`text-center`},Vd={class:`text-content-secondary dark:text-content-muted text-sm mb-4`},Hd={key:2},Ud={key:0},Wd={key:1},Gd={key:2},Kd={key:3},qd={key:4},Jd={key:5},Yd={key:6},Xd={key:7},Zd={key:8},Qd={key:9},$d={key:10},ef={key:11},tf=F(f({name:`ConfigurationView`,__name:`Configuration`,setup(n){let i=N(),c=P(),d=l(ne(`configuration_activeTab`,`radio`)),f=l(!1),p=l(null),y=l(!1),w=l(!1),E=l(null),D=l(null),O=l(null),k=l(null),A=l(null),j=l(null),M=l(null),F={radio:E,repeater:D,advert:O,duty:k,delays:A,transport:j,observer:M};function L(){let e=F[d.value]?.value;if(!e)return!1;let t=e.isEditing;return typeof t==`boolean`?t:t.value}function R(e){let t=F[d.value]?.value;t?t.requestLeave(e):e()}function z(){if(!p.value)return;let e=p.value;w.value=e.scrollLeft>4,y.value=e.scrollLeftte(`configuration_activeTab`,e));let H=[{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:`Region Configuration`,icon:`keys`},{id:`api-tokens`,label:`API Tokens`,icon:`tokens`},{id:`web`,label:`Web Options`,icon:`web`},{id:`observer`,label:`Observer`,icon:`observer`},{id:`backup`,label:`Backup`,icon:`backup`},{id:`database`,label:`Database`,icon:`database`},{id:`memory`,label:`Memory`,icon:`memory`}];r(async()=>{if(i.stats)f.value=!0;else try{await c.ensure(`stats`)}catch(e){console.error(`Failed to load configuration data:`,e)}finally{f.value=!0}s(()=>z())});function ee(e){if(e!==d.value&&L()){R(()=>{d.value=e});return}d.value=e}return(n,r)=>{let o=a(`router-link`);return h(),C(`div`,gd,[S(`div`,_d,[r[4]||=S(`div`,null,[S(`h1`,{class:`text-xl sm:text-2xl font-bold text-content-primary dark:text-content-primary`},` Configuration `),S(`p`,{class:`text-content-secondary dark:text-content-muted mt-1 sm:mt-2 text-sm sm:text-base`},` System configuration and settings `)],-1),f.value&&!(v(i).stats?.config?.radio)?.cad?.peak_threshold?(h(),u(o,{key:0,to:`/cad-calibration`,class:`flex-shrink-0 flex items-center gap-4 px-5 py-3 min-w-[280px] rounded-xl border border-primary/30 bg-primary/10 text-primary hover:bg-primary/20 transition-colors`},{default:e(()=>[...r[3]||=[S(`svg`,{class:`w-5 h-5 flex-shrink-0`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M13 10V3L4 14h7v7l9-11h-7z`})],-1),S(`div`,null,[S(`div`,{class:`text-sm font-semibold`},`CAD Calibration Available`),S(`div`,{class:`text-xs text-primary/70`},`Optimise CAD settings →`)],-1)]]),_:1})):g(``,!0)]),S(`div`,vd,[S(`div`,yd,[_(V,{name:`tab-fade`},{default:e(()=>[w.value?(h(),C(`div`,bd,[r[6]||=S(`div`,{class:`tab-fade-left absolute inset-0 pointer-events-none`},null,-1),S(`button`,{onClick:r[0]||=e=>B(`left`),class:`relative z-10 ml-1.5 w-6 h-6 flex items-center justify-center rounded-full bg-surface shadow-md border border-stroke-subtle dark:border-stroke/30 text-content-muted`},[...r[5]||=[S(`svg`,{class:`w-3 h-3`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2.5`,d:`M15 19l-7-7 7-7`})],-1)]])])):g(``,!0)]),_:1}),_(V,{name:`tab-fade`},{default:e(()=>[y.value?(h(),C(`div`,xd,[r[8]||=S(`div`,{class:`tab-fade-right absolute inset-0 pointer-events-none`},null,-1),S(`button`,{onClick:r[1]||=e=>B(`right`),class:`relative z-10 mr-1.5 w-6 h-6 flex items-center justify-center rounded-full bg-surface shadow-md border border-stroke-subtle dark:border-stroke/30 text-content-muted`},[...r[7]||=[S(`svg`,{class:`w-3 h-3`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2.5`,d:`M9 5l7 7-7 7`})],-1)]])])):g(``,!0)]),_:1}),S(`div`,{ref_key:`tabsContainer`,ref:p,onScroll:z,class:`flex overflow-x-auto border-b border-stroke-subtle dark:border-stroke px-3 sm:px-0 scrollbar-hide`},[(h(),C(x,null,m(H,e=>S(`button`,{key:e.id,onClick:t=>ee(e.id),class:T([`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`,d.value===e.id?`text-primary 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`])},[S(`div`,Cd,[e.icon===`radio`?(h(),C(`svg`,wd,[...r[9]||=[S(`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)]])):e.icon===`repeater`?(h(),C(`svg`,Td,[...r[10]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M5 12h14M5 12l4-4m-4 4l4 4`},null,-1)]])):e.icon===`advert`?(h(),C(`svg`,Ed,[...r[11]||=[S(`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)]])):e.icon===`duty`?(h(),C(`svg`,Dd,[...r[12]||=[S(`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)]])):e.icon===`delays`?(h(),C(`svg`,Od,[...r[13]||=[S(`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)]])):e.icon===`keys`?(h(),C(`svg`,kd,[...r[14]||=[S(`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.icon===`tokens`?(h(),C(`svg`,Ad,[...r[15]||=[S(`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)]])):e.icon===`web`?(h(),C(`svg`,jd,[...r[16]||=[S(`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)]])):e.icon===`observer`?(h(),C(`svg`,Md,[...r[17]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M3.055 11H5a2 2 0 012 2v1a2 2 0 002 2 2 2 0 012 2v2.945M8 3.935V5.5A2.5 2.5 0 0010.5 8h.5a2 2 0 012 2 2 2 0 104 0 2 2 0 012-2h1.064M15 20.488V18a2 2 0 012-2h3.064M21 12a9 9 0 11-18 0 9 9 0 0118 0z`},null,-1)]])):e.icon===`backup`?(h(),C(`svg`,Nd,[...r[18]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4`},null,-1)]])):e.icon===`database`?(h(),C(`svg`,Pd,[...r[19]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4`},null,-1)]])):e.icon===`memory`?(h(),C(`svg`,Fd,[...r[20]||=[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z`},null,-1)]])):g(``,!0),b(` `+t(e.label),1)])],10,Sd)),64))],544)]),S(`div`,Id,[!f.value&&v(i).isLoading?(h(),C(`div`,Ld,[S(`div`,Rd,[_(I,{class:`mx-auto mb-4`}),r[21]||=S(`div`,{class:`text-content-secondary dark:text-content-muted`},` Loading configuration... `,-1)])])):f.value&&!v(i).stats?(h(),C(`div`,zd,[S(`div`,Bd,[r[22]||=S(`div`,{class:`text-accent-red mb-2`},`Failed to load configuration`,-1),S(`div`,Vd,t(v(i).error),1),S(`button`,{onClick:r[2]||=e=>v(i).fetchStats(),class:`btn-primary`},` Retry `)])])):(h(),C(`div`,Hd,[d.value===`radio`?(h(),C(`div`,Ud,[_(Ve,{ref_key:`radioRef`,ref:E,key:`radio-settings`},null,512)])):g(``,!0),d.value===`repeater`?(h(),C(`div`,Wd,[_(Vt,{ref_key:`repeaterRef`,ref:D,key:`repeater-settings`},null,512)])):g(``,!0),d.value===`advert`?(h(),C(`div`,Gd,[_(qo,{ref_key:`advertRef`,ref:O,key:`advert-settings`},null,512)])):g(``,!0),d.value===`duty`?(h(),C(`div`,Kd,[_(tn,{ref_key:`dutyRef`,ref:k,key:`duty-cycle`},null,512)])):g(``,!0),d.value===`delays`?(h(),C(`div`,qd,[_(hn,{ref_key:`delaysRef`,ref:A,key:`transmission-delays`},null,512)])):g(``,!0),d.value===`transport`?(h(),C(`div`,Jd,[_(Pi,{ref_key:`transportRef`,ref:j,key:`transport-keys`},null,512)])):g(``,!0),d.value===`api-tokens`?(h(),C(`div`,Yd,[_(la,{key:`api-tokens`})])):g(``,!0),d.value===`web`?(h(),C(`div`,Xd,[_(Pa,{key:`web-settings`})])):g(``,!0),d.value===`observer`?(h(),C(`div`,Zd,[_(gc,{ref_key:`letsMeshRef`,ref:M,key:`letsmesh-settings`},null,512)])):g(``,!0),d.value===`backup`?(h(),C(`div`,Qd,[_(Sl,{key:`backup-restore`})])):g(``,!0),d.value===`database`?(h(),C(`div`,$d,[_(Cu,{key:`database-management`})])):g(``,!0),d.value===`memory`?(h(),C(`div`,ef,[_(hd,{key:`memory-debug`})])):g(``,!0)]))])])])}}}),[[`__scopeId`,`data-v-aef8d875`]]);export{tf as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/ConfirmDialog-DZJrcPub.js b/repeater/web/html/assets/ConfirmDialog-DZJrcPub.js deleted file mode 100644 index 869d2ef..0000000 --- a/repeater/web/html/assets/ConfirmDialog-DZJrcPub.js +++ /dev/null @@ -1 +0,0 @@ -import{Ct as e,c as t,g as n,i as r,k as i,l as a,s as o,u as s,xt as c}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{g as l}from"./index-CG181k2K.js";var u={class:`modal-card max-w-md`},d={class:`flex items-center justify-between mb-4`},f={class:`text-xl font-semibold text-content-primary dark:text-content-primary`},p={class:`mb-6`},m={key:0,class:`w-6 h-6`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},h={key:1,class:`w-6 h-6`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},g={key:2,class:`w-6 h-6`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},_={class:`text-content-secondary dark:text-content-primary/80 text-base leading-relaxed`},v={class:`flex gap-3`},y=n({__name:`ConfirmDialog`,props:{show:{type:Boolean},title:{default:`Confirm Action`},message:{},confirmText:{default:`Confirm`},cancelText:{default:`Cancel`},variant:{default:`warning`}},emits:[`close`,`confirm`],setup(n,{emit:y}){let b=n,x=y,S={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`},C={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(n,y)=>(i(),t(r,{to:`body`},[b.show?(i(),s(`div`,{key:0,onClick:y[3]||=l(e=>x(`close`),[`self`]),class:`modal-backdrop`},[o(`div`,u,[o(`div`,d,[o(`h3`,f,e(b.title),1),o(`button`,{onClick:y[0]||=e=>x(`close`),class:`text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors`},[...y[4]||=[o(`svg`,{class:`w-6 h-6`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[o(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),o(`div`,p,[o(`div`,{class:c([`inline-flex p-3 rounded-xl mb-4`,S[b.variant]])},[b.variant===`danger`?(i(),s(`svg`,m,[...y[5]||=[o(`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)]])):b.variant===`warning`?(i(),s(`svg`,h,[...y[6]||=[o(`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)]])):(i(),s(`svg`,g,[...y[7]||=[o(`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),o(`p`,_,e(b.message),1)]),o(`div`,v,[o(`button`,{onClick:y[1]||=e=>x(`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`},e(b.cancelText),1),o(`button`,{onClick:y[2]||=e=>x(`confirm`),class:c([`flex-1 px-4 py-3 rounded-xl text-white transition-all duration-200`,C[b.variant]])},e(b.confirmText),3)])])])):a(``,!0)]))}});export{y as t}; \ No newline at end of file diff --git a/repeater/web/html/assets/ConfirmDialog-XtZRdfP5.js b/repeater/web/html/assets/ConfirmDialog-XtZRdfP5.js new file mode 100644 index 0000000..cf06ed4 --- /dev/null +++ b/repeater/web/html/assets/ConfirmDialog-XtZRdfP5.js @@ -0,0 +1 @@ +import{Ct as e,c as t,g as n,i as r,k as i,l as a,s as o,u as s,xt as c}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{u as l}from"./runtime-dom.esm-bundler-fKU3dih-.js";var u={class:`modal-card max-w-md`},d={class:`flex items-center justify-between mb-4`},f={class:`text-xl font-semibold text-content-primary dark:text-content-primary`},p={class:`mb-6`},m={key:0,class:`w-6 h-6`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},h={key:1,class:`w-6 h-6`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},g={key:2,class:`w-6 h-6`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},_={class:`text-content-secondary dark:text-content-primary/80 text-base leading-relaxed`},v={class:`flex gap-3`},y=n({__name:`ConfirmDialog`,props:{show:{type:Boolean},title:{default:`Confirm Action`},message:{},confirmText:{default:`Confirm`},cancelText:{default:`Cancel`},variant:{default:`warning`}},emits:[`close`,`confirm`],setup(n,{emit:y}){let b=n,x=y,S={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`},C={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(n,y)=>(i(),t(r,{to:`body`},[b.show?(i(),s(`div`,{key:0,onClick:y[3]||=l(e=>x(`close`),[`self`]),class:`modal-backdrop`},[o(`div`,u,[o(`div`,d,[o(`h3`,f,e(b.title),1),o(`button`,{onClick:y[0]||=e=>x(`close`),class:`text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors`},[...y[4]||=[o(`svg`,{class:`w-6 h-6`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[o(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),o(`div`,p,[o(`div`,{class:c([`inline-flex p-3 rounded-xl mb-4`,S[b.variant]])},[b.variant===`danger`?(i(),s(`svg`,m,[...y[5]||=[o(`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)]])):b.variant===`warning`?(i(),s(`svg`,h,[...y[6]||=[o(`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)]])):(i(),s(`svg`,g,[...y[7]||=[o(`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),o(`p`,_,e(b.message),1)]),o(`div`,v,[o(`button`,{onClick:y[1]||=e=>x(`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`},e(b.cancelText),1),o(`button`,{onClick:y[2]||=e=>x(`confirm`),class:c([`flex-1 px-4 py-3 rounded-xl text-white transition-all duration-200`,C[b.variant]])},e(b.confirmText),3)])])])):a(``,!0)]))}});export{y as t}; \ No newline at end of file diff --git a/repeater/web/html/assets/Dashboard-B5wTBGWv.js b/repeater/web/html/assets/Dashboard-B5wTBGWv.js new file mode 100644 index 0000000..daa1959 --- /dev/null +++ b/repeater/web/html/assets/Dashboard-B5wTBGWv.js @@ -0,0 +1,2 @@ +import{B as e,Ct as t,E as n,K as r,R as i,S as a,St as o,V as s,Y as c,c as l,f as u,g as d,i as f,j as p,k as m,l as h,m as g,nt as _,o as v,p as y,r as b,s as x,u as S,w as C,xt as w}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{o as T,t as E,u as D}from"./runtime-dom.esm-bundler-fKU3dih-.js";import{t as O}from"./packets-B7XZyaZ9.js";import{t as k}from"./system-Dx7MrhAz.js";import{t as A}from"./dataService-CLvdg62X.js";import{t as j}from"./_plugin-vue_export-helper-TcpyXLsZ.js";import{t as M}from"./Spinner-CYvUNW0P.js";import{t as N}from"./websocket-BBHBKSxR.js";import{t as P}from"./index-BpKhPa08.js";import{n as F,t as I}from"./preferences-6MHglq--.js";import{d as L,f as R,g as z,l as ee,n as B,o as te,s as V,t as ne,u as re}from"./ChartCard-Cqs_1Frf.js";import{t as ie}from"./useSignalQuality-CLsnSJcS.js";var H={class:`sparkline-card`},U={class:`card-header`},W={class:`card-title`},G={class:`card-values`},K={class:`card-chart`},q=j(d({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(e){V.register(te,L,R,re,ee,z);let s=e,l=c(null),u=c(null),d=e=>{if(e.length<3)return e;let t=Math.min(15,Math.max(3,Math.floor(e.length*.2))),n=[];for(let r=0;re+t,0)/s.length)}let r=Math.min(12,n.length),i=n.length/r,a=[];for(let e=0;e!s.data||s.data.length===0?[]:d(s.data)),p=v(()=>!s.secondaryData||s.secondaryData.length===0?[]:d(s.secondaryData)),g=()=>{if(!l.value)return;let e=l.value.getContext(`2d`);if(!e)return;u.value&&=(u.value.destroy(),null);let t=f.value;if(t.length<2)return;let n=[{data:t,borderColor:s.color,borderWidth:2.5,fill:!1,tension:.4,pointRadius:0,pointHoverRadius:0}],i=p.value;i.length>=2&&s.secondaryColor&&n.push({data:i,borderColor:s.secondaryColor,borderWidth:2,borderDash:[4,3],fill:!1,tension:.4,pointRadius:0,pointHoverRadius:0}),u.value=r(new V(e,{type:`line`,data:{labels:t.map((e,t)=>t.toString()),datasets:n},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}}}}))},_=()=>{if(!u.value){g();return}let e=f.value;if(e.length<2)return;u.value.data.labels=e.map((e,t)=>t.toString()),u.value.data.datasets[0].data=e;let t=p.value;t.length>=2&&s.secondaryColor&&(u.value.data.datasets.length<2?u.value.data.datasets.push({data:t,borderColor:s.secondaryColor,borderWidth:2,borderDash:[4,3],fill:!1,tension:.4,pointRadius:0,pointHoverRadius:0}):u.value.data.datasets[1].data=t),u.value.update(`default`)};return i(()=>s.data,()=>{a(()=>_())},{deep:!0}),i(()=>s.color,()=>{u.value&&(u.value.data.datasets[0].borderColor=s.color,u.value.update(`none`))}),n(()=>{a(()=>g())}),C(()=>{u.value&&=(u.value.destroy(),null)}),(n,r)=>(m(),S(`div`,H,[x(`div`,U,[x(`p`,W,t(e.title),1),x(`div`,G,[x(`span`,{class:`card-value`,style:o({color:e.color})},t(typeof e.value==`number`?e.value.toLocaleString():e.value),5),e.secondaryValue===void 0?h(``,!0):(m(),S(`span`,{key:0,class:`card-secondary-value`,style:o({color:e.secondaryColor})},t(e.secondaryLabel)+t(typeof e.secondaryValue==`number`?e.secondaryValue.toLocaleString():e.secondaryValue),5))])]),x(`div`,K,[e.showChart?(m(),S(`canvas`,{key:0,ref_key:`canvasRef`,ref:l},null,512)):h(``,!0)])]))}}),[[`__scopeId`,`data-v-d5c09182`]]),J={class:`grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3 lg:gap-4 mb-5 stats-cards-container`},ae=j(d({name:`StatsCards`,__name:`StatsCards`,setup(e){let t={uptime:`#EBA0FC`,rx:`#AAE8E8`,forward:`#FFC246`,dropped:`#FB787B`,crcErrors:`#F59E0B`,hashCache:`#9F7AEA`},r=O(),i=k(),a=A(),o=e=>{let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h`:n>0?`${n}h ${r}m`:`${r}m`},s=v(()=>{let e=r.packetStats,t=i.stats?.uptime_seconds||0,n=e?.total_packets||0,a=e?.dropped_packets||0;return{packetsReceived:n,packetsForwarded:e?.transmitted_packets||0,uptimeFormatted:o(t),droppedPackets:a,crcErrorCount:r.crcErrorCount,hashCacheSize:r.systemStats?.duplicate_cache_size??0}}),c=v(()=>r.sparklineData);return n(()=>{a.ensure(`sparklines`)}),(e,n)=>(m(),S(`div`,J,[g(q,{title:`Up Time`,value:s.value.uptimeFormatted,color:t.uptime,data:[],showChart:!1,class:`stat-card`},null,8,[`value`,`color`]),g(q,{title:`RX Packets`,value:s.value.packetsReceived,color:t.rx,data:c.value.totalPackets,class:`stat-card`},null,8,[`value`,`color`,`data`]),g(q,{title:`Forward`,value:s.value.packetsForwarded,color:t.forward,data:c.value.transmittedPackets,class:`stat-card`},null,8,[`value`,`color`,`data`]),g(q,{title:`Dropped`,value:s.value.droppedPackets,color:t.dropped,data:c.value.droppedPackets,class:`stat-card`},null,8,[`value`,`color`,`data`]),g(q,{title:`CRC Errors`,value:s.value.crcErrorCount,color:t.crcErrors,data:c.value.crcErrors,class:`stat-card`},null,8,[`value`,`color`,`data`]),g(q,{title:`Hash Cache`,value:s.value.hashCacheSize,color:t.hashCache,showChart:!1,class:`stat-card`},null,8,[`value`,`color`])]))}}),[[`__scopeId`,`data-v-19814841`]]),oe={class:`glass-card rounded-[10px] p-4 lg:p-6`},se={key:0,class:`absolute inset-0 flex items-center justify-center`},ce={key:1,class:`h-full flex flex-col`},Y={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`},X={class:`text-content-primary dark:text-content-primary text-sm font-medium mb-1`},le={class:`text-content-primary dark:text-content-primary`},ue={class:`flex-1 flex items-end justify-evenly gap-4 px-4`},de=[`onMouseenter`],fe={class:`text-content-primary dark:text-content-primary text-xs sm:text-sm font-semibold text-center w-full`,style:{"padding-bottom":`5px`}},pe={class:`text-content-secondary dark:text-content-muted text-xs mt-2 text-center`},me={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`},he={class:`truncate text-left`},ge={key:1,class:`mt-3 text-xs text-content-secondary dark:text-content-muted text-center`},_e=j(d({name:`PacketTypesChart`,__name:`PacketTypesChart`,setup(r){let a=c([]),s=O(),l=N(),u=c(!0),d=c(!1),f=c(null),_=c(`Connecting...`),y=c(null),C=[{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`]}],w=v(()=>C.map(e=>{let t=a.value.filter(t=>e.types.some(e=>t.name.includes(e)||t.name===e)).sort((e,t)=>t.count-e.count).map((t,n)=>({...t,color:e.subColors[n%e.subColors.length]}));return{name:e.name,color:e.subColors[0],items:t,total:t.reduce((e,t)=>e+t.count,0)}}).filter(e=>e.total>0)),T=v(()=>Math.max(...w.value.map(e=>e.total),1)),E=v(()=>w.value.reduce((e,t)=>e+t.total,0)),D=async()=>{_.value=`Connecting...`,f.value=null,u.value||(d.value=!0);try{let e=await B(`/packet_type_graph_data`,void 0,{onPhaseChange:e=>{_.value=e===`receiving`?`Receiving data...`:`Connecting...`}});if(e?.success&&e?.data){let t=e.data;if(t?.series){let e=[];t.series.forEach((t,n)=>{let r=0;t.data&&Array.isArray(t.data)&&(r=t.data.reduce((e,t)=>e+(t[1]||0),0)),r>0&&e.push({name:t.name||`Type ${t.type}`,type:t.type,count:r,color:``})}),a.value=e,u.value=!1,d.value=!1}else f.value=`No series data in server response`,u.value=!1,d.value=!1}else f.value=`Invalid response from server`,u.value=!1,d.value=!1}catch(e){f.value=e instanceof Error?e.message:`Failed to load data`,u.value=!1,d.value=!1}},k={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`},A=()=>{let e=s.packetTypeBreakdown;!e||e.length===0||(a.value=e.map(e=>({name:k[Number(e.type)]||`Type ${e.type}`,type:e.type,count:e.count,color:``})),u.value=!1,f.value=null)},j=e=>Math.max(e/T.value*90,2),M=(e,t)=>t===0?0:e/t*100;return n(()=>{D()}),i(()=>s.packetTypeBreakdown,()=>A(),{deep:!0,immediate:!0}),P(D,{intervalMs:3e4,enabled:()=>!l.isConnected,immediate:!0}),(n,r)=>(m(),S(`div`,oe,[r[2]||=x(`div`,{class:`flex items-baseline justify-between mb-3 lg:mb-4`},[x(`h3`,{class:`text-content-primary dark:text-content-primary text-lg lg:text-xl font-semibold`},` Packet Types `),x(`p`,{class:`text-content-secondary dark:text-content-muted text-xs lg:text-sm uppercase`},` Distribution by Type `)],-1),g(ne,{class:`h-48 lg:h-56`,"is-loading":u.value,"is-updating":d.value,error:f.value,status:_.value,onRetry:D},{default:e(()=>[w.value.length===0&&!u.value&&!f.value?(m(),S(`div`,se,[...r[1]||=[x(`div`,{class:`text-content-secondary dark:text-content-primary text-sm lg:text-base`},` No packet data available `,-1)]])):h(``,!0),w.value.length>0?(m(),S(`div`,ce,[y.value?(m(),S(`div`,Y,[x(`div`,X,t(y.value.name)+` · `+t(y.value.total.toLocaleString()),1),(m(!0),S(b,null,p(y.value.items,e=>(m(),S(`div`,{key:e.type,class:`flex justify-between gap-4 text-xs text-content-secondary dark:text-content-muted`},[x(`span`,null,t(e.name),1),x(`span`,le,t(e.count.toLocaleString()),1)]))),128))])):h(``,!0),x(`div`,ue,[(m(!0),S(b,null,p(w.value,e=>(m(),S(`div`,{key:e.name,class:`flex flex-col items-center flex-1 max-w-32 h-full justify-end cursor-pointer`,onMouseenter:t=>y.value=e,onMouseleave:r[0]||=e=>y.value=null},[x(`span`,fe,t(e.total.toLocaleString()),1),x(`div`,{class:`w-full rounded-[5px] transition-all duration-300 ease-out hover:opacity-90 overflow-hidden flex flex-col-reverse`,style:o({height:j(e.total)+`%`,minHeight:`8px`})},[(m(!0),S(b,null,p(e.items,t=>(m(),S(`div`,{key:t.type,style:o({height:M(t.count,e.total)+`%`,backgroundColor:t.color})},null,4))),128))],4),x(`span`,pe,t(e.name),1)],40,de))),128))])])):h(``,!0)]),_:1},8,[`is-loading`,`is-updating`,`error`,`status`]),w.value.length>0?(m(),S(`div`,me,[(m(!0),S(b,null,p(w.value,e=>(m(),S(`div`,{key:`legend-`+e.name,class:`flex flex-col gap-0.5 min-w-[100px] max-w-[140px] flex-shrink-0`},[(m(!0),S(b,null,p(e.items,e=>(m(),S(`div`,{key:e.type,class:`flex items-center gap-1.5`},[x(`span`,{class:`w-2 h-2 rounded-sm shrink-0`,style:o({backgroundColor:e.color})},null,4),x(`span`,he,t(e.name),1)]))),128))]))),128))])):h(``,!0),w.value.length>0?(m(),S(`div`,ge,` Total: `+t(E.value.toLocaleString())+` packets `,1)):h(``,!0)]))}}),[[`__scopeId`,`data-v-a30328ce`]]),ve={class:`glass-card rounded-[10px] p-4 lg:p-6`},ye={class:`mt-3 lg:mt-4 grid grid-cols-2 gap-3 lg:gap-4`},be={class:`text-center`},xe={class:`text-lg lg:text-2xl font-bold text-content-primary dark:text-content-primary`},Se={class:`text-center`},Ce={class:`text-lg lg:text-2xl font-bold text-content-primary dark:text-content-primary`},we={class:`mt-2 lg:mt-3 grid grid-cols-3 gap-2 lg:gap-3 text-center`},Te={class:`text-xs lg:text-sm font-semibold text-accent-purple flex items-center justify-center gap-1`},Ee={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`},Oe={class:`text-xs lg:text-sm font-semibold text-accent-red flex items-center justify-center gap-1`},ke={key:0,class:`inline-block w-1.5 h-1.5 rounded-full bg-secondary opacity-70`,title:`Early data - limited uptime`},Ae={class:`text-xs text-content-secondary dark:text-content-muted`},je={class:`text-xs lg:text-sm font-semibold text-accent-red`},Z=null,Me=12e4,Ne=j(d({name:`AirtimeUtilizationChart`,__name:`AirtimeUtilizationChart`,setup(r){let i={rx:`#EBA0FC`,tx:`#FB787B`},o=()=>{let e=document.documentElement.classList.contains(`dark`);return{gridLine:e?`rgba(255, 255, 255, 0.1)`:`rgba(0, 0, 0, 0.1)`,axisLabel:e?`rgba(255, 255, 255, 0.5)`:`rgba(0, 0, 0, 0.5)`}},s=O(),l=k(),d=c(null),f=c([]),p=c(!1),b=c(!0),w=c(!1),T=c(null),E=c(`Connecting...`),D=c(30),A=c({totalReceived:0,totalTransmitted:0,dropped:0,firstPacketTime:0}),j=c({sf:9,bwHz:62500,cr:5,preamble:17}),M=(e,t=60)=>{if(e.length===0)return[];let n=1-.5**(1/t),r=Math.min(e.length,Math.max(10,Math.floor(t/3))),i=0,a=0;for(let t=0;t(i=n*e.rxUtil+(1-n)*i,a=n*e.txUtil+(1-n)*a,{...e,rxUtil:i,txUtil:a}))},N=v(()=>{let e=s.packetStats?.total_packets||0,t=s.packetStats?.transmitted_packets||0,n=l.stats?.uptime_seconds||0,r=e||A.value.totalReceived,i=t||A.value.totalTransmitted,a=A.value.firstPacketTime>0?Math.floor(Date.now()/1e3)-A.value.firstPacketTime:0,o=n||a,c=Math.max(o/3600,.1);if(c<1){let e=Math.max(o/60,1);return{rxRate:{value:Math.round(r/e*100)/100,label:c<.5?`RX/min (early)`:`RX/min`},txRate:{value:Math.round(i/e*100)/100,label:c<.5?`TX/min (early)`:`TX/min`},confidence:`low`}}let u=Math.round(r/c*100)/100,d=Math.round(i/c*100)/100,f,p;return c<6?(f=`RX/hr (${Math.round(c)}h)`,p=`medium`):c<24?(f=`RX/hr (${Math.round(c)}h)`,p=`high`):(f=`RX/hr`,p=`high`),{rxRate:{value:u,label:f},txRate:{value:d,label:f.replace(`RX`,`TX`)},confidence:p}}),F=async()=>{E.value=`Connecting...`,T.value=null,b.value||(w.value=!0);try{let e=60*1e3,t=Math.floor(Date.now()/1e3),n=t-24*3600,r=l.stats?.config?.radio;r&&(j.value={sf:r.spreading_factor??9,bwHz:r.bandwidth??62500,cr:r.coding_rate??5,preamble:r.preamble_length??17});let i=await B(`/airtime_chart_data`,{start_timestamp:n,end_timestamp:t,bucket_seconds:60,sf:j.value.sf,bw_hz:j.value.bwHz,cr:j.value.cr,preamble:j.value.preamble},{onPhaseChange:e=>{E.value=e===`receiving`?`Receiving data...`:`Connecting...`}});if(!i.success){f.value=[],p.value=!1,b.value=!1,w.value=!1,a(()=>I());return}let o=i.data,c=o.buckets||[];A.value={totalReceived:o.rx_total||0,totalTransmitted:o.tx_total||0,dropped:s.packetStats?.dropped_packets??0,firstPacketTime:c.length>0?c[0].timestamp:t};let u=24*3600/60,d=new Float64Array(u),m=new Float64Array(u);for(let t of c){let r=Math.floor((t.timestamp-n)/60);r>=0&&r[e.rxUtil,e.txUtil]))*1.05;D.value=Math.max(5,Math.ceil(y/5)*5),Z={data:v,yAxisMax:D.value,fetchedAt:Date.now()},p.value=!1,b.value=!1,w.value=!1,T.value=null,a(()=>I())}catch(e){console.error(`Failed to fetch airtime data:`,e),f.value=[],p.value=!1,b.value=!1,w.value=!1,T.value=e instanceof Error?e.message:`Failed to load chart data`,a(()=>I())}},I=()=>{if(!d.value)return;let e=d.value,t=e.getContext(`2d`);if(!t)return;let n=e.parentElement;if(!n)return;let r=n.getBoundingClientRect(),a=r.width,s=r.height;if(e.width=a*window.devicePixelRatio,e.height=s*window.devicePixelRatio,e.style.width=a+`px`,e.style.height=s+`px`,t.scale(window.devicePixelRatio,window.devicePixelRatio),t.clearRect(0,0,a,s),p.value){t.fillStyle=o().axisLabel,t.font=`16px system-ui`,t.textAlign=`center`,t.fillText(`Loading chart data...`,a/2,s/2);return}if(f.value.length===0){t.fillStyle=o().axisLabel,t.font=`16px system-ui`,t.textAlign=`center`,t.fillText(`No data available`,a/2,s/2);return}let c=a-45-20,l=s-40,u=D.value,m=D.value,h=o();t.strokeStyle=h.gridLine,t.lineWidth=1,t.font=`10px system-ui`,t.textAlign=`right`;for(let e=0;e<=5;e++){let n=20+l*e/5;t.beginPath(),t.moveTo(45,n),t.lineTo(a-20,n),t.stroke();let r=u-e/5*m;t.fillStyle=h.axisLabel,t.fillText(`${r.toFixed(0)}%`,40,n+3)}for(let e=0;e<=6;e++){let n=45+c*e/6;t.beginPath(),t.moveTo(n,20),t.lineTo(n,s-20),t.stroke()}f.value.length>1&&(t.strokeStyle=i.rx,t.lineWidth=2,t.beginPath(),f.value.forEach((e,n)=>{let r=45+c*n/(f.value.length-1),i=s-20-Math.min(e.rxUtil,D.value)/m*l;n===0?t.moveTo(r,i):t.lineTo(r,i)}),t.stroke()),f.value.length>1&&(t.strokeStyle=i.tx,t.lineWidth=2,t.beginPath(),f.value.forEach((e,n)=>{let r=45+c*n/(f.value.length-1),i=s-20-Math.min(e.txUtil,D.value)/m*l;n===0?t.moveTo(r,i):t.lineTo(r,i)}),t.stroke())};return P(F,{intervalMs:12e4,immediate:!1}),n(()=>{Z&&Date.now()-Z.fetchedAt{I(),setTimeout(()=>I(),100)}),window.addEventListener(`resize`,I)}),C(()=>{window.removeEventListener(`resize`,I)}),(n,r)=>(m(),S(`div`,ve,[r[3]||=u(`

Airtime Utilization

Activity (Last 24 Hours)

Rx Util
Tx Util
`,3),g(ne,{class:`h-40 lg:h-48`,"is-loading":b.value,"is-updating":w.value,error:T.value,status:E.value,onRetry:F},{default:e(()=>[x(`canvas`,{ref_key:`chartRef`,ref:d,class:`absolute inset-0 w-full h-full`},null,512)]),_:1},8,[`is-loading`,`is-updating`,`error`,`status`]),x(`div`,ye,[x(`div`,be,[x(`div`,xe,t(_(s).packetStats?.total_packets||A.value.totalReceived),1),r[0]||=x(`div`,{class:`text-xs text-content-secondary dark:text-content-muted uppercase tracking-wide`},` Total Received `,-1)]),x(`div`,Se,[x(`div`,Ce,t(_(s).packetStats?.transmitted_packets||A.value.totalTransmitted),1),r[1]||=x(`div`,{class:`text-xs text-content-secondary dark:text-content-muted uppercase tracking-wide`},` Total Transmitted `,-1)])]),x(`div`,we,[x(`div`,null,[x(`div`,Te,[y(t(N.value.rxRate.value)+` `,1),N.value.confidence===`low`?(m(),S(`span`,Ee)):h(``,!0)]),x(`div`,De,t(N.value.rxRate.label),1)]),x(`div`,null,[x(`div`,Oe,[y(t(N.value.txRate.value)+` `,1),N.value.confidence===`low`?(m(),S(`span`,ke)):h(``,!0)]),x(`div`,Ae,t(N.value.txRate.label),1)]),x(`div`,null,[x(`div`,je,t(_(s).packetStats?.dropped_packets||A.value.dropped),1),r[2]||=x(`div`,{class:`text-xs text-content-secondary dark:text-content-muted`},`Dropped`,-1)])])]))}}),[[`__scopeId`,`data-v-2e55952b`]]),Pe={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`},Fe={class:`flex items-center justify-between p-8 pb-4 flex-shrink-0`},Ie={class:`text-content-secondary dark:text-content-muted text-sm`},Le={class:`flex items-center gap-2`},Re=[`title`],ze={class:`flex-1 overflow-y-auto custom-scrollbar px-8`},Be={class:`mb-6`},Ve={class:`glass-card bg-white/5 rounded-[15px] p-4`},He={class:`grid grid-cols-1 md:grid-cols-2 gap-4`},Ue={class:`space-y-3`},We={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10`},Ge={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`},qe={class:`text-content-primary dark:text-content-primary font-mono text-xs break-all`},Je={key:0,class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10`},Ye={class:`text-content-primary dark:text-content-primary font-mono text-xs`},Xe={class:`space-y-3`},Ze={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-semibold`},$e={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10`},et={class:`text-content-primary dark:text-content-primary font-semibold`},tt={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10`},nt={class:`mb-6`},rt={class:`bg-gray-50 dark:bg-white/5 rounded-[15px] p-4 border border-stroke-subtle dark:border-stroke/10`},it={class:`space-y-3`},at={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10`},ot={class:`text-content-primary dark:text-content-primary`},st={key:0,class:`pt-2`},ct={class:`glass-card bg-background-mute dark:bg-black/30 rounded-[10px] p-4 mb-4`},lt={class:`w-full overflow-x-auto`},ut={class:`text-content-primary dark:text-content-primary/90 text-xs font-mono whitespace-pre leading-relaxed min-w-full`},dt={class:`flex items-center justify-between mb-3`},ft={class:`text-content-secondary dark:text-content-primary/80 text-sm font-semibold`},pt={class:`text-content-muted dark:text-content-muted text-xs`},mt={class:`bg-background-mute dark:bg-black/40 rounded-[8px] p-3 mb-3`},ht={class:`font-mono text-xs text-content-primary dark:text-content-primary break-all whitespace-pre-wrap leading-relaxed`},gt={class:`bg-gray-50 dark:bg-white/5 rounded-[10px] overflow-hidden`},_t={key:0,class:`min-w-0`},vt={class:`text-cyan-500 text-sm font-mono break-words min-w-0`},yt={class:`text-content-primary dark:text-content-primary text-sm break-words min-w-0`},bt={class:`text-content-primary dark:text-content-primary text-sm font-semibold break-all min-w-0 overflow-hidden`},xt=[`title`],St={key:0,class:`text-orange-500 text-xs font-mono break-all min-w-0 overflow-hidden`},Ct=[`title`],wt={class:`grid grid-cols-2 gap-2`},Tt={class:`text-cyan-500 text-sm font-mono break-words`},Et={class:`text-content-primary dark:text-content-primary text-sm break-words`},Dt=[`title`],Ot={key:0},kt=[`title`],At={key:0,class:`text-content-muted dark:text-content-muted text-xs italic mt-2 px-1`},jt={key:1,class:`py-2`},Mt={class:`mb-6`},Nt={class:`bg-gray-50 dark:bg-white/5 rounded-[15px] p-4 border border-stroke-subtle dark:border-stroke/10`},Pt={class:`space-y-4`},Ft={class:`grid grid-cols-1 md:grid-cols-2 gap-4`},It={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10`},Lt={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10`},Rt={key:0,class:`py-2`},zt={class:`bg-background-mute dark:bg-black/20 rounded-[10px] p-4`},Bt={class:`flex items-center flex-wrap gap-2`},Vt={class:`relative group`},Ht={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`},Ut={class:`font-mono text-[10px] font-semibold tracking-tight text-content-primary dark:text-content-primary/90 sm:text-xs`},Wt={class:`pointer-events-none absolute bottom-full left-1/2 z-50 mb-2 -translate-x-1/2 transform whitespace-nowrap rounded-md bg-neutral-900 px-2 py-1 font-mono text-xs text-white opacity-0 shadow-lg ring-1 ring-white/10 transition-opacity group-hover:opacity-100`},Gt={key:0,class:`mx-2 text-cyan-600 dark:text-cyan-400/60`},Kt={key:1,class:`py-2`},qt={class:`text-content-secondary dark:text-content-muted text-sm mb-2 flex items-center`},Jt={key:0,class:`w-4 h-4 ml-2 text-yellow-500`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Yt={key:1,class:`text-yellow-500 text-xs ml-1`},Xt={class:`bg-background-mute dark:bg-black/20 rounded-[10px] p-4`},Zt={class:`flex items-center flex-wrap gap-2`},Qt={class:`relative group`},$t={key:0,class:`absolute -top-1 -right-1 w-2 h-2 bg-yellow-400 rounded-full animate-pulse`},en={class:`pointer-events-none absolute bottom-full left-1/2 z-50 mb-2 -translate-x-1/2 transform whitespace-nowrap rounded-md bg-neutral-900 px-2 py-1 font-mono text-xs text-white opacity-0 shadow-lg ring-1 ring-white/10 transition-opacity group-hover:opacity-100`},tn={key:0,class:`mx-1 text-orange-600 dark:text-orange-400/60`},nn={class:`mb-6`},rn={class:`glass-card bg-gray-50 dark:bg-white/5 rounded-[15px] p-4`},an={class:`grid grid-cols-1 md:grid-cols-3 gap-4 mb-4`},on={class:`text-center p-3 glass-card bg-background-mute dark:bg-black/20 rounded-[10px]`},sn={class:`text-lg font-bold text-content-primary dark:text-content-primary`},cn={class:`text-center p-3 glass-card bg-background-mute dark:bg-black/20 rounded-[10px]`},ln={class:`text-center p-3 glass-card bg-background-mute dark:bg-black/20 rounded-[10px]`},un={class:`text-lg font-bold text-content-primary dark:text-content-primary`},dn={key:0,class:`mb-4`},fn={class:`flex items-center gap-3`},pn={class:`flex gap-1`},mn={class:`text-content-secondary dark:text-content-primary/80 text-sm capitalize`},hn={key:1,class:`mb-4`},gn={key:2,class:`mb-4`},_n={class:`text-content-secondary dark:text-content-muted text-sm mb-3`},vn={class:`space-y-2`},yn={class:`flex items-center gap-3`},bn={class:`text-content-muted dark:text-content-muted text-sm`},xn={key:3,class:`mt-6 pt-4 border-t border-stroke-subtle dark:border-stroke/10`},Sn={class:`grid grid-cols-1 md:grid-cols-3 gap-3 mb-4`},Cn={class:`text-center p-3 glass-card bg-background-mute dark:bg-black/20 rounded-[10px]`},wn={class:`text-2xl font-bold text-content-primary dark:text-content-primary`},Tn={class:`text-center p-3 glass-card bg-background-mute dark:bg-black/20 rounded-[10px]`},En={class:`text-2xl font-bold text-content-primary dark:text-content-primary`},Dn={class:`text-content-muted dark:text-content-muted text-xs mt-1`},On={class:`text-center p-3 glass-card bg-background-mute dark:bg-black/20 rounded-[10px]`},kn={class:`text-content-muted dark:text-content-muted text-xs mt-1`},An={key:0,class:`glass-card bg-background-mute dark:bg-black/20 rounded-[10px] p-4`},jn={class:`space-y-3`},Mn={class:`flex-shrink-0 w-16 text-right`},Nn={class:`text-content-secondary dark:text-content-muted text-xs`},Pn={class:`flex-1 relative`},Fn={class:`h-8 rounded-lg overflow-hidden bg-background-mute dark:bg-stroke/5 relative`},In={class:`absolute inset-0 flex items-center px-3`},Ln={class:`text-content-primary dark:text-content-primary text-xs font-mono font-semibold`},Rn={class:`flex-shrink-0 w-12 text-left`},zn={class:`text-content-muted dark:text-content-muted text-xs`},Bn={class:`grid grid-cols-1 md:grid-cols-2 gap-4`},Vn={class:`space-y-2`},Hn={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10`},Un={class:`text-content-primary dark:text-content-primary`},Wn={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10`},Gn={class:`space-y-2`},Kn={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10`},qn={key:0,class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10`},Jn={class:`text-red-600 dark:text-red-400 text-sm`},Yn={class:`p-8 pt-4 border-t border-stroke-subtle dark:border-stroke/10 flex justify-end flex-shrink-0`},Xn=j(d({name:`PacketDetailsModal`,__name:`PacketDetailsModal`,props:{packet:{},isOpen:{type:Boolean},localHash:{}},emits:[`close`],setup(n,{emit:r}){let{getSignalQuality:a}=ie(),s=n,u=r,d=c(!1),_=e=>new Date(e*1e3).toLocaleString(),v=e=>e.transmitted?e.is_duplicate?`text-amber-600 dark:text-amber-400`:e.drop_reason?`text-red-600 dark:text-red-400`:`text-green-600 dark:text-green-400`:`text-red-600 dark:text-red-400`,C=e=>e.transmitted?e.is_duplicate?`Duplicate`:e.drop_reason?`Dropped`:`Forwarded`:`Dropped`,T=e=>({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]||`Unknown Type (${e})`,O=e=>({0:`Transport Flood`,1:`Flood`,2:`Direct`,3:`Transport Direct`})[e]||`Unknown Route (${e})`,k=e=>{if(!e)return`None`;let t=e.replace(/\s+/g,``).toUpperCase().match(/.{2}/g)||[],n=[];for(let e=0;e{try{let r=0,i=t.length/2;if(i>=100){if(t.length>=r+64){let i=t.slice(r,r+64);e.push({name:`Public Key`,byteRange:`${(n+r)/2}-${(n+r+63)/2}`,hexData:i.match(/.{8}/g)?.join(` `)||i,description:`Ed25519 public key of the node (32 bytes)`,fields:[{bits:`0-255`,name:`Ed25519 Public Key`,value:`${i.slice(0,16)}...${i.slice(-16)}`,binary:`32 bytes (256 bits)`}]}),r+=64}if(t.length>=r+8){let i=t.slice(r,r+8),a=parseInt(i,16),o=new Date(a*1e3);e.push({name:`Timestamp`,byteRange:`${(n+r)/2}-${(n+r+7)/2}`,hexData:i.match(/.{2}/g)?.join(` `)||i,description:`Unix timestamp of advertisement`,fields:[{bits:`0-31`,name:`Unix Timestamp`,value:`${a} (${o.toLocaleString()})`,binary:a.toString(2).padStart(32,`0`)}]}),r+=8}if(t.length>=r+128){let i=t.slice(r,r+128);e.push({name:`Signature`,byteRange:`${(n+r)/2}-${(n+r+127)/2}`,hexData:i.match(/.{8}/g)?.join(` `)||i,description:`Ed25519 signature of public key, timestamp, and appdata`,fields:[{bits:`0-511`,name:`Ed25519 Signature`,value:`${i.slice(0,16)}...${i.slice(-16)}`,binary:`64 bytes (512 bits)`}]}),r+=128}t.length>r&&j(e,t.slice(r),n+r)}else e.push({name:`ADVERT AppData (Partial)`,byteRange:`${n/2}-${n/2+i-1}`,hexData:t.match(/.{2}/g)?.join(` `)||t,description:`Partial ADVERT data - appears to be just AppData portion (${i} bytes)`,fields:[{bits:`0-${i*8-1}`,name:`Partial Data`,value:`${i} bytes - attempting to decode as AppData`,binary:`${i} bytes (${i*8} bits)`}]}),j(e,t,n)}catch(n){e.push({name:`ADVERT Parse Error`,byteRange:`N/A`,hexData:t.slice(0,32)+`...`,description:`Failed to parse ADVERT payload structure`,fields:[{bits:`N/A`,name:`Error`,value:`Parse error: ${n instanceof Error?n.message:`Unknown error`}`,binary:`Invalid`}]})}},j=(e,t,n)=>{try{let r=t.length/2;e.push({name:`AppData`,byteRange:`${n/2}-${n/2+r-1}`,hexData:t.match(/.{2}/g)?.join(` `)||t,description:`Node advertisement application data (${r} bytes)`,fields:[{bits:`0-${r*8-1}`,name:`Application Data`,value:`${r} bytes (contains flags, location, name, etc.)`,binary:`${r} bytes (${r*8} bits)`}]});let i=0;if(t.length>=2){let r=parseInt(t.slice(i,i+2),16),a=[],o=!!(r&16),s=!!(r&32),c=!!(r&64),l=!!(r&128);if(r&1&&a.push(`is chat node`),r&2&&a.push(`is repeater`),r&4&&a.push(`is room server`),r&8&&a.push(`is sensor`),o&&a.push(`has location`),s&&a.push(`has feature 1`),c&&a.push(`has feature 2`),l&&a.push(`has name`),e.push({name:`AppData Flags`,byteRange:`${(n+i)/2}`,hexData:`0x${t.slice(i,i+2)}`,description:`Flags indicating which optional fields are present`,fields:[{bits:`0-7`,name:`Flags`,value:a.join(`, `)||`none`,binary:r.toString(2).padStart(8,`0`)}]}),i+=2,o&&t.length>=i+16){let r=t.slice(i,i+8),a=[];for(let e=6;e>=0;e-=2)a.push(r.slice(e,e+2));let o=parseInt(a.join(``),16),s=o>2147483647?o-4294967296:o,c=s/1e6,l=t.slice(i+8,i+16),u=[];for(let e=6;e>=0;e-=2)u.push(l.slice(e,e+2));let d=parseInt(u.join(``),16),f=d>2147483647?d-4294967296:d,p=f/1e6;e.push({name:`Location Data`,byteRange:`${(n+i)/2}-${(n+i+15)/2}`,hexData:`${r.match(/.{2}/g)?.join(` `)||r} ${l.match(/.{2}/g)?.join(` `)||l}`,description:`GPS coordinates (latitude and longitude)`,fields:[{bits:`0-31`,name:`Latitude`,value:`${c.toFixed(6)}° (raw: ${s})`,binary:s.toString(2).padStart(32,`0`)},{bits:`32-63`,name:`Longitude`,value:`${p.toFixed(6)}° (raw: ${f})`,binary:f.toString(2).padStart(32,`0`)}]}),i+=16}if(s&&t.length>=i+4){let r=t.slice(i,i+4),a=parseInt(r,16);e.push({name:`Feature 1`,byteRange:`${(n+i)/2}-${(n+i+3)/2}`,hexData:r.match(/.{2}/g)?.join(` `)||r,description:`Reserved feature 1 (2 bytes)`,fields:[{bits:`0-15`,name:`Feature 1 Value`,value:`${a}`,binary:a.toString(2).padStart(16,`0`)}]}),i+=4}if(c&&t.length>=i+4){let r=t.slice(i,i+4),a=parseInt(r,16);e.push({name:`Feature 2`,byteRange:`${(n+i)/2}-${(n+i+3)/2}`,hexData:r.match(/.{2}/g)?.join(` `)||r,description:`Reserved feature 2 (2 bytes)`,fields:[{bits:`0-15`,name:`Feature 2 Value`,value:`${a}`,binary:a.toString(2).padStart(16,`0`)}]}),i+=4}if(l&&t.length>i){let r=t.slice(i),a=r.match(/.{2}/g)||[],o=a.map(e=>{let t=parseInt(e,16);return t>=32&&t<=126?String.fromCharCode(t):`.`}).join(``).replace(/\.+$/,``);e.push({name:`Node Name`,byteRange:`${(n+i)/2}-${(n+t.length-1)/2}`,hexData:r.match(/.{2}/g)?.join(` `)||r,description:`Node name string (${a.length} bytes)`,fields:[{bits:`0-${a.length*8-1}`,name:`Node Name`,value:`"${o}"`,binary:`ASCII text (${a.length} bytes)`}]})}}}catch(n){e.push({name:`AppData Parse Error`,byteRange:`N/A`,hexData:t.slice(0,Math.min(32,t.length)),description:`Failed to parse AppData structure`,fields:[{bits:`N/A`,name:`Error`,value:`Parse error: ${n instanceof Error?n.message:`Unknown error`}`,binary:`Invalid`}]})}},M=e=>{if(!e)return[];if(Array.isArray(e))return e;if(typeof e==`string`)try{return JSON.parse(e)}catch{return[]}return[]},N=e=>{let t=[];if(!e)return t;try{let n=e.raw_packet;if(n){let e=n.replace(/\s+/g,``).toUpperCase(),r=0;if(e.length>=2){let n=e.slice(r,r+2),i=parseInt(n,16),a=i&3,o=(i&60)>>2,s=(i&192)>>6;if(t.push({name:`Header`,byteRange:`0`,hexData:`0x${n}`,description:`Contains routing type, payload type, and payload version`,fields:[{bits:`0-1`,name:`Route Type`,value:{0:`Transport Flood`,1:`Flood`,2:`Direct`,3:`Transport Direct`}[a]||`Unknown`,binary:a.toString(2).padStart(2,`0`)},{bits:`2-5`,name:`Payload Type`,value:{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`}[o]||`Unknown`,binary:o.toString(2).padStart(4,`0`)},{bits:`6-7`,name:`Version`,value:s.toString(),binary:s.toString(2).padStart(2,`0`)}]}),r+=2,(a===0||a===3)&&e.length>=r+8){let n=e.slice(r,r+8),i=parseInt(n.slice(0,4),16),a=parseInt(n.slice(4,8),16);t.push({name:`Transport Codes`,byteRange:`1-4`,hexData:`${n.slice(0,4)} ${n.slice(4,8)}`,description:`2x 16-bit transport codes for routing optimization`,fields:[{bits:`0-15`,name:`Code 1`,value:i.toString(),binary:i.toString(2).padStart(16,`0`)},{bits:`16-31`,name:`Code 2`,value:a.toString(),binary:a.toString(2).padStart(16,`0`)}]}),r+=8}if(e.length>=r+2){let n=e.slice(r,r+2),i=parseInt(n,16),a=(i>>6)+1,o=i&63,s=o*a;if(t.push({name:`Path Length`,byteRange:`${r/2}`,hexData:`0x${n}`,description:`${o} hop${o===1?``:`s`}, ${a}-byte hash${a>1?`es`:``} (${s} bytes)`,fields:[{bits:`6-7`,name:`Hash Size`,value:`${a}-byte`,binary:(i>>6&3).toString(2).padStart(2,`0`)},{bits:`0-5`,name:`Hop Count`,value:`${o}`,binary:(i&63).toString(2).padStart(6,`0`)}]}),r+=2,s>0&&e.length>=r+s*2){let n=e.slice(r,r+s*2),i=RegExp(`.{${a*2}}`,`g`),c=n.match(i)||[];t.push({name:`Path Data`,byteRange:`${r/2}-${(r+s*2-2)/2}`,hexData:c.join(` `)||n,description:`${o} × ${a}-byte routing hash${o===1?``:`es`}`,fields:c.map((e,t)=>({bits:`${t*a*8}-${(t+1)*a*8-1}`,name:`Hop ${t+1}`,value:e.toUpperCase(),binary:`${a} byte${a>1?`s`:``}`}))}),r+=s*2}}if(e.length>r){let n=e.slice(r),i=n.length/2;o===4?A(t,n,r):t.push({name:`Payload Data`,byteRange:`${r/2}-${r/2+i-1}`,hexData:n.match(/.{2}/g)?.join(` `)||n,description:`Application data content`,fields:[{bits:`0-${i*8-1}`,name:`Application Data`,value:`${i} bytes`,binary:`${i} bytes (${i*8} bits)`}]})}}}else{if(e.header){let n=e.header.replace(/0x/gi,``).replace(/\s+/g,``).toUpperCase(),r=parseInt(n,16),i=r&3,a=(r&60)>>2,o=(r&192)>>6;t.push({name:`Header`,byteRange:`0`,hexData:`0x${n}`,description:`Contains routing type, payload type, and payload version`,fields:[{bits:`0-1`,name:`Route Type`,value:{0:`Transport Flood`,1:`Flood`,2:`Direct`,3:`Transport Direct`}[i]||`Unknown`,binary:i.toString(2).padStart(2,`0`)},{bits:`2-5`,name:`Payload Type`,value:{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`}[a]||`Unknown`,binary:a.toString(2).padStart(4,`0`)},{bits:`6-7`,name:`Version`,value:o.toString(),binary:o.toString(2).padStart(2,`0`)}]}),e.transport_codes&&t.push({name:`Transport Codes`,byteRange:`1-4`,hexData:e.transport_codes,description:`2x 16-bit transport codes for routing optimization`,fields:[{bits:`0-31`,name:`Transport Codes`,value:e.transport_codes,binary:`Available in separate field`}]}),e.original_path&&e.original_path.length>0&&t.push({name:`Original Path`,byteRange:`?`,hexData:e.original_path.join(` `),description:`Original routing path (${e.original_path.length} nodes)`,fields:[{bits:`0-?`,name:`Path Nodes`,value:`${e.original_path.length} nodes`,binary:`Available as node list`}]}),e.forwarded_path&&e.forwarded_path.length>0&&t.push({name:`Forwarded Path`,byteRange:`?`,hexData:e.forwarded_path.join(` `),description:`Forwarded routing path (${e.forwarded_path.length} nodes)`,fields:[{bits:`0-?`,name:`Path Nodes`,value:`${e.forwarded_path.length} nodes`,binary:`Available as node list`}]})}if(e.payload){let n=e.payload.replace(/\s+/g,``).toUpperCase(),r=n.length/2;e.type===4?A(t,n,0):t.push({name:`Payload Data`,byteRange:`0-${r-1}`,hexData:n.match(/.{2}/g)?.join(` `)||n,description:`Application data content (${r} bytes)`,fields:[{bits:`0-${r*8-1}`,name:`Application Data`,value:`${r} bytes`,binary:`${r} bytes (${r*8} bits)`}]})}}}catch{t.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 t},P=(e,t)=>e==null||t==null?`text-content-muted dark:text-content-muted`:a(t).color,F=e=>{if(e==null)return{level:0,className:`signal-none`};let t=a(e),n,r;return t.bars>=5?(n=4,r=`signal-excellent`):t.bars>=4?(n=3,r=`signal-good`):t.bars>=2?(n=2,r=`signal-fair`):t.bars>=1?(n=1,r=`signal-poor`):(n=0,r=`signal-none`),{level:n,className:r}},I=e=>{if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}},L=e=>e>=1e3?`${(e/1e3).toFixed(2)}s`:`${Math.round(e)}ms`,R=e=>{e.key===`Escape`&&u(`close`)},z=e=>{e.target===e.currentTarget&&u(`close`)};return i(()=>s.isOpen,e=>{e?document.body.style.overflow=`hidden`:document.body.style.overflow=``},{immediate:!0}),(r,i)=>(m(),l(f,{to:`body`},[g(E,{name:`modal`,appear:``},{default:e(()=>[n.isOpen&&n.packet?(m(),S(`div`,{key:0,class:`fixed inset-0 z-50 flex items-center justify-center p-4 overflow-hidden`,onClick:z,onKeydown:R,tabindex:`0`},[i[51]||=x(`div`,{class:`absolute inset-0 bg-black/60 backdrop-blur-md pointer-events-none`},null,-1),x(`div`,{class:`relative w-full max-w-4xl max-h-[90vh] flex flex-col`,onClick:i[3]||=D(()=>{},[`stop`])},[x(`div`,Pe,[x(`div`,Fe,[x(`div`,null,[i[4]||=x(`h2`,{class:`text-2xl font-bold text-content-primary dark:text-content-primary mb-1`},` Packet Details `,-1),x(`p`,Ie,t(T(n.packet.type))+` - `+t(O(n.packet.route)),1)]),x(`div`,Le,[x(`button`,{onClick:i[0]||=e=>d.value=!d.value,class:w([`flex items-center gap-2 px-3 py-1.5 rounded-lg transition-all duration-200`,d.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:d.value?`Hide binary values`:`Show binary values`},[...i[5]||=[x(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4`})],-1),x(`span`,{class:`text-xs font-medium`},`Binary`,-1)]],10,Re),x(`button`,{onClick:i[1]||=e=>u(`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`},[...i[6]||=[x(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])])]),x(`div`,ze,[x(`div`,Be,[i[13]||=x(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-4 flex items-center`},[x(`div`,{class:`w-2 h-2 rounded-full bg-cyan-400 mr-3`}),y(` Basic Information `)],-1),x(`div`,Ve,[x(`div`,He,[x(`div`,Ue,[x(`div`,We,[i[7]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Timestamp`,-1),x(`span`,Ge,t(_(n.packet.timestamp)),1)]),x(`div`,Ke,[i[8]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Packet Hash`,-1),x(`span`,qe,t(n.packet.packet_hash),1)]),n.packet.header?(m(),S(`div`,Je,[i[9]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Header`,-1),x(`span`,Ye,t(n.packet.header),1)])):h(``,!0)]),x(`div`,Xe,[x(`div`,Ze,[i[10]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Type`,-1),x(`span`,Qe,t(n.packet.type)+` (`+t(T(n.packet.type))+`)`,1)]),x(`div`,$e,[i[11]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Route`,-1),x(`span`,et,t(n.packet.route)+` (`+t(O(n.packet.route))+`)`,1)]),x(`div`,tt,[i[12]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Status`,-1),x(`span`,{class:w([`font-semibold`,v(n.packet)])},t(C(n.packet)),3)])])])])]),x(`div`,nt,[i[25]||=x(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-4 flex items-center`},[x(`div`,{class:`w-2 h-2 rounded-full bg-orange-400 mr-3`}),y(` Payload Data `)],-1),x(`div`,rt,[x(`div`,it,[x(`div`,at,[i[14]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Payload Length`,-1),x(`span`,ot,t(n.packet.payload_length||n.packet.length)+` bytes`,1)]),n.packet.payload?(m(),S(`div`,st,[i[23]||=x(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-3`},` Payload Analysis `,-1),x(`div`,ct,[i[15]||=x(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-2 font-semibold`},` Raw Hex Data `,-1),x(`div`,lt,[x(`pre`,ut,t(k(n.packet.payload)),1)])]),(m(!0),S(b,null,p(N(n.packet).filter(e=>!e.name.includes(`Parse Error`)),(e,n)=>(m(),S(`div`,{key:n,class:`mb-4`},[x(`div`,dt,[x(`h4`,ft,t(e.name),1),x(`span`,pt,`Bytes `+t(e.byteRange),1)]),x(`div`,mt,[x(`div`,ht,t(e.hexData),1)]),x(`div`,gt,[x(`div`,{class:w([`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`,d.value?`grid-cols-4`:`grid-cols-3`])},[i[16]||=x(`div`,{class:`min-w-0`},`Bits`,-1),i[17]||=x(`div`,{class:`min-w-0`},`Field`,-1),i[18]||=x(`div`,{class:`min-w-0`},`Value`,-1),d.value?(m(),S(`div`,_t,`Binary`)):h(``,!0)],2),(m(!0),S(b,null,p(e.fields,(e,n)=>(m(),S(`div`,{key:n,class:w([`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`,d.value?`grid-cols-4`:`grid-cols-3`])},[x(`div`,vt,t(e.bits),1),x(`div`,yt,t(e.name),1),x(`div`,bt,[x(`span`,{class:`block`,title:e.value},t(e.value),9,xt)]),d.value?(m(),S(`div`,St,[x(`span`,{class:`block`,title:e.binary},t(e.binary),9,Ct)])):h(``,!0)],2))),128)),(m(!0),S(b,null,p(e.fields,(e,n)=>(m(),S(`div`,{key:`mobile-${n}`,class:`md:hidden p-3 border-b border-stroke-subtle dark:border-stroke/5 last:border-b-0 space-y-2`},[x(`div`,wt,[x(`div`,null,[i[19]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-xs uppercase tracking-wide`},`Bits:`,-1),x(`div`,Tt,t(e.bits),1)]),x(`div`,null,[i[20]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-xs uppercase tracking-wide`},`Field:`,-1),x(`div`,Et,t(e.name),1)])]),x(`div`,null,[i[21]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-xs uppercase tracking-wide`},`Value:`,-1),x(`div`,{class:`text-content-primary dark:text-content-primary text-sm font-semibold break-all`,title:e.value},t(e.value),9,Dt)]),d.value?(m(),S(`div`,Ot,[i[22]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-xs uppercase tracking-wide`},`Binary:`,-1),x(`div`,{class:`text-orange-500 text-xs font-mono break-all`,title:e.binary},t(e.binary),9,kt)])):h(``,!0)]))),128))]),e.description?(m(),S(`div`,At,t(e.description),1)):h(``,!0)]))),128))])):(m(),S(`div`,jt,[...i[24]||=[x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Payload:`,-1),x(`span`,{class:`text-content-muted dark:text-content-muted ml-2`},`None`,-1)]]))])])]),x(`div`,Mt,[i[33]||=x(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-4 flex items-center`},[x(`div`,{class:`w-2 h-2 rounded-full bg-purple-400 mr-3`}),y(` Path Information `)],-1),x(`div`,Nt,[x(`div`,Pt,[x(`div`,Ft,[x(`div`,It,[i[26]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Source Hash`,-1),x(`span`,{class:w([`text-content-primary dark:text-content-primary font-mono text-xs`,s.localHash&&n.packet.src_hash===s.localHash?`bg-cyan-400/20 text-cyan-600 dark:text-cyan-300 px-1 rounded`:``])},t(n.packet.src_hash||`Unknown`),3)]),x(`div`,Lt,[i[27]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Destination Hash`,-1),x(`span`,{class:w([`text-content-primary dark:text-content-primary font-mono text-xs`,s.localHash&&n.packet.dst_hash===s.localHash?`bg-cyan-400/20 text-cyan-600 dark:text-cyan-300 px-1 rounded`:``])},t(n.packet.dst_hash||`Broadcast`),3)])]),M(n.packet.original_path).length>0?(m(),S(`div`,Rt,[i[29]||=x(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-2`},` Original Path `,-1),x(`div`,zt,[x(`div`,Bt,[(m(!0),S(b,null,p(M(n.packet.original_path),(e,r)=>(m(),S(`div`,{key:r,class:`flex items-center`},[x(`div`,Vt,[x(`div`,Ht,[x(`div`,Ut,t(e.toUpperCase()),1)]),x(`div`,Wt,` Node: `+t(e.toUpperCase()),1)]),r0?(m(),S(`div`,Kt,[x(`div`,qt,[i[31]||=y(` Forwarded Path `,-1),JSON.stringify(M(n.packet.original_path))===JSON.stringify(M(n.packet.forwarded_path))?h(``,!0):(m(),S(`svg`,Jt,[...i[30]||=[x(`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)]])),JSON.stringify(M(n.packet.original_path))===JSON.stringify(M(n.packet.forwarded_path))?h(``,!0):(m(),S(`span`,Yt,`(Modified)`))]),x(`div`,Xt,[x(`div`,Zt,[(m(!0),S(b,null,p(M(n.packet.forwarded_path),(e,r)=>(m(),S(`div`,{key:r,class:`flex items-center`},[x(`div`,Qt,[x(`div`,{class:w([`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`,s.localHash&&e===s.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`])},[x(`div`,{class:w([`font-mono text-[10px] font-semibold tracking-tight sm:text-xs`,s.localHash&&e===s.localHash?`text-yellow-200`:`text-white/90`])},t(e.toUpperCase()),3),s.localHash&&e===s.localHash?(m(),S(`div`,$t)):h(``,!0)],2),x(`div`,en,t(e.toUpperCase()),1)]),rx(`div`,{key:e,class:w([`w-2 h-6 rounded-sm transition-all duration-300`,e<=F(n.packet.rssi).level?{"signal-excellent":`bg-green-400`,"signal-good":`bg-cyan-400`,"signal-fair":`bg-yellow-400`,"signal-poor":`bg-red-400`}[F(n.packet.rssi).className]:`bg-stroke-subtle dark:bg-stroke/10`])},null,2)),64))]),x(`span`,mn,t(F(n.packet.rssi).className.replace(`signal-`,``)),1)])])),n.packet.is_trace&&n.packet.path_snr_details&&n.packet.path_snr_details.length>0?(m(),S(`div`,gn,[x(`div`,_n,` Path SNR Details (`+t(n.packet.path_snr_details.length)+` hops) `,1),x(`div`,vn,[(m(!0),S(b,null,p(n.packet.path_snr_details,(e,n)=>(m(),S(`div`,{key:n,class:`flex items-center justify-between p-2 glass-card bg-background-mute dark:bg-black/20 rounded-[8px]`},[x(`div`,yn,[x(`span`,bn,t(n+1)+`.`,1),x(`span`,{class:w([`font-mono text-xs text-content-primary dark:text-content-primary`,s.localHash&&e.hash===s.localHash?`bg-cyan-400/20 text-cyan-600 dark:text-cyan-300 px-1 rounded`:``])},t(e.hash.toUpperCase()),3)]),x(`span`,{class:w([`text-sm font-bold`,P(e.snr_db,null)])},t(e.snr_db.toFixed(1))+`dB `,3)]))),128))])])):h(``,!0),n.packet.transmitted&&n.packet.lbt_attempts!==void 0?(m(),S(`div`,xn,[i[45]||=x(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-3 flex items-center`},[x(`svg`,{class:`w-4 h-4 mr-2`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`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`})]),y(` Listen Before Talk (LBT) Metrics `)],-1),x(`div`,Sn,[x(`div`,Cn,[i[41]||=x(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},` CAD Attempts `,-1),x(`div`,wn,t(n.packet.lbt_attempts),1)]),x(`div`,Tn,[i[42]||=x(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},` Total LBT Delay `,-1),x(`div`,En,t(L(I(n.packet.lbt_backoff_delays_ms).reduce((e,t)=>e+t,0))),1),x(`div`,Dn,t(I(n.packet.lbt_backoff_delays_ms).length)+` backoffs `,1)]),x(`div`,On,[i[43]||=x(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},` Channel Status `,-1),x(`div`,{class:w([`text-lg font-bold`,n.packet.lbt_channel_busy?`text-yellow-600 dark:text-yellow-400`:`text-green-600 dark:text-green-400`])},t(n.packet.lbt_channel_busy?`BUSY`:`CLEAR`),3),x(`div`,kn,t(n.packet.lbt_channel_busy?`Waited for clear`:`Immediate TX`),1)])]),I(n.packet.lbt_backoff_delays_ms).length>0?(m(),S(`div`,An,[i[44]||=x(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-3 font-semibold`},` Backoff Pattern (Exponential with Jitter) `,-1),x(`div`,jn,[(m(!0),S(b,null,p(I(n.packet.lbt_backoff_delays_ms),(e,r)=>(m(),S(`div`,{key:r,class:`flex items-center gap-3`},[x(`div`,Mn,[x(`span`,Nn,`Attempt `+t(r+1),1)]),x(`div`,Pn,[x(`div`,Fn,[x(`div`,{class:w([`h-full rounded-lg transition-all duration-300`,[r===0?`bg-gradient-to-r from-cyan-500/50 to-cyan-600/50`:r===1?`bg-gradient-to-r from-yellow-500/50 to-yellow-600/50`:r===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:o({width:`${Math.min(100,e/Math.max(...I(n.packet.lbt_backoff_delays_ms))*100)}%`})},[x(`div`,In,[x(`span`,Ln,t(L(e)),1)])],6)])]),x(`div`,Rn,[x(`span`,zn,t(Math.round(e/I(n.packet.lbt_backoff_delays_ms).reduce((e,t)=>e+t,0)*100))+`% `,1)])]))),128))])])):h(``,!0)])):h(``,!0),x(`div`,Bn,[x(`div`,Vn,[x(`div`,Hn,[i[46]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`TX Delay`,-1),x(`span`,Un,t(Number(n.packet.tx_delay_ms)>0?Number(n.packet.tx_delay_ms).toFixed(1)+`ms`:`-`),1)]),x(`div`,Wn,[i[47]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Transmitted`,-1),x(`span`,{class:w(n.packet.transmitted?`text-green-600 dark:text-green-400`:`text-red-600 dark:text-red-400`)},t(n.packet.transmitted?`Yes`:`No`),3)])]),x(`div`,Gn,[x(`div`,Kn,[i[48]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Is Duplicate`,-1),x(`span`,{class:w(n.packet.is_duplicate?`text-amber-600 dark:text-amber-400`:`text-content-muted dark:text-content-muted`)},t(n.packet.is_duplicate?`Yes`:`No`),3)]),n.packet.drop_reason?(m(),S(`div`,qn,[i[49]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Drop Reason`,-1),x(`span`,Jn,t(n.packet.drop_reason),1)])):h(``,!0)])])])])]),x(`div`,Yn,[x(`button`,{onClick:i[2]||=e=>u(`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)):h(``,!0)]),_:1})]))}}),[[`__scopeId`,`data-v-c8711b75`]]),Zn={class:`glass-card rounded-[20px] p-6`},Qn={class:`flex flex-col lg:flex-row lg:justify-between lg:items-center mb-6 gap-4 filter-container`},$n={class:`flex items-center gap-2 header-info relative`},er={class:`text-content-secondary dark:text-content-muted text-sm packet-count`},tr=[`title`],nr={class:`hidden sm:inline`},rr={key:1,class:`text-accent-red text-sm error-indicator`},ir={class:`flex items-center gap-3 lg:flex filter-controls`},ar={class:`flex flex-col`},or=[`value`],sr={class:`flex flex-col`},cr=[`value`],lr={class:`flex flex-col`},ur={class:`flex flex-col reset-container`},dr=[`disabled`],fr={class:`space-y-4 overflow-hidden`},pr={class:`space-y-4`},mr=[`onClick`],hr={class:`hidden lg:grid grid-cols-12 gap-2 items-center`},gr={class:`col-span-1 text-content-primary dark:text-content-primary text-sm`},_r={class:`col-span-1 flex items-center gap-2`},vr={class:`flex flex-col`},yr={class:`text-content-primary dark:text-content-primary text-xs`},br=[`title`],xr={class:`col-span-2`},Sr={class:`col-span-1 text-content-primary dark:text-content-primary text-xs`},Cr={class:`col-span-2`},wr={class:`space-y-1`},Tr={key:0,class:`flex items-center gap-0.5 flex-wrap`},Er=[`title`],Dr={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`},Or={key:0,class:`text-[9px] text-content-muted dark:text-content-muted ml-1`},kr={key:1,class:`flex items-center gap-1`},Ar={class:`inline-block px-2 py-0.5 rounded bg-badge-cyan-bg text-badge-cyan-text text-xs font-mono`},jr={class:`col-span-1 text-content-primary dark:text-content-primary text-xs`},Mr={class:`col-span-1 text-content-primary dark:text-content-primary text-xs`},Nr={class:`col-span-1 text-content-primary dark:text-content-primary text-xs`},Pr={class:`col-span-1 text-content-primary dark:text-content-primary text-xs`},Fr={key:0,class:`flex items-center gap-1`},Ir={class:`col-span-1`},Lr={key:0,class:`text-accent-red text-[8px] italic truncate`},Rr={class:`lg:hidden space-y-2`},zr={class:`flex items-center justify-between`},Br={class:`flex items-center gap-2`},Vr={class:`flex flex-col`},Hr={class:`text-content-primary dark:text-content-primary text-sm font-medium`},Ur=[`title`],Wr={class:`flex items-center gap-2 text-right`},Gr={class:`text-content-secondary dark:text-content-muted text-xs`},Kr={class:`flex items-center justify-between`},qr={class:`flex items-center gap-1.5`},Jr={key:0,class:`flex flex-wrap items-center gap-0.5`},Yr=[`title`],Xr={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`},Zr={key:0,class:`text-[9px] text-content-muted dark:text-content-muted ml-1`},Qr={class:`flex items-center gap-1`},$r={class:`inline-block px-2 py-0.5 rounded bg-badge-cyan-bg text-badge-cyan-text text-xs font-mono font-semibold`},ei={class:`flex items-center gap-0.5 text-content-muted dark:text-content-muted/60`},ti={key:0,class:`text-[9px] font-medium`,title:`Multi-hop path`},ni={class:`flex items-center gap-1`},ri={class:`flex items-center gap-2`},ii={class:`flex items-center gap-1`},ai={key:0,class:`flex gap-0.5`},oi={class:`text-content-primary dark:text-content-primary text-xs`},si={class:`flex items-center justify-between text-content-secondary dark:text-content-muted text-xs`},ci={class:`flex items-center gap-3`},li={class:`flex items-center gap-2`},ui={key:0,class:`flex items-center gap-1`},di={key:0,class:`text-accent-red text-xs italic`},fi={key:0,class:`flex justify-between items-center mt-6 pt-4 border-t border-stroke-subtle dark:border-stroke pagination-container`},pi={class:`flex items-center gap-4 pagination-info`},mi={class:`text-content-secondary dark:text-content-muted text-sm`},hi={key:0,class:`flex items-center gap-2 load-more-section`},gi=[`disabled`],_i={class:`text-content-secondary dark:text-content-muted text-xs load-more-count`},vi={class:`flex items-center gap-2 pagination-controls`},yi=[`disabled`],bi={class:`flex items-center gap-1 page-numbers`},xi={key:1,class:`text-content-secondary dark:text-content-muted text-sm px-2 ellipsis`},Si=[`onClick`],Ci={key:2,class:`text-content-secondary dark:text-content-muted text-sm px-2 ellipsis`},wi=[`disabled`],Ti={key:1,class:`flex justify-center mt-6 pt-4 border-t border-stroke-subtle dark:border-stroke`},Ei={class:`flex items-center gap-4`},Di={class:`text-content-secondary dark:text-content-muted text-sm`},Oi={class:`text-content-secondary dark:text-content-muted text-xs`},ki={key:2,class:`flex justify-center mt-6 pt-4 border-t border-stroke-subtle dark:border-stroke`},Ai={class:`flex items-center gap-2`},Q=10,$=1e3,ji=j(d({name:`PacketTable`,__name:`PacketTable`,setup(e){let r=O(),a=A(),o=c(1),l=c(100),d=c(!1),f=c(!1),y=null;i(()=>r.isLoading,e=>{e?(y&&=(clearTimeout(y),null),f.value=!0):y=window.setTimeout(()=>{f.value=!1,y=null},600)});let E=c(null),D=c(!1),k=async e=>{if(E.value=e,D.value=!0,e.packet_hash&&(!e.header||!e.raw_packet))try{let t=await r.getPacketByHash(e.packet_hash);t&&E.value?.packet_hash===e.packet_hash&&(E.value={...E.value,...t})}catch{}},j=()=>{D.value=!1,E.value=null},N=c(I(`packetTable_selectedType`,`all`)),P=c(I(`packetTable_selectedRoute`,`all`)),L=c(!1),R=c(null),z=[`all`,`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`10`,`11`],ee=[`all`,`1`,`2`];i(N,e=>{F(`packetTable_selectedType`,e),o.value=1}),i(P,e=>{F(`packetTable_selectedRoute`,e),o.value=1}),i(L,()=>{o.value=1});let B=v(()=>{let e=r.recentPackets;if(N.value!==`all`){let t=parseInt(N.value);e=e.filter(e=>e.type===t)}if(P.value!==`all`){let t=parseInt(P.value);e=e.filter(e=>e.route===t)}return L.value&&R.value!==null&&(e=e.filter(e=>e.timestamp>=R.value)),e}),te=v(()=>{let e=(o.value-1)*Q,t=e+Q;return B.value.slice(e,t)}),V=v(()=>Math.ceil(B.value.length/Q)),ne=v(()=>o.value===V.value),re=v(()=>r.recentPackets.length>=l.value&&l.value<$),ie=v(()=>ne.value&&re.value&&!d.value),H=e=>new Date(e*1e3).toLocaleTimeString(void 0,{hour12:!0}),U=e=>({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`})[e]||`TYPE_${e}`,W=e=>({0:`T-Flood`,1:`Flood`,2:`Direct`,3:`T-Direct`})[e]||`Route ${e}`,G=e=>e.transmitted?`text-accent-green`:`text-primary`,K=e=>e.drop_reason?`Dropped`:e.transmitted?`Forward`:`Received`,q=e=>e===1?`bg-badge-cyan-bg text-badge-cyan-text`:`bg-badge-neutral-bg text-badge-neutral-text`,J=e=>({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`})[e]||`bg-gray-500`,ae=e=>({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`})[e]||`border-l-gray-500`,oe=e=>!e.transmitted||!e.lbt_attempts||e.lbt_attempts===0?`bg-green-400`:e.lbt_attempts===1?`bg-cyan-400`:e.lbt_attempts===2?`bg-yellow-400`:`bg-orange-400`,se=e=>e>=1e3?(e/1e3).toFixed(2)+`s`:e.toFixed(1)+`ms`,ce=e=>{if(!e)return[];if(Array.isArray(e))return e;if(typeof e==`string`)try{let t=JSON.parse(e);return typeof t==`string`?JSON.parse(t):Array.isArray(t)?t:[]}catch{return[]}return[]},Y=e=>{let t=ce(e.original_path),n=ce(e.forwarded_path),r=t.length>0?t:n;return r.length===0?null:{hops:r.length-1,nodes:r.map(e=>e.toUpperCase())}},X=e=>{if(e.type!==4||!e.payload)return null;try{let t=e.payload.replace(/\s+/g,``).toUpperCase(),n=t,r=0;if(t.length/2>=100)if(t.length>200)n=t.slice(200),r=0;else return null;if(n.length>=2){let e=parseInt(n.slice(0,2),16);r+=2;let t=!!(e&16),i=!!(e&32),a=!!(e&64);if(!(e&128))return null;if(t&&n.length>=r+16&&(r+=16),i&&n.length>=r+4&&(r+=4),a&&n.length>=r+4&&(r+=4),n.length>r){let e=(n.slice(r).match(/.{2}/g)||[]).map(e=>{let t=parseInt(e,16);return t>=32&&t<=126?String.fromCharCode(t):`.`}).join(``).replace(/\.*$/,``);return e.length>0?e:null}}}catch(e){console.error(`Error parsing ADVERT node name:`,e)}return null},le=()=>{N.value=`all`,P.value=`all`,L.value=!1,R.value=null,o.value=1},ue=()=>{L.value?(L.value=!1,R.value=null):(L.value=!0,R.value=Date.now()/1e3),o.value=1},de=v(()=>R.value?new Date(R.value*1e3).toLocaleTimeString(void 0,{hour12:!0}):``),fe=async e=>{try{let t=e||l.value;await r.fetchRecentPackets({limit:t})}catch(e){console.error(`Error fetching packet data:`,e)}},pe=async()=>{if(!(d.value||l.value>=$)){d.value=!0;try{let e=Math.min(l.value+200,$);l.value=e,await fe(e)}catch(e){console.error(`Error loading more records:`,e)}finally{d.value=!1}}};return n(()=>{a.ensure(`recentPackets`)}),C(()=>{y&&clearTimeout(y)}),(e,n)=>(m(),S(b,null,[x(`div`,Zn,[x(`div`,Qn,[x(`div`,$n,[n[7]||=x(`h3`,{class:`text-content-primary dark:text-content-primary text-xl font-semibold`},` Recent Packets `,-1),x(`span`,er,` (`+t(B.value.length)+` of `+t(_(r).recentPackets.length)+`) `,1),L.value?(m(),S(`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 ${de.value}`},[x(`span`,nr,`Live Mode (since `+t(de.value)+`)`,1),n[6]||=x(`span`,{class:`sm:hidden`},`Live`,-1)],8,tr)):h(``,!0),_(r).error?(m(),S(`span`,rr,t(_(r).error),1)):h(``,!0)]),x(`div`,ir,[x(`div`,ar,[n[8]||=x(`label`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},`Type`,-1),s(x(`select`,{"onUpdate:modelValue":n[0]||=e=>N.value=e,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`},[(m(),S(b,null,p(z,e=>x(`option`,{key:e,value:e,class:`bg-surface dark:bg-surface-elevated text-content-primary dark:text-content-primary`},t(e===`all`?`All Types`:`Type ${e} (${U(parseInt(e))})`),9,or)),64))],512),[[T,N.value]])]),x(`div`,sr,[n[9]||=x(`label`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},`Route`,-1),s(x(`select`,{"onUpdate:modelValue":n[1]||=e=>P.value=e,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`},[(m(),S(b,null,p(ee,e=>x(`option`,{key:e,value:e,class:`bg-surface dark:bg-surface-elevated text-content-primary dark:text-content-primary`},t(e===`all`?`All Routes`:`Route ${e} (${W(parseInt(e))})`),9,cr)),64))],512),[[T,P.value]])]),x(`div`,lr,[n[10]||=x(`label`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},`Filter`,-1),x(`button`,{onClick:ue,class:w([`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":L.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":!L.value}])},t(L.value?`New Only`:`Show New`),3)]),x(`div`,ur,[n[11]||=x(`label`,{class:`text-transparent text-xs mb-1`},`.`,-1),x(`button`,{onClick:le,class:w([`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":N.value===`all`&&P.value===`all`&&!L.value,"hover:bg-primary/10":N.value!==`all`||P.value!==`all`||L.value}]),disabled:N.value===`all`&&P.value===`all`&&!L.value},` Reset `,10,dr)])])]),n[25]||=u(``,1),x(`div`,fr,[x(`div`,pr,[(m(!0),S(b,null,p(te.value,(e,r)=>(m(),S(`div`,{key:`${e.packet_hash}_${e.timestamp}_${r}`,class:w([`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`,ae(e.type)]),onClick:t=>k(e)},[x(`div`,hr,[x(`div`,gr,t(H(e.timestamp)),1),x(`div`,_r,[x(`div`,{class:w([`w-2 h-2 rounded-full`,J(e.type)])},null,2),x(`div`,vr,[x(`span`,yr,t(U(e.type)),1),e.type===4&&X(e)?(m(),S(`span`,{key:0,class:`text-accent-red/70 text-[10px] font-medium max-w-[80px] truncate`,title:X(e)||void 0},t(X(e)),9,br)):h(``,!0)])]),x(`div`,xr,[x(`span`,{class:w([`inline-block px-2 py-1 rounded text-xs font-medium`,q(e.route)])},t(W(e.route)),3)]),x(`div`,Sr,t(e.length)+`B `,1),x(`div`,Cr,[x(`div`,wr,[Y(e)?(m(),S(`div`,Tr,[(m(!0),S(b,null,p(Y(e).nodes,(r,i)=>(m(),S(b,{key:i},[x(`span`,{class:w([`inline-block max-w-full truncate px-1.5 py-0.5 rounded text-[9px] font-mono font-semibold leading-tight tracking-tight`,i===0?`bg-badge-cyan-bg text-badge-cyan-text`:`bg-gray-500/20 text-content-muted dark:text-content-muted`]),title:r},t(r),11,Er),i0?(m(),S(`span`,Or,` (`+t(Y(e).hops)+` hop`+t(Y(e).hops>1?`s`:``)+`) `,1)):h(``,!0)])):(m(),S(`div`,kr,[x(`span`,Ar,t(e.src_hash?.slice(-4).toUpperCase()||`????`),1),n[13]||=x(`svg`,{class:`w-3 h-3 text-content-muted dark:text-content-muted/60`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2.5`,d:`M9 5l7 7-7 7`})],-1),x(`span`,{class:w([`inline-block px-2 py-0.5 rounded text-xs font-mono`,e.dst_hash?`bg-badge-cyan-bg text-badge-cyan-text`:`bg-yellow-500/20 text-yellow-700 dark:text-yellow-300`])},t(e.dst_hash?e.dst_hash.slice(-4).toUpperCase():`BCAST`),3)]))])]),x(`div`,jr,t(e.rssi==null?`N/A`:e.rssi.toFixed(0)+` dBm`),1),x(`div`,Mr,t(e.snr==null?`N/A`:e.snr.toFixed(1)+`dB`),1),x(`div`,Nr,t(e.score==null?`N/A`:e.score.toFixed(2)),1),x(`div`,Pr,[Number(e.tx_delay_ms)>0?(m(),S(`div`,Fr,[e.transmitted?(m(),S(`div`,{key:0,class:w([`w-1.5 h-1.5 rounded-full flex-shrink-0`,oe(e)])},null,2)):h(``,!0),x(`span`,null,t(se(Number(e.tx_delay_ms))),1)])):h(``,!0)]),x(`div`,Ir,[x(`div`,null,[x(`span`,{class:w([`text-xs font-medium`,G(e)])},t(K(e)),3),e.drop_reason?(m(),S(`p`,Lr,t(e.drop_reason),1)):h(``,!0)])])]),x(`div`,Rr,[x(`div`,zr,[x(`div`,Br,[x(`div`,{class:w([`w-2 h-2 rounded-full flex-shrink-0`,J(e.type)])},null,2),x(`div`,Vr,[x(`span`,Hr,t(U(e.type)),1),e.type===4&&X(e)?(m(),S(`span`,{key:0,class:`text-accent-red/70 text-[10px] font-medium leading-tight`,title:X(e)||void 0},t(X(e)),9,Ur)):h(``,!0)]),x(`span`,{class:w([`inline-block px-2 py-1 rounded text-xs font-medium ml-2`,q(e.route)])},t(W(e.route)),3)]),x(`div`,Wr,[x(`span`,Gr,t(H(e.timestamp)),1),x(`span`,{class:w([`text-xs font-medium`,G(e)])},t(K(e)),3)])]),x(`div`,Kr,[x(`div`,qr,[Y(e)?(m(),S(`div`,Jr,[n[15]||=x(`span`,{class:`text-content-muted dark:text-content-muted text-[10px] font-medium`},`PATH`,-1),(m(!0),S(b,null,p(Y(e).nodes,(r,i)=>(m(),S(b,{key:i},[x(`span`,{class:w([`inline-block max-w-full truncate px-1.5 py-0.5 rounded text-[9px] font-mono font-semibold leading-tight tracking-tight`,i===0?`bg-badge-cyan-bg text-badge-cyan-text`:`bg-gray-500/20 text-content-muted dark:text-content-muted`]),title:r},t(r),11,Yr),i0?(m(),S(`span`,Zr,` (`+t(Y(e).hops)+` hop`+t(Y(e).hops>1?`s`:``)+`) `,1)):h(``,!0)])):(m(),S(b,{key:1},[x(`div`,Qr,[n[16]||=x(`span`,{class:`text-content-muted dark:text-content-muted text-[10px] font-medium`},`SRC`,-1),x(`span`,$r,t(e.src_hash?.slice(-4)||`????`),1)]),x(`div`,ei,[n[18]||=x(`svg`,{class:`w-3 h-3`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2.5`,d:`M9 5l7 7-7 7`})],-1),e.route===1?(m(),S(`span`,ti,[...n[17]||=[x(`svg`,{class:`w-2.5 h-2.5 inline`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M13 5l7 7-7 7M5 5l7 7-7 7`})],-1)]])):h(``,!0)]),x(`div`,ni,[x(`span`,{class:w([`inline-block px-2 py-0.5 rounded text-xs font-mono font-semibold`,e.dst_hash?`bg-badge-cyan-bg text-badge-cyan-text`:`bg-yellow-500/20 text-yellow-700 dark:text-yellow-300`])},t(e.dst_hash?e.dst_hash.slice(-4).toUpperCase():`BCAST`),3),n[19]||=x(`span`,{class:`text-content-muted dark:text-content-muted text-[10px] font-medium`},`DST`,-1)])],64))]),x(`div`,ri,[x(`div`,ii,[e.snr==null?h(``,!0):(m(),S(`div`,ai,[x(`div`,{class:w([`w-1 h-3 rounded-sm`,e.snr>=-10?`bg-green-400`:`bg-white/20`])},null,2),x(`div`,{class:w([`w-1 h-4 rounded-sm`,e.snr>=-5?`bg-green-400`:`bg-white/20`])},null,2),x(`div`,{class:w([`w-1 h-5 rounded-sm`,e.snr>=0?`bg-green-400`:`bg-white/20`])},null,2),x(`div`,{class:w([`w-1 h-6 rounded-sm`,e.snr>=10?`bg-green-400`:`bg-white/20`])},null,2)])),x(`span`,oi,t(e.rssi==null?`TX`:e.rssi.toFixed(0)+`dBm`),1)])])]),x(`div`,si,[x(`div`,ci,[x(`span`,null,t(e.length)+`B`,1),x(`span`,null,`SNR: `+t(e.snr==null?`N/A`:e.snr.toFixed(1)+`dB`),1),x(`span`,null,`Score: `+t(e.score==null?`N/A`:e.score.toFixed(2)),1)]),x(`div`,li,[Number(e.tx_delay_ms)>0?(m(),S(`span`,ui,[e.transmitted?(m(),S(`div`,{key:0,class:w([`w-1.5 h-1.5 rounded-full flex-shrink-0`,oe(e)])},null,2)):h(``,!0),x(`span`,null,t(se(Number(e.tx_delay_ms))),1)])):h(``,!0)])]),e.drop_reason?(m(),S(`div`,di,t(e.drop_reason),1)):h(``,!0)])],10,mr))),128))])]),V.value>1?(m(),S(`div`,fi,[x(`div`,pi,[x(`span`,mi,` Showing `+t((o.value-1)*Q+1)+` - `+t(Math.min(o.value*Q,B.value.length))+` of `+t(B.value.length)+` packets `,1),ie.value?(m(),S(`div`,hi,[n[20]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-xs`},`•`,-1),x(`button`,{onClick:pe,disabled:d.value,class:w([`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":!d.value,"text-content-secondary dark:text-content-muted border-stroke-subtle dark:border-stroke cursor-not-allowed opacity-50":d.value}])},t(d.value?`Loading...`:`Load ${Math.min(200,$-l.value)} more`),11,gi),x(`span`,_i,`(`+t(l.value)+`/`+t($)+` max)`,1)])):h(``,!0)]),x(`div`,vi,[x(`button`,{onClick:n[2]||=e=>--o.value,disabled:o.value<=1,class:w([`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":o.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":o.value>1}])},[...n[21]||=[x(`span`,{class:`hidden sm:inline`},`Previous`,-1),x(`span`,{class:`sm:hidden`},`‹`,-1)]],10,yi),x(`div`,bi,[o.value>3?(m(),S(`button`,{key:0,onClick:n[3]||=e=>o.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 `)):h(``,!0),o.value>4?(m(),S(`span`,xi,`...`)):h(``,!0),(m(!0),S(b,null,p(Array.from({length:Math.min(5,V.value)},(e,t)=>Math.max(1,Math.min(o.value-2,V.value-4))+t).filter(e=>e<=V.value),e=>(m(),S(`button`,{key:e,onClick:t=>o.value=e,class:w([`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":o.value===e,"border-stroke-subtle dark:border-stroke text-content-primary dark:text-content-primary hover:border-primary hover:text-primary hover:bg-primary/5":o.value!==e}])},t(e),11,Si))),128)),o.valueo.value=V.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`},t(V.value),1)):h(``,!0)]),x(`button`,{onClick:n[5]||=e=>o.value+=1,disabled:o.value>=V.value,class:w([`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":o.value>=V.value,"border-stroke-subtle dark:border-stroke text-content-primary dark:text-content-primary hover:border-primary hover:text-primary hover:bg-primary/5":o.value(m(),S(`div`,null,[g(ae),x(`div`,Mi,[g(Ne),g(_e)]),g(ji)]))}});export{Ni as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/Dashboard-Cl9vIX2c.js b/repeater/web/html/assets/Dashboard-Cl9vIX2c.js deleted file mode 100644 index a797e04..0000000 --- a/repeater/web/html/assets/Dashboard-Cl9vIX2c.js +++ /dev/null @@ -1,2 +0,0 @@ -import{B as e,Ct as t,E as n,K as r,R as i,S as a,St as o,V as s,Y as c,c as l,f as u,g as d,i as f,j as p,k as m,l as h,m as g,nt as _,o as v,p as y,r as b,s as x,u as S,w as C,xt as w}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{t as T}from"./packets-BBUX0ge1.js";import{t as E}from"./system-BfTzQTOF.js";import{t as D}from"./dataService-KNFTsxUb.js";import{t as O}from"./_plugin-vue_export-helper-TcpyXLsZ.js";import{t as k}from"./Spinner-CYvUNW0P.js";import{t as A}from"./websocket-BqxrlZFR.js";import{f as j,g as M,l as N,t as P}from"./index-CG181k2K.js";import{n as F,t as I}from"./preferences-6MHglq--.js";import{d as L,f as R,g as ee,l as te,n as z,o as ne,s as B,t as re,u as ie}from"./ChartCard-CzDm8sMP.js";import{t as ae}from"./useSignalQuality-aEjorkkD.js";var oe={class:`sparkline-card`},V={class:`card-header`},H={class:`card-title`},U={class:`card-values`},W={class:`card-chart`},G=O(d({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(e){B.register(ne,L,R,ie,te,ee);let s=e,l=c(null),u=c(null),d=e=>{if(e.length<3)return e;let t=Math.min(15,Math.max(3,Math.floor(e.length*.2))),n=[];for(let r=0;re+t,0)/s.length)}let r=Math.min(12,n.length),i=n.length/r,a=[];for(let e=0;e!s.data||s.data.length===0?[]:d(s.data)),p=v(()=>!s.secondaryData||s.secondaryData.length===0?[]:d(s.secondaryData)),g=()=>{if(!l.value)return;let e=l.value.getContext(`2d`);if(!e)return;u.value&&=(u.value.destroy(),null);let t=f.value;if(t.length<2)return;let n=[{data:t,borderColor:s.color,borderWidth:2.5,fill:!1,tension:.4,pointRadius:0,pointHoverRadius:0}],i=p.value;i.length>=2&&s.secondaryColor&&n.push({data:i,borderColor:s.secondaryColor,borderWidth:2,borderDash:[4,3],fill:!1,tension:.4,pointRadius:0,pointHoverRadius:0}),u.value=r(new B(e,{type:`line`,data:{labels:t.map((e,t)=>t.toString()),datasets:n},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}}}}))},_=()=>{if(!u.value){g();return}let e=f.value;if(e.length<2)return;u.value.data.labels=e.map((e,t)=>t.toString()),u.value.data.datasets[0].data=e;let t=p.value;t.length>=2&&s.secondaryColor&&(u.value.data.datasets.length<2?u.value.data.datasets.push({data:t,borderColor:s.secondaryColor,borderWidth:2,borderDash:[4,3],fill:!1,tension:.4,pointRadius:0,pointHoverRadius:0}):u.value.data.datasets[1].data=t),u.value.update(`default`)};return i(()=>s.data,()=>{a(()=>_())},{deep:!0}),i(()=>s.color,()=>{u.value&&(u.value.data.datasets[0].borderColor=s.color,u.value.update(`none`))}),n(()=>{a(()=>g())}),C(()=>{u.value&&=(u.value.destroy(),null)}),(n,r)=>(m(),S(`div`,oe,[x(`div`,V,[x(`p`,H,t(e.title),1),x(`div`,U,[x(`span`,{class:`card-value`,style:o({color:e.color})},t(typeof e.value==`number`?e.value.toLocaleString():e.value),5),e.secondaryValue===void 0?h(``,!0):(m(),S(`span`,{key:0,class:`card-secondary-value`,style:o({color:e.secondaryColor})},t(e.secondaryLabel)+t(typeof e.secondaryValue==`number`?e.secondaryValue.toLocaleString():e.secondaryValue),5))])]),x(`div`,W,[e.showChart?(m(),S(`canvas`,{key:0,ref_key:`canvasRef`,ref:l},null,512)):h(``,!0)])]))}}),[[`__scopeId`,`data-v-d5c09182`]]),K={class:`grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3 lg:gap-4 mb-5 stats-cards-container`},se=O(d({name:`StatsCards`,__name:`StatsCards`,setup(e){let t={uptime:`#EBA0FC`,rx:`#AAE8E8`,forward:`#FFC246`,dropped:`#FB787B`,crcErrors:`#F59E0B`,hashCache:`#9F7AEA`},r=T(),i=E(),a=D(),o=e=>{let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h`:n>0?`${n}h ${r}m`:`${r}m`},s=v(()=>{let e=r.packetStats,t=i.stats?.uptime_seconds||0,n=e?.total_packets||0,a=e?.dropped_packets||0;return{packetsReceived:n,packetsForwarded:e?.transmitted_packets||0,uptimeFormatted:o(t),droppedPackets:a,crcErrorCount:r.crcErrorCount,hashCacheSize:r.systemStats?.duplicate_cache_size??0}}),c=v(()=>r.sparklineData);return n(()=>{a.ensure(`sparklines`)}),(e,n)=>(m(),S(`div`,K,[g(G,{title:`Up Time`,value:s.value.uptimeFormatted,color:t.uptime,data:[],showChart:!1,class:`stat-card`},null,8,[`value`,`color`]),g(G,{title:`RX Packets`,value:s.value.packetsReceived,color:t.rx,data:c.value.totalPackets,class:`stat-card`},null,8,[`value`,`color`,`data`]),g(G,{title:`Forward`,value:s.value.packetsForwarded,color:t.forward,data:c.value.transmittedPackets,class:`stat-card`},null,8,[`value`,`color`,`data`]),g(G,{title:`Dropped`,value:s.value.droppedPackets,color:t.dropped,data:c.value.droppedPackets,class:`stat-card`},null,8,[`value`,`color`,`data`]),g(G,{title:`CRC Errors`,value:s.value.crcErrorCount,color:t.crcErrors,data:c.value.crcErrors,class:`stat-card`},null,8,[`value`,`color`,`data`]),g(G,{title:`Hash Cache`,value:s.value.hashCacheSize,color:t.hashCache,showChart:!1,class:`stat-card`},null,8,[`value`,`color`])]))}}),[[`__scopeId`,`data-v-19814841`]]),q={class:`glass-card rounded-[10px] p-4 lg:p-6`},J={key:0,class:`absolute inset-0 flex items-center justify-center`},ce={key:1,class:`h-full flex flex-col`},Y={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`},X={class:`text-content-primary dark:text-content-primary text-sm font-medium mb-1`},le={class:`text-content-primary dark:text-content-primary`},ue={class:`flex-1 flex items-end justify-evenly gap-4 px-4`},de=[`onMouseenter`],fe={class:`text-content-primary dark:text-content-primary text-xs sm:text-sm font-semibold text-center w-full`,style:{"padding-bottom":`5px`}},pe={class:`text-content-secondary dark:text-content-muted text-xs mt-2 text-center`},me={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`},he={class:`truncate text-left`},ge={key:1,class:`mt-3 text-xs text-content-secondary dark:text-content-muted text-center`},_e=O(d({name:`PacketTypesChart`,__name:`PacketTypesChart`,setup(r){let a=c([]),s=T(),l=A(),u=c(!0),d=c(!1),f=c(null),_=c(`Connecting...`),y=c(null),C=[{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`]}],w=v(()=>C.map(e=>{let t=a.value.filter(t=>e.types.some(e=>t.name.includes(e)||t.name===e)).sort((e,t)=>t.count-e.count).map((t,n)=>({...t,color:e.subColors[n%e.subColors.length]}));return{name:e.name,color:e.subColors[0],items:t,total:t.reduce((e,t)=>e+t.count,0)}}).filter(e=>e.total>0)),E=v(()=>Math.max(...w.value.map(e=>e.total),1)),D=v(()=>w.value.reduce((e,t)=>e+t.total,0)),O=async()=>{_.value=`Connecting...`,f.value=null,u.value||(d.value=!0);try{let e=await z(`/packet_type_graph_data`,void 0,{onPhaseChange:e=>{_.value=e===`receiving`?`Receiving data...`:`Connecting...`}});if(e?.success&&e?.data){let t=e.data;if(t?.series){let e=[];t.series.forEach((t,n)=>{let r=0;t.data&&Array.isArray(t.data)&&(r=t.data.reduce((e,t)=>e+(t[1]||0),0)),r>0&&e.push({name:t.name||`Type ${t.type}`,type:t.type,count:r,color:``})}),a.value=e,u.value=!1,d.value=!1}else f.value=`No series data in server response`,u.value=!1,d.value=!1}else f.value=`Invalid response from server`,u.value=!1,d.value=!1}catch(e){f.value=e instanceof Error?e.message:`Failed to load data`,u.value=!1,d.value=!1}},k={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`},j=()=>{let e=s.packetTypeBreakdown;!e||e.length===0||(a.value=e.map(e=>({name:k[Number(e.type)]||`Type ${e.type}`,type:e.type,count:e.count,color:``})),u.value=!1,f.value=null)},M=e=>Math.max(e/E.value*90,2),N=(e,t)=>t===0?0:e/t*100;return n(()=>{O()}),i(()=>s.packetTypeBreakdown,()=>j(),{deep:!0,immediate:!0}),P(O,{intervalMs:3e4,enabled:()=>!l.isConnected,immediate:!0}),(n,r)=>(m(),S(`div`,q,[r[2]||=x(`div`,{class:`flex items-baseline justify-between mb-3 lg:mb-4`},[x(`h3`,{class:`text-content-primary dark:text-content-primary text-lg lg:text-xl font-semibold`},` Packet Types `),x(`p`,{class:`text-content-secondary dark:text-content-muted text-xs lg:text-sm uppercase`},` Distribution by Type `)],-1),g(re,{class:`h-48 lg:h-56`,"is-loading":u.value,"is-updating":d.value,error:f.value,status:_.value,onRetry:O},{default:e(()=>[w.value.length===0&&!u.value&&!f.value?(m(),S(`div`,J,[...r[1]||=[x(`div`,{class:`text-content-secondary dark:text-content-primary text-sm lg:text-base`},` No packet data available `,-1)]])):h(``,!0),w.value.length>0?(m(),S(`div`,ce,[y.value?(m(),S(`div`,Y,[x(`div`,X,t(y.value.name)+` · `+t(y.value.total.toLocaleString()),1),(m(!0),S(b,null,p(y.value.items,e=>(m(),S(`div`,{key:e.type,class:`flex justify-between gap-4 text-xs text-content-secondary dark:text-content-muted`},[x(`span`,null,t(e.name),1),x(`span`,le,t(e.count.toLocaleString()),1)]))),128))])):h(``,!0),x(`div`,ue,[(m(!0),S(b,null,p(w.value,e=>(m(),S(`div`,{key:e.name,class:`flex flex-col items-center flex-1 max-w-32 h-full justify-end cursor-pointer`,onMouseenter:t=>y.value=e,onMouseleave:r[0]||=e=>y.value=null},[x(`span`,fe,t(e.total.toLocaleString()),1),x(`div`,{class:`w-full rounded-[5px] transition-all duration-300 ease-out hover:opacity-90 overflow-hidden flex flex-col-reverse`,style:o({height:M(e.total)+`%`,minHeight:`8px`})},[(m(!0),S(b,null,p(e.items,t=>(m(),S(`div`,{key:t.type,style:o({height:N(t.count,e.total)+`%`,backgroundColor:t.color})},null,4))),128))],4),x(`span`,pe,t(e.name),1)],40,de))),128))])])):h(``,!0)]),_:1},8,[`is-loading`,`is-updating`,`error`,`status`]),w.value.length>0?(m(),S(`div`,me,[(m(!0),S(b,null,p(w.value,e=>(m(),S(`div`,{key:`legend-`+e.name,class:`flex flex-col gap-0.5 min-w-[100px] max-w-[140px] flex-shrink-0`},[(m(!0),S(b,null,p(e.items,e=>(m(),S(`div`,{key:e.type,class:`flex items-center gap-1.5`},[x(`span`,{class:`w-2 h-2 rounded-sm shrink-0`,style:o({backgroundColor:e.color})},null,4),x(`span`,he,t(e.name),1)]))),128))]))),128))])):h(``,!0),w.value.length>0?(m(),S(`div`,ge,` Total: `+t(D.value.toLocaleString())+` packets `,1)):h(``,!0)]))}}),[[`__scopeId`,`data-v-a30328ce`]]),ve={class:`glass-card rounded-[10px] p-4 lg:p-6`},ye={class:`mt-3 lg:mt-4 grid grid-cols-2 gap-3 lg:gap-4`},be={class:`text-center`},xe={class:`text-lg lg:text-2xl font-bold text-content-primary dark:text-content-primary`},Se={class:`text-center`},Ce={class:`text-lg lg:text-2xl font-bold text-content-primary dark:text-content-primary`},we={class:`mt-2 lg:mt-3 grid grid-cols-3 gap-2 lg:gap-3 text-center`},Te={class:`text-xs lg:text-sm font-semibold text-accent-purple flex items-center justify-center gap-1`},Ee={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`},Oe={class:`text-xs lg:text-sm font-semibold text-accent-red flex items-center justify-center gap-1`},ke={key:0,class:`inline-block w-1.5 h-1.5 rounded-full bg-secondary opacity-70`,title:`Early data - limited uptime`},Ae={class:`text-xs text-content-secondary dark:text-content-muted`},je={class:`text-xs lg:text-sm font-semibold text-accent-red`},Z=null,Me=12e4,Ne=O(d({name:`AirtimeUtilizationChart`,__name:`AirtimeUtilizationChart`,setup(r){let i={rx:`#EBA0FC`,tx:`#FB787B`},o=()=>{let e=document.documentElement.classList.contains(`dark`);return{gridLine:e?`rgba(255, 255, 255, 0.1)`:`rgba(0, 0, 0, 0.1)`,axisLabel:e?`rgba(255, 255, 255, 0.5)`:`rgba(0, 0, 0, 0.5)`}},s=T(),l=E(),d=c(null),f=c([]),p=c(!1),b=c(!0),w=c(!1),D=c(null),O=c(`Connecting...`),k=c(30),A=c({totalReceived:0,totalTransmitted:0,dropped:0,firstPacketTime:0}),j=c({sf:9,bwHz:62500,cr:5,preamble:17}),M=(e,t=60)=>{if(e.length===0)return[];let n=1-.5**(1/t),r=Math.min(e.length,Math.max(10,Math.floor(t/3))),i=0,a=0;for(let t=0;t(i=n*e.rxUtil+(1-n)*i,a=n*e.txUtil+(1-n)*a,{...e,rxUtil:i,txUtil:a}))},N=v(()=>{let e=s.packetStats?.total_packets||0,t=s.packetStats?.transmitted_packets||0,n=l.stats?.uptime_seconds||0,r=e||A.value.totalReceived,i=t||A.value.totalTransmitted,a=A.value.firstPacketTime>0?Math.floor(Date.now()/1e3)-A.value.firstPacketTime:0,o=n||a,c=Math.max(o/3600,.1);if(c<1){let e=Math.max(o/60,1);return{rxRate:{value:Math.round(r/e*100)/100,label:c<.5?`RX/min (early)`:`RX/min`},txRate:{value:Math.round(i/e*100)/100,label:c<.5?`TX/min (early)`:`TX/min`},confidence:`low`}}let u=Math.round(r/c*100)/100,d=Math.round(i/c*100)/100,f,p;return c<6?(f=`RX/hr (${Math.round(c)}h)`,p=`medium`):c<24?(f=`RX/hr (${Math.round(c)}h)`,p=`high`):(f=`RX/hr`,p=`high`),{rxRate:{value:u,label:f},txRate:{value:d,label:f.replace(`RX`,`TX`)},confidence:p}}),F=async()=>{O.value=`Connecting...`,D.value=null,b.value||(w.value=!0);try{let e=60*1e3,t=Math.floor(Date.now()/1e3),n=t-24*3600,r=l.stats?.config?.radio;r&&(j.value={sf:r.spreading_factor??9,bwHz:r.bandwidth??62500,cr:r.coding_rate??5,preamble:r.preamble_length??17});let i=await z(`/airtime_chart_data`,{start_timestamp:n,end_timestamp:t,bucket_seconds:60,sf:j.value.sf,bw_hz:j.value.bwHz,cr:j.value.cr,preamble:j.value.preamble},{onPhaseChange:e=>{O.value=e===`receiving`?`Receiving data...`:`Connecting...`}});if(!i.success){f.value=[],p.value=!1,b.value=!1,w.value=!1,a(()=>I());return}let o=i.data,c=o.buckets||[];A.value={totalReceived:o.rx_total||0,totalTransmitted:o.tx_total||0,dropped:s.packetStats?.dropped_packets??0,firstPacketTime:c.length>0?c[0].timestamp:t};let u=24*3600/60,d=new Float64Array(u),m=new Float64Array(u);for(let t of c){let r=Math.floor((t.timestamp-n)/60);r>=0&&r[e.rxUtil,e.txUtil]))*1.05;k.value=Math.max(5,Math.ceil(y/5)*5),Z={data:v,yAxisMax:k.value,fetchedAt:Date.now()},p.value=!1,b.value=!1,w.value=!1,D.value=null,a(()=>I())}catch(e){console.error(`Failed to fetch airtime data:`,e),f.value=[],p.value=!1,b.value=!1,w.value=!1,D.value=e instanceof Error?e.message:`Failed to load chart data`,a(()=>I())}},I=()=>{if(!d.value)return;let e=d.value,t=e.getContext(`2d`);if(!t)return;let n=e.parentElement;if(!n)return;let r=n.getBoundingClientRect(),a=r.width,s=r.height;if(e.width=a*window.devicePixelRatio,e.height=s*window.devicePixelRatio,e.style.width=a+`px`,e.style.height=s+`px`,t.scale(window.devicePixelRatio,window.devicePixelRatio),t.clearRect(0,0,a,s),p.value){t.fillStyle=o().axisLabel,t.font=`16px system-ui`,t.textAlign=`center`,t.fillText(`Loading chart data...`,a/2,s/2);return}if(f.value.length===0){t.fillStyle=o().axisLabel,t.font=`16px system-ui`,t.textAlign=`center`,t.fillText(`No data available`,a/2,s/2);return}let c=a-45-20,l=s-40,u=k.value,m=k.value,h=o();t.strokeStyle=h.gridLine,t.lineWidth=1,t.font=`10px system-ui`,t.textAlign=`right`;for(let e=0;e<=5;e++){let n=20+l*e/5;t.beginPath(),t.moveTo(45,n),t.lineTo(a-20,n),t.stroke();let r=u-e/5*m;t.fillStyle=h.axisLabel,t.fillText(`${r.toFixed(0)}%`,40,n+3)}for(let e=0;e<=6;e++){let n=45+c*e/6;t.beginPath(),t.moveTo(n,20),t.lineTo(n,s-20),t.stroke()}f.value.length>1&&(t.strokeStyle=i.rx,t.lineWidth=2,t.beginPath(),f.value.forEach((e,n)=>{let r=45+c*n/(f.value.length-1),i=s-20-Math.min(e.rxUtil,k.value)/m*l;n===0?t.moveTo(r,i):t.lineTo(r,i)}),t.stroke()),f.value.length>1&&(t.strokeStyle=i.tx,t.lineWidth=2,t.beginPath(),f.value.forEach((e,n)=>{let r=45+c*n/(f.value.length-1),i=s-20-Math.min(e.txUtil,k.value)/m*l;n===0?t.moveTo(r,i):t.lineTo(r,i)}),t.stroke())};return P(F,{intervalMs:12e4,immediate:!1}),n(()=>{Z&&Date.now()-Z.fetchedAt{I(),setTimeout(()=>I(),100)}),window.addEventListener(`resize`,I)}),C(()=>{window.removeEventListener(`resize`,I)}),(n,r)=>(m(),S(`div`,ve,[r[3]||=u(`

Airtime Utilization

Activity (Last 24 Hours)

Rx Util
Tx Util
`,3),g(re,{class:`h-40 lg:h-48`,"is-loading":b.value,"is-updating":w.value,error:D.value,status:O.value,onRetry:F},{default:e(()=>[x(`canvas`,{ref_key:`chartRef`,ref:d,class:`absolute inset-0 w-full h-full`},null,512)]),_:1},8,[`is-loading`,`is-updating`,`error`,`status`]),x(`div`,ye,[x(`div`,be,[x(`div`,xe,t(_(s).packetStats?.total_packets||A.value.totalReceived),1),r[0]||=x(`div`,{class:`text-xs text-content-secondary dark:text-content-muted uppercase tracking-wide`},` Total Received `,-1)]),x(`div`,Se,[x(`div`,Ce,t(_(s).packetStats?.transmitted_packets||A.value.totalTransmitted),1),r[1]||=x(`div`,{class:`text-xs text-content-secondary dark:text-content-muted uppercase tracking-wide`},` Total Transmitted `,-1)])]),x(`div`,we,[x(`div`,null,[x(`div`,Te,[y(t(N.value.rxRate.value)+` `,1),N.value.confidence===`low`?(m(),S(`span`,Ee)):h(``,!0)]),x(`div`,De,t(N.value.rxRate.label),1)]),x(`div`,null,[x(`div`,Oe,[y(t(N.value.txRate.value)+` `,1),N.value.confidence===`low`?(m(),S(`span`,ke)):h(``,!0)]),x(`div`,Ae,t(N.value.txRate.label),1)]),x(`div`,null,[x(`div`,je,t(_(s).packetStats?.dropped_packets||A.value.dropped),1),r[2]||=x(`div`,{class:`text-xs text-content-secondary dark:text-content-muted`},`Dropped`,-1)])])]))}}),[[`__scopeId`,`data-v-2e55952b`]]),Pe={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`},Fe={class:`flex items-center justify-between p-8 pb-4 flex-shrink-0`},Ie={class:`text-content-secondary dark:text-content-muted text-sm`},Le={class:`flex items-center gap-2`},Re=[`title`],ze={class:`flex-1 overflow-y-auto custom-scrollbar px-8`},Be={class:`mb-6`},Ve={class:`glass-card bg-white/5 rounded-[15px] p-4`},He={class:`grid grid-cols-1 md:grid-cols-2 gap-4`},Ue={class:`space-y-3`},We={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10`},Ge={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`},qe={class:`text-content-primary dark:text-content-primary font-mono text-xs break-all`},Je={key:0,class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10`},Ye={class:`text-content-primary dark:text-content-primary font-mono text-xs`},Xe={class:`space-y-3`},Ze={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-semibold`},$e={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10`},et={class:`text-content-primary dark:text-content-primary font-semibold`},tt={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10`},nt={class:`mb-6`},rt={class:`bg-gray-50 dark:bg-white/5 rounded-[15px] p-4 border border-stroke-subtle dark:border-stroke/10`},it={class:`space-y-3`},at={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10`},ot={class:`text-content-primary dark:text-content-primary`},st={key:0,class:`pt-2`},ct={class:`glass-card bg-background-mute dark:bg-black/30 rounded-[10px] p-4 mb-4`},lt={class:`w-full overflow-x-auto`},ut={class:`text-content-primary dark:text-content-primary/90 text-xs font-mono whitespace-pre leading-relaxed min-w-full`},dt={class:`flex items-center justify-between mb-3`},ft={class:`text-content-secondary dark:text-content-primary/80 text-sm font-semibold`},pt={class:`text-content-muted dark:text-content-muted text-xs`},mt={class:`bg-background-mute dark:bg-black/40 rounded-[8px] p-3 mb-3`},ht={class:`font-mono text-xs text-content-primary dark:text-content-primary break-all whitespace-pre-wrap leading-relaxed`},gt={class:`bg-gray-50 dark:bg-white/5 rounded-[10px] overflow-hidden`},_t={key:0,class:`min-w-0`},vt={class:`text-cyan-500 text-sm font-mono break-words min-w-0`},yt={class:`text-content-primary dark:text-content-primary text-sm break-words min-w-0`},bt={class:`text-content-primary dark:text-content-primary text-sm font-semibold break-all min-w-0 overflow-hidden`},xt=[`title`],St={key:0,class:`text-orange-500 text-xs font-mono break-all min-w-0 overflow-hidden`},Ct=[`title`],wt={class:`grid grid-cols-2 gap-2`},Tt={class:`text-cyan-500 text-sm font-mono break-words`},Et={class:`text-content-primary dark:text-content-primary text-sm break-words`},Dt=[`title`],Ot={key:0},kt=[`title`],At={key:0,class:`text-content-muted dark:text-content-muted text-xs italic mt-2 px-1`},jt={key:1,class:`py-2`},Mt={class:`mb-6`},Nt={class:`bg-gray-50 dark:bg-white/5 rounded-[15px] p-4 border border-stroke-subtle dark:border-stroke/10`},Pt={class:`space-y-4`},Ft={class:`grid grid-cols-1 md:grid-cols-2 gap-4`},It={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10`},Lt={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10`},Rt={key:0,class:`py-2`},zt={class:`bg-background-mute dark:bg-black/20 rounded-[10px] p-4`},Bt={class:`flex items-center flex-wrap gap-2`},Vt={class:`relative group`},Ht={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`},Ut={class:`font-mono text-[10px] font-semibold tracking-tight text-content-primary dark:text-content-primary/90 sm:text-xs`},Wt={class:`pointer-events-none absolute bottom-full left-1/2 z-50 mb-2 -translate-x-1/2 transform whitespace-nowrap rounded-md bg-neutral-900 px-2 py-1 font-mono text-xs text-white opacity-0 shadow-lg ring-1 ring-white/10 transition-opacity group-hover:opacity-100`},Gt={key:0,class:`mx-2 text-cyan-600 dark:text-cyan-400/60`},Kt={key:1,class:`py-2`},qt={class:`text-content-secondary dark:text-content-muted text-sm mb-2 flex items-center`},Jt={key:0,class:`w-4 h-4 ml-2 text-yellow-500`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Yt={key:1,class:`text-yellow-500 text-xs ml-1`},Xt={class:`bg-background-mute dark:bg-black/20 rounded-[10px] p-4`},Zt={class:`flex items-center flex-wrap gap-2`},Qt={class:`relative group`},$t={key:0,class:`absolute -top-1 -right-1 w-2 h-2 bg-yellow-400 rounded-full animate-pulse`},en={class:`pointer-events-none absolute bottom-full left-1/2 z-50 mb-2 -translate-x-1/2 transform whitespace-nowrap rounded-md bg-neutral-900 px-2 py-1 font-mono text-xs text-white opacity-0 shadow-lg ring-1 ring-white/10 transition-opacity group-hover:opacity-100`},tn={key:0,class:`mx-1 text-orange-600 dark:text-orange-400/60`},nn={class:`mb-6`},rn={class:`glass-card bg-gray-50 dark:bg-white/5 rounded-[15px] p-4`},an={class:`grid grid-cols-1 md:grid-cols-3 gap-4 mb-4`},on={class:`text-center p-3 glass-card bg-background-mute dark:bg-black/20 rounded-[10px]`},sn={class:`text-lg font-bold text-content-primary dark:text-content-primary`},cn={class:`text-center p-3 glass-card bg-background-mute dark:bg-black/20 rounded-[10px]`},ln={class:`text-center p-3 glass-card bg-background-mute dark:bg-black/20 rounded-[10px]`},un={class:`text-lg font-bold text-content-primary dark:text-content-primary`},dn={key:0,class:`mb-4`},fn={class:`flex items-center gap-3`},pn={class:`flex gap-1`},mn={class:`text-content-secondary dark:text-content-primary/80 text-sm capitalize`},hn={key:1,class:`mb-4`},gn={key:2,class:`mb-4`},_n={class:`text-content-secondary dark:text-content-muted text-sm mb-3`},vn={class:`space-y-2`},yn={class:`flex items-center gap-3`},bn={class:`text-content-muted dark:text-content-muted text-sm`},xn={key:3,class:`mt-6 pt-4 border-t border-stroke-subtle dark:border-stroke/10`},Sn={class:`grid grid-cols-1 md:grid-cols-3 gap-3 mb-4`},Cn={class:`text-center p-3 glass-card bg-background-mute dark:bg-black/20 rounded-[10px]`},wn={class:`text-2xl font-bold text-content-primary dark:text-content-primary`},Tn={class:`text-center p-3 glass-card bg-background-mute dark:bg-black/20 rounded-[10px]`},En={class:`text-2xl font-bold text-content-primary dark:text-content-primary`},Dn={class:`text-content-muted dark:text-content-muted text-xs mt-1`},On={class:`text-center p-3 glass-card bg-background-mute dark:bg-black/20 rounded-[10px]`},kn={class:`text-content-muted dark:text-content-muted text-xs mt-1`},An={key:0,class:`glass-card bg-background-mute dark:bg-black/20 rounded-[10px] p-4`},jn={class:`space-y-3`},Mn={class:`flex-shrink-0 w-16 text-right`},Nn={class:`text-content-secondary dark:text-content-muted text-xs`},Pn={class:`flex-1 relative`},Fn={class:`h-8 rounded-lg overflow-hidden bg-background-mute dark:bg-stroke/5 relative`},In={class:`absolute inset-0 flex items-center px-3`},Ln={class:`text-content-primary dark:text-content-primary text-xs font-mono font-semibold`},Rn={class:`flex-shrink-0 w-12 text-left`},zn={class:`text-content-muted dark:text-content-muted text-xs`},Bn={class:`grid grid-cols-1 md:grid-cols-2 gap-4`},Vn={class:`space-y-2`},Hn={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10`},Un={class:`text-content-primary dark:text-content-primary`},Wn={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10`},Gn={class:`space-y-2`},Kn={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10`},qn={key:0,class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/10`},Jn={class:`text-red-600 dark:text-red-400 text-sm`},Yn={class:`p-8 pt-4 border-t border-stroke-subtle dark:border-stroke/10 flex justify-end flex-shrink-0`},Xn=O(d({name:`PacketDetailsModal`,__name:`PacketDetailsModal`,props:{packet:{},isOpen:{type:Boolean},localHash:{}},emits:[`close`],setup(n,{emit:r}){let{getSignalQuality:a}=ae(),s=n,u=r,d=c(!1),_=e=>new Date(e*1e3).toLocaleString(),v=e=>e.transmitted?e.is_duplicate?`text-amber-600 dark:text-amber-400`:e.drop_reason?`text-red-600 dark:text-red-400`:`text-green-600 dark:text-green-400`:`text-red-600 dark:text-red-400`,C=e=>e.transmitted?e.is_duplicate?`Duplicate`:e.drop_reason?`Dropped`:`Forwarded`:`Dropped`,T=e=>({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]||`Unknown Type (${e})`,E=e=>({0:`Transport Flood`,1:`Flood`,2:`Direct`,3:`Transport Direct`})[e]||`Unknown Route (${e})`,D=e=>{if(!e)return`None`;let t=e.replace(/\s+/g,``).toUpperCase().match(/.{2}/g)||[],n=[];for(let e=0;e{try{let r=0,i=t.length/2;if(i>=100){if(t.length>=r+64){let i=t.slice(r,r+64);e.push({name:`Public Key`,byteRange:`${(n+r)/2}-${(n+r+63)/2}`,hexData:i.match(/.{8}/g)?.join(` `)||i,description:`Ed25519 public key of the node (32 bytes)`,fields:[{bits:`0-255`,name:`Ed25519 Public Key`,value:`${i.slice(0,16)}...${i.slice(-16)}`,binary:`32 bytes (256 bits)`}]}),r+=64}if(t.length>=r+8){let i=t.slice(r,r+8),a=parseInt(i,16),o=new Date(a*1e3);e.push({name:`Timestamp`,byteRange:`${(n+r)/2}-${(n+r+7)/2}`,hexData:i.match(/.{2}/g)?.join(` `)||i,description:`Unix timestamp of advertisement`,fields:[{bits:`0-31`,name:`Unix Timestamp`,value:`${a} (${o.toLocaleString()})`,binary:a.toString(2).padStart(32,`0`)}]}),r+=8}if(t.length>=r+128){let i=t.slice(r,r+128);e.push({name:`Signature`,byteRange:`${(n+r)/2}-${(n+r+127)/2}`,hexData:i.match(/.{8}/g)?.join(` `)||i,description:`Ed25519 signature of public key, timestamp, and appdata`,fields:[{bits:`0-511`,name:`Ed25519 Signature`,value:`${i.slice(0,16)}...${i.slice(-16)}`,binary:`64 bytes (512 bits)`}]}),r+=128}t.length>r&&k(e,t.slice(r),n+r)}else e.push({name:`ADVERT AppData (Partial)`,byteRange:`${n/2}-${n/2+i-1}`,hexData:t.match(/.{2}/g)?.join(` `)||t,description:`Partial ADVERT data - appears to be just AppData portion (${i} bytes)`,fields:[{bits:`0-${i*8-1}`,name:`Partial Data`,value:`${i} bytes - attempting to decode as AppData`,binary:`${i} bytes (${i*8} bits)`}]}),k(e,t,n)}catch(n){e.push({name:`ADVERT Parse Error`,byteRange:`N/A`,hexData:t.slice(0,32)+`...`,description:`Failed to parse ADVERT payload structure`,fields:[{bits:`N/A`,name:`Error`,value:`Parse error: ${n instanceof Error?n.message:`Unknown error`}`,binary:`Invalid`}]})}},k=(e,t,n)=>{try{let r=t.length/2;e.push({name:`AppData`,byteRange:`${n/2}-${n/2+r-1}`,hexData:t.match(/.{2}/g)?.join(` `)||t,description:`Node advertisement application data (${r} bytes)`,fields:[{bits:`0-${r*8-1}`,name:`Application Data`,value:`${r} bytes (contains flags, location, name, etc.)`,binary:`${r} bytes (${r*8} bits)`}]});let i=0;if(t.length>=2){let r=parseInt(t.slice(i,i+2),16),a=[],o=!!(r&16),s=!!(r&32),c=!!(r&64),l=!!(r&128);if(r&1&&a.push(`is chat node`),r&2&&a.push(`is repeater`),r&4&&a.push(`is room server`),r&8&&a.push(`is sensor`),o&&a.push(`has location`),s&&a.push(`has feature 1`),c&&a.push(`has feature 2`),l&&a.push(`has name`),e.push({name:`AppData Flags`,byteRange:`${(n+i)/2}`,hexData:`0x${t.slice(i,i+2)}`,description:`Flags indicating which optional fields are present`,fields:[{bits:`0-7`,name:`Flags`,value:a.join(`, `)||`none`,binary:r.toString(2).padStart(8,`0`)}]}),i+=2,o&&t.length>=i+16){let r=t.slice(i,i+8),a=[];for(let e=6;e>=0;e-=2)a.push(r.slice(e,e+2));let o=parseInt(a.join(``),16),s=o>2147483647?o-4294967296:o,c=s/1e6,l=t.slice(i+8,i+16),u=[];for(let e=6;e>=0;e-=2)u.push(l.slice(e,e+2));let d=parseInt(u.join(``),16),f=d>2147483647?d-4294967296:d,p=f/1e6;e.push({name:`Location Data`,byteRange:`${(n+i)/2}-${(n+i+15)/2}`,hexData:`${r.match(/.{2}/g)?.join(` `)||r} ${l.match(/.{2}/g)?.join(` `)||l}`,description:`GPS coordinates (latitude and longitude)`,fields:[{bits:`0-31`,name:`Latitude`,value:`${c.toFixed(6)}° (raw: ${s})`,binary:s.toString(2).padStart(32,`0`)},{bits:`32-63`,name:`Longitude`,value:`${p.toFixed(6)}° (raw: ${f})`,binary:f.toString(2).padStart(32,`0`)}]}),i+=16}if(s&&t.length>=i+4){let r=t.slice(i,i+4),a=parseInt(r,16);e.push({name:`Feature 1`,byteRange:`${(n+i)/2}-${(n+i+3)/2}`,hexData:r.match(/.{2}/g)?.join(` `)||r,description:`Reserved feature 1 (2 bytes)`,fields:[{bits:`0-15`,name:`Feature 1 Value`,value:`${a}`,binary:a.toString(2).padStart(16,`0`)}]}),i+=4}if(c&&t.length>=i+4){let r=t.slice(i,i+4),a=parseInt(r,16);e.push({name:`Feature 2`,byteRange:`${(n+i)/2}-${(n+i+3)/2}`,hexData:r.match(/.{2}/g)?.join(` `)||r,description:`Reserved feature 2 (2 bytes)`,fields:[{bits:`0-15`,name:`Feature 2 Value`,value:`${a}`,binary:a.toString(2).padStart(16,`0`)}]}),i+=4}if(l&&t.length>i){let r=t.slice(i),a=r.match(/.{2}/g)||[],o=a.map(e=>{let t=parseInt(e,16);return t>=32&&t<=126?String.fromCharCode(t):`.`}).join(``).replace(/\.+$/,``);e.push({name:`Node Name`,byteRange:`${(n+i)/2}-${(n+t.length-1)/2}`,hexData:r.match(/.{2}/g)?.join(` `)||r,description:`Node name string (${a.length} bytes)`,fields:[{bits:`0-${a.length*8-1}`,name:`Node Name`,value:`"${o}"`,binary:`ASCII text (${a.length} bytes)`}]})}}}catch(n){e.push({name:`AppData Parse Error`,byteRange:`N/A`,hexData:t.slice(0,Math.min(32,t.length)),description:`Failed to parse AppData structure`,fields:[{bits:`N/A`,name:`Error`,value:`Parse error: ${n instanceof Error?n.message:`Unknown error`}`,binary:`Invalid`}]})}},A=e=>{if(!e)return[];if(Array.isArray(e))return e;if(typeof e==`string`)try{return JSON.parse(e)}catch{return[]}return[]},j=e=>{let t=[];if(!e)return t;try{let n=e.raw_packet;if(n){let e=n.replace(/\s+/g,``).toUpperCase(),r=0;if(e.length>=2){let n=e.slice(r,r+2),i=parseInt(n,16),a=i&3,o=(i&60)>>2,s=(i&192)>>6;if(t.push({name:`Header`,byteRange:`0`,hexData:`0x${n}`,description:`Contains routing type, payload type, and payload version`,fields:[{bits:`0-1`,name:`Route Type`,value:{0:`Transport Flood`,1:`Flood`,2:`Direct`,3:`Transport Direct`}[a]||`Unknown`,binary:a.toString(2).padStart(2,`0`)},{bits:`2-5`,name:`Payload Type`,value:{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`}[o]||`Unknown`,binary:o.toString(2).padStart(4,`0`)},{bits:`6-7`,name:`Version`,value:s.toString(),binary:s.toString(2).padStart(2,`0`)}]}),r+=2,(a===0||a===3)&&e.length>=r+8){let n=e.slice(r,r+8),i=parseInt(n.slice(0,4),16),a=parseInt(n.slice(4,8),16);t.push({name:`Transport Codes`,byteRange:`1-4`,hexData:`${n.slice(0,4)} ${n.slice(4,8)}`,description:`2x 16-bit transport codes for routing optimization`,fields:[{bits:`0-15`,name:`Code 1`,value:i.toString(),binary:i.toString(2).padStart(16,`0`)},{bits:`16-31`,name:`Code 2`,value:a.toString(),binary:a.toString(2).padStart(16,`0`)}]}),r+=8}if(e.length>=r+2){let n=e.slice(r,r+2),i=parseInt(n,16),a=(i>>6)+1,o=i&63,s=o*a;if(t.push({name:`Path Length`,byteRange:`${r/2}`,hexData:`0x${n}`,description:`${o} hop${o===1?``:`s`}, ${a}-byte hash${a>1?`es`:``} (${s} bytes)`,fields:[{bits:`6-7`,name:`Hash Size`,value:`${a}-byte`,binary:(i>>6&3).toString(2).padStart(2,`0`)},{bits:`0-5`,name:`Hop Count`,value:`${o}`,binary:(i&63).toString(2).padStart(6,`0`)}]}),r+=2,s>0&&e.length>=r+s*2){let n=e.slice(r,r+s*2),i=RegExp(`.{${a*2}}`,`g`),c=n.match(i)||[];t.push({name:`Path Data`,byteRange:`${r/2}-${(r+s*2-2)/2}`,hexData:c.join(` `)||n,description:`${o} × ${a}-byte routing hash${o===1?``:`es`}`,fields:c.map((e,t)=>({bits:`${t*a*8}-${(t+1)*a*8-1}`,name:`Hop ${t+1}`,value:e.toUpperCase(),binary:`${a} byte${a>1?`s`:``}`}))}),r+=s*2}}if(e.length>r){let n=e.slice(r),i=n.length/2;o===4?O(t,n,r):t.push({name:`Payload Data`,byteRange:`${r/2}-${r/2+i-1}`,hexData:n.match(/.{2}/g)?.join(` `)||n,description:`Application data content`,fields:[{bits:`0-${i*8-1}`,name:`Application Data`,value:`${i} bytes`,binary:`${i} bytes (${i*8} bits)`}]})}}}else{if(e.header){let n=e.header.replace(/0x/gi,``).replace(/\s+/g,``).toUpperCase(),r=parseInt(n,16),i=r&3,a=(r&60)>>2,o=(r&192)>>6;t.push({name:`Header`,byteRange:`0`,hexData:`0x${n}`,description:`Contains routing type, payload type, and payload version`,fields:[{bits:`0-1`,name:`Route Type`,value:{0:`Transport Flood`,1:`Flood`,2:`Direct`,3:`Transport Direct`}[i]||`Unknown`,binary:i.toString(2).padStart(2,`0`)},{bits:`2-5`,name:`Payload Type`,value:{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`}[a]||`Unknown`,binary:a.toString(2).padStart(4,`0`)},{bits:`6-7`,name:`Version`,value:o.toString(),binary:o.toString(2).padStart(2,`0`)}]}),e.transport_codes&&t.push({name:`Transport Codes`,byteRange:`1-4`,hexData:e.transport_codes,description:`2x 16-bit transport codes for routing optimization`,fields:[{bits:`0-31`,name:`Transport Codes`,value:e.transport_codes,binary:`Available in separate field`}]}),e.original_path&&e.original_path.length>0&&t.push({name:`Original Path`,byteRange:`?`,hexData:e.original_path.join(` `),description:`Original routing path (${e.original_path.length} nodes)`,fields:[{bits:`0-?`,name:`Path Nodes`,value:`${e.original_path.length} nodes`,binary:`Available as node list`}]}),e.forwarded_path&&e.forwarded_path.length>0&&t.push({name:`Forwarded Path`,byteRange:`?`,hexData:e.forwarded_path.join(` `),description:`Forwarded routing path (${e.forwarded_path.length} nodes)`,fields:[{bits:`0-?`,name:`Path Nodes`,value:`${e.forwarded_path.length} nodes`,binary:`Available as node list`}]})}if(e.payload){let n=e.payload.replace(/\s+/g,``).toUpperCase(),r=n.length/2;e.type===4?O(t,n,0):t.push({name:`Payload Data`,byteRange:`0-${r-1}`,hexData:n.match(/.{2}/g)?.join(` `)||n,description:`Application data content (${r} bytes)`,fields:[{bits:`0-${r*8-1}`,name:`Application Data`,value:`${r} bytes`,binary:`${r} bytes (${r*8} bits)`}]})}}}catch{t.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 t},P=(e,t)=>e==null||t==null?`text-content-muted dark:text-content-muted`:a(t).color,F=e=>{if(e==null)return{level:0,className:`signal-none`};let t=a(e),n,r;return t.bars>=5?(n=4,r=`signal-excellent`):t.bars>=4?(n=3,r=`signal-good`):t.bars>=2?(n=2,r=`signal-fair`):t.bars>=1?(n=1,r=`signal-poor`):(n=0,r=`signal-none`),{level:n,className:r}},I=e=>{if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}},L=e=>e>=1e3?`${(e/1e3).toFixed(2)}s`:`${Math.round(e)}ms`,R=e=>{e.key===`Escape`&&u(`close`)},ee=e=>{e.target===e.currentTarget&&u(`close`)};return i(()=>s.isOpen,e=>{e?document.body.style.overflow=`hidden`:document.body.style.overflow=``},{immediate:!0}),(r,i)=>(m(),l(f,{to:`body`},[g(N,{name:`modal`,appear:``},{default:e(()=>[n.isOpen&&n.packet?(m(),S(`div`,{key:0,class:`fixed inset-0 z-50 flex items-center justify-center p-4 overflow-hidden`,onClick:ee,onKeydown:R,tabindex:`0`},[i[51]||=x(`div`,{class:`absolute inset-0 bg-black/60 backdrop-blur-md pointer-events-none`},null,-1),x(`div`,{class:`relative w-full max-w-4xl max-h-[90vh] flex flex-col`,onClick:i[3]||=M(()=>{},[`stop`])},[x(`div`,Pe,[x(`div`,Fe,[x(`div`,null,[i[4]||=x(`h2`,{class:`text-2xl font-bold text-content-primary dark:text-content-primary mb-1`},` Packet Details `,-1),x(`p`,Ie,t(T(n.packet.type))+` - `+t(E(n.packet.route)),1)]),x(`div`,Le,[x(`button`,{onClick:i[0]||=e=>d.value=!d.value,class:w([`flex items-center gap-2 px-3 py-1.5 rounded-lg transition-all duration-200`,d.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:d.value?`Hide binary values`:`Show binary values`},[...i[5]||=[x(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4`})],-1),x(`span`,{class:`text-xs font-medium`},`Binary`,-1)]],10,Re),x(`button`,{onClick:i[1]||=e=>u(`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`},[...i[6]||=[x(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])])]),x(`div`,ze,[x(`div`,Be,[i[13]||=x(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-4 flex items-center`},[x(`div`,{class:`w-2 h-2 rounded-full bg-cyan-400 mr-3`}),y(` Basic Information `)],-1),x(`div`,Ve,[x(`div`,He,[x(`div`,Ue,[x(`div`,We,[i[7]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Timestamp`,-1),x(`span`,Ge,t(_(n.packet.timestamp)),1)]),x(`div`,Ke,[i[8]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Packet Hash`,-1),x(`span`,qe,t(n.packet.packet_hash),1)]),n.packet.header?(m(),S(`div`,Je,[i[9]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Header`,-1),x(`span`,Ye,t(n.packet.header),1)])):h(``,!0)]),x(`div`,Xe,[x(`div`,Ze,[i[10]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Type`,-1),x(`span`,Qe,t(n.packet.type)+` (`+t(T(n.packet.type))+`)`,1)]),x(`div`,$e,[i[11]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Route`,-1),x(`span`,et,t(n.packet.route)+` (`+t(E(n.packet.route))+`)`,1)]),x(`div`,tt,[i[12]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Status`,-1),x(`span`,{class:w([`font-semibold`,v(n.packet)])},t(C(n.packet)),3)])])])])]),x(`div`,nt,[i[25]||=x(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-4 flex items-center`},[x(`div`,{class:`w-2 h-2 rounded-full bg-orange-400 mr-3`}),y(` Payload Data `)],-1),x(`div`,rt,[x(`div`,it,[x(`div`,at,[i[14]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Payload Length`,-1),x(`span`,ot,t(n.packet.payload_length||n.packet.length)+` bytes`,1)]),n.packet.payload?(m(),S(`div`,st,[i[23]||=x(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-3`},` Payload Analysis `,-1),x(`div`,ct,[i[15]||=x(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-2 font-semibold`},` Raw Hex Data `,-1),x(`div`,lt,[x(`pre`,ut,t(D(n.packet.payload)),1)])]),(m(!0),S(b,null,p(j(n.packet).filter(e=>!e.name.includes(`Parse Error`)),(e,n)=>(m(),S(`div`,{key:n,class:`mb-4`},[x(`div`,dt,[x(`h4`,ft,t(e.name),1),x(`span`,pt,`Bytes `+t(e.byteRange),1)]),x(`div`,mt,[x(`div`,ht,t(e.hexData),1)]),x(`div`,gt,[x(`div`,{class:w([`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`,d.value?`grid-cols-4`:`grid-cols-3`])},[i[16]||=x(`div`,{class:`min-w-0`},`Bits`,-1),i[17]||=x(`div`,{class:`min-w-0`},`Field`,-1),i[18]||=x(`div`,{class:`min-w-0`},`Value`,-1),d.value?(m(),S(`div`,_t,`Binary`)):h(``,!0)],2),(m(!0),S(b,null,p(e.fields,(e,n)=>(m(),S(`div`,{key:n,class:w([`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`,d.value?`grid-cols-4`:`grid-cols-3`])},[x(`div`,vt,t(e.bits),1),x(`div`,yt,t(e.name),1),x(`div`,bt,[x(`span`,{class:`block`,title:e.value},t(e.value),9,xt)]),d.value?(m(),S(`div`,St,[x(`span`,{class:`block`,title:e.binary},t(e.binary),9,Ct)])):h(``,!0)],2))),128)),(m(!0),S(b,null,p(e.fields,(e,n)=>(m(),S(`div`,{key:`mobile-${n}`,class:`md:hidden p-3 border-b border-stroke-subtle dark:border-stroke/5 last:border-b-0 space-y-2`},[x(`div`,wt,[x(`div`,null,[i[19]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-xs uppercase tracking-wide`},`Bits:`,-1),x(`div`,Tt,t(e.bits),1)]),x(`div`,null,[i[20]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-xs uppercase tracking-wide`},`Field:`,-1),x(`div`,Et,t(e.name),1)])]),x(`div`,null,[i[21]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-xs uppercase tracking-wide`},`Value:`,-1),x(`div`,{class:`text-content-primary dark:text-content-primary text-sm font-semibold break-all`,title:e.value},t(e.value),9,Dt)]),d.value?(m(),S(`div`,Ot,[i[22]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-xs uppercase tracking-wide`},`Binary:`,-1),x(`div`,{class:`text-orange-500 text-xs font-mono break-all`,title:e.binary},t(e.binary),9,kt)])):h(``,!0)]))),128))]),e.description?(m(),S(`div`,At,t(e.description),1)):h(``,!0)]))),128))])):(m(),S(`div`,jt,[...i[24]||=[x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Payload:`,-1),x(`span`,{class:`text-content-muted dark:text-content-muted ml-2`},`None`,-1)]]))])])]),x(`div`,Mt,[i[33]||=x(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-4 flex items-center`},[x(`div`,{class:`w-2 h-2 rounded-full bg-purple-400 mr-3`}),y(` Path Information `)],-1),x(`div`,Nt,[x(`div`,Pt,[x(`div`,Ft,[x(`div`,It,[i[26]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Source Hash`,-1),x(`span`,{class:w([`text-content-primary dark:text-content-primary font-mono text-xs`,s.localHash&&n.packet.src_hash===s.localHash?`bg-cyan-400/20 text-cyan-600 dark:text-cyan-300 px-1 rounded`:``])},t(n.packet.src_hash||`Unknown`),3)]),x(`div`,Lt,[i[27]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Destination Hash`,-1),x(`span`,{class:w([`text-content-primary dark:text-content-primary font-mono text-xs`,s.localHash&&n.packet.dst_hash===s.localHash?`bg-cyan-400/20 text-cyan-600 dark:text-cyan-300 px-1 rounded`:``])},t(n.packet.dst_hash||`Broadcast`),3)])]),A(n.packet.original_path).length>0?(m(),S(`div`,Rt,[i[29]||=x(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-2`},` Original Path `,-1),x(`div`,zt,[x(`div`,Bt,[(m(!0),S(b,null,p(A(n.packet.original_path),(e,r)=>(m(),S(`div`,{key:r,class:`flex items-center`},[x(`div`,Vt,[x(`div`,Ht,[x(`div`,Ut,t(e.toUpperCase()),1)]),x(`div`,Wt,` Node: `+t(e.toUpperCase()),1)]),r0?(m(),S(`div`,Kt,[x(`div`,qt,[i[31]||=y(` Forwarded Path `,-1),JSON.stringify(A(n.packet.original_path))===JSON.stringify(A(n.packet.forwarded_path))?h(``,!0):(m(),S(`svg`,Jt,[...i[30]||=[x(`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)]])),JSON.stringify(A(n.packet.original_path))===JSON.stringify(A(n.packet.forwarded_path))?h(``,!0):(m(),S(`span`,Yt,`(Modified)`))]),x(`div`,Xt,[x(`div`,Zt,[(m(!0),S(b,null,p(A(n.packet.forwarded_path),(e,r)=>(m(),S(`div`,{key:r,class:`flex items-center`},[x(`div`,Qt,[x(`div`,{class:w([`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`,s.localHash&&e===s.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`])},[x(`div`,{class:w([`font-mono text-[10px] font-semibold tracking-tight sm:text-xs`,s.localHash&&e===s.localHash?`text-yellow-200`:`text-white/90`])},t(e.toUpperCase()),3),s.localHash&&e===s.localHash?(m(),S(`div`,$t)):h(``,!0)],2),x(`div`,en,t(e.toUpperCase()),1)]),rx(`div`,{key:e,class:w([`w-2 h-6 rounded-sm transition-all duration-300`,e<=F(n.packet.rssi).level?{"signal-excellent":`bg-green-400`,"signal-good":`bg-cyan-400`,"signal-fair":`bg-yellow-400`,"signal-poor":`bg-red-400`}[F(n.packet.rssi).className]:`bg-stroke-subtle dark:bg-stroke/10`])},null,2)),64))]),x(`span`,mn,t(F(n.packet.rssi).className.replace(`signal-`,``)),1)])])),n.packet.is_trace&&n.packet.path_snr_details&&n.packet.path_snr_details.length>0?(m(),S(`div`,gn,[x(`div`,_n,` Path SNR Details (`+t(n.packet.path_snr_details.length)+` hops) `,1),x(`div`,vn,[(m(!0),S(b,null,p(n.packet.path_snr_details,(e,n)=>(m(),S(`div`,{key:n,class:`flex items-center justify-between p-2 glass-card bg-background-mute dark:bg-black/20 rounded-[8px]`},[x(`div`,yn,[x(`span`,bn,t(n+1)+`.`,1),x(`span`,{class:w([`font-mono text-xs text-content-primary dark:text-content-primary`,s.localHash&&e.hash===s.localHash?`bg-cyan-400/20 text-cyan-600 dark:text-cyan-300 px-1 rounded`:``])},t(e.hash.toUpperCase()),3)]),x(`span`,{class:w([`text-sm font-bold`,P(e.snr_db,null)])},t(e.snr_db.toFixed(1))+`dB `,3)]))),128))])])):h(``,!0),n.packet.transmitted&&n.packet.lbt_attempts!==void 0?(m(),S(`div`,xn,[i[45]||=x(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-3 flex items-center`},[x(`svg`,{class:`w-4 h-4 mr-2`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`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`})]),y(` Listen Before Talk (LBT) Metrics `)],-1),x(`div`,Sn,[x(`div`,Cn,[i[41]||=x(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},` CAD Attempts `,-1),x(`div`,wn,t(n.packet.lbt_attempts),1)]),x(`div`,Tn,[i[42]||=x(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},` Total LBT Delay `,-1),x(`div`,En,t(L(I(n.packet.lbt_backoff_delays_ms).reduce((e,t)=>e+t,0))),1),x(`div`,Dn,t(I(n.packet.lbt_backoff_delays_ms).length)+` backoffs `,1)]),x(`div`,On,[i[43]||=x(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},` Channel Status `,-1),x(`div`,{class:w([`text-lg font-bold`,n.packet.lbt_channel_busy?`text-yellow-600 dark:text-yellow-400`:`text-green-600 dark:text-green-400`])},t(n.packet.lbt_channel_busy?`BUSY`:`CLEAR`),3),x(`div`,kn,t(n.packet.lbt_channel_busy?`Waited for clear`:`Immediate TX`),1)])]),I(n.packet.lbt_backoff_delays_ms).length>0?(m(),S(`div`,An,[i[44]||=x(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-3 font-semibold`},` Backoff Pattern (Exponential with Jitter) `,-1),x(`div`,jn,[(m(!0),S(b,null,p(I(n.packet.lbt_backoff_delays_ms),(e,r)=>(m(),S(`div`,{key:r,class:`flex items-center gap-3`},[x(`div`,Mn,[x(`span`,Nn,`Attempt `+t(r+1),1)]),x(`div`,Pn,[x(`div`,Fn,[x(`div`,{class:w([`h-full rounded-lg transition-all duration-300`,[r===0?`bg-gradient-to-r from-cyan-500/50 to-cyan-600/50`:r===1?`bg-gradient-to-r from-yellow-500/50 to-yellow-600/50`:r===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:o({width:`${Math.min(100,e/Math.max(...I(n.packet.lbt_backoff_delays_ms))*100)}%`})},[x(`div`,In,[x(`span`,Ln,t(L(e)),1)])],6)])]),x(`div`,Rn,[x(`span`,zn,t(Math.round(e/I(n.packet.lbt_backoff_delays_ms).reduce((e,t)=>e+t,0)*100))+`% `,1)])]))),128))])])):h(``,!0)])):h(``,!0),x(`div`,Bn,[x(`div`,Vn,[x(`div`,Hn,[i[46]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`TX Delay`,-1),x(`span`,Un,t(Number(n.packet.tx_delay_ms)>0?Number(n.packet.tx_delay_ms).toFixed(1)+`ms`:`-`),1)]),x(`div`,Wn,[i[47]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Transmitted`,-1),x(`span`,{class:w(n.packet.transmitted?`text-green-600 dark:text-green-400`:`text-red-600 dark:text-red-400`)},t(n.packet.transmitted?`Yes`:`No`),3)])]),x(`div`,Gn,[x(`div`,Kn,[i[48]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Is Duplicate`,-1),x(`span`,{class:w(n.packet.is_duplicate?`text-amber-600 dark:text-amber-400`:`text-content-muted dark:text-content-muted`)},t(n.packet.is_duplicate?`Yes`:`No`),3)]),n.packet.drop_reason?(m(),S(`div`,qn,[i[49]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Drop Reason`,-1),x(`span`,Jn,t(n.packet.drop_reason),1)])):h(``,!0)])])])])]),x(`div`,Yn,[x(`button`,{onClick:i[2]||=e=>u(`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)):h(``,!0)]),_:1})]))}}),[[`__scopeId`,`data-v-c8711b75`]]),Zn={class:`glass-card rounded-[20px] p-6`},Qn={class:`flex flex-col lg:flex-row lg:justify-between lg:items-center mb-6 gap-4 filter-container`},$n={class:`flex items-center gap-2 header-info relative`},er={class:`text-content-secondary dark:text-content-muted text-sm packet-count`},tr=[`title`],nr={class:`hidden sm:inline`},rr={key:1,class:`text-accent-red text-sm error-indicator`},ir={class:`flex items-center gap-3 lg:flex filter-controls`},ar={class:`flex flex-col`},or=[`value`],sr={class:`flex flex-col`},cr=[`value`],lr={class:`flex flex-col`},ur={class:`flex flex-col reset-container`},dr=[`disabled`],fr={class:`space-y-4 overflow-hidden`},pr={class:`space-y-4`},mr=[`onClick`],hr={class:`hidden lg:grid grid-cols-12 gap-2 items-center`},gr={class:`col-span-1 text-content-primary dark:text-content-primary text-sm`},_r={class:`col-span-1 flex items-center gap-2`},vr={class:`flex flex-col`},yr={class:`text-content-primary dark:text-content-primary text-xs`},br=[`title`],xr={class:`col-span-2`},Sr={class:`col-span-1 text-content-primary dark:text-content-primary text-xs`},Cr={class:`col-span-2`},wr={class:`space-y-1`},Tr={key:0,class:`flex items-center gap-0.5 flex-wrap`},Er=[`title`],Dr={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`},Or={key:0,class:`text-[9px] text-content-muted dark:text-content-muted ml-1`},kr={key:1,class:`flex items-center gap-1`},Ar={class:`inline-block px-2 py-0.5 rounded bg-badge-cyan-bg text-badge-cyan-text text-xs font-mono`},jr={class:`col-span-1 text-content-primary dark:text-content-primary text-xs`},Mr={class:`col-span-1 text-content-primary dark:text-content-primary text-xs`},Nr={class:`col-span-1 text-content-primary dark:text-content-primary text-xs`},Pr={class:`col-span-1 text-content-primary dark:text-content-primary text-xs`},Fr={key:0,class:`flex items-center gap-1`},Ir={class:`col-span-1`},Lr={key:0,class:`text-accent-red text-[8px] italic truncate`},Rr={class:`lg:hidden space-y-2`},zr={class:`flex items-center justify-between`},Br={class:`flex items-center gap-2`},Vr={class:`flex flex-col`},Hr={class:`text-content-primary dark:text-content-primary text-sm font-medium`},Ur=[`title`],Wr={class:`flex items-center gap-2 text-right`},Gr={class:`text-content-secondary dark:text-content-muted text-xs`},Kr={class:`flex items-center justify-between`},qr={class:`flex items-center gap-1.5`},Jr={key:0,class:`flex flex-wrap items-center gap-0.5`},Yr=[`title`],Xr={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`},Zr={key:0,class:`text-[9px] text-content-muted dark:text-content-muted ml-1`},Qr={class:`flex items-center gap-1`},$r={class:`inline-block px-2 py-0.5 rounded bg-badge-cyan-bg text-badge-cyan-text text-xs font-mono font-semibold`},ei={class:`flex items-center gap-0.5 text-content-muted dark:text-content-muted/60`},ti={key:0,class:`text-[9px] font-medium`,title:`Multi-hop path`},ni={class:`flex items-center gap-1`},ri={class:`flex items-center gap-2`},ii={class:`flex items-center gap-1`},ai={key:0,class:`flex gap-0.5`},oi={class:`text-content-primary dark:text-content-primary text-xs`},si={class:`flex items-center justify-between text-content-secondary dark:text-content-muted text-xs`},ci={class:`flex items-center gap-3`},li={class:`flex items-center gap-2`},ui={key:0,class:`flex items-center gap-1`},di={key:0,class:`text-accent-red text-xs italic`},fi={key:0,class:`flex justify-between items-center mt-6 pt-4 border-t border-stroke-subtle dark:border-stroke pagination-container`},pi={class:`flex items-center gap-4 pagination-info`},mi={class:`text-content-secondary dark:text-content-muted text-sm`},hi={key:0,class:`flex items-center gap-2 load-more-section`},gi=[`disabled`],_i={class:`text-content-secondary dark:text-content-muted text-xs load-more-count`},vi={class:`flex items-center gap-2 pagination-controls`},yi=[`disabled`],bi={class:`flex items-center gap-1 page-numbers`},xi={key:1,class:`text-content-secondary dark:text-content-muted text-sm px-2 ellipsis`},Si=[`onClick`],Ci={key:2,class:`text-content-secondary dark:text-content-muted text-sm px-2 ellipsis`},wi=[`disabled`],Ti={key:1,class:`flex justify-center mt-6 pt-4 border-t border-stroke-subtle dark:border-stroke`},Ei={class:`flex items-center gap-4`},Di={class:`text-content-secondary dark:text-content-muted text-sm`},Oi={class:`text-content-secondary dark:text-content-muted text-xs`},ki={key:2,class:`flex justify-center mt-6 pt-4 border-t border-stroke-subtle dark:border-stroke`},Ai={class:`flex items-center gap-2`},Q=10,$=1e3,ji=O(d({name:`PacketTable`,__name:`PacketTable`,setup(e){let r=T(),a=D(),o=c(1),l=c(100),d=c(!1),f=c(!1),y=null;i(()=>r.isLoading,e=>{e?(y&&=(clearTimeout(y),null),f.value=!0):y=window.setTimeout(()=>{f.value=!1,y=null},600)});let E=c(null),O=c(!1),A=async e=>{if(E.value=e,O.value=!0,e.packet_hash&&(!e.header||!e.raw_packet))try{let t=await r.getPacketByHash(e.packet_hash);t&&E.value?.packet_hash===e.packet_hash&&(E.value={...E.value,...t})}catch{}},M=()=>{O.value=!1,E.value=null},N=c(I(`packetTable_selectedType`,`all`)),P=c(I(`packetTable_selectedRoute`,`all`)),L=c(!1),R=c(null),ee=[`all`,`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`10`,`11`],te=[`all`,`1`,`2`];i(N,e=>{F(`packetTable_selectedType`,e),o.value=1}),i(P,e=>{F(`packetTable_selectedRoute`,e),o.value=1}),i(L,()=>{o.value=1});let z=v(()=>{let e=r.recentPackets;if(N.value!==`all`){let t=parseInt(N.value);e=e.filter(e=>e.type===t)}if(P.value!==`all`){let t=parseInt(P.value);e=e.filter(e=>e.route===t)}return L.value&&R.value!==null&&(e=e.filter(e=>e.timestamp>=R.value)),e}),ne=v(()=>{let e=(o.value-1)*Q,t=e+Q;return z.value.slice(e,t)}),B=v(()=>Math.ceil(z.value.length/Q)),re=v(()=>o.value===B.value),ie=v(()=>r.recentPackets.length>=l.value&&l.value<$),ae=v(()=>re.value&&ie.value&&!d.value),oe=e=>new Date(e*1e3).toLocaleTimeString(void 0,{hour12:!0}),V=e=>({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`})[e]||`TYPE_${e}`,H=e=>({0:`T-Flood`,1:`Flood`,2:`Direct`,3:`T-Direct`})[e]||`Route ${e}`,U=e=>e.transmitted?`text-accent-green`:`text-primary`,W=e=>e.drop_reason?`Dropped`:e.transmitted?`Forward`:`Received`,G=e=>e===1?`bg-badge-cyan-bg text-badge-cyan-text`:`bg-badge-neutral-bg text-badge-neutral-text`,K=e=>({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`})[e]||`bg-gray-500`,se=e=>({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`})[e]||`border-l-gray-500`,q=e=>!e.transmitted||!e.lbt_attempts||e.lbt_attempts===0?`bg-green-400`:e.lbt_attempts===1?`bg-cyan-400`:e.lbt_attempts===2?`bg-yellow-400`:`bg-orange-400`,J=e=>e>=1e3?(e/1e3).toFixed(2)+`s`:e.toFixed(1)+`ms`,ce=e=>{if(!e)return[];if(Array.isArray(e))return e;if(typeof e==`string`)try{let t=JSON.parse(e);return typeof t==`string`?JSON.parse(t):Array.isArray(t)?t:[]}catch{return[]}return[]},Y=e=>{let t=ce(e.original_path),n=ce(e.forwarded_path),r=t.length>0?t:n;return r.length===0?null:{hops:r.length-1,nodes:r.map(e=>e.toUpperCase())}},X=e=>{if(e.type!==4||!e.payload)return null;try{let t=e.payload.replace(/\s+/g,``).toUpperCase(),n=t,r=0;if(t.length/2>=100)if(t.length>200)n=t.slice(200),r=0;else return null;if(n.length>=2){let e=parseInt(n.slice(0,2),16);r+=2;let t=!!(e&16),i=!!(e&32),a=!!(e&64);if(!(e&128))return null;if(t&&n.length>=r+16&&(r+=16),i&&n.length>=r+4&&(r+=4),a&&n.length>=r+4&&(r+=4),n.length>r){let e=(n.slice(r).match(/.{2}/g)||[]).map(e=>{let t=parseInt(e,16);return t>=32&&t<=126?String.fromCharCode(t):`.`}).join(``).replace(/\.*$/,``);return e.length>0?e:null}}}catch(e){console.error(`Error parsing ADVERT node name:`,e)}return null},le=()=>{N.value=`all`,P.value=`all`,L.value=!1,R.value=null,o.value=1},ue=()=>{L.value?(L.value=!1,R.value=null):(L.value=!0,R.value=Date.now()/1e3),o.value=1},de=v(()=>R.value?new Date(R.value*1e3).toLocaleTimeString(void 0,{hour12:!0}):``),fe=async e=>{try{let t=e||l.value;await r.fetchRecentPackets({limit:t})}catch(e){console.error(`Error fetching packet data:`,e)}},pe=async()=>{if(!(d.value||l.value>=$)){d.value=!0;try{let e=Math.min(l.value+200,$);l.value=e,await fe(e)}catch(e){console.error(`Error loading more records:`,e)}finally{d.value=!1}}};return n(()=>{a.ensure(`recentPackets`)}),C(()=>{y&&clearTimeout(y)}),(e,n)=>(m(),S(b,null,[x(`div`,Zn,[x(`div`,Qn,[x(`div`,$n,[n[7]||=x(`h3`,{class:`text-content-primary dark:text-content-primary text-xl font-semibold`},` Recent Packets `,-1),x(`span`,er,` (`+t(z.value.length)+` of `+t(_(r).recentPackets.length)+`) `,1),L.value?(m(),S(`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 ${de.value}`},[x(`span`,nr,`Live Mode (since `+t(de.value)+`)`,1),n[6]||=x(`span`,{class:`sm:hidden`},`Live`,-1)],8,tr)):h(``,!0),_(r).error?(m(),S(`span`,rr,t(_(r).error),1)):h(``,!0)]),x(`div`,ir,[x(`div`,ar,[n[8]||=x(`label`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},`Type`,-1),s(x(`select`,{"onUpdate:modelValue":n[0]||=e=>N.value=e,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`},[(m(),S(b,null,p(ee,e=>x(`option`,{key:e,value:e,class:`bg-surface dark:bg-surface-elevated text-content-primary dark:text-content-primary`},t(e===`all`?`All Types`:`Type ${e} (${V(parseInt(e))})`),9,or)),64))],512),[[j,N.value]])]),x(`div`,sr,[n[9]||=x(`label`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},`Route`,-1),s(x(`select`,{"onUpdate:modelValue":n[1]||=e=>P.value=e,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`},[(m(),S(b,null,p(te,e=>x(`option`,{key:e,value:e,class:`bg-surface dark:bg-surface-elevated text-content-primary dark:text-content-primary`},t(e===`all`?`All Routes`:`Route ${e} (${H(parseInt(e))})`),9,cr)),64))],512),[[j,P.value]])]),x(`div`,lr,[n[10]||=x(`label`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},`Filter`,-1),x(`button`,{onClick:ue,class:w([`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":L.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":!L.value}])},t(L.value?`New Only`:`Show New`),3)]),x(`div`,ur,[n[11]||=x(`label`,{class:`text-transparent text-xs mb-1`},`.`,-1),x(`button`,{onClick:le,class:w([`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":N.value===`all`&&P.value===`all`&&!L.value,"hover:bg-primary/10":N.value!==`all`||P.value!==`all`||L.value}]),disabled:N.value===`all`&&P.value===`all`&&!L.value},` Reset `,10,dr)])])]),n[25]||=u(``,1),x(`div`,fr,[x(`div`,pr,[(m(!0),S(b,null,p(ne.value,(e,r)=>(m(),S(`div`,{key:`${e.packet_hash}_${e.timestamp}_${r}`,class:w([`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`,se(e.type)]),onClick:t=>A(e)},[x(`div`,hr,[x(`div`,gr,t(oe(e.timestamp)),1),x(`div`,_r,[x(`div`,{class:w([`w-2 h-2 rounded-full`,K(e.type)])},null,2),x(`div`,vr,[x(`span`,yr,t(V(e.type)),1),e.type===4&&X(e)?(m(),S(`span`,{key:0,class:`text-accent-red/70 text-[10px] font-medium max-w-[80px] truncate`,title:X(e)||void 0},t(X(e)),9,br)):h(``,!0)])]),x(`div`,xr,[x(`span`,{class:w([`inline-block px-2 py-1 rounded text-xs font-medium`,G(e.route)])},t(H(e.route)),3)]),x(`div`,Sr,t(e.length)+`B `,1),x(`div`,Cr,[x(`div`,wr,[Y(e)?(m(),S(`div`,Tr,[(m(!0),S(b,null,p(Y(e).nodes,(r,i)=>(m(),S(b,{key:i},[x(`span`,{class:w([`inline-block max-w-full truncate px-1.5 py-0.5 rounded text-[9px] font-mono font-semibold leading-tight tracking-tight`,i===0?`bg-badge-cyan-bg text-badge-cyan-text`:`bg-gray-500/20 text-content-muted dark:text-content-muted`]),title:r},t(r),11,Er),i0?(m(),S(`span`,Or,` (`+t(Y(e).hops)+` hop`+t(Y(e).hops>1?`s`:``)+`) `,1)):h(``,!0)])):(m(),S(`div`,kr,[x(`span`,Ar,t(e.src_hash?.slice(-4).toUpperCase()||`????`),1),n[13]||=x(`svg`,{class:`w-3 h-3 text-content-muted dark:text-content-muted/60`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2.5`,d:`M9 5l7 7-7 7`})],-1),x(`span`,{class:w([`inline-block px-2 py-0.5 rounded text-xs font-mono`,e.dst_hash?`bg-badge-cyan-bg text-badge-cyan-text`:`bg-yellow-500/20 text-yellow-700 dark:text-yellow-300`])},t(e.dst_hash?e.dst_hash.slice(-4).toUpperCase():`BCAST`),3)]))])]),x(`div`,jr,t(e.rssi==null?`N/A`:e.rssi.toFixed(0)+` dBm`),1),x(`div`,Mr,t(e.snr==null?`N/A`:e.snr.toFixed(1)+`dB`),1),x(`div`,Nr,t(e.score==null?`N/A`:e.score.toFixed(2)),1),x(`div`,Pr,[Number(e.tx_delay_ms)>0?(m(),S(`div`,Fr,[e.transmitted?(m(),S(`div`,{key:0,class:w([`w-1.5 h-1.5 rounded-full flex-shrink-0`,q(e)])},null,2)):h(``,!0),x(`span`,null,t(J(Number(e.tx_delay_ms))),1)])):h(``,!0)]),x(`div`,Ir,[x(`div`,null,[x(`span`,{class:w([`text-xs font-medium`,U(e)])},t(W(e)),3),e.drop_reason?(m(),S(`p`,Lr,t(e.drop_reason),1)):h(``,!0)])])]),x(`div`,Rr,[x(`div`,zr,[x(`div`,Br,[x(`div`,{class:w([`w-2 h-2 rounded-full flex-shrink-0`,K(e.type)])},null,2),x(`div`,Vr,[x(`span`,Hr,t(V(e.type)),1),e.type===4&&X(e)?(m(),S(`span`,{key:0,class:`text-accent-red/70 text-[10px] font-medium leading-tight`,title:X(e)||void 0},t(X(e)),9,Ur)):h(``,!0)]),x(`span`,{class:w([`inline-block px-2 py-1 rounded text-xs font-medium ml-2`,G(e.route)])},t(H(e.route)),3)]),x(`div`,Wr,[x(`span`,Gr,t(oe(e.timestamp)),1),x(`span`,{class:w([`text-xs font-medium`,U(e)])},t(W(e)),3)])]),x(`div`,Kr,[x(`div`,qr,[Y(e)?(m(),S(`div`,Jr,[n[15]||=x(`span`,{class:`text-content-muted dark:text-content-muted text-[10px] font-medium`},`PATH`,-1),(m(!0),S(b,null,p(Y(e).nodes,(r,i)=>(m(),S(b,{key:i},[x(`span`,{class:w([`inline-block max-w-full truncate px-1.5 py-0.5 rounded text-[9px] font-mono font-semibold leading-tight tracking-tight`,i===0?`bg-badge-cyan-bg text-badge-cyan-text`:`bg-gray-500/20 text-content-muted dark:text-content-muted`]),title:r},t(r),11,Yr),i0?(m(),S(`span`,Zr,` (`+t(Y(e).hops)+` hop`+t(Y(e).hops>1?`s`:``)+`) `,1)):h(``,!0)])):(m(),S(b,{key:1},[x(`div`,Qr,[n[16]||=x(`span`,{class:`text-content-muted dark:text-content-muted text-[10px] font-medium`},`SRC`,-1),x(`span`,$r,t(e.src_hash?.slice(-4)||`????`),1)]),x(`div`,ei,[n[18]||=x(`svg`,{class:`w-3 h-3`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2.5`,d:`M9 5l7 7-7 7`})],-1),e.route===1?(m(),S(`span`,ti,[...n[17]||=[x(`svg`,{class:`w-2.5 h-2.5 inline`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M13 5l7 7-7 7M5 5l7 7-7 7`})],-1)]])):h(``,!0)]),x(`div`,ni,[x(`span`,{class:w([`inline-block px-2 py-0.5 rounded text-xs font-mono font-semibold`,e.dst_hash?`bg-badge-cyan-bg text-badge-cyan-text`:`bg-yellow-500/20 text-yellow-700 dark:text-yellow-300`])},t(e.dst_hash?e.dst_hash.slice(-4).toUpperCase():`BCAST`),3),n[19]||=x(`span`,{class:`text-content-muted dark:text-content-muted text-[10px] font-medium`},`DST`,-1)])],64))]),x(`div`,ri,[x(`div`,ii,[e.snr==null?h(``,!0):(m(),S(`div`,ai,[x(`div`,{class:w([`w-1 h-3 rounded-sm`,e.snr>=-10?`bg-green-400`:`bg-white/20`])},null,2),x(`div`,{class:w([`w-1 h-4 rounded-sm`,e.snr>=-5?`bg-green-400`:`bg-white/20`])},null,2),x(`div`,{class:w([`w-1 h-5 rounded-sm`,e.snr>=0?`bg-green-400`:`bg-white/20`])},null,2),x(`div`,{class:w([`w-1 h-6 rounded-sm`,e.snr>=10?`bg-green-400`:`bg-white/20`])},null,2)])),x(`span`,oi,t(e.rssi==null?`TX`:e.rssi.toFixed(0)+`dBm`),1)])])]),x(`div`,si,[x(`div`,ci,[x(`span`,null,t(e.length)+`B`,1),x(`span`,null,`SNR: `+t(e.snr==null?`N/A`:e.snr.toFixed(1)+`dB`),1),x(`span`,null,`Score: `+t(e.score==null?`N/A`:e.score.toFixed(2)),1)]),x(`div`,li,[Number(e.tx_delay_ms)>0?(m(),S(`span`,ui,[e.transmitted?(m(),S(`div`,{key:0,class:w([`w-1.5 h-1.5 rounded-full flex-shrink-0`,q(e)])},null,2)):h(``,!0),x(`span`,null,t(J(Number(e.tx_delay_ms))),1)])):h(``,!0)])]),e.drop_reason?(m(),S(`div`,di,t(e.drop_reason),1)):h(``,!0)])],10,mr))),128))])]),B.value>1?(m(),S(`div`,fi,[x(`div`,pi,[x(`span`,mi,` Showing `+t((o.value-1)*Q+1)+` - `+t(Math.min(o.value*Q,z.value.length))+` of `+t(z.value.length)+` packets `,1),ae.value?(m(),S(`div`,hi,[n[20]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-xs`},`•`,-1),x(`button`,{onClick:pe,disabled:d.value,class:w([`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":!d.value,"text-content-secondary dark:text-content-muted border-stroke-subtle dark:border-stroke cursor-not-allowed opacity-50":d.value}])},t(d.value?`Loading...`:`Load ${Math.min(200,$-l.value)} more`),11,gi),x(`span`,_i,`(`+t(l.value)+`/`+t($)+` max)`,1)])):h(``,!0)]),x(`div`,vi,[x(`button`,{onClick:n[2]||=e=>--o.value,disabled:o.value<=1,class:w([`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":o.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":o.value>1}])},[...n[21]||=[x(`span`,{class:`hidden sm:inline`},`Previous`,-1),x(`span`,{class:`sm:hidden`},`‹`,-1)]],10,yi),x(`div`,bi,[o.value>3?(m(),S(`button`,{key:0,onClick:n[3]||=e=>o.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 `)):h(``,!0),o.value>4?(m(),S(`span`,xi,`...`)):h(``,!0),(m(!0),S(b,null,p(Array.from({length:Math.min(5,B.value)},(e,t)=>Math.max(1,Math.min(o.value-2,B.value-4))+t).filter(e=>e<=B.value),e=>(m(),S(`button`,{key:e,onClick:t=>o.value=e,class:w([`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":o.value===e,"border-stroke-subtle dark:border-stroke text-content-primary dark:text-content-primary hover:border-primary hover:text-primary hover:bg-primary/5":o.value!==e}])},t(e),11,Si))),128)),o.valueo.value=B.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`},t(B.value),1)):h(``,!0)]),x(`button`,{onClick:n[5]||=e=>o.value+=1,disabled:o.value>=B.value,class:w([`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":o.value>=B.value,"border-stroke-subtle dark:border-stroke text-content-primary dark:text-content-primary hover:border-primary hover:text-primary hover:bg-primary/5":o.value(m(),S(`div`,null,[g(se),x(`div`,Mi,[g(Ne),g(_e)]),g(ji)]))}});export{Ni as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/GPSDiagnostics-puRIblTp.js b/repeater/web/html/assets/GPSDiagnostics-CqIZmMKR.js similarity index 71% rename from repeater/web/html/assets/GPSDiagnostics-puRIblTp.js rename to repeater/web/html/assets/GPSDiagnostics-CqIZmMKR.js index b3608a7..4c6646d 100644 --- a/repeater/web/html/assets/GPSDiagnostics-puRIblTp.js +++ b/repeater/web/html/assets/GPSDiagnostics-CqIZmMKR.js @@ -1,4 +1,4 @@ -import{Ct as e,D as t,E as n,R as r,S as i,St as a,V as o,Y as s,g as c,j as l,k as u,l as d,o as f,p,r as m,s as h,u as g,w as _,xt as v}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{l as y,t as b}from"./api-DBiYn0RS.js";import{t as x}from"./_plugin-vue_export-helper-TcpyXLsZ.js";import{m as S}from"./index-CG181k2K.js";var C={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},w={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},T=1e3,E=1001,D=1002,O=1003,k=1004,A=1005,j=1006,ee=1007,te=1008,ne=1009,M=1010,N=1011,re=1012,ie=1013,ae=1014,oe=1015,P=1016,se=1017,ce=1018,le=1020,ue=35902,de=35899,fe=1021,pe=1022,me=1023,he=1026,ge=1027,_e=1028,ve=1029,ye=1030,be=1031,xe=1033,F=33776,Se=33777,Ce=33778,we=33779,Te=35840,Ee=35841,De=35842,Oe=35843,ke=36196,I=37492,Ae=37496,L=37488,je=37489,R=37490,z=37491,B=37808,V=37809,Me=37810,Ne=37811,Pe=37812,Fe=37813,Ie=37814,Le=37815,Re=37816,ze=37817,Be=37818,Ve=37819,He=37820,Ue=37821,We=36492,Ge=36494,Ke=36495,qe=36283,Je=36284,Ye=36285,Xe=36286,Ze=2300,Qe=2301,$e=2302,et=2303,tt=2400,nt=2401,rt=2402,it=3200,at=`srgb`,ot=`srgb-linear`,st=`linear`,ct=`srgb`,lt=7680,ut=35044,dt=35048,ft=2e3;function pt(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function mt(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ht(e){return document.createElementNS(`http://www.w3.org/1999/xhtml`,e)}function gt(){let e=ht(`canvas`);return e.style.display=`block`,e}var _t={},vt=null;function yt(...e){let t=`THREE.`+e.shift();vt?vt(`log`,t,...e):console.log(t,...e)}function bt(e){let t=e[0];if(typeof t==`string`&&t.startsWith(`TSL:`)){let t=e[1];t&&t.isStackTrace?e[0]+=` `+t.getLocation():e[1]=`Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.`}return e}function H(...e){e=bt(e);let t=`THREE.`+e.shift();if(vt)vt(`warn`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.warn(n.getError(t)):console.warn(t,...e)}}function U(...e){e=bt(e);let t=`THREE.`+e.shift();if(vt)vt(`error`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.error(n.getError(t)):console.error(t,...e)}}function xt(...e){let t=e.join(` `);t in _t||(_t[t]=!0,H(...e))}function St(e,t,n){return new Promise(function(r,i){function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}}setTimeout(a,n)})}var Ct={0:1,2:6,4:7,3:5,1:0,6:2,7:4,5:3},wt=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n>8&255]+Tt[e>>16&255]+Tt[e>>24&255]+`-`+Tt[t&255]+Tt[t>>8&255]+`-`+Tt[t>>16&15|64]+Tt[t>>24&255]+`-`+Tt[n&63|128]+Tt[n>>8&255]+`-`+Tt[n>>16&255]+Tt[n>>24&255]+Tt[r&255]+Tt[r>>8&255]+Tt[r>>16&255]+Tt[r>>24&255]).toLowerCase()}function W(e,t,n){return Math.max(t,Math.min(n,e))}function At(e,t){return(e%t+t)%t}function jt(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)}function Mt(e,t,n){return e===t?0:(n-e)/(t-e)}function Nt(e,t,n){return(1-n)*e+n*t}function Pt(e,t,n,r){return Nt(e,t,1-Math.exp(-n*r))}function Ft(e,t=1){return t-Math.abs(At(e,t*2)-t)}function It(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))}function Lt(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))}function Rt(e,t){return e+Math.floor(Math.random()*(t-e+1))}function zt(e,t){return e+Math.random()*(t-e)}function Bt(e){return e*(.5-Math.random())}function Vt(e){e!==void 0&&(Et=e);let t=Et+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Ht(e){return e*Dt}function Ut(e){return e*Ot}function Wt(e){return(e&e-1)==0&&e!==0}function Gt(e){return 2**Math.ceil(Math.log(e)/Math.LN2)}function Kt(e){return 2**Math.floor(Math.log(e)/Math.LN2)}function qt(e,t,n,r,i){let a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),d=a((t-r)/2),f=o((t-r)/2),p=a((r-t)/2),m=o((r-t)/2);switch(i){case`XYX`:e.set(s*u,c*d,c*f,s*l);break;case`YZY`:e.set(c*f,s*u,c*d,s*l);break;case`ZXZ`:e.set(c*d,c*f,s*u,s*l);break;case`XZX`:e.set(s*u,c*m,c*p,s*l);break;case`YXY`:e.set(c*p,s*u,c*m,s*l);break;case`ZYZ`:e.set(c*m,c*p,s*u,s*l);break;default:H(`MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: `+i)}}function Jt(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error(`Invalid component type.`)}}function G(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error(`Invalid component type.`)}}var Yt={DEG2RAD:Dt,RAD2DEG:Ot,generateUUID:kt,clamp:W,euclideanModulo:At,mapLinear:jt,inverseLerp:Mt,lerp:Nt,damp:Pt,pingpong:Ft,smoothstep:It,smootherstep:Lt,randInt:Rt,randFloat:zt,randFloatSpread:Bt,seededRandom:Vt,degToRad:Ht,radToDeg:Ut,isPowerOfTwo:Wt,ceilPowerOfTwo:Gt,floorPowerOfTwo:Kt,setQuaternionFromProperEuler:qt,normalize:G,denormalize:Jt},K=class e{static{e.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=W(this.x,e.x,t.x),this.y=W(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=W(this.x,e,t),this.y=W(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(W(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(W(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Xt=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,a,o){let s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(u!==m||s!==d||c!==f||l!==p){let e=s*d+c*f+l*p+u*m;e<0&&(d=-d,f=-f,p=-p,m=-m,e=-e);let t=1-o;if(e<.9995){let n=Math.acos(e),r=Math.sin(n);t=Math.sin(t*n)/r,o=Math.sin(o*n)/r,s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o}else{s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o;let e=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=e,c*=e,l*=e,u*=e}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,a){let o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:H(`Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(l-s)*e,this._y=(i-c)*e,this._z=(a-r)*e}else if(n>o&&n>u){let e=2*Math.sqrt(1+n-o-u);this._w=(l-s)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+c)/e}else if(o>u){let e=2*Math.sqrt(1+o-n-u);this._w=(i-c)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(s+l)/e}else{let e=2*Math.sqrt(1+u-n-o);this._w=(a-r)/e,this._x=(i+c)/e,this._y=(s+l)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(W(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,r=-r,i=-i,a=-a,o=-o);let s=1-t;if(o<.9995){let e=Math.acos(o),c=Math.sin(e);s=Math.sin(s*e)/c,t=Math.sin(t*e)/c,this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this._onChangeCallback()}else this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},q=class e{static{e.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Qt.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Qt.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=2*(a*r-o*n),l=2*(o*t-i*r),u=2*(i*n-a*t);return this.x=t+s*c+a*u-o*l,this.y=n+s*l+o*c-i*u,this.z=r+s*u+i*l-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=W(this.x,e.x,t.x),this.y=W(this.y,e.y,t.y),this.z=W(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=W(this.x,e,t),this.y=W(this.y,e,t),this.z=W(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(W(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Zt.copy(this).projectOnVector(e),this.sub(Zt)}reflect(e){return this.sub(Zt.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(W(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Zt=new q,Qt=new Xt,J=class e{static{e.prototype.isMatrix3=!0}constructor(e,t,n,r,i,a,o,s,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,i,a,o,s,c)}set(e,t,n,r,i,a,o,s,c){let l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=l*a-o*c,d=o*s-l*i,f=c*i-a*s,p=t*u+n*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return e[0]=u*m,e[1]=(r*c-l*n)*m,e[2]=(o*n-r*a)*m,e[3]=d*m,e[4]=(l*t-r*s)*m,e[5]=(r*i-o*t)*m,e[6]=f*m,e[7]=(n*s-c*t)*m,e[8]=(a*t-n*i)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,o){let s=Math.cos(i),c=Math.sin(i);return this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply($t.makeScale(e,t)),this}rotate(e){return this.premultiply($t.makeRotation(-e)),this}translate(e,t){return this.premultiply($t.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}},$t=new J,en=new J().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),tn=new J().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function nn(){let e={enabled:!0,workingColorSpace:ot,spaces:{},convert:function(e,t,n){return this.enabled===!1||t===n||!t||!n?e:(this.spaces[t].transfer===`srgb`&&(e.r=rn(e.r),e.g=rn(e.g),e.b=rn(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===`srgb`&&(e.r=an(e.r),e.g=an(e.g),e.b=an(e.b)),e)},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===``?st:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||`standard`},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return xt(`ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().`),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return xt(`ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().`),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[ot]:{primaries:t,whitePoint:r,transfer:st,toXYZ:en,fromXYZ:tn,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:at},outputColorSpaceConfig:{drawingBufferColorSpace:at}},[at]:{primaries:t,whitePoint:r,transfer:ct,toXYZ:en,fromXYZ:tn,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:at}}}),e}var Y=nn();function rn(e){return e<.04045?e*.0773993808:(e*.9478672986+.0521327014)**2.4}function an(e){return e<.0031308?e*12.92:1.055*e**.41666-.055}var on,sn=class{static getDataURL(e,t=`image/png`){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>`u`)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{on===void 0&&(on=ht(`canvas`)),on.width=e.width,on.height=e.height;let t=on.getContext(`2d`);e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=on}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){let t=ht(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(fn).x}get height(){return this.source.getSize(fn).y}get depth(){return this.source.getSize(fn).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){H(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){H(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:`dispose`})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case T:e.x-=Math.floor(e.x);break;case E:e.x=e.x<0?0:1;break;case D:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case T:e.y-=Math.floor(e.y);break;case E:e.y=e.y<0?0:1;break;case D:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};pn.DEFAULT_IMAGE=null,pn.DEFAULT_MAPPING=300,pn.DEFAULT_ANISOTROPY=1;var mn=class e{static{e.prototype.isVector4=!0}constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w===void 0?1:e.w,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)s&&e>_?e_?s1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type=`BatchedMesh`,r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(t!==void 0&&t.shapes!==void 0){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t0){r.children=[];for(let t=0;t0){r.animations=[];for(let t=0;t0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l),u.length>0&&(n.nodes=u)}return n.object=r,n;function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot===null?null:e.pivot.clone(),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let t=0;ts+l?(c.inputState.pinching=!1,this.dispatchEvent({type:`pinchend`,handedness:e.handedness,target:this})):!c.inputState.pinching&&o<=s-l&&(c.inputState.pinching=!0,this.dispatchEvent({type:`pinchstart`,handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,s.eventsEnabled&&s.dispatchEvent({type:`gripUpdated`,data:e,target:this})));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&i!==null&&(r=i),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Jn)))}return o!==null&&(o.visible=r!==null),s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new qn;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},Xn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Zn={h:0,s:0,l:0},Qn={h:0,s:0,l:0};function $n(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}var X=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let t=e;t&&t.isColor?this.copy(t):typeof t==`number`?this.setHex(t):typeof t==`string`&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=at){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Y.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=Y.workingColorSpace){return this.r=e,this.g=t,this.b=n,Y.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=Y.workingColorSpace){if(e=At(e,1),t=W(t,0,1),n=W(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=$n(i,r,e+1/3),this.g=$n(i,r,e),this.b=$n(i,r,e-1/3)}return Y.colorSpaceToWorking(this,r),this}setStyle(e,t=at){function n(t){t!==void 0&&parseFloat(t)<1&&H(`Color: Alpha component of `+e+` will be ignored.`)}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=r[1],o=r[2];switch(a){case`rgb`:case`rgba`:if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case`hsl`:case`hsla`:if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:H(`Color: Unknown color model `+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=r[1],i=n.length;if(i===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(i===6)return this.setHex(parseInt(n,16),t);H(`Color: Invalid hex color `+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=at){let n=Xn[e.toLowerCase()];return n===void 0?H(`Color: Unknown color `+e):this.setHex(n,t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=rn(e.r),this.g=rn(e.g),this.b=rn(e.b),this}copyLinearToSRGB(e){return this.r=an(e.r),this.g=an(e.g),this.b=an(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=at){return Y.workingToColorSpace(er.copy(this),e),Math.round(W(er.r*255,0,255))*65536+Math.round(W(er.g*255,0,255))*256+Math.round(W(er.b*255,0,255))}getHexString(e=at){return(`000000`+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Y.workingColorSpace){Y.workingToColorSpace(er.copy(this),t);let n=er.r,r=er.g,i=er.b,a=Math.max(n,r,i),o=Math.min(n,r,i),s,c,l=(o+a)/2;if(o===a)s=0,c=0;else{let e=a-o;switch(c=l<=.5?e/(a+o):e/(2-a-o),a){case n:s=(r-i)/e+(r0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},nr=new q,rr=new q,ir=new q,ar=new q,or=new q,sr=new q,cr=new q,lr=new q,ur=new q,dr=new q,fr=new mn,pr=new mn,mr=new mn,hr=class e{constructor(e=new q,t=new q,n=new q){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),nr.subVectors(e,t),r.cross(nr);let i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){nr.subVectors(r,t),rr.subVectors(n,t),ir.subVectors(e,t);let a=nr.dot(nr),o=nr.dot(rr),s=nr.dot(ir),c=rr.dot(rr),l=rr.dot(ir),u=a*c-o*o;if(u===0)return i.set(0,0,0),null;let d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,ar)===null?!1:ar.x>=0&&ar.y>=0&&ar.x+ar.y<=1}static getInterpolation(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,ar)===null?(s.x=0,s.y=0,`z`in s&&(s.z=0),`w`in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(i,ar.x),s.addScaledVector(a,ar.y),s.addScaledVector(o,ar.z),s)}static getInterpolatedAttribute(e,t,n,r,i,a){return fr.setScalar(0),pr.setScalar(0),mr.setScalar(0),fr.fromBufferAttribute(e,t),pr.fromBufferAttribute(e,n),mr.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(fr,i.x),a.addScaledVector(pr,i.y),a.addScaledVector(mr,i.z),a}static isFrontFacing(e,t,n,r){return nr.subVectors(n,t),rr.subVectors(e,t),nr.cross(rr).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return nr.subVectors(this.c,this.b),rr.subVectors(this.a,this.b),nr.cross(rr).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return e.getNormal(this.a,this.b,this.c,t)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}getInterpolation(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}containsPoint(t){return e.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return e.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,i=this.c,a,o;or.subVectors(r,n),sr.subVectors(i,n),lr.subVectors(e,n);let s=or.dot(lr),c=sr.dot(lr);if(s<=0&&c<=0)return t.copy(n);ur.subVectors(e,r);let l=or.dot(ur),u=sr.dot(ur);if(l>=0&&u<=l)return t.copy(r);let d=s*u-l*c;if(d<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(or,a);dr.subVectors(e,i);let f=or.dot(dr),p=sr.dot(dr);if(p>=0&&f<=p)return t.copy(i);let m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(sr,o);let h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return cr.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(cr,o);let g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(or,a).addScaledVector(sr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},gr=class{constructor(e=new q(1/0,1/0,1/0),t=new q(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,vr),vr.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Er),Dr.subVectors(this.max,Er),br.subVectors(e.a,Er),xr.subVectors(e.b,Er),Sr.subVectors(e.c,Er),Cr.subVectors(xr,br),wr.subVectors(Sr,xr),Tr.subVectors(br,Sr);let t=[0,-Cr.z,Cr.y,0,-wr.z,wr.y,0,-Tr.z,Tr.y,Cr.z,0,-Cr.x,wr.z,0,-wr.x,Tr.z,0,-Tr.x,-Cr.y,Cr.x,0,-wr.y,wr.x,0,-Tr.y,Tr.x,0];return!Ar(t,br,xr,Sr,Dr)||(t=[1,0,0,0,1,0,0,0,1],!Ar(t,br,xr,Sr,Dr))?!1:(Or.crossVectors(Cr,wr),t=[Or.x,Or.y,Or.z],Ar(t,br,xr,Sr,Dr))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,vr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(vr).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(_r[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),_r[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),_r[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),_r[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),_r[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),_r[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),_r[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),_r[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(_r),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},_r=[new q,new q,new q,new q,new q,new q,new q,new q],vr=new q,yr=new gr,br=new q,xr=new q,Sr=new q,Cr=new q,wr=new q,Tr=new q,Er=new q,Dr=new q,Or=new q,kr=new q;function Ar(e,t,n,r,i){for(let a=0,o=e.length-3;a<=o;a+=3){kr.fromArray(e,a);let o=i.x*Math.abs(kr.x)+i.y*Math.abs(kr.y)+i.z*Math.abs(kr.z),s=t.dot(kr),c=n.dot(kr),l=r.dot(kr);if(Math.max(-Math.max(s,c,l),Math.min(s,c,l))>o)return!1}return!0}var jr=new q,Mr=new K,Nr=0,Pr=class extends wt{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.isBufferAttribute=!0,Object.defineProperty(this,`id`,{value:Nr++}),this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n,this.usage=ut,this.updateRanges=[],this.gpuType=oe,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;rthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;zr.subVectors(e,this.center);let t=zr.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(zr,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Br.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(zr.copy(e.center).add(Br)),this.expandByPoint(zr.copy(e.center).sub(Br))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},Hr=0,Ur=new yn,Wr=new Kn,Gr=new q,Kr=new gr,qr=new gr,Jr=new q,Yr=class e extends wt{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,`id`,{value:Hr++}),this.uuid=kt(),this.name=``,this.type=`BufferGeometry`,this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(pt(e)?Ir:Fr)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let t=new J().getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ur.makeRotationFromQuaternion(e),this.applyMatrix4(Ur),this}rotateX(e){return Ur.makeRotationX(e),this.applyMatrix4(Ur),this}rotateY(e){return Ur.makeRotationY(e),this.applyMatrix4(Ur),this}rotateZ(e){return Ur.makeRotationZ(e),this.applyMatrix4(Ur),this}translate(e,t,n){return Ur.makeTranslation(e,t,n),this.applyMatrix4(Ur),this}scale(e,t,n){return Ur.makeScale(e,t,n),this.applyMatrix4(Ur),this}lookAt(e){return Wr.lookAt(e),Wr.updateMatrix(),this.applyMatrix4(Wr.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Gr).negate(),this.translate(Gr.x,Gr.y,Gr.z),this}setFromPoints(e){let t=this.getAttribute(`position`);if(t===void 0){let t=[];for(let n=0,r=e.length;nt.count&&H(`BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.`),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new gr);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){U(`BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.`,this),this.boundingBox.set(new q(-1/0,-1/0,-1/0),new q(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e0&&(e.userData=this.userData),this.parameters!==void 0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){H(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){H(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,this.name!==``&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(n.blending=this.blending),this.side!==0&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==204&&(n.blendSrc=this.blendSrc),this.blendDst!==205&&(n.blendDst=this.blendDst),this.blendEquation!==100&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==3&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==519&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==7680&&(n.stencilFail=this.stencilFail),this.stencilZFail!==7680&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==7680&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==`round`&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==`round`&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let e=t.length;n=Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:`dispose`})}set needsUpdate(e){e===!0&&this.version++}},ti=class extends ei{constructor(e){super(),this.isSpriteMaterial=!0,this.type=`SpriteMaterial`,this.color=new X(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},ni,ri=new q,ii=new q,ai=new q,oi=new K,si=new K,ci=new yn,li=new q,ui=new q,di=new q,fi=new K,pi=new K,mi=new K,hi=class extends Kn{constructor(e=new ti){if(super(),this.isSprite=!0,this.type=`Sprite`,ni===void 0){ni=new Yr;let e=new Xr(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);ni.setIndex([0,1,2,0,2,3]),ni.setAttribute(`position`,new Qr(e,3,0,!1)),ni.setAttribute(`uv`,new Qr(e,2,3,!1))}this.geometry=ni,this.material=e,this.center=new K(.5,.5),this.count=1}raycast(e,t){e.camera===null&&U(`Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.`),ii.setFromMatrixScale(this.matrixWorld),ci.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),ai.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&ii.multiplyScalar(-ai.z);let n=this.material.rotation,r,i;n!==0&&(i=Math.cos(n),r=Math.sin(n));let a=this.center;gi(li.set(-.5,-.5,0),ai,a,ii,r,i),gi(ui.set(.5,-.5,0),ai,a,ii,r,i),gi(di.set(.5,.5,0),ai,a,ii,r,i),fi.set(0,0),pi.set(1,0),mi.set(1,1);let o=e.ray.intersectTriangle(li,ui,di,!1,ri);if(o===null&&(gi(ui.set(-.5,.5,0),ai,a,ii,r,i),pi.set(0,1),o=e.ray.intersectTriangle(li,di,ui,!1,ri),o===null))return;let s=e.ray.origin.distanceTo(ri);se.far||t.push({distance:s,point:ri.clone(),uv:hr.getInterpolation(ri,li,ui,di,fi,pi,mi,new K),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};function gi(e,t,n,r,i,a){oi.subVectors(e,n).addScalar(.5).multiply(r),i===void 0?si.copy(oi):(si.x=a*oi.x-i*oi.y,si.y=i*oi.x+a*oi.y),e.copy(t),e.x+=si.x,e.y+=si.y,e.applyMatrix4(ci)}var _i=new q,vi=new q,yi=new q,bi=new q,xi=new q,Si=new q,Ci=new q,wi=class{constructor(e=new q,t=new q(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,_i)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=_i.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(_i.copy(this.origin).addScaledVector(this.direction,t),_i.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){vi.copy(e).add(t).multiplyScalar(.5),yi.copy(t).sub(e).normalize(),bi.copy(this.origin).sub(vi);let i=e.distanceTo(t)*.5,a=-this.direction.dot(yi),o=bi.dot(this.direction),s=-bi.dot(yi),c=bi.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0)if(u=a*s-o,d=a*o-s,p=i*l,u>=0)if(d>=-p)if(d<=p){let e=1/l;u*=e,d*=e,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c);else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(vi).addScaledVector(yi,d),f}intersectSphere(e,t){_i.subVectors(e.center,this.origin);let n=_i.dot(this.direction),r=_i.dot(_i)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||isNaN(n))&&(n=i),(a=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,_i)!==null}intersectTriangle(e,t,n,r,i){xi.subVectors(t,e),Si.subVectors(n,e),Ci.crossVectors(xi,Si);let a=this.direction.dot(Ci),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;bi.subVectors(this.origin,e);let s=o*this.direction.dot(Si.crossVectors(bi,Si));if(s<0)return null;let c=o*this.direction.dot(xi.cross(bi));if(c<0||s+c>a)return null;let l=-o*bi.dot(Ci);return l<0?null:this.at(l/a,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Ti=class extends ei{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type=`MeshBasicMaterial`,this.color=new X(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new kn,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},Ei=new yn,Di=new wi,Oi=new Vr,ki=new q,Ai=new q,ji=new q,Mi=new q,Ni=new q,Pi=new q,Fi=new q,Ii=new q,Li=class extends Kn{constructor(e=new Yr,t=new Ti){super(),this.isMesh=!0,this.type=`Mesh`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e(e.far-e.near)**2))&&(Ei.copy(i).invert(),Di.copy(e.ray).applyMatrix4(Ei),!(n.boundingBox!==null&&Di.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Di)))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,c=i.attributes.uv,l=i.attributes.uv1,u=i.attributes.normal,d=i.groups,f=i.drawRange;if(o!==null)if(Array.isArray(a))for(let i=0,s=d.length;in.far?null:{distance:l,point:Ii.clone(),object:e}}function zi(e,t,n,r,i,a,o,s,c,l){e.getVertexPosition(s,Ai),e.getVertexPosition(c,ji),e.getVertexPosition(l,Mi);let u=Ri(e,t,n,r,Ai,ji,Mi,Fi);if(u){let e=new q;hr.getBarycoord(Fi,Ai,ji,Mi,e),i&&(u.uv=hr.getInterpolatedAttribute(i,s,c,l,e,new K)),a&&(u.uv1=hr.getInterpolatedAttribute(a,s,c,l,e,new K)),o&&(u.normal=hr.getInterpolatedAttribute(o,s,c,l,e,new q),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));let t={a:s,b:c,c:l,normal:new q,materialIndex:0};hr.getNormal(Ai,ji,Mi,t.normal),u.face=t,u.barycoord=e}return u}var Bi=class extends pn{constructor(e=null,t=1,n=1,r,i,a,o,s,c=O,l=O,u,d){super(null,a,o,s,c,l,r,i,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},Vi=new q,Hi=new q,Ui=new J,Wi=class{constructor(e=new q(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=Vi.subVectors(n,t).cross(Hi.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let r=e.delta(Vi),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/i;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||Ui.getNormalMatrix(e),r=this.coplanarPoint(Vi).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},Gi=new Vr,Ki=new K(.5,.5),qi=new q,Ji=class{constructor(e=new Wi,t=new Wi,n=new Wi,r=new Wi,i=new Wi,a=new Wi){this.planes=[e,t,n,r,i,a]}set(e,t,n,r,i,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=ft,n=!1){let r=this.planes,i=e.elements,a=i[0],o=i[1],s=i[2],c=i[3],l=i[4],u=i[5],d=i[6],f=i[7],p=i[8],m=i[9],h=i[10],g=i[11],_=i[12],v=i[13],y=i[14],b=i[15];if(r[0].setComponents(c-a,f-l,g-p,b-_).normalize(),r[1].setComponents(c+a,f+l,g+p,b+_).normalize(),r[2].setComponents(c+o,f+u,g+m,b+v).normalize(),r[3].setComponents(c-o,f-u,g-m,b-v).normalize(),n)r[4].setComponents(s,d,h,y).normalize(),r[5].setComponents(c-s,f-d,g-h,b-y).normalize();else if(r[4].setComponents(c-s,f-d,g-h,b-y).normalize(),t===2e3)r[5].setComponents(c+s,f+d,g+h,b+y).normalize();else if(t===2001)r[5].setComponents(s,d,h,y).normalize();else throw Error(`THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: `+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Gi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Gi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Gi)}intersectsSprite(e){return Gi.center.set(0,0,0),Gi.radius=.7071067811865476+Ki.distanceTo(e.center),Gi.applyMatrix4(e.matrixWorld),this.intersectsSphere(Gi)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,qi.y=r.normal.y>0?e.max.y:e.min.y,qi.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(qi)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},Yi=class extends ei{constructor(e){super(),this.isLineBasicMaterial=!0,this.type=`LineBasicMaterial`,this.color=new X(16777215),this.map=null,this.linewidth=1,this.linecap=`round`,this.linejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},Xi=new q,Zi=new q,Qi=new yn,$i=new wi,ea=new Vr,ta=new q,na=new q,ra=class extends Kn{constructor(e=new Yr,t=new Yi){super(),this.isLine=!0,this.type=`Line`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let e=1,r=t.count;e0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;er)return;ta.applyMatrix4(e.matrixWorld);let c=t.ray.origin.distanceTo(ta);if(!(ct.far))return{distance:c,point:na.clone().applyMatrix4(e.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:e}}var aa=class extends pn{constructor(e=[],t=301,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,s,c,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},oa=class extends pn{constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r,i,a,o,s,c),this.isCanvasTexture=!0,this.needsUpdate=!0}},sa=class extends pn{constructor(e,t,n=ae,r,i,a,o=O,s=O,c,l=he,u=1){if(l!==1026&&l!==1027)throw Error(`DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat`);super({width:e,height:t,depth:u},r,i,a,o,s,l,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new ln(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},ca=class extends sa{constructor(e,t=ae,n=301,r,i,a=O,o=O,s,c=he){let l={width:e,height:e,depth:1},u=[l,l,l,l,l,l];super(e,e,t,n,r,i,a,o,s,c),this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},la=class extends pn{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},ua=class e extends Yr{constructor(e=1,t=1,n=1,r=1,i=1,a=1){super(),this.type=`BoxGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let o=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);let s=[],c=[],l=[],u=[],d=0,f=0;p(`z`,`y`,`x`,-1,-1,n,t,e,a,i,0),p(`z`,`y`,`x`,1,-1,n,t,-e,a,i,1),p(`x`,`z`,`y`,1,1,e,n,t,r,a,2),p(`x`,`z`,`y`,1,-1,e,n,-t,r,a,3),p(`x`,`y`,`z`,1,-1,e,t,n,r,i,4),p(`x`,`y`,`z`,-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute(`position`,new Lr(c,3)),this.setAttribute(`normal`,new Lr(l,3)),this.setAttribute(`uv`,new Lr(u,2));function p(e,t,n,r,i,a,p,m,h,g,_){let v=a/h,y=p/g,b=a/2,x=p/2,S=m/2,C=h+1,w=g+1,T=0,E=0,D=new q;for(let a=0;a0?1:-1,l.push(D.x,D.y,D.z),u.push(s/h),u.push(1-a/g),T+=1}for(let e=0;e0)&&f.push(t,i,c),(e!==n-1||s=0;--t)if(e[t]>=65535)return!0;return!1}function mt(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ht(e){return document.createElementNS(`http://www.w3.org/1999/xhtml`,e)}function gt(){let e=ht(`canvas`);return e.style.display=`block`,e}var _t={},vt=null;function yt(...e){let t=`THREE.`+e.shift();vt?vt(`log`,t,...e):console.log(t,...e)}function bt(e){let t=e[0];if(typeof t==`string`&&t.startsWith(`TSL:`)){let t=e[1];t&&t.isStackTrace?e[0]+=` `+t.getLocation():e[1]=`Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.`}return e}function H(...e){e=bt(e);let t=`THREE.`+e.shift();if(vt)vt(`warn`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.warn(n.getError(t)):console.warn(t,...e)}}function U(...e){e=bt(e);let t=`THREE.`+e.shift();if(vt)vt(`error`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.error(n.getError(t)):console.error(t,...e)}}function xt(...e){let t=e.join(` `);t in _t||(_t[t]=!0,H(...e))}function St(e,t,n){return new Promise(function(r,i){function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}}setTimeout(a,n)})}var Ct={0:1,2:6,4:7,3:5,1:0,6:2,7:4,5:3},wt=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n>8&255]+Tt[e>>16&255]+Tt[e>>24&255]+`-`+Tt[t&255]+Tt[t>>8&255]+`-`+Tt[t>>16&15|64]+Tt[t>>24&255]+`-`+Tt[n&63|128]+Tt[n>>8&255]+`-`+Tt[n>>16&255]+Tt[n>>24&255]+Tt[r&255]+Tt[r>>8&255]+Tt[r>>16&255]+Tt[r>>24&255]).toLowerCase()}function W(e,t,n){return Math.max(t,Math.min(n,e))}function At(e,t){return(e%t+t)%t}function jt(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)}function Mt(e,t,n){return e===t?0:(n-e)/(t-e)}function Nt(e,t,n){return(1-n)*e+n*t}function Pt(e,t,n,r){return Nt(e,t,1-Math.exp(-n*r))}function Ft(e,t=1){return t-Math.abs(At(e,t*2)-t)}function It(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))}function Lt(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))}function Rt(e,t){return e+Math.floor(Math.random()*(t-e+1))}function zt(e,t){return e+Math.random()*(t-e)}function Bt(e){return e*(.5-Math.random())}function Vt(e){e!==void 0&&(Et=e);let t=Et+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Ht(e){return e*Dt}function Ut(e){return e*Ot}function Wt(e){return(e&e-1)==0&&e!==0}function Gt(e){return 2**Math.ceil(Math.log(e)/Math.LN2)}function Kt(e){return 2**Math.floor(Math.log(e)/Math.LN2)}function qt(e,t,n,r,i){let a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),d=a((t-r)/2),f=o((t-r)/2),p=a((r-t)/2),m=o((r-t)/2);switch(i){case`XYX`:e.set(s*u,c*d,c*f,s*l);break;case`YZY`:e.set(c*f,s*u,c*d,s*l);break;case`ZXZ`:e.set(c*d,c*f,s*u,s*l);break;case`XZX`:e.set(s*u,c*m,c*p,s*l);break;case`YXY`:e.set(c*p,s*u,c*m,s*l);break;case`ZYZ`:e.set(c*m,c*p,s*u,s*l);break;default:H(`MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: `+i)}}function Jt(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error(`Invalid component type.`)}}function G(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error(`Invalid component type.`)}}var Yt={DEG2RAD:Dt,RAD2DEG:Ot,generateUUID:kt,clamp:W,euclideanModulo:At,mapLinear:jt,inverseLerp:Mt,lerp:Nt,damp:Pt,pingpong:Ft,smoothstep:It,smootherstep:Lt,randInt:Rt,randFloat:zt,randFloatSpread:Bt,seededRandom:Vt,degToRad:Ht,radToDeg:Ut,isPowerOfTwo:Wt,ceilPowerOfTwo:Gt,floorPowerOfTwo:Kt,setQuaternionFromProperEuler:qt,normalize:G,denormalize:Jt},K=class e{static{e.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=W(this.x,e.x,t.x),this.y=W(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=W(this.x,e,t),this.y=W(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(W(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(W(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Xt=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,a,o){let s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(u!==m||s!==d||c!==f||l!==p){let e=s*d+c*f+l*p+u*m;e<0&&(d=-d,f=-f,p=-p,m=-m,e=-e);let t=1-o;if(e<.9995){let n=Math.acos(e),r=Math.sin(n);t=Math.sin(t*n)/r,o=Math.sin(o*n)/r,s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o}else{s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o;let e=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=e,c*=e,l*=e,u*=e}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,a){let o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:H(`Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(l-s)*e,this._y=(i-c)*e,this._z=(a-r)*e}else if(n>o&&n>u){let e=2*Math.sqrt(1+n-o-u);this._w=(l-s)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+c)/e}else if(o>u){let e=2*Math.sqrt(1+o-n-u);this._w=(i-c)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(s+l)/e}else{let e=2*Math.sqrt(1+u-n-o);this._w=(a-r)/e,this._x=(i+c)/e,this._y=(s+l)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(W(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,r=-r,i=-i,a=-a,o=-o);let s=1-t;if(o<.9995){let e=Math.acos(o),c=Math.sin(e);s=Math.sin(s*e)/c,t=Math.sin(t*e)/c,this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this._onChangeCallback()}else this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},q=class e{static{e.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Qt.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Qt.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=2*(a*r-o*n),l=2*(o*t-i*r),u=2*(i*n-a*t);return this.x=t+s*c+a*u-o*l,this.y=n+s*l+o*c-i*u,this.z=r+s*u+i*l-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=W(this.x,e.x,t.x),this.y=W(this.y,e.y,t.y),this.z=W(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=W(this.x,e,t),this.y=W(this.y,e,t),this.z=W(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(W(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Zt.copy(this).projectOnVector(e),this.sub(Zt)}reflect(e){return this.sub(Zt.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(W(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Zt=new q,Qt=new Xt,J=class e{static{e.prototype.isMatrix3=!0}constructor(e,t,n,r,i,a,o,s,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,i,a,o,s,c)}set(e,t,n,r,i,a,o,s,c){let l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=l*a-o*c,d=o*s-l*i,f=c*i-a*s,p=t*u+n*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return e[0]=u*m,e[1]=(r*c-l*n)*m,e[2]=(o*n-r*a)*m,e[3]=d*m,e[4]=(l*t-r*s)*m,e[5]=(r*i-o*t)*m,e[6]=f*m,e[7]=(n*s-c*t)*m,e[8]=(a*t-n*i)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,o){let s=Math.cos(i),c=Math.sin(i);return this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply($t.makeScale(e,t)),this}rotate(e){return this.premultiply($t.makeRotation(-e)),this}translate(e,t){return this.premultiply($t.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}},$t=new J,en=new J().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),tn=new J().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function nn(){let e={enabled:!0,workingColorSpace:ot,spaces:{},convert:function(e,t,n){return this.enabled===!1||t===n||!t||!n?e:(this.spaces[t].transfer===`srgb`&&(e.r=rn(e.r),e.g=rn(e.g),e.b=rn(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===`srgb`&&(e.r=an(e.r),e.g=an(e.g),e.b=an(e.b)),e)},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===``?st:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||`standard`},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return xt(`ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().`),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return xt(`ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().`),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[ot]:{primaries:t,whitePoint:r,transfer:st,toXYZ:en,fromXYZ:tn,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:at},outputColorSpaceConfig:{drawingBufferColorSpace:at}},[at]:{primaries:t,whitePoint:r,transfer:ct,toXYZ:en,fromXYZ:tn,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:at}}}),e}var Y=nn();function rn(e){return e<.04045?e*.0773993808:(e*.9478672986+.0521327014)**2.4}function an(e){return e<.0031308?e*12.92:1.055*e**.41666-.055}var on,sn=class{static getDataURL(e,t=`image/png`){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>`u`)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{on===void 0&&(on=ht(`canvas`)),on.width=e.width,on.height=e.height;let t=on.getContext(`2d`);e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=on}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){let t=ht(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(fn).x}get height(){return this.source.getSize(fn).y}get depth(){return this.source.getSize(fn).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){H(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){H(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:`dispose`})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case T:e.x-=Math.floor(e.x);break;case E:e.x=e.x<0?0:1;break;case D:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case T:e.y-=Math.floor(e.y);break;case E:e.y=e.y<0?0:1;break;case D:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};pn.DEFAULT_IMAGE=null,pn.DEFAULT_MAPPING=300,pn.DEFAULT_ANISOTROPY=1;var mn=class e{static{e.prototype.isVector4=!0}constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w===void 0?1:e.w,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)s&&e>_?e_?s1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type=`BatchedMesh`,r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(t!==void 0&&t.shapes!==void 0){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t0){r.children=[];for(let t=0;t0){r.animations=[];for(let t=0;t0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l),u.length>0&&(n.nodes=u)}return n.object=r,n;function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot===null?null:e.pivot.clone(),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let t=0;ts+l?(c.inputState.pinching=!1,this.dispatchEvent({type:`pinchend`,handedness:e.handedness,target:this})):!c.inputState.pinching&&o<=s-l&&(c.inputState.pinching=!0,this.dispatchEvent({type:`pinchstart`,handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,s.eventsEnabled&&s.dispatchEvent({type:`gripUpdated`,data:e,target:this})));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&i!==null&&(r=i),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Jn)))}return o!==null&&(o.visible=r!==null),s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new qn;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},Xn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Zn={h:0,s:0,l:0},Qn={h:0,s:0,l:0};function $n(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}var X=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let t=e;t&&t.isColor?this.copy(t):typeof t==`number`?this.setHex(t):typeof t==`string`&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=at){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Y.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=Y.workingColorSpace){return this.r=e,this.g=t,this.b=n,Y.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=Y.workingColorSpace){if(e=At(e,1),t=W(t,0,1),n=W(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=$n(i,r,e+1/3),this.g=$n(i,r,e),this.b=$n(i,r,e-1/3)}return Y.colorSpaceToWorking(this,r),this}setStyle(e,t=at){function n(t){t!==void 0&&parseFloat(t)<1&&H(`Color: Alpha component of `+e+` will be ignored.`)}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=r[1],o=r[2];switch(a){case`rgb`:case`rgba`:if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case`hsl`:case`hsla`:if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:H(`Color: Unknown color model `+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=r[1],i=n.length;if(i===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(i===6)return this.setHex(parseInt(n,16),t);H(`Color: Invalid hex color `+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=at){let n=Xn[e.toLowerCase()];return n===void 0?H(`Color: Unknown color `+e):this.setHex(n,t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=rn(e.r),this.g=rn(e.g),this.b=rn(e.b),this}copyLinearToSRGB(e){return this.r=an(e.r),this.g=an(e.g),this.b=an(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=at){return Y.workingToColorSpace(er.copy(this),e),Math.round(W(er.r*255,0,255))*65536+Math.round(W(er.g*255,0,255))*256+Math.round(W(er.b*255,0,255))}getHexString(e=at){return(`000000`+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Y.workingColorSpace){Y.workingToColorSpace(er.copy(this),t);let n=er.r,r=er.g,i=er.b,a=Math.max(n,r,i),o=Math.min(n,r,i),s,c,l=(o+a)/2;if(o===a)s=0,c=0;else{let e=a-o;switch(c=l<=.5?e/(a+o):e/(2-a-o),a){case n:s=(r-i)/e+(r0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},nr=new q,rr=new q,ir=new q,ar=new q,or=new q,sr=new q,cr=new q,lr=new q,ur=new q,dr=new q,fr=new mn,pr=new mn,mr=new mn,hr=class e{constructor(e=new q,t=new q,n=new q){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),nr.subVectors(e,t),r.cross(nr);let i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){nr.subVectors(r,t),rr.subVectors(n,t),ir.subVectors(e,t);let a=nr.dot(nr),o=nr.dot(rr),s=nr.dot(ir),c=rr.dot(rr),l=rr.dot(ir),u=a*c-o*o;if(u===0)return i.set(0,0,0),null;let d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,ar)===null?!1:ar.x>=0&&ar.y>=0&&ar.x+ar.y<=1}static getInterpolation(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,ar)===null?(s.x=0,s.y=0,`z`in s&&(s.z=0),`w`in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(i,ar.x),s.addScaledVector(a,ar.y),s.addScaledVector(o,ar.z),s)}static getInterpolatedAttribute(e,t,n,r,i,a){return fr.setScalar(0),pr.setScalar(0),mr.setScalar(0),fr.fromBufferAttribute(e,t),pr.fromBufferAttribute(e,n),mr.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(fr,i.x),a.addScaledVector(pr,i.y),a.addScaledVector(mr,i.z),a}static isFrontFacing(e,t,n,r){return nr.subVectors(n,t),rr.subVectors(e,t),nr.cross(rr).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return nr.subVectors(this.c,this.b),rr.subVectors(this.a,this.b),nr.cross(rr).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return e.getNormal(this.a,this.b,this.c,t)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}getInterpolation(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}containsPoint(t){return e.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return e.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,i=this.c,a,o;or.subVectors(r,n),sr.subVectors(i,n),lr.subVectors(e,n);let s=or.dot(lr),c=sr.dot(lr);if(s<=0&&c<=0)return t.copy(n);ur.subVectors(e,r);let l=or.dot(ur),u=sr.dot(ur);if(l>=0&&u<=l)return t.copy(r);let d=s*u-l*c;if(d<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(or,a);dr.subVectors(e,i);let f=or.dot(dr),p=sr.dot(dr);if(p>=0&&f<=p)return t.copy(i);let m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(sr,o);let h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return cr.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(cr,o);let g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(or,a).addScaledVector(sr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},gr=class{constructor(e=new q(1/0,1/0,1/0),t=new q(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,vr),vr.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Er),Dr.subVectors(this.max,Er),br.subVectors(e.a,Er),xr.subVectors(e.b,Er),Sr.subVectors(e.c,Er),Cr.subVectors(xr,br),wr.subVectors(Sr,xr),Tr.subVectors(br,Sr);let t=[0,-Cr.z,Cr.y,0,-wr.z,wr.y,0,-Tr.z,Tr.y,Cr.z,0,-Cr.x,wr.z,0,-wr.x,Tr.z,0,-Tr.x,-Cr.y,Cr.x,0,-wr.y,wr.x,0,-Tr.y,Tr.x,0];return!Ar(t,br,xr,Sr,Dr)||(t=[1,0,0,0,1,0,0,0,1],!Ar(t,br,xr,Sr,Dr))?!1:(Or.crossVectors(Cr,wr),t=[Or.x,Or.y,Or.z],Ar(t,br,xr,Sr,Dr))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,vr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(vr).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(_r[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),_r[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),_r[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),_r[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),_r[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),_r[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),_r[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),_r[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(_r),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},_r=[new q,new q,new q,new q,new q,new q,new q,new q],vr=new q,yr=new gr,br=new q,xr=new q,Sr=new q,Cr=new q,wr=new q,Tr=new q,Er=new q,Dr=new q,Or=new q,kr=new q;function Ar(e,t,n,r,i){for(let a=0,o=e.length-3;a<=o;a+=3){kr.fromArray(e,a);let o=i.x*Math.abs(kr.x)+i.y*Math.abs(kr.y)+i.z*Math.abs(kr.z),s=t.dot(kr),c=n.dot(kr),l=r.dot(kr);if(Math.max(-Math.max(s,c,l),Math.min(s,c,l))>o)return!1}return!0}var jr=new q,Mr=new K,Nr=0,Pr=class extends wt{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.isBufferAttribute=!0,Object.defineProperty(this,`id`,{value:Nr++}),this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n,this.usage=ut,this.updateRanges=[],this.gpuType=oe,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;rthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;zr.subVectors(e,this.center);let t=zr.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(zr,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Br.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(zr.copy(e.center).add(Br)),this.expandByPoint(zr.copy(e.center).sub(Br))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},Hr=0,Ur=new yn,Wr=new Kn,Gr=new q,Kr=new gr,qr=new gr,Jr=new q,Yr=class e extends wt{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,`id`,{value:Hr++}),this.uuid=kt(),this.name=``,this.type=`BufferGeometry`,this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(pt(e)?Ir:Fr)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let t=new J().getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ur.makeRotationFromQuaternion(e),this.applyMatrix4(Ur),this}rotateX(e){return Ur.makeRotationX(e),this.applyMatrix4(Ur),this}rotateY(e){return Ur.makeRotationY(e),this.applyMatrix4(Ur),this}rotateZ(e){return Ur.makeRotationZ(e),this.applyMatrix4(Ur),this}translate(e,t,n){return Ur.makeTranslation(e,t,n),this.applyMatrix4(Ur),this}scale(e,t,n){return Ur.makeScale(e,t,n),this.applyMatrix4(Ur),this}lookAt(e){return Wr.lookAt(e),Wr.updateMatrix(),this.applyMatrix4(Wr.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Gr).negate(),this.translate(Gr.x,Gr.y,Gr.z),this}setFromPoints(e){let t=this.getAttribute(`position`);if(t===void 0){let t=[];for(let n=0,r=e.length;nt.count&&H(`BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.`),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new gr);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){U(`BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.`,this),this.boundingBox.set(new q(-1/0,-1/0,-1/0),new q(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e0&&(e.userData=this.userData),this.parameters!==void 0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){H(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){H(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,this.name!==``&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(n.blending=this.blending),this.side!==0&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==204&&(n.blendSrc=this.blendSrc),this.blendDst!==205&&(n.blendDst=this.blendDst),this.blendEquation!==100&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==3&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==519&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==7680&&(n.stencilFail=this.stencilFail),this.stencilZFail!==7680&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==7680&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==`round`&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==`round`&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let e=t.length;n=Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:`dispose`})}set needsUpdate(e){e===!0&&this.version++}},ti=class extends ei{constructor(e){super(),this.isSpriteMaterial=!0,this.type=`SpriteMaterial`,this.color=new X(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},ni,ri=new q,ii=new q,ai=new q,oi=new K,si=new K,ci=new yn,li=new q,ui=new q,di=new q,fi=new K,pi=new K,mi=new K,hi=class extends Kn{constructor(e=new ti){if(super(),this.isSprite=!0,this.type=`Sprite`,ni===void 0){ni=new Yr;let e=new Xr(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);ni.setIndex([0,1,2,0,2,3]),ni.setAttribute(`position`,new Qr(e,3,0,!1)),ni.setAttribute(`uv`,new Qr(e,2,3,!1))}this.geometry=ni,this.material=e,this.center=new K(.5,.5),this.count=1}raycast(e,t){e.camera===null&&U(`Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.`),ii.setFromMatrixScale(this.matrixWorld),ci.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),ai.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&ii.multiplyScalar(-ai.z);let n=this.material.rotation,r,i;n!==0&&(i=Math.cos(n),r=Math.sin(n));let a=this.center;gi(li.set(-.5,-.5,0),ai,a,ii,r,i),gi(ui.set(.5,-.5,0),ai,a,ii,r,i),gi(di.set(.5,.5,0),ai,a,ii,r,i),fi.set(0,0),pi.set(1,0),mi.set(1,1);let o=e.ray.intersectTriangle(li,ui,di,!1,ri);if(o===null&&(gi(ui.set(-.5,.5,0),ai,a,ii,r,i),pi.set(0,1),o=e.ray.intersectTriangle(li,di,ui,!1,ri),o===null))return;let s=e.ray.origin.distanceTo(ri);se.far||t.push({distance:s,point:ri.clone(),uv:hr.getInterpolation(ri,li,ui,di,fi,pi,mi,new K),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};function gi(e,t,n,r,i,a){oi.subVectors(e,n).addScalar(.5).multiply(r),i===void 0?si.copy(oi):(si.x=a*oi.x-i*oi.y,si.y=i*oi.x+a*oi.y),e.copy(t),e.x+=si.x,e.y+=si.y,e.applyMatrix4(ci)}var _i=new q,vi=new q,yi=new q,bi=new q,xi=new q,Si=new q,Ci=new q,wi=class{constructor(e=new q,t=new q(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,_i)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=_i.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(_i.copy(this.origin).addScaledVector(this.direction,t),_i.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){vi.copy(e).add(t).multiplyScalar(.5),yi.copy(t).sub(e).normalize(),bi.copy(this.origin).sub(vi);let i=e.distanceTo(t)*.5,a=-this.direction.dot(yi),o=bi.dot(this.direction),s=-bi.dot(yi),c=bi.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0)if(u=a*s-o,d=a*o-s,p=i*l,u>=0)if(d>=-p)if(d<=p){let e=1/l;u*=e,d*=e,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c);else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(vi).addScaledVector(yi,d),f}intersectSphere(e,t){_i.subVectors(e.center,this.origin);let n=_i.dot(this.direction),r=_i.dot(_i)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||isNaN(n))&&(n=i),(a=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,_i)!==null}intersectTriangle(e,t,n,r,i){xi.subVectors(t,e),Si.subVectors(n,e),Ci.crossVectors(xi,Si);let a=this.direction.dot(Ci),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;bi.subVectors(this.origin,e);let s=o*this.direction.dot(Si.crossVectors(bi,Si));if(s<0)return null;let c=o*this.direction.dot(xi.cross(bi));if(c<0||s+c>a)return null;let l=-o*bi.dot(Ci);return l<0?null:this.at(l/a,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Ti=class extends ei{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type=`MeshBasicMaterial`,this.color=new X(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new kn,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},Ei=new yn,Di=new wi,Oi=new Vr,ki=new q,Ai=new q,ji=new q,Mi=new q,Ni=new q,Pi=new q,Fi=new q,Ii=new q,Li=class extends Kn{constructor(e=new Yr,t=new Ti){super(),this.isMesh=!0,this.type=`Mesh`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e(e.far-e.near)**2))&&(Ei.copy(i).invert(),Di.copy(e.ray).applyMatrix4(Ei),!(n.boundingBox!==null&&Di.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Di)))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,c=i.attributes.uv,l=i.attributes.uv1,u=i.attributes.normal,d=i.groups,f=i.drawRange;if(o!==null)if(Array.isArray(a))for(let i=0,s=d.length;in.far?null:{distance:l,point:Ii.clone(),object:e}}function zi(e,t,n,r,i,a,o,s,c,l){e.getVertexPosition(s,Ai),e.getVertexPosition(c,ji),e.getVertexPosition(l,Mi);let u=Ri(e,t,n,r,Ai,ji,Mi,Fi);if(u){let e=new q;hr.getBarycoord(Fi,Ai,ji,Mi,e),i&&(u.uv=hr.getInterpolatedAttribute(i,s,c,l,e,new K)),a&&(u.uv1=hr.getInterpolatedAttribute(a,s,c,l,e,new K)),o&&(u.normal=hr.getInterpolatedAttribute(o,s,c,l,e,new q),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));let t={a:s,b:c,c:l,normal:new q,materialIndex:0};hr.getNormal(Ai,ji,Mi,t.normal),u.face=t,u.barycoord=e}return u}var Bi=class extends pn{constructor(e=null,t=1,n=1,r,i,a,o,s,c=O,l=O,u,d){super(null,a,o,s,c,l,r,i,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},Vi=new q,Hi=new q,Ui=new J,Wi=class{constructor(e=new q(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=Vi.subVectors(n,t).cross(Hi.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let r=e.delta(Vi),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/i;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||Ui.getNormalMatrix(e),r=this.coplanarPoint(Vi).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},Gi=new Vr,Ki=new K(.5,.5),qi=new q,Ji=class{constructor(e=new Wi,t=new Wi,n=new Wi,r=new Wi,i=new Wi,a=new Wi){this.planes=[e,t,n,r,i,a]}set(e,t,n,r,i,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=ft,n=!1){let r=this.planes,i=e.elements,a=i[0],o=i[1],s=i[2],c=i[3],l=i[4],u=i[5],d=i[6],f=i[7],p=i[8],m=i[9],h=i[10],g=i[11],_=i[12],v=i[13],y=i[14],b=i[15];if(r[0].setComponents(c-a,f-l,g-p,b-_).normalize(),r[1].setComponents(c+a,f+l,g+p,b+_).normalize(),r[2].setComponents(c+o,f+u,g+m,b+v).normalize(),r[3].setComponents(c-o,f-u,g-m,b-v).normalize(),n)r[4].setComponents(s,d,h,y).normalize(),r[5].setComponents(c-s,f-d,g-h,b-y).normalize();else if(r[4].setComponents(c-s,f-d,g-h,b-y).normalize(),t===2e3)r[5].setComponents(c+s,f+d,g+h,b+y).normalize();else if(t===2001)r[5].setComponents(s,d,h,y).normalize();else throw Error(`THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: `+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Gi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Gi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Gi)}intersectsSprite(e){return Gi.center.set(0,0,0),Gi.radius=.7071067811865476+Ki.distanceTo(e.center),Gi.applyMatrix4(e.matrixWorld),this.intersectsSphere(Gi)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,qi.y=r.normal.y>0?e.max.y:e.min.y,qi.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(qi)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},Yi=class extends ei{constructor(e){super(),this.isLineBasicMaterial=!0,this.type=`LineBasicMaterial`,this.color=new X(16777215),this.map=null,this.linewidth=1,this.linecap=`round`,this.linejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},Xi=new q,Zi=new q,Qi=new yn,$i=new wi,ea=new Vr,ta=new q,na=new q,ra=class extends Kn{constructor(e=new Yr,t=new Yi){super(),this.isLine=!0,this.type=`Line`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let e=1,r=t.count;e0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;er)return;ta.applyMatrix4(e.matrixWorld);let c=t.ray.origin.distanceTo(ta);if(!(ct.far))return{distance:c,point:na.clone().applyMatrix4(e.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:e}}var aa=class extends pn{constructor(e=[],t=301,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,s,c,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},oa=class extends pn{constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r,i,a,o,s,c),this.isCanvasTexture=!0,this.needsUpdate=!0}},sa=class extends pn{constructor(e,t,n=ae,r,i,a,o=O,s=O,c,l=he,u=1){if(l!==1026&&l!==1027)throw Error(`DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat`);super({width:e,height:t,depth:u},r,i,a,o,s,l,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new ln(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},ca=class extends sa{constructor(e,t=ae,n=301,r,i,a=O,o=O,s,c=he){let l={width:e,height:e,depth:1},u=[l,l,l,l,l,l];super(e,e,t,n,r,i,a,o,s,c),this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},la=class extends pn{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},ua=class e extends Yr{constructor(e=1,t=1,n=1,r=1,i=1,a=1){super(),this.type=`BoxGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let o=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);let s=[],c=[],l=[],u=[],d=0,f=0;p(`z`,`y`,`x`,-1,-1,n,t,e,a,i,0),p(`z`,`y`,`x`,1,-1,n,t,-e,a,i,1),p(`x`,`z`,`y`,1,1,e,n,t,r,a,2),p(`x`,`z`,`y`,1,-1,e,n,-t,r,a,3),p(`x`,`y`,`z`,1,-1,e,t,n,r,i,4),p(`x`,`y`,`z`,-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute(`position`,new Lr(c,3)),this.setAttribute(`normal`,new Lr(l,3)),this.setAttribute(`uv`,new Lr(u,2));function p(e,t,n,r,i,a,p,m,h,g,_){let v=a/h,y=p/g,b=a/2,x=p/2,S=m/2,C=h+1,w=g+1,T=0,E=0,D=new q;for(let a=0;a0?1:-1,l.push(D.x,D.y,D.z),u.push(s/h),u.push(1-a/g),T+=1}for(let e=0;e0)&&f.push(t,i,c),(e!==n-1||s=0&&(x[r]=null,b[r].disconnect(n))}for(let t=0;t=x.length){x.push(n),r=e;break}else if(x[e]===null){x[e]=n,r=e;break}if(r===-1)break}let i=b[r];i&&i.connect(n)}}let te=new q,M=new q;function N(e,t,n){te.setFromMatrixPosition(t.matrixWorld),M.setFromMatrixPosition(n.matrixWorld);let r=te.distanceTo(M),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(a[8]+1)/a[0],f=o*u,p=o*d,m=r/(-u+d),h=m*-u;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(h),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),i[10]===-1)e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=o+m,n=s+m,i=f-h,a=p+(r-h),u=c*s/n*t,d=l*s/n*t;e.projectionMatrix.makePerspective(i,a,u,d,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}function re(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(r===null)return;let t=e.near,n=e.far;h.texture!==null&&(h.depthNear>0&&(t=h.depthNear),h.depthFar>0&&(n=h.depthFar)),D.near=T.near=w.near=t,D.far=T.far=w.far=n,(O!==D.near||k!==D.far)&&(r.updateRenderState({depthNear:D.near,depthFar:D.far}),O=D.near,k=D.far),D.layers.mask=e.layers.mask|6,w.layers.mask=D.layers.mask&-5,T.layers.mask=D.layers.mask&-3;let i=e.parent,a=D.cameras;re(D,i);for(let e=0;e0&&(e.alphaTest.value=r.alphaTest);let i=t.get(r),a=i.envMap,o=i.envMapRotation;a&&(e.envMap.value=a,e.envMapRotation.value.setFromMatrix4(Ul.makeRotationFromEuler(o)).transpose(),a.isCubeTexture&&a.isRenderTargetTexture===!1&&e.envMapRotation.value.premultiply(Wl),e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,n(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,e.aoMapTransform))}function o(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}function s(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function c(e,t,r,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=i*.5,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function l(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function u(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}function d(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}function f(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function p(e,t,r){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===1&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}function m(e,t){t.matcap&&(e.matcap.value=t.matcap)}function h(e,n){let r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function Kl(e,t,n,r){let i={},a={},o=[],s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function c(e,t){let n=t.program;r.uniformBlockBinding(e,n)}function l(e,n){let o=i[e.id];o===void 0&&(m(e),o=u(e),i[e.id]=o,e.addEventListener(`dispose`,g));let s=n.program;r.updateUBOMapping(e,s);let c=t.render.frame;a[e.id]!==c&&(f(e),a[e.id]=c)}function u(t){let n=d();t.__bindingPointIndex=n;let r=e.createBuffer(),i=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,r),e.bufferData(e.UNIFORM_BUFFER,i,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,r),r}function d(){for(let e=0;e0&&(n+=16-r),e.__size=n,e.__cache={},this}function h(e){let t={boundary:0,storage:0};return typeof e==`number`||typeof e==`boolean`?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?H(`WebGLRenderer: Texture samplers can not be part of an uniforms group.`):ArrayBuffer.isView(e)?(t.boundary=16,t.storage=e.byteLength):H(`WebGLRenderer: Unsupported uniform value type.`,e),t}function g(t){let n=t.target;n.removeEventListener(`dispose`,g);let r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}function _(){for(let t in i)e.deleteBuffer(i[t]);o=[],i={},a={}}return{bind:c,update:l,dispose:_}}var ql=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),Jl=null;function Yl(){return Jl===null&&(Jl=new Bi(ql,16,16,ye,P),Jl.name=`DFG_LUT`,Jl.minFilter=j,Jl.magFilter=j,Jl.wrapS=E,Jl.wrapT=E,Jl.generateMipmaps=!1,Jl.needsUpdate=!0),Jl}var Xl=class{constructor(e={}){let{canvas:t=gt(),context:n=null,depth:r=!0,stencil:i=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:s=!0,preserveDrawingBuffer:c=!1,powerPreference:l=`default`,failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:d=!1,outputBufferType:f=ne}=e;this.isWebGLRenderer=!0;let p;if(n!==null){if(typeof WebGLRenderingContext<`u`&&n instanceof WebGLRenderingContext)throw Error(`THREE.WebGLRenderer: WebGL 1 is not supported since r163.`);p=n.getContextAttributes().alpha}else p=a;let m=f,h=new Set([xe,be,ve]),g=new Set([ne,ae,re,le,se,ce]),_=new Uint32Array(4),v=new Int32Array(4),y=new q,b=null,x=null,S=[],C=[],w=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let T=this,E=!1,D=null;this._outputColorSpace=at;let O=0,k=0,A=null,j=-1,ee=null,M=new mn,N=new mn,ie=null,oe=new X(0),ue=0,de=t.width,fe=t.height,pe=1,me=null,he=null,ge=new mn(0,0,de,fe),_e=new mn(0,0,de,fe),ye=!1,F=new Ji,Se=!1,Ce=!1,we=new yn,Te=new q,Ee=new mn,De={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},Oe=!1;function ke(){return A===null?pe:1}let I=n;function Ae(e,n){return t.getContext(e,n)}try{let e={alpha:!0,depth:r,stencil:i,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if(`setAttribute`in t&&t.setAttribute(`data-engine`,`three.js r184`),t.addEventListener(`webglcontextlost`,Ze,!1),t.addEventListener(`webglcontextrestored`,Qe,!1),t.addEventListener(`webglcontextcreationerror`,$e,!1),I===null){let t=`webgl2`;if(I=Ae(t,e),I===null)throw Ae(t)?Error(`Error creating WebGL context with your selected attributes.`):Error(`Error creating WebGL context.`)}}catch(e){throw U(`WebGLRenderer: `+e.message),e}let L,je,R,z,B,V,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,We,Ge,Ke,qe,Je;function Ye(){L=new ms(I),L.init(),Ke=new Rl(I,L),je=new Wo(I,L,e,Ke),R=new Il(I,L),je.reversedDepthBuffer&&d&&R.buffers.depth.setReversed(!0),z=new _s(I),B=new gl,V=new Ll(I,L,R,B,je,Ke,z),Me=new ps(T),Ne=new Io(I),qe=new Ho(I,Ne),Pe=new hs(I,Ne,z,qe),Fe=new ys(I,Pe,Ne,qe,z),Ue=new vs(I,je,V),Be=new Go(B),Ie=new hl(T,Me,L,je,qe,Be),Le=new Gl(T,B),Re=new bl,ze=new Dl(L),He=new Vo(T,Me,R,Fe,p,s),Ve=new Fl(T,Fe,je),Je=new Kl(I,z,je,R),We=new Uo(I,L,z),Ge=new gs(I,L,z),z.programs=Ie.programs,T.capabilities=je,T.extensions=L,T.properties=B,T.renderLists=Re,T.shadowMap=Ve,T.state=R,T.info=z}Ye(),m!==1009&&(w=new xs(m,t.width,t.height,r,i));let Xe=new Hl(T,I);this.xr=Xe,this.getContext=function(){return I},this.getContextAttributes=function(){return I.getContextAttributes()},this.forceContextLoss=function(){let e=L.get(`WEBGL_lose_context`);e&&e.loseContext()},this.forceContextRestore=function(){let e=L.get(`WEBGL_lose_context`);e&&e.restoreContext()},this.getPixelRatio=function(){return pe},this.setPixelRatio=function(e){e!==void 0&&(pe=e,this.setSize(de,fe,!1))},this.getSize=function(e){return e.set(de,fe)},this.setSize=function(e,n,r=!0){if(Xe.isPresenting){H(`WebGLRenderer: Can't change size while VR device is presenting.`);return}de=e,fe=n,t.width=Math.floor(e*pe),t.height=Math.floor(n*pe),r===!0&&(t.style.width=e+`px`,t.style.height=n+`px`),w!==null&&w.setSize(t.width,t.height),this.setViewport(0,0,e,n)},this.getDrawingBufferSize=function(e){return e.set(de*pe,fe*pe).floor()},this.setDrawingBufferSize=function(e,n,r){de=e,fe=n,pe=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.setEffects=function(e){if(m===1009){U(`THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.`);return}if(e){for(let t=0;t{function n(){if(r.forEach(function(e){B.get(e).currentProgram.isReady()&&r.delete(e)}),r.size===0){t(e);return}setTimeout(n,10)}L.get(`KHR_parallel_shader_compile`)===null?setTimeout(n,10):n()})};let it=null;function ot(e){it&&it(e)}function st(){lt.stop()}function ct(){lt.start()}let lt=new Fo;lt.setAnimationLoop(ot),typeof self<`u`&<.setContext(self),this.setAnimationLoop=function(e){it=e,Xe.setAnimationLoop(e),e===null?lt.stop():lt.start()},Xe.addEventListener(`sessionstart`,st),Xe.addEventListener(`sessionend`,ct),this.render=function(e,t){if(t!==void 0&&t.isCamera!==!0){U(`WebGLRenderer.render: camera is not an instance of THREE.Camera.`);return}if(E===!0)return;D!==null&&D.renderStart(e,t);let n=Xe.enabled===!0&&Xe.isPresenting===!0,r=w!==null&&(A===null||n)&&w.begin(T,A);if(e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),Xe.enabled===!0&&Xe.isPresenting===!0&&(w===null||w.isCompositing()===!1)&&(Xe.cameraAutoUpdate===!0&&Xe.updateCamera(t),t=Xe.getCamera()),e.isScene===!0&&e.onBeforeRender(T,e,t,A),x=ze.get(e,C.length),x.init(t),x.state.textureUnits=V.getTextureUnits(),C.push(x),we.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),F.setFromProjectionMatrix(we,ft,t.reversedDepth),Ce=this.localClippingEnabled,Se=Be.init(this.clippingPlanes,Ce),b=Re.get(e,S.length),b.init(),S.push(b),Xe.enabled===!0&&Xe.isPresenting===!0){let e=T.xr.getDepthSensingMesh();e!==null&&ut(e,t,-1/0,T.sortObjects)}ut(e,t,0,T.sortObjects),b.finish(),T.sortObjects===!0&&b.sort(me,he),Oe=Xe.enabled===!1||Xe.isPresenting===!1||Xe.hasDepthSensing()===!1,Oe&&He.addToRenderList(b,e),this.info.render.frame++,Se===!0&&Be.beginShadows();let i=x.state.shadowsArray;if(Ve.render(i,e,t),Se===!0&&Be.endShadows(),this.info.autoReset===!0&&this.info.reset(),(r&&w.hasRenderPass())===!1){let n=b.opaque,r=b.transmissive;if(x.setupLights(),t.isArrayCamera){let i=t.cameras;if(r.length>0)for(let t=0,a=i.length;t0&&pt(n,r,e,t),Oe&&He.render(e),dt(b,e,t)}A!==null&&k===0&&(V.updateMultisampleRenderTarget(A),V.updateRenderTargetMipmap(A)),r&&w.end(T),e.isScene===!0&&e.onAfterRender(T,e,t),qe.resetDefaultState(),j=-1,ee=null,C.pop(),C.length>0?(x=C[C.length-1],V.setTextureUnits(x.state.textureUnits),Se===!0&&Be.setGlobalState(T.clippingPlanes,x.state.camera)):x=null,S.pop(),b=S.length>0?S[S.length-1]:null,D!==null&&D.renderEnd()};function ut(e,t,n,r){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLightProbeGrid)x.pushLightProbeGrid(e);else if(e.isLight)x.pushLight(e),e.castShadow&&x.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||F.intersectsSprite(e)){r&&Ee.setFromMatrixPosition(e.matrixWorld).applyMatrix4(we);let t=Fe.update(e),i=e.material;i.visible&&b.push(e,t,i,n,Ee.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||F.intersectsObject(e))){let t=Fe.update(e),i=e.material;if(r&&(e.boundingSphere===void 0?(t.boundingSphere===null&&t.computeBoundingSphere(),Ee.copy(t.boundingSphere.center)):(e.boundingSphere===null&&e.computeBoundingSphere(),Ee.copy(e.boundingSphere.center)),Ee.applyMatrix4(e.matrixWorld).applyMatrix4(we)),Array.isArray(i)){let r=t.groups;for(let a=0,o=r.length;a0&&mt(i,t,n),a.length>0&&mt(a,t,n),o.length>0&&mt(o,t,n),R.buffers.depth.setTest(!0),R.buffers.depth.setMask(!0),R.buffers.color.setMask(!0),R.setPolygonOffset(!1)}function pt(e,t,n,r){if((n.isScene===!0?n.overrideMaterial:null)!==null)return;if(x.state.transmissionRenderTarget[r.id]===void 0){let e=L.has(`EXT_color_buffer_half_float`)||L.has(`EXT_color_buffer_float`);x.state.transmissionRenderTarget[r.id]=new gn(1,1,{generateMipmaps:!0,type:e?P:ne,minFilter:te,samples:Math.max(4,je.samples),stencilBuffer:i,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Y.workingColorSpace})}let a=x.state.transmissionRenderTarget[r.id],o=r.viewport||M;a.setSize(o.z*T.transmissionResolutionScale,o.w*T.transmissionResolutionScale);let s=T.getRenderTarget(),c=T.getActiveCubeFace(),l=T.getActiveMipmapLevel();T.setRenderTarget(a),T.getClearColor(oe),ue=T.getClearAlpha(),ue<1&&T.setClearColor(16777215,.5),T.clear(),Oe&&He.render(n);let u=T.toneMapping;T.toneMapping=0;let d=r.viewport;if(r.viewport!==void 0&&(r.viewport=void 0),x.setupLightsView(r),Se===!0&&Be.setGlobalState(T.clippingPlanes,r),mt(e,n,r),V.updateMultisampleRenderTarget(a),V.updateRenderTargetMipmap(a),L.has(`WEBGL_multisampled_render_to_texture`)===!1){let e=!1;for(let i=0,a=t.length;i0,r.currentProgram=d,r.uniformsList=null,d}function vt(e){if(e.uniformsList===null){let t=e.currentProgram.getUniforms();e.uniformsList=Oc.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function bt(e,t){let n=B.get(e);n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}function xt(e,t){if(e.length===0)return null;if(e.length===1)return e[0].texture===null?null:e[0];y.setFromMatrixPosition(t.matrixWorld);for(let t=0,n=e.length;t0),f=!!n.morphAttributes.position,p=!!n.morphAttributes.normal,m=!!n.morphAttributes.color,h=0;r.toneMapped&&(A===null||A.isXRRenderTarget===!0)&&(h=T.toneMapping);let g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,_=g===void 0?0:g.length,v=B.get(r),y=x.state.lights;if(Se===!0&&(Ce===!0||e!==ee)){let t=e===ee&&r.id===j;Be.setState(r,e,t)}let b=!1;r.version===v.__version?v.needsLights&&v.lightsStateVersion!==y.state.version?b=!0:v.outputColorSpace===s?i.isBatchedMesh&&v.batching===!1||!i.isBatchedMesh&&v.batching===!0||i.isBatchedMesh&&v.batchingColor===!0&&i.colorTexture===null||i.isBatchedMesh&&v.batchingColor===!1&&i.colorTexture!==null||i.isInstancedMesh&&v.instancing===!1||!i.isInstancedMesh&&v.instancing===!0||i.isSkinnedMesh&&v.skinning===!1||!i.isSkinnedMesh&&v.skinning===!0||i.isInstancedMesh&&v.instancingColor===!0&&i.instanceColor===null||i.isInstancedMesh&&v.instancingColor===!1&&i.instanceColor!==null||i.isInstancedMesh&&v.instancingMorph===!0&&i.morphTexture===null||i.isInstancedMesh&&v.instancingMorph===!1&&i.morphTexture!==null?b=!0:v.envMap===l?r.fog===!0&&v.fog!==a||v.numClippingPlanes!==void 0&&(v.numClippingPlanes!==Be.numPlanes||v.numIntersection!==Be.numIntersection)?b=!0:v.vertexAlphas===u&&v.vertexTangents===d&&v.morphTargets===f&&v.morphNormals===p&&v.morphColors===m&&v.toneMapping===h&&v.morphTargetsCount===_?!!v.lightProbeGrid!=x.state.lightProbeGridArray.length>0&&(b=!0):b=!0:b=!0:b=!0:(b=!0,v.__version=r.version);let S=v.currentProgram;b===!0&&(S=_t(r,t,i),D&&r.isNodeMaterial&&D.onUpdateProgram(r,S,v));let C=!1,w=!1,E=!1,O=S.getUniforms(),k=v.uniforms;if(R.useProgram(S.program)&&(C=!0,w=!0,E=!0),r.id!==j&&(j=r.id,w=!0),v.needsLights){let e=xt(x.state.lightProbeGridArray,i);v.lightProbeGrid!==e&&(v.lightProbeGrid=e,w=!0)}if(C||ee!==e){R.buffers.depth.getReversed()&&e.reversedDepth!==!0&&(e._reversedDepth=!0,e.updateProjectionMatrix()),O.setValue(I,`projectionMatrix`,e.projectionMatrix),O.setValue(I,`viewMatrix`,e.matrixWorldInverse);let t=O.map.cameraPosition;t!==void 0&&t.setValue(I,Te.setFromMatrixPosition(e.matrixWorld)),je.logarithmicDepthBuffer&&O.setValue(I,`logDepthBufFC`,2/(Math.log(e.far+1)/Math.LN2)),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&O.setValue(I,`isOrthographic`,e.isOrthographicCamera===!0),ee!==e&&(ee=e,w=!0,E=!0)}if(v.needsLights&&(y.state.directionalShadowMap.length>0&&O.setValue(I,`directionalShadowMap`,y.state.directionalShadowMap,V),y.state.spotShadowMap.length>0&&O.setValue(I,`spotShadowMap`,y.state.spotShadowMap,V),y.state.pointShadowMap.length>0&&O.setValue(I,`pointShadowMap`,y.state.pointShadowMap,V)),i.isSkinnedMesh){O.setOptional(I,i,`bindMatrix`),O.setOptional(I,i,`bindMatrixInverse`);let e=i.skeleton;e&&(e.boneTexture===null&&e.computeBoneTexture(),O.setValue(I,`boneTexture`,e.boneTexture,V))}i.isBatchedMesh&&(O.setOptional(I,i,`batchingTexture`),O.setValue(I,`batchingTexture`,i._matricesTexture,V),O.setOptional(I,i,`batchingIdTexture`),O.setValue(I,`batchingIdTexture`,i._indirectTexture,V),O.setOptional(I,i,`batchingColorTexture`),i._colorsTexture!==null&&O.setValue(I,`batchingColorTexture`,i._colorsTexture,V));let te=n.morphAttributes;if((te.position!==void 0||te.normal!==void 0||te.color!==void 0)&&Ue.update(i,n,S),(w||v.receiveShadow!==i.receiveShadow)&&(v.receiveShadow=i.receiveShadow,O.setValue(I,`receiveShadow`,i.receiveShadow)),(r.isMeshStandardMaterial||r.isMeshLambertMaterial||r.isMeshPhongMaterial)&&r.envMap===null&&t.environment!==null&&(k.envMapIntensity.value=t.environmentIntensity),k.dfgLUT!==void 0&&(k.dfgLUT.value=Yl()),w){if(O.setValue(I,`toneMappingExposure`,T.toneMappingExposure),v.needsLights&&wt(k,E),a&&r.fog===!0&&Le.refreshFogUniforms(k,a),Le.refreshMaterialUniforms(k,r,pe,fe,x.state.transmissionRenderTarget[e.id]),v.needsLights&&v.lightProbeGrid){let e=v.lightProbeGrid;k.probesSH.value=e.texture,k.probesMin.value.copy(e.boundingBox.min),k.probesMax.value.copy(e.boundingBox.max),k.probesResolution.value.copy(e.resolution)}Oc.upload(I,vt(v),k,V)}if(r.isShaderMaterial&&r.uniformsNeedUpdate===!0&&(Oc.upload(I,vt(v),k,V),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&O.setValue(I,`center`,i.center),O.setValue(I,`modelViewMatrix`,i.modelViewMatrix),O.setValue(I,`normalMatrix`,i.normalMatrix),O.setValue(I,`modelMatrix`,i.matrixWorld),r.uniformsGroups!==void 0){let e=r.uniformsGroups;for(let t=0,n=e.length;t0&&V.useMultisampledRTT(e)===!1?B.get(e).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,M.copy(e.viewport),N.copy(e.scissor),ie=e.scissorTest}else M.copy(ge).multiplyScalar(pe).floor(),N.copy(_e).multiplyScalar(pe).floor(),ie=ye;if(n!==0&&(r=Et),R.bindFramebuffer(I.FRAMEBUFFER,r)&&R.drawBuffers(e,r),R.viewport(M),R.scissor(N),R.setScissorTest(ie),i){let r=B.get(e.texture);I.framebufferTexture2D(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(a){let r=t;for(let t=0;t1&&I.readBuffer(I.COLOR_ATTACHMENT0+s),!je.textureFormatReadable(c)){U(`WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.`);return}if(!je.textureTypeReadable(l)){U(`WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.`);return}t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&I.readPixels(t,n,r,i,Ke.convert(c),Ke.convert(l),a)}finally{let e=A===null?null:B.get(A).__webglFramebuffer;R.bindFramebuffer(I.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget))throw Error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);let c=B.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c)if(t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i){R.bindFramebuffer(I.FRAMEBUFFER,c);let o=e.textures[s],l=o.format,u=o.type;if(e.textures.length>1&&I.readBuffer(I.COLOR_ATTACHMENT0+s),!je.textureFormatReadable(l))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.`);if(!je.textureTypeReadable(u))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.`);let d=I.createBuffer();I.bindBuffer(I.PIXEL_PACK_BUFFER,d),I.bufferData(I.PIXEL_PACK_BUFFER,a.byteLength,I.STREAM_READ),I.readPixels(t,n,r,i,Ke.convert(l),Ke.convert(u),0);let f=A===null?null:B.get(A).__webglFramebuffer;R.bindFramebuffer(I.FRAMEBUFFER,f);let p=I.fenceSync(I.SYNC_GPU_COMMANDS_COMPLETE,0);return I.flush(),await St(I,p,4),I.bindBuffer(I.PIXEL_PACK_BUFFER,d),I.getBufferSubData(I.PIXEL_PACK_BUFFER,0,a),I.deleteBuffer(d),I.deleteSync(p),a}else throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.`)},this.copyFramebufferToTexture=function(e,t=null,n=0){let r=2**-n,i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),o=t===null?0:t.x,s=t===null?0:t.y;V.setTexture2D(e,0),I.copyTexSubImage2D(I.TEXTURE_2D,n,0,0,o,s,i,a),R.unbindTexture()};let Dt=I.createFramebuffer(),Ot=I.createFramebuffer();this.copyTextureToTexture=function(e,t,n=null,r=null,i=0,a=0){let o,s,c,l,u,d,f,p,m,h=e.isCompressedTexture?e.mipmaps[a]:e.image;if(n!==null)o=n.max.x-n.min.x,s=n.max.y-n.min.y,c=n.isBox3?n.max.z-n.min.z:1,l=n.min.x,u=n.min.y,d=n.isBox3?n.min.z:0;else{let t=2**-i;o=Math.floor(h.width*t),s=Math.floor(h.height*t),c=e.isDataArrayTexture?h.depth:e.isData3DTexture?Math.floor(h.depth*t):1,l=0,u=0,d=0}r===null?(f=0,p=0,m=0):(f=r.x,p=r.y,m=r.z);let g=Ke.convert(t.format),_=Ke.convert(t.type),v;t.isData3DTexture?(V.setTexture3D(t,0),v=I.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(V.setTexture2DArray(t,0),v=I.TEXTURE_2D_ARRAY):(V.setTexture2D(t,0),v=I.TEXTURE_2D),R.activeTexture(I.TEXTURE0),R.pixelStorei(I.UNPACK_FLIP_Y_WEBGL,t.flipY),R.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),R.pixelStorei(I.UNPACK_ALIGNMENT,t.unpackAlignment);let y=R.getParameter(I.UNPACK_ROW_LENGTH),b=R.getParameter(I.UNPACK_IMAGE_HEIGHT),x=R.getParameter(I.UNPACK_SKIP_PIXELS),S=R.getParameter(I.UNPACK_SKIP_ROWS),C=R.getParameter(I.UNPACK_SKIP_IMAGES);R.pixelStorei(I.UNPACK_ROW_LENGTH,h.width),R.pixelStorei(I.UNPACK_IMAGE_HEIGHT,h.height),R.pixelStorei(I.UNPACK_SKIP_PIXELS,l),R.pixelStorei(I.UNPACK_SKIP_ROWS,u),R.pixelStorei(I.UNPACK_SKIP_IMAGES,d);let w=e.isDataArrayTexture||e.isData3DTexture,T=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let n=B.get(e),r=B.get(t),h=B.get(n.__renderTarget),g=B.get(r.__renderTarget);R.bindFramebuffer(I.READ_FRAMEBUFFER,h.__webglFramebuffer),R.bindFramebuffer(I.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let n=0;nMath.PI&&(n-=iu),r<-Math.PI?r+=iu:r>Math.PI&&(r-=iu),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let i=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{let e=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),i=e!=this._spherical.radius}if(ru.setFromSpherical(this._spherical),ru.applyQuaternion(this._quatInverse),t.copy(this.target).add(ru),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let e=null;if(this.object.isPerspectiveCamera){let t=ru.length();e=this._clampDistance(t*this._scale);let n=t-e;this.object.position.addScaledVector(this._dollyDirection,n),this.object.updateMatrixWorld(),i=!!n}else if(this.object.isOrthographicCamera){let t=new q(this._mouse.x,this._mouse.y,0);t.unproject(this.object);let n=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),i=n!==this.object.zoom;let r=new q(this._mouse.x,this._mouse.y,0);r.unproject(this.object),this.object.position.sub(r).add(t),this.object.updateMatrixWorld(),e=ru.length()}else console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled.`),this.zoomToCursor=!1;e!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(e).add(this.object.position):(eu.origin.copy(this.object.position),eu.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(eu.direction))au||8*(1-this._lastQuaternion.dot(this.object.quaternion))>au||this._lastTargetPosition.distanceToSquared(this.target)>au?(this.dispatchEvent(Zl),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e===null?iu/60/60*this.autoRotateSpeed:iu/60*this.autoRotateSpeed*e}_getZoomScale(e){let t=Math.abs(e*.01);return .95**(this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){ru.setFromMatrixColumn(t,0),ru.multiplyScalar(-e),this._panOffset.add(ru)}_panUp(e,t){this.screenSpacePanning===!0?ru.setFromMatrixColumn(t,1):(ru.setFromMatrixColumn(t,0),ru.crossVectors(this.object.up,ru)),ru.multiplyScalar(e),this._panOffset.add(ru)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;ru.copy(r).sub(this.target);let i=ru.length();i*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*i/n.clientHeight,this.object.matrix),this._panUp(2*t*i/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.`),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),r=e-n.left,i=t-n.top,a=n.width,o=n.height;this._mouse.x=r/a*2-1,this._mouse.y=-(i/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(iu*this._rotateDelta.x/t.clientHeight),this._rotateUp(iu*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(iu*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-iu*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(iu*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-iu*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);this._dollyStart.set(0,i)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateEnd.set(n,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(iu*this._rotateDelta.x/t.clientHeight),this._rotateUp(iu*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,i),this._dollyDelta.set(0,(this._dollyEnd.y/this._dollyStart.y)**+this.zoomSpeed),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t{T.value.has(e)?T.value.delete(e):T.value.add(e),T.value=new Set(T.value)},D=s(null),O=s(!0),k=s(null),A=s(null),j=s(!1),ee=s(null),te=s(null),ne=s(null),M=s(!1),N=s(`Waiting for satellite data`),re=s(null),ie=s({left:`0px`,top:`0px`}),ae=f(()=>D.value?.status??{}),oe=f(()=>D.value?.fix??{}),P=f(()=>D.value?.position??{}),se=f(()=>D.value?.gps_position??D.value?.position??{}),ce=f(()=>D.value?.manual_position??null),le=f(()=>{let e=D.value?.position_meta??{},t=e.gps_fix_valid??!!ae.value.fix_valid;return{source:e.source??`gps`,source_label:e.source_label??(t?`GPS fix`:`GPS estimate`),policy:e.policy??`gps_only`,manual_config_available:!!e.manual_config_available,gps_fix_valid:t}}),ue=f(()=>D.value?.motion??{}),de=f(()=>D.value?.accuracy??{}),fe=f(()=>D.value?.time??{}),pe=f(()=>D.value?.satellites??{}),me=f(()=>D.value?.nmea??{}),he=f(()=>D.value?.source??{}),ge=e=>{D.value=e,A.value=new Date,k.value=null,O.value=!1},_e=async()=>{try{D.value||(O.value=!0),k.value=null;let e=await b.getGpsDiagnostics();if(e.success===!1)throw Error(e.error||`GPS API error`);ge(e.data??null)}catch(e){k.value=e instanceof Error?e.message:`Failed to load GPS diagnostics`}finally{O.value=!1}},ve=()=>{ee.value&&=(ee.value.close(),null)},ye=()=>{ve();let e=y(),t=e?`?token=${encodeURIComponent(e)}`:``;ee.value=new EventSource(`/api/gps-stream${t}`),ee.value.onmessage=e=>{try{let t=JSON.parse(e.data);if(!t||typeof t!=`object`)return;let n=t;if(n.type===`snapshot`){ge(n.data??null);return}n.success===!0&&ge(n.data??null)}catch(e){console.error(`Failed to parse GPS SSE payload:`,e)}},ee.value.onerror=()=>{D.value||(k.value=`GPS live stream disconnected. Reconnecting...`,O.value=!1)}};n(async()=>{await _e(),ye()}),t(()=>{ve()});let be=e=>{let t=Number(e);return Number.isFinite(t)?t:null},xe=e=>String(Number.isInteger(e)?e:Number(e.toFixed(6))),F=(e,t=``)=>e==null||e===``?`n/a`:typeof e==`boolean`?e?`yes`:`no`:Array.isArray(e)?e.length?e.join(`, `):`none`:typeof e==`number`?`${xe(e)}${t?` ${t}`:``}`:`${String(e)}${t?` ${t}`:``}`,Se=(e,t)=>e==null||t==null?`n/a`:`${xe(e)}, ${xe(t)}`,Ce=f(()=>(ae.value.state??`unknown`).replaceAll(`_`,` `)),we=f(()=>{switch(ae.value.state){case`valid_fix`:return`text-accent-green`;case`error`:return`text-accent-red`;case`invalid_fix`:case`stale`:case`no_data`:case`disabled`:return`text-secondary`;default:return`text-content-muted`}}),Te=f(()=>[{label:`Fix State`,value:Ce.value,note:ae.value.last_error||`quality: ${F(oe.value.quality_label)}`,valueClass:we.value},{label:`Coordinates`,value:Se(P.value.latitude,P.value.longitude),note:`${F(le.value.source_label)} | altitude: ${F(P.value.altitude_m,`m`)}`,valueClass:`text-content-heading dark:text-white`},{label:`Satellites`,value:`${F(pe.value.used_count)} / ${F(pe.value.in_view_count)}`,note:`SNR avg: ${F(pe.value.snr?.avg,`dB`)}`,valueClass:`text-content-heading dark:text-white`},{label:`Freshness`,value:ae.value.age_seconds===null||ae.value.age_seconds===void 0?`n/a`:`${F(ae.value.age_seconds)}s`,note:ae.value.last_update||`last update unknown`,valueClass:ae.value.stale?`text-secondary`:`text-content-heading dark:text-white`},{label:`GPS Time`,value:fe.value.utc_time??`n/a`,note:fe.value.date??`no date`,valueClass:fe.value.utc_time?`text-content-heading dark:text-white`:`text-content-muted`}]),Ee=f(()=>[{title:`Receiver Source`,rows:[[`enabled`,D.value?.enabled],[`running`,D.value?.running],[`source type`,he.value.type],[`device`,he.value.device],[`baud rate`,he.value.baud_rate],[`source path`,he.value.source_path],[`read timeout`,he.value.read_timeout_seconds,`s`],[`poll interval`,he.value.poll_interval_seconds,`s`],[`stale after`,he.value.stale_after_seconds,`s`]]},{title:`Fix`,rows:[[`valid`,oe.value.valid],[`status`,oe.value.status],[`quality`,oe.value.quality],[`quality label`,oe.value.quality_label],[`GSA fix type`,oe.value.gsa_fix_type],[`GSA label`,oe.value.gsa_fix_type_label]]},{title:`Position`,rows:[[`display source`,le.value.source_label||le.value.source],[`policy`,le.value.policy],[`display latitude`,P.value.latitude],[`display longitude`,P.value.longitude],[`GPS latitude`,se.value.latitude],[`GPS longitude`,se.value.longitude],[`manual latitude`,ce.value?.latitude],[`manual longitude`,ce.value?.longitude],[`altitude`,P.value.altitude_m,`m`],[`geoid separation`,P.value.geoid_separation_m,`m`]]},{title:`Motion`,rows:[[`speed`,ue.value.speed_knots,`knots`],[`speed`,ue.value.speed_kmh,`km/h`],[`course`,ue.value.course_degrees,`deg`],[`magnetic variation`,ue.value.magnetic_variation_degrees,`deg`]]},{title:`Accuracy`,rows:[[`HDOP`,de.value.hdop],[`PDOP`,de.value.pdop],[`VDOP`,de.value.vdop]]},{title:`Time`,rows:[[`UTC time`,fe.value.utc_time],[`date`,fe.value.date],[`datetime UTC`,fe.value.datetime_utc]]},{title:`NMEA Health`,rows:[[`last talker`,me.value.last_talker],[`last sentence type`,me.value.last_sentence_type],[`seen sentence types`,me.value.seen_sentence_types],[`valid checksums`,me.value.valid_checksum_count],[`invalid checksums`,me.value.invalid_checksum_count],[`missing checksums`,me.value.missing_checksum_count],[`last sentence`,me.value.last_sentence]]}]),De=f(()=>pe.value.in_view??[]),Oe=f(()=>me.value.recent_sentences??[]),ke=s(new Map),I=f(()=>[...ke.value.values()].sort((e,t)=>e.prn.localeCompare(t.prn,void 0,{numeric:!0})));r(pe,e=>{let t=e?.in_view??[],n=new Set((e?.used_prns??[]).map(String)),r=new Set;for(let e of t){let t=String(e.prn??`?`);r.add(t);let i=ke.value.get(t);i?(i.staleTimer!==null&&(clearTimeout(i.staleTimer),i.staleTimer=null),i.data=e,i.used=n.has(t),i.stale=!1):ke.value.set(t,{prn:t,data:e,used:n.has(t),stale:!1,staleTimer:null})}for(let[e,t]of ke.value)!r.has(e)&&!t.stale&&(t.stale=!0,t.staleTimer=setTimeout(()=>{ke.value.delete(e),ke.value=new Map(ke.value)},Hd));ke.value=new Map(ke.value)},{deep:!1});let Ae=f(()=>{let e=new Set((pe.value.used_prns??[]).map(String));return De.value.map(t=>{let n=be(t.azimuth_degrees),r=be(t.elevation_degrees);if(n===null||r===null)return null;let i=Math.max(0,Math.min(60,be(t.snr_db)??0)),a=(1-Math.max(0,Math.min(90,r))/90)*82,o=n*Math.PI/180,s=t.prn??`?`;return{key:`${s}-${n}-${r}`,prn:String(s),x:100+Math.sin(o)*a,y:100-Math.cos(o)*a,size:4+i/60*7,used:e.has(String(s)),snr:i,elevation:r,azimuth:n,raw:t}}).filter(e=>e!==null)}),L=f(()=>`${Ae.value.length} sat${Ae.value.length===1?``:`s`}`),je=e=>({left:`${e.x/2}%`,top:`${e.y/2}%`,"--size":`${e.size+5}px`}),R=null,z=(e,t)=>typeof window>`u`?t:window.getComputedStyle(document.documentElement).getPropertyValue(e).trim()||t,B=e=>{let t=Ae.value.length;if(!e){N.value=`Waiting for satellite data`;return}N.value=t?`2D fallback: ${t} satellites plotted from GSV az/el`:`Waiting for satellites in view`},V=()=>{let e=ne.value,t=te.value;if(!e||!t)throw Error(`Satellite globe container is not mounted`);let n=new tr,r=new ao(38,1,.1,100),i=new Xl({canvas:e,alpha:!0,antialias:!0,powerPreference:`low-power`}),a=new ou(r,i.domElement),o=new qn,s=new qn,c=new qn,l=new qn,u=new Oo,d=new K,f=new q,p=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,m=new Map,h=null,g=0;r.position.set(0,.1,3.72),i.setClearColor(0,0),i.setPixelRatio(Math.min(window.devicePixelRatio||1,1.5)),a.enableDamping=!0,a.dampingFactor=.08,a.enablePan=!1,a.minDistance=2.45,a.maxDistance=5.6,a.rotateSpeed=.55,a.zoomSpeed=.72,a.target.set(0,0,0),a.update(),n.add(new lo(16777215,.84));let _=new co(16777215,.78);_.position.set(2.7,2.2,3.4),n.add(_);let v=new Ca({color:new X(z(`--color-primary`,`#0d7377`)),roughness:.62,metalness:.04}),y=new Li(new fa(1,56,36),v);new Ka().load(x,e=>{e.anisotropy=window.innerWidth<1024?Math.min(2,i.capabilities.getMaxAnisotropy()):i.capabilities.getMaxAnisotropy(),v.map=e,v.color.set(16777215),v.roughness=.82,v.needsUpdate=!0},void 0,()=>{N.value=`Earth texture unavailable; using local fallback globe`});let b=new Li(new fa(1.006,28,18),new Ti({color:new X(z(`--color-primary`,`#aae8e8`)),wireframe:!0,transparent:!0,opacity:.16})),S=new Li(new fa(1.045,48,24),new Ti({color:new X(z(`--color-primary`,`#aae8e8`)),transparent:!0,opacity:.1,side:1}));o.add(y,b,S,l,c,s),n.add(o);let C=()=>{let e=t.getBoundingClientRect(),n=Math.max(240,Math.floor(e.width)),a=Math.max(240,Math.floor(e.height));i.setSize(n,a,!1),r.aspect=n/a,r.updateProjectionMatrix()},w=e=>{let t=e;t.geometry?.dispose(),(Array.isArray(t.material)?t.material:[t.material]).forEach(e=>{e&&(e.map?.dispose(),e.dispose())})},T=e=>{for(;e.children.length;){let t=e.children.pop();t&&(t.traverse(w),e.remove(t))}},E=(e,t,n=1)=>{let r=e*Math.PI/180,i=t*Math.PI/180;return new q(Math.cos(r)*Math.cos(i),Math.sin(r),-Math.cos(r)*Math.sin(i)).multiplyScalar(n)},D=(e,t)=>{let n=e*Math.PI/180,r=t*Math.PI/180,i=E(e,t,1).normalize();return{east:new q(-Math.sin(r),0,-Math.cos(r)).normalize(),north:new q(-Math.sin(n)*Math.cos(r),Math.cos(n),Math.sin(n)*Math.sin(r)).normalize(),up:i}},O=(e,t,n,r,i,a)=>{e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath()},k=(e,t,n,r=1,i=c)=>{let a=document.createElement(`canvas`);a.width=192,a.height=76;let o=a.getContext(`2d`);if(!o)return;o.font=`800 28px Inter, sans-serif`,o.textAlign=`center`,o.textBaseline=`middle`,O(o,20,14,152,48,16),o.fillStyle=`rgba(3, 8, 10, 0.88)`,o.fill(),o.lineWidth=3,o.strokeStyle=n,o.stroke(),o.fillStyle=`#ffffff`,o.shadowColor=`rgba(0, 0, 0, 0.92)`,o.shadowBlur=7,o.fillText(e,96,39);let s=new hi(new ti({map:new oa(a),transparent:!0,opacity:.98,depthTest:!1,depthWrite:!1}));return s.position.copy(t),s.scale.set(.3*r,.12*r,1),s.renderOrder=10,i.add(s),s},A=(e=!1)=>{h=null,re.value=null},j=(e,n)=>{let r=e.userData.satellite;if(!r)return;let i=t.getBoundingClientRect();ie.value={left:`${Math.max(86,Math.min(i.width-86,n.clientX-i.left))}px`,top:`${Math.max(84,Math.min(i.height-12,n.clientY-i.top))}px`},re.value=r},ee=t=>{let n=e.getBoundingClientRect();d.x=(t.clientX-n.left)/n.width*2-1,d.y=-((t.clientY-n.top)/n.height*2-1),u.setFromCamera(d,r);let i=[...m.values()].map(e=>e.mesh),a=u.intersectObjects(i,!1)[0];h=a?a.object:null,h?j(h,t):A()},M=(e,t,n)=>{let r=e.azimuth*Math.PI/180,i=Math.max(0,Math.min(90,e.elevation))*Math.PI/180,a=t.north.clone().multiplyScalar(Math.cos(r)).add(t.east.clone().multiplyScalar(Math.sin(r))).multiplyScalar(Math.cos(i)).add(t.up.clone().multiplyScalar(Math.sin(i))).normalize();return n.clone().add(a.multiplyScalar(.62))},ae=(e,t,n)=>{let r=M(e,t,n),i=e.used?z(`--color-accent-green`,`#a5e5b6`):z(`--color-primary`,`#aae8e8`),a=.024+e.snr/60*.042,o=new Ti({color:new X(i),transparent:!0,opacity:0}),s=new Li(new fa(a,16,12),o);s.position.copy(r),s.userData={satellite:e,used:e.used},c.add(s);let u=n.clone().multiplyScalar(1.012),d=new Pr(new Float32Array([u.x,u.y,u.z,r.x,r.y,r.z]),3);d.setUsage(dt);let f=new Yr;f.setAttribute(`position`,d);let p=new Yi({color:new X(i),transparent:!0,opacity:0}),m=new ra(f,p);l.add(m);let h=r.clone().multiplyScalar(1.035),g=new ti({transparent:!0,opacity:0,depthTest:!1,depthWrite:!1}),_=k(e.prn,h,i,.88),v=_.material;return g.map=v.map,v.dispose(),_.material=g,{mesh:s,meshMat:o,line:m,lineMat:p,linePosAttr:d,labelSprite:_,labelMat:g,opacity:0,targetOpacity:1,pos:r.clone(),targetPos:r.clone()}},oe=(e,t)=>{let n=E(e,t,1.022),r=D(e,t),i=z(`--color-accent-green`,`#a5e5b6`),a=new Li(new fa(.032,18,14),new Ti({color:new X(i)}));a.position.copy(n),s.add(a),k(`YOU`,n.clone().multiplyScalar(1.08),i,1,s);let o=[];for(let e=0;e<=96;e+=1){let t=e/96*Math.PI*2;o.push(n.clone().add(r.north.clone().multiplyScalar(Math.cos(t)*.62)).add(r.east.clone().multiplyScalar(Math.sin(t)*.62)))}let c=new Yr().setFromPoints(o),l=new Yi({color:new X(i),transparent:!0,opacity:.28});return s.add(new ra(c,l)),{basis:r,userPosition:n}},P=e=>{let t=be(e?.position?.latitude),n=be(e?.position?.longitude);for(let e of m.values())e.targetOpacity=0;if(T(s),t===null||n===null){N.value=`Waiting for receiver position`,A();return}let r=E(t,n,1).normalize(),i=new q(.1,.1,1).normalize();o.quaternion.copy(new Xt().setFromUnitVectors(r,i));let{basis:a,userPosition:c}=oe(t,n);for(let e of Ae.value){let t=e.prn,n=M(e,a,c),r=e.used?z(`--color-accent-green`,`#a5e5b6`):z(`--color-primary`,`#aae8e8`),i=e.used?.46:.26,o=m.get(t);if(o)o.targetPos.copy(n),o.targetOpacity=1,o.meshMat.color.set(r),o.lineMat.color.set(r),o.mesh.userData={satellite:e,used:e.used},o.linePosAttr.setXYZ(1,n.x,n.y,n.z),o.linePosAttr.needsUpdate=!0,o.labelSprite.position.copy(n.clone().multiplyScalar(1.035)),o.lineMat._targetOpacity=i;else{let n=ae(e,a,c);m.set(t,n)}}N.value=Ae.value.length?`${Ae.value.length} satellites plotted from GSV az/el using ${F(le.value.source_label||`receiver position`)}`:`No satellites in view yet`},se=new ResizeObserver(C);se.observe(t),C();let ce=()=>A(!0),ue=e=>e.preventDefault();e.addEventListener(`pointermove`,ee),e.addEventListener(`pointerleave`,ce),e.addEventListener(`wheel`,ue,{passive:!1});let de=()=>{p||(S.rotation.y+=.0012,b.rotation.y+=5e-4),a.update();let e=[];for(let[t,n]of m){n.opacity+=(n.targetOpacity-n.opacity)*.08;let r=Math.max(0,Math.min(1,n.opacity));n.meshMat.opacity=r;let i=(n.lineMat._targetOpacity??.46)*r;n.lineMat.opacity=i,n.labelMat.opacity=r,n.pos.lerp(n.targetPos,.12),n.mesh.position.copy(n.pos),n.labelSprite.position.copy(n.pos.clone().multiplyScalar(1.035)),n.linePosAttr.setXYZ(1,n.pos.x,n.pos.y,n.pos.z),n.linePosAttr.needsUpdate=!0;let a=n.mesh===h?1.75:1;f.set(a,a,a),n.mesh.scale.lerp(f,.18),n.targetOpacity===0&&r<.01&&e.push(t)}for(let t of e){let e=m.get(t);c.remove(e.mesh),l.remove(e.line),c.remove(e.labelSprite),e.mesh.geometry.dispose(),e.meshMat.dispose(),e.line.geometry.dispose(),e.lineMat.dispose(),e.labelMat.map?.dispose(),e.labelMat.dispose(),h===e.mesh&&(h=null,re.value=null),m.delete(t)}i.render(n,r),g=window.requestAnimationFrame(de)};return de(),{update:P,dispose(){window.cancelAnimationFrame(g),se.disconnect(),e.removeEventListener(`pointermove`,ee),e.removeEventListener(`pointerleave`,ce),e.removeEventListener(`wheel`,ue),a.dispose();for(let e of m.values())e.mesh.geometry.dispose(),e.meshMat.dispose(),e.line.geometry.dispose(),e.lineMat.dispose(),e.labelMat.map?.dispose(),e.labelMat.dispose();m.clear(),T(s),T(c),T(l),o.traverse(w),i.forceContextLoss(),i.dispose()}}},Me=async(e=D.value)=>{if(await i(),M.value){B(e);return}try{if(R&&te.value){let e=te.value.getBoundingClientRect();(e.width===0||e.height===0)&&(R.dispose(),R=null)}R||=V(),R.update(e)}catch(t){console.warn(`Satellite globe failed; using fallback`,t),M.value=!0,B(e)}};n(()=>{Me()}),r(D,e=>{Me(e)},{flush:`post`}),r(C,e=>{e===`overview`&&Me()}),r(w,e=>{e===`globe`&&Me()}),_(()=>{R?.dispose(),R=null});let Ne=f(()=>JSON.stringify(D.value??{},null,2));return(t,n)=>(u(),g(`div`,yu,[h(`div`,bu,[n[4]||=h(`div`,null,[h(`h1`,{class:`text-2xl font-semibold text-content-heading dark:text-white`},`GPS Diagnostics`),h(`p`,{class:`text-sm text-content-muted`},` Live NMEA receiver state, parsed fix data, and satellite visibility. `)],-1),h(`button`,{type:`button`,class:`rounded-[10px] border border-stroke-subtle dark:border-white/10 bg-white/80 dark:bg-white/10 px-4 py-2 text-sm font-semibold text-content-primary dark:text-white transition-colors hover:bg-white dark:hover:bg-white/20 disabled:cursor-not-allowed disabled:opacity-60`,disabled:O.value,onClick:_e},e(O.value?`Refreshing`:`Refresh`),9,xu)]),k.value?(u(),g(`div`,Su,e(k.value),1)):d(``,!0),h(`div`,Cu,[(u(!0),g(m,null,l(Te.value,t=>(u(),g(`section`,{key:t.label,class:`glass-card min-h-[118px] p-4`},[h(`p`,wu,e(t.label),1),h(`p`,{class:v([`mt-2 break-words text-xl font-semibold leading-tight`,t.valueClass])},e(t.value),3),h(`p`,Tu,e(t.note),1)]))),128))]),h(`div`,Eu,[(u(),g(m,null,l([{id:`overview`,label:`Overview`},{id:`satellites`,label:`Satellites`},{id:`details`,label:`Details`}],t=>h(`button`,{key:t.id,type:`button`,class:v([`page-tab`,{"page-tab-active":C.value===t.id}]),onClick:e=>C.value=t.id},e(t.label),11,Du)),64))]),o(h(`div`,null,[h(`div`,Ou,[h(`section`,ku,[h(`div`,Au,[h(`div`,null,[n[5]||=h(`h2`,{class:`text-lg font-semibold text-content-heading dark:text-white`},` Satellites `,-1),h(`p`,ju,e(Ae.value.length)+` satellite`+e(Ae.value.length===1?``:`s`)+` plotted from GSV azimuth, elevation, and SNR. `,1)]),h(`div`,Mu,[h(`span`,Nu,e(L.value),1),h(`div`,Pu,[h(`button`,{type:`button`,class:v([`inner-tab`,{"inner-tab-active":w.value===`globe`}]),onClick:n[0]||=e=>w.value=`globe`},`Globe`,2),h(`button`,{type:`button`,class:v([`inner-tab`,{"inner-tab-active":w.value===`table`}]),onClick:n[1]||=e=>w.value=`table`},`Table`,2)])])]),o(h(`div`,null,[h(`div`,{ref_key:`globeStage`,ref:te,class:`globe-stage`},[o(h(`canvas`,{ref_key:`globeCanvas`,ref:ne,"aria-label":`3D globe showing satellites around the current receiver position`},null,512),[[S,!M.value]]),M.value?(u(),g(`div`,Fu,[Ae.value.length?(u(),g(`div`,Iu,[(u(!0),g(m,null,l(Ae.value,t=>(u(),g(`div`,{key:t.key,class:v([`fallback-sat`,{"fallback-sat-used":t.used}]),style:a(je(t))},[h(`span`,null,e(t.prn),1)],6))),128))])):(u(),g(`div`,Lu,`No satellites in view yet`))])):d(``,!0),re.value?(u(),g(`div`,{key:1,class:`globe-tooltip`,style:a(ie.value),role:`status`,"aria-live":`polite`},[h(`div`,Ru,`SAT `+e(re.value.prn),1),h(`div`,zu,[n[6]||=h(`span`,{class:`tooltip-key`},`SNR`,-1),h(`span`,Bu,e(F(re.value.snr,`dB`)),1),n[7]||=h(`span`,{class:`tooltip-key`},`Elevation`,-1),h(`span`,Vu,e(F(re.value.elevation,`deg`)),1),n[8]||=h(`span`,{class:`tooltip-key`},`Azimuth`,-1),h(`span`,Hu,e(F(re.value.azimuth,`deg`)),1),n[9]||=h(`span`,{class:`tooltip-key`},`Used in fix`,-1),h(`span`,Uu,e(F(re.value.used)),1)])],4)):d(``,!0)],512),h(`div`,Wu,[h(`span`,null,e(N.value),1),n[10]||=h(`span`,null,`Drag to rotate · Scroll to zoom · Hover for details`,-1)]),h(`div`,Gu,[n[11]||=h(`span`,{class:`inline-flex items-center gap-2`},[h(`span`,{class:`h-2.5 w-2.5 rounded-full bg-accent-green`}),p(`Used in fix `)],-1),n[12]||=h(`span`,{class:`inline-flex items-center gap-2`},[h(`span`,{class:`h-2.5 w-2.5 rounded-full bg-primary`}),p(`In view `)],-1),h(`span`,null,`Last refresh: `+e(A.value?A.value.toLocaleTimeString():`n/a`),1)])],512),[[S,w.value===`globe`]]),o(h(`div`,null,[h(`div`,Ku,[h(`table`,qu,[n[14]||=h(`thead`,{class:`border-b border-stroke-subtle text-xs uppercase text-content-muted`},[h(`tr`,null,[h(`th`,{class:`py-2 pr-4 font-semibold`},`PRN`),h(`th`,{class:`py-2 pr-4 font-semibold`},`Used`),h(`th`,{class:`py-2 pr-4 font-semibold`},`Elevation`),h(`th`,{class:`py-2 pr-4 font-semibold`},`Azimuth`),h(`th`,{class:`py-2 pr-4 font-semibold`},`SNR`)])],-1),h(`tbody`,Ju,[(u(!0),g(m,null,l(I.value,t=>(u(),g(`tr`,{key:t.prn,class:v([`sat-row`,{"sat-row-stale":t.stale}])},[h(`td`,{class:v([`py-2 pr-4 font-medium`,t.used?`text-accent-green`:`text-content-primary dark:text-white`])},e(t.prn),3),h(`td`,Yu,[h(`span`,{class:v(t.used?`inline-flex items-center gap-1.5 text-accent-green`:`text-content-muted`)},[t.used?(u(),g(`span`,Xu)):d(``,!0),p(` `+e(t.used?`yes`:`–`),1)],2)]),h(`td`,Zu,e(F(t.data.elevation_degrees,`deg`)),1),h(`td`,Qu,e(F(t.data.azimuth_degrees,`deg`)),1),h(`td`,$u,e(F(t.data.snr_db,`dB`)),1)],2))),128)),I.value.length===0?(u(),g(`tr`,ed,[...n[13]||=[h(`td`,{colspan:`5`,class:`py-6 text-center text-content-muted`},`No satellites in view yet`,-1)]])):d(``,!0)])])])],512),[[S,w.value===`table`]])]),h(`section`,td,[n[20]||=h(`h2`,{class:`mb-4 text-lg font-semibold text-content-heading dark:text-white`},`Position`,-1),h(`div`,nd,[h(`div`,rd,[n[15]||=h(`span`,{class:`text-content-muted`},`Display source`,-1),h(`span`,id,e(F(le.value.source_label||le.value.source)),1)]),h(`div`,ad,[n[16]||=h(`span`,{class:`text-content-muted`},`Display location`,-1),h(`span`,od,e(Se(P.value.latitude,P.value.longitude)),1)]),h(`div`,sd,[n[17]||=h(`span`,{class:`text-content-muted`},`GPS location`,-1),h(`span`,cd,e(Se(se.value.latitude,se.value.longitude)),1)]),h(`div`,ld,[n[18]||=h(`span`,{class:`text-content-muted`},`Manual location`,-1),h(`span`,ud,e(ce.value?Se(ce.value.latitude,ce.value.longitude):`n/a`),1)]),h(`div`,dd,[n[19]||=h(`span`,{class:`text-content-muted`},`Policy`,-1),h(`span`,fd,e(F(le.value.policy)),1)])])])])],512),[[S,C.value===`overview`]]),o(h(`div`,null,[h(`section`,pd,[n[23]||=h(`h2`,{class:`mb-4 text-lg font-semibold text-content-heading dark:text-white`},`Satellites In View`,-1),h(`div`,md,[h(`table`,hd,[n[22]||=h(`thead`,{class:`border-b border-stroke-subtle text-xs uppercase text-content-muted`},[h(`tr`,null,[h(`th`,{class:`py-2 pr-4 font-semibold`},`PRN`),h(`th`,{class:`py-2 pr-4 font-semibold`},`Used`),h(`th`,{class:`py-2 pr-4 font-semibold`},`Elevation`),h(`th`,{class:`py-2 pr-4 font-semibold`},`Azimuth`),h(`th`,{class:`py-2 pr-4 font-semibold`},`SNR`)])],-1),h(`tbody`,gd,[(u(!0),g(m,null,l(I.value,t=>(u(),g(`tr`,{key:t.prn,class:v([`sat-row`,{"sat-row-stale":t.stale}])},[h(`td`,{class:v([`py-2 pr-4 font-medium`,t.used?`text-accent-green`:`text-content-primary dark:text-white`])},e(t.prn),3),h(`td`,_d,[h(`span`,{class:v(t.used?`inline-flex items-center gap-1.5 text-accent-green`:`text-content-muted`)},[t.used?(u(),g(`span`,vd)):d(``,!0),p(` `+e(t.used?`yes`:`–`),1)],2)]),h(`td`,yd,e(F(t.data.elevation_degrees,`deg`)),1),h(`td`,bd,e(F(t.data.azimuth_degrees,`deg`)),1),h(`td`,xd,e(F(t.data.snr_db,`dB`)),1)],2))),128)),I.value.length===0?(u(),g(`tr`,Sd,[...n[21]||=[h(`td`,{colspan:`5`,class:`py-6 text-center text-content-muted`},`No satellites in view yet`,-1)]])):d(``,!0)])])])])],512),[[S,C.value===`satellites`]]),o(h(`div`,null,[h(`div`,Cd,[(u(!0),g(m,null,l(Ee.value,t=>(u(),g(`div`,{key:t.title,class:`glass-card overflow-hidden`},[h(`button`,{type:`button`,class:`accordion-header`,onClick:e=>E(t.title)},[h(`span`,Td,e(t.title),1),(u(),g(`svg`,{class:v([`accordion-chevron`,{"accordion-chevron-open":T.value.has(t.title)}]),xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[...n[24]||=[h(`polyline`,{points:`6 9 12 15 18 9`},null,-1)]],2))],8,wd),T.value.has(t.title)?(u(),g(`div`,Ed,[h(`div`,Dd,[(u(!0),g(m,null,l(t.rows,n=>(u(),g(m,{key:`${t.title}-${n[0]}`},[h(`div`,Od,e(n[0]),1),h(`div`,kd,e(F(n[1],n[2])),1)],64))),128))])])):d(``,!0)]))),128))]),h(`section`,Ad,[h(`button`,{type:`button`,class:`accordion-header`,onClick:n[2]||=e=>E(`__nmea__`)},[n[26]||=h(`span`,{class:`font-semibold text-content-heading dark:text-white`},`Recent NMEA Sentences`,-1),(u(),g(`svg`,{class:v([`accordion-chevron`,{"accordion-chevron-open":T.value.has(`__nmea__`)}]),xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[...n[25]||=[h(`polyline`,{points:`6 9 12 15 18 9`},null,-1)]],2))]),T.value.has(`__nmea__`)?(u(),g(`div`,jd,[h(`div`,Md,[h(`table`,Nd,[n[28]||=h(`thead`,{class:`border-b border-stroke-subtle text-xs uppercase text-content-muted`},[h(`tr`,null,[h(`th`,{class:`py-2 pr-4 font-semibold`},`Timestamp`),h(`th`,{class:`py-2 pr-4 font-semibold`},`Type`),h(`th`,{class:`py-2 pr-4 font-semibold`},`Sentence`)])],-1),h(`tbody`,Pd,[(u(!0),g(m,null,l(Oe.value,t=>(u(),g(`tr`,{key:`${t.timestamp}-${t.sentence}`},[h(`td`,Fd,e(F(t.timestamp)),1),h(`td`,Id,e(F(t.sentence_type)),1),h(`td`,Ld,e(F(t.sentence)),1)]))),128)),Oe.value.length===0?(u(),g(`tr`,Rd,[...n[27]||=[h(`td`,{colspan:`3`,class:`py-6 text-center text-content-muted`},`No NMEA sentences captured yet`,-1)]])):d(``,!0)])])])])):d(``,!0)]),h(`section`,zd,[h(`div`,Bd,[n[29]||=h(`h2`,{class:`text-lg font-semibold text-content-heading dark:text-white`},`Raw Snapshot`,-1),h(`button`,{type:`button`,class:`rounded-[10px] border border-stroke-subtle dark:border-white/10 bg-white/70 dark:bg-white/10 px-3 py-1.5 text-xs font-semibold text-content-primary dark:text-white hover:bg-white dark:hover:bg-white/20`,onClick:n[3]||=e=>j.value=!j.value},e(j.value?`Hide`:`Show`),1)]),j.value?(u(),g(`pre`,Vd,e(Ne.value),1)):d(``,!0)])],512),[[S,C.value===`details`]])]))}}),[[`__scopeId`,`data-v-413c18f1`]]);export{Ud as default}; \ No newline at end of file +}`,Vl=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new la(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new xa({vertexShader:zl,fragmentShader:Bl,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Li(new da(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},Hl=class extends wt{constructor(e,t){super();let n=this,r=null,i=1,a=null,o=`local-floor`,s=1,c=null,l=null,u=null,d=null,f=null,p=null,m=typeof XRWebGLBinding<`u`,h=new Vl,g={},_=t.getContextAttributes(),v=null,y=null,b=[],x=[],S=new K,C=null,w=new ao;w.viewport=new mn;let T=new ao;T.viewport=new mn;let E=[w,T],D=new mo,O=null,k=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=b[e];return t===void 0&&(t=new Yn,b[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=b[e];return t===void 0&&(t=new Yn,b[e]=t),t.getGripSpace()},this.getHand=function(e){let t=b[e];return t===void 0&&(t=new Yn,b[e]=t),t.getHandSpace()};function A(e){let t=x.indexOf(e.inputSource);if(t===-1)return;let n=b[t];n!==void 0&&(n.update(e.inputSource,e.frame,c||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function j(){r.removeEventListener(`select`,A),r.removeEventListener(`selectstart`,A),r.removeEventListener(`selectend`,A),r.removeEventListener(`squeeze`,A),r.removeEventListener(`squeezestart`,A),r.removeEventListener(`squeezeend`,A),r.removeEventListener(`end`,j),r.removeEventListener(`inputsourceschange`,ee);for(let e=0;e=0&&(x[r]=null,b[r].disconnect(n))}for(let t=0;t=x.length){x.push(n),r=e;break}else if(x[e]===null){x[e]=n,r=e;break}if(r===-1)break}let i=b[r];i&&i.connect(n)}}let te=new q,M=new q;function N(e,t,n){te.setFromMatrixPosition(t.matrixWorld),M.setFromMatrixPosition(n.matrixWorld);let r=te.distanceTo(M),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(a[8]+1)/a[0],f=o*u,p=o*d,m=r/(-u+d),h=m*-u;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(h),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),i[10]===-1)e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=o+m,n=s+m,i=f-h,a=p+(r-h),u=c*s/n*t,d=l*s/n*t;e.projectionMatrix.makePerspective(i,a,u,d,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}function re(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(r===null)return;let t=e.near,n=e.far;h.texture!==null&&(h.depthNear>0&&(t=h.depthNear),h.depthFar>0&&(n=h.depthFar)),D.near=T.near=w.near=t,D.far=T.far=w.far=n,(O!==D.near||k!==D.far)&&(r.updateRenderState({depthNear:D.near,depthFar:D.far}),O=D.near,k=D.far),D.layers.mask=e.layers.mask|6,w.layers.mask=D.layers.mask&-5,T.layers.mask=D.layers.mask&-3;let i=e.parent,a=D.cameras;re(D,i);for(let e=0;e0&&(e.alphaTest.value=r.alphaTest);let i=t.get(r),a=i.envMap,o=i.envMapRotation;a&&(e.envMap.value=a,e.envMapRotation.value.setFromMatrix4(Ul.makeRotationFromEuler(o)).transpose(),a.isCubeTexture&&a.isRenderTargetTexture===!1&&e.envMapRotation.value.premultiply(Wl),e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,n(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,e.aoMapTransform))}function o(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}function s(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function c(e,t,r,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=i*.5,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function l(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function u(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}function d(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}function f(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function p(e,t,r){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===1&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}function m(e,t){t.matcap&&(e.matcap.value=t.matcap)}function h(e,n){let r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function Kl(e,t,n,r){let i={},a={},o=[],s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function c(e,t){let n=t.program;r.uniformBlockBinding(e,n)}function l(e,n){let o=i[e.id];o===void 0&&(m(e),o=u(e),i[e.id]=o,e.addEventListener(`dispose`,g));let s=n.program;r.updateUBOMapping(e,s);let c=t.render.frame;a[e.id]!==c&&(f(e),a[e.id]=c)}function u(t){let n=d();t.__bindingPointIndex=n;let r=e.createBuffer(),i=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,r),e.bufferData(e.UNIFORM_BUFFER,i,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,r),r}function d(){for(let e=0;e0&&(n+=16-r),e.__size=n,e.__cache={},this}function h(e){let t={boundary:0,storage:0};return typeof e==`number`||typeof e==`boolean`?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?H(`WebGLRenderer: Texture samplers can not be part of an uniforms group.`):ArrayBuffer.isView(e)?(t.boundary=16,t.storage=e.byteLength):H(`WebGLRenderer: Unsupported uniform value type.`,e),t}function g(t){let n=t.target;n.removeEventListener(`dispose`,g);let r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}function _(){for(let t in i)e.deleteBuffer(i[t]);o=[],i={},a={}}return{bind:c,update:l,dispose:_}}var ql=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),Jl=null;function Yl(){return Jl===null&&(Jl=new Bi(ql,16,16,ye,P),Jl.name=`DFG_LUT`,Jl.minFilter=j,Jl.magFilter=j,Jl.wrapS=E,Jl.wrapT=E,Jl.generateMipmaps=!1,Jl.needsUpdate=!0),Jl}var Xl=class{constructor(e={}){let{canvas:t=gt(),context:n=null,depth:r=!0,stencil:i=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:s=!0,preserveDrawingBuffer:c=!1,powerPreference:l=`default`,failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:d=!1,outputBufferType:f=ne}=e;this.isWebGLRenderer=!0;let p;if(n!==null){if(typeof WebGLRenderingContext<`u`&&n instanceof WebGLRenderingContext)throw Error(`THREE.WebGLRenderer: WebGL 1 is not supported since r163.`);p=n.getContextAttributes().alpha}else p=a;let m=f,h=new Set([xe,be,ve]),g=new Set([ne,ae,re,le,se,ce]),_=new Uint32Array(4),v=new Int32Array(4),y=new q,b=null,x=null,S=[],C=[],w=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let T=this,E=!1,D=null;this._outputColorSpace=at;let O=0,k=0,A=null,j=-1,ee=null,M=new mn,N=new mn,ie=null,oe=new X(0),ue=0,de=t.width,fe=t.height,pe=1,me=null,he=null,ge=new mn(0,0,de,fe),_e=new mn(0,0,de,fe),ye=!1,F=new Ji,Se=!1,Ce=!1,we=new yn,Te=new q,Ee=new mn,De={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},Oe=!1;function ke(){return A===null?pe:1}let I=n;function Ae(e,n){return t.getContext(e,n)}try{let e={alpha:!0,depth:r,stencil:i,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if(`setAttribute`in t&&t.setAttribute(`data-engine`,`three.js r184`),t.addEventListener(`webglcontextlost`,Ze,!1),t.addEventListener(`webglcontextrestored`,Qe,!1),t.addEventListener(`webglcontextcreationerror`,$e,!1),I===null){let t=`webgl2`;if(I=Ae(t,e),I===null)throw Ae(t)?Error(`Error creating WebGL context with your selected attributes.`):Error(`Error creating WebGL context.`)}}catch(e){throw U(`WebGLRenderer: `+e.message),e}let L,je,R,z,B,V,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,We,Ge,Ke,qe,Je;function Ye(){L=new ms(I),L.init(),Ke=new Rl(I,L),je=new Wo(I,L,e,Ke),R=new Il(I,L),je.reversedDepthBuffer&&d&&R.buffers.depth.setReversed(!0),z=new _s(I),B=new gl,V=new Ll(I,L,R,B,je,Ke,z),Me=new ps(T),Ne=new Io(I),qe=new Ho(I,Ne),Pe=new hs(I,Ne,z,qe),Fe=new ys(I,Pe,Ne,qe,z),Ue=new vs(I,je,V),Be=new Go(B),Ie=new hl(T,Me,L,je,qe,Be),Le=new Gl(T,B),Re=new bl,ze=new Dl(L),He=new Vo(T,Me,R,Fe,p,s),Ve=new Fl(T,Fe,je),Je=new Kl(I,z,je,R),We=new Uo(I,L,z),Ge=new gs(I,L,z),z.programs=Ie.programs,T.capabilities=je,T.extensions=L,T.properties=B,T.renderLists=Re,T.shadowMap=Ve,T.state=R,T.info=z}Ye(),m!==1009&&(w=new xs(m,t.width,t.height,r,i));let Xe=new Hl(T,I);this.xr=Xe,this.getContext=function(){return I},this.getContextAttributes=function(){return I.getContextAttributes()},this.forceContextLoss=function(){let e=L.get(`WEBGL_lose_context`);e&&e.loseContext()},this.forceContextRestore=function(){let e=L.get(`WEBGL_lose_context`);e&&e.restoreContext()},this.getPixelRatio=function(){return pe},this.setPixelRatio=function(e){e!==void 0&&(pe=e,this.setSize(de,fe,!1))},this.getSize=function(e){return e.set(de,fe)},this.setSize=function(e,n,r=!0){if(Xe.isPresenting){H(`WebGLRenderer: Can't change size while VR device is presenting.`);return}de=e,fe=n,t.width=Math.floor(e*pe),t.height=Math.floor(n*pe),r===!0&&(t.style.width=e+`px`,t.style.height=n+`px`),w!==null&&w.setSize(t.width,t.height),this.setViewport(0,0,e,n)},this.getDrawingBufferSize=function(e){return e.set(de*pe,fe*pe).floor()},this.setDrawingBufferSize=function(e,n,r){de=e,fe=n,pe=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.setEffects=function(e){if(m===1009){U(`THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.`);return}if(e){for(let t=0;t{function n(){if(r.forEach(function(e){B.get(e).currentProgram.isReady()&&r.delete(e)}),r.size===0){t(e);return}setTimeout(n,10)}L.get(`KHR_parallel_shader_compile`)===null?setTimeout(n,10):n()})};let it=null;function ot(e){it&&it(e)}function st(){lt.stop()}function ct(){lt.start()}let lt=new Fo;lt.setAnimationLoop(ot),typeof self<`u`&<.setContext(self),this.setAnimationLoop=function(e){it=e,Xe.setAnimationLoop(e),e===null?lt.stop():lt.start()},Xe.addEventListener(`sessionstart`,st),Xe.addEventListener(`sessionend`,ct),this.render=function(e,t){if(t!==void 0&&t.isCamera!==!0){U(`WebGLRenderer.render: camera is not an instance of THREE.Camera.`);return}if(E===!0)return;D!==null&&D.renderStart(e,t);let n=Xe.enabled===!0&&Xe.isPresenting===!0,r=w!==null&&(A===null||n)&&w.begin(T,A);if(e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),Xe.enabled===!0&&Xe.isPresenting===!0&&(w===null||w.isCompositing()===!1)&&(Xe.cameraAutoUpdate===!0&&Xe.updateCamera(t),t=Xe.getCamera()),e.isScene===!0&&e.onBeforeRender(T,e,t,A),x=ze.get(e,C.length),x.init(t),x.state.textureUnits=V.getTextureUnits(),C.push(x),we.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),F.setFromProjectionMatrix(we,ft,t.reversedDepth),Ce=this.localClippingEnabled,Se=Be.init(this.clippingPlanes,Ce),b=Re.get(e,S.length),b.init(),S.push(b),Xe.enabled===!0&&Xe.isPresenting===!0){let e=T.xr.getDepthSensingMesh();e!==null&&ut(e,t,-1/0,T.sortObjects)}ut(e,t,0,T.sortObjects),b.finish(),T.sortObjects===!0&&b.sort(me,he),Oe=Xe.enabled===!1||Xe.isPresenting===!1||Xe.hasDepthSensing()===!1,Oe&&He.addToRenderList(b,e),this.info.render.frame++,Se===!0&&Be.beginShadows();let i=x.state.shadowsArray;if(Ve.render(i,e,t),Se===!0&&Be.endShadows(),this.info.autoReset===!0&&this.info.reset(),(r&&w.hasRenderPass())===!1){let n=b.opaque,r=b.transmissive;if(x.setupLights(),t.isArrayCamera){let i=t.cameras;if(r.length>0)for(let t=0,a=i.length;t0&&pt(n,r,e,t),Oe&&He.render(e),dt(b,e,t)}A!==null&&k===0&&(V.updateMultisampleRenderTarget(A),V.updateRenderTargetMipmap(A)),r&&w.end(T),e.isScene===!0&&e.onAfterRender(T,e,t),qe.resetDefaultState(),j=-1,ee=null,C.pop(),C.length>0?(x=C[C.length-1],V.setTextureUnits(x.state.textureUnits),Se===!0&&Be.setGlobalState(T.clippingPlanes,x.state.camera)):x=null,S.pop(),b=S.length>0?S[S.length-1]:null,D!==null&&D.renderEnd()};function ut(e,t,n,r){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLightProbeGrid)x.pushLightProbeGrid(e);else if(e.isLight)x.pushLight(e),e.castShadow&&x.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||F.intersectsSprite(e)){r&&Ee.setFromMatrixPosition(e.matrixWorld).applyMatrix4(we);let t=Fe.update(e),i=e.material;i.visible&&b.push(e,t,i,n,Ee.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||F.intersectsObject(e))){let t=Fe.update(e),i=e.material;if(r&&(e.boundingSphere===void 0?(t.boundingSphere===null&&t.computeBoundingSphere(),Ee.copy(t.boundingSphere.center)):(e.boundingSphere===null&&e.computeBoundingSphere(),Ee.copy(e.boundingSphere.center)),Ee.applyMatrix4(e.matrixWorld).applyMatrix4(we)),Array.isArray(i)){let r=t.groups;for(let a=0,o=r.length;a0&&mt(i,t,n),a.length>0&&mt(a,t,n),o.length>0&&mt(o,t,n),R.buffers.depth.setTest(!0),R.buffers.depth.setMask(!0),R.buffers.color.setMask(!0),R.setPolygonOffset(!1)}function pt(e,t,n,r){if((n.isScene===!0?n.overrideMaterial:null)!==null)return;if(x.state.transmissionRenderTarget[r.id]===void 0){let e=L.has(`EXT_color_buffer_half_float`)||L.has(`EXT_color_buffer_float`);x.state.transmissionRenderTarget[r.id]=new gn(1,1,{generateMipmaps:!0,type:e?P:ne,minFilter:te,samples:Math.max(4,je.samples),stencilBuffer:i,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Y.workingColorSpace})}let a=x.state.transmissionRenderTarget[r.id],o=r.viewport||M;a.setSize(o.z*T.transmissionResolutionScale,o.w*T.transmissionResolutionScale);let s=T.getRenderTarget(),c=T.getActiveCubeFace(),l=T.getActiveMipmapLevel();T.setRenderTarget(a),T.getClearColor(oe),ue=T.getClearAlpha(),ue<1&&T.setClearColor(16777215,.5),T.clear(),Oe&&He.render(n);let u=T.toneMapping;T.toneMapping=0;let d=r.viewport;if(r.viewport!==void 0&&(r.viewport=void 0),x.setupLightsView(r),Se===!0&&Be.setGlobalState(T.clippingPlanes,r),mt(e,n,r),V.updateMultisampleRenderTarget(a),V.updateRenderTargetMipmap(a),L.has(`WEBGL_multisampled_render_to_texture`)===!1){let e=!1;for(let i=0,a=t.length;i0,r.currentProgram=d,r.uniformsList=null,d}function vt(e){if(e.uniformsList===null){let t=e.currentProgram.getUniforms();e.uniformsList=Oc.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function bt(e,t){let n=B.get(e);n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}function xt(e,t){if(e.length===0)return null;if(e.length===1)return e[0].texture===null?null:e[0];y.setFromMatrixPosition(t.matrixWorld);for(let t=0,n=e.length;t0),f=!!n.morphAttributes.position,p=!!n.morphAttributes.normal,m=!!n.morphAttributes.color,h=0;r.toneMapped&&(A===null||A.isXRRenderTarget===!0)&&(h=T.toneMapping);let g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,_=g===void 0?0:g.length,v=B.get(r),y=x.state.lights;if(Se===!0&&(Ce===!0||e!==ee)){let t=e===ee&&r.id===j;Be.setState(r,e,t)}let b=!1;r.version===v.__version?v.needsLights&&v.lightsStateVersion!==y.state.version?b=!0:v.outputColorSpace===s?i.isBatchedMesh&&v.batching===!1||!i.isBatchedMesh&&v.batching===!0||i.isBatchedMesh&&v.batchingColor===!0&&i.colorTexture===null||i.isBatchedMesh&&v.batchingColor===!1&&i.colorTexture!==null||i.isInstancedMesh&&v.instancing===!1||!i.isInstancedMesh&&v.instancing===!0||i.isSkinnedMesh&&v.skinning===!1||!i.isSkinnedMesh&&v.skinning===!0||i.isInstancedMesh&&v.instancingColor===!0&&i.instanceColor===null||i.isInstancedMesh&&v.instancingColor===!1&&i.instanceColor!==null||i.isInstancedMesh&&v.instancingMorph===!0&&i.morphTexture===null||i.isInstancedMesh&&v.instancingMorph===!1&&i.morphTexture!==null?b=!0:v.envMap===l?r.fog===!0&&v.fog!==a||v.numClippingPlanes!==void 0&&(v.numClippingPlanes!==Be.numPlanes||v.numIntersection!==Be.numIntersection)?b=!0:v.vertexAlphas===u&&v.vertexTangents===d&&v.morphTargets===f&&v.morphNormals===p&&v.morphColors===m&&v.toneMapping===h&&v.morphTargetsCount===_?!!v.lightProbeGrid!=x.state.lightProbeGridArray.length>0&&(b=!0):b=!0:b=!0:b=!0:(b=!0,v.__version=r.version);let S=v.currentProgram;b===!0&&(S=_t(r,t,i),D&&r.isNodeMaterial&&D.onUpdateProgram(r,S,v));let C=!1,w=!1,E=!1,O=S.getUniforms(),k=v.uniforms;if(R.useProgram(S.program)&&(C=!0,w=!0,E=!0),r.id!==j&&(j=r.id,w=!0),v.needsLights){let e=xt(x.state.lightProbeGridArray,i);v.lightProbeGrid!==e&&(v.lightProbeGrid=e,w=!0)}if(C||ee!==e){R.buffers.depth.getReversed()&&e.reversedDepth!==!0&&(e._reversedDepth=!0,e.updateProjectionMatrix()),O.setValue(I,`projectionMatrix`,e.projectionMatrix),O.setValue(I,`viewMatrix`,e.matrixWorldInverse);let t=O.map.cameraPosition;t!==void 0&&t.setValue(I,Te.setFromMatrixPosition(e.matrixWorld)),je.logarithmicDepthBuffer&&O.setValue(I,`logDepthBufFC`,2/(Math.log(e.far+1)/Math.LN2)),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&O.setValue(I,`isOrthographic`,e.isOrthographicCamera===!0),ee!==e&&(ee=e,w=!0,E=!0)}if(v.needsLights&&(y.state.directionalShadowMap.length>0&&O.setValue(I,`directionalShadowMap`,y.state.directionalShadowMap,V),y.state.spotShadowMap.length>0&&O.setValue(I,`spotShadowMap`,y.state.spotShadowMap,V),y.state.pointShadowMap.length>0&&O.setValue(I,`pointShadowMap`,y.state.pointShadowMap,V)),i.isSkinnedMesh){O.setOptional(I,i,`bindMatrix`),O.setOptional(I,i,`bindMatrixInverse`);let e=i.skeleton;e&&(e.boneTexture===null&&e.computeBoneTexture(),O.setValue(I,`boneTexture`,e.boneTexture,V))}i.isBatchedMesh&&(O.setOptional(I,i,`batchingTexture`),O.setValue(I,`batchingTexture`,i._matricesTexture,V),O.setOptional(I,i,`batchingIdTexture`),O.setValue(I,`batchingIdTexture`,i._indirectTexture,V),O.setOptional(I,i,`batchingColorTexture`),i._colorsTexture!==null&&O.setValue(I,`batchingColorTexture`,i._colorsTexture,V));let te=n.morphAttributes;if((te.position!==void 0||te.normal!==void 0||te.color!==void 0)&&Ue.update(i,n,S),(w||v.receiveShadow!==i.receiveShadow)&&(v.receiveShadow=i.receiveShadow,O.setValue(I,`receiveShadow`,i.receiveShadow)),(r.isMeshStandardMaterial||r.isMeshLambertMaterial||r.isMeshPhongMaterial)&&r.envMap===null&&t.environment!==null&&(k.envMapIntensity.value=t.environmentIntensity),k.dfgLUT!==void 0&&(k.dfgLUT.value=Yl()),w){if(O.setValue(I,`toneMappingExposure`,T.toneMappingExposure),v.needsLights&&wt(k,E),a&&r.fog===!0&&Le.refreshFogUniforms(k,a),Le.refreshMaterialUniforms(k,r,pe,fe,x.state.transmissionRenderTarget[e.id]),v.needsLights&&v.lightProbeGrid){let e=v.lightProbeGrid;k.probesSH.value=e.texture,k.probesMin.value.copy(e.boundingBox.min),k.probesMax.value.copy(e.boundingBox.max),k.probesResolution.value.copy(e.resolution)}Oc.upload(I,vt(v),k,V)}if(r.isShaderMaterial&&r.uniformsNeedUpdate===!0&&(Oc.upload(I,vt(v),k,V),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&O.setValue(I,`center`,i.center),O.setValue(I,`modelViewMatrix`,i.modelViewMatrix),O.setValue(I,`normalMatrix`,i.normalMatrix),O.setValue(I,`modelMatrix`,i.matrixWorld),r.uniformsGroups!==void 0){let e=r.uniformsGroups;for(let t=0,n=e.length;t0&&V.useMultisampledRTT(e)===!1?B.get(e).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,M.copy(e.viewport),N.copy(e.scissor),ie=e.scissorTest}else M.copy(ge).multiplyScalar(pe).floor(),N.copy(_e).multiplyScalar(pe).floor(),ie=ye;if(n!==0&&(r=Et),R.bindFramebuffer(I.FRAMEBUFFER,r)&&R.drawBuffers(e,r),R.viewport(M),R.scissor(N),R.setScissorTest(ie),i){let r=B.get(e.texture);I.framebufferTexture2D(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(a){let r=t;for(let t=0;t1&&I.readBuffer(I.COLOR_ATTACHMENT0+s),!je.textureFormatReadable(c)){U(`WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.`);return}if(!je.textureTypeReadable(l)){U(`WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.`);return}t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&I.readPixels(t,n,r,i,Ke.convert(c),Ke.convert(l),a)}finally{let e=A===null?null:B.get(A).__webglFramebuffer;R.bindFramebuffer(I.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget))throw Error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);let c=B.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c)if(t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i){R.bindFramebuffer(I.FRAMEBUFFER,c);let o=e.textures[s],l=o.format,u=o.type;if(e.textures.length>1&&I.readBuffer(I.COLOR_ATTACHMENT0+s),!je.textureFormatReadable(l))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.`);if(!je.textureTypeReadable(u))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.`);let d=I.createBuffer();I.bindBuffer(I.PIXEL_PACK_BUFFER,d),I.bufferData(I.PIXEL_PACK_BUFFER,a.byteLength,I.STREAM_READ),I.readPixels(t,n,r,i,Ke.convert(l),Ke.convert(u),0);let f=A===null?null:B.get(A).__webglFramebuffer;R.bindFramebuffer(I.FRAMEBUFFER,f);let p=I.fenceSync(I.SYNC_GPU_COMMANDS_COMPLETE,0);return I.flush(),await St(I,p,4),I.bindBuffer(I.PIXEL_PACK_BUFFER,d),I.getBufferSubData(I.PIXEL_PACK_BUFFER,0,a),I.deleteBuffer(d),I.deleteSync(p),a}else throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.`)},this.copyFramebufferToTexture=function(e,t=null,n=0){let r=2**-n,i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),o=t===null?0:t.x,s=t===null?0:t.y;V.setTexture2D(e,0),I.copyTexSubImage2D(I.TEXTURE_2D,n,0,0,o,s,i,a),R.unbindTexture()};let Dt=I.createFramebuffer(),Ot=I.createFramebuffer();this.copyTextureToTexture=function(e,t,n=null,r=null,i=0,a=0){let o,s,c,l,u,d,f,p,m,h=e.isCompressedTexture?e.mipmaps[a]:e.image;if(n!==null)o=n.max.x-n.min.x,s=n.max.y-n.min.y,c=n.isBox3?n.max.z-n.min.z:1,l=n.min.x,u=n.min.y,d=n.isBox3?n.min.z:0;else{let t=2**-i;o=Math.floor(h.width*t),s=Math.floor(h.height*t),c=e.isDataArrayTexture?h.depth:e.isData3DTexture?Math.floor(h.depth*t):1,l=0,u=0,d=0}r===null?(f=0,p=0,m=0):(f=r.x,p=r.y,m=r.z);let g=Ke.convert(t.format),_=Ke.convert(t.type),v;t.isData3DTexture?(V.setTexture3D(t,0),v=I.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(V.setTexture2DArray(t,0),v=I.TEXTURE_2D_ARRAY):(V.setTexture2D(t,0),v=I.TEXTURE_2D),R.activeTexture(I.TEXTURE0),R.pixelStorei(I.UNPACK_FLIP_Y_WEBGL,t.flipY),R.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),R.pixelStorei(I.UNPACK_ALIGNMENT,t.unpackAlignment);let y=R.getParameter(I.UNPACK_ROW_LENGTH),b=R.getParameter(I.UNPACK_IMAGE_HEIGHT),x=R.getParameter(I.UNPACK_SKIP_PIXELS),S=R.getParameter(I.UNPACK_SKIP_ROWS),C=R.getParameter(I.UNPACK_SKIP_IMAGES);R.pixelStorei(I.UNPACK_ROW_LENGTH,h.width),R.pixelStorei(I.UNPACK_IMAGE_HEIGHT,h.height),R.pixelStorei(I.UNPACK_SKIP_PIXELS,l),R.pixelStorei(I.UNPACK_SKIP_ROWS,u),R.pixelStorei(I.UNPACK_SKIP_IMAGES,d);let w=e.isDataArrayTexture||e.isData3DTexture,T=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let n=B.get(e),r=B.get(t),h=B.get(n.__renderTarget),g=B.get(r.__renderTarget);R.bindFramebuffer(I.READ_FRAMEBUFFER,h.__webglFramebuffer),R.bindFramebuffer(I.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let n=0;nMath.PI&&(n-=iu),r<-Math.PI?r+=iu:r>Math.PI&&(r-=iu),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let i=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{let e=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),i=e!=this._spherical.radius}if(ru.setFromSpherical(this._spherical),ru.applyQuaternion(this._quatInverse),t.copy(this.target).add(ru),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let e=null;if(this.object.isPerspectiveCamera){let t=ru.length();e=this._clampDistance(t*this._scale);let n=t-e;this.object.position.addScaledVector(this._dollyDirection,n),this.object.updateMatrixWorld(),i=!!n}else if(this.object.isOrthographicCamera){let t=new q(this._mouse.x,this._mouse.y,0);t.unproject(this.object);let n=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),i=n!==this.object.zoom;let r=new q(this._mouse.x,this._mouse.y,0);r.unproject(this.object),this.object.position.sub(r).add(t),this.object.updateMatrixWorld(),e=ru.length()}else console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled.`),this.zoomToCursor=!1;e!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(e).add(this.object.position):(eu.origin.copy(this.object.position),eu.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(eu.direction))au||8*(1-this._lastQuaternion.dot(this.object.quaternion))>au||this._lastTargetPosition.distanceToSquared(this.target)>au?(this.dispatchEvent(Zl),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e===null?iu/60/60*this.autoRotateSpeed:iu/60*this.autoRotateSpeed*e}_getZoomScale(e){let t=Math.abs(e*.01);return .95**(this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){ru.setFromMatrixColumn(t,0),ru.multiplyScalar(-e),this._panOffset.add(ru)}_panUp(e,t){this.screenSpacePanning===!0?ru.setFromMatrixColumn(t,1):(ru.setFromMatrixColumn(t,0),ru.crossVectors(this.object.up,ru)),ru.multiplyScalar(e),this._panOffset.add(ru)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;ru.copy(r).sub(this.target);let i=ru.length();i*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*i/n.clientHeight,this.object.matrix),this._panUp(2*t*i/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.`),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),r=e-n.left,i=t-n.top,a=n.width,o=n.height;this._mouse.x=r/a*2-1,this._mouse.y=-(i/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(iu*this._rotateDelta.x/t.clientHeight),this._rotateUp(iu*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(iu*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-iu*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(iu*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-iu*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);this._dollyStart.set(0,i)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateEnd.set(n,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(iu*this._rotateDelta.x/t.clientHeight),this._rotateUp(iu*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,i),this._dollyDelta.set(0,(this._dollyEnd.y/this._dollyStart.y)**+this.zoomSpeed),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t{T.value.has(e)?T.value.delete(e):T.value.add(e),T.value=new Set(T.value)},D=s(null),O=s(!0),k=s(null),A=s(null),j=s(!1),ee=s(null),te=s(null),ne=s(null),M=s(!1),N=s(`Waiting for satellite data`),re=s(null),ie=s({left:`0px`,top:`0px`}),ae=f(()=>D.value?.status??{}),oe=f(()=>D.value?.fix??{}),P=f(()=>D.value?.position??{}),se=f(()=>D.value?.gps_position??D.value?.position??{}),ce=f(()=>D.value?.manual_position??null),le=f(()=>{let e=D.value?.position_meta??{},t=e.gps_fix_valid??!!ae.value.fix_valid;return{source:e.source??`gps`,source_label:e.source_label??(t?`GPS fix`:`GPS estimate`),policy:e.policy??`gps_only`,manual_config_available:!!e.manual_config_available,gps_fix_valid:t}}),ue=f(()=>D.value?.motion??{}),de=f(()=>D.value?.accuracy??{}),fe=f(()=>D.value?.time??{}),pe=f(()=>D.value?.satellites??{}),me=f(()=>D.value?.nmea??{}),he=f(()=>D.value?.source??{}),ge=e=>{D.value=e,A.value=new Date,k.value=null,O.value=!1},_e=async()=>{try{D.value||(O.value=!0),k.value=null;let e=await x.getGpsDiagnostics();if(e.success===!1)throw Error(e.error||`GPS API error`);ge(e.data??null)}catch(e){k.value=e instanceof Error?e.message:`Failed to load GPS diagnostics`}finally{O.value=!1}},ve=()=>{ee.value&&=(ee.value.close(),null)},ye=()=>{ve();let e=b(),t=e?`?token=${encodeURIComponent(e)}`:``;ee.value=new EventSource(`/api/gps-stream${t}`),ee.value.onmessage=e=>{try{let t=JSON.parse(e.data);if(!t||typeof t!=`object`)return;let n=t;if(n.type===`snapshot`){ge(n.data??null);return}n.success===!0&&ge(n.data??null)}catch(e){console.error(`Failed to parse GPS SSE payload:`,e)}},ee.value.onerror=()=>{D.value||(k.value=`GPS live stream disconnected. Reconnecting...`,O.value=!1)}};n(async()=>{await _e(),ye()}),t(()=>{ve()});let be=e=>{let t=Number(e);return Number.isFinite(t)?t:null},xe=e=>String(Number.isInteger(e)?e:Number(e.toFixed(6))),F=(e,t=``)=>e==null||e===``?`n/a`:typeof e==`boolean`?e?`yes`:`no`:Array.isArray(e)?e.length?e.join(`, `):`none`:typeof e==`number`?`${xe(e)}${t?` ${t}`:``}`:`${String(e)}${t?` ${t}`:``}`,Se=(e,t)=>e==null||t==null?`n/a`:`${xe(e)}, ${xe(t)}`,Ce=f(()=>(ae.value.state??`unknown`).split(`_`).join(` `)),we=f(()=>{switch(ae.value.state){case`valid_fix`:return`text-accent-green`;case`error`:return`text-accent-red`;case`invalid_fix`:case`stale`:case`no_data`:case`disabled`:return`text-secondary`;default:return`text-content-muted`}}),Te=f(()=>[{label:`Fix State`,value:Ce.value,note:ae.value.last_error||`quality: ${F(oe.value.quality_label)}`,valueClass:we.value},{label:`Coordinates`,value:Se(P.value.latitude,P.value.longitude),note:`${F(le.value.source_label)} | altitude: ${F(P.value.altitude_m,`m`)}`,valueClass:`text-content-heading dark:text-white`},{label:`Satellites`,value:`${F(pe.value.used_count)} / ${F(pe.value.in_view_count)}`,note:`SNR avg: ${F(pe.value.snr?.avg,`dB`)}`,valueClass:`text-content-heading dark:text-white`},{label:`Freshness`,value:ae.value.age_seconds===null||ae.value.age_seconds===void 0?`n/a`:`${F(ae.value.age_seconds)}s`,note:ae.value.last_update||`last update unknown`,valueClass:ae.value.stale?`text-secondary`:`text-content-heading dark:text-white`},{label:`GPS Time`,value:fe.value.utc_time??`n/a`,note:fe.value.date??`no date`,valueClass:fe.value.utc_time?`text-content-heading dark:text-white`:`text-content-muted`}]),Ee=f(()=>[{title:`Receiver Source`,rows:[[`enabled`,D.value?.enabled],[`running`,D.value?.running],[`source type`,he.value.type],[`device`,he.value.device],[`baud rate`,he.value.baud_rate],[`source path`,he.value.source_path],[`read timeout`,he.value.read_timeout_seconds,`s`],[`poll interval`,he.value.poll_interval_seconds,`s`],[`stale after`,he.value.stale_after_seconds,`s`]]},{title:`Fix`,rows:[[`valid`,oe.value.valid],[`status`,oe.value.status],[`quality`,oe.value.quality],[`quality label`,oe.value.quality_label],[`GSA fix type`,oe.value.gsa_fix_type],[`GSA label`,oe.value.gsa_fix_type_label]]},{title:`Position`,rows:[[`display source`,le.value.source_label||le.value.source],[`policy`,le.value.policy],[`display latitude`,P.value.latitude],[`display longitude`,P.value.longitude],[`GPS latitude`,se.value.latitude],[`GPS longitude`,se.value.longitude],[`manual latitude`,ce.value?.latitude],[`manual longitude`,ce.value?.longitude],[`altitude`,P.value.altitude_m,`m`],[`geoid separation`,P.value.geoid_separation_m,`m`]]},{title:`Motion`,rows:[[`speed`,ue.value.speed_knots,`knots`],[`speed`,ue.value.speed_kmh,`km/h`],[`course`,ue.value.course_degrees,`deg`],[`magnetic variation`,ue.value.magnetic_variation_degrees,`deg`]]},{title:`Accuracy`,rows:[[`HDOP`,de.value.hdop],[`PDOP`,de.value.pdop],[`VDOP`,de.value.vdop]]},{title:`Time`,rows:[[`UTC time`,fe.value.utc_time],[`date`,fe.value.date],[`datetime UTC`,fe.value.datetime_utc]]},{title:`NMEA Health`,rows:[[`last talker`,me.value.last_talker],[`last sentence type`,me.value.last_sentence_type],[`seen sentence types`,me.value.seen_sentence_types],[`valid checksums`,me.value.valid_checksum_count],[`invalid checksums`,me.value.invalid_checksum_count],[`missing checksums`,me.value.missing_checksum_count],[`last sentence`,me.value.last_sentence]]}]),De=f(()=>pe.value.in_view??[]),Oe=f(()=>me.value.recent_sentences??[]),ke=s(new Map),I=f(()=>[...ke.value.values()].sort((e,t)=>e.prn.localeCompare(t.prn,void 0,{numeric:!0})));r(pe,e=>{let t=e?.in_view??[],n=new Set((e?.used_prns??[]).map(String)),r=new Set;for(let e of t){let t=String(e.prn??`?`);r.add(t);let i=ke.value.get(t);i?(i.staleTimer!==null&&(clearTimeout(i.staleTimer),i.staleTimer=null),i.data=e,i.used=n.has(t),i.stale=!1):ke.value.set(t,{prn:t,data:e,used:n.has(t),stale:!1,staleTimer:null})}for(let[e,t]of ke.value)!r.has(e)&&!t.stale&&(t.stale=!0,t.staleTimer=setTimeout(()=>{ke.value.delete(e),ke.value=new Map(ke.value)},Hd));ke.value=new Map(ke.value)},{deep:!1});let Ae=f(()=>{let e=new Set((pe.value.used_prns??[]).map(String));return De.value.map(t=>{let n=be(t.azimuth_degrees),r=be(t.elevation_degrees);if(n===null||r===null)return null;let i=Math.max(0,Math.min(60,be(t.snr_db)??0)),a=(1-Math.max(0,Math.min(90,r))/90)*82,o=n*Math.PI/180,s=t.prn??`?`;return{key:`${s}-${n}-${r}`,prn:String(s),x:100+Math.sin(o)*a,y:100-Math.cos(o)*a,size:4+i/60*7,used:e.has(String(s)),snr:i,elevation:r,azimuth:n,raw:t}}).filter(e=>e!==null)}),L=f(()=>`${Ae.value.length} sat${Ae.value.length===1?``:`s`}`),je=e=>({left:`${e.x/2}%`,top:`${e.y/2}%`,"--size":`${e.size+5}px`}),R=null,z=(e,t)=>typeof window>`u`?t:window.getComputedStyle(document.documentElement).getPropertyValue(e).trim()||t,B=e=>{let t=Ae.value.length;if(!e){N.value=`Waiting for satellite data`;return}N.value=t?`2D fallback: ${t} satellites plotted from GSV az/el`:`Waiting for satellites in view`},V=()=>{let e=ne.value,t=te.value;if(!e||!t)throw Error(`Satellite globe container is not mounted`);let n=new tr,r=new ao(38,1,.1,100),i=new Xl({canvas:e,alpha:!0,antialias:!0,powerPreference:`low-power`}),a=new ou(r,i.domElement),o=new qn,s=new qn,c=new qn,l=new qn,u=new Oo,d=new K,f=new q,p=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,m=new Map,h=null,g=0;r.position.set(0,.1,3.72),i.setClearColor(0,0),i.setPixelRatio(Math.min(window.devicePixelRatio||1,1.5)),a.enableDamping=!0,a.dampingFactor=.08,a.enablePan=!1,a.minDistance=2.45,a.maxDistance=5.6,a.rotateSpeed=.55,a.zoomSpeed=.72,a.target.set(0,0,0),a.update(),n.add(new lo(16777215,.84));let _=new co(16777215,.78);_.position.set(2.7,2.2,3.4),n.add(_);let v=new Ca({color:new X(z(`--color-primary`,`#0d7377`)),roughness:.62,metalness:.04}),y=new Li(new fa(1,56,36),v);new Ka().load(S,e=>{e.anisotropy=window.innerWidth<1024?Math.min(2,i.capabilities.getMaxAnisotropy()):i.capabilities.getMaxAnisotropy(),v.map=e,v.color.set(16777215),v.roughness=.82,v.needsUpdate=!0},void 0,()=>{N.value=`Earth texture unavailable; using local fallback globe`});let b=new Li(new fa(1.006,28,18),new Ti({color:new X(z(`--color-primary`,`#aae8e8`)),wireframe:!0,transparent:!0,opacity:.16})),x=new Li(new fa(1.045,48,24),new Ti({color:new X(z(`--color-primary`,`#aae8e8`)),transparent:!0,opacity:.1,side:1}));o.add(y,b,x,l,c,s),n.add(o);let C=()=>{let e=t.getBoundingClientRect(),n=Math.max(240,Math.floor(e.width)),a=Math.max(240,Math.floor(e.height));i.setSize(n,a,!1),r.aspect=n/a,r.updateProjectionMatrix()},w=e=>{let t=e;t.geometry?.dispose(),(Array.isArray(t.material)?t.material:[t.material]).forEach(e=>{e&&(e.map?.dispose(),e.dispose())})},T=e=>{for(;e.children.length;){let t=e.children.pop();t&&(t.traverse(w),e.remove(t))}},E=(e,t,n=1)=>{let r=e*Math.PI/180,i=t*Math.PI/180;return new q(Math.cos(r)*Math.cos(i),Math.sin(r),-Math.cos(r)*Math.sin(i)).multiplyScalar(n)},D=(e,t)=>{let n=e*Math.PI/180,r=t*Math.PI/180,i=E(e,t,1).normalize();return{east:new q(-Math.sin(r),0,-Math.cos(r)).normalize(),north:new q(-Math.sin(n)*Math.cos(r),Math.cos(n),Math.sin(n)*Math.sin(r)).normalize(),up:i}},O=(e,t,n,r,i,a)=>{e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath()},k=(e,t,n,r=1,i=c)=>{let a=document.createElement(`canvas`);a.width=192,a.height=76;let o=a.getContext(`2d`);if(!o)return;o.font=`800 28px Inter, sans-serif`,o.textAlign=`center`,o.textBaseline=`middle`,O(o,20,14,152,48,16),o.fillStyle=`rgba(3, 8, 10, 0.88)`,o.fill(),o.lineWidth=3,o.strokeStyle=n,o.stroke(),o.fillStyle=`#ffffff`,o.shadowColor=`rgba(0, 0, 0, 0.92)`,o.shadowBlur=7,o.fillText(e,96,39);let s=new hi(new ti({map:new oa(a),transparent:!0,opacity:.98,depthTest:!1,depthWrite:!1}));return s.position.copy(t),s.scale.set(.3*r,.12*r,1),s.renderOrder=10,i.add(s),s},A=(e=!1)=>{h=null,re.value=null},j=(e,n)=>{let r=e.userData.satellite;if(!r)return;let i=t.getBoundingClientRect();ie.value={left:`${Math.max(86,Math.min(i.width-86,n.clientX-i.left))}px`,top:`${Math.max(84,Math.min(i.height-12,n.clientY-i.top))}px`},re.value=r},ee=t=>{let n=e.getBoundingClientRect();d.x=(t.clientX-n.left)/n.width*2-1,d.y=-((t.clientY-n.top)/n.height*2-1),u.setFromCamera(d,r);let i=[...m.values()].map(e=>e.mesh),a=u.intersectObjects(i,!1)[0];h=a?a.object:null,h?j(h,t):A()},M=(e,t,n)=>{let r=e.azimuth*Math.PI/180,i=Math.max(0,Math.min(90,e.elevation))*Math.PI/180,a=t.north.clone().multiplyScalar(Math.cos(r)).add(t.east.clone().multiplyScalar(Math.sin(r))).multiplyScalar(Math.cos(i)).add(t.up.clone().multiplyScalar(Math.sin(i))).normalize();return n.clone().add(a.multiplyScalar(.62))},ae=(e,t,n)=>{let r=M(e,t,n),i=e.used?z(`--color-accent-green`,`#a5e5b6`):z(`--color-primary`,`#aae8e8`),a=.024+e.snr/60*.042,o=new Ti({color:new X(i),transparent:!0,opacity:0}),s=new Li(new fa(a,16,12),o);s.position.copy(r),s.userData={satellite:e,used:e.used},c.add(s);let u=n.clone().multiplyScalar(1.012),d=new Pr(new Float32Array([u.x,u.y,u.z,r.x,r.y,r.z]),3);d.setUsage(dt);let f=new Yr;f.setAttribute(`position`,d);let p=new Yi({color:new X(i),transparent:!0,opacity:0}),m=new ra(f,p);l.add(m);let h=r.clone().multiplyScalar(1.035),g=new ti({transparent:!0,opacity:0,depthTest:!1,depthWrite:!1}),_=k(e.prn,h,i,.88),v=_.material;return g.map=v.map,v.dispose(),_.material=g,{mesh:s,meshMat:o,line:m,lineMat:p,linePosAttr:d,labelSprite:_,labelMat:g,opacity:0,targetOpacity:1,pos:r.clone(),targetPos:r.clone()}},oe=(e,t)=>{let n=E(e,t,1.022),r=D(e,t),i=z(`--color-accent-green`,`#a5e5b6`),a=new Li(new fa(.032,18,14),new Ti({color:new X(i)}));a.position.copy(n),s.add(a),k(`YOU`,n.clone().multiplyScalar(1.08),i,1,s);let o=[];for(let e=0;e<=96;e+=1){let t=e/96*Math.PI*2;o.push(n.clone().add(r.north.clone().multiplyScalar(Math.cos(t)*.62)).add(r.east.clone().multiplyScalar(Math.sin(t)*.62)))}let c=new Yr().setFromPoints(o),l=new Yi({color:new X(i),transparent:!0,opacity:.28});return s.add(new ra(c,l)),{basis:r,userPosition:n}},P=e=>{let t=be(e?.position?.latitude),n=be(e?.position?.longitude);for(let e of m.values())e.targetOpacity=0;if(T(s),t===null||n===null){N.value=`Waiting for receiver position`,A();return}let r=E(t,n,1).normalize(),i=new q(.1,.1,1).normalize();o.quaternion.copy(new Xt().setFromUnitVectors(r,i));let{basis:a,userPosition:c}=oe(t,n);for(let e of Ae.value){let t=e.prn,n=M(e,a,c),r=e.used?z(`--color-accent-green`,`#a5e5b6`):z(`--color-primary`,`#aae8e8`),i=e.used?.46:.26,o=m.get(t);if(o)o.targetPos.copy(n),o.targetOpacity=1,o.meshMat.color.set(r),o.lineMat.color.set(r),o.mesh.userData={satellite:e,used:e.used},o.linePosAttr.setXYZ(1,n.x,n.y,n.z),o.linePosAttr.needsUpdate=!0,o.labelSprite.position.copy(n.clone().multiplyScalar(1.035)),o.lineMat._targetOpacity=i;else{let n=ae(e,a,c);m.set(t,n)}}N.value=Ae.value.length?`${Ae.value.length} satellites plotted from GSV az/el using ${F(le.value.source_label||`receiver position`)}`:`No satellites in view yet`},se=new ResizeObserver(C);se.observe(t),C();let ce=()=>A(!0),ue=e=>e.preventDefault();e.addEventListener(`pointermove`,ee),e.addEventListener(`pointerleave`,ce),e.addEventListener(`wheel`,ue,{passive:!1});let de=()=>{p||(x.rotation.y+=.0012,b.rotation.y+=5e-4),a.update();let e=[];for(let[t,n]of m){n.opacity+=(n.targetOpacity-n.opacity)*.08;let r=Math.max(0,Math.min(1,n.opacity));n.meshMat.opacity=r;let i=(n.lineMat._targetOpacity??.46)*r;n.lineMat.opacity=i,n.labelMat.opacity=r,n.pos.lerp(n.targetPos,.12),n.mesh.position.copy(n.pos),n.labelSprite.position.copy(n.pos.clone().multiplyScalar(1.035)),n.linePosAttr.setXYZ(1,n.pos.x,n.pos.y,n.pos.z),n.linePosAttr.needsUpdate=!0;let a=n.mesh===h?1.75:1;f.set(a,a,a),n.mesh.scale.lerp(f,.18),n.targetOpacity===0&&r<.01&&e.push(t)}for(let t of e){let e=m.get(t);c.remove(e.mesh),l.remove(e.line),c.remove(e.labelSprite),e.mesh.geometry.dispose(),e.meshMat.dispose(),e.line.geometry.dispose(),e.lineMat.dispose(),e.labelMat.map?.dispose(),e.labelMat.dispose(),h===e.mesh&&(h=null,re.value=null),m.delete(t)}i.render(n,r),g=window.requestAnimationFrame(de)};return de(),{update:P,dispose(){window.cancelAnimationFrame(g),se.disconnect(),e.removeEventListener(`pointermove`,ee),e.removeEventListener(`pointerleave`,ce),e.removeEventListener(`wheel`,ue),a.dispose();for(let e of m.values())e.mesh.geometry.dispose(),e.meshMat.dispose(),e.line.geometry.dispose(),e.lineMat.dispose(),e.labelMat.map?.dispose(),e.labelMat.dispose();m.clear(),T(s),T(c),T(l),o.traverse(w),i.forceContextLoss(),i.dispose()}}},Me=async(e=D.value)=>{if(await i(),M.value){B(e);return}try{if(R&&te.value){let e=te.value.getBoundingClientRect();(e.width===0||e.height===0)&&(R.dispose(),R=null)}R||=V(),R.update(e)}catch(t){console.warn(`Satellite globe failed; using fallback`,t),M.value=!0,B(e)}};n(()=>{Me()}),r(D,e=>{Me(e)},{flush:`post`}),r(C,e=>{e===`overview`&&Me()}),r(w,e=>{e===`globe`&&Me()}),_(()=>{R?.dispose(),R=null});let Ne=f(()=>JSON.stringify(D.value??{},null,2));return(t,n)=>(u(),g(`div`,yu,[h(`div`,bu,[n[4]||=h(`div`,null,[h(`h1`,{class:`text-2xl font-semibold text-content-heading dark:text-white`},`GPS Diagnostics`),h(`p`,{class:`text-sm text-content-muted`},` Live NMEA receiver state, parsed fix data, and satellite visibility. `)],-1),h(`button`,{type:`button`,class:`rounded-[10px] border border-stroke-subtle dark:border-white/10 bg-white/80 dark:bg-white/10 px-4 py-2 text-sm font-semibold text-content-primary dark:text-white transition-colors hover:bg-white dark:hover:bg-white/20 disabled:cursor-not-allowed disabled:opacity-60`,disabled:O.value,onClick:_e},e(O.value?`Refreshing`:`Refresh`),9,xu)]),k.value?(u(),g(`div`,Su,e(k.value),1)):d(``,!0),h(`div`,Cu,[(u(!0),g(m,null,l(Te.value,t=>(u(),g(`section`,{key:t.label,class:`glass-card min-h-[118px] p-4`},[h(`p`,wu,e(t.label),1),h(`p`,{class:v([`mt-2 break-words text-xl font-semibold leading-tight`,t.valueClass])},e(t.value),3),h(`p`,Tu,e(t.note),1)]))),128))]),h(`div`,Eu,[(u(),g(m,null,l([{id:`overview`,label:`Overview`},{id:`satellites`,label:`Satellites`},{id:`details`,label:`Details`}],t=>h(`button`,{key:t.id,type:`button`,class:v([`page-tab`,{"page-tab-active":C.value===t.id}]),onClick:e=>C.value=t.id},e(t.label),11,Du)),64))]),o(h(`div`,null,[h(`div`,Ou,[h(`section`,ku,[h(`div`,Au,[h(`div`,null,[n[5]||=h(`h2`,{class:`text-lg font-semibold text-content-heading dark:text-white`},` Satellites `,-1),h(`p`,ju,e(Ae.value.length)+` satellite`+e(Ae.value.length===1?``:`s`)+` plotted from GSV azimuth, elevation, and SNR. `,1)]),h(`div`,Mu,[h(`span`,Nu,e(L.value),1),h(`div`,Pu,[h(`button`,{type:`button`,class:v([`inner-tab`,{"inner-tab-active":w.value===`globe`}]),onClick:n[0]||=e=>w.value=`globe`},`Globe`,2),h(`button`,{type:`button`,class:v([`inner-tab`,{"inner-tab-active":w.value===`table`}]),onClick:n[1]||=e=>w.value=`table`},`Table`,2)])])]),o(h(`div`,null,[h(`div`,{ref_key:`globeStage`,ref:te,class:`globe-stage`},[o(h(`canvas`,{ref_key:`globeCanvas`,ref:ne,"aria-label":`3D globe showing satellites around the current receiver position`},null,512),[[y,!M.value]]),M.value?(u(),g(`div`,Fu,[Ae.value.length?(u(),g(`div`,Iu,[(u(!0),g(m,null,l(Ae.value,t=>(u(),g(`div`,{key:t.key,class:v([`fallback-sat`,{"fallback-sat-used":t.used}]),style:a(je(t))},[h(`span`,null,e(t.prn),1)],6))),128))])):(u(),g(`div`,Lu,`No satellites in view yet`))])):d(``,!0),re.value?(u(),g(`div`,{key:1,class:`globe-tooltip`,style:a(ie.value),role:`status`,"aria-live":`polite`},[h(`div`,Ru,`SAT `+e(re.value.prn),1),h(`div`,zu,[n[6]||=h(`span`,{class:`tooltip-key`},`SNR`,-1),h(`span`,Bu,e(F(re.value.snr,`dB`)),1),n[7]||=h(`span`,{class:`tooltip-key`},`Elevation`,-1),h(`span`,Vu,e(F(re.value.elevation,`deg`)),1),n[8]||=h(`span`,{class:`tooltip-key`},`Azimuth`,-1),h(`span`,Hu,e(F(re.value.azimuth,`deg`)),1),n[9]||=h(`span`,{class:`tooltip-key`},`Used in fix`,-1),h(`span`,Uu,e(F(re.value.used)),1)])],4)):d(``,!0)],512),h(`div`,Wu,[h(`span`,null,e(N.value),1),n[10]||=h(`span`,null,`Drag to rotate · Scroll to zoom · Hover for details`,-1)]),h(`div`,Gu,[n[11]||=h(`span`,{class:`inline-flex items-center gap-2`},[h(`span`,{class:`h-2.5 w-2.5 rounded-full bg-accent-green`}),p(`Used in fix `)],-1),n[12]||=h(`span`,{class:`inline-flex items-center gap-2`},[h(`span`,{class:`h-2.5 w-2.5 rounded-full bg-primary`}),p(`In view `)],-1),h(`span`,null,`Last refresh: `+e(A.value?A.value.toLocaleTimeString():`n/a`),1)])],512),[[y,w.value===`globe`]]),o(h(`div`,null,[h(`div`,Ku,[h(`table`,qu,[n[14]||=h(`thead`,{class:`border-b border-stroke-subtle text-xs uppercase text-content-muted`},[h(`tr`,null,[h(`th`,{class:`py-2 pr-4 font-semibold`},`PRN`),h(`th`,{class:`py-2 pr-4 font-semibold`},`Used`),h(`th`,{class:`py-2 pr-4 font-semibold`},`Elevation`),h(`th`,{class:`py-2 pr-4 font-semibold`},`Azimuth`),h(`th`,{class:`py-2 pr-4 font-semibold`},`SNR`)])],-1),h(`tbody`,Ju,[(u(!0),g(m,null,l(I.value,t=>(u(),g(`tr`,{key:t.prn,class:v([`sat-row`,{"sat-row-stale":t.stale}])},[h(`td`,{class:v([`py-2 pr-4 font-medium`,t.used?`text-accent-green`:`text-content-primary dark:text-white`])},e(t.prn),3),h(`td`,Yu,[h(`span`,{class:v(t.used?`inline-flex items-center gap-1.5 text-accent-green`:`text-content-muted`)},[t.used?(u(),g(`span`,Xu)):d(``,!0),p(` `+e(t.used?`yes`:`–`),1)],2)]),h(`td`,Zu,e(F(t.data.elevation_degrees,`deg`)),1),h(`td`,Qu,e(F(t.data.azimuth_degrees,`deg`)),1),h(`td`,$u,e(F(t.data.snr_db,`dB`)),1)],2))),128)),I.value.length===0?(u(),g(`tr`,ed,[...n[13]||=[h(`td`,{colspan:`5`,class:`py-6 text-center text-content-muted`},`No satellites in view yet`,-1)]])):d(``,!0)])])])],512),[[y,w.value===`table`]])]),h(`section`,td,[n[20]||=h(`h2`,{class:`mb-4 text-lg font-semibold text-content-heading dark:text-white`},`Position`,-1),h(`div`,nd,[h(`div`,rd,[n[15]||=h(`span`,{class:`text-content-muted`},`Display source`,-1),h(`span`,id,e(F(le.value.source_label||le.value.source)),1)]),h(`div`,ad,[n[16]||=h(`span`,{class:`text-content-muted`},`Display location`,-1),h(`span`,od,e(Se(P.value.latitude,P.value.longitude)),1)]),h(`div`,sd,[n[17]||=h(`span`,{class:`text-content-muted`},`GPS location`,-1),h(`span`,cd,e(Se(se.value.latitude,se.value.longitude)),1)]),h(`div`,ld,[n[18]||=h(`span`,{class:`text-content-muted`},`Manual location`,-1),h(`span`,ud,e(ce.value?Se(ce.value.latitude,ce.value.longitude):`n/a`),1)]),h(`div`,dd,[n[19]||=h(`span`,{class:`text-content-muted`},`Policy`,-1),h(`span`,fd,e(F(le.value.policy)),1)])])])])],512),[[y,C.value===`overview`]]),o(h(`div`,null,[h(`section`,pd,[n[23]||=h(`h2`,{class:`mb-4 text-lg font-semibold text-content-heading dark:text-white`},`Satellites In View`,-1),h(`div`,md,[h(`table`,hd,[n[22]||=h(`thead`,{class:`border-b border-stroke-subtle text-xs uppercase text-content-muted`},[h(`tr`,null,[h(`th`,{class:`py-2 pr-4 font-semibold`},`PRN`),h(`th`,{class:`py-2 pr-4 font-semibold`},`Used`),h(`th`,{class:`py-2 pr-4 font-semibold`},`Elevation`),h(`th`,{class:`py-2 pr-4 font-semibold`},`Azimuth`),h(`th`,{class:`py-2 pr-4 font-semibold`},`SNR`)])],-1),h(`tbody`,gd,[(u(!0),g(m,null,l(I.value,t=>(u(),g(`tr`,{key:t.prn,class:v([`sat-row`,{"sat-row-stale":t.stale}])},[h(`td`,{class:v([`py-2 pr-4 font-medium`,t.used?`text-accent-green`:`text-content-primary dark:text-white`])},e(t.prn),3),h(`td`,_d,[h(`span`,{class:v(t.used?`inline-flex items-center gap-1.5 text-accent-green`:`text-content-muted`)},[t.used?(u(),g(`span`,vd)):d(``,!0),p(` `+e(t.used?`yes`:`–`),1)],2)]),h(`td`,yd,e(F(t.data.elevation_degrees,`deg`)),1),h(`td`,bd,e(F(t.data.azimuth_degrees,`deg`)),1),h(`td`,xd,e(F(t.data.snr_db,`dB`)),1)],2))),128)),I.value.length===0?(u(),g(`tr`,Sd,[...n[21]||=[h(`td`,{colspan:`5`,class:`py-6 text-center text-content-muted`},`No satellites in view yet`,-1)]])):d(``,!0)])])])])],512),[[y,C.value===`satellites`]]),o(h(`div`,null,[h(`div`,Cd,[(u(!0),g(m,null,l(Ee.value,t=>(u(),g(`div`,{key:t.title,class:`glass-card overflow-hidden`},[h(`button`,{type:`button`,class:`accordion-header`,onClick:e=>E(t.title)},[h(`span`,Td,e(t.title),1),(u(),g(`svg`,{class:v([`accordion-chevron`,{"accordion-chevron-open":T.value.has(t.title)}]),xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[...n[24]||=[h(`polyline`,{points:`6 9 12 15 18 9`},null,-1)]],2))],8,wd),T.value.has(t.title)?(u(),g(`div`,Ed,[h(`div`,Dd,[(u(!0),g(m,null,l(t.rows,n=>(u(),g(m,{key:`${t.title}-${n[0]}`},[h(`div`,Od,e(n[0]),1),h(`div`,kd,e(F(n[1],n[2])),1)],64))),128))])])):d(``,!0)]))),128))]),h(`section`,Ad,[h(`button`,{type:`button`,class:`accordion-header`,onClick:n[2]||=e=>E(`__nmea__`)},[n[26]||=h(`span`,{class:`font-semibold text-content-heading dark:text-white`},`Recent NMEA Sentences`,-1),(u(),g(`svg`,{class:v([`accordion-chevron`,{"accordion-chevron-open":T.value.has(`__nmea__`)}]),xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[...n[25]||=[h(`polyline`,{points:`6 9 12 15 18 9`},null,-1)]],2))]),T.value.has(`__nmea__`)?(u(),g(`div`,jd,[h(`div`,Md,[h(`table`,Nd,[n[28]||=h(`thead`,{class:`border-b border-stroke-subtle text-xs uppercase text-content-muted`},[h(`tr`,null,[h(`th`,{class:`py-2 pr-4 font-semibold`},`Timestamp`),h(`th`,{class:`py-2 pr-4 font-semibold`},`Type`),h(`th`,{class:`py-2 pr-4 font-semibold`},`Sentence`)])],-1),h(`tbody`,Pd,[(u(!0),g(m,null,l(Oe.value,t=>(u(),g(`tr`,{key:`${t.timestamp}-${t.sentence}`},[h(`td`,Fd,e(F(t.timestamp)),1),h(`td`,Id,e(F(t.sentence_type)),1),h(`td`,Ld,e(F(t.sentence)),1)]))),128)),Oe.value.length===0?(u(),g(`tr`,Rd,[...n[27]||=[h(`td`,{colspan:`3`,class:`py-6 text-center text-content-muted`},`No NMEA sentences captured yet`,-1)]])):d(``,!0)])])])])):d(``,!0)]),h(`section`,zd,[h(`div`,Bd,[n[29]||=h(`h2`,{class:`text-lg font-semibold text-content-heading dark:text-white`},`Raw Snapshot`,-1),h(`button`,{type:`button`,class:`rounded-[10px] border border-stroke-subtle dark:border-white/10 bg-white/70 dark:bg-white/10 px-3 py-1.5 text-xs font-semibold text-content-primary dark:text-white hover:bg-white dark:hover:bg-white/20`,onClick:n[3]||=e=>j.value=!j.value},e(j.value?`Hide`:`Show`),1)]),j.value?(u(),g(`pre`,Vd,e(Ne.value),1)):d(``,!0)])],512),[[y,C.value===`details`]])]))}}),[[`__scopeId`,`data-v-517bbbeb`]]);export{Ud as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/GPSDiagnostics-1MaoN5NX.css b/repeater/web/html/assets/GPSDiagnostics-ozfiXH-7.css similarity index 55% rename from repeater/web/html/assets/GPSDiagnostics-1MaoN5NX.css rename to repeater/web/html/assets/GPSDiagnostics-ozfiXH-7.css index 6ed578e..20a39ce 100644 --- a/repeater/web/html/assets/GPSDiagnostics-1MaoN5NX.css +++ b/repeater/web/html/assets/GPSDiagnostics-ozfiXH-7.css @@ -1 +1 @@ -.globe-stage[data-v-413c18f1]{border:1px solid var(--color-border-subtle);background:radial-gradient(circle at 50% 46%, color-mix(in srgb, var(--color-primary) 24%, transparent), transparent 34%), radial-gradient(circle at 48% 50%, #ffffff24, transparent 20%), linear-gradient(145deg, var(--color-background-soft), var(--color-background));cursor:grab;touch-action:none;border-radius:10px;min-height:330px;position:relative;overflow:hidden}.globe-stage[data-v-413c18f1]:active{cursor:grabbing}.globe-stage canvas[data-v-413c18f1]{width:100%;height:330px;display:block}.globe-tooltip[data-v-413c18f1]{z-index:2;color:#fff;pointer-events:none;background:#050a0ceb;border:1px solid #ffffff2e;border-radius:12px;min-width:154px;padding:10px 11px;position:absolute;transform:translate(-50%,calc(-100% - 22px));box-shadow:0 14px 40px #0000005c}.tooltip-title[data-v-413c18f1]{color:var(--color-accent-green);letter-spacing:.06em;text-transform:uppercase;font-size:.82rem;font-weight:800}.tooltip-grid[data-v-413c18f1]{grid-template-columns:auto 1fr;gap:4px 10px;margin-top:7px;font-size:.78rem;display:grid}.tooltip-key[data-v-413c18f1]{color:#ffffffa8}.tooltip-value[data-v-413c18f1]{color:#fff;text-align:right;font-weight:700}.globe-fallback[data-v-413c18f1]{padding:18px;position:absolute;inset:0}.fallback-sky[data-v-413c18f1]{aspect-ratio:1;border:1px solid color-mix(in srgb, var(--color-primary) 34%, var(--color-border-subtle));background:radial-gradient(circle, color-mix(in srgb, var(--color-primary) 18%, transparent) 0 2px, transparent 3px), repeating-radial-gradient(circle, transparent 0 31%, color-mix(in srgb, var(--color-border) 70%, transparent) 31.5% 32%, transparent 32.5% 49%), linear-gradient(90deg, transparent 49.7%, color-mix(in srgb, var(--color-border) 78%, transparent) 49.7% 50.3%, transparent 50.3%), linear-gradient(0deg, transparent 49.7%, color-mix(in srgb, var(--color-border) 78%, transparent) 49.7% 50.3%, transparent 50.3%);border-radius:50%;width:min(250px,72vw);margin:0 auto;position:relative}.fallback-sat[data-v-413c18f1]{width:var(--size);height:var(--size);background:var(--color-primary);box-shadow:0 0 16px color-mix(in srgb, var(--color-primary) 70%, transparent);border-radius:999px;position:absolute;transform:translate(-50%,-50%)}.fallback-sat-used[data-v-413c18f1]{background:var(--color-accent-green);box-shadow:0 0 16px color-mix(in srgb, var(--color-accent-green) 70%, transparent)}.fallback-sat span[data-v-413c18f1]{color:var(--color-text-primary);white-space:nowrap;font-size:.65rem;font-weight:700;position:absolute;top:calc(100% + 4px);left:50%;transform:translate(-50%)}.sky-empty[data-v-413c18f1]{color:var(--color-text-muted);pointer-events:none;place-items:center;font-size:.875rem;display:grid;position:absolute;inset:0}.sat-row[data-v-413c18f1]{opacity:1;transition:opacity .6s,color .4s}.sat-row-stale[data-v-413c18f1]{opacity:.35}.page-tabs[data-v-413c18f1]{border-bottom:1px solid var(--color-border-subtle,#0000001a);gap:2px;padding-bottom:0;display:flex}.page-tab[data-v-413c18f1]{color:var(--color-text-muted,#888);cursor:pointer;background:0 0;border:none;border-bottom:2px solid #0000;margin-bottom:-1px;padding:8px 18px;font-size:.875rem;font-weight:600;transition:color .18s,border-color .18s}.page-tab[data-v-413c18f1]:hover{color:var(--color-text-primary,#fff)}.page-tab-active[data-v-413c18f1]{color:var(--color-primary,#aae8e8);border-bottom-color:var(--color-primary,#aae8e8)}.inner-tabs[data-v-413c18f1]{border:1px solid var(--color-border-subtle,#ffffff1a);background:#ffffff0a;border-radius:8px;gap:2px;padding:2px;display:flex}.inner-tab[data-v-413c18f1]{color:var(--color-text-muted,#888);cursor:pointer;background:0 0;border:none;border-radius:6px;padding:4px 12px;font-size:.75rem;font-weight:600;transition:background .15s,color .15s}.inner-tab[data-v-413c18f1]:hover{color:var(--color-text-primary,#fff)}.inner-tab-active[data-v-413c18f1]{background:var(--color-primary,#aae8e8);color:#000}.accordion-header[data-v-413c18f1]{cursor:pointer;text-align:left;background:0 0;border:none;justify-content:space-between;align-items:center;width:100%;padding:14px 20px;font-size:.9rem;transition:background .15s;display:flex}.accordion-header[data-v-413c18f1]:hover{background:#ffffff0a}.accordion-chevron[data-v-413c18f1]{color:var(--color-text-muted,#888);flex-shrink:0;transition:transform .2s}.accordion-chevron-open[data-v-413c18f1]{transform:rotate(180deg)}.accordion-body[data-v-413c18f1]{padding:0 20px 16px} +.globe-stage[data-v-517bbbeb]{border:1px solid var(--color-border-subtle);background:radial-gradient(circle at 50% 46%, color-mix(in srgb, var(--color-primary) 24%, transparent), transparent 34%), radial-gradient(circle at 48% 50%, #ffffff24, transparent 20%), linear-gradient(145deg, var(--color-background-soft), var(--color-background));cursor:grab;touch-action:none;border-radius:10px;min-height:330px;position:relative;overflow:hidden}.globe-stage[data-v-517bbbeb]:active{cursor:grabbing}.globe-stage canvas[data-v-517bbbeb]{width:100%;height:330px;display:block}.globe-tooltip[data-v-517bbbeb]{z-index:2;color:#fff;pointer-events:none;background:#050a0ceb;border:1px solid #ffffff2e;border-radius:12px;min-width:154px;padding:10px 11px;position:absolute;transform:translate(-50%,calc(-100% - 22px));box-shadow:0 14px 40px #0000005c}.tooltip-title[data-v-517bbbeb]{color:var(--color-accent-green);letter-spacing:.06em;text-transform:uppercase;font-size:.82rem;font-weight:800}.tooltip-grid[data-v-517bbbeb]{grid-template-columns:auto 1fr;gap:4px 10px;margin-top:7px;font-size:.78rem;display:grid}.tooltip-key[data-v-517bbbeb]{color:#ffffffa8}.tooltip-value[data-v-517bbbeb]{color:#fff;text-align:right;font-weight:700}.globe-fallback[data-v-517bbbeb]{padding:18px;position:absolute;inset:0}.fallback-sky[data-v-517bbbeb]{aspect-ratio:1;border:1px solid color-mix(in srgb, var(--color-primary) 34%, var(--color-border-subtle));background:radial-gradient(circle, color-mix(in srgb, var(--color-primary) 18%, transparent) 0 2px, transparent 3px), repeating-radial-gradient(circle, transparent 0 31%, color-mix(in srgb, var(--color-border) 70%, transparent) 31.5% 32%, transparent 32.5% 49%), linear-gradient(90deg, transparent 49.7%, color-mix(in srgb, var(--color-border) 78%, transparent) 49.7% 50.3%, transparent 50.3%), linear-gradient(0deg, transparent 49.7%, color-mix(in srgb, var(--color-border) 78%, transparent) 49.7% 50.3%, transparent 50.3%);border-radius:50%;width:min(250px,72vw);margin:0 auto;position:relative}.fallback-sat[data-v-517bbbeb]{width:var(--size);height:var(--size);background:var(--color-primary);box-shadow:0 0 16px color-mix(in srgb, var(--color-primary) 70%, transparent);border-radius:999px;position:absolute;transform:translate(-50%,-50%)}.fallback-sat-used[data-v-517bbbeb]{background:var(--color-accent-green);box-shadow:0 0 16px color-mix(in srgb, var(--color-accent-green) 70%, transparent)}.fallback-sat span[data-v-517bbbeb]{color:var(--color-text-primary);white-space:nowrap;font-size:.65rem;font-weight:700;position:absolute;top:calc(100% + 4px);left:50%;transform:translate(-50%)}.sky-empty[data-v-517bbbeb]{color:var(--color-text-muted);pointer-events:none;place-items:center;font-size:.875rem;display:grid;position:absolute;inset:0}.sat-row[data-v-517bbbeb]{opacity:1;transition:opacity .6s,color .4s}.sat-row-stale[data-v-517bbbeb]{opacity:.35}.page-tabs[data-v-517bbbeb]{border-bottom:1px solid var(--color-border-subtle,#0000001a);gap:2px;padding-bottom:0;display:flex}.page-tab[data-v-517bbbeb]{color:var(--color-text-muted,#888);cursor:pointer;background:0 0;border:none;border-bottom:2px solid #0000;margin-bottom:-1px;padding:8px 18px;font-size:.875rem;font-weight:600;transition:color .18s,border-color .18s}.page-tab[data-v-517bbbeb]:hover{color:var(--color-text-primary,#fff)}.page-tab-active[data-v-517bbbeb]{color:var(--color-primary,#aae8e8);border-bottom-color:var(--color-primary,#aae8e8)}.inner-tabs[data-v-517bbbeb]{border:1px solid var(--color-border-subtle,#ffffff1a);background:#ffffff0a;border-radius:8px;gap:2px;padding:2px;display:flex}.inner-tab[data-v-517bbbeb]{color:var(--color-text-muted,#888);cursor:pointer;background:0 0;border:none;border-radius:6px;padding:4px 12px;font-size:.75rem;font-weight:600;transition:background .15s,color .15s}.inner-tab[data-v-517bbbeb]:hover{color:var(--color-text-primary,#fff)}.inner-tab-active[data-v-517bbbeb]{background:var(--color-primary,#aae8e8);color:#000}.accordion-header[data-v-517bbbeb]{cursor:pointer;text-align:left;background:0 0;border:none;justify-content:space-between;align-items:center;width:100%;padding:14px 20px;font-size:.9rem;transition:background .15s;display:flex}.accordion-header[data-v-517bbbeb]:hover{background:#ffffff0a}.accordion-chevron[data-v-517bbbeb]{color:var(--color-text-muted,#888);flex-shrink:0;transition:transform .2s}.accordion-chevron-open[data-v-517bbbeb]{transform:rotate(180deg)}.accordion-body[data-v-517bbbeb]{padding:0 20px 16px} diff --git a/repeater/web/html/assets/LocationPicker-B5L5Ju6J.js b/repeater/web/html/assets/LocationPicker-B5L5Ju6J.js deleted file mode 100644 index 6d57159..0000000 --- a/repeater/web/html/assets/LocationPicker-B5L5Ju6J.js +++ /dev/null @@ -1,2 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/leaflet-src-phWEwbzW.js","assets/chunk-DECur_0Z.js"])))=>i.map(i=>d[i]); -import{r as e}from"./chunk-DECur_0Z.js";import{D as t,R as n,S as r,V as i,Y as a,c as o,g as s,i as c,k as l,l as u,p as d,s as f,u as p}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{o as m}from"./api-DBiYn0RS.js";import{t as h}from"./_plugin-vue_export-helper-TcpyXLsZ.js";import{g,p as _}from"./index-CG181k2K.js";/* empty css */var v={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`},y={class:`flex-1 relative min-h-[400px]`},b={class:`p-6 border-t border-stroke-subtle dark:border-stroke/10 space-y-4`},x={class:`grid grid-cols-2 gap-4`},S=h(s({__name:`LocationPicker`,props:{isOpen:{type:Boolean},latitude:{},longitude:{}},emits:[`close`,`select`],setup(s,{emit:h}){let S=s,C=h,w=a(null),T=a(S.latitude||0),E=a(S.longitude||0),D=null,O=null,k=async()=>{if(w.value){A();try{let t=(await m(async()=>{let{default:t}=await import(`./leaflet-src-phWEwbzW.js`).then(t=>e(t.t(),1));return{default:t}},__vite__mapDeps([0,1]))).default;delete t.Icon.Default.prototype._getIconUrl,t.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 r();let n=T.value||0,i=E.value||0,a=n===0&&i===0?2:13;D=t.map(w.value).setView([n,i],a);try{let e=t.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==`}),n=t.tileLayer(`https://{s}.basemaps.cartocdn.com/dark_only_labels/{z}/{x}/{y}{r}.png`,{maxZoom:19,attribution:``,errorTileUrl:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==`});e.addTo(D),n.addTo(D)}catch(e){console.warn(`Error loading tiles:`,e)}(n!==0||i!==0)&&(O=t.marker([n,i]).addTo(D)),D.on(`click`,e=>{T.value=e.latlng.lat,E.value=e.latlng.lng,O?O.setLatLng(e.latlng):O=t.marker(e.latlng).addTo(D)}),setTimeout(()=>{D?.invalidateSize()},200)}catch(e){console.error(`Failed to initialize map:`,e)}}},A=()=>{D&&(D.remove(),D=null,O=null)};n(()=>S.isOpen,async e=>{e?(await r(),await k()):A()}),n(()=>[S.latitude,S.longitude],([e,t])=>{T.value=e,E.value=t});let j=()=>{C(`select`,{latitude:Math.round(T.value*1e6)/1e6,longitude:Math.round(E.value*1e6)/1e6}),C(`close`)},M=()=>{C(`close`)},N=()=>{navigator.geolocation?navigator.geolocation.getCurrentPosition(async t=>{if(T.value=t.coords.latitude,E.value=t.coords.longitude,D){D.setView([T.value,E.value],13);let t=(await m(async()=>{let{default:t}=await import(`./leaflet-src-phWEwbzW.js`).then(t=>e(t.t(),1));return{default:t}},__vite__mapDeps([0,1]))).default;O?O.setLatLng([T.value,E.value]):O=t.marker([T.value,E.value]).addTo(D)}},e=>{console.error(`Error getting location:`,e),alert(`Unable to get current location. Please check browser permissions.`)}):alert(`Geolocation is not supported by this browser.`)};return t(()=>{A()}),(e,t)=>(l(),o(c,{to:`body`},[s.isOpen?(l(),p(`div`,{key:0,class:`fixed inset-0 z-[400] flex items-center justify-center p-4 bg-black/50 backdrop-blur-lg`,onClick:g(M,[`self`])},[f(`div`,v,[f(`div`,{class:`flex items-center justify-between p-6 border-b border-stroke-subtle dark:border-stroke/10`},[t[3]||=f(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary`},` Select Location `,-1),f(`button`,{onClick:M,class:`text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors`},[...t[2]||=[f(`svg`,{class:`w-6 h-6`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[f(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),f(`div`,y,[f(`div`,{ref_key:`mapContainer`,ref:w,class:`absolute inset-0 rounded-b-[15px] overflow-hidden`},null,512)]),f(`div`,b,[f(`div`,x,[f(`div`,null,[t[4]||=f(`label`,{class:`block text-sm font-medium text-content-secondary dark:text-content-muted mb-2`},`Latitude`,-1),i(f(`input`,{"onUpdate:modelValue":t[0]||=e=>T.value=e,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),[[_,T.value,void 0,{number:!0}]])]),f(`div`,null,[t[5]||=f(`label`,{class:`block text-sm font-medium text-content-secondary dark:text-content-muted mb-2`},`Longitude`,-1),i(f(`input`,{"onUpdate:modelValue":t[1]||=e=>E.value=e,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),[[_,E.value,void 0,{number:!0}]])])]),f(`div`,{class:`flex gap-3`},[f(`button`,{onClick:N,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]||=[f(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[f(`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`}),f(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 11a3 3 0 11-6 0 3 3 0 016 0z`})],-1),d(` Use Current Location `,-1)]]),f(`button`,{onClick:M,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 `),f(`button`,{onClick:j,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]||=f(`p`,{class:`text-content-muted dark:text-content-muted text-xs text-center`},` Click on the map to select a location `,-1)])])])):u(``,!0)]))}}),[[`__scopeId`,`data-v-a6ceb55e`]]);export{S as t}; \ No newline at end of file diff --git a/repeater/web/html/assets/LocationPicker-Beqlkai5.js b/repeater/web/html/assets/LocationPicker-Beqlkai5.js new file mode 100644 index 0000000..93ff32f --- /dev/null +++ b/repeater/web/html/assets/LocationPicker-Beqlkai5.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/leaflet-src-EmArVA6Z.js","assets/chunk-DECur_0Z.js"])))=>i.map(i=>d[i]); +import{r as e}from"./chunk-DECur_0Z.js";import{D as t,R as n,S as r,V as i,Y as a,c as o,g as s,i as c,k as l,l as u,p as d,s as f,u as p}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{s as m,u as h}from"./runtime-dom.esm-bundler-fKU3dih-.js";import{o as g}from"./api-C0ctTLHN.js";import{t as _}from"./_plugin-vue_export-helper-TcpyXLsZ.js";/* empty css */var v={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`},y={class:`flex-1 relative min-h-[400px]`},b={class:`p-6 border-t border-stroke-subtle dark:border-stroke/10 space-y-4`},x={class:`grid grid-cols-2 gap-4`},S=_(s({__name:`LocationPicker`,props:{isOpen:{type:Boolean},latitude:{},longitude:{}},emits:[`close`,`select`],setup(s,{emit:_}){let S=s,C=_,w=a(null),T=a(S.latitude||0),E=a(S.longitude||0),D=null,O=null,k=async()=>{if(w.value){A();try{let t=(await g(async()=>{let{default:t}=await import(`./leaflet-src-EmArVA6Z.js`).then(t=>e(t.t(),1));return{default:t}},__vite__mapDeps([0,1]))).default;delete t.Icon.Default.prototype._getIconUrl,t.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 r();let n=T.value||0,i=E.value||0,a=n===0&&i===0?2:13;D=t.map(w.value).setView([n,i],a);try{let e=t.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==`}),n=t.tileLayer(`https://{s}.basemaps.cartocdn.com/dark_only_labels/{z}/{x}/{y}{r}.png`,{maxZoom:19,attribution:``,errorTileUrl:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==`});e.addTo(D),n.addTo(D)}catch(e){console.warn(`Error loading tiles:`,e)}(n!==0||i!==0)&&(O=t.marker([n,i]).addTo(D)),D.on(`click`,e=>{T.value=e.latlng.lat,E.value=e.latlng.lng,O?O.setLatLng(e.latlng):O=t.marker(e.latlng).addTo(D)}),setTimeout(()=>{D?.invalidateSize()},200)}catch(e){console.error(`Failed to initialize map:`,e)}}},A=()=>{D&&(D.remove(),D=null,O=null)};n(()=>S.isOpen,async e=>{e?(await r(),await k()):A()}),n(()=>[S.latitude,S.longitude],([e,t])=>{T.value=e,E.value=t});let j=()=>{C(`select`,{latitude:Math.round(T.value*1e6)/1e6,longitude:Math.round(E.value*1e6)/1e6}),C(`close`)},M=()=>{C(`close`)},N=()=>{navigator.geolocation?navigator.geolocation.getCurrentPosition(async t=>{if(T.value=t.coords.latitude,E.value=t.coords.longitude,D){D.setView([T.value,E.value],13);let t=(await g(async()=>{let{default:t}=await import(`./leaflet-src-EmArVA6Z.js`).then(t=>e(t.t(),1));return{default:t}},__vite__mapDeps([0,1]))).default;O?O.setLatLng([T.value,E.value]):O=t.marker([T.value,E.value]).addTo(D)}},e=>{console.error(`Error getting location:`,e),alert(`Unable to get current location. Please check browser permissions.`)}):alert(`Geolocation is not supported by this browser.`)};return t(()=>{A()}),(e,t)=>(l(),o(c,{to:`body`},[s.isOpen?(l(),p(`div`,{key:0,class:`fixed inset-0 z-[400] flex items-center justify-center p-4 bg-black/50 backdrop-blur-lg`,onClick:h(M,[`self`])},[f(`div`,v,[f(`div`,{class:`flex items-center justify-between p-6 border-b border-stroke-subtle dark:border-stroke/10`},[t[3]||=f(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary`},` Select Location `,-1),f(`button`,{onClick:M,class:`text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors`},[...t[2]||=[f(`svg`,{class:`w-6 h-6`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[f(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),f(`div`,y,[f(`div`,{ref_key:`mapContainer`,ref:w,class:`absolute inset-0 rounded-b-[15px] overflow-hidden`},null,512)]),f(`div`,b,[f(`div`,x,[f(`div`,null,[t[4]||=f(`label`,{class:`block text-sm font-medium text-content-secondary dark:text-content-muted mb-2`},`Latitude`,-1),i(f(`input`,{"onUpdate:modelValue":t[0]||=e=>T.value=e,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),[[m,T.value,void 0,{number:!0}]])]),f(`div`,null,[t[5]||=f(`label`,{class:`block text-sm font-medium text-content-secondary dark:text-content-muted mb-2`},`Longitude`,-1),i(f(`input`,{"onUpdate:modelValue":t[1]||=e=>E.value=e,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),[[m,E.value,void 0,{number:!0}]])])]),f(`div`,{class:`flex gap-3`},[f(`button`,{onClick:N,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]||=[f(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[f(`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`}),f(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 11a3 3 0 11-6 0 3 3 0 016 0z`})],-1),d(` Use Current Location `,-1)]]),f(`button`,{onClick:M,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 `),f(`button`,{onClick:j,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]||=f(`p`,{class:`text-content-muted dark:text-content-muted text-xs text-center`},` Click on the map to select a location `,-1)])])])):u(``,!0)]))}}),[[`__scopeId`,`data-v-a6ceb55e`]]);export{S as t}; \ No newline at end of file diff --git a/repeater/web/html/assets/Login-BS0KJmAp.js b/repeater/web/html/assets/Login-BS0KJmAp.js deleted file mode 100644 index 94aa3d9..0000000 --- a/repeater/web/html/assets/Login-BS0KJmAp.js +++ /dev/null @@ -1 +0,0 @@ -import{Ct as e,V as t,Y as n,c as r,g as i,i as a,k as o,l as s,m as c,o as l,p as u,s as d,u as f}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{c as p,g as m,i as h,p as g,r as _}from"./api-DBiYn0RS.js";import{t as v}from"./_plugin-vue_export-helper-TcpyXLsZ.js";import{t as y}from"./useTheme-D8lKuC-u.js";import{t as b}from"./Spinner-CYvUNW0P.js";import{g as x,i as S,n as C,o as w,p as T,r as ee,s as te}from"./index-CG181k2K.js";var E={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`},D={key:0,class:`bg-red-500/10 border border-red-500/30 rounded-lg p-3`},O={class:`text-red-600 dark:text-red-400 text-sm`},k={key:1,class:`bg-green-500/10 border border-green-600/40 dark:border-green-500/30 rounded-lg p-3`},A={class:`text-green-600 dark:text-green-400 text-sm`},j={class:`flex justify-end gap-3 mt-6`},M=[`disabled`],N=[`disabled`],P=i({name:`ChangePasswordModal`,__name:`ChangePasswordModal`,props:{isOpen:{type:Boolean},canSkip:{type:Boolean,default:!0}},emits:[`close`,`success`],setup(i,{emit:c}){let l=c,p=n(``),m=n(``),h=n(``),g=n(!1),v=n(``),y=n(``),S=()=>{g.value||l(`close`)},C=()=>{l(`close`)},w=async()=>{if(v.value=``,y.value=``,m.value.length<8){v.value=`New password must be at least 8 characters long`;return}if(m.value!==h.value){v.value=`Passwords do not match`;return}if(m.value===p.value){v.value=`New password must be different from current password`;return}g.value=!0;try{let e=(await _.post(`/auth/change_password`,{current_password:p.value,new_password:m.value})).data;e&&e.success?(y.value=e.message||`Password changed successfully!`,setTimeout(()=>{l(`success`),l(`close`)},1500)):v.value=e?.error||`Failed to change password`}catch(e){console.error(`Password change error:`,e),v.value=e.response?.data?.error||`Failed to change password. Please try again.`}finally{g.value=!1}};return(n,c)=>(o(),r(a,{to:`body`},[i.isOpen?(o(),f(`div`,{key:0,class:`fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm`,onClick:x(S,[`self`])},[d(`div`,E,[c[6]||=d(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary mb-2`},` Change Default Password `,-1),c[7]||=d(`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),d(`form`,{onSubmit:x(w,[`prevent`]),class:`space-y-4`},[d(`div`,null,[c[3]||=d(`label`,{class:`block text-sm font-medium text-content-secondary dark:text-content-primary/70 mb-2`},`Current Password`,-1),t(d(`input`,{"onUpdate:modelValue":c[0]||=e=>p.value=e,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),[[T,p.value]])]),d(`div`,null,[c[4]||=d(`label`,{class:`block text-sm font-medium text-content-secondary dark:text-content-primary/70 mb-2`},`New Password`,-1),t(d(`input`,{"onUpdate:modelValue":c[1]||=e=>m.value=e,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),[[T,m.value]])]),d(`div`,null,[c[5]||=d(`label`,{class:`block text-sm font-medium text-content-secondary dark:text-content-primary/70 mb-2`},`Confirm New Password`,-1),t(d(`input`,{"onUpdate:modelValue":c[2]||=e=>h.value=e,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),[[T,h.value]])]),v.value?(o(),f(`div`,D,[d(`p`,O,e(v.value),1)])):s(``,!0),y.value?(o(),f(`div`,k,[d(`p`,A,e(y.value),1)])):s(``,!0),d(`div`,j,[i.canSkip?(o(),f(`button`,{key:0,type:`button`,onClick:C,disabled:g.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,M)):s(``,!0),d(`button`,{type:`submit`,disabled:g.value,class:`btn-primary flex items-center gap-2`},[g.value?(o(),r(b,{key:0,size:`sm`,color:`current`})):s(``,!0),u(` `+e(g.value?`Changing...`:`Change Password`),1)],8,N)])],32)])])):s(``,!0)]))}}),F={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`},I={class:`absolute top-4 right-4 z-20`},L={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`},R={class:`relative login-content`},z={class:`text-center mb-6 sm:mb-10`},B={class:`mb-4 sm:mb-6 flex justify-center`},V=[`src`],H={class:`form-group`},U={class:`relative`},W=[`disabled`],G={class:`form-group`},K={class:`relative`},q=[`disabled`],J={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`},Y={class:`text-red-600 dark:text-red-400 text-xs sm:text-sm font-medium`},X=[`disabled`],Z={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`},ne={class:`relative`},re={class:`mt-6 sm:mt-8 pt-4 sm:pt-6 border-t border-stroke-subtle dark:border-stroke/10`},Q={class:`flex items-center justify-center gap-3`},ie={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`},ae={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`},$=v(i({name:`LoginView`,__name:`Login`,setup(i){let a=m(),u=h(),{theme:v}=y(),E=l(()=>v.value===`dark`?S:ee),D=n(`admin`),O=n(``),k=n(!1),A=n(``),j=n(!1),M=n(!1),N=async()=>{A.value=``,k.value=!0;try{let e=p(),t=(await _.post(`/auth/login`,{username:D.value,password:O.value,client_id:e})).data;t.success&&t.token?O.value===`admin123`?(g(t.token),u.markAuthenticated(),M.value=!0,j.value=!0):(g(t.token),u.markAuthenticated(),a.push(`/`)):A.value=t.error||`Login failed`}catch(e){console.error(`Login error:`,e),A.value=e.response?.data?.error||`Connection error. Please try again.`}finally{k.value=!1}},$=()=>{j.value=!1,a.push(`/`)},oe=()=>{j.value=!1,M.value&&a.push(`/`)};return(n,i)=>(o(),f(`div`,F,[d(`div`,I,[c(C)]),i[10]||=d(`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),i[11]||=d(`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),i[12]||=d(`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),d(`div`,L,[i[9]||=d(`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),d(`div`,R,[d(`div`,z,[d(`div`,B,[d(`img`,{src:E.value,alt:`pyMC`,class:`logo-image h-36 sm:h-40 relative z-10`},null,8,V)]),i[2]||=d(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},` Sign in to access your dashboard `,-1)]),d(`form`,{onSubmit:x(N,[`prevent`]),class:`space-y-4 sm:space-y-5`},[d(`div`,H,[i[4]||=d(`label`,{for:`username`,class:`block text-content-secondary dark:text-content-primary/90 text-xs sm:text-sm font-medium mb-2`},` Username `,-1),d(`div`,U,[t(d(`input`,{id:`username`,"onUpdate:modelValue":i[0]||=e=>D.value=e,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:k.value},null,8,W),[[T,D.value]]),i[3]||=d(`div`,{class:`absolute inset-0 rounded-[12px] pointer-events-none input-glow`},null,-1)])]),d(`div`,G,[i[6]||=d(`label`,{for:`password`,class:`block text-content-secondary dark:text-content-primary/90 text-xs sm:text-sm font-medium mb-2`},` Password `,-1),d(`div`,K,[t(d(`input`,{id:`password`,"onUpdate:modelValue":i[1]||=e=>O.value=e,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:k.value},null,8,q),[[T,O.value]]),i[5]||=d(`div`,{class:`absolute inset-0 rounded-[12px] pointer-events-none input-glow`},null,-1)])]),A.value?(o(),f(`div`,J,[d(`p`,Y,e(A.value),1)])):s(``,!0),d(`button`,{type:`submit`,disabled:k.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`},[k.value?(o(),r(b,{key:0,size:`sm`,color:`white`})):(o(),f(`svg`,Z,[...i[7]||=[d(`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)]])),d(`span`,ne,e(k.value?`Signing in...`:`Sign In`),1)],8,X)],32),d(`div`,re,[i[8]||=d(`div`,{class:`flex flex-col items-center justify-center mb-4`},[d(`p`,{class:`text-content-muted dark:text-content-muted text-[10px] sm:text-xs mb-1.5 tracking-wide uppercase opacity-60`},`Powered by`),d(`img`,{src:`/assets/meshcore-DQNtEl5I.svg`,alt:`MeshCore`,class:`h-4 sm:h-5 opacity-50 brightness-0 dark:brightness-100`})],-1),d(`div`,Q,[d(`a`,ie,[c(te,{class:`w-5 h-5 sm:w-6 sm:h-6 text-white group-hover:text-primary transition-colors`})]),d(`a`,ae,[c(w,{class:`w-5 h-5 sm:w-6 sm:h-6 text-white group-hover:text-yellow-500 transition-colors`})])])])])]),c(P,{"is-open":j.value,"can-skip":!0,onClose:oe,onSuccess:$},null,8,[`is-open`])]))}}),[[`__scopeId`,`data-v-2c828a8f`]]);export{$ as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/Login-Yv1Mvbrl.js b/repeater/web/html/assets/Login-Yv1Mvbrl.js new file mode 100644 index 0000000..2f3456e --- /dev/null +++ b/repeater/web/html/assets/Login-Yv1Mvbrl.js @@ -0,0 +1 @@ +import{Ct as e,V as t,Y as n,c as r,g as i,i as a,k as o,l as s,m as c,o as l,p as u,s as d,u as f}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{s as p,u as m}from"./runtime-dom.esm-bundler-fKU3dih-.js";import{c as h,g,i as _,p as v,r as y}from"./api-C0ctTLHN.js";import{t as b}from"./_plugin-vue_export-helper-TcpyXLsZ.js";import{t as x}from"./useTheme-D8lKuC-u.js";import{t as S}from"./Spinner-CYvUNW0P.js";import{a as C,c as w,i as T,r as ee,s as te}from"./index-BpKhPa08.js";var E={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`},D={key:0,class:`bg-red-500/10 border border-red-500/30 rounded-lg p-3`},O={class:`text-red-600 dark:text-red-400 text-sm`},k={key:1,class:`bg-green-500/10 border border-green-600/40 dark:border-green-500/30 rounded-lg p-3`},A={class:`text-green-600 dark:text-green-400 text-sm`},j={class:`flex justify-end gap-3 mt-6`},M=[`disabled`],N=[`disabled`],P=i({name:`ChangePasswordModal`,__name:`ChangePasswordModal`,props:{isOpen:{type:Boolean},canSkip:{type:Boolean,default:!0}},emits:[`close`,`success`],setup(i,{emit:c}){let l=c,h=n(``),g=n(``),_=n(``),v=n(!1),b=n(``),x=n(``),C=()=>{v.value||l(`close`)},w=()=>{l(`close`)},T=async()=>{if(b.value=``,x.value=``,g.value.length<8){b.value=`New password must be at least 8 characters long`;return}if(g.value!==_.value){b.value=`Passwords do not match`;return}if(g.value===h.value){b.value=`New password must be different from current password`;return}v.value=!0;try{let e=(await y.post(`/auth/change_password`,{current_password:h.value,new_password:g.value})).data;e&&e.success?(x.value=e.message||`Password changed successfully!`,setTimeout(()=>{l(`success`),l(`close`)},1500)):b.value=e?.error||`Failed to change password`}catch(e){console.error(`Password change error:`,e),b.value=e.response?.data?.error||`Failed to change password. Please try again.`}finally{v.value=!1}};return(n,c)=>(o(),r(a,{to:`body`},[i.isOpen?(o(),f(`div`,{key:0,class:`fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm`,onClick:m(C,[`self`])},[d(`div`,E,[c[6]||=d(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary mb-2`},` Change Default Password `,-1),c[7]||=d(`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),d(`form`,{onSubmit:m(T,[`prevent`]),class:`space-y-4`},[d(`div`,null,[c[3]||=d(`label`,{class:`block text-sm font-medium text-content-secondary dark:text-content-primary/70 mb-2`},`Current Password`,-1),t(d(`input`,{"onUpdate:modelValue":c[0]||=e=>h.value=e,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),[[p,h.value]])]),d(`div`,null,[c[4]||=d(`label`,{class:`block text-sm font-medium text-content-secondary dark:text-content-primary/70 mb-2`},`New Password`,-1),t(d(`input`,{"onUpdate:modelValue":c[1]||=e=>g.value=e,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),[[p,g.value]])]),d(`div`,null,[c[5]||=d(`label`,{class:`block text-sm font-medium text-content-secondary dark:text-content-primary/70 mb-2`},`Confirm New Password`,-1),t(d(`input`,{"onUpdate:modelValue":c[2]||=e=>_.value=e,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),[[p,_.value]])]),b.value?(o(),f(`div`,D,[d(`p`,O,e(b.value),1)])):s(``,!0),x.value?(o(),f(`div`,k,[d(`p`,A,e(x.value),1)])):s(``,!0),d(`div`,j,[i.canSkip?(o(),f(`button`,{key:0,type:`button`,onClick:w,disabled:v.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,M)):s(``,!0),d(`button`,{type:`submit`,disabled:v.value,class:`btn-primary flex items-center gap-2`},[v.value?(o(),r(S,{key:0,size:`sm`,color:`current`})):s(``,!0),u(` `+e(v.value?`Changing...`:`Change Password`),1)],8,N)])],32)])])):s(``,!0)]))}}),F={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`},I={class:`absolute top-4 right-4 z-20`},L={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`},R={class:`relative login-content`},z={class:`text-center mb-6 sm:mb-10`},B={class:`mb-4 sm:mb-6 flex justify-center`},V=[`src`],H={class:`form-group`},U={class:`relative`},W=[`disabled`],G={class:`form-group`},K={class:`relative`},q=[`disabled`],J={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`},Y={class:`text-red-600 dark:text-red-400 text-xs sm:text-sm font-medium`},X=[`disabled`],Z={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`},ne={class:`relative`},re={class:`mt-6 sm:mt-8 pt-4 sm:pt-6 border-t border-stroke-subtle dark:border-stroke/10`},Q={class:`flex items-center justify-center gap-3`},ie={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`},ae={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`},$=b(i({name:`LoginView`,__name:`Login`,setup(i){let a=g(),u=_(),{theme:b}=x(),E=l(()=>b.value===`dark`?C:T),D=n(`admin`),O=n(``),k=n(!1),A=n(``),j=n(!1),M=n(!1),N=async()=>{A.value=``,k.value=!0;try{let e=h(),t=(await y.post(`/auth/login`,{username:D.value,password:O.value,client_id:e})).data;t.success&&t.token?O.value===`admin123`?(v(t.token),u.markAuthenticated(),M.value=!0,j.value=!0):(v(t.token),u.markAuthenticated(),a.push(`/`)):A.value=t.error||`Login failed`}catch(e){console.error(`Login error:`,e),A.value=e.response?.data?.error||`Connection error. Please try again.`}finally{k.value=!1}},$=()=>{j.value=!1,a.push(`/`)},oe=()=>{j.value=!1,M.value&&a.push(`/`)};return(n,i)=>(o(),f(`div`,F,[d(`div`,I,[c(ee)]),i[10]||=d(`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),i[11]||=d(`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),i[12]||=d(`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),d(`div`,L,[i[9]||=d(`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),d(`div`,R,[d(`div`,z,[d(`div`,B,[d(`img`,{src:E.value,alt:`pyMC`,class:`logo-image h-36 sm:h-40 relative z-10`},null,8,V)]),i[2]||=d(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},` Sign in to access your dashboard `,-1)]),d(`form`,{onSubmit:m(N,[`prevent`]),class:`space-y-4 sm:space-y-5`},[d(`div`,H,[i[4]||=d(`label`,{for:`username`,class:`block text-content-secondary dark:text-content-primary/90 text-xs sm:text-sm font-medium mb-2`},` Username `,-1),d(`div`,U,[t(d(`input`,{id:`username`,"onUpdate:modelValue":i[0]||=e=>D.value=e,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:k.value},null,8,W),[[p,D.value]]),i[3]||=d(`div`,{class:`absolute inset-0 rounded-[12px] pointer-events-none input-glow`},null,-1)])]),d(`div`,G,[i[6]||=d(`label`,{for:`password`,class:`block text-content-secondary dark:text-content-primary/90 text-xs sm:text-sm font-medium mb-2`},` Password `,-1),d(`div`,K,[t(d(`input`,{id:`password`,"onUpdate:modelValue":i[1]||=e=>O.value=e,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:k.value},null,8,q),[[p,O.value]]),i[5]||=d(`div`,{class:`absolute inset-0 rounded-[12px] pointer-events-none input-glow`},null,-1)])]),A.value?(o(),f(`div`,J,[d(`p`,Y,e(A.value),1)])):s(``,!0),d(`button`,{type:`submit`,disabled:k.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`},[k.value?(o(),r(S,{key:0,size:`sm`,color:`white`})):(o(),f(`svg`,Z,[...i[7]||=[d(`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)]])),d(`span`,ne,e(k.value?`Signing in...`:`Sign In`),1)],8,X)],32),d(`div`,re,[i[8]||=d(`div`,{class:`flex flex-col items-center justify-center mb-4`},[d(`p`,{class:`text-content-muted dark:text-content-muted text-[10px] sm:text-xs mb-1.5 tracking-wide uppercase opacity-60`},`Powered by`),d(`img`,{src:`/assets/meshcore-DQNtEl5I.svg`,alt:`MeshCore`,class:`h-4 sm:h-5 opacity-50 brightness-0 dark:brightness-100`})],-1),d(`div`,Q,[d(`a`,ie,[c(w,{class:`w-5 h-5 sm:w-6 sm:h-6 text-white group-hover:text-primary transition-colors`})]),d(`a`,ae,[c(te,{class:`w-5 h-5 sm:w-6 sm:h-6 text-white group-hover:text-yellow-500 transition-colors`})])])])])]),c(P,{"is-open":j.value,"can-skip":!0,onClose:oe,onSuccess:$},null,8,[`is-open`])]))}}),[[`__scopeId`,`data-v-2c828a8f`]]);export{$ as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/Logs-BZIqxYO-.js b/repeater/web/html/assets/Logs-rmQ2jrEc.js similarity index 98% rename from repeater/web/html/assets/Logs-BZIqxYO-.js rename to repeater/web/html/assets/Logs-rmQ2jrEc.js index c26610e..da7a8ce 100644 --- a/repeater/web/html/assets/Logs-BZIqxYO-.js +++ b/repeater/web/html/assets/Logs-rmQ2jrEc.js @@ -1 +1 @@ -import{Ct as e,E as t,Y as n,f as r,g as i,j as a,k as o,l as s,m as c,o as l,p as u,r as d,s as f,u as p,w as m,xt as h}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{t as g}from"./api-DBiYn0RS.js";import{t as _}from"./Spinner-CYvUNW0P.js";var v={class:`space-y-6`},ee={class:`glass-card backdrop-blur border border-stroke-subtle dark:border-white/10 rounded-[15px] p-6`},y={class:`flex items-center justify-between mb-4`},b=[`disabled`],x={class:`bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4`},S={class:`flex flex-wrap gap-2`},C=[`onClick`],w={key:0,class:`w-px h-6 bg-stroke-subtle dark:bg-stroke/20 mx-2 self-center`},T=[`onClick`],E={class:`glass-card backdrop-blur border border-stroke-subtle dark:border-white/10 rounded-[15px] overflow-hidden`},te={key:0,class:`p-8 text-center`},D={key:1,class:`p-8 text-center`},O={class:`text-content-secondary dark:text-content-muted mb-4`},k={key:2,class:`max-h-[600px] overflow-y-auto`},A={key:0,class:`p-8 text-center`},j={key:1,class:`divide-y divide-gray-200 dark:divide-white/5`},M={class:`flex-shrink-0 text-content-secondary dark:text-content-muted`},N={class:`flex-shrink-0 px-2 py-1 text-xs font-medium rounded bg-blue-500/20 text-blue-600 dark:text-blue-400`},P={class:`text-content-primary dark:text-content-primary flex-1 break-all`},F=i({name:`LogsView`,__name:`Logs`,setup(i){let F=n([]),I=n(new Set),L=n(new Set([`DEBUG`,`INFO`,`WARNING`,`ERROR`])),R=n(new Set),z=n(new Set),B=n(!0),V=n(null),H=null,U=e=>{let t=e.match(/- ([^-]+) - (?:DEBUG|INFO|WARNING|ERROR) -/);return t?t[1].trim():`Unknown`},W=e=>{let t=e.match(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3} - [^-]+ - (?:DEBUG|INFO|WARNING|ERROR) - (.+)$/);return t?t[1]:e},G=(e,t)=>{if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0},K=async()=>{try{let e=await g.getLogs();if(e.logs&&e.logs.length>0){F.value=e.logs;let t=new Set;F.value.forEach(e=>{let n=U(e.message);t.add(n)});let n=new Set;F.value.forEach(e=>{n.add(e.level)}),I.value.size===0&&(I.value=new Set(t));let r=!G(R.value,t),i=!G(z.value,n);r&&(R.value=t),i&&(z.value=n),V.value=null}}catch(e){console.error(`Error loading logs:`,e),V.value=e instanceof Error?e.message:`Failed to load logs`}finally{B.value=!1}},q=l(()=>F.value.filter(e=>{let t=U(e.message),n=I.value.has(t),r=L.value.has(e.level);return n&&r})),J=l(()=>Array.from(R.value).sort()),Y=l(()=>{let e=[`ERROR`,`WARNING`,`WARN`,`INFO`,`DEBUG`];return Array.from(z.value).sort((t,n)=>{let r=e.indexOf(t),i=e.indexOf(n);return r!==-1&&i!==-1?r-i:t.localeCompare(n)})}),X=e=>{L.value.has(e)?L.value.delete(e):L.value.add(e),L.value=new Set(L.value)},Z=e=>new Date(e).toLocaleTimeString(`en-US`,{hour12:!1,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),Q=e=>({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`})[e]||`text-gray-400 bg-gray-900/20`,$=(e,t)=>t?{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`}[e]||`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`,ne=e=>{I.value.has(e)?I.value.delete(e):I.value.add(e),I.value=new Set(I.value)},re=()=>{I.value=new Set(R.value)},ie=()=>{I.value=new Set},ae=()=>{L.value=new Set(z.value)},oe=()=>{L.value=new Set},se=()=>{H&&clearInterval(H),H=setInterval(K,5e3)},ce=()=>{H&&=(clearInterval(H),null)};return t(()=>{K(),se()}),m(()=>{ce()}),(t,n)=>(o(),p(`div`,v,[f(`div`,ee,[f(`div`,y,[n[1]||=f(`div`,null,[f(`h1`,{class:`text-content-primary dark:text-content-primary text-2xl font-semibold mb-2`},` System Logs `),f(`p`,{class:`text-content-secondary dark:text-content-muted`},` Real-time system events and diagnostics `)],-1),f(`button`,{onClick:K,disabled:B.value,class:`btn-primary flex items-center gap-2`},[(o(),p(`svg`,{class:h([`w-4 h-4`,{"animate-spin":B.value}]),fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[...n[0]||=[f(`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)),u(` `+e(B.value?`Loading...`:`Refresh`),1)],8,b)]),f(`div`,x,[f(`div`,{class:`flex flex-wrap items-center gap-3 mb-4`},[n[2]||=f(`span`,{class:`text-content-primary dark:text-content-primary font-medium`},`Filters:`,-1),f(`button`,{onClick:re,class:`btn-success-xs`},` All Loggers `),f(`button`,{onClick:ie,class:`btn-danger-xs`},` Clear Loggers `),n[3]||=f(`div`,{class:`w-px h-4 bg-white/20 mx-1`},null,-1),f(`button`,{onClick:ae,class:`btn-success-xs`},` All Levels `),f(`button`,{onClick:oe,class:`btn-danger-xs`},` Clear Levels `)]),f(`div`,S,[(o(!0),p(d,null,a(J.value,t=>(o(),p(`button`,{key:`logger-`+t,onClick:e=>ne(t),class:h([`px-3 py-1 text-xs border rounded-full transition-colors`,I.value.has(t)?`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`])},e(t),11,C))),128)),J.value.length>0&&Y.value.length>0?(o(),p(`div`,w)):s(``,!0),(o(!0),p(d,null,a(Y.value,t=>(o(),p(`button`,{key:`level-`+t,onClick:e=>X(t),class:h([`px-3 py-1 text-xs border rounded-full transition-colors font-medium`,L.value.has(t)?$(t,!0):$(t,!1)])},e(t),11,T))),128))])])]),f(`div`,E,[B.value&&F.value.length===0?(o(),p(`div`,te,[c(_,{class:`mx-auto mb-4`}),n[4]||=f(`p`,{class:`text-content-secondary dark:text-content-muted`},`Loading system logs...`,-1)])):V.value?(o(),p(`div`,D,[n[5]||=f(`div`,{class:`text-red-600 dark:text-red-400 mb-4`},[f(`svg`,{class:`w-12 h-12 mx-auto mb-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[f(`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),n[6]||=f(`h3`,{class:`text-content-primary dark:text-content-primary text-lg font-medium mb-2`},` Error Loading Logs `,-1),f(`p`,O,e(V.value),1),f(`button`,{onClick:K,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 `)])):(o(),p(`div`,k,[q.value.length===0?(o(),p(`div`,A,[...n[7]||=[r(`

No Logs to Display

No logs match the current filter criteria.

`,3)]])):(o(),p(`div`,j,[(o(!0),p(d,null,a(q.value,(t,n)=>(o(),p(`div`,{key:n,class:`flex items-start gap-4 p-4 hover:bg-background-mute dark:hover:bg-stroke/5 transition-colors font-mono text-sm`},[f(`span`,M,` [`+e(Z(t.timestamp))+`] `,1),f(`span`,N,e(U(t.message)),1),f(`span`,{class:h([`flex-shrink-0 px-2 py-1 text-xs font-medium rounded`,Q(t.level)])},e(t.level),3),f(`span`,P,e(W(t.message)),1)]))),128))]))]))])]))}});export{F as default}; \ No newline at end of file +import{Ct as e,E as t,Y as n,f as r,g as i,j as a,k as o,l as s,m as c,o as l,p as u,r as d,s as f,u as p,w as m,xt as h}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{t as g}from"./api-C0ctTLHN.js";import{t as _}from"./Spinner-CYvUNW0P.js";var v={class:`space-y-6`},ee={class:`glass-card backdrop-blur border border-stroke-subtle dark:border-white/10 rounded-[15px] p-6`},y={class:`flex items-center justify-between mb-4`},b=[`disabled`],x={class:`bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4`},S={class:`flex flex-wrap gap-2`},C=[`onClick`],w={key:0,class:`w-px h-6 bg-stroke-subtle dark:bg-stroke/20 mx-2 self-center`},T=[`onClick`],E={class:`glass-card backdrop-blur border border-stroke-subtle dark:border-white/10 rounded-[15px] overflow-hidden`},te={key:0,class:`p-8 text-center`},D={key:1,class:`p-8 text-center`},O={class:`text-content-secondary dark:text-content-muted mb-4`},k={key:2,class:`max-h-[600px] overflow-y-auto`},A={key:0,class:`p-8 text-center`},j={key:1,class:`divide-y divide-gray-200 dark:divide-white/5`},M={class:`flex-shrink-0 text-content-secondary dark:text-content-muted`},N={class:`flex-shrink-0 px-2 py-1 text-xs font-medium rounded bg-blue-500/20 text-blue-600 dark:text-blue-400`},P={class:`text-content-primary dark:text-content-primary flex-1 break-all`},F=i({name:`LogsView`,__name:`Logs`,setup(i){let F=n([]),I=n(new Set),L=n(new Set([`DEBUG`,`INFO`,`WARNING`,`ERROR`])),R=n(new Set),z=n(new Set),B=n(!0),V=n(null),H=null,U=e=>{let t=e.match(/- ([^-]+) - (?:DEBUG|INFO|WARNING|ERROR) -/);return t?t[1].trim():`Unknown`},W=e=>{let t=e.match(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3} - [^-]+ - (?:DEBUG|INFO|WARNING|ERROR) - (.+)$/);return t?t[1]:e},G=(e,t)=>{if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0},K=async()=>{try{let e=await g.getLogs();if(e.logs&&e.logs.length>0){F.value=e.logs;let t=new Set;F.value.forEach(e=>{let n=U(e.message);t.add(n)});let n=new Set;F.value.forEach(e=>{n.add(e.level)}),I.value.size===0&&(I.value=new Set(t));let r=!G(R.value,t),i=!G(z.value,n);r&&(R.value=t),i&&(z.value=n),V.value=null}}catch(e){console.error(`Error loading logs:`,e),V.value=e instanceof Error?e.message:`Failed to load logs`}finally{B.value=!1}},q=l(()=>F.value.filter(e=>{let t=U(e.message),n=I.value.has(t),r=L.value.has(e.level);return n&&r})),J=l(()=>Array.from(R.value).sort()),Y=l(()=>{let e=[`ERROR`,`WARNING`,`WARN`,`INFO`,`DEBUG`];return Array.from(z.value).sort((t,n)=>{let r=e.indexOf(t),i=e.indexOf(n);return r!==-1&&i!==-1?r-i:t.localeCompare(n)})}),X=e=>{L.value.has(e)?L.value.delete(e):L.value.add(e),L.value=new Set(L.value)},Z=e=>new Date(e).toLocaleTimeString(`en-US`,{hour12:!1,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),Q=e=>({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`})[e]||`text-gray-400 bg-gray-900/20`,$=(e,t)=>t?{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`}[e]||`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`,ne=e=>{I.value.has(e)?I.value.delete(e):I.value.add(e),I.value=new Set(I.value)},re=()=>{I.value=new Set(R.value)},ie=()=>{I.value=new Set},ae=()=>{L.value=new Set(z.value)},oe=()=>{L.value=new Set},se=()=>{H&&clearInterval(H),H=setInterval(K,5e3)},ce=()=>{H&&=(clearInterval(H),null)};return t(()=>{K(),se()}),m(()=>{ce()}),(t,n)=>(o(),p(`div`,v,[f(`div`,ee,[f(`div`,y,[n[1]||=f(`div`,null,[f(`h1`,{class:`text-content-primary dark:text-content-primary text-2xl font-semibold mb-2`},` System Logs `),f(`p`,{class:`text-content-secondary dark:text-content-muted`},` Real-time system events and diagnostics `)],-1),f(`button`,{onClick:K,disabled:B.value,class:`btn-primary flex items-center gap-2`},[(o(),p(`svg`,{class:h([`w-4 h-4`,{"animate-spin":B.value}]),fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[...n[0]||=[f(`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)),u(` `+e(B.value?`Loading...`:`Refresh`),1)],8,b)]),f(`div`,x,[f(`div`,{class:`flex flex-wrap items-center gap-3 mb-4`},[n[2]||=f(`span`,{class:`text-content-primary dark:text-content-primary font-medium`},`Filters:`,-1),f(`button`,{onClick:re,class:`btn-success-xs`},` All Loggers `),f(`button`,{onClick:ie,class:`btn-danger-xs`},` Clear Loggers `),n[3]||=f(`div`,{class:`w-px h-4 bg-white/20 mx-1`},null,-1),f(`button`,{onClick:ae,class:`btn-success-xs`},` All Levels `),f(`button`,{onClick:oe,class:`btn-danger-xs`},` Clear Levels `)]),f(`div`,S,[(o(!0),p(d,null,a(J.value,t=>(o(),p(`button`,{key:`logger-`+t,onClick:e=>ne(t),class:h([`px-3 py-1 text-xs border rounded-full transition-colors`,I.value.has(t)?`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`])},e(t),11,C))),128)),J.value.length>0&&Y.value.length>0?(o(),p(`div`,w)):s(``,!0),(o(!0),p(d,null,a(Y.value,t=>(o(),p(`button`,{key:`level-`+t,onClick:e=>X(t),class:h([`px-3 py-1 text-xs border rounded-full transition-colors font-medium`,L.value.has(t)?$(t,!0):$(t,!1)])},e(t),11,T))),128))])])]),f(`div`,E,[B.value&&F.value.length===0?(o(),p(`div`,te,[c(_,{class:`mx-auto mb-4`}),n[4]||=f(`p`,{class:`text-content-secondary dark:text-content-muted`},`Loading system logs...`,-1)])):V.value?(o(),p(`div`,D,[n[5]||=f(`div`,{class:`text-red-600 dark:text-red-400 mb-4`},[f(`svg`,{class:`w-12 h-12 mx-auto mb-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[f(`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),n[6]||=f(`h3`,{class:`text-content-primary dark:text-content-primary text-lg font-medium mb-2`},` Error Loading Logs `,-1),f(`p`,O,e(V.value),1),f(`button`,{onClick:K,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 `)])):(o(),p(`div`,k,[q.value.length===0?(o(),p(`div`,A,[...n[7]||=[r(`

No Logs to Display

No logs match the current filter criteria.

`,3)]])):(o(),p(`div`,j,[(o(!0),p(d,null,a(q.value,(t,n)=>(o(),p(`div`,{key:n,class:`flex items-start gap-4 p-4 hover:bg-background-mute dark:hover:bg-stroke/5 transition-colors font-mono text-sm`},[f(`span`,M,` [`+e(Z(t.timestamp))+`] `,1),f(`span`,N,e(U(t.message)),1),f(`span`,{class:h([`flex-shrink-0 px-2 py-1 text-xs font-medium rounded`,Q(t.level)])},e(t.level),3),f(`span`,P,e(W(t.message)),1)]))),128))]))]))])]))}});export{F as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/MessageDialog-Bs1UHPdw.js b/repeater/web/html/assets/MessageDialog-Bs1UHPdw.js new file mode 100644 index 0000000..e6923ff --- /dev/null +++ b/repeater/web/html/assets/MessageDialog-Bs1UHPdw.js @@ -0,0 +1 @@ +import{Ct as e,c as t,g as n,i as r,k as i,l as a,s as o,u as s,xt as c}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{u as l}from"./runtime-dom.esm-bundler-fKU3dih-.js";var u={class:`modal-card max-w-md`},d={class:`mb-6`},f={key:0,class:`w-6 h-6`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},p={key:1,class:`w-6 h-6`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},m={key:2,class:`w-6 h-6`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},h={class:`text-content-secondary dark:text-content-primary/80 text-base leading-relaxed`},g={class:`flex`},_=n({__name:`MessageDialog`,props:{show:{type:Boolean},message:{},variant:{default:`success`}},emits:[`close`],setup(n,{emit:_}){let v=n,y=_,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`},x={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,_)=>(i(),t(r,{to:`body`},[v.show?(i(),s(`div`,{key:0,onClick:_[1]||=l(e=>y(`close`),[`self`]),class:`modal-backdrop`},[o(`div`,u,[o(`div`,d,[o(`div`,{class:c([`inline-flex p-3 rounded-xl mb-4`,b[v.variant]])},[v.variant===`success`?(i(),s(`svg`,f,[..._[2]||=[o(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M5 13l4 4L19 7`},null,-1)]])):v.variant===`error`?(i(),s(`svg`,p,[..._[3]||=[o(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`},null,-1)]])):(i(),s(`svg`,m,[..._[4]||=[o(`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),o(`p`,h,e(v.message),1)]),o(`div`,g,[o(`button`,{onClick:_[0]||=e=>y(`close`),class:c([`flex-1 px-4 py-3 rounded-xl text-white transition-all duration-200`,x[v.variant]])},` OK `,2)])])])):a(``,!0)]))}});export{_ as t}; \ No newline at end of file diff --git a/repeater/web/html/assets/MessageDialog-CgmXx0Yp.js b/repeater/web/html/assets/MessageDialog-CgmXx0Yp.js deleted file mode 100644 index 5ed367c..0000000 --- a/repeater/web/html/assets/MessageDialog-CgmXx0Yp.js +++ /dev/null @@ -1 +0,0 @@ -import{Ct as e,c as t,g as n,i as r,k as i,l as a,s as o,u as s,xt as c}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{g as l}from"./index-CG181k2K.js";var u={class:`modal-card max-w-md`},d={class:`mb-6`},f={key:0,class:`w-6 h-6`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},p={key:1,class:`w-6 h-6`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},m={key:2,class:`w-6 h-6`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},h={class:`text-content-secondary dark:text-content-primary/80 text-base leading-relaxed`},g={class:`flex`},_=n({__name:`MessageDialog`,props:{show:{type:Boolean},message:{},variant:{default:`success`}},emits:[`close`],setup(n,{emit:_}){let v=n,y=_,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`},x={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,_)=>(i(),t(r,{to:`body`},[v.show?(i(),s(`div`,{key:0,onClick:_[1]||=l(e=>y(`close`),[`self`]),class:`modal-backdrop`},[o(`div`,u,[o(`div`,d,[o(`div`,{class:c([`inline-flex p-3 rounded-xl mb-4`,b[v.variant]])},[v.variant===`success`?(i(),s(`svg`,f,[..._[2]||=[o(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M5 13l4 4L19 7`},null,-1)]])):v.variant===`error`?(i(),s(`svg`,p,[..._[3]||=[o(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`},null,-1)]])):(i(),s(`svg`,m,[..._[4]||=[o(`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),o(`p`,h,e(v.message),1)]),o(`div`,g,[o(`button`,{onClick:_[0]||=e=>y(`close`),class:c([`flex-1 px-4 py-3 rounded-xl text-white transition-all duration-200`,x[v.variant]])},` OK `,2)])])])):a(``,!0)]))}});export{_ as t}; \ No newline at end of file diff --git a/repeater/web/html/assets/Neighbors-BPL8jV_a.js b/repeater/web/html/assets/Neighbors-BPL8jV_a.js new file mode 100644 index 0000000..d730948 --- /dev/null +++ b/repeater/web/html/assets/Neighbors-BPL8jV_a.js @@ -0,0 +1,65 @@ +import{r as e}from"./chunk-DECur_0Z.js";import{B as t,Ct as n,D as r,E as i,R as a,S as o,St as s,V as c,Y as l,c as u,f as d,g as f,i as p,j as m,k as h,l as g,m as _,nt as v,o as y,p as b,r as x,s as S,u as C,xt as w}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{c as T,o as E,s as D,t as O,u as k}from"./runtime-dom.esm-bundler-fKU3dih-.js";import{t as A}from"./api-C0ctTLHN.js";import{t as j}from"./system-Dx7MrhAz.js";import{n as M,r as N,t as P}from"./dataService-CLvdg62X.js";import{t as F}from"./_plugin-vue_export-helper-TcpyXLsZ.js";import{t as I}from"./Spinner-CYvUNW0P.js";import{t as L}from"./leaflet-src-EmArVA6Z.js";/* empty css */import{a as R,i as z,l as B,o as V,r as ee,s as H,u as U}from"./formatters-Cc4UJmeb.js";import{n as W,t as G}from"./preferences-6MHglq--.js";import{t as K}from"./useSignalQuality-CLsnSJcS.js";var q={class:`modal-card max-w-md`},J={class:`bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4 mb-6`},te={class:`flex items-center gap-3`},ne={class:`flex-1 min-w-0`},re={class:`text-content-primary dark:text-content-primary font-medium truncate`},ie={class:`text-content-secondary dark:text-content-muted text-sm font-mono`},ae={key:0,class:`text-white/50 text-xs`},oe={key:1,class:`text-white/50 text-xs`},se=f({__name:`DeleteNeighborModal`,props:{show:{type:Boolean},neighbor:{}},emits:[`close`,`delete`],setup(e,{emit:t}){let r=e,i=t,a=()=>{r.neighbor&&(i(`delete`,r.neighbor.id),o())},o=()=>{i(`close`)};return(t,r)=>(h(),u(p,{to:`body`},[e.show&&e.neighbor?(h(),C(`div`,{key:0,onClick:r[0]||=k(e=>o(),[`self`]),class:`modal-backdrop-heavy`},[S(`div`,q,[S(`div`,{class:`flex items-center gap-3 mb-6`},[r[2]||=S(`svg`,{class:`w-6 h-6 text-accent-red`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),r[3]||=S(`div`,null,[S(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary`},` Delete Neighbor `),S(`p`,{class:`text-content-secondary dark:text-content-muted text-sm mt-1`},` Are you sure you want to delete this neighbor? `)],-1),S(`button`,{onClick:o,class:`ml-auto text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors`},[...r[1]||=[S(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),S(`div`,J,[S(`div`,te,[S(`div`,ne,[S(`div`,re,n(e.neighbor?.node_name||e.neighbor?.long_name||e.neighbor?.short_name||`Unknown`),1),S(`div`,ie,` ID: `+n(e.neighbor?.node_num_hex||e.neighbor?.node_num||e.neighbor?.id||`N/A`),1),e.neighbor?.contact_type?(h(),C(`div`,ae,n(e.neighbor.contact_type),1)):g(``,!0),e.neighbor?.hw_model?(h(),C(`div`,oe,n(e.neighbor.hw_model),1)):g(``,!0)])])]),r[4]||=S(`div`,{class:`bg-accent-red/10 border border-accent-red/30 rounded-lg p-4 mb-6`},[S(`div`,{class:`flex items-center gap-2 text-accent-red text-sm`},[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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`})]),S(`span`,null,`This action cannot be undone`)])],-1),S(`div`,{class:`flex gap-3`},[S(`button`,{onClick:o,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(`button`,{onClick:a,class:`modal-btn-danger`},` Delete `)])])])):g(``,!0)]))}}),ce={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`},le={class:`flex items-center justify-between`},ue={class:`flex items-center gap-3`},Y={key:0,class:`text-sm text-content-secondary dark:text-content-muted`},de={class:`p-6`},fe={key:0,class:`text-center py-8`},pe={key:1,class:`text-center py-8`},me={class:`text-content-secondary dark:text-content-muted text-sm`},he={key:2,class:`space-y-4`},ge={class:`bg-background-mute dark:bg-background/50 border border-stroke-subtle dark:border-stroke/10 rounded-[15px] p-4`},_e={class:`flex items-center justify-between mb-2`},ve={class:`flex items-baseline gap-2`},ye={class:`text-3xl font-bold text-content-primary dark:text-content-primary`},be={class:`grid grid-cols-2 gap-3`},xe={class:`bg-background-mute dark:bg-background/50 border border-stroke-subtle dark:border-stroke/10 rounded-[15px] p-4`},Se={class:`flex items-center gap-2 mb-2`},Ce={class:`flex gap-0.5`},we={class:`flex items-baseline gap-1`},Te={class:`text-xl font-bold text-content-primary dark:text-content-primary`},Ee={class:`bg-background-mute dark:bg-background/50 border border-stroke-subtle dark:border-stroke/10 rounded-[15px] p-4`},De={class:`flex items-baseline gap-1`},Oe={class:`text-xl font-bold text-content-primary dark:text-content-primary`},ke={key:0,class:`flex items-start gap-3 bg-amber-500/10 border border-amber-500/30 rounded-[12px] p-3`},Ae={class:`text-xs leading-relaxed`},je={class:`font-semibold text-amber-600 dark:text-amber-400 mb-0.5`},Me={class:`bg-background-mute dark:bg-background/50 border border-stroke-subtle dark:border-stroke/10 rounded-[15px] p-4`},Ne={class:`relative`},Pe={class:`flex items-center gap-2 overflow-x-auto pb-2`},Fe={key:0,class:`relative flex items-center`},Ie={key:0,class:`absolute left-1/2 -translate-x-1/2 animate-pulse`},Le={class:`text-content-muted dark:text-content-muted text-xs mt-2 flex items-center justify-between`},Re={key:0,class:`text-cyan-500 dark:text-primary animate-pulse`},ze={class:`flex items-center justify-between text-xs text-content-muted dark:text-content-muted pt-2`},Be=F(f({__name:`PingResultModal`,props:{show:{type:Boolean},nodeName:{default:null},result:{default:null},error:{default:null},loading:{type:Boolean,default:!1}},emits:[`close`],setup(e,{emit:r}){let i=e,o=r,s=j(),{getSignalQuality:c}=K(),d=l(0),f=l(!1),v=y(()=>{let e=s.stats?.config?.radio?.spreading_factor??7,t=s.stats?.config?.radio?.bandwidth??125,n=s.stats?.config?.radio?.coding_rate??5;return 2**e/t*(8+4.25*(n-4)+20)}),b=y(()=>{if(!i.result)return{color:`text-gray-400`,label:`Unknown`};let e=i.result.rtt_ms,t=v.value,n=i.result.path.length,r=2*t*n+500*n;return e{if(!i.result)return{bars:0,color:`text-gray-400`};let e=c(i.result.rssi);return{bars:e.bars,color:e.color}}),E=y(()=>{if(!i.result)return 0;if(i.result.path_hash_mode!==void 0)return i.result.path_hash_mode;let e=i.result.path.reduce((e,t)=>{let n=t.replace(/^0x/i,``);return Math.max(e,n.length)},0);return e>4?2:e>2?1:0}),D=y(()=>E.value>0),A=y(()=>({0:`1-byte`,1:`2-byte`,2:`3-byte`})[E.value]??`1-byte`);a(()=>i.result,e=>{if(e&&!f.value){f.value=!0,d.value=0;let t=e.path.length,n=1500/(t*2),r=0,i=t*2-2,a=()=>{r<=i?(d.value=r/i,r++,setTimeout(a,n)):(f.value=!1,d.value=1)};setTimeout(a,100)}},{immediate:!0});let M=y(()=>{if(!i.result||!f.value)return-1;let e=i.result.path.length;if(e<=1)return-1;let t=d.value,n=.5;if(t<=n)return t/n*(e-1);{let r=(t-n)/n;return(e-1)*(1-r)}}),N=()=>{o(`close`)};return(r,i)=>(h(),u(p,{to:`body`},[_(O,{name:`modal`},{default:t(()=>[e.show?(h(),C(`div`,{key:0,class:`fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-[300] p-4`,onClick:k(N,[`self`])},[S(`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:i[0]||=k(()=>{},[`stop`])},[S(`div`,ce,[S(`div`,le,[S(`div`,ue,[i[2]||=S(`div`,{class:`p-2 bg-cyan-400/20 dark:bg-primary/20 rounded-lg`},[S(`svg`,{class:`w-5 h-5 text-cyan-500 dark:text-primary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`div`,null,[i[1]||=S(`h2`,{class:`text-xl font-bold text-content-primary dark:text-content-primary`},` Ping Result `,-1),e.nodeName?(h(),C(`p`,Y,n(e.nodeName),1)):g(``,!0)])]),S(`button`,{onClick:N,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`},[...i[3]||=[S(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])])]),S(`div`,de,[e.loading?(h(),C(`div`,fe,[_(I,{size:`lg`,class:`mx-auto mb-4`}),i[4]||=S(`p`,{class:`text-content-secondary dark:text-content-muted`},`Sending ping...`,-1),i[5]||=S(`p`,{class:`text-content-muted dark:text-content-muted text-sm mt-1`},` Waiting for response... `,-1)])):e.error?(h(),C(`div`,pe,[i[6]||=S(`div`,{class:`p-3 bg-accent-red/10 rounded-full w-16 h-16 mx-auto mb-4 flex items-center justify-center`},[S(`svg`,{class:`w-8 h-8 text-accent-red`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),i[7]||=S(`h3`,{class:`text-accent-red font-semibold mb-2`},`Ping Failed`,-1),S(`p`,me,n(e.error),1)])):e.result?(h(),C(`div`,he,[S(`div`,ge,[S(`div`,_e,[i[8]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Round-Trip Time`,-1),S(`span`,{class:w([`text-xs font-medium px-2 py-1 rounded-full`,b.value.color,`bg-current/10`])},n(b.value.label),3)]),S(`div`,ve,[S(`span`,ye,n(e.result.rtt_ms.toFixed(2)),1),i[9]||=S(`span`,{class:`text-content-secondary dark:text-content-muted`},`ms`,-1)])]),S(`div`,be,[S(`div`,xe,[S(`div`,Se,[i[10]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`RSSI`,-1),S(`div`,Ce,[(h(),C(x,null,m(5,e=>S(`div`,{key:e,class:w([`w-1 h-3 rounded-sm`,e<=T.value.bars?T.value.color:`bg-stroke-subtle dark:bg-stroke/10`])},null,2)),64))])]),S(`div`,we,[S(`span`,Te,n(e.result.rssi),1),i[11]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs`},`dBm`,-1)])]),S(`div`,Ee,[i[13]||=S(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-2`},`SNR`,-1),S(`div`,De,[S(`span`,Oe,n(e.result.snr_db),1),i[12]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs`},`dB`,-1)])])]),D.value?(h(),C(`div`,ke,[i[15]||=S(`svg`,{class:`w-5 h-5 text-amber-500 flex-shrink-0 mt-0.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`div`,Ae,[S(`p`,je,n(A.value)+` path hashes active `,1),i[14]||=S(`p`,{class:`text-content-secondary dark:text-content-muted`},` This result uses multi-byte path hashes. The repeater being traced must be running firmware that supports multi-byte path hashes. Repeaters on older firmware will not respond to or correctly route these trace packets. `,-1)])])):g(``,!0),S(`div`,Me,[i[18]||=S(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-3`},` Network Path `,-1),S(`div`,Ne,[S(`div`,Pe,[(h(!0),C(x,null,m(e.result.path,(r,a)=>(h(),C(`div`,{key:a,class:`flex items-center gap-2 flex-shrink-0 relative`},[S(`div`,{class:w([`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`,f.value&&Math.floor(M.value)===a?`ring-2 ring-cyan-400/50 dark:ring-primary/50 scale-105`:``])},n(r),3),a[f.value&&M.value>=a&&M.value({Unknown:`Unknown`,"Chat Node":`Chat Node`,Repeater:`Repeater`,"Room Server":`Room Server`,"Hybrid Node":`Hybrid Node`})[e]||e,E=e=>({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`})[e]||`text-gray-600 dark:text-gray-400`,D=async()=>{if(!s.neighbor?.latitude||!s.neighbor?.longitude)return;let e=`${s.neighbor.latitude.toFixed(6)}, ${s.neighbor.longitude.toFixed(6)}`;try{await navigator.clipboard.writeText(e),o.value=`Copied!`,setTimeout(()=>{o.value=`Copy`},2e3)}catch(e){console.error(`Failed to copy coordinates:`,e),o.value=`Failed`,setTimeout(()=>{o.value=`Copy`},2e3)}},A=y(()=>{if(!s.neighbor?.latitude||!s.neighbor?.longitude||!s.baseLatitude||!s.baseLongitude)return null;let e=(s.neighbor.latitude-s.baseLatitude)*Math.PI/180,t=(s.neighbor.longitude-s.baseLongitude)*Math.PI/180,n=Math.sin(e/2)*Math.sin(e/2)+Math.cos(s.baseLatitude*Math.PI/180)*Math.cos(s.neighbor.latitude*Math.PI/180)*Math.sin(t/2)*Math.sin(t/2);return 6371*(2*Math.atan2(Math.sqrt(n),Math.sqrt(1-n)))}),j=y(()=>s.neighbor?.latitude!==null&&s.neighbor?.longitude!==null&&s.neighbor?.latitude!==0&&s.neighbor?.longitude!==0&&Math.abs(s.neighbor?.latitude??0)<=90&&Math.abs(s.neighbor?.longitude??0)<=180),M=()=>{if(!d.value||!s.neighbor||!j.value)return;f&&=(f.remove(),null);let e=document.documentElement.classList.contains(`dark`);f=X.default.map(d.value,{center:[s.neighbor.latitude,s.neighbor.longitude],zoom:13,zoomControl:!0,attributionControl:!1});let t=e?`https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png`:`https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png`;X.default.tileLayer(t,{maxZoom:19,attribution:`© OpenStreetMap © CARTO`}).addTo(f);let n=X.default.divIcon({className:`custom-marker`,html:`
${s.neighbor.node_name?.charAt(0)||`?`}
`,iconSize:[32,32],iconAnchor:[16,16]});if(X.default.marker([s.neighbor.latitude,s.neighbor.longitude],{icon:n}).addTo(f).bindPopup(`${s.neighbor.node_name||`Unknown`}
${s.neighbor.pubkey.slice(0,8)}...`),s.baseLatitude!==null&&s.baseLongitude!==null&&s.baseLatitude!==0&&s.baseLongitude!==0&&Math.abs(s.baseLatitude)<=90&&Math.abs(s.baseLongitude)<=180){let e=X.default.divIcon({className:`custom-marker`,html:`
B
`,iconSize:[32,32],iconAnchor:[16,16]});X.default.marker([s.baseLatitude,s.baseLongitude],{icon:e}).addTo(f).bindPopup(`Base Station`),X.default.polyline([[s.baseLatitude,s.baseLongitude],[s.neighbor.latitude,s.neighbor.longitude]],{color:`#3b82f6`,weight:2,opacity:.6,dashArray:`5, 10`}).addTo(f);let t=X.default.latLngBounds([s.baseLatitude,s.baseLongitude],[s.neighbor.latitude,s.neighbor.longitude]);f.fitBounds(t,{padding:[50,50]})}},N=e=>{e.key===`Escape`&&c(`close`)},P=e=>{e.target===e.currentTarget&&c(`close`)};a(()=>s.isOpen,e=>{e?(document.body.style.overflow=`hidden`,setTimeout(()=>{j.value&&M()},100)):(document.body.style.overflow=``,f&&=(f.remove(),null))},{immediate:!0});let F=y(()=>s.neighbor?i(s.neighbor.rssi):null),I=[`h-1.5`,`h-2`,`h-2.5`,`h-3`,`h-3.5`];return(r,i)=>(h(),u(p,{to:`body`},[_(O,{name:`modal`,appear:``},{default:t(()=>[e.isOpen&&e.neighbor?(h(),C(`div`,{key:0,class:`fixed inset-0 z-50 flex items-center justify-center p-4 overflow-hidden`,onClick:P,onKeydown:N,tabindex:`0`},[i[21]||=S(`div`,{class:`absolute inset-0 bg-black/60 backdrop-blur-md pointer-events-none`},null,-1),S(`div`,{class:`relative w-full max-w-4xl max-h-[90vh] flex flex-col`,onClick:i[2]||=k(()=>{},[`stop`])},[S(`div`,Ve,[S(`div`,He,[S(`div`,Ue,[S(`h2`,We,n(e.neighbor.node_name||`Unknown Node`),1),S(`p`,Ge,n(e.neighbor.pubkey),1)]),S(`div`,Ke,[S(`button`,{onClick:i[0]||=e=>c(`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`},[...i[3]||=[S(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])])]),S(`div`,qe,[S(`div`,Je,[i[8]||=S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-4`},` Basic Information `,-1),S(`div`,Ye,[S(`div`,Xe,[i[4]||=S(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` Contact Type `,-1),S(`div`,{class:w([`font-medium`,E(e.neighbor.contact_type)])},n(T(e.neighbor.contact_type)),3)]),S(`div`,Ze,[i[5]||=S(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` Route Type `,-1),S(`div`,Qe,n(v(V)(e.neighbor.route_type)),1)]),S(`div`,$e,[i[6]||=S(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` Zero Hop `,-1),S(`div`,{class:w([`font-medium`,e.neighbor.zero_hop?`text-green-600 dark:text-green-400`:`text-gray-600 dark:text-gray-400`])},n(e.neighbor.zero_hop?`Yes`:`No`),3)]),S(`div`,et,[i[7]||=S(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` Advert Count `,-1),S(`div`,tt,n(e.neighbor.advert_count.toLocaleString()),1)])])]),S(`div`,nt,[i[13]||=S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-4`},` Signal Quality `,-1),S(`div`,rt,[S(`div`,it,[i[9]||=S(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` RSSI `,-1),S(`div`,at,n(v(R)(e.neighbor.rssi)),1)]),S(`div`,ot,[i[10]||=S(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` SNR `,-1),S(`div`,st,n(v(H)(e.neighbor.snr)),1)]),F.value?(h(),C(`div`,ct,[i[12]||=S(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` Signal Strength `,-1),S(`div`,lt,[S(`div`,ut,[(h(),C(x,null,m(5,e=>S(`div`,{key:e,class:w([`w-1 transition-colors`,I[e-1],e<=F.value.bars?F.value.color:`text-gray-600 dark:text-gray-700`])},[...i[11]||=[S(`div`,{class:`w-full h-full bg-current rounded-sm`},null,-1)]],2)),64))]),S(`span`,{class:w([`text-sm font-medium`,F.value.color])},n(F.value.quality),3)])])):g(``,!0)])]),S(`div`,dt,[i[16]||=S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-4`},` Timeline `,-1),S(`div`,ft,[S(`div`,pt,[i[14]||=S(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` First Seen `,-1),S(`div`,mt,n(v(B)(e.neighbor.first_seen)),1)]),S(`div`,ht,[i[15]||=S(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` Last Seen `,-1),S(`div`,gt,n(v(B)(e.neighbor.last_seen)),1)])])]),j.value?(h(),C(`div`,_t,[i[20]||=S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-4`},` Location `,-1),S(`div`,vt,[S(`div`,yt,[i[17]||=S(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` Latitude `,-1),S(`div`,bt,n(e.neighbor.latitude?.toFixed(6)),1)]),S(`div`,xt,[i[18]||=S(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` Longitude `,-1),S(`div`,St,n(e.neighbor.longitude?.toFixed(6)),1)]),S(`div`,Ct,[S(`div`,wt,n(A.value===null?`Coordinates`:`Distance`),1),A.value===null?(h(),C(`button`,{key:1,onClick:D,class:`w-full px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center justify-center gap-1.5 bg-primary/20 hover:bg-primary/30 border border-primary/50 text-primary`},[i[19]||=S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),b(` `+n(o.value),1)])):(h(),C(`div`,Tt,n(`${A.value.toFixed(2)} km`),1))])]),S(`div`,{ref_key:`mapContainer`,ref:d,class:`w-full h-96 rounded-[12px] overflow-hidden border border-stroke-subtle dark:border-white/10`},null,512)])):g(``,!0)]),S(`div`,Et,[S(`button`,{onClick:i[1]||=e=>c(`close`),class:`w-full px-4 py-2.5 rounded-lg font-medium transition-colors bg-primary/20 hover:bg-primary/30 border border-primary/50 text-primary`},` Close `)])])])],32)):g(``,!0)]),_:1})]))}}),[[`__scopeId`,`data-v-dc69b1d1`]]),Ot=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],kt=1,At=8,jt=class e{static from(t){if(!(t instanceof ArrayBuffer))throw Error(`Data must be an instance of ArrayBuffer.`);let[n,r]=new Uint8Array(t,0,2);if(n!==219)throw Error(`Data does not appear to be in a KDBush format.`);let i=r>>4;if(i!==kt)throw Error(`Got v${i} data when expected v${kt}.`);let a=Ot[r&15];if(!a)throw Error(`Unrecognized array type.`);let[o]=new Uint16Array(t,2,1),[s]=new Uint32Array(t,4,1);return new e(s,o,a,t)}constructor(e,t=64,n=Float64Array,r){if(isNaN(e)||e<0)throw Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let i=Ot.indexOf(this.ArrayType),a=e*2*this.ArrayType.BYTES_PER_ELEMENT,o=e*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-o%8)%8;if(i<0)throw Error(`Unexpected typed array class: ${n}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,At,e),this.coords=new this.ArrayType(this.data,At+o+s,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(At+a+o+s),this.ids=new this.IndexArrayType(this.data,At,e),this.coords=new this.ArrayType(this.data,At+o+s,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(kt<<4)+i]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=t,n}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return Mt(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,n,r){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:i,coords:a,nodeSize:o}=this,s=[0,i.length-1,0],c=[];for(;s.length;){let l=s.pop()||0,u=s.pop()||0,d=s.pop()||0;if(u-d<=o){for(let o=d;o<=u;o++){let s=a[2*o],l=a[2*o+1];s>=e&&s<=n&&l>=t&&l<=r&&c.push(i[o])}continue}let f=d+u>>1,p=a[2*f],m=a[2*f+1];p>=e&&p<=n&&m>=t&&m<=r&&c.push(i[f]),(l===0?e<=p:t<=m)&&(s.push(d),s.push(f-1),s.push(1-l)),(l===0?n>=p:r>=m)&&(s.push(f+1),s.push(u),s.push(1-l))}return c}within(e,t,n){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:r,coords:i,nodeSize:a}=this,o=[0,r.length-1,0],s=[],c=n*n;for(;o.length;){let l=o.pop()||0,u=o.pop()||0,d=o.pop()||0;if(u-d<=a){for(let n=d;n<=u;n++)It(i[2*n],i[2*n+1],e,t)<=c&&s.push(r[n]);continue}let f=d+u>>1,p=i[2*f],m=i[2*f+1];It(p,m,e,t)<=c&&s.push(r[f]),(l===0?e-n<=p:t-n<=m)&&(o.push(d),o.push(f-1),o.push(1-l)),(l===0?e+n>=p:t+n>=m)&&(o.push(f+1),o.push(u),o.push(1-l))}return s}};function Mt(e,t,n,r,i,a){if(i-r<=n)return;let o=r+i>>1;Nt(e,t,o,r,i,a),Mt(e,t,n,r,o-1,1-a),Mt(e,t,n,o+1,i,1-a)}function Nt(e,t,n,r,i,a){for(;i>r;){if(i-r>600){let o=i-r+1,s=n-r+1,c=Math.log(o),l=.5*Math.exp(2*c/3),u=.5*Math.sqrt(c*l*(o-l)/o)*(s-o/2<0?-1:1);Nt(e,t,n,Math.max(r,Math.floor(n-s*l/o+u)),Math.min(i,Math.floor(n+(o-s)*l/o+u)),a)}let o=t[2*n+a],s=r,c=i;for(Pt(e,t,r,n),t[2*i+a]>o&&Pt(e,t,r,i);so;)c--}t[2*r+a]===o?Pt(e,t,r,c):(c++,Pt(e,t,c,i)),c<=n&&(r=c+1),n<=c&&(i=c-1)}}function Pt(e,t,n,r){Ft(e,n,r),Ft(t,2*n,2*r),Ft(t,2*n+1,2*r+1)}function Ft(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function It(e,t,n,r){let i=e-n,a=t-r;return i*i+a*a}var Lt={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},Rt=Math.fround||(e=>(t=>(e[0]=+t,e[0])))(new Float32Array(1)),Z=2,Q=3,zt=4,$=5,Bt=6,Vt=class{constructor(e){this.options=Object.assign(Object.create(Lt),e),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){let{log:t,minZoom:n,maxZoom:r}=this.options;t&&console.time(`total time`);let i=`prepare ${e.length} points`;t&&console.time(i),this.points=e;let a=[];for(let t=0;t=n;e--){let n=+Date.now();o=this.trees[e]=this._createTree(this._cluster(o,e)),t&&console.log(`z%d: %d clusters in %dms`,e,o.numItems,+Date.now()-n)}return t&&console.timeEnd(`total time`),this}getClusters(e,t){let n=((e[0]+180)%360+360)%360-180,r=Math.max(-90,Math.min(90,e[1])),i=e[2]===180?180:((e[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)n=-180,i=180;else if(n>i){let e=this.getClusters([n,r,180,a],t),o=this.getClusters([-180,r,i,a],t);return e.concat(o)}let o=this.trees[this._limitZoom(t)],s=o.range(Wt(n),Gt(a),Wt(i),Gt(r)),c=o.data,l=[];for(let e of s){let t=this.stride*e;l.push(c[t+$]>1?Ht(c,t,this.clusterProps):this.points[c[t+Q]])}return l}getChildren(e){let t=this._getOriginId(e),n=this._getOriginZoom(e),r=`No cluster with the specified id.`,i=this.trees[n];if(!i)throw Error(r);let a=i.data;if(t*this.stride>=a.length)throw Error(r);let o=this.options.radius/(this.options.extent*2**(n-1)),s=a[t*this.stride],c=a[t*this.stride+1],l=i.within(s,c,o),u=[];for(let t of l){let n=t*this.stride;a[n+zt]===e&&u.push(a[n+$]>1?Ht(a,n,this.clusterProps):this.points[a[n+Q]])}if(u.length===0)throw Error(r);return u}getLeaves(e,t,n){t||=10,n||=0;let r=[];return this._appendLeaves(r,e,t,n,0),r}getTile(e,t,n){let r=this.trees[this._limitZoom(e)],i=2**e,{extent:a,radius:o}=this.options,s=o/a,c=(n-s)/i,l=(n+1+s)/i,u={features:[]};return this._addTileFeatures(r.range((t-s)/i,c,(t+1+s)/i,l),r.data,t,n,i,u),t===0&&this._addTileFeatures(r.range(1-s/i,c,1,l),r.data,i,n,i,u),t===i-1&&this._addTileFeatures(r.range(0,c,s/i,l),r.data,-1,n,i,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){let n=this.getChildren(e);if(t++,n.length!==1)break;e=n[0].properties.cluster_id}return t}_appendLeaves(e,t,n,r,i){let a=this.getChildren(t);for(let t of a){let a=t.properties;if(a&&a.cluster?i+a.point_count<=r?i+=a.point_count:i=this._appendLeaves(e,a.cluster_id,n,r,i):i1,c,l,u;if(s)c=Ut(t,e,this.clusterProps),l=t[e],u=t[e+1];else{let n=this.points[t[e+Q]];c=n.properties;let[r,i]=n.geometry.coordinates;l=Wt(r),u=Gt(i)}let d={type:1,geometry:[[Math.round(this.options.extent*(l*i-n)),Math.round(this.options.extent*(u*i-r))]],tags:c},f;f=s||this.options.generateId?t[e+Q]:this.points[t[e+Q]].id,f!==void 0&&(d.id=f),a.features.push(d)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){let{radius:n,extent:r,reduce:i,minPoints:a}=this.options,o=n/(r*2**t),s=e.data,c=[],l=this.stride;for(let n=0;nt&&(p+=s[n+$])}if(p>f&&p>=a){let e=r*f,a=u*f,o,m=-1,h=((n/l|0)<<5)+(t+1)+this.points.length;for(let r of d){let c=r*l;if(s[c+Z]<=t)continue;s[c+Z]=t;let u=s[c+$];e+=s[c]*u,a+=s[c+1]*u,s[c+zt]=h,i&&(o||(o=this._map(s,n,!0),m=this.clusterProps.length,this.clusterProps.push(o)),i(o,this._map(s,c)))}s[n+zt]=h,c.push(e/p,a/p,1/0,h,-1,p),i&&c.push(m)}else{for(let e=0;e1)for(let e of d){let n=e*l;if(!(s[n+Z]<=t)){s[n+Z]=t;for(let e=0;e>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,n){if(e[t+$]>1){let r=this.clusterProps[e[t+Bt]];return n?Object.assign({},r):r}let r=this.points[e[t+Q]].properties,i=this.options.map(r);return n&&i===r?Object.assign({},i):i}};function Ht(e,t,n){return{type:`Feature`,id:e[t+Q],properties:Ut(e,t,n),geometry:{type:`Point`,coordinates:[Kt(e[t]),qt(e[t+1])]}}}function Ut(e,t,n){let r=e[t+$],i=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?`${Math.round(r/100)/10}k`:r,a=e[t+Bt],o=a===-1?{}:Object.assign({},n[a]);return Object.assign(o,{cluster:!0,cluster_id:e[t+Q],point_count:r,point_count_abbreviated:i})}function Wt(e){return e/360+.5}function Gt(e){let t=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n<0?0:n>1?1:n}function Kt(e){return(e-.5)*360}function qt(e){let t=(180-e*360)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}var Jt={class:`map-container`},Yt={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`},Xt={key:0,class:`flex items-center gap-2 text-content-secondary dark:text-content-muted`},Zt={key:1,class:`text-center text-content-primary dark:text-content-primary`},Qt={class:`hidden sm:inline`},$t={key:3,class:`map-legend`},en={class:`legend-footer`},tn={key:4,class:`map-attribution`},nn=F(f({__name:`NetworkMap`,props:{adverts:{},baseLatitude:{default:null},baseLongitude:{default:null},statsLoading:{type:Boolean,default:!1},showLegend:{type:Boolean,default:!0}},emits:[`update:showLegend`],setup(e,{expose:t,emit:s}){typeof window<`u`&&!window.chrome&&(window.chrome={runtime:{}});let c=e,u=s,f=()=>{u(`update:showLegend`,!c.showLegend)},p=l(),m=null,v=l(new Map),b=null,x=l(new Map),w=l([]),T=l(!0),E=l(60),D=l(14),O=l(document.documentElement.classList.contains(`dark`)),k=new MutationObserver(()=>{let e=document.documentElement.classList.contains(`dark`);e!==O.value&&(O.value=e,m&&N())}),A=y(()=>c.baseLatitude!==null&&c.baseLongitude!==null&&typeof c.baseLatitude==`number`&&typeof c.baseLongitude==`number`&&c.baseLatitude!==0&&c.baseLongitude!==0&&Math.abs(c.baseLatitude)<=90&&Math.abs(c.baseLongitude)<=180),j=(e,t,n,r)=>{let i=(n-e)*Math.PI/180,a=(r-t)*Math.PI/180,o=Math.sin(i/2)*Math.sin(i/2)+Math.cos(e*Math.PI/180)*Math.cos(n*Math.PI/180)*Math.sin(a/2)*Math.sin(a/2);return 6371*(2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o)))},M=()=>{m&&=(w.value.forEach(e=>{m&&e.remove()}),w.value.length=0,m.remove(),null),v.value.clear(),x.value.clear(),b=null},N=async()=>{let e=m?.getZoom()||11,t=m?.getCenter()||(A.value?[c.baseLatitude,c.baseLongitude]:[0,0]);M(),await o(),await L(),m&&m.setView(t,e)},P=e=>{let t=new Map;return e.filter(e=>e.latitude!==null&&e.longitude!==null).map(e=>{let n=e.latitude,r=e.longitude,i=`${n.toFixed(6)}_${r.toFixed(6)}`,a=t.get(i)||0;if(t.set(i,a+1),a>0){let e=.001,t=a*60*(Math.PI/180);n+=Math.sin(t)*e*(a*.5),r+=Math.cos(t)*e*(a*.5)}return{type:`Feature`,properties:{advert:{...e,jittered_latitude:n,jittered_longitude:r}},geometry:{type:`Point`,coordinates:[r,n]}}})},F=e=>{b=new Vt({radius:E.value,maxZoom:D.value,minPoints:2}),b.load(e)},L=async()=>{if(!p.value||!A.value){console.warn(`Cannot initialize map: missing container or coordinates`);return}M(),await o();let e=c.baseLatitude,t=c.baseLongitude;m=X.default.map(p.value,{center:[e,t],zoom:11,zoomControl:!0,attributionControl:!1,preferCanvas:!1});try{let e=O.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`,t=O.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`,n=X.default.tileLayer(e,{maxZoom:19,attribution:`© OpenStreetMap contributors © CARTO`,errorTileUrl:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==`}),r=X.default.tileLayer(t,{maxZoom:19,attribution:``,errorTileUrl:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==`});n.addTo(m),r.addTo(m)}catch(e){console.warn(`Error loading tiles:`,e)}try{let n=(e,t=!1)=>{let n=t?16:12;return X.default.divIcon({className:`custom-div-icon`,html:`
`,iconSize:[n+4,n+4],iconAnchor:[(n+4)/2,(n+4)/2]})},r=e=>{let t=e<10?30:e<100?40:50;return X.default.divIcon({className:`custom-cluster-icon`,html:` +
+ ${e} +
+ `,iconSize:[t,t],iconAnchor:[t/2,t/2]})},i=n(`#ef4444`,!0);X.default.marker([e,t],{icon:i}).addTo(m).bindPopup(` +
+ Base Station
+ Base Station
+ ${e.toFixed(6)}, ${t.toFixed(6)} +
+ `);let a={Unknown:`#9CA3AF`,"Chat Node":`#60A5FA`,Repeater:`#A5E5B6`,"Room Server":`#EBA0FC`,"Hybrid Node":`#FFC246`},o=(e,t,n,r,i=0)=>{if(!m||e.zero_hop!==!0)return;let a=e.jittered_latitude||e.latitude,o=e.jittered_longitude||e.longitude;if(a===null||o===null)return;let s=e.route_type||0,c=r,l=3,u=.7,d;s===2?(c=`#A5E5B6`,l=4,u=.9):s===1?(c=`#FFC246`,d=`10, 5`,u=.8):s===3?(c=`#059669`,l=5,u=.95):s===0?(c=`#ea580c`,d=`12, 6`,u=.8):(c=`#9CA3AF`,d=`2, 5`,u=.6);let f=[t,n],p=[a,o],h=X.default.polyline([f,p],{color:c,weight:l,opacity:0,dashArray:d,className:`connection-line`}).addTo(m),g=X.default.polyline([f,f],{color:c,weight:l,opacity:0,dashArray:d,className:`connection-line animated-line`}).addTo(m);setTimeout(()=>{let i=0;g.setStyle({opacity:u+.2});let s=()=>{i++;let c=i/30,d=f[0]+(p[0]-f[0])*c,_=f[1]+(p[1]-f[1])*c;g.setLatLngs([f,[d,_]]),i<30?setTimeout(s,30):setTimeout(()=>{m&&g&&g.remove(),h.setStyle({opacity:u}),h.on(`mouseover`,()=>{h.setStyle({weight:l+2,opacity:Math.min(u+.3,1)})}),h.on(`mouseout`,()=>{h.setStyle({weight:l,opacity:u})});let i=j(t,n,a,o);h.bindPopup(` +
+ Connection to ${e.node_name||`Unknown Node`}
+ Distance: ${i.toFixed(2)} km
+ Route: ${V(e.route_type)}
+ Signal: ${R(e.rssi)} / ${H(e.snr)} +
+ `),w.value.push(h)},200)};s()},i)},s=()=>{if(!m||!b)return;let i=m.getBounds(),s=Math.floor(m.getZoom());x.value.forEach(e=>{m&&e.remove()}),x.value.clear(),w.value.forEach(e=>{m&&e.remove()}),w.value.length=0,b.getClusters([i.getWest(),i.getSouth(),i.getEast(),i.getNorth()],s).forEach(i=>{let[s,c]=i.geometry.coordinates,l=i.properties;if(l.cluster){let n=X.default.marker([c,s],{icon:r(l.point_count||0)}).addTo(m);n.on(`click`,()=>{if(m&&b){let e=b.getClusterExpansionZoom(l.cluster_id);m.setView([c,s],e)}});let i=b.getLeaves(l.cluster_id,1/0).map(e=>`
+ • ${e.properties.advert.node_name||`Unknown Node`} (${e.properties.advert.contact_type}) +
`).join(``);n.bindPopup(` +
+ Cluster: ${l.point_count} nodes
+
+ ${i} +
+
+ Click to zoom in and separate nodes +
+
+ `),x.value.set(`cluster-${l.cluster_id}`,n);let u=j(e,t,c,s),d=Math.min(Math.floor(u*5),200);o({node_name:`Cluster of ${l.point_count} nodes`,contact_type:`Cluster`,route_type:2,rssi:null,snr:null,jittered_latitude:c,jittered_longitude:s,latitude:c,longitude:s},e,t,`#AAE8E8`,d)}else{let r=l.advert,i=a[r.contact_type]||a.Unknown,u=n(i),d=c,f=s,p=j(e,t,d,f),h=X.default.marker([d,f],{icon:u}).addTo(m).bindPopup(` +
+ ${r.node_name||`Unknown Node`}
+ Type: ${r.contact_type}
+ Distance: ${p.toFixed(2)} km
+ Signal: ${R(r.rssi)} / ${H(r.snr)}
+ Route: ${V(r.route_type)}
+ Last Seen: ${B(r.last_seen)} + ${r.jittered_latitude?`
Position adjusted to separate overlapping nodes`:``} +
+ `);v.value.set(r.pubkey,h),x.value.set(`node-${r.pubkey}`,h);let g=Math.min(Math.floor(p*5),200);o({...r,jittered_latitude:d,jittered_longitude:f},e,t,i,g)}})},l=(e,t)=>{let r=0;P(c.adverts).forEach(i=>{let s=i.properties.advert;if(s.latitude!==null&&s.longitude!==null){let i=a[s.contact_type]||a.Unknown,c=n(i),l=s.jittered_latitude||s.latitude,u=s.jittered_longitude||s.longitude,d=X.default.marker([l,u],{icon:c}).addTo(m).bindPopup(` +
+ ${s.node_name||`Unknown Node`}
+ Type: ${s.contact_type}
+ Distance: ${j(e,t,l,u).toFixed(2)} km
+ Signal: ${R(s.rssi)} / ${H(s.snr)}
+ Route: ${V(s.route_type)}
+ Last Seen: ${B(s.last_seen)} + ${s.jittered_latitude?`
Position adjusted to separate overlapping nodes`:``} +
+ `);v.value.set(s.pubkey,d);let f=d.getElement();f&&(f.style.opacity=`0`,f.style.transition=`opacity 0.5s ease-out`),o(s,e,t,i,r),setTimeout(()=>{f&&(f.style.opacity=`1`)},r+1e3),r+=100}})};if(T.value&&c.adverts.length>0)try{F(P(c.adverts));let n=Math.min(14,m.getZoom());m.setZoom(n),setTimeout(()=>{try{s()}catch(n){console.warn(`Error updating clusters:`,n),l(e,t)}},100),m.on(`moveend`,()=>{try{s()}catch(e){console.warn(`Error updating clusters on move:`,e)}}),m.on(`zoomend`,()=>{try{s()}catch(e){console.warn(`Error updating clusters on zoom:`,e)}})}catch(n){console.warn(`Error initializing clustering:`,n),l(e,t)}else l(e,t);setTimeout(()=>{m&&m.invalidateSize()},1e3)}catch(e){console.error(`Error initializing map:`,e)}};return t({highlightNode:e=>{let t=v.value.get(e);if(t){let e=t.getElement();if(e){let t=e.querySelector(`div`);t&&t.classList.add(`marker-highlight`)}}},unhighlightNode:e=>{let t=v.value.get(e);if(t){let e=t.getElement();if(e){let t=e.querySelector(`div`);t&&t.classList.remove(`marker-highlight`)}}},initializeOpenStreetMap:L}),a(()=>c.adverts,()=>{m&&A.value&&setTimeout(()=>{L()},100)},{immediate:!1}),a(A,e=>{e&&c.adverts.length>0&&!m&&o(()=>L())}),i(()=>{k.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),A.value&&c.adverts.length>0&&setTimeout(()=>{L()},300)}),r(()=>{k.disconnect(),M()}),(t,r)=>(h(),C(`div`,Jt,[A.value?(h(),C(`div`,{key:1,ref_key:`mapContainer`,ref:p,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)):(h(),C(`div`,Yt,[c.statsLoading?(h(),C(`div`,Xt,[_(I,{size:`xs`}),r[0]||=S(`p`,{class:`text-xs sm:text-sm`},`Fetching base station location…`,-1)])):(h(),C(`div`,Zt,[...r[1]||=[S(`svg`,{class:`w-8 h-8 mx-auto mb-2 text-content-muted dark:text-content-muted`,fill:`currentColor`,viewBox:`0 0 20 20`},[S(`path`,{d:`M5.05 4.05a7 7 0 119.9 9.9L10 18.9l-4.95-4.95a7 7 0 010-9.9zM10 11a2 2 0 100-4 2 2 0 000 4z`})],-1),S(`p`,{class:`text-sm text-content-primary dark:text-content-primary`},` No valid coordinates available `,-1),S(`p`,{class:`text-xs text-content-secondary dark:text-content-muted`},` Configure base station location to view map `,-1)]]))])),A.value&&e.adverts.length>0?(h(),C(`button`,{key:2,onClick:f,class:`absolute bottom-3 right-3 z-[200] 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`},[r[2]||=S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`span`,Qt,n(e.showLegend?`Hide`:`Show`),1)])):g(``,!0),A.value&&e.adverts.length>0&&e.showLegend?(h(),C(`div`,$t,[r[3]||=d(`
Node Types
Base Station
Chat Node
Repeater
Room Server
Hybrid Node
Route Types
Direct
Transport Direct
Flood
Transport Flood
`,2),S(`div`,en,n(e.adverts.length)+` node`+n(e.adverts.length===1?``:`s`)+` visible `,1)])):g(``,!0),A.value?(h(),C(`div`,tn,` © OpenStreetMap contributors © CARTO `)):g(``,!0)]))}}),[[`__scopeId`,`data-v-47bae275`]]),rn={class:`relative`,"data-menu-container":``},an=f({__name:`NeighborMenu`,props:{neighbor:{},canPing:{type:Boolean}},emits:[`ping`,`delete`,`show-details`],setup(e,{emit:t}){let n=window.__neighborMenuManager||{activeMenu:null,setActiveMenu:e=>{if(n.activeMenu&&n.activeMenu!==e)try{n.activeMenu.closeMenu()}catch(e){console.warn(`Error closing previous menu:`,e)}n.activeMenu=e}};window.__neighborMenuManager=n;let i=e,a=t,c=l(!1),d=l(),f=l(),m=l({top:0,left:0}),_=()=>{c.value=!1,document.removeEventListener(`click`,T,!0),document.removeEventListener(`keydown`,E),n.activeMenu===v&&(n.activeMenu=null)},v={closeMenu:_},y=()=>{_(),a(`ping`,i.neighbor)},b=()=>{_(),a(`show-details`,i.neighbor)},x=()=>{_(),a(`delete`,i.neighbor)},T=e=>{e.target.closest(`[data-menu-container]`)||_()},E=e=>{e.key===`Escape`&&_()},D=async()=>{if(!c.value&&d.value){n.setActiveMenu(v);let e=d.value.getBoundingClientRect(),t=window.innerWidth,r=t<1024,i=e.left+144>t-16,a=e.left;if(r&&i&&(a=e.right-144),a=Math.max(8,a),m.value={top:e.bottom+4,left:a},c.value=!0,await o(),f.value){let t=f.value.offsetHeight;e.bottom+4+t>window.innerHeight-8&&(m.value={top:e.top-t-4,left:a})}document.addEventListener(`click`,T,!0),document.addEventListener(`keydown`,E)}else _()};return r(()=>{_()}),(e,t)=>(h(),C(`div`,rn,[S(`button`,{ref_key:`buttonRef`,ref:d,onClick:D,class:w([`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":c.value}]),"data-menu-container":``},[...t[0]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),(h(),u(p,{to:`body`},[c.value?(h(),C(`div`,{key:0,ref_key:`menuRef`,ref:f,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-[450]`,style:s({top:m.value.top+`px`,left:m.value.left+`px`}),"data-menu-container":``},[S(`div`,{class:`py-2`},[S(`button`,{onClick:b,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`},[...t[1]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`span`,{class:`font-medium`},`Details`,-1)]]),S(`button`,{onClick:y,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`},[...t[2]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`span`,{class:`font-medium`},`Ping`,-1)]]),S(`button`,{onClick:x,class:`flex items-center gap-3 w-full px-4 py-3 text-sm text-accent-red hover:bg-accent-red/10 transition-colors`},[...t[3]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`span`,{class:`font-medium`},`Delete`,-1)]])])],4)):g(``,!0)]))]))}}),on={class:`glass-card/30 backdrop-blur border border-stroke-subtle dark:border-white/10 rounded-[12px] p-6 shadow-sm dark:shadow-none`},sn={class:`flex items-center justify-between mb-4`},cn={class:`flex items-center gap-3`},ln={class:`text-content-primary dark:text-content-primary text-lg font-semibold`},un={class:`bg-background-mute dark:bg-white/10 text-content-secondary dark:text-content-primary text-xs px-2 py-1 rounded-full`},dn={key:0,class:`text-content-muted dark:text-content-muted`},fn={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`},pn={class:`hidden lg:block overflow-x-auto`},mn={class:`w-full`},hn={class:`bg-background-mute dark:bg-transparent`},gn={class:`flex items-center gap-1`},_n={class:`flex items-center gap-1`},vn={class:`flex items-center gap-1`},yn={class:`flex items-center gap-1`},bn={class:`flex items-center gap-1`},xn={class:`flex items-center gap-1`},Sn={class:`flex items-center gap-1`},Cn={class:`flex items-center gap-1`},wn={class:`flex items-center gap-1`},Tn={class:`bg-surface/50 dark:bg-transparent`},En=[`onMouseenter`,`onMouseleave`,`onClick`],Dn=[`onClick`,`title`],On={key:0,class:`ml-1 text-xs`},kn={key:0,class:`flex items-center gap-3`},An={class:`text-content-secondary dark:text-content-muted`},jn={class:`flex gap-1`},Mn=[`onClick`],Nn=[`onClick`],Pn={key:1,class:`text-content-muted`},Fn={class:`flex items-center gap-2`},In={class:`flex items-end gap-0.5`},Ln={class:`flex items-center gap-2`},Rn=[`title`],zn=[`title`],Bn={class:`lg:hidden space-y-3`},Vn=[`onClick`],Hn={class:`flex items-center justify-between mb-3`},Un={class:`flex items-center gap-3`},Wn={class:`text-content-primary dark:text-content-primary font-medium text-base`},Gn={class:`flex items-center gap-2`},Kn={class:`grid grid-cols-1 gap-3`},qn={class:`grid grid-cols-2 gap-4`},Jn=[`onClick`,`title`],Yn={key:0,class:`ml-1 text-xs`},Xn={class:`flex items-center gap-2 justify-end`},Zn={class:`flex items-end gap-0.5`},Qn={class:`grid grid-cols-2 gap-4`},$n={class:`flex items-center gap-2`},er=[`title`],tr={class:`text-content-primary dark:text-content-primary text-sm block text-right`},nr={key:0,class:`border-t border-white/10 pt-3`},rr={class:`flex items-center justify-between`},ir={class:`text-content-secondary dark:text-content-muted text-sm font-mono`},ar={class:`flex gap-2`},or=[`onClick`],sr=[`onClick`],cr={class:`grid grid-cols-3 gap-4 pt-3 border-t border-white/10`},lr={class:`text-center`},ur={class:`text-content-primary dark:text-content-primary text-sm font-medium`},dr={class:`text-center`},fr={class:`text-content-primary dark:text-content-primary text-sm font-medium`},pr={class:`text-center`},mr=[`title`],hr=f({__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(e,{emit:t}){let r=l(null),{getSignalQuality:i}=K(),a=l(`advert_count`),o=l(`desc`),c=e,u=t,d=(e,t,n,r)=>{let i=(n-e)*Math.PI/180,a=(r-t)*Math.PI/180,o=Math.sin(i/2)*Math.sin(i/2)+Math.cos(e*Math.PI/180)*Math.cos(n*Math.PI/180)*Math.sin(a/2)*Math.sin(a/2);return 6371*(2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o)))},f=e=>c.baseLatitude===null||c.baseLongitude===null||e.latitude===null||e.longitude===null?`N/A`:ee(d(c.baseLatitude,c.baseLongitude,e.latitude,e.longitude)),p=async e=>{try{return await navigator.clipboard.writeText(e),!0}catch{let t=document.createElement(`textarea`);return t.value=e,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t),!0}},T=e=>{let t=Date.now()-e*1e3,n=Math.floor(t/1e3),r=Math.floor(n/60),i=Math.floor(r/60),a=Math.floor(i/24);return n<60?`${n}s ago`:r<60?`${r}m ago`:i<24?`${i}h ago`:`${a}d ago`},E=e=>{let t=Date.now()-e*1e3,n=Math.floor(t/(1e3*60*60));return n<1?{color:`text-green-600 dark:text-green-400`}:n<26?{color:`text-yellow-600 dark:text-yellow-400`}:{color:`text-red-600 dark:text-red-400`}},D=async(e,t)=>{await p(`${e.toFixed(6)}, ${t.toFixed(6)}`)},O=(e,t)=>{let n=`https://www.google.com/maps?q=${e},${t}`;window.open(n,`_blank`)},A=async e=>{await p(e),r.value=e,setTimeout(()=>{r.value=null},2e3)},j=e=>{let t=i(e);return{bars:t.bars,color:t.color}},M=[`h-1.5`,`h-2`,`h-2.5`,`h-3`,`h-3.5`],N=[`h-2`,`h-2.5`,`h-3`,`h-3.5`,`h-4`],P=()=>c.isCompactView?`py-2 px-2`:`py-4 px-3`,F=()=>{u(`toggle-view`)},I=e=>{u(`highlight-node`,e)},L=e=>{u(`unhighlight-node`,e)},V=e=>{u(`menu-ping`,e)},W=e=>{u(`show-details`,e)},G=e=>{u(`menu-delete`,e)},q=e=>{a.value===e?o.value=o.value===`asc`?`desc`:`asc`:(a.value=e,o.value=typeof c.adverts[0]?.[e]==`number`?`desc`:`asc`)},J=y(()=>a.value?[...c.adverts].sort((e,t)=>{let n=e[a.value],r=t[a.value];if(n==null)return 1;if(r==null)return-1;let i=0;return typeof n==`string`&&typeof r==`string`?i=n.localeCompare(r):typeof n==`number`&&typeof r==`number`?i=n-r:typeof n==`boolean`&&typeof r==`boolean`&&(i=n===r?0:n?1:-1),o.value===`asc`?i:-i}):c.adverts);return(t,i)=>(h(),C(`div`,on,[S(`div`,sn,[S(`div`,cn,[S(`div`,{class:`w-3 h-3 rounded-full border border-white/20`,style:s({backgroundColor:e.color})},null,4),S(`h3`,ln,n(e.contactType),1),S(`span`,un,[b(n(e.adverts.length)+` `,1),e.originalCount>0&&e.adverts.lengthq(`node_name`),class:w(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${P().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[S(`div`,gn,[i[13]||=b(` Node Name `,-1),a.value===`node_name`?(h(),C(`svg`,{key:0,class:w([`w-3 h-3`,o.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[12]||=[S(`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)):g(``,!0)])],2),S(`th`,{onClick:i[1]||=e=>q(`pubkey`),class:w(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${P().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[S(`div`,_n,[i[15]||=b(` Public Key `,-1),a.value===`pubkey`?(h(),C(`svg`,{key:0,class:w([`w-3 h-3`,o.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[14]||=[S(`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)):g(``,!0)])],2),S(`th`,{class:w(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${P().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5`)},` Location `,2),S(`th`,{class:w(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${P().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5`)},` Distance `,2),S(`th`,{onClick:i[2]||=e=>q(`route_type`),class:w(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${P().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[S(`div`,vn,[i[17]||=b(` Route Type `,-1),a.value===`route_type`?(h(),C(`svg`,{key:0,class:w([`w-3 h-3`,o.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[16]||=[S(`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)):g(``,!0)])],2),S(`th`,{onClick:i[3]||=e=>q(`zero_hop`),class:w(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${P().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[S(`div`,yn,[i[19]||=b(` Zero Hop `,-1),a.value===`zero_hop`?(h(),C(`svg`,{key:0,class:w([`w-3 h-3`,o.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[18]||=[S(`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)):g(``,!0)])],2),S(`th`,{onClick:i[4]||=e=>q(`rssi`),class:w(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${P().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[S(`div`,bn,[i[21]||=b(` RSSI `,-1),a.value===`rssi`?(h(),C(`svg`,{key:0,class:w([`w-3 h-3`,o.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[20]||=[S(`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)):g(``,!0)])],2),S(`th`,{onClick:i[5]||=e=>q(`snr`),class:w(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${P().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[S(`div`,xn,[i[23]||=b(` SNR `,-1),a.value===`snr`?(h(),C(`svg`,{key:0,class:w([`w-3 h-3`,o.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[22]||=[S(`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)):g(``,!0)])],2),S(`th`,{onClick:i[6]||=e=>q(`last_seen`),class:w(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${P().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[S(`div`,Sn,[i[25]||=b(` Last Seen `,-1),a.value===`last_seen`?(h(),C(`svg`,{key:0,class:w([`w-3 h-3`,o.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[24]||=[S(`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)):g(``,!0)])],2),S(`th`,{onClick:i[7]||=e=>q(`first_seen`),class:w(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${P().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[S(`div`,Cn,[i[27]||=b(` First Seen `,-1),a.value===`first_seen`?(h(),C(`svg`,{key:0,class:w([`w-3 h-3`,o.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[26]||=[S(`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)):g(``,!0)])],2),S(`th`,{onClick:i[8]||=e=>q(`advert_count`),class:w(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${P().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[S(`div`,wn,[i[29]||=b(` Advert Count `,-1),a.value===`advert_count`?(h(),C(`svg`,{key:0,class:w([`w-3 h-3`,o.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[28]||=[S(`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)):g(``,!0)])],2)])]),S(`tbody`,Tn,[(h(!0),C(x,null,m(J.value,e=>(h(),C(`tr`,{key:e.id,class:`hover:bg-background-mute/50 dark:hover:bg-white/5 transition-colors cursor-pointer`,onMouseenter:t=>I(e.pubkey),onMouseleave:t=>L(e.pubkey),onClick:t=>W(e)},[S(`td`,{class:w(P()),onClick:i[9]||=k(()=>{},[`stop`])},[_(an,{neighbor:e,onPing:V,onShowDetails:W,onDelete:G},null,8,[`neighbor`])],2),S(`td`,{class:w(`${P()} text-content-primary dark:text-content-primary text-sm`)},n(e.node_name||`Unknown`),3),S(`td`,{class:w(`${P()} text-content-primary dark:text-content-primary text-sm font-mono`)},[S(`button`,{onClick:k(t=>A(e.pubkey),[`stop`]),class:w([`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===e.pubkey?`text-green-600 dark:text-green-400 decoration-green-400/60`:``]),title:r.value===e.pubkey?`Copied!`:`Click to copy full public key`},[b(n(v(z)(e.pubkey))+` `,1),r.value===e.pubkey?(h(),C(`span`,On,`✓`)):g(``,!0)],10,Dn)],2),S(`td`,{class:w(`${P()} text-content-primary dark:text-content-primary text-sm`)},[e.latitude!==null&&e.longitude!==null?(h(),C(`div`,kn,[S(`span`,An,n(e.latitude.toFixed(4))+`, `+n(e.longitude.toFixed(4)),1),S(`div`,jn,[S(`button`,{onClick:k(t=>D(e.latitude,e.longitude),[`stop`]),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`},[...i[30]||=[S(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[S(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`,stroke:`currentColor`,"stroke-width":`2`}),S(`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,Mn),S(`button`,{onClick:k(t=>O(e.latitude,e.longitude),[`stop`]),class:`text-white/60 hover:text-blue-600 dark:text-blue-400 transition-colors cursor-pointer`,title:`Open in Google Maps`},[...i[31]||=[S(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[S(`path`,{d:`M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z`,stroke:`currentColor`,"stroke-width":`2`}),S(`circle`,{cx:`12`,cy:`10`,r:`3`,stroke:`currentColor`,"stroke-width":`2`})],-1)]],8,Nn)])])):(h(),C(`span`,Pn,`Unknown`))],2),S(`td`,{class:w(`${P()} text-content-primary dark:text-content-primary text-sm`)},n(f(e)),3),S(`td`,{class:w(`${P()} text-content-primary dark:text-content-primary text-sm`)},[S(`span`,{class:w([`inline-block px-2 py-1 rounded-full text-xs border transition-colors`,v(U)(e.route_type).bgColor,v(U)(e.route_type).borderColor,v(U)(e.route_type).textColor])},n(v(U)(e.route_type).text),3)],2),S(`td`,{class:w(`${P()} text-content-primary dark:text-content-primary text-sm`)},[S(`span`,{class:w([`inline-block px-2 py-1 rounded-full text-xs border transition-colors`,e.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`])},n(e.zero_hop?`Zero Hop`:`Multi-Hop`),3)],2),S(`td`,{class:w(`${P()} text-content-primary dark:text-content-primary text-sm`)},[S(`div`,Fn,[S(`div`,In,[(h(),C(x,null,m(5,t=>S(`div`,{key:t,class:w([`w-1 transition-colors`,M[t-1],t<=j(e.rssi).bars?j(e.rssi).color:`text-gray-600`])},[...i[32]||=[S(`div`,{class:`w-full h-full bg-current rounded-sm`},null,-1)]],2)),64))]),S(`span`,{class:w(j(e.rssi).color)},n(v(R)(e.rssi)),3)])],2),S(`td`,{class:w(`${P()} text-content-primary dark:text-content-primary text-sm`)},n(v(H)(e.snr)),3),S(`td`,{class:w(`${P()} text-content-primary dark:text-content-primary text-sm`)},[S(`div`,Ln,[S(`div`,{class:w([`w-2 h-2 rounded-full`,E(e.last_seen).color===`text-green-600 dark:text-green-400`?`bg-green-400`:``,E(e.last_seen).color===`text-yellow-600 dark:text-yellow-400`?`bg-yellow-400`:``,E(e.last_seen).color===`text-red-600 dark:text-red-400`?`bg-red-400`:``])},null,2),S(`span`,{class:w([E(e.last_seen).color,`cursor-help`]),title:v(B)(e.last_seen)},n(T(e.last_seen)),11,Rn)])],2),S(`td`,{class:w(`${P()} text-content-primary dark:text-content-primary text-sm`)},[S(`span`,{title:v(B)(e.first_seen),class:`cursor-help`},n(T(e.first_seen)),9,zn)],2),S(`td`,{class:w(`${P()} text-content-primary dark:text-content-primary text-sm text-center`)},n(e.advert_count),3)],40,En))),128))])])]),S(`div`,Bn,[(h(!0),C(x,null,m(J.value,e=>(h(),C(`div`,{key:e.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:t=>I(e.pubkey)},[S(`div`,Hn,[S(`div`,Un,[S(`h4`,Wn,n(e.node_name||`Unknown Node`),1),S(`div`,Gn,[S(`span`,{class:w([`inline-block px-2 py-1 rounded-full text-xs border`,v(U)(e.route_type).bgColor,v(U)(e.route_type).borderColor,v(U)(e.route_type).textColor])},n(v(U)(e.route_type).text),3),S(`span`,{class:w([`inline-block px-2 py-1 rounded-full text-xs border`,e.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`])},n(e.zero_hop?`Zero Hop`:`Multi-Hop`),3)])]),_(an,{neighbor:e,onPing:V,onShowDetails:W,onDelete:G},null,8,[`neighbor`])]),S(`div`,Kn,[S(`div`,qn,[S(`div`,null,[i[33]||=S(`div`,{class:`text-content-muted text-xs mb-1`},`Public Key`,-1),S(`button`,{onClick:t=>A(e.pubkey),class:w([`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===e.pubkey?`text-green-600 dark:text-green-400 decoration-green-400/60`:``]),title:r.value===e.pubkey?`Copied!`:`Click to copy full public key`},[b(n(v(z)(e.pubkey))+` `,1),r.value===e.pubkey?(h(),C(`span`,Yn,`✓`)):g(``,!0)],10,Jn)]),S(`div`,null,[i[35]||=S(`div`,{class:`text-content-muted text-xs mb-1`},`Signal`,-1),S(`div`,Xn,[S(`div`,Zn,[(h(),C(x,null,m(5,t=>S(`div`,{key:t,class:w([`w-1.5 transition-colors`,N[t-1],t<=j(e.rssi).bars?j(e.rssi).color:`text-gray-600`])},[...i[34]||=[S(`div`,{class:`w-full h-full bg-current rounded-sm`},null,-1)]],2)),64))]),S(`span`,{class:w(`${j(e.rssi).color} text-sm font-medium`)},n(v(R)(e.rssi)),3)])])]),S(`div`,Qn,[S(`div`,null,[i[36]||=S(`div`,{class:`text-content-muted text-xs mb-1`},`Last Seen`,-1),S(`div`,$n,[S(`div`,{class:w([`w-2 h-2 rounded-full`,E(e.last_seen).color===`text-green-600 dark:text-green-400`?`bg-green-400`:``,E(e.last_seen).color===`text-yellow-600 dark:text-yellow-400`?`bg-yellow-400`:``,E(e.last_seen).color===`text-red-600 dark:text-red-400`?`bg-red-400`:``])},null,2),S(`span`,{class:w(`${E(e.last_seen).color} text-sm`),title:v(B)(e.last_seen)},n(T(e.last_seen)),11,er)])]),S(`div`,null,[i[37]||=S(`div`,{class:`text-content-muted text-xs mb-1`},`Distance`,-1),S(`span`,tr,n(f(e)),1)])]),e.latitude!==null&&e.longitude!==null?(h(),C(`div`,nr,[i[40]||=S(`div`,{class:`text-content-muted text-xs mb-1`},`Location`,-1),S(`div`,rr,[S(`span`,ir,n(e.latitude.toFixed(4))+`, `+n(e.longitude.toFixed(4)),1),S(`div`,ar,[S(`button`,{onClick:t=>D(e.latitude,e.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`},[...i[38]||=[S(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[S(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`,stroke:`currentColor`,"stroke-width":`2`}),S(`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,or),S(`button`,{onClick:t=>O(e.latitude,e.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`},[...i[39]||=[S(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[S(`path`,{d:`M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z`,stroke:`currentColor`,"stroke-width":`2`}),S(`circle`,{cx:`12`,cy:`10`,r:`3`,stroke:`currentColor`,"stroke-width":`2`})],-1)]],8,sr)])])])):g(``,!0),S(`div`,cr,[S(`div`,lr,[i[41]||=S(`div`,{class:`text-content-muted text-xs mb-1`},`SNR`,-1),S(`span`,ur,n(v(H)(e.snr)),1)]),S(`div`,dr,[i[42]||=S(`div`,{class:`text-content-muted text-xs mb-1`},`Adverts`,-1),S(`span`,fr,n(e.advert_count),1)]),S(`div`,pr,[i[43]||=S(`div`,{class:`text-content-muted text-xs mb-1`},`First Seen`,-1),S(`span`,{class:`text-content-primary dark:text-content-primary text-sm`,title:v(B)(e.first_seen)},n(T(e.first_seen)),9,mr)])])])],8,Vn))),128))])]))}}),gr={class:`space-y-6`},_r={key:0,class:`flex items-center justify-center py-12`},vr={class:`text-center`},yr={key:1,class:`bg-red-50 dark:bg-accent-red/10 border border-red-300 dark:border-accent-red/20 rounded-[15px] p-6`},br={class:`flex items-center gap-3`},xr={class:`text-red-500 dark:text-accent-red/80 text-sm`},Sr={key:0,class:``},Cr={class:`flex items-center justify-between`},wr={class:`flex items-center gap-3`},Tr={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`},Er={class:`flex items-center gap-2`},Dr=[`value`,`disabled`],Or=[`value`],kr={class:`flex items-center gap-2`},Ar={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`},jr={class:`bg-background dark:bg-background/30 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4 mt-4 space-y-4`},Mr={class:`grid grid-cols-1 md:grid-cols-3 gap-4`},Nr={key:1,class:`text-center py-12`},Pr={key:2,class:`text-center py-12`},Fr=f({name:`NeighborsView`,__name:`Neighbors`,setup(e){let t=j(),r=N(),o=P(),s=M,u={0:`#6b7280`,1:`#60a5fa`,2:`#34d399`,3:`#a855f7`,4:`#f59e0b`},f=y(()=>r.advertsByType),p=y(()=>r.isLoading),v=l(null),O=l(r.currentHours),k=[{label:`2 Days`,value:48},{label:`7 Days`,value:168},{label:`14 Days`,value:336},{label:`30 Days`,value:720}],F=async e=>{O.value=e,await r.fetchAll(e)},L=l(G(`neighbors_compactView`,!1)),R=l(G(`neighbors_showMapLegend`,typeof window<`u`?window.innerWidth>=1024:!0)),z=l(G(`neighbors_showAllMapContacts`,!1)),B=l(G(`neighbors_showFilters`,!1)),V=l(G(`neighbors_filters`,{zeroHop:`true`,routeType:`all`,searchText:``}));a(L,e=>W(`neighbors_compactView`,e)),a(R,e=>W(`neighbors_showMapLegend`,e)),a(z,e=>W(`neighbors_showAllMapContacts`,e)),a(B,e=>W(`neighbors_showFilters`,e)),a(V,e=>W(`neighbors_filters`,e),{deep:!0});let ee=l(!1),H=l(!1),U=l(!1),K=l(null),q=l(null),J=l(null),te=l(null),ne=l(!1),re=l(null),ie=y(()=>{if(!te.value)return null;let e=te.value;return{id:e.id,pubkey:e.pubkey,node_name:e.node_name,contact_type:e.contact_type,latitude:e.latitude,longitude:e.longitude,rssi:e.rssi,snr:e.snr,route_type:e.route_type,last_seen:e.last_seen,first_seen:e.first_seen,advert_count:e.advert_count,timestamp:e.timestamp,is_repeater:e.is_repeater,is_new_neighbor:e.is_new_neighbor,zero_hop:e.zero_hop}}),ae=y(()=>t.stats?.config?.repeater?.latitude),oe=y(()=>t.stats?.config?.repeater?.longitude),ce=y(()=>t.stats===null&&t.isLoading),le=e=>e.filter(e=>{if(V.value.zeroHop!==`all`){let t=e.zero_hop;if(V.value.zeroHop===`true`&&!t||V.value.zeroHop===`false`&&t)return!1}if(V.value.routeType!==`all`){let t=e.route_type;if(V.value.routeType===`direct`&&t!==2||V.value.routeType===`transport_direct`&&t!==3||V.value.routeType===`flood`&&t!==1||V.value.routeType===`transport_flood`&&t!==0)return!1}if(V.value.searchText){let t=V.value.searchText.toLowerCase(),n=e.node_name?.toLowerCase()||``,r=e.pubkey.toLowerCase();if(!n.includes(t)&&!r.includes(t))return!1}return!0}),ue=()=>{V.value={zeroHop:`all`,routeType:`all`,searchText:``}},Y=y(()=>V.value.zeroHop!==`all`||V.value.routeType!==`all`||V.value.searchText!==``),de=y(()=>{let e={};for(let[t,n]of Object.entries(f.value))e[t]=le(n);return e}),fe=y(()=>Object.entries(s).filter(([e])=>de.value[e]?.length>0).sort(([e],[t])=>parseInt(e)-parseInt(t))),pe=y(()=>Object.values(f.value).flat().filter(e=>{let t=e.latitude,n=e.longitude;return t!=null&&t!==0&&n!=null&&n!==0&&typeof t==`number`&&typeof n==`number`&&!isNaN(t)&&!isNaN(n)&&(z.value||e.zero_hop===!0)})),me=()=>r.fetchAll(O.value),he=l(),ge=e=>{he.value?.highlightNode(e)},_e=e=>{he.value?.unhighlightNode(e)},ve=async e=>{let n=e;K.value=null,q.value=null,U.value=!0,J.value=n.node_name||`Unknown Node`,H.value=!0;try{let e=t.stats?.config?.mesh?.path_hash_mode??0,r=(e===2?3:e===1?2:1)*2,i=`0x${parseInt(n.pubkey.substring(0,r),16).toString(16).padStart(r,`0`)}`,a=await A.pingNeighbor(i,10);a.success&&a.data?K.value=a.data:(q.value=a.error||`Unknown error occurred`,console.error(`Failed to ping neighbor:`,a.error))}catch(e){console.error(`Error pinging neighbor:`,e),q.value=e instanceof Error?e.message:`Unknown error occurred`}finally{U.value=!1}},ye=()=>{H.value=!1,K.value=null,q.value=null,J.value=null},be=e=>{te.value=e,ee.value=!0},xe=e=>{re.value=e,ne.value=!0},Se=()=>{ne.value=!1,re.value=null},Ce=()=>{ee.value=!1,te.value=null},we=async e=>{try{await A.deleteAdvert(e),await r.fetchAll(O.value),Ce()}catch(e){console.error(`Error deleting neighbor:`,e)}};return i(()=>{o.ensure(`neighbors`)}),(e,t)=>(h(),C(`div`,gr,[p.value?(h(),C(`div`,_r,[S(`div`,vr,[_(I,{size:`lg`,class:`mx-auto mb-4`}),t[9]||=S(`p`,{class:`text-content-secondary dark:text-content-muted`},`Loading neighbor data...`,-1)])])):v.value?(h(),C(`div`,yr,[S(`div`,br,[t[11]||=S(`svg`,{class:`w-5 h-5 text-red-600 dark:text-accent-red`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`div`,null,[t[10]||=S(`h3`,{class:`text-red-600 dark:text-accent-red font-medium`},`Error Loading Neighbors`,-1),S(`p`,xr,n(v.value),1)])])])):(h(),C(x,{key:2},[_(nn,{ref_key:`networkMapRef`,ref:he,adverts:pe.value,"base-latitude":ae.value,"base-longitude":oe.value,"stats-loading":ce.value,"show-legend":R.value,"onUpdate:showLegend":t[0]||=e=>R.value=e},null,8,[`adverts`,`base-latitude`,`base-longitude`,`stats-loading`,`show-legend`]),Object.keys(f.value).length>0?(h(),C(`div`,Sr,[S(`div`,Cr,[t[16]||=S(`span`,{class:`text-content-primary dark:text-content-primary text-lg font-semibold`},null,-1),S(`div`,wr,[S(`div`,Tr,[S(`button`,{onClick:t[1]||=e=>L.value=!1,class:w([`p-2 rounded-md transition-colors`,L.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`},[...t[12]||=[S(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[S(`rect`,{x:`3`,y:`3`,width:`18`,height:`6`,rx:`2`,stroke:`currentColor`,"stroke-width":`2`}),S(`rect`,{x:`3`,y:`12`,width:`18`,height:`6`,rx:`2`,stroke:`currentColor`,"stroke-width":`2`})],-1)]],2),S(`button`,{onClick:t[2]||=e=>L.value=!0,class:w([`p-2 rounded-md transition-colors`,L.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`},[...t[13]||=[S(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[S(`rect`,{x:`3`,y:`3`,width:`18`,height:`4`,rx:`2`,stroke:`currentColor`,"stroke-width":`2`}),S(`rect`,{x:`3`,y:`10`,width:`18`,height:`4`,rx:`2`,stroke:`currentColor`,"stroke-width":`2`}),S(`rect`,{x:`3`,y:`17`,width:`18`,height:`4`,rx:`2`,stroke:`currentColor`,"stroke-width":`2`})],-1)]],2)]),S(`div`,Er,[S(`select`,{value:O.value,onChange:t[3]||=e=>F(+e.target.value),disabled:p.value,class:`text-xs px-2 py-1.5 rounded-lg bg-background-mute dark:bg-white/10 text-content-secondary dark:text-content-primary border border-stroke-subtle dark:border-stroke/20 focus:outline-none focus:border-primary/50 disabled:opacity-50`},[(h(),C(x,null,m(k,e=>S(`option`,{key:e.value,value:e.value},n(e.label),9,Or)),64))],40,Dr)]),S(`div`,kr,[S(`button`,{onClick:t[4]||=e=>z.value=!z.value,class:w([`px-3 py-1.5 text-xs rounded-lg transition-colors border`,z.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`])},` Map: `+n(z.value?`All Contacts`:`Zero Hop`),3),S(`button`,{onClick:t[5]||=e=>B.value=!B.value,class:w([`px-3 py-1.5 text-xs rounded-lg transition-colors border`,Y.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`])},[t[14]||=S(`svg`,{class:`w-4 h-4 inline mr-1`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),t[15]||=b(` Filters `,-1),Y.value?(h(),C(`span`,Ar,` Active `)):g(``,!0)],2),Y.value?(h(),C(`button`,{key:0,onClick:ue,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 `)):g(``,!0)])])]),c(S(`div`,jr,[S(`div`,Mr,[S(`div`,null,[t[18]||=S(`label`,{class:`block text-xs font-medium text-content-secondary dark:text-content-muted mb-1`},`Zero Hop`,-1),c(S(`select`,{"onUpdate:modelValue":t[6]||=e=>V.value.zeroHop=e,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`},[...t[17]||=[S(`option`,{value:`all`},`All Nodes`,-1),S(`option`,{value:`true`},`Zero Hop Only`,-1),S(`option`,{value:`false`},`Multi-Hop Only`,-1)]],512),[[E,V.value.zeroHop]])]),S(`div`,null,[t[20]||=S(`label`,{class:`block text-xs font-medium text-content-secondary dark:text-content-muted mb-1`},`Route Type`,-1),c(S(`select`,{"onUpdate:modelValue":t[7]||=e=>V.value.routeType=e,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`},[...t[19]||=[d(``,5)]],512),[[E,V.value.routeType]])]),S(`div`,null,[t[21]||=S(`label`,{class:`block text-xs font-medium text-content-secondary dark:text-content-muted mb-1`},`Search`,-1),c(S(`input`,{"onUpdate:modelValue":t[8]||=e=>V.value.searchText=e,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),[[D,V.value.searchText]])])])],512),[[T,B.value]])])):g(``,!0),(h(!0),C(x,null,m(fe.value,([e,t])=>(h(),C(`div`,{key:e,class:`space-y-6`},[_(hr,{"contact-type":t,"contact-type-key":e,adverts:de.value[e],"original-count":f.value[e]?.length||0,color:u[parseInt(e)],"base-latitude":ae.value,"base-longitude":oe.value,"is-compact-view":L.value,"is-first-table":!1,"show-view-toggle":!1,onHighlightNode:ge,onUnhighlightNode:_e,onMenuPing:ve,onMenuDelete:be,onShowDetails:xe},null,8,[`contact-type`,`contact-type-key`,`adverts`,`original-count`,`color`,`base-latitude`,`base-longitude`,`is-compact-view`])]))),128)),fe.value.length===0&&Object.keys(f.value).length===0?(h(),C(`div`,Nr,[t[22]||=d(`

No Neighbors Found

No mesh neighbors have been discovered in your area yet.

`,3),S(`button`,{onClick:me,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 `)])):fe.value.length===0&&Y.value?(h(),C(`div`,Pr,[t[23]||=d(`

No neighbors match your filters

Try adjusting your filter criteria to see more results.

`,3),S(`button`,{onClick:ue,class:`px-4 py-2 bg-primary/20 text-primary border border-primary/30 rounded-lg hover:bg-primary/30 transition-colors`},` Clear Filters `)])):g(``,!0)],64)),_(se,{show:ee.value,neighbor:ie.value,onClose:Ce,onDelete:we},null,8,[`show`,`neighbor`]),_(Be,{show:H.value,"node-name":J.value,result:K.value,error:q.value,loading:U.value,onClose:ye},null,8,[`show`,`node-name`,`result`,`error`,`loading`]),_(Dt,{"is-open":ne.value,neighbor:re.value,"base-latitude":ae.value,"base-longitude":oe.value,onClose:Se},null,8,[`is-open`,`neighbor`,`base-latitude`,`base-longitude`])]))}});export{Fr as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/Neighbors-n_lvMCc7.js b/repeater/web/html/assets/Neighbors-n_lvMCc7.js deleted file mode 100644 index 1d44468..0000000 --- a/repeater/web/html/assets/Neighbors-n_lvMCc7.js +++ /dev/null @@ -1,65 +0,0 @@ -import{r as e}from"./chunk-DECur_0Z.js";import{B as t,Ct as n,D as r,E as i,R as a,S as o,St as s,V as c,Y as l,c as u,f as d,g as f,i as p,j as m,k as h,l as g,m as _,nt as v,o as y,p as b,r as x,s as S,u as C,xt as w}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{t as T}from"./api-DBiYn0RS.js";import{t as E}from"./system-BfTzQTOF.js";import{n as D,r as O,t as k}from"./dataService-KNFTsxUb.js";import{t as A}from"./_plugin-vue_export-helper-TcpyXLsZ.js";import{t as j}from"./Spinner-CYvUNW0P.js";import{f as M,g as N,l as P,m as F,p as ee}from"./index-CG181k2K.js";import{t as I}from"./leaflet-src-phWEwbzW.js";/* empty css */import{a as L,i as R,l as z,o as B,r as te,s as V,u as H}from"./formatters-Cc4UJmeb.js";import{n as U,t as W}from"./preferences-6MHglq--.js";import{t as G}from"./useSignalQuality-aEjorkkD.js";var K={class:`modal-card max-w-md`},q={class:`bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4 mb-6`},J={class:`flex items-center gap-3`},ne={class:`flex-1 min-w-0`},re={class:`text-content-primary dark:text-content-primary font-medium truncate`},ie={class:`text-content-secondary dark:text-content-muted text-sm font-mono`},ae={key:0,class:`text-white/50 text-xs`},oe={key:1,class:`text-white/50 text-xs`},se=f({__name:`DeleteNeighborModal`,props:{show:{type:Boolean},neighbor:{}},emits:[`close`,`delete`],setup(e,{emit:t}){let r=e,i=t,a=()=>{r.neighbor&&(i(`delete`,r.neighbor.id),o())},o=()=>{i(`close`)};return(t,r)=>(h(),u(p,{to:`body`},[e.show&&e.neighbor?(h(),C(`div`,{key:0,onClick:r[0]||=N(e=>o(),[`self`]),class:`modal-backdrop-heavy`},[S(`div`,K,[S(`div`,{class:`flex items-center gap-3 mb-6`},[r[2]||=S(`svg`,{class:`w-6 h-6 text-accent-red`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),r[3]||=S(`div`,null,[S(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary`},` Delete Neighbor `),S(`p`,{class:`text-content-secondary dark:text-content-muted text-sm mt-1`},` Are you sure you want to delete this neighbor? `)],-1),S(`button`,{onClick:o,class:`ml-auto text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors`},[...r[1]||=[S(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),S(`div`,q,[S(`div`,J,[S(`div`,ne,[S(`div`,re,n(e.neighbor?.node_name||e.neighbor?.long_name||e.neighbor?.short_name||`Unknown`),1),S(`div`,ie,` ID: `+n(e.neighbor?.node_num_hex||e.neighbor?.node_num||e.neighbor?.id||`N/A`),1),e.neighbor?.contact_type?(h(),C(`div`,ae,n(e.neighbor.contact_type),1)):g(``,!0),e.neighbor?.hw_model?(h(),C(`div`,oe,n(e.neighbor.hw_model),1)):g(``,!0)])])]),r[4]||=S(`div`,{class:`bg-accent-red/10 border border-accent-red/30 rounded-lg p-4 mb-6`},[S(`div`,{class:`flex items-center gap-2 text-accent-red text-sm`},[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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`})]),S(`span`,null,`This action cannot be undone`)])],-1),S(`div`,{class:`flex gap-3`},[S(`button`,{onClick:o,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(`button`,{onClick:a,class:`modal-btn-danger`},` Delete `)])])])):g(``,!0)]))}}),ce={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`},le={class:`flex items-center justify-between`},ue={class:`flex items-center gap-3`},Y={key:0,class:`text-sm text-content-secondary dark:text-content-muted`},de={class:`p-6`},fe={key:0,class:`text-center py-8`},pe={key:1,class:`text-center py-8`},me={class:`text-content-secondary dark:text-content-muted text-sm`},he={key:2,class:`space-y-4`},ge={class:`bg-background-mute dark:bg-background/50 border border-stroke-subtle dark:border-stroke/10 rounded-[15px] p-4`},_e={class:`flex items-center justify-between mb-2`},ve={class:`flex items-baseline gap-2`},ye={class:`text-3xl font-bold text-content-primary dark:text-content-primary`},be={class:`grid grid-cols-2 gap-3`},xe={class:`bg-background-mute dark:bg-background/50 border border-stroke-subtle dark:border-stroke/10 rounded-[15px] p-4`},Se={class:`flex items-center gap-2 mb-2`},Ce={class:`flex gap-0.5`},we={class:`flex items-baseline gap-1`},Te={class:`text-xl font-bold text-content-primary dark:text-content-primary`},Ee={class:`bg-background-mute dark:bg-background/50 border border-stroke-subtle dark:border-stroke/10 rounded-[15px] p-4`},De={class:`flex items-baseline gap-1`},Oe={class:`text-xl font-bold text-content-primary dark:text-content-primary`},ke={key:0,class:`flex items-start gap-3 bg-amber-500/10 border border-amber-500/30 rounded-[12px] p-3`},Ae={class:`text-xs leading-relaxed`},je={class:`font-semibold text-amber-600 dark:text-amber-400 mb-0.5`},Me={class:`bg-background-mute dark:bg-background/50 border border-stroke-subtle dark:border-stroke/10 rounded-[15px] p-4`},Ne={class:`relative`},Pe={class:`flex items-center gap-2 overflow-x-auto pb-2`},Fe={key:0,class:`relative flex items-center`},Ie={key:0,class:`absolute left-1/2 -translate-x-1/2 animate-pulse`},Le={class:`text-content-muted dark:text-content-muted text-xs mt-2 flex items-center justify-between`},Re={key:0,class:`text-cyan-500 dark:text-primary animate-pulse`},ze={class:`flex items-center justify-between text-xs text-content-muted dark:text-content-muted pt-2`},Be=A(f({__name:`PingResultModal`,props:{show:{type:Boolean},nodeName:{default:null},result:{default:null},error:{default:null},loading:{type:Boolean,default:!1}},emits:[`close`],setup(e,{emit:r}){let i=e,o=r,s=E(),{getSignalQuality:c}=G(),d=l(0),f=l(!1),v=y(()=>{let e=s.stats?.config?.radio?.spreading_factor??7,t=s.stats?.config?.radio?.bandwidth??125,n=s.stats?.config?.radio?.coding_rate??5;return 2**e/t*(8+4.25*(n-4)+20)}),b=y(()=>{if(!i.result)return{color:`text-gray-400`,label:`Unknown`};let e=i.result.rtt_ms,t=v.value,n=i.result.path.length,r=2*t*n+500*n;return e{if(!i.result)return{bars:0,color:`text-gray-400`};let e=c(i.result.rssi);return{bars:e.bars,color:e.color}}),D=y(()=>{if(!i.result)return 0;if(i.result.path_hash_mode!==void 0)return i.result.path_hash_mode;let e=i.result.path.reduce((e,t)=>{let n=t.replace(/^0x/i,``);return Math.max(e,n.length)},0);return e>4?2:e>2?1:0}),O=y(()=>D.value>0),k=y(()=>({0:`1-byte`,1:`2-byte`,2:`3-byte`})[D.value]??`1-byte`);a(()=>i.result,e=>{if(e&&!f.value){f.value=!0,d.value=0;let t=e.path.length,n=1500/(t*2),r=0,i=t*2-2,a=()=>{r<=i?(d.value=r/i,r++,setTimeout(a,n)):(f.value=!1,d.value=1)};setTimeout(a,100)}},{immediate:!0});let A=y(()=>{if(!i.result||!f.value)return-1;let e=i.result.path.length;if(e<=1)return-1;let t=d.value,n=.5;if(t<=n)return t/n*(e-1);{let r=(t-n)/n;return(e-1)*(1-r)}}),M=()=>{o(`close`)};return(r,i)=>(h(),u(p,{to:`body`},[_(P,{name:`modal`},{default:t(()=>[e.show?(h(),C(`div`,{key:0,class:`fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-[300] p-4`,onClick:N(M,[`self`])},[S(`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:i[0]||=N(()=>{},[`stop`])},[S(`div`,ce,[S(`div`,le,[S(`div`,ue,[i[2]||=S(`div`,{class:`p-2 bg-cyan-400/20 dark:bg-primary/20 rounded-lg`},[S(`svg`,{class:`w-5 h-5 text-cyan-500 dark:text-primary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`div`,null,[i[1]||=S(`h2`,{class:`text-xl font-bold text-content-primary dark:text-content-primary`},` Ping Result `,-1),e.nodeName?(h(),C(`p`,Y,n(e.nodeName),1)):g(``,!0)])]),S(`button`,{onClick:M,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`},[...i[3]||=[S(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])])]),S(`div`,de,[e.loading?(h(),C(`div`,fe,[_(j,{size:`lg`,class:`mx-auto mb-4`}),i[4]||=S(`p`,{class:`text-content-secondary dark:text-content-muted`},`Sending ping...`,-1),i[5]||=S(`p`,{class:`text-content-muted dark:text-content-muted text-sm mt-1`},` Waiting for response... `,-1)])):e.error?(h(),C(`div`,pe,[i[6]||=S(`div`,{class:`p-3 bg-accent-red/10 rounded-full w-16 h-16 mx-auto mb-4 flex items-center justify-center`},[S(`svg`,{class:`w-8 h-8 text-accent-red`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),i[7]||=S(`h3`,{class:`text-accent-red font-semibold mb-2`},`Ping Failed`,-1),S(`p`,me,n(e.error),1)])):e.result?(h(),C(`div`,he,[S(`div`,ge,[S(`div`,_e,[i[8]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Round-Trip Time`,-1),S(`span`,{class:w([`text-xs font-medium px-2 py-1 rounded-full`,b.value.color,`bg-current/10`])},n(b.value.label),3)]),S(`div`,ve,[S(`span`,ye,n(e.result.rtt_ms.toFixed(2)),1),i[9]||=S(`span`,{class:`text-content-secondary dark:text-content-muted`},`ms`,-1)])]),S(`div`,be,[S(`div`,xe,[S(`div`,Se,[i[10]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`RSSI`,-1),S(`div`,Ce,[(h(),C(x,null,m(5,e=>S(`div`,{key:e,class:w([`w-1 h-3 rounded-sm`,e<=T.value.bars?T.value.color:`bg-stroke-subtle dark:bg-stroke/10`])},null,2)),64))])]),S(`div`,we,[S(`span`,Te,n(e.result.rssi),1),i[11]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs`},`dBm`,-1)])]),S(`div`,Ee,[i[13]||=S(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-2`},`SNR`,-1),S(`div`,De,[S(`span`,Oe,n(e.result.snr_db),1),i[12]||=S(`span`,{class:`text-content-secondary dark:text-content-muted text-xs`},`dB`,-1)])])]),O.value?(h(),C(`div`,ke,[i[15]||=S(`svg`,{class:`w-5 h-5 text-amber-500 flex-shrink-0 mt-0.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`div`,Ae,[S(`p`,je,n(k.value)+` path hashes active `,1),i[14]||=S(`p`,{class:`text-content-secondary dark:text-content-muted`},` This result uses multi-byte path hashes. The repeater being traced must be running firmware that supports multi-byte path hashes. Repeaters on older firmware will not respond to or correctly route these trace packets. `,-1)])])):g(``,!0),S(`div`,Me,[i[18]||=S(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-3`},` Network Path `,-1),S(`div`,Ne,[S(`div`,Pe,[(h(!0),C(x,null,m(e.result.path,(r,a)=>(h(),C(`div`,{key:a,class:`flex items-center gap-2 flex-shrink-0 relative`},[S(`div`,{class:w([`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`,f.value&&Math.floor(A.value)===a?`ring-2 ring-cyan-400/50 dark:ring-primary/50 scale-105`:``])},n(r),3),a[f.value&&A.value>=a&&A.value({Unknown:`Unknown`,"Chat Node":`Chat Node`,Repeater:`Repeater`,"Room Server":`Room Server`,"Hybrid Node":`Hybrid Node`})[e]||e,E=e=>({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`})[e]||`text-gray-600 dark:text-gray-400`,D=async()=>{if(!s.neighbor?.latitude||!s.neighbor?.longitude)return;let e=`${s.neighbor.latitude.toFixed(6)}, ${s.neighbor.longitude.toFixed(6)}`;try{await navigator.clipboard.writeText(e),o.value=`Copied!`,setTimeout(()=>{o.value=`Copy`},2e3)}catch(e){console.error(`Failed to copy coordinates:`,e),o.value=`Failed`,setTimeout(()=>{o.value=`Copy`},2e3)}},O=y(()=>{if(!s.neighbor?.latitude||!s.neighbor?.longitude||!s.baseLatitude||!s.baseLongitude)return null;let e=(s.neighbor.latitude-s.baseLatitude)*Math.PI/180,t=(s.neighbor.longitude-s.baseLongitude)*Math.PI/180,n=Math.sin(e/2)*Math.sin(e/2)+Math.cos(s.baseLatitude*Math.PI/180)*Math.cos(s.neighbor.latitude*Math.PI/180)*Math.sin(t/2)*Math.sin(t/2);return 6371*(2*Math.atan2(Math.sqrt(n),Math.sqrt(1-n)))}),k=y(()=>s.neighbor?.latitude!==null&&s.neighbor?.longitude!==null&&s.neighbor?.latitude!==0&&s.neighbor?.longitude!==0&&Math.abs(s.neighbor?.latitude??0)<=90&&Math.abs(s.neighbor?.longitude??0)<=180),A=()=>{if(!d.value||!s.neighbor||!k.value)return;f&&=(f.remove(),null);let e=document.documentElement.classList.contains(`dark`);f=X.default.map(d.value,{center:[s.neighbor.latitude,s.neighbor.longitude],zoom:13,zoomControl:!0,attributionControl:!1});let t=e?`https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png`:`https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png`;X.default.tileLayer(t,{maxZoom:19,attribution:`© OpenStreetMap © CARTO`}).addTo(f);let n=X.default.divIcon({className:`custom-marker`,html:`
${s.neighbor.node_name?.charAt(0)||`?`}
`,iconSize:[32,32],iconAnchor:[16,16]});if(X.default.marker([s.neighbor.latitude,s.neighbor.longitude],{icon:n}).addTo(f).bindPopup(`${s.neighbor.node_name||`Unknown`}
${s.neighbor.pubkey.slice(0,8)}...`),s.baseLatitude!==null&&s.baseLongitude!==null&&s.baseLatitude!==0&&s.baseLongitude!==0&&Math.abs(s.baseLatitude)<=90&&Math.abs(s.baseLongitude)<=180){let e=X.default.divIcon({className:`custom-marker`,html:`
B
`,iconSize:[32,32],iconAnchor:[16,16]});X.default.marker([s.baseLatitude,s.baseLongitude],{icon:e}).addTo(f).bindPopup(`Base Station`),X.default.polyline([[s.baseLatitude,s.baseLongitude],[s.neighbor.latitude,s.neighbor.longitude]],{color:`#3b82f6`,weight:2,opacity:.6,dashArray:`5, 10`}).addTo(f);let t=X.default.latLngBounds([s.baseLatitude,s.baseLongitude],[s.neighbor.latitude,s.neighbor.longitude]);f.fitBounds(t,{padding:[50,50]})}},j=e=>{e.key===`Escape`&&c(`close`)},M=e=>{e.target===e.currentTarget&&c(`close`)};a(()=>s.isOpen,e=>{e?(document.body.style.overflow=`hidden`,setTimeout(()=>{k.value&&A()},100)):(document.body.style.overflow=``,f&&=(f.remove(),null))},{immediate:!0});let F=y(()=>s.neighbor?i(s.neighbor.rssi):null),ee=[`h-1.5`,`h-2`,`h-2.5`,`h-3`,`h-3.5`];return(r,i)=>(h(),u(p,{to:`body`},[_(P,{name:`modal`,appear:``},{default:t(()=>[e.isOpen&&e.neighbor?(h(),C(`div`,{key:0,class:`fixed inset-0 z-50 flex items-center justify-center p-4 overflow-hidden`,onClick:M,onKeydown:j,tabindex:`0`},[i[21]||=S(`div`,{class:`absolute inset-0 bg-black/60 backdrop-blur-md pointer-events-none`},null,-1),S(`div`,{class:`relative w-full max-w-4xl max-h-[90vh] flex flex-col`,onClick:i[2]||=N(()=>{},[`stop`])},[S(`div`,Ve,[S(`div`,He,[S(`div`,Ue,[S(`h2`,We,n(e.neighbor.node_name||`Unknown Node`),1),S(`p`,Ge,n(e.neighbor.pubkey),1)]),S(`div`,Ke,[S(`button`,{onClick:i[0]||=e=>c(`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`},[...i[3]||=[S(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])])]),S(`div`,qe,[S(`div`,Je,[i[8]||=S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-4`},` Basic Information `,-1),S(`div`,Ye,[S(`div`,Xe,[i[4]||=S(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` Contact Type `,-1),S(`div`,{class:w([`font-medium`,E(e.neighbor.contact_type)])},n(T(e.neighbor.contact_type)),3)]),S(`div`,Ze,[i[5]||=S(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` Route Type `,-1),S(`div`,Qe,n(v(B)(e.neighbor.route_type)),1)]),S(`div`,$e,[i[6]||=S(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` Zero Hop `,-1),S(`div`,{class:w([`font-medium`,e.neighbor.zero_hop?`text-green-600 dark:text-green-400`:`text-gray-600 dark:text-gray-400`])},n(e.neighbor.zero_hop?`Yes`:`No`),3)]),S(`div`,et,[i[7]||=S(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` Advert Count `,-1),S(`div`,tt,n(e.neighbor.advert_count.toLocaleString()),1)])])]),S(`div`,nt,[i[13]||=S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-4`},` Signal Quality `,-1),S(`div`,rt,[S(`div`,it,[i[9]||=S(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` RSSI `,-1),S(`div`,at,n(v(L)(e.neighbor.rssi)),1)]),S(`div`,ot,[i[10]||=S(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` SNR `,-1),S(`div`,st,n(v(V)(e.neighbor.snr)),1)]),F.value?(h(),C(`div`,ct,[i[12]||=S(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` Signal Strength `,-1),S(`div`,lt,[S(`div`,ut,[(h(),C(x,null,m(5,e=>S(`div`,{key:e,class:w([`w-1 transition-colors`,ee[e-1],e<=F.value.bars?F.value.color:`text-gray-600 dark:text-gray-700`])},[...i[11]||=[S(`div`,{class:`w-full h-full bg-current rounded-sm`},null,-1)]],2)),64))]),S(`span`,{class:w([`text-sm font-medium`,F.value.color])},n(F.value.quality),3)])])):g(``,!0)])]),S(`div`,dt,[i[16]||=S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-4`},` Timeline `,-1),S(`div`,ft,[S(`div`,pt,[i[14]||=S(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` First Seen `,-1),S(`div`,mt,n(v(z)(e.neighbor.first_seen)),1)]),S(`div`,ht,[i[15]||=S(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` Last Seen `,-1),S(`div`,gt,n(v(z)(e.neighbor.last_seen)),1)])])]),k.value?(h(),C(`div`,_t,[i[20]||=S(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-4`},` Location `,-1),S(`div`,vt,[S(`div`,yt,[i[17]||=S(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` Latitude `,-1),S(`div`,bt,n(e.neighbor.latitude?.toFixed(6)),1)]),S(`div`,xt,[i[18]||=S(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` Longitude `,-1),S(`div`,St,n(e.neighbor.longitude?.toFixed(6)),1)]),S(`div`,Ct,[S(`div`,wt,n(O.value===null?`Coordinates`:`Distance`),1),O.value===null?(h(),C(`button`,{key:1,onClick:D,class:`w-full px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center justify-center gap-1.5 bg-primary/20 hover:bg-primary/30 border border-primary/50 text-primary`},[i[19]||=S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),b(` `+n(o.value),1)])):(h(),C(`div`,Tt,n(`${O.value.toFixed(2)} km`),1))])]),S(`div`,{ref_key:`mapContainer`,ref:d,class:`w-full h-96 rounded-[12px] overflow-hidden border border-stroke-subtle dark:border-white/10`},null,512)])):g(``,!0)]),S(`div`,Et,[S(`button`,{onClick:i[1]||=e=>c(`close`),class:`w-full px-4 py-2.5 rounded-lg font-medium transition-colors bg-primary/20 hover:bg-primary/30 border border-primary/50 text-primary`},` Close `)])])])],32)):g(``,!0)]),_:1})]))}}),[[`__scopeId`,`data-v-dc69b1d1`]]),Ot=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],kt=1,At=8,jt=class e{static from(t){if(!(t instanceof ArrayBuffer))throw Error(`Data must be an instance of ArrayBuffer.`);let[n,r]=new Uint8Array(t,0,2);if(n!==219)throw Error(`Data does not appear to be in a KDBush format.`);let i=r>>4;if(i!==kt)throw Error(`Got v${i} data when expected v${kt}.`);let a=Ot[r&15];if(!a)throw Error(`Unrecognized array type.`);let[o]=new Uint16Array(t,2,1),[s]=new Uint32Array(t,4,1);return new e(s,o,a,t)}constructor(e,t=64,n=Float64Array,r){if(isNaN(e)||e<0)throw Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let i=Ot.indexOf(this.ArrayType),a=e*2*this.ArrayType.BYTES_PER_ELEMENT,o=e*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-o%8)%8;if(i<0)throw Error(`Unexpected typed array class: ${n}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,At,e),this.coords=new this.ArrayType(this.data,At+o+s,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(At+a+o+s),this.ids=new this.IndexArrayType(this.data,At,e),this.coords=new this.ArrayType(this.data,At+o+s,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(kt<<4)+i]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=t,n}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return Mt(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,n,r){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:i,coords:a,nodeSize:o}=this,s=[0,i.length-1,0],c=[];for(;s.length;){let l=s.pop()||0,u=s.pop()||0,d=s.pop()||0;if(u-d<=o){for(let o=d;o<=u;o++){let s=a[2*o],l=a[2*o+1];s>=e&&s<=n&&l>=t&&l<=r&&c.push(i[o])}continue}let f=d+u>>1,p=a[2*f],m=a[2*f+1];p>=e&&p<=n&&m>=t&&m<=r&&c.push(i[f]),(l===0?e<=p:t<=m)&&(s.push(d),s.push(f-1),s.push(1-l)),(l===0?n>=p:r>=m)&&(s.push(f+1),s.push(u),s.push(1-l))}return c}within(e,t,n){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:r,coords:i,nodeSize:a}=this,o=[0,r.length-1,0],s=[],c=n*n;for(;o.length;){let l=o.pop()||0,u=o.pop()||0,d=o.pop()||0;if(u-d<=a){for(let n=d;n<=u;n++)It(i[2*n],i[2*n+1],e,t)<=c&&s.push(r[n]);continue}let f=d+u>>1,p=i[2*f],m=i[2*f+1];It(p,m,e,t)<=c&&s.push(r[f]),(l===0?e-n<=p:t-n<=m)&&(o.push(d),o.push(f-1),o.push(1-l)),(l===0?e+n>=p:t+n>=m)&&(o.push(f+1),o.push(u),o.push(1-l))}return s}};function Mt(e,t,n,r,i,a){if(i-r<=n)return;let o=r+i>>1;Nt(e,t,o,r,i,a),Mt(e,t,n,r,o-1,1-a),Mt(e,t,n,o+1,i,1-a)}function Nt(e,t,n,r,i,a){for(;i>r;){if(i-r>600){let o=i-r+1,s=n-r+1,c=Math.log(o),l=.5*Math.exp(2*c/3),u=.5*Math.sqrt(c*l*(o-l)/o)*(s-o/2<0?-1:1);Nt(e,t,n,Math.max(r,Math.floor(n-s*l/o+u)),Math.min(i,Math.floor(n+(o-s)*l/o+u)),a)}let o=t[2*n+a],s=r,c=i;for(Pt(e,t,r,n),t[2*i+a]>o&&Pt(e,t,r,i);so;)c--}t[2*r+a]===o?Pt(e,t,r,c):(c++,Pt(e,t,c,i)),c<=n&&(r=c+1),n<=c&&(i=c-1)}}function Pt(e,t,n,r){Ft(e,n,r),Ft(t,2*n,2*r),Ft(t,2*n+1,2*r+1)}function Ft(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function It(e,t,n,r){let i=e-n,a=t-r;return i*i+a*a}var Lt={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},Rt=Math.fround||(e=>(t=>(e[0]=+t,e[0])))(new Float32Array(1)),Z=2,Q=3,zt=4,$=5,Bt=6,Vt=class{constructor(e){this.options=Object.assign(Object.create(Lt),e),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){let{log:t,minZoom:n,maxZoom:r}=this.options;t&&console.time(`total time`);let i=`prepare ${e.length} points`;t&&console.time(i),this.points=e;let a=[];for(let t=0;t=n;e--){let n=+Date.now();o=this.trees[e]=this._createTree(this._cluster(o,e)),t&&console.log(`z%d: %d clusters in %dms`,e,o.numItems,+Date.now()-n)}return t&&console.timeEnd(`total time`),this}getClusters(e,t){let n=((e[0]+180)%360+360)%360-180,r=Math.max(-90,Math.min(90,e[1])),i=e[2]===180?180:((e[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)n=-180,i=180;else if(n>i){let e=this.getClusters([n,r,180,a],t),o=this.getClusters([-180,r,i,a],t);return e.concat(o)}let o=this.trees[this._limitZoom(t)],s=o.range(Wt(n),Gt(a),Wt(i),Gt(r)),c=o.data,l=[];for(let e of s){let t=this.stride*e;l.push(c[t+$]>1?Ht(c,t,this.clusterProps):this.points[c[t+Q]])}return l}getChildren(e){let t=this._getOriginId(e),n=this._getOriginZoom(e),r=`No cluster with the specified id.`,i=this.trees[n];if(!i)throw Error(r);let a=i.data;if(t*this.stride>=a.length)throw Error(r);let o=this.options.radius/(this.options.extent*2**(n-1)),s=a[t*this.stride],c=a[t*this.stride+1],l=i.within(s,c,o),u=[];for(let t of l){let n=t*this.stride;a[n+zt]===e&&u.push(a[n+$]>1?Ht(a,n,this.clusterProps):this.points[a[n+Q]])}if(u.length===0)throw Error(r);return u}getLeaves(e,t,n){t||=10,n||=0;let r=[];return this._appendLeaves(r,e,t,n,0),r}getTile(e,t,n){let r=this.trees[this._limitZoom(e)],i=2**e,{extent:a,radius:o}=this.options,s=o/a,c=(n-s)/i,l=(n+1+s)/i,u={features:[]};return this._addTileFeatures(r.range((t-s)/i,c,(t+1+s)/i,l),r.data,t,n,i,u),t===0&&this._addTileFeatures(r.range(1-s/i,c,1,l),r.data,i,n,i,u),t===i-1&&this._addTileFeatures(r.range(0,c,s/i,l),r.data,-1,n,i,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){let n=this.getChildren(e);if(t++,n.length!==1)break;e=n[0].properties.cluster_id}return t}_appendLeaves(e,t,n,r,i){let a=this.getChildren(t);for(let t of a){let a=t.properties;if(a&&a.cluster?i+a.point_count<=r?i+=a.point_count:i=this._appendLeaves(e,a.cluster_id,n,r,i):i1,c,l,u;if(s)c=Ut(t,e,this.clusterProps),l=t[e],u=t[e+1];else{let n=this.points[t[e+Q]];c=n.properties;let[r,i]=n.geometry.coordinates;l=Wt(r),u=Gt(i)}let d={type:1,geometry:[[Math.round(this.options.extent*(l*i-n)),Math.round(this.options.extent*(u*i-r))]],tags:c},f;f=s||this.options.generateId?t[e+Q]:this.points[t[e+Q]].id,f!==void 0&&(d.id=f),a.features.push(d)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){let{radius:n,extent:r,reduce:i,minPoints:a}=this.options,o=n/(r*2**t),s=e.data,c=[],l=this.stride;for(let n=0;nt&&(p+=s[n+$])}if(p>f&&p>=a){let e=r*f,a=u*f,o,m=-1,h=((n/l|0)<<5)+(t+1)+this.points.length;for(let r of d){let c=r*l;if(s[c+Z]<=t)continue;s[c+Z]=t;let u=s[c+$];e+=s[c]*u,a+=s[c+1]*u,s[c+zt]=h,i&&(o||(o=this._map(s,n,!0),m=this.clusterProps.length,this.clusterProps.push(o)),i(o,this._map(s,c)))}s[n+zt]=h,c.push(e/p,a/p,1/0,h,-1,p),i&&c.push(m)}else{for(let e=0;e1)for(let e of d){let n=e*l;if(!(s[n+Z]<=t)){s[n+Z]=t;for(let e=0;e>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,n){if(e[t+$]>1){let r=this.clusterProps[e[t+Bt]];return n?Object.assign({},r):r}let r=this.points[e[t+Q]].properties,i=this.options.map(r);return n&&i===r?Object.assign({},i):i}};function Ht(e,t,n){return{type:`Feature`,id:e[t+Q],properties:Ut(e,t,n),geometry:{type:`Point`,coordinates:[Kt(e[t]),qt(e[t+1])]}}}function Ut(e,t,n){let r=e[t+$],i=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?`${Math.round(r/100)/10}k`:r,a=e[t+Bt],o=a===-1?{}:Object.assign({},n[a]);return Object.assign(o,{cluster:!0,cluster_id:e[t+Q],point_count:r,point_count_abbreviated:i})}function Wt(e){return e/360+.5}function Gt(e){let t=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n<0?0:n>1?1:n}function Kt(e){return(e-.5)*360}function qt(e){let t=(180-e*360)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}var Jt={class:`map-container`},Yt={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`},Xt={key:0,class:`flex items-center gap-2 text-content-secondary dark:text-content-muted`},Zt={key:1,class:`text-center text-content-primary dark:text-content-primary`},Qt={class:`hidden sm:inline`},$t={key:3,class:`map-legend`},en={class:`legend-footer`},tn={key:4,class:`map-attribution`},nn=A(f({__name:`NetworkMap`,props:{adverts:{},baseLatitude:{default:null},baseLongitude:{default:null},statsLoading:{type:Boolean,default:!1},showLegend:{type:Boolean,default:!0}},emits:[`update:showLegend`],setup(e,{expose:t,emit:s}){typeof window<`u`&&!window.chrome&&(window.chrome={runtime:{}});let c=e,u=s,f=()=>{u(`update:showLegend`,!c.showLegend)},p=l(),m=null,v=l(new Map),b=null,x=l(new Map),w=l([]),T=l(!0),E=l(60),D=l(14),O=l(document.documentElement.classList.contains(`dark`)),k=new MutationObserver(()=>{let e=document.documentElement.classList.contains(`dark`);e!==O.value&&(O.value=e,m&&P())}),A=y(()=>c.baseLatitude!==null&&c.baseLongitude!==null&&typeof c.baseLatitude==`number`&&typeof c.baseLongitude==`number`&&c.baseLatitude!==0&&c.baseLongitude!==0&&Math.abs(c.baseLatitude)<=90&&Math.abs(c.baseLongitude)<=180),M=(e,t,n,r)=>{let i=(n-e)*Math.PI/180,a=(r-t)*Math.PI/180,o=Math.sin(i/2)*Math.sin(i/2)+Math.cos(e*Math.PI/180)*Math.cos(n*Math.PI/180)*Math.sin(a/2)*Math.sin(a/2);return 6371*(2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o)))},N=()=>{m&&=(w.value.forEach(e=>{m&&e.remove()}),w.value.length=0,m.remove(),null),v.value.clear(),x.value.clear(),b=null},P=async()=>{let e=m?.getZoom()||11,t=m?.getCenter()||(A.value?[c.baseLatitude,c.baseLongitude]:[0,0]);N(),await o(),await I(),m&&m.setView(t,e)},F=e=>{let t=new Map;return e.filter(e=>e.latitude!==null&&e.longitude!==null).map(e=>{let n=e.latitude,r=e.longitude,i=`${n.toFixed(6)}_${r.toFixed(6)}`,a=t.get(i)||0;if(t.set(i,a+1),a>0){let e=.001,t=a*60*(Math.PI/180);n+=Math.sin(t)*e*(a*.5),r+=Math.cos(t)*e*(a*.5)}return{type:`Feature`,properties:{advert:{...e,jittered_latitude:n,jittered_longitude:r}},geometry:{type:`Point`,coordinates:[r,n]}}})},ee=e=>{b=new Vt({radius:E.value,maxZoom:D.value,minPoints:2}),b.load(e)},I=async()=>{if(!p.value||!A.value){console.warn(`Cannot initialize map: missing container or coordinates`);return}N(),await o();let e=c.baseLatitude,t=c.baseLongitude;m=X.default.map(p.value,{center:[e,t],zoom:11,zoomControl:!0,attributionControl:!1,preferCanvas:!1});try{let e=O.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`,t=O.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`,n=X.default.tileLayer(e,{maxZoom:19,attribution:`© OpenStreetMap contributors © CARTO`,errorTileUrl:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==`}),r=X.default.tileLayer(t,{maxZoom:19,attribution:``,errorTileUrl:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==`});n.addTo(m),r.addTo(m)}catch(e){console.warn(`Error loading tiles:`,e)}try{let n=(e,t=!1)=>{let n=t?16:12;return X.default.divIcon({className:`custom-div-icon`,html:`
`,iconSize:[n+4,n+4],iconAnchor:[(n+4)/2,(n+4)/2]})},r=e=>{let t=e<10?30:e<100?40:50;return X.default.divIcon({className:`custom-cluster-icon`,html:` -
- ${e} -
- `,iconSize:[t,t],iconAnchor:[t/2,t/2]})},i=n(`#ef4444`,!0);X.default.marker([e,t],{icon:i}).addTo(m).bindPopup(` -
- Base Station
- Base Station
- ${e.toFixed(6)}, ${t.toFixed(6)} -
- `);let a={Unknown:`#9CA3AF`,"Chat Node":`#60A5FA`,Repeater:`#A5E5B6`,"Room Server":`#EBA0FC`,"Hybrid Node":`#FFC246`},o=(e,t,n,r,i=0)=>{if(!m||e.zero_hop!==!0)return;let a=e.jittered_latitude||e.latitude,o=e.jittered_longitude||e.longitude;if(a===null||o===null)return;let s=e.route_type||0,c=r,l=3,u=.7,d;s===2?(c=`#A5E5B6`,l=4,u=.9):s===1?(c=`#FFC246`,d=`10, 5`,u=.8):s===3?(c=`#059669`,l=5,u=.95):s===0?(c=`#ea580c`,d=`12, 6`,u=.8):(c=`#9CA3AF`,d=`2, 5`,u=.6);let f=[t,n],p=[a,o],h=X.default.polyline([f,p],{color:c,weight:l,opacity:0,dashArray:d,className:`connection-line`}).addTo(m),g=X.default.polyline([f,f],{color:c,weight:l,opacity:0,dashArray:d,className:`connection-line animated-line`}).addTo(m);setTimeout(()=>{let i=0;g.setStyle({opacity:u+.2});let s=()=>{i++;let c=i/30,d=f[0]+(p[0]-f[0])*c,_=f[1]+(p[1]-f[1])*c;g.setLatLngs([f,[d,_]]),i<30?setTimeout(s,30):setTimeout(()=>{m&&g&&g.remove(),h.setStyle({opacity:u}),h.on(`mouseover`,()=>{h.setStyle({weight:l+2,opacity:Math.min(u+.3,1)})}),h.on(`mouseout`,()=>{h.setStyle({weight:l,opacity:u})});let i=M(t,n,a,o);h.bindPopup(` -
- Connection to ${e.node_name||`Unknown Node`}
- Distance: ${i.toFixed(2)} km
- Route: ${B(e.route_type)}
- Signal: ${L(e.rssi)} / ${V(e.snr)} -
- `),w.value.push(h)},200)};s()},i)},s=()=>{if(!m||!b)return;let i=m.getBounds(),s=Math.floor(m.getZoom());x.value.forEach(e=>{m&&e.remove()}),x.value.clear(),w.value.forEach(e=>{m&&e.remove()}),w.value.length=0,b.getClusters([i.getWest(),i.getSouth(),i.getEast(),i.getNorth()],s).forEach(i=>{let[s,c]=i.geometry.coordinates,l=i.properties;if(l.cluster){let n=X.default.marker([c,s],{icon:r(l.point_count||0)}).addTo(m);n.on(`click`,()=>{if(m&&b){let e=b.getClusterExpansionZoom(l.cluster_id);m.setView([c,s],e)}});let i=b.getLeaves(l.cluster_id,1/0).map(e=>`
- • ${e.properties.advert.node_name||`Unknown Node`} (${e.properties.advert.contact_type}) -
`).join(``);n.bindPopup(` -
- Cluster: ${l.point_count} nodes
-
- ${i} -
-
- Click to zoom in and separate nodes -
-
- `),x.value.set(`cluster-${l.cluster_id}`,n);let u=M(e,t,c,s),d=Math.min(Math.floor(u*5),200);o({node_name:`Cluster of ${l.point_count} nodes`,contact_type:`Cluster`,route_type:2,rssi:null,snr:null,jittered_latitude:c,jittered_longitude:s,latitude:c,longitude:s},e,t,`#AAE8E8`,d)}else{let r=l.advert,i=a[r.contact_type]||a.Unknown,u=n(i),d=c,f=s,p=M(e,t,d,f),h=X.default.marker([d,f],{icon:u}).addTo(m).bindPopup(` -
- ${r.node_name||`Unknown Node`}
- Type: ${r.contact_type}
- Distance: ${p.toFixed(2)} km
- Signal: ${L(r.rssi)} / ${V(r.snr)}
- Route: ${B(r.route_type)}
- Last Seen: ${z(r.last_seen)} - ${r.jittered_latitude?`
Position adjusted to separate overlapping nodes`:``} -
- `);v.value.set(r.pubkey,h),x.value.set(`node-${r.pubkey}`,h);let g=Math.min(Math.floor(p*5),200);o({...r,jittered_latitude:d,jittered_longitude:f},e,t,i,g)}})},l=(e,t)=>{let r=0;F(c.adverts).forEach(i=>{let s=i.properties.advert;if(s.latitude!==null&&s.longitude!==null){let i=a[s.contact_type]||a.Unknown,c=n(i),l=s.jittered_latitude||s.latitude,u=s.jittered_longitude||s.longitude,d=X.default.marker([l,u],{icon:c}).addTo(m).bindPopup(` -
- ${s.node_name||`Unknown Node`}
- Type: ${s.contact_type}
- Distance: ${M(e,t,l,u).toFixed(2)} km
- Signal: ${L(s.rssi)} / ${V(s.snr)}
- Route: ${B(s.route_type)}
- Last Seen: ${z(s.last_seen)} - ${s.jittered_latitude?`
Position adjusted to separate overlapping nodes`:``} -
- `);v.value.set(s.pubkey,d);let f=d.getElement();f&&(f.style.opacity=`0`,f.style.transition=`opacity 0.5s ease-out`),o(s,e,t,i,r),setTimeout(()=>{f&&(f.style.opacity=`1`)},r+1e3),r+=100}})};if(T.value&&c.adverts.length>0)try{ee(F(c.adverts));let n=Math.min(14,m.getZoom());m.setZoom(n),setTimeout(()=>{try{s()}catch(n){console.warn(`Error updating clusters:`,n),l(e,t)}},100),m.on(`moveend`,()=>{try{s()}catch(e){console.warn(`Error updating clusters on move:`,e)}}),m.on(`zoomend`,()=>{try{s()}catch(e){console.warn(`Error updating clusters on zoom:`,e)}})}catch(n){console.warn(`Error initializing clustering:`,n),l(e,t)}else l(e,t);setTimeout(()=>{m&&m.invalidateSize()},1e3)}catch(e){console.error(`Error initializing map:`,e)}};return t({highlightNode:e=>{let t=v.value.get(e);if(t){let e=t.getElement();if(e){let t=e.querySelector(`div`);t&&t.classList.add(`marker-highlight`)}}},unhighlightNode:e=>{let t=v.value.get(e);if(t){let e=t.getElement();if(e){let t=e.querySelector(`div`);t&&t.classList.remove(`marker-highlight`)}}},initializeOpenStreetMap:I}),a(()=>c.adverts,()=>{m&&A.value&&setTimeout(()=>{I()},100)},{immediate:!1}),a(A,e=>{e&&c.adverts.length>0&&!m&&o(()=>I())}),i(()=>{k.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),A.value&&c.adverts.length>0&&setTimeout(()=>{I()},300)}),r(()=>{k.disconnect(),N()}),(t,r)=>(h(),C(`div`,Jt,[A.value?(h(),C(`div`,{key:1,ref_key:`mapContainer`,ref:p,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)):(h(),C(`div`,Yt,[c.statsLoading?(h(),C(`div`,Xt,[_(j,{size:`xs`}),r[0]||=S(`p`,{class:`text-xs sm:text-sm`},`Fetching base station location…`,-1)])):(h(),C(`div`,Zt,[...r[1]||=[S(`svg`,{class:`w-8 h-8 mx-auto mb-2 text-content-muted dark:text-content-muted`,fill:`currentColor`,viewBox:`0 0 20 20`},[S(`path`,{d:`M5.05 4.05a7 7 0 119.9 9.9L10 18.9l-4.95-4.95a7 7 0 010-9.9zM10 11a2 2 0 100-4 2 2 0 000 4z`})],-1),S(`p`,{class:`text-sm text-content-primary dark:text-content-primary`},` No valid coordinates available `,-1),S(`p`,{class:`text-xs text-content-secondary dark:text-content-muted`},` Configure base station location to view map `,-1)]]))])),A.value&&e.adverts.length>0?(h(),C(`button`,{key:2,onClick:f,class:`absolute bottom-3 right-3 z-[200] 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`},[r[2]||=S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`span`,Qt,n(e.showLegend?`Hide`:`Show`),1)])):g(``,!0),A.value&&e.adverts.length>0&&e.showLegend?(h(),C(`div`,$t,[r[3]||=d(`
Node Types
Base Station
Chat Node
Repeater
Room Server
Hybrid Node
Route Types
Direct
Transport Direct
Flood
Transport Flood
`,2),S(`div`,en,n(e.adverts.length)+` node`+n(e.adverts.length===1?``:`s`)+` visible `,1)])):g(``,!0),A.value?(h(),C(`div`,tn,` © OpenStreetMap contributors © CARTO `)):g(``,!0)]))}}),[[`__scopeId`,`data-v-47bae275`]]),rn={class:`relative`,"data-menu-container":``},an=f({__name:`NeighborMenu`,props:{neighbor:{},canPing:{type:Boolean}},emits:[`ping`,`delete`,`show-details`],setup(e,{emit:t}){let n=window.__neighborMenuManager||{activeMenu:null,setActiveMenu:e=>{if(n.activeMenu&&n.activeMenu!==e)try{n.activeMenu.closeMenu()}catch(e){console.warn(`Error closing previous menu:`,e)}n.activeMenu=e}};window.__neighborMenuManager=n;let i=e,a=t,c=l(!1),d=l(),f=l(),m=l({top:0,left:0}),_=()=>{c.value=!1,document.removeEventListener(`click`,T,!0),document.removeEventListener(`keydown`,E),n.activeMenu===v&&(n.activeMenu=null)},v={closeMenu:_},y=()=>{_(),a(`ping`,i.neighbor)},b=()=>{_(),a(`show-details`,i.neighbor)},x=()=>{_(),a(`delete`,i.neighbor)},T=e=>{e.target.closest(`[data-menu-container]`)||_()},E=e=>{e.key===`Escape`&&_()},D=async()=>{if(!c.value&&d.value){n.setActiveMenu(v);let e=d.value.getBoundingClientRect(),t=window.innerWidth,r=t<1024,i=e.left+144>t-16,a=e.left;if(r&&i&&(a=e.right-144),a=Math.max(8,a),m.value={top:e.bottom+4,left:a},c.value=!0,await o(),f.value){let t=f.value.offsetHeight;e.bottom+4+t>window.innerHeight-8&&(m.value={top:e.top-t-4,left:a})}document.addEventListener(`click`,T,!0),document.addEventListener(`keydown`,E)}else _()};return r(()=>{_()}),(e,t)=>(h(),C(`div`,rn,[S(`button`,{ref_key:`buttonRef`,ref:d,onClick:D,class:w([`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":c.value}]),"data-menu-container":``},[...t[0]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),(h(),u(p,{to:`body`},[c.value?(h(),C(`div`,{key:0,ref_key:`menuRef`,ref:f,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-[450]`,style:s({top:m.value.top+`px`,left:m.value.left+`px`}),"data-menu-container":``},[S(`div`,{class:`py-2`},[S(`button`,{onClick:b,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`},[...t[1]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`span`,{class:`font-medium`},`Details`,-1)]]),S(`button`,{onClick:y,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`},[...t[2]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`span`,{class:`font-medium`},`Ping`,-1)]]),S(`button`,{onClick:x,class:`flex items-center gap-3 w-full px-4 py-3 text-sm text-accent-red hover:bg-accent-red/10 transition-colors`},[...t[3]||=[S(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`span`,{class:`font-medium`},`Delete`,-1)]])])],4)):g(``,!0)]))]))}}),on={class:`glass-card/30 backdrop-blur border border-stroke-subtle dark:border-white/10 rounded-[12px] p-6 shadow-sm dark:shadow-none`},sn={class:`flex items-center justify-between mb-4`},cn={class:`flex items-center gap-3`},ln={class:`text-content-primary dark:text-content-primary text-lg font-semibold`},un={class:`bg-background-mute dark:bg-white/10 text-content-secondary dark:text-content-primary text-xs px-2 py-1 rounded-full`},dn={key:0,class:`text-content-muted dark:text-content-muted`},fn={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`},pn={class:`hidden lg:block overflow-x-auto`},mn={class:`w-full`},hn={class:`bg-background-mute dark:bg-transparent`},gn={class:`flex items-center gap-1`},_n={class:`flex items-center gap-1`},vn={class:`flex items-center gap-1`},yn={class:`flex items-center gap-1`},bn={class:`flex items-center gap-1`},xn={class:`flex items-center gap-1`},Sn={class:`flex items-center gap-1`},Cn={class:`flex items-center gap-1`},wn={class:`flex items-center gap-1`},Tn={class:`bg-surface/50 dark:bg-transparent`},En=[`onMouseenter`,`onMouseleave`,`onClick`],Dn=[`onClick`,`title`],On={key:0,class:`ml-1 text-xs`},kn={key:0,class:`flex items-center gap-3`},An={class:`text-content-secondary dark:text-content-muted`},jn={class:`flex gap-1`},Mn=[`onClick`],Nn=[`onClick`],Pn={key:1,class:`text-content-muted`},Fn={class:`flex items-center gap-2`},In={class:`flex items-end gap-0.5`},Ln={class:`flex items-center gap-2`},Rn=[`title`],zn=[`title`],Bn={class:`lg:hidden space-y-3`},Vn=[`onClick`],Hn={class:`flex items-center justify-between mb-3`},Un={class:`flex items-center gap-3`},Wn={class:`text-content-primary dark:text-content-primary font-medium text-base`},Gn={class:`flex items-center gap-2`},Kn={class:`grid grid-cols-1 gap-3`},qn={class:`grid grid-cols-2 gap-4`},Jn=[`onClick`,`title`],Yn={key:0,class:`ml-1 text-xs`},Xn={class:`flex items-center gap-2 justify-end`},Zn={class:`flex items-end gap-0.5`},Qn={class:`grid grid-cols-2 gap-4`},$n={class:`flex items-center gap-2`},er=[`title`],tr={class:`text-content-primary dark:text-content-primary text-sm block text-right`},nr={key:0,class:`border-t border-white/10 pt-3`},rr={class:`flex items-center justify-between`},ir={class:`text-content-secondary dark:text-content-muted text-sm font-mono`},ar={class:`flex gap-2`},or=[`onClick`],sr=[`onClick`],cr={class:`grid grid-cols-3 gap-4 pt-3 border-t border-white/10`},lr={class:`text-center`},ur={class:`text-content-primary dark:text-content-primary text-sm font-medium`},dr={class:`text-center`},fr={class:`text-content-primary dark:text-content-primary text-sm font-medium`},pr={class:`text-center`},mr=[`title`],hr=f({__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(e,{emit:t}){let r=l(null),{getSignalQuality:i}=G(),a=l(`advert_count`),o=l(`desc`),c=e,u=t,d=(e,t,n,r)=>{let i=(n-e)*Math.PI/180,a=(r-t)*Math.PI/180,o=Math.sin(i/2)*Math.sin(i/2)+Math.cos(e*Math.PI/180)*Math.cos(n*Math.PI/180)*Math.sin(a/2)*Math.sin(a/2);return 6371*(2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o)))},f=e=>c.baseLatitude===null||c.baseLongitude===null||e.latitude===null||e.longitude===null?`N/A`:te(d(c.baseLatitude,c.baseLongitude,e.latitude,e.longitude)),p=async e=>{try{return await navigator.clipboard.writeText(e),!0}catch{let t=document.createElement(`textarea`);return t.value=e,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t),!0}},T=e=>{let t=Date.now()-e*1e3,n=Math.floor(t/1e3),r=Math.floor(n/60),i=Math.floor(r/60),a=Math.floor(i/24);return n<60?`${n}s ago`:r<60?`${r}m ago`:i<24?`${i}h ago`:`${a}d ago`},E=e=>{let t=Date.now()-e*1e3,n=Math.floor(t/(1e3*60*60));return n<1?{color:`text-green-600 dark:text-green-400`}:n<26?{color:`text-yellow-600 dark:text-yellow-400`}:{color:`text-red-600 dark:text-red-400`}},D=async(e,t)=>{await p(`${e.toFixed(6)}, ${t.toFixed(6)}`)},O=(e,t)=>{let n=`https://www.google.com/maps?q=${e},${t}`;window.open(n,`_blank`)},k=async e=>{await p(e),r.value=e,setTimeout(()=>{r.value=null},2e3)},A=e=>{let t=i(e);return{bars:t.bars,color:t.color}},j=[`h-1.5`,`h-2`,`h-2.5`,`h-3`,`h-3.5`],M=[`h-2`,`h-2.5`,`h-3`,`h-3.5`,`h-4`],P=()=>c.isCompactView?`py-2 px-2`:`py-4 px-3`,F=()=>{u(`toggle-view`)},ee=e=>{u(`highlight-node`,e)},I=e=>{u(`unhighlight-node`,e)},B=e=>{u(`menu-ping`,e)},U=e=>{u(`show-details`,e)},W=e=>{u(`menu-delete`,e)},K=e=>{a.value===e?o.value=o.value===`asc`?`desc`:`asc`:(a.value=e,o.value=typeof c.adverts[0]?.[e]==`number`?`desc`:`asc`)},q=y(()=>a.value?[...c.adverts].sort((e,t)=>{let n=e[a.value],r=t[a.value];if(n==null)return 1;if(r==null)return-1;let i=0;return typeof n==`string`&&typeof r==`string`?i=n.localeCompare(r):typeof n==`number`&&typeof r==`number`?i=n-r:typeof n==`boolean`&&typeof r==`boolean`&&(i=n===r?0:n?1:-1),o.value===`asc`?i:-i}):c.adverts);return(t,i)=>(h(),C(`div`,on,[S(`div`,sn,[S(`div`,cn,[S(`div`,{class:`w-3 h-3 rounded-full border border-white/20`,style:s({backgroundColor:e.color})},null,4),S(`h3`,ln,n(e.contactType),1),S(`span`,un,[b(n(e.adverts.length)+` `,1),e.originalCount>0&&e.adverts.lengthK(`node_name`),class:w(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${P().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[S(`div`,gn,[i[13]||=b(` Node Name `,-1),a.value===`node_name`?(h(),C(`svg`,{key:0,class:w([`w-3 h-3`,o.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[12]||=[S(`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)):g(``,!0)])],2),S(`th`,{onClick:i[1]||=e=>K(`pubkey`),class:w(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${P().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[S(`div`,_n,[i[15]||=b(` Public Key `,-1),a.value===`pubkey`?(h(),C(`svg`,{key:0,class:w([`w-3 h-3`,o.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[14]||=[S(`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)):g(``,!0)])],2),S(`th`,{class:w(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${P().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5`)},` Location `,2),S(`th`,{class:w(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${P().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5`)},` Distance `,2),S(`th`,{onClick:i[2]||=e=>K(`route_type`),class:w(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${P().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[S(`div`,vn,[i[17]||=b(` Route Type `,-1),a.value===`route_type`?(h(),C(`svg`,{key:0,class:w([`w-3 h-3`,o.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[16]||=[S(`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)):g(``,!0)])],2),S(`th`,{onClick:i[3]||=e=>K(`zero_hop`),class:w(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${P().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[S(`div`,yn,[i[19]||=b(` Zero Hop `,-1),a.value===`zero_hop`?(h(),C(`svg`,{key:0,class:w([`w-3 h-3`,o.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[18]||=[S(`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)):g(``,!0)])],2),S(`th`,{onClick:i[4]||=e=>K(`rssi`),class:w(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${P().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[S(`div`,bn,[i[21]||=b(` RSSI `,-1),a.value===`rssi`?(h(),C(`svg`,{key:0,class:w([`w-3 h-3`,o.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[20]||=[S(`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)):g(``,!0)])],2),S(`th`,{onClick:i[5]||=e=>K(`snr`),class:w(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${P().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[S(`div`,xn,[i[23]||=b(` SNR `,-1),a.value===`snr`?(h(),C(`svg`,{key:0,class:w([`w-3 h-3`,o.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[22]||=[S(`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)):g(``,!0)])],2),S(`th`,{onClick:i[6]||=e=>K(`last_seen`),class:w(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${P().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[S(`div`,Sn,[i[25]||=b(` Last Seen `,-1),a.value===`last_seen`?(h(),C(`svg`,{key:0,class:w([`w-3 h-3`,o.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[24]||=[S(`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)):g(``,!0)])],2),S(`th`,{onClick:i[7]||=e=>K(`first_seen`),class:w(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${P().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[S(`div`,Cn,[i[27]||=b(` First Seen `,-1),a.value===`first_seen`?(h(),C(`svg`,{key:0,class:w([`w-3 h-3`,o.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[26]||=[S(`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)):g(``,!0)])],2),S(`th`,{onClick:i[8]||=e=>K(`advert_count`),class:w(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${P().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[S(`div`,wn,[i[29]||=b(` Advert Count `,-1),a.value===`advert_count`?(h(),C(`svg`,{key:0,class:w([`w-3 h-3`,o.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[28]||=[S(`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)):g(``,!0)])],2)])]),S(`tbody`,Tn,[(h(!0),C(x,null,m(q.value,e=>(h(),C(`tr`,{key:e.id,class:`hover:bg-background-mute/50 dark:hover:bg-white/5 transition-colors cursor-pointer`,onMouseenter:t=>ee(e.pubkey),onMouseleave:t=>I(e.pubkey),onClick:t=>U(e)},[S(`td`,{class:w(P()),onClick:i[9]||=N(()=>{},[`stop`])},[_(an,{neighbor:e,onPing:B,onShowDetails:U,onDelete:W},null,8,[`neighbor`])],2),S(`td`,{class:w(`${P()} text-content-primary dark:text-content-primary text-sm`)},n(e.node_name||`Unknown`),3),S(`td`,{class:w(`${P()} text-content-primary dark:text-content-primary text-sm font-mono`)},[S(`button`,{onClick:N(t=>k(e.pubkey),[`stop`]),class:w([`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===e.pubkey?`text-green-600 dark:text-green-400 decoration-green-400/60`:``]),title:r.value===e.pubkey?`Copied!`:`Click to copy full public key`},[b(n(v(R)(e.pubkey))+` `,1),r.value===e.pubkey?(h(),C(`span`,On,`✓`)):g(``,!0)],10,Dn)],2),S(`td`,{class:w(`${P()} text-content-primary dark:text-content-primary text-sm`)},[e.latitude!==null&&e.longitude!==null?(h(),C(`div`,kn,[S(`span`,An,n(e.latitude.toFixed(4))+`, `+n(e.longitude.toFixed(4)),1),S(`div`,jn,[S(`button`,{onClick:N(t=>D(e.latitude,e.longitude),[`stop`]),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`},[...i[30]||=[S(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[S(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`,stroke:`currentColor`,"stroke-width":`2`}),S(`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,Mn),S(`button`,{onClick:N(t=>O(e.latitude,e.longitude),[`stop`]),class:`text-white/60 hover:text-blue-600 dark:text-blue-400 transition-colors cursor-pointer`,title:`Open in Google Maps`},[...i[31]||=[S(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[S(`path`,{d:`M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z`,stroke:`currentColor`,"stroke-width":`2`}),S(`circle`,{cx:`12`,cy:`10`,r:`3`,stroke:`currentColor`,"stroke-width":`2`})],-1)]],8,Nn)])])):(h(),C(`span`,Pn,`Unknown`))],2),S(`td`,{class:w(`${P()} text-content-primary dark:text-content-primary text-sm`)},n(f(e)),3),S(`td`,{class:w(`${P()} text-content-primary dark:text-content-primary text-sm`)},[S(`span`,{class:w([`inline-block px-2 py-1 rounded-full text-xs border transition-colors`,v(H)(e.route_type).bgColor,v(H)(e.route_type).borderColor,v(H)(e.route_type).textColor])},n(v(H)(e.route_type).text),3)],2),S(`td`,{class:w(`${P()} text-content-primary dark:text-content-primary text-sm`)},[S(`span`,{class:w([`inline-block px-2 py-1 rounded-full text-xs border transition-colors`,e.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`])},n(e.zero_hop?`Zero Hop`:`Multi-Hop`),3)],2),S(`td`,{class:w(`${P()} text-content-primary dark:text-content-primary text-sm`)},[S(`div`,Fn,[S(`div`,In,[(h(),C(x,null,m(5,t=>S(`div`,{key:t,class:w([`w-1 transition-colors`,j[t-1],t<=A(e.rssi).bars?A(e.rssi).color:`text-gray-600`])},[...i[32]||=[S(`div`,{class:`w-full h-full bg-current rounded-sm`},null,-1)]],2)),64))]),S(`span`,{class:w(A(e.rssi).color)},n(v(L)(e.rssi)),3)])],2),S(`td`,{class:w(`${P()} text-content-primary dark:text-content-primary text-sm`)},n(v(V)(e.snr)),3),S(`td`,{class:w(`${P()} text-content-primary dark:text-content-primary text-sm`)},[S(`div`,Ln,[S(`div`,{class:w([`w-2 h-2 rounded-full`,E(e.last_seen).color===`text-green-600 dark:text-green-400`?`bg-green-400`:``,E(e.last_seen).color===`text-yellow-600 dark:text-yellow-400`?`bg-yellow-400`:``,E(e.last_seen).color===`text-red-600 dark:text-red-400`?`bg-red-400`:``])},null,2),S(`span`,{class:w([E(e.last_seen).color,`cursor-help`]),title:v(z)(e.last_seen)},n(T(e.last_seen)),11,Rn)])],2),S(`td`,{class:w(`${P()} text-content-primary dark:text-content-primary text-sm`)},[S(`span`,{title:v(z)(e.first_seen),class:`cursor-help`},n(T(e.first_seen)),9,zn)],2),S(`td`,{class:w(`${P()} text-content-primary dark:text-content-primary text-sm text-center`)},n(e.advert_count),3)],40,En))),128))])])]),S(`div`,Bn,[(h(!0),C(x,null,m(q.value,e=>(h(),C(`div`,{key:e.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:t=>ee(e.pubkey)},[S(`div`,Hn,[S(`div`,Un,[S(`h4`,Wn,n(e.node_name||`Unknown Node`),1),S(`div`,Gn,[S(`span`,{class:w([`inline-block px-2 py-1 rounded-full text-xs border`,v(H)(e.route_type).bgColor,v(H)(e.route_type).borderColor,v(H)(e.route_type).textColor])},n(v(H)(e.route_type).text),3),S(`span`,{class:w([`inline-block px-2 py-1 rounded-full text-xs border`,e.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`])},n(e.zero_hop?`Zero Hop`:`Multi-Hop`),3)])]),_(an,{neighbor:e,onPing:B,onShowDetails:U,onDelete:W},null,8,[`neighbor`])]),S(`div`,Kn,[S(`div`,qn,[S(`div`,null,[i[33]||=S(`div`,{class:`text-content-muted text-xs mb-1`},`Public Key`,-1),S(`button`,{onClick:t=>k(e.pubkey),class:w([`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===e.pubkey?`text-green-600 dark:text-green-400 decoration-green-400/60`:``]),title:r.value===e.pubkey?`Copied!`:`Click to copy full public key`},[b(n(v(R)(e.pubkey))+` `,1),r.value===e.pubkey?(h(),C(`span`,Yn,`✓`)):g(``,!0)],10,Jn)]),S(`div`,null,[i[35]||=S(`div`,{class:`text-content-muted text-xs mb-1`},`Signal`,-1),S(`div`,Xn,[S(`div`,Zn,[(h(),C(x,null,m(5,t=>S(`div`,{key:t,class:w([`w-1.5 transition-colors`,M[t-1],t<=A(e.rssi).bars?A(e.rssi).color:`text-gray-600`])},[...i[34]||=[S(`div`,{class:`w-full h-full bg-current rounded-sm`},null,-1)]],2)),64))]),S(`span`,{class:w(`${A(e.rssi).color} text-sm font-medium`)},n(v(L)(e.rssi)),3)])])]),S(`div`,Qn,[S(`div`,null,[i[36]||=S(`div`,{class:`text-content-muted text-xs mb-1`},`Last Seen`,-1),S(`div`,$n,[S(`div`,{class:w([`w-2 h-2 rounded-full`,E(e.last_seen).color===`text-green-600 dark:text-green-400`?`bg-green-400`:``,E(e.last_seen).color===`text-yellow-600 dark:text-yellow-400`?`bg-yellow-400`:``,E(e.last_seen).color===`text-red-600 dark:text-red-400`?`bg-red-400`:``])},null,2),S(`span`,{class:w(`${E(e.last_seen).color} text-sm`),title:v(z)(e.last_seen)},n(T(e.last_seen)),11,er)])]),S(`div`,null,[i[37]||=S(`div`,{class:`text-content-muted text-xs mb-1`},`Distance`,-1),S(`span`,tr,n(f(e)),1)])]),e.latitude!==null&&e.longitude!==null?(h(),C(`div`,nr,[i[40]||=S(`div`,{class:`text-content-muted text-xs mb-1`},`Location`,-1),S(`div`,rr,[S(`span`,ir,n(e.latitude.toFixed(4))+`, `+n(e.longitude.toFixed(4)),1),S(`div`,ar,[S(`button`,{onClick:t=>D(e.latitude,e.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`},[...i[38]||=[S(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[S(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`,stroke:`currentColor`,"stroke-width":`2`}),S(`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,or),S(`button`,{onClick:t=>O(e.latitude,e.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`},[...i[39]||=[S(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[S(`path`,{d:`M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z`,stroke:`currentColor`,"stroke-width":`2`}),S(`circle`,{cx:`12`,cy:`10`,r:`3`,stroke:`currentColor`,"stroke-width":`2`})],-1)]],8,sr)])])])):g(``,!0),S(`div`,cr,[S(`div`,lr,[i[41]||=S(`div`,{class:`text-content-muted text-xs mb-1`},`SNR`,-1),S(`span`,ur,n(v(V)(e.snr)),1)]),S(`div`,dr,[i[42]||=S(`div`,{class:`text-content-muted text-xs mb-1`},`Adverts`,-1),S(`span`,fr,n(e.advert_count),1)]),S(`div`,pr,[i[43]||=S(`div`,{class:`text-content-muted text-xs mb-1`},`First Seen`,-1),S(`span`,{class:`text-content-primary dark:text-content-primary text-sm`,title:v(z)(e.first_seen)},n(T(e.first_seen)),9,mr)])])])],8,Vn))),128))])]))}}),gr={class:`space-y-6`},_r={key:0,class:`flex items-center justify-center py-12`},vr={class:`text-center`},yr={key:1,class:`bg-red-50 dark:bg-accent-red/10 border border-red-300 dark:border-accent-red/20 rounded-[15px] p-6`},br={class:`flex items-center gap-3`},xr={class:`text-red-500 dark:text-accent-red/80 text-sm`},Sr={key:0,class:``},Cr={class:`flex items-center justify-between`},wr={class:`flex items-center gap-3`},Tr={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`},Er={class:`flex items-center gap-2`},Dr=[`value`,`disabled`],Or=[`value`],kr={class:`flex items-center gap-2`},Ar={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`},jr={class:`bg-background dark:bg-background/30 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4 mt-4 space-y-4`},Mr={class:`grid grid-cols-1 md:grid-cols-3 gap-4`},Nr={key:1,class:`text-center py-12`},Pr={key:2,class:`text-center py-12`},Fr=f({name:`NeighborsView`,__name:`Neighbors`,setup(e){let t=E(),r=O(),o=k(),s=D,u={0:`#6b7280`,1:`#60a5fa`,2:`#34d399`,3:`#a855f7`,4:`#f59e0b`},f=y(()=>r.advertsByType),p=y(()=>r.isLoading),v=l(null),A=l(r.currentHours),N=[{label:`2 Days`,value:48},{label:`7 Days`,value:168},{label:`14 Days`,value:336},{label:`30 Days`,value:720}],P=async e=>{A.value=e,await r.fetchAll(e)},I=l(W(`neighbors_compactView`,!1)),L=l(W(`neighbors_showMapLegend`,typeof window<`u`?window.innerWidth>=1024:!0)),R=l(W(`neighbors_showAllMapContacts`,!1)),z=l(W(`neighbors_showFilters`,!1)),B=l(W(`neighbors_filters`,{zeroHop:`true`,routeType:`all`,searchText:``}));a(I,e=>U(`neighbors_compactView`,e)),a(L,e=>U(`neighbors_showMapLegend`,e)),a(R,e=>U(`neighbors_showAllMapContacts`,e)),a(z,e=>U(`neighbors_showFilters`,e)),a(B,e=>U(`neighbors_filters`,e),{deep:!0});let te=l(!1),V=l(!1),H=l(!1),G=l(null),K=l(null),q=l(null),J=l(null),ne=l(!1),re=l(null),ie=y(()=>{if(!J.value)return null;let e=J.value;return{id:e.id,pubkey:e.pubkey,node_name:e.node_name,contact_type:e.contact_type,latitude:e.latitude,longitude:e.longitude,rssi:e.rssi,snr:e.snr,route_type:e.route_type,last_seen:e.last_seen,first_seen:e.first_seen,advert_count:e.advert_count,timestamp:e.timestamp,is_repeater:e.is_repeater,is_new_neighbor:e.is_new_neighbor,zero_hop:e.zero_hop}}),ae=y(()=>t.stats?.config?.repeater?.latitude),oe=y(()=>t.stats?.config?.repeater?.longitude),ce=y(()=>t.stats===null&&t.isLoading),le=e=>e.filter(e=>{if(B.value.zeroHop!==`all`){let t=e.zero_hop;if(B.value.zeroHop===`true`&&!t||B.value.zeroHop===`false`&&t)return!1}if(B.value.routeType!==`all`){let t=e.route_type;if(B.value.routeType===`direct`&&t!==2||B.value.routeType===`transport_direct`&&t!==3||B.value.routeType===`flood`&&t!==1||B.value.routeType===`transport_flood`&&t!==0)return!1}if(B.value.searchText){let t=B.value.searchText.toLowerCase(),n=e.node_name?.toLowerCase()||``,r=e.pubkey.toLowerCase();if(!n.includes(t)&&!r.includes(t))return!1}return!0}),ue=()=>{B.value={zeroHop:`all`,routeType:`all`,searchText:``}},Y=y(()=>B.value.zeroHop!==`all`||B.value.routeType!==`all`||B.value.searchText!==``),de=y(()=>{let e={};for(let[t,n]of Object.entries(f.value))e[t]=le(n);return e}),fe=y(()=>Object.entries(s).filter(([e])=>de.value[e]?.length>0).sort(([e],[t])=>parseInt(e)-parseInt(t))),pe=y(()=>Object.values(f.value).flat().filter(e=>{let t=e.latitude,n=e.longitude;return t!=null&&t!==0&&n!=null&&n!==0&&typeof t==`number`&&typeof n==`number`&&!isNaN(t)&&!isNaN(n)&&(R.value||e.zero_hop===!0)})),me=()=>r.fetchAll(A.value),he=l(),ge=e=>{he.value?.highlightNode(e)},_e=e=>{he.value?.unhighlightNode(e)},ve=async e=>{let n=e;G.value=null,K.value=null,H.value=!0,q.value=n.node_name||`Unknown Node`,V.value=!0;try{let e=t.stats?.config?.mesh?.path_hash_mode??0,r=(e===2?3:e===1?2:1)*2,i=`0x${parseInt(n.pubkey.substring(0,r),16).toString(16).padStart(r,`0`)}`,a=await T.pingNeighbor(i,10);a.success&&a.data?G.value=a.data:(K.value=a.error||`Unknown error occurred`,console.error(`Failed to ping neighbor:`,a.error))}catch(e){console.error(`Error pinging neighbor:`,e),K.value=e instanceof Error?e.message:`Unknown error occurred`}finally{H.value=!1}},ye=()=>{V.value=!1,G.value=null,K.value=null,q.value=null},be=e=>{J.value=e,te.value=!0},xe=e=>{re.value=e,ne.value=!0},Se=()=>{ne.value=!1,re.value=null},Ce=()=>{te.value=!1,J.value=null},we=async e=>{try{await T.deleteAdvert(e),await r.fetchAll(A.value),Ce()}catch(e){console.error(`Error deleting neighbor:`,e)}};return i(()=>{o.ensure(`neighbors`)}),(e,t)=>(h(),C(`div`,gr,[p.value?(h(),C(`div`,_r,[S(`div`,vr,[_(j,{size:`lg`,class:`mx-auto mb-4`}),t[9]||=S(`p`,{class:`text-content-secondary dark:text-content-muted`},`Loading neighbor data...`,-1)])])):v.value?(h(),C(`div`,yr,[S(`div`,br,[t[11]||=S(`svg`,{class:`w-5 h-5 text-red-600 dark:text-accent-red`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),S(`div`,null,[t[10]||=S(`h3`,{class:`text-red-600 dark:text-accent-red font-medium`},`Error Loading Neighbors`,-1),S(`p`,xr,n(v.value),1)])])])):(h(),C(x,{key:2},[_(nn,{ref_key:`networkMapRef`,ref:he,adverts:pe.value,"base-latitude":ae.value,"base-longitude":oe.value,"stats-loading":ce.value,"show-legend":L.value,"onUpdate:showLegend":t[0]||=e=>L.value=e},null,8,[`adverts`,`base-latitude`,`base-longitude`,`stats-loading`,`show-legend`]),Object.keys(f.value).length>0?(h(),C(`div`,Sr,[S(`div`,Cr,[t[16]||=S(`span`,{class:`text-content-primary dark:text-content-primary text-lg font-semibold`},null,-1),S(`div`,wr,[S(`div`,Tr,[S(`button`,{onClick:t[1]||=e=>I.value=!1,class:w([`p-2 rounded-md transition-colors`,I.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`},[...t[12]||=[S(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[S(`rect`,{x:`3`,y:`3`,width:`18`,height:`6`,rx:`2`,stroke:`currentColor`,"stroke-width":`2`}),S(`rect`,{x:`3`,y:`12`,width:`18`,height:`6`,rx:`2`,stroke:`currentColor`,"stroke-width":`2`})],-1)]],2),S(`button`,{onClick:t[2]||=e=>I.value=!0,class:w([`p-2 rounded-md transition-colors`,I.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`},[...t[13]||=[S(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[S(`rect`,{x:`3`,y:`3`,width:`18`,height:`4`,rx:`2`,stroke:`currentColor`,"stroke-width":`2`}),S(`rect`,{x:`3`,y:`10`,width:`18`,height:`4`,rx:`2`,stroke:`currentColor`,"stroke-width":`2`}),S(`rect`,{x:`3`,y:`17`,width:`18`,height:`4`,rx:`2`,stroke:`currentColor`,"stroke-width":`2`})],-1)]],2)]),S(`div`,Er,[S(`select`,{value:A.value,onChange:t[3]||=e=>P(+e.target.value),disabled:p.value,class:`text-xs px-2 py-1.5 rounded-lg bg-background-mute dark:bg-white/10 text-content-secondary dark:text-content-primary border border-stroke-subtle dark:border-stroke/20 focus:outline-none focus:border-primary/50 disabled:opacity-50`},[(h(),C(x,null,m(N,e=>S(`option`,{key:e.value,value:e.value},n(e.label),9,Or)),64))],40,Dr)]),S(`div`,kr,[S(`button`,{onClick:t[4]||=e=>R.value=!R.value,class:w([`px-3 py-1.5 text-xs rounded-lg transition-colors border`,R.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`])},` Map: `+n(R.value?`All Contacts`:`Zero Hop`),3),S(`button`,{onClick:t[5]||=e=>z.value=!z.value,class:w([`px-3 py-1.5 text-xs rounded-lg transition-colors border`,Y.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`])},[t[14]||=S(`svg`,{class:`w-4 h-4 inline mr-1`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[S(`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),t[15]||=b(` Filters `,-1),Y.value?(h(),C(`span`,Ar,` Active `)):g(``,!0)],2),Y.value?(h(),C(`button`,{key:0,onClick:ue,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 `)):g(``,!0)])])]),c(S(`div`,jr,[S(`div`,Mr,[S(`div`,null,[t[18]||=S(`label`,{class:`block text-xs font-medium text-content-secondary dark:text-content-muted mb-1`},`Zero Hop`,-1),c(S(`select`,{"onUpdate:modelValue":t[6]||=e=>B.value.zeroHop=e,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`},[...t[17]||=[S(`option`,{value:`all`},`All Nodes`,-1),S(`option`,{value:`true`},`Zero Hop Only`,-1),S(`option`,{value:`false`},`Multi-Hop Only`,-1)]],512),[[M,B.value.zeroHop]])]),S(`div`,null,[t[20]||=S(`label`,{class:`block text-xs font-medium text-content-secondary dark:text-content-muted mb-1`},`Route Type`,-1),c(S(`select`,{"onUpdate:modelValue":t[7]||=e=>B.value.routeType=e,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`},[...t[19]||=[d(``,5)]],512),[[M,B.value.routeType]])]),S(`div`,null,[t[21]||=S(`label`,{class:`block text-xs font-medium text-content-secondary dark:text-content-muted mb-1`},`Search`,-1),c(S(`input`,{"onUpdate:modelValue":t[8]||=e=>B.value.searchText=e,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),[[ee,B.value.searchText]])])])],512),[[F,z.value]])])):g(``,!0),(h(!0),C(x,null,m(fe.value,([e,t])=>(h(),C(`div`,{key:e,class:`space-y-6`},[_(hr,{"contact-type":t,"contact-type-key":e,adverts:de.value[e],"original-count":f.value[e]?.length||0,color:u[parseInt(e)],"base-latitude":ae.value,"base-longitude":oe.value,"is-compact-view":I.value,"is-first-table":!1,"show-view-toggle":!1,onHighlightNode:ge,onUnhighlightNode:_e,onMenuPing:ve,onMenuDelete:be,onShowDetails:xe},null,8,[`contact-type`,`contact-type-key`,`adverts`,`original-count`,`color`,`base-latitude`,`base-longitude`,`is-compact-view`])]))),128)),fe.value.length===0&&Object.keys(f.value).length===0?(h(),C(`div`,Nr,[t[22]||=d(`

No Neighbors Found

No mesh neighbors have been discovered in your area yet.

`,3),S(`button`,{onClick:me,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 `)])):fe.value.length===0&&Y.value?(h(),C(`div`,Pr,[t[23]||=d(`

No neighbors match your filters

Try adjusting your filter criteria to see more results.

`,3),S(`button`,{onClick:ue,class:`px-4 py-2 bg-primary/20 text-primary border border-primary/30 rounded-lg hover:bg-primary/30 transition-colors`},` Clear Filters `)])):g(``,!0)],64)),_(se,{show:te.value,neighbor:ie.value,onClose:Ce,onDelete:we},null,8,[`show`,`neighbor`]),_(Be,{show:V.value,"node-name":q.value,result:G.value,error:K.value,loading:H.value,onClose:ye},null,8,[`show`,`node-name`,`result`,`error`,`loading`]),_(Dt,{"is-open":ne.value,neighbor:re.value,"base-latitude":ae.value,"base-longitude":oe.value,onClose:Se},null,8,[`is-open`,`neighbor`,`base-latitude`,`base-longitude`])]))}});export{Fr as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/RFNoiseFloor-DfoNL6D7.js b/repeater/web/html/assets/RFNoiseFloor-DfoNL6D7.js deleted file mode 100644 index 686f6c3..0000000 --- a/repeater/web/html/assets/RFNoiseFloor-DfoNL6D7.js +++ /dev/null @@ -1 +0,0 @@ -import{a as e}from"./index-CG181k2K.js";export{e as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/RFNoiseFloor-ki1ynpAI.js b/repeater/web/html/assets/RFNoiseFloor-ki1ynpAI.js new file mode 100644 index 0000000..62d319c --- /dev/null +++ b/repeater/web/html/assets/RFNoiseFloor-ki1ynpAI.js @@ -0,0 +1 @@ +import{o as e}from"./index-BpKhPa08.js";export{e as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/RestartModal-DDp7H13-.js b/repeater/web/html/assets/RestartModal-DDp7H13-.js deleted file mode 100644 index e2b2425..0000000 --- a/repeater/web/html/assets/RestartModal-DDp7H13-.js +++ /dev/null @@ -1 +0,0 @@ -import{B as e,Ct as t,R as n,Y as r,c as i,g as a,i as o,k as s,l as c,m as l,r as u,s as d,u as f,w as p}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{t as m}from"./api-DBiYn0RS.js";import{t as h}from"./Spinner-CYvUNW0P.js";import{g,l as _}from"./index-CG181k2K.js";var v={class:`modal-card max-w-md shadow-xl`},y={key:0,class:`flex flex-col items-center gap-5 py-2`},b={class:`flex items-start gap-3 mb-4`},x={class:`text-base font-semibold text-content-primary dark:text-content-primary`},S={class:`mt-1 text-sm text-content-secondary dark:text-content-muted`},C=50,w=5,T=a({__name:`RestartModal`,props:{modelValue:{type:Boolean},message:{},title:{default:`Service Restart Required`}},emits:[`update:modelValue`],setup(a,{emit:T}){let E=a,D=T,O=r(!1),k=r(!1),A=null,j=0,M=0;function N(){O.value&&!k.value||(O.value=!1,k.value=!1,A&&=(clearTimeout(A),null),j=0,M=0,D(`update:modelValue`,!1))}async function P(){O.value=!0,k.value=!1;try{await m.post(`/restart_service`,{})}catch{}j=0,M=0,A=setTimeout(F,1e4)}function F(){j++,fetch(`/api/needs_setup`,{method:`GET`}).then(e=>{e.ok?(M++,M>=w?window.location.reload():A=setTimeout(F,1e3)):(M=0,I())}).catch(()=>{M=0,I()})}function I(){jE.modelValue,e=>{e||(O.value=!1,k.value=!1,A&&=(clearTimeout(A),null),j=0,M=0)}),p(()=>{A&&clearTimeout(A)}),(n,r)=>(s(),i(o,{to:`body`},[l(_,{"enter-active-class":`transition-opacity duration-200`,"enter-from-class":`opacity-0`,"leave-active-class":`transition-opacity duration-200`,"leave-to-class":`opacity-0`},{default:e(()=>[a.modelValue?(s(),f(`div`,{key:0,class:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:g(N,[`self`])},[d(`div`,v,[O.value?(s(),f(`div`,y,[l(h,{size:`lg`}),r[0]||=d(`div`,{class:`text-center`},[d(`h3`,{class:`text-base font-semibold text-content-primary dark:text-content-primary`},` Restarting… `),d(`p`,{class:`mt-1 text-sm text-content-secondary dark:text-content-muted`},` Please wait while the service restarts. This may take up to a minute. `)],-1)])):k.value?(s(),f(u,{key:1},[r[1]||=d(`div`,{class:`flex items-start gap-3 mb-4`},[d(`div`,{class:`flex-shrink-0 w-10 h-10 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center`},[d(`svg`,{class:`w-5 h-5 text-red-600 dark:text-red-400`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[d(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 9v2m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z`})])]),d(`div`,null,[d(`h3`,{class:`text-base font-semibold text-content-primary dark:text-content-primary`},` Service Did Not Restart `),d(`p`,{class:`mt-1 text-sm text-content-secondary dark:text-content-muted`},` The service did not respond after 60 seconds. Please log into the device and check the system logs. `)])],-1),d(`div`,{class:`modal-actions`},[d(`button`,{onClick:N,class:`modal-btn-cancel`},`Dismiss`)])],64)):(s(),f(u,{key:2},[d(`div`,b,[r[2]||=d(`div`,{class:`flex-shrink-0 w-10 h-10 rounded-full bg-amber-100 dark:bg-amber-900/30 flex items-center justify-center`},[d(`svg`,{class:`w-5 h-5 text-amber-600 dark:text-amber-400`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[d(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 9v2m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z`})])],-1),d(`div`,null,[d(`h3`,x,t(a.title),1),d(`p`,S,t(a.message),1)])]),d(`div`,{class:`modal-actions`},[d(`button`,{onClick:N,class:`modal-btn-cancel`},`Cancel`),d(`button`,{onClick:P,class:`modal-btn-primary`},`Restart`)])],64))])])):c(``,!0)]),_:1})]))}});export{T as t}; \ No newline at end of file diff --git a/repeater/web/html/assets/RoomServers-C6RN6JrC.js b/repeater/web/html/assets/RoomServers-C6RN6JrC.js new file mode 100644 index 0000000..f23ceb0 --- /dev/null +++ b/repeater/web/html/assets/RoomServers-C6RN6JrC.js @@ -0,0 +1 @@ +import{B as e,Ct as t,E as n,R as r,V as i,Y as a,c as o,f as ee,g as te,i as s,j as c,k as l,l as u,m as d,o as f,p,r as m,s as h,u as g,xt as _}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{l as ne,s as v,t as re,u as y}from"./runtime-dom.esm-bundler-fKU3dih-.js";import{t as b}from"./api-C0ctTLHN.js";import{t as ie}from"./system-Dx7MrhAz.js";import{t as ae}from"./Spinner-CYvUNW0P.js";import{n as oe}from"./index-BpKhPa08.js";import{t as se}from"./ConfirmDialog-XtZRdfP5.js";import{t as ce}from"./MessageDialog-Bs1UHPdw.js";import{t as le}from"./LocationPicker-Beqlkai5.js";import{n as ue,t as de}from"./preferences-6MHglq--.js";var fe={class:`p-6 space-y-6`},pe={key:0,class:`grid grid-cols-1 md:grid-cols-3 gap-4`},me={class:`glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-5`},he={class:`flex items-center justify-between`},ge={class:`text-3xl font-bold text-content-primary dark:text-content-primary mb-1`},_e={class:`glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-5`},ve={class:`flex items-center justify-between`},ye={class:`text-3xl font-bold text-primary mb-1`},be={class:`glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-5`},xe={class:`flex items-center justify-between`},Se={key:0,class:`w-6 h-6 text-accent-green`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Ce={key:1,class:`w-6 h-6 text-accent-yellow`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},we={class:`glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-6`},Te={key:0,class:`flex items-center justify-center py-12`},Ee={class:`text-center`},De={key:1,class:`flex items-center justify-center py-12`},Oe={class:`text-center`},ke={class:`text-content-secondary dark:text-content-muted text-sm mb-4`},Ae={key:2,class:`space-y-4`},je={class:`flex items-start justify-between`},Me={class:`flex-1`},Ne={class:`flex items-center gap-3 mb-4`},Pe={class:`relative`},Fe={key:0,class:`absolute inset-0 bg-accent-green/50 rounded-full animate-ping`},Ie={class:`text-xl font-bold text-content-primary dark:text-content-primary`},Le={key:0,class:`text-content-muted dark:text-content-muted text-sm`},Re={class:`grid grid-cols-1 md:grid-cols-2 gap-3 text-sm mb-3`},ze={class:`text-content-primary dark:text-content-primary/90 ml-2`},Be={class:`flex items-center gap-2`},Ve={key:0,class:`text-content-primary dark:text-content-primary/90 font-mono ml-2 text-xs`},He={key:1,class:`text-content-muted dark:text-content-muted ml-2 text-xs`},Ue=[`onClick`],We={class:`text-content-primary dark:text-content-primary/90 ml-2`},Ge={key:0},Ke={class:`text-content-primary dark:text-content-primary/90 ml-2`},qe={key:0,class:`text-accent-green`},Je={key:1,class:`text-content-muted dark:text-content-muted`},Ye={key:2,class:`text-primary`},Xe={key:0,class:`text-xs text-content-muted dark:text-content-muted font-mono`},Ze={class:`ml-4 flex flex-wrap gap-2`},Qe=[`onClick`,`disabled`,`title`],$e=[`onClick`,`disabled`,`title`],et=[`onClick`],tt=[`onClick`],nt={key:3,class:`text-center py-12 text-content-secondary dark:text-content-muted`},rt={class:`modal-card max-w-2xl w-full max-h-[90vh] overflow-y-auto`},it={class:`modal-field-label-row`},at={key:0},ot={key:1,class:`text-content-secondary dark:text-content-muted text-sm`},st={class:`grid grid-cols-2 gap-5`},ct={class:`grid grid-cols-2 gap-5`},lt={class:`modal-card max-w-2xl w-full max-h-[90vh] overflow-y-auto`},ut={class:`modal-field-label-row`},dt={key:0},ft={key:1,class:`text-content-secondary dark:text-content-muted text-sm`},pt={class:`grid grid-cols-2 gap-5`},mt={class:`grid grid-cols-2 gap-5`},ht={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`},gt={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`},_t={class:`relative flex items-center justify-between`},vt={class:`flex items-center gap-4`},yt={class:`text-content-secondary dark:text-content-muted text-sm flex items-center gap-2`},bt={class:`text-primary font-semibold`},xt={class:`flex items-center gap-2`},St={class:`bg-primary/30 px-1.5 py-0.5 rounded-full text-[10px]`},Ct={class:`flex-1 overflow-y-auto mb-4 space-y-3`},wt={key:0,class:`flex items-center justify-center py-12`},Tt={class:`text-center`},Et={key:1,class:`flex items-center justify-center py-12`},Dt={class:`text-center`},Ot={class:`text-content-secondary dark:text-content-muted text-sm mb-4`},kt={key:2,class:`space-y-3`},At={class:`relative flex items-start justify-between gap-3`},jt={class:`flex-1 min-w-0`},Mt={class:`flex items-center gap-2 mb-3`},Nt={class:`flex items-center gap-2 flex-wrap`},Pt={key:0,class:`text-primary text-sm font-bold`},Ft={key:1,class:`text-primary/80 text-xs font-mono bg-primary/10 px-2 py-1 rounded-md border border-primary/20`},It={key:2,class:`text-content-muted dark:text-content-muted text-xs`},Lt={class:`text-content-secondary dark:text-content-muted text-xs flex items-center gap-1`},Rt={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`},zt={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`},Bt=[`onClick`],Vt={key:0,class:`text-center pt-4`},Ht={key:1,class:`text-center pt-4`},Ut={class:`flex items-center justify-center gap-2 text-content-secondary dark:text-content-muted text-sm`},Wt={key:3,class:`flex items-center justify-center h-full`},Gt={class:`relative overflow-hidden rounded-[15px] border-t border-stroke-subtle dark:border-white/20 pt-4 mt-4`},Kt={class:`relative space-y-3`},qt={class:`flex gap-3`},Jt={class:`flex-1 relative`},Yt=[`onKeydown`],Xt=[`disabled`],Zt={key:0,class:`fixed inset-0 bg-black/70 backdrop-blur-md flex items-center justify-center z-[350] p-4`},Qt={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`},$t={class:`flex items-center justify-between mb-4 pb-4 border-b border-stroke-subtle dark:border-white/10`},en={class:`text-content-secondary dark:text-content-primary/70 text-sm mt-1`},tn={class:`text-primary`},nn={class:`flex-1 overflow-y-auto space-y-3`},rn={key:0,class:`text-center py-12`},an={class:`space-y-2`},on={class:`flex items-center justify-between`},sn={class:`flex items-center gap-2`},cn={class:`text-content-primary dark:text-content-primary font-semibold`},ln={class:`flex items-center gap-2`},un={class:`text-content-secondary dark:text-content-muted text-xs`},dn=[`onClick`],fn={class:`space-y-1 text-xs`},pn={class:`flex items-center gap-2`},mn={class:`text-primary font-mono bg-primary/10 px-2 py-0.5 rounded`},hn={class:`flex items-center gap-2`},gn={class:`text-primary font-mono bg-primary/10 px-2 py-0.5 rounded text-[10px] break-all`},_n={class:`flex items-center justify-between text-xs text-content-secondary dark:text-content-muted`},vn={class:`flex items-center gap-4`},yn={key:0},bn={key:1},xn={key:0},x=te({name:`RoomServersView`,__name:`RoomServers`,setup(te){let x=ie(),Sn=f(()=>x.stats?.config?.repeater?.latitude??0),Cn=f(()=>x.stats?.config?.repeater?.longitude??0),S=a(!1),C=a(!1),w=a(!1),T=a(null),E=a(null),D=a(!1),O=a(!1),k=a(!1),A=a(null),j=a(``),M=a(!1),N=a(!1),P=a(new Set),wn=f(()=>E.value?.configured?.filter(e=>e.registered).length??0),Tn=f(()=>E.value?.configured?.length??0),F=f(()=>wn.value===Tn.value),I=a(!1),L=a(``),En=a(!1),Dn=a({message:``,variant:`success`}),R=a(!1),z=a(``),On=a(``),B=a([]),V=a(!1),H=a(null),U=a(``),W=a(de(`roomServers_messagesLimit`,50)),G=a(0),K=a(!0);r(W,e=>ue(`roomServers_messagesLimit`,e));let q=a([]),kn=a(!1),J=a({name:``,identity_key:``,type:`room_server`,settings:{node_name:``,latitude:0,longitude:0,admin_password:``,guest_password:``}});n(async()=>{await Y()});async function Y(){w.value=!0,T.value=null;try{let e=await b.getIdentities();e.success?E.value=e.data:T.value=e.error||`Failed to load identities`}catch(e){T.value=e instanceof Error?e.message:`Failed to load identities`}finally{w.value=!1}}function An(e){e.latitude=Math.round(e.latitude*1e6)/1e6,e.longitude=Math.round(e.longitude*1e6)/1e6}async function jn(){An(J.value.settings);try{let e=await b.createIdentity(J.value);e.success?(D.value=!1,await Y(),k.value=!0):X(`Failed to create identity: ${e.error}`,`error`)}catch(e){X(`Error creating identity: ${e}`,`error`)}}async function Mn(){let e={...A.value,settings:{...A.value.settings}};An(e.settings),e.name===j.value?delete e.new_name:(e.new_name=e.name,e.name=j.value);try{let t=await b.updateIdentity(e);t.success?(O.value=!1,A.value=null,await Y(),k.value=!0):X(`Failed to update identity: ${t.error}`,`error`)}catch(e){X(`Error updating identity: ${e}`,`error`)}}function Nn(e){L.value=e,I.value=!0}async function Pn(){let e=L.value;I.value=!1;try{let t=await b.deleteIdentity(e);t.success?(await Y(),X(t.message||`Identity deleted successfully!`,`success`)):X(`Failed to delete identity: ${t.error}`,`error`)}catch(e){X(`Error deleting identity: ${e}`,`error`)}finally{L.value=``}}function X(e,t){Dn.value={message:e,variant:t},En.value=!0}async function Fn(e){try{let t=await b.sendRoomServerAdvert(e);t.success?X(t.message||`Advert sent for '${e}'!`,`success`):X(`Failed to send advert: ${t.error}`,`error`)}catch(e){X(`Error sending advert: ${e}`,`error`)}}function In(e){A.value=JSON.parse(JSON.stringify(e)),j.value=A.value.name,delete A.value.new_name,A.value.settings||(A.value.settings={}),A.value.settings.admin_password||(A.value.settings.admin_password=``),A.value.settings.guest_password||(A.value.settings.guest_password=``),A.value.settings.latitude??(A.value.settings.latitude=0),A.value.settings.longitude??(A.value.settings.longitude=0),N.value=!1,O.value=!0}function Ln(){J.value={name:``,identity_key:``,type:`room_server`,settings:{node_name:``,latitude:Sn.value,longitude:Cn.value,admin_password:``,guest_password:``}},M.value=!1}function Rn(){Ln(),D.value=!0}function zn(e){J.value.settings.latitude=e.latitude,J.value.settings.longitude=e.longitude}function Bn(e){A.value&&(A.value.settings.latitude=e.latitude,A.value.settings.longitude=e.longitude)}function Z(){D.value=!1,O.value=!1,A.value=null,M.value=!1,N.value=!1}function Vn(e){P.value.has(e)?P.value.delete(e):P.value.add(e)}async function Hn(e){z.value=e,R.value=!0,G.value=0,K.value=!0,On.value=E.value?.configured.find(t=>t.name===e)?.hash||``,await Un(),await Q(!0)}async function Un(){try{let e=await b.getACLClients({identity_hash:On.value,identity_name:z.value});e.success&&e.data&&(q.value=e.data.clients||[])}catch(e){console.error(`Failed to fetch ACL clients:`,e)}}async function Q(e=!1){e&&(G.value=0,B.value=[]),V.value=!0,H.value=null;try{let t=await b.getRoomMessages({room_name:z.value,limit:W.value,offset:G.value});if(t.success&&t.data){let n=t.data.messages||[];e?B.value=n:B.value=[...B.value,...n],K.value=n.length===W.value}else H.value=t.error||`Failed to load messages`}catch(e){H.value=e instanceof Error?e.message:`Failed to load messages`}finally{V.value=!1}}async function Wn(){G.value+=W.value,await Q(!1)}async function $(){if(U.value.trim())try{let e=await b.postRoomMessage({room_name:z.value,message:U.value,author_pubkey:`server`});e.success?(U.value=``,await Q(!0)):X(`Failed to send message: ${e.error}`,`error`)}catch(e){X(`Error sending message: ${e}`,`error`)}}async function Gn(e){if(confirm(`Are you sure you want to delete this message?`))try{let t=await b.deleteRoomMessage({room_name:z.value,message_id:e});t.success?(await Q(!0),X(`Message deleted successfully`,`success`)):X(`Failed to delete message: ${t.error}`,`error`)}catch(e){X(`Error deleting message: ${e}`,`error`)}}function Kn(){R.value=!1,z.value=``,On.value=``,B.value=[],U.value=``,H.value=null,q.value=[]}function qn(e){return e?new Date(e*1e3).toLocaleString():`Unknown`}async function Jn(e,t){if(confirm(`Are you sure you want to remove this client from the ACL?`))try{let n=await b.removeACLClient({public_key:e,identity_hash:t});n.success?(await Un(),X(`Client removed successfully`,`success`)):X(`Failed to remove client: ${n.error}`,`error`)}catch(e){X(`Error removing client: ${e}`,`error`)}}return(n,r)=>(l(),g(m,null,[h(`div`,fe,[h(`div`,{class:`relative overflow-hidden rounded-[20px] p-6 mb-6 glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10`},[r[30]||=h(`div`,{class:`absolute inset-0 bg-gradient-to-br from-primary/20 via-secondary/10 to-accent-purple/20 opacity-50`},null,-1),r[31]||=h(`div`,{class:`absolute inset-0 bg-gradient-to-tl from-accent-green/10 via-transparent to-primary/10 animate-pulse`},null,-1),h(`div`,{class:`relative flex items-center justify-between`},[r[29]||=ee(`

Room Servers

Manage room server identities and messages

`,1),h(`button`,{onClick:Rn,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`},[...r[28]||=[h(`span`,{class:`flex items-center gap-2`},[h(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[h(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 4v16m8-8H4`})]),p(` Add Room Server `)],-1)]])])]),E.value&&E.value.total_configured>0?(l(),g(`div`,pe,[h(`div`,me,[h(`div`,he,[h(`div`,null,[r[32]||=h(`div`,{class:`text-content-secondary dark:text-content-muted text-xs font-medium mb-2 uppercase tracking-wide`},` Total Configured `,-1),h(`div`,ge,t(Tn.value),1)]),r[33]||=h(`div`,{class:`bg-background-mute dark:bg-white/10 p-3 rounded-[12px]`},[h(`svg`,{class:`w-6 h-6 text-content-secondary dark:text-content-primary/70`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[h(`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)])]),h(`div`,_e,[h(`div`,ve,[h(`div`,null,[r[34]||=h(`div`,{class:`text-content-secondary dark:text-content-muted text-xs font-medium mb-2 uppercase tracking-wide`},` Currently Registered `,-1),h(`div`,ye,t(wn.value),1)]),r[35]||=h(`div`,{class:`bg-primary/20 p-3 rounded-[12px]`},[h(`svg`,{class:`w-6 h-6 text-primary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[h(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M5 13l4 4L19 7`})])],-1)])]),h(`div`,be,[h(`div`,xe,[h(`div`,null,[r[36]||=h(`div`,{class:`text-content-secondary dark:text-content-muted text-xs font-medium mb-2 uppercase tracking-wide`},` Status `,-1),h(`div`,{class:_([`text-3xl font-bold`,F.value?`text-accent-green`:`text-accent-yellow`])},t(F.value?`Synced`:`Out of Sync`),3)]),h(`div`,{class:_([`p-3 rounded-[12px]`,F.value?`bg-accent-green/20`:`bg-accent-yellow/20`])},[F.value?(l(),g(`svg`,Se,[...r[37]||=[h(`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)]])):(l(),g(`svg`,Ce,[...r[38]||=[h(`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),h(`div`,we,[w.value?(l(),g(`div`,Te,[h(`div`,Ee,[d(ae,{class:`mx-auto mb-4`}),r[39]||=h(`div`,{class:`text-content-secondary dark:text-content-primary/70`},` Loading room servers... `,-1)])])):T.value?(l(),g(`div`,De,[h(`div`,Oe,[r[40]||=h(`div`,{class:`text-red-600 dark:text-red-400 mb-2`},`Failed to load room servers`,-1),h(`div`,ke,t(T.value),1),h(`button`,{onClick:Y,class:`btn-primary`},` Retry `)])])):E.value&&E.value.configured.length>0?(l(),g(`div`,Ae,[(l(!0),g(m,null,c(E.value.configured,e=>(l(),g(`div`,{key:e.name,class:`glass-card backdrop-blur-xl rounded-[15px] p-5 border border-stroke-subtle dark:border-white/10`},[h(`div`,je,[h(`div`,Me,[h(`div`,Ne,[h(`div`,Pe,[e.registered?(l(),g(`div`,Fe)):u(``,!0),h(`div`,{class:_([`relative w-3 h-3 rounded-full`,e.registered?`bg-accent-green`:`bg-accent-red`])},null,2)]),h(`h3`,Ie,t(e.name),1),h(`span`,{class:_([`px-3 py-1 text-xs font-semibold rounded-full`,e.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`])},t(e.registered?`● Active`:`○ Inactive`),3),e.hash?(l(),g(`span`,Le,t(e.hash),1)):u(``,!0)]),h(`div`,Re,[h(`div`,null,[r[41]||=h(`span`,{class:`text-content-muted dark:text-content-muted`},`Node Name:`,-1),h(`span`,ze,t(e.settings?.node_name||`Not set`),1)]),h(`div`,Be,[r[42]||=h(`span`,{class:`text-content-muted dark:text-content-muted`},`Identity Key:`,-1),P.value.has(e.name)?(l(),g(`span`,Ve,t(e.identity_key),1)):(l(),g(`span`,He,` •••••••••••••••• `)),h(`button`,{onClick:t=>Vn(e.name),class:`text-primary/70 hover:text-primary text-xs underline`},t(P.value.has(e.name)?`Hide`:`Show`),9,Ue)]),h(`div`,null,[r[43]||=h(`span`,{class:`text-content-muted dark:text-content-muted`},`Location:`,-1),h(`span`,We,t(e.settings?.latitude||0)+`, `+t(e.settings?.longitude||0),1)]),e.settings?.admin_password||e.settings?.guest_password?(l(),g(`div`,Ge,[r[44]||=h(`span`,{class:`text-content-muted dark:text-content-muted`},`Passwords:`,-1),h(`span`,Ke,[e.settings?.admin_password?(l(),g(`span`,qe,`Admin`)):u(``,!0),e.settings?.admin_password&&e.settings?.guest_password?(l(),g(`span`,Je,` / `)):u(``,!0),e.settings?.guest_password?(l(),g(`span`,Ye,`Guest`)):u(``,!0)])])):u(``,!0)]),e.address?(l(),g(`div`,Xe,` Address: `+t(e.address),1)):u(``,!0)]),h(`div`,Ze,[h(`button`,{onClick:t=>Hn(e.name),disabled:!e.registered,class:_([`group px-4 py-2 rounded-[10px] text-xs font-medium transition-all duration-200 flex items-center gap-2`,e.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:e.registered?`Manage messages for this room`:`Room server must be active to manage messages`},[...r[45]||=[h(`svg`,{class:`w-4 h-4 group-hover:rotate-12 transition-transform`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[h(`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),p(` Messages `,-1)]],10,Qe),h(`button`,{onClick:t=>Fn(e.name),disabled:!e.registered,class:_([`group px-4 py-2 rounded-[10px] text-xs font-medium transition-all duration-200 flex items-center gap-2`,e.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:e.registered?`Send advert for this room server`:`Room server must be active to send advert`},[...r[46]||=[h(`svg`,{class:`w-4 h-4 group-hover:scale-110 transition-transform`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[h(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M13 10V3L4 14h7v7l9-11h-7z`})],-1),p(` Send Advert `,-1)]],10,$e),h(`button`,{onClick:t=>In(e),class:`btn-primary-xs`},` Edit `,8,et),h(`button`,{onClick:t=>Nn(e.name),class:`btn-danger-xs`},` Delete `,8,tt)])])]))),128))])):(l(),g(`div`,nt,[r[47]||=h(`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`},[h(`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),r[48]||=h(`p`,{class:`text-lg mb-2`},`No room servers configured`,-1),r[49]||=h(`p`,{class:`text-sm mb-4`},`Add your first room server to get started`,-1),h(`button`,{onClick:Rn,class:`btn-primary`},` + Add Room Server `)]))]),(l(),o(s,{to:`body`},[d(re,{"enter-active-class":`transition-opacity duration-200`,"enter-from-class":`opacity-0`,"leave-active-class":`transition-opacity duration-200`,"leave-to-class":`opacity-0`},{default:e(()=>[D.value?(l(),g(`div`,{key:0,class:`modal-backdrop`,onClick:y(Z,[`self`])},[h(`div`,rt,[h(`div`,{class:`flex items-center justify-between mb-7`},[r[51]||=h(`div`,null,[h(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary`},` Add Room Server `),h(`p`,{class:`text-content-secondary dark:text-content-muted text-sm mt-1`},` Configure a new room server identity `)],-1),h(`button`,{onClick:Z,class:`text-content-secondary dark:text-white/60 hover:text-content-primary dark:hover:text-white transition-colors`},[...r[50]||=[h(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[h(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),h(`form`,{onSubmit:y(jn,[`prevent`]),class:`modal-form`},[h(`div`,null,[r[52]||=h(`label`,{class:`modal-field-label`},[p(`Name `),h(`span`,{class:`text-red-500`},`*`)],-1),i(h(`input`,{"onUpdate:modelValue":r[0]||=e=>J.value.name=e,type:`text`,placeholder:`e.g., MainBBS`,class:`modal-input`},null,512),[[v,J.value.name]])]),h(`div`,null,[h(`div`,it,[r[53]||=h(`span`,{class:`text-xs font-medium text-content-secondary dark:text-content-muted`},`Identity Key (Optional)`,-1),h(`button`,{onClick:r[1]||=e=>M.value=!M.value,type:`button`,class:`text-primary/70 hover:text-primary text-xs underline`},t(M.value?`Hide`:`Show/Edit`),1)]),M.value?(l(),g(`div`,at,[i(h(`input`,{"onUpdate:modelValue":r[2]||=e=>J.value.identity_key=e,type:`text`,placeholder:`Leave empty to auto-generate`,class:`modal-input font-mono`},null,512),[[v,J.value.identity_key]]),r[54]||=h(`p`,{class:`text-content-secondary dark:text-content-muted text-xs mt-1`},` Leave empty to automatically generate a secure key `,-1)])):(l(),g(`div`,ot,` Will be auto-generated if not provided `))]),h(`div`,null,[r[55]||=h(`label`,{class:`modal-field-label`},`Node Name`,-1),i(h(`input`,{"onUpdate:modelValue":r[3]||=e=>J.value.settings.node_name=e,type:`text`,placeholder:`Display name for the room server`,class:`modal-input`},null,512),[[v,J.value.settings.node_name]])]),h(`div`,null,[r[59]||=h(`label`,{class:`modal-field-label`},`Location`,-1),h(`button`,{type:`button`,onClick:r[4]||=e=>S.value=!0,class:`flex items-center gap-1.5 px-2.5 py-1 mb-3 text-xs bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-secondary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors`,title:`Pick location on map`},[...r[56]||=[h(`svg`,{class:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[h(`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`}),h(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 11a3 3 0 11-6 0 3 3 0 016 0z`})],-1),p(` Pick on Map `,-1)]]),h(`div`,st,[h(`div`,null,[r[57]||=h(`label`,{class:`modal-field-label`},`Latitude`,-1),i(h(`input`,{"onUpdate:modelValue":r[5]||=e=>J.value.settings.latitude=e,type:`number`,step:`0.000001`,class:`modal-input`},null,512),[[v,J.value.settings.latitude,void 0,{number:!0}]])]),h(`div`,null,[r[58]||=h(`label`,{class:`modal-field-label`},`Longitude`,-1),i(h(`input`,{"onUpdate:modelValue":r[6]||=e=>J.value.settings.longitude=e,type:`number`,step:`0.000001`,class:`modal-input`},null,512),[[v,J.value.settings.longitude,void 0,{number:!0}]])])])]),h(`div`,ct,[h(`div`,null,[r[60]||=h(`label`,{class:`modal-field-label`},`Admin Password (Optional)`,-1),i(h(`input`,{"onUpdate:modelValue":r[7]||=e=>J.value.settings.admin_password=e,type:`password`,placeholder:`Leave empty for no password`,class:`modal-input`},null,512),[[v,J.value.settings.admin_password]]),r[61]||=h(`p`,{class:`text-content-secondary dark:text-content-muted text-xs mt-1`},`Full access to room server`,-1)]),h(`div`,null,[r[62]||=h(`label`,{class:`modal-field-label`},`Guest Password (Optional)`,-1),i(h(`input`,{"onUpdate:modelValue":r[8]||=e=>J.value.settings.guest_password=e,type:`password`,placeholder:`Leave empty for no password`,class:`modal-input`},null,512),[[v,J.value.settings.guest_password]]),r[63]||=h(`p`,{class:`text-content-secondary dark:text-content-muted text-xs mt-1`},`Read-only access`,-1)])]),h(`div`,{class:`modal-actions`},[h(`button`,{type:`button`,onClick:Z,class:`modal-btn-cancel`},`Cancel`),r[64]||=h(`button`,{type:`submit`,class:`modal-btn-primary`},`Create`,-1)])],32)])])):u(``,!0)]),_:1})])),d(le,{"is-open":S.value,latitude:J.value.settings.latitude,longitude:J.value.settings.longitude,onClose:r[9]||=e=>S.value=!1,onSelect:zn},null,8,[`is-open`,`latitude`,`longitude`]),(l(),o(s,{to:`body`},[d(re,{"enter-active-class":`transition-opacity duration-200`,"enter-from-class":`opacity-0`,"leave-active-class":`transition-opacity duration-200`,"leave-to-class":`opacity-0`},{default:e(()=>[O.value&&A.value?(l(),g(`div`,{key:0,class:`modal-backdrop`,onClick:y(Z,[`self`])},[h(`div`,lt,[h(`div`,{class:`flex items-center justify-between mb-7`},[r[66]||=h(`div`,null,[h(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary`},` Edit Room Server `),h(`p`,{class:`text-content-secondary dark:text-content-muted text-sm mt-1`},` Update room server identity `)],-1),h(`button`,{onClick:Z,class:`text-content-secondary dark:text-white/60 hover:text-content-primary dark:hover:text-white transition-colors`},[...r[65]||=[h(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[h(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),h(`form`,{onSubmit:y(Mn,[`prevent`]),class:`modal-form`},[h(`div`,null,[r[67]||=h(`label`,{class:`modal-field-label`},[p(`Name `),h(`span`,{class:`text-red-500`},`*`)],-1),i(h(`input`,{"onUpdate:modelValue":r[10]||=e=>A.value.name=e,type:`text`,class:`modal-input`},null,512),[[v,A.value.name]])]),h(`div`,null,[h(`div`,ut,[r[68]||=h(`span`,{class:`text-xs font-medium text-content-secondary dark:text-content-muted`},`Identity Key (Optional)`,-1),h(`button`,{onClick:r[11]||=e=>N.value=!N.value,type:`button`,class:`text-primary/70 hover:text-primary text-xs underline`},t(N.value?`Hide`:`Show/Edit`),1)]),N.value?(l(),g(`div`,dt,[i(h(`input`,{"onUpdate:modelValue":r[12]||=e=>A.value.identity_key=e,type:`text`,placeholder:`Leave empty to keep current key`,class:`modal-input font-mono`},null,512),[[v,A.value.identity_key]]),r[69]||=h(`p`,{class:`text-content-secondary dark:text-content-muted text-xs mt-1`},` Leave empty to keep the current identity key `,-1)])):(l(),g(`div`,ft,` Click "Show/Edit" to change the identity key `))]),h(`div`,null,[r[70]||=h(`label`,{class:`modal-field-label`},`Node Name`,-1),i(h(`input`,{"onUpdate:modelValue":r[13]||=e=>A.value.settings.node_name=e,type:`text`,class:`modal-input`},null,512),[[v,A.value.settings.node_name]])]),h(`div`,null,[r[74]||=h(`label`,{class:`modal-field-label`},`Location`,-1),h(`button`,{type:`button`,onClick:r[14]||=e=>C.value=!0,class:`flex items-center gap-1.5 px-2.5 py-1 mb-3 text-xs bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-secondary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors`,title:`Pick location on map`},[...r[71]||=[h(`svg`,{class:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[h(`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`}),h(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 11a3 3 0 11-6 0 3 3 0 016 0z`})],-1),p(` Pick on Map `,-1)]]),h(`div`,pt,[h(`div`,null,[r[72]||=h(`label`,{class:`modal-field-label`},`Latitude`,-1),i(h(`input`,{"onUpdate:modelValue":r[15]||=e=>A.value.settings.latitude=e,type:`number`,step:`0.000001`,class:`modal-input`},null,512),[[v,A.value.settings.latitude,void 0,{number:!0}]])]),h(`div`,null,[r[73]||=h(`label`,{class:`modal-field-label`},`Longitude`,-1),i(h(`input`,{"onUpdate:modelValue":r[16]||=e=>A.value.settings.longitude=e,type:`number`,step:`0.000001`,class:`modal-input`},null,512),[[v,A.value.settings.longitude,void 0,{number:!0}]])])])]),h(`div`,mt,[h(`div`,null,[r[75]||=h(`label`,{class:`modal-field-label`},`Admin Password (Optional)`,-1),i(h(`input`,{"onUpdate:modelValue":r[17]||=e=>A.value.settings.admin_password=e,type:`password`,placeholder:`Leave empty for no password`,class:`modal-input`},null,512),[[v,A.value.settings.admin_password]]),r[76]||=h(`p`,{class:`text-content-secondary dark:text-content-muted text-xs mt-1`},`Full access to room server`,-1)]),h(`div`,null,[r[77]||=h(`label`,{class:`modal-field-label`},`Guest Password (Optional)`,-1),i(h(`input`,{"onUpdate:modelValue":r[18]||=e=>A.value.settings.guest_password=e,type:`password`,placeholder:`Leave empty for no password`,class:`modal-input`},null,512),[[v,A.value.settings.guest_password]]),r[78]||=h(`p`,{class:`text-content-secondary dark:text-content-muted text-xs mt-1`},`Read-only access`,-1)])]),h(`div`,{class:`modal-actions`},[h(`button`,{type:`button`,onClick:Z,class:`modal-btn-cancel`},`Cancel`),r[79]||=h(`button`,{type:`submit`,class:`modal-btn-primary`},`Update`,-1)])],32)])])):u(``,!0)]),_:1})])),d(le,{"is-open":C.value,latitude:A.value?.settings?.latitude,longitude:A.value?.settings?.longitude,onClose:r[19]||=e=>C.value=!1,onSelect:Bn},null,8,[`is-open`,`latitude`,`longitude`])]),d(se,{show:I.value,title:`Delete Room Server`,message:`Are you sure you want to delete '${L.value}'? This action cannot be undone.`,"confirm-text":`Delete`,"cancel-text":`Cancel`,variant:`danger`,onClose:r[20]||=e=>I.value=!1,onConfirm:Pn},null,8,[`show`,`message`]),d(ce,{show:En.value,message:Dn.value.message,variant:Dn.value.variant,onClose:r[21]||=e=>En.value=!1},null,8,[`show`,`message`,`variant`]),d(oe,{modelValue:k.value,"onUpdate:modelValue":r[22]||=e=>k.value=e,message:`Room server settings have been saved. A service restart is required for the changes to take effect.`},null,8,[`modelValue`]),(l(),o(s,{to:`body`},[R.value?(l(),g(`div`,{key:0,class:`fixed inset-0 bg-black/70 backdrop-blur-lg flex items-center justify-center z-[300] p-4`,onClick:r[26]||=y(e=>R.value=!1,[`self`])},[h(`div`,ht,[h(`div`,gt,[r[86]||=h(`div`,{class:`absolute inset-0 bg-gradient-to-r from-secondary/20 via-primary/20 to-accent-purple/20`},null,-1),r[87]||=h(`div`,{class:`absolute inset-0 bg-gradient-to-br from-transparent via-white/5 to-transparent`},null,-1),h(`div`,_t,[h(`div`,vt,[r[82]||=h(`div`,{class:`relative`},[h(`div`,{class:`absolute inset-0 bg-secondary/40 blur-xl rounded-full`}),h(`div`,{class:`relative bg-secondary/20 p-3 rounded-[12px] border border-secondary/30`},[h(`svg`,{class:`w-6 h-6 text-secondary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[h(`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),h(`div`,null,[r[81]||=h(`h2`,{class:`text-2xl font-bold text-content-primary dark:text-content-primary mb-1`},` Room Messages `,-1),h(`p`,yt,[r[80]||=h(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[h(`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),h(`span`,bt,t(z.value),1)])])]),h(`div`,xt,[h(`button`,{onClick:r[23]||=e=>kn.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`},[r[83]||=h(`svg`,{class:`w-4 h-4 group-hover:scale-110 transition-transform`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[h(`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),r[84]||=h(`span`,{class:`hidden sm:inline`},`Sessions`,-1),h(`span`,St,t(q.value.length),1)]),h(`button`,{onClick:Kn,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`},[...r[85]||=[h(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[h(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])])])]),h(`div`,Ct,[V.value&&B.value.length===0?(l(),g(`div`,wt,[h(`div`,Tt,[d(ae,{class:`mx-auto mb-4`}),r[88]||=h(`div`,{class:`text-content-secondary dark:text-content-primary/70`},` Loading messages... `,-1)])])):H.value?(l(),g(`div`,Et,[h(`div`,Dt,[r[89]||=h(`div`,{class:`text-red-600 dark:text-red-400 mb-2`},`Failed to load messages`,-1),h(`div`,Ot,t(H.value),1),h(`button`,{onClick:r[24]||=e=>Q(!0),class:`btn-primary`},` Retry `)])])):B.value.length>0?(l(),g(`div`,kt,[(l(!0),g(m,null,c(B.value,(e,n)=>(l(),g(`div`,{key:e.id||n,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`},[r[94]||=h(`div`,{class:`absolute inset-0 bg-gradient-to-r from-secondary/5 to-transparent opacity-0 group-hover:opacity-100 transition-opacity`},null,-1),h(`div`,At,[h(`div`,jt,[h(`div`,Mt,[h(`div`,Nt,[r[91]||=h(`div`,{class:`w-6 h-6 rounded-full bg-gradient-to-br from-primary/30 to-secondary/30 flex items-center justify-center`},[h(`svg`,{class:`w-3 h-3 text-content-secondary dark:text-content-primary/70`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[h(`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),e.author_name?(l(),g(`span`,Pt,t(e.author_name),1)):u(``,!0),e.author_pubkey?(l(),g(`span`,Ft,t(e.author_pubkey.substring(0,8))+`... `,1)):(l(),g(`span`,It,` Anonymous `)),r[92]||=h(`span`,{class:`text-content-muted dark:text-content-muted/60 text-xs`},`•`,-1),h(`span`,Lt,[r[90]||=h(`svg`,{class:`w-3 h-3`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[h(`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),p(` `+t(qn(e.timestamp)),1)]),e.id?(l(),g(`span`,Rt,` #`+t(e.id),1)):u(``,!0)])]),h(`div`,zt,t(e.message_text),1)]),h(`button`,{onClick:t=>Gn(e.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`},[...r[93]||=[h(`svg`,{class:`w-4 h-4 group-hover/delete:rotate-12 transition-transform`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[h(`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,Bt)])]))),128)),K.value&&!V.value?(l(),g(`div`,Vt,[h(`button`,{onClick:Wn,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`},[...r[95]||=[h(`svg`,{class:`w-4 h-4 group-hover:translate-y-1 transition-transform`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[h(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M19 9l-7 7-7-7`})],-1),p(` Load More Messages `,-1)]])])):V.value?(l(),g(`div`,Ht,[h(`div`,Ut,[d(ae,{size:`sm`}),r[96]||=p(` Loading... `,-1)])])):u(``,!0)])):(l(),g(`div`,Wt,[...r[97]||=[h(`div`,{class:`text-center py-12`},[h(`div`,{class:`relative mb-6`},[h(`div`,{class:`absolute inset-0 bg-secondary/20 blur-3xl rounded-full`}),h(`div`,{class:`relative bg-gradient-to-br from-secondary/20 to-primary/20 p-6 rounded-[20px] inline-block border border-stroke-subtle dark:border-white/10`},[h(`svg`,{class:`w-16 h-16 text-content-muted dark:text-content-muted/70`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[h(`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`})])])]),h(`p`,{class:`text-xl font-bold text-content-primary dark:text-content-primary mb-2`},` No messages yet `),h(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},` Be the first to start the conversation `)],-1)]]))]),h(`div`,Gt,[r[100]||=h(`div`,{class:`absolute inset-0 bg-gradient-to-t from-primary/5 to-transparent pointer-events-none`},null,-1),h(`div`,Kt,[h(`div`,qt,[h(`div`,Jt,[i(h(`textarea`,{"onUpdate:modelValue":r[25]||=e=>U.value=e,onKeydown:[ne(y($,[`ctrl`]),[`enter`]),ne(y($,[`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,Yt),[[v,U.value]])]),h(`button`,{onClick:$,disabled:!U.value.trim(),class:_([`group px-6 py-3 rounded-[12px] transition-all duration-200 flex items-center justify-center gap-2 font-medium`,U.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`])},[...r[98]||=[h(`svg`,{class:`w-5 h-5 group-hover:translate-x-1 transition-transform`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[h(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 19l9 2-9-18-9 18 9-2zm0 0v-8`})],-1),h(`span`,{class:`hidden sm:inline`},`Send`,-1)]],10,Xt)]),r[99]||=h(`p`,{class:`text-content-secondary dark:text-content-muted/60 text-xs flex items-center gap-2`},[h(`svg`,{class:`w-3 h-3`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[h(`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`})]),p(` Press Ctrl+Enter to send message quickly `)],-1)])])])])):u(``,!0)])),(l(),o(s,{to:`body`},[kn.value?(l(),g(`div`,Zt,[h(`div`,Qt,[h(`div`,$t,[h(`div`,null,[r[102]||=h(`h2`,{class:`text-xl font-bold text-content-primary dark:text-content-primary`},` Active Sessions `,-1),h(`p`,en,[r[101]||=p(` Room: `,-1),h(`span`,tn,t(z.value),1)])]),h(`button`,{onClick:r[27]||=e=>kn.value=!1,class:`text-content-secondary dark:text-content-primary/70 hover:text-content-primary dark:hover:text-content-primary transition-colors`},[...r[103]||=[h(`svg`,{class:`w-6 h-6`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[h(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),h(`div`,nn,[q.value.length===0?(l(),g(`div`,rn,[...r[104]||=[h(`div`,{class:`text-content-secondary dark:text-content-muted`},`No active sessions found`,-1)]])):u(``,!0),(l(!0),g(m,null,c(q.value,(e,n)=>(l(),g(`div`,{key:e.public_key_full||n,class:`glass-card backdrop-blur-xl rounded-[10px] p-4 border border-stroke-subtle dark:border-white/10`},[h(`div`,an,[h(`div`,on,[h(`div`,sn,[h(`span`,cn,t(e.identity_name||`Unknown`),1),h(`span`,{class:_([`px-2 py-0.5 text-xs font-medium rounded`,e.permissions===`admin`?`bg-accent-green/20 text-accent-green`:`bg-secondary/20 text-secondary`])},t(e.permissions),3)]),h(`div`,ln,[h(`span`,un,t(e.identity_type),1),h(`button`,{onClick:t=>Jn(e.public_key_full,e.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,dn)])]),h(`div`,fn,[h(`div`,pn,[r[105]||=h(`span`,{class:`text-content-secondary dark:text-content-muted`},`Short Key:`,-1),h(`code`,mn,t(e.public_key),1)]),h(`div`,hn,[r[106]||=h(`span`,{class:`text-content-secondary dark:text-content-muted`},`Full Key:`,-1),h(`code`,gn,t(e.public_key_full),1)])]),h(`div`,_n,[h(`div`,vn,[e.address?(l(),g(`span`,yn,`📍 `+t(e.address),1)):u(``,!0),e.last_login_success?(l(),g(`span`,bn,`Last Login: `+t(new Date(e.last_login_success*1e3).toLocaleString()),1)):u(``,!0)]),e.last_activity?(l(),g(`span`,xn,`Active: `+t(Math.floor((Date.now()/1e3-e.last_activity)/60))+`m ago`,1)):u(``,!0)])])]))),128))])])])):u(``,!0)]))],64))}});export{x as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/RoomServers-CzQh-0n_.js b/repeater/web/html/assets/RoomServers-CzQh-0n_.js deleted file mode 100644 index 553a1c4..0000000 --- a/repeater/web/html/assets/RoomServers-CzQh-0n_.js +++ /dev/null @@ -1 +0,0 @@ -import{B as e,Ct as t,E as n,R as r,V as i,Y as a,c as o,f as ee,g as te,i as s,j as ne,k as c,l,m as u,o as d,p as f,r as p,s as m,u as h,xt as g}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{t as _}from"./api-DBiYn0RS.js";import{t as re}from"./system-BfTzQTOF.js";import{t as v}from"./Spinner-CYvUNW0P.js";import{g as y,h as ie,l as ae,p as b}from"./index-CG181k2K.js";import{t as oe}from"./RestartModal-DDp7H13-.js";import{t as se}from"./ConfirmDialog-DZJrcPub.js";import{t as ce}from"./MessageDialog-CgmXx0Yp.js";import{t as le}from"./LocationPicker-B5L5Ju6J.js";import{n as ue,t as de}from"./preferences-6MHglq--.js";var fe={class:`p-6 space-y-6`},pe={key:0,class:`grid grid-cols-1 md:grid-cols-3 gap-4`},me={class:`glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-5`},he={class:`flex items-center justify-between`},ge={class:`text-3xl font-bold text-content-primary dark:text-content-primary mb-1`},_e={class:`glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-5`},ve={class:`flex items-center justify-between`},ye={class:`text-3xl font-bold text-primary mb-1`},be={class:`glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-5`},xe={class:`flex items-center justify-between`},Se={key:0,class:`w-6 h-6 text-accent-green`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},Ce={key:1,class:`w-6 h-6 text-accent-yellow`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},we={class:`glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-6`},Te={key:0,class:`flex items-center justify-center py-12`},Ee={class:`text-center`},De={key:1,class:`flex items-center justify-center py-12`},Oe={class:`text-center`},ke={class:`text-content-secondary dark:text-content-muted text-sm mb-4`},Ae={key:2,class:`space-y-4`},je={class:`flex items-start justify-between`},Me={class:`flex-1`},Ne={class:`flex items-center gap-3 mb-4`},Pe={class:`relative`},Fe={key:0,class:`absolute inset-0 bg-accent-green/50 rounded-full animate-ping`},Ie={class:`text-xl font-bold text-content-primary dark:text-content-primary`},Le={key:0,class:`text-content-muted dark:text-content-muted text-sm`},Re={class:`grid grid-cols-1 md:grid-cols-2 gap-3 text-sm mb-3`},ze={class:`text-content-primary dark:text-content-primary/90 ml-2`},Be={class:`flex items-center gap-2`},Ve={key:0,class:`text-content-primary dark:text-content-primary/90 font-mono ml-2 text-xs`},He={key:1,class:`text-content-muted dark:text-content-muted ml-2 text-xs`},Ue=[`onClick`],We={class:`text-content-primary dark:text-content-primary/90 ml-2`},Ge={key:0},Ke={class:`text-content-primary dark:text-content-primary/90 ml-2`},qe={key:0,class:`text-accent-green`},Je={key:1,class:`text-content-muted dark:text-content-muted`},Ye={key:2,class:`text-primary`},Xe={key:0,class:`text-xs text-content-muted dark:text-content-muted font-mono`},Ze={class:`ml-4 flex flex-wrap gap-2`},Qe=[`onClick`,`disabled`,`title`],$e=[`onClick`,`disabled`,`title`],et=[`onClick`],tt=[`onClick`],nt={key:3,class:`text-center py-12 text-content-secondary dark:text-content-muted`},rt={class:`modal-card max-w-2xl w-full max-h-[90vh] overflow-y-auto`},it={class:`modal-field-label-row`},at={key:0},ot={key:1,class:`text-content-secondary dark:text-content-muted text-sm`},st={class:`grid grid-cols-2 gap-5`},ct={class:`grid grid-cols-2 gap-5`},lt={class:`modal-card max-w-2xl w-full max-h-[90vh] overflow-y-auto`},ut={class:`modal-field-label-row`},dt={key:0},ft={key:1,class:`text-content-secondary dark:text-content-muted text-sm`},pt={class:`grid grid-cols-2 gap-5`},mt={class:`grid grid-cols-2 gap-5`},ht={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`},gt={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`},_t={class:`relative flex items-center justify-between`},vt={class:`flex items-center gap-4`},yt={class:`text-content-secondary dark:text-content-muted text-sm flex items-center gap-2`},bt={class:`text-primary font-semibold`},xt={class:`flex items-center gap-2`},St={class:`bg-primary/30 px-1.5 py-0.5 rounded-full text-[10px]`},Ct={class:`flex-1 overflow-y-auto mb-4 space-y-3`},wt={key:0,class:`flex items-center justify-center py-12`},Tt={class:`text-center`},Et={key:1,class:`flex items-center justify-center py-12`},Dt={class:`text-center`},Ot={class:`text-content-secondary dark:text-content-muted text-sm mb-4`},kt={key:2,class:`space-y-3`},At={class:`relative flex items-start justify-between gap-3`},jt={class:`flex-1 min-w-0`},Mt={class:`flex items-center gap-2 mb-3`},Nt={class:`flex items-center gap-2 flex-wrap`},Pt={key:0,class:`text-primary text-sm font-bold`},Ft={key:1,class:`text-primary/80 text-xs font-mono bg-primary/10 px-2 py-1 rounded-md border border-primary/20`},It={key:2,class:`text-content-muted dark:text-content-muted text-xs`},Lt={class:`text-content-secondary dark:text-content-muted text-xs flex items-center gap-1`},Rt={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`},zt={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`},Bt=[`onClick`],Vt={key:0,class:`text-center pt-4`},Ht={key:1,class:`text-center pt-4`},Ut={class:`flex items-center justify-center gap-2 text-content-secondary dark:text-content-muted text-sm`},Wt={key:3,class:`flex items-center justify-center h-full`},Gt={class:`relative overflow-hidden rounded-[15px] border-t border-stroke-subtle dark:border-white/20 pt-4 mt-4`},Kt={class:`relative space-y-3`},qt={class:`flex gap-3`},Jt={class:`flex-1 relative`},Yt=[`onKeydown`],Xt=[`disabled`],Zt={key:0,class:`fixed inset-0 bg-black/70 backdrop-blur-md flex items-center justify-center z-[350] p-4`},Qt={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`},$t={class:`flex items-center justify-between mb-4 pb-4 border-b border-stroke-subtle dark:border-white/10`},en={class:`text-content-secondary dark:text-content-primary/70 text-sm mt-1`},tn={class:`text-primary`},nn={class:`flex-1 overflow-y-auto space-y-3`},rn={key:0,class:`text-center py-12`},an={class:`space-y-2`},on={class:`flex items-center justify-between`},sn={class:`flex items-center gap-2`},cn={class:`text-content-primary dark:text-content-primary font-semibold`},ln={class:`flex items-center gap-2`},un={class:`text-content-secondary dark:text-content-muted text-xs`},dn=[`onClick`],fn={class:`space-y-1 text-xs`},pn={class:`flex items-center gap-2`},mn={class:`text-primary font-mono bg-primary/10 px-2 py-0.5 rounded`},hn={class:`flex items-center gap-2`},gn={class:`text-primary font-mono bg-primary/10 px-2 py-0.5 rounded text-[10px] break-all`},_n={class:`flex items-center justify-between text-xs text-content-secondary dark:text-content-muted`},vn={class:`flex items-center gap-4`},yn={key:0},bn={key:1},xn={key:0},x=te({name:`RoomServersView`,__name:`RoomServers`,setup(te){let x=re(),Sn=d(()=>x.stats?.config?.repeater?.latitude??0),Cn=d(()=>x.stats?.config?.repeater?.longitude??0),S=a(!1),C=a(!1),w=a(!1),T=a(null),E=a(null),D=a(!1),O=a(!1),k=a(!1),A=a(null),j=a(``),M=a(!1),N=a(!1),P=a(new Set),wn=d(()=>E.value?.configured?.filter(e=>e.registered).length??0),Tn=d(()=>E.value?.configured?.length??0),F=d(()=>wn.value===Tn.value),I=a(!1),L=a(``),En=a(!1),Dn=a({message:``,variant:`success`}),R=a(!1),z=a(``),On=a(``),B=a([]),V=a(!1),H=a(null),U=a(``),W=a(de(`roomServers_messagesLimit`,50)),G=a(0),K=a(!0);r(W,e=>ue(`roomServers_messagesLimit`,e));let q=a([]),kn=a(!1),J=a({name:``,identity_key:``,type:`room_server`,settings:{node_name:``,latitude:0,longitude:0,admin_password:``,guest_password:``}});n(async()=>{await Y()});async function Y(){w.value=!0,T.value=null;try{let e=await _.getIdentities();e.success?E.value=e.data:T.value=e.error||`Failed to load identities`}catch(e){T.value=e instanceof Error?e.message:`Failed to load identities`}finally{w.value=!1}}function An(e){e.latitude=Math.round(e.latitude*1e6)/1e6,e.longitude=Math.round(e.longitude*1e6)/1e6}async function jn(){An(J.value.settings);try{let e=await _.createIdentity(J.value);e.success?(D.value=!1,await Y(),k.value=!0):X(`Failed to create identity: ${e.error}`,`error`)}catch(e){X(`Error creating identity: ${e}`,`error`)}}async function Mn(){let e={...A.value,settings:{...A.value.settings}};An(e.settings),e.name===j.value?delete e.new_name:(e.new_name=e.name,e.name=j.value);try{let t=await _.updateIdentity(e);t.success?(O.value=!1,A.value=null,await Y(),k.value=!0):X(`Failed to update identity: ${t.error}`,`error`)}catch(e){X(`Error updating identity: ${e}`,`error`)}}function Nn(e){L.value=e,I.value=!0}async function Pn(){let e=L.value;I.value=!1;try{let t=await _.deleteIdentity(e);t.success?(await Y(),X(t.message||`Identity deleted successfully!`,`success`)):X(`Failed to delete identity: ${t.error}`,`error`)}catch(e){X(`Error deleting identity: ${e}`,`error`)}finally{L.value=``}}function X(e,t){Dn.value={message:e,variant:t},En.value=!0}async function Fn(e){try{let t=await _.sendRoomServerAdvert(e);t.success?X(t.message||`Advert sent for '${e}'!`,`success`):X(`Failed to send advert: ${t.error}`,`error`)}catch(e){X(`Error sending advert: ${e}`,`error`)}}function In(e){A.value=JSON.parse(JSON.stringify(e)),j.value=A.value.name,delete A.value.new_name,A.value.settings||(A.value.settings={}),A.value.settings.admin_password||(A.value.settings.admin_password=``),A.value.settings.guest_password||(A.value.settings.guest_password=``),A.value.settings.latitude??(A.value.settings.latitude=0),A.value.settings.longitude??(A.value.settings.longitude=0),N.value=!1,O.value=!0}function Ln(){J.value={name:``,identity_key:``,type:`room_server`,settings:{node_name:``,latitude:Sn.value,longitude:Cn.value,admin_password:``,guest_password:``}},M.value=!1}function Rn(){Ln(),D.value=!0}function zn(e){J.value.settings.latitude=e.latitude,J.value.settings.longitude=e.longitude}function Bn(e){A.value&&(A.value.settings.latitude=e.latitude,A.value.settings.longitude=e.longitude)}function Z(){D.value=!1,O.value=!1,A.value=null,M.value=!1,N.value=!1}function Vn(e){P.value.has(e)?P.value.delete(e):P.value.add(e)}async function Hn(e){z.value=e,R.value=!0,G.value=0,K.value=!0,On.value=E.value?.configured.find(t=>t.name===e)?.hash||``,await Un(),await Q(!0)}async function Un(){try{let e=await _.getACLClients({identity_hash:On.value,identity_name:z.value});e.success&&e.data&&(q.value=e.data.clients||[])}catch(e){console.error(`Failed to fetch ACL clients:`,e)}}async function Q(e=!1){e&&(G.value=0,B.value=[]),V.value=!0,H.value=null;try{let t=await _.getRoomMessages({room_name:z.value,limit:W.value,offset:G.value});if(t.success&&t.data){let n=t.data.messages||[];e?B.value=n:B.value=[...B.value,...n],K.value=n.length===W.value}else H.value=t.error||`Failed to load messages`}catch(e){H.value=e instanceof Error?e.message:`Failed to load messages`}finally{V.value=!1}}async function Wn(){G.value+=W.value,await Q(!1)}async function $(){if(U.value.trim())try{let e=await _.postRoomMessage({room_name:z.value,message:U.value,author_pubkey:`server`});e.success?(U.value=``,await Q(!0)):X(`Failed to send message: ${e.error}`,`error`)}catch(e){X(`Error sending message: ${e}`,`error`)}}async function Gn(e){if(confirm(`Are you sure you want to delete this message?`))try{let t=await _.deleteRoomMessage({room_name:z.value,message_id:e});t.success?(await Q(!0),X(`Message deleted successfully`,`success`)):X(`Failed to delete message: ${t.error}`,`error`)}catch(e){X(`Error deleting message: ${e}`,`error`)}}function Kn(){R.value=!1,z.value=``,On.value=``,B.value=[],U.value=``,H.value=null,q.value=[]}function qn(e){return e?new Date(e*1e3).toLocaleString():`Unknown`}async function Jn(e,t){if(confirm(`Are you sure you want to remove this client from the ACL?`))try{let n=await _.removeACLClient({public_key:e,identity_hash:t});n.success?(await Un(),X(`Client removed successfully`,`success`)):X(`Failed to remove client: ${n.error}`,`error`)}catch(e){X(`Error removing client: ${e}`,`error`)}}return(n,r)=>(c(),h(p,null,[m(`div`,fe,[m(`div`,{class:`relative overflow-hidden rounded-[20px] p-6 mb-6 glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10`},[r[30]||=m(`div`,{class:`absolute inset-0 bg-gradient-to-br from-primary/20 via-secondary/10 to-accent-purple/20 opacity-50`},null,-1),r[31]||=m(`div`,{class:`absolute inset-0 bg-gradient-to-tl from-accent-green/10 via-transparent to-primary/10 animate-pulse`},null,-1),m(`div`,{class:`relative flex items-center justify-between`},[r[29]||=ee(`

Room Servers

Manage room server identities and messages

`,1),m(`button`,{onClick:Rn,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`},[...r[28]||=[m(`span`,{class:`flex items-center gap-2`},[m(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[m(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 4v16m8-8H4`})]),f(` Add Room Server `)],-1)]])])]),E.value&&E.value.total_configured>0?(c(),h(`div`,pe,[m(`div`,me,[m(`div`,he,[m(`div`,null,[r[32]||=m(`div`,{class:`text-content-secondary dark:text-content-muted text-xs font-medium mb-2 uppercase tracking-wide`},` Total Configured `,-1),m(`div`,ge,t(Tn.value),1)]),r[33]||=m(`div`,{class:`bg-background-mute dark:bg-white/10 p-3 rounded-[12px]`},[m(`svg`,{class:`w-6 h-6 text-content-secondary dark:text-content-primary/70`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[m(`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)])]),m(`div`,_e,[m(`div`,ve,[m(`div`,null,[r[34]||=m(`div`,{class:`text-content-secondary dark:text-content-muted text-xs font-medium mb-2 uppercase tracking-wide`},` Currently Registered `,-1),m(`div`,ye,t(wn.value),1)]),r[35]||=m(`div`,{class:`bg-primary/20 p-3 rounded-[12px]`},[m(`svg`,{class:`w-6 h-6 text-primary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[m(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M5 13l4 4L19 7`})])],-1)])]),m(`div`,be,[m(`div`,xe,[m(`div`,null,[r[36]||=m(`div`,{class:`text-content-secondary dark:text-content-muted text-xs font-medium mb-2 uppercase tracking-wide`},` Status `,-1),m(`div`,{class:g([`text-3xl font-bold`,F.value?`text-accent-green`:`text-accent-yellow`])},t(F.value?`Synced`:`Out of Sync`),3)]),m(`div`,{class:g([`p-3 rounded-[12px]`,F.value?`bg-accent-green/20`:`bg-accent-yellow/20`])},[F.value?(c(),h(`svg`,Se,[...r[37]||=[m(`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)]])):(c(),h(`svg`,Ce,[...r[38]||=[m(`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)])])])):l(``,!0),m(`div`,we,[w.value?(c(),h(`div`,Te,[m(`div`,Ee,[u(v,{class:`mx-auto mb-4`}),r[39]||=m(`div`,{class:`text-content-secondary dark:text-content-primary/70`},` Loading room servers... `,-1)])])):T.value?(c(),h(`div`,De,[m(`div`,Oe,[r[40]||=m(`div`,{class:`text-red-600 dark:text-red-400 mb-2`},`Failed to load room servers`,-1),m(`div`,ke,t(T.value),1),m(`button`,{onClick:Y,class:`btn-primary`},` Retry `)])])):E.value&&E.value.configured.length>0?(c(),h(`div`,Ae,[(c(!0),h(p,null,ne(E.value.configured,e=>(c(),h(`div`,{key:e.name,class:`glass-card backdrop-blur-xl rounded-[15px] p-5 border border-stroke-subtle dark:border-white/10`},[m(`div`,je,[m(`div`,Me,[m(`div`,Ne,[m(`div`,Pe,[e.registered?(c(),h(`div`,Fe)):l(``,!0),m(`div`,{class:g([`relative w-3 h-3 rounded-full`,e.registered?`bg-accent-green`:`bg-accent-red`])},null,2)]),m(`h3`,Ie,t(e.name),1),m(`span`,{class:g([`px-3 py-1 text-xs font-semibold rounded-full`,e.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`])},t(e.registered?`● Active`:`○ Inactive`),3),e.hash?(c(),h(`span`,Le,t(e.hash),1)):l(``,!0)]),m(`div`,Re,[m(`div`,null,[r[41]||=m(`span`,{class:`text-content-muted dark:text-content-muted`},`Node Name:`,-1),m(`span`,ze,t(e.settings?.node_name||`Not set`),1)]),m(`div`,Be,[r[42]||=m(`span`,{class:`text-content-muted dark:text-content-muted`},`Identity Key:`,-1),P.value.has(e.name)?(c(),h(`span`,Ve,t(e.identity_key),1)):(c(),h(`span`,He,` •••••••••••••••• `)),m(`button`,{onClick:t=>Vn(e.name),class:`text-primary/70 hover:text-primary text-xs underline`},t(P.value.has(e.name)?`Hide`:`Show`),9,Ue)]),m(`div`,null,[r[43]||=m(`span`,{class:`text-content-muted dark:text-content-muted`},`Location:`,-1),m(`span`,We,t(e.settings?.latitude||0)+`, `+t(e.settings?.longitude||0),1)]),e.settings?.admin_password||e.settings?.guest_password?(c(),h(`div`,Ge,[r[44]||=m(`span`,{class:`text-content-muted dark:text-content-muted`},`Passwords:`,-1),m(`span`,Ke,[e.settings?.admin_password?(c(),h(`span`,qe,`Admin`)):l(``,!0),e.settings?.admin_password&&e.settings?.guest_password?(c(),h(`span`,Je,` / `)):l(``,!0),e.settings?.guest_password?(c(),h(`span`,Ye,`Guest`)):l(``,!0)])])):l(``,!0)]),e.address?(c(),h(`div`,Xe,` Address: `+t(e.address),1)):l(``,!0)]),m(`div`,Ze,[m(`button`,{onClick:t=>Hn(e.name),disabled:!e.registered,class:g([`group px-4 py-2 rounded-[10px] text-xs font-medium transition-all duration-200 flex items-center gap-2`,e.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:e.registered?`Manage messages for this room`:`Room server must be active to manage messages`},[...r[45]||=[m(`svg`,{class:`w-4 h-4 group-hover:rotate-12 transition-transform`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[m(`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),f(` Messages `,-1)]],10,Qe),m(`button`,{onClick:t=>Fn(e.name),disabled:!e.registered,class:g([`group px-4 py-2 rounded-[10px] text-xs font-medium transition-all duration-200 flex items-center gap-2`,e.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:e.registered?`Send advert for this room server`:`Room server must be active to send advert`},[...r[46]||=[m(`svg`,{class:`w-4 h-4 group-hover:scale-110 transition-transform`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[m(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M13 10V3L4 14h7v7l9-11h-7z`})],-1),f(` Send Advert `,-1)]],10,$e),m(`button`,{onClick:t=>In(e),class:`btn-primary-xs`},` Edit `,8,et),m(`button`,{onClick:t=>Nn(e.name),class:`btn-danger-xs`},` Delete `,8,tt)])])]))),128))])):(c(),h(`div`,nt,[r[47]||=m(`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`},[m(`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),r[48]||=m(`p`,{class:`text-lg mb-2`},`No room servers configured`,-1),r[49]||=m(`p`,{class:`text-sm mb-4`},`Add your first room server to get started`,-1),m(`button`,{onClick:Rn,class:`btn-primary`},` + Add Room Server `)]))]),(c(),o(s,{to:`body`},[u(ae,{"enter-active-class":`transition-opacity duration-200`,"enter-from-class":`opacity-0`,"leave-active-class":`transition-opacity duration-200`,"leave-to-class":`opacity-0`},{default:e(()=>[D.value?(c(),h(`div`,{key:0,class:`modal-backdrop`,onClick:y(Z,[`self`])},[m(`div`,rt,[m(`div`,{class:`flex items-center justify-between mb-7`},[r[51]||=m(`div`,null,[m(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary`},` Add Room Server `),m(`p`,{class:`text-content-secondary dark:text-content-muted text-sm mt-1`},` Configure a new room server identity `)],-1),m(`button`,{onClick:Z,class:`text-content-secondary dark:text-white/60 hover:text-content-primary dark:hover:text-white transition-colors`},[...r[50]||=[m(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[m(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),m(`form`,{onSubmit:y(jn,[`prevent`]),class:`modal-form`},[m(`div`,null,[r[52]||=m(`label`,{class:`modal-field-label`},[f(`Name `),m(`span`,{class:`text-red-500`},`*`)],-1),i(m(`input`,{"onUpdate:modelValue":r[0]||=e=>J.value.name=e,type:`text`,placeholder:`e.g., MainBBS`,class:`modal-input`},null,512),[[b,J.value.name]])]),m(`div`,null,[m(`div`,it,[r[53]||=m(`span`,{class:`text-xs font-medium text-content-secondary dark:text-content-muted`},`Identity Key (Optional)`,-1),m(`button`,{onClick:r[1]||=e=>M.value=!M.value,type:`button`,class:`text-primary/70 hover:text-primary text-xs underline`},t(M.value?`Hide`:`Show/Edit`),1)]),M.value?(c(),h(`div`,at,[i(m(`input`,{"onUpdate:modelValue":r[2]||=e=>J.value.identity_key=e,type:`text`,placeholder:`Leave empty to auto-generate`,class:`modal-input font-mono`},null,512),[[b,J.value.identity_key]]),r[54]||=m(`p`,{class:`text-content-secondary dark:text-content-muted text-xs mt-1`},` Leave empty to automatically generate a secure key `,-1)])):(c(),h(`div`,ot,` Will be auto-generated if not provided `))]),m(`div`,null,[r[55]||=m(`label`,{class:`modal-field-label`},`Node Name`,-1),i(m(`input`,{"onUpdate:modelValue":r[3]||=e=>J.value.settings.node_name=e,type:`text`,placeholder:`Display name for the room server`,class:`modal-input`},null,512),[[b,J.value.settings.node_name]])]),m(`div`,null,[r[59]||=m(`label`,{class:`modal-field-label`},`Location`,-1),m(`button`,{type:`button`,onClick:r[4]||=e=>S.value=!0,class:`flex items-center gap-1.5 px-2.5 py-1 mb-3 text-xs bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-secondary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors`,title:`Pick location on map`},[...r[56]||=[m(`svg`,{class:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[m(`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`}),m(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 11a3 3 0 11-6 0 3 3 0 016 0z`})],-1),f(` Pick on Map `,-1)]]),m(`div`,st,[m(`div`,null,[r[57]||=m(`label`,{class:`modal-field-label`},`Latitude`,-1),i(m(`input`,{"onUpdate:modelValue":r[5]||=e=>J.value.settings.latitude=e,type:`number`,step:`0.000001`,class:`modal-input`},null,512),[[b,J.value.settings.latitude,void 0,{number:!0}]])]),m(`div`,null,[r[58]||=m(`label`,{class:`modal-field-label`},`Longitude`,-1),i(m(`input`,{"onUpdate:modelValue":r[6]||=e=>J.value.settings.longitude=e,type:`number`,step:`0.000001`,class:`modal-input`},null,512),[[b,J.value.settings.longitude,void 0,{number:!0}]])])])]),m(`div`,ct,[m(`div`,null,[r[60]||=m(`label`,{class:`modal-field-label`},`Admin Password (Optional)`,-1),i(m(`input`,{"onUpdate:modelValue":r[7]||=e=>J.value.settings.admin_password=e,type:`password`,placeholder:`Leave empty for no password`,class:`modal-input`},null,512),[[b,J.value.settings.admin_password]]),r[61]||=m(`p`,{class:`text-content-secondary dark:text-content-muted text-xs mt-1`},`Full access to room server`,-1)]),m(`div`,null,[r[62]||=m(`label`,{class:`modal-field-label`},`Guest Password (Optional)`,-1),i(m(`input`,{"onUpdate:modelValue":r[8]||=e=>J.value.settings.guest_password=e,type:`password`,placeholder:`Leave empty for no password`,class:`modal-input`},null,512),[[b,J.value.settings.guest_password]]),r[63]||=m(`p`,{class:`text-content-secondary dark:text-content-muted text-xs mt-1`},`Read-only access`,-1)])]),m(`div`,{class:`modal-actions`},[m(`button`,{type:`button`,onClick:Z,class:`modal-btn-cancel`},`Cancel`),r[64]||=m(`button`,{type:`submit`,class:`modal-btn-primary`},`Create`,-1)])],32)])])):l(``,!0)]),_:1})])),u(le,{"is-open":S.value,latitude:J.value.settings.latitude,longitude:J.value.settings.longitude,onClose:r[9]||=e=>S.value=!1,onSelect:zn},null,8,[`is-open`,`latitude`,`longitude`]),(c(),o(s,{to:`body`},[u(ae,{"enter-active-class":`transition-opacity duration-200`,"enter-from-class":`opacity-0`,"leave-active-class":`transition-opacity duration-200`,"leave-to-class":`opacity-0`},{default:e(()=>[O.value&&A.value?(c(),h(`div`,{key:0,class:`modal-backdrop`,onClick:y(Z,[`self`])},[m(`div`,lt,[m(`div`,{class:`flex items-center justify-between mb-7`},[r[66]||=m(`div`,null,[m(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary`},` Edit Room Server `),m(`p`,{class:`text-content-secondary dark:text-content-muted text-sm mt-1`},` Update room server identity `)],-1),m(`button`,{onClick:Z,class:`text-content-secondary dark:text-white/60 hover:text-content-primary dark:hover:text-white transition-colors`},[...r[65]||=[m(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[m(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),m(`form`,{onSubmit:y(Mn,[`prevent`]),class:`modal-form`},[m(`div`,null,[r[67]||=m(`label`,{class:`modal-field-label`},[f(`Name `),m(`span`,{class:`text-red-500`},`*`)],-1),i(m(`input`,{"onUpdate:modelValue":r[10]||=e=>A.value.name=e,type:`text`,class:`modal-input`},null,512),[[b,A.value.name]])]),m(`div`,null,[m(`div`,ut,[r[68]||=m(`span`,{class:`text-xs font-medium text-content-secondary dark:text-content-muted`},`Identity Key (Optional)`,-1),m(`button`,{onClick:r[11]||=e=>N.value=!N.value,type:`button`,class:`text-primary/70 hover:text-primary text-xs underline`},t(N.value?`Hide`:`Show/Edit`),1)]),N.value?(c(),h(`div`,dt,[i(m(`input`,{"onUpdate:modelValue":r[12]||=e=>A.value.identity_key=e,type:`text`,placeholder:`Leave empty to keep current key`,class:`modal-input font-mono`},null,512),[[b,A.value.identity_key]]),r[69]||=m(`p`,{class:`text-content-secondary dark:text-content-muted text-xs mt-1`},` Leave empty to keep the current identity key `,-1)])):(c(),h(`div`,ft,` Click "Show/Edit" to change the identity key `))]),m(`div`,null,[r[70]||=m(`label`,{class:`modal-field-label`},`Node Name`,-1),i(m(`input`,{"onUpdate:modelValue":r[13]||=e=>A.value.settings.node_name=e,type:`text`,class:`modal-input`},null,512),[[b,A.value.settings.node_name]])]),m(`div`,null,[r[74]||=m(`label`,{class:`modal-field-label`},`Location`,-1),m(`button`,{type:`button`,onClick:r[14]||=e=>C.value=!0,class:`flex items-center gap-1.5 px-2.5 py-1 mb-3 text-xs bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-secondary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors`,title:`Pick location on map`},[...r[71]||=[m(`svg`,{class:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[m(`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`}),m(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 11a3 3 0 11-6 0 3 3 0 016 0z`})],-1),f(` Pick on Map `,-1)]]),m(`div`,pt,[m(`div`,null,[r[72]||=m(`label`,{class:`modal-field-label`},`Latitude`,-1),i(m(`input`,{"onUpdate:modelValue":r[15]||=e=>A.value.settings.latitude=e,type:`number`,step:`0.000001`,class:`modal-input`},null,512),[[b,A.value.settings.latitude,void 0,{number:!0}]])]),m(`div`,null,[r[73]||=m(`label`,{class:`modal-field-label`},`Longitude`,-1),i(m(`input`,{"onUpdate:modelValue":r[16]||=e=>A.value.settings.longitude=e,type:`number`,step:`0.000001`,class:`modal-input`},null,512),[[b,A.value.settings.longitude,void 0,{number:!0}]])])])]),m(`div`,mt,[m(`div`,null,[r[75]||=m(`label`,{class:`modal-field-label`},`Admin Password (Optional)`,-1),i(m(`input`,{"onUpdate:modelValue":r[17]||=e=>A.value.settings.admin_password=e,type:`password`,placeholder:`Leave empty for no password`,class:`modal-input`},null,512),[[b,A.value.settings.admin_password]]),r[76]||=m(`p`,{class:`text-content-secondary dark:text-content-muted text-xs mt-1`},`Full access to room server`,-1)]),m(`div`,null,[r[77]||=m(`label`,{class:`modal-field-label`},`Guest Password (Optional)`,-1),i(m(`input`,{"onUpdate:modelValue":r[18]||=e=>A.value.settings.guest_password=e,type:`password`,placeholder:`Leave empty for no password`,class:`modal-input`},null,512),[[b,A.value.settings.guest_password]]),r[78]||=m(`p`,{class:`text-content-secondary dark:text-content-muted text-xs mt-1`},`Read-only access`,-1)])]),m(`div`,{class:`modal-actions`},[m(`button`,{type:`button`,onClick:Z,class:`modal-btn-cancel`},`Cancel`),r[79]||=m(`button`,{type:`submit`,class:`modal-btn-primary`},`Update`,-1)])],32)])])):l(``,!0)]),_:1})])),u(le,{"is-open":C.value,latitude:A.value?.settings?.latitude,longitude:A.value?.settings?.longitude,onClose:r[19]||=e=>C.value=!1,onSelect:Bn},null,8,[`is-open`,`latitude`,`longitude`])]),u(se,{show:I.value,title:`Delete Room Server`,message:`Are you sure you want to delete '${L.value}'? This action cannot be undone.`,"confirm-text":`Delete`,"cancel-text":`Cancel`,variant:`danger`,onClose:r[20]||=e=>I.value=!1,onConfirm:Pn},null,8,[`show`,`message`]),u(ce,{show:En.value,message:Dn.value.message,variant:Dn.value.variant,onClose:r[21]||=e=>En.value=!1},null,8,[`show`,`message`,`variant`]),u(oe,{modelValue:k.value,"onUpdate:modelValue":r[22]||=e=>k.value=e,message:`Room server settings have been saved. A service restart is required for the changes to take effect.`},null,8,[`modelValue`]),(c(),o(s,{to:`body`},[R.value?(c(),h(`div`,{key:0,class:`fixed inset-0 bg-black/70 backdrop-blur-lg flex items-center justify-center z-[300] p-4`,onClick:r[26]||=y(e=>R.value=!1,[`self`])},[m(`div`,ht,[m(`div`,gt,[r[86]||=m(`div`,{class:`absolute inset-0 bg-gradient-to-r from-secondary/20 via-primary/20 to-accent-purple/20`},null,-1),r[87]||=m(`div`,{class:`absolute inset-0 bg-gradient-to-br from-transparent via-white/5 to-transparent`},null,-1),m(`div`,_t,[m(`div`,vt,[r[82]||=m(`div`,{class:`relative`},[m(`div`,{class:`absolute inset-0 bg-secondary/40 blur-xl rounded-full`}),m(`div`,{class:`relative bg-secondary/20 p-3 rounded-[12px] border border-secondary/30`},[m(`svg`,{class:`w-6 h-6 text-secondary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[m(`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),m(`div`,null,[r[81]||=m(`h2`,{class:`text-2xl font-bold text-content-primary dark:text-content-primary mb-1`},` Room Messages `,-1),m(`p`,yt,[r[80]||=m(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[m(`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),m(`span`,bt,t(z.value),1)])])]),m(`div`,xt,[m(`button`,{onClick:r[23]||=e=>kn.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`},[r[83]||=m(`svg`,{class:`w-4 h-4 group-hover:scale-110 transition-transform`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[m(`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),r[84]||=m(`span`,{class:`hidden sm:inline`},`Sessions`,-1),m(`span`,St,t(q.value.length),1)]),m(`button`,{onClick:Kn,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`},[...r[85]||=[m(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[m(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])])])]),m(`div`,Ct,[V.value&&B.value.length===0?(c(),h(`div`,wt,[m(`div`,Tt,[u(v,{class:`mx-auto mb-4`}),r[88]||=m(`div`,{class:`text-content-secondary dark:text-content-primary/70`},` Loading messages... `,-1)])])):H.value?(c(),h(`div`,Et,[m(`div`,Dt,[r[89]||=m(`div`,{class:`text-red-600 dark:text-red-400 mb-2`},`Failed to load messages`,-1),m(`div`,Ot,t(H.value),1),m(`button`,{onClick:r[24]||=e=>Q(!0),class:`btn-primary`},` Retry `)])])):B.value.length>0?(c(),h(`div`,kt,[(c(!0),h(p,null,ne(B.value,(e,n)=>(c(),h(`div`,{key:e.id||n,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`},[r[94]||=m(`div`,{class:`absolute inset-0 bg-gradient-to-r from-secondary/5 to-transparent opacity-0 group-hover:opacity-100 transition-opacity`},null,-1),m(`div`,At,[m(`div`,jt,[m(`div`,Mt,[m(`div`,Nt,[r[91]||=m(`div`,{class:`w-6 h-6 rounded-full bg-gradient-to-br from-primary/30 to-secondary/30 flex items-center justify-center`},[m(`svg`,{class:`w-3 h-3 text-content-secondary dark:text-content-primary/70`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[m(`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),e.author_name?(c(),h(`span`,Pt,t(e.author_name),1)):l(``,!0),e.author_pubkey?(c(),h(`span`,Ft,t(e.author_pubkey.substring(0,8))+`... `,1)):(c(),h(`span`,It,` Anonymous `)),r[92]||=m(`span`,{class:`text-content-muted dark:text-content-muted/60 text-xs`},`•`,-1),m(`span`,Lt,[r[90]||=m(`svg`,{class:`w-3 h-3`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[m(`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),f(` `+t(qn(e.timestamp)),1)]),e.id?(c(),h(`span`,Rt,` #`+t(e.id),1)):l(``,!0)])]),m(`div`,zt,t(e.message_text),1)]),m(`button`,{onClick:t=>Gn(e.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`},[...r[93]||=[m(`svg`,{class:`w-4 h-4 group-hover/delete:rotate-12 transition-transform`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[m(`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,Bt)])]))),128)),K.value&&!V.value?(c(),h(`div`,Vt,[m(`button`,{onClick:Wn,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`},[...r[95]||=[m(`svg`,{class:`w-4 h-4 group-hover:translate-y-1 transition-transform`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[m(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M19 9l-7 7-7-7`})],-1),f(` Load More Messages `,-1)]])])):V.value?(c(),h(`div`,Ht,[m(`div`,Ut,[u(v,{size:`sm`}),r[96]||=f(` Loading... `,-1)])])):l(``,!0)])):(c(),h(`div`,Wt,[...r[97]||=[m(`div`,{class:`text-center py-12`},[m(`div`,{class:`relative mb-6`},[m(`div`,{class:`absolute inset-0 bg-secondary/20 blur-3xl rounded-full`}),m(`div`,{class:`relative bg-gradient-to-br from-secondary/20 to-primary/20 p-6 rounded-[20px] inline-block border border-stroke-subtle dark:border-white/10`},[m(`svg`,{class:`w-16 h-16 text-content-muted dark:text-content-muted/70`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[m(`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`})])])]),m(`p`,{class:`text-xl font-bold text-content-primary dark:text-content-primary mb-2`},` No messages yet `),m(`p`,{class:`text-sm text-content-secondary dark:text-content-muted`},` Be the first to start the conversation `)],-1)]]))]),m(`div`,Gt,[r[100]||=m(`div`,{class:`absolute inset-0 bg-gradient-to-t from-primary/5 to-transparent pointer-events-none`},null,-1),m(`div`,Kt,[m(`div`,qt,[m(`div`,Jt,[i(m(`textarea`,{"onUpdate:modelValue":r[25]||=e=>U.value=e,onKeydown:[ie(y($,[`ctrl`]),[`enter`]),ie(y($,[`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,Yt),[[b,U.value]])]),m(`button`,{onClick:$,disabled:!U.value.trim(),class:g([`group px-6 py-3 rounded-[12px] transition-all duration-200 flex items-center justify-center gap-2 font-medium`,U.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`])},[...r[98]||=[m(`svg`,{class:`w-5 h-5 group-hover:translate-x-1 transition-transform`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[m(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 19l9 2-9-18-9 18 9-2zm0 0v-8`})],-1),m(`span`,{class:`hidden sm:inline`},`Send`,-1)]],10,Xt)]),r[99]||=m(`p`,{class:`text-content-secondary dark:text-content-muted/60 text-xs flex items-center gap-2`},[m(`svg`,{class:`w-3 h-3`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[m(`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`})]),f(` Press Ctrl+Enter to send message quickly `)],-1)])])])])):l(``,!0)])),(c(),o(s,{to:`body`},[kn.value?(c(),h(`div`,Zt,[m(`div`,Qt,[m(`div`,$t,[m(`div`,null,[r[102]||=m(`h2`,{class:`text-xl font-bold text-content-primary dark:text-content-primary`},` Active Sessions `,-1),m(`p`,en,[r[101]||=f(` Room: `,-1),m(`span`,tn,t(z.value),1)])]),m(`button`,{onClick:r[27]||=e=>kn.value=!1,class:`text-content-secondary dark:text-content-primary/70 hover:text-content-primary dark:hover:text-content-primary transition-colors`},[...r[103]||=[m(`svg`,{class:`w-6 h-6`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[m(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),m(`div`,nn,[q.value.length===0?(c(),h(`div`,rn,[...r[104]||=[m(`div`,{class:`text-content-secondary dark:text-content-muted`},`No active sessions found`,-1)]])):l(``,!0),(c(!0),h(p,null,ne(q.value,(e,n)=>(c(),h(`div`,{key:e.public_key_full||n,class:`glass-card backdrop-blur-xl rounded-[10px] p-4 border border-stroke-subtle dark:border-white/10`},[m(`div`,an,[m(`div`,on,[m(`div`,sn,[m(`span`,cn,t(e.identity_name||`Unknown`),1),m(`span`,{class:g([`px-2 py-0.5 text-xs font-medium rounded`,e.permissions===`admin`?`bg-accent-green/20 text-accent-green`:`bg-secondary/20 text-secondary`])},t(e.permissions),3)]),m(`div`,ln,[m(`span`,un,t(e.identity_type),1),m(`button`,{onClick:t=>Jn(e.public_key_full,e.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,dn)])]),m(`div`,fn,[m(`div`,pn,[r[105]||=m(`span`,{class:`text-content-secondary dark:text-content-muted`},`Short Key:`,-1),m(`code`,mn,t(e.public_key),1)]),m(`div`,hn,[r[106]||=m(`span`,{class:`text-content-secondary dark:text-content-muted`},`Full Key:`,-1),m(`code`,gn,t(e.public_key_full),1)])]),m(`div`,_n,[m(`div`,vn,[e.address?(c(),h(`span`,yn,`📍 `+t(e.address),1)):l(``,!0),e.last_login_success?(c(),h(`span`,bn,`Last Login: `+t(new Date(e.last_login_success*1e3).toLocaleString()),1)):l(``,!0)]),e.last_activity?(c(),h(`span`,xn,`Active: `+t(Math.floor((Date.now()/1e3-e.last_activity)/60))+`m ago`,1)):l(``,!0)])])]))),128))])])])):l(``,!0)]))],64))}});export{x as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/Sensors-DSOTF01P.js b/repeater/web/html/assets/Sensors-fpSLvgWk.js similarity index 96% rename from repeater/web/html/assets/Sensors-DSOTF01P.js rename to repeater/web/html/assets/Sensors-fpSLvgWk.js index 61d3e40..9824dff 100644 --- a/repeater/web/html/assets/Sensors-DSOTF01P.js +++ b/repeater/web/html/assets/Sensors-fpSLvgWk.js @@ -1 +1 @@ -import{Ct as e,g as t,j as n,k as r,l as i,o as a,r as o,s,u as c,xt as l}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{t as u}from"./system-BfTzQTOF.js";import{t as d}from"./index-CG181k2K.js";var f={class:`space-y-4`},p={class:`glass-card rounded-[15px] p-4 sm:p-6`},m={class:`mt-4 grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-4`},h={class:`text-xs uppercase tracking-wide text-content-muted`},g={class:`mt-2 text-lg font-semibold text-content-heading dark:text-white`},_={key:0,class:`glass-card rounded-[15px] p-5 text-content-muted`},v={class:`flex flex-wrap items-center justify-between gap-3`},y={class:`text-lg font-semibold text-content-heading dark:text-white`},b={class:`text-sm text-content-muted`},x={class:`mt-3 grid grid-cols-1 gap-2 sm:grid-cols-2`},S={class:`text-sm`},C={class:`ml-2 text-content-heading dark:text-white`},w={key:0,class:`text-sm`},T={class:`ml-2 text-red-600 dark:text-red-300`},E={class:`mt-4 overflow-x-auto rounded-[12px] border border-stroke-subtle dark:border-white/10`},D={class:`min-w-full text-sm`},O={class:`px-3 py-2 font-medium text-content-heading dark:text-white`},k={class:`px-3 py-2 text-content-muted break-all`},A={key:0},j={key:1,class:`glass-card rounded-[15px] p-5 text-content-muted`},M=t({name:`SensorsView`,__name:`Sensors`,setup(t){let M=u(),N=a(()=>M.stats?.sensors??null),P=a(()=>N.value?.readings??[]),F=a(()=>{let e=N.value;return e?[{label:`Enabled`,value:e.enabled?`Yes`:`No`},{label:`Running`,value:e.running?`Yes`:`No`},{label:`Configured / Loaded`,value:`${e.configured??0} / ${e.loaded??0}`},{label:`Poll Interval`,value:typeof e.poll_interval_seconds==`number`?`${e.poll_interval_seconds.toFixed(1)}s`:`n/a`}]:[{label:`Enabled`,value:`n/a`},{label:`Running`,value:`n/a`},{label:`Configured`,value:`n/a`},{label:`Poll Interval`,value:`n/a`}]}),I=e=>{if(e==null)return`n/a`;if(typeof e==`boolean`)return e?`true`:`false`;if(typeof e==`number`)return Number.isFinite(e)?String(e):`n/a`;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}},L=e=>{if(!e)return`n/a`;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()},R=async()=>{await M.fetchStats()};return d(async()=>{await M.fetchStats()},{intervalMs:1e4,immediate:!0}),(t,a)=>(r(),c(`div`,f,[s(`div`,p,[s(`div`,{class:`flex items-start justify-between gap-4`},[a[0]||=s(`div`,null,[s(`h1`,{class:`text-xl sm:text-2xl font-semibold text-content-heading dark:text-white`},`Sensors`),s(`p`,{class:`mt-1 text-sm text-content-muted`},` Live sensor summary from the existing stats API. `)],-1),s(`button`,{class:`rounded-[10px] border border-stroke-subtle dark:border-white/10 px-3 py-2 text-sm hover:bg-black/5 dark:hover:bg-white/5`,onClick:R},` Refresh `)]),s(`div`,m,[(r(!0),c(o,null,n(F.value,t=>(r(),c(`div`,{key:t.label,class:`rounded-[12px] border border-stroke-subtle dark:border-white/10 p-3`},[s(`p`,h,e(t.label),1),s(`p`,g,e(t.value),1)]))),128))])]),N.value?i(``,!0):(r(),c(`div`,_,` Sensor data is not available yet. Ensure the repeater has started and stats are loading. `)),(r(!0),c(o,null,n(P.value,(t,u)=>(r(),c(`div`,{key:`${t.name||`sensor`}-${u}`,class:`glass-card rounded-[15px] p-4 sm:p-5`},[s(`div`,v,[s(`div`,null,[s(`h2`,y,e(t.name||`Sensor ${u+1}`),1),s(`p`,b,`Type: `+e(t.type||`unknown`),1)]),s(`span`,{class:l([`rounded-full px-3 py-1 text-xs font-semibold`,t.ok?`bg-green-100 text-green-700 dark:bg-green-500/20 dark:text-green-300`:`bg-red-100 text-red-700 dark:bg-red-500/20 dark:text-red-300`])},e(t.ok?`OK`:`Error`),3)]),s(`div`,x,[s(`div`,S,[a[1]||=s(`span`,{class:`text-content-muted`},`Timestamp:`,-1),s(`span`,C,e(L(t.timestamp)),1)]),t.error?(r(),c(`div`,w,[a[2]||=s(`span`,{class:`text-content-muted`},`Error:`,-1),s(`span`,T,e(t.error),1)])):i(``,!0)]),s(`div`,E,[s(`table`,D,[a[4]||=s(`thead`,{class:`bg-black/5 dark:bg-white/5`},[s(`tr`,null,[s(`th`,{class:`px-3 py-2 text-left text-content-muted`},`Field`),s(`th`,{class:`px-3 py-2 text-left text-content-muted`},`Value`)])],-1),s(`tbody`,null,[(r(!0),c(o,null,n(t.data||{},(t,n)=>(r(),c(`tr`,{key:String(n),class:`border-t border-stroke-subtle dark:border-white/10`},[s(`td`,O,e(n),1),s(`td`,k,e(I(t)),1)]))),128)),!t.data||Object.keys(t.data).length===0?(r(),c(`tr`,A,[...a[3]||=[s(`td`,{class:`px-3 py-3 text-content-muted`,colspan:`2`},`No fields in payload`,-1)]])):i(``,!0)])])])]))),128)),N.value&&P.value.length===0?(r(),c(`div`,j,` Sensors are configured but no readings are available yet. `)):i(``,!0)]))}});export{M as default}; \ No newline at end of file +import{Ct as e,g as t,j as n,k as r,l as i,o as a,r as o,s,u as c,xt as l}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{t as u}from"./system-Dx7MrhAz.js";import{t as d}from"./index-BpKhPa08.js";var f={class:`space-y-4`},p={class:`glass-card rounded-[15px] p-4 sm:p-6`},m={class:`mt-4 grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-4`},h={class:`text-xs uppercase tracking-wide text-content-muted`},g={class:`mt-2 text-lg font-semibold text-content-heading dark:text-white`},_={key:0,class:`glass-card rounded-[15px] p-5 text-content-muted`},v={class:`flex flex-wrap items-center justify-between gap-3`},y={class:`text-lg font-semibold text-content-heading dark:text-white`},b={class:`text-sm text-content-muted`},x={class:`mt-3 grid grid-cols-1 gap-2 sm:grid-cols-2`},S={class:`text-sm`},C={class:`ml-2 text-content-heading dark:text-white`},w={key:0,class:`text-sm`},T={class:`ml-2 text-red-600 dark:text-red-300`},E={class:`mt-4 overflow-x-auto rounded-[12px] border border-stroke-subtle dark:border-white/10`},D={class:`min-w-full text-sm`},O={class:`px-3 py-2 font-medium text-content-heading dark:text-white`},k={class:`px-3 py-2 text-content-muted break-all`},A={key:0},j={key:1,class:`glass-card rounded-[15px] p-5 text-content-muted`},M=t({name:`SensorsView`,__name:`Sensors`,setup(t){let M=u(),N=a(()=>M.stats?.sensors??null),P=a(()=>N.value?.readings??[]),F=a(()=>{let e=N.value;return e?[{label:`Enabled`,value:e.enabled?`Yes`:`No`},{label:`Running`,value:e.running?`Yes`:`No`},{label:`Configured / Loaded`,value:`${e.configured??0} / ${e.loaded??0}`},{label:`Poll Interval`,value:typeof e.poll_interval_seconds==`number`?`${e.poll_interval_seconds.toFixed(1)}s`:`n/a`}]:[{label:`Enabled`,value:`n/a`},{label:`Running`,value:`n/a`},{label:`Configured`,value:`n/a`},{label:`Poll Interval`,value:`n/a`}]}),I=e=>{if(e==null)return`n/a`;if(typeof e==`boolean`)return e?`true`:`false`;if(typeof e==`number`)return Number.isFinite(e)?String(e):`n/a`;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}},L=e=>{if(!e)return`n/a`;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()},R=async()=>{await M.fetchStats()};return d(async()=>{await M.fetchStats()},{intervalMs:1e4,immediate:!0}),(t,a)=>(r(),c(`div`,f,[s(`div`,p,[s(`div`,{class:`flex items-start justify-between gap-4`},[a[0]||=s(`div`,null,[s(`h1`,{class:`text-xl sm:text-2xl font-semibold text-content-heading dark:text-white`},`Sensors`),s(`p`,{class:`mt-1 text-sm text-content-muted`},` Live sensor summary from the existing stats API. `)],-1),s(`button`,{class:`rounded-[10px] border border-stroke-subtle dark:border-white/10 px-3 py-2 text-sm hover:bg-black/5 dark:hover:bg-white/5`,onClick:R},` Refresh `)]),s(`div`,m,[(r(!0),c(o,null,n(F.value,t=>(r(),c(`div`,{key:t.label,class:`rounded-[12px] border border-stroke-subtle dark:border-white/10 p-3`},[s(`p`,h,e(t.label),1),s(`p`,g,e(t.value),1)]))),128))])]),N.value?i(``,!0):(r(),c(`div`,_,` Sensor data is not available yet. Ensure the repeater has started and stats are loading. `)),(r(!0),c(o,null,n(P.value,(t,u)=>(r(),c(`div`,{key:`${t.name||`sensor`}-${u}`,class:`glass-card rounded-[15px] p-4 sm:p-5`},[s(`div`,v,[s(`div`,null,[s(`h2`,y,e(t.name||`Sensor ${u+1}`),1),s(`p`,b,`Type: `+e(t.type||`unknown`),1)]),s(`span`,{class:l([`rounded-full px-3 py-1 text-xs font-semibold`,t.ok?`bg-green-100 text-green-700 dark:bg-green-500/20 dark:text-green-300`:`bg-red-100 text-red-700 dark:bg-red-500/20 dark:text-red-300`])},e(t.ok?`OK`:`Error`),3)]),s(`div`,x,[s(`div`,S,[a[1]||=s(`span`,{class:`text-content-muted`},`Timestamp:`,-1),s(`span`,C,e(L(t.timestamp)),1)]),t.error?(r(),c(`div`,w,[a[2]||=s(`span`,{class:`text-content-muted`},`Error:`,-1),s(`span`,T,e(t.error),1)])):i(``,!0)]),s(`div`,E,[s(`table`,D,[a[4]||=s(`thead`,{class:`bg-black/5 dark:bg-white/5`},[s(`tr`,null,[s(`th`,{class:`px-3 py-2 text-left text-content-muted`},`Field`),s(`th`,{class:`px-3 py-2 text-left text-content-muted`},`Value`)])],-1),s(`tbody`,null,[(r(!0),c(o,null,n(t.data||{},(t,n)=>(r(),c(`tr`,{key:String(n),class:`border-t border-stroke-subtle dark:border-white/10`},[s(`td`,O,e(n),1),s(`td`,k,e(I(t)),1)]))),128)),!t.data||Object.keys(t.data).length===0?(r(),c(`tr`,A,[...a[3]||=[s(`td`,{class:`px-3 py-3 text-content-muted`,colspan:`2`},`No fields in payload`,-1)]])):i(``,!0)])])])]))),128)),N.value&&P.value.length===0?(r(),c(`div`,j,` Sensors are configured but no readings are available yet. `)):i(``,!0)]))}});export{M as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/Sessions-BcRSI1Q2.js b/repeater/web/html/assets/Sessions-BcRSI1Q2.js new file mode 100644 index 0000000..aab6271 --- /dev/null +++ b/repeater/web/html/assets/Sessions-BcRSI1Q2.js @@ -0,0 +1 @@ +import{Ct as e,E as t,V as n,Y as r,g as ee,j as i,k as a,l as o,m as te,o as s,p as ne,r as c,s as l,u,xt as d}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{o as re}from"./runtime-dom.esm-bundler-fKU3dih-.js";import{t as f}from"./api-C0ctTLHN.js";import{t as ie}from"./Spinner-CYvUNW0P.js";var ae={class:`p-6 space-y-6`},oe={key:0,class:`grid grid-cols-1 md:grid-cols-4 gap-4`},se={class:`glass-card rounded-[15px] p-4`},ce={class:`text-2xl font-bold text-content-primary dark:text-content-primary`},le={class:`glass-card rounded-[15px] p-4`},ue={class:`text-2xl font-bold text-primary`},de={class:`glass-card rounded-[15px] p-4`},fe={class:`text-2xl font-bold text-accent-green`},pe={class:`glass-card rounded-[15px] p-4`},me={class:`text-2xl font-bold text-secondary`},he={class:`glass-card rounded-[15px] p-6`},p={class:`flex flex-wrap border-b border-stroke-subtle dark:border-stroke/10 mb-6`},m=[`onClick`],h={class:`flex items-center gap-2`},g={key:0,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},_={key:1,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},v={key:2,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},y={class:`min-h-[400px]`},b={key:0,class:`flex items-center justify-center py-12`},x={class:`text-center`},S={key:1,class:`flex items-center justify-center py-12`},C={class:`text-center`},w={class:`text-content-secondary dark:text-content-muted text-sm mb-4`},T={key:2,class:`space-y-4`},E={key:0,class:`text-center py-12 text-content-secondary dark:text-content-muted`},D={key:1,class:`space-y-4`},O={class:`flex items-start justify-between`},k={class:`flex-1 min-w-0`},A={class:`flex items-center gap-2 flex-wrap mb-3`},j={class:`text-lg font-semibold text-content-primary dark:text-content-primary truncate`},M={class:`flex flex-wrap items-center gap-x-4 gap-y-2 text-sm`},N={key:0,class:`flex items-center gap-1.5`},P={class:`text-content-secondary dark:text-content-muted`},F={key:1,class:`flex items-center gap-1.5`},I={class:`text-content-secondary dark:text-content-muted`},L={key:2,class:`text-content-secondary dark:text-content-muted font-mono text-xs`},R={key:3,class:`text-content-muted dark:text-content-muted font-mono text-xs`},ge={key:0,class:`text-content-muted dark:text-content-muted text-xs mt-2 mb-0`},_e={class:`grid grid-cols-2 md:grid-cols-4 gap-4 mt-4`},ve={class:`text-content-primary dark:text-content-primary font-medium`},ye={class:`text-primary font-medium`},be={class:`mt-3 flex items-center gap-2`},xe={key:3,class:`space-y-4`},Se={key:0,class:`text-center py-12 text-content-secondary dark:text-content-muted`},Ce={key:1,class:`overflow-x-auto`},we={class:`w-full`},z={class:`py-3`},Te={class:`font-mono text-sm text-content-primary dark:text-content-primary`},Ee={class:`py-3`},De={class:`font-mono text-xs text-content-secondary dark:text-content-muted`},Oe={class:`py-3`},ke={class:`text-sm text-content-primary dark:text-content-primary`},Ae={class:`text-xs text-content-muted dark:text-content-muted`},je={class:`py-3`},Me={class:`py-3`},Ne={class:`text-sm text-content-secondary dark:text-content-muted`},Pe={class:`py-3`},Fe=[`onClick`],Ie={key:4,class:`space-y-4`},Le={class:`mb-4`},Re=[`value`],ze={key:0,class:`text-center py-12 text-content-secondary dark:text-content-muted`},Be={key:1,class:`grid grid-cols-1 gap-4`},Ve={class:`flex items-start justify-between`},He={class:`flex-1`},Ue={class:`flex items-center gap-3 mb-3`},We={class:`text-content-primary dark:text-content-primary font-mono text-sm`},Ge={class:`grid grid-cols-1 md:grid-cols-2 gap-3 text-sm`},Ke={class:`text-content-primary dark:text-content-primary/90 font-mono ml-2`},qe={class:`text-content-primary dark:text-content-primary/90 ml-2`},Je={class:`text-content-primary dark:text-content-primary/90 ml-2`},Ye={class:`text-content-primary dark:text-content-primary/90 ml-2`},Xe=[`onClick`],Ze={class:`flex justify-end`},Qe=[`disabled`],B=ee({name:`SessionsView`,__name:`Sessions`,setup(ee){let B=r(`overview`),V=r(!1),H=r(!1),U=r(null),W=r(null),G=r([]),K=r(null),q=r(null),$e=[{id:`overview`,label:`Overview`,icon:`overview`},{id:`clients`,label:`Authenticated Clients`,icon:`clients`},{id:`identities`,label:`By Identity`,icon:`identities`}];t(async()=>{await J(),V.value=!0});async function J(){H.value=!0,U.value=null;try{let e=await f.getACLInfo();e.success&&(W.value=e.data);let t=await f.getACLClients();t.success&&t.data&&(G.value=t.data.clients||[]);let n=await f.getACLStats();n.success&&(K.value=n.data)}catch(e){U.value=e instanceof Error?e.message:`Failed to load ACL data`,console.error(`Error fetching ACL data:`,e)}finally{H.value=!1}}async function Y(e,t){if(confirm(`Are you sure you want to remove this client from the ACL?`))try{let n=await f.removeACLClient({public_key:e,identity_hash:t});n.success?await J():alert(`Failed to remove client: ${n.error}`)}catch(e){alert(`Error removing client: ${e}`)}}function X(e){return e?new Date(e*1e3).toLocaleString():`Never`}function et(e){B.value=e}let Z=s(()=>q.value?G.value.filter(e=>e.identity_name===q.value):G.value),Q=s(()=>W.value&&W.value.acls||[]);function tt(e){return e?.type===`companion`}function nt(e){return e===`repeater`?`bg-primary/20 text-primary`:e===`companion`?`bg-accent-purple/20 text-accent-purple`:`bg-secondary/20 text-secondary`}function $(e){return e==null?`N/A`:typeof e==`boolean`?e?`✓`:`✗`:String(e)}return(t,r)=>(a(),u(`div`,ae,[r[22]||=l(`div`,null,[l(`h1`,{class:`text-2xl font-bold text-content-primary dark:text-content-primary`},` Sessions & Access Control `),l(`p`,{class:`text-content-secondary dark:text-content-muted mt-2`},` Manage authenticated clients and access control lists `),l(`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),K.value?(a(),u(`div`,oe,[l(`div`,se,[r[1]||=l(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-1`},` Total Identities `,-1),l(`div`,ce,e(K.value.total_identities),1)]),l(`div`,le,[r[2]||=l(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-1`},` Authenticated Clients `,-1),l(`div`,ue,e(K.value.total_clients),1)]),l(`div`,de,[r[3]||=l(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-1`},`Admin Clients`,-1),l(`div`,fe,e(K.value.admin_clients),1)]),l(`div`,pe,[r[4]||=l(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-1`},`Guest Clients`,-1),l(`div`,me,e(K.value.guest_clients),1)])])):o(``,!0),l(`div`,he,[l(`div`,p,[(a(),u(c,null,i($e,t=>l(`button`,{key:t.id,onClick:e=>et(t.id),class:d([`px-4 py-2 text-sm font-medium transition-colors duration-200 border-b-2 mr-6 mb-2`,B.value===t.id?`text-primary 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`])},[l(`div`,h,[t.icon===`overview`?(a(),u(`svg`,g,[...r[5]||=[l(`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)]])):t.icon===`clients`?(a(),u(`svg`,_,[...r[6]||=[l(`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)]])):t.icon===`identities`?(a(),u(`svg`,v,[...r[7]||=[l(`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)]])):o(``,!0),ne(` `+e(t.label),1)])],10,m)),64))]),l(`div`,y,[H.value&&!V.value?(a(),u(`div`,b,[l(`div`,x,[te(ie,{class:`mx-auto mb-4`}),r[8]||=l(`div`,{class:`text-content-secondary dark:text-content-muted`},`Loading ACL data...`,-1)])])):U.value?(a(),u(`div`,S,[l(`div`,C,[r[9]||=l(`div`,{class:`text-accent-red mb-2`},`Failed to load ACL data`,-1),l(`div`,w,e(U.value),1),l(`button`,{onClick:J,class:`btn-primary`},` Retry `)])])):B.value===`overview`?(a(),u(`div`,T,[Q.value.length===0?(a(),u(`div`,E,` No identities configured `)):(a(),u(`div`,D,[(a(!0),u(c,null,i(Q.value,t=>(a(),u(`div`,{key:t.hash,class:`glass-card rounded-[10px] p-4 border border-stroke-subtle dark:border-white/10 hover:border-primary/30 transition-colors`},[l(`div`,O,[l(`div`,k,[l(`div`,A,[l(`h3`,j,e(t.name),1),l(`span`,{class:d([`px-2 py-0.5 text-xs font-medium rounded shrink-0`,nt(t.type)])},e(t.type),3)]),tt(t)?(a(),u(c,{key:0},[l(`div`,M,[t.registered===void 0?o(``,!0):(a(),u(`span`,N,[l(`span`,{class:d([`w-2 h-2 rounded-full shrink-0`,t.registered?`bg-accent-green`:`bg-accent-red`]),"aria-hidden":``},null,2),l(`span`,P,`Registered: `+e(t.registered?`Active`:`Inactive`),1)])),t.active===void 0?o(``,!0):(a(),u(`span`,F,[l(`span`,{class:d([`w-2 h-2 rounded-full shrink-0`,t.active?`bg-accent-green`:`bg-accent-red`]),"aria-hidden":``},null,2),l(`span`,I,`Bridge: `+e(t.active?`Connected`:`Disconnected`),1)])),t.client_ip?(a(),u(`span`,L,` Client: `+e(t.client_ip),1)):o(``,!0),t.hash?(a(),u(`span`,R,` Hash: `+e(t.hash),1)):o(``,!0)]),t.last_seen==null?o(``,!0):(a(),u(`p`,ge,` Last seen: `+e(X(t.last_seen)),1))],64)):(a(),u(c,{key:1},[l(`div`,_e,[l(`div`,null,[r[10]||=l(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},` Max Clients `,-1),l(`div`,ve,e($(t.max_clients)),1)]),l(`div`,null,[r[11]||=l(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},` Authenticated `,-1),l(`div`,ye,e($(t.authenticated_clients)),1)]),l(`div`,null,[r[12]||=l(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},` Admin Password `,-1),l(`div`,{class:d(t.has_admin_password?`text-accent-green`:`text-accent-red`)},e(t.has_admin_password==null?`N/A`:t.has_admin_password?`✓ Set`:`✗ Not Set`),3)]),l(`div`,null,[r[13]||=l(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},` Guest Password `,-1),l(`div`,{class:d(t.has_guest_password?`text-accent-green`:`text-accent-red`)},e(t.has_guest_password==null?`N/A`:t.has_guest_password?`✓ Set`:`✗ Not Set`),3)])]),l(`div`,be,[r[14]||=l(`span`,{class:`text-content-secondary dark:text-content-muted text-xs`},`Read-Only Access:`,-1),l(`span`,{class:d(t.allow_read_only?`text-accent-green`:`text-accent-red`)},e(t.allow_read_only==null?`N/A`:t.allow_read_only?`Allowed`:`Disabled`),3)])],64))])])]))),128))]))])):B.value===`clients`?(a(),u(`div`,xe,[G.value.length===0?(a(),u(`div`,Se,` No authenticated clients `)):(a(),u(`div`,Ce,[l(`table`,we,[r[15]||=l(`thead`,null,[l(`tr`,{class:`border-b border-stroke-subtle dark:border-stroke/10`},[l(`th`,{class:`text-left text-content-secondary dark:text-content-muted text-sm font-medium pb-3`},` Client `),l(`th`,{class:`text-left text-content-secondary dark:text-content-muted text-sm font-medium pb-3`},` Address `),l(`th`,{class:`text-left text-content-secondary dark:text-content-muted text-sm font-medium pb-3`},` Identity `),l(`th`,{class:`text-left text-content-secondary dark:text-content-muted text-sm font-medium pb-3`},` Permissions `),l(`th`,{class:`text-left text-content-secondary dark:text-content-muted text-sm font-medium pb-3`},` Last Activity `),l(`th`,{class:`text-left text-content-secondary dark:text-content-muted text-sm font-medium pb-3`},` Actions `)])],-1),l(`tbody`,null,[(a(!0),u(c,null,i(G.value,t=>(a(),u(`tr`,{key:t.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`},[l(`td`,z,[l(`div`,Te,e(t.public_key),1)]),l(`td`,Ee,[l(`div`,De,e(t.address),1)]),l(`td`,Oe,[l(`div`,ke,e(t.identity_name),1),l(`div`,Ae,e(t.identity_hash),1)]),l(`td`,je,[l(`span`,{class:d([`px-2 py-1 text-xs font-medium rounded`,t.permissions===`admin`?`bg-accent-green/20 text-accent-green`:`bg-secondary/20 text-secondary`])},e(t.permissions),3)]),l(`td`,Me,[l(`div`,Ne,e(X(t.last_activity)),1)]),l(`td`,Pe,[l(`button`,{onClick:e=>Y(t.public_key_full,t.identity_hash),class:`btn-danger-xs`},` Remove `,8,Fe)])]))),128))])])]))])):B.value===`identities`?(a(),u(`div`,Ie,[l(`div`,Le,[r[17]||=l(`label`,{class:`block text-content-secondary dark:text-content-muted text-sm mb-2`},`Filter by Identity`,-1),n(l(`select`,{"onUpdate:modelValue":r[0]||=e=>q.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-primary/50 transition-colors`},[r[16]||=l(`option`,{value:null},`All Identities`,-1),(a(!0),u(c,null,i(Q.value,t=>(a(),u(`option`,{key:t.name,value:t.name},e(t.name)+` (`+e(t.authenticated_clients??0)+` clients) `,9,Re))),128))],512),[[re,q.value]])]),Z.value.length===0?(a(),u(`div`,ze,` No clients for selected identity `)):(a(),u(`div`,Be,[(a(!0),u(c,null,i(Z.value,t=>(a(),u(`div`,{key:t.public_key_full,class:`glass-card rounded-[10px] p-4 border border-stroke-subtle dark:border-white/10`},[l(`div`,Ve,[l(`div`,He,[l(`div`,Ue,[l(`span`,{class:d([`px-2 py-1 text-xs font-medium rounded`,t.permissions===`admin`?`bg-accent-green/20 text-accent-green`:`bg-secondary/20 text-secondary`])},e(t.permissions),3),l(`span`,We,e(t.public_key),1)]),l(`div`,Ge,[l(`div`,null,[r[18]||=l(`span`,{class:`text-content-secondary dark:text-content-muted`},`Address:`,-1),l(`span`,Ke,e(t.address),1)]),l(`div`,null,[r[19]||=l(`span`,{class:`text-content-secondary dark:text-content-muted`},`Identity:`,-1),l(`span`,qe,e(t.identity_name)+` (`+e(t.identity_hash)+`)`,1)]),l(`div`,null,[r[20]||=l(`span`,{class:`text-content-secondary dark:text-content-muted`},`Last Activity:`,-1),l(`span`,Je,e(X(t.last_activity)),1)]),l(`div`,null,[r[21]||=l(`span`,{class:`text-content-secondary dark:text-content-muted`},`Last Login:`,-1),l(`span`,Ye,e(X(t.last_login_success)),1)])])]),l(`button`,{onClick:e=>Y(t.public_key_full,t.identity_hash),class:`ml-4 btn-danger-xs`},` Remove `,8,Xe)])]))),128))]))])):o(``,!0)])]),l(`div`,Ze,[l(`button`,{onClick:J,disabled:H.value,class:`btn-primary`},e(H.value?`Refreshing...`:`Refresh Data`),9,Qe)])]))}});export{B as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/Sessions-CTrtKCPc.js b/repeater/web/html/assets/Sessions-CTrtKCPc.js deleted file mode 100644 index d54f1c8..0000000 --- a/repeater/web/html/assets/Sessions-CTrtKCPc.js +++ /dev/null @@ -1 +0,0 @@ -import{Ct as e,E as t,V as n,Y as r,g as ee,j as i,k as a,l as o,m as te,o as s,p as ne,r as c,s as l,u,xt as d}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{t as f}from"./api-DBiYn0RS.js";import{t as re}from"./Spinner-CYvUNW0P.js";import{f as ie}from"./index-CG181k2K.js";var ae={class:`p-6 space-y-6`},oe={key:0,class:`grid grid-cols-1 md:grid-cols-4 gap-4`},se={class:`glass-card rounded-[15px] p-4`},ce={class:`text-2xl font-bold text-content-primary dark:text-content-primary`},le={class:`glass-card rounded-[15px] p-4`},ue={class:`text-2xl font-bold text-primary`},de={class:`glass-card rounded-[15px] p-4`},fe={class:`text-2xl font-bold text-accent-green`},pe={class:`glass-card rounded-[15px] p-4`},me={class:`text-2xl font-bold text-secondary`},he={class:`glass-card rounded-[15px] p-6`},p={class:`flex flex-wrap border-b border-stroke-subtle dark:border-stroke/10 mb-6`},m=[`onClick`],h={class:`flex items-center gap-2`},g={key:0,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},_={key:1,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},v={key:2,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},y={class:`min-h-[400px]`},b={key:0,class:`flex items-center justify-center py-12`},x={class:`text-center`},S={key:1,class:`flex items-center justify-center py-12`},C={class:`text-center`},w={class:`text-content-secondary dark:text-content-muted text-sm mb-4`},T={key:2,class:`space-y-4`},E={key:0,class:`text-center py-12 text-content-secondary dark:text-content-muted`},D={key:1,class:`space-y-4`},O={class:`flex items-start justify-between`},k={class:`flex-1 min-w-0`},A={class:`flex items-center gap-2 flex-wrap mb-3`},j={class:`text-lg font-semibold text-content-primary dark:text-content-primary truncate`},M={class:`flex flex-wrap items-center gap-x-4 gap-y-2 text-sm`},N={key:0,class:`flex items-center gap-1.5`},P={class:`text-content-secondary dark:text-content-muted`},F={key:1,class:`flex items-center gap-1.5`},I={class:`text-content-secondary dark:text-content-muted`},L={key:2,class:`text-content-secondary dark:text-content-muted font-mono text-xs`},R={key:3,class:`text-content-muted dark:text-content-muted font-mono text-xs`},ge={key:0,class:`text-content-muted dark:text-content-muted text-xs mt-2 mb-0`},_e={class:`grid grid-cols-2 md:grid-cols-4 gap-4 mt-4`},ve={class:`text-content-primary dark:text-content-primary font-medium`},ye={class:`text-primary font-medium`},be={class:`mt-3 flex items-center gap-2`},xe={key:3,class:`space-y-4`},Se={key:0,class:`text-center py-12 text-content-secondary dark:text-content-muted`},Ce={key:1,class:`overflow-x-auto`},we={class:`w-full`},z={class:`py-3`},Te={class:`font-mono text-sm text-content-primary dark:text-content-primary`},Ee={class:`py-3`},De={class:`font-mono text-xs text-content-secondary dark:text-content-muted`},Oe={class:`py-3`},ke={class:`text-sm text-content-primary dark:text-content-primary`},Ae={class:`text-xs text-content-muted dark:text-content-muted`},je={class:`py-3`},Me={class:`py-3`},Ne={class:`text-sm text-content-secondary dark:text-content-muted`},Pe={class:`py-3`},Fe=[`onClick`],Ie={key:4,class:`space-y-4`},Le={class:`mb-4`},Re=[`value`],ze={key:0,class:`text-center py-12 text-content-secondary dark:text-content-muted`},Be={key:1,class:`grid grid-cols-1 gap-4`},Ve={class:`flex items-start justify-between`},He={class:`flex-1`},Ue={class:`flex items-center gap-3 mb-3`},We={class:`text-content-primary dark:text-content-primary font-mono text-sm`},Ge={class:`grid grid-cols-1 md:grid-cols-2 gap-3 text-sm`},Ke={class:`text-content-primary dark:text-content-primary/90 font-mono ml-2`},qe={class:`text-content-primary dark:text-content-primary/90 ml-2`},Je={class:`text-content-primary dark:text-content-primary/90 ml-2`},Ye={class:`text-content-primary dark:text-content-primary/90 ml-2`},Xe=[`onClick`],Ze={class:`flex justify-end`},Qe=[`disabled`],B=ee({name:`SessionsView`,__name:`Sessions`,setup(ee){let B=r(`overview`),V=r(!1),H=r(!1),U=r(null),W=r(null),G=r([]),K=r(null),q=r(null),$e=[{id:`overview`,label:`Overview`,icon:`overview`},{id:`clients`,label:`Authenticated Clients`,icon:`clients`},{id:`identities`,label:`By Identity`,icon:`identities`}];t(async()=>{await J(),V.value=!0});async function J(){H.value=!0,U.value=null;try{let e=await f.getACLInfo();e.success&&(W.value=e.data);let t=await f.getACLClients();t.success&&t.data&&(G.value=t.data.clients||[]);let n=await f.getACLStats();n.success&&(K.value=n.data)}catch(e){U.value=e instanceof Error?e.message:`Failed to load ACL data`,console.error(`Error fetching ACL data:`,e)}finally{H.value=!1}}async function Y(e,t){if(confirm(`Are you sure you want to remove this client from the ACL?`))try{let n=await f.removeACLClient({public_key:e,identity_hash:t});n.success?await J():alert(`Failed to remove client: ${n.error}`)}catch(e){alert(`Error removing client: ${e}`)}}function X(e){return e?new Date(e*1e3).toLocaleString():`Never`}function et(e){B.value=e}let Z=s(()=>q.value?G.value.filter(e=>e.identity_name===q.value):G.value),Q=s(()=>W.value&&W.value.acls||[]);function tt(e){return e?.type===`companion`}function nt(e){return e===`repeater`?`bg-primary/20 text-primary`:e===`companion`?`bg-accent-purple/20 text-accent-purple`:`bg-secondary/20 text-secondary`}function $(e){return e==null?`N/A`:typeof e==`boolean`?e?`✓`:`✗`:String(e)}return(t,r)=>(a(),u(`div`,ae,[r[22]||=l(`div`,null,[l(`h1`,{class:`text-2xl font-bold text-content-primary dark:text-content-primary`},` Sessions & Access Control `),l(`p`,{class:`text-content-secondary dark:text-content-muted mt-2`},` Manage authenticated clients and access control lists `),l(`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),K.value?(a(),u(`div`,oe,[l(`div`,se,[r[1]||=l(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-1`},` Total Identities `,-1),l(`div`,ce,e(K.value.total_identities),1)]),l(`div`,le,[r[2]||=l(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-1`},` Authenticated Clients `,-1),l(`div`,ue,e(K.value.total_clients),1)]),l(`div`,de,[r[3]||=l(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-1`},`Admin Clients`,-1),l(`div`,fe,e(K.value.admin_clients),1)]),l(`div`,pe,[r[4]||=l(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-1`},`Guest Clients`,-1),l(`div`,me,e(K.value.guest_clients),1)])])):o(``,!0),l(`div`,he,[l(`div`,p,[(a(),u(c,null,i($e,t=>l(`button`,{key:t.id,onClick:e=>et(t.id),class:d([`px-4 py-2 text-sm font-medium transition-colors duration-200 border-b-2 mr-6 mb-2`,B.value===t.id?`text-primary 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`])},[l(`div`,h,[t.icon===`overview`?(a(),u(`svg`,g,[...r[5]||=[l(`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)]])):t.icon===`clients`?(a(),u(`svg`,_,[...r[6]||=[l(`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)]])):t.icon===`identities`?(a(),u(`svg`,v,[...r[7]||=[l(`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)]])):o(``,!0),ne(` `+e(t.label),1)])],10,m)),64))]),l(`div`,y,[H.value&&!V.value?(a(),u(`div`,b,[l(`div`,x,[te(re,{class:`mx-auto mb-4`}),r[8]||=l(`div`,{class:`text-content-secondary dark:text-content-muted`},`Loading ACL data...`,-1)])])):U.value?(a(),u(`div`,S,[l(`div`,C,[r[9]||=l(`div`,{class:`text-accent-red mb-2`},`Failed to load ACL data`,-1),l(`div`,w,e(U.value),1),l(`button`,{onClick:J,class:`btn-primary`},` Retry `)])])):B.value===`overview`?(a(),u(`div`,T,[Q.value.length===0?(a(),u(`div`,E,` No identities configured `)):(a(),u(`div`,D,[(a(!0),u(c,null,i(Q.value,t=>(a(),u(`div`,{key:t.hash,class:`glass-card rounded-[10px] p-4 border border-stroke-subtle dark:border-white/10 hover:border-primary/30 transition-colors`},[l(`div`,O,[l(`div`,k,[l(`div`,A,[l(`h3`,j,e(t.name),1),l(`span`,{class:d([`px-2 py-0.5 text-xs font-medium rounded shrink-0`,nt(t.type)])},e(t.type),3)]),tt(t)?(a(),u(c,{key:0},[l(`div`,M,[t.registered===void 0?o(``,!0):(a(),u(`span`,N,[l(`span`,{class:d([`w-2 h-2 rounded-full shrink-0`,t.registered?`bg-accent-green`:`bg-accent-red`]),"aria-hidden":``},null,2),l(`span`,P,`Registered: `+e(t.registered?`Active`:`Inactive`),1)])),t.active===void 0?o(``,!0):(a(),u(`span`,F,[l(`span`,{class:d([`w-2 h-2 rounded-full shrink-0`,t.active?`bg-accent-green`:`bg-accent-red`]),"aria-hidden":``},null,2),l(`span`,I,`Bridge: `+e(t.active?`Connected`:`Disconnected`),1)])),t.client_ip?(a(),u(`span`,L,` Client: `+e(t.client_ip),1)):o(``,!0),t.hash?(a(),u(`span`,R,` Hash: `+e(t.hash),1)):o(``,!0)]),t.last_seen==null?o(``,!0):(a(),u(`p`,ge,` Last seen: `+e(X(t.last_seen)),1))],64)):(a(),u(c,{key:1},[l(`div`,_e,[l(`div`,null,[r[10]||=l(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},` Max Clients `,-1),l(`div`,ve,e($(t.max_clients)),1)]),l(`div`,null,[r[11]||=l(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},` Authenticated `,-1),l(`div`,ye,e($(t.authenticated_clients)),1)]),l(`div`,null,[r[12]||=l(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},` Admin Password `,-1),l(`div`,{class:d(t.has_admin_password?`text-accent-green`:`text-accent-red`)},e(t.has_admin_password==null?`N/A`:t.has_admin_password?`✓ Set`:`✗ Not Set`),3)]),l(`div`,null,[r[13]||=l(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},` Guest Password `,-1),l(`div`,{class:d(t.has_guest_password?`text-accent-green`:`text-accent-red`)},e(t.has_guest_password==null?`N/A`:t.has_guest_password?`✓ Set`:`✗ Not Set`),3)])]),l(`div`,be,[r[14]||=l(`span`,{class:`text-content-secondary dark:text-content-muted text-xs`},`Read-Only Access:`,-1),l(`span`,{class:d(t.allow_read_only?`text-accent-green`:`text-accent-red`)},e(t.allow_read_only==null?`N/A`:t.allow_read_only?`Allowed`:`Disabled`),3)])],64))])])]))),128))]))])):B.value===`clients`?(a(),u(`div`,xe,[G.value.length===0?(a(),u(`div`,Se,` No authenticated clients `)):(a(),u(`div`,Ce,[l(`table`,we,[r[15]||=l(`thead`,null,[l(`tr`,{class:`border-b border-stroke-subtle dark:border-stroke/10`},[l(`th`,{class:`text-left text-content-secondary dark:text-content-muted text-sm font-medium pb-3`},` Client `),l(`th`,{class:`text-left text-content-secondary dark:text-content-muted text-sm font-medium pb-3`},` Address `),l(`th`,{class:`text-left text-content-secondary dark:text-content-muted text-sm font-medium pb-3`},` Identity `),l(`th`,{class:`text-left text-content-secondary dark:text-content-muted text-sm font-medium pb-3`},` Permissions `),l(`th`,{class:`text-left text-content-secondary dark:text-content-muted text-sm font-medium pb-3`},` Last Activity `),l(`th`,{class:`text-left text-content-secondary dark:text-content-muted text-sm font-medium pb-3`},` Actions `)])],-1),l(`tbody`,null,[(a(!0),u(c,null,i(G.value,t=>(a(),u(`tr`,{key:t.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`},[l(`td`,z,[l(`div`,Te,e(t.public_key),1)]),l(`td`,Ee,[l(`div`,De,e(t.address),1)]),l(`td`,Oe,[l(`div`,ke,e(t.identity_name),1),l(`div`,Ae,e(t.identity_hash),1)]),l(`td`,je,[l(`span`,{class:d([`px-2 py-1 text-xs font-medium rounded`,t.permissions===`admin`?`bg-accent-green/20 text-accent-green`:`bg-secondary/20 text-secondary`])},e(t.permissions),3)]),l(`td`,Me,[l(`div`,Ne,e(X(t.last_activity)),1)]),l(`td`,Pe,[l(`button`,{onClick:e=>Y(t.public_key_full,t.identity_hash),class:`btn-danger-xs`},` Remove `,8,Fe)])]))),128))])])]))])):B.value===`identities`?(a(),u(`div`,Ie,[l(`div`,Le,[r[17]||=l(`label`,{class:`block text-content-secondary dark:text-content-muted text-sm mb-2`},`Filter by Identity`,-1),n(l(`select`,{"onUpdate:modelValue":r[0]||=e=>q.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-primary/50 transition-colors`},[r[16]||=l(`option`,{value:null},`All Identities`,-1),(a(!0),u(c,null,i(Q.value,t=>(a(),u(`option`,{key:t.name,value:t.name},e(t.name)+` (`+e(t.authenticated_clients??0)+` clients) `,9,Re))),128))],512),[[ie,q.value]])]),Z.value.length===0?(a(),u(`div`,ze,` No clients for selected identity `)):(a(),u(`div`,Be,[(a(!0),u(c,null,i(Z.value,t=>(a(),u(`div`,{key:t.public_key_full,class:`glass-card rounded-[10px] p-4 border border-stroke-subtle dark:border-white/10`},[l(`div`,Ve,[l(`div`,He,[l(`div`,Ue,[l(`span`,{class:d([`px-2 py-1 text-xs font-medium rounded`,t.permissions===`admin`?`bg-accent-green/20 text-accent-green`:`bg-secondary/20 text-secondary`])},e(t.permissions),3),l(`span`,We,e(t.public_key),1)]),l(`div`,Ge,[l(`div`,null,[r[18]||=l(`span`,{class:`text-content-secondary dark:text-content-muted`},`Address:`,-1),l(`span`,Ke,e(t.address),1)]),l(`div`,null,[r[19]||=l(`span`,{class:`text-content-secondary dark:text-content-muted`},`Identity:`,-1),l(`span`,qe,e(t.identity_name)+` (`+e(t.identity_hash)+`)`,1)]),l(`div`,null,[r[20]||=l(`span`,{class:`text-content-secondary dark:text-content-muted`},`Last Activity:`,-1),l(`span`,Je,e(X(t.last_activity)),1)]),l(`div`,null,[r[21]||=l(`span`,{class:`text-content-secondary dark:text-content-muted`},`Last Login:`,-1),l(`span`,Ye,e(X(t.last_login_success)),1)])])]),l(`button`,{onClick:e=>Y(t.public_key_full,t.identity_hash),class:`ml-4 btn-danger-xs`},` Remove `,8,Xe)])]))),128))]))])):o(``,!0)])]),l(`div`,Ze,[l(`button`,{onClick:J,disabled:H.value,class:`btn-primary`},e(H.value?`Refreshing...`:`Refresh Data`),9,Qe)])]))}});export{B as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/Setup-BpLQMRSD.css b/repeater/web/html/assets/Setup-BpLQMRSD.css deleted file mode 100644 index de654f0..0000000 --- a/repeater/web/html/assets/Setup-BpLQMRSD.css +++ /dev/null @@ -1 +0,0 @@ -.glass-card[data-v-5b488fbf]{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background:#ffffff0d;border:1px solid #ffffff1a}.modal-enter-active[data-v-5b488fbf],.modal-leave-active[data-v-5b488fbf]{transition:opacity .3s}.modal-enter-from[data-v-5b488fbf],.modal-leave-to[data-v-5b488fbf]{opacity:0}.modal-enter-active .glass-card[data-v-5b488fbf],.modal-leave-active .glass-card[data-v-5b488fbf]{transition:transform .3s}.modal-enter-from .glass-card[data-v-5b488fbf],.modal-leave-to .glass-card[data-v-5b488fbf]{transform:scale(.9)}.slide-enter-active[data-v-5b488fbf],.slide-leave-active[data-v-5b488fbf]{transition:all .3s}.slide-enter-from[data-v-5b488fbf],.slide-leave-to[data-v-5b488fbf]{opacity:0;transform:translateY(-10px)}@keyframes float-slow-5b488fbf{0%,to{opacity:.8;transform:translate(0)scale(1)rotate(-24.22deg)}50%{opacity:.6;transform:translate(20px,-20px)scale(1.05)rotate(-24.22deg)}}@keyframes float-slower-5b488fbf{0%,to{opacity:.75;transform:translate(0)scale(1)rotate(-24.22deg)}50%{opacity:.5;transform:translate(-30px,20px)scale(1.08)rotate(-24.22deg)}}@keyframes float-slowest-5b488fbf{0%,to{opacity:.8;transform:translate(0)scale(1)rotate(-24.22deg)}50%{opacity:.55;transform:translate(25px,25px)scale(1.1)rotate(-24.22deg)}}.animate-pulse-slow[data-v-5b488fbf]{will-change:transform, opacity;animation:15s ease-in-out infinite float-slow-5b488fbf}.animate-pulse-slower[data-v-5b488fbf]{will-change:transform, opacity;animation:18s ease-in-out infinite float-slower-5b488fbf}.animate-pulse-slowest[data-v-5b488fbf]{will-change:transform, opacity;animation:20s ease-in-out infinite float-slowest-5b488fbf} diff --git a/repeater/web/html/assets/Setup-CpiSqNYG.js b/repeater/web/html/assets/Setup-CpiSqNYG.js new file mode 100644 index 0000000..5d08f35 --- /dev/null +++ b/repeater/web/html/assets/Setup-CpiSqNYG.js @@ -0,0 +1 @@ +import{B as e,Ct as t,E as n,St as r,V as i,Y as a,c as o,f as s,g as c,j as l,k as u,l as d,m as f,nt as p,o as m,p as h,r as g,s as _,u as v,x as y,xt as b,y as x}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{o as S,s as C,t as w,u as T}from"./runtime-dom.esm-bundler-fKU3dih-.js";import{v as E}from"./api-C0ctTLHN.js";import{t as D}from"./_plugin-vue_export-helper-TcpyXLsZ.js";import{t as ee}from"./Spinner-CYvUNW0P.js";import{n as te,r as ne}from"./index-BpKhPa08.js";var O=e=>e===``,k=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),A=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),j=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),M=e=>{let t=j(e);return t.charAt(0).toUpperCase()+t.slice(1)},N={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`},P=Symbol(`lucide-icons`);function F(){return y(P,{})}var I=({name:e,iconNode:t,absoluteStrokeWidth:n,"absolute-stroke-width":r,strokeWidth:i,"stroke-width":a,size:o,color:s,...c},{slots:l})=>{let{size:u,color:d,strokeWidth:f=2,absoluteStrokeWidth:p=!1,class:h=``}=F(),g=m(()=>{let e=O(n)||O(r)||n===!0||r===!0||p===!0,t=i||a||f||N[`stroke-width`];return e?Number(t)*24/Number(o??u??N.width):t});return x(`svg`,{...N,...c,width:o??u??N.width,height:o??u??N.height,stroke:s??d??N.stroke,"stroke-width":g.value,class:k(`lucide`,h,...e?[`lucide-${A(M(e))}-icon`,`lucide-${A(e)}`]:[`lucide-icon`])},[...t.map(e=>x(...e)),...l.default?[l.default()]:[]])},L=(e,t)=>(n,{slots:r,attrs:i})=>x(I,{...i,...n,iconNode:t,name:e},r.default?{default:r.default}:void 0),R=L(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),z=L(`usb`,[[`circle`,{cx:`10`,cy:`7`,r:`1`,key:`dypaad`}],[`circle`,{cx:`4`,cy:`20`,r:`1`,key:`22iqad`}],[`path`,{d:`M4.7 19.3 19 5`,key:`1enqfc`}],[`path`,{d:`m21 3-3 1 2 2Z`,key:`d3ov82`}],[`path`,{d:`M9.26 7.68 5 12l2 5`,key:`1esawj`}],[`path`,{d:`m10 14 5 2 3.5-3.5`,key:`v8oal5`}],[`path`,{d:`m18 12 1-1 1 1-1 1Z`,key:`1bh22v`}]]),B=L(`wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),V=E(`setup`,()=>{let e=a(1),t=a(6),n=a(`pyRpt${Math.floor(Math.random()*1e4).toString().padStart(4,`0`)}`),r=a(null),i=a(null),o=a(null),s=a(``),c=a(``),l=a(!1),u=a({frequency:`915.0`,spreading_factor:`7`,bandwidth:`125`,coding_rate:`5`}),d=a([]),f=a([]),p=a(!1),h=a(!1),g=a(null),_=m(()=>{switch(e.value){case 1:return!0;case 2:return n.value.trim().length>0;case 3:return i.value!==null;case 4:return r.value!==null;case 5:return l.value?u.value.frequency&&u.value.spreading_factor&&u.value.bandwidth&&u.value.coding_rate:o.value!==null;case 6:return s.value.length>=6&&s.value===c.value;default:return!1}}),v=m(()=>e.value>1),y=m(()=>e.value===t.value);async function b(){p.value=!0,g.value=null;try{let e=await(await fetch(`/api/hardware_options`)).json();if(e.error)throw Error(e.error);d.value=e.hardware||[]}catch(e){g.value=e instanceof Error?e.message:`Failed to load hardware options`,console.error(`Error fetching hardware options:`,e)}finally{p.value=!1}}let x=e=>({title:String(e.title??``),description:String(e.description??``),frequency:String(e.frequency??``),spreading_factor:String(e.spreading_factor??``),bandwidth:String(e.bandwidth??``),coding_rate:String(e.coding_rate??``)});async function S(){p.value=!0,g.value=null;try{try{let e=new AbortController,t=setTimeout(()=>e.abort(),4e3);try{let t=await fetch(`https://api.meshcore.nz/api/v1/config`,{signal:e.signal});if(t.ok){let e=(await t.json())?.config?.suggested_radio_settings?.entries??[];if(e.length>0){f.value=e.map(e=>x(e));return}}}finally{clearTimeout(t)}}catch{}let e=await(await fetch(`/api/radio_presets`)).json();if(e.error)throw Error(e.error);f.value=(e.presets??[]).map(e=>x(e))}catch(e){g.value=e instanceof Error?e.message:`Failed to load radio presets`,console.error(`Error fetching radio presets:`,e)}finally{p.value=!1}}async function C(){if(!_.value)return{success:!1,error:`Please complete all required fields`};h.value=!0,g.value=null;try{let e=l.value?{title:`Custom Configuration`,description:`Custom radio settings`,frequency:u.value.frequency,spreading_factor:u.value.spreading_factor,bandwidth:u.value.bandwidth,coding_rate:u.value.coding_rate}:o.value,t=await(await fetch(`/api/setup_wizard`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({node_name:n.value.trim(),hardware_key:r.value?.key,radio_preset:e,admin_password:s.value})})).json();if(!t.success)throw Error(t.error||`Setup failed`);return{success:!0,data:t}}catch(e){let t=e instanceof Error?e.message:`Failed to complete setup`;return g.value=t,{success:!1,error:t}}finally{h.value=!1}}function w(){_.value&&e.value=1&&n<=t.value&&(e.value=n)}function D(){e.value=1,n.value=`pyRpt${Math.floor(Math.random()*1e4).toString().padStart(4,`0`)}`,r.value=null,i.value=null,o.value=null,l.value=!1,u.value={frequency:`915.0`,spreading_factor:`7`,bandwidth:`125`,coding_rate:`5`},s.value=``,c.value=``,g.value=null}return{currentStep:e,totalSteps:t,nodeName:n,selectedHardware:r,selectedHardwareConnection:i,selectedRadioPreset:o,useCustomRadio:l,customRadio:u,adminPassword:s,confirmPassword:c,hardwareOptions:d,radioPresets:f,isLoading:p,isSubmitting:h,error:g,canGoNext:_,canGoBack:v,isLastStep:y,fetchHardwareOptions:b,fetchRadioPresets:S,completeSetup:C,nextStep:w,previousStep:T,goToStep:E,reset:D}}),H={class:`min-h-screen bg-background dark:bg-background overflow-hidden relative flex items-center justify-center p-4`},U={class:`absolute top-4 right-4 z-20`},W={class:`w-full max-w-4xl relative z-10`},G={class:`mb-8`},K={class:`flex justify-between mb-2`},q={class:`text-content-secondary dark:text-content-muted text-sm`},J={class:`text-content-secondary dark:text-content-muted text-sm`},Y={class:`h-2 bg-stroke-subtle dark:bg-stroke/10 rounded-full overflow-hidden`},X={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`},Z={class:`flex justify-center mb-8`},re={class:`flex gap-2`},ie={class:`mb-8`},ae={class:`text-2xl sm:text-3xl font-bold text-content-primary dark:text-content-primary mb-2 text-center`},oe={key:0,class:`space-y-6 mt-8`},se={key:1,class:`space-y-6 mt-8`},ce={class:`max-w-md mx-auto`},le={key:2,class:`space-y-6 mt-8`},ue={class:`grid grid-cols-1 md:grid-cols-3 gap-4 max-w-5xl mx-auto`},de=[`onClick`],fe={class:`font-semibold text-lg text-content-primary dark:text-content-primary mb-2`},pe={class:`text-sm text-content-secondary dark:text-content-muted`},me={key:3,class:`space-y-6 mt-8`},he={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`},_e={key:2,class:`text-center text-content-secondary dark:text-content-muted`},ve={key:3,class:`grid grid-cols-1 md:grid-cols-2 gap-4 max-w-3xl mx-auto`},ye=[`onClick`],be={class:`font-medium text-content-primary dark:text-content-primary mb-1`},xe={class:`text-sm text-content-secondary dark:text-content-muted`},Se={key:4,class:`space-y-6 mt-8`},Ce={key:0,class:`text-center text-content-secondary dark:text-content-muted`},we={key:1,class:`text-center text-content-secondary dark:text-content-muted`},Te={key:2,class:`max-w-5xl mx-auto`},Ee={class:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mb-4`},De=[`onClick`],Oe={class:`relative z-10`},ke={class:`font-medium text-content-primary dark:text-content-primary mb-1 flex items-start justify-between gap-2`},Ae={class:`flex items-center gap-2`},je={class:`text-2xl`},Me={key:0,class:`text-primary flex-shrink-0`},Ne={class:`text-xs text-content-secondary dark:text-content-muted mb-3`},Pe={class:`grid grid-cols-2 gap-2 text-xs`},Fe={class:`bg-gray-50 dark:bg-white/5 rounded px-2 py-1`},Ie={class:`text-content-primary dark:text-content-primary/80 font-medium`},Le={class:`bg-gray-50 dark:bg-white/5 rounded px-2 py-1`},Re={class:`text-content-primary dark:text-content-primary/80 font-medium`},ze={class:`bg-gray-50 dark:bg-white/5 rounded px-2 py-1`},Be={class:`text-content-primary dark:text-content-primary/80 font-medium`},Ve={class:`bg-gray-50 dark:bg-white/5 rounded px-2 py-1`},He={class:`text-content-primary dark:text-content-primary/80 font-medium`},Ue={class:`border-t border-stroke-subtle dark:border-stroke/10 pt-6`},We={class:`flex items-center justify-between mb-2`},Ge={key:0,class:`text-primary`},Ke={key:0,class:`mt-4 grid grid-cols-2 gap-4`},qe={key:5,class:`space-y-6 mt-8`},Je={class:`max-w-md mx-auto space-y-4`},Ye={key:0,class:`text-red-600 dark:text-red-400 text-sm`},Q={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`},Xe={class:`flex justify-between gap-4`},Ze={key:1},Qe=[`disabled`],$e={key:1},et={key:2},tt={key:3},nt={key:4,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},rt={class:`text-2xl font-bold text-content-primary dark:text-content-primary text-center mb-4`},it={class:`text-content-secondary dark:text-content-primary/70 text-center mb-6`},$=D(c({name:`SetupView`,__name:`Setup`,setup(c){let y=V(),x=a(!1),E=a(``),D=a(``),O=a(`error`),k=a(!1),A=e=>{let t=e.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`)?`🇻🇳`:`🌍`};n(async()=>{await Promise.all([y.fetchHardwareOptions(),y.fetchRadioPresets()])});let j=m(()=>y.currentStep/y.totalSteps*100),M=[{key:`gpio`,title:`HAT GPIO Based Device`,description:`Direct SPI/GPIO connected HATs and board-integrated radios.`},{key:`usb`,title:`USB Connection`,description:`USB-attached modems including CH341 and pyMC USB modem.`},{key:`network`,title:`Network Wi-Fi Based`,description:`Remote modem reached over LAN/Wi-Fi using pyMC TCP.`}];function N(e){let t=e.key.toLowerCase();if(t===`kiss`)return`usb`;let n=String(e.config?.connection_type||``).toLowerCase();return n===`usb`||n===`network`||n===`gpio`?n:t.includes(`ch341`)||t===`pymc_usb`?`usb`:t===`pymc_tcp`?`network`:`gpio`}let P=m(()=>{let e=y.selectedHardwareConnection;return e?y.hardwareOptions.filter(t=>N(t)===e):[]});function F(e){y.selectedHardwareConnection=e,y.selectedHardware&&!P.value.some(e=>e.key===y.selectedHardware?.key)&&(y.selectedHardware=null)}async function I(){if(y.isLastStep){let e=await y.completeSetup();e.success?k.value=!0:(O.value=`error`,E.value=`Setup Failed`,D.value=e.error||`An unknown error occurred`,x.value=!0)}else y.nextStep()}function L(){y.previousStep()}function $(){x.value=!1}let at=[`Welcome`,`Repeater Name`,`Connection Type`,`Hardware Selection`,`Radio Configuration`,`Security Setup`];return(n,a)=>(u(),v(`div`,H,[_(`div`,U,[f(ne)]),a[37]||=_(`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),a[38]||=_(`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),a[39]||=_(`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),_(`div`,W,[_(`div`,G,[_(`div`,K,[_(`span`,q,`Step `+t(p(y).currentStep)+` of `+t(p(y).totalSteps),1),_(`span`,J,t(Math.round(j.value))+`% Complete`,1)]),_(`div`,Y,[_(`div`,{class:`h-full bg-gradient-to-r from-primary to-primary/80 transition-all duration-500`,style:r({width:`${j.value}%`})},null,4)])]),_(`div`,X,[_(`div`,Z,[_(`div`,re,[(u(!0),v(g,null,l(p(y).totalSteps,e=>(u(),v(`div`,{key:e,class:b([`w-10 h-10 rounded-full flex items-center justify-center text-sm font-medium transition-all`,e===p(y).currentStep?`bg-primary text-white`:e

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)]])):p(y).currentStep===2?(u(),v(`div`,se,[a[13]||=_(`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),_(`div`,ce,[a[11]||=_(`label`,{class:`block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2`},`Repeater Name`,-1),i(_(`input`,{"onUpdate:modelValue":a[0]||=e=>p(y).nodeName=e,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,p(y).nodeName]]),a[12]||=_(`p`,{class:`text-content-secondary dark:text-content-muted text-xs mt-2`},` Use letters, numbers, hyphens, or underscores (3-32 characters) `,-1)])])):p(y).currentStep===3?(u(),v(`div`,le,[a[14]||=_(`p`,{class:`text-content-secondary dark:text-content-primary/70 text-center mb-6`},` Choose how your radio hardware connects to this repeater. `,-1),_(`div`,ue,[(u(),v(g,null,l(M,e=>_(`button`,{key:e.key,onClick:t=>F(e.key),class:b([`p-6 rounded-[16px] border transition-all duration-300 text-left backdrop-blur-sm min-h-[220px] flex flex-col`,p(y).selectedHardwareConnection===e.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`])},[_(`div`,{class:b([`mb-5 w-16 h-16 rounded-2xl flex items-center justify-center border transition-all duration-300`,p(y).selectedHardwareConnection===e.key?`bg-primary/20 border-primary/40 shadow-md shadow-primary/20`:`bg-white/60 dark:bg-white/10 border-stroke-subtle dark:border-stroke/20`])},[e.key===`gpio`?(u(),o(p(R),{key:0,class:`w-9 h-9 text-primary`,"stroke-width":1.8})):e.key===`usb`?(u(),o(p(z),{key:1,class:`w-9 h-9 text-primary`,"stroke-width":1.8})):(u(),o(p(B),{key:2,class:`w-9 h-9 text-primary`,"stroke-width":1.8}))],2),_(`div`,fe,t(e.title),1),_(`div`,pe,t(e.description),1)],10,de)),64))])])):p(y).currentStep===4?(u(),v(`div`,me,[a[15]||=_(`p`,{class:`text-content-secondary dark:text-content-primary/70 text-center mb-6`},` Select your hardware board type `,-1),p(y).isLoading?(u(),v(`div`,he,` Loading hardware options... `)):p(y).selectedHardwareConnection?P.value.length===0?(u(),v(`div`,_e,` No hardware options available for this connection type `)):(u(),v(`div`,ve,[(u(!0),v(g,null,l(P.value,e=>(u(),v(`button`,{key:e.key,onClick:t=>p(y).selectedHardware=e,class:b([`p-4 rounded-[12px] border transition-all duration-300 text-left backdrop-blur-sm`,p(y).selectedHardware?.key===e.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`])},[_(`div`,be,t(e.name),1),_(`div`,xe,t(e.description||e.key),1)],10,ye))),128))])):(u(),v(`div`,ge,` Choose a connection type first `))])):p(y).currentStep===5?(u(),v(`div`,Se,[a[30]||=_(`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),p(y).isLoading?(u(),v(`div`,Ce,` Loading radio presets... `)):p(y).radioPresets.length===0?(u(),v(`div`,we,` No radio presets available `)):(u(),v(`div`,Te,[_(`div`,Ee,[(u(!0),v(g,null,l(p(y).radioPresets,e=>(u(),v(`button`,{key:e.title,onClick:t=>{p(y).selectedRadioPreset=e,p(y).useCustomRadio=!1},class:b([`p-4 rounded-[12px] border transition-all duration-300 text-left backdrop-blur-sm relative overflow-hidden`,!p(y).useCustomRadio&&p(y).selectedRadioPreset?.title===e.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`])},[_(`div`,Oe,[_(`div`,ke,[_(`span`,Ae,[_(`span`,je,t(A(e.title)),1),_(`span`,null,t(e.title),1)]),!p(y).useCustomRadio&&p(y).selectedRadioPreset?.title===e.title?(u(),v(`div`,Me,[...a[16]||=[_(`svg`,{class:`w-5 h-5`,fill:`currentColor`,viewBox:`0 0 20 20`},[_(`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)]])):d(``,!0)]),_(`div`,Ne,t(e.description),1),_(`div`,Pe,[_(`div`,Fe,[a[17]||=_(`div`,{class:`text-content-muted dark:text-content-muted`},`Freq`,-1),_(`div`,Ie,t(e.frequency),1)]),_(`div`,Le,[a[18]||=_(`div`,{class:`text-content-muted dark:text-content-muted`},`BW`,-1),_(`div`,Re,t(e.bandwidth),1)]),_(`div`,ze,[a[19]||=_(`div`,{class:`text-content-muted dark:text-content-muted`},`SF`,-1),_(`div`,Be,t(e.spreading_factor),1)]),_(`div`,Ve,[a[20]||=_(`div`,{class:`text-content-muted dark:text-content-muted`},`CR`,-1),_(`div`,He,t(e.coding_rate),1)])])])],10,De))),128))]),_(`div`,Ue,[_(`button`,{onClick:a[1]||=e=>{p(y).useCustomRadio=!p(y).useCustomRadio,p(y).useCustomRadio&&(p(y).selectedRadioPreset=null)},class:b([`w-full p-4 rounded-[12px] border transition-all duration-300 text-left backdrop-blur-sm`,p(y).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`])},[_(`div`,We,[a[22]||=_(`div`,{class:`font-medium text-content-primary dark:text-content-primary flex items-center gap-2`},[_(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[_(`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`})]),h(` Custom Configuration `)],-1),p(y).useCustomRadio?(u(),v(`div`,Ge,[...a[21]||=[_(`svg`,{class:`w-5 h-5`,fill:`currentColor`,viewBox:`0 0 20 20`},[_(`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)]])):d(``,!0)]),a[23]||=_(`div`,{class:`text-xs text-content-secondary dark:text-content-muted`},` Manually configure frequency, bandwidth, spreading factor, and coding rate `,-1)],2),f(w,{name:`slide`},{default:e(()=>[p(y).useCustomRadio?(u(),v(`div`,Ke,[_(`div`,null,[a[24]||=_(`label`,{class:`block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2`},`Frequency (MHz)`,-1),i(_(`input`,{"onUpdate:modelValue":a[2]||=e=>p(y).customRadio.frequency=e,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,p(y).customRadio.frequency]])]),_(`div`,null,[a[25]||=_(`label`,{class:`block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2`},`Bandwidth (kHz)`,-1),i(_(`input`,{"onUpdate:modelValue":a[3]||=e=>p(y).customRadio.bandwidth=e,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,p(y).customRadio.bandwidth]])]),_(`div`,null,[a[27]||=_(`label`,{class:`block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2`},`Spreading Factor`,-1),i(_(`select`,{"onUpdate:modelValue":a[4]||=e=>p(y).customRadio.spreading_factor=e,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`},[...a[26]||=[_(`option`,{value:`7`},`7`,-1),_(`option`,{value:`8`},`8`,-1),_(`option`,{value:`9`},`9`,-1),_(`option`,{value:`10`},`10`,-1),_(`option`,{value:`11`},`11`,-1),_(`option`,{value:`12`},`12`,-1)]],512),[[S,p(y).customRadio.spreading_factor]])]),_(`div`,null,[a[29]||=_(`label`,{class:`block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2`},`Coding Rate`,-1),i(_(`select`,{"onUpdate:modelValue":a[5]||=e=>p(y).customRadio.coding_rate=e,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`},[...a[28]||=[_(`option`,{value:`5`},`4/5`,-1),_(`option`,{value:`6`},`4/6`,-1),_(`option`,{value:`7`},`4/7`,-1),_(`option`,{value:`8`},`4/8`,-1)]],512),[[S,p(y).customRadio.coding_rate]])])])):d(``,!0)]),_:1})])]))])):p(y).currentStep===6?(u(),v(`div`,qe,[a[34]||=_(`p`,{class:`text-content-secondary dark:text-content-primary/70 text-center mb-6`},` Set a secure admin password to protect your repeater `,-1),_(`div`,Je,[_(`div`,null,[a[31]||=_(`label`,{class:`block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2`},`Admin Password`,-1),i(_(`input`,{"onUpdate:modelValue":a[6]||=e=>p(y).adminPassword=e,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,p(y).adminPassword]])]),_(`div`,null,[a[32]||=_(`label`,{class:`block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2`},`Confirm Password`,-1),i(_(`input`,{"onUpdate:modelValue":a[7]||=e=>p(y).confirmPassword=e,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,p(y).confirmPassword]])]),p(y).adminPassword&&p(y).confirmPassword&&p(y).adminPassword!==p(y).confirmPassword?(u(),v(`div`,Ye,` Passwords do not match `)):d(``,!0),a[33]||=_(`div`,{class:`bg-yellow-500/10 border border-yellow-500/30 rounded-lg p-3 text-sm text-yellow-800 dark:text-yellow-200`},[_(`strong`,null,`Important:`),h(` Remember this password - you'll need it to access the dashboard. `)],-1)])])):d(``,!0)]),p(y).error?(u(),v(`div`,Q,t(p(y).error),1)):d(``,!0),_(`div`,Xe,[p(y).canGoBack?(u(),v(`button`,{key:0,onClick:L,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 `)):(u(),v(`div`,Ze)),_(`button`,{onClick:I,disabled:!p(y).canGoNext||p(y).isSubmitting,class:b([`px-8 py-3 rounded-[12px] font-semibold transition-all duration-300 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed`,p(y).canGoNext&&!p(y).isSubmitting?`bg-primary hover:bg-primary/90 text-white border border-primary hover:border-primary/80`:`bg-background-mute dark:bg-stroke/5 text-content-muted dark:text-content-muted border border-stroke-subtle dark:border-stroke/10`])},[p(y).isSubmitting?(u(),o(ee,{key:0,size:`sm`,color:`white`})):d(``,!0),p(y).isSubmitting?(u(),v(`span`,$e,`Setting up...`)):p(y).isLastStep?(u(),v(`span`,et,`Complete Setup`)):(u(),v(`span`,tt,`Next`)),!p(y).isSubmitting&&!p(y).isLastStep?(u(),v(`svg`,nt,[...a[35]||=[_(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M9 5l7 7-7 7`},null,-1)]])):d(``,!0)],10,Qe)])])]),f(w,{name:`modal`},{default:e(()=>[x.value?(u(),v(`div`,{key:0,class:`fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm`,onClick:$},[_(`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:a[8]||=T(()=>{},[`stop`])},[a[36]||=_(`div`,{class:`flex justify-center mb-6`},[_(`div`,{class:`w-16 h-16 rounded-full bg-red-100 dark:bg-red-500/20 flex items-center justify-center`},[_(`svg`,{class:`w-8 h-8 text-red-600 dark:text-red-400`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[_(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})])])],-1),_(`h3`,rt,t(E.value),1),_(`p`,it,t(D.value),1),_(`button`,{onClick:$,class:`w-full px-6 py-3 rounded-lg font-medium transition-colors bg-accent-red/20 hover:bg-accent-red/30 border border-accent-red/50 text-accent-red`},` Close `)])])):d(``,!0)]),_:1}),f(te,{modelValue:k.value,"onUpdate:modelValue":a[9]||=e=>k.value=e,"start-immediately":!0,message:`Setup complete. The service is restarting. This may take up to a minute.`},null,8,[`modelValue`])]))}}),[[`__scopeId`,`data-v-3f71558b`]]);export{$ as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/Setup-CySN3SxS.js b/repeater/web/html/assets/Setup-CySN3SxS.js deleted file mode 100644 index cdfdc78..0000000 --- a/repeater/web/html/assets/Setup-CySN3SxS.js +++ /dev/null @@ -1 +0,0 @@ -import{B as e,Ct as t,E as n,St as r,V as i,Y as a,c as o,f as s,g as c,j as l,k as u,l as d,m as f,nt as p,o as m,p as h,r as g,s as _,u as v,w as y,x as b,xt as x,y as S}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{n as C}from"./pinia-DP0dFoGY.js";import{t as w}from"./_plugin-vue_export-helper-TcpyXLsZ.js";import{t as T}from"./Spinner-CYvUNW0P.js";import{f as E,g as D,l as O,n as ee,p as k}from"./index-CG181k2K.js";var A=e=>e===``,j=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),M=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),N=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),P=e=>{let t=N(e);return t.charAt(0).toUpperCase()+t.slice(1)},F={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`},I=Symbol(`lucide-icons`);function L(){return b(I,{})}var R=({name:e,iconNode:t,absoluteStrokeWidth:n,"absolute-stroke-width":r,strokeWidth:i,"stroke-width":a,size:o,color:s,...c},{slots:l})=>{let{size:u,color:d,strokeWidth:f=2,absoluteStrokeWidth:p=!1,class:h=``}=L(),g=m(()=>{let e=A(n)||A(r)||n===!0||r===!0||p===!0,t=i||a||f||F[`stroke-width`];return e?Number(t)*24/Number(o??u??F.width):t});return S(`svg`,{...F,...c,width:o??u??F.width,height:o??u??F.height,stroke:s??d??F.stroke,"stroke-width":g.value,class:j(`lucide`,h,...e?[`lucide-${M(P(e))}-icon`,`lucide-${M(e)}`]:[`lucide-icon`])},[...t.map(e=>S(...e)),...l.default?[l.default()]:[]])},z=(e,t)=>(n,{slots:r,attrs:i})=>S(R,{...i,...n,iconNode:t,name:e},r.default?{default:r.default}:void 0),te=z(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),ne=z(`usb`,[[`circle`,{cx:`10`,cy:`7`,r:`1`,key:`dypaad`}],[`circle`,{cx:`4`,cy:`20`,r:`1`,key:`22iqad`}],[`path`,{d:`M4.7 19.3 19 5`,key:`1enqfc`}],[`path`,{d:`m21 3-3 1 2 2Z`,key:`d3ov82`}],[`path`,{d:`M9.26 7.68 5 12l2 5`,key:`1esawj`}],[`path`,{d:`m10 14 5 2 3.5-3.5`,key:`v8oal5`}],[`path`,{d:`m18 12 1-1 1 1-1 1Z`,key:`1bh22v`}]]),re=z(`wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),B=C(`setup`,()=>{let e=a(1),t=a(6),n=a(`pyRpt${Math.floor(Math.random()*1e4).toString().padStart(4,`0`)}`),r=a(null),i=a(null),o=a(null),s=a(``),c=a(``),l=a(!1),u=a({frequency:`915.0`,spreading_factor:`7`,bandwidth:`125`,coding_rate:`5`}),d=a([]),f=a([]),p=a(!1),h=a(!1),g=a(null),_=m(()=>{switch(e.value){case 1:return!0;case 2:return n.value.trim().length>0;case 3:return i.value!==null;case 4:return r.value!==null;case 5:return l.value?u.value.frequency&&u.value.spreading_factor&&u.value.bandwidth&&u.value.coding_rate:o.value!==null;case 6:return s.value.length>=6&&s.value===c.value;default:return!1}}),v=m(()=>e.value>1),y=m(()=>e.value===t.value);async function b(){p.value=!0,g.value=null;try{let e=await(await fetch(`/api/hardware_options`)).json();if(e.error)throw Error(e.error);d.value=e.hardware||[]}catch(e){g.value=e instanceof Error?e.message:`Failed to load hardware options`,console.error(`Error fetching hardware options:`,e)}finally{p.value=!1}}let x=e=>({title:String(e.title??``),description:String(e.description??``),frequency:String(e.frequency??``),spreading_factor:String(e.spreading_factor??``),bandwidth:String(e.bandwidth??``),coding_rate:String(e.coding_rate??``)});async function S(){p.value=!0,g.value=null;try{try{let e=new AbortController,t=setTimeout(()=>e.abort(),4e3);try{let t=await fetch(`https://api.meshcore.nz/api/v1/config`,{signal:e.signal});if(t.ok){let e=(await t.json())?.config?.suggested_radio_settings?.entries??[];if(e.length>0){f.value=e.map(e=>x(e));return}}}finally{clearTimeout(t)}}catch{}let e=await(await fetch(`/api/radio_presets`)).json();if(e.error)throw Error(e.error);f.value=(e.presets??[]).map(e=>x(e))}catch(e){g.value=e instanceof Error?e.message:`Failed to load radio presets`,console.error(`Error fetching radio presets:`,e)}finally{p.value=!1}}async function C(){if(!_.value)return{success:!1,error:`Please complete all required fields`};h.value=!0,g.value=null;try{let e=l.value?{title:`Custom Configuration`,description:`Custom radio settings`,frequency:u.value.frequency,spreading_factor:u.value.spreading_factor,bandwidth:u.value.bandwidth,coding_rate:u.value.coding_rate}:o.value,t=await(await fetch(`/api/setup_wizard`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({node_name:n.value.trim(),hardware_key:r.value?.key,radio_preset:e,admin_password:s.value})})).json();if(!t.success)throw Error(t.error||`Setup failed`);return{success:!0,data:t}}catch(e){let t=e instanceof Error?e.message:`Failed to complete setup`;return g.value=t,{success:!1,error:t}}finally{h.value=!1}}function w(){_.value&&e.value=1&&n<=t.value&&(e.value=n)}function D(){e.value=1,n.value=`pyRpt${Math.floor(Math.random()*1e4).toString().padStart(4,`0`)}`,r.value=null,i.value=null,o.value=null,l.value=!1,u.value={frequency:`915.0`,spreading_factor:`7`,bandwidth:`125`,coding_rate:`5`},s.value=``,c.value=``,g.value=null}return{currentStep:e,totalSteps:t,nodeName:n,selectedHardware:r,selectedHardwareConnection:i,selectedRadioPreset:o,useCustomRadio:l,customRadio:u,adminPassword:s,confirmPassword:c,hardwareOptions:d,radioPresets:f,isLoading:p,isSubmitting:h,error:g,canGoNext:_,canGoBack:v,isLastStep:y,fetchHardwareOptions:b,fetchRadioPresets:S,completeSetup:C,nextStep:w,previousStep:T,goToStep:E,reset:D}}),V={class:`min-h-screen bg-background dark:bg-background overflow-hidden relative flex items-center justify-center p-4`},H={class:`absolute top-4 right-4 z-20`},U={class:`w-full max-w-4xl relative z-10`},W={class:`mb-8`},G={class:`flex justify-between mb-2`},K={class:`text-content-secondary dark:text-content-muted text-sm`},q={class:`text-content-secondary dark:text-content-muted text-sm`},J={class:`h-2 bg-stroke-subtle dark:bg-stroke/10 rounded-full overflow-hidden`},Y={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`},X={class:`flex justify-center mb-8`},ie={class:`flex gap-2`},ae={class:`mb-8`},oe={class:`text-2xl sm:text-3xl font-bold text-content-primary dark:text-content-primary mb-2 text-center`},se={key:0,class:`space-y-6 mt-8`},ce={key:1,class:`space-y-6 mt-8`},le={class:`max-w-md mx-auto`},ue={key:2,class:`space-y-6 mt-8`},de={class:`grid grid-cols-1 md:grid-cols-3 gap-4 max-w-5xl mx-auto`},fe=[`onClick`],pe={class:`font-semibold text-lg text-content-primary dark:text-content-primary mb-2`},me={class:`text-sm text-content-secondary dark:text-content-muted`},he={key:3,class:`space-y-6 mt-8`},ge={key:0,class:`text-center text-content-secondary dark:text-content-muted`},_e={key:1,class:`text-center text-content-secondary dark:text-content-muted`},ve={key:2,class:`text-center text-content-secondary dark:text-content-muted`},ye={key:3,class:`grid grid-cols-1 md:grid-cols-2 gap-4 max-w-3xl mx-auto`},be=[`onClick`],xe={class:`font-medium text-content-primary dark:text-content-primary mb-1`},Se={class:`text-sm text-content-secondary dark:text-content-muted`},Ce={key:4,class:`space-y-6 mt-8`},we={key:0,class:`text-center text-content-secondary dark:text-content-muted`},Te={key:1,class:`text-center text-content-secondary dark:text-content-muted`},Ee={key:2,class:`max-w-5xl mx-auto`},De={class:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mb-4`},Oe=[`onClick`],ke={class:`relative z-10`},Ae={class:`font-medium text-content-primary dark:text-content-primary mb-1 flex items-start justify-between gap-2`},je={class:`flex items-center gap-2`},Me={class:`text-2xl`},Ne={key:0,class:`text-primary flex-shrink-0`},Pe={class:`text-xs text-content-secondary dark:text-content-muted mb-3`},Fe={class:`grid grid-cols-2 gap-2 text-xs`},Ie={class:`bg-gray-50 dark:bg-white/5 rounded px-2 py-1`},Le={class:`text-content-primary dark:text-content-primary/80 font-medium`},Re={class:`bg-gray-50 dark:bg-white/5 rounded px-2 py-1`},ze={class:`text-content-primary dark:text-content-primary/80 font-medium`},Be={class:`bg-gray-50 dark:bg-white/5 rounded px-2 py-1`},Ve={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`},We={class:`border-t border-stroke-subtle dark:border-stroke/10 pt-6`},Ge={class:`flex items-center justify-between mb-2`},Ke={key:0,class:`text-primary`},qe={key:0,class:`mt-4 grid grid-cols-2 gap-4`},Je={key:5,class:`space-y-6 mt-8`},Ye={class:`max-w-md mx-auto space-y-4`},Xe={key:0,class:`text-red-600 dark:text-red-400 text-sm`},Z={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`},Qe={key:1},$e=[`disabled`],et={key:1},tt={key:2},nt={key:3},rt={key:4,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},it={class:`text-2xl font-bold text-content-primary dark:text-content-primary text-center mb-4`},at={class:`text-content-secondary dark:text-content-primary/70 text-center mb-6`},ot={key:0,class:`fixed inset-0 z-[500] flex items-center justify-center p-4 bg-black/75 backdrop-blur-md`},st={class:`bg-white dark:bg-surface-elevated backdrop-blur-xl max-w-sm w-full p-10 rounded-[24px] border border-stroke-subtle dark:border-white/20 shadow-[0_8px_48px_0_rgba(0,0,0,0.5)] flex flex-col items-center gap-6`},Q=w(c({name:`SetupView`,__name:`Setup`,setup(c){let b=B(),S=a(!1),C=a(``),w=a(``),A=a(`error`),j=a(!1),M=null,N=e=>{let t=e.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`)?`🇻🇳`:`🌍`};n(async()=>{await Promise.all([b.fetchHardwareOptions(),b.fetchRadioPresets()])});let P=m(()=>b.currentStep/b.totalSteps*100),F=[{key:`gpio`,title:`HAT GPIO Based Device`,description:`Direct SPI/GPIO connected HATs and board-integrated radios.`},{key:`usb`,title:`USB Connection`,description:`USB-attached modems including CH341 and pyMC USB modem.`},{key:`network`,title:`Network Wi-Fi Based`,description:`Remote modem reached over LAN/Wi-Fi using pyMC TCP.`}];function I(e){let t=e.key.toLowerCase();if(t===`kiss`)return`usb`;let n=String(e.config?.connection_type||``).toLowerCase();return n===`usb`||n===`network`||n===`gpio`?n:t.includes(`ch341`)||t===`pymc_usb`?`usb`:t===`pymc_tcp`?`network`:`gpio`}let L=m(()=>{let e=b.selectedHardwareConnection;return e?b.hardwareOptions.filter(t=>I(t)===e):[]});function R(e){b.selectedHardwareConnection=e,b.selectedHardware&&!L.value.some(e=>e.key===b.selectedHardware?.key)&&(b.selectedHardware=null)}async function z(){if(b.isLastStep){let e=await b.completeSetup();e.success?(j.value=!0,ct()):(A.value=`error`,C.value=`Setup Failed`,w.value=e.error||`An unknown error occurred`,S.value=!0)}else b.nextStep()}function Q(){b.previousStep()}function $(){S.value=!1}function ct(){let e=0;function t(){e++,fetch(`/api/needs_setup`,{method:`GET`}).then(e=>{e.ok?(M=null,window.location.reload()):n()}).catch(()=>{n()})}function n(){e<90?M=setTimeout(t,1e3):(M=null,window.location.reload())}M=setTimeout(t,3e3)}y(()=>{M&&=(clearTimeout(M),null)});let lt=[`Welcome`,`Repeater Name`,`Connection Type`,`Hardware Selection`,`Radio Configuration`,`Security Setup`];return(n,a)=>(u(),v(`div`,V,[_(`div`,H,[f(ee)]),a[37]||=_(`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),a[38]||=_(`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),a[39]||=_(`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),_(`div`,U,[_(`div`,W,[_(`div`,G,[_(`span`,K,`Step `+t(p(b).currentStep)+` of `+t(p(b).totalSteps),1),_(`span`,q,t(Math.round(P.value))+`% Complete`,1)]),_(`div`,J,[_(`div`,{class:`h-full bg-gradient-to-r from-primary to-primary/80 transition-all duration-500`,style:r({width:`${P.value}%`})},null,4)])]),_(`div`,Y,[_(`div`,X,[_(`div`,ie,[(u(!0),v(g,null,l(p(b).totalSteps,e=>(u(),v(`div`,{key:e,class:x([`w-10 h-10 rounded-full flex items-center justify-center text-sm font-medium transition-all`,e===p(b).currentStep?`bg-primary text-white`:e

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)]])):p(b).currentStep===2?(u(),v(`div`,ce,[a[12]||=_(`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),_(`div`,le,[a[10]||=_(`label`,{class:`block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2`},`Repeater Name`,-1),i(_(`input`,{"onUpdate:modelValue":a[0]||=e=>p(b).nodeName=e,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),[[k,p(b).nodeName]]),a[11]||=_(`p`,{class:`text-content-secondary dark:text-content-muted text-xs mt-2`},` Use letters, numbers, hyphens, or underscores (3-32 characters) `,-1)])])):p(b).currentStep===3?(u(),v(`div`,ue,[a[13]||=_(`p`,{class:`text-content-secondary dark:text-content-primary/70 text-center mb-6`},` Choose how your radio hardware connects to this repeater. `,-1),_(`div`,de,[(u(),v(g,null,l(F,e=>_(`button`,{key:e.key,onClick:t=>R(e.key),class:x([`p-6 rounded-[16px] border transition-all duration-300 text-left backdrop-blur-sm min-h-[220px] flex flex-col`,p(b).selectedHardwareConnection===e.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`])},[_(`div`,{class:x([`mb-5 w-16 h-16 rounded-2xl flex items-center justify-center border transition-all duration-300`,p(b).selectedHardwareConnection===e.key?`bg-primary/20 border-primary/40 shadow-md shadow-primary/20`:`bg-white/60 dark:bg-white/10 border-stroke-subtle dark:border-stroke/20`])},[e.key===`gpio`?(u(),o(p(te),{key:0,class:`w-9 h-9 text-primary`,"stroke-width":1.8})):e.key===`usb`?(u(),o(p(ne),{key:1,class:`w-9 h-9 text-primary`,"stroke-width":1.8})):(u(),o(p(re),{key:2,class:`w-9 h-9 text-primary`,"stroke-width":1.8}))],2),_(`div`,pe,t(e.title),1),_(`div`,me,t(e.description),1)],10,fe)),64))])])):p(b).currentStep===4?(u(),v(`div`,he,[a[14]||=_(`p`,{class:`text-content-secondary dark:text-content-primary/70 text-center mb-6`},` Select your hardware board type `,-1),p(b).isLoading?(u(),v(`div`,ge,` Loading hardware options... `)):p(b).selectedHardwareConnection?L.value.length===0?(u(),v(`div`,ve,` No hardware options available for this connection type `)):(u(),v(`div`,ye,[(u(!0),v(g,null,l(L.value,e=>(u(),v(`button`,{key:e.key,onClick:t=>p(b).selectedHardware=e,class:x([`p-4 rounded-[12px] border transition-all duration-300 text-left backdrop-blur-sm`,p(b).selectedHardware?.key===e.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`])},[_(`div`,xe,t(e.name),1),_(`div`,Se,t(e.description||e.key),1)],10,be))),128))])):(u(),v(`div`,_e,` Choose a connection type first `))])):p(b).currentStep===5?(u(),v(`div`,Ce,[a[29]||=_(`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),p(b).isLoading?(u(),v(`div`,we,` Loading radio presets... `)):p(b).radioPresets.length===0?(u(),v(`div`,Te,` No radio presets available `)):(u(),v(`div`,Ee,[_(`div`,De,[(u(!0),v(g,null,l(p(b).radioPresets,e=>(u(),v(`button`,{key:e.title,onClick:t=>{p(b).selectedRadioPreset=e,p(b).useCustomRadio=!1},class:x([`p-4 rounded-[12px] border transition-all duration-300 text-left backdrop-blur-sm relative overflow-hidden`,!p(b).useCustomRadio&&p(b).selectedRadioPreset?.title===e.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`])},[_(`div`,ke,[_(`div`,Ae,[_(`span`,je,[_(`span`,Me,t(N(e.title)),1),_(`span`,null,t(e.title),1)]),!p(b).useCustomRadio&&p(b).selectedRadioPreset?.title===e.title?(u(),v(`div`,Ne,[...a[15]||=[_(`svg`,{class:`w-5 h-5`,fill:`currentColor`,viewBox:`0 0 20 20`},[_(`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)]])):d(``,!0)]),_(`div`,Pe,t(e.description),1),_(`div`,Fe,[_(`div`,Ie,[a[16]||=_(`div`,{class:`text-content-muted dark:text-content-muted`},`Freq`,-1),_(`div`,Le,t(e.frequency),1)]),_(`div`,Re,[a[17]||=_(`div`,{class:`text-content-muted dark:text-content-muted`},`BW`,-1),_(`div`,ze,t(e.bandwidth),1)]),_(`div`,Be,[a[18]||=_(`div`,{class:`text-content-muted dark:text-content-muted`},`SF`,-1),_(`div`,Ve,t(e.spreading_factor),1)]),_(`div`,He,[a[19]||=_(`div`,{class:`text-content-muted dark:text-content-muted`},`CR`,-1),_(`div`,Ue,t(e.coding_rate),1)])])])],10,Oe))),128))]),_(`div`,We,[_(`button`,{onClick:a[1]||=e=>{p(b).useCustomRadio=!p(b).useCustomRadio,p(b).useCustomRadio&&(p(b).selectedRadioPreset=null)},class:x([`w-full p-4 rounded-[12px] border transition-all duration-300 text-left backdrop-blur-sm`,p(b).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`])},[_(`div`,Ge,[a[21]||=_(`div`,{class:`font-medium text-content-primary dark:text-content-primary flex items-center gap-2`},[_(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[_(`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`})]),h(` Custom Configuration `)],-1),p(b).useCustomRadio?(u(),v(`div`,Ke,[...a[20]||=[_(`svg`,{class:`w-5 h-5`,fill:`currentColor`,viewBox:`0 0 20 20`},[_(`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)]])):d(``,!0)]),a[22]||=_(`div`,{class:`text-xs text-content-secondary dark:text-content-muted`},` Manually configure frequency, bandwidth, spreading factor, and coding rate `,-1)],2),f(O,{name:`slide`},{default:e(()=>[p(b).useCustomRadio?(u(),v(`div`,qe,[_(`div`,null,[a[23]||=_(`label`,{class:`block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2`},`Frequency (MHz)`,-1),i(_(`input`,{"onUpdate:modelValue":a[2]||=e=>p(b).customRadio.frequency=e,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),[[k,p(b).customRadio.frequency]])]),_(`div`,null,[a[24]||=_(`label`,{class:`block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2`},`Bandwidth (kHz)`,-1),i(_(`input`,{"onUpdate:modelValue":a[3]||=e=>p(b).customRadio.bandwidth=e,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),[[k,p(b).customRadio.bandwidth]])]),_(`div`,null,[a[26]||=_(`label`,{class:`block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2`},`Spreading Factor`,-1),i(_(`select`,{"onUpdate:modelValue":a[4]||=e=>p(b).customRadio.spreading_factor=e,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`},[...a[25]||=[_(`option`,{value:`7`},`7`,-1),_(`option`,{value:`8`},`8`,-1),_(`option`,{value:`9`},`9`,-1),_(`option`,{value:`10`},`10`,-1),_(`option`,{value:`11`},`11`,-1),_(`option`,{value:`12`},`12`,-1)]],512),[[E,p(b).customRadio.spreading_factor]])]),_(`div`,null,[a[28]||=_(`label`,{class:`block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2`},`Coding Rate`,-1),i(_(`select`,{"onUpdate:modelValue":a[5]||=e=>p(b).customRadio.coding_rate=e,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`},[...a[27]||=[_(`option`,{value:`5`},`4/5`,-1),_(`option`,{value:`6`},`4/6`,-1),_(`option`,{value:`7`},`4/7`,-1),_(`option`,{value:`8`},`4/8`,-1)]],512),[[E,p(b).customRadio.coding_rate]])])])):d(``,!0)]),_:1})])]))])):p(b).currentStep===6?(u(),v(`div`,Je,[a[33]||=_(`p`,{class:`text-content-secondary dark:text-content-primary/70 text-center mb-6`},` Set a secure admin password to protect your repeater `,-1),_(`div`,Ye,[_(`div`,null,[a[30]||=_(`label`,{class:`block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2`},`Admin Password`,-1),i(_(`input`,{"onUpdate:modelValue":a[6]||=e=>p(b).adminPassword=e,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),[[k,p(b).adminPassword]])]),_(`div`,null,[a[31]||=_(`label`,{class:`block text-content-primary dark:text-content-primary/90 text-sm font-medium mb-2`},`Confirm Password`,-1),i(_(`input`,{"onUpdate:modelValue":a[7]||=e=>p(b).confirmPassword=e,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),[[k,p(b).confirmPassword]])]),p(b).adminPassword&&p(b).confirmPassword&&p(b).adminPassword!==p(b).confirmPassword?(u(),v(`div`,Xe,` Passwords do not match `)):d(``,!0),a[32]||=_(`div`,{class:`bg-yellow-500/10 border border-yellow-500/30 rounded-lg p-3 text-sm text-yellow-800 dark:text-yellow-200`},[_(`strong`,null,`Important:`),h(` Remember this password - you'll need it to access the dashboard. `)],-1)])])):d(``,!0)]),p(b).error?(u(),v(`div`,Z,t(p(b).error),1)):d(``,!0),_(`div`,Ze,[p(b).canGoBack?(u(),v(`button`,{key:0,onClick:Q,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 `)):(u(),v(`div`,Qe)),_(`button`,{onClick:z,disabled:!p(b).canGoNext||p(b).isSubmitting,class:x([`px-8 py-3 rounded-[12px] font-semibold transition-all duration-300 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed`,p(b).canGoNext&&!p(b).isSubmitting?`bg-primary hover:bg-primary/90 text-white border border-primary hover:border-primary/80`:`bg-background-mute dark:bg-stroke/5 text-content-muted dark:text-content-muted border border-stroke-subtle dark:border-stroke/10`])},[p(b).isSubmitting?(u(),o(T,{key:0,size:`sm`,color:`white`})):d(``,!0),p(b).isSubmitting?(u(),v(`span`,et,`Setting up...`)):p(b).isLastStep?(u(),v(`span`,tt,`Complete Setup`)):(u(),v(`span`,nt,`Next`)),!p(b).isSubmitting&&!p(b).isLastStep?(u(),v(`svg`,rt,[...a[34]||=[_(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M9 5l7 7-7 7`},null,-1)]])):d(``,!0)],10,$e)])])]),f(O,{name:`modal`},{default:e(()=>[S.value?(u(),v(`div`,{key:0,class:`fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm`,onClick:$},[_(`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:a[8]||=D(()=>{},[`stop`])},[a[35]||=_(`div`,{class:`flex justify-center mb-6`},[_(`div`,{class:`w-16 h-16 rounded-full bg-red-100 dark:bg-red-500/20 flex items-center justify-center`},[_(`svg`,{class:`w-8 h-8 text-red-600 dark:text-red-400`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[_(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})])])],-1),_(`h3`,it,t(C.value),1),_(`p`,at,t(w.value),1),_(`button`,{onClick:$,class:`w-full px-6 py-3 rounded-lg font-medium transition-colors bg-accent-red/20 hover:bg-accent-red/30 border border-accent-red/50 text-accent-red`},` Close `)])])):d(``,!0)]),_:1}),f(O,{name:`modal`},{default:e(()=>[j.value?(u(),v(`div`,ot,[_(`div`,st,[f(T,{size:`lg`}),a[36]||=_(`div`,{class:`text-center`},[_(`h3`,{class:`text-xl font-bold text-content-primary dark:text-content-primary mb-2`},` Restarting… `),_(`p`,{class:`text-sm text-content-secondary dark:text-content-primary/60`},` Please wait while the service restarts. This may take up to a minute. `)],-1)])])):d(``,!0)]),_:1})]))}}),[[`__scopeId`,`data-v-5b488fbf`]]);export{Q as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/Setup-DHp0ibOb.css b/repeater/web/html/assets/Setup-DHp0ibOb.css new file mode 100644 index 0000000..e2ee98f --- /dev/null +++ b/repeater/web/html/assets/Setup-DHp0ibOb.css @@ -0,0 +1 @@ +.glass-card[data-v-3f71558b]{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background:#ffffff0d;border:1px solid #ffffff1a}.modal-enter-active[data-v-3f71558b],.modal-leave-active[data-v-3f71558b]{transition:opacity .3s}.modal-enter-from[data-v-3f71558b],.modal-leave-to[data-v-3f71558b]{opacity:0}.modal-enter-active .glass-card[data-v-3f71558b],.modal-leave-active .glass-card[data-v-3f71558b]{transition:transform .3s}.modal-enter-from .glass-card[data-v-3f71558b],.modal-leave-to .glass-card[data-v-3f71558b]{transform:scale(.9)}.slide-enter-active[data-v-3f71558b],.slide-leave-active[data-v-3f71558b]{transition:all .3s}.slide-enter-from[data-v-3f71558b],.slide-leave-to[data-v-3f71558b]{opacity:0;transform:translateY(-10px)}@keyframes float-slow-3f71558b{0%,to{opacity:.8;transform:translate(0)scale(1)rotate(-24.22deg)}50%{opacity:.6;transform:translate(20px,-20px)scale(1.05)rotate(-24.22deg)}}@keyframes float-slower-3f71558b{0%,to{opacity:.75;transform:translate(0)scale(1)rotate(-24.22deg)}50%{opacity:.5;transform:translate(-30px,20px)scale(1.08)rotate(-24.22deg)}}@keyframes float-slowest-3f71558b{0%,to{opacity:.8;transform:translate(0)scale(1)rotate(-24.22deg)}50%{opacity:.55;transform:translate(25px,25px)scale(1.1)rotate(-24.22deg)}}.animate-pulse-slow[data-v-3f71558b]{will-change:transform, opacity;animation:15s ease-in-out infinite float-slow-3f71558b}.animate-pulse-slower[data-v-3f71558b]{will-change:transform, opacity;animation:18s ease-in-out infinite float-slower-3f71558b}.animate-pulse-slowest[data-v-3f71558b]{will-change:transform, opacity;animation:20s ease-in-out infinite float-slowest-3f71558b} diff --git a/repeater/web/html/assets/Statistics-CW9a5fGJ.js b/repeater/web/html/assets/Statistics-CW9a5fGJ.js new file mode 100644 index 0000000..3b45fb2 --- /dev/null +++ b/repeater/web/html/assets/Statistics-CW9a5fGJ.js @@ -0,0 +1 @@ +import{B as e,Ct as t,E as n,J as r,K as i,Q as a,S as o,St as s,V as c,Y as l,g as u,j as d,k as f,l as p,m,o as ee,r as h,s as g,u as _,w as te}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{o as ne}from"./runtime-dom.esm-bundler-fKU3dih-.js";import{t as re}from"./packets-B7XZyaZ9.js";import{_ as ie,a as ae,c as oe,d as se,f as ce,g as le,i as ue,l as de,m as fe,n as v,o as pe,p as me,r as he,s as y,t as b,u as ge,v as _e,y as ve}from"./ChartCard-Cqs_1Frf.js";import{t as x}from"./chartjs-adapter-date-fns.esm-NizYWXHk.js";var ye={class:`p-3 sm:p-6 space-y-4 sm:space-y-6`},be={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center gap-3`},xe={class:`flex items-center gap-2 sm:gap-3`},Se=[`value`],Ce={class:`grid grid-cols-1 sm:grid-cols-3 gap-4`},we={class:`glass-card rounded-[15px] p-3 sm:p-6`},Te={class:`flex items-center gap-3 sm:gap-6 mb-3 sm:mb-4`},Ee={class:`flex items-center gap-2`},De={class:`flex items-center gap-2`},Oe={class:`grid grid-cols-1 lg:grid-cols-2 gap-4 sm:gap-6 items-stretch`},ke={class:`glass-card rounded-[15px] p-3 sm:p-6 flex flex-col`},Ae={class:`glass-card rounded-[15px] p-3 sm:p-6 flex flex-col`},je={class:`w-28 sm:w-32 text-sm text-content-primary dark:text-content-primary truncate`},Me={class:`flex-1 h-12 bg-background-mute dark:bg-stroke/10 rounded overflow-hidden`},Ne={class:`w-20 text-sm text-content-secondary dark:text-content-muted text-right tabular-nums`},S=20,C=u({name:`StatisticsView`,__name:`Statistics`,setup(u){y.register(pe,se,ce,ge,de,ue,oe,me,_e,ve,ie,he,ae,le,fe);let C=re(),w=e=>e>48?{unit:`day`,displayFormats:{day:`EEE MMM d`}}:e>24?{unit:`hour`,displayFormats:{hour:`EEE HH:mm`}}:{unit:`hour`,displayFormats:{hour:`HH:mm`}},T=r({packetRate:`Connecting...`,noiseFloor:`Connecting...`,routePie:`Connecting...`}),E=()=>{let 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)`}},D={tx:`#F59E0B`,rx:`#C084FC`,noiseFloor:`#F59E0B`,noiseFloorFill:`rgba(245, 158, 11, 0.8)`,noiseFloorGrid:`rgba(245, 158, 11, 0.2)`,totalRx:`#AAE8E8`,totalTx:`#FFC246`,crcErrors:`#F59E0B`,packetTypes:[`#60A5FA`,`#34D399`,`#FBBF24`,`#A78BFA`,`#F87171`,`#06B6D4`,`#84CC16`,`#F472B6`,`#10B981`],routes:[`#3B82F6`,`#10B981`,`#F59E0B`,`#A78BFA`,`#F87171`]},O=l(24),Pe=[{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`}],k=l(null),A=l(null),j=l(null),M=l([]),N=l([]),P=l(!0),F=l(null),I=l({packetRate:!0,noiseFloor:!1,routePie:!0,sparklineMetrics:!0,sparklineCrc:!0}),L=l(null),R=l(null),z=l(null),B=l(null),V=l(null),H=l(null),U=l(null),W=l(null),G=l({totalRx:0,totalTx:0}),K=(e,t)=>{if(e.length===0)return[];let n=Math.round(t*60*60*1e3/72),r=new Map;return e.forEach(([e,t])=>{let i=e;e>0x38d7ea4c68000?i=e/1e3:e>1e9&&e<0xe8d4a51000&&(i=e*1e3);let a=Math.floor(i/n)*n;r.has(a)||r.set(a,[]),r.get(a).push(t)}),Array.from(r.entries()).sort((e,t)=>e[0]-t[0]).map(([,e])=>e.reduce((e,t)=>e+t,0)/e.length)},q=ee(()=>{let e=[],t=[];if(k.value?.series){let n=k.value.series.find(e=>e.type===`rx_count`),r=k.value.series.find(e=>e.type===`tx_count`);n?.data&&(e=K(n.data.map(([e,t])=>[e,t>S?0:t]),O.value)),r?.data&&(t=K(r.data.map(([e,t])=>[e,t>S?0:t]),O.value))}return{totalPackets:e,transmittedPackets:t,droppedPackets:[],crcErrors:K(N.value.map(e=>[e.timestamp>0xe8d4a51000?e.timestamp:e.timestamp*1e3,e.count]),O.value)}}),J=async()=>{try{P.value=!0,F.value=null;let e=await v(`/packet_stats`,{hours:O.value});G.value={totalRx:e.data?.total_packets||0,totalTx:e.data?.transmitted_packets||0},P.value=!1}catch(e){F.value=e instanceof Error?e.message:`Failed to fetch data`,P.value=!1}Fe()},Fe=async()=>{I.value={packetRate:!0,noiseFloor:!0,routePie:!0,sparklineMetrics:!0,sparklineCrc:!0},C.metricsGraphData&&(k.value=C.metricsGraphData),C.crcErrorHistory.length>0&&(N.value=[...C.crcErrorHistory]),C.noiseFloorHistory.length>0&&(A.value={chart_data:C.noiseFloorHistory.map(e=>({timestamp:e.timestamp,noise_floor_dbm:e.noise_floor_dbm}))},$()),Y(),X(),Z(),Q()},Y=async()=>{T.packetRate=`Connecting...`,L.value=null;try{let e=await v(`/metrics_graph_data`,{hours:O.value,resolution:`average`,metrics:`rx_count,tx_count`},{onPhaseChange:e=>{T.packetRate=e===`receiving`?`Receiving data...`:`Connecting...`}});e?.success&&(k.value=e.data)}catch(e){L.value=e instanceof Error?e.message:`Failed to load`,k.value=null}finally{I.value.packetRate=!1,I.value.sparklineMetrics=!1,L.value||(await o(),Re())}},X=async()=>{T.routePie=`Connecting...`,R.value=null;try{let e=await v(`/route_stats`,{hours:O.value},{onPhaseChange:e=>{T.routePie=e===`receiving`?`Receiving data...`:`Connecting...`}});e?.success&&e.data&&(j.value=e.data)}catch(e){j.value=null,R.value=e instanceof Error?e.message:`Failed to load`}finally{I.value.routePie=!1}},Z=async()=>{T.noiseFloor=`Connecting...`,z.value=null;try{let e=O.value*120,t=await v(`/noise_floor_history`,{hours:O.value,limit:e},{idleTimeoutMs:3e4,onPhaseChange:e=>{T.noiseFloor=e===`receiving`?`Receiving data...`:`Connecting...`}});if(t.success&&t.data){let e=t.data.history||[];if(Array.isArray(e)&&e.length>0){let t=e;if(e.length>1500){let n=Math.ceil(e.length/1500);t=e.filter((e,t)=>t%n===0)}A.value={chart_data:t.map(e=>({timestamp:e.timestamp||Date.now()/1e3,noise_floor_dbm:e.noise_floor_dbm||e.noise_floor||-120}))},$()}}}catch(e){A.value={chart_data:[]},z.value=e instanceof Error?e.message:`Failed to load`}finally{I.value.noiseFloor=!1,z.value||(await o(),ze())}},Q=async()=>{B.value=null;try{let e=await v(`/crc_error_history`,{hours:O.value});e?.success&&e.data&&(N.value=e.data.history||[])}catch(e){N.value=[],B.value=e instanceof Error?e.message:`Failed to load`}finally{I.value.sparklineCrc=!1}},Ie=()=>{I.value={packetRate:!0,noiseFloor:!0,routePie:!0,sparklineMetrics:!0,sparklineCrc:!0},Le(),L.value=null,R.value=null,z.value=null,J()},$=()=>{M.value=[],A.value?.chart_data&&A.value.chart_data.length>0&&(M.value=A.value.chart_data.map(e=>({timestamp:e.timestamp*1e3,snr:null,rssi:null,noiseFloor:e.noise_floor_dbm})))},Le=()=>{try{V.value&&=(V.value.destroy(),null),H.value&&=(H.value.destroy(),null)}catch(e){console.error(`Error destroying charts:`,e)}},Re=()=>{if(!U.value)return;let e=U.value.getContext(`2d`);if(!e)return;let t=[],n=[];if(k.value?.series){let e=k.value.series.find(e=>e.type===`rx_count`),r=k.value.series.find(e=>e.type===`tx_count`);e?.data&&(t=e.data.map(([e,t])=>{let n=e;return n=e>0x38d7ea4c68000?e/1e3:e>0xe8d4a51000?e:e>1e9?e*1e3:Date.now(),{x:n,y:t>S?0:t*3600}})),r?.data&&(n=r.data.map(([e,t])=>{let n=e;return n=e>0x38d7ea4c68000?e/1e3:e>0xe8d4a51000?e:e>1e9?e*1e3:Date.now(),{x:n,y:t>S?0:t*3600}}))}if(t.length===0&&n.length===0){L.value=`No data available for the selected time range`;return}L.value=null,V.value&&=(V.value.destroy(),null);let r=Math.round(O.value*60*60*1e3/72),a=e=>{if(e.length===0)return[];let t=new Map;return e.forEach(e=>{let n=Math.floor(e.x/r)*r;t.has(n)||t.set(n,[]),t.get(n).push(e.y)}),Array.from(t.entries()).map(([e,t])=>({x:e,y:t.reduce((e,t)=>e+t,0)/t.length})).sort((e,t)=>e.x-t.x)},o=(e,t=3)=>{if(e.lengthe+t.y,0)/o.length;n.push({x:e[r].x,y:s})}return n},s=o(a(t)),c=o(a(n)),l=[...s.map(e=>e.y),...c.map(e=>e.y)],u=Math.min(...l),d=Math.max(...l),f=d-u||d*.1||.001,p=Math.max(0,u-f*.05),m=d+f*.05;try{let t=JSON.parse(JSON.stringify(s));V.value=i(new y(e,{type:`line`,data:{datasets:[{label:`TX/hr`,data:JSON.parse(JSON.stringify(c)),borderColor:D.tx,backgroundColor:D.tx,borderWidth:2,fill:`origin`,tension:.4,pointRadius:0,pointHoverRadius:3,order:1},{label:`RX/hr`,data:t,borderColor:D.rx,backgroundColor:D.rx,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(e){let t=e[0]?.parsed?.x;return t==null?``:new Date(t).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})},label:function(e){let t=e.dataset?.label||``,n=e.parsed?.y;return n==null?t:`${t}: ${n.toFixed(1)}`}}}},scales:{x:{type:`time`,time:w(O.value),min:Date.now()-O.value*3600*1e3,max:Date.now(),grid:{color:E().gridColor},ticks:{color:E().tickColor,maxTicksLimit:8}},y:{beginAtZero:!1,title:{display:!0,text:`Packets / Hour`,color:E().tickColor},grid:{color:E().gridColor},ticks:{color:E().tickColor,callback:function(e){return typeof e==`number`?e.toFixed(1):e}},min:p,max:m}}}}))}catch(e){console.error(`Error creating packet rate chart:`,e),L.value=`Failed to render chart`}},ze=()=>{if(!W.value)return;let e=W.value.getContext(`2d`);if(!e)return;let t=M.value.map(e=>({x:e.timestamp,y:e.noiseFloor})).filter(e=>e.y!==null&&e.y!==void 0),n=t.map(e=>e.y),r=n.length>0?Math.min(...n):-120,o=n.length>0?Math.max(...n):-110,s=o-r||1,c=r-s*.05,l=o+s*.05;if(H.value)try{let e=a(H.value),n=JSON.parse(JSON.stringify(t));e.data.datasets[0]&&(e.data.datasets[0].data=n),e.options?.scales?.x&&(e.options.scales.x.min=Date.now()-O.value*3600*1e3,e.options.scales.x.max=Date.now(),e.options.scales.x.time=w(O.value)),e.options?.scales?.y?.ticks&&(e.options.scales.y.ticks.color=E().tickColor),e.options?.plugins?.legend?.labels&&(e.options.plugins.legend.labels.color=E().legendColor),e.update();return}catch{H.value.destroy(),H.value=null}H.value=i(new y(e,{type:`scatter`,data:{datasets:[{label:`Noise Floor (dBm)`,data:JSON.parse(JSON.stringify(t)),borderWidth:0,backgroundColor:D.noiseFloorFill,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:E().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(e){let t=e[0]?.parsed?.x;return t==null?``:new Date(t).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})},label:function(e){let t=e.dataset?.label||``,n=e.parsed?.y;return n==null?t:`${t}: ${n.toFixed(1)} dBm`}}}},scales:{x:{type:`time`,time:w(O.value),min:Date.now()-O.value*3600*1e3,max:Date.now(),grid:{color:E().gridColor},ticks:{color:E().tickColor,maxTicksLimit:8}},y:{type:`linear`,display:!0,title:{display:!0,text:`Noise Floor (dBm)`,color:E().titleColor},grid:{color:D.noiseFloorGrid},ticks:{color:E().tickColor,callback:function(e){return typeof e==`number`?e.toFixed(1):e}},min:c,max:l}}}}))};return n(async()=>{await o(),J(),window.addEventListener(`resize`,()=>{setTimeout(()=>{a(V.value)?.resize(),a(H.value)?.resize()},100)})}),te(()=>{V.value?.destroy(),H.value?.destroy(),window.removeEventListener(`resize`,()=>{})}),(n,r)=>(f(),_(`div`,ye,[g(`div`,be,[r[8]||=g(`h2`,{class:`text-xl sm:text-2xl font-bold text-content-primary dark:text-content-primary`},` Statistics `,-1),g(`div`,xe,[r[7]||=g(`label`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Time Range:`,-1),c(g(`select`,{"onUpdate:modelValue":r[0]||=e=>O.value=e,onChange:Ie,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`},[(f(),_(h,null,d(Pe,e=>g(`option`,{key:e.value,value:e.value,class:`bg-surface text-content-primary`},t(e.label),9,Se)),64))],544),[[ne,O.value]])])]),g(`div`,Ce,[m(x,{title:`Total RX`,value:G.value.totalRx,color:D.totalRx,data:q.value.totalPackets,loading:I.value.sparklineMetrics,error:L.value,variant:`classic`,onRetry:r[1]||=()=>{I.value.sparklineMetrics=!0,I.value.packetRate=!0,L.value=null,Y()}},null,8,[`value`,`color`,`data`,`loading`,`error`]),m(x,{title:`Total TX`,value:G.value.totalTx,color:D.totalTx,data:q.value.transmittedPackets,loading:I.value.sparklineMetrics,error:L.value,variant:`classic`,onRetry:r[2]||=()=>{I.value.sparklineMetrics=!0,I.value.packetRate=!0,L.value=null,Y()}},null,8,[`value`,`color`,`data`,`loading`,`error`]),m(x,{title:`CRC Errors`,value:N.value.reduce((e,t)=>e+t.count,0),color:D.crcErrors,data:q.value.crcErrors,loading:I.value.sparklineCrc,error:B.value,variant:`classic`,onRetry:r[3]||=()=>{I.value.sparklineCrc=!0,B.value=null,Q()}},null,8,[`value`,`color`,`data`,`loading`,`error`])]),g(`div`,we,[r[12]||=g(`h3`,{class:`text-content-primary dark:text-content-primary text-lg sm:text-xl font-semibold mb-3 sm:mb-4`},` Performance Metrics `,-1),g(`div`,null,[r[11]||=g(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm uppercase tracking-wide mb-2`},` Packet Rate (RX/TX PER HOUR) `,-1),g(`div`,Te,[g(`div`,Ee,[g(`div`,{class:`w-3 h-3 rounded-full`,style:s({backgroundColor:D.rx})},null,4),r[9]||=g(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`RX/hr`,-1)]),g(`div`,De,[g(`div`,{class:`w-3 h-3 rounded-full`,style:s({backgroundColor:D.tx})},null,4),r[10]||=g(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`TX/hr`,-1)])]),m(b,{class:`h-40 sm:h-48 rounded-lg p-2 sm:p-4`,"is-loading":I.value.packetRate,error:L.value,status:T.packetRate,onRetry:r[4]||=()=>{I.value.packetRate=!0,L.value=null,Y()}},{default:e(()=>[g(`canvas`,{ref_key:`packetRateCanvasRef`,ref:U,class:`w-full h-full relative z-10`},null,512)]),_:1},8,[`is-loading`,`error`,`status`])])]),g(`div`,Oe,[g(`div`,ke,[r[13]||=g(`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),m(b,{class:`flex-1 min-h-[12rem] sm:min-h-[16rem] rounded-lg`,"is-loading":I.value.noiseFloor,error:z.value,status:T.noiseFloor,onRetry:r[5]||=()=>{I.value.noiseFloor=!0,z.value=null,Z()}},{default:e(()=>[g(`canvas`,{ref_key:`signalMetricsCanvasRef`,ref:W,class:`absolute inset-0 w-full h-full`},null,512)]),_:1},8,[`is-loading`,`error`,`status`])]),g(`div`,Ae,[r[14]||=g(`h3`,{class:`text-content-primary dark:text-content-primary text-lg sm:text-xl font-semibold mb-3 sm:mb-4`},` Route Distribution `,-1),m(b,{class:`flex-1 flex flex-col justify-evenly min-h-[8rem]`,"is-loading":I.value.routePie,error:R.value,status:T.routePie,onRetry:r[6]||=()=>{I.value.routePie=!0,R.value=null,X()}},{default:e(()=>[j.value?.route_totals?(f(!0),_(h,{key:0},d(j.value.route_totals,(e,n,r)=>(f(),_(`div`,{key:n,class:`flex items-center gap-3`},[g(`div`,je,t(n),1),g(`div`,Me,[g(`div`,{class:`h-full rounded transition-all duration-300`,style:s({width:`${e/Math.max(...Object.values(j.value.route_totals))*100}%`,backgroundColor:D.routes[r%D.routes.length]})},null,4)]),g(`div`,Ne,t(e.toLocaleString()),1)]))),128)):p(``,!0)]),_:1},8,[`is-loading`,`error`,`status`])])])]))}});export{C as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/Statistics-Ca2RklrO.js b/repeater/web/html/assets/Statistics-Ca2RklrO.js deleted file mode 100644 index 50a8ae2..0000000 --- a/repeater/web/html/assets/Statistics-Ca2RklrO.js +++ /dev/null @@ -1 +0,0 @@ -import{B as e,Ct as t,E as n,J as r,K as i,Q as a,S as o,St as s,V as c,Y as l,g as u,j as d,k as f,l as p,m,o as ee,r as h,s as g,u as _,w as te}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{t as ne}from"./packets-BBUX0ge1.js";import{f as re}from"./index-CG181k2K.js";import{_ as ie,a as ae,c as oe,d as se,f as ce,g as le,i as ue,l as de,m as fe,n as v,o as pe,p as me,r as he,s as y,t as b,u as ge,v as _e,y as ve}from"./ChartCard-CzDm8sMP.js";import{t as x}from"./chartjs-adapter-date-fns.esm-CzgOsHIF.js";var ye={class:`p-3 sm:p-6 space-y-4 sm:space-y-6`},be={class:`flex flex-col sm:flex-row sm:justify-between sm:items-center gap-3`},xe={class:`flex items-center gap-2 sm:gap-3`},Se=[`value`],Ce={class:`grid grid-cols-1 sm:grid-cols-3 gap-4`},we={class:`glass-card rounded-[15px] p-3 sm:p-6`},Te={class:`flex items-center gap-3 sm:gap-6 mb-3 sm:mb-4`},Ee={class:`flex items-center gap-2`},De={class:`flex items-center gap-2`},Oe={class:`grid grid-cols-1 lg:grid-cols-2 gap-4 sm:gap-6 items-stretch`},ke={class:`glass-card rounded-[15px] p-3 sm:p-6 flex flex-col`},Ae={class:`glass-card rounded-[15px] p-3 sm:p-6 flex flex-col`},je={class:`w-28 sm:w-32 text-sm text-content-primary dark:text-content-primary truncate`},Me={class:`flex-1 h-12 bg-background-mute dark:bg-stroke/10 rounded overflow-hidden`},Ne={class:`w-20 text-sm text-content-secondary dark:text-content-muted text-right tabular-nums`},S=20,C=u({name:`StatisticsView`,__name:`Statistics`,setup(u){y.register(pe,se,ce,ge,de,ue,oe,me,_e,ve,ie,he,ae,le,fe);let C=ne(),w=e=>e>48?{unit:`day`,displayFormats:{day:`EEE MMM d`}}:e>24?{unit:`hour`,displayFormats:{hour:`EEE HH:mm`}}:{unit:`hour`,displayFormats:{hour:`HH:mm`}},T=r({packetRate:`Connecting...`,noiseFloor:`Connecting...`,routePie:`Connecting...`}),E=()=>{let 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)`}},D={tx:`#F59E0B`,rx:`#C084FC`,noiseFloor:`#F59E0B`,noiseFloorFill:`rgba(245, 158, 11, 0.8)`,noiseFloorGrid:`rgba(245, 158, 11, 0.2)`,totalRx:`#AAE8E8`,totalTx:`#FFC246`,crcErrors:`#F59E0B`,packetTypes:[`#60A5FA`,`#34D399`,`#FBBF24`,`#A78BFA`,`#F87171`,`#06B6D4`,`#84CC16`,`#F472B6`,`#10B981`],routes:[`#3B82F6`,`#10B981`,`#F59E0B`,`#A78BFA`,`#F87171`]},O=l(24),Pe=[{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`}],k=l(null),A=l(null),j=l(null),M=l([]),N=l([]),P=l(!0),F=l(null),I=l({packetRate:!0,noiseFloor:!1,routePie:!0,sparklineMetrics:!0,sparklineCrc:!0}),L=l(null),R=l(null),z=l(null),B=l(null),V=l(null),H=l(null),U=l(null),W=l(null),G=l({totalRx:0,totalTx:0}),K=(e,t)=>{if(e.length===0)return[];let n=Math.round(t*60*60*1e3/72),r=new Map;return e.forEach(([e,t])=>{let i=e;e>0x38d7ea4c68000?i=e/1e3:e>1e9&&e<0xe8d4a51000&&(i=e*1e3);let a=Math.floor(i/n)*n;r.has(a)||r.set(a,[]),r.get(a).push(t)}),Array.from(r.entries()).sort((e,t)=>e[0]-t[0]).map(([,e])=>e.reduce((e,t)=>e+t,0)/e.length)},q=ee(()=>{let e=[],t=[];if(k.value?.series){let n=k.value.series.find(e=>e.type===`rx_count`),r=k.value.series.find(e=>e.type===`tx_count`);n?.data&&(e=K(n.data.map(([e,t])=>[e,t>S?0:t]),O.value)),r?.data&&(t=K(r.data.map(([e,t])=>[e,t>S?0:t]),O.value))}return{totalPackets:e,transmittedPackets:t,droppedPackets:[],crcErrors:K(N.value.map(e=>[e.timestamp>0xe8d4a51000?e.timestamp:e.timestamp*1e3,e.count]),O.value)}}),J=async()=>{try{P.value=!0,F.value=null;let e=await v(`/packet_stats`,{hours:O.value});G.value={totalRx:e.data?.total_packets||0,totalTx:e.data?.transmitted_packets||0},P.value=!1}catch(e){F.value=e instanceof Error?e.message:`Failed to fetch data`,P.value=!1}Fe()},Fe=async()=>{I.value={packetRate:!0,noiseFloor:!0,routePie:!0,sparklineMetrics:!0,sparklineCrc:!0},C.metricsGraphData&&(k.value=C.metricsGraphData),C.crcErrorHistory.length>0&&(N.value=[...C.crcErrorHistory]),C.noiseFloorHistory.length>0&&(A.value={chart_data:C.noiseFloorHistory.map(e=>({timestamp:e.timestamp,noise_floor_dbm:e.noise_floor_dbm}))},$()),Y(),X(),Z(),Q()},Y=async()=>{T.packetRate=`Connecting...`,L.value=null;try{let e=await v(`/metrics_graph_data`,{hours:O.value,resolution:`average`,metrics:`rx_count,tx_count`},{onPhaseChange:e=>{T.packetRate=e===`receiving`?`Receiving data...`:`Connecting...`}});e?.success&&(k.value=e.data)}catch(e){L.value=e instanceof Error?e.message:`Failed to load`,k.value=null}finally{I.value.packetRate=!1,I.value.sparklineMetrics=!1,L.value||(await o(),Re())}},X=async()=>{T.routePie=`Connecting...`,R.value=null;try{let e=await v(`/route_stats`,{hours:O.value},{onPhaseChange:e=>{T.routePie=e===`receiving`?`Receiving data...`:`Connecting...`}});e?.success&&e.data&&(j.value=e.data)}catch(e){j.value=null,R.value=e instanceof Error?e.message:`Failed to load`}finally{I.value.routePie=!1}},Z=async()=>{T.noiseFloor=`Connecting...`,z.value=null;try{let e=O.value*120,t=await v(`/noise_floor_history`,{hours:O.value,limit:e},{idleTimeoutMs:3e4,onPhaseChange:e=>{T.noiseFloor=e===`receiving`?`Receiving data...`:`Connecting...`}});if(t.success&&t.data){let e=t.data.history||[];if(Array.isArray(e)&&e.length>0){let t=e;if(e.length>1500){let n=Math.ceil(e.length/1500);t=e.filter((e,t)=>t%n===0)}A.value={chart_data:t.map(e=>({timestamp:e.timestamp||Date.now()/1e3,noise_floor_dbm:e.noise_floor_dbm||e.noise_floor||-120}))},$()}}}catch(e){A.value={chart_data:[]},z.value=e instanceof Error?e.message:`Failed to load`}finally{I.value.noiseFloor=!1,z.value||(await o(),ze())}},Q=async()=>{B.value=null;try{let e=await v(`/crc_error_history`,{hours:O.value});e?.success&&e.data&&(N.value=e.data.history||[])}catch(e){N.value=[],B.value=e instanceof Error?e.message:`Failed to load`}finally{I.value.sparklineCrc=!1}},Ie=()=>{I.value={packetRate:!0,noiseFloor:!0,routePie:!0,sparklineMetrics:!0,sparklineCrc:!0},Le(),L.value=null,R.value=null,z.value=null,J()},$=()=>{M.value=[],A.value?.chart_data&&A.value.chart_data.length>0&&(M.value=A.value.chart_data.map(e=>({timestamp:e.timestamp*1e3,snr:null,rssi:null,noiseFloor:e.noise_floor_dbm})))},Le=()=>{try{V.value&&=(V.value.destroy(),null),H.value&&=(H.value.destroy(),null)}catch(e){console.error(`Error destroying charts:`,e)}},Re=()=>{if(!U.value)return;let e=U.value.getContext(`2d`);if(!e)return;let t=[],n=[];if(k.value?.series){let e=k.value.series.find(e=>e.type===`rx_count`),r=k.value.series.find(e=>e.type===`tx_count`);e?.data&&(t=e.data.map(([e,t])=>{let n=e;return n=e>0x38d7ea4c68000?e/1e3:e>0xe8d4a51000?e:e>1e9?e*1e3:Date.now(),{x:n,y:t>S?0:t*3600}})),r?.data&&(n=r.data.map(([e,t])=>{let n=e;return n=e>0x38d7ea4c68000?e/1e3:e>0xe8d4a51000?e:e>1e9?e*1e3:Date.now(),{x:n,y:t>S?0:t*3600}}))}if(t.length===0&&n.length===0){L.value=`No data available for the selected time range`;return}L.value=null,V.value&&=(V.value.destroy(),null);let r=Math.round(O.value*60*60*1e3/72),a=e=>{if(e.length===0)return[];let t=new Map;return e.forEach(e=>{let n=Math.floor(e.x/r)*r;t.has(n)||t.set(n,[]),t.get(n).push(e.y)}),Array.from(t.entries()).map(([e,t])=>({x:e,y:t.reduce((e,t)=>e+t,0)/t.length})).sort((e,t)=>e.x-t.x)},o=(e,t=3)=>{if(e.lengthe+t.y,0)/o.length;n.push({x:e[r].x,y:s})}return n},s=o(a(t)),c=o(a(n)),l=[...s.map(e=>e.y),...c.map(e=>e.y)],u=Math.min(...l),d=Math.max(...l),f=d-u||d*.1||.001,p=Math.max(0,u-f*.05),m=d+f*.05;try{let t=JSON.parse(JSON.stringify(s));V.value=i(new y(e,{type:`line`,data:{datasets:[{label:`TX/hr`,data:JSON.parse(JSON.stringify(c)),borderColor:D.tx,backgroundColor:D.tx,borderWidth:2,fill:`origin`,tension:.4,pointRadius:0,pointHoverRadius:3,order:1},{label:`RX/hr`,data:t,borderColor:D.rx,backgroundColor:D.rx,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(e){let t=e[0]?.parsed?.x;return t==null?``:new Date(t).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})},label:function(e){let t=e.dataset?.label||``,n=e.parsed?.y;return n==null?t:`${t}: ${n.toFixed(1)}`}}}},scales:{x:{type:`time`,time:w(O.value),min:Date.now()-O.value*3600*1e3,max:Date.now(),grid:{color:E().gridColor},ticks:{color:E().tickColor,maxTicksLimit:8}},y:{beginAtZero:!1,title:{display:!0,text:`Packets / Hour`,color:E().tickColor},grid:{color:E().gridColor},ticks:{color:E().tickColor,callback:function(e){return typeof e==`number`?e.toFixed(1):e}},min:p,max:m}}}}))}catch(e){console.error(`Error creating packet rate chart:`,e),L.value=`Failed to render chart`}},ze=()=>{if(!W.value)return;let e=W.value.getContext(`2d`);if(!e)return;let t=M.value.map(e=>({x:e.timestamp,y:e.noiseFloor})).filter(e=>e.y!==null&&e.y!==void 0),n=t.map(e=>e.y),r=n.length>0?Math.min(...n):-120,o=n.length>0?Math.max(...n):-110,s=o-r||1,c=r-s*.05,l=o+s*.05;if(H.value)try{let e=a(H.value),n=JSON.parse(JSON.stringify(t));e.data.datasets[0]&&(e.data.datasets[0].data=n),e.options?.scales?.x&&(e.options.scales.x.min=Date.now()-O.value*3600*1e3,e.options.scales.x.max=Date.now(),e.options.scales.x.time=w(O.value)),e.options?.scales?.y?.ticks&&(e.options.scales.y.ticks.color=E().tickColor),e.options?.plugins?.legend?.labels&&(e.options.plugins.legend.labels.color=E().legendColor),e.update();return}catch{H.value.destroy(),H.value=null}H.value=i(new y(e,{type:`scatter`,data:{datasets:[{label:`Noise Floor (dBm)`,data:JSON.parse(JSON.stringify(t)),borderWidth:0,backgroundColor:D.noiseFloorFill,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:E().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(e){let t=e[0]?.parsed?.x;return t==null?``:new Date(t).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})},label:function(e){let t=e.dataset?.label||``,n=e.parsed?.y;return n==null?t:`${t}: ${n.toFixed(1)} dBm`}}}},scales:{x:{type:`time`,time:w(O.value),min:Date.now()-O.value*3600*1e3,max:Date.now(),grid:{color:E().gridColor},ticks:{color:E().tickColor,maxTicksLimit:8}},y:{type:`linear`,display:!0,title:{display:!0,text:`Noise Floor (dBm)`,color:E().titleColor},grid:{color:D.noiseFloorGrid},ticks:{color:E().tickColor,callback:function(e){return typeof e==`number`?e.toFixed(1):e}},min:c,max:l}}}}))};return n(async()=>{await o(),J(),window.addEventListener(`resize`,()=>{setTimeout(()=>{a(V.value)?.resize(),a(H.value)?.resize()},100)})}),te(()=>{V.value?.destroy(),H.value?.destroy(),window.removeEventListener(`resize`,()=>{})}),(n,r)=>(f(),_(`div`,ye,[g(`div`,be,[r[8]||=g(`h2`,{class:`text-xl sm:text-2xl font-bold text-content-primary dark:text-content-primary`},` Statistics `,-1),g(`div`,xe,[r[7]||=g(`label`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},`Time Range:`,-1),c(g(`select`,{"onUpdate:modelValue":r[0]||=e=>O.value=e,onChange:Ie,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`},[(f(),_(h,null,d(Pe,e=>g(`option`,{key:e.value,value:e.value,class:`bg-surface text-content-primary`},t(e.label),9,Se)),64))],544),[[re,O.value]])])]),g(`div`,Ce,[m(x,{title:`Total RX`,value:G.value.totalRx,color:D.totalRx,data:q.value.totalPackets,loading:I.value.sparklineMetrics,error:L.value,variant:`classic`,onRetry:r[1]||=()=>{I.value.sparklineMetrics=!0,I.value.packetRate=!0,L.value=null,Y()}},null,8,[`value`,`color`,`data`,`loading`,`error`]),m(x,{title:`Total TX`,value:G.value.totalTx,color:D.totalTx,data:q.value.transmittedPackets,loading:I.value.sparklineMetrics,error:L.value,variant:`classic`,onRetry:r[2]||=()=>{I.value.sparklineMetrics=!0,I.value.packetRate=!0,L.value=null,Y()}},null,8,[`value`,`color`,`data`,`loading`,`error`]),m(x,{title:`CRC Errors`,value:N.value.reduce((e,t)=>e+t.count,0),color:D.crcErrors,data:q.value.crcErrors,loading:I.value.sparklineCrc,error:B.value,variant:`classic`,onRetry:r[3]||=()=>{I.value.sparklineCrc=!0,B.value=null,Q()}},null,8,[`value`,`color`,`data`,`loading`,`error`])]),g(`div`,we,[r[12]||=g(`h3`,{class:`text-content-primary dark:text-content-primary text-lg sm:text-xl font-semibold mb-3 sm:mb-4`},` Performance Metrics `,-1),g(`div`,null,[r[11]||=g(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm uppercase tracking-wide mb-2`},` Packet Rate (RX/TX PER HOUR) `,-1),g(`div`,Te,[g(`div`,Ee,[g(`div`,{class:`w-3 h-3 rounded-full`,style:s({backgroundColor:D.rx})},null,4),r[9]||=g(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`RX/hr`,-1)]),g(`div`,De,[g(`div`,{class:`w-3 h-3 rounded-full`,style:s({backgroundColor:D.tx})},null,4),r[10]||=g(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`TX/hr`,-1)])]),m(b,{class:`h-40 sm:h-48 rounded-lg p-2 sm:p-4`,"is-loading":I.value.packetRate,error:L.value,status:T.packetRate,onRetry:r[4]||=()=>{I.value.packetRate=!0,L.value=null,Y()}},{default:e(()=>[g(`canvas`,{ref_key:`packetRateCanvasRef`,ref:U,class:`w-full h-full relative z-10`},null,512)]),_:1},8,[`is-loading`,`error`,`status`])])]),g(`div`,Oe,[g(`div`,ke,[r[13]||=g(`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),m(b,{class:`flex-1 min-h-[12rem] sm:min-h-[16rem] rounded-lg`,"is-loading":I.value.noiseFloor,error:z.value,status:T.noiseFloor,onRetry:r[5]||=()=>{I.value.noiseFloor=!0,z.value=null,Z()}},{default:e(()=>[g(`canvas`,{ref_key:`signalMetricsCanvasRef`,ref:W,class:`absolute inset-0 w-full h-full`},null,512)]),_:1},8,[`is-loading`,`error`,`status`])]),g(`div`,Ae,[r[14]||=g(`h3`,{class:`text-content-primary dark:text-content-primary text-lg sm:text-xl font-semibold mb-3 sm:mb-4`},` Route Distribution `,-1),m(b,{class:`flex-1 flex flex-col justify-evenly min-h-[8rem]`,"is-loading":I.value.routePie,error:R.value,status:T.routePie,onRetry:r[6]||=()=>{I.value.routePie=!0,R.value=null,X()}},{default:e(()=>[j.value?.route_totals?(f(!0),_(h,{key:0},d(j.value.route_totals,(e,n,r)=>(f(),_(`div`,{key:n,class:`flex items-center gap-3`},[g(`div`,je,t(n),1),g(`div`,Me,[g(`div`,{class:`h-full rounded transition-all duration-300`,style:s({width:`${e/Math.max(...Object.values(j.value.route_totals))*100}%`,backgroundColor:D.routes[r%D.routes.length]})},null,4)]),g(`div`,Ne,t(e.toLocaleString()),1)]))),128)):p(``,!0)]),_:1},8,[`is-loading`,`error`,`status`])])])]))}});export{C as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/SystemStats-ChbjEAGq.js b/repeater/web/html/assets/SystemStats-_yafXwf7.js similarity index 96% rename from repeater/web/html/assets/SystemStats-ChbjEAGq.js rename to repeater/web/html/assets/SystemStats-_yafXwf7.js index 801f465..1fb44b5 100644 --- a/repeater/web/html/assets/SystemStats-ChbjEAGq.js +++ b/repeater/web/html/assets/SystemStats-_yafXwf7.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/plotly.min-YhyN9SYa.js","assets/chunk-DECur_0Z.js"])))=>i.map(i=>d[i]); -import{r as e}from"./chunk-DECur_0Z.js";import{B as t,Ct as n,E as r,K as i,Q as a,R as o,S as s,Y as c,g as ee,j as l,k as u,l as d,m as f,nt as p,o as m,r as h,s as g,u as _,w as te,xt as v}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{o as y}from"./api-DBiYn0RS.js";import{t as b}from"./_plugin-vue_export-helper-TcpyXLsZ.js";import{t as ne}from"./useTheme-D8lKuC-u.js";import{t as re}from"./index-CG181k2K.js";import{t as x}from"./formatters-Cc4UJmeb.js";import{_ as ie,a as ae,c as oe,d as se,f as ce,g as le,i as ue,l as de,m as fe,n as S,o as pe,r as me,s as C,t as w,u as he,v as ge,y as _e}from"./ChartCard-CzDm8sMP.js";import{t as T}from"./chartjs-adapter-date-fns.esm-CzgOsHIF.js";var ve={class:`p-6 space-y-6`},ye={class:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4`},be={class:`grid grid-cols-1 lg:grid-cols-2 gap-6`},xe={class:`glass-card rounded-[15px] p-6`},Se={key:0,class:`grid grid-cols-2 gap-4 text-sm`},Ce={class:`text-content-primary dark:text-content-primary font-semibold`},we={class:`text-content-primary dark:text-content-primary font-semibold`},Te={class:`text-content-primary dark:text-content-primary font-semibold`},E={class:`text-content-primary dark:text-content-primary font-semibold`},D={class:`glass-card rounded-[15px] p-6`},O={key:0,class:`grid grid-cols-2 gap-4 text-sm`},Ee={class:`text-content-primary dark:text-content-primary font-semibold`},De={class:`text-content-primary dark:text-content-primary font-semibold`},Oe={class:`text-content-primary dark:text-content-primary font-semibold`},ke={class:`text-content-primary dark:text-content-primary font-semibold`},Ae={class:`grid grid-cols-1 lg:grid-cols-2 gap-6`},je={class:`glass-card rounded-[15px] p-6`},Me={class:`relative h-48`},Ne={key:0,class:`grid grid-cols-3 gap-4 text-sm mt-4`},Pe={class:`text-center`},Fe={class:`text-content-primary dark:text-content-primary font-semibold`},Ie={class:`text-center`},Le={class:`font-semibold text-accent-red`},Re={class:`text-center`},ze={class:`font-semibold text-accent-green`},Be={class:`glass-card rounded-[15px] p-6`},Ve={key:0,class:`space-y-4`},He={class:`grid grid-cols-2 gap-4 text-sm`},Ue={class:`text-content-primary dark:text-content-primary font-semibold`},We={class:`text-content-primary dark:text-content-primary font-semibold`},Ge={class:`text-content-primary dark:text-content-primary font-semibold`},Ke={class:`text-content-primary dark:text-content-primary font-semibold`},qe={key:0,class:`pt-4 border-t border-stroke-subtle dark:border-stroke/10`},Je={class:`grid grid-cols-2 gap-2 text-sm`},k={class:`text-content-secondary dark:text-content-muted`},Ye={class:`text-content-primary dark:text-content-primary font-semibold ml-1`},Xe={class:`glass-card rounded-[15px] p-6`},Ze={key:0,class:`overflow-x-auto`},Qe={class:`w-full text-sm`},$e={class:`text-content-secondary dark:text-content-primary/80 py-2 transition-all duration-300`},et={class:`text-content-primary dark:text-content-primary font-semibold py-2 transition-all duration-300`},tt={class:`text-center text-secondary py-2 transition-all duration-300`},nt={class:`text-center text-accent-green py-2 transition-all duration-300`},rt={class:`text-right text-content-secondary dark:text-content-primary/80 py-2 transition-all duration-300`},it={key:0,class:`mt-4 text-center text-content-secondary dark:text-content-muted text-sm transition-all duration-300`},at={key:1,class:`text-center text-content-secondary dark:text-content-muted py-8`},A=b(ee({name:`SystemStatsView`,__name:`SystemStats`,setup(ee){C.register(pe,se,ce,he,de,ue,oe,ge,_e,ie,me,ae,le,fe);let{theme:b}=ne(),A=()=>{let e=document.documentElement.classList.contains(`dark`);return{labelColor:e?`rgba(255, 255, 255, 0.5)`:`rgba(0, 0, 0, 0.5)`,textColor:e?`rgba(255, 255, 255, 0.8)`:`rgba(0, 0, 0, 0.8)`}},j={cpu:`#FFC246`,memory:`#A5E5B6`,disk:`#FB787B`,free:`#A5E5B6`,uptime:`#EBA0FC`},M=c(null),N=c(null),P=c([]),F=c(null),I=c({cpuChart:!0,memoryChart:!0,diskChart:!1,processChart:!0}),L=c(null),R=c(null),z=c(`Connecting...`),B=c(`Connecting...`),V=c(null),H=c(null),U=c(null),W=c(null),G=c(null),K=m(()=>M.value?{cpuUsage:M.value.cpu.usage_percent,memoryUsage:M.value.memory.usage_percent,diskUsage:M.value.disk.usage_percent,uptime:M.value.system.uptime}:{cpuUsage:0,memoryUsage:0,diskUsage:0,uptime:0}),q=m(()=>P.value.length===0?{cpu:[],memory:[],disk:[],network:[]}:{cpu:P.value.map(e=>e.cpu.usage_percent),memory:P.value.map(e=>e.memory.usage_percent),disk:P.value.map(e=>e.disk.usage_percent),network:P.value.map(e=>e.network.bytes_recv/1024/1024)}),J=m(()=>{let e=P.value.length;if(e<2)return``;let t=e*5;return t<120?`last ${t}s`:`last ${Math.round(t/60)}m`}),ot=e=>{let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`},Y=async()=>{z.value=`Connecting...`,B.value=`Connecting...`;try{let e=await S(`/hardware_stats`,void 0,{onPhaseChange:e=>{let t=e===`receiving`?`Receiving data...`:`Connecting...`;z.value=t,B.value=t}});if(e?.success&&e.data){let t=e.data;M.value=t,P.value.push(t),P.value.length>20&&P.value.shift(),L.value=null,R.value=null,await s(),Z()}else L.value=`No data in server response`,R.value=`No data in server response`}catch(e){let t=e instanceof Error?e.message:`Failed to load data`;L.value=t,R.value=t}finally{I.value.cpuChart=!1,I.value.memoryChart=!1}},st=async()=>{try{let e=await S(`/hardware_processes`);e?.success&&e.data&&(F.value=N.value,N.value=e.data)}catch(e){console.error(`Failed to fetch process stats:`,e)}finally{I.value.processChart=!1}},X=(e,t)=>{if(!F.value)return!1;let n=F.value.processes.find(t=>t.pid===e.pid);return n?n[t]!==e[t]:!0},ct=()=>{Y(),st()},Z=()=>{M.value&&(lt(),ut(),dt())},lt=()=>{if(!U.value||!M.value){I.value.cpuChart=!1;return}let e=U.value.getContext(`2d`);if(!e){I.value.cpuChart=!1;return}let t=M.value.cpu.usage_percent,n=100-t;if(V.value)try{V.value.data.datasets[0].data=[t,n],V.value.update(`none`);return}catch(e){console.warn(`Failed to update CPU chart, recreating...`,e),V.value.destroy(),V.value=null}let r=j.cpu,a=A(),o=document.documentElement.classList.contains(`dark`),s=o?`rgba(255, 255, 255, 0.1)`:`rgba(0, 0, 0, 0.1)`,c=o?`rgba(255, 255, 255, 0.2)`:`rgba(0, 0, 0, 0.2)`;try{V.value=i(new C(e,{type:`doughnut`,data:{labels:[`Used`,`Available`],datasets:[{data:[t,n],backgroundColor:[r,s],borderColor:[r,c],borderWidth:2}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`70%`,animation:{animateRotate:!1,animateScale:!1,duration:0},plugins:{legend:{display:!1},tooltip:{callbacks:{label:function(e){return`${e.label}: ${e.parsed.toFixed(1)}%`}}}}},plugins:[{id:`centerText`,beforeDraw:function(e){let t=e.ctx;t.save();let n=e.data.datasets[0].data[0],i=(e.chartArea.left+e.chartArea.right)/2,o=(e.chartArea.top+e.chartArea.bottom)/2;t.textAlign=`center`,t.textBaseline=`middle`,t.fillStyle=r,t.font=`bold 18px sans-serif`,t.fillText(`${n.toFixed(1)}%`,i,o-5),t.fillStyle=a.labelColor,t.font=`10px sans-serif`,t.fillText(`CPU`,i,o+12),t.restore()}}]})),L.value=null,I.value.cpuChart=!1}catch(e){console.error(`Error creating CPU chart:`,e),L.value=`Failed to create CPU chart`,I.value.cpuChart=!1}},ut=()=>{if(!W.value||!M.value){I.value.memoryChart=!1;return}let e=W.value.getContext(`2d`);if(!e){I.value.memoryChart=!1;return}let t=M.value.memory.usage_percent,n=100-t;if(H.value)try{H.value.data.datasets[0].data=[t,n],H.value.update(`none`);return}catch(e){console.warn(`Failed to update Memory chart, recreating...`,e),H.value.destroy(),H.value=null}let r=j.memory,a=A(),o=document.documentElement.classList.contains(`dark`),s=o?`rgba(255, 255, 255, 0.1)`:`rgba(0, 0, 0, 0.1)`,c=o?`rgba(255, 255, 255, 0.2)`:`rgba(0, 0, 0, 0.2)`;try{H.value=i(new C(e,{type:`doughnut`,data:{labels:[`Used`,`Available`],datasets:[{data:[t,n],backgroundColor:[r,s],borderColor:[r,c],borderWidth:2}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`70%`,animation:{animateRotate:!1,animateScale:!1,duration:0},plugins:{legend:{display:!1},tooltip:{callbacks:{label:function(e){return`${e.label}: ${e.parsed.toFixed(1)}%`}}}}},plugins:[{id:`centerText`,beforeDraw:function(e){let t=e.ctx;t.save();let n=e.data.datasets[0].data[0],i=(e.chartArea.left+e.chartArea.right)/2,o=(e.chartArea.top+e.chartArea.bottom)/2;t.textAlign=`center`,t.textBaseline=`middle`,t.fillStyle=r,t.font=`bold 18px sans-serif`,t.fillText(`${n.toFixed(1)}%`,i,o-5),t.fillStyle=a.labelColor,t.font=`10px sans-serif`,t.fillText(`Memory`,i,o+12),t.restore()}}]})),R.value=null,I.value.memoryChart=!1}catch(e){console.error(`Error creating Memory chart:`,e),R.value=`Failed to create Memory chart`,I.value.memoryChart=!1}},dt=()=>{if(!G.value||!M.value)return;let t=A().textColor;try{y(()=>import(`./plotly.min-YhyN9SYa.js`).then(t=>e(t.t(),1)).then(e=>{let n=e.default||e,r=M.value.disk,i=[{type:`pie`,labels:[`Used`,`Free`],values:[r.used,r.free],marker:{colors:[j.disk,j.free]},hovertemplate:`%{label}
Size: %{value}
Percentage: %{percent}`,textinfo:`label+percent`,textposition:`auto`,hole:.4}],a={title:{text:``,font:{color:t}},paper_bgcolor:`rgba(0,0,0,0)`,plot_bgcolor:`rgba(0,0,0,0)`,font:{color:t,size:11},margin:{t:20,b:20,l:20,r:20},showlegend:!0,legend:{orientation:`h`,x:0,y:-.2,font:{color:t,size:10}}};n.newPlot(G.value,i,a,{responsive:!0,displayModeBar:!1,staticPlot:!1})}),__vite__mapDeps([0,1]))}catch(e){console.error(`Error creating disk chart:`,e)}},Q=()=>{try{if(V.value&&=(V.value.destroy(),null),H.value&&=(H.value.destroy(),null),G.value)try{y(()=>import(`./plotly.min-YhyN9SYa.js`).then(t=>e(t.t(),1)).then(e=>{let t=e?.default||e;t?.purge&&t.purge(G.value)}),__vite__mapDeps([0,1])).catch(()=>{})}catch{}}catch(e){console.error(`Error destroying charts:`,e)}};o(b,()=>{Q(),s(()=>Z())});let $=()=>{setTimeout(()=>{a(V.value)?.resize(),a(H.value)?.resize();try{y(()=>import(`./plotly.min-YhyN9SYa.js`).then(t=>e(t.t(),1)).then(e=>{let t=e?.default||e;t?.Plots&&t.Plots.resize(G.value)}),__vite__mapDeps([0,1])).catch(()=>{})}catch{}},100)};return re(ct,{intervalMs:5e3,immediate:!0}),r(async()=>{await s(),window.addEventListener(`resize`,$)}),te(()=>{window.removeEventListener(`resize`,$),Q()}),(e,r)=>(u(),_(`div`,ve,[r[22]||=g(`div`,{class:`flex justify-between items-center`},[g(`h2`,{class:`text-2xl font-bold text-content-primary dark:text-content-primary`},` System Statistics `),g(`div`,{class:`text-content-secondary dark:text-content-muted text-sm`},` Updates every 5 seconds `)],-1),g(`div`,ye,[f(T,{title:`CPU Usage`,value:`${K.value.cpuUsage.toFixed(1)}%`,color:j.cpu,data:q.value.cpu,"min-y":0,"max-y":100,subtitle:J.value},null,8,[`value`,`color`,`data`,`subtitle`]),f(T,{title:`Memory Usage`,value:`${K.value.memoryUsage.toFixed(1)}%`,color:j.memory,data:q.value.memory,"min-y":0,"max-y":100,subtitle:J.value},null,8,[`value`,`color`,`data`,`subtitle`]),f(T,{title:`Disk Usage`,value:`${K.value.diskUsage.toFixed(1)}%`,color:j.disk,data:q.value.disk,"min-y":0,"max-y":100,subtitle:J.value},null,8,[`value`,`color`,`data`,`subtitle`]),f(T,{title:`Uptime`,value:ot(K.value.uptime),color:j.uptime,data:[],"show-chart":!1},null,8,[`value`,`color`])]),g(`div`,be,[g(`div`,xe,[r[4]||=g(`h3`,{class:`text-content-primary dark:text-content-primary text-xl font-semibold mb-4`},` CPU Performance `,-1),f(w,{class:`h-32 mb-4`,"is-loading":I.value.cpuChart,error:L.value,status:z.value,onRetry:Y},{default:t(()=>[g(`canvas`,{ref_key:`cpuCanvasRef`,ref:U,class:`w-full h-full`},null,512)]),_:1},8,[`is-loading`,`error`,`status`]),M.value?(u(),_(`div`,Se,[g(`div`,null,[r[0]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`CPU Count`,-1),g(`div`,Ce,n(M.value.cpu.count)+` cores `,1)]),g(`div`,null,[r[1]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Frequency`,-1),g(`div`,we,n(M.value.cpu.frequency.toFixed(0))+` MHz `,1)]),g(`div`,null,[r[2]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Load (1m)`,-1),g(`div`,Te,n(M.value.cpu.load_avg[`1min`].toFixed(2)),1)]),g(`div`,null,[r[3]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Load (5m)`,-1),g(`div`,E,n(M.value.cpu.load_avg[`5min`].toFixed(2)),1)])])):d(``,!0)]),g(`div`,D,[r[9]||=g(`h3`,{class:`text-content-primary dark:text-content-primary text-xl font-semibold mb-4`},` Memory Usage `,-1),f(w,{class:`h-32 mb-4`,"is-loading":I.value.memoryChart,error:R.value,status:B.value,onRetry:Y},{default:t(()=>[g(`canvas`,{ref_key:`memoryCanvasRef`,ref:W,class:`w-full h-full`},null,512)]),_:1},8,[`is-loading`,`error`,`status`]),M.value?(u(),_(`div`,O,[g(`div`,null,[r[5]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Total`,-1),g(`div`,Ee,n(p(x)(M.value.memory.total)),1)]),g(`div`,null,[r[6]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Used`,-1),g(`div`,De,n(p(x)(M.value.memory.used)),1)]),g(`div`,null,[r[7]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Available`,-1),g(`div`,Oe,n(p(x)(M.value.memory.available)),1)]),g(`div`,null,[r[8]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Usage`,-1),g(`div`,ke,n(M.value.memory.usage_percent.toFixed(1))+`% `,1)])])):d(``,!0)])]),g(`div`,Ae,[g(`div`,je,[r[13]||=g(`h3`,{class:`text-content-primary dark:text-content-primary text-xl font-semibold mb-4`},` Storage Usage `,-1),g(`div`,Me,[g(`div`,{ref_key:`diskCanvasRef`,ref:G,class:`w-full h-full`},null,512)]),M.value?(u(),_(`div`,Ne,[g(`div`,Pe,[r[10]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Total`,-1),g(`div`,Fe,n(p(x)(M.value.disk.total)),1)]),g(`div`,Ie,[r[11]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Used`,-1),g(`div`,Le,n(p(x)(M.value.disk.used)),1)]),g(`div`,Re,[r[12]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Free`,-1),g(`div`,ze,n(p(x)(M.value.disk.free)),1)])])):d(``,!0)]),g(`div`,Be,[r[19]||=g(`h3`,{class:`text-content-primary dark:text-content-primary text-xl font-semibold mb-4`},` Network Statistics `,-1),M.value?(u(),_(`div`,Ve,[g(`div`,He,[g(`div`,null,[r[14]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Bytes Sent`,-1),g(`div`,Ue,n(p(x)(M.value.network.bytes_sent)),1)]),g(`div`,null,[r[15]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Bytes Received`,-1),g(`div`,We,n(p(x)(M.value.network.bytes_recv)),1)]),g(`div`,null,[r[16]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Packets Sent`,-1),g(`div`,Ge,n(M.value.network.packets_sent.toLocaleString()),1)]),g(`div`,null,[r[17]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Packets Received`,-1),g(`div`,Ke,n(M.value.network.packets_recv.toLocaleString()),1)])]),M.value.temperatures&&Object.keys(M.value.temperatures).length>0?(u(),_(`div`,qe,[r[18]||=g(`div`,{class:`text-content-secondary dark:text-content-muted mb-2`},` System Temperatures `,-1),g(`div`,Je,[(u(!0),_(h,null,l(M.value.temperatures,(e,t)=>(u(),_(`div`,{key:t},[g(`span`,k,n(t)+`:`,1),g(`span`,Ye,n(e.toFixed(1))+`°C`,1)]))),128))])])):d(``,!0)])):d(``,!0)])]),g(`div`,Xe,[r[21]||=g(`h3`,{class:`text-content-primary dark:text-content-primary text-xl font-semibold mb-4`},` Top Processes `,-1),N.value?.processes&&N.value.processes.length>0?(u(),_(`div`,Ze,[g(`table`,Qe,[r[20]||=g(`thead`,null,[g(`tr`,{class:`border-b border-stroke-subtle dark:border-stroke/10`},[g(`th`,{class:`text-left text-content-secondary dark:text-content-muted py-2`},`PID`),g(`th`,{class:`text-left text-content-secondary dark:text-content-muted py-2`},`Name`),g(`th`,{class:`text-center text-content-secondary dark:text-content-muted py-2`},`CPU %`),g(`th`,{class:`text-center text-content-secondary dark:text-content-muted py-2`},` Memory % `),g(`th`,{class:`text-right text-content-secondary dark:text-content-muted py-2`},`Memory`)])],-1),g(`tbody`,null,[(u(!0),_(h,null,l(N.value.processes.slice(0,10),e=>(u(),_(`tr`,{key:e.pid,class:`border-b border-stroke-subtle dark:border-white/5 process-row`},[g(`td`,$e,n(e.pid),1),g(`td`,et,n(e.name),1),g(`td`,tt,[g(`span`,{class:v([`cpu-value`,{"value-updated":X(e,`cpu_percent`)}])},n(e.cpu_percent.toFixed(1))+`% `,3)]),g(`td`,nt,[g(`span`,{class:v([`memory-value`,{"value-updated":X(e,`memory_percent`)}])},n(e.memory_percent.toFixed(1))+`% `,3)]),g(`td`,rt,[g(`span`,{class:v({"value-updated":X(e,`memory_mb`)})},n(e.memory_mb.toFixed(1))+` MB `,3)])]))),128))])]),N.value.total_processes?(u(),_(`div`,it,` Showing top 10 of `+n(N.value.total_processes)+` total processes `,1)):d(``,!0)])):I.value.processChart?d(``,!0):(u(),_(`div`,at,` No process data available `))])]))}}),[[`__scopeId`,`data-v-d0fbc86b`]]);export{A as default}; \ No newline at end of file +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/plotly.min-B8UFpwnE.js","assets/chunk-DECur_0Z.js"])))=>i.map(i=>d[i]); +import{r as e}from"./chunk-DECur_0Z.js";import{B as t,Ct as n,E as r,K as i,Q as a,R as o,S as s,Y as c,g as ee,j as l,k as u,l as d,m as f,nt as p,o as m,r as h,s as g,u as _,w as te,xt as v}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{o as y}from"./api-C0ctTLHN.js";import{t as b}from"./_plugin-vue_export-helper-TcpyXLsZ.js";import{t as ne}from"./useTheme-D8lKuC-u.js";import{t as re}from"./index-BpKhPa08.js";import{t as x}from"./formatters-Cc4UJmeb.js";import{_ as ie,a as ae,c as oe,d as se,f as ce,g as le,i as ue,l as de,m as fe,n as S,o as pe,r as me,s as C,t as w,u as he,v as ge,y as _e}from"./ChartCard-Cqs_1Frf.js";import{t as T}from"./chartjs-adapter-date-fns.esm-NizYWXHk.js";var ve={class:`p-6 space-y-6`},ye={class:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4`},be={class:`grid grid-cols-1 lg:grid-cols-2 gap-6`},xe={class:`glass-card rounded-[15px] p-6`},Se={key:0,class:`grid grid-cols-2 gap-4 text-sm`},Ce={class:`text-content-primary dark:text-content-primary font-semibold`},we={class:`text-content-primary dark:text-content-primary font-semibold`},Te={class:`text-content-primary dark:text-content-primary font-semibold`},E={class:`text-content-primary dark:text-content-primary font-semibold`},D={class:`glass-card rounded-[15px] p-6`},O={key:0,class:`grid grid-cols-2 gap-4 text-sm`},Ee={class:`text-content-primary dark:text-content-primary font-semibold`},De={class:`text-content-primary dark:text-content-primary font-semibold`},Oe={class:`text-content-primary dark:text-content-primary font-semibold`},ke={class:`text-content-primary dark:text-content-primary font-semibold`},Ae={class:`grid grid-cols-1 lg:grid-cols-2 gap-6`},je={class:`glass-card rounded-[15px] p-6`},Me={class:`relative h-48`},Ne={key:0,class:`grid grid-cols-3 gap-4 text-sm mt-4`},Pe={class:`text-center`},Fe={class:`text-content-primary dark:text-content-primary font-semibold`},Ie={class:`text-center`},Le={class:`font-semibold text-accent-red`},Re={class:`text-center`},ze={class:`font-semibold text-accent-green`},Be={class:`glass-card rounded-[15px] p-6`},Ve={key:0,class:`space-y-4`},He={class:`grid grid-cols-2 gap-4 text-sm`},Ue={class:`text-content-primary dark:text-content-primary font-semibold`},We={class:`text-content-primary dark:text-content-primary font-semibold`},Ge={class:`text-content-primary dark:text-content-primary font-semibold`},Ke={class:`text-content-primary dark:text-content-primary font-semibold`},qe={key:0,class:`pt-4 border-t border-stroke-subtle dark:border-stroke/10`},Je={class:`grid grid-cols-2 gap-2 text-sm`},k={class:`text-content-secondary dark:text-content-muted`},Ye={class:`text-content-primary dark:text-content-primary font-semibold ml-1`},Xe={class:`glass-card rounded-[15px] p-6`},Ze={key:0,class:`overflow-x-auto`},Qe={class:`w-full text-sm`},$e={class:`text-content-secondary dark:text-content-primary/80 py-2 transition-all duration-300`},et={class:`text-content-primary dark:text-content-primary font-semibold py-2 transition-all duration-300`},tt={class:`text-center text-secondary py-2 transition-all duration-300`},nt={class:`text-center text-accent-green py-2 transition-all duration-300`},rt={class:`text-right text-content-secondary dark:text-content-primary/80 py-2 transition-all duration-300`},it={key:0,class:`mt-4 text-center text-content-secondary dark:text-content-muted text-sm transition-all duration-300`},at={key:1,class:`text-center text-content-secondary dark:text-content-muted py-8`},A=b(ee({name:`SystemStatsView`,__name:`SystemStats`,setup(ee){C.register(pe,se,ce,he,de,ue,oe,ge,_e,ie,me,ae,le,fe);let{theme:b}=ne(),A=()=>{let e=document.documentElement.classList.contains(`dark`);return{labelColor:e?`rgba(255, 255, 255, 0.5)`:`rgba(0, 0, 0, 0.5)`,textColor:e?`rgba(255, 255, 255, 0.8)`:`rgba(0, 0, 0, 0.8)`}},j={cpu:`#FFC246`,memory:`#A5E5B6`,disk:`#FB787B`,free:`#A5E5B6`,uptime:`#EBA0FC`},M=c(null),N=c(null),P=c([]),F=c(null),I=c({cpuChart:!0,memoryChart:!0,diskChart:!1,processChart:!0}),L=c(null),R=c(null),z=c(`Connecting...`),B=c(`Connecting...`),V=c(null),H=c(null),U=c(null),W=c(null),G=c(null),K=m(()=>M.value?{cpuUsage:M.value.cpu.usage_percent,memoryUsage:M.value.memory.usage_percent,diskUsage:M.value.disk.usage_percent,uptime:M.value.system.uptime}:{cpuUsage:0,memoryUsage:0,diskUsage:0,uptime:0}),q=m(()=>P.value.length===0?{cpu:[],memory:[],disk:[],network:[]}:{cpu:P.value.map(e=>e.cpu.usage_percent),memory:P.value.map(e=>e.memory.usage_percent),disk:P.value.map(e=>e.disk.usage_percent),network:P.value.map(e=>e.network.bytes_recv/1024/1024)}),J=m(()=>{let e=P.value.length;if(e<2)return``;let t=e*5;return t<120?`last ${t}s`:`last ${Math.round(t/60)}m`}),ot=e=>{let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`},Y=async()=>{z.value=`Connecting...`,B.value=`Connecting...`;try{let e=await S(`/hardware_stats`,void 0,{onPhaseChange:e=>{let t=e===`receiving`?`Receiving data...`:`Connecting...`;z.value=t,B.value=t}});if(e?.success&&e.data){let t=e.data;M.value=t,P.value.push(t),P.value.length>20&&P.value.shift(),L.value=null,R.value=null,await s(),Z()}else L.value=`No data in server response`,R.value=`No data in server response`}catch(e){let t=e instanceof Error?e.message:`Failed to load data`;L.value=t,R.value=t}finally{I.value.cpuChart=!1,I.value.memoryChart=!1}},st=async()=>{try{let e=await S(`/hardware_processes`);e?.success&&e.data&&(F.value=N.value,N.value=e.data)}catch(e){console.error(`Failed to fetch process stats:`,e)}finally{I.value.processChart=!1}},X=(e,t)=>{if(!F.value)return!1;let n=F.value.processes.find(t=>t.pid===e.pid);return n?n[t]!==e[t]:!0},ct=()=>{Y(),st()},Z=()=>{M.value&&(lt(),ut(),dt())},lt=()=>{if(!U.value||!M.value){I.value.cpuChart=!1;return}let e=U.value.getContext(`2d`);if(!e){I.value.cpuChart=!1;return}let t=M.value.cpu.usage_percent,n=100-t;if(V.value)try{V.value.data.datasets[0].data=[t,n],V.value.update(`none`);return}catch(e){console.warn(`Failed to update CPU chart, recreating...`,e),V.value.destroy(),V.value=null}let r=j.cpu,a=A(),o=document.documentElement.classList.contains(`dark`),s=o?`rgba(255, 255, 255, 0.1)`:`rgba(0, 0, 0, 0.1)`,c=o?`rgba(255, 255, 255, 0.2)`:`rgba(0, 0, 0, 0.2)`;try{V.value=i(new C(e,{type:`doughnut`,data:{labels:[`Used`,`Available`],datasets:[{data:[t,n],backgroundColor:[r,s],borderColor:[r,c],borderWidth:2}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`70%`,animation:{animateRotate:!1,animateScale:!1,duration:0},plugins:{legend:{display:!1},tooltip:{callbacks:{label:function(e){return`${e.label}: ${e.parsed.toFixed(1)}%`}}}}},plugins:[{id:`centerText`,beforeDraw:function(e){let t=e.ctx;t.save();let n=e.data.datasets[0].data[0],i=(e.chartArea.left+e.chartArea.right)/2,o=(e.chartArea.top+e.chartArea.bottom)/2;t.textAlign=`center`,t.textBaseline=`middle`,t.fillStyle=r,t.font=`bold 18px sans-serif`,t.fillText(`${n.toFixed(1)}%`,i,o-5),t.fillStyle=a.labelColor,t.font=`10px sans-serif`,t.fillText(`CPU`,i,o+12),t.restore()}}]})),L.value=null,I.value.cpuChart=!1}catch(e){console.error(`Error creating CPU chart:`,e),L.value=`Failed to create CPU chart`,I.value.cpuChart=!1}},ut=()=>{if(!W.value||!M.value){I.value.memoryChart=!1;return}let e=W.value.getContext(`2d`);if(!e){I.value.memoryChart=!1;return}let t=M.value.memory.usage_percent,n=100-t;if(H.value)try{H.value.data.datasets[0].data=[t,n],H.value.update(`none`);return}catch(e){console.warn(`Failed to update Memory chart, recreating...`,e),H.value.destroy(),H.value=null}let r=j.memory,a=A(),o=document.documentElement.classList.contains(`dark`),s=o?`rgba(255, 255, 255, 0.1)`:`rgba(0, 0, 0, 0.1)`,c=o?`rgba(255, 255, 255, 0.2)`:`rgba(0, 0, 0, 0.2)`;try{H.value=i(new C(e,{type:`doughnut`,data:{labels:[`Used`,`Available`],datasets:[{data:[t,n],backgroundColor:[r,s],borderColor:[r,c],borderWidth:2}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:`70%`,animation:{animateRotate:!1,animateScale:!1,duration:0},plugins:{legend:{display:!1},tooltip:{callbacks:{label:function(e){return`${e.label}: ${e.parsed.toFixed(1)}%`}}}}},plugins:[{id:`centerText`,beforeDraw:function(e){let t=e.ctx;t.save();let n=e.data.datasets[0].data[0],i=(e.chartArea.left+e.chartArea.right)/2,o=(e.chartArea.top+e.chartArea.bottom)/2;t.textAlign=`center`,t.textBaseline=`middle`,t.fillStyle=r,t.font=`bold 18px sans-serif`,t.fillText(`${n.toFixed(1)}%`,i,o-5),t.fillStyle=a.labelColor,t.font=`10px sans-serif`,t.fillText(`Memory`,i,o+12),t.restore()}}]})),R.value=null,I.value.memoryChart=!1}catch(e){console.error(`Error creating Memory chart:`,e),R.value=`Failed to create Memory chart`,I.value.memoryChart=!1}},dt=()=>{if(!G.value||!M.value)return;let t=A().textColor;try{y(()=>import(`./plotly.min-B8UFpwnE.js`).then(t=>e(t.t(),1)).then(e=>{let n=e.default||e,r=M.value.disk,i=[{type:`pie`,labels:[`Used`,`Free`],values:[r.used,r.free],marker:{colors:[j.disk,j.free]},hovertemplate:`%{label}
Size: %{value}
Percentage: %{percent}`,textinfo:`label+percent`,textposition:`auto`,hole:.4}],a={title:{text:``,font:{color:t}},paper_bgcolor:`rgba(0,0,0,0)`,plot_bgcolor:`rgba(0,0,0,0)`,font:{color:t,size:11},margin:{t:20,b:20,l:20,r:20},showlegend:!0,legend:{orientation:`h`,x:0,y:-.2,font:{color:t,size:10}}};n.newPlot(G.value,i,a,{responsive:!0,displayModeBar:!1,staticPlot:!1})}),__vite__mapDeps([0,1]))}catch(e){console.error(`Error creating disk chart:`,e)}},Q=()=>{try{if(V.value&&=(V.value.destroy(),null),H.value&&=(H.value.destroy(),null),G.value)try{y(()=>import(`./plotly.min-B8UFpwnE.js`).then(t=>e(t.t(),1)).then(e=>{let t=e?.default||e;t?.purge&&t.purge(G.value)}),__vite__mapDeps([0,1])).catch(()=>{})}catch{}}catch(e){console.error(`Error destroying charts:`,e)}};o(b,()=>{Q(),s(()=>Z())});let $=()=>{setTimeout(()=>{a(V.value)?.resize(),a(H.value)?.resize();try{y(()=>import(`./plotly.min-B8UFpwnE.js`).then(t=>e(t.t(),1)).then(e=>{let t=e?.default||e;t?.Plots&&t.Plots.resize(G.value)}),__vite__mapDeps([0,1])).catch(()=>{})}catch{}},100)};return re(ct,{intervalMs:5e3,immediate:!0}),r(async()=>{await s(),window.addEventListener(`resize`,$)}),te(()=>{window.removeEventListener(`resize`,$),Q()}),(e,r)=>(u(),_(`div`,ve,[r[22]||=g(`div`,{class:`flex justify-between items-center`},[g(`h2`,{class:`text-2xl font-bold text-content-primary dark:text-content-primary`},` System Statistics `),g(`div`,{class:`text-content-secondary dark:text-content-muted text-sm`},` Updates every 5 seconds `)],-1),g(`div`,ye,[f(T,{title:`CPU Usage`,value:`${K.value.cpuUsage.toFixed(1)}%`,color:j.cpu,data:q.value.cpu,"min-y":0,"max-y":100,subtitle:J.value},null,8,[`value`,`color`,`data`,`subtitle`]),f(T,{title:`Memory Usage`,value:`${K.value.memoryUsage.toFixed(1)}%`,color:j.memory,data:q.value.memory,"min-y":0,"max-y":100,subtitle:J.value},null,8,[`value`,`color`,`data`,`subtitle`]),f(T,{title:`Disk Usage`,value:`${K.value.diskUsage.toFixed(1)}%`,color:j.disk,data:q.value.disk,"min-y":0,"max-y":100,subtitle:J.value},null,8,[`value`,`color`,`data`,`subtitle`]),f(T,{title:`Uptime`,value:ot(K.value.uptime),color:j.uptime,data:[],"show-chart":!1},null,8,[`value`,`color`])]),g(`div`,be,[g(`div`,xe,[r[4]||=g(`h3`,{class:`text-content-primary dark:text-content-primary text-xl font-semibold mb-4`},` CPU Performance `,-1),f(w,{class:`h-32 mb-4`,"is-loading":I.value.cpuChart,error:L.value,status:z.value,onRetry:Y},{default:t(()=>[g(`canvas`,{ref_key:`cpuCanvasRef`,ref:U,class:`w-full h-full`},null,512)]),_:1},8,[`is-loading`,`error`,`status`]),M.value?(u(),_(`div`,Se,[g(`div`,null,[r[0]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`CPU Count`,-1),g(`div`,Ce,n(M.value.cpu.count)+` cores `,1)]),g(`div`,null,[r[1]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Frequency`,-1),g(`div`,we,n(M.value.cpu.frequency.toFixed(0))+` MHz `,1)]),g(`div`,null,[r[2]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Load (1m)`,-1),g(`div`,Te,n(M.value.cpu.load_avg[`1min`].toFixed(2)),1)]),g(`div`,null,[r[3]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Load (5m)`,-1),g(`div`,E,n(M.value.cpu.load_avg[`5min`].toFixed(2)),1)])])):d(``,!0)]),g(`div`,D,[r[9]||=g(`h3`,{class:`text-content-primary dark:text-content-primary text-xl font-semibold mb-4`},` Memory Usage `,-1),f(w,{class:`h-32 mb-4`,"is-loading":I.value.memoryChart,error:R.value,status:B.value,onRetry:Y},{default:t(()=>[g(`canvas`,{ref_key:`memoryCanvasRef`,ref:W,class:`w-full h-full`},null,512)]),_:1},8,[`is-loading`,`error`,`status`]),M.value?(u(),_(`div`,O,[g(`div`,null,[r[5]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Total`,-1),g(`div`,Ee,n(p(x)(M.value.memory.total)),1)]),g(`div`,null,[r[6]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Used`,-1),g(`div`,De,n(p(x)(M.value.memory.used)),1)]),g(`div`,null,[r[7]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Available`,-1),g(`div`,Oe,n(p(x)(M.value.memory.available)),1)]),g(`div`,null,[r[8]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Usage`,-1),g(`div`,ke,n(M.value.memory.usage_percent.toFixed(1))+`% `,1)])])):d(``,!0)])]),g(`div`,Ae,[g(`div`,je,[r[13]||=g(`h3`,{class:`text-content-primary dark:text-content-primary text-xl font-semibold mb-4`},` Storage Usage `,-1),g(`div`,Me,[g(`div`,{ref_key:`diskCanvasRef`,ref:G,class:`w-full h-full`},null,512)]),M.value?(u(),_(`div`,Ne,[g(`div`,Pe,[r[10]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Total`,-1),g(`div`,Fe,n(p(x)(M.value.disk.total)),1)]),g(`div`,Ie,[r[11]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Used`,-1),g(`div`,Le,n(p(x)(M.value.disk.used)),1)]),g(`div`,Re,[r[12]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Free`,-1),g(`div`,ze,n(p(x)(M.value.disk.free)),1)])])):d(``,!0)]),g(`div`,Be,[r[19]||=g(`h3`,{class:`text-content-primary dark:text-content-primary text-xl font-semibold mb-4`},` Network Statistics `,-1),M.value?(u(),_(`div`,Ve,[g(`div`,He,[g(`div`,null,[r[14]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Bytes Sent`,-1),g(`div`,Ue,n(p(x)(M.value.network.bytes_sent)),1)]),g(`div`,null,[r[15]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Bytes Received`,-1),g(`div`,We,n(p(x)(M.value.network.bytes_recv)),1)]),g(`div`,null,[r[16]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Packets Sent`,-1),g(`div`,Ge,n(M.value.network.packets_sent.toLocaleString()),1)]),g(`div`,null,[r[17]||=g(`div`,{class:`text-content-secondary dark:text-content-muted`},`Packets Received`,-1),g(`div`,Ke,n(M.value.network.packets_recv.toLocaleString()),1)])]),M.value.temperatures&&Object.keys(M.value.temperatures).length>0?(u(),_(`div`,qe,[r[18]||=g(`div`,{class:`text-content-secondary dark:text-content-muted mb-2`},` System Temperatures `,-1),g(`div`,Je,[(u(!0),_(h,null,l(M.value.temperatures,(e,t)=>(u(),_(`div`,{key:t},[g(`span`,k,n(t)+`:`,1),g(`span`,Ye,n(e.toFixed(1))+`°C`,1)]))),128))])])):d(``,!0)])):d(``,!0)])]),g(`div`,Xe,[r[21]||=g(`h3`,{class:`text-content-primary dark:text-content-primary text-xl font-semibold mb-4`},` Top Processes `,-1),N.value?.processes&&N.value.processes.length>0?(u(),_(`div`,Ze,[g(`table`,Qe,[r[20]||=g(`thead`,null,[g(`tr`,{class:`border-b border-stroke-subtle dark:border-stroke/10`},[g(`th`,{class:`text-left text-content-secondary dark:text-content-muted py-2`},`PID`),g(`th`,{class:`text-left text-content-secondary dark:text-content-muted py-2`},`Name`),g(`th`,{class:`text-center text-content-secondary dark:text-content-muted py-2`},`CPU %`),g(`th`,{class:`text-center text-content-secondary dark:text-content-muted py-2`},` Memory % `),g(`th`,{class:`text-right text-content-secondary dark:text-content-muted py-2`},`Memory`)])],-1),g(`tbody`,null,[(u(!0),_(h,null,l(N.value.processes.slice(0,10),e=>(u(),_(`tr`,{key:e.pid,class:`border-b border-stroke-subtle dark:border-white/5 process-row`},[g(`td`,$e,n(e.pid),1),g(`td`,et,n(e.name),1),g(`td`,tt,[g(`span`,{class:v([`cpu-value`,{"value-updated":X(e,`cpu_percent`)}])},n(e.cpu_percent.toFixed(1))+`% `,3)]),g(`td`,nt,[g(`span`,{class:v([`memory-value`,{"value-updated":X(e,`memory_percent`)}])},n(e.memory_percent.toFixed(1))+`% `,3)]),g(`td`,rt,[g(`span`,{class:v({"value-updated":X(e,`memory_mb`)})},n(e.memory_mb.toFixed(1))+` MB `,3)])]))),128))])]),N.value.total_processes?(u(),_(`div`,it,` Showing top 10 of `+n(N.value.total_processes)+` total processes `,1)):d(``,!0)])):I.value.processChart?d(``,!0):(u(),_(`div`,at,` No process data available `))])]))}}),[[`__scopeId`,`data-v-d0fbc86b`]]);export{A as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/Terminal-BIlcURMy.js b/repeater/web/html/assets/Terminal-BIlcURMy.js new file mode 100644 index 0000000..17b9ff0 --- /dev/null +++ b/repeater/web/html/assets/Terminal-BIlcURMy.js @@ -0,0 +1,198 @@ +import{Ct as e,D as t,E as n,R as r,V as i,Y as a,g as o,k as s,l as c,s as l,u,xt as d}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{l as f,s as p,u as m}from"./runtime-dom.esm-bundler-fKU3dih-.js";import{t as h}from"./api-C0ctTLHN.js";import{t as g}from"./system-Dx7MrhAz.js";import{t as _}from"./_plugin-vue_export-helper-TcpyXLsZ.js";import{t as v}from"./useTheme-D8lKuC-u.js";import{r as y,t as b}from"./constants-CqNUcWkW.js";var x=Object.defineProperty,ee=Object.getOwnPropertyDescriptor,te=(e,t)=>{for(var n in t)x(e,n,{get:t[n],enumerable:!0})},S=(e,t,n,r)=>{for(var i=r>1?void 0:r?ee(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&x(t,n,i),i},C=(e,t)=>(n,r)=>t(n,r,e),w=`Terminal input`,T={get:()=>w,set:e=>w=e},E=`Too much output to announce, navigate to rows manually to read`,D={get:()=>E,set:e=>E=e};function ne(e){return e.replace(/\r?\n/g,`\r`)}function re(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function O(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function k(e,t,n,r){e.stopPropagation(),e.clipboardData&&A(e.clipboardData.getData(`text/plain`),t,n,r)}function A(e,t,n,r){e=ne(e),e=re(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function j(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function ie(e,t,n,r,i){j(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function ae(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function oe(e,t=0,n=e.length){let r=``;for(let i=t;i65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var se=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},ce=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}else this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},le=``,ue=` `,M=class e{constructor(){this.fg=0,this.bg=0,this.extended=new de}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 t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}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}},de=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}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 e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},N=class e extends M{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new de,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?ae(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 t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},fe=`di$target`,pe=`di$dependencies`,me=new Map;function he(e){return e[pe]||[]}function ge(e){if(me.has(e))return me.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);_e(t,e,r)};return t._id=e,me.set(e,t),t}function _e(e,t,n){t[fe]===t?t[pe].push({id:e,index:n}):(t[pe]=[{id:e,index:n}],t[fe]=t)}var ve=ge(`BufferService`),ye=ge(`CoreMouseService`),be=ge(`CoreService`),xe=ge(`CharsetService`),Se=ge(`InstantiationService`),Ce=ge(`LogService`),we=ge(`OptionsService`),Te=ge(`OscLinkService`),Ee=ge(`UnicodeService`),De=ge(`DecorationService`),Oe=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new N,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;ti?i.activate(e,t,a):ke(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Oe=S([C(0,ve),C(1,we),C(2,Te)],Oe);function ke(e,t){if(confirm(`Do you want to navigate to ${t}? + +WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var Ae=ge(`CharSizeService`),je=ge(`CoreBrowserService`),Me=ge(`MouseService`),Ne=ge(`RenderService`),Pe=ge(`SelectionService`),Fe=ge(`CharacterJoinerService`),Ie=ge(`ThemeService`),Le=ge(`LinkProviderService`),Re=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?We.isErrorNoTelemetry(e)?new We(e.message+` + +`+e.stack):Error(e.message+` + +`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(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)}};function ze(e){Ve(e)||Re.onUnexpectedError(e)}var Be=`Canceled`;function Ve(e){return e instanceof He?!0:e instanceof Error&&e.name===Be&&e.message===Be}var He=class extends Error{constructor(){super(Be),this.name=this.message}};function Ue(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var We=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},Ge=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function Ke(e,t,n=0,r=e.length){let i=n,a=r;for(;i{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Ye||={});function Xe(e,t){return(n,r)=>t(e(n),e(r))}var Ze=(e,t)=>e-t,Qe=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>t(n)?e(n):!0))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>e(n)?(t=n,!1):!0),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||Ye.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};Qe.empty=new Qe(e=>{});function $e(e,t){let n=Object.create(null);for(let r of e){let e=t(r),i=n[e];i||=n[e]=[],i.push(r)}return n}var et=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){return this.map.get(e)||new Set}};function tt(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var nt;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);tt.source!==null&&!this.getRootParent(t,e).isSingleton).flatMap(([e])=>e)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let e=new Map,t=[...this.livingDisposables.values()].filter(t=>t.source!==null&&!this.getRootParent(t,e).isSingleton);if(t.length===0)return;let r=new Set(t.map(e=>e.value));if(n=t.filter(e=>!(e.parent&&r.has(e.parent))),n.length===0)throw Error(`There are cyclic diposable chains!`)}if(!n)return;function r(e){function t(e,t){for(;e.length>0&&t.some(t=>typeof t==`string`?t===e[0]:e[0].match(t));)e.shift()}let n=e.source.split(` +`).map(e=>e.trim().replace(`at `,``)).filter(e=>e!==``);return t(n,[`Error`,/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),n.reverse()}let i=new et;for(let e of n){let t=r(e);for(let n=0;n<=t.length;n++)i.add(t.slice(0,n).join(` +`),e)}n.sort(Xe(e=>e.idx,Ze));let a=``,o=0;for(let t of n.slice(0,e)){o++;let e=r(t),s=[];for(let t=0;tr(e)[t]),e=>e);delete o[e[t]];for(let[e,t]of Object.entries(o))s.unshift(` - stacktraces of ${t.length} other leaks continue with ${e}`);s.unshift(a)}a+=` + + +==================== Leaking disposable ${o}/${n.length}: ${t.value.constructor.name} ==================== +${s.join(` +`)} +============================================================ + +`}return n.length>e&&(a+=` + + +... and ${n.length-e} more leaking disposables + +`),{leaks:n,details:a}}};at.idx=0;function ot(e){it=e}if(rt){let e=`__is_disposable_tracked__`;ot(new class{trackDisposable(t){let n=Error(`Potentially leaked disposable`).stack;setTimeout(()=>{t[e]||console.log(n)},3e3)}setParent(t,n){if(t&&t!==F.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==F.None)try{t[e]=!0}catch{}}markAsSingleton(e){}})}function st(e){return it?.trackDisposable(e),e}function ct(e){it?.markAsDisposed(e)}function lt(e,t){it?.setParent(e,t)}function ut(e,t){if(it)for(let n of e)it.setParent(n,t)}function dt(e){return it?.markAsSingleton(e),e}function ft(e){if(nt.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function pt(...e){let t=P(()=>ft(e));return ut(e,t),t}function P(e){let t=st({dispose:tt(()=>{ct(t),e()})});return t}var mt=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,st(this)}dispose(){this._isDisposed||(ct(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{ft(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return lt(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(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(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),lt(e,null))}};mt.DISABLE_DISPOSED_WARNING=!1;var ht=mt,F=class{constructor(){this._store=new ht,st(this),lt(this._store,this)}dispose(){ct(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};F.None=Object.freeze({dispose(){}});var gt=class{constructor(){this._isDisposed=!1,st(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&<(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,ct(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&<(e,null),e}},_t=typeof window==`object`?window:globalThis,vt=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};vt.Undefined=new vt(void 0);var I=vt,yt=class{constructor(){this._first=I.Undefined,this._last=I.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===I.Undefined}clear(){let e=this._first;for(;e!==I.Undefined;){let t=e.next;e.prev=I.Undefined,e.next=I.Undefined,e=t}this._first=I.Undefined,this._last=I.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new I(e);if(this._first===I.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==I.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==I.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==I.Undefined&&e.next!==I.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===I.Undefined&&e.next===I.Undefined?(this._first=I.Undefined,this._last=I.Undefined):e.next===I.Undefined?(this._last=this._last.prev,this._last.next=I.Undefined):e.prev===I.Undefined&&(this._first=this._first.next,this._first.prev=I.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==I.Undefined;)yield e.element,e=e.next}},bt=globalThis.performance&&typeof globalThis.performance.now==`function`,xt=class e{static create(t){return new e(t)}constructor(e){this._now=bt&&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._now()-this._startTime:this._stopTime-this._startTime}},St=!1,Ct=!1,wt=!1,Tt;(e=>{e.None=()=>F.None;function t(e){if(wt){let{onDidAddListener:t}=e,n=jt.create(),r=0;e.onDidAddListener=()=>{++r===2&&(console.warn(`snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here`),n.print()),t?.()}}}function n(e,t){return f(e,()=>{},0,void 0,!0,void 0,t)}e.defer=n;function r(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=r;function i(e,t,n){return u((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=i;function a(e,t,n){return u((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=a;function o(e,t,n){return u((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=o;function s(e){return e}e.signal=s;function c(...e){return(t,n=null,r)=>d(pt(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=c;function l(e,t,n,r){let a=n;return i(e,e=>(a=t(a,e),a),r)}e.reduce=l;function u(e,n){let r,i={onWillAddFirstListener(){r=e(a.fire,a)},onDidRemoveLastListener(){r?.dispose()}};n||t(i);let a=new L(i);return n?.add(a),a.event}function d(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function f(e,n,r=100,i=!1,a=!1,o,s){let c,l,u,d=0,f,p={leakWarningThreshold:o,onWillAddFirstListener(){c=e(e=>{d++,l=n(l,e),i&&!u&&(m.fire(l),l=void 0),f=()=>{let e=l;l=void 0,u=void 0,(!i||d>1)&&m.fire(e),d=0},typeof r==`number`?(clearTimeout(u),u=setTimeout(f,r)):u===void 0&&(u=0,queueMicrotask(f))})},onWillRemoveListener(){a&&d>0&&f?.()},onDidRemoveLastListener(){f=void 0,c.dispose()}};s||t(p);let m=new L(p);return s?.add(m),m.event}e.debounce=f;function p(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=p;function m(e,t=(e,t)=>e===t,n){let r=!0,i;return o(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=m;function h(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=h;function g(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new L({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=g;function _(e,t){return(n,r,i)=>{let a=t(new y);return e(function(e){let t=a.evaluate(e);t!==v&&n.call(r,t)},void 0,i)}}e.chain=_;let v=Symbol(`HaltChainable`);class y{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:v),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:v}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===v)break;return e}}function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new L({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=b;function x(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new L({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=x;function ee(e){return new Promise(t=>r(e)(t))}e.toPromise=ee;function te(e){let t=new L;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=te;function S(e,t){return e(e=>t.fire(e))}e.forward=S;function C(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=C;class w{constructor(e,n){this._observable=e,this._counter=0,this._hasChanged=!1;let r={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};n||t(r),this.emitter=new L(r),n&&n.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function T(e,t){return new w(e,t).emitter.event}e.fromObservable=T;function E(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof ht?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=E})(Tt||={});var Et=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new xt,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}}};Et.all=new Set,Et._idPool=0;var Dt=Et,Ot=-1,kt=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t{if(e instanceof Ft)t(e);else for(let n=0;n{e.length!==0&&(console.warn(`[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:`),console.warn(e.join(` +`)),e.length=0)},3e3),Rt=new FinalizationRegistry(t=>{typeof t==`string`&&e.push(t)})}var L=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Ot>0||this._options?.leakWarningThreshold?new At(e?.onListenerError??ze,this._options?.leakWarningThreshold??Ot):void 0,this._perfMon=this._options?._profName?new Dt(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(Ct){let e=this._listeners;queueMicrotask(()=>{Lt(e,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new Nt(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||ze)(n),F.None}if(this._disposed)return F.None;t&&(e=e.bind(t));let r=new Ft(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=jt.create(),i=this._leakageMon.check(r.stack,this._size+1)),Ct&&(r.stack=jt.create()),this._listeners?this._listeners instanceof Ft?(this._deliveryQueue??=new zt,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=P(()=>{Rt?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof ht?n.add(a):Array.isArray(n)&&n.push(a),Rt){let e=Error().stack.split(` +`).slice(2,3).join(` +`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);Rt.register(a,t?.[2]??e,a)}return a},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 t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*It<=t.length){let e=0;for(let n=0;n0}},zt=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Bt=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new L,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new L,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Bt.INSTANCE=new Bt;var Vt=Bt;function Ht(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}Vt.INSTANCE.onDidChangeZoomLevel;function Ut(e){return Vt.INSTANCE.getZoomFactor(e)}Vt.INSTANCE.onDidChangeFullscreen;var Wt=typeof navigator==`object`?navigator.userAgent:``,Gt=Wt.indexOf(`Firefox`)>=0,Kt=Wt.indexOf(`AppleWebKit`)>=0,qt=Wt.indexOf(`Chrome`)>=0,Jt=!qt&&Wt.indexOf(`Safari`)>=0;Wt.indexOf(`Electron/`),Wt.indexOf(`Android`);var Yt=!1;if(typeof _t.matchMedia==`function`){let e=_t.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=_t.matchMedia(`(display-mode: fullscreen)`);Yt=e.matches,Ht(_t,e,({matches:e})=>{Yt&&t.matches||(Yt=e)})}function Xt(){return Yt}var Zt=`en`,Qt=!1,$t=!1,en=!1,tn=!1,nn=!1,rn=Zt,an,on=globalThis,sn;typeof on.vscode<`u`&&typeof on.vscode.process<`u`?sn=on.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(sn=process);var cn=typeof sn?.versions?.electron==`string`&&sn?.type===`renderer`;if(typeof sn==`object`){Qt=sn.platform===`win32`,$t=sn.platform===`darwin`,en=sn.platform===`linux`,en&&sn.env.SNAP&&sn.env.SNAP_REVISION,sn.env.CI||sn.env.BUILD_ARTIFACTSTAGINGDIRECTORY,rn=Zt;let e=sn.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,rn=t.resolvedLanguage||Zt,t.languagePack?.translationsConfigFile}catch{}tn=!0}else typeof navigator==`object`&&!cn?(an=navigator.userAgent,Qt=an.indexOf(`Windows`)>=0,$t=an.indexOf(`Macintosh`)>=0,(an.indexOf(`Macintosh`)>=0||an.indexOf(`iPad`)>=0||an.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,en=an.indexOf(`Linux`)>=0,an?.indexOf(`Mobi`),nn=!0,rn=globalThis._VSCODE_NLS_LANGUAGE||Zt,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var ln=Qt,un=$t,dn=en,fn=tn;nn&&typeof on.importScripts==`function`&&on.origin;var pn=an,mn=rn,hn;(e=>{function t(){return mn}e.value=t;function n(){return mn.length===2?mn===`en`:mn.length>=3?mn[0]===`e`&&mn[1]===`n`&&mn[2]===`-`:!1}e.isDefaultVariant=n;function r(){return mn===`en`}e.isDefault=r})(hn||={});var gn=typeof on.postMessage==`function`&&!on.importScripts;(()=>{if(gn){let e=[];on.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n{let r=++t;e.push({id:r,callback:n}),on.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var _n=!!(pn&&pn.indexOf(`Chrome`)>=0);pn&&pn.indexOf(`Firefox`),!_n&&pn&&pn.indexOf(`Safari`),pn&&pn.indexOf(`Edg/`),pn&&pn.indexOf(`Android`);var vn=typeof navigator==`object`?navigator:{};fn||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||vn&&vn.clipboard&&vn.clipboard.writeText,fn||vn&&vn.clipboard&&vn.clipboard.readText,fn||Xt()||vn.keyboard,`ontouchstart`in _t||vn.maxTouchPoints,_t.PointerEvent&&(`ontouchstart`in _t||navigator.maxTouchPoints);var yn=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},bn=new yn,xn=new yn,Sn=new yn,Cn=Array(230),wn;(e=>{function t(e){return bn.keyCodeToStr(e)}e.toString=t;function n(e){return bn.strToKeyCode(e)}e.fromString=n;function r(e){return xn.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return Sn.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return xn.strToKeyCode(e)||Sn.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return bn.keyCodeToStr(e)}e.toElectronAccelerator=o})(wn||={});var Tn=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new En([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},En=class{constructor(e){if(e.length===0)throw Ue(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t{function t(t){return t===e.None||t===e.Cancelled||t instanceof Bn?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Tt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Rn})})(zn||={});var Bn=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?Rn:(this._emitter||=new L,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},Vn=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e==`function`&&typeof t==`number`&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Ge(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Ge(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},Hn=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new Ge(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=P(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var Un;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(Un||={});var Wn=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new L,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.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(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.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())}};Wn.EMPTY=Wn.fromArray([]);function Gn(e){return 55296<=e&&e<=56319}function Kn(e){return 56320<=e&&e<=57343}function qn(e,t){return(e-55296<<10)+(t-56320)+65536}function Jn(e){return Yn(e,0)}function Yn(e,t){switch(typeof e){case`object`:return e===null?Xn(349,t):Array.isArray(e)?$n(e,t):er(e,t);case`string`:return Qn(e,t);case`boolean`:return Zn(e,t);case`number`:return Xn(e,t);case`undefined`:return Xn(937,t);default:return Xn(617,t)}}function Xn(e,t){return(t<<5)-t+e|0}function Zn(e,t){return Xn(e?433:863,t)}function Qn(e,t){t=Xn(149417,t);for(let n=0,r=e.length;nYn(t,e),t)}function er(e,t){return t=Xn(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=Qn(n,t),Yn(e[n],t)),t)}function tr(e,t,n=32){let r=n-t,i=~((1<>>r)>>>0}function nr(e,t=0,n=e.byteLength,r=0){for(let i=0;ie.toString(16).padStart(2,`0`)).join(``):rr((e>>>0).toString(16),t/4)}var ar=class e{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){let t=e.length;if(t===0)return;let n=this._buff,r=this._buffLen,i=this._leftoverHighSurrogate,a,o;for(i===0?(a=e.charCodeAt(0),o=0):(a=i,o=-1,i=0);;){let s=a;if(Gn(a))if(o+1>>6,e[t++]=128|(n&63)>>>0):n<65536?(e[t++]=224|(n&61440)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0):(e[t++]=240|(n&1835008)>>>18,e[t++]=128|(n&258048)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),ir(this._h0)+ir(this._h1)+ir(this._h2)+ir(this._h3)+ir(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,nr(this._buff,this._buffLen),this._buffLen>56&&(this._step(),nr(this._buff));let e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){let t=e._bigBlock32,n=this._buffDV;for(let e=0;e<64;e+=4)t.setUint32(e,n.getUint32(e,!1),!1);for(let e=64;e<320;e+=4)t.setUint32(e,tr(t.getUint32(e-12,!1)^t.getUint32(e-32,!1)^t.getUint32(e-56,!1)^t.getUint32(e-64,!1),1),!1);let r=this._h0,i=this._h1,a=this._h2,o=this._h3,s=this._h4,c,l,u;for(let e=0;e<80;e++)e<20?(c=i&a|~i&o,l=1518500249):e<40?(c=i^a^o,l=1859775393):e<60?(c=i&a|i&o|a&o,l=2400959708):(c=i^a^o,l=3395469782),u=tr(r,5)+c+s+l+t.getUint32(e*4,!1)&4294967295,s=o,o=a,a=tr(i,30),i=r,r=u;this._h0=this._h0+r&4294967295,this._h1=this._h1+i&4294967295,this._h2=this._h2+a&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+s&4294967295}};ar._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:or,getWindow:sr,getDocument:cr,getWindows:lr,getWindowsCount:ur,getWindowId:dr,getWindowById:fr,hasWindow:pr,onDidRegisterWindow:mr,onWillUnregisterWindow:hr,onDidUnregisterWindow:gr}=function(){let e=new Map,t={window:_t,disposables:new ht};e.set(_t.vscodeWindowId,t);let n=new L,r=new L,i=new L;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return F.None;let a=new ht,o={window:t,disposables:a.add(new ht)};return e.set(t.vscodeWindowId,o),a.add(P(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(R(t,Er.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:_t},getDocument(e){return sr(e).document}}}(),_r=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,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,null)}};function R(e,t,n,r){return new _r(e,t,n,r)}function vr(e,t){return function(n){return t(new In(e,n))}}function yr(e){return function(t){return e(new Mn(t))}}var br=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=vr(sr(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=yr(n)),R(e,t,i,r)},xr,Sr=class extends Hn{constructor(e){super(),this.defaultTarget=e&&sr(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},Cr=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){ze(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(Cr.sort),a.shift().execute();r.set(i,!1)};xr=(t,r,a=0)=>{let o=dr(t),s=new Cr(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})();var wr=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};wr.None=new wr(0,0);function Tr(e){let t=e.getBoundingClientRect(),n=sr(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=Jn(n),a=r.get(i);if(a)a.users+=1;else{let o=new L,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(P(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var Er={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:Kt?`webkitAnimationStart`:`animationstart`,ANIMATION_END:Kt?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:Kt?`webkitAnimationIteration`:`animationiteration`},Dr=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function Or(e,t,n,...r){let i=Dr.exec(t);if(!i)throw Error(`Bad use of emmet`);let a=i[1]||`div`,o;return o=e===`http://www.w3.org/1999/xhtml`?document.createElement(a):document.createElementNS(e,a),i[3]&&(o.id=i[3]),i[4]&&(o.className=i[4].replace(/\./g,` `).trim()),n&&Object.entries(n).forEach(([e,t])=>{typeof t>`u`||(/^on\w+$/.test(e)?o[e]=t:e===`selected`?t&&o.setAttribute(e,`true`):o.setAttribute(e,t))}),o.append(...r),o}function kr(e,t,...n){return Or(`http://www.w3.org/1999/xhtml`,e,t,...n)}kr.SVG=function(e,t,...n){return Or(`http://www.w3.org/2000/svg`,e,t,...n)};var Ar=class{constructor(e){this.domNode=e,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(e){let t=jr(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=jr(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=jr(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=jr(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=jr(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=jr(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=jr(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=jr(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=jr(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=jr(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=jr(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=jr(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=jr(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=jr(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?`translate3d(0px, 0px, 0px)`:``)}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function jr(e){return typeof e==`number`?`${e}px`:e}function Mr(e){return new Ar(e)}var Nr=class{constructor(){this._hooks=new ht,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add(P(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=sr(e)}this._hooks.add(R(a,Er.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(R(a,Er.POINTER_UP,e=>this.stopMonitoring(!0)))}};function Pr(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}var Fr;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(Fr||={});var Ir=class e extends F{constructor(){super(),this.dispatched=!1,this.targets=new yt,this.ignoreTargets=new yt,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Tt.runAndSubscribe(mr,({window:e,disposables:t})=>{t.add(R(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(R(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(R(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:_t,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=dt(new e),P(e.INSTANCE.targets.push(t))):F.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=dt(new e),P(e.INSTANCE.ignoreTargets.push(t))):F.None}static isTouchDevice(){return`ontouchstart`in _t||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n=e.HOLD_DELAY&&Math.abs(s.initialPageX-Je(s.rollingPageX))<30&&Math.abs(s.initialPageY-Je(s.rollingPageY))<30){let e=this.newGestureEvent(Fr.Contextmenu,s.initialTarget);e.pageX=Je(s.rollingPageX),e.pageY=Je(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=Je(s.rollingPageX),n=Je(s.rollingPageY),i=Je(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(Fr.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===Fr.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else (t.type===Fr.Change||t.type===Fr.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=xr(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(Fr.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}};Ir.SCROLL_FRICTION=-.005,Ir.HOLD_DELAY=700,Ir.CLEAR_TAP_COUNT_TIME=400,S([Pr],Ir,`isTouchDevice`,1);var Lr=Ir,Rr=class extends F{onclick(e,t){this._register(R(e,Er.CLICK,n=>t(new In(sr(e),n))))}onmousedown(e,t){this._register(R(e,Er.MOUSE_DOWN,n=>t(new In(sr(e),n))))}onmouseover(e,t){this._register(R(e,Er.MOUSE_OVER,n=>t(new In(sr(e),n))))}onmouseleave(e,t){this._register(R(e,Er.MOUSE_LEAVE,n=>t(new In(sr(e),n))))}onkeydown(e,t){this._register(R(e,Er.KEY_DOWN,e=>t(new Mn(e))))}onkeyup(e,t){this._register(R(e,Er.KEY_UP,e=>t(new Mn(e))))}oninput(e,t){this._register(R(e,Er.INPUT,t))}onblur(e,t){this._register(R(e,Er.BLUR,t))}onfocus(e,t){this._register(R(e,Er.FOCUS,t))}onchange(e,t){this._register(R(e,Er.CHANGE,t))}ignoreGesture(e){return Lr.ignoreTarget(e)}},zr=11,Br=class extends Rr{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement(`div`),this.bgDomNode.className=`arrow-background`,this.bgDomNode.style.position=`absolute`,this.bgDomNode.style.width=e.bgWidth+`px`,this.bgDomNode.style.height=e.bgHeight+`px`,typeof e.top<`u`&&(this.bgDomNode.style.top=`0px`),typeof e.left<`u`&&(this.bgDomNode.style.left=`0px`),typeof e.bottom<`u`&&(this.bgDomNode.style.bottom=`0px`),typeof e.right<`u`&&(this.bgDomNode.style.right=`0px`),this.domNode=document.createElement(`div`),this.domNode.className=e.className,this.domNode.style.position=`absolute`,this.domNode.style.width=zr+`px`,this.domNode.style.height=zr+`px`,typeof e.top<`u`&&(this.domNode.style.top=e.top+`px`),typeof e.left<`u`&&(this.domNode.style.left=e.left+`px`),typeof e.bottom<`u`&&(this.domNode.style.bottom=e.bottom+`px`),typeof e.right<`u`&&(this.domNode.style.right=e.right+`px`),this._pointerMoveMonitor=this._register(new Nr),this._register(br(this.bgDomNode,Er.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(br(this.domNode,Er.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new Sr),this._pointerdownScheduleRepeatTimer=this._register(new Vn)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,sr(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},Vr=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}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(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<`u`?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<`u`?t.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,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:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},Hr=class extends F{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new L),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new Vr(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>`u`?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>`u`?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new Kr(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=Kr.start(this._state,t,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 e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},Ur=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function Wr(e,t){let n=t-e;return function(t){return e+n*Jr(t)}}function Gr(e,t,n){return function(r){return r2.5*n){let r,i;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`:``)))}},Xr=140,Zr=class extends Rr{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 Yr(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Nr),this._shouldRender=!0,this.domNode=Mr(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(R(this.domNode.domNode,Er.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new Br(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=Mr(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register(R(this.slider.domNode,Er.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.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 t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=Tr(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);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 t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if(ln&&a>Xr){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName(`active`,!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},Qr=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize===t?!1:(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize===t?!1:(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition===t?!1:(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.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 t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};ai.INSTANCE=new ai;var oi=ai,si=class extends Rr{constructor(e,t,n){super(),this._onScroll=this._register(new L),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new L),this.onWillScroll=this._onWillScroll.event,this._options=li(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new ei(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new $r(this._scrollable,this._options,r)),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(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Mr(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Mr(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Mr(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,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new Vn),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ft(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,un&&(this._options.className+=` mac`),this._domNode.className=`xterm-scrollable-element `+this._options.className}updateOptions(e){typeof e.handleMouseWheel<`u`&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<`u`&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<`u`&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<`u`&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<`u`&&(this._options.horizontal=e.horizontal),typeof e.vertical<`u`&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<`u`&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<`u`&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<`u`&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Ln(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=ft(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(R(this._listenOnDomNode,Er.MOUSE_WHEEL,e=>{this._onMouseWheel(new Ln(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=oi.INSTANCE;ri&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!un&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=ni*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=ni*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(ri&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw 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 e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){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(),ti)}},ci=class extends si{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function li(e){let t={lazyRender:typeof e.lazyRender<`u`?e.lazyRender:!1,className:typeof e.className<`u`?e.className:``,useShadows:typeof e.useShadows<`u`?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<`u`?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<`u`?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<`u`?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<`u`?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<`u`?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<`u`?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<`u`?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<`u`?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<`u`?e.listenOnDomNode:null,horizontal:typeof e.horizontal<`u`?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<`u`?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<`u`?e.horizontalHasArrows:!1,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,un&&(t.className+=` mac`),t}var ui=class extends F{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new L),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new Hr({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>xr(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new ci(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Tt.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(P(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(P(()=>this._styleElement.remove())),this._register(Tt.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.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(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,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 t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};ui=S([C(2,ve),C(3,je),C(4,ye),C(5,Ie),C(6,we),C(7,Ne)],ui);var di=class extends F{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,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(e=>this._removeDecoration(e))),this._register(P(()=>{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 t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:``:t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};di=S([C(1,ve),C(2,je),C(3,De),C(4,Ne)],di);var fi=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 t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},pi={full:0,left:0,center:0,right:0},mi={full:0,left:0,center:0,right:0},hi={full:0,left:0,center:0,right:0},gi=class extends F{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new fi,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(P(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw 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),t=Math.ceil((this._canvas.width-1)/3);mi.full=this._canvas.width,mi.left=e,mi.center=t,mi.right=e,this._refreshDrawHeightConstants(),hi.full=1,hi.left=1,hi.center=1+mi.left,hi.right=1+mi.left+mi.center}_refreshDrawHeightConstants(){pi.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);pi.left=t,pi.center=t,pi.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*pi.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*pi.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*pi.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*pi.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 e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);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(hi[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-pi[e.position||`full`]/2),mi[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+pi[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};gi=S([C(2,ve),C(3,De),C(4,Ne),C(5,we),C(6,Ie),C(7,je)],gi);var z;(e=>(e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=` +`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))(z||={});var _i;(e=>(e.PAD=`€`,e.HOP=``,e.BPH=`‚`,e.NBH=`ƒ`,e.IND=`„`,e.NEL=`…`,e.SSA=`†`,e.ESA=`‡`,e.HTS=`ˆ`,e.HTJ=`‰`,e.VTS=`Š`,e.PLD=`‹`,e.PLU=`Œ`,e.RI=``,e.SS2=`Ž`,e.SS3=``,e.DCS=``,e.PU1=`‘`,e.PU2=`’`,e.STS=`“`,e.CCH=`”`,e.MW=`•`,e.SPA=`–`,e.EPA=`—`,e.SOS=`˜`,e.SGCI=`™`,e.SCI=`š`,e.CSI=`›`,e.ST=`œ`,e.OSC=``,e.PM=`ž`,e.APC=`Ÿ`))(_i||={});var vi;(e=>e.ST=`${z.ESC}\\`)(vi||={});var yi=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,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 e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.lengththis.updateCompositionElements(!0),0)}}};yi=S([C(2,ve),C(3,we),C(4,be),C(5,Ne)],yi);var bi=0,xi=0,Si=0,B=0,Ci={css:`#00000000`,rgba:0},V;(e=>{function t(e,t,n,r){return r===void 0?`#${Ei(e)}${Ei(t)}${Ei(n)}`:`#${Ei(e)}${Ei(t)}${Ei(n)}${Ei(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(V||={});var H;(e=>{function t(e,t){if(B=(t.rgba&255)/255,B===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return bi=a+Math.round((n-a)*B),xi=o+Math.round((r-o)*B),Si=s+Math.round((i-s)*B),{css:V.toCss(bi,xi,Si),rgba:V.toRgba(bi,xi,Si)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=Ti.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return V.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[bi,xi,Si]=Ti.toChannels(t),{css:V.toCss(bi,xi,Si),rgba:t}}e.opaque=i;function a(e,t){return B=Math.round(t*255),[bi,xi,Si]=Ti.toChannels(e.rgba),{css:V.toCss(bi,xi,Si,B),rgba:V.toRgba(bi,xi,Si,B)}}e.opacity=a;function o(e,t){return B=e.rgba&255,a(e,B*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(H||={});var U;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return bi=parseInt(e.slice(1,2).repeat(2),16),xi=parseInt(e.slice(2,3).repeat(2),16),Si=parseInt(e.slice(3,4).repeat(2),16),V.toColor(bi,xi,Si);case 5:return bi=parseInt(e.slice(1,2).repeat(2),16),xi=parseInt(e.slice(2,3).repeat(2),16),Si=parseInt(e.slice(3,4).repeat(2),16),B=parseInt(e.slice(4,5).repeat(2),16),V.toColor(bi,xi,Si,B);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return bi=parseInt(r[1]),xi=parseInt(r[2]),Si=parseInt(r[3]),B=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),V.toColor(bi,xi,Si,B);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[bi,xi,Si,B]=t.getImageData(0,0,1,1).data,B!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:V.toRgba(bi,xi,Si,B),css:e}}e.toColor=r})(U||={});var wi;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(wi||={});var Ti;(e=>{function t(e,t){if(B=(t&255)/255,B===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return bi=a+Math.round((n-a)*B),xi=o+Math.round((r-o)*B),Si=s+Math.round((i-s)*B),V.toRgba(bi,xi,Si)}e.blend=t;function n(e,t,n){let a=wi.relativeLuminance(e>>8),o=wi.relativeLuminance(t>>8);if(Di(a,o)>8));if(sDi(a,wi.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=Di(a,wi.relativeLuminance(s>>8));if(cDi(a,wi.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=Di(wi.relativeLuminance2(o,s,c),wi.relativeLuminance2(r,i,a));for(;l0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=Di(wi.relativeLuminance2(o,s,c),wi.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=Di(wi.relativeLuminance2(o,s,c),wi.relativeLuminance2(r,i,a));for(;l>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(Ti||={});function Ei(e){let t=e.toString(16);return t.length<2?`0`+t:t}function Di(e,t){return e1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t=w,O=D,k=this._workCell;if(f.length>0&&D===f[0][0]&&re){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v=r[1],re?(ne=!0,k=new Oi(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),O=r[1]-1,m=k.getWidth()):w=r[1]}let A=this._isCellInSelection(D,t),j=n&&D===a,ie=E&&D>=l&&D<=u,ae=!1;this._decorationService.forEachDecorationAtCell(D,t,void 0,e=>{ae=!0});let oe=k.getChars()||ue;if(oe===` `&&(k.isUnderline()||k.isOverline())&&(oe=`\xA0`),C=m*s-c.get(oe,k.isBold(),k.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(A&&S||!A&&!S&&k.bg===y)&&(A&&S&&p.selectionForeground||k.fg===b)&&k.extended.ext===x&&ie===ee&&C===te&&!j&&!ne&&!ae&&re){k.isInvisible()?_+=ue:_+=oe,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=k.bg,b=k.fg,x=k.extended.ext,ee=ie,te=C,S=A,ne&&a>=D&&a<=O&&(a=D),!this._coreService.isCursorHidden&&j&&this._coreService.isCursorInitialized){if(T.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&T.push(`xterm-cursor-blink`),T.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:T.push(`xterm-cursor-outline`);break;case`block`:T.push(`xterm-cursor-block`);break;case`bar`:T.push(`xterm-cursor-bar`);break;case`underline`:T.push(`xterm-cursor-underline`);break;default:break}}if(k.isBold()&&T.push(`xterm-bold`),k.isItalic()&&T.push(`xterm-italic`),k.isDim()&&T.push(`xterm-dim`),_=k.isInvisible()?ue:k.getChars()||ue,k.isUnderline()&&(T.push(`xterm-underline-${k.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!k.isUnderlineColorDefault()))if(k.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${M.toColorRGB(k.getUnderlineColor()).join(`,`)})`;else{let e=k.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&k.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}k.isOverline()&&(T.push(`xterm-overline`),_===` `&&(_=`\xA0`)),k.isStrikethrough()&&T.push(`xterm-strikethrough`),ie&&(h.style.textDecoration=`underline`);let se=k.getFgColor(),ce=k.getFgColorMode(),le=k.getBgColor(),de=k.getBgColorMode(),N=!!k.isInverse();if(N){let e=se;se=le,le=e;let t=ce;ce=de,de=t}let fe,pe,me=!1;this._decorationService.forEachDecorationAtCell(D,t,void 0,e=>{e.options.layer!==`top`&&me||(e.backgroundColorRGB&&(de=50331648,le=e.backgroundColorRGB.rgba>>8&16777215,fe=e.backgroundColorRGB),e.foregroundColorRGB&&(ce=50331648,se=e.foregroundColorRGB.rgba>>8&16777215,pe=e.foregroundColorRGB),me=e.options.layer===`top`)}),!me&&A&&(fe=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,le=fe.rgba>>8&16777215,de=50331648,me=!0,p.selectionForeground&&(ce=50331648,se=p.selectionForeground.rgba>>8&16777215,pe=p.selectionForeground)),me&&T.push(`xterm-decoration-top`);let he;switch(de){case 16777216:case 33554432:he=p.ansi[le],T.push(`xterm-bg-${le}`);break;case 50331648:he=V.toColor(le>>16,le>>8&255,le&255),this._addStyle(h,`background-color:#${Ii((le>>>0).toString(16),`0`,6)}`);break;default:N?(he=p.foreground,T.push(`xterm-bg-257`)):he=p.background}switch(fe||k.isDim()&&(fe=H.multiplyOpacity(he,.5)),ce){case 16777216:case 33554432:k.isBold()&&se<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(se+=8),this._applyMinimumContrast(h,he,p.ansi[se],k,fe,void 0)||T.push(`xterm-fg-${se}`);break;case 50331648:let e=V.toColor(se>>16&255,se>>8&255,se&255);this._applyMinimumContrast(h,he,e,k,fe,pe)||this._addStyle(h,`color:#${Ii(se.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,he,p.foreground,k,fe,pe)||N&&T.push(`xterm-fg-257`)}T.length&&=(h.className=T.join(` `),0),!j&&!ne&&!ae&&re?g++:h.textContent=_,C!==this.defaultSpacing&&(h.style.letterSpacing=`${C}px`),d.push(h),D=O}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||Mi(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=H.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t=n[0]&&e=n[0]}};Fi=S([C(1,Fe),C(2,we),C(3,je),C(4,be),C(5,De),C(6,Ie)],Fi);function Ii(e,t,n){for(;e.length0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},Ri=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,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n=this.startCol&&t=this.startCol):!1}};function zi(){return new Ri}var Bi=`xterm-dom-renderer-owner-`,Vi=`xterm-rows`,Hi=`xterm-fg-`,Ui=`xterm-bg-`,Wi=`xterm-focus`,Gi=`xterm-selection`,Ki=1,qi=class extends F{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=Ki++,this._rowElements=[],this._selectionRenderModel=zi(),this.onRequestRedraw=this._register(new L).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(Vi),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(Gi),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=Ni(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(Fi,document),this._element.classList.add(Bi+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(P(()=>{this._element.classList.remove(Bi+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Li(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 e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Vi} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,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 t=`${this._terminalSelector} .${Vi} { 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}`;t+=`${this._terminalSelector} .${Vi} .xterm-dim { color: ${H.multiplyOpacity(e.foreground,.5).css};}`,t+=`${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 n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Vi}.${Wi} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Vi}.${Wi} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Vi}.${Wi} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Vi} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Vi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Vi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Vi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Vi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Gi} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Gi} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Gi} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${Hi}${n} { color: ${r.css}; }${this._terminalSelector} .${Hi}${n}.xterm-dim { color: ${H.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${Ui}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${Hi}257 { color: ${H.opaque(e.background).css}; }${this._terminalSelector} .${Hi}257.xterm-dim { color: ${H.multiplyOpacity(H.opaque(e.background),.5).css}; }${this._terminalSelector} .${Ui}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_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,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),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(Wi),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Wi),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}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,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Bi}${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,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};qi=S([C(7,Se),C(8,Ae),C(9,we),C(10,ve),C(11,be),C(12,je),C(13,Ie)],qi);var Ji=class extends F{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new L),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Zi(this._optionsService))}catch{this._measureStrategy=this._register(new Xi(e,t,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())}};Ji=S([C(2,we)],Ji);var Yi=class extends F{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},Xi=class extends Yi{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,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}},Zi=class extends Yi{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw 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}},Qi=class extends F{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new $i(this._window)),this._onDprChange=this._register(new L),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new L),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(Tt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(R(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(R(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}},$i=class extends F{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new gt),this._onDprChange=this._register(new L),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(P(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=R(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)}},ea=class extends F{constructor(){super(),this.linkProviders=[],this._register(P(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function ta(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function na(e,t,n,r,i,a,o,s,c){if(!a)return;let l=ta(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+(c?1:0)),l[1]=Math.min(Math.max(l[1],1),i),l}var ra=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return na(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=ta(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};ra=S([C(0,Ne),C(1,Ae)],ra);var ia=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),!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),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},aa={};te(aa,{getSafariVersion:()=>fa,isChromeOS:()=>va,isFirefox:()=>la,isIpad:()=>ma,isIphone:()=>ha,isLegacyEdge:()=>ua,isLinux:()=>_a,isMac:()=>pa,isNode:()=>oa,isSafari:()=>da,isWindows:()=>ga});var oa=typeof process<`u`&&`title`in process,sa=oa?`node`:navigator.userAgent,ca=oa?`node`:navigator.platform,la=sa.includes(`Firefox`),ua=sa.includes(`Edge`),da=/^((?!chrome|android).)*safari/i.test(sa);function fa(){if(!da)return 0;let e=sa.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var pa=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(ca),ma=ca===`iPad`,ha=ca===`iPhone`,ga=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(ca),_a=ca.indexOf(`Linux`)>=0,va=/\bCrOS\b/.test(sa),ya=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._ii){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},ba=class extends ya{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},xa=class extends ya{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Sa=!oa&&`requestIdleCallback`in window?xa:ba,Ca=class{constructor(){this._queue=new Sa}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},wa=class extends F{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new gt),this._pausedResizeTask=new Ca,this._observerDisposable=this._register(new gt),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 L),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new L),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new L),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new L),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new ia((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Ta(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(P(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=P(()=>n.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,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,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(e=>this.refreshRows(e.start,e.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,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};wa=S([C(2,we),C(3,Ae),C(4,be),C(5,De),C(6,ve),C(7,je),C(8,Ie)],wa);var Ta=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,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 e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function Ea(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return ka(i,a,e,t,n,r)+Aa(a,t,n,r)+ja(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,Ra(Math.abs(i-e),La(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return Ra(Oa(a>t?e:i,n)+(s-1)*n.cols+1+Da(a>t?i:e,n),La(o,r))}function Da(e,t){return e-1}function Oa(e,t){return t.cols-e}function ka(e,t,n,r,i,a){return Aa(t,r,i,a).length===0?``:Ra(Ia(e,t,e,t-Na(t,i),!1,i).length,La(`D`,a))}function Aa(e,t,n,r){let i=e-Na(e,n),a=t-Na(t,n);return Ra(Math.abs(i-a)-Ma(e,t,n),La(Fa(e,t),r))}function ja(e,t,n,r,i,a){let o;o=Aa(t,r,i,a).length>0?r-Na(r,i):t;let s=r,c=Pa(e,t,n,r,i,a);return Ra(Ia(e,o,n,s,c===`C`,i).length,La(c,a))}function Ma(e,t,n){let r=0,i=e-Na(e,n),a=t-Na(t,n);for(let o=0;o=0&&e0?r-Na(r,i):t,e=n&&ot?`A`:`B`}function Ia(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&sa.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function La(e,t){let n=t?`O`:`[`;return z.ESC+n+e}function Ra(e,t){e=Math.floor(e);let n=``;for(let r=0;rthis._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Ba(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var Va=50,Ha=15,Ua=50,Wa=500,Ga=RegExp(`\xA0`,`g`),Ka=class extends F{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new N,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new L),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new L),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new L),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new L),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new za(this._bufferService),this._activeSelectionMode=0,this._register(P(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.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,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]e.replace(Ga,` `)).join(ga?`\r +`:` +`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),_a&&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 t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]=t[0]&&e[0]=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=Ba(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=ta(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-Va),Va),t/=Va,t/Math.abs(t)+Math.round(t*(Ha-1)))}shouldForceSelection(e){return pa?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(),Ua)}_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 t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(pa&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=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 n=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 t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&tthis._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(!(!t&&o.slice(s,c).trim()===``)){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Ba(n,this._bufferService.cols)}};Ka=S([C(3,ve),C(4,be),C(5,Me),C(6,we),C(7,Ne),C(8,je)],Ka);var qa=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Ja=class{constructor(){this._color=new qa,this._css=new qa}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},W=Object.freeze((()=>{let e=[U.toColor(`#2e3436`),U.toColor(`#cc0000`),U.toColor(`#4e9a06`),U.toColor(`#c4a000`),U.toColor(`#3465a4`),U.toColor(`#75507b`),U.toColor(`#06989a`),U.toColor(`#d3d7cf`),U.toColor(`#555753`),U.toColor(`#ef2929`),U.toColor(`#8ae234`),U.toColor(`#fce94f`),U.toColor(`#729fcf`),U.toColor(`#ad7fa8`),U.toColor(`#34e2e2`),U.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:V.toCss(r,i,a),rgba:V.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:V.toCss(n,n,n),rgba:V.toRgba(n,n,n)})}return e})()),Ya=U.toColor(`#ffffff`),Xa=U.toColor(`#000000`),Za=U.toColor(`#ffffff`),Qa=Xa,$a={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},eo=Ya,to=class extends F{constructor(e){super(),this._optionsService=e,this._contrastCache=new Ja,this._halfContrastCache=new Ja,this._onChangeColors=this._register(new L),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Ya,background:Xa,cursor:Za,cursorAccent:Qa,selectionForeground:void 0,selectionBackgroundTransparent:$a,selectionBackgroundOpaque:H.blend(Xa,$a),selectionInactiveBackgroundTransparent:$a,selectionInactiveBackgroundOpaque:H.blend(Xa,$a),scrollbarSliderBackground:H.opacity(Ya,.2),scrollbarSliderHoverBackground:H.opacity(Ya,.4),scrollbarSliderActiveBackground:H.opacity(Ya,.5),overviewRulerBorder:Ya,ansi:W.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 t=this._colors;if(t.foreground=G(e.foreground,Ya),t.background=G(e.background,Xa),t.cursor=H.blend(t.background,G(e.cursor,Za)),t.cursorAccent=H.blend(t.background,G(e.cursorAccent,Qa)),t.selectionBackgroundTransparent=G(e.selectionBackground,$a),t.selectionBackgroundOpaque=H.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=G(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=H.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?G(e.selectionForeground,Ci):void 0,t.selectionForeground===Ci&&(t.selectionForeground=void 0),H.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=H.opacity(t.selectionBackgroundTransparent,.3)),H.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=H.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=G(e.scrollbarSliderBackground,H.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=G(e.scrollbarSliderHoverBackground,H.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=G(e.scrollbarSliderActiveBackground,H.opacity(t.foreground,.5)),t.overviewRulerBorder=G(e.overviewRulerBorder,eo),t.ansi=W.slice(),t.ansi[0]=G(e.black,W[0]),t.ansi[1]=G(e.red,W[1]),t.ansi[2]=G(e.green,W[2]),t.ansi[3]=G(e.yellow,W[3]),t.ansi[4]=G(e.blue,W[4]),t.ansi[5]=G(e.magenta,W[5]),t.ansi[6]=G(e.cyan,W[6]),t.ansi[7]=G(e.white,W[7]),t.ansi[8]=G(e.brightBlack,W[8]),t.ansi[9]=G(e.brightRed,W[9]),t.ansi[10]=G(e.brightGreen,W[10]),t.ansi[11]=G(e.brightYellow,W[11]),t.ansi[12]=G(e.brightBlue,W[12]),t.ansi[13]=G(e.brightMagenta,W[13]),t.ansi[14]=G(e.brightCyan,W[14]),t.ansi[15]=G(e.brightWhite,W[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;re.index-t.index),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},io={trace:0,debug:1,info:2,warn:3,error:4,off:5},ao=`xterm.js: `,oo=class extends F{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),so=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=io[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;tthis._length)for(let t=this._length;t=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;tthis._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-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,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*K+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*K+0]=e|2097152|t[2]<<22):this._data[e*K+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*K+0]>>22}hasWidth(e){return this._data[e*K+0]&12582912}getFg(e){return this._data[e*K+1]}getBg(e){return this._data[e*K+2]}hasContent(e){return this._data[e*K+0]&4194303}getCodePoint(e){let t=this._data[e*K+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*K+0]&2097152}getString(e){let t=this._data[e*K+0];return t&2097152?this._combined[e]:t&2097151?ae(t&2097151):``}isProtected(e){return this._data[e*K+2]&536870912}loadCell(e,t){return lo=e*K,t.content=this._data[lo+0],t.fg=this._data[lo+1],t.bg=this._data[lo+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*K+0]=t.content,this._data[e*K+1]=t.fg,this._data[e*K+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*K+0]=t|n<<22,this._data[e*K+1]=r.fg,this._data[e*K+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*K+0];r&2097152?this._combined[e]+=ae(t):r&2097151?(this._combined[e]=ae(r&2097151)+ae(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*K+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;rthis.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t=e&&delete this._extendedAttrs[n]}}return this.length=e,n*4*uo=0;--e)if(this._data[e*K+0]&4194303)return e+(this._data[e*K+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*K+0]&4194303||this._data[e*K+2]&50331648)return e+(this._data[e*K+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t>22||1}return r&&r.push(t),i}};function po(e,t,n,r,i,a){let o=[];for(let s=0;s=s&&r0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o}function mo(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;o_o(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;sc&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function _o(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var vo=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new L),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ft(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};vo._nextId=1;var yo=vo,bo={},xo=bo.B;bo[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:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},bo.A={"#":`£`},bo.B=void 0,bo[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},bo.C=bo[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},bo.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},bo.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},bo.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},bo.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},bo.E=bo[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},bo.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},bo.H=bo[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},bo[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var So=4294967295,Co=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=q.clone(),this.savedCharset=xo,this.markers=[],this._nullCell=N.fromCharData([0,le,1,0]),this._whitespaceCell=N.fromCharData([0,ue,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Sa,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new co(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new de),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new de),this._whitespaceCell}getBlankLine(e,t){return new fo(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&eSo?So:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=q);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new co(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(q),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new fo(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=po(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(q),n);if(r.length>0){let n=mo(this.lines,r);ho(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(q),i=n;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=_o(c,Math.max(g,0),this._cols))}for(let t=0;t0;)this.ybase===0?this.y0){let e=[],t=[];for(let e=0;e=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+a-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+10;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.linee.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},wo=class extends F{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new L),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 Co(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Co(!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,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},To=2,Eo=1,Do=class extends F{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new L),this.onResize=this._onResize.event,this._onScroll=this._register(new L),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,To),this.rows=Math.max(e.rawOptions.rows||0,Eo),this.buffers=this._register(new wo(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};Do=S([C(0,we)],Do);var Oo={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:pa,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},ko=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],Ao=class extends F{constructor(e){super(),this._onOptionChange=this._register(new L),this.onOptionChange=this._onOptionChange.event;let t={...Oo};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(P(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=e=>{if(!(e in Oo))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in Oo))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=Oo[e],!jo(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=Oo[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=ko.includes(t)?t:Oo[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case`minimumContrastRatio`:t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case`scrollback`:if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={};break}return t}};function jo(e){return e===`block`||e===`underline`||e===`bar`}function Mo(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&Mo(e[r],t-1);return n}var No=Object.freeze({insertMode:!1}),Po=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Fo=class extends F{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new L),this.onData=this._onData.event,this._onUserInput=this._register(new L),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new L),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new L),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Mo(No),this.decPrivateModes=Mo(Po)}reset(){this.modes=Mo(No),this.decPrivateModes=Mo(Po)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.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(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};Fo=S([C(0,ve),C(1,Ce),C(2,we)],Fo);var Io={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function Lo(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var Ro=String.fromCharCode,zo={DEFAULT:e=>{let t=[Lo(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${Ro(t[0])}${Ro(t[1])}${Ro(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${Lo(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${Lo(e,!0)};${e.x};${e.y}${t}`}},Bo=class extends F{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new L),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(Io))this.addProtocol(e,Io[e]);for(let e of Object.keys(zo))this.addEncoding(e,zo[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};Bo=S([C(0,ve),C(1,be),C(2,we)],Bo);var Vo=[[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]],Ho=[[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]],Uo;function Wo(e,t){let n=0,r=t.length-1,i;if(et[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=Ko.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return Ko.createPropertyValue(0,n,r)}},Ko=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new L,this.onChange=this._onChange.event;let e=new Go;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,t,n=!1){return(e&16777215)<<3|(t&3)<<1|(n?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 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(t){let n=0,r=0,i=t.length;for(let a=0;a=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},qo=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,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function Jo(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var Yo=2147483647,Xo=256,Zo=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>Xo)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=Array.isArray(t[0])?1:0;e>8,r=this._subParamsIdx[t]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,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 Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>Yo?Yo:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>Yo?Yo:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t>8,r=this._subParamsIdx[t]&255;r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,Yo):e}},Qo=[],$o=class{constructor(){this._state=0,this._active=Qo,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,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=Qo}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=Qo,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Qo,!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,t,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,oe(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t0&&this._put(e,t,n)}}end(e,t=!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 n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=Qo,this._id=-1,this._state=0}}},es=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=oe(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data=``,this._hitLimit=!1,e));return this._data=``,this._hitLimit=!1,t}},ts=[],ns=class{constructor(){this._handlers=Object.create(null),this._active=ts,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=ts}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,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=ts,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||ts,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,oe(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=ts,this._ident=0}},rs=new Zo;rs.addParam(0);var is=class{constructor(e){this._handler=e,this._data=``,this._params=rs,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():rs,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=oe(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=rs,this._data=``,this._hitLimit=!1,e));return this._params=rs,this._data=``,this._hitLimit=!1,t}},as=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;it),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(os,0,2,0),e.add(os,8,5,8),e.add(os,6,0,6),e.add(os,11,0,11),e.add(os,13,13,13),e}(),cs=class extends F{constructor(e=ss){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 Zo,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(P(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new $o),this._dcsParser=this._register(new ns),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;tr||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,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,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}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,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;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],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let n=a;n>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r=t||(r=e[i])<32||r>126&&r=t||(r=e[i])<32||r>126&&r=t||(r=e[i])<32||r>126&&r=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<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(++n47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<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 i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r=t||(r=e[i])<32||r>127&&r>4:i>>8}return n}}function fs(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function ps(e,t=16){let[n,r,i]=e;return`rgb:${fs(n,t)}/${fs(r,t)}/${fs(i,t)}`}var ms={"(":0,")":1,"*":2,"+":3,"-":1,".":2},hs=131072,gs=10;function _s(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var vs=5e3,ys=0,bs=class extends F{constructor(e,t,n,r,i,a,o,s,c=new cs){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new se,this._utf8Decoder=new ce,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=q.clone(),this._eraseAttrDataInternal=q.clone(),this._onRequestBell=this._register(new L),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new L),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new L),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new L),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new L),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new L),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new L),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new L),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new L),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new L),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new L),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new L),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new L),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 xs(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(z.BEL,()=>this.bell()),this._parser.setExecuteHandler(z.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(z.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(z.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(z.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(z.BS,()=>this.backspace()),this._parser.setExecuteHandler(z.HT,()=>this.tab()),this._parser.setExecuteHandler(z.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(z.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(_i.IND,()=>this.index()),this._parser.setExecuteHandler(_i.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(_i.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new es(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new es(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new es(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new es(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new es(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new es(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new es(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new es(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new es(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new es(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new es(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new es(e=>this.restoreCursorColor(e))),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 e in bo)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new is((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),vs))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${vs} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>hs&&(a=this._parseStack.position+hs)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.lengthhs)for(let t=a;t0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;ps){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,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),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof fo&&d.copyCellsFrom(e,t,0,m,!1);t=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>_s(e.params[0],this._optionsService.rawOptions.windowOptions)?t(e):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new is(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new es(t))}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 e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,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(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.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 c=s;for(let e=1;e0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(z.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(z.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(z.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(z.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(z.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${z.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:c===132?1:0:0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=M.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=q.fg,e.bg=q.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=q.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=q.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=q.fg&16777215,r.bg&=-67108864,r.bg|=q.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${z.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${z.ESC}[${e};${t}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${z.ESC}[?${e};${t}R`);break;case 15:break;case 25:break;case 26:break;case 53:break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=q.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(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){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 e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!_s(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${z.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>gs&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>gs&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){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(e){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(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(Ss(n))if(r===`?`)t.push({type:0,index:n});else{let e=ds(r);e&&t.push({type:1,index:n,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=ds(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e=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 e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,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=q.clone(),this._eraseAttrDataInternal=q.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new N;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t(this._coreService.triggerDataEvent(`${z.ESC}${e}${z.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-(i.cursorBlink?1:0)} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},xs=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){ethis.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(ys=e,e=t,t=ys),ethis.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};xs=S([C(0,ve)],xs);function Ss(e){return 0<=e&&e<256}var Cs=5e7,ws=12,Ts=50,Es=class extends F{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 L),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){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 n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>Cs)throw 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(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>performance.now()-n>=ws?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=ws)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>Ts&&(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()}},Ds=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Ds=S([C(0,ve)],Ds);var Os=!1,ks=class extends F{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new gt),this._onBinary=this._register(new L),this.onBinary=this._onBinary.event,this._onData=this._register(new L),this.onData=this._onData.event,this._onLineFeed=this._register(new L),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new L),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new L),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new L),this._instantiationService=new ro,this.optionsService=this._register(new Ao(e)),this._instantiationService.setService(we,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Do)),this._instantiationService.setService(ve,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(oo)),this._instantiationService.setService(Ce,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Fo)),this._instantiationService.setService(be,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Bo)),this._instantiationService.setService(ye,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Ko)),this._instantiationService.setService(Ee,this.unicodeService),this._charsetService=this._instantiationService.createInstance(qo),this._instantiationService.setService(xe,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Ds),this._instantiationService.setService(Te,this._oscLinkService),this._inputHandler=this._register(new bs(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Tt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Tt.forward(this._bufferService.onResize,this._onResize)),this._register(Tt.forward(this.coreService.onData,this._onData)),this._register(Tt.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 Es((e,t)=>this._inputHandler.parse(e,t))),this._register(Tt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new L),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 t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!Os&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),Os=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,To),t=Math.max(t,Eo),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}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 t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.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(Jo.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(Jo(this._bufferService),!1))),this._windowsWrappingHeuristics.value=P(()=>{for(let t of e)t.dispose()})}}},As={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 js(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?t?i.key=z.ESC+`OA`:i.key=z.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?t?i.key=z.ESC+`OD`:i.key=z.ESC+`[D`:e.key===`UIKeyInputRightArrow`?t?i.key=z.ESC+`OC`:i.key=z.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(t?i.key=z.ESC+`OB`:i.key=z.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:z.DEL,e.altKey&&(i.key=z.ESC+i.key);break;case 9:if(e.shiftKey){i.key=z.ESC+`[Z`;break}i.key=z.HT,i.cancel=!0;break;case 13:i.key=e.altKey?z.ESC+z.CR:z.CR,i.cancel=!0;break;case 27:i.key=z.ESC,e.altKey&&(i.key=z.ESC+z.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;a?i.key=z.ESC+`[1;`+(a+1)+`D`:t?i.key=z.ESC+`OD`:i.key=z.ESC+`[D`;break;case 39:if(e.metaKey)break;a?i.key=z.ESC+`[1;`+(a+1)+`C`:t?i.key=z.ESC+`OC`:i.key=z.ESC+`[C`;break;case 38:if(e.metaKey)break;a?i.key=z.ESC+`[1;`+(a+1)+`A`:t?i.key=z.ESC+`OA`:i.key=z.ESC+`[A`;break;case 40:if(e.metaKey)break;a?i.key=z.ESC+`[1;`+(a+1)+`B`:t?i.key=z.ESC+`OB`:i.key=z.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=z.ESC+`[2~`);break;case 46:a?i.key=z.ESC+`[3;`+(a+1)+`~`:i.key=z.ESC+`[3~`;break;case 36:a?i.key=z.ESC+`[1;`+(a+1)+`H`:t?i.key=z.ESC+`OH`:i.key=z.ESC+`[H`;break;case 35:a?i.key=z.ESC+`[1;`+(a+1)+`F`:t?i.key=z.ESC+`OF`:i.key=z.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=z.ESC+`[5;`+(a+1)+`~`:i.key=z.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=z.ESC+`[6;`+(a+1)+`~`:i.key=z.ESC+`[6~`;break;case 112:a?i.key=z.ESC+`[1;`+(a+1)+`P`:i.key=z.ESC+`OP`;break;case 113:a?i.key=z.ESC+`[1;`+(a+1)+`Q`:i.key=z.ESC+`OQ`;break;case 114:a?i.key=z.ESC+`[1;`+(a+1)+`R`:i.key=z.ESC+`OR`;break;case 115:a?i.key=z.ESC+`[1;`+(a+1)+`S`:i.key=z.ESC+`OS`;break;case 116:a?i.key=z.ESC+`[15;`+(a+1)+`~`:i.key=z.ESC+`[15~`;break;case 117:a?i.key=z.ESC+`[17;`+(a+1)+`~`:i.key=z.ESC+`[17~`;break;case 118:a?i.key=z.ESC+`[18;`+(a+1)+`~`:i.key=z.ESC+`[18~`;break;case 119:a?i.key=z.ESC+`[19;`+(a+1)+`~`:i.key=z.ESC+`[19~`;break;case 120:a?i.key=z.ESC+`[20;`+(a+1)+`~`:i.key=z.ESC+`[20~`;break;case 121:a?i.key=z.ESC+`[21;`+(a+1)+`~`:i.key=z.ESC+`[21~`;break;case 122:a?i.key=z.ESC+`[23;`+(a+1)+`~`:i.key=z.ESC+`[23~`;break;case 123:a?i.key=z.ESC+`[24;`+(a+1)+`~`:i.key=z.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=z.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=z.DEL:e.keyCode===219?i.key=z.ESC:e.keyCode===220?i.key=z.FS:e.keyCode===221&&(i.key=z.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=As[e.keyCode]?.[e.shiftKey?1:0];if(t)i.key=z.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=z.ESC+n}else if(e.keyCode===32)i.key=z.ESC+(e.ctrlKey?z.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=z.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=z.US),e.key===`@`&&(i.key=z.NUL));break}return i}var J=0,Ms=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Sa,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Sa,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((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];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 t=this._getKey(e);if(t===void 0||(J=this._search(t),J===-1)||this._getKey(this._array[J])!==t)return!1;do if(this._array[J]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(J),!0;while(++Je-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(J=this._search(e),!(J<0||J>=this._array.length)&&this._getKey(this._array[J])===e))do yield this._array[J];while(++J=this._array.length)&&this._getKey(this._array[J])===e))do t(this._array[J]);while(++J=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},Ns=0,Ps=0,Fs=class extends F{constructor(){super(),this._decorations=new Ms(e=>e?.marker.line),this._onDecorationRegistered=this._register(new L),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new L),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(P(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new Is(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e{Ns=t.options.x??0,Ps=Ns+(t.options.width??1),e>=Ns&&e=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},zs=20,Bs=!1,Vs=class extends F{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;ethis._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,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=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new Rs(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);Bs?(this._accessibilityContainer.classList.add(`debug`),this._rowContainer.classList.add(`debug`),this._debugRootContainer=i.createElement(`div`),this._debugRootContainer.classList.add(`xterm`),this._debugRootContainer.appendChild(i.createTextNode(`------start a11y------`)),this._debugRootContainer.appendChild(this._accessibilityContainer),this._debugRootContainer.appendChild(i.createTextNode(`------end a11y------`)),this._terminal.element.insertAdjacentElement(`afterend`,this._debugRootContainer)):this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(` +`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(R(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(P(()=>{Bs?this._debugRootContainer.remove():this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===` +`&&(this._liveRegionLineCount++,this._liveRegionLineCount===zs+1&&(this._liveRegion.textContent+=D.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(!(!a||!o)){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;ee;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_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 e=0;e{ft(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(R(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(R(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(R(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(R(this._element,`mouseup`,this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;re?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;tthis._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;ethis._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&Us(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,ft(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};Hs=S([C(1,Me),C(2,Ne),C(3,ve),C(4,Le)],Hs);function Us(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var Ws=class extends ks{constructor(e={}){super(e),this._linkifier=this._register(new gt),this.browser=aa,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new gt),this._onCursorMove=this._register(new L),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new L),this.onKey=this._onKey.event,this._onRender=this._register(new L),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new L),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new L),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new L),this.onBell=this._onBell.event,this._onFocus=this._register(new L),this._onBlur=this._register(new L),this._onA11yCharEmitter=this._register(new L),this._onA11yTabEmitter=this._register(new L),this._onWillOpen=this._register(new L),this._setup(),this._decorationService=this._instantiationService.createInstance(Fs),this._instantiationService.setService(De,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ea),this._instantiationService.setService(Le,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Oe)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(Tt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Tt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Tt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Tt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(P(()=>{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 t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=H.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${z.ESC}]${n};${ps(r)}${vi.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=V.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=V.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.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(Vs,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(z.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(z.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,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(R(this.element,`copy`,e=>{this.hasSelection()&&O(e,this._selectionService)}));let e=e=>k(e,this.textarea,this.coreService,this.optionsService);this._register(R(this.textarea,`paste`,e)),this._register(R(this.element,`paste`,e)),la?this._register(R(this.element,`mousedown`,e=>{e.button===2&&ie(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(R(this.element,`contextmenu`,e=>{ie(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),_a&&this._register(R(this.element,`auxclick`,e=>{e.button===1&&j(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(R(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(R(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(R(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(R(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(R(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(R(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(R(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw 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 t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._register(R(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,T.get()),va||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`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Qi,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(je,this._coreBrowserService),this._register(R(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(R(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Ji,this._document,this._helperContainer),this._instantiationService.setService(Ae,this._charSizeService),this._themeService=this._instantiationService.createInstance(to),this._instantiationService.setService(Ie,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(ki),this._instantiationService.setService(Fe,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(wa,this.rows,this.screenElement)),this._instantiationService.setService(Ne,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(yi,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(ra),this._instantiationService.setService(Me,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Hs,this.screenElement));this.element.appendChild(t);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(ui,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Ka,this.element,this.screenElement,r)),this._instantiationService.setService(Pe,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(Tt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(di,this.screenElement)),this._register(R(this.element,`mousedown`,e=>this._selectionService.handleMouseDown(e))),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(Vs,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(gi,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(gi,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(qi,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=t.buttons&1?0:t.buttons&4?1:t.buttons&2?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),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()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(R(t,`mousedown`,e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)})),this._register(R(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=z.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}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,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),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 t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){A(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 Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw 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,t,n){this._selectionService.setSelection(e,t,n)}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,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key===`Dead`||e.key===`AltGraph`)&&(this._unprocessedDeadKey=!0);let n=js(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.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((n.key===z.ETX||n.key===z.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Gs(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!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 t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){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,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new N)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},Js=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,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(e){let t=this._buffer.lines.get(e);if(t)return new qs(t)}getNullCell(){return new N}},Ys=class extends F{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new L),this.onBufferChange=this._onBufferChange.event,this._normal=new Js(this._core.buffers.normal,`normal`),this._alternate=new Js(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 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)}},Xs=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},Zs=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}},Qs=[`cols`,`rows`],$s=0,ec=class extends F{constructor(e){super(),this._core=this._register(new Ws(e)),this._addonManager=this._register(new Ks),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(Qs.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw 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||=new Xs(this._core),this._parser}get unicode(){return this._checkProposedApi(),new Zs(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._register(new Ys(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`;break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r +`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return T.get()},set promptLabel(e){T.set(e)},get tooMuchOutput(){return D.get()},set tooMuchOutput(e){D.set(e)}}}_verifyIntegers(...e){for($s of e)if($s===1/0||isNaN($s)||$s%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for($s of e)if($s&&($s===1/0||isNaN($s)||$s%1!=0||$s<0))throw Error(`This API only accepts positive integers`)}},tc=2,nc=1,rc=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(tc,Math.floor(u/e.css.cell.width)),rows:Math.max(nc,Math.floor(l/e.css.cell.height))}}},ic=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=oc.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}};function ac(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var oc=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!ac(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),!(!n.isWrapped||o.indexOf(` `)!==-1)););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function cc(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var lc=class{constructor(e=cc,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||sc;this._linkProvider=this._terminal.registerLinkProvider(new ic(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}},uc=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?hc.isErrorNoTelemetry(e)?new hc(e.message+` + +`+e.stack):Error(e.message+` + +`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(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)}};function dc(e){pc(e)||uc.onUnexpectedError(e)}var fc=`Canceled`;function pc(e){return e instanceof mc?!0:e instanceof Error&&e.name===fc&&e.message===fc}var mc=class extends Error{constructor(){super(fc),this.name=this.message}},hc=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}};function gc(e,t,n=0,r=e.length){let i=n,a=r;for(;i{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(vc||={});function yc(e,t){return(n,r)=>t(e(n),e(r))}var bc=(e,t)=>e-t,xc=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>t(n)?e(n):!0))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>e(n)?(t=n,!1):!0),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||vc.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};xc.empty=new xc(e=>{});function Sc(e,t){let n=Object.create(null);for(let r of e){let e=t(r),i=n[e];i||=n[e]=[],i.push(r)}return n}var Cc=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){return this.map.get(e)||new Set}};function wc(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var Tc;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);tt.source!==null&&!this.getRootParent(t,e).isSingleton).flatMap(([e])=>e)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let e=new Map,t=[...this.livingDisposables.values()].filter(t=>t.source!==null&&!this.getRootParent(t,e).isSingleton);if(t.length===0)return;let r=new Set(t.map(e=>e.value));if(n=t.filter(e=>!(e.parent&&r.has(e.parent))),n.length===0)throw Error(`There are cyclic diposable chains!`)}if(!n)return;function r(e){function t(e,t){for(;e.length>0&&t.some(t=>typeof t==`string`?t===e[0]:e[0].match(t));)e.shift()}let n=e.source.split(` +`).map(e=>e.trim().replace(`at `,``)).filter(e=>e!==``);return t(n,[`Error`,/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),n.reverse()}let i=new Cc;for(let e of n){let t=r(e);for(let n=0;n<=t.length;n++)i.add(t.slice(0,n).join(` +`),e)}n.sort(yc(e=>e.idx,bc));let a=``,o=0;for(let t of n.slice(0,e)){o++;let e=r(t),s=[];for(let t=0;tr(e)[t]),e=>e);delete o[e[t]];for(let[e,t]of Object.entries(o))s.unshift(` - stacktraces of ${t.length} other leaks continue with ${e}`);s.unshift(a)}a+=` + + +==================== Leaking disposable ${o}/${n.length}: ${t.value.constructor.name} ==================== +${s.join(` +`)} +============================================================ + +`}return n.length>e&&(a+=` + + +... and ${n.length-e} more leaking disposables + +`),{leaks:n,details:a}}};Oc.idx=0;function kc(e){Dc=e}if(Ec){let e=`__is_disposable_tracked__`;kc(new class{trackDisposable(t){let n=Error(`Potentially leaked disposable`).stack;setTimeout(()=>{t[e]||console.log(n)},3e3)}setParent(t,n){if(t&&t!==zc.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==zc.None)try{t[e]=!0}catch{}}markAsSingleton(e){}})}function Ac(e){return Dc?.trackDisposable(e),e}function jc(e){Dc?.markAsDisposed(e)}function Mc(e,t){Dc?.setParent(e,t)}function Nc(e,t){if(Dc)for(let n of e)Dc.setParent(n,t)}function Pc(e){if(Tc.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function Fc(...e){let t=Ic(()=>Pc(e));return Nc(e,t),t}function Ic(e){let t=Ac({dispose:wc(()=>{jc(t),e()})});return t}var Lc=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,Ac(this)}dispose(){this._isDisposed||(jc(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Pc(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return Mc(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(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(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),Mc(e,null))}};Lc.DISABLE_DISPOSED_WARNING=!1;var Rc=Lc,zc=class{constructor(){this._store=new Rc,Ac(this),Mc(this._store,this)}dispose(){jc(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};zc.None=Object.freeze({dispose(){}});var Bc=class{constructor(){this._isDisposed=!1,Ac(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&Mc(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,jc(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&Mc(e,null),e}},Vc=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};Vc.Undefined=new Vc(void 0);var Hc=globalThis.performance&&typeof globalThis.performance.now==`function`,Uc=class e{static create(t){return new e(t)}constructor(e){this._now=Hc&&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._now()-this._startTime:this._stopTime-this._startTime}},Wc=!1,Gc=!1,Kc=!1,qc;(e=>{e.None=()=>zc.None;function t(e){if(Kc){let{onDidAddListener:t}=e,n=$c.create(),r=0;e.onDidAddListener=()=>{++r===2&&(console.warn(`snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here`),n.print()),t?.()}}}function n(e,t){return f(e,()=>{},0,void 0,!0,void 0,t)}e.defer=n;function r(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=r;function i(e,t,n){return u((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=i;function a(e,t,n){return u((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=a;function o(e,t,n){return u((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=o;function s(e){return e}e.signal=s;function c(...e){return(t,n=null,r)=>d(Fc(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=c;function l(e,t,n,r){let a=n;return i(e,e=>(a=t(a,e),a),r)}e.reduce=l;function u(e,n){let r,i={onWillAddFirstListener(){r=e(a.fire,a)},onDidRemoveLastListener(){r?.dispose()}};n||t(i);let a=new sl(i);return n?.add(a),a.event}function d(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function f(e,n,r=100,i=!1,a=!1,o,s){let c,l,u,d=0,f,p={leakWarningThreshold:o,onWillAddFirstListener(){c=e(e=>{d++,l=n(l,e),i&&!u&&(m.fire(l),l=void 0),f=()=>{let e=l;l=void 0,u=void 0,(!i||d>1)&&m.fire(e),d=0},typeof r==`number`?(clearTimeout(u),u=setTimeout(f,r)):u===void 0&&(u=0,queueMicrotask(f))})},onWillRemoveListener(){a&&d>0&&f?.()},onDidRemoveLastListener(){f=void 0,c.dispose()}};s||t(p);let m=new sl(p);return s?.add(m),m.event}e.debounce=f;function p(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=p;function m(e,t=(e,t)=>e===t,n){let r=!0,i;return o(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=m;function h(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=h;function g(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new sl({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=g;function _(e,t){return(n,r,i)=>{let a=t(new y);return e(function(e){let t=a.evaluate(e);t!==v&&n.call(r,t)},void 0,i)}}e.chain=_;let v=Symbol(`HaltChainable`);class y{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:v),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:v}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===v)break;return e}}function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new sl({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=b;function x(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new sl({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=x;function ee(e){return new Promise(t=>r(e)(t))}e.toPromise=ee;function te(e){let t=new sl;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=te;function S(e,t){return e(e=>t.fire(e))}e.forward=S;function C(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=C;class w{constructor(e,n){this._observable=e,this._counter=0,this._hasChanged=!1;let r={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};n||t(r),this.emitter=new sl(r),n&&n.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function T(e,t){return new w(e,t).emitter.event}e.fromObservable=T;function E(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof Rc?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=E})(qc||={});var Jc=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new Uc,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}}};Jc.all=new Set,Jc._idPool=0;var Yc=Jc,Xc=-1,Zc=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t{if(e instanceof rl)t(e);else for(let n=0;n{e.length!==0&&(console.warn(`[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:`),console.warn(e.join(` +`)),e.length=0)},3e3),ol=new FinalizationRegistry(t=>{typeof t==`string`&&e.push(t)})}var sl=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Xc>0||this._options?.leakWarningThreshold?new Qc(e?.onListenerError??dc,this._options?.leakWarningThreshold??Xc):void 0,this._perfMon=this._options?._profName?new Yc(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(Gc){let e=this._listeners;queueMicrotask(()=>{al(e,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new tl(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||dc)(n),zc.None}if(this._disposed)return zc.None;t&&(e=e.bind(t));let r=new rl(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=$c.create(),i=this._leakageMon.check(r.stack,this._size+1)),Gc&&(r.stack=$c.create()),this._listeners?this._listeners instanceof rl?(this._deliveryQueue??=new cl,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=Ic(()=>{ol?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof Rc?n.add(a):Array.isArray(n)&&n.push(a),ol){let e=Error().stack.split(` +`).slice(2,3).join(` +`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);ol.register(a,t?.[2]??e,a)}return a},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 t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*il<=t.length){let e=0;for(let n=0;n0}},cl=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},ll=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),ul;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof dl?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:qc.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:ll})})(ul||={});var dl=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?ll:(this._emitter||=new sl,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},fl=`en`,pl=!1,ml=!1,hl=fl,gl,_l=globalThis,vl;typeof _l.vscode<`u`&&typeof _l.vscode.process<`u`?vl=_l.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(vl=process);var yl=typeof vl?.versions?.electron==`string`&&vl?.type===`renderer`;if(typeof vl==`object`){vl.platform,vl.platform,pl=vl.platform===`linux`,pl&&vl.env.SNAP&&vl.env.SNAP_REVISION,vl.env.CI||vl.env.BUILD_ARTIFACTSTAGINGDIRECTORY,hl=fl;let e=vl.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,hl=t.resolvedLanguage||fl,t.languagePack?.translationsConfigFile}catch{}}else typeof navigator==`object`&&!yl?(gl=navigator.userAgent,gl.indexOf(`Windows`),gl.indexOf(`Macintosh`),(gl.indexOf(`Macintosh`)>=0||gl.indexOf(`iPad`)>=0||gl.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,pl=gl.indexOf(`Linux`)>=0,gl?.indexOf(`Mobi`),ml=!0,hl=globalThis._VSCODE_NLS_LANGUAGE||fl,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);ml&&typeof _l.importScripts==`function`&&_l.origin;var bl=gl,xl=hl,Sl;(e=>{function t(){return xl}e.value=t;function n(){return xl.length===2?xl===`en`:xl.length>=3?xl[0]===`e`&&xl[1]===`n`&&xl[2]===`-`:!1}e.isDefaultVariant=n;function r(){return xl===`en`}e.isDefault=r})(Sl||={});var Cl=typeof _l.postMessage==`function`&&!_l.importScripts;(()=>{if(Cl){let e=[];_l.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n{let r=++t;e.push({id:r,callback:n}),_l.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var wl=!!(bl&&bl.indexOf(`Chrome`)>=0);bl&&bl.indexOf(`Firefox`),!wl&&bl&&bl.indexOf(`Safari`),bl&&bl.indexOf(`Edg/`),bl&&bl.indexOf(`Android`);function Tl(e,t=0,n){let r=setTimeout(()=>{e(),n&&i.dispose()},t),i=Ic(()=>{clearTimeout(r),n?.deleteAndLeak(i)});return n?.add(i),i}(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var El;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(El||={});var Dl=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new sl,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.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(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.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())}};Dl.EMPTY=Dl.fromArray([]);var Ol=class extends zc{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new Bc),this._linesCacheDisposables=this._register(new Bc),this._register(Ic(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=Fc(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=Tl(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let n=[],r=[0],i=this._terminal.buffer.active.getLine(e);for(;i;){let a=this._terminal.buffer.active.getLine(e+1),o=a?a.isWrapped:!1,s=i.translateToString(!o&&t);if(o&&a){let e=i.getCell(i.length-1);e&&e.getCode()===0&&e.getWidth()===1&&a.getCell(0)?.getWidth()===2&&(s=s.slice(0,-1))}if(n.push(s),o)r.push(r[r.length-1]+s.length);else break;e++,i=a}return[n.join(``),r]}},kl=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,t){return t?.decorations?this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||this.didOptionsChange(t):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},Al=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,n,r){if(!e||e.length===0){this._terminal.clearSelection();return}if(n>this._terminal.cols)throw Error(`Invalid col: ${n} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let i={startRow:t,startCol:n},a=this._findInLine(e,i,r);if(!a)for(let n=t+1;n=0&&(o.startRow=n,s=this._findInLine(e,o,t,!0),!s);n--);}if(!s&&i!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let n=this._terminal.buffer.active.baseY+this._terminal.rows-1;n>=i&&(o.startRow=n,s=this._findInLine(e,o,t,!0),!s);n--);return s}_isWholeWord(e,t,n){return(e===0||` ~!@#$%^&*()+\`-=[]{}|\\;:"',./<>?`.includes(t[e-1]))&&(e+n.length===t.length||` ~!@#$%^&*()+\`-=[]{}|\\;:"',./<>?`.includes(t[e+n.length]))}_findInLine(e,t,n={},r=!1){let i=t.startRow,a=t.startCol;if(this._terminal.buffer.active.getLine(i)?.isWrapped){if(r){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,n)}let o=this._lineCache.getLineFromCache(i);o||(o=this._lineCache.translateBufferLineToStringWithWrap(i,!0),this._lineCache.setLineInCache(i,o));let[s,c]=o,l=this._bufferColsToStringOffset(i,a),u=e,d=s;n.regex||(u=n.caseSensitive?e:e.toLowerCase(),d=n.caseSensitive?s:s.toLowerCase());let f=-1;if(n.regex){let t=RegExp(u,n.caseSensitive?`g`:`gi`),i;if(r)for(;i=t.exec(d.slice(0,l));)f=t.lastIndex-i[0].length,e=i[0],t.lastIndex-=e.length-1;else i=t.exec(d.slice(l)),i&&i[0].length>0&&(f=l+(t.lastIndex-i[0].length),e=i[0])}else r?l-u.length>=0&&(f=d.lastIndexOf(u,l-u.length)):f=d.indexOf(u,l);if(f>=0){if(n.wholeWord&&!this._isWholeWord(f,d,e))return;let t=0;for(;t=c[t+1];)t++;let r=t;for(;r=c[r+1];)r++;let a=f-c[t],o=f+e.length-c[r],s=this._stringLengthToBufferSize(i+t,a),l=this._stringLengthToBufferSize(i+r,o)-s+this._terminal.cols*(r-t);return{term:e,col:s,row:i+t,size:l}}}_stringLengthToBufferSize(e,t){let n=this._terminal.buffer.active.getLine(e);if(!n)return 0;for(let e=0;e1&&(t-=i.length-1);let a=n.getCell(e+1);a&&a.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let n=e,r=0,i=this._terminal.buffer.active.getLine(n);for(;t>0&&i;){for(let e=0;ethis.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let n of e){let e=this._createResultDecorations(n,t,!1);if(e)for(let t of e)this._storeDecoration(t,n)}}createActiveDecoration(e,t){let n=this._createResultDecorations(e,t,!0);if(n)return{decorations:n,match:e,dispose(){Pc(n)}}}clearHighlightDecorations(){Pc(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,n){e.classList.contains(`xterm-find-result-decoration`)||(e.classList.add(`xterm-find-result-decoration`),t&&(e.style.outline=`1px solid ${t}`)),n&&e.classList.add(`xterm-find-active-result-decoration`)}_createResultDecorations(e,t,n){let r=[],i=e.col,a=e.size,o=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;a>0;){let e=Math.min(this._terminal.cols-i,a);r.push([o,i,e]),i=0,a-=e,o++}let s=[];for(let e of r){let r=this._terminal.registerMarker(e[0]),i=this._terminal.registerDecoration({marker:r,x:e[1],width:e[2],backgroundColor:n?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(r.line)?void 0:{color:n?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:`center`}});if(i){let e=[];e.push(r),e.push(i.onRender(e=>this._applyStyles(e,n?t.activeMatchBorder:t.matchBorder,!1))),e.push(i.onDispose(()=>Pc(e))),s.push(i)}}return s.length===0?void 0:s}},Ml=class extends zc{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new sl)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&=(this._selectedDecoration.dispose(),void 0)}findResultIndex(e){for(let t=0;tthis._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Ic(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=Tl(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,n){if(!this._terminal||!this._engine)throw Error(`Cannot use addon until it has been loaded`);this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findNextAndSelect(e,t,n);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw Error(`Cannot use addon until it has been loaded`);if(!this._state.isValidSearchTerm(e)){this.clearDecorations();return}this.clearDecorations(!0);let n=[],r,i=this._engine.find(e,0,0,t);for(;i&&(r?.row!==i.row||r?.col!==i.col)&&!(n.length>=this._highlightLimit);)r=i,n.push(r),i=this._engine.find(e,r.col+r.term.length>=this._terminal.cols?r.row+1:r.row,r.col+r.term.length>=this._terminal.cols?0:r.col+1,t);this._resultTracker.updateResults(n,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(n,t.decorations)}_findNextAndSelect(e,t,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,n?.noScroll)}findPrevious(e,t,n){if(!this._terminal||!this._engine)throw Error(`Cannot use addon until it has been loaded`);this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findPreviousAndSelect(e,t,n);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,n?.noScroll)}_selectResult(e,t,n){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),!1;if(this._terminal.select(e.col,e.row,e.size),t){let n=this._decorationManager.createActiveDecoration(e,t);n&&(this._resultTracker.selectedDecoration=n)}if(!n&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.rowt[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=Lu.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return Lu.createPropertyValue(0,n,r)}},zl=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Wl.isErrorNoTelemetry(e)?new Wl(e.message+` + +`+e.stack):Error(e.message+` + +`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(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)}};function Bl(e){Hl(e)||zl.onUnexpectedError(e)}var Vl=`Canceled`;function Hl(e){return e instanceof Ul?!0:e instanceof Error&&e.name===Vl&&e.message===Vl}var Ul=class extends Error{constructor(){super(Vl),this.name=this.message}},Wl=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}};function Gl(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}function Kl(e,t,n=0,r=e.length){let i=n,a=r;for(;i{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Jl||={});function Yl(e,t){return(n,r)=>t(e(n),e(r))}var Xl=(e,t)=>e-t,Zl=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>t(n)?e(n):!0))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>e(n)?(t=n,!1):!0),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||Jl.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};Zl.empty=new Zl(e=>{});function Ql(e,t){let n=Object.create(null);for(let r of e){let e=t(r),i=n[e];i||=n[e]=[],i.push(r)}return n}var $l=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){return this.map.get(e)||new Set}},eu;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);tt.source!==null&&!this.getRootParent(t,e).isSingleton).flatMap(([e])=>e)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let e=new Map,t=[...this.livingDisposables.values()].filter(t=>t.source!==null&&!this.getRootParent(t,e).isSingleton);if(t.length===0)return;let r=new Set(t.map(e=>e.value));if(n=t.filter(e=>!(e.parent&&r.has(e.parent))),n.length===0)throw Error(`There are cyclic diposable chains!`)}if(!n)return;function r(e){function t(e,t){for(;e.length>0&&t.some(t=>typeof t==`string`?t===e[0]:e[0].match(t));)e.shift()}let n=e.source.split(` +`).map(e=>e.trim().replace(`at `,``)).filter(e=>e!==``);return t(n,[`Error`,/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),n.reverse()}let i=new $l;for(let e of n){let t=r(e);for(let n=0;n<=t.length;n++)i.add(t.slice(0,n).join(` +`),e)}n.sort(Yl(e=>e.idx,Xl));let a=``,o=0;for(let t of n.slice(0,e)){o++;let e=r(t),s=[];for(let t=0;tr(e)[t]),e=>e);delete o[e[t]];for(let[e,t]of Object.entries(o))s.unshift(` - stacktraces of ${t.length} other leaks continue with ${e}`);s.unshift(a)}a+=` + + +==================== Leaking disposable ${o}/${n.length}: ${t.value.constructor.name} ==================== +${s.join(` +`)} +============================================================ + +`}return n.length>e&&(a+=` + + +... and ${n.length-e} more leaking disposables + +`),{leaks:n,details:a}}};ru.idx=0;function iu(e){nu=e}if(tu){let e=`__is_disposable_tracked__`;iu(new class{trackDisposable(t){let n=Error(`Potentially leaked disposable`).stack;setTimeout(()=>{t[e]||console.log(n)},3e3)}setParent(t,n){if(t&&t!==mu.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==mu.None)try{t[e]=!0}catch{}}markAsSingleton(e){}})}function au(e){return nu?.trackDisposable(e),e}function ou(e){nu?.markAsDisposed(e)}function su(e,t){nu?.setParent(e,t)}function cu(e,t){if(nu)for(let n of e)nu.setParent(n,t)}function lu(e){if(eu.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function uu(...e){let t=du(()=>lu(e));return cu(e,t),t}function du(e){let t=au({dispose:Gl(()=>{ou(t),e()})});return t}var fu=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,au(this)}dispose(){this._isDisposed||(ou(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{lu(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return su(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(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(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),su(e,null))}};fu.DISABLE_DISPOSED_WARNING=!1;var pu=fu,mu=class{constructor(){this._store=new pu,au(this),su(this._store,this)}dispose(){ou(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};mu.None=Object.freeze({dispose(){}});var hu=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};hu.Undefined=new hu(void 0);var gu=globalThis.performance&&typeof globalThis.performance.now==`function`,_u=class e{static create(t){return new e(t)}constructor(e){this._now=gu&&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._now()-this._startTime:this._stopTime-this._startTime}},vu=!1,yu=!1,bu=!1,xu;(e=>{e.None=()=>mu.None;function t(e){if(bu){let{onDidAddListener:t}=e,n=Du.create(),r=0;e.onDidAddListener=()=>{++r===2&&(console.warn(`snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here`),n.print()),t?.()}}}function n(e,t){return f(e,()=>{},0,void 0,!0,void 0,t)}e.defer=n;function r(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=r;function i(e,t,n){return u((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=i;function a(e,t,n){return u((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=a;function o(e,t,n){return u((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=o;function s(e){return e}e.signal=s;function c(...e){return(t,n=null,r)=>d(uu(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=c;function l(e,t,n,r){let a=n;return i(e,e=>(a=t(a,e),a),r)}e.reduce=l;function u(e,n){let r,i={onWillAddFirstListener(){r=e(a.fire,a)},onDidRemoveLastListener(){r?.dispose()}};n||t(i);let a=new Fu(i);return n?.add(a),a.event}function d(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function f(e,n,r=100,i=!1,a=!1,o,s){let c,l,u,d=0,f,p={leakWarningThreshold:o,onWillAddFirstListener(){c=e(e=>{d++,l=n(l,e),i&&!u&&(m.fire(l),l=void 0),f=()=>{let e=l;l=void 0,u=void 0,(!i||d>1)&&m.fire(e),d=0},typeof r==`number`?(clearTimeout(u),u=setTimeout(f,r)):u===void 0&&(u=0,queueMicrotask(f))})},onWillRemoveListener(){a&&d>0&&f?.()},onDidRemoveLastListener(){f=void 0,c.dispose()}};s||t(p);let m=new Fu(p);return s?.add(m),m.event}e.debounce=f;function p(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=p;function m(e,t=(e,t)=>e===t,n){let r=!0,i;return o(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=m;function h(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=h;function g(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new Fu({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=g;function _(e,t){return(n,r,i)=>{let a=t(new y);return e(function(e){let t=a.evaluate(e);t!==v&&n.call(r,t)},void 0,i)}}e.chain=_;let v=Symbol(`HaltChainable`);class y{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:v),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:v}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===v)break;return e}}function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Fu({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=b;function x(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Fu({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=x;function ee(e){return new Promise(t=>r(e)(t))}e.toPromise=ee;function te(e){let t=new Fu;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=te;function S(e,t){return e(e=>t.fire(e))}e.forward=S;function C(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=C;class w{constructor(e,n){this._observable=e,this._counter=0,this._hasChanged=!1;let r={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};n||t(r),this.emitter=new Fu(r),n&&n.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function T(e,t){return new w(e,t).emitter.event}e.fromObservable=T;function E(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof pu?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=E})(xu||={});var Su=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new _u,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}}};Su.all=new Set,Su._idPool=0;var Cu=Su,wu=-1,Tu=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t{if(e instanceof ju)t(e);else for(let n=0;n{e.length!==0&&(console.warn(`[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:`),console.warn(e.join(` +`)),e.length=0)},3e3),Pu=new FinalizationRegistry(t=>{typeof t==`string`&&e.push(t)})}var Fu=class{constructor(e){this._size=0,this._options=e,this._leakageMon=wu>0||this._options?.leakWarningThreshold?new Eu(e?.onListenerError??Bl,this._options?.leakWarningThreshold??wu):void 0,this._perfMon=this._options?._profName?new Cu(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(yu){let e=this._listeners;queueMicrotask(()=>{Nu(e,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new ku(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||Bl)(n),mu.None}if(this._disposed)return mu.None;t&&(e=e.bind(t));let r=new ju(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Du.create(),i=this._leakageMon.check(r.stack,this._size+1)),yu&&(r.stack=Du.create()),this._listeners?this._listeners instanceof ju?(this._deliveryQueue??=new Iu,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=du(()=>{Pu?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof pu?n.add(a):Array.isArray(n)&&n.push(a),Pu){let e=Error().stack.split(` +`).slice(2,3).join(` +`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);Pu.register(a,t?.[2]??e,a)}return a},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 t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Mu<=t.length){let e=0;for(let n=0;n0}},Iu=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Lu=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new Fu,this.onChange=this._onChange.event;let e=new Rl;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,t,n=!1){return(e&16777215)<<3|(t&3)<<1|(n?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 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(t){let n=0,r=0,i=t.length;for(let a=0;a=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},Ru=[[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]],zu=[[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]],Bu=[[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]],Vu=[[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]],Hu;function Uu(e,t){let n=0,r=t.length-1,i;if(et[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(en&&(n=e)}return Lu.createPropertyValue(0,n,r)}},Gu=class{activate(e){e.unicode.register(new Wu)}dispose(){}},Ku=Object.defineProperty,qu=Object.getOwnPropertyDescriptor,Ju=(e,t,n,r)=>{for(var i=r>1?void 0:r?qu(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Ku(t,n,i),i},Yu=(e,t)=>(n,r)=>t(n,r,e),Xu=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?td.isErrorNoTelemetry(e)?new td(e.message+` + +`+e.stack):Error(e.message+` + +`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(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)}};function Zu(e){$u(e)||Xu.onUnexpectedError(e)}var Qu=`Canceled`;function $u(e){return e instanceof ed?!0:e instanceof Error&&e.name===Qu&&e.message===Qu}var ed=class extends Error{constructor(){super(Qu),this.name=this.message}},td=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}};function nd(e,t,n=0,r=e.length){let i=n,a=r;for(;i{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(id||={});function ad(e,t){return(n,r)=>t(e(n),e(r))}var od=(e,t)=>e-t,sd=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>t(n)?e(n):!0))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>e(n)?(t=n,!1):!0),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||id.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};sd.empty=new sd(e=>{});function cd(e,t){let n=Object.create(null);for(let r of e){let e=t(r),i=n[e];i||=n[e]=[],i.push(r)}return n}var ld=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){return this.map.get(e)||new Set}};function ud(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var dd;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);tt.source!==null&&!this.getRootParent(t,e).isSingleton).flatMap(([e])=>e)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let e=new Map,t=[...this.livingDisposables.values()].filter(t=>t.source!==null&&!this.getRootParent(t,e).isSingleton);if(t.length===0)return;let r=new Set(t.map(e=>e.value));if(n=t.filter(e=>!(e.parent&&r.has(e.parent))),n.length===0)throw Error(`There are cyclic diposable chains!`)}if(!n)return;function r(e){function t(e,t){for(;e.length>0&&t.some(t=>typeof t==`string`?t===e[0]:e[0].match(t));)e.shift()}let n=e.source.split(` +`).map(e=>e.trim().replace(`at `,``)).filter(e=>e!==``);return t(n,[`Error`,/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),n.reverse()}let i=new ld;for(let e of n){let t=r(e);for(let n=0;n<=t.length;n++)i.add(t.slice(0,n).join(` +`),e)}n.sort(ad(e=>e.idx,od));let a=``,o=0;for(let t of n.slice(0,e)){o++;let e=r(t),s=[];for(let t=0;tr(e)[t]),e=>e);delete o[e[t]];for(let[e,t]of Object.entries(o))s.unshift(` - stacktraces of ${t.length} other leaks continue with ${e}`);s.unshift(a)}a+=` + + +==================== Leaking disposable ${o}/${n.length}: ${t.value.constructor.name} ==================== +${s.join(` +`)} +============================================================ + +`}return n.length>e&&(a+=` + + +... and ${n.length-e} more leaking disposables + +`),{leaks:n,details:a}}};md.idx=0;function hd(e){pd=e}if(fd){let e=`__is_disposable_tracked__`;hd(new class{trackDisposable(t){let n=Error(`Potentially leaked disposable`).stack;setTimeout(()=>{t[e]||console.log(n)},3e3)}setParent(t,n){if(t&&t!==Td.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==Td.None)try{t[e]=!0}catch{}}markAsSingleton(e){}})}function gd(e){return pd?.trackDisposable(e),e}function _d(e){pd?.markAsDisposed(e)}function vd(e,t){pd?.setParent(e,t)}function yd(e,t){if(pd)for(let n of e)pd.setParent(n,t)}function bd(e){if(dd.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function xd(...e){let t=Sd(()=>bd(e));return yd(e,t),t}function Sd(e){let t=gd({dispose:ud(()=>{_d(t),e()})});return t}var Cd=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,gd(this)}dispose(){this._isDisposed||(_d(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{bd(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return vd(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(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(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),vd(e,null))}};Cd.DISABLE_DISPOSED_WARNING=!1;var wd=Cd,Td=class{constructor(){this._store=new wd,gd(this),vd(this._store,this)}dispose(){_d(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};Td.None=Object.freeze({dispose(){}});var Ed=class{constructor(){this._isDisposed=!1,gd(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&vd(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,_d(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&vd(e,null),e}},Dd=typeof process<`u`&&`title`in process,Od=Dd?`node`:navigator.userAgent,kd=Dd?`node`:navigator.platform,Ad=Od.includes(`Firefox`),jd=Od.includes(`Edge`),Md=/^((?!chrome|android).)*safari/i.test(Od);function Nd(){if(!Md)return 0;let e=Od.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(kd),[`Windows`,`Win16`,`Win32`,`WinCE`].includes(kd),kd.indexOf(`Linux`),/\bCrOS\b/.test(Od);var Pd=``,Fd=0,Id=0,Ld=0,Y=0,Rd={css:`#00000000`,rgba:0},zd;(e=>{function t(e,t,n,r){return r===void 0?`#${Wd(e)}${Wd(t)}${Wd(n)}`:`#${Wd(e)}${Wd(t)}${Wd(n)}${Wd(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(zd||={});var Bd;(e=>{function t(e,t){if(Y=(t.rgba&255)/255,Y===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return Fd=a+Math.round((n-a)*Y),Id=o+Math.round((r-o)*Y),Ld=s+Math.round((i-s)*Y),{css:zd.toCss(Fd,Id,Ld),rgba:zd.toRgba(Fd,Id,Ld)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=Ud.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return zd.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[Fd,Id,Ld]=Ud.toChannels(t),{css:zd.toCss(Fd,Id,Ld),rgba:t}}e.opaque=i;function a(e,t){return Y=Math.round(t*255),[Fd,Id,Ld]=Ud.toChannels(e.rgba),{css:zd.toCss(Fd,Id,Ld,Y),rgba:zd.toRgba(Fd,Id,Ld,Y)}}e.opacity=a;function o(e,t){return Y=e.rgba&255,a(e,Y*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(Bd||={});var Vd;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return Fd=parseInt(e.slice(1,2).repeat(2),16),Id=parseInt(e.slice(2,3).repeat(2),16),Ld=parseInt(e.slice(3,4).repeat(2),16),zd.toColor(Fd,Id,Ld);case 5:return Fd=parseInt(e.slice(1,2).repeat(2),16),Id=parseInt(e.slice(2,3).repeat(2),16),Ld=parseInt(e.slice(3,4).repeat(2),16),Y=parseInt(e.slice(4,5).repeat(2),16),zd.toColor(Fd,Id,Ld,Y);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return Fd=parseInt(r[1]),Id=parseInt(r[2]),Ld=parseInt(r[3]),Y=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),zd.toColor(Fd,Id,Ld,Y);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[Fd,Id,Ld,Y]=t.getImageData(0,0,1,1).data,Y!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:zd.toRgba(Fd,Id,Ld,Y),css:e}}e.toColor=r})(Vd||={});var Hd;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(Hd||={});var Ud;(e=>{function t(e,t){if(Y=(t&255)/255,Y===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return Fd=a+Math.round((n-a)*Y),Id=o+Math.round((r-o)*Y),Ld=s+Math.round((i-s)*Y),zd.toRgba(Fd,Id,Ld)}e.blend=t;function n(e,t,n){let a=Hd.relativeLuminance(e>>8),o=Hd.relativeLuminance(t>>8);if(Gd(a,o)>8));if(sGd(a,Hd.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=Gd(a,Hd.relativeLuminance(s>>8));if(cGd(a,Hd.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=Gd(Hd.relativeLuminance2(o,s,c),Hd.relativeLuminance2(r,i,a));for(;l0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=Gd(Hd.relativeLuminance2(o,s,c),Hd.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=Gd(Hd.relativeLuminance2(o,s,c),Hd.relativeLuminance2(r,i,a));for(;l>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(Ud||={});function Wd(e){let t=e.toString(16);return t.length<2?`0`+t:t}function Gd(e,t){return e=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}function Zd(e,t,n,r){return t===1&&n>Math.ceil(r*1.5)&&e!==void 0&&e>255&&!Xd(e)&&!Kd(e)&&!Jd(e)}function Qd(e){return Kd(e)||Yd(e)}function $d(){return{css:{canvas:ef(),cell:ef()},device:{canvas:ef(),cell:ef(),char:{width:0,height:0,left:0,top:0}}}}function ef(){return{width:0,height:0}}function tf(e,t,n=0){return(e-(Math.round(t)*2-n))%(Math.round(t)*2)}var nf=0,rf=0,af=!1,of=!1,sf=!1,cf,lf=0,uf=class{constructor(e,t,n,r,i,a){this._terminal=e,this._optionService=t,this._selectionRenderModel=n,this._decorationService=r,this._coreBrowserService=i,this._themeService=a,this.result={fg:0,bg:0,ext:0}}resolve(e,t,n,r){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,rf=0,nf=0,of=!1,af=!1,sf=!1,cf=this._themeService.colors,lf=0,e.getCode()!==0&&e.extended.underlineStyle===4){let e=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));lf=t*r%(Math.round(e)*2)}if(this._decorationService.forEachDecorationAtCell(t,n,`bottom`,e=>{e.backgroundColorRGB&&(rf=e.backgroundColorRGB.rgba>>8&16777215,of=!0),e.foregroundColorRGB&&(nf=e.foregroundColorRGB.rgba>>8&16777215,af=!0)}),sf=this._selectionRenderModel.isCellSelected(this._terminal,t,n),sf){if(this.result.fg&67108864||this.result.bg&50331648){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:rf=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:rf=(this.result.fg&16777215)<<8|255;break;case 0:default:rf=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:rf=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:rf=(this.result.bg&16777215)<<8|255;break}rf=Ud.blend(rf,(this._coreBrowserService.isFocused?cf.selectionBackgroundOpaque:cf.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else rf=(this._coreBrowserService.isFocused?cf.selectionBackgroundOpaque:cf.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(of=!0,cf.selectionForeground&&(nf=cf.selectionForeground.rgba>>8&16777215,af=!0),Qd(e.getCode())){if(this.result.fg&67108864&&!(this.result.bg&50331648))nf=(this._coreBrowserService.isFocused?cf.selectionBackgroundOpaque:cf.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:nf=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:nf=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:nf=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:nf=(this.result.fg&16777215)<<8|255;break;case 0:default:nf=this._themeService.colors.foreground.rgba}nf=Ud.blend(nf,(this._coreBrowserService.isFocused?cf.selectionBackgroundOpaque:cf.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}af=!0}}this._decorationService.forEachDecorationAtCell(t,n,`top`,e=>{e.backgroundColorRGB&&(rf=e.backgroundColorRGB.rgba>>8&16777215,of=!0),e.foregroundColorRGB&&(nf=e.foregroundColorRGB.rgba>>8&16777215,af=!0)}),of&&(rf=sf?e.bg&-150994944|rf|50331648:e.bg&-16777216|rf|50331648),af&&(nf=e.fg&-83886080|nf|50331648),this.result.fg&67108864&&(of&&!af&&(nf=this.result.bg&50331648?this.result.fg&-134217728|this.result.bg&67108863:this.result.fg&-134217728|cf.background.rgba>>8&16777215|50331648,af=!0),!of&&af&&(rf=this.result.fg&50331648?this.result.bg&-67108864|this.result.fg&67108863:this.result.bg&-67108864|cf.foreground.rgba>>8&16777215|50331648,of=!0)),cf=void 0,this.result.bg=of?rf:this.result.bg,this.result.fg=af?nf:this.result.fg,this.result.ext&=536870911,this.result.ext|=lf<<29&3758096384}},df=.5,ff=Ad||jd?`bottom`:`ideographic`,pf={"▀":[{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}]},mf={"░":[[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]]},hf={"─":{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:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},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:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},gf={"":{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}};gf[``]=gf[``],gf[``]=gf[``];function _f(e,t,n,r,i,a,o,s){let c=pf[t];if(c)return vf(e,c,n,r,i,a),!0;let l=mf[t];if(l)return bf(e,l,n,r,i,a),!0;let u=hf[t];if(u)return xf(e,u,n,r,i,a,s),!0;let d=gf[t];return d?(Sf(e,d,n,r,i,a,o,s),!0):!1}function vf(e,t,n,r,i,a){for(let o=0;o7&&parseInt(s.slice(7,9),16)||1;else if(s.startsWith(`rgba`))[u,d,f,p]=s.substring(5,s.length-1).split(`,`).map(e=>parseFloat(e));else throw Error(`Unexpected fillStyle color format "${s}" when drawing pattern glyph`);for(let e=0;ee.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function Tf(e,t,n,r,i,a,o,s=0,c=0){let l=e.map(e=>parseFloat(e)||parseInt(e));if(l.length<2)throw Error(`Too few arguments for instruction`);for(let e=0;ei){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},kf=class extends Of{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},Af=class extends Of{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},jf=!Dd&&`requestIdleCallback`in window?Af:kf,Mf=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Nf}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 t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}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}},Nf=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}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 e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Pf=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};Pf.Undefined=new Pf(void 0);var Ff=globalThis.performance&&typeof globalThis.performance.now==`function`,If=class e{static create(t){return new e(t)}constructor(e){this._now=Ff&&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._now()-this._startTime:this._stopTime-this._startTime}},Lf=!1,Rf=!1,zf=!1,Bf;(e=>{e.None=()=>Td.None;function t(e){if(zf){let{onDidAddListener:t}=e,n=Kf.create(),r=0;e.onDidAddListener=()=>{++r===2&&(console.warn(`snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here`),n.print()),t?.()}}}function n(e,t){return f(e,()=>{},0,void 0,!0,void 0,t)}e.defer=n;function r(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=r;function i(e,t,n){return u((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=i;function a(e,t,n){return u((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=a;function o(e,t,n){return u((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=o;function s(e){return e}e.signal=s;function c(...e){return(t,n=null,r)=>d(xd(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=c;function l(e,t,n,r){let a=n;return i(e,e=>(a=t(a,e),a),r)}e.reduce=l;function u(e,n){let r,i={onWillAddFirstListener(){r=e(a.fire,a)},onDidRemoveLastListener(){r?.dispose()}};n||t(i);let a=new Z(i);return n?.add(a),a.event}function d(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function f(e,n,r=100,i=!1,a=!1,o,s){let c,l,u,d=0,f,p={leakWarningThreshold:o,onWillAddFirstListener(){c=e(e=>{d++,l=n(l,e),i&&!u&&(m.fire(l),l=void 0),f=()=>{let e=l;l=void 0,u=void 0,(!i||d>1)&&m.fire(e),d=0},typeof r==`number`?(clearTimeout(u),u=setTimeout(f,r)):u===void 0&&(u=0,queueMicrotask(f))})},onWillRemoveListener(){a&&d>0&&f?.()},onDidRemoveLastListener(){f=void 0,c.dispose()}};s||t(p);let m=new Z(p);return s?.add(m),m.event}e.debounce=f;function p(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=p;function m(e,t=(e,t)=>e===t,n){let r=!0,i;return o(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=m;function h(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=h;function g(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new Z({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=g;function _(e,t){return(n,r,i)=>{let a=t(new y);return e(function(e){let t=a.evaluate(e);t!==v&&n.call(r,t)},void 0,i)}}e.chain=_;let v=Symbol(`HaltChainable`);class y{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:v),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:v}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===v)break;return e}}function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Z({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=b;function x(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Z({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=x;function ee(e){return new Promise(t=>r(e)(t))}e.toPromise=ee;function te(e){let t=new Z;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=te;function S(e,t){return e(e=>t.fire(e))}e.forward=S;function C(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=C;class w{constructor(e,n){this._observable=e,this._counter=0,this._hasChanged=!1;let r={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};n||t(r),this.emitter=new Z(r),n&&n.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function T(e,t){return new w(e,t).emitter.event}e.fromObservable=T;function E(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof wd?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=E})(Bf||={});var Vf=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new If,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}}};Vf.all=new Set,Vf._idPool=0;var Hf=Vf,Uf=-1,Wf=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t{if(e instanceof Xf)t(e);else for(let n=0;n{e.length!==0&&(console.warn(`[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:`),console.warn(e.join(` +`)),e.length=0)},3e3),$f=new FinalizationRegistry(t=>{typeof t==`string`&&e.push(t)})}var Z=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Uf>0||this._options?.leakWarningThreshold?new Gf(e?.onListenerError??Zu,this._options?.leakWarningThreshold??Uf):void 0,this._perfMon=this._options?._profName?new Hf(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(Rf){let e=this._listeners;queueMicrotask(()=>{Qf(e,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new Jf(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||Zu)(n),Td.None}if(this._disposed)return Td.None;t&&(e=e.bind(t));let r=new Xf(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Kf.create(),i=this._leakageMon.check(r.stack,this._size+1)),Rf&&(r.stack=Kf.create()),this._listeners?this._listeners instanceof Xf?(this._deliveryQueue??=new ep,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=Sd(()=>{$f?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof wd?n.add(a):Array.isArray(n)&&n.push(a),$f){let e=Error().stack.split(` +`).slice(2,3).join(` +`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);$f.register(a,t?.[2]??e,a)}return a},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 t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Zf<=t.length){let e=0;for(let n=0;n0}},ep=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},tp={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}},np=2,rp,ip=class e{constructor(e,t,n){this._document=e,this._config=t,this._unicodeService=n,this._didWarmUp=!1,this._cacheMap=new Df,this._cacheMapCombined=new Df,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Mf,this._textureSize=512,this._onAddTextureAtlasCanvas=new Z,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Z,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=cp(e,this._config.deviceCellWidth*4+np*2,this._config.deviceCellHeight+np*2),this._tmpCtx=X(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(),!0)}_doWarmUp(){let e=new jf;for(let t=33;t<126;t++)e.enqueue(()=>{if(!this._cacheMap.get(t,0,0,0)){let e=this._drawToCache(t,0,0,0,!1,void 0);this._cacheMap.set(t,0,0,0,e)}})}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(e.maxAtlasPages&&this._pages.length>=Math.max(4,e.maxAtlasPages)){let t=this._pages.filter(t=>t.canvas.width*2<=(e.maxTextureSize||4096)).sort((e,t)=>t.canvas.width===e.canvas.width?t.percentageUsed-e.percentageUsed:t.canvas.width-e.canvas.width),n=-1,r=0;for(let e=0;ee.glyphs[0].texturePage).sort((e,t)=>e>t?1:-1),o=this.pages.length-i.length,s=this._mergePages(i,o);s.version++;for(let e=a.length-1;e>=0;e--)this._deletePage(a[e]);this.pages.push(s),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(s.canvas)}let t=new ap(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(e,t){let n=e[0].canvas.width*2,r=new ap(this._document,n,e);for(let[i,a]of e.entries()){let e=i*a.canvas.width%n,o=Math.floor(i/2)*a.canvas.height;r.ctx.drawImage(a.canvas,e,o);for(let r of a.glyphs)r.texturePage=t,r.sizeClipSpace.x=r.size.x/n,r.sizeClipSpace.y=r.size.y/n,r.texturePosition.x+=e,r.texturePosition.y+=o,r.texturePositionClipSpace.x=r.texturePosition.x/n,r.texturePositionClipSpace.y=r.texturePosition.y/n;this._onRemoveTextureAtlasCanvas.fire(a.canvas);let s=this._activePages.indexOf(a);s!==-1&&this._activePages.splice(s,1)}return r}_deletePage(e){this._pages.splice(e,1);for(let t=e;t=this._config.colors.ansi.length)throw Error(`No color found for idx `+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,n,r){if(this._config.allowTransparency)return Rd;let i;switch(e){case 16777216:case 33554432:i=this._getColorFromAnsiIndex(t);break;case 50331648:let e=Mf.toColorRGB(t);i=zd.toColor(e[0],e[1],e[2]);break;default:i=n?Bd.opaque(this._config.colors.foreground):this._config.colors.background;break}return this._config.allowTransparency||(i=Bd.opaque(i)),i}_getForegroundColor(e,t,n,r,i,a,o,s,c,l){let u=this._getMinimumContrastColor(e,t,n,r,i,a,o,c,s,l);if(u)return u;let d;switch(i){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&c&&a<8&&(a+=8),d=this._getColorFromAnsiIndex(a);break;case 50331648:let e=Mf.toColorRGB(a);d=zd.toColor(e[0],e[1],e[2]);break;default:d=o?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(d=Bd.opaque(d)),s&&(d=Bd.multiplyOpacity(d,df)),d}_resolveBackgroundRgba(e,t,n){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,n,r){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,n,r,i,a,o,s,c,l){if(this._config.minimumContrastRatio===1||l)return;let u=this._getContrastCache(c),d=u.getColor(e,r);if(d!==void 0)return d||void 0;let f=this._resolveBackgroundRgba(t,n,o),p=this._resolveForegroundRgba(i,a,o,s),m=Ud.ensureContrastRatio(f,p,this._config.minimumContrastRatio/(c?2:1));if(!m){u.setColor(e,r,null);return}let h=zd.toColor(m>>24&255,m>>16&255,m>>8&255);return u.setColor(e,r,h),h}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,n,r,i,a,o){let s=typeof t==`number`?String.fromCharCode(t):t;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display=`none`,o.append(this._tmpCanvas));let c=Math.min(this._config.deviceCellWidth*Math.max(s.length,2)+np*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width=e?e*2-c:e-c;c>=e||f===0?(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(s+f,r),this._tmpCtx.lineTo(l,r)):(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(s+f,r),this._tmpCtx.moveTo(s+f+e,r),this._tmpCtx.lineTo(l,r)),c=tf(l-s,e,c);break;case 5:let p=l-s,m=Math.floor(.6*p),h=Math.floor(.3*p),g=p-m-h;this._tmpCtx.setLineDash([m,h,g]),this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(l,r);break;default:this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(l,r);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!E&&this._config.fontSize>=12&&!this._config.allowTransparency&&s!==` `){this._tmpCtx.save(),this._tmpCtx.textBaseline=`alphabetic`;let t=this._tmpCtx.measureText(s);if(this._tmpCtx.restore(),`actualBoundingBoxDescent`in t&&t.actualBoundingBoxDescent>0){this._tmpCtx.save();let t=new Path2D;t.rect(n,r-Math.ceil(e/2),this._config.deviceCellWidth*ne,o-r+Math.ceil(e/2)),this._tmpCtx.clip(t),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=x.css,this._tmpCtx.strokeText(s,T,T+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(g){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(T,T+t),this._tmpCtx.lineTo(T+this._config.deviceCharWidth*ne,T+t),this._tmpCtx.stroke()}if(E||this._tmpCtx.fillText(s,T,T+this._config.deviceCharHeight),s===`_`&&!this._config.allowTransparency){let e=op(this._tmpCtx.getImageData(T,T,this._config.deviceCellWidth,this._config.deviceCellHeight),x,w,D);if(e)for(let t=1;t<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(s,T,T+this._config.deviceCharHeight-t),e=op(this._tmpCtx.getImageData(T,T,this._config.deviceCellWidth,this._config.deviceCellHeight),x,w,D),e);t++);}if(h){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),t=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(T,T+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.lineTo(T+this._config.deviceCharWidth*ne,T+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.stroke()}this._tmpCtx.restore();let re=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),O;if(O=this._config.allowTransparency?sp(re):op(re,x,w,D),O)return tp;let k=this._findGlyphBoundingBox(re,this._workBoundingBox,c,C,E,T),A,j;for(;;){if(this._activePages.length===0){let e=this._createNewPage();A=e,j=e.currentRow,j.height=k.size.y;break}A=this._activePages[this._activePages.length-1],j=A.currentRow;for(let e of this._activePages)k.size.y<=e.currentRow.height&&(A=e,j=e.currentRow);for(let e=this._activePages.length-1;e>=0;e--)for(let t of this._activePages[e].fixedRows)t.height<=j.height&&k.size.y<=t.height&&(A=this._activePages[e],j=t);if(k.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new ap(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),A=this._overflowSizePage,j=this._overflowSizePage.currentRow,j.x+k.size.x>=A.canvas.width&&(j.x=0,j.y+=j.height,j.height=0);break}if(j.y+k.size.y>=A.canvas.height||j.height>k.size.y+2){let t=!1;if(A.currentRow.y+A.currentRow.height+k.size.y>=A.canvas.height){let n;for(let e of this._activePages)if(e.currentRow.y+e.currentRow.height+k.size.y=e.maxAtlasPages&&j.y+k.size.y<=A.canvas.height&&j.height>=k.size.y&&j.x+k.size.x<=A.canvas.width)t=!0;else{let e=this._createNewPage();A=e,j=e.currentRow,j.height=k.size.y,t=!0}}t||(A.currentRow.height>0&&A.fixedRows.push(A.currentRow),j={x:0,y:A.currentRow.y+A.currentRow.height,height:k.size.y},A.fixedRows.push(j),A.currentRow={x:0,y:j.y+j.height,height:0})}if(j.x+k.size.x<=A.canvas.width)break;j===A.currentRow?(j.x=0,j.y+=j.height,j.height=0):A.fixedRows.splice(A.fixedRows.indexOf(j),1)}return k.texturePage=this._pages.indexOf(A),k.texturePosition.x=j.x,k.texturePosition.y=j.y,k.texturePositionClipSpace.x=j.x/A.canvas.width,k.texturePositionClipSpace.y=j.y/A.canvas.height,k.sizeClipSpace.x/=A.canvas.width,k.sizeClipSpace.y/=A.canvas.height,j.height=Math.max(j.height,k.size.y),j.x+=k.size.x,A.ctx.putImageData(re,k.texturePosition.x-this._workBoundingBox.left,k.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,k.size.x,k.size.y),A.addGlyph(k),A.version++,k}_findGlyphBoundingBox(e,t,n,r,i,a){t.top=0;let o=r?this._config.deviceCellHeight:this._tmpCanvas.height,s=r?this._config.deviceCellWidth:n,c=!1;for(let n=0;n=a;n--){for(let r=0;r=0;n--){for(let r=0;r>>24,a=t.rgba>>>16&255,o=t.rgba>>>8&255,s=n.rgba>>>24,c=n.rgba>>>16&255,l=n.rgba>>>8&255,u=Math.floor((Math.abs(i-s)+Math.abs(a-c)+Math.abs(o-l))/12),d=!0;for(let t=0;t0)return!1;return!0}function cp(e,t,n){let r=e.createElement(`canvas`);return r.width=t,r.height=n,r}function lp(e,t,n,r,i,a,o,s){let c={foreground:a.foreground,background:a.background,cursor:Rd,cursorAccent:Rd,selectionForeground:Rd,selectionBackgroundTransparent:Rd,selectionBackgroundOpaque:Rd,selectionInactiveBackgroundTransparent:Rd,selectionInactiveBackgroundOpaque:Rd,overviewRulerBorder:Rd,scrollbarSliderBackground:Rd,scrollbarSliderHoverBackground:Rd,scrollbarSliderActiveBackground:Rd,ansi:a.ansi.slice(),contrastCache:a.contrastCache,halfContrastCache:a.halfContrastCache};return{customGlyphs:i.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:s,letterSpacing:i.letterSpacing,lineHeight:i.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:n,deviceCharHeight:r,fontFamily:i.fontFamily,fontSize:i.fontSize,fontWeight:i.fontWeight,fontWeightBold:i.fontWeightBold,allowTransparency:i.allowTransparency,drawBoldTextInBrightColors:i.drawBoldTextInBrightColors,minimumContrastRatio:i.minimumContrastRatio,colors:c}}function up(e,t){for(let n=0;n=0){if(up(n.config,l))return n.atlas;n.ownedBy.length===1?(n.atlas.dispose(),fp.splice(t,1)):n.ownedBy.splice(r,1);break}}for(let t=0;t{this._renderCallback(),this._animationFrame=void 0}))}_restartInterval(e=hp){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let e=hp-(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=hp-(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})},hp)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function _p(e,t,n){let r=new t.ResizeObserver(t=>{let i=t.find(t=>t.target===e);if(!i)return;if(!(`devicePixelContentBoxSize`in i)){r?.disconnect(),r=void 0;return}let a=i.devicePixelContentBoxSize[0].inlineSize,o=i.devicePixelContentBoxSize[0].blockSize;a>0&&o>0&&n(a,o)});try{r.observe(e,{box:[`device-pixel-content-box`]})}catch{r.disconnect(),r=void 0}return Sd(()=>r?.disconnect())}function vp(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var yp=class e extends Mf{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Nf,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?vp(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 t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},bp=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function xp(e,t,n){let r=X(e.createProgram());if(e.attachShader(r,X(Sp(e,e.VERTEX_SHADER,t))),e.attachShader(r,X(Sp(e,e.FRAGMENT_SHADER,n))),e.linkProgram(r),e.getProgramParameter(r,e.LINK_STATUS))return r;console.error(e.getProgramInfoLog(r)),e.deleteProgram(r)}function Sp(e,t,n){let r=X(e.createShader(t));if(e.shaderSource(r,n),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS))return r;console.error(e.getShaderInfoLog(r)),e.deleteShader(r)}function Cp(e,t){let n=Math.min(e.length*2,t),r=new Float32Array(n);for(let t=0;ti.deleteProgram(this._program))),this._projectionLocation=X(i.getUniformLocation(this._program,`u_projection`)),this._resolutionLocation=X(i.getUniformLocation(this._program,`u_resolution`)),this._textureLocation=X(i.getUniformLocation(this._program,`u_texture`)),this._vertexArrayObject=i.createVertexArray(),i.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),o=i.createBuffer();this._register(Sd(()=>i.deleteBuffer(o))),i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,a,i.STATIC_DRAW),i.enableVertexAttribArray(0),i.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let s=new Uint8Array([0,1,2,3]),c=i.createBuffer();this._register(Sd(()=>i.deleteBuffer(c))),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,c),i.bufferData(i.ELEMENT_ARRAY_BUFFER,s,i.STATIC_DRAW),this._attributesBuffer=X(i.createBuffer()),this._register(Sd(()=>i.deleteBuffer(this._attributesBuffer))),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.enableVertexAttribArray(2),i.vertexAttribPointer(2,2,i.FLOAT,!1,Op,0),i.vertexAttribDivisor(2,1),i.enableVertexAttribArray(3),i.vertexAttribPointer(3,2,i.FLOAT,!1,Op,2*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(3,1),i.enableVertexAttribArray(4),i.vertexAttribPointer(4,1,i.FLOAT,!1,Op,4*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(4,1),i.enableVertexAttribArray(5),i.vertexAttribPointer(5,2,i.FLOAT,!1,Op,5*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(5,1),i.enableVertexAttribArray(6),i.vertexAttribPointer(6,2,i.FLOAT,!1,Op,7*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(6,1),i.enableVertexAttribArray(1),i.vertexAttribPointer(1,2,i.FLOAT,!1,Op,9*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(1,1),i.useProgram(this._program);let l=new Int32Array(ip.maxAtlasPages);for(let e=0;ei.deleteTexture(t.texture))),i.activeTexture(i.TEXTURE0+e),i.bindTexture(i.TEXTURE_2D,t.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[e]=t}i.enable(i.BLEND),i.blendFunc(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(e,t,n,r,i,a,o,s,c){this._updateCell(this._vertices.attributes,e,t,n,r,i,a,o,s,c)}_updateCell(e,t,n,r,i,a,o,s,c,l){if(Q=(n*this._terminal.cols+t)*Dp,r===0||r===void 0){e.fill(0,Q,Q+Dp-1-kp);return}this._atlas&&($=s&&s.length>1?this._atlas.getRasterizedGlyphCombinedChar(s,i,a,o,!1,this._terminal.element):this._atlas.getRasterizedGlyph(r,i,a,o,!1,this._terminal.element),Ap=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),i!==l&&$.offset.x>Ap?(jp=$.offset.x-Ap,e[Q]=-($.offset.x-jp)+this._dimensions.device.char.left,e[Q+1]=-$.offset.y+this._dimensions.device.char.top,e[Q+2]=($.size.x-jp)/this._dimensions.device.canvas.width,e[Q+3]=$.size.y/this._dimensions.device.canvas.height,e[Q+4]=$.texturePage,e[Q+5]=$.texturePositionClipSpace.x+jp/this._atlas.pages[$.texturePage].canvas.width,e[Q+6]=$.texturePositionClipSpace.y,e[Q+7]=$.sizeClipSpace.x-jp/this._atlas.pages[$.texturePage].canvas.width,e[Q+8]=$.sizeClipSpace.y):(e[Q]=-$.offset.x+this._dimensions.device.char.left,e[Q+1]=-$.offset.y+this._dimensions.device.char.top,e[Q+2]=$.size.x/this._dimensions.device.canvas.width,e[Q+3]=$.size.y/this._dimensions.device.canvas.height,e[Q+4]=$.texturePage,e[Q+5]=$.texturePositionClipSpace.x,e[Q+6]=$.texturePositionClipSpace.y,e[Q+7]=$.sizeClipSpace.x,e[Q+8]=$.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&Zd(r,c,$.size.x,this._dimensions.device.cell.width)&&(e[Q+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*Dp;this._vertices.count===t?this._vertices.attributes.fill(0):this._vertices.attributes=new Float32Array(t);let n=0;for(;n=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n=this.startCol&&t=this.startCol):!1}};function Pp(){return new Np}var Fp=4,Ip=1,Lp=2,Rp=3,zp=2147483648,Bp=class{constructor(){this.cells=new Uint32Array,this.lineLengths=new Uint32Array,this.selection=Pp()}resize(e,t){let n=e*t*Fp;n!==this.cells.length&&(this.cells=new Uint32Array(n),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},Vp=`#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; +}`,Hp=`#version 300 es +precision lowp float; + +in vec4 v_color; + +out vec4 outColor; + +void main() { + outColor = v_color; +}`,Up=8,Wp=Up*Float32Array.BYTES_PER_ELEMENT,Gp=20*Up,Kp=class{constructor(){this.attributes=new Float32Array(Gp),this.count=0}},qp=0,Jp=0,Yp=0,Xp=0,Zp=0,Qp=0,$p=0,em=class extends Td{constructor(e,t,n,r){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=r,this._vertices=new Kp,this._verticesCursor=new Kp;let i=this._gl;this._program=X(xp(i,Vp,Hp)),this._register(Sd(()=>i.deleteProgram(this._program))),this._projectionLocation=X(i.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=i.createVertexArray(),i.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),o=i.createBuffer();this._register(Sd(()=>i.deleteBuffer(o))),i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,a,i.STATIC_DRAW),i.enableVertexAttribArray(3),i.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let s=new Uint8Array([0,1,2,3]),c=i.createBuffer();this._register(Sd(()=>i.deleteBuffer(c))),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,c),i.bufferData(i.ELEMENT_ARRAY_BUFFER,s,i.STATIC_DRAW),this._attributesBuffer=X(i.createBuffer()),this._register(Sd(()=>i.deleteBuffer(this._attributesBuffer))),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.enableVertexAttribArray(0),i.vertexAttribPointer(0,2,i.FLOAT,!1,Wp,0),i.vertexAttribDivisor(0,1),i.enableVertexAttribArray(1),i.vertexAttribPointer(1,2,i.FLOAT,!1,Wp,2*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(1,1),i.enableVertexAttribArray(2),i.vertexAttribPointer(2,4,i.FLOAT,!1,Wp,4*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(e=>{this._updateCachedColors(e),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,bp),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.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(e){let t=this._terminal,n=this._vertices,r=1,i,a,o,s,c,l,u,d,f,p,m;for(i=0;i>24&255)/255,Zp=(qp>>16&255)/255,Qp=(qp>>8&255)/255,$p=1,this._addRectangle(e.attributes,t,Jp,Yp,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Xp,Zp,Qp,$p)}_addRectangle(e,t,n,r,i,a,o,s,c,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=s,e[t+6]=c,e[t+7]=l}_addRectangleFloat(e,t,n,r,i,a,o){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},tm=class extends Td{constructor(e,t,n,r,i,a,o,s){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=o,this._themeService=s,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-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(t=>{this._refreshCharAtlas(e,t),this.reset(e)})),this._register(Sd(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=X(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=pp(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*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(e,t,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=ff,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){let r=t?e.options.fontWeightBold:e.options.fontWeight;return`${n?`italic`:``} ${r} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},nm=class extends tm{constructor(e,t,n,r,i,a,o){super(n,e,`link`,t,!0,i,a,o),this._register(r.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(r.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&dp(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t=0;!(sm.indexOf(`Chrome`)>=0)&&sm.indexOf(`Safari`),sm.indexOf(`Electron/`),sm.indexOf(`Android`);var lm=!1;if(typeof rm.matchMedia==`function`){let e=rm.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=rm.matchMedia(`(display-mode: fullscreen)`);lm=e.matches,om(rm,e,({matches:e})=>{lm&&t.matches||(lm=e)})}function um(){return lm}var dm=`en`,fm=!1,pm=!1,mm=!1,hm=dm,gm,_m=globalThis,vm;typeof _m.vscode<`u`&&typeof _m.vscode.process<`u`?vm=_m.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(vm=process);var ym=typeof vm?.versions?.electron==`string`&&vm?.type===`renderer`;if(typeof vm==`object`){vm.platform,vm.platform,fm=vm.platform===`linux`,fm&&vm.env.SNAP&&vm.env.SNAP_REVISION,vm.env.CI||vm.env.BUILD_ARTIFACTSTAGINGDIRECTORY,hm=dm;let e=vm.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,hm=t.resolvedLanguage||dm,t.languagePack?.translationsConfigFile}catch{}pm=!0}else typeof navigator==`object`&&!ym?(gm=navigator.userAgent,gm.indexOf(`Windows`),gm.indexOf(`Macintosh`),(gm.indexOf(`Macintosh`)>=0||gm.indexOf(`iPad`)>=0||gm.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,fm=gm.indexOf(`Linux`)>=0,gm?.indexOf(`Mobi`),mm=!0,hm=globalThis._VSCODE_NLS_LANGUAGE||dm,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var bm=pm;mm&&typeof _m.importScripts==`function`&&_m.origin;var xm=gm,Sm=hm,Cm;(e=>{function t(){return Sm}e.value=t;function n(){return Sm.length===2?Sm===`en`:Sm.length>=3?Sm[0]===`e`&&Sm[1]===`n`&&Sm[2]===`-`:!1}e.isDefaultVariant=n;function r(){return Sm===`en`}e.isDefault=r})(Cm||={});var wm=typeof _m.postMessage==`function`&&!_m.importScripts;(()=>{if(wm){let e=[];_m.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n{let r=++t;e.push({id:r,callback:n}),_m.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var Tm=!!(xm&&xm.indexOf(`Chrome`)>=0);xm&&xm.indexOf(`Firefox`),!Tm&&xm&&xm.indexOf(`Safari`),xm&&xm.indexOf(`Edg/`),xm&&xm.indexOf(`Android`);var Em=typeof navigator==`object`?navigator:{};bm||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||Em&&Em.clipboard&&Em.clipboard.writeText,bm||Em&&Em.clipboard&&Em.clipboard.readText,bm||um()||Em.keyboard,`ontouchstart`in rm||Em.maxTouchPoints,rm.PointerEvent&&(`ontouchstart`in rm||navigator.maxTouchPoints);var Dm=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Om=new Dm,km=new Dm,Am=new Dm;Array(230);var jm;(e=>{function t(e){return Om.keyCodeToStr(e)}e.toString=t;function n(e){return Om.strToKeyCode(e)}e.fromString=n;function r(e){return km.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return Am.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return km.strToKeyCode(e)||Am.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return Om.keyCodeToStr(e)}e.toElectronAccelerator=o})(jm||={});var Mm=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),Nm;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof Pm?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Bf.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Mm})})(Nm||={});var Pm=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?Mm:(this._emitter||=new Z,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var Fm;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(Fm||={});var Im=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new Z,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.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(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.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())}};Im.EMPTY=Im.fromArray([]);function Lm(e){return 55296<=e&&e<=56319}function Rm(e){return 56320<=e&&e<=57343}function zm(e,t){return(e-55296<<10)+(t-56320)+65536}function Bm(e){return Vm(e,0)}function Vm(e,t){switch(typeof e){case`object`:return e===null?Hm(349,t):Array.isArray(e)?Gm(e,t):Km(e,t);case`string`:return Wm(e,t);case`boolean`:return Um(e,t);case`number`:return Hm(e,t);case`undefined`:return Hm(937,t);default:return Hm(617,t)}}function Hm(e,t){return(t<<5)-t+e|0}function Um(e,t){return Hm(e?433:863,t)}function Wm(e,t){t=Hm(149417,t);for(let n=0,r=e.length;nVm(t,e),t)}function Km(e,t){return t=Hm(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=Wm(n,t),Vm(e[n],t)),t)}function qm(e,t,n=32){let r=n-t,i=~((1<>>r)>>>0}function Jm(e,t=0,n=e.byteLength,r=0){for(let i=0;ie.toString(16).padStart(2,`0`)).join(``):Ym((e>>>0).toString(16),t/4)}var Zm=class e{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){let t=e.length;if(t===0)return;let n=this._buff,r=this._buffLen,i=this._leftoverHighSurrogate,a,o;for(i===0?(a=e.charCodeAt(0),o=0):(a=i,o=-1,i=0);;){let s=a;if(Lm(a))if(o+1>>6,e[t++]=128|(n&63)>>>0):n<65536?(e[t++]=224|(n&61440)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0):(e[t++]=240|(n&1835008)>>>18,e[t++]=128|(n&258048)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),Xm(this._h0)+Xm(this._h1)+Xm(this._h2)+Xm(this._h3)+Xm(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,Jm(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Jm(this._buff));let e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){let t=e._bigBlock32,n=this._buffDV;for(let e=0;e<64;e+=4)t.setUint32(e,n.getUint32(e,!1),!1);for(let e=64;e<320;e+=4)t.setUint32(e,qm(t.getUint32(e-12,!1)^t.getUint32(e-32,!1)^t.getUint32(e-56,!1)^t.getUint32(e-64,!1),1),!1);let r=this._h0,i=this._h1,a=this._h2,o=this._h3,s=this._h4,c,l,u;for(let e=0;e<80;e++)e<20?(c=i&a|~i&o,l=1518500249):e<40?(c=i^a^o,l=1859775393):e<60?(c=i&a|i&o|a&o,l=2400959708):(c=i^a^o,l=3395469782),u=qm(r,5)+c+s+l+t.getUint32(e*4,!1)&4294967295,s=o,o=a,a=qm(i,30),i=r,r=u;this._h0=this._h0+r&4294967295,this._h1=this._h1+i&4294967295,this._h2=this._h2+a&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+s&4294967295}};Zm._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:Qm,getWindow:$m,getDocument:eh,getWindows:th,getWindowsCount:nh,getWindowId:rh,getWindowById:ih,hasWindow:ah,onDidRegisterWindow:oh,onWillUnregisterWindow:sh,onDidUnregisterWindow:ch}=function(){let e=new Map,t={window:rm,disposables:new wd};e.set(rm.vscodeWindowId,t);let n=new Z,r=new Z,i=new Z;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return Td.None;let a=new wd,o={window:t,disposables:a.add(new wd)};return e.set(t.vscodeWindowId,o),a.add(Sd(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(uh(t,fh.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:rm},getDocument(e){return $m(e).document}}}(),lh=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,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,null)}};function uh(e,t,n,r){return new lh(e,t,n,r)}var dh=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};dh.None=new dh(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=Bm(n),a=r.get(i);if(a)a.users+=1;else{let o=new Z,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(Sd(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var fh={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:cm?`webkitAnimationStart`:`animationstart`,ANIMATION_END:cm?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:cm?`webkitAnimationIteration`:`animationiteration`},ph=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function mh(e,t,n,...r){let i=ph.exec(t);if(!i)throw Error(`Bad use of emmet`);let a=i[1]||`div`,o;return o=e===`http://www.w3.org/1999/xhtml`?document.createElement(a):document.createElementNS(e,a),i[3]&&(o.id=i[3]),i[4]&&(o.className=i[4].replace(/\./g,` `).trim()),n&&Object.entries(n).forEach(([e,t])=>{typeof t>`u`||(/^on\w+$/.test(e)?o[e]=t:e===`selected`?t&&o.setAttribute(e,`true`):o.setAttribute(e,t))}),o.append(...r),o}function hh(e,t,...n){return mh(`http://www.w3.org/1999/xhtml`,e,t,...n)}hh.SVG=function(e,t,...n){return mh(`http://www.w3.org/2000/svg`,e,t,...n)};var gh=class extends Td{constructor(e,t,n,r,i,a,o,s,c){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._optionsService=o,this._themeService=s,this._cursorBlinkStateManager=new Ed,this._charAtlasDisposable=this._register(new Ed),this._observerDisposable=this._register(new Ed),this._model=new Bp,this._workCell=new yp,this._workCell2=new yp,this._rectangleRenderer=this._register(new Ed),this._glyphRenderer=this._register(new Ed),this._onChangeTextureAtlas=this._register(new Z),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Z),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Z),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Z),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Z),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let l={antialias:!1,depth:!1,preserveDrawingBuffer:c};if(this._gl=this._canvas.getContext(`webgl2`,l),!this._gl)throw Error(`WebGL2 not supported `+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new uf(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new nm(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=$d(),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(uh(this._canvas,`webglcontextlost`,e=>{console.log(`webglcontextlost event received`),e.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn(`webgl context not restored; firing onContextLoss`),this._onContextLoss.fire(e)},3e3)})),this._register(uh(this._canvas,`webglcontextrestored`,e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,mp(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=_p(this._canvas,this._coreBrowserService.window,(e,t)=>this._setCanvasDevicePixelDimensions(e,t)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=_p(this._canvas,e,(e,t)=>this._setCanvasDevicePixelDimensions(e,t))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Sd(()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),mp(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(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let e of this._renderLayers)e.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 e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new em(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new Mp(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 e=pp(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!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=xd(Bf.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Bf.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){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 n of this._renderLayers)n.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),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 gp(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r=this._workCell,i,a,o,s,c,l,u=0,d=!0,f,p,m,h,g,_,v,y,b;e=vh(e,n.rows-1,0),t=vh(t,n.rows-1,0);let x=this._coreService.decPrivateModes.cursorStyle??n.options.cursorStyle??`block`,ee=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,te=ee-n.buffer.ydisp,S=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),C=-1,w=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let T=!1;for(a=e;a<=t;a++)for(o=a+n.buffer.ydisp,s=n.buffer.lines.get(o),this._model.lineLengths[a]=0,m=ee===o,u=0,c=this._characterJoinerService.getJoinedCharacters(o),y=0;y=u,f=y,c.length>0&&y===c[0][0]&&d){p=c.shift();let e=this._model.selection.isCellSelected(this._terminal,p[0],o);for(v=p[0]+1;v=p[1],d?(l=!0,r=new _h(r,s.translateToString(!0,p[0],p[1]),p[1]-p[0]),f=p[1]-1):u=p[1]}if(h=r.getChars(),g=r.getCode(),v=(a*n.cols+y)*Fp,this._cellColorResolver.resolve(r,y,o,this.dimensions.device.cell.width),w&&o===ee&&(y===S&&(this._model.cursor={x:S,y:te,width:r.getWidth(),style:this._coreBrowserService.isFocused?x:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},C=S+r.getWidth()-1),y>=S&&y<=C&&(this._coreBrowserService.isFocused&&x===`block`||this._coreBrowserService.isFocused===!1&&n.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)),g!==0&&(this._model.lineLengths[a]=y+1),!(this._model.cells[v]===g&&this._model.cells[v+Ip]===this._cellColorResolver.result.bg&&this._model.cells[v+Lp]===this._cellColorResolver.result.fg&&this._model.cells[v+Rp]===this._cellColorResolver.result.ext)&&(T=!0,h.length>1&&(g|=zp),this._model.cells[v]=g,this._model.cells[v+Ip]=this._cellColorResolver.result.bg,this._model.cells[v+Lp]=this._cellColorResolver.result.fg,this._model.cells[v+Rp]=this._cellColorResolver.result.ext,_=r.getWidth(),this._glyphRenderer.value.updateCell(y,a,g,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,h,_,i),l)){for(r=this._workCell,y++;y<=f;y++)b=(a*n.cols+y)*Fp,this._glyphRenderer.value.updateCell(y,a,0,0,0,0,Pd,0,0),this._model.cells[b]=0,this._model.cells[b+Ip]=this._cellColorResolver.result.bg,this._model.cells[b+Lp]=this._cellColorResolver.result.fg,this._model.cells[b+Rp]=this._cellColorResolver.result.ext;y--}}T&&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(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},_h=class extends Mf{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function vh(e,t,n=0){return Math.max(Math.min(e,t),n)}var yh=`di$target`,bh=`di$dependencies`,xh=new Map;function Sh(e){if(xh.has(e))return xh.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Ch(t,e,r)};return t._id=e,xh.set(e,t),t}function Ch(e,t,n){t[yh]===t?t[bh].push({id:e,index:n}):(t[bh]=[{id:e,index:n}],t[yh]=t)}Sh(`BufferService`),Sh(`CoreMouseService`),Sh(`CoreService`),Sh(`CharsetService`),Sh(`InstantiationService`),Sh(`LogService`);var wh=Sh(`OptionsService`);Sh(`OscLinkService`),Sh(`UnicodeService`),Sh(`DecorationService`);var Th={trace:0,debug:1,info:2,warn:3,error:4,off:5},Eh=`xterm.js: `,Dh=class extends Td{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),Oh=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Th[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;tthis.activate(e)));return}this._terminal=e;let n=t.coreService,r=t.optionsService,i=t,a=i._renderService,o=i._characterJoinerService,s=i._charSizeService,c=i._coreBrowserService,l=i._decorationService;i._logService;let u=i._themeService;this._renderer=this._register(new gh(e,o,s,c,n,l,r,u,this._preserveDrawingBuffer)),this._register(Bf.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Bf.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Bf.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Bf.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),a.setRenderer(this._renderer),this._register(Sd(()=>{if(this._terminal._core._store._isDisposed)return;let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}},Ah=class{aliases;usage;matches(e){let t=e.toLowerCase();return t===this.name.toLowerCase()||(this.aliases?.some(e=>t===e.toLowerCase())??!1)}writeLine(e,t,n){n?e.writeln(`${n}${t}\x1b[0m`):e.writeln(t)}writeSuccess(e,t){e.writeln(`\x1b[1;32m✓\x1b[0m ${t}`)}writeError(e,t){e.writeln(`\x1b[1;31m✗ Error:\x1b[0m ${t}`)}writeInfo(e,t){e.writeln(`\x1b[90m${t}\x1b[0m`)}startLoading(e,t){let n=[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`],r=0,i=!0,a=setInterval(()=>{if(!i){clearInterval(a);return}e.write(`\r\x1b[36m${n[r]}\x1b[0m ${t}`),r=(r+1)%n.length},80);return()=>{i=!1,clearInterval(a),e.write(`\r\x1B[K`)}}},jh=class extends Ah{name=`help`;description=`Show available commands`;aliases=[`?`,`h`];constructor(e){super(),this.commands=e}execute({term:e,writePrompt:t}){e.writeln(``),e.writeln(`\x1B[1;33mAvailable Commands:\x1B[0m`),e.writeln(``),this.commands.forEach(t=>{let n=t.aliases?.length?` (${t.aliases.join(`, `)})`:``;e.writeln(` \x1b[1;36m${t.name.padEnd(15)}\x1b[0m ${t.description}${n}`)}),e.writeln(``),e.writeln(`\x1B[90mTip: Use Tab for autocomplete, ↑↓ for history, Ctrl+F to search\x1B[0m`),t()}},Mh=class extends Ah{name=`clear`;description=`Clear terminal screen`;aliases=[`cls`];execute({term:e,writePrompt:t}){e.clear(),t()}},Nh=class extends Ah{name=`status`;description=`Show repeater status`;aliases=[`st`];execute({term:e,writePrompt:t}){let n=g().stats;if(n&&typeof n==`object`){this.writeSuccess(e,`Repeater Status:`),e.writeln(``);for(let[t,r]of Object.entries(n))e.writeln(` \x1b[36m${t.padEnd(20)}\x1b[0m ${r}`)}else this.writeError(e,`No status data available`);t()}},Ph=class extends Ah{name=`uptime`;description=`Show system uptime`;execute({term:e,writePrompt:t}){let n=g().stats?.uptime_seconds||0;this.writeSuccess(e,this.formatUptime(n)),t()}formatUptime(e){let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`}},Fh=class extends Ah{name=`packets`;description=`Show packet statistics`;isMobile(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<768}execute({term:e,writePrompt:t}){let n=g().stats;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,``),t()}},Ih=class extends Ah{name=`board`;description=`Show board information`;execute({term:e,writePrompt:t}){let n=g().stats?.board_info||`pyMC_Repeater (Linux/RPi)`;this.writeSuccess(e,n),t()}},Lh=class extends Ah{name=`advert`;description=`Send neighbor advert immediately`;async execute({term:e,writePrompt:t}){let n=this.startLoading(e,`Sending advert...`);try{let t=await h.post(`/send_advert`,{},{timeout:1e4});n(),t.success?this.writeSuccess(e,t.data||`Advert sent successfully`):this.writeError(e,t.error||`Failed to send advert`)}catch(t){n(),this.writeError(e,`Failed to send advert: ${t}`)}t()}},Rh=class extends Ah{name=`get`;description=`Get configuration values (name, freq, tx, mode, duty, etc.)`;matches(e){let t=e.toLowerCase();return t===`get`||t.startsWith(`get `)}execute({term:e,args:t,writePrompt:n}){let r=t[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,``),n();return}let i=g().stats;if(!i){this.writeError(e,`System stats not available`),n();return}{let t=i,a=t.config||{},o=a.radio||{},s=a.repeater||{},c=a.delays||{},l=a.duty_cycle||{},u=``;switch(r){case`name`:u=a.node_name||`Unknown`;break;case`role`:u=`repeater`;break;case`lat`:u=s.latitude==null?`not set`:String(s.latitude);break;case`lon`:u=s.longitude==null?`not set`:String(s.longitude);break;case`freq`:u=o.frequency?`${(o.frequency/1e6).toFixed(3)} MHz`:`?`;break;case`tx`:u=o.tx_power==null?`?`:`${o.tx_power}dBm`;break;case`bw`:u=o.bandwidth?`${o.bandwidth/1e3} kHz`:`?`;break;case`sf`:u=o.spreading_factor==null?`?`:String(o.spreading_factor);break;case`cr`:u=o.coding_rate==null?`?`:`4/${o.coding_rate}`;break;case`radio`:if(o.frequency){this.writeSuccess(e,`Radio Configuration:`),this.writeLine(e,``),this.writeLine(e,` \x1b[36mFrequency:\x1b[0m ${(o.frequency/1e6).toFixed(3)} MHz`),this.writeLine(e,` \x1b[36mBandwidth:\x1b[0m ${o.bandwidth/1e3} kHz`),this.writeLine(e,` \x1b[36mSpreading Factor:\x1b[0m ${o.spreading_factor}`),this.writeLine(e,` \x1b[36mCoding Rate:\x1b[0m 4/${o.coding_rate}`),this.writeLine(e,` \x1b[36mTX Power:\x1b[0m ${o.tx_power}dBm`),this.writeLine(e,``),n();return}else u=`Radio configuration not available`;break;case`af`:case`txdelay`:u=c.tx_delay_factor==null?`\x1B[90mnot set (default: 1.0)\x1B[0m`:String(c.tx_delay_factor);break;case`direct.txdelay`:u=c.direct_tx_delay_factor==null?`\x1B[90mnot set (default: 0.5)\x1B[0m`:String(c.direct_tx_delay_factor);break;case`rxdelay`:u=c.rx_delay_base==null?`\x1B[90mnot set (default: 0.0s)\x1B[0m`:`${c.rx_delay_base}s`;break;case`mode`:u=s.mode==null?`\x1B[90mnot set (default: forward)\x1B[0m`:s.mode;break;case`repeat`:u=s.mode==null?`\x1B[90mnot set (default: on)\x1B[0m`:s.mode===`forward`?`on`:`off`;break;case`flood.max`:u=s.max_flood_hops==null?`\x1B[90mnot set (default: 3)\x1B[0m`:String(s.max_flood_hops);break;case`flood.advert.interval`:u=s.send_advert_interval_hours==null?`\x1B[90mnot set\x1B[0m`:`${s.send_advert_interval_hours}h`;break;case`advert.interval`:u=s.advert_interval_minutes==null?`\x1B[90mnot set (default: 120m)\x1B[0m`:`${s.advert_interval_minutes}m`;break;case`duty`:case`duty.enabled`:u=l.enforcement_enabled==null?`\x1B[90mnot set (default: off)\x1B[0m`:l.enforcement_enabled?`on`:`off`;break;case`duty.max`:u=l.max_airtime_percent==null?`\x1B[90mnot set\x1B[0m`:`${l.max_airtime_percent}%`;break;case`public.key`:u=t.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`),n();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`),n();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`),n();return}this.writeSuccess(e,u)}n()}writeWarning(e,t){e.writeln(`\x1b[1;33m⚠ Warning:\x1b[0m ${t}`)}},zh=class extends Ah{name=`set`;description=`Set configuration values (tx, txdelay, mode, duty, etc.)`;matches(e){let t=e.toLowerCase();return t===`set`||t.startsWith(`set `)}async execute({term:e,args:t,writePrompt:n}){let r=t[0]?.toLowerCase(),i=t.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,``),n();return}let a=this.startLoading(e,`Updating configuration...`);try{let t;switch(r){case`tx`:{let r=parseInt(i);if(isNaN(r)||r<2||r>30){a(),this.writeError(e,`TX power must be 2-30 dBm`),n();return}t=await h.post(`/update_radio_config`,{tx_power:r},{timeout:3e4});break}case`freq`:{let r=parseFloat(i);if(isNaN(r)||r<100||r>1e3){a(),this.writeError(e,`Frequency must be 100-1000 MHz`),n();return}t=await h.post(`/update_radio_config`,{frequency:r*1e6},{timeout:3e4});break}case`bw`:{let r=parseFloat(i),o=[7.8,10.4,15.6,20.8,31.25,41.7,62.5,125,250,500];if(isNaN(r)||!o.includes(r)){a(),this.writeError(e,`Bandwidth must be one of: ${o.join(`, `)} kHz`),n();return}t=await h.post(`/update_radio_config`,{bandwidth:r*1e3},{timeout:3e4});break}case`sf`:{let r=parseInt(i);if(isNaN(r)||r<5||r>12){a(),this.writeError(e,`Spreading factor must be 5-12`),n();return}t=await h.post(`/update_radio_config`,{spreading_factor:r},{timeout:3e4});break}case`cr`:{let r=parseInt(i);if(isNaN(r)||r<5||r>8){a(),this.writeError(e,`Coding rate must be 5-8 (for 4/5 to 4/8)`),n();return}t=await h.post(`/update_radio_config`,{coding_rate:r},{timeout:3e4});break}case`af`:case`txdelay`:{let r=parseFloat(i);if(isNaN(r)||r<0||r>5){a(),this.writeError(e,`TX delay factor must be 0.0-5.0`),n();return}t=await h.post(`/update_radio_config`,{tx_delay_factor:r},{timeout:3e4});break}case`direct.txdelay`:{let r=parseFloat(i);if(isNaN(r)||r<0||r>5){a(),this.writeError(e,`Direct TX delay factor must be 0.0-5.0`),n();return}t=await h.post(`/update_radio_config`,{direct_tx_delay_factor:r},{timeout:3e4});break}case`rxdelay`:{let r=parseFloat(i);if(isNaN(r)||r<0){a(),this.writeError(e,`RX delay must be >= 0`),n();return}t=await h.post(`/update_radio_config`,{rx_delay_base:r},{timeout:3e4});break}case`name`:if(!i.trim()){a(),this.writeError(e,`Node name cannot be empty`),n();return}t=await h.post(`/update_radio_config`,{node_name:i.trim()},{timeout:3e4});break;case`lat`:{let r=parseFloat(i);if(isNaN(r)||r<-90||r>90){a(),this.writeError(e,`Latitude must be -90 to 90`),n();return}t=await h.post(`/update_radio_config`,{latitude:r},{timeout:3e4});break}case`lon`:{let r=parseFloat(i);if(isNaN(r)||r<-180||r>180){a(),this.writeError(e,`Longitude must be -180 to 180`),n();return}t=await h.post(`/update_radio_config`,{longitude:r},{timeout:3e4});break}case`mode`:{let r=i.toLowerCase();if(r!==`forward`&&r!==`monitor`&&r!==`no_tx`){a(),this.writeError(e,`Mode must be "forward", "monitor", or "no_tx"`),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)`),this.writeLine(e,` \x1B[36mno_tx\x1B[0m - No repeat, no local TX; adverts skipped`),n();return}t=await h.post(`/set_mode`,{mode:r},{timeout:3e4}),t.data&&(t.data.applied=[`mode=${r}`],t.data.persisted=!0,t.data.live_update=!0);break}case`duty`:{let r=i.toLowerCase();if(r!==`on`&&r!==`off`){a(),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`),n();return}let o=r===`on`;t=await h.post(`/set_duty_cycle`,{enabled:o},{timeout:3e4}),t.data&&(t.data.applied=[`duty=${r}`],t.data.persisted=!0,t.data.live_update=!0);break}case`flood.max`:{let r=parseInt(i);if(isNaN(r)||r<0||r>64){a(),this.writeError(e,`Max flood hops must be 0-64`),n();return}t=await h.post(`/update_radio_config`,{max_flood_hops:r},{timeout:3e4});break}case`flood.advert.interval`:{let r=parseInt(i);if(isNaN(r)||r!==0&&(r<3||r>48)){a(),this.writeError(e,`Flood advert interval must be 0 (off) or 3-48 hours`),n();return}t=await h.post(`/update_radio_config`,{flood_advert_interval_hours:r},{timeout:3e4});break}case`advert.interval`:{let r=parseInt(i);if(isNaN(r)||r!==0&&(r<1||r>10080)){a(),this.writeError(e,`Advert interval must be 0 (off) or 1-10080 minutes`),n();return}t=await h.post(`/update_radio_config`,{advert_interval_minutes:r},{timeout:3e4});break}case`log`:a(),this.writeWarning(e,`Log level configuration not yet implemented`),this.writeInfo(e,`Backend endpoint /set_log_level does not exist`),n();return;default:a(),this.writeError(e,`Unknown parameter: ${r}`),this.writeLine(e,``),this.writeInfo(e,`Type "set" without arguments to see available parameters`),n();return}a();let o=t.data||t;t.success?(o.applied&&o.applied.length>0?this.writeSuccess(e,`Configuration updated: ${o.applied.join(`, `)}`):this.writeSuccess(e,`Configuration updated`),g().fetchStats(),o.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`)):o.message&&!o.live_update&&(this.writeLine(e,``),this.writeInfo(e,o.message))):this.writeError(e,t.error||`Failed to update configuration`)}catch(t){a(),this.writeError(e,`Failed to update ${r}: ${t}`)}this.writeLine(e,``),n()}writeWarning(e,t){e.writeln(`\x1b[1;33m⚠ Warning:\x1b[0m ${t}`)}},Bh=class extends Ah{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:t}){let n=this.startLoading(e,`Fetching identities...`);try{let t=await h.getIdentities();n();let r=[];if(t.success&&t.data){let e=t.data,n=e.registered||[],i=e.configured||[];r=i.length>0?i:n}else Array.isArray(t)&&(r=t);r.length===0?this.writeInfo(e,`No identities found`):(this.writeSuccess(e,`Found \x1b[1m${r.length}\x1b[0m identit${r.length===1?`y`:`ies`}`),e.writeln(``),this.isMobile()?r.forEach((t,n)=>{e.writeln(`\x1b[1;36m[${n+1}] ${t.name||`Unnamed`}\x1b[0m`),e.writeln(` \x1b[90mType:\x1b[0m ${t.type||`-`}`),e.writeln(` \x1b[90mHash:\x1b[0m ${t.hash||`-`}`),e.writeln(` \x1b[90mAddress:\x1b[0m ${t.address||`-`}`),e.writeln(` \x1b[90mRegistered:\x1b[0m ${t.registered?`\x1B[32myes\x1B[0m`:`\x1B[31mno\x1B[0m`}`),n{let r=(n+1).toString().padEnd(2),i=(t.name||`Unnamed`).padEnd(27),a=(t.type||`-`).padEnd(13),o=(t.hash||`-`).padEnd(4),s=(t.address||`-`).padEnd(7),c=(t.registered?`yes`:`no`).padEnd(10);e.writeln(`\x1b[36m│\x1b[0m ${r} \x1b[36m│\x1b[0m \x1b[1m${i}\x1b[0m \x1b[36m│\x1b[0m ${a} \x1b[36m│\x1b[0m ${o} \x1b[36m│\x1b[0m ${s} \x1b[36m│\x1b[0m ${c} \x1b[36m│\x1b[0m`)}),e.writeln(`\x1B[36m└────┴─────────────────────────────┴───────────────┴──────┴─────────┴────────────┘\x1B[0m`)))}catch(t){n(),this.writeError(e,t instanceof Error?t.message:`Failed to fetch identities`)}t()}},Vh=class extends Ah{name=`keys`;description=`List transport keys`;async execute({term:e,writePrompt:t}){let n=this.startLoading(e,`Fetching transport keys...`);try{let t=await h.getTransportKeys();n();let r=t.success&&t.data?t.data:t,i=Array.isArray(r)?r:[];i.length===0?this.writeInfo(e,`No transport keys found`):(this.writeSuccess(e,`Found \x1b[1m${i.length}\x1b[0m transport key${i.length===1?``:`s`}`),e.writeln(``),i.forEach((t,n)=>{e.writeln(`\x1b[36m${(n+1).toString().padStart(2)}.\x1b[0m \x1b[1m${t.name||`Unnamed`}\x1b[0m`),t.flood_policy&&e.writeln(` Policy: \x1b[90m${t.flood_policy}\x1b[0m`),t.parent_id&&e.writeln(` Parent: \x1b[90m${t.parent_id}\x1b[0m`),n{if(e.writeln(`\x1b[1;36m[${n+1}] ${t.node_name||`Unknown`}\x1b[0m`),e.writeln(` \x1b[90mPubKey:\x1b[0m ${t.pubkey?.substring(0,8)||`----`}`),e.writeln(` \x1b[90mType:\x1b[0m ${t.contact_type||`-`}`),t.last_seen){let n=new Date(t.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 ${n}`)}t.rssi&&e.writeln(` \x1b[90mRSSI:\x1b[0m ${t.rssi}`),t.snr&&e.writeln(` \x1b[90mSNR:\x1b[0m ${t.snr}`),e.writeln(` \x1b[90mAdverts:\x1b[0m ${t.advert_count||0}`),e.writeln(` \x1b[90mDirect:\x1b[0m ${t.zero_hop?`\x1B[32myes\x1B[0m`:`\x1B[31mno\x1B[0m`}`),n{let r=(n+1).toString().padEnd(2),i=(t.node_name||`Unknown`).padEnd(20),a=(t.pubkey?.substring(0,4)||`----`).padEnd(6),o=(t.contact_type||`-`).padEnd(12),s=t.last_seen?new Date(t.last_seen*1e3).toLocaleString(`en-US`,{month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).padEnd(20):`-`.padEnd(20),c=(t.rssi?`${t.rssi}`:`-`).padEnd(8),l=(t.snr?`${t.snr}`:`-`).padEnd(4),u=(t.advert_count?.toString()||`0`).padEnd(6),d=(t.zero_hop?`yes`:`no`).padEnd(6);e.writeln(`\x1b[36m│\x1b[0m ${r} \x1b[36m│\x1b[0m \x1b[1m${i}\x1b[0m \x1b[36m│\x1b[0m ${a} \x1b[36m│\x1b[0m ${o} \x1b[36m│\x1b[0m ${s} \x1b[36m│\x1b[0m ${c} \x1b[36m│\x1b[0m ${l} \x1b[36m│\x1b[0m ${u} \x1b[36m│\x1b[0m ${d} \x1b[36m│\x1b[0m`)}),e.writeln(`\x1B[36m└────┴──────────────────────┴────────┴──────────────┴──────────────────────┴──────────┴──────┴────────┴────────┘\x1B[0m`)),r.length>10&&(e.writeln(``),e.writeln(`\x1b[90m... and ${r.length-10} more neighbors\x1b[0m`)))}catch(t){n(),this.writeError(e,t instanceof Error?t.message:`Failed to fetch neighbors`)}t()}},Uh=class extends Ah{name=`acl`;description=`Show ACL statistics`;async execute({term:e,writePrompt:t}){let n=this.startLoading(e,`Fetching ACL stats...`);try{let t=await h.getACLStats();n();let r=t.success&&t.data?t.data:t;if(r&&typeof r==`object`){this.writeSuccess(e,`ACL Statistics:`),e.writeln(``);let t=(n,r=` `)=>{if(typeof n==`object`&&n&&!Array.isArray(n))for(let[i,a]of Object.entries(n))typeof a==`object`&&a?(e.writeln(`${r}\x1b[90m${i}:\x1b[0m`),t(a,r+` `)):e.writeln(`${r}\x1b[90m${i.padEnd(18)}\x1b[0m ${a}`);else e.writeln(`${r}${n}`)};for(let[n,i]of Object.entries(r))typeof i==`object`&&i?(e.writeln(` \x1b[36m${n}\x1b[0m`),t(i,` `)):e.writeln(` \x1b[36m${n.padEnd(20)}\x1b[0m ${i}`)}else this.writeError(e,`No ACL data available`)}catch(t){n(),this.writeError(e,t instanceof Error?t.message:`Failed to fetch ACL stats`)}t()}},Wh=class extends Ah{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:t}){let n=this.startLoading(e,`Fetching room stats...`);try{let t=await h.getRoomStats();n();let r=[];t.success&&t.data?r=t.data.rooms||(Array.isArray(t.data)?t.data:[]):Array.isArray(t)&&(r=t),r.length===0?this.writeInfo(e,`No room servers found`):(this.writeSuccess(e,`Found \x1b[1m${r.length}\x1b[0m room server${r.length===1?``:`s`}`),e.writeln(``),this.isMobile()?r.forEach((t,n)=>{e.writeln(`\x1b[1;36m[${n+1}] ${t.room_name||`Unnamed`}\x1b[0m`),e.writeln(` \x1b[90mMessages:\x1b[0m ${t.total_messages||0}`),e.writeln(` \x1b[90mTotal Clients:\x1b[0m ${t.total_clients||0}`),e.writeln(` \x1b[90mActive Clients:\x1b[0m ${t.active_clients||0}`),e.writeln(` \x1b[90mSync:\x1b[0m ${t.sync_running?`\x1B[32mrunning\x1B[0m`:`\x1B[31mstopped\x1B[0m`}`),n{let r=(n+1).toString().padEnd(2),i=(t.room_name||`Unnamed`).padEnd(27),a=(t.total_messages?.toString()||`0`).padEnd(8),o=(t.total_clients?.toString()||`0`).padEnd(12),s=(t.active_clients?.toString()||`0`).padEnd(14),c=(t.sync_running?`running`:`stopped`).padEnd(8);e.writeln(`\x1b[36m│\x1b[0m ${r} \x1b[36m│\x1b[0m \x1b[1m${i}\x1b[0m \x1b[36m│\x1b[0m ${a} \x1b[36m│\x1b[0m ${o} \x1b[36m│\x1b[0m ${s} \x1b[36m│\x1b[0m ${c} \x1b[36m│\x1b[0m`)}),e.writeln(`\x1B[36m└────┴─────────────────────────────┴──────────┴──────────────┴────────────────┴──────────┘\x1B[0m`)))}catch(t){n(),this.writeError(e,t instanceof Error?t.message:`Failed to fetch room stats`)}t()}},Gh=class extends Ah{name=`restart`;description=`Restart the pymc-repeater service`;aliases=[`reboot`];matches(e){let t=e.toLowerCase();return t===`restart`||t===`reboot`}async execute({term:e,writePrompt:t}){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...`);let n=this.startLoading(e,`Restarting...`);try{let r=await h.post(`/restart_service`,{},{timeout:1e4});if(n(),r.success){this.writeLine(e,``),this.writeSuccess(e,`Service restart initiated`),this.writeLine(e,``),await this.waitForServiceRestart(e,t);return}else 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){n(),this.writeLine(e,``);let i=r;if(i.code===`ERR_NETWORK`||i.message?.includes(`Network error`)||i.message?.includes(`ECONNRESET`)||i.code===`ECONNRESET`){this.writeSuccess(e,`Service restart initiated successfully`),this.writeLine(e,``),await this.waitForServiceRestart(e,t);return}else if(i.code===`ECONNABORTED`||i.message?.includes(`timeout`)){this.writeSuccess(e,`Service restart initiated successfully`),this.writeLine(e,``),await this.waitForServiceRestart(e,t);return}else i.response?.status===403||i.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;t--)e.write(`\r\x1b[36m⏳\x1b[0m Restarting service... ${t}s`),await new Promise(e=>setTimeout(e,1e3));e.write(`\r\x1B[K`);let a=n,o=0,s=0;for(;a=5){e.write(`\r\x1B[K`),this.writeLine(e,``),this.writeSuccess(e,`Service is back online! (took ~${a}s)`),this.writeLine(e,``),t();return}}else s=0}catch(t){s=0;let n=t;n.code&&![`ERR_NETWORK`,`ECONNREFUSED`,`ECONNRESET`].includes(n.code)&&e.write(`[${n.code}] `)}await new Promise(e=>setTimeout(e,i*1e3)),a+=i}e.write(`\r\x1B[K`),this.writeLine(e,``),this.writeLine(e,`\x1B[33m⚠️ Service did not respond within 60 seconds\x1B[0m`),this.writeLine(e,``),this.writeInfo(e,`The service may still be starting. Try: status`),this.writeLine(e,``),t()}},Kh=class extends Ah{name=`ping`;description=`Ping a neighbor node to measure latency and signal quality`;usage=`ping [timeout_seconds]`;async execute({term:e,args:t,writePrompt:n}){if(t.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`),n();return}let r=t[0],i=t.length>1?parseInt(t[1]):10;if(isNaN(i)||i<1||i>60){this.writeError(e,`Invalid timeout. Must be between 1-60 seconds`),n();return}let a=null,o=r.match(/^(0x)?([0-9a-fA-F]{1,2})$/);if(o)a=`0x${o[2].padStart(2,`0`)}`;else{let t=this.startLoading(e,`Resolving target...`);try{let i=[`Chat Node`,`Repeater`,`Room Server`,`Hybrid Node`,`Unknown`],o=!1;for(let e of i)try{let t=await h.get(`/adverts_by_contact_type`,{contact_type:e,hours:168}),n=t.success&&t.data?t.data:t,i=(Array.isArray(n)?n:[]).find(e=>e.node_name&&e.node_name.toLowerCase()===r.toLowerCase());if(i&&i.pubkey){a=`0x${i.pubkey.substring(0,2)}`,o=!0;break}}catch{continue}if(t(),!o){this.writeError(e,`Node '${r}' not found in neighbors`),e.writeln(``),this.writeInfo(e,`Try: neighbors - to list available nodes`),n();return}}catch(r){t(),this.writeError(e,`Failed to resolve target: ${r}`),n();return}}this.writeLine(e,`\x1b[36mPinging ${r} (${a}) with ${i}s timeout...\x1b[0m`),e.writeln(``);let s=this.startLoading(e,`Waiting for response...`);try{let t=await h.pingNeighbor(a,i);if(s(),t.success&&t.data){let n=t.data;this.writeSuccess(e,`Reply from ${r} (${n.target_id})`),e.writeln(``);let i=`\x1B[32m`;if(n.rtt_ms>500?i=`\x1B[31m`:n.rtt_ms>250&&(i=`\x1B[33m`),e.writeln(` \x1b[1mRound-Trip Time:\x1b[0m ${i}${n.rtt_ms.toFixed(2)} ms\x1b[0m`),e.writeln(` \x1b[1mRSSI:\x1b[0m ${n.rssi} dBm`),e.writeln(` \x1b[1mSNR:\x1b[0m ${n.snr_db} dB`),n.path&&n.path.length>0){let t=n.path.join(` → `),r=n.path.length;e.writeln(` \x1b[1mPath:\x1b[0m ${t}`),e.writeln(` \x1b[1mHops:\x1b[0m ${r}`)}e.writeln(``);let a=`Excellent`,o=`\x1B[32m`;n.rtt_ms>500||n.rssi<-120?(a=`Poor`,o=`\x1B[31m`):n.rtt_ms>250||n.rssi<-100?(a=`Fair`,o=`\x1B[33m`):(n.rtt_ms>100||n.rssi<-80)&&(a=`Good`,o=`\x1B[36m`),e.writeln(` \x1b[1mLink Quality:\x1b[0m ${o}${a}\x1b[0m`)}else this.writeError(e,t.error||`Ping failed`)}catch(t){s(),this.writeError(e,`Ping failed: ${t.message||t}`)}e.writeln(``),n()}};async function qh(){try{let e=[`Chat Node`,`Repeater`,`Room Server`,`Hybrid Node`,`Unknown`],t=[];for(let n of e)try{let e=await h.get(`/adverts_by_contact_type`,{contact_type:n,hours:168}),r=e.success&&e.data?e.data:e;(Array.isArray(r)?r:[]).forEach(e=>{e.node_name&&!t.includes(e.node_name)&&t.push(e.node_name)})}catch{continue}return t.sort()}catch{return[]}}var Jh=class{commands=[];constructor(){let e=new Mh,t=new Nh,n=new Ph,r=new Fh,i=new Ih,a=new Lh,o=new Rh,s=new zh,c=new Bh,l=new Vh,u=new Hh,d=new Uh,f=new Wh,p=new Gh,m=new Kh;this.commands=[new jh([e,t,n,r,i,a,o,s,c,l,u,d,f,p,m]),e,t,n,r,i,a,o,s,c,l,u,d,f,p,m]}findCommand(e){return this.commands.find(t=>t.matches(e))}getAllCommands(){return this.commands}getCommandNames(){return this.commands.map(e=>e.name)}},Yh={class:`space-y-4 md:space-y-6`},Xh={class:`glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-3 md:p-4`},Zh={class:`flex items-center justify-between`},Qh={class:`flex items-center gap-2 md:gap-3`},$h=[`title`],eg={key:0,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},tg={key:1,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},ng={class:`hidden sm:inline`},rg=[`title`],ig={class:`hidden sm:inline`},ag=[`title`],og={key:0,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},sg={key:1,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},cg={class:`hidden sm:inline`},lg={key:0,class:`glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-4`},ug={class:`flex items-center gap-3`},dg=[`onKeydown`],fg={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`},pg=_(o({name:`TerminalView`,__name:`Terminal`,setup(o){let{theme:h}=v(),g={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`},_={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`},y=a(null),b=a(null),x=a(null),ee=a(``),te=a(!1),S=a(!1),C=a(!1),w=a(!1),T=a(!1);a(0);let E=null,D=null,ne=null,re=null,O=``,k=[],A=-1,j=``,ie=new Jh,ae=ie.getCommandNames(),oe=[],se=0,ce={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:[]},le={set:{mode:[`forward`,`monitor`],duty:[`on`,`off`]}},ue={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/no_tx)`,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:{}};n(()=>{if(!y.value)return;C.value=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),E=new ec({cursorBlink:!1,cursorStyle:`underline`,cursorWidth:3,fontFamily:`"JetBrains Mono", "Fira Code", Menlo, Monaco, "Courier New", monospace`,fontSize:window.innerWidth<768?11:13,fontWeight:`400`,fontWeightBold:`700`,lineHeight:1.3,letterSpacing:.5,smoothScrollDuration:50,scrollSensitivity:3,fastScrollSensitivity:5,allowProposedApi:!0,screenReaderMode:C.value,theme:h.value===`dark`?g:_,scrollback:C.value?500:1e4,tabStopWidth:4,macOptionIsMeta:!0}),D=new rc,E.loadAddon(D);try{re=new kh,E.loadAddon(re)}catch{console.warn(`WebGL addon failed to load, falling back to canvas renderer`),re=null}let e=new lc((e,t)=>{window.open(t,`_blank`)});E.loadAddon(e);let n=new Gu;if(E.loadAddon(n),E.unicode.activeVersion=`11`,ne=new Nl,E.loadAddon(ne),E.open(y.value),D.fit(),E.focus(),C.value&&b.value){let e=b.value,n=()=>{e.focus({preventScroll:!1})};y.value?.addEventListener(`click`,n),y.value?.addEventListener(`touchstart`,n),e.addEventListener(`input`,()=>{setTimeout(()=>{E?.scrollToBottom()},10)}),t(()=>{y.value?.removeEventListener(`click`,n),y.value?.removeEventListener(`touchstart`,n)})}let r=h.value===`dark`?`\x1B[1;37m`:`\x1B[1;90m`;h.value;let i=(h.value,`\x1B[90m`),a=`\x1B[0m`;E.writeln(``),E.writeln(`${r} ██████ ██ ██ ███ ███ ██████${a}`),E.writeln(`${r} ██ ██ ██ ██ ████ ████ ██ ${a}`),E.writeln(`${r} ██████ ████ ██ ████ ██ ██ ${a}`),E.writeln(`${r} ██ ██ ██ ██ ██ ██ ${a}`),E.writeln(`${r} ██ ██ ██ ██ ██████${a}`),E.writeln(``),E.writeln(` Repeater Terminal${a}`),E.writeln(``),E.writeln(`${i} Type help${i} for available commands${a}`),E.writeln(``),M(),E.onData(e=>{fe(e)});let o=new ResizeObserver(()=>{D?.fit()});o.observe(y.value),t(()=>{o.disconnect(),re?.dispose(),re=null,E?.dispose(),E=null})});let M=()=>{E?.write(`\r +\x1B[1;36m❯\x1B[0m `)},de=e=>{if(!(!E||!e)){E.write(`\x1b[90m${e}\x1b[0m`);for(let t=0;t{if(!(!E||!j)){for(let e=0;e{if(!E)return;let t=e.charCodeAt(0);if(t===13){N(),E.write(`\r +`),O.trim()?(me(O.trim()),k.push(O.trim()),A=k.length):M(),O=``;return}if(t===127){O.length>0&&(N(),O=O.slice(0,-1),E.write(`\b \b`),pe());return}if(t===3){N(),E.write(`^C\r +`),O=``,M();return}if(t===12){E.clear(),O=``,M();return}if(t===6){te.value=!te.value;return}if(e===`\x1B[A`){k.length>0&&A>0&&(N(),A--,E.write(`\r\x1B[K`),M(),O=k[A],E.write(O));return}if(e===`\x1B[B`){N(),A2&&le[n]){let e=t[1]?.toLowerCase(),r=t.slice(2).join(` `).toLowerCase(),i=le[n][e];if(i){let e=i.filter(e=>e.toLowerCase().startsWith(r));if(e.length===1){let n=t.slice(2).join(` `),r=e[0].slice(n.length);O+=r,E.write(r)}else e.length>1&&(E.write(`\r +\r +\x1B[33mAvailable values:\x1B[0m\r +\r +`),e.forEach(e=>{E.writeln(` \x1b[36m${e}\x1b[0m`)}),M(),E.write(O));return}}if(t.length>1&&ce[n]){if(n===`ping`){let e=t.slice(1).join(` `).toLowerCase(),n=Date.now();n-se>3e4&&qh().then(e=>{oe=e,se=n,ce.ping=e});let r=oe.filter(t=>t.toLowerCase().startsWith(e));if(r.length===1){let e=t.slice(1).join(` `),n=r[0].slice(e.length)+` `;O+=n,E.write(n)}else r.length>1?(E.write(`\r +\r +\x1B[33mAvailable neighbors:\x1B[0m\r +\r +`),r.forEach(e=>{E.writeln(` \x1b[36m${e}\x1b[0m`)}),M(),E.write(O)):oe.length===0&&e===``&&(E.write(`\r +\r +\x1B[33mFetching neighbors...\x1B[0m\r +`),qh().then(e=>{oe=e,se=n,ce.ping=e,E.write(`\r +\x1B[33mAvailable neighbors:\x1B[0m\r +\r +`),e.forEach(e=>{E.writeln(` \x1b[36m${e}\x1b[0m`)}),M(),E.write(O)}).catch(()=>{E.write(`\r +\x1B[31mFailed to fetch neighbors\x1B[0m\r +`),M(),E.write(O)}));return}let e=t.slice(1).join(` `).toLowerCase(),r=ce[n].filter(t=>t.toLowerCase().startsWith(e));if(r.length===1){let e=t.slice(1).join(` `),n=r[0].slice(e.length)+` `;O+=n,E.write(n)}else if(r.length>1){E.write(`\r +\r +\x1B[33mAvailable parameters:\x1B[0m\r +\r +`);let e=ue[n]||{};r.forEach(t=>{let n=e[t]||``,r=t.padEnd(20);E.writeln(` \x1b[36m${r}\x1b[0m\x1b[90m${n}\x1b[0m`)}),M(),E.write(O)}return}let r=ie.getAllCommands().filter(t=>!!(t.name.toLowerCase().startsWith(e)||t.aliases?.some(t=>t.toLowerCase().startsWith(e))));if(r.length===1){let e=r[0].name.slice(O.length)+` `;O+=e,E.write(e)}else r.length>1&&(E.write(`\r +\r +\x1B[33mAvailable commands:\x1B[0m\r +\r +`),r.forEach(e=>{let t=e.aliases&&e.aliases.length>0?` (${e.aliases.join(`, `)})`:``;E.writeln(` \x1b[36m${e.name.padEnd(15)}\x1b[0m ${e.description}${t}`)}),M(),E.write(O));return}t>=32&&t<127&&(N(),O+=e,E.write(e),C.value||pe())},pe=()=>{if(O.length===0){j=``;return}let e=ae.filter(e=>e.startsWith(O.toLowerCase()));e.length===1&&e[0]!==O?(j=e[0].slice(O.length),de(j)):j=``},me=async e=>{if(!E)return;let[t,...n]=e.trim().split(/\s+/),r=ie.findCommand(t);if(r)try{await r.execute({term:E,args:n,writePrompt:M})}catch(e){console.error(`Command execution error:`,e),E.writeln(`\x1b[1;31m✗ Error:\x1b[0m ${e instanceof Error?e.message:`Command failed`}`),M()}else E.writeln(`\x1b[1;31m✗ Unknown command:\x1b[0m ${t}`),E.writeln(`\x1B[90mType \x1B[36mhelp\x1B[90m for available commands\x1B[0m`),M()},he=()=>{!ne||!ee.value||ne.findNext(ee.value,{caseSensitive:!1})},ge=()=>{!ne||!ee.value||ne.findPrevious(ee.value,{caseSensitive:!1})},_e=()=>{te.value=!1,ee.value=``,E?.focus()},ve=async()=>{if(x.value){if(w.value)try{document.exitFullscreen&&await document.exitFullscreen(),w.value=!1}catch(e){console.error(`Failed to exit fullscreen:`,e)}else try{x.value.requestFullscreen&&await x.value.requestFullscreen(),w.value=!0,setTimeout(()=>{C.value&&b.value?b.value.focus():E&&E.focus()},100)}catch(e){console.error(`Failed to enter fullscreen:`,e)}setTimeout(()=>{D?.fit()},100)}},ye=()=>{T.value=!T.value,T.value&&C.value&&setTimeout(()=>{window.scrollTo(0,1)},100),setTimeout(()=>{C.value&&b.value?b.value.focus():E?.focus(),D?.fit()},150)},be=()=>{T.value=!1,setTimeout(()=>{D?.fit()},100)};r(h,e=>{E&&(E.options.theme=e===`dark`?g:_)}),typeof document<`u`&&(document.addEventListener(`fullscreenchange`,()=>{w.value=!!document.fullscreenElement,setTimeout(()=>D?.fit(),100)}),document.addEventListener(`keydown`,e=>{e.key===`Escape`&&T.value&&!w.value&&be()}),document.addEventListener(`keydown`,e=>{e.key===`Escape`&&T.value&&!w.value&&be()}));let xe=()=>{C.value&&b.value&&b.value.focus()},Se=e=>{let t=e.target,n=t.value;n&&E&&fe(n.slice(-1)),t.value=``},Ce=()=>{E&&fe(`\r`),b.value&&(b.value.value=``)},we=()=>{E&&fe(``),b.value&&(b.value.value=``)};return(t,n)=>(s(),u(`div`,Yh,[l(`div`,Xh,[l(`div`,Zh,[n[8]||=l(`div`,null,[l(`h1`,{class:`text-content-primary dark:text-content-primary text-lg md:text-xl font-semibold`},` Terminal `),l(`p`,{class:`text-content-secondary dark:text-content-muted text-sm hidden md:block`},` Interactive command-line interface `)],-1),l(`div`,Qh,[C.value?(s(),u(`button`,{key:0,onClick:ye,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:T.value?`Exit fullscreen`:`Enter fullscreen`},[T.value?(s(),u(`svg`,tg,[...n[3]||=[l(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`},null,-1)]])):(s(),u(`svg`,eg,[...n[2]||=[l(`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)]])),l(`span`,ng,e(T.value?`Exit`:`Fullscreen`),1)],8,$h)):c(``,!0),C.value?c(``,!0):(s(),u(`button`,{key:1,onClick:ye,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:T.value?`Exit full window`:`Full window`},[n[4]||=l(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[l(`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),l(`span`,ig,e(T.value?`Exit Window`:`Full Window`),1)],8,rg)),C.value?c(``,!0):(s(),u(`button`,{key:2,onClick:ve,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:w.value?`Exit fullscreen`:`Fullscreen`},[w.value?(s(),u(`svg`,sg,[...n[6]||=[l(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`},null,-1)]])):(s(),u(`svg`,og,[...n[5]||=[l(`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)]])),l(`span`,cg,e(w.value?`Exit Full`:`Fullscreen`),1)],8,ag)),l(`button`,{onClick:n[0]||=e=>te.value=!te.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`},[...n[7]||=[l(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[l(`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),l(`span`,{class:`hidden sm:inline`},`Search`,-1)]])])])]),te.value?(s(),u(`div`,lg,[l(`div`,ug,[i(l(`input`,{"onUpdate:modelValue":n[1]||=e=>ee.value=e,onKeydown:[f(he,[`enter`]),f(_e,[`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),[[p,ee.value]]),l(`button`,{onClick:ge,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)`},` ↑ `),l(`button`,{onClick:he,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)`},` ↓ `),l(`button`,{onClick:_e,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`},` ✕ `)])])):c(``,!0),l(`div`,{ref_key:`terminalContainerRef`,ref:x,class:d([`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":w.value,"full-window-terminal":T.value}])},[T.value&&!w.value?(s(),u(`button`,{key:0,onClick:be,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)`},[...n[9]||=[l(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[l(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])):c(``,!0),l(`div`,{ref_key:`terminalRef`,ref:y,class:d([`terminal-container`,{"fullscreen-content":w.value}]),onClick:xe,onTouchstart:xe},[C.value?(s(),u(`input`,{key:0,ref_key:`mobileInputRef`,ref:b,type:`text`,class:`mobile-keyboard-input`,onInput:Se,onKeydown:[f(m(Ce,[`prevent`]),[`enter`]),f(we,[`delete`])],inputmode:`text`,autocomplete:`off`,autocorrect:`off`,autocapitalize:`off`,spellcheck:`false`},null,40,dg)):c(``,!0)],34),S.value?(s(),u(`div`,fg,[...n[10]||=[l(`div`,{class:`w-2 h-2 bg-primary rounded-full animate-pulse`},null,-1),l(`span`,{class:`text-primary text-sm font-medium`},`Processing...`,-1)]])):c(``,!0)],2)]))}}),[[`__scopeId`,`data-v-7db8a6e5`]]);export{pg as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/Terminal-BVrSGxOT.js b/repeater/web/html/assets/Terminal-BVrSGxOT.js deleted file mode 100644 index 6323086..0000000 --- a/repeater/web/html/assets/Terminal-BVrSGxOT.js +++ /dev/null @@ -1,198 +0,0 @@ -import{Ct as e,D as t,E as n,R as r,V as i,Y as a,g as o,k as s,l as c,s as l,u,xt as d}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{t as f}from"./api-DBiYn0RS.js";import{t as p}from"./system-BfTzQTOF.js";import{t as m}from"./_plugin-vue_export-helper-TcpyXLsZ.js";import{t as h}from"./useTheme-D8lKuC-u.js";import{g,h as _,p as v}from"./index-CG181k2K.js";var y=Object.defineProperty,b=Object.getOwnPropertyDescriptor,ee=(e,t)=>{for(var n in t)y(e,n,{get:t[n],enumerable:!0})},x=(e,t,n,r)=>{for(var i=r>1?void 0:r?b(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&y(t,n,i),i},S=(e,t)=>(n,r)=>t(n,r,e),te=`Terminal input`,C={get:()=>te,set:e=>te=e},w=`Too much output to announce, navigate to rows manually to read`,T={get:()=>w,set:e=>w=e};function E(e){return e.replace(/\r?\n/g,`\r`)}function D(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function ne(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function re(e,t,n,r){e.stopPropagation(),e.clipboardData&&O(e.clipboardData.getData(`text/plain`),t,n,r)}function O(e,t,n,r){e=E(e),e=D(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function k(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function A(e,t,n,r,i){k(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function j(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function ie(e,t=0,n=e.length){let r=``;for(let i=t;i65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var ae=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},oe=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}else this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},se=``,ce=` `,le=class e{constructor(){this.fg=0,this.bg=0,this.extended=new ue}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 t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}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}},ue=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}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 e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},M=class e extends le{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ue,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?j(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 t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},de=`di$target`,fe=`di$dependencies`,pe=new Map;function me(e){return e[fe]||[]}function N(e){if(pe.has(e))return pe.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);he(t,e,r)};return t._id=e,pe.set(e,t),t}function he(e,t,n){t[de]===t?t[fe].push({id:e,index:n}):(t[fe]=[{id:e,index:n}],t[de]=t)}var ge=N(`BufferService`),_e=N(`CoreMouseService`),ve=N(`CoreService`),ye=N(`CharsetService`),be=N(`InstantiationService`),xe=N(`LogService`),Se=N(`OptionsService`),Ce=N(`OscLinkService`),we=N(`UnicodeService`),Te=N(`DecorationService`),Ee=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new M,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;ti?i.activate(e,t,a):De(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Ee=x([S(0,ge),S(1,Se),S(2,Ce)],Ee);function De(e,t){if(confirm(`Do you want to navigate to ${t}? - -WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var Oe=N(`CharSizeService`),ke=N(`CoreBrowserService`),Ae=N(`MouseService`),je=N(`RenderService`),Me=N(`SelectionService`),Ne=N(`CharacterJoinerService`),Pe=N(`ThemeService`),Fe=N(`LinkProviderService`),Ie=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?He.isErrorNoTelemetry(e)?new He(e.message+` - -`+e.stack):Error(e.message+` - -`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(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)}};function Le(e){ze(e)||Ie.onUnexpectedError(e)}var Re=`Canceled`;function ze(e){return e instanceof Be?!0:e instanceof Error&&e.name===Re&&e.message===Re}var Be=class extends Error{constructor(){super(Re),this.name=this.message}};function Ve(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var He=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},Ue=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function We(e,t,n=0,r=e.length){let i=n,a=r;for(;i{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(qe||={});function Je(e,t){return(n,r)=>t(e(n),e(r))}var Ye=(e,t)=>e-t,Xe=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>t(n)?e(n):!0))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>e(n)?(t=n,!1):!0),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||qe.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};Xe.empty=new Xe(e=>{});function Ze(e,t){let n=Object.create(null);for(let r of e){let e=t(r),i=n[e];i||=n[e]=[],i.push(r)}return n}var Qe=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){return this.map.get(e)||new Set}};function $e(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var et;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);tt.source!==null&&!this.getRootParent(t,e).isSingleton).flatMap(([e])=>e)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let e=new Map,t=[...this.livingDisposables.values()].filter(t=>t.source!==null&&!this.getRootParent(t,e).isSingleton);if(t.length===0)return;let r=new Set(t.map(e=>e.value));if(n=t.filter(e=>!(e.parent&&r.has(e.parent))),n.length===0)throw Error(`There are cyclic diposable chains!`)}if(!n)return;function r(e){function t(e,t){for(;e.length>0&&t.some(t=>typeof t==`string`?t===e[0]:e[0].match(t));)e.shift()}let n=e.source.split(` -`).map(e=>e.trim().replace(`at `,``)).filter(e=>e!==``);return t(n,[`Error`,/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),n.reverse()}let i=new Qe;for(let e of n){let t=r(e);for(let n=0;n<=t.length;n++)i.add(t.slice(0,n).join(` -`),e)}n.sort(Je(e=>e.idx,Ye));let a=``,o=0;for(let t of n.slice(0,e)){o++;let e=r(t),s=[];for(let t=0;tr(e)[t]),e=>e);delete o[e[t]];for(let[e,t]of Object.entries(o))s.unshift(` - stacktraces of ${t.length} other leaks continue with ${e}`);s.unshift(a)}a+=` - - -==================== Leaking disposable ${o}/${n.length}: ${t.value.constructor.name} ==================== -${s.join(` -`)} -============================================================ - -`}return n.length>e&&(a+=` - - -... and ${n.length-e} more leaking disposables - -`),{leaks:n,details:a}}};rt.idx=0;function it(e){nt=e}if(tt){let e=`__is_disposable_tracked__`;it(new class{trackDisposable(t){let n=Error(`Potentially leaked disposable`).stack;setTimeout(()=>{t[e]||console.log(n)},3e3)}setParent(t,n){if(t&&t!==F.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==F.None)try{t[e]=!0}catch{}}markAsSingleton(e){}})}function at(e){return nt?.trackDisposable(e),e}function ot(e){nt?.markAsDisposed(e)}function st(e,t){nt?.setParent(e,t)}function ct(e,t){if(nt)for(let n of e)nt.setParent(n,t)}function lt(e){return nt?.markAsSingleton(e),e}function ut(e){if(et.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function dt(...e){let t=P(()=>ut(e));return ct(e,t),t}function P(e){let t=at({dispose:$e(()=>{ot(t),e()})});return t}var ft=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,at(this)}dispose(){this._isDisposed||(ot(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{ut(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return st(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(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(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),st(e,null))}};ft.DISABLE_DISPOSED_WARNING=!1;var pt=ft,F=class{constructor(){this._store=new pt,at(this),st(this._store,this)}dispose(){ot(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};F.None=Object.freeze({dispose(){}});var mt=class{constructor(){this._isDisposed=!1,at(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&st(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,ot(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&st(e,null),e}},ht=typeof window==`object`?window:globalThis,gt=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};gt.Undefined=new gt(void 0);var I=gt,_t=class{constructor(){this._first=I.Undefined,this._last=I.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===I.Undefined}clear(){let e=this._first;for(;e!==I.Undefined;){let t=e.next;e.prev=I.Undefined,e.next=I.Undefined,e=t}this._first=I.Undefined,this._last=I.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new I(e);if(this._first===I.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==I.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==I.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==I.Undefined&&e.next!==I.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===I.Undefined&&e.next===I.Undefined?(this._first=I.Undefined,this._last=I.Undefined):e.next===I.Undefined?(this._last=this._last.prev,this._last.next=I.Undefined):e.prev===I.Undefined&&(this._first=this._first.next,this._first.prev=I.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==I.Undefined;)yield e.element,e=e.next}},vt=globalThis.performance&&typeof globalThis.performance.now==`function`,yt=class e{static create(t){return new e(t)}constructor(e){this._now=vt&&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._now()-this._startTime:this._stopTime-this._startTime}},bt=!1,xt=!1,St=!1,Ct;(e=>{e.None=()=>F.None;function t(e){if(St){let{onDidAddListener:t}=e,n=kt.create(),r=0;e.onDidAddListener=()=>{++r===2&&(console.warn(`snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here`),n.print()),t?.()}}}function n(e,t){return f(e,()=>{},0,void 0,!0,void 0,t)}e.defer=n;function r(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=r;function i(e,t,n){return u((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=i;function a(e,t,n){return u((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=a;function o(e,t,n){return u((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=o;function s(e){return e}e.signal=s;function c(...e){return(t,n=null,r)=>d(dt(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=c;function l(e,t,n,r){let a=n;return i(e,e=>(a=t(a,e),a),r)}e.reduce=l;function u(e,n){let r,i={onWillAddFirstListener(){r=e(a.fire,a)},onDidRemoveLastListener(){r?.dispose()}};n||t(i);let a=new L(i);return n?.add(a),a.event}function d(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function f(e,n,r=100,i=!1,a=!1,o,s){let c,l,u,d=0,f,p={leakWarningThreshold:o,onWillAddFirstListener(){c=e(e=>{d++,l=n(l,e),i&&!u&&(m.fire(l),l=void 0),f=()=>{let e=l;l=void 0,u=void 0,(!i||d>1)&&m.fire(e),d=0},typeof r==`number`?(clearTimeout(u),u=setTimeout(f,r)):u===void 0&&(u=0,queueMicrotask(f))})},onWillRemoveListener(){a&&d>0&&f?.()},onDidRemoveLastListener(){f=void 0,c.dispose()}};s||t(p);let m=new L(p);return s?.add(m),m.event}e.debounce=f;function p(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=p;function m(e,t=(e,t)=>e===t,n){let r=!0,i;return o(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=m;function h(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=h;function g(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new L({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=g;function _(e,t){return(n,r,i)=>{let a=t(new y);return e(function(e){let t=a.evaluate(e);t!==v&&n.call(r,t)},void 0,i)}}e.chain=_;let v=Symbol(`HaltChainable`);class y{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:v),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:v}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===v)break;return e}}function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new L({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=b;function ee(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new L({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=ee;function x(e){return new Promise(t=>r(e)(t))}e.toPromise=x;function S(e){let t=new L;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function te(e,t){return e(e=>t.fire(e))}e.forward=te;function C(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=C;class w{constructor(e,n){this._observable=e,this._counter=0,this._hasChanged=!1;let r={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};n||t(r),this.emitter=new L(r),n&&n.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function T(e,t){return new w(e,t).emitter.event}e.fromObservable=T;function E(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof pt?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=E})(Ct||={});var wt=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new yt,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}}};wt.all=new Set,wt._idPool=0;var Tt=wt,Et=-1,Dt=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t{if(e instanceof Nt)t(e);else for(let n=0;n{e.length!==0&&(console.warn(`[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:`),console.warn(e.join(` -`)),e.length=0)},3e3),It=new FinalizationRegistry(t=>{typeof t==`string`&&e.push(t)})}var L=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Et>0||this._options?.leakWarningThreshold?new Ot(e?.onListenerError??Le,this._options?.leakWarningThreshold??Et):void 0,this._perfMon=this._options?._profName?new Tt(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(xt){let e=this._listeners;queueMicrotask(()=>{Ft(e,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new jt(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||Le)(n),F.None}if(this._disposed)return F.None;t&&(e=e.bind(t));let r=new Nt(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=kt.create(),i=this._leakageMon.check(r.stack,this._size+1)),xt&&(r.stack=kt.create()),this._listeners?this._listeners instanceof Nt?(this._deliveryQueue??=new Lt,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=P(()=>{It?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof pt?n.add(a):Array.isArray(n)&&n.push(a),It){let e=Error().stack.split(` -`).slice(2,3).join(` -`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);It.register(a,t?.[2]??e,a)}return a},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 t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Pt<=t.length){let e=0;for(let n=0;n0}},Lt=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Rt=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new L,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new L,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Rt.INSTANCE=new Rt;var zt=Rt;function Bt(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}zt.INSTANCE.onDidChangeZoomLevel;function Vt(e){return zt.INSTANCE.getZoomFactor(e)}zt.INSTANCE.onDidChangeFullscreen;var Ht=typeof navigator==`object`?navigator.userAgent:``,Ut=Ht.indexOf(`Firefox`)>=0,Wt=Ht.indexOf(`AppleWebKit`)>=0,Gt=Ht.indexOf(`Chrome`)>=0,Kt=!Gt&&Ht.indexOf(`Safari`)>=0;Ht.indexOf(`Electron/`),Ht.indexOf(`Android`);var qt=!1;if(typeof ht.matchMedia==`function`){let e=ht.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=ht.matchMedia(`(display-mode: fullscreen)`);qt=e.matches,Bt(ht,e,({matches:e})=>{qt&&t.matches||(qt=e)})}function Jt(){return qt}var Yt=`en`,Xt=!1,Zt=!1,Qt=!1,$t=!1,en=!1,tn=Yt,nn,rn=globalThis,an;typeof rn.vscode<`u`&&typeof rn.vscode.process<`u`?an=rn.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(an=process);var on=typeof an?.versions?.electron==`string`&&an?.type===`renderer`;if(typeof an==`object`){Xt=an.platform===`win32`,Zt=an.platform===`darwin`,Qt=an.platform===`linux`,Qt&&an.env.SNAP&&an.env.SNAP_REVISION,an.env.CI||an.env.BUILD_ARTIFACTSTAGINGDIRECTORY,tn=Yt;let e=an.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,tn=t.resolvedLanguage||Yt,t.languagePack?.translationsConfigFile}catch{}$t=!0}else typeof navigator==`object`&&!on?(nn=navigator.userAgent,Xt=nn.indexOf(`Windows`)>=0,Zt=nn.indexOf(`Macintosh`)>=0,(nn.indexOf(`Macintosh`)>=0||nn.indexOf(`iPad`)>=0||nn.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,Qt=nn.indexOf(`Linux`)>=0,nn?.indexOf(`Mobi`),en=!0,tn=globalThis._VSCODE_NLS_LANGUAGE||Yt,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var sn=Xt,cn=Zt,ln=Qt,un=$t;en&&typeof rn.importScripts==`function`&&rn.origin;var dn=nn,fn=tn,pn;(e=>{function t(){return fn}e.value=t;function n(){return fn.length===2?fn===`en`:fn.length>=3?fn[0]===`e`&&fn[1]===`n`&&fn[2]===`-`:!1}e.isDefaultVariant=n;function r(){return fn===`en`}e.isDefault=r})(pn||={});var mn=typeof rn.postMessage==`function`&&!rn.importScripts;(()=>{if(mn){let e=[];rn.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n{let r=++t;e.push({id:r,callback:n}),rn.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var hn=!!(dn&&dn.indexOf(`Chrome`)>=0);dn&&dn.indexOf(`Firefox`),!hn&&dn&&dn.indexOf(`Safari`),dn&&dn.indexOf(`Edg/`),dn&&dn.indexOf(`Android`);var gn=typeof navigator==`object`?navigator:{};un||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||gn&&gn.clipboard&&gn.clipboard.writeText,un||gn&&gn.clipboard&&gn.clipboard.readText,un||Jt()||gn.keyboard,`ontouchstart`in ht||gn.maxTouchPoints,ht.PointerEvent&&(`ontouchstart`in ht||navigator.maxTouchPoints);var _n=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},vn=new _n,yn=new _n,bn=new _n,xn=Array(230),Sn;(e=>{function t(e){return vn.keyCodeToStr(e)}e.toString=t;function n(e){return vn.strToKeyCode(e)}e.fromString=n;function r(e){return yn.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return bn.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return yn.strToKeyCode(e)||bn.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return vn.keyCodeToStr(e)}e.toElectronAccelerator=o})(Sn||={});var Cn=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new wn([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},wn=class{constructor(e){if(e.length===0)throw Ve(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t{function t(t){return t===e.None||t===e.Cancelled||t instanceof Rn?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ct.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:In})})(Ln||={});var Rn=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?In:(this._emitter||=new L,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},zn=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e==`function`&&typeof t==`number`&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Ue(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Ue(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},Bn=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new Ue(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=P(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var Vn;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(Vn||={});var Hn=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new L,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.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(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.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())}};Hn.EMPTY=Hn.fromArray([]);function Un(e){return 55296<=e&&e<=56319}function Wn(e){return 56320<=e&&e<=57343}function Gn(e,t){return(e-55296<<10)+(t-56320)+65536}function Kn(e){return qn(e,0)}function qn(e,t){switch(typeof e){case`object`:return e===null?Jn(349,t):Array.isArray(e)?Zn(e,t):Qn(e,t);case`string`:return Xn(e,t);case`boolean`:return Yn(e,t);case`number`:return Jn(e,t);case`undefined`:return Jn(937,t);default:return Jn(617,t)}}function Jn(e,t){return(t<<5)-t+e|0}function Yn(e,t){return Jn(e?433:863,t)}function Xn(e,t){t=Jn(149417,t);for(let n=0,r=e.length;nqn(t,e),t)}function Qn(e,t){return t=Jn(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=Xn(n,t),qn(e[n],t)),t)}function $n(e,t,n=32){let r=n-t,i=~((1<>>r)>>>0}function er(e,t=0,n=e.byteLength,r=0){for(let i=0;ie.toString(16).padStart(2,`0`)).join(``):tr((e>>>0).toString(16),t/4)}var rr=class e{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){let t=e.length;if(t===0)return;let n=this._buff,r=this._buffLen,i=this._leftoverHighSurrogate,a,o;for(i===0?(a=e.charCodeAt(0),o=0):(a=i,o=-1,i=0);;){let s=a;if(Un(a))if(o+1>>6,e[t++]=128|(n&63)>>>0):n<65536?(e[t++]=224|(n&61440)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0):(e[t++]=240|(n&1835008)>>>18,e[t++]=128|(n&258048)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),nr(this._h0)+nr(this._h1)+nr(this._h2)+nr(this._h3)+nr(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,er(this._buff,this._buffLen),this._buffLen>56&&(this._step(),er(this._buff));let e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){let t=e._bigBlock32,n=this._buffDV;for(let e=0;e<64;e+=4)t.setUint32(e,n.getUint32(e,!1),!1);for(let e=64;e<320;e+=4)t.setUint32(e,$n(t.getUint32(e-12,!1)^t.getUint32(e-32,!1)^t.getUint32(e-56,!1)^t.getUint32(e-64,!1),1),!1);let r=this._h0,i=this._h1,a=this._h2,o=this._h3,s=this._h4,c,l,u;for(let e=0;e<80;e++)e<20?(c=i&a|~i&o,l=1518500249):e<40?(c=i^a^o,l=1859775393):e<60?(c=i&a|i&o|a&o,l=2400959708):(c=i^a^o,l=3395469782),u=$n(r,5)+c+s+l+t.getUint32(e*4,!1)&4294967295,s=o,o=a,a=$n(i,30),i=r,r=u;this._h0=this._h0+r&4294967295,this._h1=this._h1+i&4294967295,this._h2=this._h2+a&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+s&4294967295}};rr._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:ir,getWindow:ar,getDocument:or,getWindows:sr,getWindowsCount:cr,getWindowId:lr,getWindowById:ur,hasWindow:dr,onDidRegisterWindow:fr,onWillUnregisterWindow:pr,onDidUnregisterWindow:mr}=function(){let e=new Map,t={window:ht,disposables:new pt};e.set(ht.vscodeWindowId,t);let n=new L,r=new L,i=new L;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return F.None;let a=new pt,o={window:t,disposables:a.add(new pt)};return e.set(t.vscodeWindowId,o),a.add(P(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(R(t,wr.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:ht},getDocument(e){return ar(e).document}}}(),hr=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,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,null)}};function R(e,t,n,r){return new hr(e,t,n,r)}function gr(e,t){return function(n){return t(new Pn(e,n))}}function _r(e){return function(t){return e(new An(t))}}var vr=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=gr(ar(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=_r(n)),R(e,t,i,r)},yr,br=class extends Bn{constructor(e){super(),this.defaultTarget=e&&ar(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},xr=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Le(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(xr.sort),a.shift().execute();r.set(i,!1)};yr=(t,r,a=0)=>{let o=lr(t),s=new xr(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})();var Sr=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};Sr.None=new Sr(0,0);function Cr(e){let t=e.getBoundingClientRect(),n=ar(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=Kn(n),a=r.get(i);if(a)a.users+=1;else{let o=new L,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(P(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var wr={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:Wt?`webkitAnimationStart`:`animationstart`,ANIMATION_END:Wt?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:Wt?`webkitAnimationIteration`:`animationiteration`},Tr=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function Er(e,t,n,...r){let i=Tr.exec(t);if(!i)throw Error(`Bad use of emmet`);let a=i[1]||`div`,o;return o=e===`http://www.w3.org/1999/xhtml`?document.createElement(a):document.createElementNS(e,a),i[3]&&(o.id=i[3]),i[4]&&(o.className=i[4].replace(/\./g,` `).trim()),n&&Object.entries(n).forEach(([e,t])=>{typeof t>`u`||(/^on\w+$/.test(e)?o[e]=t:e===`selected`?t&&o.setAttribute(e,`true`):o.setAttribute(e,t))}),o.append(...r),o}function Dr(e,t,...n){return Er(`http://www.w3.org/1999/xhtml`,e,t,...n)}Dr.SVG=function(e,t,...n){return Er(`http://www.w3.org/2000/svg`,e,t,...n)};var Or=class{constructor(e){this.domNode=e,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(e){let t=kr(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=kr(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=kr(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=kr(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=kr(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=kr(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=kr(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=kr(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=kr(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=kr(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=kr(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=kr(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=kr(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=kr(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?`translate3d(0px, 0px, 0px)`:``)}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function kr(e){return typeof e==`number`?`${e}px`:e}function Ar(e){return new Or(e)}var jr=class{constructor(){this._hooks=new pt,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add(P(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=ar(e)}this._hooks.add(R(a,wr.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(R(a,wr.POINTER_UP,e=>this.stopMonitoring(!0)))}};function Mr(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}var Nr;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(Nr||={});var Pr=class e extends F{constructor(){super(),this.dispatched=!1,this.targets=new _t,this.ignoreTargets=new _t,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Ct.runAndSubscribe(fr,({window:e,disposables:t})=>{t.add(R(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(R(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(R(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:ht,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=lt(new e),P(e.INSTANCE.targets.push(t))):F.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=lt(new e),P(e.INSTANCE.ignoreTargets.push(t))):F.None}static isTouchDevice(){return`ontouchstart`in ht||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n=e.HOLD_DELAY&&Math.abs(s.initialPageX-Ke(s.rollingPageX))<30&&Math.abs(s.initialPageY-Ke(s.rollingPageY))<30){let e=this.newGestureEvent(Nr.Contextmenu,s.initialTarget);e.pageX=Ke(s.rollingPageX),e.pageY=Ke(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=Ke(s.rollingPageX),n=Ke(s.rollingPageY),i=Ke(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(Nr.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===Nr.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else (t.type===Nr.Change||t.type===Nr.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=yr(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(Nr.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}};Pr.SCROLL_FRICTION=-.005,Pr.HOLD_DELAY=700,Pr.CLEAR_TAP_COUNT_TIME=400,x([Mr],Pr,`isTouchDevice`,1);var Fr=Pr,Ir=class extends F{onclick(e,t){this._register(R(e,wr.CLICK,n=>t(new Pn(ar(e),n))))}onmousedown(e,t){this._register(R(e,wr.MOUSE_DOWN,n=>t(new Pn(ar(e),n))))}onmouseover(e,t){this._register(R(e,wr.MOUSE_OVER,n=>t(new Pn(ar(e),n))))}onmouseleave(e,t){this._register(R(e,wr.MOUSE_LEAVE,n=>t(new Pn(ar(e),n))))}onkeydown(e,t){this._register(R(e,wr.KEY_DOWN,e=>t(new An(e))))}onkeyup(e,t){this._register(R(e,wr.KEY_UP,e=>t(new An(e))))}oninput(e,t){this._register(R(e,wr.INPUT,t))}onblur(e,t){this._register(R(e,wr.BLUR,t))}onfocus(e,t){this._register(R(e,wr.FOCUS,t))}onchange(e,t){this._register(R(e,wr.CHANGE,t))}ignoreGesture(e){return Fr.ignoreTarget(e)}},Lr=11,Rr=class extends Ir{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement(`div`),this.bgDomNode.className=`arrow-background`,this.bgDomNode.style.position=`absolute`,this.bgDomNode.style.width=e.bgWidth+`px`,this.bgDomNode.style.height=e.bgHeight+`px`,typeof e.top<`u`&&(this.bgDomNode.style.top=`0px`),typeof e.left<`u`&&(this.bgDomNode.style.left=`0px`),typeof e.bottom<`u`&&(this.bgDomNode.style.bottom=`0px`),typeof e.right<`u`&&(this.bgDomNode.style.right=`0px`),this.domNode=document.createElement(`div`),this.domNode.className=e.className,this.domNode.style.position=`absolute`,this.domNode.style.width=Lr+`px`,this.domNode.style.height=Lr+`px`,typeof e.top<`u`&&(this.domNode.style.top=e.top+`px`),typeof e.left<`u`&&(this.domNode.style.left=e.left+`px`),typeof e.bottom<`u`&&(this.domNode.style.bottom=e.bottom+`px`),typeof e.right<`u`&&(this.domNode.style.right=e.right+`px`),this._pointerMoveMonitor=this._register(new jr),this._register(vr(this.bgDomNode,wr.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(vr(this.domNode,wr.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new br),this._pointerdownScheduleRepeatTimer=this._register(new zn)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,ar(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},zr=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}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(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<`u`?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<`u`?t.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,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:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},Br=class extends F{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new L),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new zr(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>`u`?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>`u`?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new Wr(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=Wr.start(this._state,t,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 e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},Vr=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function Hr(e,t){let n=t-e;return function(t){return e+n*Kr(t)}}function Ur(e,t,n){return function(r){return r2.5*n){let r,i;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`:``)))}},Jr=140,Yr=class extends Ir{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 qr(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new jr),this._shouldRender=!0,this.domNode=Ar(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(R(this.domNode.domNode,wr.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new Rr(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=Ar(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register(R(this.slider.domNode,wr.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.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 t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=Cr(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);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 t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if(sn&&a>Jr){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName(`active`,!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},Xr=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize===t?!1:(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize===t?!1:(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition===t?!1:(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.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 t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};ri.INSTANCE=new ri;var ii=ri,ai=class extends Ir{constructor(e,t,n){super(),this._onScroll=this._register(new L),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new L),this.onWillScroll=this._onWillScroll.event,this._options=si(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Qr(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new Zr(this._scrollable,this._options,r)),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(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Ar(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Ar(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Ar(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,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new zn),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ut(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,cn&&(this._options.className+=` mac`),this._domNode.className=`xterm-scrollable-element `+this._options.className}updateOptions(e){typeof e.handleMouseWheel<`u`&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<`u`&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<`u`&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<`u`&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<`u`&&(this._options.horizontal=e.horizontal),typeof e.vertical<`u`&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<`u`&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<`u`&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<`u`&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Fn(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=ut(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(R(this._listenOnDomNode,wr.MOUSE_WHEEL,e=>{this._onMouseWheel(new Fn(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=ii.INSTANCE;ti&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!cn&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=ei*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=ei*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(ti&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw 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 e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){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(),$r)}},oi=class extends ai{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function si(e){let t={lazyRender:typeof e.lazyRender<`u`?e.lazyRender:!1,className:typeof e.className<`u`?e.className:``,useShadows:typeof e.useShadows<`u`?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<`u`?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<`u`?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<`u`?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<`u`?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<`u`?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<`u`?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<`u`?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<`u`?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<`u`?e.listenOnDomNode:null,horizontal:typeof e.horizontal<`u`?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<`u`?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<`u`?e.horizontalHasArrows:!1,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,cn&&(t.className+=` mac`),t}var ci=class extends F{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new L),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new Br({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>yr(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new oi(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Ct.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(P(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(P(()=>this._styleElement.remove())),this._register(Ct.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.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(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,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 t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};ci=x([S(2,ge),S(3,ke),S(4,_e),S(5,Pe),S(6,Se),S(7,je)],ci);var li=class extends F{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,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(e=>this._removeDecoration(e))),this._register(P(()=>{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 t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:``:t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};li=x([S(1,ge),S(2,ke),S(3,Te),S(4,je)],li);var ui=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 t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},di={full:0,left:0,center:0,right:0},fi={full:0,left:0,center:0,right:0},pi={full:0,left:0,center:0,right:0},mi=class extends F{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new ui,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(P(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw 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),t=Math.ceil((this._canvas.width-1)/3);fi.full=this._canvas.width,fi.left=e,fi.center=t,fi.right=e,this._refreshDrawHeightConstants(),pi.full=1,pi.left=1,pi.center=1+fi.left,pi.right=1+fi.left+fi.center}_refreshDrawHeightConstants(){di.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);di.left=t,di.center=t,di.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*di.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*di.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*di.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*di.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 e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);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(pi[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-di[e.position||`full`]/2),fi[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+di[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};mi=x([S(2,ge),S(3,Te),S(4,je),S(5,Se),S(6,Pe),S(7,ke)],mi);var z;(e=>(e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=` -`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))(z||={});var hi;(e=>(e.PAD=`€`,e.HOP=``,e.BPH=`‚`,e.NBH=`ƒ`,e.IND=`„`,e.NEL=`…`,e.SSA=`†`,e.ESA=`‡`,e.HTS=`ˆ`,e.HTJ=`‰`,e.VTS=`Š`,e.PLD=`‹`,e.PLU=`Œ`,e.RI=``,e.SS2=`Ž`,e.SS3=``,e.DCS=``,e.PU1=`‘`,e.PU2=`’`,e.STS=`“`,e.CCH=`”`,e.MW=`•`,e.SPA=`–`,e.EPA=`—`,e.SOS=`˜`,e.SGCI=`™`,e.SCI=`š`,e.CSI=`›`,e.ST=`œ`,e.OSC=``,e.PM=`ž`,e.APC=`Ÿ`))(hi||={});var gi;(e=>e.ST=`${z.ESC}\\`)(gi||={});var _i=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,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 e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.lengththis.updateCompositionElements(!0),0)}}};_i=x([S(2,ge),S(3,Se),S(4,ve),S(5,je)],_i);var vi=0,yi=0,bi=0,B=0,xi={css:`#00000000`,rgba:0},V;(e=>{function t(e,t,n,r){return r===void 0?`#${wi(e)}${wi(t)}${wi(n)}`:`#${wi(e)}${wi(t)}${wi(n)}${wi(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(V||={});var H;(e=>{function t(e,t){if(B=(t.rgba&255)/255,B===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return vi=a+Math.round((n-a)*B),yi=o+Math.round((r-o)*B),bi=s+Math.round((i-s)*B),{css:V.toCss(vi,yi,bi),rgba:V.toRgba(vi,yi,bi)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=Ci.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return V.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[vi,yi,bi]=Ci.toChannels(t),{css:V.toCss(vi,yi,bi),rgba:t}}e.opaque=i;function a(e,t){return B=Math.round(t*255),[vi,yi,bi]=Ci.toChannels(e.rgba),{css:V.toCss(vi,yi,bi,B),rgba:V.toRgba(vi,yi,bi,B)}}e.opacity=a;function o(e,t){return B=e.rgba&255,a(e,B*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(H||={});var U;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return vi=parseInt(e.slice(1,2).repeat(2),16),yi=parseInt(e.slice(2,3).repeat(2),16),bi=parseInt(e.slice(3,4).repeat(2),16),V.toColor(vi,yi,bi);case 5:return vi=parseInt(e.slice(1,2).repeat(2),16),yi=parseInt(e.slice(2,3).repeat(2),16),bi=parseInt(e.slice(3,4).repeat(2),16),B=parseInt(e.slice(4,5).repeat(2),16),V.toColor(vi,yi,bi,B);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return vi=parseInt(r[1]),yi=parseInt(r[2]),bi=parseInt(r[3]),B=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),V.toColor(vi,yi,bi,B);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[vi,yi,bi,B]=t.getImageData(0,0,1,1).data,B!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:V.toRgba(vi,yi,bi,B),css:e}}e.toColor=r})(U||={});var Si;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(Si||={});var Ci;(e=>{function t(e,t){if(B=(t&255)/255,B===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return vi=a+Math.round((n-a)*B),yi=o+Math.round((r-o)*B),bi=s+Math.round((i-s)*B),V.toRgba(vi,yi,bi)}e.blend=t;function n(e,t,n){let a=Si.relativeLuminance(e>>8),o=Si.relativeLuminance(t>>8);if(Ti(a,o)>8));if(sTi(a,Si.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=Ti(a,Si.relativeLuminance(s>>8));if(cTi(a,Si.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=Ti(Si.relativeLuminance2(o,s,c),Si.relativeLuminance2(r,i,a));for(;l0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=Ti(Si.relativeLuminance2(o,s,c),Si.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=Ti(Si.relativeLuminance2(o,s,c),Si.relativeLuminance2(r,i,a));for(;l>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(Ci||={});function wi(e){let t=e.toString(16);return t.length<2?`0`+t:t}function Ti(e,t){return e1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t=w,O=D,k=this._workCell;if(f.length>0&&D===f[0][0]&&re){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v=r[1],re?(ne=!0,k=new Ei(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),O=r[1]-1,m=k.getWidth()):w=r[1]}let A=this._isCellInSelection(D,t),j=n&&D===a,ie=E&&D>=l&&D<=u,ae=!1;this._decorationService.forEachDecorationAtCell(D,t,void 0,e=>{ae=!0});let oe=k.getChars()||ce;if(oe===` `&&(k.isUnderline()||k.isOverline())&&(oe=`\xA0`),C=m*s-c.get(oe,k.isBold(),k.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(A&&te||!A&&!te&&k.bg===y)&&(A&&te&&p.selectionForeground||k.fg===b)&&k.extended.ext===ee&&ie===x&&C===S&&!j&&!ne&&!ae&&re){k.isInvisible()?_+=ce:_+=oe,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=k.bg,b=k.fg,ee=k.extended.ext,x=ie,S=C,te=A,ne&&a>=D&&a<=O&&(a=D),!this._coreService.isCursorHidden&&j&&this._coreService.isCursorInitialized){if(T.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&T.push(`xterm-cursor-blink`),T.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:T.push(`xterm-cursor-outline`);break;case`block`:T.push(`xterm-cursor-block`);break;case`bar`:T.push(`xterm-cursor-bar`);break;case`underline`:T.push(`xterm-cursor-underline`);break;default:break}}if(k.isBold()&&T.push(`xterm-bold`),k.isItalic()&&T.push(`xterm-italic`),k.isDim()&&T.push(`xterm-dim`),_=k.isInvisible()?ce:k.getChars()||ce,k.isUnderline()&&(T.push(`xterm-underline-${k.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!k.isUnderlineColorDefault()))if(k.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${le.toColorRGB(k.getUnderlineColor()).join(`,`)})`;else{let e=k.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&k.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}k.isOverline()&&(T.push(`xterm-overline`),_===` `&&(_=`\xA0`)),k.isStrikethrough()&&T.push(`xterm-strikethrough`),ie&&(h.style.textDecoration=`underline`);let se=k.getFgColor(),ue=k.getFgColorMode(),M=k.getBgColor(),de=k.getBgColorMode(),fe=!!k.isInverse();if(fe){let e=se;se=M,M=e;let t=ue;ue=de,de=t}let pe,me,N=!1;this._decorationService.forEachDecorationAtCell(D,t,void 0,e=>{e.options.layer!==`top`&&N||(e.backgroundColorRGB&&(de=50331648,M=e.backgroundColorRGB.rgba>>8&16777215,pe=e.backgroundColorRGB),e.foregroundColorRGB&&(ue=50331648,se=e.foregroundColorRGB.rgba>>8&16777215,me=e.foregroundColorRGB),N=e.options.layer===`top`)}),!N&&A&&(pe=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,M=pe.rgba>>8&16777215,de=50331648,N=!0,p.selectionForeground&&(ue=50331648,se=p.selectionForeground.rgba>>8&16777215,me=p.selectionForeground)),N&&T.push(`xterm-decoration-top`);let he;switch(de){case 16777216:case 33554432:he=p.ansi[M],T.push(`xterm-bg-${M}`);break;case 50331648:he=V.toColor(M>>16,M>>8&255,M&255),this._addStyle(h,`background-color:#${Pi((M>>>0).toString(16),`0`,6)}`);break;default:fe?(he=p.foreground,T.push(`xterm-bg-257`)):he=p.background}switch(pe||k.isDim()&&(pe=H.multiplyOpacity(he,.5)),ue){case 16777216:case 33554432:k.isBold()&&se<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(se+=8),this._applyMinimumContrast(h,he,p.ansi[se],k,pe,void 0)||T.push(`xterm-fg-${se}`);break;case 50331648:let e=V.toColor(se>>16&255,se>>8&255,se&255);this._applyMinimumContrast(h,he,e,k,pe,me)||this._addStyle(h,`color:#${Pi(se.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,he,p.foreground,k,pe,me)||fe&&T.push(`xterm-fg-257`)}T.length&&=(h.className=T.join(` `),0),!j&&!ne&&!ae&&re?g++:h.textContent=_,C!==this.defaultSpacing&&(h.style.letterSpacing=`${C}px`),d.push(h),D=O}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||Ai(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=H.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t=n[0]&&e=n[0]}};Ni=x([S(1,Ne),S(2,Se),S(3,ke),S(4,ve),S(5,Te),S(6,Pe)],Ni);function Pi(e,t,n){for(;e.length0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},Ii=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,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n=this.startCol&&t=this.startCol):!1}};function Li(){return new Ii}var Ri=`xterm-dom-renderer-owner-`,zi=`xterm-rows`,Bi=`xterm-fg-`,Vi=`xterm-bg-`,Hi=`xterm-focus`,Ui=`xterm-selection`,Wi=1,Gi=class extends F{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=Wi++,this._rowElements=[],this._selectionRenderModel=Li(),this.onRequestRedraw=this._register(new L).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(zi),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(Ui),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=ji(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(Ni,document),this._element.classList.add(Ri+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(P(()=>{this._element.classList.remove(Ri+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Fi(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 e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${zi} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,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 t=`${this._terminalSelector} .${zi} { 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}`;t+=`${this._terminalSelector} .${zi} .xterm-dim { color: ${H.multiplyOpacity(e.foreground,.5).css};}`,t+=`${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 n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${zi}.${Hi} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${zi}.${Hi} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${zi}.${Hi} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${zi} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${zi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${zi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${zi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${zi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Ui} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Ui} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Ui} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${Bi}${n} { color: ${r.css}; }${this._terminalSelector} .${Bi}${n}.xterm-dim { color: ${H.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${Vi}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${Bi}257 { color: ${H.opaque(e.background).css}; }${this._terminalSelector} .${Bi}257.xterm-dim { color: ${H.multiplyOpacity(H.opaque(e.background),.5).css}; }${this._terminalSelector} .${Vi}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_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,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),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(Hi),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Hi),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}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,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Ri}${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,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};Gi=x([S(7,be),S(8,Oe),S(9,Se),S(10,ge),S(11,ve),S(12,ke),S(13,Pe)],Gi);var Ki=class extends F{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new L),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Yi(this._optionsService))}catch{this._measureStrategy=this._register(new Ji(e,t,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())}};Ki=x([S(2,Se)],Ki);var qi=class extends F{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},Ji=class extends qi{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,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}},Yi=class extends qi{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw 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}},Xi=class extends F{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Zi(this._window)),this._onDprChange=this._register(new L),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new L),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(Ct.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(R(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(R(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}},Zi=class extends F{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new mt),this._onDprChange=this._register(new L),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(P(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=R(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)}},Qi=class extends F{constructor(){super(),this.linkProviders=[],this._register(P(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function $i(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function ea(e,t,n,r,i,a,o,s,c){if(!a)return;let l=$i(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+(c?1:0)),l[1]=Math.min(Math.max(l[1],1),i),l}var ta=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return ea(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=$i(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};ta=x([S(0,je),S(1,Oe)],ta);var na=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),!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),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},ra={};ee(ra,{getSafariVersion:()=>ua,isChromeOS:()=>ga,isFirefox:()=>sa,isIpad:()=>fa,isIphone:()=>pa,isLegacyEdge:()=>ca,isLinux:()=>ha,isMac:()=>da,isNode:()=>ia,isSafari:()=>la,isWindows:()=>ma});var ia=typeof process<`u`&&`title`in process,aa=ia?`node`:navigator.userAgent,oa=ia?`node`:navigator.platform,sa=aa.includes(`Firefox`),ca=aa.includes(`Edge`),la=/^((?!chrome|android).)*safari/i.test(aa);function ua(){if(!la)return 0;let e=aa.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var da=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(oa),fa=oa===`iPad`,pa=oa===`iPhone`,ma=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(oa),ha=oa.indexOf(`Linux`)>=0,ga=/\bCrOS\b/.test(aa),_a=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._ii){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},va=class extends _a{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},ya=class extends _a{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},ba=!ia&&`requestIdleCallback`in window?ya:va,xa=class{constructor(){this._queue=new ba}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Sa=class extends F{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new mt),this._pausedResizeTask=new xa,this._observerDisposable=this._register(new mt),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 L),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new L),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new L),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new L),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new na((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Ca(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(P(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=P(()=>n.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,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,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(e=>this.refreshRows(e.start,e.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,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Sa=x([S(2,Se),S(3,Oe),S(4,ve),S(5,Te),S(6,ge),S(7,ke),S(8,Pe)],Sa);var Ca=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,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 e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function wa(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return Da(i,a,e,t,n,r)+Oa(a,t,n,r)+ka(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,Ia(Math.abs(i-e),Fa(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return Ia(Ea(a>t?e:i,n)+(s-1)*n.cols+1+Ta(a>t?i:e,n),Fa(o,r))}function Ta(e,t){return e-1}function Ea(e,t){return t.cols-e}function Da(e,t,n,r,i,a){return Oa(t,r,i,a).length===0?``:Ia(Pa(e,t,e,t-ja(t,i),!1,i).length,Fa(`D`,a))}function Oa(e,t,n,r){let i=e-ja(e,n),a=t-ja(t,n);return Ia(Math.abs(i-a)-Aa(e,t,n),Fa(Na(e,t),r))}function ka(e,t,n,r,i,a){let o;o=Oa(t,r,i,a).length>0?r-ja(r,i):t;let s=r,c=Ma(e,t,n,r,i,a);return Ia(Pa(e,o,n,s,c===`C`,i).length,Fa(c,a))}function Aa(e,t,n){let r=0,i=e-ja(e,n),a=t-ja(t,n);for(let o=0;o=0&&e0?r-ja(r,i):t,e=n&&ot?`A`:`B`}function Pa(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&sa.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function Fa(e,t){let n=t?`O`:`[`;return z.ESC+n+e}function Ia(e,t){e=Math.floor(e);let n=``;for(let r=0;rthis._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Ra(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var za=50,Ba=15,Va=50,Ha=500,Ua=RegExp(`\xA0`,`g`),Wa=class extends F{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new M,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new L),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new L),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new L),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new L),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new La(this._bufferService),this._activeSelectionMode=0,this._register(P(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.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,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]e.replace(Ua,` `)).join(ma?`\r -`:` -`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),ha&&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 t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]=t[0]&&e[0]=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=Ra(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=$i(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-za),za),t/=za,t/Math.abs(t)+Math.round(t*(Ba-1)))}shouldForceSelection(e){return da?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(),Va)}_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 t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(da&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=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 n=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 t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&tthis._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(!(!t&&o.slice(s,c).trim()===``)){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Ra(n,this._bufferService.cols)}};Wa=x([S(3,ge),S(4,ve),S(5,Ae),S(6,Se),S(7,je),S(8,ke)],Wa);var Ga=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Ka=class{constructor(){this._color=new Ga,this._css=new Ga}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},W=Object.freeze((()=>{let e=[U.toColor(`#2e3436`),U.toColor(`#cc0000`),U.toColor(`#4e9a06`),U.toColor(`#c4a000`),U.toColor(`#3465a4`),U.toColor(`#75507b`),U.toColor(`#06989a`),U.toColor(`#d3d7cf`),U.toColor(`#555753`),U.toColor(`#ef2929`),U.toColor(`#8ae234`),U.toColor(`#fce94f`),U.toColor(`#729fcf`),U.toColor(`#ad7fa8`),U.toColor(`#34e2e2`),U.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:V.toCss(r,i,a),rgba:V.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:V.toCss(n,n,n),rgba:V.toRgba(n,n,n)})}return e})()),qa=U.toColor(`#ffffff`),Ja=U.toColor(`#000000`),Ya=U.toColor(`#ffffff`),Xa=Ja,Za={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},Qa=qa,$a=class extends F{constructor(e){super(),this._optionsService=e,this._contrastCache=new Ka,this._halfContrastCache=new Ka,this._onChangeColors=this._register(new L),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:qa,background:Ja,cursor:Ya,cursorAccent:Xa,selectionForeground:void 0,selectionBackgroundTransparent:Za,selectionBackgroundOpaque:H.blend(Ja,Za),selectionInactiveBackgroundTransparent:Za,selectionInactiveBackgroundOpaque:H.blend(Ja,Za),scrollbarSliderBackground:H.opacity(qa,.2),scrollbarSliderHoverBackground:H.opacity(qa,.4),scrollbarSliderActiveBackground:H.opacity(qa,.5),overviewRulerBorder:qa,ansi:W.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 t=this._colors;if(t.foreground=G(e.foreground,qa),t.background=G(e.background,Ja),t.cursor=H.blend(t.background,G(e.cursor,Ya)),t.cursorAccent=H.blend(t.background,G(e.cursorAccent,Xa)),t.selectionBackgroundTransparent=G(e.selectionBackground,Za),t.selectionBackgroundOpaque=H.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=G(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=H.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?G(e.selectionForeground,xi):void 0,t.selectionForeground===xi&&(t.selectionForeground=void 0),H.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=H.opacity(t.selectionBackgroundTransparent,.3)),H.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=H.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=G(e.scrollbarSliderBackground,H.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=G(e.scrollbarSliderHoverBackground,H.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=G(e.scrollbarSliderActiveBackground,H.opacity(t.foreground,.5)),t.overviewRulerBorder=G(e.overviewRulerBorder,Qa),t.ansi=W.slice(),t.ansi[0]=G(e.black,W[0]),t.ansi[1]=G(e.red,W[1]),t.ansi[2]=G(e.green,W[2]),t.ansi[3]=G(e.yellow,W[3]),t.ansi[4]=G(e.blue,W[4]),t.ansi[5]=G(e.magenta,W[5]),t.ansi[6]=G(e.cyan,W[6]),t.ansi[7]=G(e.white,W[7]),t.ansi[8]=G(e.brightBlack,W[8]),t.ansi[9]=G(e.brightRed,W[9]),t.ansi[10]=G(e.brightGreen,W[10]),t.ansi[11]=G(e.brightYellow,W[11]),t.ansi[12]=G(e.brightBlue,W[12]),t.ansi[13]=G(e.brightMagenta,W[13]),t.ansi[14]=G(e.brightCyan,W[14]),t.ansi[15]=G(e.brightWhite,W[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;re.index-t.index),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},no={trace:0,debug:1,info:2,warn:3,error:4,off:5},ro=`xterm.js: `,io=class extends F{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),ao=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=no[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;tthis._length)for(let t=this._length;t=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;tthis._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-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,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*K+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*K+0]=e|2097152|t[2]<<22):this._data[e*K+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*K+0]>>22}hasWidth(e){return this._data[e*K+0]&12582912}getFg(e){return this._data[e*K+1]}getBg(e){return this._data[e*K+2]}hasContent(e){return this._data[e*K+0]&4194303}getCodePoint(e){let t=this._data[e*K+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*K+0]&2097152}getString(e){let t=this._data[e*K+0];return t&2097152?this._combined[e]:t&2097151?j(t&2097151):``}isProtected(e){return this._data[e*K+2]&536870912}loadCell(e,t){return so=e*K,t.content=this._data[so+0],t.fg=this._data[so+1],t.bg=this._data[so+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*K+0]=t.content,this._data[e*K+1]=t.fg,this._data[e*K+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*K+0]=t|n<<22,this._data[e*K+1]=r.fg,this._data[e*K+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*K+0];r&2097152?this._combined[e]+=j(t):r&2097151?(this._combined[e]=j(r&2097151)+j(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*K+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;rthis.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t=e&&delete this._extendedAttrs[n]}}return this.length=e,n*4*co=0;--e)if(this._data[e*K+0]&4194303)return e+(this._data[e*K+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*K+0]&4194303||this._data[e*K+2]&50331648)return e+(this._data[e*K+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t>22||1}return r&&r.push(t),i}};function uo(e,t,n,r,i,a){let o=[];for(let s=0;s=s&&r0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o}function fo(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;oho(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;sc&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function ho(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var go=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new L),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ut(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};go._nextId=1;var _o=go,vo={},yo=vo.B;vo[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:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},vo.A={"#":`£`},vo.B=void 0,vo[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},vo.C=vo[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},vo.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},vo.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},vo.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},vo.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},vo.E=vo[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},vo.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},vo.H=vo[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},vo[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var bo=4294967295,xo=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=q.clone(),this.savedCharset=yo,this.markers=[],this._nullCell=M.fromCharData([0,se,1,0]),this._whitespaceCell=M.fromCharData([0,ce,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new ba,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(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new ue),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new ue),this._whitespaceCell}getBlankLine(e,t){return new lo(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&ebo?bo:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=q);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}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(e,t){let n=this.getNullCell(q),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new lo(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=uo(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(q),n);if(r.length>0){let n=fo(this.lines,r);po(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(q),i=n;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=ho(c,Math.max(g,0),this._cols))}for(let t=0;t0;)this.ybase===0?this.y0){let e=[],t=[];for(let e=0;e=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+a-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+10;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.linee.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},So=class extends F{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new L),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 xo(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new xo(!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,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},Co=2,wo=1,To=class extends F{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new L),this.onResize=this._onResize.event,this._onScroll=this._register(new L),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Co),this.rows=Math.max(e.rawOptions.rows||0,wo),this.buffers=this._register(new So(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};To=x([S(0,Se)],To);var Eo={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:da,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},Do=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],Oo=class extends F{constructor(e){super(),this._onOptionChange=this._register(new L),this.onOptionChange=this._onOptionChange.event;let t={...Eo};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(P(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=e=>{if(!(e in Eo))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in Eo))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=Eo[e],!ko(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=Eo[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=Do.includes(t)?t:Eo[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case`minimumContrastRatio`:t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case`scrollback`:if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={};break}return t}};function ko(e){return e===`block`||e===`underline`||e===`bar`}function Ao(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&Ao(e[r],t-1);return n}var jo=Object.freeze({insertMode:!1}),Mo=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),No=class extends F{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new L),this.onData=this._onData.event,this._onUserInput=this._register(new L),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new L),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new L),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Ao(jo),this.decPrivateModes=Ao(Mo)}reset(){this.modes=Ao(jo),this.decPrivateModes=Ao(Mo)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.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(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};No=x([S(0,ge),S(1,xe),S(2,Se)],No);var Po={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function Fo(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var Io=String.fromCharCode,Lo={DEFAULT:e=>{let t=[Fo(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${Io(t[0])}${Io(t[1])}${Io(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${Fo(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${Fo(e,!0)};${e.x};${e.y}${t}`}},Ro=class extends F{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new L),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(Po))this.addProtocol(e,Po[e]);for(let e of Object.keys(Lo))this.addEncoding(e,Lo[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};Ro=x([S(0,ge),S(1,ve),S(2,Se)],Ro);var zo=[[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]],Bo=[[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]],Vo;function Ho(e,t){let n=0,r=t.length-1,i;if(et[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=Wo.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return Wo.createPropertyValue(0,n,r)}},Wo=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new L,this.onChange=this._onChange.event;let e=new Uo;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,t,n=!1){return(e&16777215)<<3|(t&3)<<1|(n?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 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(t){let n=0,r=0,i=t.length;for(let a=0;a=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},Go=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,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function Ko(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var qo=2147483647,Jo=256,Yo=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>Jo)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=Array.isArray(t[0])?1:0;e>8,r=this._subParamsIdx[t]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,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 Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>qo?qo:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>qo?qo:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t>8,r=this._subParamsIdx[t]&255;r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,qo):e}},Xo=[],Zo=class{constructor(){this._state=0,this._active=Xo,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,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=Xo}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=Xo,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Xo,!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,t,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,ie(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t0&&this._put(e,t,n)}}end(e,t=!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 n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=Xo,this._id=-1,this._state=0}}},Qo=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=ie(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data=``,this._hitLimit=!1,e));return this._data=``,this._hitLimit=!1,t}},$o=[],es=class{constructor(){this._handlers=Object.create(null),this._active=$o,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=$o}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,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=$o,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||$o,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,ie(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=$o,this._ident=0}},ts=new Yo;ts.addParam(0);var ns=class{constructor(e){this._handler=e,this._data=``,this._params=ts,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():ts,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=ie(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=ts,this._data=``,this._hitLimit=!1,e));return this._params=ts,this._data=``,this._hitLimit=!1,t}},rs=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;it),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(is,0,2,0),e.add(is,8,5,8),e.add(is,6,0,6),e.add(is,11,0,11),e.add(is,13,13,13),e}(),os=class extends F{constructor(e=as){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 Yo,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(P(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Zo),this._dcsParser=this._register(new es),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;tr||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,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,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}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,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;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],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let n=a;n>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r=t||(r=e[i])<32||r>126&&r=t||(r=e[i])<32||r>126&&r=t||(r=e[i])<32||r>126&&r=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<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(++n47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<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 i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r=t||(r=e[i])<32||r>127&&r>4:i>>8}return n}}function us(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function ds(e,t=16){let[n,r,i]=e;return`rgb:${us(n,t)}/${us(r,t)}/${us(i,t)}`}var fs={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ps=131072,ms=10;function hs(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var gs=5e3,_s=0,vs=class extends F{constructor(e,t,n,r,i,a,o,s,c=new os){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new ae,this._utf8Decoder=new oe,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=q.clone(),this._eraseAttrDataInternal=q.clone(),this._onRequestBell=this._register(new L),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new L),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new L),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new L),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new L),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new L),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new L),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new L),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new L),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new L),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new L),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new L),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new L),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 ys(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(z.BEL,()=>this.bell()),this._parser.setExecuteHandler(z.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(z.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(z.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(z.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(z.BS,()=>this.backspace()),this._parser.setExecuteHandler(z.HT,()=>this.tab()),this._parser.setExecuteHandler(z.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(z.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(hi.IND,()=>this.index()),this._parser.setExecuteHandler(hi.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(hi.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Qo(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new Qo(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new Qo(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new Qo(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new Qo(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new Qo(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new Qo(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new Qo(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new Qo(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new Qo(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new Qo(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new Qo(e=>this.restoreCursorColor(e))),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 e in vo)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new ns((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),gs))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${gs} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>ps&&(a=this._parseStack.position+ps)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.lengthps)for(let t=a;t0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;ps){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,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),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof lo&&d.copyCellsFrom(e,t,0,m,!1);t=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>hs(e.params[0],this._optionsService.rawOptions.windowOptions)?t(e):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new ns(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Qo(t))}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 e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,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(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.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 c=s;for(let e=1;e0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(z.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(z.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(z.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(z.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(z.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${z.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:c===132?1:0:0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=le.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=q.fg,e.bg=q.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=q.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=q.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=q.fg&16777215,r.bg&=-67108864,r.bg|=q.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${z.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${z.ESC}[${e};${t}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${z.ESC}[?${e};${t}R`);break;case 15:break;case 25:break;case 26:break;case 53:break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=q.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(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){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 e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!hs(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${z.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>ms&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>ms&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){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(e){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(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(bs(n))if(r===`?`)t.push({type:0,index:n});else{let e=ls(r);e&&t.push({type:1,index:n,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=ls(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e=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 e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,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=q.clone(),this._eraseAttrDataInternal=q.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new M;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t(this._coreService.triggerDataEvent(`${z.ESC}${e}${z.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-(i.cursorBlink?1:0)} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},ys=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){ethis.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(_s=e,e=t,t=_s),ethis.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};ys=x([S(0,ge)],ys);function bs(e){return 0<=e&&e<256}var xs=5e7,Ss=12,Cs=50,ws=class extends F{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 L),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){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 n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>xs)throw 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(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>performance.now()-n>=Ss?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=Ss)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>Cs&&(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()}},Ts=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Ts=x([S(0,ge)],Ts);var Es=!1,Ds=class extends F{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new mt),this._onBinary=this._register(new L),this.onBinary=this._onBinary.event,this._onData=this._register(new L),this.onData=this._onData.event,this._onLineFeed=this._register(new L),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new L),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new L),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new L),this._instantiationService=new to,this.optionsService=this._register(new Oo(e)),this._instantiationService.setService(Se,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(To)),this._instantiationService.setService(ge,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(io)),this._instantiationService.setService(xe,this._logService),this.coreService=this._register(this._instantiationService.createInstance(No)),this._instantiationService.setService(ve,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Ro)),this._instantiationService.setService(_e,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Wo)),this._instantiationService.setService(we,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Go),this._instantiationService.setService(ye,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Ts),this._instantiationService.setService(Ce,this._oscLinkService),this._inputHandler=this._register(new vs(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Ct.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Ct.forward(this._bufferService.onResize,this._onResize)),this._register(Ct.forward(this.coreService.onData,this._onData)),this._register(Ct.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 ws((e,t)=>this._inputHandler.parse(e,t))),this._register(Ct.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new L),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 t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!Es&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),Es=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,Co),t=Math.max(t,wo),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}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 t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.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(Ko.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(Ko(this._bufferService),!1))),this._windowsWrappingHeuristics.value=P(()=>{for(let t of e)t.dispose()})}}},Os={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 ks(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?t?i.key=z.ESC+`OA`:i.key=z.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?t?i.key=z.ESC+`OD`:i.key=z.ESC+`[D`:e.key===`UIKeyInputRightArrow`?t?i.key=z.ESC+`OC`:i.key=z.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(t?i.key=z.ESC+`OB`:i.key=z.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:z.DEL,e.altKey&&(i.key=z.ESC+i.key);break;case 9:if(e.shiftKey){i.key=z.ESC+`[Z`;break}i.key=z.HT,i.cancel=!0;break;case 13:i.key=e.altKey?z.ESC+z.CR:z.CR,i.cancel=!0;break;case 27:i.key=z.ESC,e.altKey&&(i.key=z.ESC+z.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;a?i.key=z.ESC+`[1;`+(a+1)+`D`:t?i.key=z.ESC+`OD`:i.key=z.ESC+`[D`;break;case 39:if(e.metaKey)break;a?i.key=z.ESC+`[1;`+(a+1)+`C`:t?i.key=z.ESC+`OC`:i.key=z.ESC+`[C`;break;case 38:if(e.metaKey)break;a?i.key=z.ESC+`[1;`+(a+1)+`A`:t?i.key=z.ESC+`OA`:i.key=z.ESC+`[A`;break;case 40:if(e.metaKey)break;a?i.key=z.ESC+`[1;`+(a+1)+`B`:t?i.key=z.ESC+`OB`:i.key=z.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=z.ESC+`[2~`);break;case 46:a?i.key=z.ESC+`[3;`+(a+1)+`~`:i.key=z.ESC+`[3~`;break;case 36:a?i.key=z.ESC+`[1;`+(a+1)+`H`:t?i.key=z.ESC+`OH`:i.key=z.ESC+`[H`;break;case 35:a?i.key=z.ESC+`[1;`+(a+1)+`F`:t?i.key=z.ESC+`OF`:i.key=z.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=z.ESC+`[5;`+(a+1)+`~`:i.key=z.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=z.ESC+`[6;`+(a+1)+`~`:i.key=z.ESC+`[6~`;break;case 112:a?i.key=z.ESC+`[1;`+(a+1)+`P`:i.key=z.ESC+`OP`;break;case 113:a?i.key=z.ESC+`[1;`+(a+1)+`Q`:i.key=z.ESC+`OQ`;break;case 114:a?i.key=z.ESC+`[1;`+(a+1)+`R`:i.key=z.ESC+`OR`;break;case 115:a?i.key=z.ESC+`[1;`+(a+1)+`S`:i.key=z.ESC+`OS`;break;case 116:a?i.key=z.ESC+`[15;`+(a+1)+`~`:i.key=z.ESC+`[15~`;break;case 117:a?i.key=z.ESC+`[17;`+(a+1)+`~`:i.key=z.ESC+`[17~`;break;case 118:a?i.key=z.ESC+`[18;`+(a+1)+`~`:i.key=z.ESC+`[18~`;break;case 119:a?i.key=z.ESC+`[19;`+(a+1)+`~`:i.key=z.ESC+`[19~`;break;case 120:a?i.key=z.ESC+`[20;`+(a+1)+`~`:i.key=z.ESC+`[20~`;break;case 121:a?i.key=z.ESC+`[21;`+(a+1)+`~`:i.key=z.ESC+`[21~`;break;case 122:a?i.key=z.ESC+`[23;`+(a+1)+`~`:i.key=z.ESC+`[23~`;break;case 123:a?i.key=z.ESC+`[24;`+(a+1)+`~`:i.key=z.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=z.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=z.DEL:e.keyCode===219?i.key=z.ESC:e.keyCode===220?i.key=z.FS:e.keyCode===221&&(i.key=z.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=Os[e.keyCode]?.[e.shiftKey?1:0];if(t)i.key=z.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=z.ESC+n}else if(e.keyCode===32)i.key=z.ESC+(e.ctrlKey?z.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=z.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=z.US),e.key===`@`&&(i.key=z.NUL));break}return i}var J=0,As=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new ba,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new ba,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((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];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 t=this._getKey(e);if(t===void 0||(J=this._search(t),J===-1)||this._getKey(this._array[J])!==t)return!1;do if(this._array[J]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(J),!0;while(++Je-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(J=this._search(e),!(J<0||J>=this._array.length)&&this._getKey(this._array[J])===e))do yield this._array[J];while(++J=this._array.length)&&this._getKey(this._array[J])===e))do t(this._array[J]);while(++J=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},js=0,Ms=0,Ns=class extends F{constructor(){super(),this._decorations=new As(e=>e?.marker.line),this._onDecorationRegistered=this._register(new L),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new L),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(P(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new Ps(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e{js=t.options.x??0,Ms=js+(t.options.width??1),e>=js&&e=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},Ls=20,Rs=!1,zs=class extends F{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;ethis._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,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=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new Is(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);Rs?(this._accessibilityContainer.classList.add(`debug`),this._rowContainer.classList.add(`debug`),this._debugRootContainer=i.createElement(`div`),this._debugRootContainer.classList.add(`xterm`),this._debugRootContainer.appendChild(i.createTextNode(`------start a11y------`)),this._debugRootContainer.appendChild(this._accessibilityContainer),this._debugRootContainer.appendChild(i.createTextNode(`------end a11y------`)),this._terminal.element.insertAdjacentElement(`afterend`,this._debugRootContainer)):this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(` -`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(R(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(P(()=>{Rs?this._debugRootContainer.remove():this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===` -`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Ls+1&&(this._liveRegion.textContent+=T.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(!(!a||!o)){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;ee;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_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 e=0;e{ut(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(R(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(R(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(R(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(R(this._element,`mouseup`,this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;re?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;tthis._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;ethis._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&Vs(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,ut(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};Bs=x([S(1,Ae),S(2,je),S(3,ge),S(4,Fe)],Bs);function Vs(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var Hs=class extends Ds{constructor(e={}){super(e),this._linkifier=this._register(new mt),this.browser=ra,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new mt),this._onCursorMove=this._register(new L),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new L),this.onKey=this._onKey.event,this._onRender=this._register(new L),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new L),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new L),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new L),this.onBell=this._onBell.event,this._onFocus=this._register(new L),this._onBlur=this._register(new L),this._onA11yCharEmitter=this._register(new L),this._onA11yTabEmitter=this._register(new L),this._onWillOpen=this._register(new L),this._setup(),this._decorationService=this._instantiationService.createInstance(Ns),this._instantiationService.setService(Te,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Qi),this._instantiationService.setService(Fe,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Ee)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(Ct.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Ct.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Ct.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Ct.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(P(()=>{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 t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=H.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${z.ESC}]${n};${ds(r)}${gi.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=V.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=V.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.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(zs,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(z.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(z.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,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(R(this.element,`copy`,e=>{this.hasSelection()&&ne(e,this._selectionService)}));let e=e=>re(e,this.textarea,this.coreService,this.optionsService);this._register(R(this.textarea,`paste`,e)),this._register(R(this.element,`paste`,e)),sa?this._register(R(this.element,`mousedown`,e=>{e.button===2&&A(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(R(this.element,`contextmenu`,e=>{A(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),ha&&this._register(R(this.element,`auxclick`,e=>{e.button===1&&k(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(R(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(R(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(R(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(R(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(R(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(R(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(R(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw 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 t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._register(R(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,C.get()),ga||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`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Xi,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(ke,this._coreBrowserService),this._register(R(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(R(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Ki,this._document,this._helperContainer),this._instantiationService.setService(Oe,this._charSizeService),this._themeService=this._instantiationService.createInstance($a),this._instantiationService.setService(Pe,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Di),this._instantiationService.setService(Ne,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Sa,this.rows,this.screenElement)),this._instantiationService.setService(je,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(_i,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(ta),this._instantiationService.setService(Ae,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Bs,this.screenElement));this.element.appendChild(t);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(ci,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Wa,this.element,this.screenElement,r)),this._instantiationService.setService(Me,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(Ct.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(li,this.screenElement)),this._register(R(this.element,`mousedown`,e=>this._selectionService.handleMouseDown(e))),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(zs,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(mi,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(mi,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Gi,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=t.buttons&1?0:t.buttons&4?1:t.buttons&2?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),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()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(R(t,`mousedown`,e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)})),this._register(R(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=z.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}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,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),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 t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){O(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 Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw 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,t,n){this._selectionService.setSelection(e,t,n)}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,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key===`Dead`||e.key===`AltGraph`)&&(this._unprocessedDeadKey=!0);let n=ks(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.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((n.key===z.ETX||n.key===z.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Us(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!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 t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){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,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new M)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},Ks=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,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(e){let t=this._buffer.lines.get(e);if(t)return new Gs(t)}getNullCell(){return new M}},qs=class extends F{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new L),this.onBufferChange=this._onBufferChange.event,this._normal=new Ks(this._core.buffers.normal,`normal`),this._alternate=new Ks(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 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)}},Js=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},Ys=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}},Xs=[`cols`,`rows`],Zs=0,Qs=class extends F{constructor(e){super(),this._core=this._register(new Hs(e)),this._addonManager=this._register(new Ws),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(Xs.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw 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||=new Js(this._core),this._parser}get unicode(){return this._checkProposedApi(),new Ys(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._register(new qs(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`;break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r -`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return C.get()},set promptLabel(e){C.set(e)},get tooMuchOutput(){return T.get()},set tooMuchOutput(e){T.set(e)}}}_verifyIntegers(...e){for(Zs of e)if(Zs===1/0||isNaN(Zs)||Zs%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(Zs of e)if(Zs&&(Zs===1/0||isNaN(Zs)||Zs%1!=0||Zs<0))throw Error(`This API only accepts positive integers`)}},$s=2,ec=1,tc=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max($s,Math.floor(u/e.css.cell.width)),rows:Math.max(ec,Math.floor(l/e.css.cell.height))}}},nc=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=ic.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}};function rc(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var ic=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!rc(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),!(!n.isWrapped||o.indexOf(` `)!==-1)););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function oc(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var sc=class{constructor(e=oc,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||ac;this._linkProvider=this._terminal.registerLinkProvider(new nc(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}},cc=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?pc.isErrorNoTelemetry(e)?new pc(e.message+` - -`+e.stack):Error(e.message+` - -`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(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)}};function lc(e){dc(e)||cc.onUnexpectedError(e)}var uc=`Canceled`;function dc(e){return e instanceof fc?!0:e instanceof Error&&e.name===uc&&e.message===uc}var fc=class extends Error{constructor(){super(uc),this.name=this.message}},pc=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}};function mc(e,t,n=0,r=e.length){let i=n,a=r;for(;i{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(gc||={});function _c(e,t){return(n,r)=>t(e(n),e(r))}var vc=(e,t)=>e-t,yc=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>t(n)?e(n):!0))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>e(n)?(t=n,!1):!0),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||gc.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};yc.empty=new yc(e=>{});function bc(e,t){let n=Object.create(null);for(let r of e){let e=t(r),i=n[e];i||=n[e]=[],i.push(r)}return n}var xc=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){return this.map.get(e)||new Set}};function Sc(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var Cc;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);tt.source!==null&&!this.getRootParent(t,e).isSingleton).flatMap(([e])=>e)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let e=new Map,t=[...this.livingDisposables.values()].filter(t=>t.source!==null&&!this.getRootParent(t,e).isSingleton);if(t.length===0)return;let r=new Set(t.map(e=>e.value));if(n=t.filter(e=>!(e.parent&&r.has(e.parent))),n.length===0)throw Error(`There are cyclic diposable chains!`)}if(!n)return;function r(e){function t(e,t){for(;e.length>0&&t.some(t=>typeof t==`string`?t===e[0]:e[0].match(t));)e.shift()}let n=e.source.split(` -`).map(e=>e.trim().replace(`at `,``)).filter(e=>e!==``);return t(n,[`Error`,/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),n.reverse()}let i=new xc;for(let e of n){let t=r(e);for(let n=0;n<=t.length;n++)i.add(t.slice(0,n).join(` -`),e)}n.sort(_c(e=>e.idx,vc));let a=``,o=0;for(let t of n.slice(0,e)){o++;let e=r(t),s=[];for(let t=0;tr(e)[t]),e=>e);delete o[e[t]];for(let[e,t]of Object.entries(o))s.unshift(` - stacktraces of ${t.length} other leaks continue with ${e}`);s.unshift(a)}a+=` - - -==================== Leaking disposable ${o}/${n.length}: ${t.value.constructor.name} ==================== -${s.join(` -`)} -============================================================ - -`}return n.length>e&&(a+=` - - -... and ${n.length-e} more leaking disposables - -`),{leaks:n,details:a}}};Ec.idx=0;function Dc(e){Tc=e}if(wc){let e=`__is_disposable_tracked__`;Dc(new class{trackDisposable(t){let n=Error(`Potentially leaked disposable`).stack;setTimeout(()=>{t[e]||console.log(n)},3e3)}setParent(t,n){if(t&&t!==Lc.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==Lc.None)try{t[e]=!0}catch{}}markAsSingleton(e){}})}function Oc(e){return Tc?.trackDisposable(e),e}function kc(e){Tc?.markAsDisposed(e)}function Ac(e,t){Tc?.setParent(e,t)}function jc(e,t){if(Tc)for(let n of e)Tc.setParent(n,t)}function Mc(e){if(Cc.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function Nc(...e){let t=Pc(()=>Mc(e));return jc(e,t),t}function Pc(e){let t=Oc({dispose:Sc(()=>{kc(t),e()})});return t}var Fc=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,Oc(this)}dispose(){this._isDisposed||(kc(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Mc(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return Ac(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(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(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),Ac(e,null))}};Fc.DISABLE_DISPOSED_WARNING=!1;var Ic=Fc,Lc=class{constructor(){this._store=new Ic,Oc(this),Ac(this._store,this)}dispose(){kc(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};Lc.None=Object.freeze({dispose(){}});var Rc=class{constructor(){this._isDisposed=!1,Oc(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&Ac(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,kc(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&Ac(e,null),e}},zc=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};zc.Undefined=new zc(void 0);var Bc=globalThis.performance&&typeof globalThis.performance.now==`function`,Vc=class e{static create(t){return new e(t)}constructor(e){this._now=Bc&&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._now()-this._startTime:this._stopTime-this._startTime}},Hc=!1,Uc=!1,Wc=!1,Gc;(e=>{e.None=()=>Lc.None;function t(e){if(Wc){let{onDidAddListener:t}=e,n=Zc.create(),r=0;e.onDidAddListener=()=>{++r===2&&(console.warn(`snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here`),n.print()),t?.()}}}function n(e,t){return f(e,()=>{},0,void 0,!0,void 0,t)}e.defer=n;function r(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=r;function i(e,t,n){return u((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=i;function a(e,t,n){return u((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=a;function o(e,t,n){return u((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=o;function s(e){return e}e.signal=s;function c(...e){return(t,n=null,r)=>d(Nc(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=c;function l(e,t,n,r){let a=n;return i(e,e=>(a=t(a,e),a),r)}e.reduce=l;function u(e,n){let r,i={onWillAddFirstListener(){r=e(a.fire,a)},onDidRemoveLastListener(){r?.dispose()}};n||t(i);let a=new al(i);return n?.add(a),a.event}function d(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function f(e,n,r=100,i=!1,a=!1,o,s){let c,l,u,d=0,f,p={leakWarningThreshold:o,onWillAddFirstListener(){c=e(e=>{d++,l=n(l,e),i&&!u&&(m.fire(l),l=void 0),f=()=>{let e=l;l=void 0,u=void 0,(!i||d>1)&&m.fire(e),d=0},typeof r==`number`?(clearTimeout(u),u=setTimeout(f,r)):u===void 0&&(u=0,queueMicrotask(f))})},onWillRemoveListener(){a&&d>0&&f?.()},onDidRemoveLastListener(){f=void 0,c.dispose()}};s||t(p);let m=new al(p);return s?.add(m),m.event}e.debounce=f;function p(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=p;function m(e,t=(e,t)=>e===t,n){let r=!0,i;return o(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=m;function h(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=h;function g(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new al({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=g;function _(e,t){return(n,r,i)=>{let a=t(new y);return e(function(e){let t=a.evaluate(e);t!==v&&n.call(r,t)},void 0,i)}}e.chain=_;let v=Symbol(`HaltChainable`);class y{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:v),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:v}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===v)break;return e}}function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new al({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=b;function ee(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new al({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=ee;function x(e){return new Promise(t=>r(e)(t))}e.toPromise=x;function S(e){let t=new al;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function te(e,t){return e(e=>t.fire(e))}e.forward=te;function C(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=C;class w{constructor(e,n){this._observable=e,this._counter=0,this._hasChanged=!1;let r={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};n||t(r),this.emitter=new al(r),n&&n.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function T(e,t){return new w(e,t).emitter.event}e.fromObservable=T;function E(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof Ic?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=E})(Gc||={});var Kc=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new Vc,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}}};Kc.all=new Set,Kc._idPool=0;var qc=Kc,Jc=-1,Yc=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t{if(e instanceof tl)t(e);else for(let n=0;n{e.length!==0&&(console.warn(`[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:`),console.warn(e.join(` -`)),e.length=0)},3e3),il=new FinalizationRegistry(t=>{typeof t==`string`&&e.push(t)})}var al=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Jc>0||this._options?.leakWarningThreshold?new Xc(e?.onListenerError??lc,this._options?.leakWarningThreshold??Jc):void 0,this._perfMon=this._options?._profName?new qc(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(Uc){let e=this._listeners;queueMicrotask(()=>{rl(e,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new $c(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||lc)(n),Lc.None}if(this._disposed)return Lc.None;t&&(e=e.bind(t));let r=new tl(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Zc.create(),i=this._leakageMon.check(r.stack,this._size+1)),Uc&&(r.stack=Zc.create()),this._listeners?this._listeners instanceof tl?(this._deliveryQueue??=new ol,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=Pc(()=>{il?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof Ic?n.add(a):Array.isArray(n)&&n.push(a),il){let e=Error().stack.split(` -`).slice(2,3).join(` -`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);il.register(a,t?.[2]??e,a)}return a},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 t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*nl<=t.length){let e=0;for(let n=0;n0}},ol=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},sl=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),cl;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof ll?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Gc.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:sl})})(cl||={});var ll=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?sl:(this._emitter||=new al,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},ul=`en`,dl=!1,fl=!1,pl=ul,ml,hl=globalThis,gl;typeof hl.vscode<`u`&&typeof hl.vscode.process<`u`?gl=hl.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(gl=process);var _l=typeof gl?.versions?.electron==`string`&&gl?.type===`renderer`;if(typeof gl==`object`){gl.platform,gl.platform,dl=gl.platform===`linux`,dl&&gl.env.SNAP&&gl.env.SNAP_REVISION,gl.env.CI||gl.env.BUILD_ARTIFACTSTAGINGDIRECTORY,pl=ul;let e=gl.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,pl=t.resolvedLanguage||ul,t.languagePack?.translationsConfigFile}catch{}}else typeof navigator==`object`&&!_l?(ml=navigator.userAgent,ml.indexOf(`Windows`),ml.indexOf(`Macintosh`),(ml.indexOf(`Macintosh`)>=0||ml.indexOf(`iPad`)>=0||ml.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,dl=ml.indexOf(`Linux`)>=0,ml?.indexOf(`Mobi`),fl=!0,pl=globalThis._VSCODE_NLS_LANGUAGE||ul,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);fl&&typeof hl.importScripts==`function`&&hl.origin;var vl=ml,yl=pl,bl;(e=>{function t(){return yl}e.value=t;function n(){return yl.length===2?yl===`en`:yl.length>=3?yl[0]===`e`&&yl[1]===`n`&&yl[2]===`-`:!1}e.isDefaultVariant=n;function r(){return yl===`en`}e.isDefault=r})(bl||={});var xl=typeof hl.postMessage==`function`&&!hl.importScripts;(()=>{if(xl){let e=[];hl.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n{let r=++t;e.push({id:r,callback:n}),hl.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var Sl=!!(vl&&vl.indexOf(`Chrome`)>=0);vl&&vl.indexOf(`Firefox`),!Sl&&vl&&vl.indexOf(`Safari`),vl&&vl.indexOf(`Edg/`),vl&&vl.indexOf(`Android`);function Cl(e,t=0,n){let r=setTimeout(()=>{e(),n&&i.dispose()},t),i=Pc(()=>{clearTimeout(r),n?.deleteAndLeak(i)});return n?.add(i),i}(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var wl;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(wl||={});var Tl=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new al,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.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(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.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())}};Tl.EMPTY=Tl.fromArray([]);var El=class extends Lc{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new Rc),this._linesCacheDisposables=this._register(new Rc),this._register(Pc(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=Nc(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=Cl(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let n=[],r=[0],i=this._terminal.buffer.active.getLine(e);for(;i;){let a=this._terminal.buffer.active.getLine(e+1),o=a?a.isWrapped:!1,s=i.translateToString(!o&&t);if(o&&a){let e=i.getCell(i.length-1);e&&e.getCode()===0&&e.getWidth()===1&&a.getCell(0)?.getWidth()===2&&(s=s.slice(0,-1))}if(n.push(s),o)r.push(r[r.length-1]+s.length);else break;e++,i=a}return[n.join(``),r]}},Dl=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,t){return t?.decorations?this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||this.didOptionsChange(t):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},Ol=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,n,r){if(!e||e.length===0){this._terminal.clearSelection();return}if(n>this._terminal.cols)throw Error(`Invalid col: ${n} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let i={startRow:t,startCol:n},a=this._findInLine(e,i,r);if(!a)for(let n=t+1;n=0&&(o.startRow=n,s=this._findInLine(e,o,t,!0),!s);n--);}if(!s&&i!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let n=this._terminal.buffer.active.baseY+this._terminal.rows-1;n>=i&&(o.startRow=n,s=this._findInLine(e,o,t,!0),!s);n--);return s}_isWholeWord(e,t,n){return(e===0||` ~!@#$%^&*()+\`-=[]{}|\\;:"',./<>?`.includes(t[e-1]))&&(e+n.length===t.length||` ~!@#$%^&*()+\`-=[]{}|\\;:"',./<>?`.includes(t[e+n.length]))}_findInLine(e,t,n={},r=!1){let i=t.startRow,a=t.startCol;if(this._terminal.buffer.active.getLine(i)?.isWrapped){if(r){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,n)}let o=this._lineCache.getLineFromCache(i);o||(o=this._lineCache.translateBufferLineToStringWithWrap(i,!0),this._lineCache.setLineInCache(i,o));let[s,c]=o,l=this._bufferColsToStringOffset(i,a),u=e,d=s;n.regex||(u=n.caseSensitive?e:e.toLowerCase(),d=n.caseSensitive?s:s.toLowerCase());let f=-1;if(n.regex){let t=RegExp(u,n.caseSensitive?`g`:`gi`),i;if(r)for(;i=t.exec(d.slice(0,l));)f=t.lastIndex-i[0].length,e=i[0],t.lastIndex-=e.length-1;else i=t.exec(d.slice(l)),i&&i[0].length>0&&(f=l+(t.lastIndex-i[0].length),e=i[0])}else r?l-u.length>=0&&(f=d.lastIndexOf(u,l-u.length)):f=d.indexOf(u,l);if(f>=0){if(n.wholeWord&&!this._isWholeWord(f,d,e))return;let t=0;for(;t=c[t+1];)t++;let r=t;for(;r=c[r+1];)r++;let a=f-c[t],o=f+e.length-c[r],s=this._stringLengthToBufferSize(i+t,a),l=this._stringLengthToBufferSize(i+r,o)-s+this._terminal.cols*(r-t);return{term:e,col:s,row:i+t,size:l}}}_stringLengthToBufferSize(e,t){let n=this._terminal.buffer.active.getLine(e);if(!n)return 0;for(let e=0;e1&&(t-=i.length-1);let a=n.getCell(e+1);a&&a.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let n=e,r=0,i=this._terminal.buffer.active.getLine(n);for(;t>0&&i;){for(let e=0;ethis.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let n of e){let e=this._createResultDecorations(n,t,!1);if(e)for(let t of e)this._storeDecoration(t,n)}}createActiveDecoration(e,t){let n=this._createResultDecorations(e,t,!0);if(n)return{decorations:n,match:e,dispose(){Mc(n)}}}clearHighlightDecorations(){Mc(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,n){e.classList.contains(`xterm-find-result-decoration`)||(e.classList.add(`xterm-find-result-decoration`),t&&(e.style.outline=`1px solid ${t}`)),n&&e.classList.add(`xterm-find-active-result-decoration`)}_createResultDecorations(e,t,n){let r=[],i=e.col,a=e.size,o=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;a>0;){let e=Math.min(this._terminal.cols-i,a);r.push([o,i,e]),i=0,a-=e,o++}let s=[];for(let e of r){let r=this._terminal.registerMarker(e[0]),i=this._terminal.registerDecoration({marker:r,x:e[1],width:e[2],backgroundColor:n?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(r.line)?void 0:{color:n?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:`center`}});if(i){let e=[];e.push(r),e.push(i.onRender(e=>this._applyStyles(e,n?t.activeMatchBorder:t.matchBorder,!1))),e.push(i.onDispose(()=>Mc(e))),s.push(i)}}return s.length===0?void 0:s}},Al=class extends Lc{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new al)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&=(this._selectedDecoration.dispose(),void 0)}findResultIndex(e){for(let t=0;tthis._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Pc(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=Cl(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,n){if(!this._terminal||!this._engine)throw Error(`Cannot use addon until it has been loaded`);this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findNextAndSelect(e,t,n);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw Error(`Cannot use addon until it has been loaded`);if(!this._state.isValidSearchTerm(e)){this.clearDecorations();return}this.clearDecorations(!0);let n=[],r,i=this._engine.find(e,0,0,t);for(;i&&(r?.row!==i.row||r?.col!==i.col)&&!(n.length>=this._highlightLimit);)r=i,n.push(r),i=this._engine.find(e,r.col+r.term.length>=this._terminal.cols?r.row+1:r.row,r.col+r.term.length>=this._terminal.cols?0:r.col+1,t);this._resultTracker.updateResults(n,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(n,t.decorations)}_findNextAndSelect(e,t,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,n?.noScroll)}findPrevious(e,t,n){if(!this._terminal||!this._engine)throw Error(`Cannot use addon until it has been loaded`);this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findPreviousAndSelect(e,t,n);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,n?.noScroll)}_selectResult(e,t,n){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),!1;if(this._terminal.select(e.col,e.row,e.size),t){let n=this._decorationManager.createActiveDecoration(e,t);n&&(this._resultTracker.selectedDecoration=n)}if(!n&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.rowt[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=Fu.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return Fu.createPropertyValue(0,n,r)}},Ll=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Hl.isErrorNoTelemetry(e)?new Hl(e.message+` - -`+e.stack):Error(e.message+` - -`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(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)}};function Rl(e){Bl(e)||Ll.onUnexpectedError(e)}var zl=`Canceled`;function Bl(e){return e instanceof Vl?!0:e instanceof Error&&e.name===zl&&e.message===zl}var Vl=class extends Error{constructor(){super(zl),this.name=this.message}},Hl=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}};function Ul(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}function Wl(e,t,n=0,r=e.length){let i=n,a=r;for(;i{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Kl||={});function ql(e,t){return(n,r)=>t(e(n),e(r))}var Jl=(e,t)=>e-t,Yl=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>t(n)?e(n):!0))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>e(n)?(t=n,!1):!0),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||Kl.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};Yl.empty=new Yl(e=>{});function Xl(e,t){let n=Object.create(null);for(let r of e){let e=t(r),i=n[e];i||=n[e]=[],i.push(r)}return n}var Zl=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){return this.map.get(e)||new Set}},Ql;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);tt.source!==null&&!this.getRootParent(t,e).isSingleton).flatMap(([e])=>e)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let e=new Map,t=[...this.livingDisposables.values()].filter(t=>t.source!==null&&!this.getRootParent(t,e).isSingleton);if(t.length===0)return;let r=new Set(t.map(e=>e.value));if(n=t.filter(e=>!(e.parent&&r.has(e.parent))),n.length===0)throw Error(`There are cyclic diposable chains!`)}if(!n)return;function r(e){function t(e,t){for(;e.length>0&&t.some(t=>typeof t==`string`?t===e[0]:e[0].match(t));)e.shift()}let n=e.source.split(` -`).map(e=>e.trim().replace(`at `,``)).filter(e=>e!==``);return t(n,[`Error`,/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),n.reverse()}let i=new Zl;for(let e of n){let t=r(e);for(let n=0;n<=t.length;n++)i.add(t.slice(0,n).join(` -`),e)}n.sort(ql(e=>e.idx,Jl));let a=``,o=0;for(let t of n.slice(0,e)){o++;let e=r(t),s=[];for(let t=0;tr(e)[t]),e=>e);delete o[e[t]];for(let[e,t]of Object.entries(o))s.unshift(` - stacktraces of ${t.length} other leaks continue with ${e}`);s.unshift(a)}a+=` - - -==================== Leaking disposable ${o}/${n.length}: ${t.value.constructor.name} ==================== -${s.join(` -`)} -============================================================ - -`}return n.length>e&&(a+=` - - -... and ${n.length-e} more leaking disposables - -`),{leaks:n,details:a}}};tu.idx=0;function nu(e){eu=e}if($l){let e=`__is_disposable_tracked__`;nu(new class{trackDisposable(t){let n=Error(`Potentially leaked disposable`).stack;setTimeout(()=>{t[e]||console.log(n)},3e3)}setParent(t,n){if(t&&t!==fu.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==fu.None)try{t[e]=!0}catch{}}markAsSingleton(e){}})}function ru(e){return eu?.trackDisposable(e),e}function iu(e){eu?.markAsDisposed(e)}function au(e,t){eu?.setParent(e,t)}function ou(e,t){if(eu)for(let n of e)eu.setParent(n,t)}function su(e){if(Ql.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function cu(...e){let t=lu(()=>su(e));return ou(e,t),t}function lu(e){let t=ru({dispose:Ul(()=>{iu(t),e()})});return t}var uu=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,ru(this)}dispose(){this._isDisposed||(iu(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{su(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return au(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(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(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),au(e,null))}};uu.DISABLE_DISPOSED_WARNING=!1;var du=uu,fu=class{constructor(){this._store=new du,ru(this),au(this._store,this)}dispose(){iu(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};fu.None=Object.freeze({dispose(){}});var pu=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};pu.Undefined=new pu(void 0);var mu=globalThis.performance&&typeof globalThis.performance.now==`function`,hu=class e{static create(t){return new e(t)}constructor(e){this._now=mu&&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._now()-this._startTime:this._stopTime-this._startTime}},gu=!1,_u=!1,vu=!1,yu;(e=>{e.None=()=>fu.None;function t(e){if(vu){let{onDidAddListener:t}=e,n=Tu.create(),r=0;e.onDidAddListener=()=>{++r===2&&(console.warn(`snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here`),n.print()),t?.()}}}function n(e,t){return f(e,()=>{},0,void 0,!0,void 0,t)}e.defer=n;function r(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=r;function i(e,t,n){return u((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=i;function a(e,t,n){return u((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=a;function o(e,t,n){return u((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=o;function s(e){return e}e.signal=s;function c(...e){return(t,n=null,r)=>d(cu(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=c;function l(e,t,n,r){let a=n;return i(e,e=>(a=t(a,e),a),r)}e.reduce=l;function u(e,n){let r,i={onWillAddFirstListener(){r=e(a.fire,a)},onDidRemoveLastListener(){r?.dispose()}};n||t(i);let a=new Nu(i);return n?.add(a),a.event}function d(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function f(e,n,r=100,i=!1,a=!1,o,s){let c,l,u,d=0,f,p={leakWarningThreshold:o,onWillAddFirstListener(){c=e(e=>{d++,l=n(l,e),i&&!u&&(m.fire(l),l=void 0),f=()=>{let e=l;l=void 0,u=void 0,(!i||d>1)&&m.fire(e),d=0},typeof r==`number`?(clearTimeout(u),u=setTimeout(f,r)):u===void 0&&(u=0,queueMicrotask(f))})},onWillRemoveListener(){a&&d>0&&f?.()},onDidRemoveLastListener(){f=void 0,c.dispose()}};s||t(p);let m=new Nu(p);return s?.add(m),m.event}e.debounce=f;function p(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=p;function m(e,t=(e,t)=>e===t,n){let r=!0,i;return o(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=m;function h(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=h;function g(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new Nu({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=g;function _(e,t){return(n,r,i)=>{let a=t(new y);return e(function(e){let t=a.evaluate(e);t!==v&&n.call(r,t)},void 0,i)}}e.chain=_;let v=Symbol(`HaltChainable`);class y{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:v),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:v}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===v)break;return e}}function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Nu({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=b;function ee(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Nu({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=ee;function x(e){return new Promise(t=>r(e)(t))}e.toPromise=x;function S(e){let t=new Nu;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function te(e,t){return e(e=>t.fire(e))}e.forward=te;function C(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=C;class w{constructor(e,n){this._observable=e,this._counter=0,this._hasChanged=!1;let r={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};n||t(r),this.emitter=new Nu(r),n&&n.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function T(e,t){return new w(e,t).emitter.event}e.fromObservable=T;function E(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof du?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=E})(yu||={});var bu=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new hu,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}}};bu.all=new Set,bu._idPool=0;var xu=bu,Su=-1,Cu=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t{if(e instanceof ku)t(e);else for(let n=0;n{e.length!==0&&(console.warn(`[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:`),console.warn(e.join(` -`)),e.length=0)},3e3),Mu=new FinalizationRegistry(t=>{typeof t==`string`&&e.push(t)})}var Nu=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Su>0||this._options?.leakWarningThreshold?new wu(e?.onListenerError??Rl,this._options?.leakWarningThreshold??Su):void 0,this._perfMon=this._options?._profName?new xu(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(_u){let e=this._listeners;queueMicrotask(()=>{ju(e,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new Du(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||Rl)(n),fu.None}if(this._disposed)return fu.None;t&&(e=e.bind(t));let r=new ku(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Tu.create(),i=this._leakageMon.check(r.stack,this._size+1)),_u&&(r.stack=Tu.create()),this._listeners?this._listeners instanceof ku?(this._deliveryQueue??=new Pu,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=lu(()=>{Mu?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof du?n.add(a):Array.isArray(n)&&n.push(a),Mu){let e=Error().stack.split(` -`).slice(2,3).join(` -`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);Mu.register(a,t?.[2]??e,a)}return a},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 t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Au<=t.length){let e=0;for(let n=0;n0}},Pu=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Fu=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new Nu,this.onChange=this._onChange.event;let e=new Il;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,t,n=!1){return(e&16777215)<<3|(t&3)<<1|(n?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 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(t){let n=0,r=0,i=t.length;for(let a=0;a=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},Iu=[[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]],Lu=[[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]],Ru=[[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]],zu=[[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]],Bu;function Vu(e,t){let n=0,r=t.length-1,i;if(et[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(en&&(n=e)}return Fu.createPropertyValue(0,n,r)}},Uu=class{activate(e){e.unicode.register(new Hu)}dispose(){}},Wu=Object.defineProperty,Gu=Object.getOwnPropertyDescriptor,Ku=(e,t,n,r)=>{for(var i=r>1?void 0:r?Gu(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Wu(t,n,i),i},qu=(e,t)=>(n,r)=>t(n,r,e),Ju=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?$u.isErrorNoTelemetry(e)?new $u(e.message+` - -`+e.stack):Error(e.message+` - -`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(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)}};function Yu(e){Zu(e)||Ju.onUnexpectedError(e)}var Xu=`Canceled`;function Zu(e){return e instanceof Qu?!0:e instanceof Error&&e.name===Xu&&e.message===Xu}var Qu=class extends Error{constructor(){super(Xu),this.name=this.message}},$u=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}};function ed(e,t,n=0,r=e.length){let i=n,a=r;for(;i{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(nd||={});function rd(e,t){return(n,r)=>t(e(n),e(r))}var id=(e,t)=>e-t,ad=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>t(n)?e(n):!0))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>e(n)?(t=n,!1):!0),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||nd.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};ad.empty=new ad(e=>{});function od(e,t){let n=Object.create(null);for(let r of e){let e=t(r),i=n[e];i||=n[e]=[],i.push(r)}return n}var sd=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){return this.map.get(e)||new Set}};function cd(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var ld;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);tt.source!==null&&!this.getRootParent(t,e).isSingleton).flatMap(([e])=>e)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let e=new Map,t=[...this.livingDisposables.values()].filter(t=>t.source!==null&&!this.getRootParent(t,e).isSingleton);if(t.length===0)return;let r=new Set(t.map(e=>e.value));if(n=t.filter(e=>!(e.parent&&r.has(e.parent))),n.length===0)throw Error(`There are cyclic diposable chains!`)}if(!n)return;function r(e){function t(e,t){for(;e.length>0&&t.some(t=>typeof t==`string`?t===e[0]:e[0].match(t));)e.shift()}let n=e.source.split(` -`).map(e=>e.trim().replace(`at `,``)).filter(e=>e!==``);return t(n,[`Error`,/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),n.reverse()}let i=new sd;for(let e of n){let t=r(e);for(let n=0;n<=t.length;n++)i.add(t.slice(0,n).join(` -`),e)}n.sort(rd(e=>e.idx,id));let a=``,o=0;for(let t of n.slice(0,e)){o++;let e=r(t),s=[];for(let t=0;tr(e)[t]),e=>e);delete o[e[t]];for(let[e,t]of Object.entries(o))s.unshift(` - stacktraces of ${t.length} other leaks continue with ${e}`);s.unshift(a)}a+=` - - -==================== Leaking disposable ${o}/${n.length}: ${t.value.constructor.name} ==================== -${s.join(` -`)} -============================================================ - -`}return n.length>e&&(a+=` - - -... and ${n.length-e} more leaking disposables - -`),{leaks:n,details:a}}};fd.idx=0;function pd(e){dd=e}if(ud){let e=`__is_disposable_tracked__`;pd(new class{trackDisposable(t){let n=Error(`Potentially leaked disposable`).stack;setTimeout(()=>{t[e]||console.log(n)},3e3)}setParent(t,n){if(t&&t!==Cd.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==Cd.None)try{t[e]=!0}catch{}}markAsSingleton(e){}})}function md(e){return dd?.trackDisposable(e),e}function hd(e){dd?.markAsDisposed(e)}function gd(e,t){dd?.setParent(e,t)}function _d(e,t){if(dd)for(let n of e)dd.setParent(n,t)}function vd(e){if(ld.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function yd(...e){let t=bd(()=>vd(e));return _d(e,t),t}function bd(e){let t=md({dispose:cd(()=>{hd(t),e()})});return t}var xd=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,md(this)}dispose(){this._isDisposed||(hd(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{vd(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return gd(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(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(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),gd(e,null))}};xd.DISABLE_DISPOSED_WARNING=!1;var Sd=xd,Cd=class{constructor(){this._store=new Sd,md(this),gd(this._store,this)}dispose(){hd(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};Cd.None=Object.freeze({dispose(){}});var wd=class{constructor(){this._isDisposed=!1,md(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&gd(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,hd(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&gd(e,null),e}},Td=typeof process<`u`&&`title`in process,Ed=Td?`node`:navigator.userAgent,Dd=Td?`node`:navigator.platform,Od=Ed.includes(`Firefox`),kd=Ed.includes(`Edge`),Ad=/^((?!chrome|android).)*safari/i.test(Ed);function jd(){if(!Ad)return 0;let e=Ed.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(Dd),[`Windows`,`Win16`,`Win32`,`WinCE`].includes(Dd),Dd.indexOf(`Linux`),/\bCrOS\b/.test(Ed);var Md=``,Nd=0,Pd=0,Fd=0,Y=0,Id={css:`#00000000`,rgba:0},Ld;(e=>{function t(e,t,n,r){return r===void 0?`#${Hd(e)}${Hd(t)}${Hd(n)}`:`#${Hd(e)}${Hd(t)}${Hd(n)}${Hd(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(Ld||={});var Rd;(e=>{function t(e,t){if(Y=(t.rgba&255)/255,Y===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return Nd=a+Math.round((n-a)*Y),Pd=o+Math.round((r-o)*Y),Fd=s+Math.round((i-s)*Y),{css:Ld.toCss(Nd,Pd,Fd),rgba:Ld.toRgba(Nd,Pd,Fd)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=Vd.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return Ld.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[Nd,Pd,Fd]=Vd.toChannels(t),{css:Ld.toCss(Nd,Pd,Fd),rgba:t}}e.opaque=i;function a(e,t){return Y=Math.round(t*255),[Nd,Pd,Fd]=Vd.toChannels(e.rgba),{css:Ld.toCss(Nd,Pd,Fd,Y),rgba:Ld.toRgba(Nd,Pd,Fd,Y)}}e.opacity=a;function o(e,t){return Y=e.rgba&255,a(e,Y*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(Rd||={});var zd;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return Nd=parseInt(e.slice(1,2).repeat(2),16),Pd=parseInt(e.slice(2,3).repeat(2),16),Fd=parseInt(e.slice(3,4).repeat(2),16),Ld.toColor(Nd,Pd,Fd);case 5:return Nd=parseInt(e.slice(1,2).repeat(2),16),Pd=parseInt(e.slice(2,3).repeat(2),16),Fd=parseInt(e.slice(3,4).repeat(2),16),Y=parseInt(e.slice(4,5).repeat(2),16),Ld.toColor(Nd,Pd,Fd,Y);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return Nd=parseInt(r[1]),Pd=parseInt(r[2]),Fd=parseInt(r[3]),Y=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),Ld.toColor(Nd,Pd,Fd,Y);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[Nd,Pd,Fd,Y]=t.getImageData(0,0,1,1).data,Y!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:Ld.toRgba(Nd,Pd,Fd,Y),css:e}}e.toColor=r})(zd||={});var Bd;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(Bd||={});var Vd;(e=>{function t(e,t){if(Y=(t&255)/255,Y===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return Nd=a+Math.round((n-a)*Y),Pd=o+Math.round((r-o)*Y),Fd=s+Math.round((i-s)*Y),Ld.toRgba(Nd,Pd,Fd)}e.blend=t;function n(e,t,n){let a=Bd.relativeLuminance(e>>8),o=Bd.relativeLuminance(t>>8);if(Ud(a,o)>8));if(sUd(a,Bd.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=Ud(a,Bd.relativeLuminance(s>>8));if(cUd(a,Bd.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=Ud(Bd.relativeLuminance2(o,s,c),Bd.relativeLuminance2(r,i,a));for(;l0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=Ud(Bd.relativeLuminance2(o,s,c),Bd.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=Ud(Bd.relativeLuminance2(o,s,c),Bd.relativeLuminance2(r,i,a));for(;l>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(Vd||={});function Hd(e){let t=e.toString(16);return t.length<2?`0`+t:t}function Ud(e,t){return e=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}function Yd(e,t,n,r){return t===1&&n>Math.ceil(r*1.5)&&e!==void 0&&e>255&&!Jd(e)&&!Wd(e)&&!Kd(e)}function Xd(e){return Wd(e)||qd(e)}function Zd(){return{css:{canvas:Qd(),cell:Qd()},device:{canvas:Qd(),cell:Qd(),char:{width:0,height:0,left:0,top:0}}}}function Qd(){return{width:0,height:0}}function $d(e,t,n=0){return(e-(Math.round(t)*2-n))%(Math.round(t)*2)}var ef=0,tf=0,nf=!1,rf=!1,af=!1,of,sf=0,cf=class{constructor(e,t,n,r,i,a){this._terminal=e,this._optionService=t,this._selectionRenderModel=n,this._decorationService=r,this._coreBrowserService=i,this._themeService=a,this.result={fg:0,bg:0,ext:0}}resolve(e,t,n,r){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,tf=0,ef=0,rf=!1,nf=!1,af=!1,of=this._themeService.colors,sf=0,e.getCode()!==0&&e.extended.underlineStyle===4){let e=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));sf=t*r%(Math.round(e)*2)}if(this._decorationService.forEachDecorationAtCell(t,n,`bottom`,e=>{e.backgroundColorRGB&&(tf=e.backgroundColorRGB.rgba>>8&16777215,rf=!0),e.foregroundColorRGB&&(ef=e.foregroundColorRGB.rgba>>8&16777215,nf=!0)}),af=this._selectionRenderModel.isCellSelected(this._terminal,t,n),af){if(this.result.fg&67108864||this.result.bg&50331648){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:tf=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:tf=(this.result.fg&16777215)<<8|255;break;case 0:default:tf=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:tf=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:tf=(this.result.bg&16777215)<<8|255;break}tf=Vd.blend(tf,(this._coreBrowserService.isFocused?of.selectionBackgroundOpaque:of.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else tf=(this._coreBrowserService.isFocused?of.selectionBackgroundOpaque:of.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(rf=!0,of.selectionForeground&&(ef=of.selectionForeground.rgba>>8&16777215,nf=!0),Xd(e.getCode())){if(this.result.fg&67108864&&!(this.result.bg&50331648))ef=(this._coreBrowserService.isFocused?of.selectionBackgroundOpaque:of.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:ef=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:ef=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:ef=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:ef=(this.result.fg&16777215)<<8|255;break;case 0:default:ef=this._themeService.colors.foreground.rgba}ef=Vd.blend(ef,(this._coreBrowserService.isFocused?of.selectionBackgroundOpaque:of.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}nf=!0}}this._decorationService.forEachDecorationAtCell(t,n,`top`,e=>{e.backgroundColorRGB&&(tf=e.backgroundColorRGB.rgba>>8&16777215,rf=!0),e.foregroundColorRGB&&(ef=e.foregroundColorRGB.rgba>>8&16777215,nf=!0)}),rf&&(tf=af?e.bg&-150994944|tf|50331648:e.bg&-16777216|tf|50331648),nf&&(ef=e.fg&-83886080|ef|50331648),this.result.fg&67108864&&(rf&&!nf&&(ef=this.result.bg&50331648?this.result.fg&-134217728|this.result.bg&67108863:this.result.fg&-134217728|of.background.rgba>>8&16777215|50331648,nf=!0),!rf&&nf&&(tf=this.result.fg&50331648?this.result.bg&-67108864|this.result.fg&67108863:this.result.bg&-67108864|of.foreground.rgba>>8&16777215|50331648,rf=!0)),of=void 0,this.result.bg=rf?tf:this.result.bg,this.result.fg=nf?ef:this.result.fg,this.result.ext&=536870911,this.result.ext|=sf<<29&3758096384}},lf=.5,uf=Od||kd?`bottom`:`ideographic`,df={"▀":[{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}]},ff={"░":[[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]]},pf={"─":{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:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},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:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},mf={"":{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}};mf[``]=mf[``],mf[``]=mf[``];function hf(e,t,n,r,i,a,o,s){let c=df[t];if(c)return gf(e,c,n,r,i,a),!0;let l=ff[t];if(l)return vf(e,l,n,r,i,a),!0;let u=pf[t];if(u)return yf(e,u,n,r,i,a,s),!0;let d=mf[t];return d?(bf(e,d,n,r,i,a,o,s),!0):!1}function gf(e,t,n,r,i,a){for(let o=0;o7&&parseInt(s.slice(7,9),16)||1;else if(s.startsWith(`rgba`))[u,d,f,p]=s.substring(5,s.length-1).split(`,`).map(e=>parseFloat(e));else throw Error(`Unexpected fillStyle color format "${s}" when drawing pattern glyph`);for(let e=0;ee.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function Cf(e,t,n,r,i,a,o,s=0,c=0){let l=e.map(e=>parseFloat(e)||parseInt(e));if(l.length<2)throw Error(`Too few arguments for instruction`);for(let e=0;ei){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},Df=class extends Ef{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},Of=class extends Ef{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},kf=!Td&&`requestIdleCallback`in window?Of:Df,Af=class e{constructor(){this.fg=0,this.bg=0,this.extended=new jf}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 t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}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}},jf=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}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 e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Mf=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};Mf.Undefined=new Mf(void 0);var Nf=globalThis.performance&&typeof globalThis.performance.now==`function`,Pf=class e{static create(t){return new e(t)}constructor(e){this._now=Nf&&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._now()-this._startTime:this._stopTime-this._startTime}},Ff=!1,If=!1,Lf=!1,Rf;(e=>{e.None=()=>Cd.None;function t(e){if(Lf){let{onDidAddListener:t}=e,n=Wf.create(),r=0;e.onDidAddListener=()=>{++r===2&&(console.warn(`snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here`),n.print()),t?.()}}}function n(e,t){return f(e,()=>{},0,void 0,!0,void 0,t)}e.defer=n;function r(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=r;function i(e,t,n){return u((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=i;function a(e,t,n){return u((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=a;function o(e,t,n){return u((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=o;function s(e){return e}e.signal=s;function c(...e){return(t,n=null,r)=>d(yd(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=c;function l(e,t,n,r){let a=n;return i(e,e=>(a=t(a,e),a),r)}e.reduce=l;function u(e,n){let r,i={onWillAddFirstListener(){r=e(a.fire,a)},onDidRemoveLastListener(){r?.dispose()}};n||t(i);let a=new Z(i);return n?.add(a),a.event}function d(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function f(e,n,r=100,i=!1,a=!1,o,s){let c,l,u,d=0,f,p={leakWarningThreshold:o,onWillAddFirstListener(){c=e(e=>{d++,l=n(l,e),i&&!u&&(m.fire(l),l=void 0),f=()=>{let e=l;l=void 0,u=void 0,(!i||d>1)&&m.fire(e),d=0},typeof r==`number`?(clearTimeout(u),u=setTimeout(f,r)):u===void 0&&(u=0,queueMicrotask(f))})},onWillRemoveListener(){a&&d>0&&f?.()},onDidRemoveLastListener(){f=void 0,c.dispose()}};s||t(p);let m=new Z(p);return s?.add(m),m.event}e.debounce=f;function p(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=p;function m(e,t=(e,t)=>e===t,n){let r=!0,i;return o(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=m;function h(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=h;function g(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new Z({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=g;function _(e,t){return(n,r,i)=>{let a=t(new y);return e(function(e){let t=a.evaluate(e);t!==v&&n.call(r,t)},void 0,i)}}e.chain=_;let v=Symbol(`HaltChainable`);class y{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:v),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:v}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===v)break;return e}}function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Z({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=b;function ee(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Z({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=ee;function x(e){return new Promise(t=>r(e)(t))}e.toPromise=x;function S(e){let t=new Z;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function te(e,t){return e(e=>t.fire(e))}e.forward=te;function C(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=C;class w{constructor(e,n){this._observable=e,this._counter=0,this._hasChanged=!1;let r={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};n||t(r),this.emitter=new Z(r),n&&n.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function T(e,t){return new w(e,t).emitter.event}e.fromObservable=T;function E(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof Sd?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=E})(Rf||={});var zf=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new Pf,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}}};zf.all=new Set,zf._idPool=0;var Bf=zf,Vf=-1,Hf=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t{if(e instanceof Jf)t(e);else for(let n=0;n{e.length!==0&&(console.warn(`[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:`),console.warn(e.join(` -`)),e.length=0)},3e3),Zf=new FinalizationRegistry(t=>{typeof t==`string`&&e.push(t)})}var Z=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Vf>0||this._options?.leakWarningThreshold?new Uf(e?.onListenerError??Yu,this._options?.leakWarningThreshold??Vf):void 0,this._perfMon=this._options?._profName?new Bf(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(If){let e=this._listeners;queueMicrotask(()=>{Xf(e,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new Kf(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||Yu)(n),Cd.None}if(this._disposed)return Cd.None;t&&(e=e.bind(t));let r=new Jf(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Wf.create(),i=this._leakageMon.check(r.stack,this._size+1)),If&&(r.stack=Wf.create()),this._listeners?this._listeners instanceof Jf?(this._deliveryQueue??=new Qf,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=bd(()=>{Zf?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof Sd?n.add(a):Array.isArray(n)&&n.push(a),Zf){let e=Error().stack.split(` -`).slice(2,3).join(` -`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);Zf.register(a,t?.[2]??e,a)}return a},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 t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Yf<=t.length){let e=0;for(let n=0;n0}},Qf=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},$f={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}},ep=2,tp,np=class e{constructor(e,t,n){this._document=e,this._config=t,this._unicodeService=n,this._didWarmUp=!1,this._cacheMap=new Tf,this._cacheMapCombined=new Tf,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Af,this._textureSize=512,this._onAddTextureAtlasCanvas=new Z,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Z,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=op(e,this._config.deviceCellWidth*4+ep*2,this._config.deviceCellHeight+ep*2),this._tmpCtx=X(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(),!0)}_doWarmUp(){let e=new kf;for(let t=33;t<126;t++)e.enqueue(()=>{if(!this._cacheMap.get(t,0,0,0)){let e=this._drawToCache(t,0,0,0,!1,void 0);this._cacheMap.set(t,0,0,0,e)}})}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(e.maxAtlasPages&&this._pages.length>=Math.max(4,e.maxAtlasPages)){let t=this._pages.filter(t=>t.canvas.width*2<=(e.maxTextureSize||4096)).sort((e,t)=>t.canvas.width===e.canvas.width?t.percentageUsed-e.percentageUsed:t.canvas.width-e.canvas.width),n=-1,r=0;for(let e=0;ee.glyphs[0].texturePage).sort((e,t)=>e>t?1:-1),o=this.pages.length-i.length,s=this._mergePages(i,o);s.version++;for(let e=a.length-1;e>=0;e--)this._deletePage(a[e]);this.pages.push(s),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(s.canvas)}let t=new rp(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(e,t){let n=e[0].canvas.width*2,r=new rp(this._document,n,e);for(let[i,a]of e.entries()){let e=i*a.canvas.width%n,o=Math.floor(i/2)*a.canvas.height;r.ctx.drawImage(a.canvas,e,o);for(let r of a.glyphs)r.texturePage=t,r.sizeClipSpace.x=r.size.x/n,r.sizeClipSpace.y=r.size.y/n,r.texturePosition.x+=e,r.texturePosition.y+=o,r.texturePositionClipSpace.x=r.texturePosition.x/n,r.texturePositionClipSpace.y=r.texturePosition.y/n;this._onRemoveTextureAtlasCanvas.fire(a.canvas);let s=this._activePages.indexOf(a);s!==-1&&this._activePages.splice(s,1)}return r}_deletePage(e){this._pages.splice(e,1);for(let t=e;t=this._config.colors.ansi.length)throw Error(`No color found for idx `+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,n,r){if(this._config.allowTransparency)return Id;let i;switch(e){case 16777216:case 33554432:i=this._getColorFromAnsiIndex(t);break;case 50331648:let e=Af.toColorRGB(t);i=Ld.toColor(e[0],e[1],e[2]);break;default:i=n?Rd.opaque(this._config.colors.foreground):this._config.colors.background;break}return this._config.allowTransparency||(i=Rd.opaque(i)),i}_getForegroundColor(e,t,n,r,i,a,o,s,c,l){let u=this._getMinimumContrastColor(e,t,n,r,i,a,o,c,s,l);if(u)return u;let d;switch(i){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&c&&a<8&&(a+=8),d=this._getColorFromAnsiIndex(a);break;case 50331648:let e=Af.toColorRGB(a);d=Ld.toColor(e[0],e[1],e[2]);break;default:d=o?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(d=Rd.opaque(d)),s&&(d=Rd.multiplyOpacity(d,lf)),d}_resolveBackgroundRgba(e,t,n){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,n,r){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,n,r,i,a,o,s,c,l){if(this._config.minimumContrastRatio===1||l)return;let u=this._getContrastCache(c),d=u.getColor(e,r);if(d!==void 0)return d||void 0;let f=this._resolveBackgroundRgba(t,n,o),p=this._resolveForegroundRgba(i,a,o,s),m=Vd.ensureContrastRatio(f,p,this._config.minimumContrastRatio/(c?2:1));if(!m){u.setColor(e,r,null);return}let h=Ld.toColor(m>>24&255,m>>16&255,m>>8&255);return u.setColor(e,r,h),h}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,n,r,i,a,o){let s=typeof t==`number`?String.fromCharCode(t):t;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display=`none`,o.append(this._tmpCanvas));let c=Math.min(this._config.deviceCellWidth*Math.max(s.length,2)+ep*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width=e?e*2-c:e-c;c>=e||f===0?(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(s+f,r),this._tmpCtx.lineTo(l,r)):(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(s+f,r),this._tmpCtx.moveTo(s+f+e,r),this._tmpCtx.lineTo(l,r)),c=$d(l-s,e,c);break;case 5:let p=l-s,m=Math.floor(.6*p),h=Math.floor(.3*p),g=p-m-h;this._tmpCtx.setLineDash([m,h,g]),this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(l,r);break;default:this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(l,r);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!E&&this._config.fontSize>=12&&!this._config.allowTransparency&&s!==` `){this._tmpCtx.save(),this._tmpCtx.textBaseline=`alphabetic`;let t=this._tmpCtx.measureText(s);if(this._tmpCtx.restore(),`actualBoundingBoxDescent`in t&&t.actualBoundingBoxDescent>0){this._tmpCtx.save();let t=new Path2D;t.rect(n,r-Math.ceil(e/2),this._config.deviceCellWidth*ne,o-r+Math.ceil(e/2)),this._tmpCtx.clip(t),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=ee.css,this._tmpCtx.strokeText(s,T,T+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(g){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(T,T+t),this._tmpCtx.lineTo(T+this._config.deviceCharWidth*ne,T+t),this._tmpCtx.stroke()}if(E||this._tmpCtx.fillText(s,T,T+this._config.deviceCharHeight),s===`_`&&!this._config.allowTransparency){let e=ip(this._tmpCtx.getImageData(T,T,this._config.deviceCellWidth,this._config.deviceCellHeight),ee,w,D);if(e)for(let t=1;t<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=ee.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(s,T,T+this._config.deviceCharHeight-t),e=ip(this._tmpCtx.getImageData(T,T,this._config.deviceCellWidth,this._config.deviceCellHeight),ee,w,D),e);t++);}if(h){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),t=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(T,T+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.lineTo(T+this._config.deviceCharWidth*ne,T+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.stroke()}this._tmpCtx.restore();let re=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),O;if(O=this._config.allowTransparency?ap(re):ip(re,ee,w,D),O)return $f;let k=this._findGlyphBoundingBox(re,this._workBoundingBox,c,C,E,T),A,j;for(;;){if(this._activePages.length===0){let e=this._createNewPage();A=e,j=e.currentRow,j.height=k.size.y;break}A=this._activePages[this._activePages.length-1],j=A.currentRow;for(let e of this._activePages)k.size.y<=e.currentRow.height&&(A=e,j=e.currentRow);for(let e=this._activePages.length-1;e>=0;e--)for(let t of this._activePages[e].fixedRows)t.height<=j.height&&k.size.y<=t.height&&(A=this._activePages[e],j=t);if(k.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new rp(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),A=this._overflowSizePage,j=this._overflowSizePage.currentRow,j.x+k.size.x>=A.canvas.width&&(j.x=0,j.y+=j.height,j.height=0);break}if(j.y+k.size.y>=A.canvas.height||j.height>k.size.y+2){let t=!1;if(A.currentRow.y+A.currentRow.height+k.size.y>=A.canvas.height){let n;for(let e of this._activePages)if(e.currentRow.y+e.currentRow.height+k.size.y=e.maxAtlasPages&&j.y+k.size.y<=A.canvas.height&&j.height>=k.size.y&&j.x+k.size.x<=A.canvas.width)t=!0;else{let e=this._createNewPage();A=e,j=e.currentRow,j.height=k.size.y,t=!0}}t||(A.currentRow.height>0&&A.fixedRows.push(A.currentRow),j={x:0,y:A.currentRow.y+A.currentRow.height,height:k.size.y},A.fixedRows.push(j),A.currentRow={x:0,y:j.y+j.height,height:0})}if(j.x+k.size.x<=A.canvas.width)break;j===A.currentRow?(j.x=0,j.y+=j.height,j.height=0):A.fixedRows.splice(A.fixedRows.indexOf(j),1)}return k.texturePage=this._pages.indexOf(A),k.texturePosition.x=j.x,k.texturePosition.y=j.y,k.texturePositionClipSpace.x=j.x/A.canvas.width,k.texturePositionClipSpace.y=j.y/A.canvas.height,k.sizeClipSpace.x/=A.canvas.width,k.sizeClipSpace.y/=A.canvas.height,j.height=Math.max(j.height,k.size.y),j.x+=k.size.x,A.ctx.putImageData(re,k.texturePosition.x-this._workBoundingBox.left,k.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,k.size.x,k.size.y),A.addGlyph(k),A.version++,k}_findGlyphBoundingBox(e,t,n,r,i,a){t.top=0;let o=r?this._config.deviceCellHeight:this._tmpCanvas.height,s=r?this._config.deviceCellWidth:n,c=!1;for(let n=0;n=a;n--){for(let r=0;r=0;n--){for(let r=0;r>>24,a=t.rgba>>>16&255,o=t.rgba>>>8&255,s=n.rgba>>>24,c=n.rgba>>>16&255,l=n.rgba>>>8&255,u=Math.floor((Math.abs(i-s)+Math.abs(a-c)+Math.abs(o-l))/12),d=!0;for(let t=0;t0)return!1;return!0}function op(e,t,n){let r=e.createElement(`canvas`);return r.width=t,r.height=n,r}function sp(e,t,n,r,i,a,o,s){let c={foreground:a.foreground,background:a.background,cursor:Id,cursorAccent:Id,selectionForeground:Id,selectionBackgroundTransparent:Id,selectionBackgroundOpaque:Id,selectionInactiveBackgroundTransparent:Id,selectionInactiveBackgroundOpaque:Id,overviewRulerBorder:Id,scrollbarSliderBackground:Id,scrollbarSliderHoverBackground:Id,scrollbarSliderActiveBackground:Id,ansi:a.ansi.slice(),contrastCache:a.contrastCache,halfContrastCache:a.halfContrastCache};return{customGlyphs:i.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:s,letterSpacing:i.letterSpacing,lineHeight:i.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:n,deviceCharHeight:r,fontFamily:i.fontFamily,fontSize:i.fontSize,fontWeight:i.fontWeight,fontWeightBold:i.fontWeightBold,allowTransparency:i.allowTransparency,drawBoldTextInBrightColors:i.drawBoldTextInBrightColors,minimumContrastRatio:i.minimumContrastRatio,colors:c}}function cp(e,t){for(let n=0;n=0){if(cp(n.config,l))return n.atlas;n.ownedBy.length===1?(n.atlas.dispose(),up.splice(t,1)):n.ownedBy.splice(r,1);break}}for(let t=0;t{this._renderCallback(),this._animationFrame=void 0}))}_restartInterval(e=pp){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let e=pp-(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=pp-(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})},pp)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function hp(e,t,n){let r=new t.ResizeObserver(t=>{let i=t.find(t=>t.target===e);if(!i)return;if(!(`devicePixelContentBoxSize`in i)){r?.disconnect(),r=void 0;return}let a=i.devicePixelContentBoxSize[0].inlineSize,o=i.devicePixelContentBoxSize[0].blockSize;a>0&&o>0&&n(a,o)});try{r.observe(e,{box:[`device-pixel-content-box`]})}catch{r.disconnect(),r=void 0}return bd(()=>r?.disconnect())}function gp(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var _p=class e extends Af{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new jf,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?gp(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 t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},vp=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function yp(e,t,n){let r=X(e.createProgram());if(e.attachShader(r,X(bp(e,e.VERTEX_SHADER,t))),e.attachShader(r,X(bp(e,e.FRAGMENT_SHADER,n))),e.linkProgram(r),e.getProgramParameter(r,e.LINK_STATUS))return r;console.error(e.getProgramInfoLog(r)),e.deleteProgram(r)}function bp(e,t,n){let r=X(e.createShader(t));if(e.shaderSource(r,n),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS))return r;console.error(e.getShaderInfoLog(r)),e.deleteShader(r)}function xp(e,t){let n=Math.min(e.length*2,t),r=new Float32Array(n);for(let t=0;ti.deleteProgram(this._program))),this._projectionLocation=X(i.getUniformLocation(this._program,`u_projection`)),this._resolutionLocation=X(i.getUniformLocation(this._program,`u_resolution`)),this._textureLocation=X(i.getUniformLocation(this._program,`u_texture`)),this._vertexArrayObject=i.createVertexArray(),i.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),o=i.createBuffer();this._register(bd(()=>i.deleteBuffer(o))),i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,a,i.STATIC_DRAW),i.enableVertexAttribArray(0),i.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let s=new Uint8Array([0,1,2,3]),c=i.createBuffer();this._register(bd(()=>i.deleteBuffer(c))),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,c),i.bufferData(i.ELEMENT_ARRAY_BUFFER,s,i.STATIC_DRAW),this._attributesBuffer=X(i.createBuffer()),this._register(bd(()=>i.deleteBuffer(this._attributesBuffer))),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.enableVertexAttribArray(2),i.vertexAttribPointer(2,2,i.FLOAT,!1,Ep,0),i.vertexAttribDivisor(2,1),i.enableVertexAttribArray(3),i.vertexAttribPointer(3,2,i.FLOAT,!1,Ep,2*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(3,1),i.enableVertexAttribArray(4),i.vertexAttribPointer(4,1,i.FLOAT,!1,Ep,4*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(4,1),i.enableVertexAttribArray(5),i.vertexAttribPointer(5,2,i.FLOAT,!1,Ep,5*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(5,1),i.enableVertexAttribArray(6),i.vertexAttribPointer(6,2,i.FLOAT,!1,Ep,7*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(6,1),i.enableVertexAttribArray(1),i.vertexAttribPointer(1,2,i.FLOAT,!1,Ep,9*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(1,1),i.useProgram(this._program);let l=new Int32Array(np.maxAtlasPages);for(let e=0;ei.deleteTexture(t.texture))),i.activeTexture(i.TEXTURE0+e),i.bindTexture(i.TEXTURE_2D,t.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[e]=t}i.enable(i.BLEND),i.blendFunc(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(e,t,n,r,i,a,o,s,c){this._updateCell(this._vertices.attributes,e,t,n,r,i,a,o,s,c)}_updateCell(e,t,n,r,i,a,o,s,c,l){if(Q=(n*this._terminal.cols+t)*Tp,r===0||r===void 0){e.fill(0,Q,Q+Tp-1-Dp);return}this._atlas&&($=s&&s.length>1?this._atlas.getRasterizedGlyphCombinedChar(s,i,a,o,!1,this._terminal.element):this._atlas.getRasterizedGlyph(r,i,a,o,!1,this._terminal.element),Op=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),i!==l&&$.offset.x>Op?(kp=$.offset.x-Op,e[Q]=-($.offset.x-kp)+this._dimensions.device.char.left,e[Q+1]=-$.offset.y+this._dimensions.device.char.top,e[Q+2]=($.size.x-kp)/this._dimensions.device.canvas.width,e[Q+3]=$.size.y/this._dimensions.device.canvas.height,e[Q+4]=$.texturePage,e[Q+5]=$.texturePositionClipSpace.x+kp/this._atlas.pages[$.texturePage].canvas.width,e[Q+6]=$.texturePositionClipSpace.y,e[Q+7]=$.sizeClipSpace.x-kp/this._atlas.pages[$.texturePage].canvas.width,e[Q+8]=$.sizeClipSpace.y):(e[Q]=-$.offset.x+this._dimensions.device.char.left,e[Q+1]=-$.offset.y+this._dimensions.device.char.top,e[Q+2]=$.size.x/this._dimensions.device.canvas.width,e[Q+3]=$.size.y/this._dimensions.device.canvas.height,e[Q+4]=$.texturePage,e[Q+5]=$.texturePositionClipSpace.x,e[Q+6]=$.texturePositionClipSpace.y,e[Q+7]=$.sizeClipSpace.x,e[Q+8]=$.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&Yd(r,c,$.size.x,this._dimensions.device.cell.width)&&(e[Q+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*Tp;this._vertices.count===t?this._vertices.attributes.fill(0):this._vertices.attributes=new Float32Array(t);let n=0;for(;n=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n=this.startCol&&t=this.startCol):!1}};function Mp(){return new jp}var Np=4,Pp=1,Fp=2,Ip=3,Lp=2147483648,Rp=class{constructor(){this.cells=new Uint32Array,this.lineLengths=new Uint32Array,this.selection=Mp()}resize(e,t){let n=e*t*Np;n!==this.cells.length&&(this.cells=new Uint32Array(n),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},zp=`#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; -}`,Bp=`#version 300 es -precision lowp float; - -in vec4 v_color; - -out vec4 outColor; - -void main() { - outColor = v_color; -}`,Vp=8,Hp=Vp*Float32Array.BYTES_PER_ELEMENT,Up=20*Vp,Wp=class{constructor(){this.attributes=new Float32Array(Up),this.count=0}},Gp=0,Kp=0,qp=0,Jp=0,Yp=0,Xp=0,Zp=0,Qp=class extends Cd{constructor(e,t,n,r){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=r,this._vertices=new Wp,this._verticesCursor=new Wp;let i=this._gl;this._program=X(yp(i,zp,Bp)),this._register(bd(()=>i.deleteProgram(this._program))),this._projectionLocation=X(i.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=i.createVertexArray(),i.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),o=i.createBuffer();this._register(bd(()=>i.deleteBuffer(o))),i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,a,i.STATIC_DRAW),i.enableVertexAttribArray(3),i.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let s=new Uint8Array([0,1,2,3]),c=i.createBuffer();this._register(bd(()=>i.deleteBuffer(c))),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,c),i.bufferData(i.ELEMENT_ARRAY_BUFFER,s,i.STATIC_DRAW),this._attributesBuffer=X(i.createBuffer()),this._register(bd(()=>i.deleteBuffer(this._attributesBuffer))),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.enableVertexAttribArray(0),i.vertexAttribPointer(0,2,i.FLOAT,!1,Hp,0),i.vertexAttribDivisor(0,1),i.enableVertexAttribArray(1),i.vertexAttribPointer(1,2,i.FLOAT,!1,Hp,2*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(1,1),i.enableVertexAttribArray(2),i.vertexAttribPointer(2,4,i.FLOAT,!1,Hp,4*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(e=>{this._updateCachedColors(e),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,vp),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.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(e){let t=this._terminal,n=this._vertices,r=1,i,a,o,s,c,l,u,d,f,p,m;for(i=0;i>24&255)/255,Yp=(Gp>>16&255)/255,Xp=(Gp>>8&255)/255,Zp=1,this._addRectangle(e.attributes,t,Kp,qp,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Jp,Yp,Xp,Zp)}_addRectangle(e,t,n,r,i,a,o,s,c,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=s,e[t+6]=c,e[t+7]=l}_addRectangleFloat(e,t,n,r,i,a,o){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},$p=class extends Cd{constructor(e,t,n,r,i,a,o,s){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=o,this._themeService=s,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-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(t=>{this._refreshCharAtlas(e,t),this.reset(e)})),this._register(bd(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=X(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=dp(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*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(e,t,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=uf,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){let r=t?e.options.fontWeightBold:e.options.fontWeight;return`${n?`italic`:``} ${r} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},em=class extends $p{constructor(e,t,n,r,i,a,o){super(n,e,`link`,t,!0,i,a,o),this._register(r.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(r.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&lp(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t=0;!(am.indexOf(`Chrome`)>=0)&&am.indexOf(`Safari`),am.indexOf(`Electron/`),am.indexOf(`Android`);var sm=!1;if(typeof tm.matchMedia==`function`){let e=tm.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=tm.matchMedia(`(display-mode: fullscreen)`);sm=e.matches,im(tm,e,({matches:e})=>{sm&&t.matches||(sm=e)})}function cm(){return sm}var lm=`en`,um=!1,dm=!1,fm=!1,pm=lm,mm,hm=globalThis,gm;typeof hm.vscode<`u`&&typeof hm.vscode.process<`u`?gm=hm.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(gm=process);var _m=typeof gm?.versions?.electron==`string`&&gm?.type===`renderer`;if(typeof gm==`object`){gm.platform,gm.platform,um=gm.platform===`linux`,um&&gm.env.SNAP&&gm.env.SNAP_REVISION,gm.env.CI||gm.env.BUILD_ARTIFACTSTAGINGDIRECTORY,pm=lm;let e=gm.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,pm=t.resolvedLanguage||lm,t.languagePack?.translationsConfigFile}catch{}dm=!0}else typeof navigator==`object`&&!_m?(mm=navigator.userAgent,mm.indexOf(`Windows`),mm.indexOf(`Macintosh`),(mm.indexOf(`Macintosh`)>=0||mm.indexOf(`iPad`)>=0||mm.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,um=mm.indexOf(`Linux`)>=0,mm?.indexOf(`Mobi`),fm=!0,pm=globalThis._VSCODE_NLS_LANGUAGE||lm,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var vm=dm;fm&&typeof hm.importScripts==`function`&&hm.origin;var ym=mm,bm=pm,xm;(e=>{function t(){return bm}e.value=t;function n(){return bm.length===2?bm===`en`:bm.length>=3?bm[0]===`e`&&bm[1]===`n`&&bm[2]===`-`:!1}e.isDefaultVariant=n;function r(){return bm===`en`}e.isDefault=r})(xm||={});var Sm=typeof hm.postMessage==`function`&&!hm.importScripts;(()=>{if(Sm){let e=[];hm.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n{let r=++t;e.push({id:r,callback:n}),hm.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var Cm=!!(ym&&ym.indexOf(`Chrome`)>=0);ym&&ym.indexOf(`Firefox`),!Cm&&ym&&ym.indexOf(`Safari`),ym&&ym.indexOf(`Edg/`),ym&&ym.indexOf(`Android`);var wm=typeof navigator==`object`?navigator:{};vm||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||wm&&wm.clipboard&&wm.clipboard.writeText,vm||wm&&wm.clipboard&&wm.clipboard.readText,vm||cm()||wm.keyboard,`ontouchstart`in tm||wm.maxTouchPoints,tm.PointerEvent&&(`ontouchstart`in tm||navigator.maxTouchPoints);var Tm=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Em=new Tm,Dm=new Tm,Om=new Tm;Array(230);var km;(e=>{function t(e){return Em.keyCodeToStr(e)}e.toString=t;function n(e){return Em.strToKeyCode(e)}e.fromString=n;function r(e){return Dm.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return Om.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return Dm.strToKeyCode(e)||Om.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return Em.keyCodeToStr(e)}e.toElectronAccelerator=o})(km||={});var Am=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),jm;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof Mm?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Rf.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Am})})(jm||={});var Mm=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?Am:(this._emitter||=new Z,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var Nm;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(Nm||={});var Pm=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new Z,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.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(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.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())}};Pm.EMPTY=Pm.fromArray([]);function Fm(e){return 55296<=e&&e<=56319}function Im(e){return 56320<=e&&e<=57343}function Lm(e,t){return(e-55296<<10)+(t-56320)+65536}function Rm(e){return zm(e,0)}function zm(e,t){switch(typeof e){case`object`:return e===null?Bm(349,t):Array.isArray(e)?Um(e,t):Wm(e,t);case`string`:return Hm(e,t);case`boolean`:return Vm(e,t);case`number`:return Bm(e,t);case`undefined`:return Bm(937,t);default:return Bm(617,t)}}function Bm(e,t){return(t<<5)-t+e|0}function Vm(e,t){return Bm(e?433:863,t)}function Hm(e,t){t=Bm(149417,t);for(let n=0,r=e.length;nzm(t,e),t)}function Wm(e,t){return t=Bm(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=Hm(n,t),zm(e[n],t)),t)}function Gm(e,t,n=32){let r=n-t,i=~((1<>>r)>>>0}function Km(e,t=0,n=e.byteLength,r=0){for(let i=0;ie.toString(16).padStart(2,`0`)).join(``):qm((e>>>0).toString(16),t/4)}var Ym=class e{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){let t=e.length;if(t===0)return;let n=this._buff,r=this._buffLen,i=this._leftoverHighSurrogate,a,o;for(i===0?(a=e.charCodeAt(0),o=0):(a=i,o=-1,i=0);;){let s=a;if(Fm(a))if(o+1>>6,e[t++]=128|(n&63)>>>0):n<65536?(e[t++]=224|(n&61440)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0):(e[t++]=240|(n&1835008)>>>18,e[t++]=128|(n&258048)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),Jm(this._h0)+Jm(this._h1)+Jm(this._h2)+Jm(this._h3)+Jm(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,Km(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Km(this._buff));let e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){let t=e._bigBlock32,n=this._buffDV;for(let e=0;e<64;e+=4)t.setUint32(e,n.getUint32(e,!1),!1);for(let e=64;e<320;e+=4)t.setUint32(e,Gm(t.getUint32(e-12,!1)^t.getUint32(e-32,!1)^t.getUint32(e-56,!1)^t.getUint32(e-64,!1),1),!1);let r=this._h0,i=this._h1,a=this._h2,o=this._h3,s=this._h4,c,l,u;for(let e=0;e<80;e++)e<20?(c=i&a|~i&o,l=1518500249):e<40?(c=i^a^o,l=1859775393):e<60?(c=i&a|i&o|a&o,l=2400959708):(c=i^a^o,l=3395469782),u=Gm(r,5)+c+s+l+t.getUint32(e*4,!1)&4294967295,s=o,o=a,a=Gm(i,30),i=r,r=u;this._h0=this._h0+r&4294967295,this._h1=this._h1+i&4294967295,this._h2=this._h2+a&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+s&4294967295}};Ym._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:Xm,getWindow:Zm,getDocument:Qm,getWindows:$m,getWindowsCount:eh,getWindowId:th,getWindowById:nh,hasWindow:rh,onDidRegisterWindow:ih,onWillUnregisterWindow:ah,onDidUnregisterWindow:oh}=function(){let e=new Map,t={window:tm,disposables:new Sd};e.set(tm.vscodeWindowId,t);let n=new Z,r=new Z,i=new Z;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return Cd.None;let a=new Sd,o={window:t,disposables:a.add(new Sd)};return e.set(t.vscodeWindowId,o),a.add(bd(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(ch(t,uh.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:tm},getDocument(e){return Zm(e).document}}}(),sh=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,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,null)}};function ch(e,t,n,r){return new sh(e,t,n,r)}var lh=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};lh.None=new lh(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=Rm(n),a=r.get(i);if(a)a.users+=1;else{let o=new Z,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(bd(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var uh={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:om?`webkitAnimationStart`:`animationstart`,ANIMATION_END:om?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:om?`webkitAnimationIteration`:`animationiteration`},dh=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function fh(e,t,n,...r){let i=dh.exec(t);if(!i)throw Error(`Bad use of emmet`);let a=i[1]||`div`,o;return o=e===`http://www.w3.org/1999/xhtml`?document.createElement(a):document.createElementNS(e,a),i[3]&&(o.id=i[3]),i[4]&&(o.className=i[4].replace(/\./g,` `).trim()),n&&Object.entries(n).forEach(([e,t])=>{typeof t>`u`||(/^on\w+$/.test(e)?o[e]=t:e===`selected`?t&&o.setAttribute(e,`true`):o.setAttribute(e,t))}),o.append(...r),o}function ph(e,t,...n){return fh(`http://www.w3.org/1999/xhtml`,e,t,...n)}ph.SVG=function(e,t,...n){return fh(`http://www.w3.org/2000/svg`,e,t,...n)};var mh=class extends Cd{constructor(e,t,n,r,i,a,o,s,c){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._optionsService=o,this._themeService=s,this._cursorBlinkStateManager=new wd,this._charAtlasDisposable=this._register(new wd),this._observerDisposable=this._register(new wd),this._model=new Rp,this._workCell=new _p,this._workCell2=new _p,this._rectangleRenderer=this._register(new wd),this._glyphRenderer=this._register(new wd),this._onChangeTextureAtlas=this._register(new Z),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Z),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Z),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Z),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Z),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let l={antialias:!1,depth:!1,preserveDrawingBuffer:c};if(this._gl=this._canvas.getContext(`webgl2`,l),!this._gl)throw Error(`WebGL2 not supported `+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new cf(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new em(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=Zd(),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(ch(this._canvas,`webglcontextlost`,e=>{console.log(`webglcontextlost event received`),e.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn(`webgl context not restored; firing onContextLoss`),this._onContextLoss.fire(e)},3e3)})),this._register(ch(this._canvas,`webglcontextrestored`,e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,fp(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=hp(this._canvas,this._coreBrowserService.window,(e,t)=>this._setCanvasDevicePixelDimensions(e,t)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=hp(this._canvas,e,(e,t)=>this._setCanvasDevicePixelDimensions(e,t))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(bd(()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),fp(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(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let e of this._renderLayers)e.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 e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new Qp(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new Ap(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 e=dp(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!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=yd(Rf.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Rf.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){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 n of this._renderLayers)n.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),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 mp(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r=this._workCell,i,a,o,s,c,l,u=0,d=!0,f,p,m,h,g,_,v,y,b;e=gh(e,n.rows-1,0),t=gh(t,n.rows-1,0);let ee=this._coreService.decPrivateModes.cursorStyle??n.options.cursorStyle??`block`,x=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,S=x-n.buffer.ydisp,te=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),C=-1,w=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let T=!1;for(a=e;a<=t;a++)for(o=a+n.buffer.ydisp,s=n.buffer.lines.get(o),this._model.lineLengths[a]=0,m=x===o,u=0,c=this._characterJoinerService.getJoinedCharacters(o),y=0;y=u,f=y,c.length>0&&y===c[0][0]&&d){p=c.shift();let e=this._model.selection.isCellSelected(this._terminal,p[0],o);for(v=p[0]+1;v=p[1],d?(l=!0,r=new hh(r,s.translateToString(!0,p[0],p[1]),p[1]-p[0]),f=p[1]-1):u=p[1]}if(h=r.getChars(),g=r.getCode(),v=(a*n.cols+y)*Np,this._cellColorResolver.resolve(r,y,o,this.dimensions.device.cell.width),w&&o===x&&(y===te&&(this._model.cursor={x:te,y:S,width:r.getWidth(),style:this._coreBrowserService.isFocused?ee:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},C=te+r.getWidth()-1),y>=te&&y<=C&&(this._coreBrowserService.isFocused&&ee===`block`||this._coreBrowserService.isFocused===!1&&n.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)),g!==0&&(this._model.lineLengths[a]=y+1),!(this._model.cells[v]===g&&this._model.cells[v+Pp]===this._cellColorResolver.result.bg&&this._model.cells[v+Fp]===this._cellColorResolver.result.fg&&this._model.cells[v+Ip]===this._cellColorResolver.result.ext)&&(T=!0,h.length>1&&(g|=Lp),this._model.cells[v]=g,this._model.cells[v+Pp]=this._cellColorResolver.result.bg,this._model.cells[v+Fp]=this._cellColorResolver.result.fg,this._model.cells[v+Ip]=this._cellColorResolver.result.ext,_=r.getWidth(),this._glyphRenderer.value.updateCell(y,a,g,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,h,_,i),l)){for(r=this._workCell,y++;y<=f;y++)b=(a*n.cols+y)*Np,this._glyphRenderer.value.updateCell(y,a,0,0,0,0,Md,0,0),this._model.cells[b]=0,this._model.cells[b+Pp]=this._cellColorResolver.result.bg,this._model.cells[b+Fp]=this._cellColorResolver.result.fg,this._model.cells[b+Ip]=this._cellColorResolver.result.ext;y--}}T&&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(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},hh=class extends Af{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function gh(e,t,n=0){return Math.max(Math.min(e,t),n)}var _h=`di$target`,vh=`di$dependencies`,yh=new Map;function bh(e){if(yh.has(e))return yh.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);xh(t,e,r)};return t._id=e,yh.set(e,t),t}function xh(e,t,n){t[_h]===t?t[vh].push({id:e,index:n}):(t[vh]=[{id:e,index:n}],t[_h]=t)}bh(`BufferService`),bh(`CoreMouseService`),bh(`CoreService`),bh(`CharsetService`),bh(`InstantiationService`),bh(`LogService`);var Sh=bh(`OptionsService`);bh(`OscLinkService`),bh(`UnicodeService`),bh(`DecorationService`);var Ch={trace:0,debug:1,info:2,warn:3,error:4,off:5},wh=`xterm.js: `,Th=class extends Cd{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),Eh=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Ch[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;tthis.activate(e)));return}this._terminal=e;let n=t.coreService,r=t.optionsService,i=t,a=i._renderService,o=i._characterJoinerService,s=i._charSizeService,c=i._coreBrowserService,l=i._decorationService;i._logService;let u=i._themeService;this._renderer=this._register(new mh(e,o,s,c,n,l,r,u,this._preserveDrawingBuffer)),this._register(Rf.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Rf.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Rf.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Rf.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),a.setRenderer(this._renderer),this._register(bd(()=>{if(this._terminal._core._store._isDisposed)return;let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}},Oh=class{aliases;usage;matches(e){let t=e.toLowerCase();return t===this.name.toLowerCase()||(this.aliases?.some(e=>t===e.toLowerCase())??!1)}writeLine(e,t,n){n?e.writeln(`${n}${t}\x1b[0m`):e.writeln(t)}writeSuccess(e,t){e.writeln(`\x1b[1;32m✓\x1b[0m ${t}`)}writeError(e,t){e.writeln(`\x1b[1;31m✗ Error:\x1b[0m ${t}`)}writeInfo(e,t){e.writeln(`\x1b[90m${t}\x1b[0m`)}startLoading(e,t){let n=[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`],r=0,i=!0,a=setInterval(()=>{if(!i){clearInterval(a);return}e.write(`\r\x1b[36m${n[r]}\x1b[0m ${t}`),r=(r+1)%n.length},80);return()=>{i=!1,clearInterval(a),e.write(`\r\x1B[K`)}}},kh=class extends Oh{name=`help`;description=`Show available commands`;aliases=[`?`,`h`];constructor(e){super(),this.commands=e}execute({term:e,writePrompt:t}){e.writeln(``),e.writeln(`\x1B[1;33mAvailable Commands:\x1B[0m`),e.writeln(``),this.commands.forEach(t=>{let n=t.aliases?.length?` (${t.aliases.join(`, `)})`:``;e.writeln(` \x1b[1;36m${t.name.padEnd(15)}\x1b[0m ${t.description}${n}`)}),e.writeln(``),e.writeln(`\x1B[90mTip: Use Tab for autocomplete, ↑↓ for history, Ctrl+F to search\x1B[0m`),t()}},Ah=class extends Oh{name=`clear`;description=`Clear terminal screen`;aliases=[`cls`];execute({term:e,writePrompt:t}){e.clear(),t()}},jh=class extends Oh{name=`status`;description=`Show repeater status`;aliases=[`st`];execute({term:e,writePrompt:t}){let n=p().stats;if(n&&typeof n==`object`){this.writeSuccess(e,`Repeater Status:`),e.writeln(``);for(let[t,r]of Object.entries(n))e.writeln(` \x1b[36m${t.padEnd(20)}\x1b[0m ${r}`)}else this.writeError(e,`No status data available`);t()}},Mh=class extends Oh{name=`uptime`;description=`Show system uptime`;execute({term:e,writePrompt:t}){let n=p().stats?.uptime_seconds||0;this.writeSuccess(e,this.formatUptime(n)),t()}formatUptime(e){let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`}},Nh=class extends Oh{name=`packets`;description=`Show packet statistics`;isMobile(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<768}execute({term:e,writePrompt:t}){let n=p().stats;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,``),t()}},Ph=class extends Oh{name=`board`;description=`Show board information`;execute({term:e,writePrompt:t}){let n=p().stats?.board_info||`pyMC_Repeater (Linux/RPi)`;this.writeSuccess(e,n),t()}},Fh=class extends Oh{name=`advert`;description=`Send neighbor advert immediately`;async execute({term:e,writePrompt:t}){let n=this.startLoading(e,`Sending advert...`);try{let t=await f.post(`/send_advert`,{},{timeout:1e4});n(),t.success?this.writeSuccess(e,t.data||`Advert sent successfully`):this.writeError(e,t.error||`Failed to send advert`)}catch(t){n(),this.writeError(e,`Failed to send advert: ${t}`)}t()}},Ih=class extends Oh{name=`get`;description=`Get configuration values (name, freq, tx, mode, duty, etc.)`;matches(e){let t=e.toLowerCase();return t===`get`||t.startsWith(`get `)}execute({term:e,args:t,writePrompt:n}){let r=t[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,``),n();return}let i=p().stats;if(!i){this.writeError(e,`System stats not available`),n();return}{let t=i,a=t.config||{},o=a.radio||{},s=a.repeater||{},c=a.delays||{},l=a.duty_cycle||{},u=``;switch(r){case`name`:u=a.node_name||`Unknown`;break;case`role`:u=`repeater`;break;case`lat`:u=s.latitude==null?`not set`:String(s.latitude);break;case`lon`:u=s.longitude==null?`not set`:String(s.longitude);break;case`freq`:u=o.frequency?`${(o.frequency/1e6).toFixed(3)} MHz`:`?`;break;case`tx`:u=o.tx_power==null?`?`:`${o.tx_power}dBm`;break;case`bw`:u=o.bandwidth?`${o.bandwidth/1e3} kHz`:`?`;break;case`sf`:u=o.spreading_factor==null?`?`:String(o.spreading_factor);break;case`cr`:u=o.coding_rate==null?`?`:`4/${o.coding_rate}`;break;case`radio`:if(o.frequency){this.writeSuccess(e,`Radio Configuration:`),this.writeLine(e,``),this.writeLine(e,` \x1b[36mFrequency:\x1b[0m ${(o.frequency/1e6).toFixed(3)} MHz`),this.writeLine(e,` \x1b[36mBandwidth:\x1b[0m ${o.bandwidth/1e3} kHz`),this.writeLine(e,` \x1b[36mSpreading Factor:\x1b[0m ${o.spreading_factor}`),this.writeLine(e,` \x1b[36mCoding Rate:\x1b[0m 4/${o.coding_rate}`),this.writeLine(e,` \x1b[36mTX Power:\x1b[0m ${o.tx_power}dBm`),this.writeLine(e,``),n();return}else u=`Radio configuration not available`;break;case`af`:case`txdelay`:u=c.tx_delay_factor==null?`\x1B[90mnot set (default: 1.0)\x1B[0m`:String(c.tx_delay_factor);break;case`direct.txdelay`:u=c.direct_tx_delay_factor==null?`\x1B[90mnot set (default: 0.5)\x1B[0m`:String(c.direct_tx_delay_factor);break;case`rxdelay`:u=c.rx_delay_base==null?`\x1B[90mnot set (default: 0.0s)\x1B[0m`:`${c.rx_delay_base}s`;break;case`mode`:u=s.mode==null?`\x1B[90mnot set (default: forward)\x1B[0m`:s.mode;break;case`repeat`:u=s.mode==null?`\x1B[90mnot set (default: on)\x1B[0m`:s.mode===`forward`?`on`:`off`;break;case`flood.max`:u=s.max_flood_hops==null?`\x1B[90mnot set (default: 3)\x1B[0m`:String(s.max_flood_hops);break;case`flood.advert.interval`:u=s.send_advert_interval_hours==null?`\x1B[90mnot set\x1B[0m`:`${s.send_advert_interval_hours}h`;break;case`advert.interval`:u=s.advert_interval_minutes==null?`\x1B[90mnot set (default: 120m)\x1B[0m`:`${s.advert_interval_minutes}m`;break;case`duty`:case`duty.enabled`:u=l.enforcement_enabled==null?`\x1B[90mnot set (default: off)\x1B[0m`:l.enforcement_enabled?`on`:`off`;break;case`duty.max`:u=l.max_airtime_percent==null?`\x1B[90mnot set\x1B[0m`:`${l.max_airtime_percent}%`;break;case`public.key`:u=t.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`),n();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`),n();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`),n();return}this.writeSuccess(e,u)}n()}writeWarning(e,t){e.writeln(`\x1b[1;33m⚠ Warning:\x1b[0m ${t}`)}},Lh=class extends Oh{name=`set`;description=`Set configuration values (tx, txdelay, mode, duty, etc.)`;matches(e){let t=e.toLowerCase();return t===`set`||t.startsWith(`set `)}async execute({term:e,args:t,writePrompt:n}){let r=t[0]?.toLowerCase(),i=t.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,``),n();return}let a=this.startLoading(e,`Updating configuration...`);try{let t;switch(r){case`tx`:{let r=parseInt(i);if(isNaN(r)||r<2||r>30){a(),this.writeError(e,`TX power must be 2-30 dBm`),n();return}t=await f.post(`/update_radio_config`,{tx_power:r},{timeout:3e4});break}case`freq`:{let r=parseFloat(i);if(isNaN(r)||r<100||r>1e3){a(),this.writeError(e,`Frequency must be 100-1000 MHz`),n();return}t=await f.post(`/update_radio_config`,{frequency:r*1e6},{timeout:3e4});break}case`bw`:{let r=parseFloat(i),o=[7.8,10.4,15.6,20.8,31.25,41.7,62.5,125,250,500];if(isNaN(r)||!o.includes(r)){a(),this.writeError(e,`Bandwidth must be one of: ${o.join(`, `)} kHz`),n();return}t=await f.post(`/update_radio_config`,{bandwidth:r*1e3},{timeout:3e4});break}case`sf`:{let r=parseInt(i);if(isNaN(r)||r<5||r>12){a(),this.writeError(e,`Spreading factor must be 5-12`),n();return}t=await f.post(`/update_radio_config`,{spreading_factor:r},{timeout:3e4});break}case`cr`:{let r=parseInt(i);if(isNaN(r)||r<5||r>8){a(),this.writeError(e,`Coding rate must be 5-8 (for 4/5 to 4/8)`),n();return}t=await f.post(`/update_radio_config`,{coding_rate:r},{timeout:3e4});break}case`af`:case`txdelay`:{let r=parseFloat(i);if(isNaN(r)||r<0||r>5){a(),this.writeError(e,`TX delay factor must be 0.0-5.0`),n();return}t=await f.post(`/update_radio_config`,{tx_delay_factor:r},{timeout:3e4});break}case`direct.txdelay`:{let r=parseFloat(i);if(isNaN(r)||r<0||r>5){a(),this.writeError(e,`Direct TX delay factor must be 0.0-5.0`),n();return}t=await f.post(`/update_radio_config`,{direct_tx_delay_factor:r},{timeout:3e4});break}case`rxdelay`:{let r=parseFloat(i);if(isNaN(r)||r<0){a(),this.writeError(e,`RX delay must be >= 0`),n();return}t=await f.post(`/update_radio_config`,{rx_delay_base:r},{timeout:3e4});break}case`name`:if(!i.trim()){a(),this.writeError(e,`Node name cannot be empty`),n();return}t=await f.post(`/update_radio_config`,{node_name:i.trim()},{timeout:3e4});break;case`lat`:{let r=parseFloat(i);if(isNaN(r)||r<-90||r>90){a(),this.writeError(e,`Latitude must be -90 to 90`),n();return}t=await f.post(`/update_radio_config`,{latitude:r},{timeout:3e4});break}case`lon`:{let r=parseFloat(i);if(isNaN(r)||r<-180||r>180){a(),this.writeError(e,`Longitude must be -180 to 180`),n();return}t=await f.post(`/update_radio_config`,{longitude:r},{timeout:3e4});break}case`mode`:{let r=i.toLowerCase();if(r!==`forward`&&r!==`monitor`&&r!==`no_tx`){a(),this.writeError(e,`Mode must be "forward", "monitor", or "no_tx"`),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)`),this.writeLine(e,` \x1B[36mno_tx\x1B[0m - No repeat, no local TX; adverts skipped`),n();return}t=await f.post(`/set_mode`,{mode:r},{timeout:3e4}),t.data&&(t.data.applied=[`mode=${r}`],t.data.persisted=!0,t.data.live_update=!0);break}case`duty`:{let r=i.toLowerCase();if(r!==`on`&&r!==`off`){a(),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`),n();return}let o=r===`on`;t=await f.post(`/set_duty_cycle`,{enabled:o},{timeout:3e4}),t.data&&(t.data.applied=[`duty=${r}`],t.data.persisted=!0,t.data.live_update=!0);break}case`flood.max`:{let r=parseInt(i);if(isNaN(r)||r<0||r>64){a(),this.writeError(e,`Max flood hops must be 0-64`),n();return}t=await f.post(`/update_radio_config`,{max_flood_hops:r},{timeout:3e4});break}case`flood.advert.interval`:{let r=parseInt(i);if(isNaN(r)||r!==0&&(r<3||r>48)){a(),this.writeError(e,`Flood advert interval must be 0 (off) or 3-48 hours`),n();return}t=await f.post(`/update_radio_config`,{flood_advert_interval_hours:r},{timeout:3e4});break}case`advert.interval`:{let r=parseInt(i);if(isNaN(r)||r!==0&&(r<1||r>10080)){a(),this.writeError(e,`Advert interval must be 0 (off) or 1-10080 minutes`),n();return}t=await f.post(`/update_radio_config`,{advert_interval_minutes:r},{timeout:3e4});break}case`log`:a(),this.writeWarning(e,`Log level configuration not yet implemented`),this.writeInfo(e,`Backend endpoint /set_log_level does not exist`),n();return;default:a(),this.writeError(e,`Unknown parameter: ${r}`),this.writeLine(e,``),this.writeInfo(e,`Type "set" without arguments to see available parameters`),n();return}a();let o=t.data||t;t.success?(o.applied&&o.applied.length>0?this.writeSuccess(e,`Configuration updated: ${o.applied.join(`, `)}`):this.writeSuccess(e,`Configuration updated`),p().fetchStats(),o.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`)):o.message&&!o.live_update&&(this.writeLine(e,``),this.writeInfo(e,o.message))):this.writeError(e,t.error||`Failed to update configuration`)}catch(t){a(),this.writeError(e,`Failed to update ${r}: ${t}`)}this.writeLine(e,``),n()}writeWarning(e,t){e.writeln(`\x1b[1;33m⚠ Warning:\x1b[0m ${t}`)}},Rh=class extends Oh{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:t}){let n=this.startLoading(e,`Fetching identities...`);try{let t=await f.getIdentities();n();let r=[];if(t.success&&t.data){let e=t.data,n=e.registered||[],i=e.configured||[];r=i.length>0?i:n}else Array.isArray(t)&&(r=t);r.length===0?this.writeInfo(e,`No identities found`):(this.writeSuccess(e,`Found \x1b[1m${r.length}\x1b[0m identit${r.length===1?`y`:`ies`}`),e.writeln(``),this.isMobile()?r.forEach((t,n)=>{e.writeln(`\x1b[1;36m[${n+1}] ${t.name||`Unnamed`}\x1b[0m`),e.writeln(` \x1b[90mType:\x1b[0m ${t.type||`-`}`),e.writeln(` \x1b[90mHash:\x1b[0m ${t.hash||`-`}`),e.writeln(` \x1b[90mAddress:\x1b[0m ${t.address||`-`}`),e.writeln(` \x1b[90mRegistered:\x1b[0m ${t.registered?`\x1B[32myes\x1B[0m`:`\x1B[31mno\x1B[0m`}`),n{let r=(n+1).toString().padEnd(2),i=(t.name||`Unnamed`).padEnd(27),a=(t.type||`-`).padEnd(13),o=(t.hash||`-`).padEnd(4),s=(t.address||`-`).padEnd(7),c=(t.registered?`yes`:`no`).padEnd(10);e.writeln(`\x1b[36m│\x1b[0m ${r} \x1b[36m│\x1b[0m \x1b[1m${i}\x1b[0m \x1b[36m│\x1b[0m ${a} \x1b[36m│\x1b[0m ${o} \x1b[36m│\x1b[0m ${s} \x1b[36m│\x1b[0m ${c} \x1b[36m│\x1b[0m`)}),e.writeln(`\x1B[36m└────┴─────────────────────────────┴───────────────┴──────┴─────────┴────────────┘\x1B[0m`)))}catch(t){n(),this.writeError(e,t instanceof Error?t.message:`Failed to fetch identities`)}t()}},zh=class extends Oh{name=`keys`;description=`List transport keys`;async execute({term:e,writePrompt:t}){let n=this.startLoading(e,`Fetching transport keys...`);try{let t=await f.getTransportKeys();n();let r=t.success&&t.data?t.data:t,i=Array.isArray(r)?r:[];i.length===0?this.writeInfo(e,`No transport keys found`):(this.writeSuccess(e,`Found \x1b[1m${i.length}\x1b[0m transport key${i.length===1?``:`s`}`),e.writeln(``),i.forEach((t,n)=>{e.writeln(`\x1b[36m${(n+1).toString().padStart(2)}.\x1b[0m \x1b[1m${t.name||`Unnamed`}\x1b[0m`),t.flood_policy&&e.writeln(` Policy: \x1b[90m${t.flood_policy}\x1b[0m`),t.parent_id&&e.writeln(` Parent: \x1b[90m${t.parent_id}\x1b[0m`),n{if(e.writeln(`\x1b[1;36m[${n+1}] ${t.node_name||`Unknown`}\x1b[0m`),e.writeln(` \x1b[90mPubKey:\x1b[0m ${t.pubkey?.substring(0,8)||`----`}`),e.writeln(` \x1b[90mType:\x1b[0m ${t.contact_type||`-`}`),t.last_seen){let n=new Date(t.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 ${n}`)}t.rssi&&e.writeln(` \x1b[90mRSSI:\x1b[0m ${t.rssi}`),t.snr&&e.writeln(` \x1b[90mSNR:\x1b[0m ${t.snr}`),e.writeln(` \x1b[90mAdverts:\x1b[0m ${t.advert_count||0}`),e.writeln(` \x1b[90mDirect:\x1b[0m ${t.zero_hop?`\x1B[32myes\x1B[0m`:`\x1B[31mno\x1B[0m`}`),n{let r=(n+1).toString().padEnd(2),i=(t.node_name||`Unknown`).padEnd(20),a=(t.pubkey?.substring(0,4)||`----`).padEnd(6),o=(t.contact_type||`-`).padEnd(12),s=t.last_seen?new Date(t.last_seen*1e3).toLocaleString(`en-US`,{month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).padEnd(20):`-`.padEnd(20),c=(t.rssi?`${t.rssi}`:`-`).padEnd(8),l=(t.snr?`${t.snr}`:`-`).padEnd(4),u=(t.advert_count?.toString()||`0`).padEnd(6),d=(t.zero_hop?`yes`:`no`).padEnd(6);e.writeln(`\x1b[36m│\x1b[0m ${r} \x1b[36m│\x1b[0m \x1b[1m${i}\x1b[0m \x1b[36m│\x1b[0m ${a} \x1b[36m│\x1b[0m ${o} \x1b[36m│\x1b[0m ${s} \x1b[36m│\x1b[0m ${c} \x1b[36m│\x1b[0m ${l} \x1b[36m│\x1b[0m ${u} \x1b[36m│\x1b[0m ${d} \x1b[36m│\x1b[0m`)}),e.writeln(`\x1B[36m└────┴──────────────────────┴────────┴──────────────┴──────────────────────┴──────────┴──────┴────────┴────────┘\x1B[0m`)),r.length>10&&(e.writeln(``),e.writeln(`\x1b[90m... and ${r.length-10} more neighbors\x1b[0m`)))}catch(t){n(),this.writeError(e,t instanceof Error?t.message:`Failed to fetch neighbors`)}t()}},Vh=class extends Oh{name=`acl`;description=`Show ACL statistics`;async execute({term:e,writePrompt:t}){let n=this.startLoading(e,`Fetching ACL stats...`);try{let t=await f.getACLStats();n();let r=t.success&&t.data?t.data:t;if(r&&typeof r==`object`){this.writeSuccess(e,`ACL Statistics:`),e.writeln(``);let t=(n,r=` `)=>{if(typeof n==`object`&&n&&!Array.isArray(n))for(let[i,a]of Object.entries(n))typeof a==`object`&&a?(e.writeln(`${r}\x1b[90m${i}:\x1b[0m`),t(a,r+` `)):e.writeln(`${r}\x1b[90m${i.padEnd(18)}\x1b[0m ${a}`);else e.writeln(`${r}${n}`)};for(let[n,i]of Object.entries(r))typeof i==`object`&&i?(e.writeln(` \x1b[36m${n}\x1b[0m`),t(i,` `)):e.writeln(` \x1b[36m${n.padEnd(20)}\x1b[0m ${i}`)}else this.writeError(e,`No ACL data available`)}catch(t){n(),this.writeError(e,t instanceof Error?t.message:`Failed to fetch ACL stats`)}t()}},Hh=class extends Oh{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:t}){let n=this.startLoading(e,`Fetching room stats...`);try{let t=await f.getRoomStats();n();let r=[];t.success&&t.data?r=t.data.rooms||(Array.isArray(t.data)?t.data:[]):Array.isArray(t)&&(r=t),r.length===0?this.writeInfo(e,`No room servers found`):(this.writeSuccess(e,`Found \x1b[1m${r.length}\x1b[0m room server${r.length===1?``:`s`}`),e.writeln(``),this.isMobile()?r.forEach((t,n)=>{e.writeln(`\x1b[1;36m[${n+1}] ${t.room_name||`Unnamed`}\x1b[0m`),e.writeln(` \x1b[90mMessages:\x1b[0m ${t.total_messages||0}`),e.writeln(` \x1b[90mTotal Clients:\x1b[0m ${t.total_clients||0}`),e.writeln(` \x1b[90mActive Clients:\x1b[0m ${t.active_clients||0}`),e.writeln(` \x1b[90mSync:\x1b[0m ${t.sync_running?`\x1B[32mrunning\x1B[0m`:`\x1B[31mstopped\x1B[0m`}`),n{let r=(n+1).toString().padEnd(2),i=(t.room_name||`Unnamed`).padEnd(27),a=(t.total_messages?.toString()||`0`).padEnd(8),o=(t.total_clients?.toString()||`0`).padEnd(12),s=(t.active_clients?.toString()||`0`).padEnd(14),c=(t.sync_running?`running`:`stopped`).padEnd(8);e.writeln(`\x1b[36m│\x1b[0m ${r} \x1b[36m│\x1b[0m \x1b[1m${i}\x1b[0m \x1b[36m│\x1b[0m ${a} \x1b[36m│\x1b[0m ${o} \x1b[36m│\x1b[0m ${s} \x1b[36m│\x1b[0m ${c} \x1b[36m│\x1b[0m`)}),e.writeln(`\x1B[36m└────┴─────────────────────────────┴──────────┴──────────────┴────────────────┴──────────┘\x1B[0m`)))}catch(t){n(),this.writeError(e,t instanceof Error?t.message:`Failed to fetch room stats`)}t()}},Uh=class extends Oh{name=`restart`;description=`Restart the pymc-repeater service`;aliases=[`reboot`];matches(e){let t=e.toLowerCase();return t===`restart`||t===`reboot`}async execute({term:e,writePrompt:t}){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...`);let n=this.startLoading(e,`Restarting...`);try{let t=await f.post(`/restart_service`,{},{timeout:1e4});n(),t.success?(this.writeLine(e,``),this.writeSuccess(e,t.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: `+(t.error||t.message||`Unknown error`)),this.writeLine(e,``),this.writeInfo(e,`You may need to manually restart: sudo systemctl restart pymc-repeater`))}catch(r){n(),this.writeLine(e,``);let i=r;if(i.code===`ERR_NETWORK`||i.message?.includes(`Network error`)||i.message?.includes(`ECONNRESET`)||i.code===`ECONNRESET`){this.writeSuccess(e,`Service restart initiated successfully`),this.writeLine(e,``),await this.waitForServiceRestart(e,t);return}else i.code===`ECONNABORTED`||i.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.`)):i.response?.status===403||i.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;t--)e.write(`\r\x1b[36m⏳\x1b[0m Restarting service... ${t}s`),await new Promise(e=>setTimeout(e,1e3));e.write(`\r\x1B[K`);let n=4,r=0;for(;n<20;){r++,e.write(` ⏳ Verifying restart (attempt ${r})... `);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 ~${n}s)`),this.writeLine(e,``),t();return}}catch(t){let n=t;n.code&&![`ERR_NETWORK`,`ECONNREFUSED`,`ECONNRESET`].includes(n.code)&&e.write(`[${n.code}] `)}await new Promise(e=>setTimeout(e,1*1e3)),n+=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,``),t()}},Wh=class extends Oh{name=`ping`;description=`Ping a neighbor node to measure latency and signal quality`;usage=`ping [timeout_seconds]`;async execute({term:e,args:t,writePrompt:n}){if(t.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`),n();return}let r=t[0],i=t.length>1?parseInt(t[1]):10;if(isNaN(i)||i<1||i>60){this.writeError(e,`Invalid timeout. Must be between 1-60 seconds`),n();return}let a=null,o=r.match(/^(0x)?([0-9a-fA-F]{1,2})$/);if(o)a=`0x${o[2].padStart(2,`0`)}`;else{let t=this.startLoading(e,`Resolving target...`);try{let i=[`Chat Node`,`Repeater`,`Room Server`,`Hybrid Node`,`Unknown`],o=!1;for(let e of i)try{let t=await f.get(`/adverts_by_contact_type`,{contact_type:e,hours:168}),n=t.success&&t.data?t.data:t,i=(Array.isArray(n)?n:[]).find(e=>e.node_name&&e.node_name.toLowerCase()===r.toLowerCase());if(i&&i.pubkey){a=`0x${i.pubkey.substring(0,2)}`,o=!0;break}}catch{continue}if(t(),!o){this.writeError(e,`Node '${r}' not found in neighbors`),e.writeln(``),this.writeInfo(e,`Try: neighbors - to list available nodes`),n();return}}catch(r){t(),this.writeError(e,`Failed to resolve target: ${r}`),n();return}}this.writeLine(e,`\x1b[36mPinging ${r} (${a}) with ${i}s timeout...\x1b[0m`),e.writeln(``);let s=this.startLoading(e,`Waiting for response...`);try{let t=await f.pingNeighbor(a,i);if(s(),t.success&&t.data){let n=t.data;this.writeSuccess(e,`Reply from ${r} (${n.target_id})`),e.writeln(``);let i=`\x1B[32m`;if(n.rtt_ms>500?i=`\x1B[31m`:n.rtt_ms>250&&(i=`\x1B[33m`),e.writeln(` \x1b[1mRound-Trip Time:\x1b[0m ${i}${n.rtt_ms.toFixed(2)} ms\x1b[0m`),e.writeln(` \x1b[1mRSSI:\x1b[0m ${n.rssi} dBm`),e.writeln(` \x1b[1mSNR:\x1b[0m ${n.snr_db} dB`),n.path&&n.path.length>0){let t=n.path.join(` → `),r=n.path.length;e.writeln(` \x1b[1mPath:\x1b[0m ${t}`),e.writeln(` \x1b[1mHops:\x1b[0m ${r}`)}e.writeln(``);let a=`Excellent`,o=`\x1B[32m`;n.rtt_ms>500||n.rssi<-120?(a=`Poor`,o=`\x1B[31m`):n.rtt_ms>250||n.rssi<-100?(a=`Fair`,o=`\x1B[33m`):(n.rtt_ms>100||n.rssi<-80)&&(a=`Good`,o=`\x1B[36m`),e.writeln(` \x1b[1mLink Quality:\x1b[0m ${o}${a}\x1b[0m`)}else this.writeError(e,t.error||`Ping failed`)}catch(t){s(),this.writeError(e,`Ping failed: ${t.message||t}`)}e.writeln(``),n()}};async function Gh(){try{let e=[`Chat Node`,`Repeater`,`Room Server`,`Hybrid Node`,`Unknown`],t=[];for(let n of e)try{let e=await f.get(`/adverts_by_contact_type`,{contact_type:n,hours:168}),r=e.success&&e.data?e.data:e;(Array.isArray(r)?r:[]).forEach(e=>{e.node_name&&!t.includes(e.node_name)&&t.push(e.node_name)})}catch{continue}return t.sort()}catch{return[]}}var Kh=class{commands=[];constructor(){let e=new Ah,t=new jh,n=new Mh,r=new Nh,i=new Ph,a=new Fh,o=new Ih,s=new Lh,c=new Rh,l=new zh,u=new Bh,d=new Vh,f=new Hh,p=new Uh,m=new Wh;this.commands=[new kh([e,t,n,r,i,a,o,s,c,l,u,d,f,p,m]),e,t,n,r,i,a,o,s,c,l,u,d,f,p,m]}findCommand(e){return this.commands.find(t=>t.matches(e))}getAllCommands(){return this.commands}getCommandNames(){return this.commands.map(e=>e.name)}},qh={class:`space-y-4 md:space-y-6`},Jh={class:`glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-3 md:p-4`},Yh={class:`flex items-center justify-between`},Xh={class:`flex items-center gap-2 md:gap-3`},Zh=[`title`],Qh={key:0,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},$h={key:1,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},eg={class:`hidden sm:inline`},tg=[`title`],ng={class:`hidden sm:inline`},rg=[`title`],ig={key:0,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},ag={key:1,class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},og={class:`hidden sm:inline`},sg={key:0,class:`glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/10 rounded-[15px] p-4`},cg={class:`flex items-center gap-3`},lg=[`onKeydown`],ug={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`},dg=m(o({name:`TerminalView`,__name:`Terminal`,setup(o){let{theme:f}=h(),p={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`},m={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`},y=a(null),b=a(null),ee=a(null),x=a(``),S=a(!1),te=a(!1),C=a(!1),w=a(!1),T=a(!1);a(0);let E=null,D=null,ne=null,re=null,O=``,k=[],A=-1,j=``,ie=new Kh,ae=ie.getCommandNames(),oe=[],se=0,ce={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:[]},le={set:{mode:[`forward`,`monitor`],duty:[`on`,`off`]}},ue={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/no_tx)`,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:{}};n(()=>{if(!y.value)return;C.value=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),E=new Qs({cursorBlink:!1,cursorStyle:`underline`,cursorWidth:3,fontFamily:`"JetBrains Mono", "Fira Code", Menlo, Monaco, "Courier New", monospace`,fontSize:window.innerWidth<768?11:13,fontWeight:`400`,fontWeightBold:`700`,lineHeight:1.3,letterSpacing:.5,smoothScrollDuration:50,scrollSensitivity:3,fastScrollSensitivity:5,allowProposedApi:!0,screenReaderMode:C.value,theme:f.value===`dark`?p:m,scrollback:C.value?500:1e4,tabStopWidth:4,macOptionIsMeta:!0}),D=new tc,E.loadAddon(D);try{re=new Dh,E.loadAddon(re)}catch{console.warn(`WebGL addon failed to load, falling back to canvas renderer`),re=null}let e=new sc((e,t)=>{window.open(t,`_blank`)});E.loadAddon(e);let n=new Uu;if(E.loadAddon(n),E.unicode.activeVersion=`11`,ne=new jl,E.loadAddon(ne),E.open(y.value),D.fit(),E.focus(),C.value&&b.value){let e=b.value,n=()=>{e.focus({preventScroll:!1})};y.value?.addEventListener(`click`,n),y.value?.addEventListener(`touchstart`,n),e.addEventListener(`input`,()=>{setTimeout(()=>{E?.scrollToBottom()},10)}),t(()=>{y.value?.removeEventListener(`click`,n),y.value?.removeEventListener(`touchstart`,n)})}let r=f.value===`dark`?`\x1B[1;37m`:`\x1B[1;90m`;f.value;let i=(f.value,`\x1B[90m`),a=`\x1B[0m`;E.writeln(``),E.writeln(`${r} ██████ ██ ██ ███ ███ ██████${a}`),E.writeln(`${r} ██ ██ ██ ██ ████ ████ ██ ${a}`),E.writeln(`${r} ██████ ████ ██ ████ ██ ██ ${a}`),E.writeln(`${r} ██ ██ ██ ██ ██ ██ ${a}`),E.writeln(`${r} ██ ██ ██ ██ ██████${a}`),E.writeln(``),E.writeln(` Repeater Terminal${a}`),E.writeln(``),E.writeln(`${i} Type help${i} for available commands${a}`),E.writeln(``),M(),E.onData(e=>{pe(e)});let o=new ResizeObserver(()=>{D?.fit()});o.observe(y.value),t(()=>{o.disconnect(),re?.dispose(),re=null,E?.dispose(),E=null})});let M=()=>{E?.write(`\r -\x1B[1;36m❯\x1B[0m `)},de=e=>{if(!(!E||!e)){E.write(`\x1b[90m${e}\x1b[0m`);for(let t=0;t{if(!(!E||!j)){for(let e=0;e{if(!E)return;let t=e.charCodeAt(0);if(t===13){fe(),E.write(`\r -`),O.trim()?(N(O.trim()),k.push(O.trim()),A=k.length):M(),O=``;return}if(t===127){O.length>0&&(fe(),O=O.slice(0,-1),E.write(`\b \b`),me());return}if(t===3){fe(),E.write(`^C\r -`),O=``,M();return}if(t===12){E.clear(),O=``,M();return}if(t===6){S.value=!S.value;return}if(e===`\x1B[A`){k.length>0&&A>0&&(fe(),A--,E.write(`\r\x1B[K`),M(),O=k[A],E.write(O));return}if(e===`\x1B[B`){fe(),A2&&le[n]){let e=t[1]?.toLowerCase(),r=t.slice(2).join(` `).toLowerCase(),i=le[n][e];if(i){let e=i.filter(e=>e.toLowerCase().startsWith(r));if(e.length===1){let n=t.slice(2).join(` `),r=e[0].slice(n.length);O+=r,E.write(r)}else e.length>1&&(E.write(`\r -\r -\x1B[33mAvailable values:\x1B[0m\r -\r -`),e.forEach(e=>{E.writeln(` \x1b[36m${e}\x1b[0m`)}),M(),E.write(O));return}}if(t.length>1&&ce[n]){if(n===`ping`){let e=t.slice(1).join(` `).toLowerCase(),n=Date.now();n-se>3e4&&Gh().then(e=>{oe=e,se=n,ce.ping=e});let r=oe.filter(t=>t.toLowerCase().startsWith(e));if(r.length===1){let e=t.slice(1).join(` `),n=r[0].slice(e.length)+` `;O+=n,E.write(n)}else r.length>1?(E.write(`\r -\r -\x1B[33mAvailable neighbors:\x1B[0m\r -\r -`),r.forEach(e=>{E.writeln(` \x1b[36m${e}\x1b[0m`)}),M(),E.write(O)):oe.length===0&&e===``&&(E.write(`\r -\r -\x1B[33mFetching neighbors...\x1B[0m\r -`),Gh().then(e=>{oe=e,se=n,ce.ping=e,E.write(`\r -\x1B[33mAvailable neighbors:\x1B[0m\r -\r -`),e.forEach(e=>{E.writeln(` \x1b[36m${e}\x1b[0m`)}),M(),E.write(O)}).catch(()=>{E.write(`\r -\x1B[31mFailed to fetch neighbors\x1B[0m\r -`),M(),E.write(O)}));return}let e=t.slice(1).join(` `).toLowerCase(),r=ce[n].filter(t=>t.toLowerCase().startsWith(e));if(r.length===1){let e=t.slice(1).join(` `),n=r[0].slice(e.length)+` `;O+=n,E.write(n)}else if(r.length>1){E.write(`\r -\r -\x1B[33mAvailable parameters:\x1B[0m\r -\r -`);let e=ue[n]||{};r.forEach(t=>{let n=e[t]||``,r=t.padEnd(20);E.writeln(` \x1b[36m${r}\x1b[0m\x1b[90m${n}\x1b[0m`)}),M(),E.write(O)}return}let r=ie.getAllCommands().filter(t=>!!(t.name.toLowerCase().startsWith(e)||t.aliases?.some(t=>t.toLowerCase().startsWith(e))));if(r.length===1){let e=r[0].name.slice(O.length)+` `;O+=e,E.write(e)}else r.length>1&&(E.write(`\r -\r -\x1B[33mAvailable commands:\x1B[0m\r -\r -`),r.forEach(e=>{let t=e.aliases&&e.aliases.length>0?` (${e.aliases.join(`, `)})`:``;E.writeln(` \x1b[36m${e.name.padEnd(15)}\x1b[0m ${e.description}${t}`)}),M(),E.write(O));return}t>=32&&t<127&&(fe(),O+=e,E.write(e),C.value||me())},me=()=>{if(O.length===0){j=``;return}let e=ae.filter(e=>e.startsWith(O.toLowerCase()));e.length===1&&e[0]!==O?(j=e[0].slice(O.length),de(j)):j=``},N=async e=>{if(!E)return;let[t,...n]=e.trim().split(/\s+/),r=ie.findCommand(t);if(r)try{await r.execute({term:E,args:n,writePrompt:M})}catch(e){console.error(`Command execution error:`,e),E.writeln(`\x1b[1;31m✗ Error:\x1b[0m ${e instanceof Error?e.message:`Command failed`}`),M()}else E.writeln(`\x1b[1;31m✗ Unknown command:\x1b[0m ${t}`),E.writeln(`\x1B[90mType \x1B[36mhelp\x1B[90m for available commands\x1B[0m`),M()},he=()=>{!ne||!x.value||ne.findNext(x.value,{caseSensitive:!1})},ge=()=>{!ne||!x.value||ne.findPrevious(x.value,{caseSensitive:!1})},_e=()=>{S.value=!1,x.value=``,E?.focus()},ve=async()=>{if(ee.value){if(w.value)try{document.exitFullscreen&&await document.exitFullscreen(),w.value=!1}catch(e){console.error(`Failed to exit fullscreen:`,e)}else try{ee.value.requestFullscreen&&await ee.value.requestFullscreen(),w.value=!0,setTimeout(()=>{C.value&&b.value?b.value.focus():E&&E.focus()},100)}catch(e){console.error(`Failed to enter fullscreen:`,e)}setTimeout(()=>{D?.fit()},100)}},ye=()=>{T.value=!T.value,T.value&&C.value&&setTimeout(()=>{window.scrollTo(0,1)},100),setTimeout(()=>{C.value&&b.value?b.value.focus():E?.focus(),D?.fit()},150)},be=()=>{T.value=!1,setTimeout(()=>{D?.fit()},100)};r(f,e=>{E&&(E.options.theme=e===`dark`?p:m)}),typeof document<`u`&&(document.addEventListener(`fullscreenchange`,()=>{w.value=!!document.fullscreenElement,setTimeout(()=>D?.fit(),100)}),document.addEventListener(`keydown`,e=>{e.key===`Escape`&&T.value&&!w.value&&be()}),document.addEventListener(`keydown`,e=>{e.key===`Escape`&&T.value&&!w.value&&be()}));let xe=()=>{C.value&&b.value&&b.value.focus()},Se=e=>{let t=e.target,n=t.value;n&&E&&pe(n.slice(-1)),t.value=``},Ce=()=>{E&&pe(`\r`),b.value&&(b.value.value=``)},we=()=>{E&&pe(``),b.value&&(b.value.value=``)};return(t,n)=>(s(),u(`div`,qh,[l(`div`,Jh,[l(`div`,Yh,[n[8]||=l(`div`,null,[l(`h1`,{class:`text-content-primary dark:text-content-primary text-lg md:text-xl font-semibold`},` Terminal `),l(`p`,{class:`text-content-secondary dark:text-content-muted text-sm hidden md:block`},` Interactive command-line interface `)],-1),l(`div`,Xh,[C.value?(s(),u(`button`,{key:0,onClick:ye,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:T.value?`Exit fullscreen`:`Enter fullscreen`},[T.value?(s(),u(`svg`,$h,[...n[3]||=[l(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`},null,-1)]])):(s(),u(`svg`,Qh,[...n[2]||=[l(`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)]])),l(`span`,eg,e(T.value?`Exit`:`Fullscreen`),1)],8,Zh)):c(``,!0),C.value?c(``,!0):(s(),u(`button`,{key:1,onClick:ye,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:T.value?`Exit full window`:`Full window`},[n[4]||=l(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[l(`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),l(`span`,ng,e(T.value?`Exit Window`:`Full Window`),1)],8,tg)),C.value?c(``,!0):(s(),u(`button`,{key:2,onClick:ve,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:w.value?`Exit fullscreen`:`Fullscreen`},[w.value?(s(),u(`svg`,ag,[...n[6]||=[l(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`},null,-1)]])):(s(),u(`svg`,ig,[...n[5]||=[l(`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)]])),l(`span`,og,e(w.value?`Exit Full`:`Fullscreen`),1)],8,rg)),l(`button`,{onClick:n[0]||=e=>S.value=!S.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`},[...n[7]||=[l(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[l(`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),l(`span`,{class:`hidden sm:inline`},`Search`,-1)]])])])]),S.value?(s(),u(`div`,sg,[l(`div`,cg,[i(l(`input`,{"onUpdate:modelValue":n[1]||=e=>x.value=e,onKeydown:[_(he,[`enter`]),_(_e,[`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),[[v,x.value]]),l(`button`,{onClick:ge,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)`},` ↑ `),l(`button`,{onClick:he,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)`},` ↓ `),l(`button`,{onClick:_e,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`},` ✕ `)])])):c(``,!0),l(`div`,{ref_key:`terminalContainerRef`,ref:ee,class:d([`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":w.value,"full-window-terminal":T.value}])},[T.value&&!w.value?(s(),u(`button`,{key:0,onClick:be,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)`},[...n[9]||=[l(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[l(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])):c(``,!0),l(`div`,{ref_key:`terminalRef`,ref:y,class:d([`terminal-container`,{"fullscreen-content":w.value}]),onClick:xe,onTouchstart:xe},[C.value?(s(),u(`input`,{key:0,ref_key:`mobileInputRef`,ref:b,type:`text`,class:`mobile-keyboard-input`,onInput:Se,onKeydown:[_(g(Ce,[`prevent`]),[`enter`]),_(we,[`delete`])],inputmode:`text`,autocomplete:`off`,autocorrect:`off`,autocapitalize:`off`,spellcheck:`false`},null,40,lg)):c(``,!0)],34),te.value?(s(),u(`div`,ug,[...n[10]||=[l(`div`,{class:`w-2 h-2 bg-primary rounded-full animate-pulse`},null,-1),l(`span`,{class:`text-primary text-sm font-medium`},`Processing...`,-1)]])):c(``,!0)],2)]))}}),[[`__scopeId`,`data-v-7db8a6e5`]]);export{dg as default}; \ No newline at end of file diff --git a/repeater/web/html/assets/api-C0ctTLHN.js b/repeater/web/html/assets/api-C0ctTLHN.js new file mode 100644 index 0000000..e485be1 --- /dev/null +++ b/repeater/web/html/assets/api-C0ctTLHN.js @@ -0,0 +1,7 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Setup-CpiSqNYG.js","assets/_plugin-vue_export-helper-TcpyXLsZ.js","assets/index-BpKhPa08.js","assets/runtime-core.esm-bundler-C5QBTNWE.js","assets/runtime-dom.esm-bundler-fKU3dih-.js","assets/Spinner-CYvUNW0P.js","assets/useTheme-D8lKuC-u.js","assets/dataService-CLvdg62X.js","assets/packets-B7XZyaZ9.js","assets/system-Dx7MrhAz.js","assets/websocket-BBHBKSxR.js","assets/constants-CqNUcWkW.js","assets/index-BUI2F6Oi.css","assets/Setup-DHp0ibOb.css","assets/Login-Yv1Mvbrl.js","assets/Login-BgyfucJv.css","assets/Dashboard-B5wTBGWv.js","assets/ChartCard-Cqs_1Frf.js","assets/useSignalQuality-CLsnSJcS.js","assets/preferences-6MHglq--.js","assets/Dashboard-BGrwr2sL.css","assets/Neighbors-BPL8jV_a.js","assets/chunk-DECur_0Z.js","assets/leaflet-src-EmArVA6Z.js","assets/formatters-Cc4UJmeb.js","assets/Neighbors-Bng0BMwC.css","assets/leaflet-vh-t_kPv.css","assets/Statistics-CW9a5fGJ.js","assets/chartjs-adapter-date-fns.esm-NizYWXHk.js","assets/chartjs-adapter-date-fns-BKkkO1xH.css","assets/GPSDiagnostics-CqIZmMKR.js","assets/GPSDiagnostics-ozfiXH-7.css","assets/SystemStats-_yafXwf7.js","assets/SystemStats-DzIGYJV7.css","assets/Sensors-fpSLvgWk.js","assets/Configuration-BkPRUvKr.js","assets/ConfirmDialog-XtZRdfP5.js","assets/LocationPicker-Beqlkai5.js","assets/LocationPicker-KkKL2lD_.css","assets/Configuration-CuvKm5Yn.css","assets/CADCalibration-BB8Y2fH_.js","assets/plotly.min-B8UFpwnE.js","assets/CADCalibration-C4Y61LYy.css","assets/Sessions-BcRSI1Q2.js","assets/RoomServers-C6RN6JrC.js","assets/MessageDialog-Bs1UHPdw.js","assets/Companions-BWlxamyY.js","assets/Logs-rmQ2jrEc.js","assets/Terminal-BIlcURMy.js","assets/Terminal-8k-H0_ky.css","assets/Help-BXmxmm0K.js","assets/websocket-BH4j9arL.js","assets/packets-BK2ztQg5.js","assets/system-B4pvUuxx.js"])))=>i.map(i=>d[i]); +import{n as e}from"./chunk-DECur_0Z.js";import{$ as t,A as n,C as r,D as i,G as a,H as o,J as s,K as c,Q as l,R as u,S as d,T as f,U as p,W as m,X as h,Y as g,Z as _,b as v,et as y,g as b,nt as x,o as S,q as C,x as w,y as ee}from"./runtime-core.esm-bundler-C5QBTNWE.js";var te=typeof window<`u`,T,ne=e=>T=e,E=Symbol();function re(e){return e&&typeof e==`object`&&Object.prototype.toString.call(e)===`[object Object]`&&typeof e.toJSON!=`function`}var ie;(function(e){e.direct=`direct`,e.patchObject=`patch object`,e.patchFunction=`patch function`})(ie||={});var ae=typeof window==`object`&&window.window===window?window:typeof self==`object`&&self.self===self?self:typeof global==`object`&&global.global===global?global:typeof globalThis==`object`?globalThis:{HTMLElement:null};function oe(e,{autoBom:t=!1}={}){return t&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([``,e],{type:e.type}):e}function se(e,t,n){let r=new XMLHttpRequest;r.open(`GET`,e),r.responseType=`blob`,r.onload=function(){de(r.response,t,n)},r.onerror=function(){console.error(`could not download file`)},r.send()}function ce(e){let t=new XMLHttpRequest;t.open(`HEAD`,e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function le(e){try{e.dispatchEvent(new MouseEvent(`click`))}catch{let t=new MouseEvent(`click`,{bubbles:!0,cancelable:!0,view:window,detail:0,screenX:80,screenY:20,clientX:80,clientY:20,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});e.dispatchEvent(t)}}var D=typeof navigator==`object`?navigator:{userAgent:``},ue=/Macintosh/.test(D.userAgent)&&/AppleWebKit/.test(D.userAgent)&&!/Safari/.test(D.userAgent),de=te?typeof HTMLAnchorElement<`u`&&`download`in HTMLAnchorElement.prototype&&!ue?fe:`msSaveOrOpenBlob`in D?pe:me:()=>{};function fe(e,t=`download`,n){let r=document.createElement(`a`);r.download=t,r.rel=`noopener`,typeof e==`string`?(r.href=e,r.origin===location.origin?le(r):ce(r.href)?se(e,t,n):(r.target=`_blank`,le(r))):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){le(r)},0))}function pe(e,t=`download`,n){if(typeof e==`string`)if(ce(e))se(e,t,n);else{let t=document.createElement(`a`);t.href=e,t.target=`_blank`,setTimeout(function(){le(t)})}else navigator.msSaveOrOpenBlob(oe(e,n),t)}function me(e,t,n,r){if(r||=open(``,`_blank`),r&&(r.document.title=r.document.body.innerText=`downloading...`),typeof e==`string`)return se(e,t,n);let i=e.type===`application/octet-stream`,a=/constructor/i.test(String(ae.HTMLElement))||`safari`in ae,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||i&&a||ue)&&typeof FileReader<`u`){let t=new FileReader;t.onloadend=function(){let e=t.result;if(typeof e!=`string`)throw r=null,Error(`Wrong reader.result type`);e=o?e:e.replace(/^data:[^;]*;/,`data:attachment/file;`),r?r.location.href=e:location.assign(e),r=null},t.readAsDataURL(e)}else{let t=URL.createObjectURL(e);r?r.location.assign(t):location.href=t,r=null,setTimeout(function(){URL.revokeObjectURL(t)},4e4)}}var{assign:he}=Object;function ge(){let e=o(!0),t=e.run(()=>g({})),n=[],r=[],i=c({install(e){ne(i),i._a=e,e.provide(E,i),e.config.globalProperties.$pinia=i,r.forEach(e=>n.push(e)),r=[]},use(e){return this._a?n.push(e):r.push(e),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return i}var O=()=>{};function k(e,t,n,r=O){e.add(t);let i=()=>{e.delete(t)&&r()};return!n&&p()&&C(i),i}function _e(e,...t){e.forEach(e=>{e(...t)})}var ve=e=>e(),ye=Symbol(),be=Symbol();function xe(e,t){e instanceof Map&&t instanceof Map?t.forEach((t,n)=>e.set(n,t)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(let n in t){if(!t.hasOwnProperty(n))continue;let r=t[n],i=e[n];re(i)&&re(r)&&e.hasOwnProperty(n)&&!a(r)&&!m(r)?e[n]=xe(i,r):e[n]=r}return e}var Se=Symbol();function Ce(e){return!re(e)||!Object.prototype.hasOwnProperty.call(e,Se)}var{assign:A}=Object;function we(e){return!!(a(e)&&e.effect)}function Te(e,t,n,r){let{state:i,actions:a,getters:o}=t,s=n.state.value[e],l;function u(){return s||(n.state.value[e]=i?i():{}),A(y(n.state.value[e]),a,Object.keys(o||{}).reduce((t,r)=>(t[r]=c(S(()=>{ne(n);let t=n._s.get(e);return o[r].call(t,t)})),t),{}))}return l=Ee(e,u,t,n,r,!0),l}function Ee(e,t,n={},r,i,c){let f,p=A({actions:{}},n),h={deep:!0},_,v,y=new Set,b=new Set,x=r.state.value[e];!c&&!x&&(r.state.value[e]={}),g({});let S;function C(t){let n;_=v=!1,typeof t==`function`?(t(r.state.value[e]),n={type:ie.patchFunction,storeId:e,events:void 0}):(xe(r.state.value[e],t),n={type:ie.patchObject,payload:t,storeId:e,events:void 0});let i=S=Symbol();d().then(()=>{S===i&&(_=!0)}),v=!0,_e(y,n,r.state.value[e])}let w=c?function(){let{state:e}=n,t=e?e():{};this.$patch(e=>{A(e,t)})}:O;function ee(){f.stop(),y.clear(),b.clear(),r._s.delete(e)}let te=(t,n=``)=>{if(ye in t)return t[be]=n,t;let i=function(){ne(r);let n=Array.from(arguments),a=new Set,o=new Set;function s(e){a.add(e)}function c(e){o.add(e)}_e(b,{args:n,name:i[be],store:T,after:s,onError:c});let l;try{l=t.apply(this&&this.$id===e?this:T,n)}catch(e){throw _e(o,e),e}return l instanceof Promise?l.then(e=>(_e(a,e),e)).catch(e=>(_e(o,e),Promise.reject(e))):(_e(a,l),l)};return i[ye]=!0,i[be]=n,i},T=s({_p:r,$id:e,$onAction:k.bind(null,b),$patch:C,$reset:w,$subscribe(t,n={}){let i=k(y,t,n.detached,()=>a()),a=f.run(()=>u(()=>r.state.value[e],r=>{(n.flush===`sync`?v:_)&&t({storeId:e,type:ie.direct,events:void 0},r)},A({},h,n)));return i},$dispose:ee});r._s.set(e,T);let E=(r._a&&r._a.runWithContext||ve)(()=>r._e.run(()=>(f=o()).run(()=>t({action:te}))));for(let t in E){let n=E[t];a(n)&&!we(n)||m(n)?c||(x&&Ce(n)&&(a(n)?n.value=x[t]:xe(n,x[t])),r.state.value[e][t]=n):typeof n==`function`&&(E[t]=te(n,t),p.actions[t]=n)}return A(T,E),A(l(T),E),Object.defineProperty(T,`$state`,{get:()=>r.state.value[e],set:e=>{C(t=>{A(t,e)})}}),r._p.forEach(e=>{A(T,f.run(()=>e({store:T,app:r._a,pinia:r,options:p})))}),x&&c&&n.hydrate&&n.hydrate(T.$state,x),_=!0,v=!0,T}function De(e,t,n){let r,i=typeof t==`function`;r=i?n:t;function a(n,a){let o=v();return n||=o?w(E,null):null,n&&ne(n),n=T,n._s.has(e)||(i?Ee(e,t,r,n):Te(e,r,n)),n._s.get(e)}return a.$id=e,a}function Oe(e){let n=l(e),r={};for(let i in n){let o=n[i];o.effect?r[i]=S({get:()=>e[i],set(t){e[i]=t}}):(a(o)||m(o))&&(r[i]=t(e,i))}return r}var ke=typeof document<`u`;function Ae(e){return typeof e==`object`||`displayName`in e||`props`in e||`__vccOpts`in e}function je(e){return e.__esModule||e[Symbol.toStringTag]===`Module`||e.default&&Ae(e.default)}var j=Object.assign;function Me(e,t){let n={};for(let r in t){let i=t[r];n[r]=M(i)?i.map(e):e(i)}return n}var Ne=()=>{},M=Array.isArray;function Pe(e,t){let n={};for(let r in e)n[r]=r in t?t[r]:e[r];return n}var N=function(e){return e[e.MATCHER_NOT_FOUND=1]=`MATCHER_NOT_FOUND`,e[e.NAVIGATION_GUARD_REDIRECT=2]=`NAVIGATION_GUARD_REDIRECT`,e[e.NAVIGATION_ABORTED=4]=`NAVIGATION_ABORTED`,e[e.NAVIGATION_CANCELLED=8]=`NAVIGATION_CANCELLED`,e[e.NAVIGATION_DUPLICATED=16]=`NAVIGATION_DUPLICATED`,e}({}),Fe=Symbol(``);N.MATCHER_NOT_FOUND,N.NAVIGATION_GUARD_REDIRECT,N.NAVIGATION_ABORTED,N.NAVIGATION_CANCELLED,N.NAVIGATION_DUPLICATED;function Ie(e,t){return j(Error(),{type:e,[Fe]:!0},t)}function P(e,t){return e instanceof Error&&Fe in e&&(t==null||!!(e.type&t))}var Le=Symbol(``),Re=Symbol(``),ze=Symbol(``),Be=Symbol(``),Ve=Symbol(``);function He(){return w(ze)}function Ue(e){return w(Be)}var We=/#/g,Ge=/&/g,Ke=/\//g,qe=/=/g,Je=/\?/g,Ye=/\+/g,Xe=/%5B/g,Ze=/%5D/g,Qe=/%5E/g,$e=/%60/g,et=/%7B/g,tt=/%7C/g,nt=/%7D/g,rt=/%20/g;function it(e){return e==null?``:encodeURI(``+e).replace(tt,`|`).replace(Xe,`[`).replace(Ze,`]`)}function at(e){return it(e).replace(et,`{`).replace(nt,`}`).replace(Qe,`^`)}function ot(e){return it(e).replace(Ye,`%2B`).replace(rt,`+`).replace(We,`%23`).replace(Ge,`%26`).replace($e,"`").replace(et,`{`).replace(nt,`}`).replace(Qe,`^`)}function st(e){return ot(e).replace(qe,`%3D`)}function ct(e){return it(e).replace(We,`%23`).replace(Je,`%3F`)}function lt(e){return ct(e).replace(Ke,`%2F`)}function ut(e){if(e==null)return null;try{return decodeURIComponent(``+e)}catch{}return``+e}var dt=/\/$/,ft=e=>e.replace(dt,``);function pt(e,t,n=`/`){let r,i={},a=``,o=``,s=t.indexOf(`#`),c=t.indexOf(`?`);return c=s>=0&&c>s?-1:c,c>=0&&(r=t.slice(0,c),a=t.slice(c,s>0?s:t.length),i=e(a.slice(1))),s>=0&&(r||=t.slice(0,s),o=t.slice(s,t.length)),r=xt(r??t,n),{fullPath:r+a+o,path:r,query:i,hash:ut(o)}}function mt(e,t){let n=t.query?e(t.query):``;return t.path+(n&&`?`)+n+(t.hash||``)}function ht(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||`/`}function gt(e,t,n){let r=t.matched.length-1,i=n.matched.length-1;return r>-1&&r===i&&_t(t.matched[r],n.matched[i])&&vt(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function _t(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function vt(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!yt(e[n],t[n]))return!1;return!0}function yt(e,t){return M(e)?bt(e,t):M(t)?bt(t,e):(e&&e.valueOf())===(t&&t.valueOf())}function bt(e,t){return M(t)?e.length===t.length&&e.every((e,n)=>e===t[n]):e.length===1&&e[0]===t}function xt(e,t){if(e.startsWith(`/`))return e;if(!e)return t;let n=t.split(`/`),r=e.split(`/`),i=r[r.length-1];(i===`..`||i===`.`)&&r.push(``);let a=n.length-1,o,s;for(o=0;o1&&a--;else break;return n.slice(0,a).join(`/`)+`/`+r.slice(o).join(`/`)}var F={path:`/`,name:void 0,params:{},query:{},hash:``,fullPath:`/`,matched:[],meta:{},redirectedFrom:void 0},St=function(e){return e.pop=`pop`,e.push=`push`,e}({}),Ct=function(e){return e.back=`back`,e.forward=`forward`,e.unknown=``,e}({});function wt(e){if(!e)if(ke){let t=document.querySelector(`base`);e=t&&t.getAttribute(`href`)||`/`,e=e.replace(/^\w+:\/\/[^\/]+/,``)}else e=`/`;return e[0]!==`/`&&e[0]!==`#`&&(e=`/`+e),ft(e)}var Tt=/^[^#]+#/;function Et(e,t){return e.replace(Tt,`#`)+t}function Dt(e,t){let n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}var Ot=()=>({left:window.scrollX,top:window.scrollY});function kt(e){let t;if(`el`in e){let n=e.el,r=typeof n==`string`&&n.startsWith(`#`),i=typeof n==`string`?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!i)return;t=Dt(i,e)}else t=e;`scrollBehavior`in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left==null?window.scrollX:t.left,t.top==null?window.scrollY:t.top)}function At(e,t){return(history.state?history.state.position-t:-1)+e}var jt=new Map;function Mt(e,t){jt.set(e,t)}function Nt(e){let t=jt.get(e);return jt.delete(e),t}function Pt(e){return typeof e==`string`||e&&typeof e==`object`}function Ft(e){return typeof e==`string`||typeof e==`symbol`}function It(e){let t={};if(e===``||e===`?`)return t;let n=(e[0]===`?`?e.slice(1):e).split(`&`);for(let e=0;ee&&ot(e)):[r&&ot(r)]).forEach(e=>{e!==void 0&&(t+=(t.length?`&`:``)+n,e!=null&&(t+=`=`+e))})}return t}function Rt(e){let t={};for(let n in e){let r=e[n];r!==void 0&&(t[n]=M(r)?r.map(e=>e==null?null:``+e):r==null?r:``+r)}return t}function zt(){let e=[];function t(t){return e.push(t),()=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Bt(e,t,n){let a=e.value;if(!a)return;let o=a,s=()=>{o[t].delete(n)};i(s),f(s),r(()=>{let r=e.value;r&&(o=r),o[t].add(n)}),o[t].add(n)}function Vt(e){Bt(w(Le,{}),`leaveGuards`,e)}function I(e,t,n,r,i,a=e=>e()){let o=r&&(r.enterCallbacks[i]=r.enterCallbacks[i]||[]);return()=>new Promise((s,c)=>{let l=e=>{e===!1?c(Ie(N.NAVIGATION_ABORTED,{from:n,to:t})):e instanceof Error?c(e):Pt(e)?c(Ie(N.NAVIGATION_GUARD_REDIRECT,{from:t,to:e})):(o&&r.enterCallbacks[i]===o&&typeof e==`function`&&o.push(e),s())},u=a(()=>e.call(r&&r.instances[i],t,n,l)),d=Promise.resolve(u);e.length<3&&(d=d.then(l)),d.catch(e=>c(e))})}function Ht(e,t,n,r,i=e=>e()){let a=[];for(let o of e)for(let e in o.components){let s=o.components[e];if(!(t!==`beforeRouteEnter`&&!o.instances[e]))if(Ae(s)){let c=(s.__vccOpts||s)[t];c&&a.push(I(c,n,r,o,e,i))}else{let c=s();a.push(()=>c.then(a=>{if(!a)throw Error(`Couldn't resolve component "${e}" at "${o.path}"`);let s=je(a)?a.default:a;o.mods[e]=a,o.components[e]=s;let c=(s.__vccOpts||s)[t];return c&&I(c,n,r,o,e,i)()}))}}return a}function Ut(e,t){let n=[],r=[],i=[],a=Math.max(t.matched.length,e.matched.length);for(let o=0;o_t(e,a))?r.push(a):n.push(a));let s=e.matched[o];s&&(t.matched.find(e=>_t(e,s))||i.push(s))}return[n,r,i]}var Wt=()=>location.protocol+`//`+location.host;function Gt(e,t){let{pathname:n,search:r,hash:i}=t,a=e.indexOf(`#`);if(a>-1){let t=i.includes(e.slice(a))?e.slice(a).length:1,n=i.slice(t);return n[0]!==`/`&&(n=`/`+n),ht(n,``)}return ht(n,e)+r+i}function Kt(e,t,n,r){let i=[],a=[],o=null,s=({state:a})=>{let s=Gt(e,location),c=n.value,l=t.value,u=0;if(a){if(n.value=s,t.value=a,o&&o===c){o=null;return}u=l?a.position-l.position:0}else r(s);i.forEach(e=>{e(n.value,c,{delta:u,type:St.pop,direction:u?u>0?Ct.forward:Ct.back:Ct.unknown})})};function c(){o=n.value}function l(e){i.push(e);let t=()=>{let t=i.indexOf(e);t>-1&&i.splice(t,1)};return a.push(t),t}function u(){if(document.visibilityState===`hidden`){let{history:e}=window;if(!e.state)return;e.replaceState(j({},e.state,{scroll:Ot()}),``)}}function d(){for(let e of a)e();a=[],window.removeEventListener(`popstate`,s),window.removeEventListener(`pagehide`,u),document.removeEventListener(`visibilitychange`,u)}return window.addEventListener(`popstate`,s),window.addEventListener(`pagehide`,u),document.addEventListener(`visibilitychange`,u),{pauseListeners:c,listen:l,destroy:d}}function qt(e,t,n,r=!1,i=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:i?Ot():null}}function Jt(e){let{history:t,location:n}=window,r={value:Gt(e,n)},i={value:t.state};i.value||a(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function a(r,a,o){let s=e.indexOf(`#`),c=s>-1?(n.host&&document.querySelector(`base`)?e:e.slice(s))+r:Wt()+e+r;try{t[o?`replaceState`:`pushState`](a,``,c),i.value=a}catch(e){console.error(e),n[o?`replace`:`assign`](c)}}function o(e,n){a(e,j({},t.state,qt(i.value.back,e,i.value.forward,!0),n,{position:i.value.position}),!0),r.value=e}function s(e,n){let o=j({},i.value,t.state,{forward:e,scroll:Ot()});a(o.current,o,!0),a(e,j({},qt(r.value,e,null),{position:o.position+1},n),!1),r.value=e}return{location:r,state:i,push:s,replace:o}}function Yt(e){e=wt(e);let t=Jt(e),n=Kt(e,t.state,t.location,t.replace);function r(e,t=!0){t||n.pauseListeners(),history.go(e)}let i=j({location:``,base:e,go:r,createHref:Et.bind(null,e)},t,n);return Object.defineProperty(i,`location`,{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(i,`state`,{enumerable:!0,get:()=>t.state.value}),i}var L=function(e){return e[e.Static=0]=`Static`,e[e.Param=1]=`Param`,e[e.Group=2]=`Group`,e}({}),R=function(e){return e[e.Static=0]=`Static`,e[e.Param=1]=`Param`,e[e.ParamRegExp=2]=`ParamRegExp`,e[e.ParamRegExpEnd=3]=`ParamRegExpEnd`,e[e.EscapeNext=4]=`EscapeNext`,e}(R||{}),Xt={type:L.Static,value:``},Zt=/[a-zA-Z0-9_]/;function Qt(e){if(!e)return[[]];if(e===`/`)return[[Xt]];if(!e.startsWith(`/`))throw Error(`Invalid path "${e}"`);function t(e){throw Error(`ERR (${n})/"${l}": ${e}`)}let n=R.Static,r=n,i=[],a;function o(){a&&i.push(a),a=[]}let s=0,c,l=``,u=``;function d(){l&&=(n===R.Static?a.push({type:L.Static,value:l}):n===R.Param||n===R.ParamRegExp||n===R.ParamRegExpEnd?(a.length>1&&(c===`*`||c===`+`)&&t(`A repeatable param (${l}) must be alone in its segment. eg: '/:ids+.`),a.push({type:L.Param,value:l,regexp:u,repeatable:c===`*`||c===`+`,optional:c===`*`||c===`?`})):t(`Invalid state to consume buffer`),``)}function f(){l+=c}for(;st.length?t.length===1&&t[0]===z.Static+z.Segment?1:-1:0}function an(e,t){let n=0,r=e.score,i=t.score;for(;n0&&t[t.length-1]<0}var sn={strict:!1,end:!0,sensitive:!1};function cn(e,t,n){let r=j(nn(Qt(e.path),n),{record:e,parent:t,children:[],alias:[]});return t&&!r.record.aliasOf==!t.record.aliasOf&&t.children.push(r),r}function ln(e,t){let n=[],r=new Map;t=Pe(sn,t);function i(e){return r.get(e)}function a(e,n,r){let i=!r,s=dn(e);s.aliasOf=r&&r.record;let l=Pe(t,e),u=[s];if(`alias`in e){let t=typeof e.alias==`string`?[e.alias]:e.alias;for(let e of t)u.push(dn(j({},s,{components:r?r.record.components:s.components,path:e,aliasOf:r?r.record:s})))}let d,f;for(let t of u){let{path:u}=t;if(n&&u[0]!==`/`){let e=n.record.path,r=e[e.length-1]===`/`?``:`/`;t.path=n.record.path+(u&&r+u)}if(d=cn(t,n,l),r?r.alias.push(d):(f||=d,f!==d&&f.alias.push(d),i&&e.name&&!pn(d)&&o(e.name)),_n(d)&&c(d),s.children){let e=s.children;for(let t=0;t{o(f)}:Ne}function o(e){if(Ft(e)){let t=r.get(e);t&&(r.delete(e),n.splice(n.indexOf(t),1),t.children.forEach(o),t.alias.forEach(o))}else{let t=n.indexOf(e);t>-1&&(n.splice(t,1),e.record.name&&r.delete(e.record.name),e.children.forEach(o),e.alias.forEach(o))}}function s(){return n}function c(e){let t=hn(e,n);n.splice(t,0,e),e.record.name&&!pn(e)&&r.set(e.record.name,e)}function l(e,t){let i,a={},o,s;if(`name`in e&&e.name){if(i=r.get(e.name),!i)throw Ie(N.MATCHER_NOT_FOUND,{location:e});s=i.record.name,a=j(un(t.params,i.keys.filter(e=>!e.optional).concat(i.parent?i.parent.keys.filter(e=>e.optional):[]).map(e=>e.name)),e.params&&un(e.params,i.keys.map(e=>e.name))),o=i.stringify(a)}else if(e.path!=null)o=e.path,i=n.find(e=>e.re.test(o)),i&&(a=i.parse(o),s=i.record.name);else{if(i=t.name?r.get(t.name):n.find(e=>e.re.test(t.path)),!i)throw Ie(N.MATCHER_NOT_FOUND,{location:e,currentLocation:t});s=i.record.name,a=j({},t.params,e.params),o=i.stringify(a)}let c=[],l=i;for(;l;)c.unshift(l.record),l=l.parent;return{name:s,path:o,params:a,matched:c,meta:mn(c)}}e.forEach(e=>a(e));function u(){n.length=0,r.clear()}return{addRoute:a,resolve:l,removeRoute:o,clearRoutes:u,getRoutes:s,getRecordMatcher:i}}function un(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function dn(e){let t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:fn(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:`components`in e?e.components||null:e.component&&{default:e.component}};return Object.defineProperty(t,`mods`,{value:{}}),t}function fn(e){let t={},n=e.props||!1;if(`component`in e)t.default=n;else for(let r in e.components)t[r]=typeof n==`object`?n[r]:n;return t}function pn(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function mn(e){return e.reduce((e,t)=>j(e,t.meta),{})}function hn(e,t){let n=0,r=t.length;for(;n!==r;){let i=n+r>>1;an(e,t[i])<0?r=i:n=i+1}let i=gn(e);return i&&(r=t.lastIndexOf(i,r-1)),r}function gn(e){let t=e;for(;t=t.parent;)if(_n(t)&&an(e,t)===0)return t}function _n({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function vn(e){let t=w(ze),n=w(Be),r=S(()=>{let n=x(e.to);return t.resolve(n)}),i=S(()=>{let{matched:e}=r.value,{length:t}=e,i=e[t-1],a=n.matched;if(!i||!a.length)return-1;let o=a.findIndex(_t.bind(null,i));if(o>-1)return o;let s=Cn(e[t-2]);return t>1&&Cn(i)===s&&a[a.length-1].path!==s?a.findIndex(_t.bind(null,e[t-2])):o}),a=S(()=>i.value>-1&&Sn(n.params,r.value.params)),o=S(()=>i.value>-1&&i.value===n.matched.length-1&&vt(n.params,r.value.params));function s(n={}){if(xn(n)){let n=t[x(e.replace)?`replace`:`push`](x(e.to)).catch(Ne);return e.viewTransition&&typeof document<`u`&&`startViewTransition`in document&&document.startViewTransition(()=>n),n}return Promise.resolve()}return{route:r,href:S(()=>r.value.href),isActive:a,isExactActive:o,navigate:s}}function yn(e){return e.length===1?e[0]:e}var bn=b({name:`RouterLink`,compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:`page`},viewTransition:Boolean},useLink:vn,setup(e,{slots:t}){let n=s(vn(e)),{options:r}=w(ze),i=S(()=>({[wn(e.activeClass,r.linkActiveClass,`router-link-active`)]:n.isActive,[wn(e.exactActiveClass,r.linkExactActiveClass,`router-link-exact-active`)]:n.isExactActive}));return()=>{let r=t.default&&yn(t.default(n));return e.custom?r:ee(`a`,{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:i.value},r)}}});function xn(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){let t=e.currentTarget.getAttribute(`target`);if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function Sn(e,t){for(let n in t){let r=t[n],i=e[n];if(typeof r==`string`){if(r!==i)return!1}else if(!M(i)||i.length!==r.length||r.some((e,t)=>e.valueOf()!==i[t].valueOf()))return!1}return!0}function Cn(e){return e?e.aliasOf?e.aliasOf.path:e.path:``}var wn=(e,t,n)=>e??t??n,Tn=b({name:`RouterView`,inheritAttrs:!1,props:{name:{type:String,default:`default`},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:r}){let i=w(Ve),a=S(()=>e.route||i.value),o=w(Re,0),s=S(()=>{let e=x(o),{matched:t}=a.value,n;for(;(n=t[e])&&!n.components;)e++;return e}),c=S(()=>a.value.matched[s.value]);n(Re,S(()=>s.value+1)),n(Le,c),n(Ve,a);let l=g();return u(()=>[l.value,c.value,e.name],([e,t,n],[r,i,a])=>{t&&(t.instances[n]=e,i&&i!==t&&e&&e===r&&(t.leaveGuards.size||(t.leaveGuards=i.leaveGuards),t.updateGuards.size||(t.updateGuards=i.updateGuards))),e&&t&&(!i||!_t(t,i)||!r)&&(t.enterCallbacks[n]||[]).forEach(t=>t(e))},{flush:`post`}),()=>{let n=a.value,i=e.name,o=c.value,s=o&&o.components[i];if(!s)return En(r.default,{Component:s,route:n});let u=o.props[i],d=ee(s,j({},u?u===!0?n.params:typeof u==`function`?u(n):u:null,t,{onVnodeUnmounted:e=>{e.component.isUnmounted&&(o.instances[i]=null)},ref:l}));return En(r.default,{Component:d,route:n})||d}}});function En(e,t){if(!e)return null;let n=e(t);return n.length===1?n[0]:n}var Dn=Tn;function On(e){let t=ln(e.routes,e),n=e.parseQuery||It,r=e.stringifyQuery||Lt,i=e.history,a=zt(),o=zt(),s=zt(),c=_(F),l=F;ke&&e.scrollBehavior&&`scrollRestoration`in history&&(history.scrollRestoration=`manual`);let u=Me.bind(null,e=>``+e),f=Me.bind(null,lt),p=Me.bind(null,ut);function m(e,n){let r,i;return Ft(e)?(r=t.getRecordMatcher(e),i=n):i=e,t.addRoute(i,r)}function g(e){let n=t.getRecordMatcher(e);n&&t.removeRoute(n)}function v(){return t.getRoutes().map(e=>e.record)}function y(e){return!!t.getRecordMatcher(e)}function b(e,a){if(a=j({},a||c.value),typeof e==`string`){let r=pt(n,e,a.path),o=t.resolve({path:r.path},a),s=i.createHref(r.fullPath);return j(r,o,{params:p(o.params),hash:ut(r.hash),redirectedFrom:void 0,href:s})}let o;if(e.path!=null)o=j({},e,{path:pt(n,e.path,a.path).path});else{let t=j({},e.params);for(let e in t)t[e]??delete t[e];o=j({},e,{params:f(t)}),a.params=f(a.params)}let s=t.resolve(o,a),l=e.hash||``;s.params=u(p(s.params));let d=mt(r,j({},e,{hash:at(l),path:s.path})),m=i.createHref(d);return j({fullPath:d,hash:l,query:r===Lt?Rt(e.query):e.query||{}},s,{redirectedFrom:void 0,href:m})}function S(e){return typeof e==`string`?pt(n,e,c.value.path):j({},e)}function C(e,t){if(l!==e)return Ie(N.NAVIGATION_CANCELLED,{from:t,to:e})}function w(e){return T(e)}function ee(e){return w(j(S(e),{replace:!0}))}function te(e,t){let n=e.matched[e.matched.length-1];if(n&&n.redirect){let{redirect:r}=n,i=typeof r==`function`?r(e,t):r;return typeof i==`string`&&(i=i.includes(`?`)||i.includes(`#`)?i=S(i):{path:i},i.params={}),j({query:e.query,hash:e.hash,params:i.path==null?e.params:{}},i)}}function T(e,t){let n=l=b(e),i=c.value,a=e.state,o=e.force,s=e.replace===!0,u=te(n,i);if(u)return T(j(S(u),{state:typeof u==`object`?j({},a,u.state):a,force:o,replace:s}),t||n);let d=n;d.redirectedFrom=t;let f;return!o&>(r,i,n)&&(f=Ie(N.NAVIGATION_DUPLICATED,{to:d,from:i}),pe(i,i,!0,!1)),(f?Promise.resolve(f):re(d,i)).catch(e=>P(e)?P(e,N.NAVIGATION_GUARD_REDIRECT)?e:fe(e):ue(e,d,i)).then(e=>{if(e){if(P(e,N.NAVIGATION_GUARD_REDIRECT))return T(j({replace:s},S(e.to),{state:typeof e.to==`object`?j({},a,e.to.state):a,force:o}),t||d)}else e=ae(d,i,!0,s,a);return ie(d,i,e),e})}function ne(e,t){let n=C(e,t);return n?Promise.reject(n):Promise.resolve()}function E(e){let t=ge.values().next().value;return t&&typeof t.runWithContext==`function`?t.runWithContext(e):e()}function re(e,t){let n,[r,i,s]=Ut(e,t);n=Ht(r.reverse(),`beforeRouteLeave`,e,t);for(let i of r)i.leaveGuards.forEach(r=>{n.push(I(r,e,t))});let c=ne.bind(null,e,t);return n.push(c),k(n).then(()=>{n=[];for(let r of a.list())n.push(I(r,e,t));return n.push(c),k(n)}).then(()=>{n=Ht(i,`beforeRouteUpdate`,e,t);for(let r of i)r.updateGuards.forEach(r=>{n.push(I(r,e,t))});return n.push(c),k(n)}).then(()=>{n=[];for(let r of s)if(r.beforeEnter)if(M(r.beforeEnter))for(let i of r.beforeEnter)n.push(I(i,e,t));else n.push(I(r.beforeEnter,e,t));return n.push(c),k(n)}).then(()=>(e.matched.forEach(e=>e.enterCallbacks={}),n=Ht(s,`beforeRouteEnter`,e,t,E),n.push(c),k(n))).then(()=>{n=[];for(let r of o.list())n.push(I(r,e,t));return n.push(c),k(n)}).catch(e=>P(e,N.NAVIGATION_CANCELLED)?e:Promise.reject(e))}function ie(e,t,n){s.list().forEach(r=>E(()=>r(e,t,n)))}function ae(e,t,n,r,a){let o=C(e,t);if(o)return o;let s=t===F,l=ke?history.state:{};n&&(r||s?i.replace(e.fullPath,j({scroll:s&&l&&l.scroll},a)):i.push(e.fullPath,a)),c.value=e,pe(e,t,n,s),fe()}let oe;function se(){oe||=i.listen((e,t,n)=>{if(!O.listening)return;let r=b(e),a=te(r,O.currentRoute.value);if(a){T(j(a,{replace:!0,force:!0}),r).catch(Ne);return}l=r;let o=c.value;ke&&Mt(At(o.fullPath,n.delta),Ot()),re(r,o).catch(e=>P(e,N.NAVIGATION_ABORTED|N.NAVIGATION_CANCELLED)?e:P(e,N.NAVIGATION_GUARD_REDIRECT)?(T(j(S(e.to),{force:!0}),r).then(e=>{P(e,N.NAVIGATION_ABORTED|N.NAVIGATION_DUPLICATED)&&!n.delta&&n.type===St.pop&&i.go(-1,!1)}).catch(Ne),Promise.reject()):(n.delta&&i.go(-n.delta,!1),ue(e,r,o))).then(e=>{e||=ae(r,o,!1),e&&(n.delta&&!P(e,N.NAVIGATION_CANCELLED)?i.go(-n.delta,!1):n.type===St.pop&&P(e,N.NAVIGATION_ABORTED|N.NAVIGATION_DUPLICATED)&&i.go(-1,!1)),ie(r,o,e)}).catch(Ne)})}let ce=zt(),le=zt(),D;function ue(e,t,n){fe(e);let r=le.list();return r.length?r.forEach(r=>r(e,t,n)):console.error(e),Promise.reject(e)}function de(){return D&&c.value!==F?Promise.resolve():new Promise((e,t)=>{ce.add([e,t])})}function fe(e){return D||(D=!e,se(),ce.list().forEach(([t,n])=>e?n(e):t()),ce.reset()),e}function pe(t,n,r,i){let{scrollBehavior:a}=e;if(!ke||!a)return Promise.resolve();let o=!r&&Nt(At(t.fullPath,0))||(i||!r)&&history.state&&history.state.scroll||null;return d().then(()=>a(t,n,o)).then(e=>e&&kt(e)).catch(e=>ue(e,t,n))}let me=e=>i.go(e),he,ge=new Set,O={currentRoute:c,listening:!0,addRoute:m,removeRoute:g,clearRoutes:t.clearRoutes,hasRoute:y,getRoutes:v,resolve:b,options:e,push:w,replace:ee,go:me,back:()=>me(-1),forward:()=>me(1),beforeEach:a.add,beforeResolve:o.add,afterEach:s.add,onError:le.add,isReady:de,install(e){e.component(`RouterLink`,bn),e.component(`RouterView`,Dn),e.config.globalProperties.$router=O,Object.defineProperty(e.config.globalProperties,`$route`,{enumerable:!0,get:()=>x(c)}),ke&&!he&&c.value===F&&(he=!0,w(i.location).catch(e=>{}));let t={};for(let e in F)Object.defineProperty(t,e,{get:()=>c.value[e],enumerable:!0});e.provide(ze,O),e.provide(Be,h(t)),e.provide(Ve,c);let n=e.unmount;ge.add(e),e.unmount=function(){ge.delete(e),ge.size<1&&(l=F,oe&&oe(),oe=null,c.value=F,he=!1,D=!1),n()}}};function k(e){return e.reduce((e,t)=>e.then(()=>E(t)),Promise.resolve())}return O}function kn(e,t){return function(){return e.apply(t,arguments)}}var{toString:An}=Object.prototype,{getPrototypeOf:jn}=Object,{iterator:Mn,toStringTag:Nn}=Symbol,Pn=(e=>t=>{let n=An.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),B=e=>(e=e.toLowerCase(),t=>Pn(t)===e),Fn=e=>t=>typeof t===e,{isArray:In}=Array,Ln=Fn(`undefined`);function Rn(e){return e!==null&&!Ln(e)&&e.constructor!==null&&!Ln(e.constructor)&&V(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var zn=B(`ArrayBuffer`);function Bn(e){let t;return t=typeof ArrayBuffer<`u`&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&zn(e.buffer),t}var Vn=Fn(`string`),V=Fn(`function`),Hn=Fn(`number`),Un=e=>typeof e==`object`&&!!e,Wn=e=>e===!0||e===!1,Gn=e=>{if(Pn(e)!==`object`)return!1;let t=jn(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Nn in e)&&!(Mn in e)},Kn=e=>{if(!Un(e)||Rn(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},qn=B(`Date`),Jn=B(`File`),Yn=e=>!!(e&&e.uri!==void 0),Xn=e=>e&&e.getParts!==void 0,Zn=B(`Blob`),Qn=B(`FileList`),$n=e=>Un(e)&&V(e.pipe);function er(){return typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{}}var tr=er(),nr=tr.FormData===void 0?void 0:tr.FormData,rr=e=>{let t;return e&&(nr&&e instanceof nr||V(e.append)&&((t=Pn(e))===`formdata`||t===`object`&&V(e.toString)&&e.toString()===`[object FormData]`))},ir=B(`URLSearchParams`),[ar,or,sr,cr]=[`ReadableStream`,`Request`,`Response`,`Headers`].map(B),lr=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,``);function ur(e,t,{allOwnKeys:n=!1}={}){if(e==null)return;let r,i;if(typeof e!=`object`&&(e=[e]),In(e))for(r=0,i=e.length;r0;)if(i=n[r],t===i.toLowerCase())return i;return null}var H=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:global,fr=e=>!Ln(e)&&e!==H;function pr(){let{caseless:e,skipUndefined:t}=fr(this)&&this||{},n={},r=(r,i)=>{if(i===`__proto__`||i===`constructor`||i===`prototype`)return;let a=e&&dr(n,i)||i;Gn(n[a])&&Gn(r)?n[a]=pr(n[a],r):Gn(r)?n[a]=pr({},r):In(r)?n[a]=r.slice():(!t||!Ln(r))&&(n[a]=r)};for(let e=0,t=arguments.length;e(ur(t,(t,r)=>{n&&V(t)?Object.defineProperty(e,r,{value:kn(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),hr=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),gr=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,`constructor`,{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,`super`,{value:t.prototype}),n&&Object.assign(e.prototype,n)},_r=(e,t,n,r)=>{let i,a,o,s={};if(t||={},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)o=i[a],(!r||r(o,e,t))&&!s[o]&&(t[o]=e[o],s[o]=!0);e=n!==!1&&jn(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},vr=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;let r=e.indexOf(t,n);return r!==-1&&r===n},yr=e=>{if(!e)return null;if(In(e))return e;let t=e.length;if(!Hn(t))return null;let n=Array(t);for(;t-- >0;)n[t]=e[t];return n},br=(e=>t=>e&&t instanceof e)(typeof Uint8Array<`u`&&jn(Uint8Array)),xr=(e,t)=>{let n=(e&&e[Mn]).call(e),r;for(;(r=n.next())&&!r.done;){let n=r.value;t.call(e,n[0],n[1])}},Sr=(e,t)=>{let n,r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Cr=B(`HTMLFormElement`),wr=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),Tr=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Er=B(`RegExp`),Dr=(e,t)=>{let n=Object.getOwnPropertyDescriptors(e),r={};ur(n,(n,i)=>{let a;(a=t(n,i,e))!==!1&&(r[i]=a||n)}),Object.defineProperties(e,r)},Or=e=>{Dr(e,(t,n)=>{if(V(e)&&[`arguments`,`caller`,`callee`].indexOf(n)!==-1)return!1;let r=e[n];if(V(r)){if(t.enumerable=!1,`writable`in t){t.writable=!1;return}t.set||=()=>{throw Error(`Can not rewrite read-only method '`+n+`'`)}}})},kr=(e,t)=>{let n={},r=e=>{e.forEach(e=>{n[e]=!0})};return In(e)?r(e):r(String(e).split(t)),n},Ar=()=>{},jr=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Mr(e){return!!(e&&V(e.append)&&e[Nn]===`FormData`&&e[Mn])}var Nr=e=>{let t=Array(10),n=(e,r)=>{if(Un(e)){if(t.indexOf(e)>=0)return;if(Rn(e))return e;if(!(`toJSON`in e)){t[r]=e;let i=In(e)?[]:{};return ur(e,(e,t)=>{let a=n(e,r+1);!Ln(a)&&(i[t]=a)}),t[r]=void 0,i}}return e};return n(e,0)},Pr=B(`AsyncFunction`),Fr=e=>e&&(Un(e)||V(e))&&V(e.then)&&V(e.catch),Ir=((e,t)=>e?setImmediate:t?((e,t)=>(H.addEventListener(`message`,({source:n,data:r})=>{n===H&&r===e&&t.length&&t.shift()()},!1),n=>{t.push(n),H.postMessage(e,`*`)}))(`axios@${Math.random()}`,[]):e=>setTimeout(e))(typeof setImmediate==`function`,V(H.postMessage)),U={isArray:In,isArrayBuffer:zn,isBuffer:Rn,isFormData:rr,isArrayBufferView:Bn,isString:Vn,isNumber:Hn,isBoolean:Wn,isObject:Un,isPlainObject:Gn,isEmptyObject:Kn,isReadableStream:ar,isRequest:or,isResponse:sr,isHeaders:cr,isUndefined:Ln,isDate:qn,isFile:Jn,isReactNativeBlob:Yn,isReactNative:Xn,isBlob:Zn,isRegExp:Er,isFunction:V,isStream:$n,isURLSearchParams:ir,isTypedArray:br,isFileList:Qn,forEach:ur,merge:pr,extend:mr,trim:lr,stripBOM:hr,inherits:gr,toFlatObject:_r,kindOf:Pn,kindOfTest:B,endsWith:vr,toArray:yr,forEachEntry:xr,matchAll:Sr,isHTMLForm:Cr,hasOwnProperty:Tr,hasOwnProp:Tr,reduceDescriptors:Dr,freezeMethods:Or,toObjectSet:kr,toCamelCase:wr,noop:Ar,toFiniteNumber:jr,findKey:dr,global:H,isContextDefined:fr,isSpecCompliantForm:Mr,toJSONObject:Nr,isAsyncFn:Pr,isThenable:Fr,setImmediate:Ir,asap:typeof queueMicrotask<`u`?queueMicrotask.bind(H):typeof process<`u`&&process.nextTick||Ir,isIterable:e=>e!=null&&V(e[Mn])},W=class e extends Error{static from(t,n,r,i,a,o){let s=new e(t.message,n||t.code,r,i,a);return s.cause=t,s.name=t.name,t.status!=null&&s.status==null&&(s.status=t.status),o&&Object.assign(s,o),s}constructor(e,t,n,r,i){super(e),Object.defineProperty(this,`message`,{value:e,enumerable:!0,writable:!0,configurable:!0}),this.name=`AxiosError`,this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:U.toJSONObject(this.config),code:this.code,status:this.status}}};W.ERR_BAD_OPTION_VALUE=`ERR_BAD_OPTION_VALUE`,W.ERR_BAD_OPTION=`ERR_BAD_OPTION`,W.ECONNABORTED=`ECONNABORTED`,W.ETIMEDOUT=`ETIMEDOUT`,W.ERR_NETWORK=`ERR_NETWORK`,W.ERR_FR_TOO_MANY_REDIRECTS=`ERR_FR_TOO_MANY_REDIRECTS`,W.ERR_DEPRECATED=`ERR_DEPRECATED`,W.ERR_BAD_RESPONSE=`ERR_BAD_RESPONSE`,W.ERR_BAD_REQUEST=`ERR_BAD_REQUEST`,W.ERR_CANCELED=`ERR_CANCELED`,W.ERR_NOT_SUPPORT=`ERR_NOT_SUPPORT`,W.ERR_INVALID_URL=`ERR_INVALID_URL`;function Lr(e){return U.isPlainObject(e)||U.isArray(e)}function Rr(e){return U.endsWith(e,`[]`)?e.slice(0,-2):e}function zr(e,t,n){return e?e.concat(t).map(function(e,t){return e=Rr(e),!n&&t?`[`+e+`]`:e}).join(n?`.`:``):t}function Br(e){return U.isArray(e)&&!e.some(Lr)}var Vr=U.toFlatObject(U,{},null,function(e){return/^is[A-Z]/.test(e)});function Hr(e,t,n){if(!U.isObject(e))throw TypeError(`target must be an object`);t||=new FormData,n=U.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!U.isUndefined(t[e])});let r=n.metaTokens,i=n.visitor||l,a=n.dots,o=n.indexes,s=(n.Blob||typeof Blob<`u`&&Blob)&&U.isSpecCompliantForm(t);if(!U.isFunction(i))throw TypeError(`visitor must be a function`);function c(e){if(e===null)return``;if(U.isDate(e))return e.toISOString();if(U.isBoolean(e))return e.toString();if(!s&&U.isBlob(e))throw new W(`Blob is not supported. Use a Buffer instead.`);return U.isArrayBuffer(e)||U.isTypedArray(e)?s&&typeof Blob==`function`?new Blob([e]):Buffer.from(e):e}function l(e,n,i){let s=e;if(U.isReactNative(t)&&U.isReactNativeBlob(e))return t.append(zr(i,n,a),c(e)),!1;if(e&&!i&&typeof e==`object`){if(U.endsWith(n,`{}`))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(U.isArray(e)&&Br(e)||(U.isFileList(e)||U.endsWith(n,`[]`))&&(s=U.toArray(e)))return n=Rr(n),s.forEach(function(e,r){!(U.isUndefined(e)||e===null)&&t.append(o===!0?zr([n],r,a):o===null?n:n+`[]`,c(e))}),!1}return Lr(e)?!0:(t.append(zr(i,n,a),c(e)),!1)}let u=[],d=Object.assign(Vr,{defaultVisitor:l,convertValue:c,isVisitable:Lr});function f(e,n){if(!U.isUndefined(e)){if(u.indexOf(e)!==-1)throw Error(`Circular reference detected in `+n.join(`.`));u.push(e),U.forEach(e,function(e,r){(!(U.isUndefined(e)||e===null)&&i.call(t,e,U.isString(r)?r.trim():r,n,d))===!0&&f(e,n?n.concat(r):[r])}),u.pop()}}if(!U.isObject(e))throw TypeError(`data must be an object`);return f(e),t}function Ur(e){let t={"!":`%21`,"'":`%27`,"(":`%28`,")":`%29`,"~":`%7E`,"%20":`+`,"%00":`\0`};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Wr(e,t){this._pairs=[],e&&Hr(e,this,t)}var Gr=Wr.prototype;Gr.append=function(e,t){this._pairs.push([e,t])},Gr.toString=function(e){let t=e?function(t){return e.call(this,t,Ur)}:Ur;return this._pairs.map(function(e){return t(e[0])+`=`+t(e[1])},``).join(`&`)};function Kr(e){return encodeURIComponent(e).replace(/%3A/gi,`:`).replace(/%24/g,`$`).replace(/%2C/gi,`,`).replace(/%20/g,`+`)}function qr(e,t,n){if(!t)return e;let r=n&&n.encode||Kr,i=U.isFunction(n)?{serialize:n}:n,a=i&&i.serialize,o;if(o=a?a(t,i):U.isURLSearchParams(t)?t.toString():new Wr(t,i).toString(r),o){let t=e.indexOf(`#`);t!==-1&&(e=e.slice(0,t)),e+=(e.indexOf(`?`)===-1?`?`:`&`)+o}return e}var Jr=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&=[]}forEach(e){U.forEach(this.handlers,function(t){t!==null&&e(t)})}},Yr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Xr={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<`u`?URLSearchParams:Wr,FormData:typeof FormData<`u`?FormData:null,Blob:typeof Blob<`u`?Blob:null},protocols:[`http`,`https`,`file`,`blob`,`url`,`data`]},Zr=e({hasBrowserEnv:()=>Qr,hasStandardBrowserEnv:()=>ei,hasStandardBrowserWebWorkerEnv:()=>ti,navigator:()=>$r,origin:()=>ni}),Qr=typeof window<`u`&&typeof document<`u`,$r=typeof navigator==`object`&&navigator||void 0,ei=Qr&&(!$r||[`ReactNative`,`NativeScript`,`NS`].indexOf($r.product)<0),ti=typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope&&typeof self.importScripts==`function`,ni=Qr&&window.location.href||`http://localhost`,G={...Zr,...Xr};function ri(e,t){return Hr(e,new G.classes.URLSearchParams,{visitor:function(e,t,n,r){return G.isNode&&U.isBuffer(e)?(this.append(t,e.toString(`base64`)),!1):r.defaultVisitor.apply(this,arguments)},...t})}function ii(e){return U.matchAll(/\w+|\[(\w*)]/g,e).map(e=>e[0]===`[]`?``:e[1]||e[0])}function ai(e){let t={},n=Object.keys(e),r,i=n.length,a;for(r=0;r=e.length;return a=!a&&U.isArray(r)?r.length:a,s?(U.hasOwnProp(r,a)?r[a]=[r[a],n]:r[a]=n,!o):((!r[a]||!U.isObject(r[a]))&&(r[a]=[]),t(e,n,r[a],i)&&U.isArray(r[a])&&(r[a]=ai(r[a])),!o)}if(U.isFormData(e)&&U.isFunction(e.entries)){let n={};return U.forEachEntry(e,(e,r)=>{t(ii(e),r,n,0)}),n}return null}function si(e,t,n){if(U.isString(e))try{return(t||JSON.parse)(e),U.trim(e)}catch(e){if(e.name!==`SyntaxError`)throw e}return(n||JSON.stringify)(e)}var ci={transitional:Yr,adapter:[`xhr`,`http`,`fetch`],transformRequest:[function(e,t){let n=t.getContentType()||``,r=n.indexOf(`application/json`)>-1,i=U.isObject(e);if(i&&U.isHTMLForm(e)&&(e=new FormData(e)),U.isFormData(e))return r?JSON.stringify(oi(e)):e;if(U.isArrayBuffer(e)||U.isBuffer(e)||U.isStream(e)||U.isFile(e)||U.isBlob(e)||U.isReadableStream(e))return e;if(U.isArrayBufferView(e))return e.buffer;if(U.isURLSearchParams(e))return t.setContentType(`application/x-www-form-urlencoded;charset=utf-8`,!1),e.toString();let a;if(i){if(n.indexOf(`application/x-www-form-urlencoded`)>-1)return ri(e,this.formSerializer).toString();if((a=U.isFileList(e))||n.indexOf(`multipart/form-data`)>-1){let t=this.env&&this.env.FormData;return Hr(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||r?(t.setContentType(`application/json`,!1),si(e)):e}],transformResponse:[function(e){let t=this.transitional||ci.transitional,n=t&&t.forcedJSONParsing,r=this.responseType===`json`;if(U.isResponse(e)||U.isReadableStream(e))return e;if(e&&U.isString(e)&&(n&&!this.responseType||r)){let n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n)throw e.name===`SyntaxError`?W.from(e,W.ERR_BAD_RESPONSE,this,null,this.response):e}}return e}],timeout:0,xsrfCookieName:`XSRF-TOKEN`,xsrfHeaderName:`X-XSRF-TOKEN`,maxContentLength:-1,maxBodyLength:-1,env:{FormData:G.classes.FormData,Blob:G.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:`application/json, text/plain, */*`,"Content-Type":void 0}}};U.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`],e=>{ci.headers[e]={}});var li=U.toObjectSet([`age`,`authorization`,`content-length`,`content-type`,`etag`,`expires`,`from`,`host`,`if-modified-since`,`if-unmodified-since`,`last-modified`,`location`,`max-forwards`,`proxy-authorization`,`referer`,`retry-after`,`user-agent`]),ui=e=>{let t={},n,r,i;return e&&e.split(` +`).forEach(function(e){i=e.indexOf(`:`),n=e.substring(0,i).trim().toLowerCase(),r=e.substring(i+1).trim(),!(!n||t[n]&&li[n])&&(n===`set-cookie`?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+`, `+r:r)}),t},di=Symbol(`internals`);function fi(e){return e&&String(e).trim().toLowerCase()}function pi(e){return e===!1||e==null?e:U.isArray(e)?e.map(pi):String(e).replace(/[\r\n]+$/,``)}function mi(e){let t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}var hi=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function gi(e,t,n,r,i){if(U.isFunction(r))return r.call(this,t,n);if(i&&(t=n),U.isString(t)){if(U.isString(r))return t.indexOf(r)!==-1;if(U.isRegExp(r))return r.test(t)}}function _i(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function vi(e,t){let n=U.toCamelCase(` `+t);[`get`,`set`,`has`].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,i){return this[r].call(this,t,e,n,i)},configurable:!0})})}var K=class{constructor(e){e&&this.set(e)}set(e,t,n){let r=this;function i(e,t,n){let i=fi(t);if(!i)throw Error(`header name must be a non-empty string`);let a=U.findKey(r,i);(!a||r[a]===void 0||n===!0||n===void 0&&r[a]!==!1)&&(r[a||t]=pi(e))}let a=(e,t)=>U.forEach(e,(e,n)=>i(e,n,t));if(U.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if(U.isString(e)&&(e=e.trim())&&!hi(e))a(ui(e),t);else if(U.isObject(e)&&U.isIterable(e)){let n={},r,i;for(let t of e){if(!U.isArray(t))throw TypeError(`Object iterator must return a key-value pair`);n[i=t[0]]=(r=n[i])?U.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}a(n,t)}else e!=null&&i(t,e,n);return this}get(e,t){if(e=fi(e),e){let n=U.findKey(this,e);if(n){let e=this[n];if(!t)return e;if(t===!0)return mi(e);if(U.isFunction(t))return t.call(this,e,n);if(U.isRegExp(t))return t.exec(e);throw TypeError(`parser must be boolean|regexp|function`)}}}has(e,t){if(e=fi(e),e){let n=U.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||gi(this,this[n],n,t)))}return!1}delete(e,t){let n=this,r=!1;function i(e){if(e=fi(e),e){let i=U.findKey(n,e);i&&(!t||gi(n,n[i],i,t))&&(delete n[i],r=!0)}}return U.isArray(e)?e.forEach(i):i(e),r}clear(e){let t=Object.keys(this),n=t.length,r=!1;for(;n--;){let i=t[n];(!e||gi(this,this[i],i,e,!0))&&(delete this[i],r=!0)}return r}normalize(e){let t=this,n={};return U.forEach(this,(r,i)=>{let a=U.findKey(n,i);if(a){t[a]=pi(r),delete t[i];return}let o=e?_i(i):String(i).trim();o!==i&&delete t[i],t[o]=pi(r),n[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return U.forEach(this,(n,r)=>{n!=null&&n!==!1&&(t[r]=e&&U.isArray(n)?n.join(`, `):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+`: `+t).join(` +`)}getSetCookie(){return this.get(`set-cookie`)||[]}get[Symbol.toStringTag](){return`AxiosHeaders`}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){let n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){let t=(this[di]=this[di]={accessors:{}}).accessors,n=this.prototype;function r(e){let r=fi(e);t[r]||(vi(n,e),t[r]=!0)}return U.isArray(e)?e.forEach(r):r(e),this}};K.accessor([`Content-Type`,`Content-Length`,`Accept`,`Accept-Encoding`,`User-Agent`,`Authorization`]),U.reduceDescriptors(K.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),U.freezeMethods(K);function yi(e,t){let n=this||ci,r=t||n,i=K.from(r.headers),a=r.data;return U.forEach(e,function(e){a=e.call(n,a,i.normalize(),t?t.status:void 0)}),i.normalize(),a}function bi(e){return!!(e&&e.__CANCEL__)}var xi=class extends W{constructor(e,t,n){super(e??`canceled`,W.ERR_CANCELED,t,n),this.name=`CanceledError`,this.__CANCEL__=!0}};function Si(e,t,n){let r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new W(`Request failed with status code `+n.status,[W.ERR_BAD_REQUEST,W.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Ci(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||``}function wi(e,t){e||=10;let n=Array(e),r=Array(e),i=0,a=0,o;return t=t===void 0?1e3:t,function(s){let c=Date.now(),l=r[a];o||=c,n[i]=s,r[i]=c;let u=a,d=0;for(;u!==i;)d+=n[u++],u%=e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),c-o{n=r,i=null,a&&=(clearTimeout(a),null),e(...t)};return[(...e)=>{let t=Date.now(),s=t-n;s>=r?o(e,t):(i=e,a||=setTimeout(()=>{a=null,o(i)},r-s))},()=>i&&o(i)]}var Ei=(e,t,n=3)=>{let r=0,i=wi(50,250);return Ti(n=>{let a=n.loaded,o=n.lengthComputable?n.total:void 0,s=a-r,c=i(s),l=a<=o;r=a,e({loaded:a,total:o,progress:o?a/o:void 0,bytes:s,rate:c||void 0,estimated:c&&o&&l?(o-a)/c:void 0,event:n,lengthComputable:o!=null,[t?`download`:`upload`]:!0})},n)},Di=(e,t)=>{let n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Oi=e=>(...t)=>U.asap(()=>e(...t)),ki=G.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,G.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(G.origin),G.navigator&&/(msie|trident)/i.test(G.navigator.userAgent)):()=>!0,Ai=G.hasStandardBrowserEnv?{write(e,t,n,r,i,a,o){if(typeof document>`u`)return;let s=[`${e}=${encodeURIComponent(t)}`];U.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),U.isString(r)&&s.push(`path=${r}`),U.isString(i)&&s.push(`domain=${i}`),a===!0&&s.push(`secure`),U.isString(o)&&s.push(`SameSite=${o}`),document.cookie=s.join(`; `)},read(e){if(typeof document>`u`)return null;let t=document.cookie.match(RegExp(`(?:^|; )`+e+`=([^;]*)`));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,``,Date.now()-864e5,`/`)}}:{write(){},read(){return null},remove(){}};function ji(e){return typeof e==`string`?/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e):!1}function Mi(e,t){return t?e.replace(/\/?\/$/,``)+`/`+t.replace(/^\/+/,``):e}function Ni(e,t,n){let r=!ji(t);return e&&(r||n==0)?Mi(e,t):t}var Pi=e=>e instanceof K?{...e}:e;function q(e,t){t||={};let n={};function r(e,t,n,r){return U.isPlainObject(e)&&U.isPlainObject(t)?U.merge.call({caseless:r},e,t):U.isPlainObject(t)?U.merge({},t):U.isArray(t)?t.slice():t}function i(e,t,n,i){if(!U.isUndefined(t))return r(e,t,n,i);if(!U.isUndefined(e))return r(void 0,e,n,i)}function a(e,t){if(!U.isUndefined(t))return r(void 0,t)}function o(e,t){if(!U.isUndefined(t))return r(void 0,t);if(!U.isUndefined(e))return r(void 0,e)}function s(n,i,a){if(a in t)return r(n,i);if(a in e)return r(void 0,n)}let c={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:s,headers:(e,t,n)=>i(Pi(e),Pi(t),n,!0)};return U.forEach(Object.keys({...e,...t}),function(r){if(r===`__proto__`||r===`constructor`||r===`prototype`)return;let a=U.hasOwnProp(c,r)?c[r]:i,o=a(e[r],t[r],r);U.isUndefined(o)&&a!==s||(n[r]=o)}),n}var Fi=e=>{let t=q({},e),{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:a,headers:o,auth:s}=t;if(t.headers=o=K.from(o),t.url=qr(Ni(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),s&&o.set(`Authorization`,`Basic `+btoa((s.username||``)+`:`+(s.password?unescape(encodeURIComponent(s.password)):``))),U.isFormData(n)){if(G.hasStandardBrowserEnv||G.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(U.isFunction(n.getHeaders)){let e=n.getHeaders(),t=[`content-type`,`content-length`];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&o.set(e,n)})}}if(G.hasStandardBrowserEnv&&(r&&U.isFunction(r)&&(r=r(t)),r||r!==!1&&ki(t.url))){let e=i&&a&&Ai.read(a);e&&o.set(i,e)}return t},Ii=typeof XMLHttpRequest<`u`&&function(e){return new Promise(function(t,n){let r=Fi(e),i=r.data,a=K.from(r.headers).normalize(),{responseType:o,onUploadProgress:s,onDownloadProgress:c}=r,l,u,d,f,p;function m(){f&&f(),p&&p(),r.cancelToken&&r.cancelToken.unsubscribe(l),r.signal&&r.signal.removeEventListener(`abort`,l)}let h=new XMLHttpRequest;h.open(r.method.toUpperCase(),r.url,!0),h.timeout=r.timeout;function g(){if(!h)return;let r=K.from(`getAllResponseHeaders`in h&&h.getAllResponseHeaders());Si(function(e){t(e),m()},function(e){n(e),m()},{data:!o||o===`text`||o===`json`?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:r,config:e,request:h}),h=null}`onloadend`in h?h.onloadend=g:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf(`file:`)===0)||setTimeout(g)},h.onabort=function(){h&&=(n(new W(`Request aborted`,W.ECONNABORTED,e,h)),null)},h.onerror=function(t){let r=new W(t&&t.message?t.message:`Network Error`,W.ERR_NETWORK,e,h);r.event=t||null,n(r),h=null},h.ontimeout=function(){let t=r.timeout?`timeout of `+r.timeout+`ms exceeded`:`timeout exceeded`,i=r.transitional||Yr;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new W(t,i.clarifyTimeoutError?W.ETIMEDOUT:W.ECONNABORTED,e,h)),h=null},i===void 0&&a.setContentType(null),`setRequestHeader`in h&&U.forEach(a.toJSON(),function(e,t){h.setRequestHeader(t,e)}),U.isUndefined(r.withCredentials)||(h.withCredentials=!!r.withCredentials),o&&o!==`json`&&(h.responseType=r.responseType),c&&([d,p]=Ei(c,!0),h.addEventListener(`progress`,d)),s&&h.upload&&([u,f]=Ei(s),h.upload.addEventListener(`progress`,u),h.upload.addEventListener(`loadend`,f)),(r.cancelToken||r.signal)&&(l=t=>{h&&=(n(!t||t.type?new xi(null,e,h):t),h.abort(),null)},r.cancelToken&&r.cancelToken.subscribe(l),r.signal&&(r.signal.aborted?l():r.signal.addEventListener(`abort`,l)));let _=Ci(r.url);if(_&&G.protocols.indexOf(_)===-1){n(new W(`Unsupported protocol `+_+`:`,W.ERR_BAD_REQUEST,e));return}h.send(i||null)})},Li=(e,t)=>{let{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n=new AbortController,r,i=function(e){if(!r){r=!0,o();let t=e instanceof Error?e:this.reason;n.abort(t instanceof W?t:new xi(t instanceof Error?t.message:t))}},a=t&&setTimeout(()=>{a=null,i(new W(`timeout of ${t}ms exceeded`,W.ETIMEDOUT))},t),o=()=>{e&&=(a&&clearTimeout(a),a=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener(`abort`,i)}),null)};e.forEach(e=>e.addEventListener(`abort`,i));let{signal:s}=n;return s.unsubscribe=()=>U.asap(o),s}},Ri=function*(e,t){let n=e.byteLength;if(!t||n{let i=zi(e,t),a=0,o,s=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{let{done:t,value:r}=await i.next();if(t){s(),e.close();return}let o=r.byteLength;n&&n(a+=o),e.enqueue(new Uint8Array(r))}catch(e){throw s(e),e}},cancel(e){return s(e),i.return()}},{highWaterMark:2})},Hi=64*1024,{isFunction:Ui}=U,Wi=(({Request:e,Response:t})=>({Request:e,Response:t}))(U.global),{ReadableStream:Gi,TextEncoder:Ki}=U.global,qi=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Ji=e=>{e=U.merge.call({skipUndefined:!0},Wi,e);let{fetch:t,Request:n,Response:r}=e,i=t?Ui(t):typeof fetch==`function`,a=Ui(n),o=Ui(r);if(!i)return!1;let s=i&&Ui(Gi),c=i&&(typeof Ki==`function`?(e=>t=>e.encode(t))(new Ki):async e=>new Uint8Array(await new n(e).arrayBuffer())),l=a&&s&&qi(()=>{let e=!1,t=new Gi,r=new n(G.origin,{body:t,method:`POST`,get duplex(){return e=!0,`half`}}).headers.has(`Content-Type`);return t.cancel(),e&&!r}),u=o&&s&&qi(()=>U.isReadableStream(new r(``).body)),d={stream:u&&(e=>e.body)};i&&[`text`,`arrayBuffer`,`blob`,`formData`,`stream`].forEach(e=>{!d[e]&&(d[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new W(`Response type '${e}' is not supported`,W.ERR_NOT_SUPPORT,n)})});let f=async e=>{if(e==null)return 0;if(U.isBlob(e))return e.size;if(U.isSpecCompliantForm(e))return(await new n(G.origin,{method:`POST`,body:e}).arrayBuffer()).byteLength;if(U.isArrayBufferView(e)||U.isArrayBuffer(e))return e.byteLength;if(U.isURLSearchParams(e)&&(e+=``),U.isString(e))return(await c(e)).byteLength},p=async(e,t)=>U.toFiniteNumber(e.getContentLength())??f(t);return async e=>{let{url:i,method:o,data:s,signal:c,cancelToken:f,timeout:m,onDownloadProgress:h,onUploadProgress:g,responseType:_,headers:v,withCredentials:y=`same-origin`,fetchOptions:b}=Fi(e),x=t||fetch;_=_?(_+``).toLowerCase():`text`;let S=Li([c,f&&f.toAbortSignal()],m),C=null,w=S&&S.unsubscribe&&(()=>{S.unsubscribe()}),ee;try{if(g&&l&&o!==`get`&&o!==`head`&&(ee=await p(v,s))!==0){let e=new n(i,{method:`POST`,body:s,duplex:`half`}),t;if(U.isFormData(s)&&(t=e.headers.get(`content-type`))&&v.setContentType(t),e.body){let[t,n]=Di(ee,Ei(Oi(g)));s=Vi(e.body,Hi,t,n)}}U.isString(y)||(y=y?`include`:`omit`);let t=a&&`credentials`in n.prototype,c={...b,signal:S,method:o.toUpperCase(),headers:v.normalize().toJSON(),body:s,duplex:`half`,credentials:t?y:void 0};C=a&&new n(i,c);let f=await(a?x(C,b):x(i,c)),m=u&&(_===`stream`||_===`response`);if(u&&(h||m&&w)){let e={};[`status`,`statusText`,`headers`].forEach(t=>{e[t]=f[t]});let t=U.toFiniteNumber(f.headers.get(`content-length`)),[n,i]=h&&Di(t,Ei(Oi(h),!0))||[];f=new r(Vi(f.body,Hi,n,()=>{i&&i(),w&&w()}),e)}_||=`text`;let te=await d[U.findKey(d,_)||`text`](f,e);return!m&&w&&w(),await new Promise((t,n)=>{Si(t,n,{data:te,headers:K.from(f.headers),status:f.status,statusText:f.statusText,config:e,request:C})})}catch(t){throw w&&w(),t&&t.name===`TypeError`&&/Load failed|fetch/i.test(t.message)?Object.assign(new W(`Network Error`,W.ERR_NETWORK,e,C,t&&t.response),{cause:t.cause||t}):W.from(t,t&&t.code,e,C,t&&t.response)}}},Yi=new Map,Xi=e=>{let t=e&&e.env||{},{fetch:n,Request:r,Response:i}=t,a=[r,i,n],o=a.length,s,c,l=Yi;for(;o--;)s=a[o],c=l.get(s),c===void 0&&l.set(s,c=o?new Map:Ji(t)),l=c;return c};Xi();var Zi={http:null,xhr:Ii,fetch:{get:Xi}};U.forEach(Zi,(e,t)=>{if(e){try{Object.defineProperty(e,`name`,{value:t})}catch{}Object.defineProperty(e,`adapterName`,{value:t})}});var Qi=e=>`- ${e}`,$i=e=>U.isFunction(e)||e===null||e===!1;function ea(e,t){e=U.isArray(e)?e:[e];let{length:n}=e,r,i,a={};for(let o=0;o`adapter ${e} `+(t===!1?`is not supported by the environment`:`is not available in the build`));throw new W(`There is no suitable adapter to dispatch the request `+(n?e.length>1?`since : +`+e.map(Qi).join(` +`):` `+Qi(e[0]):`as no adapter specified`),`ERR_NOT_SUPPORT`)}return i}var ta={getAdapter:ea,adapters:Zi};function na(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new xi(null,e)}function ra(e){return na(e),e.headers=K.from(e.headers),e.data=yi.call(e,e.transformRequest),[`post`,`put`,`patch`].indexOf(e.method)!==-1&&e.headers.setContentType(`application/x-www-form-urlencoded`,!1),ta.getAdapter(e.adapter||ci.adapter,e)(e).then(function(t){return na(e),t.data=yi.call(e,e.transformResponse,t),t.headers=K.from(t.headers),t},function(t){return bi(t)||(na(e),t&&t.response&&(t.response.data=yi.call(e,e.transformResponse,t.response),t.response.headers=K.from(t.response.headers))),Promise.reject(t)})}var ia=`1.14.0`,aa={};[`object`,`boolean`,`number`,`function`,`string`,`symbol`].forEach((e,t)=>{aa[e]=function(n){return typeof n===e||`a`+(t<1?`n `:` `)+e}});var oa={};aa.transitional=function(e,t,n){function r(e,t){return`[Axios v`+ia+`] Transitional option '`+e+`'`+t+(n?`. `+n:``)}return(n,i,a)=>{if(e===!1)throw new W(r(i,` has been removed`+(t?` in `+t:``)),W.ERR_DEPRECATED);return t&&!oa[i]&&(oa[i]=!0,console.warn(r(i,` has been deprecated since v`+t+` and will be removed in the near future`))),e?e(n,i,a):!0}},aa.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function sa(e,t,n){if(typeof e!=`object`)throw new W(`options must be an object`,W.ERR_BAD_OPTION_VALUE);let r=Object.keys(e),i=r.length;for(;i-- >0;){let a=r[i],o=t[a];if(o){let t=e[a],n=t===void 0||o(t,a,e);if(n!==!0)throw new W(`option `+a+` must be `+n,W.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new W(`Unknown option `+a,W.ERR_BAD_OPTION)}}var ca={assertOptions:sa,validators:aa},J=ca.validators,Y=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Jr,response:new Jr}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=Error();let n=t.stack?t.stack.replace(/^.+\n/,``):``;try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,``))&&(e.stack+=` +`+n):e.stack=n}catch{}}throw e}}_request(e,t){typeof e==`string`?(t||={},t.url=e):t=e||{},t=q(this.defaults,t);let{transitional:n,paramsSerializer:r,headers:i}=t;n!==void 0&&ca.assertOptions(n,{silentJSONParsing:J.transitional(J.boolean),forcedJSONParsing:J.transitional(J.boolean),clarifyTimeoutError:J.transitional(J.boolean),legacyInterceptorReqResOrdering:J.transitional(J.boolean)},!1),r!=null&&(U.isFunction(r)?t.paramsSerializer={serialize:r}:ca.assertOptions(r,{encode:J.function,serialize:J.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls===void 0?t.allowAbsoluteUrls=!0:t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls),ca.assertOptions(t,{baseUrl:J.spelling(`baseURL`),withXsrfToken:J.spelling(`withXSRFToken`)},!0),t.method=(t.method||this.defaults.method||`get`).toLowerCase();let a=i&&U.merge(i.common,i[t.method]);i&&U.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`common`],e=>{delete i[e]}),t.headers=K.concat(a,i);let o=[],s=!0;this.interceptors.request.forEach(function(e){if(typeof e.runWhen==`function`&&e.runWhen(t)===!1)return;s&&=e.synchronous;let n=t.transitional||Yr;n&&n.legacyInterceptorReqResOrdering?o.unshift(e.fulfilled,e.rejected):o.push(e.fulfilled,e.rejected)});let c=[];this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,u=0,d;if(!s){let e=[ra.bind(this),void 0];for(e.unshift(...o),e.push(...c),d=e.length,l=Promise.resolve(t);u{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t,r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,i){n.reason||(n.reason=new xi(e,r,i),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}};function ua(e){return function(t){return e.apply(null,t)}}function da(e){return U.isObject(e)&&e.isAxiosError===!0}var fa={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(fa).forEach(([e,t])=>{fa[t]=e});function pa(e){let t=new Y(e),n=kn(Y.prototype.request,t);return U.extend(n,Y.prototype,t,{allOwnKeys:!0}),U.extend(n,t,null,{allOwnKeys:!0}),n.create=function(t){return pa(q(e,t))},n}var X=pa(ci);X.Axios=Y,X.CanceledError=xi,X.CancelToken=la,X.isCancel=bi,X.VERSION=ia,X.toFormData=Hr,X.AxiosError=W,X.Cancel=X.CanceledError,X.all=function(e){return Promise.all(e)},X.spread=ua,X.isAxiosError=da,X.mergeConfig=q,X.AxiosHeaders=K,X.formToJSON=e=>oi(U.isHTMLForm(e)?new FormData(e):e),X.getAdapter=ta.getAdapter,X.HttpStatusCode=fa,X.default=X;var ma=`pymc_jwt_token`,ha=`pymc_client_id`;function ga(){let e=localStorage.getItem(ha);return e||(e=`${Date.now()}-${Math.random().toString(36).substring(2,15)}`,localStorage.setItem(ha,e)),e}function Z(){return localStorage.getItem(ma)}function _a(e){localStorage.setItem(ma,e)}function va(){localStorage.removeItem(ma)}function ya(){return Z()!==null}function ba(e){try{let t=e.split(`.`)[1].replace(/-/g,`+`).replace(/_/g,`/`),n=decodeURIComponent(atob(t).split(``).map(e=>`%`+(`00`+e.charCodeAt(0).toString(16)).slice(-2)).join(``));return JSON.parse(n)}catch{return null}}function xa(){let e=Z();if(!e)return!0;let t=ba(e);return!t||!t.exp?!0:Date.now()>=t.exp*1e3-3e4}function Sa(){let e=Z();if(!e)return!1;let t=ba(e);if(!t||!t.exp)return!1;let n=t.exp*1e3-Date.now();return n>0&&n<3e5}function Ca(){let e=Z();if(!e)return null;let t=ba(e);return!t||!t.sub?null:t.sub}var wa=`modulepreload`,Ta=function(e){return`/`+e},Ea={},Q=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=Ta(t,n),t in Ea)return;Ea[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:wa,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Da=On({history:Yt(`/`),routes:[{path:`/setup`,name:`setup`,component:()=>Q(()=>import(`./Setup-CpiSqNYG.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])),meta:{requiresAuth:!1,requiresSetup:!1}},{path:`/login`,name:`login`,component:()=>Q(()=>import(`./Login-Yv1Mvbrl.js`),__vite__mapDeps([14,1,2,3,4,5,6,7,8,9,10,11,12,15])),meta:{requiresAuth:!1}},{path:`/`,name:`dashboard`,component:()=>Q(()=>import(`./Dashboard-B5wTBGWv.js`),__vite__mapDeps([16,1,2,3,4,5,6,7,8,9,10,11,12,17,18,19,20])),meta:{requiresAuth:!0}},{path:`/neighbors`,name:`neighbors`,component:()=>Q(()=>import(`./Neighbors-BPL8jV_a.js`),__vite__mapDeps([21,1,22,3,4,23,5,18,9,8,7,24,19,25,26])),meta:{requiresAuth:!0}},{path:`/statistics`,name:`statistics`,component:()=>Q(()=>import(`./Statistics-CW9a5fGJ.js`),__vite__mapDeps([27,17,3,5,4,28,1,29,8])),meta:{requiresAuth:!0}},{path:`/gps`,name:`gps-diagnostics`,component:()=>Q(()=>import(`./GPSDiagnostics-CqIZmMKR.js`),__vite__mapDeps([30,1,3,4,31])),meta:{requiresAuth:!0}},{path:`/system-stats`,name:`system-stats`,component:()=>Q(()=>import(`./SystemStats-_yafXwf7.js`),__vite__mapDeps([32,1,22,2,3,4,5,6,7,8,9,10,11,12,17,28,29,24,33])),meta:{requiresAuth:!0}},{path:`/sensors`,name:`sensors`,component:()=>Q(()=>import(`./Sensors-fpSLvgWk.js`),__vite__mapDeps([34,2,1,3,4,5,6,7,8,9,10,11,12])),meta:{requiresAuth:!0}},{path:`/configuration`,name:`configuration`,component:()=>Q(()=>import(`./Configuration-BkPRUvKr.js`),__vite__mapDeps([35,1,2,3,4,5,6,7,8,9,10,11,12,36,37,22,38,26,24,19,39])),meta:{requiresAuth:!0}},{path:`/cad-calibration`,name:`cad-calibration`,component:()=>Q(()=>import(`./CADCalibration-BB8Y2fH_.js`),__vite__mapDeps([40,1,22,2,3,4,5,6,7,8,9,10,11,12,41,42])),meta:{requiresAuth:!0}},{path:`/sessions`,name:`sessions`,component:()=>Q(()=>import(`./Sessions-BcRSI1Q2.js`),__vite__mapDeps([43,3,4,5])),meta:{requiresAuth:!0}},{path:`/room-servers`,name:`room-servers`,component:()=>Q(()=>import(`./RoomServers-C6RN6JrC.js`),__vite__mapDeps([44,2,1,3,4,5,6,7,8,9,10,11,12,36,37,22,38,26,45,19])),meta:{requiresAuth:!0}},{path:`/companions`,name:`companions`,component:()=>Q(()=>import(`./Companions-BWlxamyY.js`),__vite__mapDeps([46,2,1,3,4,5,6,7,8,9,10,11,12,36,45])),meta:{requiresAuth:!0}},{path:`/logs`,name:`logs`,component:()=>Q(()=>import(`./Logs-rmQ2jrEc.js`),__vite__mapDeps([47,3,5])),meta:{requiresAuth:!0}},{path:`/terminal`,name:`terminal`,component:()=>Q(()=>import(`./Terminal-BIlcURMy.js`),__vite__mapDeps([48,1,3,4,6,9,8,11,49])),meta:{requiresAuth:!0}},{path:`/help`,name:`help`,component:()=>Q(()=>import(`./Help-BXmxmm0K.js`),__vite__mapDeps([50,3])),meta:{requiresAuth:!0}}]}),Oa=!1;async function ka(){if(Oa)return!1;try{let e=await fetch(`/api/needs_setup`,{headers:{Accept:`application/json`}});if(!e.ok)return console.error(`Setup check failed:`,e.status),!1;let t=(await e.json()).needs_setup===!0;return t||(Oa=!0),t}catch(e){return console.error(`Error checking setup status:`,e),!1}}Da.beforeEach(async e=>{let t=e.meta.requiresAuth!==!1,n=ya();if(e.path!==`/setup`&&await ka())return`/setup`;if(e.path===`/setup`&&!await ka()||t&&!n)return`/login`;if(e.path===`/login`&&n)return`/`});var Aa=De(`appRuntime`,()=>{let e=g(typeof navigator>`u`?!0:navigator.onLine),t=g(typeof document>`u`?!0:document.visibilityState===`visible`),n=g(!1),r=g(null),i=g(!1),a=S(()=>e.value&&t.value&&n.value&&!i.value);function o(){n.value=!!Z()&&!xa(),n.value||(r.value=r.value??`expired`)}function s(){n.value=!0,r.value=null,i.value=!1}function c(t){e.value=t}function l(e){t.value=e}async function u(e){if(i.value)return;i.value=!0,r.value=e,n.value=!1;let{useWebSocketStore:t}=await Q(async()=>{let{useWebSocketStore:e}=await import(`./websocket-BH4j9arL.js`);return{useWebSocketStore:e}},__vite__mapDeps([51,10,3,7,8,9])),{usePacketStore:a}=await Q(async()=>{let{usePacketStore:e}=await import(`./packets-BK2ztQg5.js`);return{usePacketStore:e}},__vite__mapDeps([52,8,3])),{useSystemStore:o}=await Q(async()=>{let{useSystemStore:e}=await import(`./system-B4pvUuxx.js`);return{useSystemStore:e}},__vite__mapDeps([53,9,3,8])),s=t(),c=a(),l=o();s.disconnect({preventReconnect:!0,silent:e!==`logout`}),c.reset(),l.reset(),va(),Da.currentRoute.value.path!==`/login`&&await Da.push(`/login`),i.value=!1}async function d(e){await u(e)}return{isOnline:e,isDocumentVisible:t,isAuthenticated:n,authFailureReason:r,canMaintainConnections:a,syncAuthState:o,markAuthenticated:s,setOnline:c,setDocumentVisible:l,stopSession:u,handleAuthFailure:d}}),ja=`/api`,Ma=!1,Na=null;async function Pa(){return Ma&&Na?Na:(Ma=!0,Na=(async()=>{try{let e=Z();if(!e)throw Error(`No token to refresh`);let t=ga(),n=await X.post(`/auth/refresh`,{client_id:t},{headers:{Authorization:`Bearer ${e}`,"Content-Type":`application/json`}});if(n.data.success&&n.data.token){let e=n.data.token;return _a(e),e}else throw Error(`Token refresh failed`)}catch(e){throw console.error(`Token refresh error:`,e),await Aa().handleAuthFailure(`expired`),e}finally{Ma=!1,Na=null}})(),Na)}var $=X.create({baseURL:ja,timeout:1e4,headers:{"Content-Type":`application/json`}}),Fa=X.create({baseURL:``,timeout:1e4,headers:{"Content-Type":`application/json`}});Fa.interceptors.request.use(async e=>{if(e.url?.includes(`/auth/login`)||e.url?.includes(`/auth/refresh`))return e;let t=Z();if(t){if(Sa())try{let t=await Pa();return e.headers.Authorization=`Bearer ${t}`,e}catch(e){return Promise.reject(e)}if(xa())return Aa().handleAuthFailure(`expired`),Promise.reject(Error(`Token expired`));e.headers.Authorization=`Bearer ${t}`}return e},e=>(console.error(`Auth API Request Error:`,e),Promise.reject(e))),Fa.interceptors.response.use(e=>e,e=>((e.response?.status===401||e.response?.status===403)&&Aa().handleAuthFailure(e.response?.status===403?`forbidden`:`unauthorized`),console.error(`Auth API Response Error:`,e.response?.data||e.message),Promise.reject(e))),$.interceptors.request.use(async e=>{if(e.url?.includes(`/auth/login`))return e;let t=Z();if(t){if(Sa())try{let t=await Pa();return e.headers.Authorization=`Bearer ${t}`,e}catch(e){return Promise.reject(e)}if(xa())return Aa().handleAuthFailure(`expired`),Promise.reject(Error(`Token expired`));e.headers.Authorization=`Bearer ${t}`}return e},e=>(console.error(`API Request Error:`,e),Promise.reject(e))),$.interceptors.response.use(e=>e,e=>((e.response?.status===401||e.response?.status===403)&&Aa().handleAuthFailure(e.response?.status===403?`forbidden`:`unauthorized`),console.error(`API Response Error:`,e.response?.data||e.message),Promise.reject(e)));var Ia=class{static async get(e,t,n){try{return(await $.get(e,{params:t,...n})).data}catch(e){throw this.handleError(e)}}static async post(e,t,n){try{return(await $.post(e,t,n)).data}catch(e){throw this.handleError(e)}}static async put(e,t,n){try{return(await $.put(e,t,n)).data}catch(e){throw this.handleError(e)}}static async delete(e,t){try{return(await $.delete(e,t)).data}catch(e){throw this.handleError(e)}}static async getTransportKeys(){return this.get(`transport_keys`)}static async sendAdvert(){return this.post(`send_advert`,{},{headers:{"Content-Type":`application/json`}})}static async getGpsDiagnostics(){return this.get(`gps`)}static async createTransportKey(e,t,n,r,i){let a={name:e,flood_policy:t,parent_id:r,last_used:i};return n!==void 0&&(a.transport_key=n),this.post(`transport_keys`,a)}static async getTransportKey(e){return this.get(`transport_key/${e}`)}static async updateTransportKey(e,t,n,r,i,a){return this.put(`transport_key/${e}`,{name:t,flood_policy:n,transport_key:r,parent_id:i,last_used:a})}static async deleteTransportKey(e){return this.delete(`transport_key/${e}`)}static async updateUnscopedFloodPolicy(e){return this.post(`unscoped_flood_policy`,{unscoped_flood_allow:e})}static async getLogs(){try{return(await $.get(`logs`)).data}catch(e){throw this.handleError(e)}}static async deleteAdvert(e){return this.delete(`advert/${e}`)}static async pingNeighbor(e,t=10){return this.post(`ping_neighbor`,{target_id:e,timeout:t})}static async getIdentities(){return this.get(`identities`)}static async getIdentity(e){return this.get(`identity`,{name:e})}static async createIdentity(e){return this.post(`create_identity`,e)}static async updateIdentity(e){return this.put(`update_identity`,e)}static async deleteIdentity(e,t=`room_server`){let n=new URLSearchParams({name:e});return t===`companion`&&n.set(`type`,`companion`),this.delete(`delete_identity?${n.toString()}`)}static async sendRoomServerAdvert(e){return this.post(`send_room_server_advert`,{name:e})}static async importRepeaterContacts(e){return this.post(`companion/import_repeater_contacts`,e)}static async getACLInfo(){return this.get(`acl_info`)}static async getACLClients(e){return this.get(`acl_clients`,e)}static async removeACLClient(e){return this.post(`acl_remove_client`,e)}static async getACLStats(){return this.get(`acl_stats`)}static async getRoomMessages(e){return this.get(`room_messages`,e)}static async postRoomMessage(e){return this.post(`room_post_message`,e)}static async deleteRoomMessage(e){return this.delete(`room_message?room_name=${encodeURIComponent(e.room_name)}&message_id=${e.message_id}`)}static async clearRoomMessages(e){return this.delete(`room_messages?room_name=${encodeURIComponent(e)}`)}static async getRoomStats(e){return this.get(`room_stats`,e?{room_name:e}:void 0)}static async getRoomClients(e){return this.get(`room_clients`,{room_name:e})}static async exportConfig(e=!1){let t=e?`config_export?include_secrets=true`:`config_export`;return this.get(t)}static async importConfig(e){return this.post(`config_import`,{config:e})}static async exportIdentityKey(){return this.get(`identity_export`)}static async generateVanityKey(e,t=!1){return this.post(`generate_vanity_key`,{prefix:e,apply:t})}static async getDbStats(){return this.get(`db_stats`)}static async purgeTable(e){return this.post(`db_purge`,{tables:e})}static async vacuumDb(){return this.post(`db_vacuum`,{})}static handleError(e){if(X.isAxiosError(e)){if(e.response){let t=e.response.data?.error||e.response.data?.message||`HTTP ${e.response.status}`;return Error(t)}else if(e.request)return Error(`Network error - no response received`)}return Error(e instanceof Error?e.message:`Unknown error occurred`)}};export{ge as _,Da as a,ga as c,ya as d,xa as f,He as g,Ue as h,Aa as i,Z as l,Vt as m,$ as n,Q as o,_a as p,Fa as r,va as s,Ia as t,Ca as u,De as v,Oe as y}; \ No newline at end of file diff --git a/repeater/web/html/assets/api-DBiYn0RS.js b/repeater/web/html/assets/api-DBiYn0RS.js deleted file mode 100644 index 11c6775..0000000 --- a/repeater/web/html/assets/api-DBiYn0RS.js +++ /dev/null @@ -1,7 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Setup-CySN3SxS.js","assets/_plugin-vue_export-helper-TcpyXLsZ.js","assets/index-CG181k2K.js","assets/runtime-core.esm-bundler-C5QBTNWE.js","assets/pinia-DP0dFoGY.js","assets/Spinner-CYvUNW0P.js","assets/useTheme-D8lKuC-u.js","assets/dataService-KNFTsxUb.js","assets/packets-BBUX0ge1.js","assets/system-BfTzQTOF.js","assets/websocket-BqxrlZFR.js","assets/index-DInITHV1.css","assets/Setup-BpLQMRSD.css","assets/Login-BS0KJmAp.js","assets/Login-BgyfucJv.css","assets/Dashboard-Cl9vIX2c.js","assets/ChartCard-CzDm8sMP.js","assets/useSignalQuality-aEjorkkD.js","assets/preferences-6MHglq--.js","assets/Dashboard-BGrwr2sL.css","assets/Neighbors-n_lvMCc7.js","assets/chunk-DECur_0Z.js","assets/leaflet-src-phWEwbzW.js","assets/formatters-Cc4UJmeb.js","assets/Neighbors-Bng0BMwC.css","assets/leaflet-vh-t_kPv.css","assets/Statistics-Ca2RklrO.js","assets/chartjs-adapter-date-fns.esm-CzgOsHIF.js","assets/chartjs-adapter-date-fns-BKkkO1xH.css","assets/GPSDiagnostics-puRIblTp.js","assets/GPSDiagnostics-1MaoN5NX.css","assets/SystemStats-ChbjEAGq.js","assets/SystemStats-DzIGYJV7.css","assets/Sensors-DSOTF01P.js","assets/Configuration-D5-XdhcR.js","assets/ConfirmDialog-DZJrcPub.js","assets/LocationPicker-B5L5Ju6J.js","assets/LocationPicker-KkKL2lD_.css","assets/RestartModal-DDp7H13-.js","assets/Configuration-CuvKm5Yn.css","assets/CADCalibration-nHiYlOIH.js","assets/plotly.min-YhyN9SYa.js","assets/CADCalibration-C0vsymGt.css","assets/Sessions-CTrtKCPc.js","assets/RoomServers-CzQh-0n_.js","assets/MessageDialog-CgmXx0Yp.js","assets/Companions-DMtu-VdK.js","assets/Logs-BZIqxYO-.js","assets/Terminal-BVrSGxOT.js","assets/Terminal-8k-H0_ky.css","assets/Help-BXmxmm0K.js","assets/websocket-Dktgus76.js","assets/packets-DMWLbcpU.js","assets/system-Dqa4NhwB.js"])))=>i.map(i=>d[i]); -import{n as e}from"./chunk-DECur_0Z.js";import{A as t,C as n,D as r,J as i,R as a,S as o,T as s,X as c,Y as l,Z as u,g as d,nt as f,o as p,x as m,y as h}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{n as g}from"./pinia-DP0dFoGY.js";var _=typeof document<`u`;function v(e){return typeof e==`object`||`displayName`in e||`props`in e||`__vccOpts`in e}function y(e){return e.__esModule||e[Symbol.toStringTag]===`Module`||e.default&&v(e.default)}var b=Object.assign;function ee(e,t){let n={};for(let r in t){let i=t[r];n[r]=S(i)?i.map(e):e(i)}return n}var x=()=>{},S=Array.isArray;function C(e,t){let n={};for(let r in e)n[r]=r in t?t[r]:e[r];return n}var w=function(e){return e[e.MATCHER_NOT_FOUND=1]=`MATCHER_NOT_FOUND`,e[e.NAVIGATION_GUARD_REDIRECT=2]=`NAVIGATION_GUARD_REDIRECT`,e[e.NAVIGATION_ABORTED=4]=`NAVIGATION_ABORTED`,e[e.NAVIGATION_CANCELLED=8]=`NAVIGATION_CANCELLED`,e[e.NAVIGATION_DUPLICATED=16]=`NAVIGATION_DUPLICATED`,e}({}),te=Symbol(``);w.MATCHER_NOT_FOUND,w.NAVIGATION_GUARD_REDIRECT,w.NAVIGATION_ABORTED,w.NAVIGATION_CANCELLED,w.NAVIGATION_DUPLICATED;function T(e,t){return b(Error(),{type:e,[te]:!0},t)}function E(e,t){return e instanceof Error&&te in e&&(t==null||!!(e.type&t))}var ne=Symbol(``),D=Symbol(``),re=Symbol(``),ie=Symbol(``),ae=Symbol(``);function oe(){return m(re)}function se(e){return m(ie)}var ce=/#/g,le=/&/g,O=/\//g,ue=/=/g,de=/\?/g,fe=/\+/g,pe=/%5B/g,me=/%5D/g,he=/%5E/g,ge=/%60/g,_e=/%7B/g,ve=/%7C/g,k=/%7D/g,ye=/%20/g;function be(e){return e==null?``:encodeURI(``+e).replace(ve,`|`).replace(pe,`[`).replace(me,`]`)}function xe(e){return be(e).replace(_e,`{`).replace(k,`}`).replace(he,`^`)}function A(e){return be(e).replace(fe,`%2B`).replace(ye,`+`).replace(ce,`%23`).replace(le,`%26`).replace(ge,"`").replace(_e,`{`).replace(k,`}`).replace(he,`^`)}function Se(e){return A(e).replace(ue,`%3D`)}function Ce(e){return be(e).replace(ce,`%23`).replace(de,`%3F`)}function we(e){return Ce(e).replace(O,`%2F`)}function Te(e){if(e==null)return null;try{return decodeURIComponent(``+e)}catch{}return``+e}var Ee=/\/$/,De=e=>e.replace(Ee,``);function Oe(e,t,n=`/`){let r,i={},a=``,o=``,s=t.indexOf(`#`),c=t.indexOf(`?`);return c=s>=0&&c>s?-1:c,c>=0&&(r=t.slice(0,c),a=t.slice(c,s>0?s:t.length),i=e(a.slice(1))),s>=0&&(r||=t.slice(0,s),o=t.slice(s,t.length)),r=Pe(r??t,n),{fullPath:r+a+o,path:r,query:i,hash:Te(o)}}function ke(e,t){let n=t.query?e(t.query):``;return t.path+(n&&`?`)+n+(t.hash||``)}function j(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||`/`}function Ae(e,t,n){let r=t.matched.length-1,i=n.matched.length-1;return r>-1&&r===i&&M(t.matched[r],n.matched[i])&&je(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function M(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function je(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!Me(e[n],t[n]))return!1;return!0}function Me(e,t){return S(e)?Ne(e,t):S(t)?Ne(t,e):(e&&e.valueOf())===(t&&t.valueOf())}function Ne(e,t){return S(t)?e.length===t.length&&e.every((e,n)=>e===t[n]):e.length===1&&e[0]===t}function Pe(e,t){if(e.startsWith(`/`))return e;if(!e)return t;let n=t.split(`/`),r=e.split(`/`),i=r[r.length-1];(i===`..`||i===`.`)&&r.push(``);let a=n.length-1,o,s;for(o=0;o1&&a--;else break;return n.slice(0,a).join(`/`)+`/`+r.slice(o).join(`/`)}var N={path:`/`,name:void 0,params:{},query:{},hash:``,fullPath:`/`,matched:[],meta:{},redirectedFrom:void 0},Fe=function(e){return e.pop=`pop`,e.push=`push`,e}({}),Ie=function(e){return e.back=`back`,e.forward=`forward`,e.unknown=``,e}({});function Le(e){if(!e)if(_){let t=document.querySelector(`base`);e=t&&t.getAttribute(`href`)||`/`,e=e.replace(/^\w+:\/\/[^\/]+/,``)}else e=`/`;return e[0]!==`/`&&e[0]!==`#`&&(e=`/`+e),De(e)}var Re=/^[^#]+#/;function ze(e,t){return e.replace(Re,`#`)+t}function Be(e,t){let n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}var Ve=()=>({left:window.scrollX,top:window.scrollY});function He(e){let t;if(`el`in e){let n=e.el,r=typeof n==`string`&&n.startsWith(`#`),i=typeof n==`string`?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!i)return;t=Be(i,e)}else t=e;`scrollBehavior`in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left==null?window.scrollX:t.left,t.top==null?window.scrollY:t.top)}function Ue(e,t){return(history.state?history.state.position-t:-1)+e}var We=new Map;function Ge(e,t){We.set(e,t)}function Ke(e){let t=We.get(e);return We.delete(e),t}function qe(e){return typeof e==`string`||e&&typeof e==`object`}function Je(e){return typeof e==`string`||typeof e==`symbol`}function Ye(e){let t={};if(e===``||e===`?`)return t;let n=(e[0]===`?`?e.slice(1):e).split(`&`);for(let e=0;ee&&A(e)):[r&&A(r)]).forEach(e=>{e!==void 0&&(t+=(t.length?`&`:``)+n,e!=null&&(t+=`=`+e))})}return t}function Ze(e){let t={};for(let n in e){let r=e[n];r!==void 0&&(t[n]=S(r)?r.map(e=>e==null?null:``+e):r==null?r:``+r)}return t}function Qe(){let e=[];function t(t){return e.push(t),()=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function $e(e,t,i){let a=e.value;if(!a)return;let o=a,c=()=>{o[t].delete(i)};r(c),s(c),n(()=>{let n=e.value;n&&(o=n),o[t].add(i)}),o[t].add(i)}function et(e){$e(m(ne,{}),`leaveGuards`,e)}function P(e,t,n,r,i,a=e=>e()){let o=r&&(r.enterCallbacks[i]=r.enterCallbacks[i]||[]);return()=>new Promise((s,c)=>{let l=e=>{e===!1?c(T(w.NAVIGATION_ABORTED,{from:n,to:t})):e instanceof Error?c(e):qe(e)?c(T(w.NAVIGATION_GUARD_REDIRECT,{from:t,to:e})):(o&&r.enterCallbacks[i]===o&&typeof e==`function`&&o.push(e),s())},u=a(()=>e.call(r&&r.instances[i],t,n,l)),d=Promise.resolve(u);e.length<3&&(d=d.then(l)),d.catch(e=>c(e))})}function tt(e,t,n,r,i=e=>e()){let a=[];for(let o of e)for(let e in o.components){let s=o.components[e];if(!(t!==`beforeRouteEnter`&&!o.instances[e]))if(v(s)){let c=(s.__vccOpts||s)[t];c&&a.push(P(c,n,r,o,e,i))}else{let c=s();a.push(()=>c.then(a=>{if(!a)throw Error(`Couldn't resolve component "${e}" at "${o.path}"`);let s=y(a)?a.default:a;o.mods[e]=a,o.components[e]=s;let c=(s.__vccOpts||s)[t];return c&&P(c,n,r,o,e,i)()}))}}return a}function nt(e,t){let n=[],r=[],i=[],a=Math.max(t.matched.length,e.matched.length);for(let o=0;oM(e,a))?r.push(a):n.push(a));let s=e.matched[o];s&&(t.matched.find(e=>M(e,s))||i.push(s))}return[n,r,i]}var rt=()=>location.protocol+`//`+location.host;function it(e,t){let{pathname:n,search:r,hash:i}=t,a=e.indexOf(`#`);if(a>-1){let t=i.includes(e.slice(a))?e.slice(a).length:1,n=i.slice(t);return n[0]!==`/`&&(n=`/`+n),j(n,``)}return j(n,e)+r+i}function at(e,t,n,r){let i=[],a=[],o=null,s=({state:a})=>{let s=it(e,location),c=n.value,l=t.value,u=0;if(a){if(n.value=s,t.value=a,o&&o===c){o=null;return}u=l?a.position-l.position:0}else r(s);i.forEach(e=>{e(n.value,c,{delta:u,type:Fe.pop,direction:u?u>0?Ie.forward:Ie.back:Ie.unknown})})};function c(){o=n.value}function l(e){i.push(e);let t=()=>{let t=i.indexOf(e);t>-1&&i.splice(t,1)};return a.push(t),t}function u(){if(document.visibilityState===`hidden`){let{history:e}=window;if(!e.state)return;e.replaceState(b({},e.state,{scroll:Ve()}),``)}}function d(){for(let e of a)e();a=[],window.removeEventListener(`popstate`,s),window.removeEventListener(`pagehide`,u),document.removeEventListener(`visibilitychange`,u)}return window.addEventListener(`popstate`,s),window.addEventListener(`pagehide`,u),document.addEventListener(`visibilitychange`,u),{pauseListeners:c,listen:l,destroy:d}}function ot(e,t,n,r=!1,i=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:i?Ve():null}}function st(e){let{history:t,location:n}=window,r={value:it(e,n)},i={value:t.state};i.value||a(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function a(r,a,o){let s=e.indexOf(`#`),c=s>-1?(n.host&&document.querySelector(`base`)?e:e.slice(s))+r:rt()+e+r;try{t[o?`replaceState`:`pushState`](a,``,c),i.value=a}catch(e){console.error(e),n[o?`replace`:`assign`](c)}}function o(e,n){a(e,b({},t.state,ot(i.value.back,e,i.value.forward,!0),n,{position:i.value.position}),!0),r.value=e}function s(e,n){let o=b({},i.value,t.state,{forward:e,scroll:Ve()});a(o.current,o,!0),a(e,b({},ot(r.value,e,null),{position:o.position+1},n),!1),r.value=e}return{location:r,state:i,push:s,replace:o}}function ct(e){e=Le(e);let t=st(e),n=at(e,t.state,t.location,t.replace);function r(e,t=!0){t||n.pauseListeners(),history.go(e)}let i=b({location:``,base:e,go:r,createHref:ze.bind(null,e)},t,n);return Object.defineProperty(i,`location`,{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(i,`state`,{enumerable:!0,get:()=>t.state.value}),i}var F=function(e){return e[e.Static=0]=`Static`,e[e.Param=1]=`Param`,e[e.Group=2]=`Group`,e}({}),I=function(e){return e[e.Static=0]=`Static`,e[e.Param=1]=`Param`,e[e.ParamRegExp=2]=`ParamRegExp`,e[e.ParamRegExpEnd=3]=`ParamRegExpEnd`,e[e.EscapeNext=4]=`EscapeNext`,e}(I||{}),lt={type:F.Static,value:``},ut=/[a-zA-Z0-9_]/;function dt(e){if(!e)return[[]];if(e===`/`)return[[lt]];if(!e.startsWith(`/`))throw Error(`Invalid path "${e}"`);function t(e){throw Error(`ERR (${n})/"${l}": ${e}`)}let n=I.Static,r=n,i=[],a;function o(){a&&i.push(a),a=[]}let s=0,c,l=``,u=``;function d(){l&&=(n===I.Static?a.push({type:F.Static,value:l}):n===I.Param||n===I.ParamRegExp||n===I.ParamRegExpEnd?(a.length>1&&(c===`*`||c===`+`)&&t(`A repeatable param (${l}) must be alone in its segment. eg: '/:ids+.`),a.push({type:F.Param,value:l,regexp:u,repeatable:c===`*`||c===`+`,optional:c===`*`||c===`?`})):t(`Invalid state to consume buffer`),``)}function f(){l+=c}for(;st.length?t.length===1&&t[0]===L.Static+L.Segment?1:-1:0}function _t(e,t){let n=0,r=e.score,i=t.score;for(;n0&&t[t.length-1]<0}var yt={strict:!1,end:!0,sensitive:!1};function bt(e,t,n){let r=b(ht(dt(e.path),n),{record:e,parent:t,children:[],alias:[]});return t&&!r.record.aliasOf==!t.record.aliasOf&&t.children.push(r),r}function xt(e,t){let n=[],r=new Map;t=C(yt,t);function i(e){return r.get(e)}function a(e,n,r){let i=!r,s=Ct(e);s.aliasOf=r&&r.record;let l=C(t,e),u=[s];if(`alias`in e){let t=typeof e.alias==`string`?[e.alias]:e.alias;for(let e of t)u.push(Ct(b({},s,{components:r?r.record.components:s.components,path:e,aliasOf:r?r.record:s})))}let d,f;for(let t of u){let{path:u}=t;if(n&&u[0]!==`/`){let e=n.record.path,r=e[e.length-1]===`/`?``:`/`;t.path=n.record.path+(u&&r+u)}if(d=bt(t,n,l),r?r.alias.push(d):(f||=d,f!==d&&f.alias.push(d),i&&e.name&&!Tt(d)&&o(e.name)),kt(d)&&c(d),s.children){let e=s.children;for(let t=0;t{o(f)}:x}function o(e){if(Je(e)){let t=r.get(e);t&&(r.delete(e),n.splice(n.indexOf(t),1),t.children.forEach(o),t.alias.forEach(o))}else{let t=n.indexOf(e);t>-1&&(n.splice(t,1),e.record.name&&r.delete(e.record.name),e.children.forEach(o),e.alias.forEach(o))}}function s(){return n}function c(e){let t=Dt(e,n);n.splice(t,0,e),e.record.name&&!Tt(e)&&r.set(e.record.name,e)}function l(e,t){let i,a={},o,s;if(`name`in e&&e.name){if(i=r.get(e.name),!i)throw T(w.MATCHER_NOT_FOUND,{location:e});s=i.record.name,a=b(St(t.params,i.keys.filter(e=>!e.optional).concat(i.parent?i.parent.keys.filter(e=>e.optional):[]).map(e=>e.name)),e.params&&St(e.params,i.keys.map(e=>e.name))),o=i.stringify(a)}else if(e.path!=null)o=e.path,i=n.find(e=>e.re.test(o)),i&&(a=i.parse(o),s=i.record.name);else{if(i=t.name?r.get(t.name):n.find(e=>e.re.test(t.path)),!i)throw T(w.MATCHER_NOT_FOUND,{location:e,currentLocation:t});s=i.record.name,a=b({},t.params,e.params),o=i.stringify(a)}let c=[],l=i;for(;l;)c.unshift(l.record),l=l.parent;return{name:s,path:o,params:a,matched:c,meta:Et(c)}}e.forEach(e=>a(e));function u(){n.length=0,r.clear()}return{addRoute:a,resolve:l,removeRoute:o,clearRoutes:u,getRoutes:s,getRecordMatcher:i}}function St(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function Ct(e){let t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:wt(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:`components`in e?e.components||null:e.component&&{default:e.component}};return Object.defineProperty(t,`mods`,{value:{}}),t}function wt(e){let t={},n=e.props||!1;if(`component`in e)t.default=n;else for(let r in e.components)t[r]=typeof n==`object`?n[r]:n;return t}function Tt(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function Et(e){return e.reduce((e,t)=>b(e,t.meta),{})}function Dt(e,t){let n=0,r=t.length;for(;n!==r;){let i=n+r>>1;_t(e,t[i])<0?r=i:n=i+1}let i=Ot(e);return i&&(r=t.lastIndexOf(i,r-1)),r}function Ot(e){let t=e;for(;t=t.parent;)if(kt(t)&&_t(e,t)===0)return t}function kt({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function At(e){let t=m(re),n=m(ie),r=p(()=>{let n=f(e.to);return t.resolve(n)}),i=p(()=>{let{matched:e}=r.value,{length:t}=e,i=e[t-1],a=n.matched;if(!i||!a.length)return-1;let o=a.findIndex(M.bind(null,i));if(o>-1)return o;let s=Ft(e[t-2]);return t>1&&Ft(i)===s&&a[a.length-1].path!==s?a.findIndex(M.bind(null,e[t-2])):o}),a=p(()=>i.value>-1&&Pt(n.params,r.value.params)),o=p(()=>i.value>-1&&i.value===n.matched.length-1&&je(n.params,r.value.params));function s(n={}){if(Nt(n)){let n=t[f(e.replace)?`replace`:`push`](f(e.to)).catch(x);return e.viewTransition&&typeof document<`u`&&`startViewTransition`in document&&document.startViewTransition(()=>n),n}return Promise.resolve()}return{route:r,href:p(()=>r.value.href),isActive:a,isExactActive:o,navigate:s}}function jt(e){return e.length===1?e[0]:e}var Mt=d({name:`RouterLink`,compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:`page`},viewTransition:Boolean},useLink:At,setup(e,{slots:t}){let n=i(At(e)),{options:r}=m(re),a=p(()=>({[It(e.activeClass,r.linkActiveClass,`router-link-active`)]:n.isActive,[It(e.exactActiveClass,r.linkExactActiveClass,`router-link-exact-active`)]:n.isExactActive}));return()=>{let r=t.default&&jt(t.default(n));return e.custom?r:h(`a`,{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:a.value},r)}}});function Nt(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){let t=e.currentTarget.getAttribute(`target`);if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function Pt(e,t){for(let n in t){let r=t[n],i=e[n];if(typeof r==`string`){if(r!==i)return!1}else if(!S(i)||i.length!==r.length||r.some((e,t)=>e.valueOf()!==i[t].valueOf()))return!1}return!0}function Ft(e){return e?e.aliasOf?e.aliasOf.path:e.path:``}var It=(e,t,n)=>e??t??n,Lt=d({name:`RouterView`,inheritAttrs:!1,props:{name:{type:String,default:`default`},route:Object},compatConfig:{MODE:3},setup(e,{attrs:n,slots:r}){let i=m(ae),o=p(()=>e.route||i.value),s=m(D,0),c=p(()=>{let e=f(s),{matched:t}=o.value,n;for(;(n=t[e])&&!n.components;)e++;return e}),u=p(()=>o.value.matched[c.value]);t(D,p(()=>c.value+1)),t(ne,u),t(ae,o);let d=l();return a(()=>[d.value,u.value,e.name],([e,t,n],[r,i,a])=>{t&&(t.instances[n]=e,i&&i!==t&&e&&e===r&&(t.leaveGuards.size||(t.leaveGuards=i.leaveGuards),t.updateGuards.size||(t.updateGuards=i.updateGuards))),e&&t&&(!i||!M(t,i)||!r)&&(t.enterCallbacks[n]||[]).forEach(t=>t(e))},{flush:`post`}),()=>{let t=o.value,i=e.name,a=u.value,s=a&&a.components[i];if(!s)return Rt(r.default,{Component:s,route:t});let c=a.props[i],l=h(s,b({},c?c===!0?t.params:typeof c==`function`?c(t):c:null,n,{onVnodeUnmounted:e=>{e.component.isUnmounted&&(a.instances[i]=null)},ref:d}));return Rt(r.default,{Component:l,route:t})||l}}});function Rt(e,t){if(!e)return null;let n=e(t);return n.length===1?n[0]:n}var zt=Lt;function Bt(e){let t=xt(e.routes,e),n=e.parseQuery||Ye,r=e.stringifyQuery||Xe,i=e.history,a=Qe(),s=Qe(),l=Qe(),d=u(N),p=N;_&&e.scrollBehavior&&`scrollRestoration`in history&&(history.scrollRestoration=`manual`);let m=ee.bind(null,e=>``+e),h=ee.bind(null,we),g=ee.bind(null,Te);function v(e,n){let r,i;return Je(e)?(r=t.getRecordMatcher(e),i=n):i=e,t.addRoute(i,r)}function y(e){let n=t.getRecordMatcher(e);n&&t.removeRoute(n)}function C(){return t.getRoutes().map(e=>e.record)}function te(e){return!!t.getRecordMatcher(e)}function ne(e,a){if(a=b({},a||d.value),typeof e==`string`){let r=Oe(n,e,a.path),o=t.resolve({path:r.path},a),s=i.createHref(r.fullPath);return b(r,o,{params:g(o.params),hash:Te(r.hash),redirectedFrom:void 0,href:s})}let o;if(e.path!=null)o=b({},e,{path:Oe(n,e.path,a.path).path});else{let t=b({},e.params);for(let e in t)t[e]??delete t[e];o=b({},e,{params:h(t)}),a.params=h(a.params)}let s=t.resolve(o,a),c=e.hash||``;s.params=m(g(s.params));let l=ke(r,b({},e,{hash:xe(c),path:s.path})),u=i.createHref(l);return b({fullPath:l,hash:c,query:r===Xe?Ze(e.query):e.query||{}},s,{redirectedFrom:void 0,href:u})}function D(e){return typeof e==`string`?Oe(n,e,d.value.path):b({},e)}function oe(e,t){if(p!==e)return T(w.NAVIGATION_CANCELLED,{from:t,to:e})}function se(e){return O(e)}function ce(e){return se(b(D(e),{replace:!0}))}function le(e,t){let n=e.matched[e.matched.length-1];if(n&&n.redirect){let{redirect:r}=n,i=typeof r==`function`?r(e,t):r;return typeof i==`string`&&(i=i.includes(`?`)||i.includes(`#`)?i=D(i):{path:i},i.params={}),b({query:e.query,hash:e.hash,params:i.path==null?e.params:{}},i)}}function O(e,t){let n=p=ne(e),i=d.value,a=e.state,o=e.force,s=e.replace===!0,c=le(n,i);if(c)return O(b(D(c),{state:typeof c==`object`?b({},a,c.state):a,force:o,replace:s}),t||n);let l=n;l.redirectedFrom=t;let u;return!o&&Ae(r,i,n)&&(u=T(w.NAVIGATION_DUPLICATED,{to:l,from:i}),Se(i,i,!0,!1)),(u?Promise.resolve(u):fe(l,i)).catch(e=>E(e)?E(e,w.NAVIGATION_GUARD_REDIRECT)?e:A(e):ye(e,l,i)).then(e=>{if(e){if(E(e,w.NAVIGATION_GUARD_REDIRECT))return O(b({replace:s},D(e.to),{state:typeof e.to==`object`?b({},a,e.to.state):a,force:o}),t||l)}else e=me(l,i,!0,s,a);return pe(l,i,e),e})}function ue(e,t){let n=oe(e,t);return n?Promise.reject(n):Promise.resolve()}function de(e){let t=De.values().next().value;return t&&typeof t.runWithContext==`function`?t.runWithContext(e):e()}function fe(e,t){let n,[r,i,o]=nt(e,t);n=tt(r.reverse(),`beforeRouteLeave`,e,t);for(let i of r)i.leaveGuards.forEach(r=>{n.push(P(r,e,t))});let c=ue.bind(null,e,t);return n.push(c),M(n).then(()=>{n=[];for(let r of a.list())n.push(P(r,e,t));return n.push(c),M(n)}).then(()=>{n=tt(i,`beforeRouteUpdate`,e,t);for(let r of i)r.updateGuards.forEach(r=>{n.push(P(r,e,t))});return n.push(c),M(n)}).then(()=>{n=[];for(let r of o)if(r.beforeEnter)if(S(r.beforeEnter))for(let i of r.beforeEnter)n.push(P(i,e,t));else n.push(P(r.beforeEnter,e,t));return n.push(c),M(n)}).then(()=>(e.matched.forEach(e=>e.enterCallbacks={}),n=tt(o,`beforeRouteEnter`,e,t,de),n.push(c),M(n))).then(()=>{n=[];for(let r of s.list())n.push(P(r,e,t));return n.push(c),M(n)}).catch(e=>E(e,w.NAVIGATION_CANCELLED)?e:Promise.reject(e))}function pe(e,t,n){l.list().forEach(r=>de(()=>r(e,t,n)))}function me(e,t,n,r,a){let o=oe(e,t);if(o)return o;let s=t===N,c=_?history.state:{};n&&(r||s?i.replace(e.fullPath,b({scroll:s&&c&&c.scroll},a)):i.push(e.fullPath,a)),d.value=e,Se(e,t,n,s),A()}let he;function ge(){he||=i.listen((e,t,n)=>{if(!j.listening)return;let r=ne(e),a=le(r,j.currentRoute.value);if(a){O(b(a,{replace:!0,force:!0}),r).catch(x);return}p=r;let o=d.value;_&&Ge(Ue(o.fullPath,n.delta),Ve()),fe(r,o).catch(e=>E(e,w.NAVIGATION_ABORTED|w.NAVIGATION_CANCELLED)?e:E(e,w.NAVIGATION_GUARD_REDIRECT)?(O(b(D(e.to),{force:!0}),r).then(e=>{E(e,w.NAVIGATION_ABORTED|w.NAVIGATION_DUPLICATED)&&!n.delta&&n.type===Fe.pop&&i.go(-1,!1)}).catch(x),Promise.reject()):(n.delta&&i.go(-n.delta,!1),ye(e,r,o))).then(e=>{e||=me(r,o,!1),e&&(n.delta&&!E(e,w.NAVIGATION_CANCELLED)?i.go(-n.delta,!1):n.type===Fe.pop&&E(e,w.NAVIGATION_ABORTED|w.NAVIGATION_DUPLICATED)&&i.go(-1,!1)),pe(r,o,e)}).catch(x)})}let _e=Qe(),ve=Qe(),k;function ye(e,t,n){A(e);let r=ve.list();return r.length?r.forEach(r=>r(e,t,n)):console.error(e),Promise.reject(e)}function be(){return k&&d.value!==N?Promise.resolve():new Promise((e,t)=>{_e.add([e,t])})}function A(e){return k||(k=!e,ge(),_e.list().forEach(([t,n])=>e?n(e):t()),_e.reset()),e}function Se(t,n,r,i){let{scrollBehavior:a}=e;if(!_||!a)return Promise.resolve();let s=!r&&Ke(Ue(t.fullPath,0))||(i||!r)&&history.state&&history.state.scroll||null;return o().then(()=>a(t,n,s)).then(e=>e&&He(e)).catch(e=>ye(e,t,n))}let Ce=e=>i.go(e),Ee,De=new Set,j={currentRoute:d,listening:!0,addRoute:v,removeRoute:y,clearRoutes:t.clearRoutes,hasRoute:te,getRoutes:C,resolve:ne,options:e,push:se,replace:ce,go:Ce,back:()=>Ce(-1),forward:()=>Ce(1),beforeEach:a.add,beforeResolve:s.add,afterEach:l.add,onError:ve.add,isReady:be,install(e){e.component(`RouterLink`,Mt),e.component(`RouterView`,zt),e.config.globalProperties.$router=j,Object.defineProperty(e.config.globalProperties,`$route`,{enumerable:!0,get:()=>f(d)}),_&&!Ee&&d.value===N&&(Ee=!0,se(i.location).catch(e=>{}));let t={};for(let e in N)Object.defineProperty(t,e,{get:()=>d.value[e],enumerable:!0});e.provide(re,j),e.provide(ie,c(t)),e.provide(ae,d);let n=e.unmount;De.add(e),e.unmount=function(){De.delete(e),De.size<1&&(p=N,he&&he(),he=null,d.value=N,Ee=!1,k=!1),n()}}};function M(e){return e.reduce((e,t)=>e.then(()=>de(t)),Promise.resolve())}return j}function Vt(e,t){return function(){return e.apply(t,arguments)}}var{toString:Ht}=Object.prototype,{getPrototypeOf:Ut}=Object,{iterator:Wt,toStringTag:Gt}=Symbol,Kt=(e=>t=>{let n=Ht.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),R=e=>(e=e.toLowerCase(),t=>Kt(t)===e),qt=e=>t=>typeof t===e,{isArray:z}=Array,B=qt(`undefined`);function Jt(e){return e!==null&&!B(e)&&e.constructor!==null&&!B(e.constructor)&&V(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var Yt=R(`ArrayBuffer`);function Xt(e){let t;return t=typeof ArrayBuffer<`u`&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Yt(e.buffer),t}var Zt=qt(`string`),V=qt(`function`),Qt=qt(`number`),$t=e=>typeof e==`object`&&!!e,en=e=>e===!0||e===!1,tn=e=>{if(Kt(e)!==`object`)return!1;let t=Ut(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Gt in e)&&!(Wt in e)},nn=e=>{if(!$t(e)||Jt(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},rn=R(`Date`),an=R(`File`),on=e=>!!(e&&e.uri!==void 0),sn=e=>e&&e.getParts!==void 0,cn=R(`Blob`),ln=R(`FileList`),un=e=>$t(e)&&V(e.pipe);function dn(){return typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{}}var fn=dn(),pn=fn.FormData===void 0?void 0:fn.FormData,mn=e=>{let t;return e&&(pn&&e instanceof pn||V(e.append)&&((t=Kt(e))===`formdata`||t===`object`&&V(e.toString)&&e.toString()===`[object FormData]`))},hn=R(`URLSearchParams`),[gn,_n,vn,yn]=[`ReadableStream`,`Request`,`Response`,`Headers`].map(R),bn=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,``);function xn(e,t,{allOwnKeys:n=!1}={}){if(e==null)return;let r,i;if(typeof e!=`object`&&(e=[e]),z(e))for(r=0,i=e.length;r0;)if(i=n[r],t===i.toLowerCase())return i;return null}var H=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:global,Cn=e=>!B(e)&&e!==H;function wn(){let{caseless:e,skipUndefined:t}=Cn(this)&&this||{},n={},r=(r,i)=>{if(i===`__proto__`||i===`constructor`||i===`prototype`)return;let a=e&&Sn(n,i)||i;tn(n[a])&&tn(r)?n[a]=wn(n[a],r):tn(r)?n[a]=wn({},r):z(r)?n[a]=r.slice():(!t||!B(r))&&(n[a]=r)};for(let e=0,t=arguments.length;e(xn(t,(t,r)=>{n&&V(t)?Object.defineProperty(e,r,{value:Vt(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),En=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Dn=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,`constructor`,{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,`super`,{value:t.prototype}),n&&Object.assign(e.prototype,n)},On=(e,t,n,r)=>{let i,a,o,s={};if(t||={},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)o=i[a],(!r||r(o,e,t))&&!s[o]&&(t[o]=e[o],s[o]=!0);e=n!==!1&&Ut(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kn=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;let r=e.indexOf(t,n);return r!==-1&&r===n},An=e=>{if(!e)return null;if(z(e))return e;let t=e.length;if(!Qt(t))return null;let n=Array(t);for(;t-- >0;)n[t]=e[t];return n},jn=(e=>t=>e&&t instanceof e)(typeof Uint8Array<`u`&&Ut(Uint8Array)),Mn=(e,t)=>{let n=(e&&e[Wt]).call(e),r;for(;(r=n.next())&&!r.done;){let n=r.value;t.call(e,n[0],n[1])}},Nn=(e,t)=>{let n,r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Pn=R(`HTMLFormElement`),Fn=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),In=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Ln=R(`RegExp`),Rn=(e,t)=>{let n=Object.getOwnPropertyDescriptors(e),r={};xn(n,(n,i)=>{let a;(a=t(n,i,e))!==!1&&(r[i]=a||n)}),Object.defineProperties(e,r)},zn=e=>{Rn(e,(t,n)=>{if(V(e)&&[`arguments`,`caller`,`callee`].indexOf(n)!==-1)return!1;let r=e[n];if(V(r)){if(t.enumerable=!1,`writable`in t){t.writable=!1;return}t.set||=()=>{throw Error(`Can not rewrite read-only method '`+n+`'`)}}})},Bn=(e,t)=>{let n={},r=e=>{e.forEach(e=>{n[e]=!0})};return z(e)?r(e):r(String(e).split(t)),n},Vn=()=>{},Hn=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Un(e){return!!(e&&V(e.append)&&e[Gt]===`FormData`&&e[Wt])}var Wn=e=>{let t=Array(10),n=(e,r)=>{if($t(e)){if(t.indexOf(e)>=0)return;if(Jt(e))return e;if(!(`toJSON`in e)){t[r]=e;let i=z(e)?[]:{};return xn(e,(e,t)=>{let a=n(e,r+1);!B(a)&&(i[t]=a)}),t[r]=void 0,i}}return e};return n(e,0)},Gn=R(`AsyncFunction`),Kn=e=>e&&($t(e)||V(e))&&V(e.then)&&V(e.catch),qn=((e,t)=>e?setImmediate:t?((e,t)=>(H.addEventListener(`message`,({source:n,data:r})=>{n===H&&r===e&&t.length&&t.shift()()},!1),n=>{t.push(n),H.postMessage(e,`*`)}))(`axios@${Math.random()}`,[]):e=>setTimeout(e))(typeof setImmediate==`function`,V(H.postMessage)),U={isArray:z,isArrayBuffer:Yt,isBuffer:Jt,isFormData:mn,isArrayBufferView:Xt,isString:Zt,isNumber:Qt,isBoolean:en,isObject:$t,isPlainObject:tn,isEmptyObject:nn,isReadableStream:gn,isRequest:_n,isResponse:vn,isHeaders:yn,isUndefined:B,isDate:rn,isFile:an,isReactNativeBlob:on,isReactNative:sn,isBlob:cn,isRegExp:Ln,isFunction:V,isStream:un,isURLSearchParams:hn,isTypedArray:jn,isFileList:ln,forEach:xn,merge:wn,extend:Tn,trim:bn,stripBOM:En,inherits:Dn,toFlatObject:On,kindOf:Kt,kindOfTest:R,endsWith:kn,toArray:An,forEachEntry:Mn,matchAll:Nn,isHTMLForm:Pn,hasOwnProperty:In,hasOwnProp:In,reduceDescriptors:Rn,freezeMethods:zn,toObjectSet:Bn,toCamelCase:Fn,noop:Vn,toFiniteNumber:Hn,findKey:Sn,global:H,isContextDefined:Cn,isSpecCompliantForm:Un,toJSONObject:Wn,isAsyncFn:Gn,isThenable:Kn,setImmediate:qn,asap:typeof queueMicrotask<`u`?queueMicrotask.bind(H):typeof process<`u`&&process.nextTick||qn,isIterable:e=>e!=null&&V(e[Wt])},W=class e extends Error{static from(t,n,r,i,a,o){let s=new e(t.message,n||t.code,r,i,a);return s.cause=t,s.name=t.name,t.status!=null&&s.status==null&&(s.status=t.status),o&&Object.assign(s,o),s}constructor(e,t,n,r,i){super(e),Object.defineProperty(this,`message`,{value:e,enumerable:!0,writable:!0,configurable:!0}),this.name=`AxiosError`,this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:U.toJSONObject(this.config),code:this.code,status:this.status}}};W.ERR_BAD_OPTION_VALUE=`ERR_BAD_OPTION_VALUE`,W.ERR_BAD_OPTION=`ERR_BAD_OPTION`,W.ECONNABORTED=`ECONNABORTED`,W.ETIMEDOUT=`ETIMEDOUT`,W.ERR_NETWORK=`ERR_NETWORK`,W.ERR_FR_TOO_MANY_REDIRECTS=`ERR_FR_TOO_MANY_REDIRECTS`,W.ERR_DEPRECATED=`ERR_DEPRECATED`,W.ERR_BAD_RESPONSE=`ERR_BAD_RESPONSE`,W.ERR_BAD_REQUEST=`ERR_BAD_REQUEST`,W.ERR_CANCELED=`ERR_CANCELED`,W.ERR_NOT_SUPPORT=`ERR_NOT_SUPPORT`,W.ERR_INVALID_URL=`ERR_INVALID_URL`;function Jn(e){return U.isPlainObject(e)||U.isArray(e)}function Yn(e){return U.endsWith(e,`[]`)?e.slice(0,-2):e}function Xn(e,t,n){return e?e.concat(t).map(function(e,t){return e=Yn(e),!n&&t?`[`+e+`]`:e}).join(n?`.`:``):t}function Zn(e){return U.isArray(e)&&!e.some(Jn)}var Qn=U.toFlatObject(U,{},null,function(e){return/^is[A-Z]/.test(e)});function $n(e,t,n){if(!U.isObject(e))throw TypeError(`target must be an object`);t||=new FormData,n=U.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!U.isUndefined(t[e])});let r=n.metaTokens,i=n.visitor||l,a=n.dots,o=n.indexes,s=(n.Blob||typeof Blob<`u`&&Blob)&&U.isSpecCompliantForm(t);if(!U.isFunction(i))throw TypeError(`visitor must be a function`);function c(e){if(e===null)return``;if(U.isDate(e))return e.toISOString();if(U.isBoolean(e))return e.toString();if(!s&&U.isBlob(e))throw new W(`Blob is not supported. Use a Buffer instead.`);return U.isArrayBuffer(e)||U.isTypedArray(e)?s&&typeof Blob==`function`?new Blob([e]):Buffer.from(e):e}function l(e,n,i){let s=e;if(U.isReactNative(t)&&U.isReactNativeBlob(e))return t.append(Xn(i,n,a),c(e)),!1;if(e&&!i&&typeof e==`object`){if(U.endsWith(n,`{}`))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(U.isArray(e)&&Zn(e)||(U.isFileList(e)||U.endsWith(n,`[]`))&&(s=U.toArray(e)))return n=Yn(n),s.forEach(function(e,r){!(U.isUndefined(e)||e===null)&&t.append(o===!0?Xn([n],r,a):o===null?n:n+`[]`,c(e))}),!1}return Jn(e)?!0:(t.append(Xn(i,n,a),c(e)),!1)}let u=[],d=Object.assign(Qn,{defaultVisitor:l,convertValue:c,isVisitable:Jn});function f(e,n){if(!U.isUndefined(e)){if(u.indexOf(e)!==-1)throw Error(`Circular reference detected in `+n.join(`.`));u.push(e),U.forEach(e,function(e,r){(!(U.isUndefined(e)||e===null)&&i.call(t,e,U.isString(r)?r.trim():r,n,d))===!0&&f(e,n?n.concat(r):[r])}),u.pop()}}if(!U.isObject(e))throw TypeError(`data must be an object`);return f(e),t}function er(e){let t={"!":`%21`,"'":`%27`,"(":`%28`,")":`%29`,"~":`%7E`,"%20":`+`,"%00":`\0`};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function tr(e,t){this._pairs=[],e&&$n(e,this,t)}var nr=tr.prototype;nr.append=function(e,t){this._pairs.push([e,t])},nr.toString=function(e){let t=e?function(t){return e.call(this,t,er)}:er;return this._pairs.map(function(e){return t(e[0])+`=`+t(e[1])},``).join(`&`)};function rr(e){return encodeURIComponent(e).replace(/%3A/gi,`:`).replace(/%24/g,`$`).replace(/%2C/gi,`,`).replace(/%20/g,`+`)}function ir(e,t,n){if(!t)return e;let r=n&&n.encode||rr,i=U.isFunction(n)?{serialize:n}:n,a=i&&i.serialize,o;if(o=a?a(t,i):U.isURLSearchParams(t)?t.toString():new tr(t,i).toString(r),o){let t=e.indexOf(`#`);t!==-1&&(e=e.slice(0,t)),e+=(e.indexOf(`?`)===-1?`?`:`&`)+o}return e}var ar=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&=[]}forEach(e){U.forEach(this.handlers,function(t){t!==null&&e(t)})}},or={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},sr={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<`u`?URLSearchParams:tr,FormData:typeof FormData<`u`?FormData:null,Blob:typeof Blob<`u`?Blob:null},protocols:[`http`,`https`,`file`,`blob`,`url`,`data`]},cr=e({hasBrowserEnv:()=>lr,hasStandardBrowserEnv:()=>dr,hasStandardBrowserWebWorkerEnv:()=>fr,navigator:()=>ur,origin:()=>pr}),lr=typeof window<`u`&&typeof document<`u`,ur=typeof navigator==`object`&&navigator||void 0,dr=lr&&(!ur||[`ReactNative`,`NativeScript`,`NS`].indexOf(ur.product)<0),fr=typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope&&typeof self.importScripts==`function`,pr=lr&&window.location.href||`http://localhost`,G={...cr,...sr};function mr(e,t){return $n(e,new G.classes.URLSearchParams,{visitor:function(e,t,n,r){return G.isNode&&U.isBuffer(e)?(this.append(t,e.toString(`base64`)),!1):r.defaultVisitor.apply(this,arguments)},...t})}function hr(e){return U.matchAll(/\w+|\[(\w*)]/g,e).map(e=>e[0]===`[]`?``:e[1]||e[0])}function gr(e){let t={},n=Object.keys(e),r,i=n.length,a;for(r=0;r=e.length;return a=!a&&U.isArray(r)?r.length:a,s?(U.hasOwnProp(r,a)?r[a]=[r[a],n]:r[a]=n,!o):((!r[a]||!U.isObject(r[a]))&&(r[a]=[]),t(e,n,r[a],i)&&U.isArray(r[a])&&(r[a]=gr(r[a])),!o)}if(U.isFormData(e)&&U.isFunction(e.entries)){let n={};return U.forEachEntry(e,(e,r)=>{t(hr(e),r,n,0)}),n}return null}function vr(e,t,n){if(U.isString(e))try{return(t||JSON.parse)(e),U.trim(e)}catch(e){if(e.name!==`SyntaxError`)throw e}return(n||JSON.stringify)(e)}var yr={transitional:or,adapter:[`xhr`,`http`,`fetch`],transformRequest:[function(e,t){let n=t.getContentType()||``,r=n.indexOf(`application/json`)>-1,i=U.isObject(e);if(i&&U.isHTMLForm(e)&&(e=new FormData(e)),U.isFormData(e))return r?JSON.stringify(_r(e)):e;if(U.isArrayBuffer(e)||U.isBuffer(e)||U.isStream(e)||U.isFile(e)||U.isBlob(e)||U.isReadableStream(e))return e;if(U.isArrayBufferView(e))return e.buffer;if(U.isURLSearchParams(e))return t.setContentType(`application/x-www-form-urlencoded;charset=utf-8`,!1),e.toString();let a;if(i){if(n.indexOf(`application/x-www-form-urlencoded`)>-1)return mr(e,this.formSerializer).toString();if((a=U.isFileList(e))||n.indexOf(`multipart/form-data`)>-1){let t=this.env&&this.env.FormData;return $n(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||r?(t.setContentType(`application/json`,!1),vr(e)):e}],transformResponse:[function(e){let t=this.transitional||yr.transitional,n=t&&t.forcedJSONParsing,r=this.responseType===`json`;if(U.isResponse(e)||U.isReadableStream(e))return e;if(e&&U.isString(e)&&(n&&!this.responseType||r)){let n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n)throw e.name===`SyntaxError`?W.from(e,W.ERR_BAD_RESPONSE,this,null,this.response):e}}return e}],timeout:0,xsrfCookieName:`XSRF-TOKEN`,xsrfHeaderName:`X-XSRF-TOKEN`,maxContentLength:-1,maxBodyLength:-1,env:{FormData:G.classes.FormData,Blob:G.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:`application/json, text/plain, */*`,"Content-Type":void 0}}};U.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`],e=>{yr.headers[e]={}});var br=U.toObjectSet([`age`,`authorization`,`content-length`,`content-type`,`etag`,`expires`,`from`,`host`,`if-modified-since`,`if-unmodified-since`,`last-modified`,`location`,`max-forwards`,`proxy-authorization`,`referer`,`retry-after`,`user-agent`]),xr=e=>{let t={},n,r,i;return e&&e.split(` -`).forEach(function(e){i=e.indexOf(`:`),n=e.substring(0,i).trim().toLowerCase(),r=e.substring(i+1).trim(),!(!n||t[n]&&br[n])&&(n===`set-cookie`?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+`, `+r:r)}),t},Sr=Symbol(`internals`);function Cr(e){return e&&String(e).trim().toLowerCase()}function wr(e){return e===!1||e==null?e:U.isArray(e)?e.map(wr):String(e).replace(/[\r\n]+$/,``)}function Tr(e){let t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}var Er=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Dr(e,t,n,r,i){if(U.isFunction(r))return r.call(this,t,n);if(i&&(t=n),U.isString(t)){if(U.isString(r))return t.indexOf(r)!==-1;if(U.isRegExp(r))return r.test(t)}}function Or(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function kr(e,t){let n=U.toCamelCase(` `+t);[`get`,`set`,`has`].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,i){return this[r].call(this,t,e,n,i)},configurable:!0})})}var K=class{constructor(e){e&&this.set(e)}set(e,t,n){let r=this;function i(e,t,n){let i=Cr(t);if(!i)throw Error(`header name must be a non-empty string`);let a=U.findKey(r,i);(!a||r[a]===void 0||n===!0||n===void 0&&r[a]!==!1)&&(r[a||t]=wr(e))}let a=(e,t)=>U.forEach(e,(e,n)=>i(e,n,t));if(U.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if(U.isString(e)&&(e=e.trim())&&!Er(e))a(xr(e),t);else if(U.isObject(e)&&U.isIterable(e)){let n={},r,i;for(let t of e){if(!U.isArray(t))throw TypeError(`Object iterator must return a key-value pair`);n[i=t[0]]=(r=n[i])?U.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}a(n,t)}else e!=null&&i(t,e,n);return this}get(e,t){if(e=Cr(e),e){let n=U.findKey(this,e);if(n){let e=this[n];if(!t)return e;if(t===!0)return Tr(e);if(U.isFunction(t))return t.call(this,e,n);if(U.isRegExp(t))return t.exec(e);throw TypeError(`parser must be boolean|regexp|function`)}}}has(e,t){if(e=Cr(e),e){let n=U.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||Dr(this,this[n],n,t)))}return!1}delete(e,t){let n=this,r=!1;function i(e){if(e=Cr(e),e){let i=U.findKey(n,e);i&&(!t||Dr(n,n[i],i,t))&&(delete n[i],r=!0)}}return U.isArray(e)?e.forEach(i):i(e),r}clear(e){let t=Object.keys(this),n=t.length,r=!1;for(;n--;){let i=t[n];(!e||Dr(this,this[i],i,e,!0))&&(delete this[i],r=!0)}return r}normalize(e){let t=this,n={};return U.forEach(this,(r,i)=>{let a=U.findKey(n,i);if(a){t[a]=wr(r),delete t[i];return}let o=e?Or(i):String(i).trim();o!==i&&delete t[i],t[o]=wr(r),n[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return U.forEach(this,(n,r)=>{n!=null&&n!==!1&&(t[r]=e&&U.isArray(n)?n.join(`, `):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+`: `+t).join(` -`)}getSetCookie(){return this.get(`set-cookie`)||[]}get[Symbol.toStringTag](){return`AxiosHeaders`}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){let n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){let t=(this[Sr]=this[Sr]={accessors:{}}).accessors,n=this.prototype;function r(e){let r=Cr(e);t[r]||(kr(n,e),t[r]=!0)}return U.isArray(e)?e.forEach(r):r(e),this}};K.accessor([`Content-Type`,`Content-Length`,`Accept`,`Accept-Encoding`,`User-Agent`,`Authorization`]),U.reduceDescriptors(K.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),U.freezeMethods(K);function Ar(e,t){let n=this||yr,r=t||n,i=K.from(r.headers),a=r.data;return U.forEach(e,function(e){a=e.call(n,a,i.normalize(),t?t.status:void 0)}),i.normalize(),a}function jr(e){return!!(e&&e.__CANCEL__)}var Mr=class extends W{constructor(e,t,n){super(e??`canceled`,W.ERR_CANCELED,t,n),this.name=`CanceledError`,this.__CANCEL__=!0}};function Nr(e,t,n){let r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new W(`Request failed with status code `+n.status,[W.ERR_BAD_REQUEST,W.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Pr(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||``}function Fr(e,t){e||=10;let n=Array(e),r=Array(e),i=0,a=0,o;return t=t===void 0?1e3:t,function(s){let c=Date.now(),l=r[a];o||=c,n[i]=s,r[i]=c;let u=a,d=0;for(;u!==i;)d+=n[u++],u%=e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),c-o{n=r,i=null,a&&=(clearTimeout(a),null),e(...t)};return[(...e)=>{let t=Date.now(),s=t-n;s>=r?o(e,t):(i=e,a||=setTimeout(()=>{a=null,o(i)},r-s))},()=>i&&o(i)]}var Lr=(e,t,n=3)=>{let r=0,i=Fr(50,250);return Ir(n=>{let a=n.loaded,o=n.lengthComputable?n.total:void 0,s=a-r,c=i(s),l=a<=o;r=a,e({loaded:a,total:o,progress:o?a/o:void 0,bytes:s,rate:c||void 0,estimated:c&&o&&l?(o-a)/c:void 0,event:n,lengthComputable:o!=null,[t?`download`:`upload`]:!0})},n)},Rr=(e,t)=>{let n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},zr=e=>(...t)=>U.asap(()=>e(...t)),Br=G.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,G.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(G.origin),G.navigator&&/(msie|trident)/i.test(G.navigator.userAgent)):()=>!0,Vr=G.hasStandardBrowserEnv?{write(e,t,n,r,i,a,o){if(typeof document>`u`)return;let s=[`${e}=${encodeURIComponent(t)}`];U.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),U.isString(r)&&s.push(`path=${r}`),U.isString(i)&&s.push(`domain=${i}`),a===!0&&s.push(`secure`),U.isString(o)&&s.push(`SameSite=${o}`),document.cookie=s.join(`; `)},read(e){if(typeof document>`u`)return null;let t=document.cookie.match(RegExp(`(?:^|; )`+e+`=([^;]*)`));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,``,Date.now()-864e5,`/`)}}:{write(){},read(){return null},remove(){}};function Hr(e){return typeof e==`string`?/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e):!1}function Ur(e,t){return t?e.replace(/\/?\/$/,``)+`/`+t.replace(/^\/+/,``):e}function Wr(e,t,n){let r=!Hr(t);return e&&(r||n==0)?Ur(e,t):t}var Gr=e=>e instanceof K?{...e}:e;function q(e,t){t||={};let n={};function r(e,t,n,r){return U.isPlainObject(e)&&U.isPlainObject(t)?U.merge.call({caseless:r},e,t):U.isPlainObject(t)?U.merge({},t):U.isArray(t)?t.slice():t}function i(e,t,n,i){if(!U.isUndefined(t))return r(e,t,n,i);if(!U.isUndefined(e))return r(void 0,e,n,i)}function a(e,t){if(!U.isUndefined(t))return r(void 0,t)}function o(e,t){if(!U.isUndefined(t))return r(void 0,t);if(!U.isUndefined(e))return r(void 0,e)}function s(n,i,a){if(a in t)return r(n,i);if(a in e)return r(void 0,n)}let c={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:s,headers:(e,t,n)=>i(Gr(e),Gr(t),n,!0)};return U.forEach(Object.keys({...e,...t}),function(r){if(r===`__proto__`||r===`constructor`||r===`prototype`)return;let a=U.hasOwnProp(c,r)?c[r]:i,o=a(e[r],t[r],r);U.isUndefined(o)&&a!==s||(n[r]=o)}),n}var Kr=e=>{let t=q({},e),{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:a,headers:o,auth:s}=t;if(t.headers=o=K.from(o),t.url=ir(Wr(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),s&&o.set(`Authorization`,`Basic `+btoa((s.username||``)+`:`+(s.password?unescape(encodeURIComponent(s.password)):``))),U.isFormData(n)){if(G.hasStandardBrowserEnv||G.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(U.isFunction(n.getHeaders)){let e=n.getHeaders(),t=[`content-type`,`content-length`];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&o.set(e,n)})}}if(G.hasStandardBrowserEnv&&(r&&U.isFunction(r)&&(r=r(t)),r||r!==!1&&Br(t.url))){let e=i&&a&&Vr.read(a);e&&o.set(i,e)}return t},qr=typeof XMLHttpRequest<`u`&&function(e){return new Promise(function(t,n){let r=Kr(e),i=r.data,a=K.from(r.headers).normalize(),{responseType:o,onUploadProgress:s,onDownloadProgress:c}=r,l,u,d,f,p;function m(){f&&f(),p&&p(),r.cancelToken&&r.cancelToken.unsubscribe(l),r.signal&&r.signal.removeEventListener(`abort`,l)}let h=new XMLHttpRequest;h.open(r.method.toUpperCase(),r.url,!0),h.timeout=r.timeout;function g(){if(!h)return;let r=K.from(`getAllResponseHeaders`in h&&h.getAllResponseHeaders());Nr(function(e){t(e),m()},function(e){n(e),m()},{data:!o||o===`text`||o===`json`?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:r,config:e,request:h}),h=null}`onloadend`in h?h.onloadend=g:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf(`file:`)===0)||setTimeout(g)},h.onabort=function(){h&&=(n(new W(`Request aborted`,W.ECONNABORTED,e,h)),null)},h.onerror=function(t){let r=new W(t&&t.message?t.message:`Network Error`,W.ERR_NETWORK,e,h);r.event=t||null,n(r),h=null},h.ontimeout=function(){let t=r.timeout?`timeout of `+r.timeout+`ms exceeded`:`timeout exceeded`,i=r.transitional||or;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new W(t,i.clarifyTimeoutError?W.ETIMEDOUT:W.ECONNABORTED,e,h)),h=null},i===void 0&&a.setContentType(null),`setRequestHeader`in h&&U.forEach(a.toJSON(),function(e,t){h.setRequestHeader(t,e)}),U.isUndefined(r.withCredentials)||(h.withCredentials=!!r.withCredentials),o&&o!==`json`&&(h.responseType=r.responseType),c&&([d,p]=Lr(c,!0),h.addEventListener(`progress`,d)),s&&h.upload&&([u,f]=Lr(s),h.upload.addEventListener(`progress`,u),h.upload.addEventListener(`loadend`,f)),(r.cancelToken||r.signal)&&(l=t=>{h&&=(n(!t||t.type?new Mr(null,e,h):t),h.abort(),null)},r.cancelToken&&r.cancelToken.subscribe(l),r.signal&&(r.signal.aborted?l():r.signal.addEventListener(`abort`,l)));let _=Pr(r.url);if(_&&G.protocols.indexOf(_)===-1){n(new W(`Unsupported protocol `+_+`:`,W.ERR_BAD_REQUEST,e));return}h.send(i||null)})},Jr=(e,t)=>{let{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n=new AbortController,r,i=function(e){if(!r){r=!0,o();let t=e instanceof Error?e:this.reason;n.abort(t instanceof W?t:new Mr(t instanceof Error?t.message:t))}},a=t&&setTimeout(()=>{a=null,i(new W(`timeout of ${t}ms exceeded`,W.ETIMEDOUT))},t),o=()=>{e&&=(a&&clearTimeout(a),a=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener(`abort`,i)}),null)};e.forEach(e=>e.addEventListener(`abort`,i));let{signal:s}=n;return s.unsubscribe=()=>U.asap(o),s}},Yr=function*(e,t){let n=e.byteLength;if(!t||n{let i=Xr(e,t),a=0,o,s=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{let{done:t,value:r}=await i.next();if(t){s(),e.close();return}let o=r.byteLength;n&&n(a+=o),e.enqueue(new Uint8Array(r))}catch(e){throw s(e),e}},cancel(e){return s(e),i.return()}},{highWaterMark:2})},$r=64*1024,{isFunction:ei}=U,ti=(({Request:e,Response:t})=>({Request:e,Response:t}))(U.global),{ReadableStream:ni,TextEncoder:ri}=U.global,ii=(e,...t)=>{try{return!!e(...t)}catch{return!1}},ai=e=>{e=U.merge.call({skipUndefined:!0},ti,e);let{fetch:t,Request:n,Response:r}=e,i=t?ei(t):typeof fetch==`function`,a=ei(n),o=ei(r);if(!i)return!1;let s=i&&ei(ni),c=i&&(typeof ri==`function`?(e=>t=>e.encode(t))(new ri):async e=>new Uint8Array(await new n(e).arrayBuffer())),l=a&&s&&ii(()=>{let e=!1,t=new ni,r=new n(G.origin,{body:t,method:`POST`,get duplex(){return e=!0,`half`}}).headers.has(`Content-Type`);return t.cancel(),e&&!r}),u=o&&s&&ii(()=>U.isReadableStream(new r(``).body)),d={stream:u&&(e=>e.body)};i&&[`text`,`arrayBuffer`,`blob`,`formData`,`stream`].forEach(e=>{!d[e]&&(d[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new W(`Response type '${e}' is not supported`,W.ERR_NOT_SUPPORT,n)})});let f=async e=>{if(e==null)return 0;if(U.isBlob(e))return e.size;if(U.isSpecCompliantForm(e))return(await new n(G.origin,{method:`POST`,body:e}).arrayBuffer()).byteLength;if(U.isArrayBufferView(e)||U.isArrayBuffer(e))return e.byteLength;if(U.isURLSearchParams(e)&&(e+=``),U.isString(e))return(await c(e)).byteLength},p=async(e,t)=>U.toFiniteNumber(e.getContentLength())??f(t);return async e=>{let{url:i,method:o,data:s,signal:c,cancelToken:f,timeout:m,onDownloadProgress:h,onUploadProgress:g,responseType:_,headers:v,withCredentials:y=`same-origin`,fetchOptions:b}=Kr(e),ee=t||fetch;_=_?(_+``).toLowerCase():`text`;let x=Jr([c,f&&f.toAbortSignal()],m),S=null,C=x&&x.unsubscribe&&(()=>{x.unsubscribe()}),w;try{if(g&&l&&o!==`get`&&o!==`head`&&(w=await p(v,s))!==0){let e=new n(i,{method:`POST`,body:s,duplex:`half`}),t;if(U.isFormData(s)&&(t=e.headers.get(`content-type`))&&v.setContentType(t),e.body){let[t,n]=Rr(w,Lr(zr(g)));s=Qr(e.body,$r,t,n)}}U.isString(y)||(y=y?`include`:`omit`);let t=a&&`credentials`in n.prototype,c={...b,signal:x,method:o.toUpperCase(),headers:v.normalize().toJSON(),body:s,duplex:`half`,credentials:t?y:void 0};S=a&&new n(i,c);let f=await(a?ee(S,b):ee(i,c)),m=u&&(_===`stream`||_===`response`);if(u&&(h||m&&C)){let e={};[`status`,`statusText`,`headers`].forEach(t=>{e[t]=f[t]});let t=U.toFiniteNumber(f.headers.get(`content-length`)),[n,i]=h&&Rr(t,Lr(zr(h),!0))||[];f=new r(Qr(f.body,$r,n,()=>{i&&i(),C&&C()}),e)}_||=`text`;let te=await d[U.findKey(d,_)||`text`](f,e);return!m&&C&&C(),await new Promise((t,n)=>{Nr(t,n,{data:te,headers:K.from(f.headers),status:f.status,statusText:f.statusText,config:e,request:S})})}catch(t){throw C&&C(),t&&t.name===`TypeError`&&/Load failed|fetch/i.test(t.message)?Object.assign(new W(`Network Error`,W.ERR_NETWORK,e,S,t&&t.response),{cause:t.cause||t}):W.from(t,t&&t.code,e,S,t&&t.response)}}},oi=new Map,si=e=>{let t=e&&e.env||{},{fetch:n,Request:r,Response:i}=t,a=[r,i,n],o=a.length,s,c,l=oi;for(;o--;)s=a[o],c=l.get(s),c===void 0&&l.set(s,c=o?new Map:ai(t)),l=c;return c};si();var ci={http:null,xhr:qr,fetch:{get:si}};U.forEach(ci,(e,t)=>{if(e){try{Object.defineProperty(e,`name`,{value:t})}catch{}Object.defineProperty(e,`adapterName`,{value:t})}});var li=e=>`- ${e}`,ui=e=>U.isFunction(e)||e===null||e===!1;function di(e,t){e=U.isArray(e)?e:[e];let{length:n}=e,r,i,a={};for(let o=0;o`adapter ${e} `+(t===!1?`is not supported by the environment`:`is not available in the build`));throw new W(`There is no suitable adapter to dispatch the request `+(n?e.length>1?`since : -`+e.map(li).join(` -`):` `+li(e[0]):`as no adapter specified`),`ERR_NOT_SUPPORT`)}return i}var fi={getAdapter:di,adapters:ci};function pi(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Mr(null,e)}function mi(e){return pi(e),e.headers=K.from(e.headers),e.data=Ar.call(e,e.transformRequest),[`post`,`put`,`patch`].indexOf(e.method)!==-1&&e.headers.setContentType(`application/x-www-form-urlencoded`,!1),fi.getAdapter(e.adapter||yr.adapter,e)(e).then(function(t){return pi(e),t.data=Ar.call(e,e.transformResponse,t),t.headers=K.from(t.headers),t},function(t){return jr(t)||(pi(e),t&&t.response&&(t.response.data=Ar.call(e,e.transformResponse,t.response),t.response.headers=K.from(t.response.headers))),Promise.reject(t)})}var hi=`1.14.0`,gi={};[`object`,`boolean`,`number`,`function`,`string`,`symbol`].forEach((e,t)=>{gi[e]=function(n){return typeof n===e||`a`+(t<1?`n `:` `)+e}});var _i={};gi.transitional=function(e,t,n){function r(e,t){return`[Axios v`+hi+`] Transitional option '`+e+`'`+t+(n?`. `+n:``)}return(n,i,a)=>{if(e===!1)throw new W(r(i,` has been removed`+(t?` in `+t:``)),W.ERR_DEPRECATED);return t&&!_i[i]&&(_i[i]=!0,console.warn(r(i,` has been deprecated since v`+t+` and will be removed in the near future`))),e?e(n,i,a):!0}},gi.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function vi(e,t,n){if(typeof e!=`object`)throw new W(`options must be an object`,W.ERR_BAD_OPTION_VALUE);let r=Object.keys(e),i=r.length;for(;i-- >0;){let a=r[i],o=t[a];if(o){let t=e[a],n=t===void 0||o(t,a,e);if(n!==!0)throw new W(`option `+a+` must be `+n,W.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new W(`Unknown option `+a,W.ERR_BAD_OPTION)}}var yi={assertOptions:vi,validators:gi},J=yi.validators,Y=class{constructor(e){this.defaults=e||{},this.interceptors={request:new ar,response:new ar}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=Error();let n=t.stack?t.stack.replace(/^.+\n/,``):``;try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,``))&&(e.stack+=` -`+n):e.stack=n}catch{}}throw e}}_request(e,t){typeof e==`string`?(t||={},t.url=e):t=e||{},t=q(this.defaults,t);let{transitional:n,paramsSerializer:r,headers:i}=t;n!==void 0&&yi.assertOptions(n,{silentJSONParsing:J.transitional(J.boolean),forcedJSONParsing:J.transitional(J.boolean),clarifyTimeoutError:J.transitional(J.boolean),legacyInterceptorReqResOrdering:J.transitional(J.boolean)},!1),r!=null&&(U.isFunction(r)?t.paramsSerializer={serialize:r}:yi.assertOptions(r,{encode:J.function,serialize:J.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls===void 0?t.allowAbsoluteUrls=!0:t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls),yi.assertOptions(t,{baseUrl:J.spelling(`baseURL`),withXsrfToken:J.spelling(`withXSRFToken`)},!0),t.method=(t.method||this.defaults.method||`get`).toLowerCase();let a=i&&U.merge(i.common,i[t.method]);i&&U.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`common`],e=>{delete i[e]}),t.headers=K.concat(a,i);let o=[],s=!0;this.interceptors.request.forEach(function(e){if(typeof e.runWhen==`function`&&e.runWhen(t)===!1)return;s&&=e.synchronous;let n=t.transitional||or;n&&n.legacyInterceptorReqResOrdering?o.unshift(e.fulfilled,e.rejected):o.push(e.fulfilled,e.rejected)});let c=[];this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,u=0,d;if(!s){let e=[mi.bind(this),void 0];for(e.unshift(...o),e.push(...c),d=e.length,l=Promise.resolve(t);u{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t,r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,i){n.reason||(n.reason=new Mr(e,r,i),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}};function xi(e){return function(t){return e.apply(null,t)}}function Si(e){return U.isObject(e)&&e.isAxiosError===!0}var Ci={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ci).forEach(([e,t])=>{Ci[t]=e});function wi(e){let t=new Y(e),n=Vt(Y.prototype.request,t);return U.extend(n,Y.prototype,t,{allOwnKeys:!0}),U.extend(n,t,null,{allOwnKeys:!0}),n.create=function(t){return wi(q(e,t))},n}var X=wi(yr);X.Axios=Y,X.CanceledError=Mr,X.CancelToken=bi,X.isCancel=jr,X.VERSION=hi,X.toFormData=$n,X.AxiosError=W,X.Cancel=X.CanceledError,X.all=function(e){return Promise.all(e)},X.spread=xi,X.isAxiosError=Si,X.mergeConfig=q,X.AxiosHeaders=K,X.formToJSON=e=>_r(U.isHTMLForm(e)?new FormData(e):e),X.getAdapter=fi.getAdapter,X.HttpStatusCode=Ci,X.default=X;var Ti=`pymc_jwt_token`,Ei=`pymc_client_id`;function Di(){let e=localStorage.getItem(Ei);return e||(e=`${Date.now()}-${Math.random().toString(36).substring(2,15)}`,localStorage.setItem(Ei,e)),e}function Z(){return localStorage.getItem(Ti)}function Oi(e){localStorage.setItem(Ti,e)}function ki(){localStorage.removeItem(Ti)}function Ai(){return Z()!==null}function ji(e){try{let t=e.split(`.`)[1].replace(/-/g,`+`).replace(/_/g,`/`),n=decodeURIComponent(atob(t).split(``).map(e=>`%`+(`00`+e.charCodeAt(0).toString(16)).slice(-2)).join(``));return JSON.parse(n)}catch{return null}}function Mi(){let e=Z();if(!e)return!0;let t=ji(e);return!t||!t.exp?!0:Date.now()>=t.exp*1e3-3e4}function Ni(){let e=Z();if(!e)return!1;let t=ji(e);if(!t||!t.exp)return!1;let n=t.exp*1e3-Date.now();return n>0&&n<3e5}function Pi(){let e=Z();if(!e)return null;let t=ji(e);return!t||!t.sub?null:t.sub}var Fi=`modulepreload`,Ii=function(e){return`/`+e},Li={},Q=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=Ii(t,n),t in Li)return;Li[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Fi,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Ri=Bt({history:ct(`/`),routes:[{path:`/setup`,name:`setup`,component:()=>Q(()=>import(`./Setup-CySN3SxS.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])),meta:{requiresAuth:!1,requiresSetup:!1}},{path:`/login`,name:`login`,component:()=>Q(()=>import(`./Login-BS0KJmAp.js`),__vite__mapDeps([13,1,2,3,4,5,6,7,8,9,10,11,14])),meta:{requiresAuth:!1}},{path:`/`,name:`dashboard`,component:()=>Q(()=>import(`./Dashboard-Cl9vIX2c.js`),__vite__mapDeps([15,1,2,3,4,5,6,7,8,9,10,11,16,17,18,19])),meta:{requiresAuth:!0}},{path:`/neighbors`,name:`neighbors`,component:()=>Q(()=>import(`./Neighbors-n_lvMCc7.js`),__vite__mapDeps([20,1,21,2,3,4,5,6,7,8,9,10,11,22,17,23,18,24,25])),meta:{requiresAuth:!0}},{path:`/statistics`,name:`statistics`,component:()=>Q(()=>import(`./Statistics-Ca2RklrO.js`),__vite__mapDeps([26,2,1,3,4,5,6,7,8,9,10,11,16,27,28])),meta:{requiresAuth:!0}},{path:`/gps`,name:`gps-diagnostics`,component:()=>Q(()=>import(`./GPSDiagnostics-puRIblTp.js`),__vite__mapDeps([29,1,2,3,4,5,6,7,8,9,10,11,30])),meta:{requiresAuth:!0}},{path:`/system-stats`,name:`system-stats`,component:()=>Q(()=>import(`./SystemStats-ChbjEAGq.js`),__vite__mapDeps([31,1,21,2,3,4,5,6,7,8,9,10,11,16,27,28,23,32])),meta:{requiresAuth:!0}},{path:`/sensors`,name:`sensors`,component:()=>Q(()=>import(`./Sensors-DSOTF01P.js`),__vite__mapDeps([33,2,1,3,4,5,6,7,8,9,10,11])),meta:{requiresAuth:!0}},{path:`/configuration`,name:`configuration`,component:()=>Q(()=>import(`./Configuration-D5-XdhcR.js`),__vite__mapDeps([34,1,2,3,4,5,6,7,8,9,10,11,35,36,21,37,25,38,23,18,39])),meta:{requiresAuth:!0}},{path:`/cad-calibration`,name:`cad-calibration`,component:()=>Q(()=>import(`./CADCalibration-nHiYlOIH.js`),__vite__mapDeps([40,1,21,3,41,38,2,4,5,6,7,8,9,10,11,42])),meta:{requiresAuth:!0}},{path:`/sessions`,name:`sessions`,component:()=>Q(()=>import(`./Sessions-CTrtKCPc.js`),__vite__mapDeps([43,2,1,3,4,5,6,7,8,9,10,11])),meta:{requiresAuth:!0}},{path:`/room-servers`,name:`room-servers`,component:()=>Q(()=>import(`./RoomServers-CzQh-0n_.js`),__vite__mapDeps([44,2,1,3,4,5,6,7,8,9,10,11,35,36,21,37,25,45,38,18])),meta:{requiresAuth:!0}},{path:`/companions`,name:`companions`,component:()=>Q(()=>import(`./Companions-DMtu-VdK.js`),__vite__mapDeps([46,2,1,3,4,5,6,7,8,9,10,11,35,45,38])),meta:{requiresAuth:!0}},{path:`/logs`,name:`logs`,component:()=>Q(()=>import(`./Logs-BZIqxYO-.js`),__vite__mapDeps([47,3,5])),meta:{requiresAuth:!0}},{path:`/terminal`,name:`terminal`,component:()=>Q(()=>import(`./Terminal-BVrSGxOT.js`),__vite__mapDeps([48,1,2,3,4,5,6,7,8,9,10,11,49])),meta:{requiresAuth:!0}},{path:`/help`,name:`help`,component:()=>Q(()=>import(`./Help-BXmxmm0K.js`),__vite__mapDeps([50,3])),meta:{requiresAuth:!0}}]}),zi=!1;async function Bi(){if(zi)return!1;try{let e=await fetch(`/api/needs_setup`,{headers:{Accept:`application/json`}});if(!e.ok)return console.error(`Setup check failed:`,e.status),!1;let t=(await e.json()).needs_setup===!0;return t||(zi=!0),t}catch(e){return console.error(`Error checking setup status:`,e),!1}}Ri.beforeEach(async e=>{let t=e.meta.requiresAuth!==!1,n=Ai();if(e.path!==`/setup`&&await Bi())return`/setup`;if(e.path===`/setup`&&!await Bi()||t&&!n)return`/login`;if(e.path===`/login`&&n)return`/`});var Vi=g(`appRuntime`,()=>{let e=l(typeof navigator>`u`?!0:navigator.onLine),t=l(typeof document>`u`?!0:document.visibilityState===`visible`),n=l(!1),r=l(null),i=l(!1),a=p(()=>e.value&&t.value&&n.value&&!i.value);function o(){n.value=!!Z()&&!Mi(),n.value||(r.value=r.value??`expired`)}function s(){n.value=!0,r.value=null,i.value=!1}function c(t){e.value=t}function u(e){t.value=e}async function d(e){if(i.value)return;i.value=!0,r.value=e,n.value=!1;let{useWebSocketStore:t}=await Q(async()=>{let{useWebSocketStore:e}=await import(`./websocket-Dktgus76.js`);return{useWebSocketStore:e}},__vite__mapDeps([51,10,3,4,7,8,9])),{usePacketStore:a}=await Q(async()=>{let{usePacketStore:e}=await import(`./packets-DMWLbcpU.js`);return{usePacketStore:e}},__vite__mapDeps([52,8,3,4])),{useSystemStore:o}=await Q(async()=>{let{useSystemStore:e}=await import(`./system-Dqa4NhwB.js`);return{useSystemStore:e}},__vite__mapDeps([53,9,3,4,8])),s=t(),c=a(),l=o();s.disconnect({preventReconnect:!0,silent:e!==`logout`}),c.reset(),l.reset(),ki(),Ri.currentRoute.value.path!==`/login`&&await Ri.push(`/login`),i.value=!1}async function f(e){await d(e)}return{isOnline:e,isDocumentVisible:t,isAuthenticated:n,authFailureReason:r,canMaintainConnections:a,syncAuthState:o,markAuthenticated:s,setOnline:c,setDocumentVisible:u,stopSession:d,handleAuthFailure:f}}),Hi=`/api`,Ui=!1,Wi=null;async function Gi(){return Ui&&Wi?Wi:(Ui=!0,Wi=(async()=>{try{let e=Z();if(!e)throw Error(`No token to refresh`);let t=Di(),n=await X.post(`/auth/refresh`,{client_id:t},{headers:{Authorization:`Bearer ${e}`,"Content-Type":`application/json`}});if(n.data.success&&n.data.token){let e=n.data.token;return Oi(e),e}else throw Error(`Token refresh failed`)}catch(e){throw console.error(`Token refresh error:`,e),await Vi().handleAuthFailure(`expired`),e}finally{Ui=!1,Wi=null}})(),Wi)}var $=X.create({baseURL:Hi,timeout:1e4,headers:{"Content-Type":`application/json`}}),Ki=X.create({baseURL:``,timeout:1e4,headers:{"Content-Type":`application/json`}});Ki.interceptors.request.use(async e=>{if(e.url?.includes(`/auth/login`)||e.url?.includes(`/auth/refresh`))return e;let t=Z();if(t){if(Ni())try{let t=await Gi();return e.headers.Authorization=`Bearer ${t}`,e}catch(e){return Promise.reject(e)}if(Mi())return Vi().handleAuthFailure(`expired`),Promise.reject(Error(`Token expired`));e.headers.Authorization=`Bearer ${t}`}return e},e=>(console.error(`Auth API Request Error:`,e),Promise.reject(e))),Ki.interceptors.response.use(e=>e,e=>((e.response?.status===401||e.response?.status===403)&&Vi().handleAuthFailure(e.response?.status===403?`forbidden`:`unauthorized`),console.error(`Auth API Response Error:`,e.response?.data||e.message),Promise.reject(e))),$.interceptors.request.use(async e=>{if(e.url?.includes(`/auth/login`))return e;let t=Z();if(t){if(Ni())try{let t=await Gi();return e.headers.Authorization=`Bearer ${t}`,e}catch(e){return Promise.reject(e)}if(Mi())return Vi().handleAuthFailure(`expired`),Promise.reject(Error(`Token expired`));e.headers.Authorization=`Bearer ${t}`}return e},e=>(console.error(`API Request Error:`,e),Promise.reject(e))),$.interceptors.response.use(e=>e,e=>((e.response?.status===401||e.response?.status===403)&&Vi().handleAuthFailure(e.response?.status===403?`forbidden`:`unauthorized`),console.error(`API Response Error:`,e.response?.data||e.message),Promise.reject(e)));var qi=class{static async get(e,t,n){try{return(await $.get(e,{params:t,...n})).data}catch(e){throw this.handleError(e)}}static async post(e,t,n){try{return(await $.post(e,t,n)).data}catch(e){throw this.handleError(e)}}static async put(e,t,n){try{return(await $.put(e,t,n)).data}catch(e){throw this.handleError(e)}}static async delete(e,t){try{return(await $.delete(e,t)).data}catch(e){throw this.handleError(e)}}static async getTransportKeys(){return this.get(`transport_keys`)}static async sendAdvert(){return this.post(`send_advert`,{},{headers:{"Content-Type":`application/json`}})}static async getGpsDiagnostics(){return this.get(`gps`)}static async createTransportKey(e,t,n,r,i){let a={name:e,flood_policy:t,parent_id:r,last_used:i};return n!==void 0&&(a.transport_key=n),this.post(`transport_keys`,a)}static async getTransportKey(e){return this.get(`transport_key/${e}`)}static async updateTransportKey(e,t,n,r,i,a){return this.put(`transport_key/${e}`,{name:t,flood_policy:n,transport_key:r,parent_id:i,last_used:a})}static async deleteTransportKey(e){return this.delete(`transport_key/${e}`)}static async updateUnscopedFloodPolicy(e){return this.post(`unscoped_flood_policy`,{unscoped_flood_allow:e})}static async getLogs(){try{return(await $.get(`logs`)).data}catch(e){throw this.handleError(e)}}static async deleteAdvert(e){return this.delete(`advert/${e}`)}static async pingNeighbor(e,t=10){return this.post(`ping_neighbor`,{target_id:e,timeout:t})}static async getIdentities(){return this.get(`identities`)}static async getIdentity(e){return this.get(`identity`,{name:e})}static async createIdentity(e){return this.post(`create_identity`,e)}static async updateIdentity(e){return this.put(`update_identity`,e)}static async deleteIdentity(e,t=`room_server`){let n=new URLSearchParams({name:e});return t===`companion`&&n.set(`type`,`companion`),this.delete(`delete_identity?${n.toString()}`)}static async sendRoomServerAdvert(e){return this.post(`send_room_server_advert`,{name:e})}static async importRepeaterContacts(e){return this.post(`companion/import_repeater_contacts`,e)}static async getACLInfo(){return this.get(`acl_info`)}static async getACLClients(e){return this.get(`acl_clients`,e)}static async removeACLClient(e){return this.post(`acl_remove_client`,e)}static async getACLStats(){return this.get(`acl_stats`)}static async getRoomMessages(e){return this.get(`room_messages`,e)}static async postRoomMessage(e){return this.post(`room_post_message`,e)}static async deleteRoomMessage(e){return this.delete(`room_message?room_name=${encodeURIComponent(e.room_name)}&message_id=${e.message_id}`)}static async clearRoomMessages(e){return this.delete(`room_messages?room_name=${encodeURIComponent(e)}`)}static async getRoomStats(e){return this.get(`room_stats`,e?{room_name:e}:void 0)}static async getRoomClients(e){return this.get(`room_clients`,{room_name:e})}static async exportConfig(e=!1){let t=e?`config_export?include_secrets=true`:`config_export`;return this.get(t)}static async importConfig(e){return this.post(`config_import`,{config:e})}static async exportIdentityKey(){return this.get(`identity_export`)}static async generateVanityKey(e,t=!1){return this.post(`generate_vanity_key`,{prefix:e,apply:t})}static async getDbStats(){return this.get(`db_stats`)}static async purgeTable(e){return this.post(`db_purge`,{tables:e})}static async vacuumDb(){return this.post(`db_vacuum`,{})}static handleError(e){if(X.isAxiosError(e)){if(e.response){let t=e.response.data?.error||e.response.data?.message||`HTTP ${e.response.status}`;return Error(t)}else if(e.request)return Error(`Network error - no response received`)}return Error(e instanceof Error?e.message:`Unknown error occurred`)}};export{Ri as a,Di as c,Ai as d,Mi as f,oe as g,se as h,Vi as i,Z as l,et as m,$ as n,Q as o,Oi as p,Ki as r,ki as s,qi as t,Pi as u}; \ No newline at end of file diff --git a/repeater/web/html/assets/chartjs-adapter-date-fns.esm-CzgOsHIF.js b/repeater/web/html/assets/chartjs-adapter-date-fns.esm-NizYWXHk.js similarity index 99% rename from repeater/web/html/assets/chartjs-adapter-date-fns.esm-CzgOsHIF.js rename to repeater/web/html/assets/chartjs-adapter-date-fns.esm-NizYWXHk.js index 2d67d76..a50924c 100644 --- a/repeater/web/html/assets/chartjs-adapter-date-fns.esm-CzgOsHIF.js +++ b/repeater/web/html/assets/chartjs-adapter-date-fns.esm-NizYWXHk.js @@ -1 +1 @@ -import{Ct as e,St as t,c as n,g as r,k as i,l as a,m as o,o as s,p as c,r as l,s as u,u as d}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{t as f}from"./_plugin-vue_export-helper-TcpyXLsZ.js";import{t as p}from"./Spinner-CYvUNW0P.js";import{h as m}from"./ChartCard-CzDm8sMP.js";var h={class:`sparkline-card`},ee={class:`card-header`},te={class:`card-title`},ne={class:`card-subtitle`},re={key:0,class:`card-chart`},ie={key:0,class:`chart-loader`},ae={key:1,class:`chart-error`},oe={key:2,class:`chart-text`},se={class:`percent-value`},ce=[`id`,`viewBox`],le=[`d`,`fill`],ue=[`d`,`stroke`],g=100,_=40,de=f(r({name:`SparklineChart`,__name:`Sparkline`,props:{title:{},value:{},color:{},data:{default:()=>[]},showChart:{type:Boolean,default:!0},variant:{default:`smooth`},loading:{type:Boolean,default:!1},error:{default:null},centerText:{default:``},subtitle:{default:``},minY:{default:void 0},maxY:{default:void 0}},emits:[`retry`],setup(r,{emit:f}){let m=r,de=f,fe=e=>{if(e.length<3)return e;let t=Math.min(15,Math.max(3,Math.floor(e.length*.2))),n=[];for(let r=0;re+t,0)/s.length)}let r=Math.min(10,n.length),i=n.length/r,a=[];for(let e=0;e!m.data||m.data.length===0?[]:m.variant===`smooth`?fe(m.data):m.data),pe=e=>{if(e.length<2)return``;let t=m.maxY??Math.max(...e),n=m.minY??Math.min(...e),r=t-n||1,i=m.variant===`classic`?4:2,a=``;return e.forEach((t,o)=>{let s=o/(e.length-1)*g,c=(t-n)/r,l=i+(_-i*2)*(1-c);if(o===0)a+=`M ${s.toFixed(2)} ${l.toFixed(2)}`;else{let t=((o-1)/(e.length-1)*g+s)/2;a+=` Q ${t.toFixed(2)} ${l.toFixed(2)} ${s.toFixed(2)} ${l.toFixed(2)}`}}),a},y=s(()=>pe(v.value)),b=s(()=>y.value?`${y.value} L ${g} ${_} L 0 ${_} Z`:``),me=s(()=>`sparkline-${m.title.replace(/\s+/g,`-`).toLowerCase()}`);return(s,f)=>(i(),d(`div`,h,[u(`div`,ee,[u(`div`,null,[u(`p`,te,e(r.title),1),u(`p`,ne,e(r.subtitle),1)]),u(`span`,{class:`card-value`,style:t({color:r.color})},[r.loading?(i(),n(p,{key:0,size:`sm`,color:`current`})):(i(),d(l,{key:1},[c(e(typeof r.value==`number`?r.value.toLocaleString():r.value),1)],64))],4)]),r.showChart?(i(),d(`div`,re,[r.loading&&r.variant===`classic`?(i(),d(`div`,ie,[o(p,{size:`sm`})])):r.error?(i(),d(`div`,ae,[u(`button`,{class:`chart-retry-btn`,onClick:f[0]||=e=>de(`retry`)},`↺ Retry`)])):r.centerText?(i(),d(`div`,oe,[u(`span`,se,e(r.centerText),1)])):(i(),d(`svg`,{key:3,id:me.value,class:`chart-svg`,viewBox:`0 0 ${g} ${_}`,preserveAspectRatio:`none`},[r.variant===`classic`?(i(),d(l,{key:0},[v.value.length>1?(i(),d(`path`,{key:0,d:b.value,fill:r.color,"fill-opacity":`0.8`,class:`sparkline-path`},null,8,le)):a(``,!0)],64)):(i(),d(l,{key:1},[v.value.length>1?(i(),d(`path`,{key:0,d:y.value,stroke:r.color,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`,fill:`none`,class:`sparkline-path`},null,8,ue)):a(``,!0)],64))],8,ce))])):a(``,!0)]))}}),[[`__scopeId`,`data-v-902d5054`]]),fe=365.2425,v=6048e5,pe=864e5,y=6e4,b=36e5,me=1e3,he=3600*24;he*7,he*fe/12*3;var ge=Symbol.for(`constructDateFrom`);function x(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&ge in e?e[ge](t):e instanceof Date?new e.constructor(t):new Date(t)}function S(e,t){return x(t||e,e)}function C(e,t,n){let r=S(e,n?.in);return isNaN(t)?x(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}function w(e,t,n){let r=S(e,n?.in);if(isNaN(t))return x(n?.in||e,NaN);if(!t)return r;let i=r.getDate(),a=x(n?.in||e,r.getTime());return a.setMonth(r.getMonth()+t+1,0),i>=a.getDate()?a:(r.setFullYear(a.getFullYear(),a.getMonth(),i),r)}function T(e,t,n){return x(n?.in||e,+S(e)+t)}function _e(e,t,n){return T(e,t*b,n)}var ve={};function E(){return ve}function D(e,t){let n=E(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=S(e,t?.in),a=i.getDay(),o=(a=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function k(e){let t=S(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function A(e,...t){let n=x.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function j(e,t){let n=S(e,t?.in);return n.setHours(0,0,0,0),n}function be(e,t,n){let[r,i]=A(n?.in,e,t),a=j(r),o=j(i),s=+a-k(a),c=+o-k(o);return Math.round((s-c)/pe)}function xe(e,t){let n=ye(e,t),r=x(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),O(r)}function Se(e,t,n){let r=S(e,n?.in);return r.setTime(r.getTime()+t*y),r}function Ce(e,t,n){return w(e,t*3,n)}function we(e,t,n){return T(e,t*1e3,n)}function Te(e,t,n){return C(e,t*7,n)}function Ee(e,t,n){return w(e,t*12,n)}function M(e,t){let n=S(e)-+S(t);return n<0?-1:n>0?1:n}function De(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function Oe(e){return!(!De(e)&&typeof e!=`number`||isNaN(+S(e)))}function ke(e,t,n){let[r,i]=A(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function Ae(e,t,n){let[r,i]=A(n?.in,e,t);return r.getFullYear()-i.getFullYear()}function je(e,t,n){let[r,i]=A(n?.in,e,t),a=Me(r,i),o=Math.abs(be(r,i));r.setDate(r.getDate()-a*o);let s=a*(o-Number(Me(r,i)===-a));return s===0?0:s}function Me(e,t){let n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function N(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function Ne(e,t,n){let[r,i]=A(n?.in,e,t),a=(r-+i)/b;return N(n?.roundingMethod)(a)}function P(e,t){return S(e)-+S(t)}function Pe(e,t,n){let r=P(e,t)/y;return N(n?.roundingMethod)(r)}function Fe(e,t){let n=S(e,t?.in);return n.setHours(23,59,59,999),n}function Ie(e,t){let n=S(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function Le(e,t){let n=S(e,t?.in);return+Fe(n,t)==+Ie(n,t)}function Re(e,t,n){let[r,i,a]=A(n?.in,e,e,t),o=M(i,a),s=Math.abs(ke(i,a));if(s<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-o*s);let c=M(i,a)===-o;Le(r)&&s===1&&M(r,a)===1&&(c=!1);let l=o*(s-+c);return l===0?0:l}function ze(e,t,n){let r=Re(e,t,n)/3;return N(n?.roundingMethod)(r)}function Be(e,t,n){let r=P(e,t)/1e3;return N(n?.roundingMethod)(r)}function Ve(e,t,n){let r=je(e,t,n)/7;return N(n?.roundingMethod)(r)}function He(e,t,n){let[r,i]=A(n?.in,e,t),a=M(r,i),o=Math.abs(Ae(r,i));r.setFullYear(1584),i.setFullYear(1584);let s=a*(o-+(M(r,i)===-a));return s===0?0:s}function Ue(e,t){let n=S(e,t?.in),r=n.getMonth(),i=r-r%3;return n.setMonth(i,1),n.setHours(0,0,0,0),n}function We(e,t){let n=S(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Ge(e,t){let n=S(e,t?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function Ke(e,t){let n=S(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function qe(e,t){let n=S(e,t?.in);return n.setMinutes(59,59,999),n}function Je(e,t){let n=E(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=S(e,t?.in),a=i.getDay(),o=(a{let r,i=Qe[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function F(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var et={date:F({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:F({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:F({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},tt={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},nt=(e,t,n,r)=>tt[e];function I(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var rt={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:I({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:I({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:I({values:{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`]},defaultWidth:`wide`}),day:I({values:{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`]},defaultWidth:`wide`}),dayPeriod:I({values:{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`}},defaultWidth:`wide`,formattingValues:{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`}},defaultFormattingWidth:`wide`})};function L(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?at(s,e=>e.test(o)):it(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function it(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function at(e,t){for(let n=0;n{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var st={code:`en-US`,formatDistance:$e,formatLong:et,formatRelative:nt,localize:rt,match:{ordinalNumber:ot({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:L({matchPatterns:{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},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:L({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:L({matchPatterns:{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},defaultMatchWidth:`wide`,parsePatterns:{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]},defaultParseWidth:`any`}),day:L({matchPatterns:{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},defaultMatchWidth:`wide`,parsePatterns:{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]},defaultParseWidth:`any`}),dayPeriod:L({matchPatterns:{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},defaultMatchWidth:`any`,parsePatterns:{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}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function ct(e,t){let n=S(e,t?.in);return be(n,Ke(n))+1}function lt(e,t){let n=S(e,t?.in),r=O(n)-+xe(n);return Math.round(r/v)+1}function R(e,t){let n=S(e,t?.in),r=n.getFullYear(),i=E(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=x(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=D(o,t),c=x(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=D(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function ut(e,t){let n=E(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=R(e,t),a=x(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),D(a,t)}function dt(e,t){let n=S(e,t?.in),r=D(n,t)-+ut(n,t);return Math.round(r/v)+1}function z(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var B={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return z(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):z(n+1,2)},d(e,t){return z(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return z(e.getHours()%12||12,t.length)},H(e,t){return z(e.getHours(),t.length)},m(e,t){return z(e.getMinutes(),t.length)},s(e,t){return z(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return z(Math.trunc(r*10**(n-3)),t.length)}},V={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},ft={G:function(e,t,n){let r=e.getFullYear()>0?1:0;switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return B.y(e,t)},Y:function(e,t,n,r){let i=R(e,r),a=i>0?i:1-i;return t===`YY`?z(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):z(a,t.length)},R:function(e,t){return z(ye(e),t.length)},u:function(e,t){return z(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return z(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return z(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return B.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return z(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=dt(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):z(i,t.length)},I:function(e,t,n){let r=lt(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):z(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):B.d(e,t)},D:function(e,t,n){let r=ct(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):z(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return z(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return z(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return z(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?V.noon:r===0?V.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?V.evening:r>=12?V.afternoon:r>=4?V.morning:V.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return B.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):B.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):z(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):z(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):B.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):B.s(e,t)},S:function(e,t){return B.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return mt(r);case`XXXX`:case`XX`:return H(r);default:return H(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return mt(r);case`xxxx`:case`xx`:return H(r);default:return H(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+pt(r,`:`);default:return`GMT`+H(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+pt(r,`:`);default:return`GMT`+H(r,`:`)}},t:function(e,t,n){return z(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return z(+e,t.length)}};function pt(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+z(a,2)}function mt(e,t){return e%60==0?(e>0?`-`:`+`)+z(Math.abs(e)/60,2):H(e,t)}function H(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=z(Math.trunc(r/60),2),a=z(r%60,2);return n+i+t+a}var ht=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},gt=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},U={p:gt,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return ht(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,ht(r,t)).replace(`{{time}}`,gt(i,t))}},_t=/^D+$/,vt=/^Y+$/,yt=[`D`,`DD`,`YY`,`YYYY`];function bt(e){return _t.test(e)}function xt(e){return vt.test(e)}function W(e,t,n){let r=St(e,t,n);if(console.warn(r),yt.includes(e))throw RangeError(r)}function St(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var Ct=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,wt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Tt=/^'([^]*?)'?$/,Et=/''/g,Dt=/[a-zA-Z]/;function Ot(e,t,n){let r=E(),i=n?.locale??r.locale??st,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=S(e,n?.in);if(!Oe(s))throw RangeError(`Invalid time value`);let c=t.match(wt).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=U[t];return n(e,i.formatLong)}return e}).join(``).match(Ct).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:kt(e)};if(ft[t])return{isToken:!0,value:e};if(t.match(Dt))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&xt(a)||!n?.useAdditionalDayOfYearTokens&&bt(a))&&W(a,t,String(e));let o=ft[a[0]];return o(s,a,i.localize,l)}).join(``)}function kt(e){let t=e.match(Tt);return t?t[1].replace(Et,`'`):e}function At(){return Object.assign({},E())}function jt(e,t){let n=S(e,t?.in).getDay();return n===0?7:n}function Mt(e,t){let n=Nt(t)?new t(0):x(t,0);return n.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),n.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n}function Nt(e){return typeof e==`function`&&e.prototype?.constructor===e}var Pt=10,Ft=class{subPriority=0;validate(e,t){return!0}},It=class extends Ft{constructor(e,t,n,r,i){super(),this.value=e,this.validateValue=t,this.setValue=n,this.priority=r,i&&(this.subPriority=i)}validate(e,t){return this.validateValue(e,this.value,t)}set(e,t,n){return this.setValue(e,t,this.value,n)}},Lt=class extends Ft{priority=Pt;subPriority=-1;constructor(e,t){super(),this.context=e||(e=>x(t,e))}set(e,t){return t.timestampIsSet?e:x(e,Mt(e,this.context))}},G=class{run(e,t,n,r){let i=this.parse(e,t,n,r);return i?{setter:new It(i.value,this.validate,this.set,this.priority,this.subPriority),rest:i.rest}:null}validate(e,t,n){return!0}},Rt=class extends G{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`});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`]},K={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}/},q={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 J(e,t){return e&&{value:t(e.value),rest:e.rest}}function Y(e,t){let n=t.match(e);return n?{value:parseInt(n[0],10),rest:t.slice(n[0].length)}:null}function X(e,t){let n=t.match(e);if(!n)return null;if(n[0]===`Z`)return{value:0,rest:t.slice(1)};let r=n[1]===`+`?1:-1,i=n[2]?parseInt(n[2],10):0,a=n[3]?parseInt(n[3],10):0,o=n[5]?parseInt(n[5],10):0;return{value:r*(i*b+a*y+o*me),rest:t.slice(n[0].length)}}function zt(e){return Y(K.anyDigitsSigned,e)}function Z(e,t){switch(e){case 1:return Y(K.singleDigit,t);case 2:return Y(K.twoDigits,t);case 3:return Y(K.threeDigits,t);case 4:return Y(K.fourDigits,t);default:return Y(RegExp(`^\\d{1,`+e+`}`),t)}}function Bt(e,t){switch(e){case 1:return Y(K.singleDigitSigned,t);case 2:return Y(K.twoDigitsSigned,t);case 3:return Y(K.threeDigitsSigned,t);case 4:return Y(K.fourDigitsSigned,t);default:return Y(RegExp(`^-?\\d{1,`+e+`}`),t)}}function Vt(e){switch(e){case`morning`:return 4;case`evening`:return 17;case`pm`:case`noon`:case`afternoon`:return 12;default:return 0}}function Ht(e,t){let n=t>0,r=n?t:1-t,i;if(r<=50)i=e||100;else{let t=r+50,n=Math.trunc(t/100)*100,a=e>=t%100;i=e+n-(a?100:0)}return n?i:1-i}function Ut(e){return e%400==0||e%4==0&&e%100!=0}var Wt=class extends G{priority=130;incompatibleTokens=[`Y`,`R`,`u`,`w`,`I`,`i`,`e`,`c`,`t`,`T`];parse(e,t,n){let r=e=>({year:e,isTwoDigitYear:t===`yy`});switch(t){case`y`:return J(Z(4,e),r);case`yo`:return J(n.ordinalNumber(e,{unit:`year`}),r);default:return J(Z(t.length,e),r)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n){let r=e.getFullYear();if(n.isTwoDigitYear){let t=Ht(n.year,r);return e.setFullYear(t,0,1),e.setHours(0,0,0,0),e}let i=!(`era`in t)||t.era===1?n.year:1-n.year;return e.setFullYear(i,0,1),e.setHours(0,0,0,0),e}},Gt=class extends G{priority=130;parse(e,t,n){let r=e=>({year:e,isTwoDigitYear:t===`YY`});switch(t){case`Y`:return J(Z(4,e),r);case`Yo`:return J(n.ordinalNumber(e,{unit:`year`}),r);default:return J(Z(t.length,e),r)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n,r){let i=R(e,r);if(n.isTwoDigitYear){let t=Ht(n.year,i);return e.setFullYear(t,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),D(e,r)}let a=!(`era`in t)||t.era===1?n.year:1-n.year;return e.setFullYear(a,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),D(e,r)}incompatibleTokens=[`y`,`R`,`u`,`Q`,`q`,`M`,`L`,`I`,`d`,`D`,`i`,`t`,`T`]},Kt=class extends G{priority=130;parse(e,t){return Bt(t===`R`?4:t.length,e)}set(e,t,n){let r=x(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),O(r)}incompatibleTokens=[`G`,`y`,`Y`,`u`,`Q`,`q`,`M`,`L`,`w`,`d`,`D`,`e`,`c`,`t`,`T`]},qt=class extends G{priority=130;parse(e,t){return Bt(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`]},Jt=class extends G{priority=120;parse(e,t,n){switch(t){case`Q`:case`QQ`:return Z(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`});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`]},Yt=class extends G{priority=120;parse(e,t,n){switch(t){case`q`:case`qq`:return Z(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`});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`]},Xt=class extends G{incompatibleTokens=[`Y`,`R`,`q`,`Q`,`L`,`w`,`I`,`D`,`i`,`e`,`c`,`t`,`T`];priority=110;parse(e,t,n){let r=e=>e-1;switch(t){case`M`:return J(Y(K.month,e),r);case`MM`:return J(Z(2,e),r);case`Mo`:return J(n.ordinalNumber(e,{unit:`month`}),r);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`});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}},Zt=class extends G{priority=110;parse(e,t,n){let r=e=>e-1;switch(t){case`L`:return J(Y(K.month,e),r);case`LL`:return J(Z(2,e),r);case`Lo`:return J(n.ordinalNumber(e,{unit:`month`}),r);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`});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 Qt(e,t,n){let r=S(e,n?.in),i=dt(r,n)-t;return r.setDate(r.getDate()-i*7),S(r,n?.in)}var $t=class extends G{priority=100;parse(e,t,n){switch(t){case`w`:return Y(K.week,e);case`wo`:return n.ordinalNumber(e,{unit:`week`});default:return Z(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n,r){return D(Qt(e,n,r),r)}incompatibleTokens=[`y`,`R`,`u`,`q`,`Q`,`M`,`L`,`I`,`d`,`D`,`i`,`t`,`T`]};function en(e,t,n){let r=S(e,n?.in),i=lt(r,n)-t;return r.setDate(r.getDate()-i*7),r}var tn=class extends G{priority=100;parse(e,t,n){switch(t){case`I`:return Y(K.week,e);case`Io`:return n.ordinalNumber(e,{unit:`week`});default:return Z(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n){return O(en(e,n))}incompatibleTokens=[`y`,`Y`,`u`,`q`,`Q`,`M`,`L`,`w`,`d`,`D`,`e`,`c`,`t`,`T`]},nn=[31,28,31,30,31,30,31,31,30,31,30,31],rn=[31,29,31,30,31,30,31,31,30,31,30,31],an=class extends G{priority=90;subPriority=1;parse(e,t,n){switch(t){case`d`:return Y(K.date,e);case`do`:return n.ordinalNumber(e,{unit:`date`});default:return Z(t.length,e)}}validate(e,t){let n=Ut(e.getFullYear()),r=e.getMonth();return n?t>=1&&t<=rn[r]:t>=1&&t<=nn[r]}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`]},on=class extends G{priority=90;subpriority=1;parse(e,t,n){switch(t){case`D`:case`DD`:return Y(K.dayOfYear,e);case`Do`:return n.ordinalNumber(e,{unit:`date`});default:return Z(t.length,e)}}validate(e,t){return Ut(e.getFullYear())?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 sn(e,t,n){let r=E(),i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=S(e,n?.in),o=a.getDay(),s=(t%7+7)%7,c=7-i;return C(a,t<0||t>6?t-(o+c)%7:(s+c)%7-(o+c)%7,n)}var cn=class extends G{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`});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,r){return e=sn(e,n,r),e.setHours(0,0,0,0),e}incompatibleTokens=[`D`,`i`,`e`,`c`,`t`,`T`]},ln=class extends G{priority=90;parse(e,t,n,r){let i=e=>{let t=Math.floor((e-1)/7)*7;return(e+r.weekStartsOn+6)%7+t};switch(t){case`e`:case`ee`:return J(Z(t.length,e),i);case`eo`:return J(n.ordinalNumber(e,{unit:`day`}),i);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`});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,r){return e=sn(e,n,r),e.setHours(0,0,0,0),e}incompatibleTokens=[`y`,`R`,`u`,`q`,`Q`,`M`,`L`,`I`,`d`,`D`,`E`,`i`,`c`,`t`,`T`]},un=class extends G{priority=90;parse(e,t,n,r){let i=e=>{let t=Math.floor((e-1)/7)*7;return(e+r.weekStartsOn+6)%7+t};switch(t){case`c`:case`cc`:return J(Z(t.length,e),i);case`co`:return J(n.ordinalNumber(e,{unit:`day`}),i);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`});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,r){return e=sn(e,n,r),e.setHours(0,0,0,0),e}incompatibleTokens=[`y`,`R`,`u`,`q`,`Q`,`M`,`L`,`I`,`d`,`D`,`E`,`i`,`e`,`t`,`T`]};function dn(e,t,n){let r=S(e,n?.in);return C(r,t-jt(r,n),n)}var fn=class extends G{priority=90;parse(e,t,n){let r=e=>e===0?7:e;switch(t){case`i`:case`ii`:return Z(t.length,e);case`io`:return n.ordinalNumber(e,{unit:`day`});case`iii`:return J(n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`}),r);case`iiiii`:return J(n.day(e,{width:`narrow`,context:`formatting`}),r);case`iiiiii`:return J(n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`}),r);default:return J(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`}),r)}}validate(e,t){return t>=1&&t<=7}set(e,t,n){return e=dn(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`]},pn=class extends G{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`});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(Vt(n),0,0,0),e}incompatibleTokens=[`b`,`B`,`H`,`k`,`t`,`T`]},mn=class extends G{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`});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(Vt(n),0,0,0),e}incompatibleTokens=[`a`,`B`,`H`,`k`,`t`,`T`]},hn=class extends G{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`});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(Vt(n),0,0,0),e}incompatibleTokens=[`a`,`b`,`t`,`T`]},gn=class extends G{priority=70;parse(e,t,n){switch(t){case`h`:return Y(K.hour12h,e);case`ho`:return n.ordinalNumber(e,{unit:`hour`});default:return Z(t.length,e)}}validate(e,t){return t>=1&&t<=12}set(e,t,n){let r=e.getHours()>=12;return r&&n<12?e.setHours(n+12,0,0,0):!r&&n===12?e.setHours(0,0,0,0):e.setHours(n,0,0,0),e}incompatibleTokens=[`H`,`K`,`k`,`t`,`T`]},_n=class extends G{priority=70;parse(e,t,n){switch(t){case`H`:return Y(K.hour23h,e);case`Ho`:return n.ordinalNumber(e,{unit:`hour`});default:return Z(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`]},vn=class extends G{priority=70;parse(e,t,n){switch(t){case`K`:return Y(K.hour11h,e);case`Ko`:return n.ordinalNumber(e,{unit:`hour`});default:return Z(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`]},yn=class extends G{priority=70;parse(e,t,n){switch(t){case`k`:return Y(K.hour24h,e);case`ko`:return n.ordinalNumber(e,{unit:`hour`});default:return Z(t.length,e)}}validate(e,t){return t>=1&&t<=24}set(e,t,n){let r=n<=24?n%24:n;return e.setHours(r,0,0,0),e}incompatibleTokens=[`a`,`b`,`h`,`H`,`K`,`t`,`T`]},bn=class extends G{priority=60;parse(e,t,n){switch(t){case`m`:return Y(K.minute,e);case`mo`:return n.ordinalNumber(e,{unit:`minute`});default:return Z(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`]},xn=class extends G{priority=50;parse(e,t,n){switch(t){case`s`:return Y(K.second,e);case`so`:return n.ordinalNumber(e,{unit:`second`});default:return Z(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setSeconds(n,0),e}incompatibleTokens=[`t`,`T`]},Sn=class extends G{priority=30;parse(e,t){return J(Z(t.length,e),e=>Math.trunc(e*10**(-t.length+3)))}set(e,t,n){return e.setMilliseconds(n),e}incompatibleTokens=[`t`,`T`]},Cn=class extends G{priority=10;parse(e,t){switch(t){case`X`:return X(q.basicOptionalMinutes,e);case`XX`:return X(q.basic,e);case`XXXX`:return X(q.basicOptionalSeconds,e);case`XXXXX`:return X(q.extendedOptionalSeconds,e);default:return X(q.extended,e)}}set(e,t,n){return t.timestampIsSet?e:x(e,e.getTime()-k(e)-n)}incompatibleTokens=[`t`,`T`,`x`]},wn=class extends G{priority=10;parse(e,t){switch(t){case`x`:return X(q.basicOptionalMinutes,e);case`xx`:return X(q.basic,e);case`xxxx`:return X(q.basicOptionalSeconds,e);case`xxxxx`:return X(q.extendedOptionalSeconds,e);default:return X(q.extended,e)}}set(e,t,n){return t.timestampIsSet?e:x(e,e.getTime()-k(e)-n)}incompatibleTokens=[`t`,`T`,`X`]},Tn=class extends G{priority=40;parse(e){return zt(e)}set(e,t,n){return[x(e,n*1e3),{timestampIsSet:!0}]}incompatibleTokens=`*`},En=class extends G{priority=20;parse(e){return zt(e)}set(e,t,n){return[x(e,n),{timestampIsSet:!0}]}incompatibleTokens=`*`},Dn={G:new Rt,y:new Wt,Y:new Gt,R:new Kt,u:new qt,Q:new Jt,q:new Yt,M:new Xt,L:new Zt,w:new $t,I:new tn,d:new an,D:new on,E:new cn,e:new ln,c:new un,i:new fn,a:new pn,b:new mn,B:new hn,h:new gn,H:new _n,K:new vn,k:new yn,m:new bn,s:new xn,S:new Sn,X:new Cn,x:new wn,t:new Tn,T:new En},On=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,kn=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,An=/^'([^]*?)'?$/,jn=/''/g,Mn=/\S/,Nn=/[a-zA-Z]/;function Pn(e,t,n,r){let i=()=>x(r?.in||n,NaN),a=At(),o=r?.locale??a.locale??st,s=r?.firstWeekContainsDate??r?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,c=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0;if(!t)return e?i():S(n,r?.in);let l={firstWeekContainsDate:s,weekStartsOn:c,locale:o},u=[new Lt(r?.in,n)],d=t.match(kn).map(e=>{let t=e[0];if(t in U){let n=U[t];return n(e,o.formatLong)}return e}).join(``).match(On),f=[];for(let n of d){!r?.useAdditionalWeekYearTokens&&xt(n)&&W(n,t,e),!r?.useAdditionalDayOfYearTokens&&bt(n)&&W(n,t,e);let a=n[0],s=Dn[a];if(s){let{incompatibleTokens:t}=s;if(Array.isArray(t)){let e=f.find(e=>t.includes(e.token)||e.token===a);if(e)throw RangeError(`The format string mustn't contain \`${e.fullToken}\` and \`${n}\` at the same time`)}else if(s.incompatibleTokens===`*`&&f.length>0)throw RangeError(`The format string mustn't contain \`${n}\` and any other token at the same time`);f.push({token:a,fullToken:n});let r=s.run(e,n,o.match,l);if(!r)return i();u.push(r.setter),e=r.rest}else{if(a.match(Nn))throw RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");if(n===`''`?n=`'`:a===`'`&&(n=Fn(n)),e.indexOf(n)===0)e=e.slice(n.length);else return i()}}if(e.length>0&&Mn.test(e))return i();let p=u.map(e=>e.priority).sort((e,t)=>t-e).filter((e,t,n)=>n.indexOf(e)===t).map(e=>u.filter(t=>t.priority===e).sort((e,t)=>t.subPriority-e.subPriority)).map(e=>e[0]),m=S(n,r?.in);if(isNaN(+m))return i();let h={};for(let e of p){if(!e.validate(m,l))return i();let t=e.set(m,h,l);Array.isArray(t)?(m=t[0],Object.assign(h,t[1])):m=t}return m}function Fn(e){return e.match(An)[1].replace(jn,`'`)}function In(e,t){let n=S(e,t?.in);return n.setMinutes(0,0,0),n}function Ln(e,t){let n=S(e,t?.in);return n.setSeconds(0,0),n}function Rn(e,t){let n=S(e,t?.in);return n.setMilliseconds(0),n}function zn(e,t){let n=()=>x(t?.in,NaN),r=t?.additionalDigits??2,i=Un(e),a;if(i.date){let e=Wn(i.date,r);a=Gn(e.restDateString,e.year)}if(!a||isNaN(+a))return n();let o=+a,s=0,c;if(i.time&&(s=Kn(i.time),isNaN(s)))return n();if(i.timezone){if(c=Jn(i.timezone),isNaN(c))return n()}else{let e=new Date(o+s),n=S(0,t?.in);return n.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),n.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),n}return S(o+s+c,t?.in)}var Q={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Bn=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,Vn=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Hn=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Un(e){let t={},n=e.split(Q.dateTimeDelimiter),r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],Q.timeZoneDelimiter.test(t.date)&&(t.date=e.split(Q.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){let e=Q.timezone.exec(r);e?(t.time=r.replace(e[1],``),t.timezone=e[1]):t.time=r}return t}function Wn(e,t){let n=RegExp(`^(?:(\\d{4}|[+-]\\d{`+(4+t)+`})|(\\d{2}|[+-]\\d{`+(2+t)+`})$)`),r=e.match(n);if(!r)return{year:NaN,restDateString:``};let i=r[1]?parseInt(r[1]):null,a=r[2]?parseInt(r[2]):null;return{year:a===null?i:a*100,restDateString:e.slice((r[1]||r[2]).length)}}function Gn(e,t){if(t===null)return new Date(NaN);let n=e.match(Bn);if(!n)return new Date(NaN);let r=!!n[4],i=$(n[1]),a=$(n[2])-1,o=$(n[3]),s=$(n[4]),c=$(n[5])-1;if(r)return er(t,s,c)?Yn(t,s,c):new Date(NaN);{let e=new Date(0);return!Qn(t,a,o)||!$n(t,i)?new Date(NaN):(e.setUTCFullYear(t,a,Math.max(i,o)),e)}}function $(e){return e?parseInt(e):1}function Kn(e){let t=e.match(Vn);if(!t)return NaN;let n=qn(t[1]),r=qn(t[2]),i=qn(t[3]);return tr(n,r,i)?n*b+r*y+i*1e3:NaN}function qn(e){return e&&parseFloat(e.replace(`,`,`.`))||0}function Jn(e){if(e===`Z`)return 0;let t=e.match(Hn);if(!t)return 0;let n=t[1]===`+`?-1:1,r=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return nr(r,i)?n*(r*b+i*y):NaN}function Yn(e,t,n){let r=new Date(0);r.setUTCFullYear(e,0,4);let i=r.getUTCDay()||7,a=(t-1)*7+n+1-i;return r.setUTCDate(r.getUTCDate()+a),r}var Xn=[31,null,31,30,31,30,31,31,30,31,30,31];function Zn(e){return e%400==0||e%4==0&&e%100!=0}function Qn(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(Xn[t]||(Zn(e)?29:28))}function $n(e,t){return t>=1&&t<=(Zn(e)?366:365)}function er(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function tr(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function nr(e,t){return t>=0&&t<=59}var rr={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`};m._date.override({_id:`date-fns`,formats:function(){return rr},parse:function(e,t){if(e==null)return null;let n=typeof e;return n===`number`||e instanceof Date?e=S(e):n===`string`&&(e=typeof t==`string`?Pn(e,t,new Date,this.options):zn(e,this.options)),Oe(e)?e.getTime():null},format:function(e,t){return Ot(e,t,this.options)},add:function(e,t,n){switch(n){case`millisecond`:return T(e,t);case`second`:return we(e,t);case`minute`:return Se(e,t);case`hour`:return _e(e,t);case`day`:return C(e,t);case`week`:return Te(e,t);case`month`:return w(e,t);case`quarter`:return Ce(e,t);case`year`:return Ee(e,t);default:return e}},diff:function(e,t,n){switch(n){case`millisecond`:return P(e,t);case`second`:return Be(e,t);case`minute`:return Pe(e,t);case`hour`:return Ne(e,t);case`day`:return je(e,t);case`week`:return Ve(e,t);case`month`:return Re(e,t);case`quarter`:return ze(e,t);case`year`:return He(e,t);default:return 0}},startOf:function(e,t,n){switch(t){case`second`:return Rn(e);case`minute`:return Ln(e);case`hour`:return In(e);case`day`:return j(e);case`week`:return D(e);case`isoWeek`:return D(e,{weekStartsOn:+n});case`month`:return We(e);case`quarter`:return Ue(e);case`year`:return Ke(e);default:return e}},endOf:function(e,t){switch(t){case`second`:return Ze(e);case`minute`:return Ye(e);case`hour`:return qe(e);case`day`:return Fe(e);case`week`:return Je(e);case`month`:return Ie(e);case`quarter`:return Xe(e);case`year`:return Ge(e);default:return e}}});export{de as t}; \ No newline at end of file +import{Ct as e,St as t,c as n,g as r,k as i,l as a,m as o,o as s,p as c,r as l,s as u,u as d}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{t as f}from"./_plugin-vue_export-helper-TcpyXLsZ.js";import{t as p}from"./Spinner-CYvUNW0P.js";import{h as m}from"./ChartCard-Cqs_1Frf.js";var h={class:`sparkline-card`},ee={class:`card-header`},te={class:`card-title`},ne={class:`card-subtitle`},re={key:0,class:`card-chart`},ie={key:0,class:`chart-loader`},ae={key:1,class:`chart-error`},oe={key:2,class:`chart-text`},se={class:`percent-value`},ce=[`id`,`viewBox`],le=[`d`,`fill`],ue=[`d`,`stroke`],g=100,_=40,de=f(r({name:`SparklineChart`,__name:`Sparkline`,props:{title:{},value:{},color:{},data:{default:()=>[]},showChart:{type:Boolean,default:!0},variant:{default:`smooth`},loading:{type:Boolean,default:!1},error:{default:null},centerText:{default:``},subtitle:{default:``},minY:{default:void 0},maxY:{default:void 0}},emits:[`retry`],setup(r,{emit:f}){let m=r,de=f,fe=e=>{if(e.length<3)return e;let t=Math.min(15,Math.max(3,Math.floor(e.length*.2))),n=[];for(let r=0;re+t,0)/s.length)}let r=Math.min(10,n.length),i=n.length/r,a=[];for(let e=0;e!m.data||m.data.length===0?[]:m.variant===`smooth`?fe(m.data):m.data),pe=e=>{if(e.length<2)return``;let t=m.maxY??Math.max(...e),n=m.minY??Math.min(...e),r=t-n||1,i=m.variant===`classic`?4:2,a=``;return e.forEach((t,o)=>{let s=o/(e.length-1)*g,c=(t-n)/r,l=i+(_-i*2)*(1-c);if(o===0)a+=`M ${s.toFixed(2)} ${l.toFixed(2)}`;else{let t=((o-1)/(e.length-1)*g+s)/2;a+=` Q ${t.toFixed(2)} ${l.toFixed(2)} ${s.toFixed(2)} ${l.toFixed(2)}`}}),a},y=s(()=>pe(v.value)),b=s(()=>y.value?`${y.value} L ${g} ${_} L 0 ${_} Z`:``),me=s(()=>`sparkline-${m.title.replace(/\s+/g,`-`).toLowerCase()}`);return(s,f)=>(i(),d(`div`,h,[u(`div`,ee,[u(`div`,null,[u(`p`,te,e(r.title),1),u(`p`,ne,e(r.subtitle),1)]),u(`span`,{class:`card-value`,style:t({color:r.color})},[r.loading?(i(),n(p,{key:0,size:`sm`,color:`current`})):(i(),d(l,{key:1},[c(e(typeof r.value==`number`?r.value.toLocaleString():r.value),1)],64))],4)]),r.showChart?(i(),d(`div`,re,[r.loading&&r.variant===`classic`?(i(),d(`div`,ie,[o(p,{size:`sm`})])):r.error?(i(),d(`div`,ae,[u(`button`,{class:`chart-retry-btn`,onClick:f[0]||=e=>de(`retry`)},`↺ Retry`)])):r.centerText?(i(),d(`div`,oe,[u(`span`,se,e(r.centerText),1)])):(i(),d(`svg`,{key:3,id:me.value,class:`chart-svg`,viewBox:`0 0 ${g} ${_}`,preserveAspectRatio:`none`},[r.variant===`classic`?(i(),d(l,{key:0},[v.value.length>1?(i(),d(`path`,{key:0,d:b.value,fill:r.color,"fill-opacity":`0.8`,class:`sparkline-path`},null,8,le)):a(``,!0)],64)):(i(),d(l,{key:1},[v.value.length>1?(i(),d(`path`,{key:0,d:y.value,stroke:r.color,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`,fill:`none`,class:`sparkline-path`},null,8,ue)):a(``,!0)],64))],8,ce))])):a(``,!0)]))}}),[[`__scopeId`,`data-v-902d5054`]]),fe=365.2425,v=6048e5,pe=864e5,y=6e4,b=36e5,me=1e3,he=3600*24;he*7,he*fe/12*3;var ge=Symbol.for(`constructDateFrom`);function x(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&ge in e?e[ge](t):e instanceof Date?new e.constructor(t):new Date(t)}function S(e,t){return x(t||e,e)}function C(e,t,n){let r=S(e,n?.in);return isNaN(t)?x(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}function w(e,t,n){let r=S(e,n?.in);if(isNaN(t))return x(n?.in||e,NaN);if(!t)return r;let i=r.getDate(),a=x(n?.in||e,r.getTime());return a.setMonth(r.getMonth()+t+1,0),i>=a.getDate()?a:(r.setFullYear(a.getFullYear(),a.getMonth(),i),r)}function T(e,t,n){return x(n?.in||e,+S(e)+t)}function _e(e,t,n){return T(e,t*b,n)}var ve={};function E(){return ve}function D(e,t){let n=E(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=S(e,t?.in),a=i.getDay(),o=(a=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function k(e){let t=S(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function A(e,...t){let n=x.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function j(e,t){let n=S(e,t?.in);return n.setHours(0,0,0,0),n}function be(e,t,n){let[r,i]=A(n?.in,e,t),a=j(r),o=j(i),s=+a-k(a),c=+o-k(o);return Math.round((s-c)/pe)}function xe(e,t){let n=ye(e,t),r=x(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),O(r)}function Se(e,t,n){let r=S(e,n?.in);return r.setTime(r.getTime()+t*y),r}function Ce(e,t,n){return w(e,t*3,n)}function we(e,t,n){return T(e,t*1e3,n)}function Te(e,t,n){return C(e,t*7,n)}function Ee(e,t,n){return w(e,t*12,n)}function M(e,t){let n=S(e)-+S(t);return n<0?-1:n>0?1:n}function De(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function Oe(e){return!(!De(e)&&typeof e!=`number`||isNaN(+S(e)))}function ke(e,t,n){let[r,i]=A(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function Ae(e,t,n){let[r,i]=A(n?.in,e,t);return r.getFullYear()-i.getFullYear()}function je(e,t,n){let[r,i]=A(n?.in,e,t),a=Me(r,i),o=Math.abs(be(r,i));r.setDate(r.getDate()-a*o);let s=a*(o-Number(Me(r,i)===-a));return s===0?0:s}function Me(e,t){let n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function N(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function Ne(e,t,n){let[r,i]=A(n?.in,e,t),a=(r-+i)/b;return N(n?.roundingMethod)(a)}function P(e,t){return S(e)-+S(t)}function Pe(e,t,n){let r=P(e,t)/y;return N(n?.roundingMethod)(r)}function Fe(e,t){let n=S(e,t?.in);return n.setHours(23,59,59,999),n}function Ie(e,t){let n=S(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function Le(e,t){let n=S(e,t?.in);return+Fe(n,t)==+Ie(n,t)}function Re(e,t,n){let[r,i,a]=A(n?.in,e,e,t),o=M(i,a),s=Math.abs(ke(i,a));if(s<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-o*s);let c=M(i,a)===-o;Le(r)&&s===1&&M(r,a)===1&&(c=!1);let l=o*(s-+c);return l===0?0:l}function ze(e,t,n){let r=Re(e,t,n)/3;return N(n?.roundingMethod)(r)}function Be(e,t,n){let r=P(e,t)/1e3;return N(n?.roundingMethod)(r)}function Ve(e,t,n){let r=je(e,t,n)/7;return N(n?.roundingMethod)(r)}function He(e,t,n){let[r,i]=A(n?.in,e,t),a=M(r,i),o=Math.abs(Ae(r,i));r.setFullYear(1584),i.setFullYear(1584);let s=a*(o-+(M(r,i)===-a));return s===0?0:s}function Ue(e,t){let n=S(e,t?.in),r=n.getMonth(),i=r-r%3;return n.setMonth(i,1),n.setHours(0,0,0,0),n}function We(e,t){let n=S(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Ge(e,t){let n=S(e,t?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function Ke(e,t){let n=S(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function qe(e,t){let n=S(e,t?.in);return n.setMinutes(59,59,999),n}function Je(e,t){let n=E(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=S(e,t?.in),a=i.getDay(),o=(a{let r,i=Qe[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function F(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var et={date:F({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:F({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:F({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},tt={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},nt=(e,t,n,r)=>tt[e];function I(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var rt={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:I({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:I({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:I({values:{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`]},defaultWidth:`wide`}),day:I({values:{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`]},defaultWidth:`wide`}),dayPeriod:I({values:{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`}},defaultWidth:`wide`,formattingValues:{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`}},defaultFormattingWidth:`wide`})};function L(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?at(s,e=>e.test(o)):it(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function it(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function at(e,t){for(let n=0;n{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var st={code:`en-US`,formatDistance:$e,formatLong:et,formatRelative:nt,localize:rt,match:{ordinalNumber:ot({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:L({matchPatterns:{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},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:L({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:L({matchPatterns:{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},defaultMatchWidth:`wide`,parsePatterns:{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]},defaultParseWidth:`any`}),day:L({matchPatterns:{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},defaultMatchWidth:`wide`,parsePatterns:{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]},defaultParseWidth:`any`}),dayPeriod:L({matchPatterns:{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},defaultMatchWidth:`any`,parsePatterns:{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}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function ct(e,t){let n=S(e,t?.in);return be(n,Ke(n))+1}function lt(e,t){let n=S(e,t?.in),r=O(n)-+xe(n);return Math.round(r/v)+1}function R(e,t){let n=S(e,t?.in),r=n.getFullYear(),i=E(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=x(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=D(o,t),c=x(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=D(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function ut(e,t){let n=E(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=R(e,t),a=x(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),D(a,t)}function dt(e,t){let n=S(e,t?.in),r=D(n,t)-+ut(n,t);return Math.round(r/v)+1}function z(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var B={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return z(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):z(n+1,2)},d(e,t){return z(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return z(e.getHours()%12||12,t.length)},H(e,t){return z(e.getHours(),t.length)},m(e,t){return z(e.getMinutes(),t.length)},s(e,t){return z(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return z(Math.trunc(r*10**(n-3)),t.length)}},V={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},ft={G:function(e,t,n){let r=e.getFullYear()>0?1:0;switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return B.y(e,t)},Y:function(e,t,n,r){let i=R(e,r),a=i>0?i:1-i;return t===`YY`?z(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):z(a,t.length)},R:function(e,t){return z(ye(e),t.length)},u:function(e,t){return z(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return z(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return z(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return B.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return z(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=dt(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):z(i,t.length)},I:function(e,t,n){let r=lt(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):z(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):B.d(e,t)},D:function(e,t,n){let r=ct(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):z(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return z(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return z(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return z(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?V.noon:r===0?V.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?V.evening:r>=12?V.afternoon:r>=4?V.morning:V.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return B.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):B.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):z(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):z(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):B.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):B.s(e,t)},S:function(e,t){return B.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return mt(r);case`XXXX`:case`XX`:return H(r);default:return H(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return mt(r);case`xxxx`:case`xx`:return H(r);default:return H(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+pt(r,`:`);default:return`GMT`+H(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+pt(r,`:`);default:return`GMT`+H(r,`:`)}},t:function(e,t,n){return z(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return z(+e,t.length)}};function pt(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+z(a,2)}function mt(e,t){return e%60==0?(e>0?`-`:`+`)+z(Math.abs(e)/60,2):H(e,t)}function H(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=z(Math.trunc(r/60),2),a=z(r%60,2);return n+i+t+a}var ht=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},gt=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},U={p:gt,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return ht(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,ht(r,t)).replace(`{{time}}`,gt(i,t))}},_t=/^D+$/,vt=/^Y+$/,yt=[`D`,`DD`,`YY`,`YYYY`];function bt(e){return _t.test(e)}function xt(e){return vt.test(e)}function W(e,t,n){let r=St(e,t,n);if(console.warn(r),yt.includes(e))throw RangeError(r)}function St(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var Ct=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,wt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Tt=/^'([^]*?)'?$/,Et=/''/g,Dt=/[a-zA-Z]/;function Ot(e,t,n){let r=E(),i=n?.locale??r.locale??st,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=S(e,n?.in);if(!Oe(s))throw RangeError(`Invalid time value`);let c=t.match(wt).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=U[t];return n(e,i.formatLong)}return e}).join(``).match(Ct).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:kt(e)};if(ft[t])return{isToken:!0,value:e};if(t.match(Dt))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&xt(a)||!n?.useAdditionalDayOfYearTokens&&bt(a))&&W(a,t,String(e));let o=ft[a[0]];return o(s,a,i.localize,l)}).join(``)}function kt(e){let t=e.match(Tt);return t?t[1].replace(Et,`'`):e}function At(){return Object.assign({},E())}function jt(e,t){let n=S(e,t?.in).getDay();return n===0?7:n}function Mt(e,t){let n=Nt(t)?new t(0):x(t,0);return n.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),n.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n}function Nt(e){return typeof e==`function`&&e.prototype?.constructor===e}var Pt=10,Ft=class{subPriority=0;validate(e,t){return!0}},It=class extends Ft{constructor(e,t,n,r,i){super(),this.value=e,this.validateValue=t,this.setValue=n,this.priority=r,i&&(this.subPriority=i)}validate(e,t){return this.validateValue(e,this.value,t)}set(e,t,n){return this.setValue(e,t,this.value,n)}},Lt=class extends Ft{priority=Pt;subPriority=-1;constructor(e,t){super(),this.context=e||(e=>x(t,e))}set(e,t){return t.timestampIsSet?e:x(e,Mt(e,this.context))}},G=class{run(e,t,n,r){let i=this.parse(e,t,n,r);return i?{setter:new It(i.value,this.validate,this.set,this.priority,this.subPriority),rest:i.rest}:null}validate(e,t,n){return!0}},Rt=class extends G{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`});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`]},K={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}/},q={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 J(e,t){return e&&{value:t(e.value),rest:e.rest}}function Y(e,t){let n=t.match(e);return n?{value:parseInt(n[0],10),rest:t.slice(n[0].length)}:null}function X(e,t){let n=t.match(e);if(!n)return null;if(n[0]===`Z`)return{value:0,rest:t.slice(1)};let r=n[1]===`+`?1:-1,i=n[2]?parseInt(n[2],10):0,a=n[3]?parseInt(n[3],10):0,o=n[5]?parseInt(n[5],10):0;return{value:r*(i*b+a*y+o*me),rest:t.slice(n[0].length)}}function zt(e){return Y(K.anyDigitsSigned,e)}function Z(e,t){switch(e){case 1:return Y(K.singleDigit,t);case 2:return Y(K.twoDigits,t);case 3:return Y(K.threeDigits,t);case 4:return Y(K.fourDigits,t);default:return Y(RegExp(`^\\d{1,`+e+`}`),t)}}function Bt(e,t){switch(e){case 1:return Y(K.singleDigitSigned,t);case 2:return Y(K.twoDigitsSigned,t);case 3:return Y(K.threeDigitsSigned,t);case 4:return Y(K.fourDigitsSigned,t);default:return Y(RegExp(`^-?\\d{1,`+e+`}`),t)}}function Vt(e){switch(e){case`morning`:return 4;case`evening`:return 17;case`pm`:case`noon`:case`afternoon`:return 12;default:return 0}}function Ht(e,t){let n=t>0,r=n?t:1-t,i;if(r<=50)i=e||100;else{let t=r+50,n=Math.trunc(t/100)*100,a=e>=t%100;i=e+n-(a?100:0)}return n?i:1-i}function Ut(e){return e%400==0||e%4==0&&e%100!=0}var Wt=class extends G{priority=130;incompatibleTokens=[`Y`,`R`,`u`,`w`,`I`,`i`,`e`,`c`,`t`,`T`];parse(e,t,n){let r=e=>({year:e,isTwoDigitYear:t===`yy`});switch(t){case`y`:return J(Z(4,e),r);case`yo`:return J(n.ordinalNumber(e,{unit:`year`}),r);default:return J(Z(t.length,e),r)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n){let r=e.getFullYear();if(n.isTwoDigitYear){let t=Ht(n.year,r);return e.setFullYear(t,0,1),e.setHours(0,0,0,0),e}let i=!(`era`in t)||t.era===1?n.year:1-n.year;return e.setFullYear(i,0,1),e.setHours(0,0,0,0),e}},Gt=class extends G{priority=130;parse(e,t,n){let r=e=>({year:e,isTwoDigitYear:t===`YY`});switch(t){case`Y`:return J(Z(4,e),r);case`Yo`:return J(n.ordinalNumber(e,{unit:`year`}),r);default:return J(Z(t.length,e),r)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n,r){let i=R(e,r);if(n.isTwoDigitYear){let t=Ht(n.year,i);return e.setFullYear(t,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),D(e,r)}let a=!(`era`in t)||t.era===1?n.year:1-n.year;return e.setFullYear(a,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),D(e,r)}incompatibleTokens=[`y`,`R`,`u`,`Q`,`q`,`M`,`L`,`I`,`d`,`D`,`i`,`t`,`T`]},Kt=class extends G{priority=130;parse(e,t){return Bt(t===`R`?4:t.length,e)}set(e,t,n){let r=x(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),O(r)}incompatibleTokens=[`G`,`y`,`Y`,`u`,`Q`,`q`,`M`,`L`,`w`,`d`,`D`,`e`,`c`,`t`,`T`]},qt=class extends G{priority=130;parse(e,t){return Bt(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`]},Jt=class extends G{priority=120;parse(e,t,n){switch(t){case`Q`:case`QQ`:return Z(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`});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`]},Yt=class extends G{priority=120;parse(e,t,n){switch(t){case`q`:case`qq`:return Z(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`});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`]},Xt=class extends G{incompatibleTokens=[`Y`,`R`,`q`,`Q`,`L`,`w`,`I`,`D`,`i`,`e`,`c`,`t`,`T`];priority=110;parse(e,t,n){let r=e=>e-1;switch(t){case`M`:return J(Y(K.month,e),r);case`MM`:return J(Z(2,e),r);case`Mo`:return J(n.ordinalNumber(e,{unit:`month`}),r);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`});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}},Zt=class extends G{priority=110;parse(e,t,n){let r=e=>e-1;switch(t){case`L`:return J(Y(K.month,e),r);case`LL`:return J(Z(2,e),r);case`Lo`:return J(n.ordinalNumber(e,{unit:`month`}),r);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`});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 Qt(e,t,n){let r=S(e,n?.in),i=dt(r,n)-t;return r.setDate(r.getDate()-i*7),S(r,n?.in)}var $t=class extends G{priority=100;parse(e,t,n){switch(t){case`w`:return Y(K.week,e);case`wo`:return n.ordinalNumber(e,{unit:`week`});default:return Z(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n,r){return D(Qt(e,n,r),r)}incompatibleTokens=[`y`,`R`,`u`,`q`,`Q`,`M`,`L`,`I`,`d`,`D`,`i`,`t`,`T`]};function en(e,t,n){let r=S(e,n?.in),i=lt(r,n)-t;return r.setDate(r.getDate()-i*7),r}var tn=class extends G{priority=100;parse(e,t,n){switch(t){case`I`:return Y(K.week,e);case`Io`:return n.ordinalNumber(e,{unit:`week`});default:return Z(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n){return O(en(e,n))}incompatibleTokens=[`y`,`Y`,`u`,`q`,`Q`,`M`,`L`,`w`,`d`,`D`,`e`,`c`,`t`,`T`]},nn=[31,28,31,30,31,30,31,31,30,31,30,31],rn=[31,29,31,30,31,30,31,31,30,31,30,31],an=class extends G{priority=90;subPriority=1;parse(e,t,n){switch(t){case`d`:return Y(K.date,e);case`do`:return n.ordinalNumber(e,{unit:`date`});default:return Z(t.length,e)}}validate(e,t){let n=Ut(e.getFullYear()),r=e.getMonth();return n?t>=1&&t<=rn[r]:t>=1&&t<=nn[r]}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`]},on=class extends G{priority=90;subpriority=1;parse(e,t,n){switch(t){case`D`:case`DD`:return Y(K.dayOfYear,e);case`Do`:return n.ordinalNumber(e,{unit:`date`});default:return Z(t.length,e)}}validate(e,t){return Ut(e.getFullYear())?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 sn(e,t,n){let r=E(),i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=S(e,n?.in),o=a.getDay(),s=(t%7+7)%7,c=7-i;return C(a,t<0||t>6?t-(o+c)%7:(s+c)%7-(o+c)%7,n)}var cn=class extends G{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`});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,r){return e=sn(e,n,r),e.setHours(0,0,0,0),e}incompatibleTokens=[`D`,`i`,`e`,`c`,`t`,`T`]},ln=class extends G{priority=90;parse(e,t,n,r){let i=e=>{let t=Math.floor((e-1)/7)*7;return(e+r.weekStartsOn+6)%7+t};switch(t){case`e`:case`ee`:return J(Z(t.length,e),i);case`eo`:return J(n.ordinalNumber(e,{unit:`day`}),i);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`});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,r){return e=sn(e,n,r),e.setHours(0,0,0,0),e}incompatibleTokens=[`y`,`R`,`u`,`q`,`Q`,`M`,`L`,`I`,`d`,`D`,`E`,`i`,`c`,`t`,`T`]},un=class extends G{priority=90;parse(e,t,n,r){let i=e=>{let t=Math.floor((e-1)/7)*7;return(e+r.weekStartsOn+6)%7+t};switch(t){case`c`:case`cc`:return J(Z(t.length,e),i);case`co`:return J(n.ordinalNumber(e,{unit:`day`}),i);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`});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,r){return e=sn(e,n,r),e.setHours(0,0,0,0),e}incompatibleTokens=[`y`,`R`,`u`,`q`,`Q`,`M`,`L`,`I`,`d`,`D`,`E`,`i`,`e`,`t`,`T`]};function dn(e,t,n){let r=S(e,n?.in);return C(r,t-jt(r,n),n)}var fn=class extends G{priority=90;parse(e,t,n){let r=e=>e===0?7:e;switch(t){case`i`:case`ii`:return Z(t.length,e);case`io`:return n.ordinalNumber(e,{unit:`day`});case`iii`:return J(n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`}),r);case`iiiii`:return J(n.day(e,{width:`narrow`,context:`formatting`}),r);case`iiiiii`:return J(n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`}),r);default:return J(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`}),r)}}validate(e,t){return t>=1&&t<=7}set(e,t,n){return e=dn(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`]},pn=class extends G{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`});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(Vt(n),0,0,0),e}incompatibleTokens=[`b`,`B`,`H`,`k`,`t`,`T`]},mn=class extends G{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`});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(Vt(n),0,0,0),e}incompatibleTokens=[`a`,`B`,`H`,`k`,`t`,`T`]},hn=class extends G{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`});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(Vt(n),0,0,0),e}incompatibleTokens=[`a`,`b`,`t`,`T`]},gn=class extends G{priority=70;parse(e,t,n){switch(t){case`h`:return Y(K.hour12h,e);case`ho`:return n.ordinalNumber(e,{unit:`hour`});default:return Z(t.length,e)}}validate(e,t){return t>=1&&t<=12}set(e,t,n){let r=e.getHours()>=12;return r&&n<12?e.setHours(n+12,0,0,0):!r&&n===12?e.setHours(0,0,0,0):e.setHours(n,0,0,0),e}incompatibleTokens=[`H`,`K`,`k`,`t`,`T`]},_n=class extends G{priority=70;parse(e,t,n){switch(t){case`H`:return Y(K.hour23h,e);case`Ho`:return n.ordinalNumber(e,{unit:`hour`});default:return Z(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`]},vn=class extends G{priority=70;parse(e,t,n){switch(t){case`K`:return Y(K.hour11h,e);case`Ko`:return n.ordinalNumber(e,{unit:`hour`});default:return Z(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`]},yn=class extends G{priority=70;parse(e,t,n){switch(t){case`k`:return Y(K.hour24h,e);case`ko`:return n.ordinalNumber(e,{unit:`hour`});default:return Z(t.length,e)}}validate(e,t){return t>=1&&t<=24}set(e,t,n){let r=n<=24?n%24:n;return e.setHours(r,0,0,0),e}incompatibleTokens=[`a`,`b`,`h`,`H`,`K`,`t`,`T`]},bn=class extends G{priority=60;parse(e,t,n){switch(t){case`m`:return Y(K.minute,e);case`mo`:return n.ordinalNumber(e,{unit:`minute`});default:return Z(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`]},xn=class extends G{priority=50;parse(e,t,n){switch(t){case`s`:return Y(K.second,e);case`so`:return n.ordinalNumber(e,{unit:`second`});default:return Z(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setSeconds(n,0),e}incompatibleTokens=[`t`,`T`]},Sn=class extends G{priority=30;parse(e,t){return J(Z(t.length,e),e=>Math.trunc(e*10**(-t.length+3)))}set(e,t,n){return e.setMilliseconds(n),e}incompatibleTokens=[`t`,`T`]},Cn=class extends G{priority=10;parse(e,t){switch(t){case`X`:return X(q.basicOptionalMinutes,e);case`XX`:return X(q.basic,e);case`XXXX`:return X(q.basicOptionalSeconds,e);case`XXXXX`:return X(q.extendedOptionalSeconds,e);default:return X(q.extended,e)}}set(e,t,n){return t.timestampIsSet?e:x(e,e.getTime()-k(e)-n)}incompatibleTokens=[`t`,`T`,`x`]},wn=class extends G{priority=10;parse(e,t){switch(t){case`x`:return X(q.basicOptionalMinutes,e);case`xx`:return X(q.basic,e);case`xxxx`:return X(q.basicOptionalSeconds,e);case`xxxxx`:return X(q.extendedOptionalSeconds,e);default:return X(q.extended,e)}}set(e,t,n){return t.timestampIsSet?e:x(e,e.getTime()-k(e)-n)}incompatibleTokens=[`t`,`T`,`X`]},Tn=class extends G{priority=40;parse(e){return zt(e)}set(e,t,n){return[x(e,n*1e3),{timestampIsSet:!0}]}incompatibleTokens=`*`},En=class extends G{priority=20;parse(e){return zt(e)}set(e,t,n){return[x(e,n),{timestampIsSet:!0}]}incompatibleTokens=`*`},Dn={G:new Rt,y:new Wt,Y:new Gt,R:new Kt,u:new qt,Q:new Jt,q:new Yt,M:new Xt,L:new Zt,w:new $t,I:new tn,d:new an,D:new on,E:new cn,e:new ln,c:new un,i:new fn,a:new pn,b:new mn,B:new hn,h:new gn,H:new _n,K:new vn,k:new yn,m:new bn,s:new xn,S:new Sn,X:new Cn,x:new wn,t:new Tn,T:new En},On=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,kn=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,An=/^'([^]*?)'?$/,jn=/''/g,Mn=/\S/,Nn=/[a-zA-Z]/;function Pn(e,t,n,r){let i=()=>x(r?.in||n,NaN),a=At(),o=r?.locale??a.locale??st,s=r?.firstWeekContainsDate??r?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,c=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0;if(!t)return e?i():S(n,r?.in);let l={firstWeekContainsDate:s,weekStartsOn:c,locale:o},u=[new Lt(r?.in,n)],d=t.match(kn).map(e=>{let t=e[0];if(t in U){let n=U[t];return n(e,o.formatLong)}return e}).join(``).match(On),f=[];for(let n of d){!r?.useAdditionalWeekYearTokens&&xt(n)&&W(n,t,e),!r?.useAdditionalDayOfYearTokens&&bt(n)&&W(n,t,e);let a=n[0],s=Dn[a];if(s){let{incompatibleTokens:t}=s;if(Array.isArray(t)){let e=f.find(e=>t.includes(e.token)||e.token===a);if(e)throw RangeError(`The format string mustn't contain \`${e.fullToken}\` and \`${n}\` at the same time`)}else if(s.incompatibleTokens===`*`&&f.length>0)throw RangeError(`The format string mustn't contain \`${n}\` and any other token at the same time`);f.push({token:a,fullToken:n});let r=s.run(e,n,o.match,l);if(!r)return i();u.push(r.setter),e=r.rest}else{if(a.match(Nn))throw RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");if(n===`''`?n=`'`:a===`'`&&(n=Fn(n)),e.indexOf(n)===0)e=e.slice(n.length);else return i()}}if(e.length>0&&Mn.test(e))return i();let p=u.map(e=>e.priority).sort((e,t)=>t-e).filter((e,t,n)=>n.indexOf(e)===t).map(e=>u.filter(t=>t.priority===e).sort((e,t)=>t.subPriority-e.subPriority)).map(e=>e[0]),m=S(n,r?.in);if(isNaN(+m))return i();let h={};for(let e of p){if(!e.validate(m,l))return i();let t=e.set(m,h,l);Array.isArray(t)?(m=t[0],Object.assign(h,t[1])):m=t}return m}function Fn(e){return e.match(An)[1].replace(jn,`'`)}function In(e,t){let n=S(e,t?.in);return n.setMinutes(0,0,0),n}function Ln(e,t){let n=S(e,t?.in);return n.setSeconds(0,0),n}function Rn(e,t){let n=S(e,t?.in);return n.setMilliseconds(0),n}function zn(e,t){let n=()=>x(t?.in,NaN),r=t?.additionalDigits??2,i=Un(e),a;if(i.date){let e=Wn(i.date,r);a=Gn(e.restDateString,e.year)}if(!a||isNaN(+a))return n();let o=+a,s=0,c;if(i.time&&(s=Kn(i.time),isNaN(s)))return n();if(i.timezone){if(c=Jn(i.timezone),isNaN(c))return n()}else{let e=new Date(o+s),n=S(0,t?.in);return n.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),n.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),n}return S(o+s+c,t?.in)}var Q={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Bn=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,Vn=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Hn=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Un(e){let t={},n=e.split(Q.dateTimeDelimiter),r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],Q.timeZoneDelimiter.test(t.date)&&(t.date=e.split(Q.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){let e=Q.timezone.exec(r);e?(t.time=r.replace(e[1],``),t.timezone=e[1]):t.time=r}return t}function Wn(e,t){let n=RegExp(`^(?:(\\d{4}|[+-]\\d{`+(4+t)+`})|(\\d{2}|[+-]\\d{`+(2+t)+`})$)`),r=e.match(n);if(!r)return{year:NaN,restDateString:``};let i=r[1]?parseInt(r[1]):null,a=r[2]?parseInt(r[2]):null;return{year:a===null?i:a*100,restDateString:e.slice((r[1]||r[2]).length)}}function Gn(e,t){if(t===null)return new Date(NaN);let n=e.match(Bn);if(!n)return new Date(NaN);let r=!!n[4],i=$(n[1]),a=$(n[2])-1,o=$(n[3]),s=$(n[4]),c=$(n[5])-1;if(r)return er(t,s,c)?Yn(t,s,c):new Date(NaN);{let e=new Date(0);return!Qn(t,a,o)||!$n(t,i)?new Date(NaN):(e.setUTCFullYear(t,a,Math.max(i,o)),e)}}function $(e){return e?parseInt(e):1}function Kn(e){let t=e.match(Vn);if(!t)return NaN;let n=qn(t[1]),r=qn(t[2]),i=qn(t[3]);return tr(n,r,i)?n*b+r*y+i*1e3:NaN}function qn(e){return e&&parseFloat(e.replace(`,`,`.`))||0}function Jn(e){if(e===`Z`)return 0;let t=e.match(Hn);if(!t)return 0;let n=t[1]===`+`?-1:1,r=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return nr(r,i)?n*(r*b+i*y):NaN}function Yn(e,t,n){let r=new Date(0);r.setUTCFullYear(e,0,4);let i=r.getUTCDay()||7,a=(t-1)*7+n+1-i;return r.setUTCDate(r.getUTCDate()+a),r}var Xn=[31,null,31,30,31,30,31,31,30,31,30,31];function Zn(e){return e%400==0||e%4==0&&e%100!=0}function Qn(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(Xn[t]||(Zn(e)?29:28))}function $n(e,t){return t>=1&&t<=(Zn(e)?366:365)}function er(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function tr(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function nr(e,t){return t>=0&&t<=59}var rr={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`};m._date.override({_id:`date-fns`,formats:function(){return rr},parse:function(e,t){if(e==null)return null;let n=typeof e;return n===`number`||e instanceof Date?e=S(e):n===`string`&&(e=typeof t==`string`?Pn(e,t,new Date,this.options):zn(e,this.options)),Oe(e)?e.getTime():null},format:function(e,t){return Ot(e,t,this.options)},add:function(e,t,n){switch(n){case`millisecond`:return T(e,t);case`second`:return we(e,t);case`minute`:return Se(e,t);case`hour`:return _e(e,t);case`day`:return C(e,t);case`week`:return Te(e,t);case`month`:return w(e,t);case`quarter`:return Ce(e,t);case`year`:return Ee(e,t);default:return e}},diff:function(e,t,n){switch(n){case`millisecond`:return P(e,t);case`second`:return Be(e,t);case`minute`:return Pe(e,t);case`hour`:return Ne(e,t);case`day`:return je(e,t);case`week`:return Ve(e,t);case`month`:return Re(e,t);case`quarter`:return ze(e,t);case`year`:return He(e,t);default:return 0}},startOf:function(e,t,n){switch(t){case`second`:return Rn(e);case`minute`:return Ln(e);case`hour`:return In(e);case`day`:return j(e);case`week`:return D(e);case`isoWeek`:return D(e,{weekStartsOn:+n});case`month`:return We(e);case`quarter`:return Ue(e);case`year`:return Ke(e);default:return e}},endOf:function(e,t){switch(t){case`second`:return Ze(e);case`minute`:return Ye(e);case`hour`:return qe(e);case`day`:return Fe(e);case`week`:return Je(e);case`month`:return Ie(e);case`quarter`:return Xe(e);case`year`:return Ge(e);default:return e}}});export{de as t}; \ No newline at end of file diff --git a/repeater/web/html/assets/constants-CqNUcWkW.js b/repeater/web/html/assets/constants-CqNUcWkW.js new file mode 100644 index 0000000..77ade1c --- /dev/null +++ b/repeater/web/html/assets/constants-CqNUcWkW.js @@ -0,0 +1 @@ +var e=`/api/needs_setup`,t=5e3,n=1e3;export{e as n,n as r,t}; \ No newline at end of file diff --git a/repeater/web/html/assets/dataService-CLvdg62X.js b/repeater/web/html/assets/dataService-CLvdg62X.js new file mode 100644 index 0000000..a219cbe --- /dev/null +++ b/repeater/web/html/assets/dataService-CLvdg62X.js @@ -0,0 +1 @@ +import{J as e,Y as t,o as n}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{t as r,v as i}from"./api-C0ctTLHN.js";import{t as a}from"./packets-B7XZyaZ9.js";import{t as o}from"./system-Dx7MrhAz.js";var s={0:`Unknown`,1:`Chat Node`,2:`Repeater`,3:`Room Server`,4:`Hybrid Node`},c=i(`neighbors`,()=>{let e=t({}),i=t(!1),a=t(null),o=t(48),c=n(()=>Object.values(e.value).flat()),l=n(()=>c.value.length);function u(e=10*6e4){return a.value===null?!0:Date.now()-a.value>e}async function d(t=o.value){i.value=!0,o.value=t;let n=Object.entries(s),c=await Promise.allSettled(n.map(async([e,n])=>{try{let i=[],a=0,o=0;for(;o<200;){let e=await r.get(`/adverts_by_contact_type?contact_type=${encodeURIComponent(n)}&hours=${t}&limit=500&offset=${a}`),s=e.success&&Array.isArray(e.data)?e.data:[];if(s.length===0||(i.push(...s),s.length<500))break;a+=500,o+=1}return{typeKey:e,adverts:i}}catch{return{typeKey:e,adverts:[]}}})),l={};for(let e of c)e.status===`fulfilled`&&e.value.adverts.length>0&&(l[e.value.typeKey]=e.value.adverts);e.value=l,a.value=Date.now(),i.value=!1}function f(){e.value={},i.value=!1,a.value=null,o.value=48}return{advertsByType:e,isLoading:i,lastFetched:a,currentHours:o,allAdverts:c,totalCount:l,isStale:u,fetchAll:d,reset:f}}),l={stats:3e4,packetStats:6e4,noiseFloor:15e3,recentPackets:3e4,sparklines:3e5,advertTier:6e4,neighbors:10*6e4},u=i(`dataService`,()=>{let n=o(),i=a(),s=c(),u=t({currentTier:`unknown`,advertsAllowed:0,advertsDropped:0,activePenalties:0}),d=t(!1),f=t(null),p=e({stats:`pending`,packetStats:`pending`,noiseFloor:`pending`,recentPackets:`pending`,sparklines:`pending`,advertTier:`pending`,neighbors:`pending`}),m=new Map,h=new Map,g=[],_=!1,v=null;async function y(e,t=2){for(let n=0;nsetTimeout(e,500*2**n))}throw Error(`unreachable`)}async function b(){try{let e=(await r.get(`/advert_rate_limit_stats`))?.data;u.value={currentTier:typeof e?.adaptive?.current_tier==`string`?e.adaptive.current_tier:`unknown`,advertsAllowed:e?.stats?.adverts_allowed||0,advertsDropped:e?.stats?.adverts_dropped||0,activePenalties:Object.keys(e?.active_penalties||{}).length},m.set(`advertTier`,Date.now())}catch{}}async function x(e){if(e===`neighbors`){if(!s.isStale())return}else{let t=m.get(e);if(t!==void 0&&Date.now()-t{m.set(`stats`,Date.now())});break;case`packetStats`:r=i.fetchPacketStats({hours:24}).then(()=>{m.set(`packetStats`,Date.now())});break;case`noiseFloor`:r=i.fetchNoiseFloorHistory({hours:24,limit:500}).then(()=>{m.set(`noiseFloor`,Date.now())});break;case`recentPackets`:r=i.fetchRecentPackets({limit:100}).then(()=>{m.set(`recentPackets`,Date.now())});break;case`sparklines`:r=i.initializeSparklineHistory().then(()=>{m.set(`sparklines`,Date.now())});break;case`advertTier`:r=b();break;case`neighbors`:r=s.fetchAll(s.currentHours).then(()=>{});break}return h.set(e,r),r.finally(()=>h.delete(e)),r}async function S(e,t){p[e]=`loading`;try{await t(),p[e]=`done`}catch{p[e]=`error`}}async function C(){if(!_){_=!0,d.value=!0,p.stats=`loading`,f.value=`requesting`;try{await y(()=>n.fetchStats({onFirstByte:()=>{f.value=`reading`}})),m.set(`stats`,Date.now()),p.stats=`done`}catch{p.stats=`error`,console.error(`[DataService] Failed to fetch stats after retries`)}finally{f.value=null}await Promise.allSettled([S(`packetStats`,()=>i.fetchPacketStats({hours:24}).then(()=>{m.set(`packetStats`,Date.now())})),S(`noiseFloor`,()=>i.fetchNoiseFloorHistory({hours:24,limit:500}).then(()=>{m.set(`noiseFloor`,Date.now())})),S(`recentPackets`,()=>i.fetchRecentPackets({limit:100}).then(()=>{m.set(`recentPackets`,Date.now())}))]),await Promise.allSettled([S(`sparklines`,()=>i.initializeSparklineHistory().then(()=>{m.set(`sparklines`,Date.now())})),S(`advertTier`,()=>b()),S(`neighbors`,()=>s.fetchAll(s.currentHours).then(()=>{}))]),d.value=!1,w()}}function w(){O(),g.push(window.setInterval(()=>void x(`advertTier`),3e4)),g.push(window.setInterval(()=>void x(`packetStats`),6e4)),g.push(window.setInterval(()=>void x(`noiseFloor`),15e3)),g.push(window.setInterval(()=>void x(`sparklines`),3e5)),g.push(window.setInterval(()=>{let e=n.lastUpdated?.getTime()??0;Date.now()-e>25e3&&x(`stats`)},3e4))}function T(){v=Math.floor(Date.now()/1e3)}async function E(e){try{let t=await r.get(`/filtered_packets`,{start_timestamp:e,limit:1e3});t.success&&t.data&&(i.mergeRecentPackets(t.data),m.set(`recentPackets`,Date.now()))}catch{}}async function D(){await new Promise(e=>setTimeout(e,3e3));let e=Math.floor(Date.now()/1e3)-600,t=v===null?e:Math.max(v,e);v=null,await Promise.allSettled([x(`stats`),x(`packetStats`),E(t)])}function O(){for(let e of g)clearInterval(e);g=[]}function k(){O(),_=!1,m.clear(),h.clear(),d.value=!1,Object.keys(p).forEach(e=>{p[e]=`pending`}),u.value={currentTier:`unknown`,advertsAllowed:0,advertsDropped:0,activePenalties:0}}return{advertTier:u,isBootstrapping:d,statsSubStatus:f,loadProgress:p,bootstrap:C,ensure:x,noteDisconnect:T,onReconnect:D,stopPolling:O,reset:k}});export{s as n,c as r,u as t}; \ No newline at end of file diff --git a/repeater/web/html/assets/dataService-KNFTsxUb.js b/repeater/web/html/assets/dataService-KNFTsxUb.js deleted file mode 100644 index 97f200e..0000000 --- a/repeater/web/html/assets/dataService-KNFTsxUb.js +++ /dev/null @@ -1 +0,0 @@ -import{J as e,Y as t,o as n}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{n as r}from"./pinia-DP0dFoGY.js";import{t as i}from"./api-DBiYn0RS.js";import{t as a}from"./packets-BBUX0ge1.js";import{t as o}from"./system-BfTzQTOF.js";var s={0:`Unknown`,1:`Chat Node`,2:`Repeater`,3:`Room Server`,4:`Hybrid Node`},c=r(`neighbors`,()=>{let e=t({}),r=t(!1),a=t(null),o=t(48),c=n(()=>Object.values(e.value).flat()),l=n(()=>c.value.length);function u(e=10*6e4){return a.value===null?!0:Date.now()-a.value>e}async function d(t=o.value){r.value=!0,o.value=t;let n=Object.entries(s),c=await Promise.allSettled(n.map(async([e,n])=>{try{let r=[],a=0,o=0;for(;o<200;){let e=await i.get(`/adverts_by_contact_type?contact_type=${encodeURIComponent(n)}&hours=${t}&limit=500&offset=${a}`),s=e.success&&Array.isArray(e.data)?e.data:[];if(s.length===0||(r.push(...s),s.length<500))break;a+=500,o+=1}return{typeKey:e,adverts:r}}catch{return{typeKey:e,adverts:[]}}})),l={};for(let e of c)e.status===`fulfilled`&&e.value.adverts.length>0&&(l[e.value.typeKey]=e.value.adverts);e.value=l,a.value=Date.now(),r.value=!1}function f(){e.value={},r.value=!1,a.value=null,o.value=48}return{advertsByType:e,isLoading:r,lastFetched:a,currentHours:o,allAdverts:c,totalCount:l,isStale:u,fetchAll:d,reset:f}}),l={stats:3e4,packetStats:6e4,noiseFloor:15e3,recentPackets:3e4,sparklines:3e5,advertTier:6e4,neighbors:10*6e4},u=r(`dataService`,()=>{let n=o(),r=a(),s=c(),u=t({currentTier:`unknown`,advertsAllowed:0,advertsDropped:0,activePenalties:0}),d=t(!1),f=t(null),p=e({stats:`pending`,packetStats:`pending`,noiseFloor:`pending`,recentPackets:`pending`,sparklines:`pending`,advertTier:`pending`,neighbors:`pending`}),m=new Map,h=new Map,g=[],_=!1,v=null;async function y(e,t=2){for(let n=0;nsetTimeout(e,500*2**n))}throw Error(`unreachable`)}async function b(){try{let e=(await i.get(`/advert_rate_limit_stats`))?.data;u.value={currentTier:typeof e?.adaptive?.current_tier==`string`?e.adaptive.current_tier:`unknown`,advertsAllowed:e?.stats?.adverts_allowed||0,advertsDropped:e?.stats?.adverts_dropped||0,activePenalties:Object.keys(e?.active_penalties||{}).length},m.set(`advertTier`,Date.now())}catch{}}async function x(e){if(e===`neighbors`){if(!s.isStale())return}else{let t=m.get(e);if(t!==void 0&&Date.now()-t{m.set(`stats`,Date.now())});break;case`packetStats`:i=r.fetchPacketStats({hours:24}).then(()=>{m.set(`packetStats`,Date.now())});break;case`noiseFloor`:i=r.fetchNoiseFloorHistory({hours:24,limit:500}).then(()=>{m.set(`noiseFloor`,Date.now())});break;case`recentPackets`:i=r.fetchRecentPackets({limit:100}).then(()=>{m.set(`recentPackets`,Date.now())});break;case`sparklines`:i=r.initializeSparklineHistory().then(()=>{m.set(`sparklines`,Date.now())});break;case`advertTier`:i=b();break;case`neighbors`:i=s.fetchAll(s.currentHours).then(()=>{});break}return h.set(e,i),i.finally(()=>h.delete(e)),i}async function S(e,t){p[e]=`loading`;try{await t(),p[e]=`done`}catch{p[e]=`error`}}async function C(){if(!_){_=!0,d.value=!0,p.stats=`loading`,f.value=`requesting`;try{await y(()=>n.fetchStats({onFirstByte:()=>{f.value=`reading`}})),m.set(`stats`,Date.now()),p.stats=`done`}catch{p.stats=`error`,console.error(`[DataService] Failed to fetch stats after retries`)}finally{f.value=null}await Promise.allSettled([S(`packetStats`,()=>r.fetchPacketStats({hours:24}).then(()=>{m.set(`packetStats`,Date.now())})),S(`noiseFloor`,()=>r.fetchNoiseFloorHistory({hours:24,limit:500}).then(()=>{m.set(`noiseFloor`,Date.now())})),S(`recentPackets`,()=>r.fetchRecentPackets({limit:100}).then(()=>{m.set(`recentPackets`,Date.now())}))]),await Promise.allSettled([S(`sparklines`,()=>r.initializeSparklineHistory().then(()=>{m.set(`sparklines`,Date.now())})),S(`advertTier`,()=>b()),S(`neighbors`,()=>s.fetchAll(s.currentHours).then(()=>{}))]),d.value=!1,w()}}function w(){O(),g.push(window.setInterval(()=>void x(`advertTier`),3e4)),g.push(window.setInterval(()=>void x(`packetStats`),6e4)),g.push(window.setInterval(()=>void x(`noiseFloor`),15e3)),g.push(window.setInterval(()=>void x(`sparklines`),3e5)),g.push(window.setInterval(()=>{let e=n.lastUpdated?.getTime()??0;Date.now()-e>25e3&&x(`stats`)},3e4))}function T(){v=Math.floor(Date.now()/1e3)}async function E(e){try{let t=await i.get(`/filtered_packets`,{start_timestamp:e,limit:1e3});t.success&&t.data&&(r.mergeRecentPackets(t.data),m.set(`recentPackets`,Date.now()))}catch{}}async function D(){await new Promise(e=>setTimeout(e,3e3));let e=Math.floor(Date.now()/1e3)-600,t=v===null?e:Math.max(v,e);v=null,await Promise.allSettled([x(`stats`),x(`packetStats`),E(t)])}function O(){for(let e of g)clearInterval(e);g=[]}function k(){O(),_=!1,m.clear(),h.clear(),d.value=!1,Object.keys(p).forEach(e=>{p[e]=`pending`}),u.value={currentTier:`unknown`,advertsAllowed:0,advertsDropped:0,activePenalties:0}}return{advertTier:u,isBootstrapping:d,statsSubStatus:f,loadProgress:p,bootstrap:C,ensure:x,noteDisconnect:T,onReconnect:D,stopPolling:O,reset:k}});export{s as n,c as r,u as t}; \ No newline at end of file diff --git a/repeater/web/html/assets/index-BUI2F6Oi.css b/repeater/web/html/assets/index-BUI2F6Oi.css new file mode 100644 index 0000000..b6a4887 --- /dev/null +++ b/repeater/web/html/assets/index-BUI2F6Oi.css @@ -0,0 +1,2 @@ +/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */ +@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-red-900:oklch(39.6% .141 25.723);--color-orange-100:oklch(95.4% .038 75.164);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-amber-900:oklch(41.4% .112 45.904);--color-yellow-50:oklch(98.7% .026 102.212);--color-yellow-100:oklch(97.3% .071 103.193);--color-yellow-200:oklch(94.5% .129 101.54);--color-yellow-300:oklch(90.5% .182 98.111);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-yellow-600:oklch(68.1% .162 75.834);--color-yellow-700:oklch(55.4% .135 66.442);--color-yellow-800:oklch(47.6% .114 61.907);--color-yellow-900:oklch(42.1% .095 57.708);--color-green-50:oklch(98.2% .018 155.826);--color-green-100:oklch(96.2% .044 156.743);--color-green-200:oklch(92.5% .084 155.995);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-green-800:oklch(44.8% .119 151.328);--color-green-900:oklch(39.3% .095 152.535);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-600:oklch(59.6% .145 163.225);--color-teal-100:oklch(95.3% .051 180.801);--color-teal-500:oklch(70.4% .14 182.503);--color-cyan-50:oklch(98.4% .019 200.873);--color-cyan-200:oklch(91.7% .08 205.041);--color-cyan-300:oklch(86.5% .127 207.078);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-cyan-600:oklch(60.9% .126 221.723);--color-cyan-700:oklch(52% .105 223.128);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-200:oklch(88.2% .059 254.128);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-800:oklch(42.4% .199 265.638);--color-blue-900:oklch(37.9% .146 265.522);--color-indigo-50:oklch(96.2% .018 272.314);--color-indigo-500:oklch(58.5% .233 277.117);--color-purple-200:oklch(90.2% .063 306.703);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-600:oklch(55.8% .288 302.321);--color-pink-100:oklch(94.8% .028 342.258);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-zinc-900:oklch(21% .006 285.885);--color-neutral-900:oklch(20.5% 0 0);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--container-5xl:64rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--ease-in:cubic-bezier(.4, 0, 1, 1);--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0, 0, .2, 1) infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--blur-md:12px;--blur-lg:16px;--blur-xl:24px;--blur-3xl:64px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:Noto Sans,-apple-system,Roboto,Helvetica,sans-serif;line-height:1.5}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.glass-card{--tw-backdrop-blur:blur(50px);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);background:var(--color-glass-bg);border:1px solid var(--color-glass-border);box-shadow:var(--color-glass-shadow);border-radius:10px}.glass-card-green{--tw-backdrop-blur:blur(50px);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);background:var(--color-glass-green-bg);border:1px solid var(--color-glass-green-border);box-shadow:var(--color-glass-green-shadow);border-radius:10px}.glass-card-orange{--tw-backdrop-blur:blur(50px);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);background:var(--color-glass-orange-bg);border:1px solid var(--color-glass-orange-border);box-shadow:var(--color-glass-orange-shadow);border-radius:10px}.bg-mode-segment-forward{background-color:var(--color-accent-green)}@supports (color:color-mix(in lab, red, red)){.bg-mode-segment-forward{background-color:color-mix(in srgb, var(--color-accent-green) 35%, transparent)}}.bg-mode-segment-no-tx{background-color:var(--color-accent-red)}@supports (color:color-mix(in lab, red, red)){.bg-mode-segment-no-tx{background-color:color-mix(in srgb, var(--color-accent-red) 35%, transparent)}}.cfg-page-heading{padding-bottom:calc(var(--spacing) * 2)}.cfg-section{border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-border-subtle);padding:calc(var(--spacing) * 8);background-color:#0000}.cfg-section:is(.dark *){border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.cfg-section:is(.dark *){border-color:color-mix(in oklab, var(--color-border) 10%, transparent)}}.cfg-section:is(.dark *){background-color:#ffffff0d}@supports (color:color-mix(in lab, red, red)){.cfg-section:is(.dark *){background-color:color-mix(in oklab, var(--color-white) 5%, transparent)}}.cfg-card{border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-border-subtle);background-color:#0000}.cfg-card:is(.dark *){border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.cfg-card:is(.dark *){border-color:color-mix(in oklab, var(--color-border) 10%, transparent)}}.cfg-card:is(.dark *){background-color:#ffffff0d}@supports (color:color-mix(in lab, red, red)){.cfg-card:is(.dark *){background-color:color-mix(in oklab, var(--color-white) 5%, transparent)}}.cfg-btn-primary{border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.cfg-btn-primary{border-color:color-mix(in oklab, var(--color-primary) 50%, transparent)}}.cfg-btn-primary{background-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.cfg-btn-primary{background-color:color-mix(in oklab, var(--color-primary) 20%, transparent)}}.cfg-btn-primary{padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-text-primary);transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media (hover:hover){.cfg-btn-primary:hover{background-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.cfg-btn-primary:hover{background-color:color-mix(in oklab, var(--color-primary) 30%, transparent)}}}.cfg-btn-primary:disabled{cursor:not-allowed;opacity:.5}.cfg-btn-primary:is(.dark *){color:var(--color-text-primary)}.cfg-btn-secondary{border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-border-subtle);background-color:var(--color-background-mute);padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-text-primary);transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media (hover:hover){.cfg-btn-secondary:hover{background-color:var(--color-border-subtle)}}.cfg-btn-secondary:disabled{cursor:not-allowed;opacity:.5}.cfg-btn-secondary:is(.dark *){border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.cfg-btn-secondary:is(.dark *){border-color:color-mix(in oklab, var(--color-border) 20%, transparent)}}.cfg-btn-secondary:is(.dark *){background-color:#ffffff0d}@supports (color:color-mix(in lab, red, red)){.cfg-btn-secondary:is(.dark *){background-color:color-mix(in oklab, var(--color-white) 5%, transparent)}}.cfg-btn-secondary:is(.dark *){color:var(--color-text-primary)}@media (hover:hover){.cfg-btn-secondary:is(.dark *):hover{background-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.cfg-btn-secondary:is(.dark *):hover{background-color:color-mix(in oklab, var(--color-white) 10%, transparent)}}}.btn-primary{border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.btn-primary{border-color:color-mix(in oklab, var(--color-primary) 50%, transparent)}}.btn-primary{background-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.btn-primary{background-color:color-mix(in oklab, var(--color-primary) 20%, transparent)}}.btn-primary{padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);color:var(--color-primary);transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media (hover:hover){.btn-primary:hover{background-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.btn-primary:hover{background-color:color-mix(in oklab, var(--color-primary) 30%, transparent)}}}.btn-primary:disabled{cursor:not-allowed;opacity:.5}.btn-danger{border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-accent-red)}@supports (color:color-mix(in lab, red, red)){.btn-danger{border-color:color-mix(in oklab, var(--color-accent-red) 50%, transparent)}}.btn-danger{background-color:var(--color-accent-red)}@supports (color:color-mix(in lab, red, red)){.btn-danger{background-color:color-mix(in oklab, var(--color-accent-red) 20%, transparent)}}.btn-danger{padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);color:var(--color-accent-red);transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media (hover:hover){.btn-danger:hover{background-color:var(--color-accent-red)}@supports (color:color-mix(in lab, red, red)){.btn-danger:hover{background-color:color-mix(in oklab, var(--color-accent-red) 30%, transparent)}}}.btn-danger:disabled{cursor:not-allowed;opacity:.5}.btn-success{border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-accent-green)}@supports (color:color-mix(in lab, red, red)){.btn-success{border-color:color-mix(in oklab, var(--color-accent-green) 50%, transparent)}}.btn-success{background-color:var(--color-accent-green)}@supports (color:color-mix(in lab, red, red)){.btn-success{background-color:color-mix(in oklab, var(--color-accent-green) 20%, transparent)}}.btn-success{padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);color:var(--color-accent-green);transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media (hover:hover){.btn-success:hover{background-color:var(--color-accent-green)}@supports (color:color-mix(in lab, red, red)){.btn-success:hover{background-color:color-mix(in oklab, var(--color-accent-green) 30%, transparent)}}}.btn-success:disabled{cursor:not-allowed;opacity:.5}.btn-secondary{border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-border-subtle);background-color:var(--color-background-mute);padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-text-primary);transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media (hover:hover){.btn-secondary:hover{background-color:var(--color-border-subtle)}}.btn-secondary:disabled{cursor:not-allowed;opacity:.5}.btn-secondary:is(.dark *){border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.btn-secondary:is(.dark *){border-color:color-mix(in oklab, var(--color-border) 20%, transparent)}}.btn-secondary:is(.dark *){background-color:#ffffff0d}@supports (color:color-mix(in lab, red, red)){.btn-secondary:is(.dark *){background-color:color-mix(in oklab, var(--color-white) 5%, transparent)}}.btn-secondary:is(.dark *){color:var(--color-text-primary)}@media (hover:hover){.btn-secondary:is(.dark *):hover{background-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.btn-secondary:is(.dark *):hover{background-color:color-mix(in oklab, var(--color-white) 10%, transparent)}}}.btn-primary-xs{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-primary);border-radius:.25rem}@supports (color:color-mix(in lab, red, red)){.btn-primary-xs{border-color:color-mix(in oklab, var(--color-primary) 50%, transparent)}}.btn-primary-xs{background-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.btn-primary-xs{background-color:color-mix(in oklab, var(--color-primary) 20%, transparent)}}.btn-primary-xs{padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 1);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-primary);transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media (hover:hover){.btn-primary-xs:hover{background-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.btn-primary-xs:hover{background-color:color-mix(in oklab, var(--color-primary) 30%, transparent)}}}.btn-primary-xs:disabled{cursor:not-allowed;opacity:.5}.btn-danger-xs{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-accent-red);border-radius:.25rem}@supports (color:color-mix(in lab, red, red)){.btn-danger-xs{border-color:color-mix(in oklab, var(--color-accent-red) 50%, transparent)}}.btn-danger-xs{background-color:var(--color-accent-red)}@supports (color:color-mix(in lab, red, red)){.btn-danger-xs{background-color:color-mix(in oklab, var(--color-accent-red) 20%, transparent)}}.btn-danger-xs{padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 1);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-accent-red);transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media (hover:hover){.btn-danger-xs:hover{background-color:var(--color-accent-red)}@supports (color:color-mix(in lab, red, red)){.btn-danger-xs:hover{background-color:color-mix(in oklab, var(--color-accent-red) 30%, transparent)}}}.btn-danger-xs:disabled{cursor:not-allowed;opacity:.5}.btn-success-xs{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-accent-green);border-radius:.25rem}@supports (color:color-mix(in lab, red, red)){.btn-success-xs{border-color:color-mix(in oklab, var(--color-accent-green) 50%, transparent)}}.btn-success-xs{background-color:var(--color-accent-green)}@supports (color:color-mix(in lab, red, red)){.btn-success-xs{background-color:color-mix(in oklab, var(--color-accent-green) 20%, transparent)}}.btn-success-xs{padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 1);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-accent-green);transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media (hover:hover){.btn-success-xs:hover{background-color:var(--color-accent-green)}@supports (color:color-mix(in lab, red, red)){.btn-success-xs:hover{background-color:color-mix(in oklab, var(--color-accent-green) 30%, transparent)}}}.btn-success-xs:disabled{cursor:not-allowed;opacity:.5}.cfg-input{border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-border-subtle);background-color:var(--color-background-mute);width:100%;padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-text-primary);transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.cfg-input:focus{border-color:var(--color-primary);--tw-outline-style:none;outline-style:none}.cfg-input:is(.dark *){border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.cfg-input:is(.dark *){border-color:color-mix(in oklab, var(--color-border) 10%, transparent)}}.cfg-input:is(.dark *){background-color:#ffffff0d}@supports (color:color-mix(in lab, red, red)){.cfg-input:is(.dark *){background-color:color-mix(in oklab, var(--color-white) 5%, transparent)}}.cfg-input:is(.dark *){color:var(--color-text-primary)}.cfg-select{border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-border-subtle);background-color:var(--color-background-mute);width:100%;padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-text-primary);transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.cfg-select:focus{border-color:var(--color-primary);--tw-outline-style:none;outline-style:none}.cfg-select:is(.dark *){border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.cfg-select:is(.dark *){border-color:color-mix(in oklab, var(--color-border) 10%, transparent)}}.cfg-select:is(.dark *){background-color:#ffffff0d}@supports (color:color-mix(in lab, red, red)){.cfg-select:is(.dark *){background-color:color-mix(in oklab, var(--color-white) 5%, transparent)}}.cfg-select:is(.dark *){color:var(--color-text-primary)}.modal-backdrop{inset:calc(var(--spacing) * 0);z-index:300;background-color:#00000080;justify-content:center;align-items:center;display:flex;position:fixed}@supports (color:color-mix(in lab, red, red)){.modal-backdrop{background-color:color-mix(in oklab, var(--color-black) 50%, transparent)}}.modal-backdrop{padding:calc(var(--spacing) * 4);--tw-backdrop-blur:blur(var(--blur-lg));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.modal-backdrop-heavy{inset:calc(var(--spacing) * 0);z-index:300;background-color:#000c;justify-content:center;align-items:center;display:flex;position:fixed}@supports (color:color-mix(in lab, red, red)){.modal-backdrop-heavy{background-color:color-mix(in oklab, var(--color-black) 80%, transparent)}}.modal-backdrop-heavy{padding:calc(var(--spacing) * 4);--tw-backdrop-blur:blur(var(--blur-lg));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.modal-card{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-border-subtle);background-color:var(--color-white);width:100%;padding:calc(var(--spacing) * 6);--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);border-radius:20px}.modal-card:is(.dark *){border-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.modal-card:is(.dark *){border-color:color-mix(in oklab, var(--color-white) 10%, transparent)}}.modal-card:is(.dark *){background-color:var(--color-surface-elevated)}.modal-form{gap:calc(var(--spacing) * 4);flex-direction:column;display:flex}.modal-field-label{margin-top:calc(var(--spacing) * 2);margin-bottom:calc(var(--spacing) * 1);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);color:var(--color-text-secondary);display:block}.modal-field-label:is(.dark *){color:var(--color-text-muted)}.modal-field-label-row{margin-top:calc(var(--spacing) * 2);margin-bottom:calc(var(--spacing) * 1);align-items:baseline;gap:calc(var(--spacing) * 3);display:flex}.modal-input{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-border-subtle);background-color:var(--color-background-mute);width:100%;padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-text-primary)}.modal-input::placeholder{color:var(--color-text-muted)}.modal-input{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.modal-input:focus{border-color:var(--color-primary);--tw-outline-style:none;outline-style:none}.modal-input:is(.dark *){border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.modal-input:is(.dark *){border-color:color-mix(in oklab, var(--color-border) 10%, transparent)}}.modal-input:is(.dark *){background-color:#ffffff0d}@supports (color:color-mix(in lab, red, red)){.modal-input:is(.dark *){background-color:color-mix(in oklab, var(--color-white) 5%, transparent)}}.modal-input:is(.dark *){color:var(--color-text-primary)}.modal-input:is(.dark *)::placeholder{color:var(--color-text-muted)}@supports (color:color-mix(in lab, red, red)){.modal-input:is(.dark *)::placeholder{color:color-mix(in oklab, var(--color-text-muted) 50%, transparent)}}.modal-select{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-border-subtle);background-color:var(--color-background-mute);width:100%;padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-text-primary);transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.modal-select:focus{border-color:var(--color-primary);--tw-outline-style:none;outline-style:none}.modal-select:is(.dark *){border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.modal-select:is(.dark *){border-color:color-mix(in oklab, var(--color-border) 10%, transparent)}}.modal-select:is(.dark *){background-color:#ffffff0d}@supports (color:color-mix(in lab, red, red)){.modal-select:is(.dark *){background-color:color-mix(in oklab, var(--color-white) 5%, transparent)}}.modal-select:is(.dark *){color:var(--color-text-primary)}.modal-actions{gap:calc(var(--spacing) * 3);padding-top:calc(var(--spacing) * 2);display:flex}.modal-btn-cancel{border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-border-subtle);background-color:var(--color-background-mute);padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 3);color:var(--color-text-primary);transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration));flex:1}@media (hover:hover){.modal-btn-cancel:hover{background-color:var(--color-border-subtle)}}.modal-btn-cancel:is(.dark *){border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.modal-btn-cancel:is(.dark *){border-color:color-mix(in oklab, var(--color-border) 20%, transparent)}}.modal-btn-cancel:is(.dark *){background-color:#ffffff0d}@supports (color:color-mix(in lab, red, red)){.modal-btn-cancel:is(.dark *){background-color:color-mix(in oklab, var(--color-white) 5%, transparent)}}.modal-btn-cancel:is(.dark *){color:var(--color-text-primary)}@media (hover:hover){.modal-btn-cancel:is(.dark *):hover{background-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.modal-btn-cancel:is(.dark *):hover{background-color:color-mix(in oklab, var(--color-white) 10%, transparent)}}}.modal-btn-primary{border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-primary);flex:1}@supports (color:color-mix(in lab, red, red)){.modal-btn-primary{border-color:color-mix(in oklab, var(--color-primary) 50%, transparent)}}.modal-btn-primary{background-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.modal-btn-primary{background-color:color-mix(in oklab, var(--color-primary) 20%, transparent)}}.modal-btn-primary{padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 3);--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);color:var(--color-primary);transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media (hover:hover){.modal-btn-primary:hover{background-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.modal-btn-primary:hover{background-color:color-mix(in oklab, var(--color-primary) 30%, transparent)}}}.modal-btn-danger{border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-accent-red);flex:1}@supports (color:color-mix(in lab, red, red)){.modal-btn-danger{border-color:color-mix(in oklab, var(--color-accent-red) 50%, transparent)}}.modal-btn-danger{background-color:var(--color-accent-red)}@supports (color:color-mix(in lab, red, red)){.modal-btn-danger{background-color:color-mix(in oklab, var(--color-accent-red) 20%, transparent)}}.modal-btn-danger{padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 3);--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);color:var(--color-accent-red);transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media (hover:hover){.modal-btn-danger:hover{background-color:var(--color-accent-red)}@supports (color:color-mix(in lab, red, red)){.modal-btn-danger:hover{background-color:color-mix(in oklab, var(--color-accent-red) 30%, transparent)}}}}.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.inset-0{inset:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.-top-1{top:calc(var(--spacing) * -1)}.-top-\[79px\]{top:-79px}.-top-\[94px\]{top:-94px}.top-0{top:calc(var(--spacing) * 0)}.top-0\.5{top:calc(var(--spacing) * .5)}.top-1\/2{top:50%}.top-2{top:calc(var(--spacing) * 2)}.top-3{top:calc(var(--spacing) * 3)}.top-4{top:calc(var(--spacing) * 4)}.top-10{top:calc(var(--spacing) * 10)}.top-\[373px\]{top:373px}.top-full{top:100%}.-right-1{right:calc(var(--spacing) * -1)}.-right-6{right:calc(var(--spacing) * -6)}.right-0{right:calc(var(--spacing) * 0)}.right-1{right:calc(var(--spacing) * 1)}.right-2{right:calc(var(--spacing) * 2)}.right-3{right:calc(var(--spacing) * 3)}.right-4{right:calc(var(--spacing) * 4)}.right-5{right:calc(var(--spacing) * 5)}.right-\[5px\]{right:5px}.bottom-0{bottom:calc(var(--spacing) * 0)}.bottom-2{bottom:calc(var(--spacing) * 2)}.bottom-3{bottom:calc(var(--spacing) * 3)}.bottom-5{bottom:calc(var(--spacing) * 5)}.bottom-\[1px\]{bottom:1px}.bottom-full{bottom:100%}.-left-\[92px\]{left:-92px}.left-0{left:calc(var(--spacing) * 0)}.left-0\.5{left:calc(var(--spacing) * .5)}.left-1\/2{left:50%}.left-2{left:calc(var(--spacing) * 2)}.left-3{left:calc(var(--spacing) * 3)}.left-\[246px\]{left:246px}.left-\[575px\]{left:575px}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[150\]{z-index:150}.z-\[200\]{z-index:200}.z-\[250\]{z-index:250}.z-\[300\]{z-index:300}.z-\[350\]{z-index:350}.z-\[400\]{z-index:400}.z-\[450\]{z-index:450}.z-\[500\]{z-index:500}.z-\[9999\]{z-index:9999}.z-\[99999\]{z-index:99999}.col-span-1{grid-column:span 1/span 1}.col-span-2{grid-column:span 2/span 2}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.-mx-3{margin-inline:calc(var(--spacing) * -3)}.mx-1{margin-inline:calc(var(--spacing) * 1)}.mx-2{margin-inline:calc(var(--spacing) * 2)}.mx-4{margin-inline:calc(var(--spacing) * 4)}.mx-auto{margin-inline:auto}.my-8{margin-block:calc(var(--spacing) * 8)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-8{margin-top:calc(var(--spacing) * 8)}.mr-1{margin-right:calc(var(--spacing) * 1)}.mr-1\.5{margin-right:calc(var(--spacing) * 1.5)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mr-3{margin-right:calc(var(--spacing) * 3)}.mr-6{margin-right:calc(var(--spacing) * 6)}.mb-0{margin-bottom:calc(var(--spacing) * 0)}.mb-0\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-5{margin-bottom:calc(var(--spacing) * 5)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.mb-7{margin-bottom:calc(var(--spacing) * 7)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.mb-12{margin-bottom:calc(var(--spacing) * 12)}.ml-0{margin-left:calc(var(--spacing) * 0)}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-1\.5{margin-left:calc(var(--spacing) * 1.5)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-4{margin-left:calc(var(--spacing) * 4)}.ml-6{margin-left:calc(var(--spacing) * 6)}.ml-7{margin-left:calc(var(--spacing) * 7)}.ml-8{margin-left:calc(var(--spacing) * 8)}.ml-12{margin-left:calc(var(--spacing) * 12)}.ml-16{margin-left:calc(var(--spacing) * 16)}.ml-20{margin-left:calc(var(--spacing) * 20)}.ml-24{margin-left:calc(var(--spacing) * 24)}.ml-28{margin-left:calc(var(--spacing) * 28)}.ml-32{margin-left:calc(var(--spacing) * 32)}.ml-auto{margin-left:auto}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.h-1{height:calc(var(--spacing) * 1)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-12{height:calc(var(--spacing) * 12)}.h-16{height:calc(var(--spacing) * 16)}.h-20{height:calc(var(--spacing) * 20)}.h-24{height:calc(var(--spacing) * 24)}.h-32{height:calc(var(--spacing) * 32)}.h-36{height:calc(var(--spacing) * 36)}.h-40{height:calc(var(--spacing) * 40)}.h-48{height:calc(var(--spacing) * 48)}.h-52{height:calc(var(--spacing) * 52)}.h-96{height:calc(var(--spacing) * 96)}.h-\[5\.2rem\]{height:5.2rem}.h-\[6\.5rem\]{height:6.5rem}.h-\[35px\]{height:35px}.h-\[50px\]{height:50px}.h-\[52px\]{height:52px}.h-\[85vh\]{height:85vh}.h-\[512px\]{height:512px}.h-full{height:100%}.max-h-0{max-height:calc(var(--spacing) * 0)}.max-h-32{max-height:calc(var(--spacing) * 32)}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-52{max-height:calc(var(--spacing) * 52)}.max-h-\[80vh\]{max-height:80vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[440px\]{max-height:440px}.max-h-\[600px\]{max-height:600px}.max-h-screen{max-height:100vh}.min-h-\[8rem\]{min-height:8rem}.min-h-\[12rem\]{min-height:12rem}.min-h-\[118px\]{min-height:118px}.min-h-\[220px\]{min-height:220px}.min-h-\[400px\]{min-height:400px}.min-h-screen{min-height:100vh}.w-1{width:calc(var(--spacing) * 1)}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-10{width:calc(var(--spacing) * 10)}.w-11{width:calc(var(--spacing) * 11)}.w-12{width:calc(var(--spacing) * 12)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-24{width:calc(var(--spacing) * 24)}.w-28{width:calc(var(--spacing) * 28)}.w-32{width:calc(var(--spacing) * 32)}.w-36{width:calc(var(--spacing) * 36)}.w-48{width:calc(var(--spacing) * 48)}.w-72{width:calc(var(--spacing) * 72)}.w-80{width:calc(var(--spacing) * 80)}.w-\[35px\]{width:35px}.w-\[285px\]{width:285px}.w-\[705px\]{width:705px}.w-full{width:100%}.w-px{width:1px}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-5xl{max-width:var(--container-5xl)}.max-w-32{max-width:calc(var(--spacing) * 32)}.max-w-\[12rem\]{max-width:12rem}.max-w-\[80px\]{max-width:80px}.max-w-\[140px\]{max-width:140px}.max-w-full{max-width:100%}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-48{min-width:calc(var(--spacing) * 48)}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[280px\]{min-width:280px}.min-w-\[540px\]{min-width:540px}.min-w-\[760px\]{min-width:760px}.min-w-full{min-width:100%}.flex-1{flex:1}.flex-shrink{flex-shrink:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.-translate-x-1\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-x-full{--tw-translate-x:-100%;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-0{--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-0\.5{--tw-translate-x:calc(var(--spacing) * .5);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-4{--tw-translate-x:calc(var(--spacing) * 4);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-5{--tw-translate-x:calc(var(--spacing) * 5);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-0{--tw-translate-y:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-3{--tw-translate-y:calc(var(--spacing) * 3);translate:var(--tw-translate-x) var(--tw-translate-y)}.scale-0{--tw-scale-x:0%;--tw-scale-y:0%;--tw-scale-z:0%;scale:var(--tw-scale-x) var(--tw-scale-y)}.scale-95{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.scale-100{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x) var(--tw-scale-y)}.scale-105{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.-rotate-\[24\.22deg\]{rotate:-24.22deg}.rotate-0{rotate:0deg}.rotate-90{rotate:90deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-ping{animation:var(--animate-ping)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-help{cursor:help}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize{resize:both}.resize-none{resize:none}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.grid-cols-\[150px_minmax\(0\,1fr\)\]{grid-template-columns:150px minmax(0,1fr)}.grid-cols-\[minmax\(110px\,0\.75fr\)_minmax\(0\,1fr\)\]{grid-template-columns:minmax(110px,.75fr) minmax(0,1fr)}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-evenly{justify-content:space-evenly}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-6{gap:calc(var(--spacing) * 6)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-12>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 12) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 12) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-x-5{column-gap:calc(var(--spacing) * 5)}.gap-x-8{column-gap:calc(var(--spacing) * 8)}:where(.space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 2) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-3>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 3) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-x-reverse)))}.gap-y-0{row-gap:calc(var(--spacing) * 0)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.gap-y-3{row-gap:calc(var(--spacing) * 3)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-gray-200>:not(:last-child)){border-color:var(--color-gray-200)}:where(.divide-stroke-subtle>:not(:last-child)){border-color:var(--color-border-subtle)}.self-center{align-self:center}.self-stretch{align-self:stretch}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-\[\.625rem\]{border-radius:.625rem}.rounded-\[5px\]{border-radius:5px}.rounded-\[8px\]{border-radius:8px}.rounded-\[10px\]{border-radius:10px}.rounded-\[12px\]{border-radius:12px}.rounded-\[15px\]{border-radius:15px}.rounded-\[16px\]{border-radius:16px}.rounded-\[20px\]{border-radius:20px}.rounded-\[24px\]{border-radius:24px}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-l-lg{border-top-left-radius:var(--radius-lg);border-bottom-left-radius:var(--radius-lg)}.rounded-r-lg{border-top-right-radius:var(--radius-lg);border-bottom-right-radius:var(--radius-lg)}.rounded-b-\[15px\]{border-bottom-right-radius:15px;border-bottom-left-radius:15px}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-3{border-style:var(--tw-border-style);border-width:3px}.border-4{border-style:var(--tw-border-style);border-width:4px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-r-0{border-right-style:var(--tw-border-style);border-right-width:0}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-accent-cyan,.border-accent-cyan\/20{border-color:var(--color-accent-cyan)}@supports (color:color-mix(in lab, red, red)){.border-accent-cyan\/20{border-color:color-mix(in oklab, var(--color-accent-cyan) 20%, transparent)}}.border-accent-cyan\/30{border-color:var(--color-accent-cyan)}@supports (color:color-mix(in lab, red, red)){.border-accent-cyan\/30{border-color:color-mix(in oklab, var(--color-accent-cyan) 30%, transparent)}}.border-accent-cyan\/50{border-color:var(--color-accent-cyan)}@supports (color:color-mix(in lab, red, red)){.border-accent-cyan\/50{border-color:color-mix(in oklab, var(--color-accent-cyan) 50%, transparent)}}.border-accent-green,.border-accent-green\/20{border-color:var(--color-accent-green)}@supports (color:color-mix(in lab, red, red)){.border-accent-green\/20{border-color:color-mix(in oklab, var(--color-accent-green) 20%, transparent)}}.border-accent-green\/30{border-color:var(--color-accent-green)}@supports (color:color-mix(in lab, red, red)){.border-accent-green\/30{border-color:color-mix(in oklab, var(--color-accent-green) 30%, transparent)}}.border-accent-green\/40{border-color:var(--color-accent-green)}@supports (color:color-mix(in lab, red, red)){.border-accent-green\/40{border-color:color-mix(in oklab, var(--color-accent-green) 40%, transparent)}}.border-accent-green\/50{border-color:var(--color-accent-green)}@supports (color:color-mix(in lab, red, red)){.border-accent-green\/50{border-color:color-mix(in oklab, var(--color-accent-green) 50%, transparent)}}.border-accent-green\/60{border-color:var(--color-accent-green)}@supports (color:color-mix(in lab, red, red)){.border-accent-green\/60{border-color:color-mix(in oklab, var(--color-accent-green) 60%, transparent)}}.border-accent-purple\/50{border-color:var(--color-accent-purple)}@supports (color:color-mix(in lab, red, red)){.border-accent-purple\/50{border-color:color-mix(in oklab, var(--color-accent-purple) 50%, transparent)}}.border-accent-red\/20{border-color:var(--color-accent-red)}@supports (color:color-mix(in lab, red, red)){.border-accent-red\/20{border-color:color-mix(in oklab, var(--color-accent-red) 20%, transparent)}}.border-accent-red\/30{border-color:var(--color-accent-red)}@supports (color:color-mix(in lab, red, red)){.border-accent-red\/30{border-color:color-mix(in oklab, var(--color-accent-red) 30%, transparent)}}.border-accent-red\/40{border-color:var(--color-accent-red)}@supports (color:color-mix(in lab, red, red)){.border-accent-red\/40{border-color:color-mix(in oklab, var(--color-accent-red) 40%, transparent)}}.border-accent-red\/50{border-color:var(--color-accent-red)}@supports (color:color-mix(in lab, red, red)){.border-accent-red\/50{border-color:color-mix(in oklab, var(--color-accent-red) 50%, transparent)}}.border-amber-200{border-color:var(--color-amber-200)}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab, red, red)){.border-amber-500\/30{border-color:color-mix(in oklab, var(--color-amber-500) 30%, transparent)}}.border-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab, red, red)){.border-amber-500\/40{border-color:color-mix(in oklab, var(--color-amber-500) 40%, transparent)}}.border-amber-500\/50{border-color:#f99c0080}@supports (color:color-mix(in lab, red, red)){.border-amber-500\/50{border-color:color-mix(in oklab, var(--color-amber-500) 50%, transparent)}}.border-black\/6{border-color:#0000000f}@supports (color:color-mix(in lab, red, red)){.border-black\/6{border-color:color-mix(in oklab, var(--color-black) 6%, transparent)}}.border-blue-200{border-color:var(--color-blue-200)}.border-blue-500\/20{border-color:#3080ff33}@supports (color:color-mix(in lab, red, red)){.border-blue-500\/20{border-color:color-mix(in oklab, var(--color-blue-500) 20%, transparent)}}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab, red, red)){.border-blue-500\/30{border-color:color-mix(in oklab, var(--color-blue-500) 30%, transparent)}}.border-blue-500\/50{border-color:#3080ff80}@supports (color:color-mix(in lab, red, red)){.border-blue-500\/50{border-color:color-mix(in oklab, var(--color-blue-500) 50%, transparent)}}.border-current{border-color:currentColor}.border-cyan-400\/30{border-color:#00d2ef4d}@supports (color:color-mix(in lab, red, red)){.border-cyan-400\/30{border-color:color-mix(in oklab, var(--color-cyan-400) 30%, transparent)}}.border-cyan-400\/40{border-color:#00d2ef66}@supports (color:color-mix(in lab, red, red)){.border-cyan-400\/40{border-color:color-mix(in oklab, var(--color-cyan-400) 40%, transparent)}}.border-cyan-500{border-color:var(--color-cyan-500)}.border-cyan-500\/30{border-color:#00b7d74d}@supports (color:color-mix(in lab, red, red)){.border-cyan-500\/30{border-color:color-mix(in oklab, var(--color-cyan-500) 30%, transparent)}}.border-cyan-600{border-color:var(--color-cyan-600)}.border-gray-400{border-color:var(--color-gray-400)}.border-gray-400\/30{border-color:#99a1af4d}@supports (color:color-mix(in lab, red, red)){.border-gray-400\/30{border-color:color-mix(in oklab, var(--color-gray-400) 30%, transparent)}}.border-gray-500\/50{border-color:#6a728280}@supports (color:color-mix(in lab, red, red)){.border-gray-500\/50{border-color:color-mix(in oklab, var(--color-gray-500) 50%, transparent)}}.border-green-200{border-color:var(--color-green-200)}.border-green-300{border-color:var(--color-green-300)}.border-green-500{border-color:var(--color-green-500)}.border-green-500\/20{border-color:#00c75833}@supports (color:color-mix(in lab, red, red)){.border-green-500\/20{border-color:color-mix(in oklab, var(--color-green-500) 20%, transparent)}}.border-green-500\/30{border-color:#00c7584d}@supports (color:color-mix(in lab, red, red)){.border-green-500\/30{border-color:color-mix(in oklab, var(--color-green-500) 30%, transparent)}}.border-green-500\/50{border-color:#00c75880}@supports (color:color-mix(in lab, red, red)){.border-green-500\/50{border-color:color-mix(in oklab, var(--color-green-500) 50%, transparent)}}.border-green-600\/40{border-color:#00a54466}@supports (color:color-mix(in lab, red, red)){.border-green-600\/40{border-color:color-mix(in oklab, var(--color-green-600) 40%, transparent)}}.border-orange-500{border-color:var(--color-orange-500)}.border-orange-500\/30{border-color:#fe6e004d}@supports (color:color-mix(in lab, red, red)){.border-orange-500\/30{border-color:color-mix(in oklab, var(--color-orange-500) 30%, transparent)}}.border-primary,.border-primary\/20{border-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.border-primary\/20{border-color:color-mix(in oklab, var(--color-primary) 20%, transparent)}}.border-primary\/30{border-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.border-primary\/30{border-color:color-mix(in oklab, var(--color-primary) 30%, transparent)}}.border-primary\/40{border-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.border-primary\/40{border-color:color-mix(in oklab, var(--color-primary) 40%, transparent)}}.border-primary\/50{border-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.border-primary\/50{border-color:color-mix(in oklab, var(--color-primary) 50%, transparent)}}.border-primary\/60{border-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.border-primary\/60{border-color:color-mix(in oklab, var(--color-primary) 60%, transparent)}}.border-red-300{border-color:var(--color-red-300)}.border-red-500{border-color:var(--color-red-500)}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab, red, red)){.border-red-500\/30{border-color:color-mix(in oklab, var(--color-red-500) 30%, transparent)}}.border-red-500\/40{border-color:#fb2c3666}@supports (color:color-mix(in lab, red, red)){.border-red-500\/40{border-color:color-mix(in oklab, var(--color-red-500) 40%, transparent)}}.border-red-500\/50{border-color:#fb2c3680}@supports (color:color-mix(in lab, red, red)){.border-red-500\/50{border-color:color-mix(in oklab, var(--color-red-500) 50%, transparent)}}.border-secondary,.border-secondary\/20{border-color:var(--color-secondary)}@supports (color:color-mix(in lab, red, red)){.border-secondary\/20{border-color:color-mix(in oklab, var(--color-secondary) 20%, transparent)}}.border-secondary\/30{border-color:var(--color-secondary)}@supports (color:color-mix(in lab, red, red)){.border-secondary\/30{border-color:color-mix(in oklab, var(--color-secondary) 30%, transparent)}}.border-secondary\/40{border-color:var(--color-secondary)}@supports (color:color-mix(in lab, red, red)){.border-secondary\/40{border-color:color-mix(in oklab, var(--color-secondary) 40%, transparent)}}.border-secondary\/50{border-color:var(--color-secondary)}@supports (color:color-mix(in lab, red, red)){.border-secondary\/50{border-color:color-mix(in oklab, var(--color-secondary) 50%, transparent)}}.border-secondary\/70{border-color:var(--color-secondary)}@supports (color:color-mix(in lab, red, red)){.border-secondary\/70{border-color:color-mix(in oklab, var(--color-secondary) 70%, transparent)}}.border-stroke{border-color:var(--color-border)}.border-stroke-hover{border-color:var(--color-border-hover)}.border-stroke-subtle,.border-stroke-subtle\/50{border-color:var(--color-border-subtle)}@supports (color:color-mix(in lab, red, red)){.border-stroke-subtle\/50{border-color:color-mix(in oklab, var(--color-border-subtle) 50%, transparent)}}.border-stroke\/10{border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.border-stroke\/10{border-color:color-mix(in oklab, var(--color-border) 10%, transparent)}}.border-stroke\/20{border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.border-stroke\/20{border-color:color-mix(in oklab, var(--color-border) 20%, transparent)}}.border-transparent{border-color:#0000}.border-white{border-color:var(--color-white)}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.border-white\/10{border-color:color-mix(in oklab, var(--color-white) 10%, transparent)}}.border-white\/20{border-color:#fff3}@supports (color:color-mix(in lab, red, red)){.border-white\/20{border-color:color-mix(in oklab, var(--color-white) 20%, transparent)}}.border-yellow-200{border-color:var(--color-yellow-200)}.border-yellow-300{border-color:var(--color-yellow-300)}.border-yellow-500{border-color:var(--color-yellow-500)}.border-yellow-500\/30{border-color:#edb2004d}@supports (color:color-mix(in lab, red, red)){.border-yellow-500\/30{border-color:color-mix(in oklab, var(--color-yellow-500) 30%, transparent)}}.border-yellow-500\/50{border-color:#edb20080}@supports (color:color-mix(in lab, red, red)){.border-yellow-500\/50{border-color:color-mix(in oklab, var(--color-yellow-500) 50%, transparent)}}.border-t-transparent{border-top-color:#0000}.border-l-accent-cyan{border-left-color:var(--color-accent-cyan)}.border-l-accent-green{border-left-color:var(--color-accent-green)}.border-l-accent-purple{border-left-color:var(--color-accent-purple)}.border-l-accent-red{border-left-color:var(--color-accent-red)}.border-l-amber-500{border-left-color:var(--color-amber-500)}.border-l-gray-500{border-left-color:var(--color-gray-500)}.border-l-green-600{border-left-color:var(--color-green-600)}.border-l-primary{border-left-color:var(--color-primary)}.border-l-secondary{border-left-color:var(--color-secondary)}.bg-accent-bg-cyan{background-color:var(--color-accent-cyan-bg)}.bg-accent-bg-green{background-color:var(--color-accent-green-bg)}.bg-accent-bg-purple{background-color:var(--color-accent-purple-bg)}.bg-accent-bg-red{background-color:var(--color-accent-red-bg)}.bg-accent-cyan,.bg-accent-cyan\/5{background-color:var(--color-accent-cyan)}@supports (color:color-mix(in lab, red, red)){.bg-accent-cyan\/5{background-color:color-mix(in oklab, var(--color-accent-cyan) 5%, transparent)}}.bg-accent-cyan\/10{background-color:var(--color-accent-cyan)}@supports (color:color-mix(in lab, red, red)){.bg-accent-cyan\/10{background-color:color-mix(in oklab, var(--color-accent-cyan) 10%, transparent)}}.bg-accent-cyan\/20{background-color:var(--color-accent-cyan)}@supports (color:color-mix(in lab, red, red)){.bg-accent-cyan\/20{background-color:color-mix(in oklab, var(--color-accent-cyan) 20%, transparent)}}.bg-accent-green,.bg-accent-green\/10{background-color:var(--color-accent-green)}@supports (color:color-mix(in lab, red, red)){.bg-accent-green\/10{background-color:color-mix(in oklab, var(--color-accent-green) 10%, transparent)}}.bg-accent-green\/20{background-color:var(--color-accent-green)}@supports (color:color-mix(in lab, red, red)){.bg-accent-green\/20{background-color:color-mix(in oklab, var(--color-accent-green) 20%, transparent)}}.bg-accent-green\/50{background-color:var(--color-accent-green)}@supports (color:color-mix(in lab, red, red)){.bg-accent-green\/50{background-color:color-mix(in oklab, var(--color-accent-green) 50%, transparent)}}.bg-accent-purple,.bg-accent-purple\/20{background-color:var(--color-accent-purple)}@supports (color:color-mix(in lab, red, red)){.bg-accent-purple\/20{background-color:color-mix(in oklab, var(--color-accent-purple) 20%, transparent)}}.bg-accent-red,.bg-accent-red\/10{background-color:var(--color-accent-red)}@supports (color:color-mix(in lab, red, red)){.bg-accent-red\/10{background-color:color-mix(in oklab, var(--color-accent-red) 10%, transparent)}}.bg-accent-red\/15{background-color:var(--color-accent-red)}@supports (color:color-mix(in lab, red, red)){.bg-accent-red\/15{background-color:color-mix(in oklab, var(--color-accent-red) 15%, transparent)}}.bg-accent-red\/20{background-color:var(--color-accent-red)}@supports (color:color-mix(in lab, red, red)){.bg-accent-red\/20{background-color:color-mix(in oklab, var(--color-accent-red) 20%, transparent)}}.bg-amber-50{background-color:var(--color-amber-50)}.bg-amber-100{background-color:var(--color-amber-100)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/5{background-color:color-mix(in oklab, var(--color-amber-500) 5%, transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/10{background-color:color-mix(in oklab, var(--color-amber-500) 10%, transparent)}}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/20{background-color:color-mix(in oklab, var(--color-amber-500) 20%, transparent)}}.bg-amber-600{background-color:var(--color-amber-600)}.bg-background{background-color:var(--color-background)}.bg-background-mute,.bg-background-mute\/30{background-color:var(--color-background-mute)}@supports (color:color-mix(in lab, red, red)){.bg-background-mute\/30{background-color:color-mix(in oklab, var(--color-background-mute) 30%, transparent)}}.bg-background-mute\/40{background-color:var(--color-background-mute)}@supports (color:color-mix(in lab, red, red)){.bg-background-mute\/40{background-color:color-mix(in oklab, var(--color-background-mute) 40%, transparent)}}.bg-background-mute\/50{background-color:var(--color-background-mute)}@supports (color:color-mix(in lab, red, red)){.bg-background-mute\/50{background-color:color-mix(in oklab, var(--color-background-mute) 50%, transparent)}}.bg-background-soft{background-color:var(--color-background-soft)}.bg-badge-cyan-bg{background-color:var(--color-badge-cyan-bg)}.bg-badge-neutral-bg{background-color:var(--color-badge-neutral-bg)}.bg-black\/5{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bg-black\/5{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab, red, red)){.bg-black\/20{background-color:color-mix(in oklab, var(--color-black) 20%, transparent)}}.bg-black\/30{background-color:#0000004d}@supports (color:color-mix(in lab, red, red)){.bg-black\/30{background-color:color-mix(in oklab, var(--color-black) 30%, transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab, red, red)){.bg-black\/40{background-color:color-mix(in oklab, var(--color-black) 40%, transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\/50{background-color:color-mix(in oklab, var(--color-black) 50%, transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab, red, red)){.bg-black\/60{background-color:color-mix(in oklab, var(--color-black) 60%, transparent)}}.bg-black\/70{background-color:#000000b3}@supports (color:color-mix(in lab, red, red)){.bg-black\/70{background-color:color-mix(in oklab, var(--color-black) 70%, transparent)}}.bg-black\/80{background-color:#000c}@supports (color:color-mix(in lab, red, red)){.bg-black\/80{background-color:color-mix(in oklab, var(--color-black) 80%, transparent)}}.bg-blue-100{background-color:var(--color-blue-100)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-500\/10{background-color:#3080ff1a}@supports (color:color-mix(in lab, red, red)){.bg-blue-500\/10{background-color:color-mix(in oklab, var(--color-blue-500) 10%, transparent)}}.bg-blue-500\/15{background-color:#3080ff26}@supports (color:color-mix(in lab, red, red)){.bg-blue-500\/15{background-color:color-mix(in oklab, var(--color-blue-500) 15%, transparent)}}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab, red, red)){.bg-blue-500\/20{background-color:color-mix(in oklab, var(--color-blue-500) 20%, transparent)}}.bg-blue-900\/20{background-color:#1c398e33}@supports (color:color-mix(in lab, red, red)){.bg-blue-900\/20{background-color:color-mix(in oklab, var(--color-blue-900) 20%, transparent)}}.bg-content-muted\/50{background-color:var(--color-text-muted)}@supports (color:color-mix(in lab, red, red)){.bg-content-muted\/50{background-color:color-mix(in oklab, var(--color-text-muted) 50%, transparent)}}.bg-content-primary{background-color:var(--color-text-primary)}.bg-current,.bg-current\/10{background-color:currentColor}@supports (color:color-mix(in lab, red, red)){.bg-current\/10{background-color:color-mix(in oklab, currentcolor 10%, transparent)}}.bg-cyan-400{background-color:var(--color-cyan-400)}.bg-cyan-400\/20{background-color:#00d2ef33}@supports (color:color-mix(in lab, red, red)){.bg-cyan-400\/20{background-color:color-mix(in oklab, var(--color-cyan-400) 20%, transparent)}}.bg-cyan-500\/10{background-color:#00b7d71a}@supports (color:color-mix(in lab, red, red)){.bg-cyan-500\/10{background-color:color-mix(in oklab, var(--color-cyan-500) 10%, transparent)}}.bg-cyan-500\/20{background-color:#00b7d733}@supports (color:color-mix(in lab, red, red)){.bg-cyan-500\/20{background-color:color-mix(in oklab, var(--color-cyan-500) 20%, transparent)}}.bg-cyan-600{background-color:var(--color-cyan-600)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-400{background-color:var(--color-gray-400)}.bg-gray-500{background-color:var(--color-gray-500)}.bg-gray-500\/20{background-color:#6a728233}@supports (color:color-mix(in lab, red, red)){.bg-gray-500\/20{background-color:color-mix(in oklab, var(--color-gray-500) 20%, transparent)}}.bg-gray-900\/20{background-color:#10182833}@supports (color:color-mix(in lab, red, red)){.bg-gray-900\/20{background-color:color-mix(in oklab, var(--color-gray-900) 20%, transparent)}}.bg-green-50{background-color:var(--color-green-50)}.bg-green-100{background-color:var(--color-green-100)}.bg-green-400{background-color:var(--color-green-400)}.bg-green-400\/20{background-color:#05df7233}@supports (color:color-mix(in lab, red, red)){.bg-green-400\/20{background-color:color-mix(in oklab, var(--color-green-400) 20%, transparent)}}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\/5{background-color:#00c7580d}@supports (color:color-mix(in lab, red, red)){.bg-green-500\/5{background-color:color-mix(in oklab, var(--color-green-500) 5%, transparent)}}.bg-green-500\/10{background-color:#00c7581a}@supports (color:color-mix(in lab, red, red)){.bg-green-500\/10{background-color:color-mix(in oklab, var(--color-green-500) 10%, transparent)}}.bg-green-500\/15{background-color:#00c75826}@supports (color:color-mix(in lab, red, red)){.bg-green-500\/15{background-color:color-mix(in oklab, var(--color-green-500) 15%, transparent)}}.bg-green-500\/20{background-color:#00c75833}@supports (color:color-mix(in lab, red, red)){.bg-green-500\/20{background-color:color-mix(in oklab, var(--color-green-500) 20%, transparent)}}.bg-neutral-900{background-color:var(--color-neutral-900)}.bg-orange-100{background-color:var(--color-orange-100)}.bg-orange-400{background-color:var(--color-orange-400)}.bg-orange-400\/20{background-color:#ff8b1a33}@supports (color:color-mix(in lab, red, red)){.bg-orange-400\/20{background-color:color-mix(in oklab, var(--color-orange-400) 20%, transparent)}}.bg-primary{background-color:var(--color-primary)}.bg-primary-bg{background-color:var(--color-primary-bg)}.bg-primary\/5{background-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.bg-primary\/5{background-color:color-mix(in oklab, var(--color-primary) 5%, transparent)}}.bg-primary\/10{background-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.bg-primary\/10{background-color:color-mix(in oklab, var(--color-primary) 10%, transparent)}}.bg-primary\/20{background-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.bg-primary\/20{background-color:color-mix(in oklab, var(--color-primary) 20%, transparent)}}.bg-primary\/30{background-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.bg-primary\/30{background-color:color-mix(in oklab, var(--color-primary) 30%, transparent)}}.bg-primary\/70{background-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.bg-primary\/70{background-color:color-mix(in oklab, var(--color-primary) 70%, transparent)}}.bg-purple-400{background-color:var(--color-purple-400)}.bg-red-50{background-color:var(--color-red-50)}.bg-red-100{background-color:var(--color-red-100)}.bg-red-400{background-color:var(--color-red-400)}.bg-red-500{background-color:var(--color-red-500)}.bg-red-500\/5{background-color:#fb2c360d}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/5{background-color:color-mix(in oklab, var(--color-red-500) 5%, transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/10{background-color:color-mix(in oklab, var(--color-red-500) 10%, transparent)}}.bg-red-500\/15{background-color:#fb2c3626}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/15{background-color:color-mix(in oklab, var(--color-red-500) 15%, transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/20{background-color:color-mix(in oklab, var(--color-red-500) 20%, transparent)}}.bg-red-600{background-color:var(--color-red-600)}.bg-red-600\/20{background-color:#e4001433}@supports (color:color-mix(in lab, red, red)){.bg-red-600\/20{background-color:color-mix(in oklab, var(--color-red-600) 20%, transparent)}}.bg-red-700{background-color:var(--color-red-700)}.bg-red-900\/20{background-color:#82181a33}@supports (color:color-mix(in lab, red, red)){.bg-red-900\/20{background-color:color-mix(in oklab, var(--color-red-900) 20%, transparent)}}.bg-secondary{background-color:var(--color-secondary)}.bg-secondary-bg,.bg-secondary-bg\/20{background-color:var(--color-secondary-bg)}@supports (color:color-mix(in lab, red, red)){.bg-secondary-bg\/20{background-color:color-mix(in oklab, var(--color-secondary-bg) 20%, transparent)}}.bg-secondary\/10{background-color:var(--color-secondary)}@supports (color:color-mix(in lab, red, red)){.bg-secondary\/10{background-color:color-mix(in oklab, var(--color-secondary) 10%, transparent)}}.bg-secondary\/20{background-color:var(--color-secondary)}@supports (color:color-mix(in lab, red, red)){.bg-secondary\/20{background-color:color-mix(in oklab, var(--color-secondary) 20%, transparent)}}.bg-secondary\/40{background-color:var(--color-secondary)}@supports (color:color-mix(in lab, red, red)){.bg-secondary\/40{background-color:color-mix(in oklab, var(--color-secondary) 40%, transparent)}}.bg-stroke-subtle,.bg-stroke-subtle\/40{background-color:var(--color-border-subtle)}@supports (color:color-mix(in lab, red, red)){.bg-stroke-subtle\/40{background-color:color-mix(in oklab, var(--color-border-subtle) 40%, transparent)}}.bg-surface{background-color:var(--color-surface)}.bg-surface-elevated{background-color:var(--color-surface-elevated)}.bg-surface\/50{background-color:var(--color-surface)}@supports (color:color-mix(in lab, red, red)){.bg-surface\/50{background-color:color-mix(in oklab, var(--color-surface) 50%, transparent)}}.bg-surface\/80{background-color:var(--color-surface)}@supports (color:color-mix(in lab, red, red)){.bg-surface\/80{background-color:color-mix(in oklab, var(--color-surface) 80%, transparent)}}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab, red, red)){.bg-white\/5{background-color:color-mix(in oklab, var(--color-white) 5%, transparent)}}.bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.bg-white\/10{background-color:color-mix(in oklab, var(--color-white) 10%, transparent)}}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab, red, red)){.bg-white\/20{background-color:color-mix(in oklab, var(--color-white) 20%, transparent)}}.bg-white\/50{background-color:#ffffff80}@supports (color:color-mix(in lab, red, red)){.bg-white\/50{background-color:color-mix(in oklab, var(--color-white) 50%, transparent)}}.bg-white\/60{background-color:#fff9}@supports (color:color-mix(in lab, red, red)){.bg-white\/60{background-color:color-mix(in oklab, var(--color-white) 60%, transparent)}}.bg-white\/70{background-color:#ffffffb3}@supports (color:color-mix(in lab, red, red)){.bg-white\/70{background-color:color-mix(in oklab, var(--color-white) 70%, transparent)}}.bg-white\/80{background-color:#fffc}@supports (color:color-mix(in lab, red, red)){.bg-white\/80{background-color:color-mix(in oklab, var(--color-white) 80%, transparent)}}.bg-white\/95{background-color:#fffffff2}@supports (color:color-mix(in lab, red, red)){.bg-white\/95{background-color:color-mix(in oklab, var(--color-white) 95%, transparent)}}.bg-yellow-50{background-color:var(--color-yellow-50)}.bg-yellow-100{background-color:var(--color-yellow-100)}.bg-yellow-400{background-color:var(--color-yellow-400)}.bg-yellow-400\/20{background-color:#fac80033}@supports (color:color-mix(in lab, red, red)){.bg-yellow-400\/20{background-color:color-mix(in oklab, var(--color-yellow-400) 20%, transparent)}}.bg-yellow-500{background-color:var(--color-yellow-500)}.bg-yellow-500\/10{background-color:#edb2001a}@supports (color:color-mix(in lab, red, red)){.bg-yellow-500\/10{background-color:color-mix(in oklab, var(--color-yellow-500) 10%, transparent)}}.bg-yellow-500\/20{background-color:#edb20033}@supports (color:color-mix(in lab, red, red)){.bg-yellow-500\/20{background-color:color-mix(in oklab, var(--color-yellow-500) 20%, transparent)}}.bg-yellow-900\/20{background-color:#733e0a33}@supports (color:color-mix(in lab, red, red)){.bg-yellow-900\/20{background-color:color-mix(in oklab, var(--color-yellow-900) 20%, transparent)}}.bg-zinc-900{background-color:var(--color-zinc-900)}.bg-gradient-to-b{--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-t{--tw-gradient-position:to top in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-tl{--tw-gradient-position:to top left in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-accent-green\/10{--tw-gradient-from:var(--color-accent-green)}@supports (color:color-mix(in lab, red, red)){.from-accent-green\/10{--tw-gradient-from:color-mix(in oklab, var(--color-accent-green) 10%, transparent)}}.from-accent-green\/10{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-blue-500\/20{--tw-gradient-from:#3080ff33}@supports (color:color-mix(in lab, red, red)){.from-blue-500\/20{--tw-gradient-from:color-mix(in oklab, var(--color-blue-500) 20%, transparent)}}.from-blue-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-cyan-200\/30{--tw-gradient-from:#a2f4fd4d}@supports (color:color-mix(in lab, red, red)){.from-cyan-200\/30{--tw-gradient-from:color-mix(in oklab, var(--color-cyan-200) 30%, transparent)}}.from-cyan-200\/30{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-cyan-400{--tw-gradient-from:var(--color-cyan-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-cyan-400\/25{--tw-gradient-from:#00d2ef40}@supports (color:color-mix(in lab, red, red)){.from-cyan-400\/25{--tw-gradient-from:color-mix(in oklab, var(--color-cyan-400) 25%, transparent)}}.from-cyan-400\/25{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-cyan-400\/90{--tw-gradient-from:#00d2efe6}@supports (color:color-mix(in lab, red, red)){.from-cyan-400\/90{--tw-gradient-from:color-mix(in oklab, var(--color-cyan-400) 90%, transparent)}}.from-cyan-400\/90{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-cyan-500\/20{--tw-gradient-from:#00b7d733}@supports (color:color-mix(in lab, red, red)){.from-cyan-500\/20{--tw-gradient-from:color-mix(in oklab, var(--color-cyan-500) 20%, transparent)}}.from-cyan-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-cyan-500\/50{--tw-gradient-from:#00b7d780}@supports (color:color-mix(in lab, red, red)){.from-cyan-500\/50{--tw-gradient-from:color-mix(in oklab, var(--color-cyan-500) 50%, transparent)}}.from-cyan-500\/50{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-200\/25{--tw-gradient-from:#a4f4cf40}@supports (color:color-mix(in lab, red, red)){.from-emerald-200\/25{--tw-gradient-from:color-mix(in oklab, var(--color-emerald-200) 25%, transparent)}}.from-emerald-200\/25{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-gray-100{--tw-gradient-from:var(--color-gray-100);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-orange-500\/20{--tw-gradient-from:#fe6e0033}@supports (color:color-mix(in lab, red, red)){.from-orange-500\/20{--tw-gradient-from:color-mix(in oklab, var(--color-orange-500) 20%, transparent)}}.from-orange-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-orange-500\/50{--tw-gradient-from:#fe6e0080}@supports (color:color-mix(in lab, red, red)){.from-orange-500\/50{--tw-gradient-from:color-mix(in oklab, var(--color-orange-500) 50%, transparent)}}.from-orange-500\/50{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-primary{--tw-gradient-from:var(--color-primary);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-primary\/3{--tw-gradient-from:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.from-primary\/3{--tw-gradient-from:color-mix(in oklab, var(--color-primary) 3%, transparent)}}.from-primary\/3{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-primary\/5{--tw-gradient-from:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.from-primary\/5{--tw-gradient-from:color-mix(in oklab, var(--color-primary) 5%, transparent)}}.from-primary\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-primary\/20{--tw-gradient-from:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.from-primary\/20{--tw-gradient-from:color-mix(in oklab, var(--color-primary) 20%, transparent)}}.from-primary\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-primary\/30{--tw-gradient-from:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.from-primary\/30{--tw-gradient-from:color-mix(in oklab, var(--color-primary) 30%, transparent)}}.from-primary\/30{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-purple-200\/25{--tw-gradient-from:#e9d5ff40}@supports (color:color-mix(in lab, red, red)){.from-purple-200\/25{--tw-gradient-from:color-mix(in oklab, var(--color-purple-200) 25%, transparent)}}.from-purple-200\/25{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-red-500\/50{--tw-gradient-from:#fb2c3680}@supports (color:color-mix(in lab, red, red)){.from-red-500\/50{--tw-gradient-from:color-mix(in oklab, var(--color-red-500) 50%, transparent)}}.from-red-500\/50{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-secondary\/5{--tw-gradient-from:var(--color-secondary)}@supports (color:color-mix(in lab, red, red)){.from-secondary\/5{--tw-gradient-from:color-mix(in oklab, var(--color-secondary) 5%, transparent)}}.from-secondary\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-secondary\/20{--tw-gradient-from:var(--color-secondary)}@supports (color:color-mix(in lab, red, red)){.from-secondary\/20{--tw-gradient-from:color-mix(in oklab, var(--color-secondary) 20%, transparent)}}.from-secondary\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-transparent{--tw-gradient-from:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-yellow-400\/30{--tw-gradient-from:#fac8004d}@supports (color:color-mix(in lab, red, red)){.from-yellow-400\/30{--tw-gradient-from:color-mix(in oklab, var(--color-yellow-400) 30%, transparent)}}.from-yellow-400\/30{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-yellow-500\/50{--tw-gradient-from:#edb20080}@supports (color:color-mix(in lab, red, red)){.from-yellow-500\/50{--tw-gradient-from:color-mix(in oklab, var(--color-yellow-500) 50%, transparent)}}.from-yellow-500\/50{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.via-primary\/20{--tw-gradient-via:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.via-primary\/20{--tw-gradient-via:color-mix(in oklab, var(--color-primary) 20%, transparent)}}.via-primary\/20{--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-secondary\/10{--tw-gradient-via:var(--color-secondary)}@supports (color:color-mix(in lab, red, red)){.via-secondary\/10{--tw-gradient-via:color-mix(in oklab, var(--color-secondary) 10%, transparent)}}.via-secondary\/10{--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-transparent{--tw-gradient-via:transparent;--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-white\/5{--tw-gradient-via:#ffffff0d}@supports (color:color-mix(in lab, red, red)){.via-white\/5{--tw-gradient-via:color-mix(in oklab, var(--color-white) 5%, transparent)}}.via-white\/5{--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-accent-cyan\/20{--tw-gradient-to:var(--color-accent-cyan)}@supports (color:color-mix(in lab, red, red)){.to-accent-cyan\/20{--tw-gradient-to:color-mix(in oklab, var(--color-accent-cyan) 20%, transparent)}}.to-accent-cyan\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-accent-green{--tw-gradient-to:var(--color-accent-green);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-accent-purple\/20{--tw-gradient-to:var(--color-accent-purple)}@supports (color:color-mix(in lab, red, red)){.to-accent-purple\/20{--tw-gradient-to:color-mix(in oklab, var(--color-accent-purple) 20%, transparent)}}.to-accent-purple\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-blue-100\/20{--tw-gradient-to:#dbeafe33}@supports (color:color-mix(in lab, red, red)){.to-blue-100\/20{--tw-gradient-to:color-mix(in oklab, var(--color-blue-100) 20%, transparent)}}.to-blue-100\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-cyan-200\/10{--tw-gradient-to:#a2f4fd1a}@supports (color:color-mix(in lab, red, red)){.to-cyan-200\/10{--tw-gradient-to:color-mix(in oklab, var(--color-cyan-200) 10%, transparent)}}.to-cyan-200\/10{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-cyan-400\/20{--tw-gradient-to:#00d2ef33}@supports (color:color-mix(in lab, red, red)){.to-cyan-400\/20{--tw-gradient-to:color-mix(in oklab, var(--color-cyan-400) 20%, transparent)}}.to-cyan-400\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-cyan-500{--tw-gradient-to:var(--color-cyan-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-cyan-500\/20{--tw-gradient-to:#00b7d733}@supports (color:color-mix(in lab, red, red)){.to-cyan-500\/20{--tw-gradient-to:color-mix(in oklab, var(--color-cyan-500) 20%, transparent)}}.to-cyan-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-cyan-500\/90{--tw-gradient-to:#00b7d7e6}@supports (color:color-mix(in lab, red, red)){.to-cyan-500\/90{--tw-gradient-to:color-mix(in oklab, var(--color-cyan-500) 90%, transparent)}}.to-cyan-500\/90{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-cyan-600\/50{--tw-gradient-to:#0092b580}@supports (color:color-mix(in lab, red, red)){.to-cyan-600\/50{--tw-gradient-to:color-mix(in oklab, var(--color-cyan-600) 50%, transparent)}}.to-cyan-600\/50{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-gray-200{--tw-gradient-to:var(--color-gray-200);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-orange-400\/30{--tw-gradient-to:#ff8b1a4d}@supports (color:color-mix(in lab, red, red)){.to-orange-400\/30{--tw-gradient-to:color-mix(in oklab, var(--color-orange-400) 30%, transparent)}}.to-orange-400\/30{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-orange-600\/50{--tw-gradient-to:#f0510080}@supports (color:color-mix(in lab, red, red)){.to-orange-600\/50{--tw-gradient-to:color-mix(in oklab, var(--color-orange-600) 50%, transparent)}}.to-orange-600\/50{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-pink-100\/15{--tw-gradient-to:#fce7f326}@supports (color:color-mix(in lab, red, red)){.to-pink-100\/15{--tw-gradient-to:color-mix(in oklab, var(--color-pink-100) 15%, transparent)}}.to-pink-100\/15{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-primary\/10{--tw-gradient-to:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.to-primary\/10{--tw-gradient-to:color-mix(in oklab, var(--color-primary) 10%, transparent)}}.to-primary\/10{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-primary\/20{--tw-gradient-to:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.to-primary\/20{--tw-gradient-to:color-mix(in oklab, var(--color-primary) 20%, transparent)}}.to-primary\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-primary\/80{--tw-gradient-to:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.to-primary\/80{--tw-gradient-to:color-mix(in oklab, var(--color-primary) 80%, transparent)}}.to-primary\/80{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-red-600\/50{--tw-gradient-to:#e4001480}@supports (color:color-mix(in lab, red, red)){.to-red-600\/50{--tw-gradient-to:color-mix(in oklab, var(--color-red-600) 50%, transparent)}}.to-red-600\/50{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-secondary\/30{--tw-gradient-to:var(--color-secondary)}@supports (color:color-mix(in lab, red, red)){.to-secondary\/30{--tw-gradient-to:color-mix(in oklab, var(--color-secondary) 30%, transparent)}}.to-secondary\/30{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-teal-100\/15{--tw-gradient-to:#cbfbf126}@supports (color:color-mix(in lab, red, red)){.to-teal-100\/15{--tw-gradient-to:color-mix(in oklab, var(--color-teal-100) 15%, transparent)}}.to-teal-100\/15{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-yellow-500\/20{--tw-gradient-to:#edb20033}@supports (color:color-mix(in lab, red, red)){.to-yellow-500\/20{--tw-gradient-to:color-mix(in oklab, var(--color-yellow-500) 20%, transparent)}}.to-yellow-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-yellow-600\/50{--tw-gradient-to:#cd890080}@supports (color:color-mix(in lab, red, red)){.to-yellow-600\/50{--tw-gradient-to:color-mix(in oklab, var(--color-yellow-600) 50%, transparent)}}.to-yellow-600\/50{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:calc(var(--spacing) * 1)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.p-\[15px\]{padding:15px}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-12{padding-block:calc(var(--spacing) * 12)}.pt-0{padding-top:calc(var(--spacing) * 0)}.pt-1{padding-top:calc(var(--spacing) * 1)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-6{padding-top:calc(var(--spacing) * 6)}.pt-8{padding-top:calc(var(--spacing) * 8)}.pt-px{padding-top:1px}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-4{padding-right:calc(var(--spacing) * 4)}.pb-0{padding-bottom:calc(var(--spacing) * 0)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.pb-1\.5{padding-bottom:calc(var(--spacing) * 1.5)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-6{padding-left:calc(var(--spacing) * 6)}.pl-9{padding-left:calc(var(--spacing) * 9)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:Noto Sans,-apple-system,Roboto,Helvetica,sans-serif}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#0d7377\]{color:#0d7377}.text-\[\#212122\]{color:#212122}.text-accent-cyan,.text-accent-cyan\/80{color:var(--color-accent-cyan)}@supports (color:color-mix(in lab, red, red)){.text-accent-cyan\/80{color:color-mix(in oklab, var(--color-accent-cyan) 80%, transparent)}}.text-accent-green,.text-accent-green\/80{color:var(--color-accent-green)}@supports (color:color-mix(in lab, red, red)){.text-accent-green\/80{color:color-mix(in oklab, var(--color-accent-green) 80%, transparent)}}.text-accent-purple{color:var(--color-accent-purple)}.text-accent-red,.text-accent-red\/50{color:var(--color-accent-red)}@supports (color:color-mix(in lab, red, red)){.text-accent-red\/50{color:color-mix(in oklab, var(--color-accent-red) 50%, transparent)}}.text-accent-red\/70{color:var(--color-accent-red)}@supports (color:color-mix(in lab, red, red)){.text-accent-red\/70{color:color-mix(in oklab, var(--color-accent-red) 70%, transparent)}}.text-accent-red\/80{color:var(--color-accent-red)}@supports (color:color-mix(in lab, red, red)){.text-accent-red\/80{color:color-mix(in oklab, var(--color-accent-red) 80%, transparent)}}.text-amber-500{color:var(--color-amber-500)}.text-amber-600{color:var(--color-amber-600)}.text-amber-700{color:var(--color-amber-700)}.text-amber-800{color:var(--color-amber-800)}.text-amber-900{color:var(--color-amber-900)}.text-background{color:var(--color-background)}.text-badge-cyan-text{color:var(--color-badge-cyan-text)}.text-badge-neutral-text{color:var(--color-badge-neutral-text)}.text-blue-100{color:var(--color-blue-100)}.text-blue-200{color:var(--color-blue-200)}.text-blue-500{color:var(--color-blue-500)}.text-blue-600{color:var(--color-blue-600)}.text-blue-700{color:var(--color-blue-700)}.text-blue-800{color:var(--color-blue-800)}.text-content{color:var(--color-text)}.text-content-heading{color:var(--color-heading)}.text-content-muted,.text-content-muted\/50{color:var(--color-text-muted)}@supports (color:color-mix(in lab, red, red)){.text-content-muted\/50{color:color-mix(in oklab, var(--color-text-muted) 50%, transparent)}}.text-content-muted\/60{color:var(--color-text-muted)}@supports (color:color-mix(in lab, red, red)){.text-content-muted\/60{color:color-mix(in oklab, var(--color-text-muted) 60%, transparent)}}.text-content-primary{color:var(--color-text-primary)}.text-content-secondary{color:var(--color-text-secondary)}.text-cyan-500{color:var(--color-cyan-500)}.text-cyan-600{color:var(--color-cyan-600)}.text-cyan-700{color:var(--color-cyan-700)}.text-emerald-600{color:var(--color-emerald-600)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-green-400{color:var(--color-green-400)}.text-green-500{color:var(--color-green-500)}.text-green-600{color:var(--color-green-600)}.text-green-700{color:var(--color-green-700)}.text-green-800{color:var(--color-green-800)}.text-orange-500{color:var(--color-orange-500)}.text-orange-600{color:var(--color-orange-600)}.text-primary,.text-primary\/70{color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.text-primary\/70{color:color-mix(in oklab, var(--color-primary) 70%, transparent)}}.text-primary\/80{color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.text-primary\/80{color:color-mix(in oklab, var(--color-primary) 80%, transparent)}}.text-purple-600{color:var(--color-purple-600)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-red-800{color:var(--color-red-800)}.text-red-900{color:var(--color-red-900)}.text-secondary,.text-secondary\/80{color:var(--color-secondary)}@supports (color:color-mix(in lab, red, red)){.text-secondary\/80{color:color-mix(in oklab, var(--color-secondary) 80%, transparent)}}.text-surface{color:var(--color-surface)}.text-transparent{color:#0000}.text-white{color:var(--color-white)}.text-white\/40{color:#fff6}@supports (color:color-mix(in lab, red, red)){.text-white\/40{color:color-mix(in oklab, var(--color-white) 40%, transparent)}}.text-white\/50{color:#ffffff80}@supports (color:color-mix(in lab, red, red)){.text-white\/50{color:color-mix(in oklab, var(--color-white) 50%, transparent)}}.text-white\/60{color:#fff9}@supports (color:color-mix(in lab, red, red)){.text-white\/60{color:color-mix(in oklab, var(--color-white) 60%, transparent)}}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab, red, red)){.text-white\/80{color:color-mix(in oklab, var(--color-white) 80%, transparent)}}.text-white\/90{color:#ffffffe6}@supports (color:color-mix(in lab, red, red)){.text-white\/90{color:color-mix(in oklab, var(--color-white) 90%, transparent)}}.text-yellow-200{color:var(--color-yellow-200)}.text-yellow-400{color:var(--color-yellow-400)}.text-yellow-500{color:var(--color-yellow-500)}.text-yellow-600{color:var(--color-yellow-600)}.text-yellow-700{color:var(--color-yellow-700)}.text-yellow-800{color:var(--color-yellow-800)}.capitalize{text-transform:capitalize}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.underline{text-decoration-line:underline}.decoration-gray-400{-webkit-text-decoration-color:var(--color-gray-400);-webkit-text-decoration-color:var(--color-gray-400);-webkit-text-decoration-color:var(--color-gray-400);text-decoration-color:var(--color-gray-400)}.decoration-green-400\/60{text-decoration-color:#05df7299}@supports (color:color-mix(in lab, red, red)){.decoration-green-400\/60{-webkit-text-decoration-color:color-mix(in oklab, var(--color-green-400) 60%, transparent);-webkit-text-decoration-color:color-mix(in oklab, var(--color-green-400) 60%, transparent);-webkit-text-decoration-color:color-mix(in oklab, var(--color-green-400) 60%, transparent);text-decoration-color:color-mix(in oklab, var(--color-green-400) 60%, transparent)}}.underline-offset-2{text-underline-offset:2px}.placeholder-gray-400::placeholder{color:var(--color-gray-400)}.placeholder-gray-500::placeholder{color:var(--color-gray-500)}.opacity-0{opacity:0}.opacity-25{opacity:.25}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-65{opacity:.65}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.opacity-100{opacity:1}.mix-blend-multiply{mix-blend-mode:multiply}.mix-blend-normal{mix-blend-mode:normal}.mix-blend-screen{mix-blend-mode:screen}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_0_\.375rem_0_rgba\(170\,232\,232\,0\.20\)\]{--tw-shadow:0 0 .375rem 0 var(--tw-shadow-color,#aae8e833);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_2px_12px_rgba\(6\,182\,212\,0\.3\)\]{--tw-shadow:0 2px 12px var(--tw-shadow-color,#06b6d44d);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_4px_16px_rgba\(6\,182\,212\,0\.4\)\]{--tw-shadow:0 4px 16px var(--tw-shadow-color,#06b6d466);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_8px_32px_0_rgba\(0\,0\,0\,0\.1\)\]{--tw-shadow:0 8px 32px 0 var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_8px_32px_0_rgba\(0\,0\,0\,0\.37\)\]{--tw-shadow:0 8px 32px 0 var(--tw-shadow-color,#0000005e);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-accent-green\/50{--tw-shadow-color:var(--color-accent-green)}@supports (color:color-mix(in lab, red, red)){.shadow-accent-green\/50{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-accent-green) 50%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-primary\/20{--tw-shadow-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.shadow-primary\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-primary) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-primary\/30{--tw-shadow-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.shadow-primary\/30{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-primary) 30%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-yellow-400\/20{--tw-shadow-color:#fac80033}@supports (color:color-mix(in lab, red, red)){.shadow-yellow-400\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-yellow-400) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.ring-cyan-400\/50{--tw-ring-color:#00d2ef80}@supports (color:color-mix(in lab, red, red)){.ring-cyan-400\/50{--tw-ring-color:color-mix(in oklab, var(--color-cyan-400) 50%, transparent)}}.ring-white\/10{--tw-ring-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.ring-white\/10{--tw-ring-color:color-mix(in oklab, var(--color-white) 10%, transparent)}}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.blur-3xl{--tw-blur:blur(var(--blur-3xl));filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.blur-\[120px\]{--tw-blur:blur(120px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.blur-xl{--tw-blur:blur(var(--blur-xl));filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.brightness-0{--tw-brightness:brightness(0%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.drop-shadow{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#0000001a)) drop-shadow(0 1px 1px var(--tw-drop-shadow-color,#0000000f));--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a) drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.drop-shadow-\[0_0_6px_rgba\(6\,182\,212\,0\.8\)\]{--tw-drop-shadow-size:drop-shadow(0 0 6px var(--tw-drop-shadow-color,#06b6d4cc));--tw-drop-shadow:var(--tw-drop-shadow-size);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.invert{--tw-invert:invert(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-\[50px\]{--tw-backdrop-blur:blur(50px);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-lg{--tw-backdrop-blur:blur(var(--blur-lg));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.ease-in{--tw-ease:var(--ease-in);transition-timing-function:var(--ease-in)}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}@media (hover:hover){.group-hover\:translate-x-1:is(:where(.group):hover *){--tw-translate-x:calc(var(--spacing) * 1);translate:var(--tw-translate-x) var(--tw-translate-y)}.group-hover\:translate-y-1:is(:where(.group):hover *){--tw-translate-y:calc(var(--spacing) * 1);translate:var(--tw-translate-x) var(--tw-translate-y)}.group-hover\:scale-110:is(:where(.group):hover *){--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}.group-hover\:rotate-12:is(:where(.group):hover *){rotate:12deg}.group-hover\:border-stroke:is(:where(.group):hover *){border-color:var(--color-border)}.group-hover\:text-cyan-500:is(:where(.group):hover *){color:var(--color-cyan-500)}.group-hover\:text-indigo-500:is(:where(.group):hover *){color:var(--color-indigo-500)}.group-hover\:text-primary:is(:where(.group):hover *){color:var(--color-primary)}.group-hover\:text-white:is(:where(.group):hover *){color:var(--color-white)}.group-hover\:text-yellow-500:is(:where(.group):hover *){color:var(--color-yellow-500)}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}.group-hover\/delete\:rotate-12:is(:where(.group\/delete):hover *){rotate:12deg}}.peer-checked\:scale-100:is(:where(.peer):checked~*){--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x) var(--tw-scale-y)}.peer-checked\:border-primary:is(:where(.peer):checked~*){border-color:var(--color-primary)}.peer-checked\:bg-primary\/20:is(:where(.peer):checked~*){background-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.peer-checked\:bg-primary\/20:is(:where(.peer):checked~*){background-color:color-mix(in oklab, var(--color-primary) 20%, transparent)}}.last\:border-r-0:last-child{border-right-style:var(--tw-border-style);border-right-width:0}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}@media (hover:hover){.hover\:scale-105:hover{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\:scale-110:hover{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\:scale-\[1\.02\]:hover{scale:1.02}.hover\:border-accent-cyan\/50:hover{border-color:var(--color-accent-cyan)}@supports (color:color-mix(in lab, red, red)){.hover\:border-accent-cyan\/50:hover{border-color:color-mix(in oklab, var(--color-accent-cyan) 50%, transparent)}}.hover\:border-cyan-400\/30:hover{border-color:#00d2ef4d}@supports (color:color-mix(in lab, red, red)){.hover\:border-cyan-400\/30:hover{border-color:color-mix(in oklab, var(--color-cyan-400) 30%, transparent)}}.hover\:border-cyan-500\/50:hover{border-color:#00b7d780}@supports (color:color-mix(in lab, red, red)){.hover\:border-cyan-500\/50:hover{border-color:color-mix(in oklab, var(--color-cyan-500) 50%, transparent)}}.hover\:border-indigo-500\/50:hover{border-color:#625fff80}@supports (color:color-mix(in lab, red, red)){.hover\:border-indigo-500\/50:hover{border-color:color-mix(in oklab, var(--color-indigo-500) 50%, transparent)}}.hover\:border-orange-500:hover{border-color:var(--color-orange-500)}.hover\:border-primary:hover,.hover\:border-primary\/30:hover{border-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.hover\:border-primary\/30:hover{border-color:color-mix(in oklab, var(--color-primary) 30%, transparent)}}.hover\:border-primary\/40:hover{border-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.hover\:border-primary\/40:hover{border-color:color-mix(in oklab, var(--color-primary) 40%, transparent)}}.hover\:border-primary\/50:hover{border-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.hover\:border-primary\/50:hover{border-color:color-mix(in oklab, var(--color-primary) 50%, transparent)}}.hover\:border-primary\/60:hover{border-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.hover\:border-primary\/60:hover{border-color:color-mix(in oklab, var(--color-primary) 60%, transparent)}}.hover\:border-primary\/80:hover{border-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.hover\:border-primary\/80:hover{border-color:color-mix(in oklab, var(--color-primary) 80%, transparent)}}.hover\:border-secondary\/30:hover{border-color:var(--color-secondary)}@supports (color:color-mix(in lab, red, red)){.hover\:border-secondary\/30:hover{border-color:color-mix(in oklab, var(--color-secondary) 30%, transparent)}}.hover\:border-stroke:hover{border-color:var(--color-border)}.hover\:border-stroke-subtle:hover{border-color:var(--color-border-subtle)}.hover\:border-yellow-500\/50:hover{border-color:#edb20080}@supports (color:color-mix(in lab, red, red)){.hover\:border-yellow-500\/50:hover{border-color:color-mix(in oklab, var(--color-yellow-500) 50%, transparent)}}.hover\:bg-accent-cyan\/30:hover{background-color:var(--color-accent-cyan)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent-cyan\/30:hover{background-color:color-mix(in oklab, var(--color-accent-cyan) 30%, transparent)}}.hover\:bg-accent-green\/10:hover{background-color:var(--color-accent-green)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent-green\/10:hover{background-color:color-mix(in oklab, var(--color-accent-green) 10%, transparent)}}.hover\:bg-accent-green\/20:hover{background-color:var(--color-accent-green)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent-green\/20:hover{background-color:color-mix(in oklab, var(--color-accent-green) 20%, transparent)}}.hover\:bg-accent-green\/30:hover{background-color:var(--color-accent-green)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent-green\/30:hover{background-color:color-mix(in oklab, var(--color-accent-green) 30%, transparent)}}.hover\:bg-accent-purple\/30:hover{background-color:var(--color-accent-purple)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent-purple\/30:hover{background-color:color-mix(in oklab, var(--color-accent-purple) 30%, transparent)}}.hover\:bg-accent-red\/10:hover{background-color:var(--color-accent-red)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent-red\/10:hover{background-color:color-mix(in oklab, var(--color-accent-red) 10%, transparent)}}.hover\:bg-accent-red\/20:hover{background-color:var(--color-accent-red)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent-red\/20:hover{background-color:color-mix(in oklab, var(--color-accent-red) 20%, transparent)}}.hover\:bg-accent-red\/30:hover{background-color:var(--color-accent-red)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent-red\/30:hover{background-color:color-mix(in oklab, var(--color-accent-red) 30%, transparent)}}.hover\:bg-amber-500\/30:hover{background-color:#f99c004d}@supports (color:color-mix(in lab, red, red)){.hover\:bg-amber-500\/30:hover{background-color:color-mix(in oklab, var(--color-amber-500) 30%, transparent)}}.hover\:bg-amber-600:hover{background-color:var(--color-amber-600)}.hover\:bg-amber-700:hover{background-color:var(--color-amber-700)}.hover\:bg-background-mute:hover,.hover\:bg-background-mute\/50:hover{background-color:var(--color-background-mute)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-background-mute\/50:hover{background-color:color-mix(in oklab, var(--color-background-mute) 50%, transparent)}}.hover\:bg-background-soft:hover{background-color:var(--color-background-soft)}.hover\:bg-black\/5:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.hover\:bg-black\/5:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.hover\:bg-black\/90:hover{background-color:#000000e6}@supports (color:color-mix(in lab, red, red)){.hover\:bg-black\/90:hover{background-color:color-mix(in oklab, var(--color-black) 90%, transparent)}}.hover\:bg-blue-600:hover{background-color:var(--color-blue-600)}.hover\:bg-content-primary\/10:hover{background-color:var(--color-text-primary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-content-primary\/10:hover{background-color:color-mix(in oklab, var(--color-text-primary) 10%, transparent)}}.hover\:bg-cyan-50:hover{background-color:var(--color-cyan-50)}.hover\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\:bg-gray-100\/50:hover{background-color:#f3f4f680}@supports (color:color-mix(in lab, red, red)){.hover\:bg-gray-100\/50:hover{background-color:color-mix(in oklab, var(--color-gray-100) 50%, transparent)}}.hover\:bg-gray-300:hover{background-color:var(--color-gray-300)}.hover\:bg-green-500\/30:hover{background-color:#00c7584d}@supports (color:color-mix(in lab, red, red)){.hover\:bg-green-500\/30:hover{background-color:color-mix(in oklab, var(--color-green-500) 30%, transparent)}}.hover\:bg-green-600:hover{background-color:var(--color-green-600)}.hover\:bg-indigo-50:hover{background-color:var(--color-indigo-50)}.hover\:bg-primary\/5:hover{background-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-primary\/5:hover{background-color:color-mix(in oklab, var(--color-primary) 5%, transparent)}}.hover\:bg-primary\/10:hover{background-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-primary\/10:hover{background-color:color-mix(in oklab, var(--color-primary) 10%, transparent)}}.hover\:bg-primary\/20:hover{background-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-primary\/20:hover{background-color:color-mix(in oklab, var(--color-primary) 20%, transparent)}}.hover\:bg-primary\/30:hover{background-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-primary\/30:hover{background-color:color-mix(in oklab, var(--color-primary) 30%, transparent)}}.hover\:bg-primary\/90:hover{background-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab, var(--color-primary) 90%, transparent)}}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab, var(--color-red-500) 10%, transparent)}}.hover\:bg-red-500\/20:hover{background-color:#fb2c3633}@supports (color:color-mix(in lab, red, red)){.hover\:bg-red-500\/20:hover{background-color:color-mix(in oklab, var(--color-red-500) 20%, transparent)}}.hover\:bg-red-500\/30:hover{background-color:#fb2c364d}@supports (color:color-mix(in lab, red, red)){.hover\:bg-red-500\/30:hover{background-color:color-mix(in oklab, var(--color-red-500) 30%, transparent)}}.hover\:bg-red-600:hover{background-color:var(--color-red-600)}.hover\:bg-red-600\/30:hover{background-color:#e400144d}@supports (color:color-mix(in lab, red, red)){.hover\:bg-red-600\/30:hover{background-color:color-mix(in oklab, var(--color-red-600) 30%, transparent)}}.hover\:bg-red-700:hover{background-color:var(--color-red-700)}.hover\:bg-secondary\/30:hover{background-color:var(--color-secondary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-secondary\/30:hover{background-color:color-mix(in oklab, var(--color-secondary) 30%, transparent)}}.hover\:bg-secondary\/90:hover{background-color:var(--color-secondary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-secondary\/90:hover{background-color:color-mix(in oklab, var(--color-secondary) 90%, transparent)}}.hover\:bg-stroke-subtle:hover,.hover\:bg-stroke-subtle\/40:hover{background-color:var(--color-border-subtle)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-stroke-subtle\/40:hover{background-color:color-mix(in oklab, var(--color-border-subtle) 40%, transparent)}}.hover\:bg-white:hover{background-color:var(--color-white)}.hover\:bg-white\/10:hover{background-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-white\/10:hover{background-color:color-mix(in oklab, var(--color-white) 10%, transparent)}}.hover\:bg-yellow-50:hover{background-color:var(--color-yellow-50)}.hover\:bg-yellow-600:hover{background-color:var(--color-yellow-600)}.hover\:bg-gradient-to-r:hover{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.hover\:from-cyan-400\/20:hover{--tw-gradient-from:#00d2ef33}@supports (color:color-mix(in lab, red, red)){.hover\:from-cyan-400\/20:hover{--tw-gradient-from:color-mix(in oklab, var(--color-cyan-400) 20%, transparent)}}.hover\:from-cyan-400\/20:hover{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:from-cyan-500:hover{--tw-gradient-from:var(--color-cyan-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:from-cyan-500\/30:hover{--tw-gradient-from:#00b7d74d}@supports (color:color-mix(in lab, red, red)){.hover\:from-cyan-500\/30:hover{--tw-gradient-from:color-mix(in oklab, var(--color-cyan-500) 30%, transparent)}}.hover\:from-cyan-500\/30:hover{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:from-gray-200:hover{--tw-gradient-from:var(--color-gray-200);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:from-primary\/40:hover{--tw-gradient-from:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.hover\:from-primary\/40:hover{--tw-gradient-from:color-mix(in oklab, var(--color-primary) 40%, transparent)}}.hover\:from-primary\/40:hover{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:to-cyan-400\/30:hover{--tw-gradient-to:#00d2ef4d}@supports (color:color-mix(in lab, red, red)){.hover\:to-cyan-400\/30:hover{--tw-gradient-to:color-mix(in oklab, var(--color-cyan-400) 30%, transparent)}}.hover\:to-cyan-400\/30:hover{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:to-cyan-500\/20:hover{--tw-gradient-to:#00b7d733}@supports (color:color-mix(in lab, red, red)){.hover\:to-cyan-500\/20:hover{--tw-gradient-to:color-mix(in oklab, var(--color-cyan-500) 20%, transparent)}}.hover\:to-cyan-500\/20:hover{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:to-cyan-600:hover{--tw-gradient-to:var(--color-cyan-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:to-gray-300:hover{--tw-gradient-to:var(--color-gray-300);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:to-secondary\/40:hover{--tw-gradient-to:var(--color-secondary)}@supports (color:color-mix(in lab, red, red)){.hover\:to-secondary\/40:hover{--tw-gradient-to:color-mix(in oklab, var(--color-secondary) 40%, transparent)}}.hover\:to-secondary\/40:hover{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.hover\:text-accent-green\/80:hover{color:var(--color-accent-green)}@supports (color:color-mix(in lab, red, red)){.hover\:text-accent-green\/80:hover{color:color-mix(in oklab, var(--color-accent-green) 80%, transparent)}}.hover\:text-accent-red:hover{color:var(--color-accent-red)}.hover\:text-blue-600:hover{color:var(--color-blue-600)}.hover\:text-content-heading:hover{color:var(--color-heading)}.hover\:text-content-primary:hover{color:var(--color-text-primary)}.hover\:text-content-secondary:hover{color:var(--color-text-secondary)}.hover\:text-gray-900:hover{color:var(--color-gray-900)}.hover\:text-primary:hover,.hover\:text-primary\/80:hover{color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.hover\:text-primary\/80:hover{color:color-mix(in oklab, var(--color-primary) 80%, transparent)}}.hover\:text-red-600:hover{color:var(--color-red-600)}.hover\:text-white:hover{color:var(--color-white)}.hover\:no-underline:hover{text-decoration-line:none}.hover\:opacity-90:hover{opacity:.9}.hover\:shadow-\[0_2px_12px_rgba\(6\,182\,212\,0\.2\)\]:hover{--tw-shadow:0 2px 12px var(--tw-shadow-color,#06b6d433);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:shadow-lg:hover{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:shadow-accent-green\/20:hover{--tw-shadow-color:var(--color-accent-green)}@supports (color:color-mix(in lab, red, red)){.hover\:shadow-accent-green\/20:hover{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-accent-green) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.hover\:shadow-primary\/20:hover{--tw-shadow-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.hover\:shadow-primary\/20:hover{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-primary) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.hover\:shadow-secondary\/10:hover{--tw-shadow-color:var(--color-secondary)}@supports (color:color-mix(in lab, red, red)){.hover\:shadow-secondary\/10:hover{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-secondary) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.hover\:shadow-secondary\/20:hover{--tw-shadow-color:var(--color-secondary)}@supports (color:color-mix(in lab, red, red)){.hover\:shadow-secondary\/20:hover{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-secondary) 20%, transparent) var(--tw-shadow-alpha), transparent)}}}.focus\:border-primary:focus,.focus\:border-primary\/50:focus{border-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.focus\:border-primary\/50:focus{border-color:color-mix(in oklab, var(--color-primary) 50%, transparent)}}.focus\:border-transparent:focus{border-color:#0000}.focus\:bg-white:focus{background-color:var(--color-white)}.focus\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-accent-cyan:focus{--tw-ring-color:var(--color-accent-cyan)}.focus\:ring-primary:focus,.focus\:ring-primary\/20:focus{--tw-ring-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.focus\:ring-primary\/20:focus{--tw-ring-color:color-mix(in oklab, var(--color-primary) 20%, transparent)}}.focus\:ring-primary\/50:focus{--tw-ring-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.focus\:ring-primary\/50:focus{--tw-ring-color:color-mix(in oklab, var(--color-primary) 50%, transparent)}}.focus\:ring-offset-background:focus{--tw-ring-offset-color:var(--color-background)}.focus\:outline-hidden:focus{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.focus\:outline-hidden:focus{outline-offset:2px;outline:2px solid #0000}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.active\:scale-\[0\.98\]:active{scale:.98}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:border-gray-500\/20:disabled{border-color:#6a728233}@supports (color:color-mix(in lab, red, red)){.disabled\:border-gray-500\/20:disabled{border-color:color-mix(in oklab, var(--color-gray-500) 20%, transparent)}}.disabled\:bg-amber-500\/50:disabled{background-color:#f99c0080}@supports (color:color-mix(in lab, red, red)){.disabled\:bg-amber-500\/50:disabled{background-color:color-mix(in oklab, var(--color-amber-500) 50%, transparent)}}.disabled\:bg-gray-500\/10:disabled{background-color:#6a72821a}@supports (color:color-mix(in lab, red, red)){.disabled\:bg-gray-500\/10:disabled{background-color:color-mix(in oklab, var(--color-gray-500) 10%, transparent)}}.disabled\:text-gray-400:disabled{color:var(--color-gray-400)}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}@media (width>=40rem){.sm\:mx-0{margin-inline:calc(var(--spacing) * 0)}.sm\:mt-2{margin-top:calc(var(--spacing) * 2)}.sm\:mt-6{margin-top:calc(var(--spacing) * 6)}.sm\:mt-8{margin-top:calc(var(--spacing) * 8)}.sm\:mr-6{margin-right:calc(var(--spacing) * 6)}.sm\:mb-2{margin-bottom:calc(var(--spacing) * 2)}.sm\:mb-4{margin-bottom:calc(var(--spacing) * 4)}.sm\:mb-6{margin-bottom:calc(var(--spacing) * 6)}.sm\:mb-10{margin-bottom:calc(var(--spacing) * 10)}.sm\:ml-4{margin-left:calc(var(--spacing) * 4)}.sm\:block{display:block}.sm\:flex{display:flex}.sm\:hidden{display:none}.sm\:inline{display:inline}.sm\:inline-block{display:inline-block}.sm\:table-cell{display:table-cell}.sm\:h-3{height:calc(var(--spacing) * 3)}.sm\:h-4{height:calc(var(--spacing) * 4)}.sm\:h-5{height:calc(var(--spacing) * 5)}.sm\:h-6{height:calc(var(--spacing) * 6)}.sm\:h-10{height:calc(var(--spacing) * 10)}.sm\:h-40{height:calc(var(--spacing) * 40)}.sm\:h-48{height:calc(var(--spacing) * 48)}.sm\:min-h-\[16rem\]{min-height:16rem}.sm\:w-3{width:calc(var(--spacing) * 3)}.sm\:w-4{width:calc(var(--spacing) * 4)}.sm\:w-5{width:calc(var(--spacing) * 5)}.sm\:w-6{width:calc(var(--spacing) * 6)}.sm\:w-10{width:calc(var(--spacing) * 10)}.sm\:w-24{width:calc(var(--spacing) * 24)}.sm\:w-32{width:calc(var(--spacing) * 32)}.sm\:w-48{width:calc(var(--spacing) * 48)}.sm\:w-64{width:calc(var(--spacing) * 64)}.sm\:w-auto{width:auto}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:flex-nowrap{flex-wrap:nowrap}.sm\:items-center{align-items:center}.sm\:items-start{align-items:flex-start}.sm\:justify-between{justify-content:space-between}.sm\:justify-end{justify-content:flex-end}.sm\:gap-2{gap:calc(var(--spacing) * 2)}.sm\:gap-2\.5{gap:calc(var(--spacing) * 2.5)}.sm\:gap-3{gap:calc(var(--spacing) * 3)}.sm\:gap-4{gap:calc(var(--spacing) * 4)}.sm\:gap-6{gap:calc(var(--spacing) * 6)}:where(.sm\:space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.sm\:space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}.sm\:rounded-\[24px\]{border-radius:24px}.sm\:border{border-style:var(--tw-border-style);border-width:1px}.sm\:border-stroke-subtle{border-color:var(--color-border-subtle)}.sm\:p-1{padding:calc(var(--spacing) * 1)}.sm\:p-3\.5{padding:calc(var(--spacing) * 3.5)}.sm\:p-4{padding:calc(var(--spacing) * 4)}.sm\:p-5{padding:calc(var(--spacing) * 5)}.sm\:p-6{padding:calc(var(--spacing) * 6)}.sm\:p-8{padding:calc(var(--spacing) * 8)}.sm\:p-10{padding:calc(var(--spacing) * 10)}.sm\:px-0{padding-inline:calc(var(--spacing) * 0)}.sm\:px-3{padding-inline:calc(var(--spacing) * 3)}.sm\:px-4{padding-inline:calc(var(--spacing) * 4)}.sm\:py-2{padding-block:calc(var(--spacing) * 2)}.sm\:py-3\.5{padding-block:calc(var(--spacing) * 3.5)}.sm\:py-4{padding-block:calc(var(--spacing) * 4)}.sm\:pt-4{padding-top:calc(var(--spacing) * 4)}.sm\:pt-6{padding-top:calc(var(--spacing) * 6)}.sm\:text-right{text-align:right}.sm\:text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.sm\:text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.sm\:text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.sm\:text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.sm\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.sm\:text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.sm\:text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}}@media (width>=48rem){.md\:block{display:block}.md\:grid{display:grid}.md\:hidden{display:none}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:items-start{align-items:flex-start}.md\:justify-between{justify-content:space-between}.md\:gap-3{gap:calc(var(--spacing) * 3)}:where(.md\:space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}.md\:p-4{padding:calc(var(--spacing) * 4)}.md\:p-12{padding:calc(var(--spacing) * 12)}.md\:px-4{padding-inline:calc(var(--spacing) * 4)}.md\:text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}}@media (width>=64rem){.lg\:mt-3{margin-top:calc(var(--spacing) * 3)}.lg\:mt-4{margin-top:calc(var(--spacing) * 4)}.lg\:mb-4{margin-bottom:calc(var(--spacing) * 4)}.lg\:block{display:block}.lg\:flex{display:flex}.lg\:grid{display:grid}.lg\:hidden{display:none}.lg\:h-48{height:calc(var(--spacing) * 48)}.lg\:h-56{height:calc(var(--spacing) * 56)}.lg\:w-7{width:calc(var(--spacing) * 7)}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:items-center{align-items:center}.lg\:justify-between{justify-content:space-between}.lg\:gap-3{gap:calc(var(--spacing) * 3)}.lg\:gap-4{gap:calc(var(--spacing) * 4)}.lg\:gap-6{gap:calc(var(--spacing) * 6)}.lg\:p-6{padding:calc(var(--spacing) * 6)}.lg\:p-\[15px\]{padding:15px}.lg\:text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.lg\:text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.lg\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.lg\:text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.lg\:text-\[35px\]{font-size:35px}}@media (width>=80rem){.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-\[minmax\(0\,1\.15fr\)_minmax\(340px\,0\.85fr\)\]{grid-template-columns:minmax(0,1.15fr) minmax(340px,.85fr)}}.dark\:block:is(.dark *){display:block}.dark\:hidden:is(.dark *){display:none}:where(.dark\:divide-stroke\/10:is(.dark *)>:not(:last-child)){border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){:where(.dark\:divide-stroke\/10:is(.dark *)>:not(:last-child)){border-color:color-mix(in oklab, var(--color-border) 10%, transparent)}}:where(.dark\:divide-white\/5:is(.dark *)>:not(:last-child)){border-color:#ffffff0d}@supports (color:color-mix(in lab, red, red)){:where(.dark\:divide-white\/5:is(.dark *)>:not(:last-child)){border-color:color-mix(in oklab, var(--color-white) 5%, transparent)}}:where(.dark\:divide-white\/10:is(.dark *)>:not(:last-child)){border-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){:where(.dark\:divide-white\/10:is(.dark *)>:not(:last-child)){border-color:color-mix(in oklab, var(--color-white) 10%, transparent)}}.dark\:border:is(.dark *){border-style:var(--tw-border-style);border-width:1px}.dark\:border-accent-green\/30:is(.dark *){border-color:var(--color-accent-green)}@supports (color:color-mix(in lab, red, red)){.dark\:border-accent-green\/30:is(.dark *){border-color:color-mix(in oklab, var(--color-accent-green) 30%, transparent)}}.dark\:border-accent-green\/40:is(.dark *){border-color:var(--color-accent-green)}@supports (color:color-mix(in lab, red, red)){.dark\:border-accent-green\/40:is(.dark *){border-color:color-mix(in oklab, var(--color-accent-green) 40%, transparent)}}.dark\:border-accent-red\/20:is(.dark *){border-color:var(--color-accent-red)}@supports (color:color-mix(in lab, red, red)){.dark\:border-accent-red\/20:is(.dark *){border-color:color-mix(in oklab, var(--color-accent-red) 20%, transparent)}}.dark\:border-amber-400\/40:is(.dark *){border-color:#fcbb0066}@supports (color:color-mix(in lab, red, red)){.dark\:border-amber-400\/40:is(.dark *){border-color:color-mix(in oklab, var(--color-amber-400) 40%, transparent)}}.dark\:border-amber-500\/30:is(.dark *){border-color:#f99c004d}@supports (color:color-mix(in lab, red, red)){.dark\:border-amber-500\/30:is(.dark *){border-color:color-mix(in oklab, var(--color-amber-500) 30%, transparent)}}.dark\:border-blue-400\/50:is(.dark *){border-color:#54a2ff80}@supports (color:color-mix(in lab, red, red)){.dark\:border-blue-400\/50:is(.dark *){border-color:color-mix(in oklab, var(--color-blue-400) 50%, transparent)}}.dark\:border-dark-border:is(.dark *),.dark\:border-dark-border\/50:is(.dark *){border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.dark\:border-dark-border\/50:is(.dark *){border-color:color-mix(in oklab, var(--color-border) 50%, transparent)}}.dark\:border-gray-600:is(.dark *){border-color:var(--color-gray-600)}.dark\:border-green-400\/30:is(.dark *){border-color:#05df724d}@supports (color:color-mix(in lab, red, red)){.dark\:border-green-400\/30:is(.dark *){border-color:color-mix(in oklab, var(--color-green-400) 30%, transparent)}}.dark\:border-green-500\/30:is(.dark *){border-color:#00c7584d}@supports (color:color-mix(in lab, red, red)){.dark\:border-green-500\/30:is(.dark *){border-color:color-mix(in oklab, var(--color-green-500) 30%, transparent)}}.dark\:border-green-500\/50:is(.dark *){border-color:#00c75880}@supports (color:color-mix(in lab, red, red)){.dark\:border-green-500\/50:is(.dark *){border-color:color-mix(in oklab, var(--color-green-500) 50%, transparent)}}.dark\:border-orange-400\/30:is(.dark *){border-color:#ff8b1a4d}@supports (color:color-mix(in lab, red, red)){.dark\:border-orange-400\/30:is(.dark *){border-color:color-mix(in oklab, var(--color-orange-400) 30%, transparent)}}.dark\:border-orange-400\/40:is(.dark *){border-color:#ff8b1a66}@supports (color:color-mix(in lab, red, red)){.dark\:border-orange-400\/40:is(.dark *){border-color:color-mix(in oklab, var(--color-orange-400) 40%, transparent)}}.dark\:border-orange-400\/60:is(.dark *){border-color:#ff8b1a99}@supports (color:color-mix(in lab, red, red)){.dark\:border-orange-400\/60:is(.dark *){border-color:color-mix(in oklab, var(--color-orange-400) 60%, transparent)}}.dark\:border-primary\/30:is(.dark *){border-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.dark\:border-primary\/30:is(.dark *){border-color:color-mix(in oklab, var(--color-primary) 30%, transparent)}}.dark\:border-primary\/40:is(.dark *){border-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.dark\:border-primary\/40:is(.dark *){border-color:color-mix(in oklab, var(--color-primary) 40%, transparent)}}.dark\:border-red-400\/20:is(.dark *){border-color:#ff656833}@supports (color:color-mix(in lab, red, red)){.dark\:border-red-400\/20:is(.dark *){border-color:color-mix(in oklab, var(--color-red-400) 20%, transparent)}}.dark\:border-red-400\/30:is(.dark *){border-color:#ff65684d}@supports (color:color-mix(in lab, red, red)){.dark\:border-red-400\/30:is(.dark *){border-color:color-mix(in oklab, var(--color-red-400) 30%, transparent)}}.dark\:border-red-400\/40:is(.dark *){border-color:#ff656866}@supports (color:color-mix(in lab, red, red)){.dark\:border-red-400\/40:is(.dark *){border-color:color-mix(in oklab, var(--color-red-400) 40%, transparent)}}.dark\:border-red-500\/30:is(.dark *){border-color:#fb2c364d}@supports (color:color-mix(in lab, red, red)){.dark\:border-red-500\/30:is(.dark *){border-color:color-mix(in oklab, var(--color-red-500) 30%, transparent)}}.dark\:border-red-500\/50:is(.dark *){border-color:#fb2c3680}@supports (color:color-mix(in lab, red, red)){.dark\:border-red-500\/50:is(.dark *){border-color:color-mix(in oklab, var(--color-red-500) 50%, transparent)}}.dark\:border-red-700\/50:is(.dark *){border-color:#bf000f80}@supports (color:color-mix(in lab, red, red)){.dark\:border-red-700\/50:is(.dark *){border-color:color-mix(in oklab, var(--color-red-700) 50%, transparent)}}.dark\:border-stroke:is(.dark *),.dark\:border-stroke\/5:is(.dark *){border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.dark\:border-stroke\/5:is(.dark *){border-color:color-mix(in oklab, var(--color-border) 5%, transparent)}}.dark\:border-stroke\/10:is(.dark *){border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.dark\:border-stroke\/10:is(.dark *){border-color:color-mix(in oklab, var(--color-border) 10%, transparent)}}.dark\:border-stroke\/20:is(.dark *){border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.dark\:border-stroke\/20:is(.dark *){border-color:color-mix(in oklab, var(--color-border) 20%, transparent)}}.dark\:border-stroke\/30:is(.dark *){border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.dark\:border-stroke\/30:is(.dark *){border-color:color-mix(in oklab, var(--color-border) 30%, transparent)}}.dark\:border-teal-500:is(.dark *){border-color:var(--color-teal-500)}.dark\:border-transparent:is(.dark *){border-color:#0000}.dark\:border-white\/5:is(.dark *){border-color:#ffffff0d}@supports (color:color-mix(in lab, red, red)){.dark\:border-white\/5:is(.dark *){border-color:color-mix(in oklab, var(--color-white) 5%, transparent)}}.dark\:border-white\/10:is(.dark *){border-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.dark\:border-white\/10:is(.dark *){border-color:color-mix(in oklab, var(--color-white) 10%, transparent)}}.dark\:border-white\/20:is(.dark *){border-color:#fff3}@supports (color:color-mix(in lab, red, red)){.dark\:border-white\/20:is(.dark *){border-color:color-mix(in oklab, var(--color-white) 20%, transparent)}}.dark\:border-yellow-400\/30:is(.dark *){border-color:#fac8004d}@supports (color:color-mix(in lab, red, red)){.dark\:border-yellow-400\/30:is(.dark *){border-color:color-mix(in oklab, var(--color-yellow-400) 30%, transparent)}}.dark\:border-yellow-500\/30:is(.dark *){border-color:#edb2004d}@supports (color:color-mix(in lab, red, red)){.dark\:border-yellow-500\/30:is(.dark *){border-color:color-mix(in oklab, var(--color-yellow-500) 30%, transparent)}}.dark\:border-l-accent-green:is(.dark *){border-left-color:var(--color-accent-green)}.dark\:bg-\[var\(--color-surface\)\]:is(.dark *){background-color:var(--color-surface)}.dark\:bg-accent-red\/10:is(.dark *){background-color:var(--color-accent-red)}@supports (color:color-mix(in lab, red, red)){.dark\:bg-accent-red\/10:is(.dark *){background-color:color-mix(in oklab, var(--color-accent-red) 10%, transparent)}}.dark\:bg-accent-red\/20:is(.dark *){background-color:var(--color-accent-red)}@supports (color:color-mix(in lab, red, red)){.dark\:bg-accent-red\/20:is(.dark *){background-color:color-mix(in oklab, var(--color-accent-red) 20%, transparent)}}.dark\:bg-amber-400\/20:is(.dark *){background-color:#fcbb0033}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-400\/20:is(.dark *){background-color:color-mix(in oklab, var(--color-amber-400) 20%, transparent)}}.dark\:bg-amber-500:is(.dark *){background-color:var(--color-amber-500)}.dark\:bg-amber-500\/5:is(.dark *){background-color:#f99c000d}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-500\/5:is(.dark *){background-color:color-mix(in oklab, var(--color-amber-500) 5%, transparent)}}.dark\:bg-amber-500\/10:is(.dark *){background-color:#f99c001a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-500\/10:is(.dark *){background-color:color-mix(in oklab, var(--color-amber-500) 10%, transparent)}}.dark\:bg-amber-900\/30:is(.dark *){background-color:#7b33064d}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-900\/30:is(.dark *){background-color:color-mix(in oklab, var(--color-amber-900) 30%, transparent)}}.dark\:bg-background:is(.dark *){background-color:var(--color-background)}.dark\:bg-background-mute:is(.dark *){background-color:var(--color-background-mute)}.dark\:bg-background\/10:is(.dark *){background-color:var(--color-background)}@supports (color:color-mix(in lab, red, red)){.dark\:bg-background\/10:is(.dark *){background-color:color-mix(in oklab, var(--color-background) 10%, transparent)}}.dark\:bg-background\/20:is(.dark *){background-color:var(--color-background)}@supports (color:color-mix(in lab, red, red)){.dark\:bg-background\/20:is(.dark *){background-color:color-mix(in oklab, var(--color-background) 20%, transparent)}}.dark\:bg-background\/30:is(.dark *){background-color:var(--color-background)}@supports (color:color-mix(in lab, red, red)){.dark\:bg-background\/30:is(.dark *){background-color:color-mix(in oklab, var(--color-background) 30%, transparent)}}.dark\:bg-background\/50:is(.dark *){background-color:var(--color-background)}@supports (color:color-mix(in lab, red, red)){.dark\:bg-background\/50:is(.dark *){background-color:color-mix(in oklab, var(--color-background) 50%, transparent)}}.dark\:bg-black\/20:is(.dark *){background-color:#0003}@supports (color:color-mix(in lab, red, red)){.dark\:bg-black\/20:is(.dark *){background-color:color-mix(in oklab, var(--color-black) 20%, transparent)}}.dark\:bg-black\/30:is(.dark *){background-color:#0000004d}@supports (color:color-mix(in lab, red, red)){.dark\:bg-black\/30:is(.dark *){background-color:color-mix(in oklab, var(--color-black) 30%, transparent)}}.dark\:bg-black\/40:is(.dark *){background-color:#0006}@supports (color:color-mix(in lab, red, red)){.dark\:bg-black\/40:is(.dark *){background-color:color-mix(in oklab, var(--color-black) 40%, transparent)}}.dark\:bg-black\/60:is(.dark *){background-color:#0009}@supports (color:color-mix(in lab, red, red)){.dark\:bg-black\/60:is(.dark *){background-color:color-mix(in oklab, var(--color-black) 60%, transparent)}}.dark\:bg-blue-400\/20:is(.dark *){background-color:#54a2ff33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-400\/20:is(.dark *){background-color:color-mix(in oklab, var(--color-blue-400) 20%, transparent)}}.dark\:bg-blue-500\/10:is(.dark *){background-color:#3080ff1a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-500\/10:is(.dark *){background-color:color-mix(in oklab, var(--color-blue-500) 10%, transparent)}}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3080ff33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-500\/20:is(.dark *){background-color:color-mix(in oklab, var(--color-blue-500) 20%, transparent)}}.dark\:bg-gray-500\/20:is(.dark *){background-color:#6a728233}@supports (color:color-mix(in lab, red, red)){.dark\:bg-gray-500\/20:is(.dark *){background-color:color-mix(in oklab, var(--color-gray-500) 20%, transparent)}}.dark\:bg-gray-600:is(.dark *){background-color:var(--color-gray-600)}.dark\:bg-gray-700:is(.dark *){background-color:var(--color-gray-700)}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1e293980}@supports (color:color-mix(in lab, red, red)){.dark\:bg-gray-800\/50:is(.dark *){background-color:color-mix(in oklab, var(--color-gray-800) 50%, transparent)}}.dark\:bg-green-500\/10:is(.dark *){background-color:#00c7581a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-green-500\/10:is(.dark *){background-color:color-mix(in oklab, var(--color-green-500) 10%, transparent)}}.dark\:bg-green-500\/20:is(.dark *){background-color:#00c75833}@supports (color:color-mix(in lab, red, red)){.dark\:bg-green-500\/20:is(.dark *){background-color:color-mix(in oklab, var(--color-green-500) 20%, transparent)}}.dark\:bg-green-600\/20:is(.dark *){background-color:#00a54433}@supports (color:color-mix(in lab, red, red)){.dark\:bg-green-600\/20:is(.dark *){background-color:color-mix(in oklab, var(--color-green-600) 20%, transparent)}}.dark\:bg-green-900\/30:is(.dark *){background-color:#0d542b4d}@supports (color:color-mix(in lab, red, red)){.dark\:bg-green-900\/30:is(.dark *){background-color:color-mix(in oklab, var(--color-green-900) 30%, transparent)}}.dark\:bg-orange-500\/20:is(.dark *){background-color:#fe6e0033}@supports (color:color-mix(in lab, red, red)){.dark\:bg-orange-500\/20:is(.dark *){background-color:color-mix(in oklab, var(--color-orange-500) 20%, transparent)}}.dark\:bg-primary\/10:is(.dark *){background-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.dark\:bg-primary\/10:is(.dark *){background-color:color-mix(in oklab, var(--color-primary) 10%, transparent)}}.dark\:bg-primary\/20:is(.dark *){background-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.dark\:bg-primary\/20:is(.dark *){background-color:color-mix(in oklab, var(--color-primary) 20%, transparent)}}.dark\:bg-primary\/30:is(.dark *){background-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.dark\:bg-primary\/30:is(.dark *){background-color:color-mix(in oklab, var(--color-primary) 30%, transparent)}}.dark\:bg-red-400\/10:is(.dark *){background-color:#ff65681a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-red-400\/10:is(.dark *){background-color:color-mix(in oklab, var(--color-red-400) 10%, transparent)}}.dark\:bg-red-400\/20:is(.dark *){background-color:#ff656833}@supports (color:color-mix(in lab, red, red)){.dark\:bg-red-400\/20:is(.dark *){background-color:color-mix(in oklab, var(--color-red-400) 20%, transparent)}}.dark\:bg-red-500:is(.dark *){background-color:var(--color-red-500)}.dark\:bg-red-500\/5:is(.dark *){background-color:#fb2c360d}@supports (color:color-mix(in lab, red, red)){.dark\:bg-red-500\/5:is(.dark *){background-color:color-mix(in oklab, var(--color-red-500) 5%, transparent)}}.dark\:bg-red-500\/10:is(.dark *){background-color:#fb2c361a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-red-500\/10:is(.dark *){background-color:color-mix(in oklab, var(--color-red-500) 10%, transparent)}}.dark\:bg-red-500\/20:is(.dark *){background-color:#fb2c3633}@supports (color:color-mix(in lab, red, red)){.dark\:bg-red-500\/20:is(.dark *){background-color:color-mix(in oklab, var(--color-red-500) 20%, transparent)}}.dark\:bg-red-900\/30:is(.dark *){background-color:#82181a4d}@supports (color:color-mix(in lab, red, red)){.dark\:bg-red-900\/30:is(.dark *){background-color:color-mix(in oklab, var(--color-red-900) 30%, transparent)}}.dark\:bg-secondary-bg\/10:is(.dark *){background-color:var(--color-secondary-bg)}@supports (color:color-mix(in lab, red, red)){.dark\:bg-secondary-bg\/10:is(.dark *){background-color:color-mix(in oklab, var(--color-secondary-bg) 10%, transparent)}}.dark\:bg-stroke\/5:is(.dark *){background-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.dark\:bg-stroke\/5:is(.dark *){background-color:color-mix(in oklab, var(--color-border) 5%, transparent)}}.dark\:bg-stroke\/10:is(.dark *){background-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.dark\:bg-stroke\/10:is(.dark *){background-color:color-mix(in oklab, var(--color-border) 10%, transparent)}}.dark\:bg-stroke\/20:is(.dark *){background-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.dark\:bg-stroke\/20:is(.dark *){background-color:color-mix(in oklab, var(--color-border) 20%, transparent)}}.dark\:bg-surface:is(.dark *){background-color:var(--color-surface)}.dark\:bg-surface-elevated:is(.dark *),.dark\:bg-surface-elevated\/30:is(.dark *){background-color:var(--color-surface-elevated)}@supports (color:color-mix(in lab, red, red)){.dark\:bg-surface-elevated\/30:is(.dark *){background-color:color-mix(in oklab, var(--color-surface-elevated) 30%, transparent)}}.dark\:bg-surface-elevated\/80:is(.dark *){background-color:var(--color-surface-elevated)}@supports (color:color-mix(in lab, red, red)){.dark\:bg-surface-elevated\/80:is(.dark *){background-color:color-mix(in oklab, var(--color-surface-elevated) 80%, transparent)}}.dark\:bg-surface\/50:is(.dark *){background-color:var(--color-surface)}@supports (color:color-mix(in lab, red, red)){.dark\:bg-surface\/50:is(.dark *){background-color:color-mix(in oklab, var(--color-surface) 50%, transparent)}}.dark\:bg-teal-500:is(.dark *){background-color:var(--color-teal-500)}.dark\:bg-transparent:is(.dark *){background-color:#0000}.dark\:bg-white\/5:is(.dark *){background-color:#ffffff0d}@supports (color:color-mix(in lab, red, red)){.dark\:bg-white\/5:is(.dark *){background-color:color-mix(in oklab, var(--color-white) 5%, transparent)}}.dark\:bg-white\/10:is(.dark *){background-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-white\/10:is(.dark *){background-color:color-mix(in oklab, var(--color-white) 10%, transparent)}}.dark\:bg-white\/15:is(.dark *){background-color:#ffffff26}@supports (color:color-mix(in lab, red, red)){.dark\:bg-white\/15:is(.dark *){background-color:color-mix(in oklab, var(--color-white) 15%, transparent)}}.dark\:bg-yellow-500\/10:is(.dark *){background-color:#edb2001a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-yellow-500\/10:is(.dark *){background-color:color-mix(in oklab, var(--color-yellow-500) 10%, transparent)}}.dark\:bg-yellow-500\/20:is(.dark *){background-color:#edb20033}@supports (color:color-mix(in lab, red, red)){.dark\:bg-yellow-500\/20:is(.dark *){background-color:color-mix(in oklab, var(--color-yellow-500) 20%, transparent)}}.dark\:from-primary\/5:is(.dark *){--tw-gradient-from:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.dark\:from-primary\/5:is(.dark *){--tw-gradient-from:color-mix(in oklab, var(--color-primary) 5%, transparent)}}.dark\:from-primary\/5:is(.dark *){--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.dark\:from-transparent:is(.dark *){--tw-gradient-from:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.dark\:from-white\/5:is(.dark *){--tw-gradient-from:#ffffff0d}@supports (color:color-mix(in lab, red, red)){.dark\:from-white\/5:is(.dark *){--tw-gradient-from:color-mix(in oklab, var(--color-white) 5%, transparent)}}.dark\:from-white\/5:is(.dark *){--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.dark\:to-transparent:is(.dark *){--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.dark\:to-white\/10:is(.dark *){--tw-gradient-to:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.dark\:to-white\/10:is(.dark *){--tw-gradient-to:color-mix(in oklab, var(--color-white) 10%, transparent)}}.dark\:to-white\/10:is(.dark *){--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.dark\:text-\[\#C3C3C3\]:is(.dark *){color:#c3c3c3}.dark\:text-accent-red:is(.dark *),.dark\:text-accent-red\/80:is(.dark *){color:var(--color-accent-red)}@supports (color:color-mix(in lab, red, red)){.dark\:text-accent-red\/80:is(.dark *){color:color-mix(in oklab, var(--color-accent-red) 80%, transparent)}}.dark\:text-amber-200:is(.dark *){color:var(--color-amber-200)}.dark\:text-amber-300:is(.dark *){color:var(--color-amber-300)}.dark\:text-amber-300\/80:is(.dark *){color:#ffd236cc}@supports (color:color-mix(in lab, red, red)){.dark\:text-amber-300\/80:is(.dark *){color:color-mix(in oklab, var(--color-amber-300) 80%, transparent)}}.dark\:text-amber-400:is(.dark *){color:var(--color-amber-400)}.dark\:text-amber-400\/80:is(.dark *){color:#fcbb00cc}@supports (color:color-mix(in lab, red, red)){.dark\:text-amber-400\/80:is(.dark *){color:color-mix(in oklab, var(--color-amber-400) 80%, transparent)}}.dark\:text-amber-500:is(.dark *){color:var(--color-amber-500)}.dark\:text-blue-200:is(.dark *){color:var(--color-blue-200)}.dark\:text-blue-300:is(.dark *){color:var(--color-blue-300)}.dark\:text-blue-400:is(.dark *){color:var(--color-blue-400)}.dark\:text-blue-500:is(.dark *){color:var(--color-blue-500)}.dark\:text-content:is(.dark *){color:var(--color-text)}.dark\:text-content-muted:is(.dark *),.dark\:text-content-muted\/40:is(.dark *){color:var(--color-text-muted)}@supports (color:color-mix(in lab, red, red)){.dark\:text-content-muted\/40:is(.dark *){color:color-mix(in oklab, var(--color-text-muted) 40%, transparent)}}.dark\:text-content-muted\/50:is(.dark *){color:var(--color-text-muted)}@supports (color:color-mix(in lab, red, red)){.dark\:text-content-muted\/50:is(.dark *){color:color-mix(in oklab, var(--color-text-muted) 50%, transparent)}}.dark\:text-content-muted\/60:is(.dark *){color:var(--color-text-muted)}@supports (color:color-mix(in lab, red, red)){.dark\:text-content-muted\/60:is(.dark *){color:color-mix(in oklab, var(--color-text-muted) 60%, transparent)}}.dark\:text-content-muted\/70:is(.dark *){color:var(--color-text-muted)}@supports (color:color-mix(in lab, red, red)){.dark\:text-content-muted\/70:is(.dark *){color:color-mix(in oklab, var(--color-text-muted) 70%, transparent)}}.dark\:text-content-muted\/80:is(.dark *){color:var(--color-text-muted)}@supports (color:color-mix(in lab, red, red)){.dark\:text-content-muted\/80:is(.dark *){color:color-mix(in oklab, var(--color-text-muted) 80%, transparent)}}.dark\:text-content-primary:is(.dark *),.dark\:text-content-primary\/70:is(.dark *){color:var(--color-text-primary)}@supports (color:color-mix(in lab, red, red)){.dark\:text-content-primary\/70:is(.dark *){color:color-mix(in oklab, var(--color-text-primary) 70%, transparent)}}.dark\:text-content-primary\/80:is(.dark *){color:var(--color-text-primary)}@supports (color:color-mix(in lab, red, red)){.dark\:text-content-primary\/80:is(.dark *){color:color-mix(in oklab, var(--color-text-primary) 80%, transparent)}}.dark\:text-content-primary\/90:is(.dark *){color:var(--color-text-primary)}@supports (color:color-mix(in lab, red, red)){.dark\:text-content-primary\/90:is(.dark *){color:color-mix(in oklab, var(--color-text-primary) 90%, transparent)}}.dark\:text-content-secondary:is(.dark *){color:var(--color-text-secondary)}.dark\:text-cyan-300:is(.dark *){color:var(--color-cyan-300)}.dark\:text-cyan-400:is(.dark *){color:var(--color-cyan-400)}.dark\:text-cyan-400\/60:is(.dark *){color:#00d2ef99}@supports (color:color-mix(in lab, red, red)){.dark\:text-cyan-400\/60:is(.dark *){color:color-mix(in oklab, var(--color-cyan-400) 60%, transparent)}}.dark\:text-emerald-400:is(.dark *){color:var(--color-emerald-400)}.dark\:text-gray-400:is(.dark *){color:var(--color-gray-400)}.dark\:text-gray-500:is(.dark *){color:var(--color-gray-500)}.dark\:text-gray-700:is(.dark *){color:var(--color-gray-700)}.dark\:text-green-300:is(.dark *){color:var(--color-green-300)}.dark\:text-green-400:is(.dark *){color:var(--color-green-400)}.dark\:text-green-500:is(.dark *){color:var(--color-green-500)}.dark\:text-orange-400:is(.dark *){color:var(--color-orange-400)}.dark\:text-orange-400\/60:is(.dark *){color:#ff8b1a99}@supports (color:color-mix(in lab, red, red)){.dark\:text-orange-400\/60:is(.dark *){color:color-mix(in oklab, var(--color-orange-400) 60%, transparent)}}.dark\:text-primary:is(.dark *),.dark\:text-primary\/80:is(.dark *){color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.dark\:text-primary\/80:is(.dark *){color:color-mix(in oklab, var(--color-primary) 80%, transparent)}}.dark\:text-purple-400:is(.dark *){color:var(--color-purple-400)}.dark\:text-red-200:is(.dark *){color:var(--color-red-200)}.dark\:text-red-300:is(.dark *){color:var(--color-red-300)}.dark\:text-red-400:is(.dark *){color:var(--color-red-400)}.dark\:text-red-400\/80:is(.dark *){color:#ff6568cc}@supports (color:color-mix(in lab, red, red)){.dark\:text-red-400\/80:is(.dark *){color:color-mix(in oklab, var(--color-red-400) 80%, transparent)}}.dark\:text-white:is(.dark *){color:var(--color-white)}.dark\:text-white\/30:is(.dark *){color:#ffffff4d}@supports (color:color-mix(in lab, red, red)){.dark\:text-white\/30:is(.dark *){color:color-mix(in oklab, var(--color-white) 30%, transparent)}}.dark\:text-white\/40:is(.dark *){color:#fff6}@supports (color:color-mix(in lab, red, red)){.dark\:text-white\/40:is(.dark *){color:color-mix(in oklab, var(--color-white) 40%, transparent)}}.dark\:text-white\/50:is(.dark *){color:#ffffff80}@supports (color:color-mix(in lab, red, red)){.dark\:text-white\/50:is(.dark *){color:color-mix(in oklab, var(--color-white) 50%, transparent)}}.dark\:text-white\/60:is(.dark *){color:#fff9}@supports (color:color-mix(in lab, red, red)){.dark\:text-white\/60:is(.dark *){color:color-mix(in oklab, var(--color-white) 60%, transparent)}}.dark\:text-white\/80:is(.dark *){color:#fffc}@supports (color:color-mix(in lab, red, red)){.dark\:text-white\/80:is(.dark *){color:color-mix(in oklab, var(--color-white) 80%, transparent)}}.dark\:text-yellow-200:is(.dark *){color:var(--color-yellow-200)}.dark\:text-yellow-300:is(.dark *){color:var(--color-yellow-300)}.dark\:text-yellow-400:is(.dark *){color:var(--color-yellow-400)}.dark\:decoration-white\/30:is(.dark *){text-decoration-color:#ffffff4d}@supports (color:color-mix(in lab, red, red)){.dark\:decoration-white\/30:is(.dark *){-webkit-text-decoration-color:color-mix(in oklab, var(--color-white) 30%, transparent);-webkit-text-decoration-color:color-mix(in oklab, var(--color-white) 30%, transparent);-webkit-text-decoration-color:color-mix(in oklab, var(--color-white) 30%, transparent);text-decoration-color:color-mix(in oklab, var(--color-white) 30%, transparent)}}.dark\:placeholder-white\/30:is(.dark *)::placeholder{color:#ffffff4d}@supports (color:color-mix(in lab, red, red)){.dark\:placeholder-white\/30:is(.dark *)::placeholder{color:color-mix(in oklab, var(--color-white) 30%, transparent)}}.dark\:placeholder-white\/40:is(.dark *)::placeholder{color:#fff6}@supports (color:color-mix(in lab, red, red)){.dark\:placeholder-white\/40:is(.dark *)::placeholder{color:color-mix(in oklab, var(--color-white) 40%, transparent)}}.dark\:placeholder-white\/50:is(.dark *)::placeholder{color:#ffffff80}@supports (color:color-mix(in lab, red, red)){.dark\:placeholder-white\/50:is(.dark *)::placeholder{color:color-mix(in oklab, var(--color-white) 50%, transparent)}}.dark\:mix-blend-screen:is(.dark *){mix-blend-mode:screen}.dark\:shadow-\[0_4px_12px_rgba\(170\,232\,232\,0\.25\)\]:is(.dark *){--tw-shadow:0 4px 12px var(--tw-shadow-color,#aae8e840);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.dark\:shadow-\[0_8px_32px_0_rgba\(0\,0\,0\,0\.37\)\]:is(.dark *){--tw-shadow:0 8px 32px 0 var(--tw-shadow-color,#0000005e);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.dark\:shadow-none:is(.dark *){--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.dark\:ring-primary\/50:is(.dark *){--tw-ring-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.dark\:ring-primary\/50:is(.dark *){--tw-ring-color:color-mix(in oklab, var(--color-primary) 50%, transparent)}}.dark\:brightness-100:is(.dark *){--tw-brightness:brightness(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.dark\:drop-shadow-\[0_0_6px_rgba\(59\,130\,246\,0\.8\)\]:is(.dark *){--tw-drop-shadow-size:drop-shadow(0 0 6px var(--tw-drop-shadow-color,#3b82f6cc));--tw-drop-shadow:var(--tw-drop-shadow-size);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.dark\:invert-0:is(.dark *){--tw-invert:invert(0%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}@media (hover:hover){.dark\:group-hover\:border-stroke\/50:is(.dark *):is(:where(.group):hover *){border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.dark\:group-hover\:border-stroke\/50:is(.dark *):is(:where(.group):hover *){border-color:color-mix(in oklab, var(--color-border) 50%, transparent)}}.dark\:group-hover\:text-white:is(.dark *):is(:where(.group):hover *){color:var(--color-white)}.dark\:hover\:border-primary\/20:is(.dark *):hover{border-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:border-primary\/20:is(.dark *):hover{border-color:color-mix(in oklab, var(--color-primary) 20%, transparent)}}.dark\:hover\:border-primary\/50:is(.dark *):hover{border-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:border-primary\/50:is(.dark *):hover{border-color:color-mix(in oklab, var(--color-primary) 50%, transparent)}}.dark\:hover\:border-stroke:is(.dark *):hover,.dark\:hover\:border-stroke\/20:is(.dark *):hover{border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:border-stroke\/20:is(.dark *):hover{border-color:color-mix(in oklab, var(--color-border) 20%, transparent)}}.dark\:hover\:border-stroke\/30:is(.dark *):hover{border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:border-stroke\/30:is(.dark *):hover{border-color:color-mix(in oklab, var(--color-border) 30%, transparent)}}.dark\:hover\:border-white\/15:is(.dark *):hover{border-color:#ffffff26}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:border-white\/15:is(.dark *):hover{border-color:color-mix(in oklab, var(--color-white) 15%, transparent)}}.dark\:hover\:bg-amber-400\/30:is(.dark *):hover{background-color:#fcbb004d}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-amber-400\/30:is(.dark *):hover{background-color:color-mix(in oklab, var(--color-amber-400) 30%, transparent)}}.dark\:hover\:bg-amber-600:is(.dark *):hover{background-color:var(--color-amber-600)}.dark\:hover\:bg-background-mute:is(.dark *):hover{background-color:var(--color-background-mute)}.dark\:hover\:bg-background\/20:is(.dark *):hover{background-color:var(--color-background)}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-background\/20:is(.dark *):hover{background-color:color-mix(in oklab, var(--color-background) 20%, transparent)}}.dark\:hover\:bg-background\/30:is(.dark *):hover{background-color:var(--color-background)}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-background\/30:is(.dark *):hover{background-color:color-mix(in oklab, var(--color-background) 30%, transparent)}}.dark\:hover\:bg-cyan-500\/20:is(.dark *):hover{background-color:#00b7d733}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-cyan-500\/20:is(.dark *):hover{background-color:color-mix(in oklab, var(--color-cyan-500) 20%, transparent)}}.dark\:hover\:bg-gray-600:is(.dark *):hover{background-color:var(--color-gray-600)}.dark\:hover\:bg-indigo-500\/20:is(.dark *):hover{background-color:#625fff33}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-indigo-500\/20:is(.dark *):hover{background-color:color-mix(in oklab, var(--color-indigo-500) 20%, transparent)}}.dark\:hover\:bg-primary\/5:is(.dark *):hover{background-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-primary\/5:is(.dark *):hover{background-color:color-mix(in oklab, var(--color-primary) 5%, transparent)}}.dark\:hover\:bg-primary\/30:is(.dark *):hover{background-color:var(--color-primary)}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-primary\/30:is(.dark *):hover{background-color:color-mix(in oklab, var(--color-primary) 30%, transparent)}}.dark\:hover\:bg-red-400\/20:is(.dark *):hover{background-color:#ff656833}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-red-400\/20:is(.dark *):hover{background-color:color-mix(in oklab, var(--color-red-400) 20%, transparent)}}.dark\:hover\:bg-red-400\/30:is(.dark *):hover{background-color:#ff65684d}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-red-400\/30:is(.dark *):hover{background-color:color-mix(in oklab, var(--color-red-400) 30%, transparent)}}.dark\:hover\:bg-red-600:is(.dark *):hover{background-color:var(--color-red-600)}.dark\:hover\:bg-red-900\/20:is(.dark *):hover{background-color:#82181a33}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-red-900\/20:is(.dark *):hover{background-color:color-mix(in oklab, var(--color-red-900) 20%, transparent)}}.dark\:hover\:bg-stroke\/5:is(.dark *):hover{background-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-stroke\/5:is(.dark *):hover{background-color:color-mix(in oklab, var(--color-border) 5%, transparent)}}.dark\:hover\:bg-stroke\/30:is(.dark *):hover{background-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-stroke\/30:is(.dark *):hover{background-color:color-mix(in oklab, var(--color-border) 30%, transparent)}}.dark\:hover\:bg-surface\/50:is(.dark *):hover{background-color:var(--color-surface)}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-surface\/50:is(.dark *):hover{background-color:color-mix(in oklab, var(--color-surface) 50%, transparent)}}.dark\:hover\:bg-white\/5:is(.dark *):hover{background-color:#ffffff0d}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-white\/5:is(.dark *):hover{background-color:color-mix(in oklab, var(--color-white) 5%, transparent)}}.dark\:hover\:bg-white\/10:is(.dark *):hover{background-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-white\/10:is(.dark *):hover{background-color:color-mix(in oklab, var(--color-white) 10%, transparent)}}.dark\:hover\:bg-white\/20:is(.dark *):hover{background-color:#fff3}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-white\/20:is(.dark *):hover{background-color:color-mix(in oklab, var(--color-white) 20%, transparent)}}.dark\:hover\:bg-yellow-500\/20:is(.dark *):hover{background-color:#edb20033}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-yellow-500\/20:is(.dark *):hover{background-color:color-mix(in oklab, var(--color-yellow-500) 20%, transparent)}}.dark\:hover\:from-white\/10:is(.dark *):hover{--tw-gradient-from:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:from-white\/10:is(.dark *):hover{--tw-gradient-from:color-mix(in oklab, var(--color-white) 10%, transparent)}}.dark\:hover\:from-white\/10:is(.dark *):hover{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.dark\:hover\:to-white\/15:is(.dark *):hover{--tw-gradient-to:#ffffff26}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:to-white\/15:is(.dark *):hover{--tw-gradient-to:color-mix(in oklab, var(--color-white) 15%, transparent)}}.dark\:hover\:to-white\/15:is(.dark *):hover{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.dark\:hover\:text-content-muted:is(.dark *):hover{color:var(--color-text-muted)}.dark\:hover\:text-content-primary:is(.dark *):hover,.dark\:hover\:text-content-primary\/80:is(.dark *):hover{color:var(--color-text-primary)}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:text-content-primary\/80:is(.dark *):hover{color:color-mix(in oklab, var(--color-text-primary) 80%, transparent)}}.dark\:hover\:text-content-secondary:is(.dark *):hover{color:var(--color-text-secondary)}.dark\:hover\:text-red-400:is(.dark *):hover{color:var(--color-red-400)}.dark\:hover\:text-white:is(.dark *):hover{color:var(--color-white)}.dark\:hover\:text-white\/80:is(.dark *):hover{color:#fffc}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:text-white\/80:is(.dark *):hover{color:color-mix(in oklab, var(--color-white) 80%, transparent)}}.dark\:hover\:shadow-\[0_2px_8px_rgba\(170\,232\,212\,0\.15\)\]:is(.dark *):hover{--tw-shadow:0 2px 8px var(--tw-shadow-color,#aae8d426);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.dark\:hover\:shadow-\[0_2px_8px_rgba\(170\,232\,232\,0\.15\)\]:is(.dark *):hover{--tw-shadow:0 2px 8px var(--tw-shadow-color,#aae8e826);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}}.dark\:focus\:border-accent-purple\/50:is(.dark *):focus{border-color:var(--color-accent-purple)}@supports (color:color-mix(in lab, red, red)){.dark\:focus\:border-accent-purple\/50:is(.dark *):focus{border-color:color-mix(in oklab, var(--color-accent-purple) 50%, transparent)}}.dark\:focus\:bg-white\/10:is(.dark *):focus{background-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.dark\:focus\:bg-white\/10:is(.dark *):focus{background-color:color-mix(in oklab, var(--color-white) 10%, transparent)}}@media (width>=40rem){.dark\:sm\:border-stroke\/20:is(.dark *){border-color:var(--color-border)}@supports (color:color-mix(in lab, red, red)){.dark\:sm\:border-stroke\/20:is(.dark *){border-color:color-mix(in oklab, var(--color-border) 20%, transparent)}}}@media (width>=64rem){.lg\:dark\:block:is(.dark *){display:block}}.\[\&_path\]\:fill-current path{fill:currentColor}:root{--vt-c-white:#fff;--vt-c-white-soft:#f8f8f8;--vt-c-white-mute:#f2f2f2;--vt-c-black:#181818;--vt-c-black-soft:#222;--vt-c-black-mute:#282828;--vt-c-indigo:#2c3e50;--vt-c-divider-light-1:#3c3c3c4a;--vt-c-divider-light-2:#3c3c3c1f;--vt-c-divider-dark-1:#545454a6;--vt-c-divider-dark-2:#5454547a;--vt-c-text-light-1:var(--vt-c-indigo);--vt-c-text-light-2:#3c3c3ca8;--vt-c-text-dark-1:var(--vt-c-white);--vt-c-text-dark-2:#ebebeba3;--color-surface:#fff;--color-surface-elevated:#fff;--color-background:#f5f7fa;--color-background-soft:#f8f8f8;--color-background-mute:#ebeef2;--color-text-primary:#111827;--color-text-secondary:#374151;--color-text-muted:#6b7280;--color-heading:#030712;--color-text:#374151;--color-border:#9ca3af;--color-border-subtle:#d1d5db;--color-border-hover:#6b7280;--color-primary:#0d7377;--color-secondary:#92610a;--color-accent-green:#15803d;--color-accent-purple:#7c3aed;--color-accent-red:#dc2626;--color-accent-cyan:#0e7490;--section-gap:160px;--color-primary-bg:#aae8e8;--color-secondary-bg:#ffc246;--color-accent-green-bg:#a5e5b6;--color-accent-purple-bg:#eba0fc;--color-accent-red-bg:#fb787b;--color-accent-cyan-bg:#d1e6e4;--color-badge-cyan-bg:#d1e6e4;--color-badge-cyan-text:#0d7377;--color-badge-neutral-bg:#e5e7eb;--color-badge-neutral-text:#374151;--color-glass-bg:#ffffffbf;--color-glass-border:#0000000f;--color-glass-shadow:0 4px 16px #0000000a, 0 1px 3px #00000005;--color-glass-green-bg:linear-gradient(91deg, #a5e5b659 1.17%, #a5e5b626 99.82%);--color-glass-green-border:#a5e5b64d;--color-glass-green-shadow:0 4px 12px #a5e5b626;--color-glass-orange-bg:linear-gradient(91deg, #f59e0b40 1.17%, #f59e0b1f 99.82%);--color-glass-orange-border:#f59e0b40;--color-glass-orange-shadow:0 4px 12px #f59e0b26}.dark{--color-surface:#0f1112;--color-surface-elevated:#1a1e1f;--color-background:#09090b;--color-background-soft:#111314;--color-background-mute:#1a1e1f;--color-text-primary:#f9fafb;--color-text-secondary:#d1d5db;--color-text-muted:#9ca3af;--color-heading:#fff;--color-text:#adadad;--color-border:#4b4b4b;--color-border-subtle:#374151;--color-border-hover:#6b7280;--color-primary:#aae8e8;--color-secondary:#ffc246;--color-accent-green:#a5e5b6;--color-accent-purple:#eba0fc;--color-accent-red:#fb787b;--color-accent-cyan:#d1e6e4;--color-primary-bg:#0d7377;--color-secondary-bg:#92610a;--color-accent-green-bg:#15803d;--color-accent-purple-bg:#7c3aed;--color-accent-red-bg:#dc2626;--color-accent-cyan-bg:#0e7490;--color-badge-cyan-bg:#223231;--color-badge-cyan-text:#d1e6e4;--color-badge-neutral-bg:#374151;--color-badge-neutral-text:#d1d5db;--color-glass-bg:#0006;--color-glass-border:#ffffff0d;--color-glass-shadow:0 4px 16px #0003;--color-glass-green-bg:linear-gradient(91deg, #15803d40 1.17%, #15803d1a 99.82%);--color-glass-green-border:#a5e5b626;--color-glass-green-shadow:0 4px 12px #0003;--color-glass-orange-bg:linear-gradient(91deg, #f59e0b40 1.17%, #f59e0b1f 99.82%);--color-glass-orange-border:#f59e0b26;--color-glass-orange-shadow:0 4px 12px #0003}*,:before,:after{box-sizing:border-box;margin:0;font-weight:400}button{cursor:pointer}body{min-height:100vh;color:var(--color-text);background:var(--color-background);text-rendering:optimizelegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:15px;line-height:1.6;transition:color .5s,background-color .5s}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}}@keyframes sparkline-draw-009b3103{0%{stroke-dasharray:1000;stroke-dashoffset:1000px}to{stroke-dasharray:1000;stroke-dashoffset:0}}.sparkline-animate[data-v-009b3103]{animation:1s ease-out sparkline-draw-009b3103}.glass-card[data-v-2c9f179a]{-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);background:#000000b3;border:1px solid #ffffff1a}@keyframes ping-2c9f179a{75%,to{opacity:0;transform:scale(2)}}@keyframes ping-fast-2c9f179a{0%{opacity:1;transform:scale(1)}75%,to{opacity:0;transform:scale(4)}}.animate-ping[data-v-2c9f179a]{animation:cubic-bezier(0,0,.2,1) infinite ping-2c9f179a}.animate-ping-fast[data-v-2c9f179a]{animation:.8s cubic-bezier(0,0,.2,1) 3 ping-fast-2c9f179a}.sidebar-item-enter-active[data-v-d921c3e8]{transition:opacity .2s,transform .2s}.sidebar-item-enter-from[data-v-d921c3e8]{opacity:0;transform:translateY(-4px)}body{color:#1f2937;background-color:#f9fafb;margin:0;padding:0;transition:background-color .3s,color .3s}.dark body{color:#fff;background-color:#09090b}.dark html{scrollbar-width:thin;scrollbar-color:#374151 #1f2937}.dark html::-webkit-scrollbar{width:8px}.dark html::-webkit-scrollbar-track{background:#1f2937}.dark html::-webkit-scrollbar-thumb{background-color:#374151;border-radius:4px}.dark html::-webkit-scrollbar-thumb:hover{background-color:#4b5563}html{scrollbar-width:thin;scrollbar-color:#d1d5db #f3f4f6}html::-webkit-scrollbar{width:8px}html::-webkit-scrollbar-track{background:#f3f4f6}html::-webkit-scrollbar-thumb{background-color:#d1d5db;border-radius:4px}html::-webkit-scrollbar-thumb:hover{background-color:#9ca3af}.scrollbar-hide{-ms-overflow-style:none;scrollbar-width:none}.scrollbar-hide::-webkit-scrollbar{display:none} diff --git a/repeater/web/html/assets/index-BpKhPa08.js b/repeater/web/html/assets/index-BpKhPa08.js new file mode 100644 index 0000000..cc4961f --- /dev/null +++ b/repeater/web/html/assets/index-BpKhPa08.js @@ -0,0 +1 @@ +import{B as e,Ct as t,D as n,E as r,N as i,P as a,R as o,St as s,V as c,Y as l,c as u,f as d,g as f,h as p,i as m,j as h,k as g,l as _,m as v,nt as y,o as b,p as x,r as S,s as C,tt as w,u as T,w as E,xt as D}from"./runtime-core.esm-bundler-C5QBTNWE.js";import{n as O,o as k,r as A,t as j,u as M}from"./runtime-dom.esm-bundler-fKU3dih-.js";import{_ as N,a as P,d as F,g as I,h as L,i as R,l as z,o as ee,s as te,t as B,u as V,y as H}from"./api-C0ctTLHN.js";import{t as U}from"./packets-B7XZyaZ9.js";import{t as W}from"./system-Dx7MrhAz.js";import{n as ne,r as re,t as G}from"./dataService-CLvdg62X.js";import{t as K}from"./_plugin-vue_export-helper-TcpyXLsZ.js";import{t as q}from"./useTheme-D8lKuC-u.js";import{t as J}from"./Spinner-CYvUNW0P.js";import{n as Y,r as ie,t as ae}from"./constants-CqNUcWkW.js";import{t as oe}from"./websocket-BBHBKSxR.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var se=`/assets/meshcore-DQNtEl5I.svg`,ce={},le={width:`23`,height:`25`,viewBox:`0 0 23 25`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`};function ue(e,t){return g(),T(`svg`,le,[...t[0]||=[C(`path`,{d:`M2.84279 2.25795C2.90709 1.12053 3.17879 0.625914 3.95795 0.228723C4.79631 -0.198778 6.11858 0.000168182 7.67449 0.788054C8.34465 1.12757 8.41289 1.13448 9.58736 0.983905C11.1485 0.783681 13.1582 0.784388 14.5991 0.985738C15.6887 1.13801 15.7603 1.1304 16.4321 0.790174C18.6406 -0.328212 20.3842 -0.255036 21.0156 0.982491C21.3308 1.6002 21.3893 3.20304 21.1449 4.52503C21.0094 5.25793 21.0238 5.34943 21.3502 5.83037C23.6466 9.21443 21.9919 14.6998 18.0569 16.7469C17.7558 16.9036 17.502 17.0005 17.2952 17.0795C16.6602 17.3219 16.4674 17.3956 16.7008 18.5117C16.8132 19.0486 16.9486 20.3833 17.0018 21.478C17.098 23.4567 17.0966 23.4705 16.7495 23.8742C16.2772 24.4233 15.5963 24.4326 15.135 23.8962C14.8341 23.5464 14.8047 23.3812 14.8047 22.0315C14.8047 20.037 14.5861 18.7113 14.0695 17.5753C13.4553 16.2235 13.9106 15.7194 15.3154 15.4173C17.268 14.9973 18.793 13.7923 19.643 11.9978C20.4511 10.2921 20.5729 7.93485 19.1119 6.50124C18.6964 6.00746 18.6674 5.56022 18.9641 4.21159C19.075 3.70754 19.168 3.05725 19.1707 2.76637C19.1749 2.30701 19.1331 2.23764 18.8509 2.23764C18.6724 2.23764 17.9902 2.49736 17.3352 2.81474L16.2897 3.32145C16.1947 3.36751 16.0883 3.38522 15.9834 3.37318C13.3251 3.06805 10.7991 3.06334 8.12774 3.37438C8.02244 3.38663 7.91563 3.36892 7.82025 3.32263L6.77535 2.81559C6.12027 2.49764 5.43813 2.23764 5.25963 2.23764C4.84693 2.23764 4.84072 2.54233 5.2169 4.35258C5.44669 5.45816 5.60133 5.70451 4.93703 6.58851C3.94131 7.91359 3.69258 9.55902 4.22654 11.2878C4.89952 13.4664 6.54749 14.9382 8.86436 15.4292C10.261 15.7253 10.6261 16.1115 10.0928 17.713C9.67293 18.9734 9.40748 19.2982 8.79738 19.2982C7.97649 19.2982 7.46228 18.5871 7.74527 17.843C7.86991 17.5151 7.83283 17.4801 7.06383 17.1996C4.71637 16.3437 2.9209 14.4254 2.10002 11.8959C1.46553 9.94098 1.74471 7.39642 2.76257 5.85843C3.10914 5.33477 3.1145 5.29036 2.95277 4.28787C2.86126 3.72037 2.81177 2.80699 2.84279 2.25795Z`,fill:`currentColor`},null,-1),C(`path`,{d:`M2.02306 16.5589C1.68479 16.0516 0.999227 15.9144 0.491814 16.2527C-0.0155884 16.591 -0.152708 17.2765 0.185564 17.7839C0.435301 18.1586 0.734065 18.4663 0.987777 18.72C1.03455 18.7668 1.08 18.8119 1.12438 18.856C1.3369 19.0671 1.52455 19.2535 1.71302 19.4748C2.12986 19.964 2.54572 20.623 2.78206 21.8047C2.88733 22.3311 3.26569 22.6147 3.47533 22.7386C3.70269 22.8728 3.9511 22.952 4.15552 23.0036C4.57369 23.109 5.08133 23.1638 5.56309 23.1957C6.09196 23.2308 6.665 23.2422 7.17743 23.2453C7.1778 23.8547 7.67202 24.3487 8.28162 24.3487C8.89146 24.3487 9.38582 23.8543 9.38582 23.2445V22.1403C9.38582 21.5305 8.89146 21.0361 8.28162 21.0361C8.17753 21.0361 8.06491 21.0364 7.94562 21.0369C7.29761 21.0389 6.45295 21.0414 5.70905 20.9922C5.35033 20.9684 5.05544 20.9347 4.8392 20.8936C4.50619 19.5863 3.96821 18.7165 3.39415 18.0426C3.14038 17.7448 2.87761 17.4842 2.66387 17.2722C2.62385 17.2326 2.58556 17.1946 2.54935 17.1584C2.30273 16.9118 2.1414 16.7365 2.02306 16.5589Z`,fill:`currentColor`},null,-1)]])}var de=K(ce,[[`render`,ue]]),fe={},pe={viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`};function me(e,t){return g(),T(`svg`,pe,[...t[0]||=[C(`path`,{d:`M20.317 4.369a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.078.037c-.211.375-.444.864-.608 1.249a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.249.077.077 0 0 0-.078-.037 19.736 19.736 0 0 0-4.885 1.515.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.056 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.027 14.16 14.16 0 0 0 1.226-1.994.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.927 1.793 8.18 1.793 12.061 0a.074.074 0 0 1 .078.009c.12.098.246.196.373.293a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.04.107c.36.698.769 1.361 1.225 1.994a.076.076 0 0 0 .084.028 19.876 19.876 0 0 0 6.002-3.03.077.077 0 0 0 .031-.055c.5-5.177-.838-9.674-3.548-13.66a.061.061 0 0 0-.031-.028ZM8.02 15.331c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.211 0 2.166 1.095 2.157 2.419 0 1.334-.955 2.419-2.157 2.419Zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.211 0 2.166 1.095 2.157 2.419 0 1.334-.946 2.419-2.157 2.419Z`},null,-1)]])}var he=K(fe,[[`render`,me]]),X={},Z={width:`17`,height:`24`,viewBox:`0 0 17 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`};function ge(e,t){return g(),T(`svg`,Z,[...t[0]||=[d(``,12)]])}var _e=K(X,[[`render`,ge]]),ve={class:`bg-transparent dark:bg-white/5 rounded-lg border border-stroke-subtle dark:border-white/10 p-5 relative overflow-hidden`},ye={key:0,class:`absolute inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-10 rounded-lg`},be={class:`text-center`},xe={class:`flex items-center justify-center gap-2 mb-2`},Se={class:`flex items-baseline gap-2 mb-4`},Ce={class:`text-content-primary dark:text-content-primary text-2xl font-medium`},Q={key:0,class:`text-content-secondary dark:text-content-muted text-xs uppercase`},$=[`viewBox`],we=[`y1`,`y2`,`stroke`],Te=[`cx`,`cy`,`fill`],Ee=200,De=50,Oe=4,ke=K(f({__name:`RFNoiseFloor`,props:{limit:{default:void 0}},setup(e){let n={noiseFloorDot:`rgba(245, 158, 11, 0.8)`},{theme:i}=q(),a=b(()=>i.value===`dark`?`rgba(255, 255, 255, 0.1)`:`rgba(0, 0, 0, 0.1)`),o=U(),s=W(),c=G(),l=(e,t)=>{let n=t/100*(e.length-1),r=Math.floor(n),i=Math.ceil(n);return r===i?e[r]:e[r]+(e[i]-e[r])*(n-r)},u=b(()=>{let e=f.value;if(e.length===0)return[];let t=[...e].sort((e,t)=>e-t),n=l(t,2.5),r=l(t,97.5),i=r-n,a=Math.max(i*.05,.5),o=n-a,s=r+a,c=s-o||1;return e.map((t,n)=>{let r=Oe+n/Math.max(e.length-1,1)*(Ee-Oe*2),i=(Math.max(o,Math.min(s,t))-o)/c;return{x:r,y:De-Oe-i*(De-Oe*2)}})});r(()=>{c.ensure(`noiseFloor`)});let d=b(()=>s.noiseFloorDbm??o.currentNoiseFloor),f=b(()=>o.noiseFloorSparklineData);return(e,r)=>(g(),T(`div`,ve,[y(s).cadCalibrationRunning?(g(),T(`div`,ye,[C(`div`,be,[C(`div`,xe,[v(J,{size:`sm`,color:`current`}),r[0]||=C(`span`,{class:`text-secondary text-sm font-medium`},`CAD Calibration`,-1)]),r[1]||=C(`p`,{class:`text-content-muted dark:text-content-muted text-xs`},`In Progress`,-1)])])):_(``,!0),r[2]||=C(`p`,{class:`text-content-secondary dark:text-content-muted text-xs uppercase mb-2`},` RF NOISE FLOOR `,-1),C(`div`,Se,[C(`span`,Ce,t(d.value===null?`Unknown`:d.value),1),d.value===null?_(``,!0):(g(),T(`span`,Q,`dBm`))]),(g(),T(`svg`,{class:`w-full h-[50px]`,viewBox:`0 0 ${Ee} ${De}`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[(g(),T(S,null,h(3,e=>C(`line`,{key:`grid-`+e,x1:0,y1:e*De/4,x2:Ee,y2:e*De/4,stroke:a.value,"stroke-width":`1`},null,8,we)),64)),(g(!0),T(S,null,h(u.value,(e,t)=>(g(),T(`circle`,{key:`point-`+t,cx:e.x,cy:e.y,r:`1.5`,fill:n.noiseFloorDot,class:`transition-all duration-300`},null,8,Te))),128))],8,$))]))}}),[[`__scopeId`,`data-v-009b3103`]]),Ae={},je={width:`800px`,height:`800px`,viewBox:`0 -1.5 20 20`,version:`1.1`,xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,class:`w-full h-full`};function Me(e,t){return g(),T(`svg`,je,[...t[0]||=[C(`g`,{id:`Page-1`,stroke:`none`,"stroke-width":`1`,fill:`none`,"fill-rule":`evenodd`},[C(`g`,{transform:`translate(-420.000000, -3641.000000)`,fill:`currentColor`},[C(`g`,{id:`icons`,transform:`translate(56.000000, 160.000000)`},[C(`path`,{d:`M378.195439,3483.828 L376.781439,3485.242 C378.195439,3486.656 378.294439,3489.588 376.880439,3491.002 L378.294439,3492.417 C380.415439,3490.295 380.316439,3485.949 378.195439,3483.828 M381.023439,3481 L379.609439,3482.414 C382.438439,3485.242 382.537439,3491.002 379.708439,3493.831 L381.122439,3495.245 C385.365439,3491.002 384.559439,3484.535 381.023439,3481 M375.432439,3486.737 C375.409439,3486.711 375.392439,3486.682 375.367439,3486.656 L375.363439,3486.66 C374.582439,3485.879 373.243439,3485.952 372.536439,3486.659 C371.829439,3487.366 371.831439,3488.778 372.538439,3489.485 C372.547439,3489.494 372.558439,3489.499 372.567439,3489.508 C372.590439,3489.534 372.607439,3489.563 372.632439,3489.588 L372.636439,3489.585 C373.201439,3490.15 373.000439,3488.284 373.000439,3498 L375.000439,3498 C375.000439,3488.058 374.753439,3490.296 375.463439,3489.586 C376.170439,3488.879 376.168439,3487.467 375.461439,3486.76 C375.452439,3486.751 375.441439,3486.746 375.432439,3486.737 M371.119439,3485.242 L369.705439,3483.828 C367.584439,3485.949 367.683439,3490.295 369.804439,3492.417 L371.218439,3491.002 C369.804439,3489.588 369.705439,3486.656 371.119439,3485.242 M368.390439,3493.831 L366.976439,3495.245 C363.440439,3491.709 362.634439,3485.242 366.877439,3481 L368.291439,3482.414 C365.462439,3485.242 365.561439,3491.002 368.390439,3493.831`,id:`radio_tower-[#1019]`})])])],-1)]])}var Ne=K(Ae,[[`render`,Me]]),Pe={class:`text-center`},Fe={class:`relative flex items-center justify-center mb-8`},Ie={class:`relative w-32 h-32`},Le={class:`absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2`},Re={key:0,class:`absolute inset-0 flex items-center justify-center`},ze={key:1,class:`absolute inset-0 flex items-center justify-center`},Be={key:2,class:`absolute inset-0`},Ve={class:`mb-6`},He={key:0,class:`text-content-primary dark:text-content-primary text-lg`},Ue={key:1,class:`text-accent-green text-lg font-medium`},We={key:2,class:`text-secondary text-lg`},Ge={key:3,class:`text-accent-red text-lg`},Ke={key:4,class:`text-content-secondary dark:text-content-muted`},qe={key:5,class:`mt-3`},Je={key:0,class:`text-secondary text-sm`},Ye={key:1,class:`text-accent-red text-sm`},Xe={key:0,class:`flex gap-3`},Ze={key:1,class:`text-content-muted text-sm`},Qe=K(f({name:`AdvertModal`,__name:`AdvertModal`,props:{isOpen:{type:Boolean},isLoading:{type:Boolean},isSuccess:{type:Boolean},error:{default:null}},emits:[`close`,`send`],setup(e,{emit:n}){let r=e,i=n,a=l(!1),c=l(!1),d=l(!1);o(()=>r.isOpen,e=>{e?(a.value=!0,setTimeout(()=>{c.value=!0},50)):(c.value=!1,d.value=!1,setTimeout(()=>{a.value=!1},300))},{immediate:!0}),o(()=>r.isLoading,e=>{e||setTimeout(()=>{d.value=!1},1e3)});let f=()=>{r.isLoading||i(`close`)},p=()=>{r.isLoading||(d.value=!0,i(`send`))},h=e=>e?.includes(`Network error - no response received`)||e?.includes(`timeout`);return(n,r)=>(g(),u(m,{to:`body`},[a.value?(g(),T(`div`,{key:0,class:`fixed inset-0 z-50 flex items-center justify-center p-4`,onClick:M(f,[`self`])},[C(`div`,{class:D([`absolute inset-0 bg-black/60 backdrop-blur-sm transition-opacity duration-300`,c.value?`opacity-100`:`opacity-0`])},null,2),C(`div`,{class:D([`relative bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[20px] p-8 max-w-md w-full transform transition-all duration-300 border border-stroke-subtle dark:border-white/10`,c.value?`scale-100 opacity-100`:`scale-95 opacity-0`])},[e.isLoading?_(``,!0):(g(),T(`button`,{key:0,onClick:f,class:`absolute top-4 right-4 text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors p-2`},[...r[0]||=[C(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[C(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])),C(`div`,Pe,[r[6]||=C(`h2`,{class:`text-content-primary dark:text-content-primary text-xl font-semibold mb-6`},` Send Advertisement `,-1),C(`div`,Fe,[C(`div`,Ie,[C(`div`,Le,[v(Ne,{class:D([`w-16 h-16 transition-all duration-500`,[e.isLoading?`animate-pulse`:``,e.isSuccess?`text-accent-green`:e.error&&!h(e.error)?`text-accent-red`:`text-primary`]]),style:s({filter:e.isLoading?`drop-shadow(0 0 8px currentColor)`:e.isSuccess?`drop-shadow(0 0 8px #A5E5B6)`:e.error&&!h(e.error)?`drop-shadow(0 0 8px #FB787B)`:`drop-shadow(0 0 4px #AAE8E8)`})},null,8,[`class`,`style`])]),e.isLoading||e.isSuccess?(g(),T(`div`,Re,[C(`div`,{class:D([`absolute w-16 h-16 rounded-full border-2 animate-ping`,[e.isSuccess?`border-accent-green/60`:`border-primary/60`]]),style:{"animation-duration":`1.5s`}},null,2),C(`div`,{class:D([`absolute w-24 h-24 rounded-full border-2 animate-ping`,[e.isSuccess?`border-accent-green/40`:`border-primary/40`]]),style:{"animation-duration":`2s`,"animation-delay":`0.3s`}},null,2),C(`div`,{class:D([`absolute w-32 h-32 rounded-full border-2 animate-ping`,[e.isSuccess?`border-accent-green/20`:`border-primary/20`]]),style:{"animation-duration":`2.5s`,"animation-delay":`0.6s`}},null,2)])):_(``,!0),d.value?(g(),T(`div`,ze,[...r[1]||=[C(`div`,{class:`absolute w-8 h-8 rounded-full border-4 border-secondary animate-ping-fast`},null,-1),C(`div`,{class:`absolute w-16 h-16 rounded-full border-3 border-secondary/70 animate-ping-fast`,style:{"animation-delay":`0.1s`}},null,-1),C(`div`,{class:`absolute w-24 h-24 rounded-full border-2 border-secondary/50 animate-ping-fast`,style:{"animation-delay":`0.2s`}},null,-1),C(`div`,{class:`absolute w-32 h-32 rounded-full border-2 border-secondary/30 animate-ping-fast`,style:{"animation-delay":`0.3s`}},null,-1)]])):_(``,!0),e.isLoading||e.isSuccess?(g(),T(`div`,Be,[C(`div`,{class:D([`absolute top-2 right-2 w-4 h-4 rounded-full transition-all duration-500 animate-pulse`,[e.isSuccess?`bg-accent-green shadow-lg shadow-accent-green/50`:`bg-primary/70 shadow-lg shadow-primary/30`]]),style:{"animation-delay":`0.5s`}},[...r[2]||=[C(`div`,{class:`w-2 h-2 bg-white rounded-full mx-auto mt-1`},null,-1)]],2),C(`div`,{class:D([`absolute bottom-2 left-2 w-4 h-4 rounded-full transition-all duration-500 animate-pulse`,[e.isSuccess?`bg-accent-green shadow-lg shadow-accent-green/50`:`bg-primary/70 shadow-lg shadow-primary/30`]]),style:{"animation-delay":`1s`}},[...r[3]||=[C(`div`,{class:`w-2 h-2 bg-white rounded-full mx-auto mt-1`},null,-1)]],2),C(`div`,{class:D([`absolute top-1/2 right-1 w-4 h-4 rounded-full transition-all duration-500 animate-pulse`,[e.isSuccess?`bg-accent-green shadow-lg shadow-accent-green/50`:`bg-primary/70 shadow-lg shadow-primary/30`]]),style:{"animation-delay":`1.5s`,transform:`translateY(-50%)`}},[...r[4]||=[C(`div`,{class:`w-2 h-2 bg-white rounded-full mx-auto mt-1`},null,-1)]],2),C(`div`,{class:D([`absolute top-3 left-3 w-4 h-4 rounded-full transition-all duration-500 animate-pulse`,[e.isSuccess?`bg-accent-green shadow-lg shadow-accent-green/50`:`bg-primary/70 shadow-lg shadow-primary/30`]]),style:{"animation-delay":`2s`}},[...r[5]||=[C(`div`,{class:`w-2 h-2 bg-white rounded-full mx-auto mt-1`},null,-1)]],2)])):_(``,!0)])]),C(`div`,Ve,[e.isLoading?(g(),T(`p`,He,` Broadcasting advertisement... `)):e.isSuccess?(g(),T(`p`,Ue,` Advertisement sent successfully! `)):e.error&&h(e.error)?(g(),T(`p`,We,` Advertisement likely sent `)):e.error?(g(),T(`p`,Ge,`Failed to send advertisement`)):(g(),T(`p`,Ke,` This will broadcast your node's presence to nearby nodes. `)),e.error?(g(),T(`div`,qe,[h(e.error)?(g(),T(`p`,Je,` Network timeout occurred, but the advertisement may have been successfully transmitted to nearby nodes. `)):(g(),T(`p`,Ye,t(e.error),1))])):_(``,!0)]),!e.isLoading&&!e.isSuccess?(g(),T(`div`,Xe,[C(`button`,{onClick:f,class:`flex-1 bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 hover:border-primary rounded-[10px] px-6 py-3 text-content-primary dark:text-content-primary hover:bg-stroke-subtle dark:hover:bg-white/10 transition-all duration-200`},` Cancel `),C(`button`,{onClick:p,class:D([`flex-1 rounded-[10px] px-6 py-3 font-medium transition-all duration-200 shadow-lg`,[e.error&&h(e.error)?`bg-secondary hover:bg-secondary/90 text-background hover:shadow-secondary/20`:`bg-primary hover:bg-primary/90 text-background hover:shadow-primary/20`]])},t(e.error&&h(e.error)?`Try Again`:`Send Advertisement`),3)])):_(``,!0),e.isSuccess?(g(),T(`div`,Ze,`Closing automatically...`)):_(``,!0)])],2)])):_(``,!0)]))}}),[[`__scopeId`,`data-v-2c9f179a`]]),$e={},et={width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`};function tt(e,t){return g(),T(`svg`,et,[...t[0]||=[d(``,2)]])}var nt=K($e,[[`render`,tt]]),rt={},it={width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`};function at(e,t){return g(),T(`svg`,it,[...t[0]||=[d(``,9)]])}var ot=K(rt,[[`render`,at]]),st={},ct={width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`};function lt(e,t){return g(),T(`svg`,ct,[...t[0]||=[d(``,2)]])}var ut=K(st,[[`render`,lt]]),dt={},ft={width:`11`,height:`14`,viewBox:`0 0 11 14`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`};function pt(e,t){return g(),T(`svg`,ft,[...t[0]||=[C(`path`,{d:`M9.81633 1.99133L8.5085 0.683492C8.29229 0.466088 8.03511 0.293723 7.75185 0.176372C7.46859 0.059021 7.16486 -0.000985579 6.85825 -0.000175002H1.75C1.28587 -0.000175002 0.840752 0.184199 0.512563 0.512388C0.184375 0.840577 0 1.2857 0 1.74983V13.9998H10.5V3.64099C10.4985 3.02248 10.2528 2.4296 9.81633 1.99133ZM8.9915 2.81616C9.02083 2.84799 9.04829 2.88149 9.07375 2.91649H7.58333V1.42608C7.61834 1.45153 7.65184 1.479 7.68367 1.50833L8.9915 2.81616ZM1.16667 12.8332V1.74983C1.16667 1.59512 1.22812 1.44674 1.33752 1.33735C1.44692 1.22795 1.59529 1.16649 1.75 1.16649H6.41667V4.08316H9.33333V12.8332H1.16667ZM2.33333 9.33316H8.16667V5.83316H2.33333V9.33316ZM3.5 6.99983H7V8.16649H3.5V6.99983ZM2.33333 10.4998H8.16667V11.6665H2.33333V10.4998Z`,fill:`currentColor`},null,-1)]])}var mt=K(dt,[[`render`,pt]]),ht={},gt={width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`};function _t(e,t){return g(),T(`svg`,gt,[...t[0]||=[C(`path`,{d:`M12.25 0H1.75C1.28587 0 0.840752 0.184375 0.512563 0.512563C0.184375 0.840752 0 1.28587 0 1.75V12.25C0 12.7141 0.184375 13.1592 0.512563 13.4874C0.840752 13.8156 1.28587 14 1.75 14H12.25C12.7141 14 13.1592 13.8156 13.4874 13.4874C13.8156 13.1592 14 12.7141 14 12.25V1.75C14 1.28587 13.8156 0.840752 13.4874 0.512563C13.1592 0.184375 12.7141 0 12.25 0ZM12.8333 12.25C12.8333 12.4047 12.7719 12.5531 12.6625 12.6625C12.5531 12.7719 12.4047 12.8333 12.25 12.8333H1.75C1.59529 12.8333 1.44692 12.7719 1.33752 12.6625C1.22812 12.5531 1.16667 12.4047 1.16667 12.25V1.75C1.16667 1.59529 1.22812 1.44692 1.33752 1.33752C1.44692 1.22812 1.59529 1.16667 1.75 1.16667H12.25C12.4047 1.16667 12.5531 1.22812 12.6625 1.33752C12.7719 1.44692 12.8333 1.59529 12.8333 1.75V12.25ZM3.23583 7.41317L5.23583 9.41317C5.29134 9.46685 5.35738 9.50892 5.43004 9.53689C5.5027 9.56485 5.58055 9.57812 5.65892 9.57579C5.73729 9.57347 5.81418 9.5556 5.88513 9.52325C5.95608 9.4909 6.01963 9.44476 6.07175 9.38792C6.12387 9.33108 6.16351 9.26467 6.18833 9.19237C6.21315 9.12007 6.22263 9.04335 6.21618 8.96725C6.20973 8.89115 6.18746 8.81722 6.15078 8.74965C6.11411 8.68207 6.06376 8.62223 6.00292 8.57383L4.66708 7.23617L6.00292 5.90033C6.10827 5.78972 6.16669 5.64161 6.16522 5.48792C6.16375 5.33423 6.10251 5.1873 5.99491 5.07882C5.88731 4.97034 5.74082 4.90791 5.58716 4.90522C5.4335 4.90254 5.28489 4.95982 5.17367 5.06417L3.17367 7.06417C3.06317 7.17386 3.00063 7.32313 3.00063 7.47867C3.00063 7.63421 3.06317 7.78348 3.17367 7.89317L3.23583 7.41317ZM8.75 10.5H7.58333C7.4286 10.5 7.28025 10.5615 7.17085 10.6709C7.06146 10.7803 7 10.9286 7 11.0833C7 11.2381 7.06146 11.3864 7.17085 11.4958C7.28025 11.6052 7.4286 11.6667 7.58333 11.6667H8.75C8.90473 11.6667 9.05308 11.6052 9.16248 11.4958C9.27188 11.3864 9.33333 11.2381 9.33333 11.0833C9.33333 10.9286 9.27188 10.7803 9.16248 10.6709C9.05308 10.5615 8.90473 10.5 8.75 10.5Z`,fill:`currentColor`},null,-1)]])}var vt=K(ht,[[`render`,_t]]),yt={},bt={width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`};function xt(e,t){return g(),T(`svg`,bt,[...t[0]||=[d(``,2)]])}var St=K(yt,[[`render`,xt]]),Ct={name:`SystemIcon`},wt={width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`};function Tt(e,t,n,r,i,a){return g(),T(`svg`,wt,[...t[0]||=[d(``,5)]])}var Et=K(Ct,[[`render`,Tt]]),Dt={},Ot={width:`11`,height:`14`,viewBox:`0 0 11 14`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`};function kt(e,t){return g(),T(`svg`,Ot,[...t[0]||=[C(`path`,{d:`M10.5 14.0004H9.33333V11.0586C9.33287 10.6013 9.15099 10.1628 8.82761 9.83942C8.50422 9.51603 8.06575 9.33415 7.60842 9.33369H2.89158C2.43425 9.33415 1.99578 9.51603 1.67239 9.83942C1.34901 10.1628 1.16713 10.6013 1.16667 11.0586V14.0004H0V11.0586C0.000926233 10.292 0.305872 9.55705 0.847948 9.01497C1.39002 8.47289 2.12497 8.16795 2.89158 8.16702H7.60842C8.37503 8.16795 9.10998 8.47289 9.65205 9.01497C10.1941 9.55705 10.4991 10.292 10.5 11.0586V14.0004Z`,fill:`currentColor`},null,-1),C(`path`,{d:`M5.25 6.99997C4.55777 6.99997 3.88108 6.7947 3.30551 6.41011C2.72993 6.02553 2.28133 5.4789 2.01642 4.83936C1.75152 4.19982 1.6822 3.49609 1.81725 2.81716C1.9523 2.13822 2.28564 1.51458 2.77513 1.0251C3.26461 0.535614 3.88825 0.202271 4.56719 0.0672226C5.24612 -0.0678257 5.94985 0.00148598 6.58939 0.266393C7.22894 0.531299 7.77556 0.979903 8.16015 1.55548C8.54473 2.13105 8.75 2.80774 8.75 3.49997C8.74908 4.42794 8.38003 5.31765 7.72385 5.97382C7.06768 6.63 6.17798 6.99904 5.25 6.99997ZM5.25 1.16664C4.78851 1.16664 4.33739 1.30349 3.95367 1.55988C3.56996 1.81627 3.27089 2.18068 3.09428 2.60704C2.91768 3.0334 2.87147 3.50256 2.9615 3.95518C3.05153 4.4078 3.27376 4.82357 3.60009 5.14989C3.92641 5.47621 4.34217 5.69844 4.79479 5.78847C5.24741 5.8785 5.71657 5.83229 6.14293 5.65569C6.56929 5.47909 6.93371 5.18002 7.1901 4.7963C7.44649 4.41259 7.58334 3.96146 7.58334 3.49997C7.58334 2.88113 7.3375 2.28764 6.89992 1.85006C6.46233 1.41247 5.86884 1.16664 5.25 1.16664Z`,fill:`currentColor`},null,-1)]])}var At=K(Dt,[[`render`,kt]]),jt={viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`},Mt=f({name:`GpsIcon`,__name:`gps`,setup(e){return(e,t)=>(g(),T(`svg`,jt,[...t[0]||=[C(`path`,{d:`M12 3.2C8.9 3.2 6.4 5.7 6.4 8.8c0 4.1 5.6 11.4 5.6 11.4s5.6-7.3 5.6-11.4c0-3.1-2.5-5.6-5.6-5.6Zm0 8.5a2.9 2.9 0 1 1 0-5.8 2.9 2.9 0 0 1 0 5.8Z`,fill:`currentColor`},null,-1),C(`path`,{d:`M4.3 8.8a7.7 7.7 0 0 1 15.4 0M2.2 8.8a9.8 9.8 0 0 1 19.6 0`,stroke:`currentColor`,"stroke-width":`1.6`,"stroke-linecap":`round`,opacity:`.45`},null,-1)]]))}}),Nt={},Pt={width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`};function Ft(e,t){return g(),T(`svg`,Pt,[...t[0]||=[d(``,2)]])}var It=K(Nt,[[`render`,Ft]]),Lt=`/assets/logo_pyMC_RBGA_640-Dark-Ba5B8kPq.png`,Rt=`/assets/logo_pyMC_RBGA_640-Light-QqmD1UTF.png`,zt={class:`w-[285px] flex-shrink-0 p-[15px] hidden lg:block`},Bt={class:`glass-card h-full p-6`},Vt={class:`mb-12`},Ht={class:`mb-3 flex justify-center`},Ut=[`src`],Wt={class:`text-content-secondary dark:text-content-muted text-sm`},Gt=[`title`],Kt={class:`text-content-secondary dark:text-content-muted text-sm mt-1`},qt={class:`mt-3 p-2 rounded-[10px] border border-stroke-subtle dark:border-white/10 bg-white dark:bg-white/5`},Jt={class:`flex items-center justify-between`},Yt={class:`flex items-center gap-3 mt-1.5 text-[10px] text-content-muted dark:text-content-muted`},Xt={class:`text-green-600 dark:text-green-400`},Zt={class:`text-red-600 dark:text-red-400`},Qt={key:0,class:`text-orange-600 dark:text-orange-400`},$t={class:`mb-8`},en={class:`mb-8`},tn=[`onClick`],nn={class:`mb-8`},rn={class:`space-y-2`},an=[`onClick`],on={class:`mb-8`},sn={class:`space-y-2`},cn=[`onClick`],ln={class:`mb-8`},un={class:`space-y-2`},dn=[`onClick`],fn={class:`mb-4`},pn={class:`flex rounded-[10px] overflow-hidden border border-stroke-subtle dark:border-white/10 bg-white dark:bg-white/5`},mn=[`title`,`disabled`,`onClick`],hn=[`disabled`],gn={class:`flex items-center gap-3`},_n={class:`mb-4`},vn={key:0,class:`mb-2 glass-card px-3 py-2 rounded-lg border border-blue-500/30 dark:border-blue-400/50 bg-blue-500/10 dark:bg-blue-400/20`},yn={class:`flex items-center gap-2`},bn={key:0,class:`mt-2 glass-card px-3 py-2 rounded-lg border border-stroke-subtle dark:border-stroke/30 space-y-2 text-xs animate-fade-in`},xn={class:`space-y-1`},Sn={class:`flex items-center justify-between`},Cn={class:`text-content-primary dark:text-content-primary font-mono`},wn={key:0,class:`pl-2 space-y-0.5 text-[10px] text-content-secondary dark:text-content-muted`},Tn={key:0,class:`flex items-center gap-1`},En={class:`bg-white/5 dark:bg-black/20 px-1 py-0.5 rounded`},Dn={class:`space-y-1`},On={class:`flex items-center justify-between`},kn={class:`text-content-primary dark:text-content-primary font-mono`},An={key:0,class:`pl-2 space-y-0.5 text-[10px] text-content-secondary dark:text-content-muted`},jn={key:0,class:`flex items-center gap-1`},Mn={class:`bg-white/5 dark:bg-black/20 px-1 py-0.5 rounded`},Nn={key:0,class:`mb-4`},Pn={class:`text-content-secondary dark:text-content-muted text-xs mb-2`},Fn={class:`text-content-primary dark:text-content-primary`},In={class:`w-full h-1 bg-white/10 rounded-full overflow-hidden`},Ln={class:`flex items-center gap-2 text-content-secondary dark:text-content-muted text-xs mb-3`},Rn={class:`flex items-center justify-center gap-3`},zn={href:`https://discord.gg/qreAsnmJ`,target:`_blank`,rel:`noopener noreferrer`,class:`inline-flex items-center justify-center w-9 h-9 rounded-xl bg-content-primary dark:bg-white/10 border border-stroke-subtle dark:border-stroke/20 hover:bg-indigo-50 dark:hover:bg-indigo-500/20 hover:border-indigo-500/50 transition-all duration-300 hover:scale-110 group backdrop-blur-sm`,title:`Discord`},Bn={href:`https://github.com/pyMC-dev/pyMC_Repeater`,target:`_blank`,rel:`noopener noreferrer`,class:`inline-flex items-center justify-center w-9 h-9 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`},Vn={href:`https://buymeacoffee.com/rightup`,target:`_blank`,rel:`noopener noreferrer`,class:`inline-flex items-center justify-center w-9 h-9 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`},Hn=K(f({name:`SidebarNav`,__name:`Sidebar`,setup(n){let r=I(),i=L(),o=W(),c=G(),{theme:d}=q(),f=b(()=>d.value===`dark`?Lt:Rt),p=U(),m=l(!1),w=l(!1),E=l(!1),k=l(!1),A=l(!1),j=l(null),M=b(()=>c.advertTier.currentTier),N=b(()=>c.advertTier.advertsAllowed),P=b(()=>c.advertTier.advertsDropped),F=b(()=>c.advertTier.activePenalties),R=b(()=>{switch(M.value){case`quiet`:return`bg-accent-green/20 text-accent-green border-accent-green/50`;case`normal`:return`bg-primary/20 text-primary border-primary/50`;case`busy`:return`bg-secondary/20 text-secondary border-secondary/50`;case`congested`:return`bg-accent-red/20 text-accent-red border-accent-red/50`;default:return`bg-surface-elevated text-content-muted border-stroke-subtle`}}),z={dashboard:ot,neighbors:At,statistics:St,gps:Mt,sensors:Et,"system-stats":Et,sessions:Et,configuration:nt,"room-servers":nt,companions:nt,logs:mt,terminal:vt,help:ut},ee=[{name:`Dashboard`,icon:`dashboard`,route:`/`,group:`monitoring`},{name:`Neighbors`,icon:`neighbors`,route:`/neighbors`,group:`monitoring`},{name:`Statistics`,icon:`statistics`,route:`/statistics`,group:`monitoring`},{name:`GPS`,icon:`gps`,route:`/gps`,group:`monitoring`},{name:`Sensors`,icon:`sensors`,route:`/sensors`,group:`monitoring`},{name:`System Stats`,icon:`system-stats`,route:`/system-stats`,group:`monitoring`},{name:`Sessions`,icon:`sessions`,route:`/sessions`,group:`system`},{name:`Configuration`,icon:`configuration`,route:`/configuration`,group:`system`},{name:`Terminal`,icon:`terminal`,route:`/terminal`,group:`system`},{name:`Room Servers`,icon:`room-servers`,route:`/room-servers`,group:`room`},{name:`Companions`,icon:`companions`,route:`/companions`,group:`room`},{name:`Logs`,icon:`logs`,route:`/logs`,group:`other`},{name:`Help`,icon:`help`,route:`/help`,group:`other`}],te=b(()=>{let e=o.stats;return e?.gps?.enabled===!0||e?.config?.gps?.enabled===!0}),B=b(()=>{let e=o.stats;return e?.sensors?.enabled===!0||e?.config?.sensors?.enabled===!0}),V=b(()=>ee.filter(e=>(e.route!==`/gps`||te.value)&&(e.route!==`/sensors`||B.value))),H=b(()=>V.value.filter(e=>e.group===`monitoring`)),ne=b(()=>V.value.filter(e=>e.group===`system`)),re=b(()=>V.value.filter(e=>e.group===`room`)),K=b(()=>V.value.filter(e=>e.group===`other`)),J=[{id:`forward`,label:`Forward`,title:`Repeats packets and Room Server and Companion identities can TX.`},{id:`monitor`,label:`Monitor`,title:`Does not repeat packets, can Advert, Room Server and Companion identities can TX.`},{id:`no_tx`,label:`No TX`,title:`No packets transmitted.`}],Y=b(()=>e=>i.path===e),ie=e=>{r.push(e)},ae=async()=>{m.value=!0,j.value=null;try{await o.sendAdvert(),A.value=!0,setTimeout(()=>{oe()},2e3)}catch(e){j.value=e instanceof Error?e.message:`Unknown error occurred`,console.error(`Failed to send advert:`,e)}finally{m.value=!1}},oe=()=>{k.value=!1,A.value=!1,j.value=null,m.value=!1},se=async e=>{if(!w.value&&o.currentMode!==e){w.value=!0;try{await o.setMode(e)}catch(e){console.error(`Failed to set mode:`,e)}finally{w.value=!1}}},ce=async()=>{if(!E.value){E.value=!0;try{await o.toggleDutyCycle()}catch(e){console.error(`Failed to toggle duty cycle:`,e)}finally{E.value=!1}}},le=b(()=>{let e=[o.lastUpdated,p.lastUpdated].filter(Boolean);return e.length===0?`Never`:e.reduce((e,t)=>e>t?e:t).toLocaleTimeString()}),ue=b(()=>{let e=o.dutyCyclePercentage,t=`var(--color-accent-green)`;return e>90?t=`var(--color-accent-red)`:e>70&&(t=`var(--color-secondary)`),{width:e===0?`2px`:`${Math.max(e,2)}%`,backgroundColor:t}}),fe=l(!1),pe=b(()=>o.version.includes(`dev`)||o.coreVersion.includes(`dev`)),me=e=>{let t=e.match(/^([\d.]+)(\.dev(\d+))?((\+g)([a-f0-9]+))?$/);return t?{base:t[1],isDev:!!t[2],devNumber:t[3]||null,commit:t[6]||null}:{base:e,isDev:!1,devNumber:null,commit:null}},X=b(()=>me(o.version)),Z=b(()=>me(o.coreVersion));return(n,r)=>(g(),T(S,null,[C(`aside`,zt,[C(`div`,Bt,[C(`div`,Vt,[C(`div`,Ht,[C(`img`,{src:f.value,alt:`pyMC`,class:`h-[6.5rem]`},null,8,Ut)]),C(`p`,Wt,[x(t(y(o).nodeName)+` `,1),C(`span`,{class:D([`inline-block w-2 h-2 rounded-full ml-2`,y(o).statusBadge.text===`Active`?`bg-accent-green`:y(o).statusBadge.text===`Monitor Mode`?`bg-secondary`:`bg-accent-red`]),title:y(o).statusBadge.title},null,10,Gt)]),C(`p`,Kt,` <`+t(y(o).pubKey)+`> `,1),C(`div`,qt,[C(`div`,Jt,[r[2]||=C(`span`,{class:`text-content-muted dark:text-content-muted text-[10px] uppercase tracking-wide`},`Adaptive`,-1),C(`div`,{class:D([`inline-flex items-center px-2 py-0.5 rounded-full border text-[10px] font-semibold`,R.value])},t(M.value.toUpperCase()),3)]),C(`div`,Yt,[C(`span`,Xt,`OK: `+t(N.value),1),C(`span`,Zt,`Drop: `+t(P.value),1),F.value>0?(g(),T(`span`,Qt,`Pen: `+t(F.value),1)):_(``,!0)])])]),r[21]||=C(`div`,{class:`border-t border-stroke-subtle dark:border-stroke mb-6`},null,-1),C(`div`,$t,[r[4]||=C(`p`,{class:`text-content-muted dark:text-content-muted text-xs uppercase mb-4`},`Actions`,-1),C(`button`,{onClick:r[0]||=e=>k.value=!0,class:`w-full bg-white dark:bg-white/10 rounded-[10px] py-3 px-4 flex items-center gap-2 text-sm font-medium text-[#212122] dark:text-white border border-stroke-subtle dark:border-white/10 hover:bg-gray-100 dark:hover:bg-white/20 transition-colors`},[...r[3]||=[C(`svg`,{class:`w-3.5 h-3.5`,viewBox:`0 0 14 14`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[C(`path`,{d:`M7 0C5.61553 0 4.26216 0.410543 3.11101 1.17971C1.95987 1.94888 1.06266 3.04213 0.532846 4.32122C0.003033 5.6003 -0.13559 7.00777 0.134506 8.36563C0.404603 9.7235 1.07129 10.9708 2.05026 11.9497C3.02922 12.9287 4.2765 13.5954 5.63437 13.8655C6.99224 14.1356 8.3997 13.997 9.67879 13.4672C10.9579 12.9373 12.0511 12.0401 12.8203 10.889C13.5895 9.73785 14 8.38447 14 7C13.998 5.1441 13.2599 3.36479 11.9475 2.05247C10.6352 0.74015 8.8559 0.0020073 7 0V0ZM7 12.8333C5.84628 12.8333 4.71846 12.4912 3.75918 11.8502C2.79989 11.2093 2.05222 10.2982 1.61071 9.23232C1.16919 8.16642 1.05368 6.99353 1.27876 5.86197C1.50384 4.73042 2.05941 3.69102 2.87521 2.87521C3.69102 2.0594 4.73042 1.50383 5.86198 1.27875C6.99353 1.05367 8.16642 1.16919 9.23232 1.6107C10.2982 2.05221 11.2093 2.79989 11.8502 3.75917C12.4912 4.71846 12.8333 5.84628 12.8333 7C12.8316 8.54658 12.2165 10.0293 11.1229 11.1229C10.0293 12.2165 8.54658 12.8316 7 12.8333ZM8.16667 7C8.1676 7.20501 8.11448 7.40665 8.01268 7.58461C7.91087 7.76256 7.76397 7.91054 7.58677 8.01365C7.40957 8.11676 7.20833 8.17136 7.00332 8.17194C6.7983 8.17252 6.59675 8.11906 6.41897 8.01696C6.24119 7.91485 6.09346 7.7677 5.99065 7.59033C5.88784 7.41295 5.83358 7.21162 5.83335 7.0066C5.83312 6.80159 5.88691 6.60013 5.98932 6.42252C6.09172 6.24491 6.23912 6.09743 6.41667 5.99492V3.5H7.58334V5.99492C7.76016 6.09659 7.90713 6.24298 8.00952 6.41939C8.1119 6.5958 8.1661 6.79603 8.16667 7Z`,fill:`currentColor`})],-1),x(` Send Advert `,-1)]])]),C(`div`,en,[r[5]||=C(`p`,{class:`text-content-muted dark:text-content-muted text-xs uppercase mb-4`},`Monitoring`,-1),v(O,{tag:`div`,class:`space-y-2`,name:`sidebar-item`},{default:e(()=>[(g(!0),T(S,null,h(H.value,e=>(g(),T(`button`,{key:e.name,onClick:t=>ie(e.route),class:D([Y.value(e.route)?`bg-gradient-to-r from-cyan-400/90 to-cyan-500/90 dark:bg-primary/30 border-cyan-500 dark:border-primary/40 shadow-[0_4px_16px_rgba(6,182,212,0.4)] dark:shadow-[0_4px_12px_rgba(170,232,232,0.25)] text-white dark:text-primary font-semibold`:`text-content-primary dark:text-content-primary hover:bg-gradient-to-r hover:from-cyan-400/20 hover:to-cyan-500/20 dark:hover:bg-primary/5 hover:border-cyan-400/30 dark:hover:border-primary/20 hover:shadow-[0_2px_12px_rgba(6,182,212,0.2)] dark:hover:shadow-[0_2px_8px_rgba(170,232,232,0.15)] border border-stroke-subtle dark:border-transparent`,`w-full rounded-[10px] py-3 px-4 flex items-center gap-3 text-sm font-medium transition-all duration-200`])},[(g(),u(a(z[e.icon]),{class:D(Y.value(e.route)?`w-3.5 h-3.5 text-white dark:text-primary [&_path]:fill-current`:`w-3.5 h-3.5 text-content-primary dark:text-content-primary [&_path]:fill-current`)},null,8,[`class`])),x(` `+t(e.name),1)],10,tn))),128))]),_:1})]),C(`div`,nn,[r[6]||=C(`p`,{class:`text-content-muted dark:text-content-muted text-xs uppercase mb-4`},`System`,-1),C(`div`,rn,[(g(!0),T(S,null,h(ne.value,e=>(g(),T(`button`,{key:e.name,onClick:t=>ie(e.route),class:D([Y.value(e.route)?`bg-gradient-to-r from-cyan-400/90 to-cyan-500/90 dark:bg-primary/30 border-cyan-500 dark:border-primary/40 shadow-[0_4px_16px_rgba(6,182,212,0.4)] dark:shadow-[0_4px_12px_rgba(170,232,232,0.25)] text-white dark:text-primary font-semibold`:`text-content-primary dark:text-content-primary hover:bg-gradient-to-r hover:from-cyan-400/20 hover:to-cyan-500/20 dark:hover:bg-primary/5 hover:border-cyan-400/30 dark:hover:border-primary/20 hover:shadow-[0_2px_12px_rgba(6,182,212,0.2)] dark:hover:shadow-[0_2px_8px_rgba(170,232,232,0.15)] border border-stroke-subtle dark:border-transparent`,`w-full rounded-[10px] py-3 px-4 flex items-center gap-3 text-sm font-medium transition-all duration-200`])},[(g(),u(a(z[e.icon]),{class:D(Y.value(e.route)?`w-3.5 h-3.5 text-white dark:text-primary [&_path]:fill-current`:`w-3.5 h-3.5 text-content-primary dark:text-content-primary [&_path]:fill-current`)},null,8,[`class`])),x(` `+t(e.name),1)],10,an))),128))])]),C(`div`,on,[r[7]||=C(`p`,{class:`text-content-muted dark:text-content-muted text-xs uppercase mb-4`},` Room Servers & Companions `,-1),C(`div`,sn,[(g(!0),T(S,null,h(re.value,e=>(g(),T(`button`,{key:e.name,onClick:t=>ie(e.route),class:D([Y.value(e.route)?`bg-gradient-to-r from-cyan-400/90 to-cyan-500/90 dark:bg-primary/30 border-cyan-500 dark:border-primary/40 shadow-[0_4px_16px_rgba(6,182,212,0.4)] dark:shadow-[0_4px_12px_rgba(170,232,232,0.25)] text-white dark:text-primary font-semibold`:`text-content-primary dark:text-content-primary hover:bg-gradient-to-r hover:from-cyan-400/20 hover:to-cyan-500/20 dark:hover:bg-primary/5 hover:border-cyan-400/30 dark:hover:border-primary/20 hover:shadow-[0_2px_12px_rgba(6,182,212,0.2)] dark:hover:shadow-[0_2px_8px_rgba(170,232,212,0.15)] border border-stroke-subtle dark:border-transparent`,`w-full rounded-[10px] py-3 px-4 flex items-center gap-3 text-sm font-medium transition-all duration-200`])},[(g(),u(a(z[e.icon]),{class:D(Y.value(e.route)?`w-3.5 h-3.5 text-white dark:text-primary [&_path]:fill-current`:`w-3.5 h-3.5 text-content-primary dark:text-content-primary [&_path]:fill-current`)},null,8,[`class`])),x(` `+t(e.name),1)],10,cn))),128))])]),C(`div`,ln,[r[8]||=C(`p`,{class:`text-content-muted dark:text-content-muted text-xs uppercase mb-4`},`Other`,-1),C(`div`,un,[(g(!0),T(S,null,h(K.value,e=>(g(),T(`button`,{key:e.name,onClick:t=>ie(e.route),class:D([Y.value(e.route)?`bg-gradient-to-r from-cyan-400/90 to-cyan-500/90 dark:bg-primary/30 border-cyan-500 dark:border-primary/40 shadow-[0_4px_16px_rgba(6,182,212,0.4)] dark:shadow-[0_4px_12px_rgba(170,232,232,0.25)] text-white dark:text-primary font-semibold`:`text-content-primary dark:text-content-primary hover:bg-gradient-to-r hover:from-cyan-400/20 hover:to-cyan-500/20 dark:hover:bg-primary/5 hover:border-cyan-400/30 dark:hover:border-primary/20 hover:shadow-[0_2px_12px_rgba(6,182,212,0.2)] dark:hover:shadow-[0_2px_8px_rgba(170,232,232,0.15)] border border-stroke-subtle dark:border-transparent`,`w-full rounded-[10px] py-3 px-4 flex items-center gap-3 text-sm font-medium transition-all duration-200`])},[(g(),u(a(z[e.icon]),{class:D(Y.value(e.route)?`w-3.5 h-3.5 text-white dark:text-primary [&_path]:fill-current`:`w-3.5 h-3.5 text-content-primary dark:text-content-primary [&_path]:fill-current`)},null,8,[`class`])),x(` `+t(e.name),1)],10,dn))),128))])]),v(ke,{"current-value":y(o).noiseFloorDbm||-116,"update-interval":3e3,class:`mb-6`},null,8,[`current-value`]),C(`div`,fn,[r[9]||=C(`p`,{class:`text-content-muted dark:text-content-muted text-xs uppercase mb-2`},`Mode`,-1),C(`div`,pn,[(g(),T(S,null,h(J,e=>C(`button`,{key:e.id,type:`button`,title:e.title,disabled:w.value,onClick:t=>se(e.id),class:D([`flex-1 py-2.5 px-2 text-xs font-medium transition-all duration-200 border-r border-stroke-subtle dark:border-white/10 last:border-r-0`,w.value?`opacity-60 cursor-not-allowed`:`cursor-pointer`,y(o).currentMode===e.id?e.id===`forward`?`bg-mode-segment-forward text-accent-green`:e.id===`monitor`?`bg-amber-500/20 text-amber-600 dark:text-amber-400`:`bg-mode-segment-no-tx text-accent-red`:`text-content-primary dark:text-content-primary hover:bg-white/10 dark:hover:bg-white/10`])},t(w.value&&y(o).currentMode!==e.id?`…`:e.label),11,mn)),64))])]),C(`button`,{onClick:ce,disabled:E.value,class:D([`p-4 flex items-center justify-between mb-4 w-full transition-all duration-200 cursor-pointer group`,y(o).dutyCycleButtonState.warning?`glass-card-orange hover:bg-accent-red/10`:`glass-card-green hover:bg-accent-green/10`])},[C(`div`,gn,[v(It,{class:`w-3.5 h-3.5 text-content-primary dark:text-content-primary group-hover:text-primary transition-colors`}),r[10]||=C(`span`,{class:`text-content-primary dark:text-content-primary text-sm group-hover:text-primary transition-colors`},`Duty Cycle`,-1)]),C(`span`,{class:D([`text-xs font-medium group-hover:text-white transition-colors`,y(o).dutyCycleButtonState.warning?`text-accent-red`:`text-primary`])},t(E.value?`Changing...`:y(o).dutyCycleEnabled?`Enabled`:`Disabled`),3)],10,hn),C(`div`,_n,[pe.value?(g(),T(`div`,vn,[...r[11]||=[C(`div`,{class:`flex items-center justify-center gap-2`},[C(`svg`,{class:`w-4 h-4 text-blue-500 dark:text-blue-400 flex-shrink-0`,viewBox:`0 0 20 20`,fill:`currentColor`},[C(`path`,{"fill-rule":`evenodd`,d:`M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z`,"clip-rule":`evenodd`})]),C(`span`,{class:`text-blue-500 dark:text-blue-400 text-xs font-semibold`},`Development Build`)],-1)]])):_(``,!0),C(`div`,{onClick:r[1]||=e=>fe.value=!fe.value,class:`cursor-pointer transition-all duration-200 hover:scale-[1.02]`},[C(`div`,yn,[C(`span`,{class:D([`glass-card px-2 py-1 text-xs font-medium rounded border transition-colors`,X.value.isDev?`text-yellow-600 dark:text-yellow-400 border-yellow-500/30 dark:border-yellow-500/30`:`text-content-secondary dark:text-content-muted border-stroke-subtle dark:border-stroke`])},` R:v`+t(X.value.base)+t(X.value.isDev?`-dev`+X.value.devNumber:``),3),C(`span`,{class:D([`glass-card px-2 py-1 text-xs font-medium rounded border transition-colors`,Z.value.isDev?`text-yellow-600 dark:text-yellow-400 border-yellow-500/30 dark:border-yellow-500/30`:`text-content-secondary dark:text-content-muted border-stroke-subtle dark:border-stroke`])},` Core:v`+t(Z.value.base)+t(Z.value.isDev?`-dev`+Z.value.devNumber:``),3),(g(),T(`svg`,{class:D([`w-3 h-3 text-content-muted transition-transform duration-200`,fe.value?`rotate-180`:``]),fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[...r[12]||=[C(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M19 9l-7 7-7-7`},null,-1)]],2))]),fe.value?(g(),T(`div`,bn,[C(`div`,xn,[C(`div`,Sn,[r[13]||=C(`span`,{class:`text-content-muted font-medium`},`Repeater:`,-1),C(`span`,Cn,`v`+t(X.value.base),1)]),X.value.isDev?(g(),T(`div`,wn,[C(`div`,null,`Dev Build: `+t(X.value.devNumber),1),X.value.commit?(g(),T(`div`,Tn,[r[14]||=C(`span`,null,`Commit:`,-1),C(`code`,En,t(X.value.commit),1)])):_(``,!0)])):_(``,!0)]),r[17]||=C(`div`,{class:`border-t border-stroke-subtle dark:border-stroke/20`},null,-1),C(`div`,Dn,[C(`div`,On,[r[15]||=C(`span`,{class:`text-content-muted font-medium`},`Core:`,-1),C(`span`,kn,`v`+t(Z.value.base),1)]),Z.value.isDev?(g(),T(`div`,An,[C(`div`,null,`Dev Build: `+t(Z.value.devNumber),1),Z.value.commit?(g(),T(`div`,jn,[r[16]||=C(`span`,null,`Commit:`,-1),C(`code`,Mn,t(Z.value.commit),1)])):_(``,!0)])):_(``,!0)])])):_(``,!0)])]),r[22]||=C(`div`,{class:`border-t border-accent-green mb-4`},null,-1),y(o).dutyCycleEnabled?(g(),T(`div`,Nn,[C(`p`,Pn,[r[18]||=x(` Duty Cycle: `,-1),C(`span`,Fn,t(y(o).dutyCycleUtilization.toFixed(1))+`% / `+t(y(o).dutyCycleMax.toFixed(1))+`%`,1)]),C(`div`,In,[C(`div`,{class:`h-full rounded-full transition-all duration-300`,style:s(ue.value)},null,4)])])):_(``,!0),C(`div`,Ln,[r[19]||=C(`svg`,{class:`w-3 h-3`,viewBox:`0 0 13 13`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[C(`path`,{d:`M6.5 13C5.59722 13 4.75174 12.8286 3.96355 12.4858C3.17537 12.143 2.48926 11.6795 1.90522 11.0955C1.32119 10.5115 0.85776 9.82535 0.514945 9.03717C0.172131 8.24898 0.000482491 7.40326 1.0101e-06 6.5C-0.000480471 5.59674 0.171168 4.75126 0.514945 3.96356C0.858723 3.17585 1.32191 2.48974 1.9045 1.90522C2.48709 1.3207 3.1732 0.857278 3.96283 0.514944C4.75246 0.172611 5.59818 0.000962963 6.5 0C7.48703 0 8.42303 0.210648 9.30799 0.631944C10.193 1.05324 10.9421 1.64907 11.5555 2.41944V1.44444C11.5555 1.23981 11.6249 1.06841 11.7635 0.930222C11.9022 0.792037 12.0736 0.722704 12.2778 0.722222C12.4819 0.721741 12.6536 0.791074 12.7927 0.930222C12.9319 1.06937 13.001 1.24078 13 1.44444V4.33333C13 4.53796 12.9307 4.70961 12.792 4.84828C12.6533 4.98694 12.4819 5.05604 12.2778 5.05556H9.38888C9.18425 5.05556 9.01285 4.98622 8.87466 4.84756C8.73647 4.70889 8.66714 4.53748 8.66666 4.33333C8.66618 4.12919 8.73551 3.95778 8.87466 3.81911C9.01381 3.68044 9.18521 3.61111 9.38888 3.61111H10.6528C10.1593 2.93704 9.55138 2.40741 8.82916 2.02222C8.10694 1.63704 7.33055 1.44444 6.5 1.44444C5.09166 1.44444 3.89711 1.93507 2.91633 2.91633C1.93555 3.89759 1.44493 5.09215 1.44444 6.5C1.44396 7.90785 1.93459 9.10265 2.91633 10.0844C3.89807 11.0661 5.09263 11.5565 6.5 11.5556C7.64351 11.5556 8.66666 11.2125 9.56944 10.5264C10.4722 9.84028 11.068 8.95555 11.3569 7.87222C11.4171 7.67963 11.5255 7.53519 11.6819 7.43889C11.8384 7.34259 12.013 7.30648 12.2055 7.33055C12.4102 7.35463 12.5727 7.44178 12.693 7.592C12.8134 7.74222 12.8495 7.90785 12.8014 8.08889C12.4523 9.5213 11.694 10.698 10.5264 11.6191C9.35879 12.5402 8.01666 13.0005 6.5 13ZM7.22222 6.21111L9.02777 8.01667C9.16018 8.14907 9.22638 8.31759 9.22638 8.52222C9.22638 8.72685 9.16018 8.89537 9.02777 9.02778C8.89536 9.16018 8.72685 9.22639 8.52222 9.22639C8.31759 9.22639 8.14907 9.16018 8.01666 9.02778L5.99444 7.00556C5.92222 6.93333 5.86805 6.8522 5.83194 6.76217C5.79583 6.67213 5.77777 6.57872 5.77777 6.48194V3.61111C5.77777 3.40648 5.84711 3.23507 5.98577 3.09689C6.12444 2.9587 6.29585 2.88937 6.5 2.88889C6.70414 2.88841 6.87579 2.95774 7.01494 3.09689C7.15409 3.23604 7.22318 3.40744 7.22222 3.61111V6.21111Z`,fill:`currentColor`})],-1),x(` Last Updated: `+t(le.value),1)]),r[23]||=C(`div`,{class:`flex flex-col items-center justify-center mb-4`},[C(`p`,{class:`text-content-muted dark:text-content-muted text-[10px] mb-1 tracking-wide uppercase opacity-70`},` Powered by `),C(`a`,{href:`https://meshcore.io`,target:`_blank`,rel:`noopener noreferrer`,title:`MeshCore`},[C(`img`,{src:`/assets/meshcore-DQNtEl5I.svg`,alt:`MeshCore`,class:`h-4 opacity-70 dark:invert-0 invert`})])],-1),C(`div`,Rn,[C(`a`,zn,[v(he,{class:`w-5 h-5 text-white group-hover:text-indigo-500 transition-colors`})]),r[20]||=C(`a`,{href:`https://pymc.dev`,target:`_blank`,rel:`noopener noreferrer`,class:`inline-flex items-center justify-center w-9 h-9 rounded-xl bg-content-primary dark:bg-white/10 border border-stroke-subtle dark:border-stroke/20 hover:bg-cyan-50 dark:hover:bg-cyan-500/20 hover:border-cyan-500/50 transition-all duration-300 hover:scale-110 group backdrop-blur-sm`,title:`pyMC Website`},[C(`svg`,{class:`w-5 h-5 text-white group-hover:text-cyan-500 transition-colors`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[C(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`1.75`,d:`M12 21a9.004 9.004 0 008.716-6M12 21a9.004 9.004 0 01-8.716-6M12 21c1.656 0 3-4.03 3-9s-1.344-9-3-9m0 18c-1.656 0-3-4.03-3-9s1.344-9 3-9m0 0a9.004 9.004 0 018.716 6M12 3a9.004 9.004 0 00-8.716 6M3.284 9h17.432M3.284 15h17.432`})])],-1),C(`a`,Bn,[v(de,{class:`w-5 h-5 text-white group-hover:text-primary transition-colors`})]),C(`a`,Vn,[v(_e,{class:`w-5 h-5 text-white group-hover:text-yellow-500 transition-colors`})])])])]),v(Qe,{isOpen:k.value,isLoading:m.value,isSuccess:A.value,error:j.value,onClose:oe,onSend:ae},null,8,[`isOpen`,`isLoading`,`isSuccess`,`error`])],64))}}),[[`__scopeId`,`data-v-d921c3e8`]]),Un={class:`bg-white/95 dark:bg-black/20 backdrop-blur-xl border border-stroke dark:border-white/10 rounded-2xl h-full p-6 overflow-auto shadow-2xl`},Wn={class:`mb-6 flex items-center justify-between`},Gn={class:`mb-2`},Kn=[`src`],qn={class:`text-content-secondary dark:text-[#C3C3C3] text-sm`},Jn=[`title`],Yn={class:`text-content-secondary dark:text-[#C3C3C3] text-sm mt-1`},Xn={class:`mt-3 p-2 rounded-[10px] border border-stroke-subtle dark:border-white/10 bg-white dark:bg-white/5`},Zn={class:`flex items-center justify-between`},Qn={class:`flex items-center gap-3 mt-1.5 text-[10px] text-content-muted`},$n={class:`text-green-600 dark:text-green-400`},er={class:`text-red-600 dark:text-red-400`},tr={key:0,class:`text-orange-600 dark:text-orange-400`},nr={class:`mb-4`},rr={class:`mb-4`},ir={class:`space-y-2 mb-3`},ar=[`onClick`],or={class:`mb-4`},sr={class:`space-y-2 mb-3`},cr=[`onClick`],lr={class:`mb-4`},ur={class:`space-y-2 mb-3`},dr=[`onClick`],fr={class:`mb-4`},pr={class:`space-y-2 mb-3`},mr=[`onClick`],hr={class:`mb-3`},gr={class:`flex rounded-[.625rem] overflow-hidden border border-stroke dark:border-white/10 bg-white dark:bg-white/5`},_r=[`title`,`disabled`,`onClick`],vr=[`disabled`],yr={class:`flex items-center gap-3`},br={class:`mb-4`},xr={key:0,class:`mt-2 glass-card px-3 py-2 rounded-lg border border-stroke-subtle dark:border-stroke/30 space-y-2 text-xs animate-fade-in`},Sr={class:`space-y-1`},Cr={class:`flex items-center justify-between`},wr={class:`text-content-primary dark:text-content-primary font-mono`},Tr={key:0,class:`pl-2 space-y-0.5 text-[10px] text-content-secondary dark:text-content-muted`},Er={key:0,class:`flex items-center gap-1`},Dr={class:`bg-white/5 dark:bg-black/20 px-1 py-0.5 rounded`},Or={class:`space-y-1`},kr={class:`flex items-center justify-between`},Ar={class:`text-content-primary dark:text-content-primary font-mono`},jr={key:0,class:`pl-2 space-y-0.5 text-[10px] text-content-secondary dark:text-content-muted`},Mr={key:0,class:`flex items-center gap-1`},Nr={class:`bg-white/5 dark:bg-black/20 px-1 py-0.5 rounded`},Pr={key:1,class:`mb-4`},Fr={class:`text-content-muted text-xs mb-2`},Ir={class:`text-content-primary dark:text-white`},Lr={class:`w-full h-1 bg-stroke-subtle dark:bg-white/10 rounded-full overflow-hidden`},Rr={class:`text-content-muted text-xs`},zr={class:`flex items-center justify-center gap-3 mt-4`},Br={href:`https://discord.gg/SMHkUDwf`,target:`_blank`,rel:`noopener noreferrer`,class:`inline-flex items-center justify-center w-9 h-9 rounded-xl bg-content-primary dark:bg-white/10 border border-stroke-subtle dark:border-stroke/20 hover:bg-indigo-50 dark:hover:bg-indigo-500/20 hover:border-indigo-500/50 transition-all duration-300 hover:scale-110 group backdrop-blur-sm`,title:`Discord`},Vr={href:`https://github.com/rightup`,target:`_blank`,rel:`noopener noreferrer`,class:`inline-flex items-center justify-center w-9 h-9 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`},Hr={href:`https://buymeacoffee.com/rightup`,target:`_blank`,rel:`noopener noreferrer`,class:`inline-flex items-center justify-center w-9 h-9 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`},Ur=f({name:`MobileSidebar`,__name:`MobileSidebar`,props:{showMobileSidebar:{type:Boolean}},emits:[`update:showMobileSidebar`,`close`],setup(e,{emit:i}){let c=p(()=>ee(()=>import(`./RFNoiseFloor-ki1ynpAI.js`),[])),d=l(!1),f=e,m=i,w=I(),E=L(),O=W(),k=G(),{theme:A}=q(),j=b(()=>A.value===`dark`?Lt:Rt);o(()=>f.showMobileSidebar,e=>{e&&!d.value?setTimeout(()=>{d.value=!0},100):e||(d.value=!1)});let M=l(!1),N=l(!1),P=l(!1),F=l(!1),R=l(!1),z=l(null),B=null,V=b(()=>k.advertTier.currentTier),H=b(()=>k.advertTier.advertsAllowed),U=b(()=>k.advertTier.advertsDropped),ne=b(()=>k.advertTier.activePenalties);r(()=>{B=window.setInterval(()=>{be.value=new Date().toLocaleTimeString()},1e3)}),n(()=>{B&&clearInterval(B)});let re=b(()=>{switch(V.value){case`quiet`:return`bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400 border-green-500/50`;case`normal`:return`bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400 border-blue-500/50`;case`busy`:return`bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400 border-yellow-500/50`;case`congested`:return`bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400 border-red-500/50`;default:return`bg-gray-100 dark:bg-gray-500/20 text-gray-700 dark:text-gray-400 border-gray-500/50`}}),K={dashboard:ot,neighbors:At,statistics:St,gps:Mt,sensors:Et,"system-stats":Et,sessions:Et,configuration:nt,"room-servers":nt,companions:nt,logs:mt,terminal:vt,help:ut},J=[{name:`Dashboard`,icon:`dashboard`,route:`/`,group:`monitoring`},{name:`Neighbors`,icon:`neighbors`,route:`/neighbors`,group:`monitoring`},{name:`Statistics`,icon:`statistics`,route:`/statistics`,group:`monitoring`},{name:`GPS`,icon:`gps`,route:`/gps`,group:`monitoring`},{name:`Sensors`,icon:`sensors`,route:`/sensors`,group:`monitoring`},{name:`System Stats`,icon:`system-stats`,route:`/system-stats`,group:`monitoring`},{name:`Sessions`,icon:`sessions`,route:`/sessions`,group:`system`},{name:`Configuration`,icon:`configuration`,route:`/configuration`,group:`system`},{name:`Terminal`,icon:`terminal`,route:`/terminal`,group:`system`},{name:`Room Servers`,icon:`room-servers`,route:`/room-servers`,group:`room`},{name:`Companions`,icon:`companions`,route:`/companions`,group:`room`},{name:`Logs`,icon:`logs`,route:`/logs`,group:`other`},{name:`Help`,icon:`help`,route:`/help`,group:`other`}],Y=b(()=>{let e=O.stats;return e?.gps?.enabled===!0||e?.config?.gps?.enabled===!0}),ie=b(()=>{let e=O.stats;return e?.sensors?.enabled===!0||e?.config?.sensors?.enabled===!0}),ae=b(()=>J.filter(e=>(e.route!==`/gps`||Y.value)&&(e.route!==`/sensors`||ie.value))),oe=b(()=>ae.value.filter(e=>e.group===`monitoring`)),se=b(()=>ae.value.filter(e=>e.group===`system`)),ce=b(()=>ae.value.filter(e=>e.group===`room`)),le=b(()=>ae.value.filter(e=>e.group===`other`)),ue=[{id:`forward`,label:`Forward`,title:`Repeats packets and Room Server and Companion identities can TX.`},{id:`monitor`,label:`Monitor`,title:`Does not repeat packets, can Advert, Room Server and Companion identities can TX.`},{id:`no_tx`,label:`No TX`,title:`No packets transmitted.`}],fe=b(()=>e=>E.path===e),pe=e=>{w.push(e),me()},me=()=>{m(`update:showMobileSidebar`,!1)},X=()=>{te(),w.push(`/login`),me()},Z=async()=>{M.value=!0,z.value=null;try{await O.sendAdvert(),R.value=!0,setTimeout(()=>{ge()},2e3)}catch(e){z.value=e instanceof Error?e.message:`Unknown error occurred`,console.error(`Failed to send advert:`,e)}finally{M.value=!1}},ge=()=>{F.value=!1,R.value=!1,z.value=null,M.value=!1},ve=async e=>{if(!N.value&&O.currentMode!==e){N.value=!0;try{await O.setMode(e)}catch(e){console.error(`Failed to set mode:`,e)}finally{N.value=!1}}},ye=async()=>{if(!P.value){P.value=!0;try{await O.toggleDutyCycle()}catch(e){console.error(`Failed to toggle duty cycle:`,e)}finally{P.value=!1}}},be=l(new Date().toLocaleTimeString()),xe=l(!1),Se=b(()=>O.version.includes(`dev`)||O.coreVersion.includes(`dev`)),Ce=e=>{let t=e.match(/^([\d.]+)(\.dev(\d+))?((\+g)([a-f0-9]+))?$/);return t?{base:t[1],isDev:!!t[2],devNumber:t[3]||null,commit:t[6]||null}:{base:e,isDev:!1,devNumber:null,commit:null}},Q=b(()=>Ce(O.version)),$=b(()=>Ce(O.coreVersion)),we=b(()=>{let e=O.dutyCyclePercentage,t=`var(--color-accent-green)`;return e>90?t=`var(--color-accent-red)`:e>70&&(t=`var(--color-secondary)`),{width:e===0?`.125rem`:`${Math.max(e,2)}%`,backgroundColor:t}});return(n,r)=>(g(),T(S,null,[C(`div`,{class:D([`fixed inset-0 z-[250] lg:hidden`,e.showMobileSidebar?`pointer-events-auto`:`pointer-events-none`])},[C(`div`,{class:D([`absolute inset-0 bg-black/30 backdrop-blur-sm dark:bg-black/30 transition-opacity duration-300 cursor-pointer`,e.showMobileSidebar?`opacity-100`:`opacity-0`]),onClick:me},null,2),C(`div`,{class:D([`absolute left-0 top-0 bottom-0 w-72 p-4 transition-transform duration-300`,e.showMobileSidebar?`translate-x-0`:`-translate-x-full`])},[C(`div`,Un,[C(`div`,Wn,[C(`div`,null,[C(`div`,Gn,[C(`img`,{src:j.value,alt:`pyMC`,class:`h-[5.2rem]`},null,8,Kn)]),C(`p`,qn,[x(t(y(O).nodeName)+` `,1),C(`span`,{class:D([`inline-block w-2 h-2 rounded-full ml-2`,y(O).statusBadge.text===`Active`?`bg-accent-green`:y(O).statusBadge.text===`Monitor Mode`?`bg-secondary`:`bg-accent-red`]),title:y(O).statusBadge.title},null,10,Jn)]),C(`p`,Yn,` <`+t(y(O).pubKey)+`> `,1),C(`div`,Xn,[C(`div`,Zn,[r[2]||=C(`span`,{class:`text-content-muted text-[10px] uppercase tracking-wide`},`Adaptive`,-1),C(`div`,{class:D([`inline-flex items-center px-2 py-0.5 rounded-full border text-[10px] font-semibold`,re.value])},t(V.value.toUpperCase()),3)]),C(`div`,Qn,[C(`span`,$n,`OK: `+t(H.value),1),C(`span`,er,`Drop: `+t(U.value),1),ne.value>0?(g(),T(`span`,tr,`Pen: `+t(ne.value),1)):_(``,!0)])])]),C(`button`,{onClick:me,class:`text-content-primary dark:text-content-muted hover:text-content-heading dark:hover:text-white`},` ✕ `)]),r[19]||=C(`div`,{class:`border-t border-stroke dark:border-dark-border mb-4`},null,-1),C(`div`,nr,[r[4]||=C(`p`,{class:`text-content-muted text-xs uppercase mb-2`},`Actions`,-1),C(`button`,{onClick:r[0]||=e=>{F.value=!0,me()},class:`w-full bg-white dark:bg-white/10 rounded-[.625rem] py-3 px-4 flex items-center gap-2 text-sm font-medium text-[#212122] dark:text-white border border-stroke-subtle dark:border-white/10 hover:bg-gray-100 dark:hover:bg-white/20 transition-colors mb-2`},[...r[3]||=[C(`svg`,{class:`w-3.5 h-3.5`,viewBox:`0 0 14 14`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[C(`path`,{d:`M7 0C5.61553 0 4.26216 0.410543 3.11101 1.17971C1.95987 1.94888 1.06266 3.04213 0.532846 4.32122C0.003033 5.6003 -0.13559 7.00777 0.134506 8.36563C0.404603 9.7235 1.07129 10.9708 2.05026 11.9497C3.02922 12.9287 4.2765 13.5954 5.63437 13.8655C6.99224 14.1356 8.3997 13.997 9.67879 13.4672C10.9579 12.9373 12.0511 12.0401 12.8203 10.889C13.5895 9.73785 14 8.38447 14 7C13.998 5.1441 13.2599 3.36479 11.9475 2.05247C10.6352 0.74015 8.8559 0.0020073 7 0V0ZM7 12.8333C5.84628 12.8333 4.71846 12.4912 3.75918 11.8502C2.79989 11.2093 2.05222 10.2982 1.61071 9.23232C1.16919 8.16642 1.05368 6.99353 1.27876 5.86197C1.50384 4.73042 2.05941 3.69102 2.87521 2.87521C3.69102 2.0594 4.73042 1.50383 5.86198 1.27875C6.99353 1.05367 8.16642 1.16919 9.23232 1.6107C10.2982 2.05221 11.2093 2.79989 11.8502 3.75917C12.4912 4.71846 12.8333 5.84628 12.8333 7C12.8316 8.54658 12.2165 10.0293 11.1229 11.1229C10.0293 12.2165 8.54658 12.8316 7 12.8333ZM8.16667 7C8.1676 7.20501 8.11448 7.40665 8.01268 7.58461C7.91087 7.76256 7.76397 7.91054 7.58677 8.01365C7.40957 8.11676 7.20833 8.17136 7.00332 8.17194C6.7983 8.17252 6.59675 8.11906 6.41897 8.01696C6.24119 7.91485 6.09346 7.7677 5.99065 7.59033C5.88784 7.41295 5.83358 7.21162 5.83335 7.0066C5.83312 6.80159 5.88691 6.60013 5.98932 6.42252C6.09172 6.24491 6.23912 6.09743 6.41667 5.99492V3.5H7.58334V5.99492C7.76016 6.09659 7.90713 6.24298 8.00952 6.41939C8.1119 6.5958 8.1661 6.79603 8.16667 7Z`,fill:`currentColor`})],-1),x(` Send Advert `,-1)]])]),C(`div`,rr,[r[5]||=C(`p`,{class:`text-content-muted text-xs uppercase mb-2`},`Monitoring`,-1),C(`div`,ir,[(g(!0),T(S,null,h(oe.value,e=>(g(),T(`button`,{key:e.name,onClick:t=>pe(e.route),class:D([fe.value(e.route)?`bg-primary/20 shadow-[0_0_.375rem_0_rgba(170,232,232,0.20)] text-primary`:`text-content-primary dark:text-white hover:bg-content-primary/10 dark:hover:bg-white/5`,`w-full rounded-[.625rem] py-3 px-4 flex items-center gap-3 text-sm transition-all`])},[(g(),u(a(K[e.icon]),{class:`w-3.5 h-3.5`})),x(` `+t(e.name),1)],10,ar))),128))])]),C(`div`,or,[r[6]||=C(`p`,{class:`text-content-muted text-xs uppercase mb-2`},`System`,-1),C(`div`,sr,[(g(!0),T(S,null,h(se.value,e=>(g(),T(`button`,{key:e.name,onClick:t=>pe(e.route),class:D([fe.value(e.route)?`bg-primary/20 shadow-[0_0_.375rem_0_rgba(170,232,232,0.20)] text-primary`:`text-content-primary dark:text-white hover:bg-content-primary/10 dark:hover:bg-white/5`,`w-full rounded-[.625rem] py-3 px-4 flex items-center gap-3 text-sm transition-all`])},[(g(),u(a(K[e.icon]),{class:`w-3.5 h-3.5`})),x(` `+t(e.name),1)],10,cr))),128))])]),C(`div`,lr,[r[7]||=C(`p`,{class:`text-content-muted text-xs uppercase mb-2`},`Room Servers & Companions`,-1),C(`div`,ur,[(g(!0),T(S,null,h(ce.value,e=>(g(),T(`button`,{key:e.name,onClick:t=>pe(e.route),class:D([fe.value(e.route)?`bg-primary/20 shadow-[0_0_.375rem_0_rgba(170,232,232,0.20)] text-primary`:`text-content-primary dark:text-white hover:bg-content-primary/10 dark:hover:bg-white/5`,`w-full rounded-[.625rem] py-3 px-4 flex items-center gap-3 text-sm transition-all`])},[(g(),u(a(K[e.icon]),{class:`w-3.5 h-3.5`})),x(` `+t(e.name),1)],10,dr))),128))])]),C(`div`,fr,[r[8]||=C(`p`,{class:`text-content-muted text-xs uppercase mb-2`},`Other`,-1),C(`div`,pr,[(g(!0),T(S,null,h(le.value,e=>(g(),T(`button`,{key:e.name,onClick:t=>pe(e.route),class:D([fe.value(e.route)?`bg-primary/20 shadow-[0_0_.375rem_0_rgba(170,232,232,0.20)] text-primary`:`text-content-primary dark:text-white hover:bg-content-primary/10 dark:hover:bg-white/5`,`w-full rounded-[.625rem] py-3 px-4 flex items-center gap-3 text-sm transition-all`])},[(g(),u(a(K[e.icon]),{class:`w-3.5 h-3.5`})),x(` `+t(e.name),1)],10,mr))),128))])]),d.value?(g(),u(y(c),{key:0,"current-value":y(O).noiseFloorDbm||-116,"update-interval":3e3,limit:50,class:`mb-4`},null,8,[`current-value`])):_(``,!0),C(`div`,hr,[r[9]||=C(`p`,{class:`text-content-muted text-xs uppercase mb-2`},`Mode`,-1),C(`div`,gr,[(g(),T(S,null,h(ue,e=>C(`button`,{key:e.id,type:`button`,title:e.title,disabled:N.value,onClick:t=>ve(e.id),class:D([`flex-1 py-2.5 px-2 text-xs font-medium transition-all duration-200 border-r border-stroke dark:border-white/10 last:border-r-0`,N.value?`opacity-60 cursor-not-allowed`:`cursor-pointer`,y(O).currentMode===e.id?e.id===`forward`?`bg-mode-segment-forward text-accent-green`:e.id===`monitor`?`bg-amber-500/20 text-amber-600 dark:text-amber-400`:`bg-mode-segment-no-tx text-accent-red`:`text-content-primary dark:text-white hover:bg-white/10 dark:hover:bg-white/10`])},t(N.value&&y(O).currentMode!==e.id?`…`:e.label),11,_r)),64))])]),C(`button`,{onClick:ye,disabled:P.value,class:D([`p-4 flex items-center justify-between mb-3 w-full transition-all duration-200 cursor-pointer group`,y(O).dutyCycleButtonState.warning?`glass-card-orange hover:bg-accent-red/10`:`glass-card-green hover:bg-accent-green/10`])},[C(`div`,yr,[v(It,{class:`w-3.5 h-3.5 text-content-primary dark:text-white group-hover:text-primary transition-colors`}),r[10]||=C(`span`,{class:`text-content-primary dark:text-white text-sm group-hover:text-primary transition-colors`},`Duty Cycle`,-1)]),C(`span`,{class:D([`text-xs font-medium group-hover:text-primary dark:group-hover:text-white transition-colors`,y(O).dutyCycleButtonState.warning?`text-accent-red`:`text-primary`])},t(P.value?`Changing...`:y(O).dutyCycleEnabled?`Enabled`:`Disabled`),3)],10,vr),C(`button`,{onClick:X,class:`w-full glass-card-orange hover:bg-accent-red/10 rounded-[.625rem] py-3 px-4 flex items-center justify-center gap-2 text-sm font-medium text-content-primary dark:text-white transition-all mb-4`},[...r[11]||=[C(`svg`,{class:`w-4 h-4`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,xmlns:`http://www.w3.org/2000/svg`},[C(`path`,{d:`M13 3H15C16.1046 3 17 3.89543 17 5V15C17 16.1046 16.1046 17 15 17H13M8 7L4 10.5M4 10.5L8 14M4 10.5H13`,"stroke-linecap":`round`,"stroke-linejoin":`round`})],-1),x(` Logout `,-1)]]),C(`div`,br,[C(`div`,{onClick:r[1]||=e=>xe.value=!xe.value,class:`flex items-center gap-2 cursor-pointer group`},[C(`span`,{class:D([`glass-card px-2 py-1 text-xs font-medium rounded border transition-all duration-200`,`border-stroke dark:border-dark-border`,Q.value.isDev?`text-secondary bg-secondary-bg/20 dark:bg-secondary-bg/10 border-secondary/40`:`text-content-muted`])},` R:v`+t(Q.value.base)+t(Q.value.isDev?`.dev${Q.value.devNumber}`:``),3),C(`span`,{class:D([`glass-card px-2 py-1 text-xs font-medium rounded border transition-all duration-200`,`border-stroke dark:border-dark-border`,$.value.isDev?`text-secondary bg-secondary-bg/20 dark:bg-secondary-bg/10 border-secondary/40`:`text-content-muted`])},` C:v`+t($.value.base)+t($.value.isDev?`.dev${$.value.devNumber}`:``),3),Se.value?(g(),T(`svg`,{key:0,class:D([`w-3 h-3 text-content-muted transition-transform duration-200`,xe.value?`rotate-180`:``]),fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[...r[12]||=[C(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M19 9l-7 7-7-7`},null,-1)]],2)):_(``,!0)]),xe.value?(g(),T(`div`,xr,[C(`div`,Sr,[C(`div`,Cr,[r[13]||=C(`span`,{class:`text-content-muted font-medium`},`Repeater:`,-1),C(`span`,wr,`v`+t(Q.value.base),1)]),Q.value.isDev?(g(),T(`div`,Tr,[C(`div`,null,`Dev Build: `+t(Q.value.devNumber),1),Q.value.commit?(g(),T(`div`,Er,[r[14]||=C(`span`,null,`Commit:`,-1),C(`code`,Dr,t(Q.value.commit),1)])):_(``,!0)])):_(``,!0)]),r[17]||=C(`div`,{class:`border-t border-stroke-subtle dark:border-stroke/20`},null,-1),C(`div`,Or,[C(`div`,kr,[r[15]||=C(`span`,{class:`text-content-muted font-medium`},`Core:`,-1),C(`span`,Ar,`v`+t($.value.base),1)]),$.value.isDev?(g(),T(`div`,jr,[C(`div`,null,`Dev Build: `+t($.value.devNumber),1),$.value.commit?(g(),T(`div`,Mr,[r[16]||=C(`span`,null,`Commit:`,-1),C(`code`,Nr,t($.value.commit),1)])):_(``,!0)])):_(``,!0)])])):_(``,!0)]),r[20]||=C(`div`,{class:`border-t border-accent-green mb-4`},null,-1),y(O).dutyCycleEnabled?(g(),T(`div`,Pr,[C(`p`,Fr,[r[18]||=x(` Duty Cycle: `,-1),C(`span`,Ir,t(y(O).dutyCycleUtilization.toFixed(1))+`% / `+t(y(O).dutyCycleMax.toFixed(1))+`%`,1)]),C(`div`,Lr,[C(`div`,{class:`h-full rounded-full transition-all duration-300`,style:s(we.value)},null,4)])])):_(``,!0),C(`p`,Rr,`Last Updated: `+t(be.value),1),r[21]||=C(`div`,{class:`flex flex-col items-center justify-center mt-4`},[C(`p`,{class:`text-content-muted text-[10px] mb-1 tracking-wide uppercase opacity-70`},` Powered by `),C(`a`,{href:`https://meshcore.io`,target:`_blank`,rel:`noopener noreferrer`,title:`MeshCore`},[C(`img`,{src:`/assets/meshcore-DQNtEl5I.svg`,alt:`MeshCore`,class:`h-4 opacity-70 dark:invert-0 invert`})])],-1),C(`div`,zr,[C(`a`,Br,[v(he,{class:`w-5 h-5 text-white group-hover:text-indigo-500 transition-colors`})]),C(`a`,Vr,[v(de,{class:`w-5 h-5 text-white group-hover:text-primary transition-colors`})]),C(`a`,Hr,[v(_e,{class:`w-5 h-5 text-white group-hover:text-yellow-500 transition-colors`})])])])],2)],2),v(Qe,{isOpen:F.value,isLoading:M.value,isSuccess:R.value,error:z.value,onClose:ge,onSend:Z},null,8,[`isOpen`,`isLoading`,`isSuccess`,`error`])],64))}}),Wr=[`aria-label`,`title`],Gr={key:0,xmlns:`http://www.w3.org/2000/svg`,class:`w-5 h-5 text-yellow-600 dark:text-yellow-400`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,"stroke-width":`2`},Kr={key:1,xmlns:`http://www.w3.org/2000/svg`,class:`w-5 h-5 text-content-secondary dark:text-content`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,"stroke-width":`2`},qr=f({__name:`ThemeToggle`,setup(e){let{theme:t,toggleTheme:n}=q();return(e,r)=>(g(),T(`button`,{onClick:r[0]||=(...e)=>y(n)&&y(n)(...e),class:`w-[35px] h-[35px] rounded bg-background-mute dark:bg-surface-elevated flex items-center justify-center hover:bg-stroke-subtle dark:hover:bg-stroke/30 transition-colors`,"aria-label":y(t)===`dark`?`Switch to light mode`:`Switch to dark mode`,title:y(t)===`dark`?`Switch to light mode`:`Switch to dark mode`},[y(t)===`dark`?(g(),T(`svg`,Gr,[...r[1]||=[C(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,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)]])):(g(),T(`svg`,Kr,[...r[2]||=[C(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,d:`M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z`},null,-1)]]))],8,Wr))}}),Jr={class:`flex items-center justify-between p-6 pb-0 shrink-0`},Yr={class:`p-6 space-y-5 overflow-y-auto flex-1`},Xr={class:`grid grid-cols-2 gap-3`},Zr={class:`bg-background-mute dark:bg-background-mute rounded-xl p-3 border border-stroke-subtle dark:border-stroke/10`},Qr={class:`text-sm font-mono font-medium text-content-primary dark:text-content-primary`},$r={key:0,class:`flex items-center gap-1.5 mt-1`},ei={key:0,class:`flex items-start gap-3 bg-amber-50 dark:bg-amber-500/10 border border-amber-200 dark:border-amber-500/30 rounded-xl p-3`},ti={class:`text-xs text-amber-800 dark:text-amber-300`},ni={class:`font-mono font-semibold`},ri={key:1,class:`flex items-center gap-2 bg-green-50 dark:bg-surface border border-green-200 dark:border-accent-green/30 border-l-2 border-l-green-600 dark:border-l-accent-green rounded-xl p-3 text-sm text-green-800 dark:text-content-primary`},ii={key:2,class:`space-y-1`},ai={class:`flex items-center gap-1`},oi={key:1,class:`text-content-muted`},si={key:0,class:`bg-background-mute dark:bg-black/30 rounded-xl border border-stroke-subtle dark:border-stroke/10 overflow-hidden`},ci={class:`max-h-52 overflow-y-auto divide-y divide-stroke-subtle dark:divide-stroke/10`},li=[`href`],ui={class:`font-mono text-[10px] text-content-muted shrink-0 mt-0.5 pt-px`},di={class:`min-w-0 flex-1`},fi={class:`text-xs text-content-primary truncate group-hover:text-primary transition-colors`},pi={class:`text-[10px] text-content-muted mt-0.5`},mi={class:`space-y-2`},hi={class:`flex gap-2`},gi=[`disabled`],_i=[`value`],vi=[`disabled`],yi={key:0,class:`text-xs text-accent-green`},bi={key:1,class:`text-xs text-accent-red`},xi={key:3,class:`space-y-2`},Si={class:`flex items-center justify-between`},Ci={key:0,class:`flex items-center gap-1 text-xs text-primary`},wi={key:1,class:`flex items-center gap-1 text-xs text-primary`},Ti={key:2,class:`flex items-center gap-1 text-xs text-yellow-500`},Ei={key:3,class:`text-xs text-accent-green font-medium`},Di={key:4,class:`text-xs text-accent-red font-medium`},Oi={key:0,class:`w-2 h-4 bg-green-400 animate-pulse inline-block ml-1`},ki={key:1,class:`flex items-center gap-2 mt-2 text-primary`},Ai={key:2,class:`flex items-center gap-2 mt-2 text-yellow-400`},ji={key:3,class:`text-content-muted animate-pulse`},Mi={key:0,class:`text-xs text-accent-red`},Ni={key:4,class:`flex items-center gap-3 bg-primary/5 dark:bg-primary/10 border border-primary/20 rounded-xl p-3 text-sm text-primary`},Pi={key:5},Fi={class:`flex items-center gap-3 bg-yellow-50 dark:bg-yellow-500/10 border border-yellow-200 dark:border-yellow-500/30 rounded-xl p-3 text-sm text-yellow-800 dark:text-yellow-400`},Ii={class:`font-medium`},Li={class:`text-xs opacity-70 mt-0.5`},Ri={key:6,class:`bg-green-50 dark:bg-surface-elevated border border-green-200 dark:border-accent-green/40 rounded-xl p-4`},zi={class:`flex items-center gap-3`},Bi={class:`text-xs text-content-muted mt-0.5`},Vi={class:`font-mono font-semibold`},Hi={key:7,class:`bg-red-50 dark:bg-accent-red/10 border border-accent-red/40 rounded-xl p-4 space-y-3`},Ui={class:`flex items-center gap-3`},Wi={class:`flex-1 min-w-0`},Gi={class:`text-xs text-accent-red/80 mt-0.5`},Ki={key:0,class:`grid grid-cols-2 gap-2 text-xs`},qi={class:`bg-white/50 dark:bg-black/20 rounded-lg px-3 py-2`},Ji={class:`font-mono font-semibold text-content-primary`},Yi={class:`bg-white/50 dark:bg-black/20 rounded-lg px-3 py-2`},Xi={class:`font-mono font-semibold text-accent-red`},Zi={class:`p-6 pt-0 flex items-center gap-3 shrink-0`},Qi=[`disabled`],$i={key:0,class:`flex items-center justify-center gap-2`},ea={key:1,class:`flex items-center justify-center gap-2`},ta={key:2},na=f({__name:`UpdateModal`,props:{show:{type:Boolean},currentVersion:{default:``},latestVersion:{default:``},hasUpdate:{type:Boolean,default:!1},rateLimitUntil:{default:null}},emits:[`close`,`installed`,`version-updated`],setup(e,{emit:r}){let i=e,a=r,s=l(i.currentVersion),d=l(i.latestVersion),f=l(i.hasUpdate);o(()=>i.currentVersion,e=>{s.value=e}),o(()=>i.latestVersion,e=>{d.value=e}),o(()=>i.hasUpdate,e=>{f.value=e});let p=l([`main`]),y=l(`main`),w=l(``),E=l(``),O=l(!1),A=l(!1),j=l([]),N=l(!1),P=l(!0),F=l(`idle`),I=l(null),L=l([]),R=l(null),ee=l(!1),te=l(null),V=l(null),H=null,U=l(!1),W=null,ne=b(()=>F.value===`idle`||F.value===`error`||F.value===`verify-failed`),re=b(()=>{switch(F.value){case`installing`:return`Installing…`;case`restarting`:return`Restarting…`;case`verified`:return`Installed ✓`;case`verify-failed`:return`Retry Install`;case`complete`:return`Installed ✓`;case`error`:return`Retry Install`;default:return f.value?`Install Update`:`Force Reinstall`}});function G(){R.value&&(R.value.scrollTop=R.value.scrollHeight)}function K(e){L.value.push(e),L.value.length>500&&L.value.splice(0,L.value.length-500),setTimeout(G,20)}function q(){H&&=(H.close(),null)}async function Y(){N.value=!0,j.value=[];try{let e=await B.get(`/update/changelog`);e.success&&Array.isArray(e.commits)&&(j.value=e.commits)}catch{}finally{N.value=!1}}async function ie(){O.value=!0,E.value=``;try{let e=await B.get(`/update/channels`);e.success&&Array.isArray(e.channels)&&(p.value=e.channels,y.value=e.current_channel??`main`)}catch{p.value=[`main`],E.value=`Could not load channels from GitHub`}finally{O.value=!1}}async function ae(){if(y.value){w.value=``,E.value=``;try{let e=await B.post(`/update/set_channel`,{channel:y.value});if(!e.success){E.value=e.error??`Failed to set channel`;return}w.value=`Switched to '${y.value}' — checking version…`,F.value=`idle`,I.value=null,L.value=[],A.value=!0,d.value=``,f.value=!1;try{await B.post(`/update/check`);for(let e=0;e<24;e++){let e=await B.get(`/update/status`);if(e.success&&e.state!==`checking`){s.value=e.current_version??s.value,d.value=e.latest_version??``,f.value=!!e.has_update,w.value=`Switched to '${y.value}'`,a(`version-updated`,{currentVersion:s.value,latestVersion:d.value,hasUpdate:f.value}),Y();break}await new Promise(e=>setTimeout(e,500))}}catch{w.value=`Switched to '${y.value}' (version check failed)`}finally{A.value=!1}}catch(e){E.value=e?.message??`Failed to set channel`}}}async function oe(){if(!ne.value)return;F.value=`installing`,I.value=null,L.value=[];try{let e=await B.post(`/update/install`,{force:!f.value});if(!e.success){F.value=`error`,I.value=e.error??`Failed to start install`;return}}catch(e){F.value=`error`,I.value=e?.message??`Network error`;return}q();let e=z(),t=e?`/api/update/progress?token=${encodeURIComponent(e)}`:`/api/update/progress`;H=new EventSource(t),H.onmessage=e=>{try{let t=JSON.parse(e.data);switch(t.type){case`line`:{let e=t.line??``;K(e),e.includes(`Restarting service`)&&(U.value=!0,W||=setTimeout(()=>{W=null,(F.value===`installing`||F.value===`complete`)&&(q(),F.value=`restarting`,K(`[pyMC updater] Service is restarting — waiting for it to come back…`),se())},8e3));break}case`status`:t.state===`error`?F.value=`error`:t.state===`complete`&&(U.value=!0,F.value=`complete`);break;case`done`:q(),W&&=(clearTimeout(W),null),t.state===`complete`?(F.value=`restarting`,se()):(F.value=`error`,t.error&&(I.value=t.error));break}}catch{}},H.onerror=()=>{if(q(),W&&=(clearTimeout(W),null),U.value&&F.value!==`error`){F.value=`restarting`,K(`[pyMC updater] Connection lost — waiting for service restart…`),se();return}F.value===`installing`&&(F.value=`error`,I.value=`Progress stream disconnected`)}}async function se(){let e=d.value;V.value=`going-down`;let t=Date.now()+2e4,n=!1;for(;Date.now()setTimeout(e,1e3));try{await B.get(`/update/status`)}catch{n=!0;break}}n||K(`[pyMC updater] Service did not appear to stop — assuming fast restart`),V.value=`coming-up`;let r=Date.now()+6e4;for(;Date.now()setTimeout(e,2e3));try{let t=await B.get(`/update/status`);if(!t?.success)continue;V.value=`verifying`,await new Promise(e=>setTimeout(e,1200));let n=t.current_version??``;te.value=n,s.value=n||s.value,a(`version-updated`,{currentVersion:s.value,latestVersion:d.value,hasUpdate:!!t.has_update}),n&&e&&n===e?(F.value=`verified`,f.value=!1,V.value=null,a(`installed`)):(F.value=`verify-failed`,V.value=null);return}catch{}}F.value=`verify-failed`,V.value=null,I.value=`Service did not respond after restart — check logs`}o(()=>i.show,e=>{e?(F.value=`idle`,I.value=null,L.value=[],ee.value=!1,te.value=null,V.value=null,U.value=!1,W&&=(clearTimeout(W),null),w.value=``,E.value=``,s.value=i.currentVersion,d.value=i.latestVersion,f.value=i.hasUpdate,ie(),Y()):q()}),n(()=>{q(),W&&=(clearTimeout(W),null)});function ce(e){e.target===e.currentTarget&&F.value!==`installing`&&F.value!==`restarting`&&F.value!==`verified`&&a(`close`)}function le(){window.location.reload()}return(e,n)=>(g(),u(m,{to:`body`},[i.show?(g(),T(`div`,{key:0,class:`modal-backdrop`,onClick:ce},[C(`div`,{class:`bg-white dark:bg-surface-elevated rounded-[20px] w-full max-w-lg border border-stroke-subtle dark:border-white/10 shadow-2xl flex flex-col max-h-[90vh]`,onClick:n[5]||=M(()=>{},[`stop`])},[C(`div`,Jr,[n[7]||=C(`div`,{class:`flex items-center gap-3`},[C(`div`,{class:`w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center`},[C(`svg`,{class:`w-5 h-5 text-primary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[C(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12`})])]),C(`div`,null,[C(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary`},` OTA Update `),C(`p`,{class:`text-xs text-content-muted dark:text-content-muted`},` Update over the air from GitHub `)])],-1),F.value!==`installing`&&F.value!==`restarting`&&F.value!==`verified`?(g(),T(`button`,{key:0,onClick:n[0]||=e=>a(`close`),class:`text-content-secondary hover:text-content-primary transition-colors`},[...n[6]||=[C(`svg`,{class:`w-6 h-6`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[C(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])):_(``,!0)]),C(`div`,Yr,[C(`div`,Xr,[C(`div`,Zr,[n[8]||=C(`p`,{class:`text-xs text-content-muted mb-1`},`Installed`,-1),C(`p`,Qr,t(s.value||`—`),1)]),C(`div`,{class:D([`bg-background-mute dark:bg-background-mute rounded-xl p-3 border border-stroke-subtle dark:border-stroke/10`,f.value?`border-l-2 border-l-accent-red`:`border-l-2 border-l-accent-green`])},[n[10]||=C(`p`,{class:`text-xs text-content-muted mb-1`},`On GitHub`,-1),A.value?(g(),T(`div`,$r,[v(J,{size:`xs`,class:`inline-block`}),n[9]||=C(`span`,{class:`text-xs text-content-muted`},`Checking…`,-1)])):(g(),T(`p`,{key:1,class:D([`text-sm font-mono font-medium`,f.value?`text-accent-red`:`text-accent-green`])},t(d.value||`—`),3))],2)]),i.rateLimitUntil?(g(),T(`div`,ei,[n[14]||=C(`svg`,{class:`w-4 h-4 shrink-0 mt-0.5 text-amber-600 dark:text-amber-400`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[C(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 9v2m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z`})],-1),C(`div`,ti,[n[13]||=C(`p`,{class:`font-semibold mb-0.5`},`GitHub API rate limit reached`,-1),C(`p`,null,[n[11]||=x(` Version checks are paused until `,-1),C(`span`,ni,t(new Date(i.rateLimitUntil).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})),1),n[12]||=x(`. This is a GitHub limit, not a software issue. You can still install or switch channels manually. `,-1)])])])):_(``,!0),!f.value&&s.value&&!A.value?(g(),T(`div`,ri,[...n[15]||=[C(`svg`,{class:`w-4 h-4 shrink-0`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[C(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M5 13l4 4L19 7`})],-1),x(` You are up to date. Use `,-1),C(`em`,{class:`mx-1`},`Force Reinstall`,-1),x(` to reinstall anyway. `,-1)]])):_(``,!0),j.value.length>0||N.value?(g(),T(`div`,ii,[C(`button`,{onClick:n[1]||=e=>P.value=!P.value,class:`flex items-center justify-between w-full text-xs font-medium text-content-secondary dark:text-content-secondary uppercase tracking-wide py-1 hover:text-content-primary transition-colors`},[n[17]||=C(`span`,null,`What's New`,-1),C(`span`,ai,[N.value?(g(),u(J,{key:0,size:`xs`,class:`inline-block`})):(g(),T(`span`,oi,t(j.value.length)+` commit`+t(j.value.length===1?``:`s`),1)),(g(),T(`svg`,{class:D([`w-3.5 h-3.5 text-content-muted transition-transform`,P.value?`rotate-180`:``]),viewBox:`0 0 20 20`,fill:`currentColor`},[...n[16]||=[C(`path`,{"fill-rule":`evenodd`,d:`M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z`,"clip-rule":`evenodd`},null,-1)]],2))])]),P.value?(g(),T(`div`,si,[C(`div`,ci,[(g(!0),T(S,null,h(j.value,e=>(g(),T(`a`,{key:e.sha,href:e.url,target:`_blank`,class:`flex gap-3 px-3 py-2.5 hover:bg-background-soft dark:hover:bg-surface/50 transition-colors group`},[C(`span`,ui,t(e.short_sha),1),C(`div`,di,[C(`p`,fi,t(e.title),1),C(`p`,pi,t(e.author)+` · `+t(e.date?new Date(e.date).toLocaleDateString():``),1)]),n[18]||=C(`svg`,{class:`w-3 h-3 text-content-muted shrink-0 mt-1 opacity-0 group-hover:opacity-100 transition-opacity`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`},[C(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14`})],-1)],8,li))),128))])])):_(``,!0)])):_(``,!0),C(`div`,mi,[n[19]||=C(`label`,{class:`text-xs font-medium text-content-secondary dark:text-content-secondary uppercase tracking-wide`},` Release Channel `,-1),C(`div`,hi,[c(C(`select`,{"onUpdate:modelValue":n[2]||=e=>y.value=e,disabled:O.value||F.value===`installing`||F.value===`verified`||A.value,class:`flex-1 bg-background-mute dark:bg-surface border border-stroke-subtle dark:border-stroke/20 rounded-xl px-3 py-2 text-sm text-content-primary dark:text-content-primary disabled:opacity-50 focus:outline-none focus:ring-1 focus:ring-primary`},[(g(!0),T(S,null,h(p.value,e=>(g(),T(`option`,{key:e,value:e},t(e),9,_i))),128))],8,gi),[[k,y.value]]),C(`button`,{onClick:ae,disabled:O.value||F.value===`installing`||F.value===`verified`||A.value,class:`px-4 py-2 bg-primary/10 hover:bg-primary/20 text-primary rounded-xl text-sm font-medium disabled:opacity-50 transition-colors`},t(O.value||A.value?`…`:`Apply`),9,vi)]),w.value?(g(),T(`p`,yi,t(w.value),1)):_(``,!0),E.value?(g(),T(`p`,bi,t(E.value),1)):_(``,!0),n[20]||=C(`p`,{class:`text-xs text-content-muted`},[C(`em`,null,`main`),x(` = stable releases \xA0|\xA0 `),C(`em`,null,`dev`),x(` = latest commits (may be unstable) `)],-1)]),F.value===`installing`||F.value===`restarting`||L.value.length>0&&(ee.value||F.value===`error`)?(g(),T(`div`,xi,[C(`div`,Si,[n[24]||=C(`label`,{class:`text-xs font-medium text-content-secondary uppercase tracking-wide`},`Install Log`,-1),F.value===`installing`?(g(),T(`span`,Ci,[...n[21]||=[C(`span`,{class:`inline-block w-2 h-2 rounded-full bg-primary animate-pulse`},null,-1),x(` Running… `,-1)]])):F.value===`restarting`&&V.value===`verifying`?(g(),T(`span`,wi,[...n[22]||=[C(`span`,{class:`inline-block w-2 h-2 rounded-full bg-primary animate-pulse`},null,-1),x(` Checking version… `,-1)]])):F.value===`restarting`?(g(),T(`span`,Ti,[n[23]||=C(`span`,{class:`inline-block w-2 h-2 rounded-full bg-yellow-500 animate-pulse`},null,-1),x(` `+t(V.value===`going-down`?`Stopping service…`:`Waiting for service…`),1)])):F.value===`verified`?(g(),T(`span`,Ei,`Complete ✓`)):F.value===`verify-failed`||F.value===`error`?(g(),T(`span`,Di,`Failed ✗`)):_(``,!0)]),C(`div`,{ref_key:`logContainer`,ref:R,class:`bg-zinc-900 dark:bg-black/60 rounded-xl p-3 h-52 overflow-y-auto font-mono text-xs text-green-400 leading-relaxed border border-stroke/20`},[(g(!0),T(S,null,h(L.value,(e,n)=>(g(),T(`div`,{key:n,class:D([`whitespace-pre-wrap break-all`,{"text-accent-red":e.includes(`✗`)||e.includes(`error`)||e.includes(`ERROR`)||e.includes(`Failed`),"text-yellow-400":e.includes(`WARNING`)||e.includes(`⚠`),"text-accent-green":e.includes(`✓`)||e.includes(`Successfully`),"text-content-muted/60":e.includes(`keepalive`)}])},t(e),3))),128)),F.value===`installing`?(g(),T(`div`,Oi)):_(``,!0),F.value===`restarting`&&V.value===`verifying`?(g(),T(`div`,ki,[v(J,{size:`xs`,class:`inline-block`}),n[25]||=x(` Service is back — verifying version… `,-1)])):F.value===`restarting`?(g(),T(`div`,Ai,[v(J,{size:`xs`,class:`inline-block`}),x(` `+t(V.value===`going-down`?`Waiting for service to stop…`:`Waiting for service to come back up…`),1)])):_(``,!0),L.value.length===0&&F.value===`installing`?(g(),T(`div`,ji,` Waiting for output… `)):_(``,!0)],512),I.value?(g(),T(`p`,Mi,t(I.value),1)):_(``,!0)])):_(``,!0),F.value===`restarting`&&V.value===`verifying`?(g(),T(`div`,Ni,[v(J,{size:`sm`,class:`shrink-0`}),n[26]||=C(`div`,null,[C(`p`,{class:`font-medium`},`Checking version…`),C(`p`,{class:`text-xs opacity-70 mt-0.5`},` Confirming the installed version matches the target `)],-1)])):F.value===`restarting`&&L.value.length===0?(g(),T(`div`,Pi,[C(`div`,Fi,[v(J,{size:`sm`,class:`shrink-0`}),C(`div`,null,[C(`p`,Ii,t(V.value===`going-down`?`Stopping service…`:`Starting service…`),1),C(`p`,Li,t(V.value===`going-down`?`Waiting for the old process to exit`:`Waiting for the service to become healthy`),1)])])])):_(``,!0),F.value===`verified`?(g(),T(`div`,Ri,[C(`div`,zi,[n[29]||=C(`div`,{class:`w-9 h-9 rounded-full bg-accent-green flex items-center justify-center shrink-0`},[C(`svg`,{class:`w-5 h-5 text-white`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[C(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2.5`,d:`M5 13l4 4L19 7`})])],-1),C(`div`,null,[n[28]||=C(`p`,{class:`font-semibold text-content-primary`},` Installed successfully! `,-1),C(`p`,Bi,[n[27]||=x(` Running version `,-1),C(`span`,Vi,t(te.value),1)])])]),C(`button`,{onClick:le,class:`modal-btn-primary w-full mt-3 text-sm font-semibold`},` Refresh Page to Load New Version `)])):_(``,!0),F.value===`verify-failed`?(g(),T(`div`,Hi,[C(`div`,Ui,[n[31]||=C(`div`,{class:`w-9 h-9 rounded-full bg-accent-red/15 flex items-center justify-center shrink-0`},[C(`svg`,{class:`w-5 h-5 text-accent-red`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[C(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2.5`,d:`M6 18L18 6M6 6l12 12`})])],-1),C(`div`,Wi,[n[30]||=C(`p`,{class:`font-semibold text-accent-red`},`Installation may have failed`,-1),C(`p`,Gi,t(I.value||`Version mismatch after restart`),1)])]),te.value||d.value?(g(),T(`div`,Ki,[C(`div`,qi,[n[32]||=C(`p`,{class:`text-content-muted mb-0.5`},`Expected`,-1),C(`p`,Ji,t(d.value||`—`),1)]),C(`div`,Yi,[n[33]||=C(`p`,{class:`text-content-muted mb-0.5`},`Reported`,-1),C(`p`,Xi,t(te.value||`unknown`),1)])])):_(``,!0),L.value.length>0?(g(),T(`button`,{key:1,onClick:n[3]||=e=>ee.value=!ee.value,class:`w-full text-xs text-accent-red/70 hover:text-accent-red underline underline-offset-2 hover:no-underline transition-all`},t(ee.value?`Hide install log`:`View install log`),1)):_(``,!0)])):_(``,!0)]),C(`div`,Zi,[C(`button`,{onClick:oe,disabled:!ne.value,class:D([`flex-1 py-3 rounded-xl font-semibold text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,F.value===`verified`||F.value===`complete`?`bg-accent-green/20 text-accent-green border border-accent-green/50 cursor-default`:F.value===`error`||F.value===`verify-failed`?`bg-accent-red/20 hover:bg-accent-red/30 text-accent-red border border-accent-red/50`:F.value===`restarting`?`bg-yellow-500/20 text-yellow-600 cursor-default`:`bg-primary/20 hover:bg-primary/30 text-primary border border-primary/50`])},[F.value===`installing`?(g(),T(`span`,$i,[v(J,{size:`sm`,color:`white`}),n[34]||=x(` Installing… `,-1)])):F.value===`restarting`?(g(),T(`span`,ea,[v(J,{size:`sm`}),n[35]||=x(` Restarting service… `,-1)])):(g(),T(`span`,ta,t(re.value),1))],10,Qi),F.value!==`installing`&&F.value!==`restarting`&&F.value!==`verified`?(g(),T(`button`,{key:0,onClick:n[4]||=e=>a(`close`),class:`px-6 py-3 rounded-xl border border-stroke-subtle dark:border-stroke/20 text-content-secondary hover:text-content-primary hover:bg-background-mute transition-colors text-sm`},` Close `)):_(``,!0)])])])):_(``,!0)]))}}),ra={class:`modal-card max-w-md shadow-xl`},ia={key:0,class:`flex flex-col items-center gap-5 py-2`},aa={class:`flex items-start gap-3 mb-4`},oa={class:`mt-1 text-sm text-content-secondary dark:text-content-muted`},sa={class:`flex items-start gap-3 mb-4`},ca={class:`text-base font-semibold text-content-primary dark:text-content-primary`},la={class:`mt-1 text-sm text-content-secondary dark:text-content-muted`},ua=f({__name:`RestartModal`,props:{modelValue:{type:Boolean},message:{},title:{default:`Service Restart Required`},startImmediately:{type:Boolean,default:!1}},emits:[`update:modelValue`],setup(n,{emit:r}){let i=n,a=r,s=l(!1),c=l(!1),d=l(``),f=null,p=0,h=0;function y(){s.value&&!c.value||(s.value=!1,c.value=!1,d.value=``,f&&=(clearTimeout(f),null),p=0,h=0,a(`update:modelValue`,!1))}async function b(){s.value=!0,c.value=!1,d.value=``;try{let e=await B.post(`/restart_service`,{});if(!e.success){s.value=!1,c.value=!0,d.value=e.error?`Restart failed: ${e.error}`:`Restart failed.`;return}}catch(e){let t=e;if(t.response){s.value=!1,c.value=!0;let e=t.response.status,n=t.response.data?.error||t.response.data?.message;e===403||e===401?d.value=`Permission denied. The service could not be restarted. Check polkit configuration.`:d.value=n?`Restart failed: ${n}`:`Restart failed (HTTP ${e}).`;return}}p=0,h=0,f=setTimeout(w,ae)}function x(){s.value=!0,c.value=!1,p=0,h=0,f=setTimeout(w,ae)}function w(){p++,fetch(Y,{method:`GET`}).then(e=>{e.ok?(h++,h>=5?window.location.reload():f=setTimeout(w,ie)):(h=0,D())}).catch(()=>{h=0,D()})}function D(){p<50?f=setTimeout(w,ie):(s.value=!1,c.value=!0)}return o(()=>i.modelValue,e=>{e?i.startImmediately&&x():(s.value=!1,c.value=!1,d.value=``,f&&=(clearTimeout(f),null),p=0,h=0)}),E(()=>{f&&clearTimeout(f)}),(r,i)=>(g(),u(m,{to:`body`},[v(j,{"enter-active-class":`transition-opacity duration-200`,"enter-from-class":`opacity-0`,"leave-active-class":`transition-opacity duration-200`,"leave-to-class":`opacity-0`},{default:e(()=>[n.modelValue?(g(),T(`div`,{key:0,class:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:M(y,[`self`])},[C(`div`,ra,[s.value?(g(),T(`div`,ia,[v(J,{size:`lg`}),i[0]||=C(`div`,{class:`text-center`},[C(`h3`,{class:`text-base font-semibold text-content-primary dark:text-content-primary`},` Restarting… `),C(`p`,{class:`mt-1 text-sm text-content-secondary dark:text-content-muted`},` Please wait while the service restarts. This may take up to a minute. `)],-1)])):c.value?(g(),T(S,{key:1},[C(`div`,aa,[i[2]||=C(`div`,{class:`flex-shrink-0 w-10 h-10 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center`},[C(`svg`,{class:`w-5 h-5 text-red-600 dark:text-red-400`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[C(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 9v2m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z`})])],-1),C(`div`,null,[i[1]||=C(`h3`,{class:`text-base font-semibold text-content-primary dark:text-content-primary`},` Service Did Not Restart `,-1),C(`p`,oa,t(d.value||`The service did not respond after 60 seconds. Please log into the device and check the system logs.`),1)])]),C(`div`,{class:`modal-actions`},[C(`button`,{onClick:y,class:`modal-btn-cancel`},`Dismiss`)])],64)):(g(),T(S,{key:2},[C(`div`,sa,[i[3]||=C(`div`,{class:`flex-shrink-0 w-10 h-10 rounded-full bg-amber-100 dark:bg-amber-900/30 flex items-center justify-center`},[C(`svg`,{class:`w-5 h-5 text-amber-600 dark:text-amber-400`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[C(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 9v2m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z`})])],-1),C(`div`,null,[C(`h3`,ca,t(n.title),1),C(`p`,la,t(n.message),1)])]),C(`div`,{class:`modal-actions`},[C(`button`,{onClick:y,class:`modal-btn-cancel`},`Cancel`),C(`button`,{onClick:b,class:`modal-btn-primary`},`Restart`)])],64))])])):_(``,!0)]),_:1})]))}});function da(e,t){let n=R(),r=null,i=null,a=b(()=>(t.enabled===void 0?!0:w(t.enabled))&&n.canMaintainConnections),s=async()=>i||(i=Promise.resolve(e()).finally(()=>{i=null}),i),c=()=>{r!==null&&(clearInterval(r),r=null)},l=async()=>{c(),a.value&&(t.immediate!==!1&&await s(),r=window.setInterval(()=>{s()},t.intervalMs))};return o(a,e=>{e?l():c()},{immediate:!0}),E(()=>{c()}),{start:l,stop:c,runNow:s}}var fa={class:`glass-card p-3 sm:p-6 mb-5 rounded-[20px] relative z-10`},pa={class:`flex justify-between items-center`},ma={class:`flex items-center gap-3`},ha={class:`hidden sm:block`},ga={class:`text-content-primary dark:text-content-primary text-2xl lg:text-[35px] font-bold mb-1 sm:mb-2`},_a={class:`flex items-center gap-3 sm:gap-4 relative`},va={class:`text-right`,style:{"min-width":`180px`}},ya={key:0,class:`flex items-center gap-2 justify-end`},ba={key:1,class:`space-y-1`},xa={class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},Sa={class:`text-primary font-medium`},Ca={key:0,class:`text-xs text-content-muted dark:text-content-muted/80`,style:{"min-height":`16px`}},wa={key:0},Ta={key:2},Ea={key:0,class:`text-xs text-content-muted dark:text-content-muted/60 hidden sm:block`,style:{"min-height":`16px`}},Da={key:0,class:`absolute right-[5px] top-10 z-[250] w-80 bg-surface dark:bg-surface-elevated border border-stroke-subtle dark:border-stroke/20 rounded-[15px] p-4 shadow-2xl backdrop-blur-sm`},Oa={class:`flex items-center justify-between mb-3`},ka={class:`flex items-center gap-2`},Aa=[`disabled`],ja=[`disabled`],Ma={class:`space-y-3 text-sm`},Na={key:0,class:`bg-red-50 dark:bg-background-mute p-3 rounded-lg border border-accent-red/30 border-l-2 border-l-accent-red`},Pa={class:`flex items-center justify-between`},Fa={class:`text-accent-red font-bold`},Ia={class:`text-xs text-content-muted dark:text-content-muted mt-1`},La={class:`mt-2 flex items-center gap-2`},Ra=[`disabled`],za={key:1,class:`flex items-start gap-2 bg-amber-50 dark:bg-amber-500/10 border border-amber-200 dark:border-amber-500/30 border-l-2 border-l-amber-500 rounded-lg p-3 text-xs text-amber-800 dark:text-amber-300`},Ba={key:2,class:`bg-green-50 dark:bg-background-mute p-3 rounded-lg border border-stroke-subtle dark:border-stroke/10 border-l-2 border-l-accent-green`},Va={class:`flex items-center justify-between`},Ha={class:`text-accent-green font-bold`},Ua={key:0,class:`text-xs text-content-muted dark:text-content-muted mt-1`},Wa={class:`mt-2 flex items-center gap-2`},Ga=[`disabled`],Ka={key:3,class:`bg-background-mute dark:bg-background-mute p-3 rounded-lg border border-stroke-subtle dark:border-stroke/10`},qa={class:`flex items-center justify-center gap-2`},Ja={key:4,class:`bg-red-50 dark:bg-background-mute p-3 rounded-lg border border-accent-red/30 border-l-2 border-l-accent-red`},Ya={class:`text-xs text-content-secondary dark:text-content-muted`},Xa={class:`bg-background-mute dark:bg-background-mute p-3 rounded-lg border border-stroke-subtle dark:border-stroke/10 border-l-2 border-l-primary`},Za={class:`flex items-center justify-between`},Qa={class:`text-primary font-bold`},$a={key:0,class:`text-xs text-content-muted dark:text-content-muted mt-1`},eo={class:`flex items-center justify-between`},to={class:`text-content-primary dark:text-content-primary font-medium`},no={key:0,class:`mt-2`},ro={class:`text-xs text-content-muted dark:text-content-muted`},io={class:`text-content-secondary dark:text-content-secondary`},ao={key:5,class:`bg-background-mute dark:bg-background-mute p-4 rounded-lg border border-stroke-subtle dark:border-stroke/10 text-center`},oo={key:6,class:`bg-background-mute dark:bg-background-mute p-3 rounded-lg border border-stroke-subtle dark:border-stroke/10 text-center`},so={class:`flex items-center justify-center gap-2`},co={key:0,class:`absolute right-[5px] top-10 z-[100] w-48 bg-surface dark:bg-surface-elevated border border-stroke-subtle dark:border-stroke/20 rounded-xl shadow-2xl overflow-hidden`},lo={key:0,class:`mt-4 rounded-xl border border-amber-500/40 bg-amber-500/10 px-4 py-3 text-amber-800 dark:text-amber-200`,role:`alert`},uo={class:`flex items-start gap-3`},fo={class:`font-semibold`},po={class:`text-sm opacity-90`},mo=K(f({name:`TopBar`,__name:`TopBar`,emits:[`toggleMobileSidebar`],setup(e,{emit:n}){let i=n;I();let a=W(),o=re(),s=R(),c=l(!1),u=l(null),f=l(!1),p=l(!1),m=l(null),w=l(!1),O=l({hasUpdate:!1,currentVersion:``,latestVersion:``,isChecking:!1,lastChecked:null,error:null,rateLimitUntil:null}),k=l(V()||`User`),A=[`Chat Node`,`Repeater`,`Room Server`],j=Object.fromEntries(Object.entries(ne).map(([e,t])=>[t,e])),N=b(()=>{let e={};for(let t of A){let n=j[t];e[t]=o.advertsByType[n]||[]}return e}),P=b(()=>o.isLoading),F=b(()=>o.lastFetched?new Date(o.lastFetched):null);function L(e){let t=e.target;u.value&&!u.value.contains(t)&&(c.value=!1),m.value&&!m.value.contains(t)&&(p.value=!1)}let z=async(e=!1)=>{if(!O.value.isChecking)try{O.value.isChecking=!0,O.value.error=null,await B.post(`/update/check`,e?{force:!0}:{});for(let e=0;e<20;e++){let e=await B.get(`/update/status`);if(e.success&&e.state!==`checking`){O.value.currentVersion=e.current_version??``,O.value.latestVersion=e.latest_version??``,O.value.hasUpdate=!!e.has_update,O.value.lastChecked=new Date,O.value.error=e.error??null,O.value.rateLimitUntil=e.rate_limit_until??null;return}await new Promise(e=>setTimeout(e,500))}O.value.error=`Version check timed out`}catch(e){console.error(`Error checking for updates:`,e),O.value.error=e instanceof Error?e.message:`Failed to check for updates`}finally{O.value.isChecking=!1}},ee=()=>{c.value=!1,z(),a.fetchStats()},te=e=>{O.value.currentVersion=e.currentVersion,O.value.latestVersion=e.latestVersion,O.value.hasUpdate=e.hasUpdate,O.value.lastChecked=new Date},H=()=>{s.stopSession(`logout`)},U=b(()=>Object.values(N.value).reduce((e,t)=>e+t.length,0)),G=b(()=>A.map(e=>({type:e,count:N.value[e]?.length||0})).filter(e=>e.count>0)),K=b(()=>!0),q=b(()=>{if(String(a.stats?.radio_status??``).toLowerCase()!==`degraded`)return null;let e=a.stats?.config?.radio_type??`configured radio`,t=a.stats?.radio_error||`Radio initialization failed`;return{title:`Radio degraded (${e})`,details:t}}),Y=e=>({"Chat Node":`text-blue-600 dark:text-blue-400`,Repeater:`text-accent-green`,"Room Server":`text-accent-purple`})[e]||`text-gray-400`,ie=e=>{let t=N.value[e]||[];return t.length===0?`None`:t.reduce((e,t)=>t.last_seen>e.last_seen?t:e,t[0]).node_name||`Unknown Node`};r(()=>{document.addEventListener(`click`,L),z()}),E(()=>{document.removeEventListener(`click`,L)}),da(()=>z(),{intervalMs:6e5,enabled:!0,immediate:!1});let ae=()=>{i(`toggleMobileSidebar`)};return(e,n)=>(g(),T(S,null,[C(`div`,fa,[C(`div`,pa,[C(`div`,ma,[C(`button`,{onClick:ae,class:`lg:hidden w-10 h-10 rounded bg-background-mute dark:bg-surface-elevated flex items-center justify-center hover:bg-stroke-subtle dark:hover:bg-stroke/30 transition-colors`},[...n[13]||=[C(`svg`,{class:`w-5 h-5 text-content-secondary dark:text-content-primary`,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[C(`path`,{d:`M3 6h14M3 10h14M3 14h14`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`})],-1)]]),C(`div`,ha,[C(`h1`,ga,` Hi `+t(k.value)+`👋 `,1)])]),C(`div`,_a,[C(`div`,va,[P.value?(g(),T(`div`,ya,[v(J,{size:`xs`}),n[14]||=C(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},` Loading... `,-1)])):U.value>0?(g(),T(`div`,ba,[C(`p`,xa,[n[15]||=x(` Tracking: `,-1),C(`span`,Sa,t(U.value)+` node`+t(U.value===1?``:`s`),1)]),G.value.length>0?(g(),T(`div`,Ca,[(g(!0),T(S,null,h(G.value,(e,n)=>(g(),T(`span`,{key:e.type,class:`inline`},[x(t(e.count)+` `+t(e.type)+t(e.count===1?``:`s`),1),n