quadwork 1.2.1 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/out/404.html +1 -1
  2. package/out/__next.__PAGE__.txt +3 -3
  3. package/out/__next._full.txt +12 -12
  4. package/out/__next._head.txt +4 -4
  5. package/out/__next._index.txt +6 -6
  6. package/out/__next._tree.txt +2 -2
  7. package/out/_next/static/chunks/0-yus965h3bk_.js +24 -0
  8. package/out/_next/static/chunks/0d.f~y5jeh785.css +2 -0
  9. package/out/_next/static/chunks/{064engxz5n7u9.js → 0e~ue9ca5zrep.js} +1 -1
  10. package/out/_next/static/chunks/0md7hgvwnovzq.js +1 -0
  11. package/out/_next/static/chunks/0whtwwbpg72ar.js +1 -0
  12. package/out/_next/static/chunks/{0o97ax9om2kj1.js → 16ell.n1p8o7d.js} +1 -1
  13. package/out/_not-found/__next._full.txt +11 -11
  14. package/out/_not-found/__next._head.txt +4 -4
  15. package/out/_not-found/__next._index.txt +6 -6
  16. package/out/_not-found/__next._not-found.__PAGE__.txt +2 -2
  17. package/out/_not-found/__next._not-found.txt +3 -3
  18. package/out/_not-found/__next._tree.txt +2 -2
  19. package/out/_not-found.html +1 -1
  20. package/out/_not-found.txt +11 -11
  21. package/out/app-shell/__next._full.txt +11 -11
  22. package/out/app-shell/__next._head.txt +4 -4
  23. package/out/app-shell/__next._index.txt +6 -6
  24. package/out/app-shell/__next._tree.txt +2 -2
  25. package/out/app-shell/__next.app-shell.__PAGE__.txt +2 -2
  26. package/out/app-shell/__next.app-shell.txt +3 -3
  27. package/out/app-shell.html +1 -1
  28. package/out/app-shell.txt +11 -11
  29. package/out/index.html +1 -1
  30. package/out/index.txt +12 -12
  31. package/out/project/_/__next._full.txt +12 -12
  32. package/out/project/_/__next._head.txt +4 -4
  33. package/out/project/_/__next._index.txt +6 -6
  34. package/out/project/_/__next._tree.txt +2 -2
  35. package/out/project/_/__next.project.$d$id.__PAGE__.txt +3 -3
  36. package/out/project/_/__next.project.$d$id.txt +3 -3
  37. package/out/project/_/__next.project.txt +3 -3
  38. package/out/project/_/memory/__next._full.txt +12 -12
  39. package/out/project/_/memory/__next._head.txt +4 -4
  40. package/out/project/_/memory/__next._index.txt +6 -6
  41. package/out/project/_/memory/__next._tree.txt +2 -2
  42. package/out/project/_/memory/__next.project.$d$id.memory.__PAGE__.txt +3 -3
  43. package/out/project/_/memory/__next.project.$d$id.memory.txt +3 -3
  44. package/out/project/_/memory/__next.project.$d$id.txt +3 -3
  45. package/out/project/_/memory/__next.project.txt +3 -3
  46. package/out/project/_/memory.html +1 -1
  47. package/out/project/_/memory.txt +12 -12
  48. package/out/project/_/queue/__next._full.txt +12 -12
  49. package/out/project/_/queue/__next._head.txt +4 -4
  50. package/out/project/_/queue/__next._index.txt +6 -6
  51. package/out/project/_/queue/__next._tree.txt +2 -2
  52. package/out/project/_/queue/__next.project.$d$id.queue.__PAGE__.txt +3 -3
  53. package/out/project/_/queue/__next.project.$d$id.queue.txt +3 -3
  54. package/out/project/_/queue/__next.project.$d$id.txt +3 -3
  55. package/out/project/_/queue/__next.project.txt +3 -3
  56. package/out/project/_/queue.html +1 -1
  57. package/out/project/_/queue.txt +12 -12
  58. package/out/project/_.html +1 -1
  59. package/out/project/_.txt +12 -12
  60. package/out/settings/__next._full.txt +12 -12
  61. package/out/settings/__next._head.txt +4 -4
  62. package/out/settings/__next._index.txt +6 -6
  63. package/out/settings/__next._tree.txt +2 -2
  64. package/out/settings/__next.settings.__PAGE__.txt +3 -3
  65. package/out/settings/__next.settings.txt +3 -3
  66. package/out/settings.html +1 -1
  67. package/out/settings.txt +12 -12
  68. package/out/setup/__next._full.txt +12 -12
  69. package/out/setup/__next._head.txt +4 -4
  70. package/out/setup/__next._index.txt +6 -6
  71. package/out/setup/__next._tree.txt +2 -2
  72. package/out/setup/__next.setup.__PAGE__.txt +3 -3
  73. package/out/setup/__next.setup.txt +3 -3
  74. package/out/setup.html +1 -1
  75. package/out/setup.txt +12 -12
  76. package/package.json +1 -1
  77. package/server/agentchattr-registry.js +105 -0
  78. package/server/index.js +125 -21
  79. package/server/routes.js +99 -10
  80. package/out/_next/static/chunks/03v5eoc-wic6o.js +0 -1
  81. package/out/_next/static/chunks/0738cfu-x.0ul.js +0 -24
  82. package/out/_next/static/chunks/0r-00ph4jahrl.css +0 -2
  83. /package/out/_next/static/{R3KHD-zZk76pfWNOR4boQ → 6W2vNw7Pp8z2_l_OJ2hqC}/_buildManifest.js +0 -0
  84. /package/out/_next/static/{R3KHD-zZk76pfWNOR4boQ → 6W2vNw7Pp8z2_l_OJ2hqC}/_clientMiddlewareManifest.js +0 -0
  85. /package/out/_next/static/{R3KHD-zZk76pfWNOR4boQ → 6W2vNw7Pp8z2_l_OJ2hqC}/_ssgManifest.js +0 -0
@@ -1,24 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,87038,(e,i,r)=>{"use strict";var s=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,o=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,h=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,u=/^\s+|\s+$/g;function d(e){return e?e.replace(u,""):""}i.exports=function(e,i){if("string"!=typeof e)throw TypeError("First argument must be a string");if(!e)return[];i=i||{};var r=1,u=1;function f(e){var i=e.match(n);i&&(r+=i.length);var s=e.lastIndexOf("\n");u=~s?e.length-s:u+e.length}function _(){var e={line:r,column:u};return function(i){return i.position=new p(e),m(o),i}}function p(e){this.start=e,this.end={line:r,column:u},this.source=i.source}function g(s){var n=Error(i.source+":"+r+":"+u+": "+s);if(n.reason=s,n.filename=i.source,n.line=r,n.column=u,n.source=e,i.silent);else throw n}function m(i){var r=i.exec(e);if(r){var s=r[0];return f(s),e=e.slice(s.length),r}}function v(e){var i;for(e=e||[];i=S();)!1!==i&&e.push(i);return e}function S(){var i=_();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var r=2;""!=e.charAt(r)&&("*"!=e.charAt(r)||"/"!=e.charAt(r+1));)++r;if(r+=2,""===e.charAt(r-1))return g("End of comment missing");var s=e.slice(2,r-2);return u+=2,f(s),e=e.slice(r),u+=2,i({type:"comment",comment:s})}}p.prototype.content=e,m(o);var y,b=[];for(v(b);y=function(){var e=_(),i=m(l);if(i){if(S(),!m(a))return g("property missing ':'");var r=m(h),n=e({type:"declaration",property:d(i[0].replace(s,"")),value:r?d(r[0].replace(s,"")):""});return m(c),n}}();)!1!==y&&(b.push(y),v(b));return b}},74499,(e,i,r)=>{"use strict";var s=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,i){let r=null;if(!e||"string"!=typeof e)return r;let s=(0,n.default)(e),o="function"==typeof i;return s.forEach(e=>{if("declaration"!==e.type)return;let{property:s,value:n}=e;o?i(s,n,e):n&&((r=r||{})[s]=n)}),r};let n=s(e.r(87038))},20461,(e,i,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.camelCase=void 0;var s=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,o=/^[^-]+$/,l=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,h=function(e,i){return i.toUpperCase()},c=function(e,i){return"".concat(i,"-")};r.camelCase=function(e,i){var r;return(void 0===i&&(i={}),!(r=e)||o.test(r)||s.test(r))?e:(e=e.toLowerCase(),(e=i.reactCompat?e.replace(a,c):e.replace(l,c)).replace(n,h))}},38671,(e,i,r)=>{"use strict";var s=(e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(e.r(74499)),n=e.r(20461);function o(e,i){var r={};return e&&"string"==typeof e&&(0,s.default)(e,function(e,s){e&&s&&(r[(0,n.camelCase)(e,i)]=s)}),r}o.default=o,i.exports=o},99834,(e,i,r)=>{"use strict";var s=Object.prototype.hasOwnProperty,n=Object.prototype.toString,o=Object.defineProperty,l=Object.getOwnPropertyDescriptor,a=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===n.call(e)},h=function(e){if(!e||"[object Object]"!==n.call(e))return!1;var i,r=s.call(e,"constructor"),o=e.constructor&&e.constructor.prototype&&s.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!r&&!o)return!1;for(i in e);return void 0===i||s.call(e,i)},c=function(e,i){o&&"__proto__"===i.name?o(e,i.name,{enumerable:!0,configurable:!0,value:i.newValue,writable:!0}):e[i.name]=i.newValue},u=function(e,i){if("__proto__"===i){if(!s.call(e,i))return;else if(l)return l(e,i).value}return e[i]};i.exports=function e(){var i,r,s,n,o,l,d=arguments[0],f=1,_=arguments.length,p=!1;for("boolean"==typeof d&&(p=d,d=arguments[1]||{},f=2),(null==d||"object"!=typeof d&&"function"!=typeof d)&&(d={});f<_;++f)if(i=arguments[f],null!=i)for(r in i)s=u(d,r),d!==(n=u(i,r))&&(p&&n&&(h(n)||(o=a(n)))?(o?(o=!1,l=s&&a(s)?s:[]):l=s&&h(s)?s:{},c(d,{name:r,newValue:e(p,l,n)})):void 0!==n&&c(d,{name:r,newValue:n}));return d}},36330,e=>{"use strict";let i,r,s,n,o,l,a,h,c,u,d,f;var _=e.i(85899),p=e.i(4232);function g({label:e,status:i,projectId:r,agentId:s,onStatusChange:n}){let o="running"===i?"bg-accent":"error"===i?"bg-error":"bg-text-muted",l=e=>{r&&s&&fetch(`/api/agents?project=${encodeURIComponent(r)}&agent=${encodeURIComponent(s)}&action=${e}`,{method:"POST"}).then(e=>e.json()).then(e=>{n&&e.state&&n(e.state)}).catch(()=>{})};return(0,_.jsxs)("div",{className:"flex items-center justify-between gap-2 px-3 h-7 shrink-0 border-b border-border",children:[(0,_.jsxs)("div",{className:"flex items-center gap-2",children:[i&&(0,_.jsx)("span",{className:`w-1.5 h-1.5 rounded-full ${o}`}),(0,_.jsx)("span",{className:"text-[11px] text-text-muted uppercase tracking-wider",children:e})]}),r&&s&&(0,_.jsxs)("div",{className:"flex items-center gap-1",children:["running"!==i&&(0,_.jsx)("button",{onClick:()=>l("start"),className:"text-[10px] text-text-muted hover:text-accent transition-colors px-1",title:"Start",children:"▶"}),"running"===i&&(0,_.jsx)("button",{onClick:()=>l("stop"),className:"text-[10px] text-text-muted hover:text-error transition-colors px-1",title:"Stop",children:"■"}),(0,_.jsx)("button",{onClick:()=>l("restart"),className:"text-[10px] text-text-muted hover:text-accent transition-colors px-1",title:"Restart",children:"↻"})]})]})}let m={head:"#00ff88",reviewer1:"#4488ff",reviewer2:"#cc44ff",dev:"#ffcc00",user:"#e0e0e0",system:"#737373"},v=["head","reviewer1","reviewer2","dev","user"];function S(e){return m[e.toLowerCase()]||"#e0e0e0"}function y({projectId:e}){let[i,r]=(0,p.useState)("loading"),[s,n]=(0,p.useState)(""),[o,l]=(0,p.useState)("");return((0,p.useEffect)(()=>{fetch("/api/config").then(e=>{if(!e.ok)throw Error("config fetch failed");return e.json()}).then(i=>{let r=e?i.projects?.find(i=>i.id===e):null;n(r?.agentchattr_url||i.agentchattr_url||"http://127.0.0.1:8300"),l(r?.agentchattr_token||i.agentchattr_token||"")}).catch(()=>n("http://127.0.0.1:8300"))},[e]),(0,p.useEffect)(()=>{if("loading"!==i)return;let e=setTimeout(()=>{r(e=>"loading"===e?"api":e)},3e3);return()=>clearTimeout(e)},[i]),s)?"loading"===i||"iframe"===i?(0,_.jsxs)("div",{className:"w-full h-full",children:[(0,_.jsx)("iframe",{ref:e=>{e&&(e.onload=()=>{try{let i=e.contentDocument||e.contentWindow?.document;i&&i.body&&i.body.innerHTML.length>0?r("iframe"):r("api")}catch{r("api")}},e.onerror=()=>r("api"))},src:o?`${s}?token=${encodeURIComponent(o)}`:s,className:"w-full h-full border-0",style:{display:"loading"===i?"none":"block"},sandbox:"allow-same-origin allow-scripts allow-forms allow-popups"}),"loading"===i&&(0,_.jsx)("div",{className:"w-full h-full flex items-center justify-center",children:(0,_.jsx)("span",{className:"text-xs text-text-muted",children:"Connecting to AgentChattr..."})})]}):(0,_.jsx)(b,{projectId:e}):null}function b({projectId:e}){let i="general",[r,s]=(0,p.useState)([]),[n,o]=(0,p.useState)(""),[l,a]=(0,p.useState)(!1),[h,c]=(0,p.useState)(""),[u,d]=(0,p.useState)(null),f=(0,p.useRef)(0),g=(0,p.useRef)(null),m=(0,p.useRef)(null),y=(0,p.useRef)(!0),x=(0,p.useRef)(0);(0,p.useEffect)(()=>{f.current=0,s([])},[e]);let w=(0,p.useCallback)(()=>{fetch(`/api/chat?path=/api/messages&channel=${encodeURIComponent(i)}&cursor=${f.current}${e?`&project=${encodeURIComponent(e)}`:""}`).then(e=>{if(403===e.status)throw x.current<3?d(null):d("Chat authentication failed (403). Set agentchattr_token in Settings or ~/.quadwork/config.json."),Error("auth failed");if(!e.ok)throw Error(`Poll failed: ${e.status}`);return e.json()}).then(e=>{d(null);let i=Array.isArray(e)?e:e.messages||[];if(i.length>0){s(e=>{let r=new Set(e.map(e=>e.id)),s=i.filter(e=>!r.has(e.id));return s.length>0?[...e,...s]:e});let e=Math.max(...i.map(e=>e.id));e>f.current&&(f.current=e)}}).catch(()=>{})},[i,e]);(0,p.useEffect)(()=>{w();let e=setInterval(w,3e3);return()=>clearInterval(e)},[w]),(0,p.useEffect)(()=>{y.current&&g.current&&(g.current.scrollTop=g.current.scrollHeight)},[r]);let[C,k]=(0,p.useState)(!1),[E,D]=(0,p.useState)(null),R=()=>{let r=n.trim();r&&!C&&(k(!0),D(null),fetch(`/api/chat${e?`?project=${encodeURIComponent(e)}`:""}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:r,channel:i,sender:"user"})}).then(e=>{if(!e.ok)throw Error(`Send failed: ${e.status}`);o(""),setTimeout(w,300)}).catch(e=>{D(e.message),console.error(e.message)}).finally(()=>k(!1)))},M=e=>{o(n.replace(/@\w*$/,`@${e} `)),a(!1),m.current?.focus()},P=v.filter(e=>e.toLowerCase().startsWith(h));return(0,_.jsxs)("div",{className:"flex flex-col h-full bg-bg",children:[u&&(0,_.jsx)("div",{className:"px-3 py-2 bg-red-900/30 border-b border-red-700/50 text-[11px] text-red-400",children:u}),(0,_.jsxs)("div",{ref:g,onScroll:()=>{if(!g.current)return;let{scrollTop:e,scrollHeight:i,clientHeight:r}=g.current;y.current=i-e-r<40},className:"flex-1 min-h-0 overflow-y-auto px-3 py-2 space-y-0.5",children:[0===r.length&&(0,_.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,_.jsx)("span",{className:"text-xs text-text-muted",children:"No messages"})}),r.map(e=>(0,_.jsxs)("div",{className:"flex gap-2 text-[12px] leading-5",children:[(0,_.jsx)("span",{className:"text-text-muted shrink-0 w-12 text-right tabular-nums",children:e.time?.slice(0,5)||""}),(0,_.jsx)("span",{className:"shrink-0 font-semibold w-10 text-right",style:{color:S(e.sender)},children:e.sender}),(0,_.jsx)("span",{className:"text-text break-words min-w-0 whitespace-pre-wrap",children:e.text})]},e.id))]}),(0,_.jsxs)("div",{className:"relative shrink-0 border-t border-border",children:[l&&P.length>0&&(0,_.jsx)("div",{className:"absolute bottom-full left-0 right-0 border border-border bg-bg-surface",children:P.map(e=>(0,_.jsxs)("button",{onClick:()=>M(e),className:"w-full text-left px-3 py-1 text-[12px] hover:bg-[#1a1a1a] transition-colors",style:{color:S(e)},children:["@",e]},e))}),E&&(0,_.jsx)("div",{className:"px-3 py-1 text-[11px] text-red-400 bg-red-900/20 border-b border-red-700/40",children:E}),(0,_.jsxs)("div",{className:"flex items-center gap-1 px-1",children:[(0,_.jsx)("input",{ref:m,type:"text",value:n,onChange:e=>{var i;let r;return o(i=e.target.value),void((r=i.match(/@(\w*)$/))?(a(!0),c(r[1].toLowerCase())):a(!1))},onKeyDown:e=>{if("Tab"===e.key&&l&&P.length>0){e.preventDefault(),M(P[0]);return}"Enter"!==e.key||e.shiftKey||(e.preventDefault(),R()),"Escape"===e.key&&a(!1)},placeholder:`Message #${i}...`,disabled:C,className:"flex-1 bg-transparent px-2 py-2 text-[12px] font-mono text-text placeholder:text-text-muted outline-none focus:ring-1 focus:ring-accent disabled:opacity-50"}),(0,_.jsx)("button",{onClick:R,disabled:C||!n.trim(),className:"shrink-0 px-2 py-1 text-[11px] font-mono text-accent border border-accent/40 rounded hover:bg-accent/10 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",title:"Send (Enter)",children:C?"…":"Send"})]})]})]})}function x({color:e}){return(0,_.jsx)("span",{className:`inline-block w-1.5 h-1.5 rounded-full shrink-0 ${e}`})}function w({projectId:e}){let[i,r]=(0,p.useState)([]),[s,n]=(0,p.useState)([]),o=(0,p.useCallback)(()=>{fetch(`/api/github/issues?project=${encodeURIComponent(e)}`).then(e=>{if(!e.ok)throw Error(`${e.status}`);return e.json()}).then(e=>{Array.isArray(e)&&r(e)}).catch(()=>{}),fetch(`/api/github/prs?project=${encodeURIComponent(e)}`).then(e=>{if(!e.ok)throw Error(`${e.status}`);return e.json()}).then(e=>{Array.isArray(e)&&n(e)}).catch(()=>{})},[e]);return(0,p.useEffect)(()=>{o();let e=setInterval(o,3e4);return()=>clearInterval(e)},[o]),(0,_.jsxs)("div",{className:"flex flex-col h-full overflow-y-auto",children:[(0,_.jsx)("div",{className:"px-3 py-1.5 border-b border-border",children:(0,_.jsxs)("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:["Issues (",i.length,")"]})}),0===i.length&&(0,_.jsx)("div",{className:"px-3 py-2 text-[11px] text-text-muted",children:"No issues"}),i.map(e=>(0,_.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 px-3 py-1 font-mono hover:bg-[#1a1a1a] transition-colors cursor-pointer border-b border-border/50",children:[(0,_.jsx)(x,{color:"OPEN"===e.state?"bg-accent":"bg-error"}),(0,_.jsxs)("span",{className:"text-[11px] text-text-muted w-8 shrink-0",children:["#",e.number]}),(0,_.jsx)("span",{className:"text-[11px] text-text truncate flex-1 min-w-0",children:e.title}),e.assignees?.[0]&&(0,_.jsx)("span",{className:"text-[10px] text-text-muted shrink-0",children:e.assignees[0].login})]},e.number)),(0,_.jsx)("div",{className:"px-3 py-1.5 border-b border-border mt-1",children:(0,_.jsxs)("span",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:["Pull Requests (",s.length,")"]})}),0===s.length&&(0,_.jsx)("div",{className:"px-3 py-2 text-[11px] text-text-muted",children:"No PRs"}),s.map(e=>{let i=e.reviews||[],r=e.reviewDecision||"REVIEW_REQUIRED",s={};for(let e of i){let i=(e.body||"").trim();/^(?:Reviewer2|T2b)\b/i.test(i)?s.reviewer2=e.state:(/^(?:Reviewer1|T2a)\b/i.test(i)||/^##\s*Verdict/i.test(i))&&(s.reviewer1=e.state)}return(0,_.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 px-3 py-1 font-mono hover:bg-[#1a1a1a] transition-colors cursor-pointer border-b border-border/50",children:[(0,_.jsx)(x,{color:"APPROVED"===r?"bg-accent":"CHANGES_REQUESTED"===r?"bg-error":"bg-[#ffcc00]"}),(0,_.jsxs)("span",{className:"text-[11px] text-text-muted w-8 shrink-0",children:["#",e.number]}),(0,_.jsx)("span",{className:"text-[11px] text-text truncate flex-1 min-w-0",children:e.title}),e.assignees?.[0]&&(0,_.jsx)("span",{className:"text-[10px] text-text-muted shrink-0",children:e.assignees[0].login}),["reviewer1","reviewer2"].map(e=>{let i=s[e];return(0,_.jsxs)("span",{className:`text-[10px] shrink-0 ${i?"APPROVED"===i?"text-accent":"CHANGES_REQUESTED"===i?"text-error":"text-[#ffcc00]":"text-text-muted"}`,children:[e,":",i?"APPROVED"===i?"ok":"CHANGES_REQUESTED"===i?"chg":"rev":"—"]},e)}),(0,_.jsx)("span",{className:`text-[10px] shrink-0 ${function(e){if(!e||0===e.length)return"text-text-muted";let i=e.map(e=>e.state);return i.every(e=>"SUCCESS"===e)?"text-accent":i.some(e=>"FAILURE"===e||"ERROR"===e)?"text-error":"text-[#ffcc00]"}(e.statusCheckRollup)}`,children:function(e){if(!e||0===e.length)return"—";let i=e.map(e=>e.state);return i.every(e=>"SUCCESS"===e)?"pass":i.some(e=>"FAILURE"===e||"ERROR"===e)?"fail":"run"}(e.statusCheckRollup)})]},e.number)})]})}function C({projectId:e}){let[i,r]=(0,p.useState)(null),[s,n]=(0,p.useState)(null),[o,l]=(0,p.useState)(!1),a=()=>{setTimeout(()=>n(null),3e3)};(0,p.useEffect)(()=>{if(!o)return;let e=setTimeout(()=>l(!1),4e3);return()=>clearTimeout(e)},[o]);let h=async()=>{if(!o)return void l(!0);l(!1),r("stop");try{let i=await fetch(`/api/agentchattr/${encodeURIComponent(e)}/stop`,{method:"POST"}),r=await i.json();n(r.ok?"Stopped":"Failed")}catch{n("Error")}r(null),a()},c=async()=>{r("restart");try{let i=await fetch(`/api/agentchattr/${encodeURIComponent(e)}/restart`,{method:"POST"}),r=await i.json();r.ok&&r.pid?n(`Restarted (PID: ${r.pid})`):n(r.error||"Failed to restart")}catch{n("Error")}r(null),a()},u=async()=>{r("reset");try{let i=await fetch(`/api/agents/${encodeURIComponent(e)}/reset`,{method:"POST"}),r=await i.json();n(r.ok?`Reset — ${r.cleared} of ${r.total} slot${1!==r.total?"s":""} deregistered`:"Failed")}catch{n("Error")}r(null),a()};return(0,_.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,_.jsx)("div",{className:"text-[10px] text-text-muted uppercase tracking-wider font-semibold",children:"Server"}),(0,_.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[(0,_.jsx)("button",{onClick:h,disabled:!!i,className:`px-1.5 py-0.5 text-[10px] border transition-colors disabled:opacity-50 ${o?"text-error border-error/60 bg-error/10 hover:bg-error/20":"text-text-muted border-border hover:text-error hover:border-error/40"}`,children:"stop"===i?"...":o?"Confirm Stop?":"Stop"}),(0,_.jsx)("button",{onClick:c,disabled:!!i,className:"px-1.5 py-0.5 text-[10px] text-text-muted border border-border hover:text-accent hover:border-accent/40 transition-colors disabled:opacity-50",children:"restart"===i?"...":"Restart"}),(0,_.jsx)("button",{onClick:u,disabled:!!i,className:"px-1.5 py-0.5 text-[10px] text-text-muted border border-border hover:text-accent hover:border-accent/40 transition-colors disabled:opacity-50",children:"reset"===i?"...":"Reset Agents"})]}),s&&(0,_.jsx)("div",{className:"text-[10px] text-accent",children:s})]})}let k=[{label:"2 hours",seconds:7200},{label:"4 hours",seconds:14400},{label:"8 hours",seconds:28800},{label:"Until stopped",seconds:0}];function E(){let e,i,[r,s]=(0,p.useState)(!1),[n,o]=(0,p.useState)(null),[l,a]=(0,p.useState)(""),[h,c]=(0,p.useState)(!1),u=(0,p.useCallback)(()=>{fetch("/api/caffeinate/status").then(e=>e.ok?e.json():null).then(e=>{e&&(s(e.active),o(e.remaining),a(e.platform))}).catch(()=>{})},[]);return((0,p.useEffect)(()=>{u();let e=setInterval(u,5e3);return()=>clearInterval(e)},[u]),l&&"darwin"!==l)?null:(0,_.jsxs)("div",{className:"flex flex-col gap-1 relative",children:[(0,_.jsx)("div",{className:"text-[10px] text-text-muted uppercase tracking-wider font-semibold",children:"System"}),(0,_.jsx)("div",{className:"flex items-center gap-1.5",children:(0,_.jsxs)("button",{onClick:()=>r?void fetch("/api/caffeinate/stop",{method:"POST"}).then(()=>{s(!1),o(null)}).catch(()=>{}):c(!h),className:`px-1.5 py-0.5 text-[10px] border transition-colors ${r?"border-accent/50 text-accent bg-accent/10 hover:bg-accent/20":"border-border text-text-muted hover:text-text hover:border-accent"}`,children:[r?"Awake":"Keep Awake",r&&null!==n&&n>0&&(0,_.jsx)("span",{className:"ml-1 text-accent/70",children:(e=Math.floor(n/3600),i=Math.floor(n%3600/60),e>0?`${e}h ${i}m`:`${i}m`)}),r&&null===n&&(0,_.jsx)("span",{className:"ml-1 text-accent/70",children:"on"})]})}),h&&!r&&(0,_.jsxs)("div",{className:"absolute bottom-full left-0 mb-1 border border-border bg-bg-surface z-20 min-w-[140px]",children:[(0,_.jsx)("p",{className:"px-2 py-1 text-[10px] text-[#ffcc00] border-b border-border",children:"Make sure Mac is plugged in"}),k.map(e=>(0,_.jsx)("button",{onClick:()=>{var i;fetch("/api/caffeinate/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({duration:i=e.seconds})}).then(e=>e.json()).then(e=>{e.ok&&(s(!0),o(i||null))}).catch(()=>{}),c(!1)},className:"w-full text-left px-2 py-1 text-[10px] text-text hover:bg-[#1a1a1a] transition-colors",children:e.label},e.label))]})]})}function D({projectId:e}){return(0,_.jsx)("div",{className:"border-t border-border px-3 py-2",children:(0,_.jsxs)("div",{className:"flex items-start gap-6",children:[(0,_.jsx)(C,{projectId:e}),(0,_.jsx)("div",{className:"w-px self-stretch bg-border"}),(0,_.jsx)(E,{})]})})}var R=e.i(24046),M=Object.defineProperty,P=Object.getOwnPropertyDescriptor,B=(e,i,r,s)=>{for(var n,o=s>1?void 0:s?P(i,r):i,l=e.length-1;l>=0;l--)(n=e[l])&&(o=(s?n(i,r,o):n(o))||o);return s&&o&&M(i,r,o),o},L=(e,i)=>(r,s)=>i(r,s,e),T="Terminal input",A="Too much output to announce, navigate to rows manually to read";function N(e,i,r,s){var n;n=e=e.replace(/\r?\n/g,"\r"),e=r.decPrivateModes.bracketedPasteMode&&!0!==s.rawOptions.ignoreBracketedPasteMode?"\x1b[200~"+n+"\x1b[201~":n,r.triggerDataEvent(e,!0),i.value=""}function O(e,i,r){let s=r.getBoundingClientRect(),n=e.clientX-s.left-10,o=e.clientY-s.top-10;i.style.width="20px",i.style.height="20px",i.style.left=`${n}px`,i.style.top=`${o}px`,i.style.zIndex="1000",i.focus()}function I(e,i,r,s,n){O(e,i,r),n&&s.rightClickSelect(e),i.value=s.selectionText,i.select()}function z(e){return e>65535?String.fromCharCode(((e-=65536)>>10)+55296)+String.fromCharCode(e%1024+56320):String.fromCharCode(e)}function H(e,i=0,r=e.length){let s="";for(let n=i;n<r;++n){let i=e[n];i>65535?(i-=65536,s+=String.fromCharCode((i>>10)+55296)+String.fromCharCode(i%1024+56320)):s+=String.fromCharCode(i)}return s}var F=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,i){let r=e.length;if(!r)return 0;let s=0,n=0;if(this._interim){let r=e.charCodeAt(n++);56320<=r&&r<=57343?i[s++]=(this._interim-55296)*1024+r-56320+65536:(i[s++]=this._interim,i[s++]=r),this._interim=0}for(let o=n;o<r;++o){let n=e.charCodeAt(o);if(55296<=n&&n<=56319){if(++o>=r)return this._interim=n,s;let l=e.charCodeAt(o);56320<=l&&l<=57343?i[s++]=(n-55296)*1024+l-56320+65536:(i[s++]=n,i[s++]=l);continue}65279!==n&&(i[s++]=n)}return s}},j=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,i){let r=e.length;if(!r)return 0;let s=0,n,o,l,a,h=0,c=0;if(this.interim[0]){let n=!1,o=this.interim[0];o&=(224&o)==192?31:(240&o)==224?15:7;let l=0,a;for(;(a=63&this.interim[++l])&&l<4;)o<<=6,o|=a;let h=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,u=h-l;for(;c<u;){if(c>=r)return 0;if((192&(a=e[c++]))!=128){c--,n=!0;break}this.interim[l++]=a,o<<=6,o|=63&a}n||(2===h?o<128?c--:i[s++]=o:3===h?o<2048||o>=55296&&o<=57343||65279===o||(i[s++]=o):o<65536||o>1114111||(i[s++]=o)),this.interim.fill(0)}let u=r-4,d=c;for(;d<r;){for(;d<u&&!(128&(n=e[d]))&&!(128&(o=e[d+1]))&&!(128&(l=e[d+2]))&&!(128&(a=e[d+3]));)i[s++]=n,i[s++]=o,i[s++]=l,i[s++]=a,d+=4;if((n=e[d++])<128)i[s++]=n;else if((224&n)==192){if(d>=r)return this.interim[0]=n,s;if((192&(o=e[d++]))!=128||(h=(31&n)<<6|63&o)<128){d--;continue}i[s++]=h}else if((240&n)==224){if(d>=r)return this.interim[0]=n,s;if((192&(o=e[d++]))!=128){d--;continue}if(d>=r)return this.interim[0]=n,this.interim[1]=o,s;if((192&(l=e[d++]))!=128){d--;continue}if((h=(15&n)<<12|(63&o)<<6|63&l)<2048||h>=55296&&h<=57343||65279===h)continue;i[s++]=h}else if((248&n)==240){if(d>=r)return this.interim[0]=n,s;if((192&(o=e[d++]))!=128){d--;continue}if(d>=r)return this.interim[0]=n,this.interim[1]=o,s;if((192&(l=e[d++]))!=128){d--;continue}if(d>=r)return this.interim[0]=n,this.interim[1]=o,this.interim[2]=l,s;if((192&(a=e[d++]))!=128){d--;continue}if((h=(7&n)<<18|(63&o)<<12|(63&l)<<6|63&a)<65536||h>1114111)continue;i[s++]=h}}return s}},W=class e{constructor(){this.fg=0,this.bg=0,this.extended=new $}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let i=new e;return i.fg=this.fg,i.bg=this.bg,i.extended=this.extended.clone(),i}isInverse(){return 0x4000000&this.fg}isBold(){return 0x8000000&this.fg}isUnderline(){return this.hasExtendedAttrs()&&0!==this.extended.underlineStyle?1:0x10000000&this.fg}isBlink(){return 0x20000000&this.fg}isInvisible(){return 0x40000000&this.fg}isItalic(){return 0x4000000&this.bg}isDim(){return 0x8000000&this.bg}isStrikethrough(){return 0x80000000&this.fg}isProtected(){return 0x20000000&this.bg}isOverline(){return 0x40000000&this.bg}getFgColorMode(){return 0x3000000&this.fg}getBgColorMode(){return 0x3000000&this.bg}isFgRGB(){return(0x3000000&this.fg)==0x3000000}isBgRGB(){return(0x3000000&this.bg)==0x3000000}isFgPalette(){return(0x3000000&this.fg)==0x1000000||(0x3000000&this.fg)==0x2000000}isBgPalette(){return(0x3000000&this.bg)==0x1000000||(0x3000000&this.bg)==0x2000000}isFgDefault(){return(0x3000000&this.fg)==0}isBgDefault(){return(0x3000000&this.bg)==0}isAttributeDefault(){return 0===this.fg&&0===this.bg}getFgColor(){switch(0x3000000&this.fg){case 0x1000000:case 0x2000000:return 255&this.fg;case 0x3000000:return 0xffffff&this.fg;default:return -1}}getBgColor(){switch(0x3000000&this.bg){case 0x1000000:case 0x2000000:return 255&this.bg;case 0x3000000:return 0xffffff&this.bg;default:return -1}}hasExtendedAttrs(){return 0x10000000&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-0x10000001:this.bg|=0x10000000}getUnderlineColor(){if(0x10000000&this.bg&&~this.extended.underlineColor)switch(0x3000000&this.extended.underlineColor){case 0x1000000:case 0x2000000:return 255&this.extended.underlineColor;case 0x3000000:return 0xffffff&this.extended.underlineColor}return this.getFgColor()}getUnderlineColorMode(){return 0x10000000&this.bg&&~this.extended.underlineColor?0x3000000&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0x3000000:this.isFgRGB()}isUnderlineColorPalette(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0x1000000||(0x3000000&this.extended.underlineColor)==0x2000000:this.isFgPalette()}isUnderlineColorDefault(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 0x10000000&this.fg?0x10000000&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},$=class e{constructor(e=0,i=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=i}get ext(){return this._urlId?-0x1c000001&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(0x1c000000&this._ext)>>26}set underlineStyle(e){this._ext&=-0x1c000001,this._ext|=e<<26&0x1c000000}get underlineColor(){return 0x3ffffff&this._ext}set underlineColor(e){this._ext&=-0x4000000,this._ext|=0x3ffffff&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(0xe0000000&this._ext)>>29;return e<0?0xfffffff8^e:e}set underlineVariantOffset(e){this._ext&=0x1fffffff,this._ext|=e<<29&0xe0000000}clone(){return new e(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}},U=class e extends W{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new $,this.combinedData=""}static fromCharData(i){let r=new e;return r.setFromCharData(i),r}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?z(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[0],this.bg=0;let i=!1;if(e[1].length>2)i=!0;else if(2===e[1].length){let r=e[1].charCodeAt(0);if(55296<=r&&r<=56319){let s=e[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(r-55296)*1024+s-56320+65536|e[2]<<22:i=!0}else i=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;i&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},K="di$target",q="di$dependencies",V=new Map;function Y(e){if(V.has(e))return V.get(e);let i=function(e,r,s){var n,o,l;if(3!=arguments.length)throw Error("@IServiceName-decorator can only be used to decorate a parameter");n=i,o=e,l=s,o[K]===o?o[q].push({id:n,index:l}):(o[q]=[{id:n,index:l}],o[K]=o)};return i._id=e,V.set(e,i),i}var X=Y("BufferService"),G=Y("CoreMouseService"),J=Y("CoreService"),Z=Y("CharsetService"),Q=Y("InstantiationService"),ee=Y("LogService"),et=Y("OptionsService"),ei=Y("OscLinkService"),er=Y("UnicodeService"),es=Y("DecorationService"),en=class{constructor(e,i,r){this._bufferService=e,this._optionsService=i,this._oscLinkService=r}provideLinks(e,i){let r=this._bufferService.buffer.lines.get(e-1);if(!r)return void i(void 0);let s=[],n=this._optionsService.rawOptions.linkHandler,o=new U,l=r.getTrimmedLength(),a=-1,h=-1,c=!1;for(let i=0;i<l;i++)if(!(-1===h&&!r.hasContent(i))){if(r.loadCell(i,o),o.hasExtendedAttrs()&&o.extended.urlId)if(-1===h){h=i,a=o.extended.urlId;continue}else c=o.extended.urlId!==a;else -1!==h&&(c=!0);if(c||-1!==h&&i===l-1){let r=this._oscLinkService.getLinkData(a)?.uri;if(r){let o={start:{x:h+1,y:e},end:{x:i+ +(!c&&i===l-1),y:e}},a=!1;if(!n?.allowNonHttpProtocols)try{let e=new URL(r);["http:","https:"].includes(e.protocol)||(a=!0)}catch{a=!0}a||s.push({text:r,range:o,activate:(e,i)=>n?n.activate(e,i,o):function(e){if(confirm(`Do you want to navigate to ${e}?
2
-
3
- WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}(i),hover:(e,i)=>n?.hover?.(e,i,o),leave:(e,i)=>n?.leave?.(e,i,o)})}c=!1,o.hasExtendedAttrs()&&o.extended.urlId?(h=i,a=o.extended.urlId):(h=-1,a=-1)}}i(s)}};en=B([L(0,X),L(1,et),L(2,ei)],en);var eo=Y("CharSizeService"),el=Y("CoreBrowserService"),ea=Y("MouseService"),eh=Y("RenderService"),ec=Y("SelectionService"),eu=Y("CharacterJoinerService"),ed=Y("ThemeService"),ef=Y("LinkProviderService"),e_=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?ev.isErrorNoTelemetry(e)?new ev(e.message+`
4
-
5
- `+e.stack):Error(e.message+`
6
-
7
- `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(i=>{i(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function ep(e){var i;(i=e)instanceof em||i instanceof Error&&i.name===eg&&i.message===eg||e_.onUnexpectedError(e)}var eg="Canceled",em=class extends Error{constructor(){super(eg),this.name=this.message}},ev=class e extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(i){if(i instanceof e)return i;let r=new e;return r.message=i.message,r.stack=i.stack,r}static isErrorNoTelemetry(e){return"CodeExpectedError"===e.name}},eS=class e extends Error{constructor(i){super(i||"An unexpected bug occurred."),Object.setPrototypeOf(this,e.prototype)}};function ey(e,i=0){return e[e.length-(1+i)]}(eI=ez||={}).isLessThan=function(e){return e<0},eI.isLessThanOrEqual=function(e){return e<=0},eI.isGreaterThan=function(e){return e>0},eI.isNeitherLessOrGreaterThan=function(e){return 0===e},eI.greaterThan=1,eI.lessThan=-1,eI.neitherLessOrGreaterThan=0;var eb=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(i=>(e(i),!0))}toArray(){let e=[];return this.iterate(i=>(e.push(i),!0)),e}filter(i){return new e(e=>this.iterate(r=>!i(r)||e(r)))}map(i){return new e(e=>this.iterate(r=>e(i(r))))}some(e){let i=!1;return this.iterate(r=>!(i=e(r))),i}findFirst(e){let i;return this.iterate(r=>!e(r)||(i=r,!1)),i}findLast(e){let i;return this.iterate(r=>(e(r)&&(i=r),!0)),i}findLastMaxBy(e){let i,r=!0;return this.iterate(s=>((r||ez.isGreaterThan(e(s,i)))&&(r=!1,i=s),!0)),i}};eb.empty=new eb(e=>{});function ex(e){}function ew(e,i){}function eC(e){if(eH.is(e)){let i=[];for(let r of e)if(r)try{r.dispose()}catch(e){i.push(e)}if(1===i.length)throw i[0];if(i.length>1)throw AggregateError(i,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function ek(e){let i={dispose:function(e,i){let r=this,s=!1,n;return function(){if(s)return n;if(s=!0,i)try{n=e.apply(r,arguments)}finally{i()}else n=e.apply(r,arguments);return n}}(()=>{ex(i),e()})};return i}(e=>{function i(e){return e&&"object"==typeof e&&"function"==typeof e[Symbol.iterator]}e.is=i;let r=Object.freeze([]);function*s(e){yield e}e.empty=function(){return r},e.single=s,e.wrap=function(e){return i(e)?e:s(e)},e.from=function(e){return e||r},e.reverse=function*(e){for(let i=e.length-1;i>=0;i--)yield e[i]},e.isEmpty=function(e){return!e||!0===e[Symbol.iterator]().next().done},e.first=function(e){return e[Symbol.iterator]().next().value},e.some=function(e,i){let r=0;for(let s of e)if(i(s,r++))return!0;return!1},e.find=function(e,i){for(let r of e)if(i(r))return r},e.filter=function*(e,i){for(let r of e)i(r)&&(yield r)},e.map=function*(e,i){let r=0;for(let s of e)yield i(s,r++)},e.flatMap=function*(e,i){let r=0;for(let s of e)yield*i(s,r++)},e.concat=function*(...e){for(let i of e)yield*i},e.reduce=function(e,i,r){let s=r;for(let r of e)s=i(s,r);return s},e.slice=function*(e,i,r=e.length){for(i<0&&(i+=e.length),r<0?r+=e.length:r>e.length&&(r=e.length);i<r;i++)yield e[i]},e.consume=function(i,r=1/0){let s=[];if(0===r)return[s,i];let n=i[Symbol.iterator]();for(let i=0;i<r;i++){let i=n.next();if(i.done)return[s,e.empty()];s.push(i.value)}return[s,{[Symbol.iterator]:()=>n}]},e.asyncToArray=async function(e){let i=[];for await(let r of e)i.push(r);return Promise.resolve(i)}})(eH||={});var eE=class e{constructor(){var e;this._toDispose=new Set,this._isDisposed=!1,e=this}dispose(){this._isDisposed||(ex(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(0!==this._toDispose.size)try{eC(this._toDispose)}finally{this._toDispose.clear()}}add(i){if(!i)return i;if(i===this)throw Error("Cannot register a disposable on itself!");return ew(i,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(i),i}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),ew(e,null))}};eE.DISABLE_DISPOSED_WARNING=!1;var eD=eE,eR=class{constructor(){var e;this._store=new eD,e=this,ew(this._store,this)}dispose(){ex(this),this._store.dispose()}_register(e){if(e===this)throw Error("Cannot register a disposable on itself!");return this._store.add(e)}};eR.None=Object.freeze({dispose(){}});var eM=class{constructor(){var e;this._isDisposed=!1,e=this}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&ew(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,ex(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&ew(e,null),e}},eP="object"==typeof window?window:globalThis,eB=class e{constructor(i){this.element=i,this.next=e.Undefined,this.prev=e.Undefined}};eB.Undefined=new eB(void 0);var eL=class{constructor(){this._first=eB.Undefined,this._last=eB.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===eB.Undefined}clear(){let e=this._first;for(;e!==eB.Undefined;){let i=e.next;e.prev=eB.Undefined,e.next=eB.Undefined,e=i}this._first=eB.Undefined,this._last=eB.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,i){let r=new eB(e);if(this._first===eB.Undefined)this._first=r,this._last=r;else if(i){let e=this._last;this._last=r,r.prev=e,e.next=r}else{let e=this._first;this._first=r,r.next=e,e.prev=r}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(r))}}shift(){if(this._first!==eB.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==eB.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==eB.Undefined&&e.next!==eB.Undefined){let i=e.prev;i.next=e.next,e.next.prev=i}else e.prev===eB.Undefined&&e.next===eB.Undefined?(this._first=eB.Undefined,this._last=eB.Undefined):e.next===eB.Undefined?(this._last=this._last.prev,this._last.next=eB.Undefined):e.prev===eB.Undefined&&(this._first=this._first.next,this._first.prev=eB.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==eB.Undefined;)yield e.element,e=e.next}},eT=globalThis.performance&&"function"==typeof globalThis.performance.now,eA=class e{static create(i){return new e(i)}constructor(e){this._now=eT&&!1===e?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 -1!==this._stopTime?this._stopTime-this._startTime:this._now()-this._startTime}};(e=>{function i(e){}function r(e){return(i,r=null,s)=>{let n=!1,o;return o=e(e=>{if(!n)return o?o.dispose():n=!0,i.call(r,e)},null,s),n&&o.dispose(),o}}function s(e,i,r){return o((r,s=null,n)=>e(e=>r.call(s,i(e)),null,n),r)}function n(e,i,r){return o((r,s=null,n)=>e(e=>i(e)&&r.call(s,e),null,n),r)}function o(e,r){let s,n={onWillAddFirstListener(){s=e(o.fire,o)},onDidRemoveLastListener(){s?.dispose()}};r||i(n);let o=new eV(n);return r?.add(o),o.event}function l(e,r,s=100,n=!1,o=!1,a,h){let c,u,d,f=0,_,p={leakWarningThreshold:a,onWillAddFirstListener(){c=e(e=>{f++,u=r(u,e),n&&!d&&(g.fire(u),u=void 0),_=()=>{let e=u;u=void 0,d=void 0,(!n||f>1)&&g.fire(e),f=0},"number"==typeof s?(clearTimeout(d),d=setTimeout(_,s)):void 0===d&&(d=0,queueMicrotask(_))})},onWillRemoveListener(){o&&f>0&&_?.()},onDidRemoveLastListener(){_=void 0,c.dispose()}};h||i(p);let g=new eV(p);return h?.add(g),g.event}e.None=()=>eR.None,e.defer=function(e,i){return l(e,()=>{},0,void 0,!0,void 0,i)},e.once=r,e.map=s,e.forEach=function(e,i,r){return o((r,s=null,n)=>e(e=>{i(e),r.call(s,e)},null,n),r)},e.filter=n,e.signal=function(e){return e},e.any=function(...e){return(i,r=null,s)=>{var n,o;return n=function(...e){let i=ek(()=>eC(e));return i}(...e.map(e=>e(e=>i.call(r,e)))),(o=s)instanceof Array?o.push(n):o&&o.add(n),n}},e.reduce=function(e,i,r,n){let o=r;return s(e,e=>o=i(o,e),n)},e.debounce=l,e.accumulate=function(i,r=0,s){return e.debounce(i,(e,i)=>e?(e.push(i),e):[i],r,void 0,!0,void 0,s)},e.latch=function(e,i=(e,i)=>e===i,r){let s=!0,o;return n(e,e=>{let r=s||!i(e,o);return s=!1,o=e,r},r)},e.split=function(i,r,s){return[e.filter(i,r,s),e.filter(i,e=>!r(e),s)]},e.buffer=function(e,i=!1,r=[],s){let n=r.slice(),o=e(e=>{n?n.push(e):a.fire(e)});s&&s.add(o);let l=()=>{n?.forEach(e=>a.fire(e)),n=null},a=new eV({onWillAddFirstListener(){o||(o=e(e=>a.fire(e)),s&&s.add(o))},onDidAddFirstListener(){n&&(i?setTimeout(l):l())},onDidRemoveLastListener(){o&&o.dispose(),o=null}});return s&&s.add(a),a.event},e.chain=function(e,i){return(r,s,n)=>{let o=i(new h);return e(function(e){let i=o.evaluate(e);i!==a&&r.call(s,i)},void 0,n)}};let a=Symbol("HaltChainable");class h{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(i=>(e(i),i)),this}filter(e){return this.steps.push(i=>e(i)?i:a),this}reduce(e,i){let r=i;return this.steps.push(i=>r=e(r,i)),this}latch(e=(e,i)=>e===i){let i=!0,r;return this.steps.push(s=>{let n=i||!e(s,r);return i=!1,r=s,n?s:a}),this}evaluate(e){for(let i of this.steps)if((e=i(e))===a)break;return e}}e.fromNodeEventEmitter=function(e,i,r=e=>e){let s=(...e)=>n.fire(r(...e)),n=new eV({onWillAddFirstListener:()=>e.on(i,s),onDidRemoveLastListener:()=>e.removeListener(i,s)});return n.event},e.fromDOMEventEmitter=function(e,i,r=e=>e){let s=(...e)=>n.fire(r(...e)),n=new eV({onWillAddFirstListener:()=>e.addEventListener(i,s),onDidRemoveLastListener:()=>e.removeEventListener(i,s)});return n.event},e.toPromise=function(e){return new Promise(i=>r(e)(i))},e.fromPromise=function(e){let i=new eV;return e.then(e=>{i.fire(e)},()=>{i.fire(void 0)}).finally(()=>{i.dispose()}),i.event},e.forward=function(e,i){return e(e=>i.fire(e))},e.runAndSubscribe=function(e,i,r){return i(r),e(e=>i(e))};class c{constructor(e,r){this._observable=e,this._counter=0,this._hasChanged=!1;let s={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};r||i(s),this.emitter=new eV(s),r&&r.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,i){this._hasChanged=!0}endUpdate(e){this._counter--,0===this._counter&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}e.fromObservable=function(e,i){return new c(e,i).emitter.event},e.fromObservableLight=function(e){return(i,r,s)=>{let n=0,o=!1,l={beginUpdate(){n++},endUpdate(){0==--n&&(e.reportChanges(),o&&(o=!1,i.call(r)))},handlePossibleChange(){},handleChange(){o=!0}};e.addObserver(l),e.reportChanges();let a={dispose(){e.removeObserver(l)}};return s instanceof eD?s.add(a):Array.isArray(s)&&s.push(a),a}}})(eF||={});var eN=class e{constructor(i){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${i}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new eA,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}}};eN.all=new Set,eN._idPool=0;var eO=class e{constructor(i,r,s=(e._idPool++).toString(16).padStart(3,"0")){this._errorHandler=i,this.threshold=r,this.name=s,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,i){let r=this.threshold;if(r<=0||i<r)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=.5*r;let[e,s]=this.getMostFrequentStack(),n=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${s}):`;console.warn(n),console.warn(e);let o=new e$(n,e);this._errorHandler(o)}return()=>{let i=this._stacks.get(e.value)||0;this._stacks.set(e.value,i-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[r,s]of this._stacks)(!e||i<s)&&(e=[r,s],i=s);return e}};eO._idPool=1;var eI,ez,eH,eF,ej,eW=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??"")}print(){console.warn(this.value.split(`
8
- `).slice(2).join(`
9
- `))}},e$=class extends Error{constructor(e,i){super(e),this.name="ListenerLeakError",this.stack=i}},eU=class extends Error{constructor(e,i){super(e),this.name="ListenerRefusalError",this.stack=i}},eK=0,eq=class{constructor(e){this.value=e,this.id=eK++}},eV=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new eO(e?.onListenerError??ep,this._options?.leakWarningThreshold??-1):void 0,this._perfMon=this._options?._profName?new eN(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,i,r)=>{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 i=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],r=new eU(`${e}. HINT: Stack shows most frequent listener (${i[1]}-times)`,i[0]);return(this._options?.onListenerError||ep)(r),eR.None}if(this._disposed)return eR.None;i&&(e=e.bind(i));let s=new eq(e),n;this._leakageMon&&this._size>=Math.ceil(.2*this._leakageMon.threshold)&&(s.stack=eW.create(),n=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof eq?(this._deliveryQueue??=new eY,this._listeners=[this._listeners,s]):this._listeners.push(s):(this._options?.onWillAddFirstListener?.(this),this._listeners=s,this._options?.onDidAddFirstListener?.(this)),this._size++;let o=ek(()=>{ej?.unregister(o),n?.(),this._removeListener(s)});if(r instanceof eD?r.add(o):Array.isArray(r)&&r.push(o),ej){let e=Error().stack.split(`
10
- `).slice(2,3).join(`
11
- `).trim(),i=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);ej.register(o,i?.[2]??e,o)}return o},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(1===this._size){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let i=this._listeners,r=i.indexOf(e);if(-1===r)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--,i[r]=void 0;let s=this._deliveryQueue.current===this;if(2*this._size<=i.length){let e=0;for(let r=0;r<i.length;r++)i[r]?i[e++]=i[r]:s&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);i.length=e}}_deliver(e,i){if(!e)return;let r=this._options?.onListenerError||ep;try{e.value(i)}catch(e){r(e)}}_deliverQueue(e){let i=e.current._listeners;for(;e.i<e.end;)this._deliver(i[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof eq)this._deliver(this._listeners,e);else{let i=this._deliveryQueue;i.enqueue(this,e,this._listeners.length),this._deliverQueue(i)}this._perfMon?.stop()}hasListeners(){return this._size>0}},eY=class{constructor(){this.i=-1,this.end=0}enqueue(e,i,r){this.i=0,this.end=r,this.current=e,this.value=i}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},eX=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new eV,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new eV,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,i){if(this.getZoomLevel(i)===e)return;let r=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(r,e),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),e)}setFullscreen(e,i){if(this.isFullscreen(i)===e)return;let r=this.getWindowId(i);this.mapWindowIdToFullScreen.set(r,e),this._onDidChangeFullscreen.fire(r)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};eX.INSTANCE=new eX,eX.INSTANCE.onDidChangeZoomLevel,eX.INSTANCE.onDidChangeFullscreen;var eG="object"==typeof navigator?navigator.userAgent:"",eJ=eG.indexOf("Firefox")>=0,eZ=eG.indexOf("AppleWebKit")>=0,eQ=eG.indexOf("Chrome")>=0,e0=!eQ&&eG.indexOf("Safari")>=0;eG.indexOf("Electron/"),eG.indexOf("Android");var e1=!1;if("function"==typeof eP.matchMedia){let e=eP.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),i=eP.matchMedia("(display-mode: fullscreen)");e1=e.matches,e2=e,"string"==typeof e2&&(e2=eP.matchMedia(e2)),e2.addEventListener("change",({matches:e})=>{e1&&i.matches||(e1=e)})}var e2,e5,e3,e4=!1,e6=!1,e9=!1,e8=!1,e7=!1,te="en",tt=globalThis;"u">typeof tt.vscode&&"u">typeof tt.vscode.process?e3=tt.vscode.process:"u">typeof R.default&&"string"==typeof R.default?.versions?.node&&(e3=R.default);var ti="string"==typeof e3?.versions?.electron&&e3?.type==="renderer";if("object"==typeof e3){e4="win32"===e3.platform,e6="darwin"===e3.platform,(e9="linux"===e3.platform)&&e3.env.SNAP&&e3.env.SNAP_REVISION,e3.env.CI||e3.env.BUILD_ARTIFACTSTAGINGDIRECTORY,te="en";let e=e3.env.VSCODE_NLS_CONFIG;if(e)try{let i=JSON.parse(e);i.userLocale,i.osLocale,te=i.resolvedLanguage||"en",i.languagePack?.translationsConfigFile}catch{}e8=!0}else"object"!=typeof navigator||ti?console.error("Unable to resolve platform."):(e4=(e5=navigator.userAgent).indexOf("Windows")>=0,e6=e5.indexOf("Macintosh")>=0,(e5.indexOf("Macintosh")>=0||e5.indexOf("iPad")>=0||e5.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,e9=e5.indexOf("Linux")>=0,e5?.indexOf("Mobi"),e7=!0,te=globalThis._VSCODE_NLS_LANGUAGE||"en",navigator.language.toLowerCase());var tr=e4,ts=e6,tn=e9,to=e8;e7&&"function"==typeof tt.importScripts&&tt.origin;var tl,ta=e5,th=te;(tS=tl||={}).value=function(){return th},tS.isDefaultVariant=function(){return 2===th.length?"en"===th:th.length>=3&&"e"===th[0]&&"n"===th[1]&&"-"===th[2]},tS.isDefault=function(){return"en"===th};var tc="function"==typeof tt.postMessage&&!tt.importScripts,tu=(()=>{if(tc){let e=[];tt.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let r=0,s=e.length;r<s;r++){let s=e[r];if(s.id===i.data.vscodeScheduleAsyncWork){e.splice(r,1),s.callback();return}}});let i=0;return r=>{let s=++i;e.push({id:s,callback:r}),tt.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})(),td=!!(ta&&ta.indexOf("Chrome")>=0);ta&&ta.indexOf("Firefox"),!td&&ta&&ta.indexOf("Safari"),ta&&ta.indexOf("Edg/"),ta&&ta.indexOf("Android");var tf="object"==typeof navigator?navigator:{};to||document.queryCommandSupported&&document.queryCommandSupported("copy")||tf&&tf.clipboard&&tf.clipboard.writeText,to||tf&&tf.clipboard&&tf.clipboard.readText,to||e1||tf.keyboard,"ontouchstart"in eP||tf.maxTouchPoints,eP.PointerEvent&&("ontouchstart"in eP||navigator.maxTouchPoints);var t_=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,i){this._keyCodeToStr[e]=i,this._strToKeyCode[i.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},tp=new t_,tg=new t_,tm=new t_,tv=Array(230);(ty=tb||={}).toString=function(e){return tp.keyCodeToStr(e)},ty.fromString=function(e){return tp.strToKeyCode(e)},ty.toUserSettingsUS=function(e){return tg.keyCodeToStr(e)},ty.toUserSettingsGeneral=function(e){return tm.keyCodeToStr(e)},ty.fromUserSettings=function(e){return tg.strToKeyCode(e)||tm.strToKeyCode(e)},ty.toElectronAccelerator=function(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 tp.keyCodeToStr(e)};var tS,ty,tb,tx,tw=class e{constructor(e,i,r,s,n){this.ctrlKey=e,this.shiftKey=i,this.altKey=r,this.metaKey=s,this.keyCode=n}equals(i){return i instanceof e&&this.ctrlKey===i.ctrlKey&&this.shiftKey===i.shiftKey&&this.altKey===i.altKey&&this.metaKey===i.metaKey&&this.keyCode===i.keyCode}getHashCode(){let e=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",r=this.altKey?"1":"0",s=this.metaKey?"1":"0";return`K${e}${i}${r}${s}${this.keyCode}`}isModifierKey(){return 0===this.keyCode||5===this.keyCode||57===this.keyCode||6===this.keyCode||4===this.keyCode}toKeybinding(){return new tC([this])}isDuplicateModifierCase(){return this.ctrlKey&&5===this.keyCode||this.shiftKey&&4===this.keyCode||this.altKey&&6===this.keyCode||this.metaKey&&57===this.keyCode}},tC=class{constructor(e){if(0===e.length)throw function(e){return e?Error(`Illegal argument: ${e}`):Error("Illegal argument")}("chords");this.chords=e}getHashCode(){let e="";for(let i=0,r=this.chords.length;i<r;i++)0!==i&&(e+=";"),e+=this.chords[i].getHashCode();return e}equals(e){if(null===e||this.chords.length!==e.chords.length)return!1;for(let i=0;i<this.chords.length;i++)if(!this.chords[i].equals(e.chords[i]))return!1;return!0}},tk=ts?256:2048,tE=ts?2048:256,tD=class{constructor(e){this._standardKeyboardEventBrand=!0,this.browserEvent=e,this.target=e.target,this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey,this.altGraphKey=e.getModifierState?.("AltGraph"),this.keyCode=function(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return tb.fromString(i)}let i=e.keyCode;if(3===i)return 7;if(eJ)switch(i){case 59:return 85;case 60:if(tn)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(ts)return 57}else if(eZ&&(ts&&93===i||!ts&&92===i))return 57;return tv[i]||0}(e),this.code=e.code,this.ctrlKey=this.ctrlKey||5===this.keyCode,this.altKey=this.altKey||6===this.keyCode,this.shiftKey=this.shiftKey||4===this.keyCode,this.metaKey=this.metaKey||57===this.keyCode,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;5!==this.keyCode&&4!==this.keyCode&&6!==this.keyCode&&57!==this.keyCode&&(e=this.keyCode);let i=0;return this.ctrlKey&&(i|=tk),this.altKey&&(i|=512),this.shiftKey&&(i|=1024),this.metaKey&&(i|=tE),i|=e}_computeKeyCodeChord(){let e=0;return 5!==this.keyCode&&4!==this.keyCode&&6!==this.keyCode&&57!==this.keyCode&&(e=this.keyCode),new tw(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},tR=new WeakMap,tM=class{static getSameOriginWindowChain(e){let i=tR.get(e);if(!i){i=[],tR.set(e,i);let r=e,s;do(s=function(e){if(!e.parent||e.parent===e)return null;try{let i=e.location,r=e.parent.location;if("null"!==i.origin&&"null"!==r.origin&&i.origin!==r.origin)return null}catch{return null}return e.parent}(r))?i.push({window:new WeakRef(r),iframeElement:r.frameElement||null}):i.push({window:new WeakRef(r),iframeElement:null}),r=s;while(r)}return i.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,i){if(!i||e===i)return{top:0,left:0};let r=0,s=0;for(let n of this.getSameOriginWindowChain(e)){let e=n.window.deref();if(r+=e?.scrollY??0,s+=e?.scrollX??0,e===i||!n.iframeElement)break;let o=n.iframeElement.getBoundingClientRect();r+=o.top,s+=o.left}return{top:r,left:s}}},tP=class{constructor(e,i){this.timestamp=Date.now(),this.browserEvent=i,this.leftButton=0===i.button,this.middleButton=1===i.button,this.rightButton=2===i.button,this.buttons=i.buttons,this.target=i.target,this.detail=i.detail||1,"dblclick"===i.type&&(this.detail=2),this.ctrlKey=i.ctrlKey,this.shiftKey=i.shiftKey,this.altKey=i.altKey,this.metaKey=i.metaKey,"number"==typeof i.pageX?(this.posx=i.pageX,this.posy=i.pageY):(this.posx=i.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=i.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let r=tM.getPositionOfChildWindowRelativeToAncestorWindow(e,i.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},tB=class{constructor(e,i=0,r=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=i;let s=!1;if(eQ){let e=navigator.userAgent.match(/Chrome\/(\d+)/);s=(e?parseInt(e[1]):123)<=122}if(e){let i=e.view?.devicePixelRatio||1;"u">typeof e.wheelDeltaY?s?this.deltaY=e.wheelDeltaY/(120*i):this.deltaY=e.wheelDeltaY/120:"u">typeof e.VERTICAL_AXIS&&e.axis===e.VERTICAL_AXIS?this.deltaY=-e.detail/3:"wheel"===e.type&&(e.deltaMode===e.DOM_DELTA_LINE?eJ&&!ts?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40),"u">typeof e.wheelDeltaX?e0&&tr?this.deltaX=-(e.wheelDeltaX/120):s?this.deltaX=e.wheelDeltaX/(120*i):this.deltaX=e.wheelDeltaX/120:"u">typeof e.HORIZONTAL_AXIS&&e.axis===e.HORIZONTAL_AXIS?this.deltaX=-e.detail/3:"wheel"===e.type&&(e.deltaMode===e.DOM_DELTA_LINE?eJ&&!ts?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40),0===this.deltaY&&0===this.deltaX&&e.wheelDelta&&(s?this.deltaY=e.wheelDelta/(120*i):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},tL=Object.freeze(function(e,i){let r=setTimeout(e.bind(i),0);return{dispose(){clearTimeout(r)}}});(iC=tx||={}).isCancellationToken=function(e){return e===iC.None||e===iC.Cancelled||e instanceof tT||!!e&&"object"==typeof e&&"boolean"==typeof e.isCancellationRequested&&"function"==typeof e.onCancellationRequested},iC.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:eF.None}),iC.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:tL});var tT=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?tL:(this._emitter||(this._emitter=new eV),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};Symbol("MicrotaskDelay");var tA=class{constructor(e,i){this._isDisposed=!1,this._token=-1,"function"==typeof e&&"number"==typeof i&&this.setIfNotSet(e,i)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){-1!==this._token&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,i){if(this._isDisposed)throw new eS("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},i)}setIfNotSet(e,i){if(this._isDisposed)throw new eS("Calling 'setIfNotSet' on a disposed TimeoutTimer");-1===this._token&&(this._token=setTimeout(()=>{this._token=-1,e()},i))}},tN=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,i,r=globalThis){if(this.isDisposed)throw new eS("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let s=r.setInterval(()=>{e()},i);this.disposable=ek(()=>{r.clearInterval(s),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(ik=iE||={}).settled=async function(e){let i,r=await Promise.all(e.map(e=>e.then(e=>e,e=>{i||(i=e)})));if("u">typeof i)throw i;return r},ik.withAsyncBody=function(e){return new Promise(async(i,r)=>{try{await e(i,r)}catch(e){r(e)}})};var tO=class e{static fromArray(i){return new e(e=>{e.emitMany(i)})}static fromPromise(i){return new e(async e=>{e.emitMany(await i)})}static fromPromises(i){return new e(async e=>{await Promise.all(i.map(async i=>e.emitOne(await i)))})}static merge(i){return new e(async e=>{await Promise.all(i.map(async i=>{for await(let r of i)e.emitOne(r)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new eV,queueMicrotask(async()=>{let i={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(i)),this.resolve()}catch(e){this.reject(e)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{for(;;){if(2===this._state)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(1===this._state)return{done:!0,value:void 0};await eF.toPromise(this._onStateChanged.event)}},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(i,r){return new e(async e=>{for await(let s of i)e.emitOne(r(s))})}map(i){return e.map(this,i)}static filter(i,r){return new e(async e=>{for await(let s of i)r(s)&&e.emitOne(s)})}filter(i){return e.filter(this,i)}static coalesce(i){return e.filter(i,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let i=[];for await(let r of e)i.push(r);return i}toPromise(){return e.toPromise(this)}emitOne(e){0===this._state&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){0===this._state&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){0===this._state&&(this._state=1,this._onStateChanged.fire())}reject(e){0===this._state&&(this._state=2,this._error=e,this._onStateChanged.fire())}};tO.EMPTY=tO.fromArray([]);function tI(e,i){return(i<<5)-i+e|0}function tz(e,i){i=tI(149417,i);for(let r=0,s=e.length;r<s;r++)i=tI(e.charCodeAt(r),i);return i}new DataView(new ArrayBuffer(320));var{registerWindow:tH,getWindow:tF,getDocument:tj,getWindows:tW,getWindowsCount:t$,getWindowId:tU,getWindowById:tK,hasWindow:tq,onDidRegisterWindow:tV,onWillUnregisterWindow:tY,onDidUnregisterWindow:tX}=(i=new Map,r={window:eP,disposables:new eD},i.set(eP.vscodeWindowId,r),s=new eV,n=new eV,o=new eV,{onDidRegisterWindow:s.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:n.event,registerWindow(e){if(i.has(e.vscodeWindowId))return eR.None;let r=new eD,l={window:e,disposables:r.add(new eD)};return i.set(e.vscodeWindowId,l),r.add(ek(()=>{i.delete(e.vscodeWindowId),n.fire(e)})),r.add(tJ(e,t2.BEFORE_UNLOAD,()=>{o.fire(e)})),s.fire(l),r},getWindows:()=>i.values(),getWindowsCount:()=>i.size,getWindowId:e=>e.vscodeWindowId,hasWindow:e=>i.has(e),getWindowById:function(e,s){return("number"==typeof e?i.get(e):void 0)??(s?r:void 0)},getWindow:e=>e?.ownerDocument?.defaultView?e.ownerDocument.defaultView.window:e?.view?e.view.window:eP,getDocument:e=>tF(e).document}),tG=class{constructor(e,i,r,s){this._node=e,this._type=i,this._handler=r,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function tJ(e,i,r,s){return new tG(e,i,r,s)}var tZ=function(e,i,r,s){var n;let o=r;return"click"===i||"mousedown"===i||"contextmenu"===i?(n=tF(e),o=function(e){return r(new tP(n,e))}):("keydown"===i||"keypress"===i||"keyup"===i)&&(o=function(e){return r(new tD(e))}),tJ(e,i,o,s)},tQ=class extends tN{constructor(e){super(),this.defaultTarget=e&&tF(e)}cancelAndSet(e,i,r){return super.cancelAndSet(e,i,r??this.defaultTarget)}},t0=class{constructor(e,i=0){this._runner=e,this.priority=i,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){ep(e)}}static sort(e,i){return i.priority-e.priority}};l=new Map,a=new Map,h=new Map,c=new Map,iD=(e,i,r=0)=>{let s=tU(e),n=new t0(i,r),o=l.get(s);return o||(o=[],l.set(s,o)),o.push(n),h.get(s)||(h.set(s,!0),e.requestAnimationFrame(()=>(e=>{h.set(e,!1);let i=l.get(e)??[];for(a.set(e,i),l.set(e,[]),c.set(e,!0);i.length>0;)i.sort(t0.sort),i.shift().execute();c.set(e,!1)})(s))),n};var t1=class e{constructor(e,i){this.width=e,this.height=i}with(i=this.width,r=this.height){return i!==this.width||r!==this.height?new e(i,r):this}static is(e){return"object"==typeof e&&"number"==typeof e.height&&"number"==typeof e.width}static lift(i){return i instanceof e?i:new e(i.width,i.height)}static equals(e,i){return e===i||!!e&&!!i&&e.width===i.width&&e.height===i.height}};t1.None=new t1(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,i,r){let s=this.mutationObservers.get(e);s||(s=new Map,this.mutationObservers.set(e,s));let n=function e(i,r){switch(typeof i){case"object":var s,n,o,l;return null===i?tI(349,r):Array.isArray(i)?(s=i,n=tI(104579,n=r),s.reduce((i,r)=>e(r,i),n)):(o=i,l=tI(181387,l=r),Object.keys(o).sort().reduce((i,r)=>(i=tz(r,i),e(o[r],i)),l));case"string":return tz(i,r);case"boolean":return tI(i?433:863,r);case"number":return tI(i,r);case"undefined":return tI(937,r);default:return tI(617,r)}}(r,0),o=s.get(n);if(o)o.users+=1;else{let l=new eV,a=new MutationObserver(e=>l.fire(e));a.observe(e,r);let h=o={users:1,observer:a,onDidMutate:l.event};i.add(ek(()=>{h.users-=1,0===h.users&&(l.dispose(),a.disconnect(),s?.delete(n),s?.size===0&&this.mutationObservers.delete(e))})),s.set(n,o)}return o.onDidMutate}};var t2={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},t5=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 i=t3(e);this._maxWidth!==i&&(this._maxWidth=i,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let i=t3(e);this._width!==i&&(this._width=i,this.domNode.style.width=this._width)}setHeight(e){let i=t3(e);this._height!==i&&(this._height=i,this.domNode.style.height=this._height)}setTop(e){let i=t3(e);this._top!==i&&(this._top=i,this.domNode.style.top=this._top)}setLeft(e){let i=t3(e);this._left!==i&&(this._left=i,this.domNode.style.left=this._left)}setBottom(e){let i=t3(e);this._bottom!==i&&(this._bottom=i,this.domNode.style.bottom=this._bottom)}setRight(e){let i=t3(e);this._right!==i&&(this._right=i,this.domNode.style.right=this._right)}setPaddingTop(e){let i=t3(e);this._paddingTop!==i&&(this._paddingTop=i,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let i=t3(e);this._paddingLeft!==i&&(this._paddingLeft=i,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let i=t3(e);this._paddingBottom!==i&&(this._paddingBottom=i,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let i=t3(e);this._paddingRight!==i&&(this._paddingRight=i,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 i=t3(e);this._fontSize!==i&&(this._fontSize=i,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 i=t3(e);this._lineHeight!==i&&(this._lineHeight=i,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let i=t3(e);this._letterSpacing!==i&&(this._letterSpacing=i,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,i){this.domNode.classList.toggle(e,i),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,i){this.domNode.setAttribute(e,i)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function t3(e){return"number"==typeof e?`${e}px`:e}function t4(e){return new t5(e)}var t6=class{constructor(){this._hooks=new eD,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,i){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(i)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,i,r,s,n){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=s,this._onStopCallback=n;let o=e;try{e.setPointerCapture(i),this._hooks.add(ek(()=>{try{e.releasePointerCapture(i)}catch{}}))}catch{o=tF(e)}this._hooks.add(tJ(o,t2.POINTER_MOVE,e=>{e.buttons!==r?this.stopMonitoring(!0):(e.preventDefault(),this._pointerMoveCallback(e))})),this._hooks.add(tJ(o,t2.POINTER_UP,e=>this.stopMonitoring(!0)))}};(u=iR||={}).Tap="-xterm-gesturetap",u.Change="-xterm-gesturechange",u.Start="-xterm-gesturestart",u.End="-xterm-gesturesend",u.Contextmenu="-xterm-gesturecontextmenu";var t9=class e extends eR{constructor(){super(),this.dispatched=!1,this.targets=new eL,this.ignoreTargets=new eL,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(eF.runAndSubscribe(tV,({window:e,disposables:i})=>{i.add(tJ(e.document,"touchstart",e=>this.onTouchStart(e),{passive:!1})),i.add(tJ(e.document,"touchend",i=>this.onTouchEnd(e,i))),i.add(tJ(e.document,"touchmove",e=>this.onTouchMove(e),{passive:!1}))},{window:eP,disposables:this._store}))}static addTarget(i){return e.isTouchDevice()?(e.INSTANCE||(e.INSTANCE=new e),ek(e.INSTANCE.targets.push(i))):eR.None}static ignoreTarget(i){return e.isTouchDevice()?(e.INSTANCE||(e.INSTANCE=new e),ek(e.INSTANCE.ignoreTargets.push(i))):eR.None}static isTouchDevice(){return"ontouchstart"in eP||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,s=e.targetTouches.length;r<s;r++){let s=e.targetTouches.item(r);this.activeTouches[s.identifier]={id:s.identifier,initialTarget:s.target,initialTimeStamp:i,initialPageX:s.pageX,initialPageY:s.pageY,rollingTimestamps:[i],rollingPageX:[s.pageX],rollingPageY:[s.pageY]};let n=this.newGestureEvent(iR.Start,s.target);n.pageX=s.pageX,n.pageY=s.pageY,this.dispatchEvent(n)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}onTouchEnd(i,r){let s=Date.now(),n=Object.keys(this.activeTouches).length;for(let o=0,l=r.changedTouches.length;o<l;o++){let l=r.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("move of an UNKNOWN touch",l);continue}let a=this.activeTouches[l.identifier],h=Date.now()-a.initialTimeStamp;if(h<e.HOLD_DELAY&&30>Math.abs(a.initialPageX-ey(a.rollingPageX))&&30>Math.abs(a.initialPageY-ey(a.rollingPageY))){let e=this.newGestureEvent(iR.Tap,a.initialTarget);e.pageX=ey(a.rollingPageX),e.pageY=ey(a.rollingPageY),this.dispatchEvent(e)}else if(h>=e.HOLD_DELAY&&30>Math.abs(a.initialPageX-ey(a.rollingPageX))&&30>Math.abs(a.initialPageY-ey(a.rollingPageY))){let e=this.newGestureEvent(iR.Contextmenu,a.initialTarget);e.pageX=ey(a.rollingPageX),e.pageY=ey(a.rollingPageY),this.dispatchEvent(e)}else if(1===n){let e=ey(a.rollingPageX),r=ey(a.rollingPageY),n=ey(a.rollingTimestamps)-a.rollingTimestamps[0],o=e-a.rollingPageX[0],l=r-a.rollingPageY[0],h=[...this.targets].filter(e=>a.initialTarget instanceof Node&&e.contains(a.initialTarget));this.inertia(i,h,s,Math.abs(o)/n,o>0?1:-1,e,Math.abs(l)/n,l>0?1:-1,r)}this.dispatchEvent(this.newGestureEvent(iR.End,a.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(r.preventDefault(),r.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,i){let r=document.createEvent("CustomEvent");return r.initEvent(e,!1,!0),r.initialTarget=i,r.tapCount=0,r}dispatchEvent(i){if(i.type===iR.Tap){let r=new Date().getTime(),s=0;s=r-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=r,i.tapCount=s}else(i.type===iR.Change||i.type===iR.Contextmenu)&&(this._lastSetTapCountTime=0);if(i.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(i.initialTarget))return;let e=[];for(let r of this.targets)if(r.contains(i.initialTarget)){let s=0,n=i.initialTarget;for(;n&&n!==r;)s++,n=n.parentElement;e.push([s,r])}for(let[r,s]of(e.sort((e,i)=>e[0]-i[0]),e))s.dispatchEvent(i),this.dispatched=!0}}inertia(i,r,s,n,o,l,a,h,c){this.handle=iD(i,()=>{let u=Date.now(),d=u-s,f=0,_=0,p=!0;n+=e.SCROLL_FRICTION*d,a+=e.SCROLL_FRICTION*d,n>0&&(p=!1,f=o*n*d),a>0&&(p=!1,_=h*a*d);let g=this.newGestureEvent(iR.Change);g.translationX=f,g.translationY=_,r.forEach(e=>e.dispatchEvent(g)),p||this.inertia(i,r,u,n,o,l+f,a,h,c+_)})}onTouchMove(e){let i=Date.now();for(let r=0,s=e.changedTouches.length;r<s;r++){let s=e.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(s.identifier))){console.warn("end of an UNKNOWN touch",s);continue}let n=this.activeTouches[s.identifier],o=this.newGestureEvent(iR.Change,n.initialTarget);o.translationX=s.pageX-ey(n.rollingPageX),o.translationY=s.pageY-ey(n.rollingPageY),o.pageX=s.pageX,o.pageY=s.pageY,this.dispatchEvent(o),n.rollingPageX.length>3&&(n.rollingPageX.shift(),n.rollingPageY.shift(),n.rollingTimestamps.shift()),n.rollingPageX.push(s.pageX),n.rollingPageY.push(s.pageY),n.rollingTimestamps.push(i)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};t9.SCROLL_FRICTION=-.005,t9.HOLD_DELAY=700,t9.CLEAR_TAP_COUNT_TIME=400,B([function(e,i,r){let s=null,n=null;if("function"==typeof r.value?(s="value",0!==(n=r.value).length&&console.warn("Memoize should only be used in functions with zero parameters")):"function"==typeof r.get&&(s="get",n=r.get),!n)throw Error("not supported");let o=`$memoize$${i}`;r[s]=function(...e){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:n.apply(this,e)}),this[o]}}],t9,"isTouchDevice",1);var t8=class extends eR{onclick(e,i){this._register(tJ(e,t2.CLICK,r=>i(new tP(tF(e),r))))}onmousedown(e,i){this._register(tJ(e,t2.MOUSE_DOWN,r=>i(new tP(tF(e),r))))}onmouseover(e,i){this._register(tJ(e,t2.MOUSE_OVER,r=>i(new tP(tF(e),r))))}onmouseleave(e,i){this._register(tJ(e,t2.MOUSE_LEAVE,r=>i(new tP(tF(e),r))))}onkeydown(e,i){this._register(tJ(e,t2.KEY_DOWN,e=>i(new tD(e))))}onkeyup(e,i){this._register(tJ(e,t2.KEY_UP,e=>i(new tD(e))))}oninput(e,i){this._register(tJ(e,t2.INPUT,i))}onblur(e,i){this._register(tJ(e,t2.BLUR,i))}onfocus(e,i){this._register(tJ(e,t2.FOCUS,i))}onchange(e,i){this._register(tJ(e,t2.CHANGE,i))}ignoreGesture(e){return t9.ignoreTarget(e)}},t7=class extends t8{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","u">typeof e.top&&(this.bgDomNode.style.top="0px"),"u">typeof e.left&&(this.bgDomNode.style.left="0px"),"u">typeof e.bottom&&(this.bgDomNode.style.bottom="0px"),"u">typeof e.right&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width="11px",this.domNode.style.height="11px","u">typeof e.top&&(this.domNode.style.top=e.top+"px"),"u">typeof e.left&&(this.domNode.style.left=e.left+"px"),"u">typeof e.bottom&&(this.domNode.style.bottom=e.bottom+"px"),"u">typeof e.right&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new t6),this._register(tZ(this.bgDomNode,t2.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(tZ(this.domNode,t2.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new tQ),this._pointerdownScheduleRepeatTimer=this._register(new tA)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let i=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,tF(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(i,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},ie=class e{constructor(e,i,r,s,n,o,l){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i|=0,r|=0,s|=0,n|=0,o|=0,l|=0),this.rawScrollLeft=s,this.rawScrollTop=l,i<0&&(i=0),s+i>r&&(s=r-i),s<0&&(s=0),n<0&&(n=0),l+n>o&&(l=o-n),l<0&&(l=0),this.width=i,this.scrollWidth=r,this.scrollLeft=s,this.height=n,this.scrollHeight=o,this.scrollTop=l}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(i,r){return new e(this._forceIntegerValues,"u">typeof i.width?i.width:this.width,"u">typeof i.scrollWidth?i.scrollWidth:this.scrollWidth,r?this.rawScrollLeft:this.scrollLeft,"u">typeof i.height?i.height:this.height,"u">typeof i.scrollHeight?i.scrollHeight:this.scrollHeight,r?this.rawScrollTop:this.scrollTop)}withScrollPosition(i){return new e(this._forceIntegerValues,this.width,this.scrollWidth,"u">typeof i.scrollLeft?i.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,"u">typeof i.scrollTop?i.scrollTop:this.rawScrollTop)}createScrollEvent(e,i){let r=this.width!==e.width,s=this.scrollWidth!==e.scrollWidth,n=this.scrollLeft!==e.scrollLeft,o=this.height!==e.height,l=this.scrollHeight!==e.scrollHeight,a=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:i,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:s,scrollLeftChanged:n,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:a}}},it=class extends eR{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new eV),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new ie(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,i){let r=this._state.withScrollDimensions(e,i);this._setState(r,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let i=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(i,!1)}setScrollPositionSmooth(e,i){if(0===this._smoothScrollDuration)return this.setScrollPositionNow(e);if(this._smoothScrolling){let r;e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let s=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===s.scrollLeft&&this._smoothScrolling.to.scrollTop===s.scrollTop)return;r=i?new is(this._smoothScrolling.from,s,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,s,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let i=this._state.withScrollPosition(e);this._smoothScrolling=is.start(this._state,i,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),i=this._state.withScrollPosition(e);if(this._setState(i,!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,i){let r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,i)))}},ii=class{constructor(e,i,r){this.scrollLeft=e,this.scrollTop=i,this.isDone=r}};function ir(e,i){let r=i-e;return function(i){return e+r*(1-Math.pow(1-i,3))}}var is=class e{constructor(e,i,r,s){this.from=e,this.to=i,this.duration=s,this.startTime=r,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,i,r){if(Math.abs(e-i)>2.5*r){var s,n;let o,l;return e<i?(o=e+.75*r,l=i-.75*r):(o=e-.75*r,l=i+.75*r),s=ir(e,o),n=ir(l,i),function(e){return e<.33?s(e/.33):n((e-.33)/(1-.33))}}return ir(e,i)}dispose(){null!==this.animationFrameDisposable&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let i=(e-this.startTime)/this.duration;return i<1?new ii(this.scrollLeft(i),this.scrollTop(i),!1):new ii(this.to.scrollLeft,this.to.scrollTop,!0)}combine(i,r,s){return e.start(i,r,s)}static start(i,r,s){return s+=10,new e(i,r,Date.now()-10,s)}},io=class extends eR{constructor(e,i,r){super(),this._visibility=e,this._visibleClassName=i,this._invisibleClassName=r,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new tA)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return 2!==this._visibility&&(3===this._visibility||this._rawShouldBeVisible)}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){this._isNeeded?this._shouldBeVisible?this._reveal():this._hide(!0):this._hide(!1)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},il=class extends t8{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 io(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new t6),this._shouldRender=!0,this.domNode=t4(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(tJ(this.domNode.domNode,t2.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let i=this._register(new t7(e));this.domNode.domNode.appendChild(i.bgDomNode),this.domNode.domNode.appendChild(i.domNode)}_createSlider(e,i,r,s){this.slider=t4(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(i),"number"==typeof r&&this.slider.setWidth(r),"number"==typeof s&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(tJ(this.slider.domNode,t2.POINTER_DOWN,e=>{0===e.button&&(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 i=this.domNode.domNode.getClientRects()[0].top,r=i+this._scrollbarState.getSliderPosition(),s=i+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),n=this._sliderPointerPosition(e);r<=n&&n<=s?0===e.button&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let i,r;if(e.target===this.domNode.domNode&&"number"==typeof e.offsetX&&"number"==typeof e.offsetY)i=e.offsetX,r=e.offsetY;else{var s;let n,o,l=(n=(s=this.domNode.domNode).getBoundingClientRect(),o=tF(s),{left:n.left+o.scrollX,top:n.top+o.scrollY,width:n.width,height:n.height});i=e.pageX-l.left,r=e.pageY-l.top}let n=this._pointerDownRelativePosition(i,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(n):this._scrollbarState.getDesiredScrollPositionFromOffset(n)),0===e.button&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let i=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),s=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let n=Math.abs(this._sliderOrthogonalPointerPosition(e)-r);if(tr&&n>140)return void this._setDesiredScrollPositionNow(s.getScrollPosition());let o=this._sliderPointerPosition(e)-i;this._setDesiredScrollPositionNow(s.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let i={};this.writeScrollPosition(i,e),this._scrollable.setScrollPositionNow(i)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},ia=class e{constructor(e,i,r,s,n,o){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(e),this._visibleSize=s,this._scrollSize=n,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let i=Math.round(e);return this._visibleSize!==i&&(this._visibleSize=i,this._refreshComputedValues(),!0)}setScrollSize(e){let i=Math.round(e);return this._scrollSize!==i&&(this._scrollSize=i,this._refreshComputedValues(),!0)}setScrollPosition(e){let i=Math.round(e);return this._scrollPosition!==i&&(this._scrollPosition=i,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,i,r,s,n){let o=Math.max(0,r-e),l=Math.max(0,o-2*i),a=s>0&&s>r;if(!a)return{computedAvailableSize:Math.round(o),computedIsNeeded:a,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let h=Math.round(Math.max(20,Math.floor(r*l/s))),c=(l-h)/(s-r);return{computedAvailableSize:Math.round(o),computedIsNeeded:a,computedSliderSize:Math.round(h),computedSliderRatio:c,computedSliderPosition:Math.round(n*c)}}_refreshComputedValues(){let i=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=i.computedAvailableSize,this._computedIsNeeded=i.computedIsNeeded,this._computedSliderSize=i.computedSliderSize,this._computedSliderRatio=i.computedSliderRatio,this._computedSliderPosition=i.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){return this._computedIsNeeded?Math.round((e-this._arrowSize-this._computedSliderSize/2)/this._computedSliderRatio):0}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let i=e-this._arrowSize,r=this._scrollPosition;return i<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(e){return this._computedIsNeeded?Math.round((this._computedSliderPosition+e)/this._computedSliderRatio):0}},ih=class extends il{constructor(e,i,r){let s=e.getScrollDimensions(),n=e.getCurrentScrollPosition();if(super({lazyRender:i.lazyRender,host:r,scrollbarState:new ia(i.horizontalHasArrows?i.arrowSize:0,2===i.horizontal?0:i.horizontalScrollbarSize,2===i.vertical?0:i.verticalScrollbarSize,s.width,s.scrollWidth,n.scrollLeft),visibility:i.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:i.scrollByPage}),i.horizontalHasArrows)throw Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((i.horizontalScrollbarSize-i.horizontalSliderSize)/2),0,void 0,i.horizontalSliderSize)}_updateSlider(e,i){this.slider.setWidth(e),this.slider.setLeft(i)}_renderDomNode(e,i){this.domNode.setWidth(e),this.domNode.setHeight(i),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,i){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,i){e.scrollLeft=i}updateOptions(e){this.updateScrollbarSize(2===e.horizontal?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(2===e.vertical?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},ic=class extends il{constructor(e,i,r){let s=e.getScrollDimensions(),n=e.getCurrentScrollPosition();if(super({lazyRender:i.lazyRender,host:r,scrollbarState:new ia(i.verticalHasArrows?i.arrowSize:0,2===i.vertical?0:i.verticalScrollbarSize,0,s.height,s.scrollHeight,n.scrollTop),visibility:i.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:i.scrollByPage}),i.verticalHasArrows)throw Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((i.verticalScrollbarSize-i.verticalSliderSize)/2),i.verticalSliderSize,void 0)}_updateSlider(e,i){this.slider.setHeight(e),this.slider.setTop(i)}_renderDomNode(e,i){this.domNode.setWidth(i),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,i){return i}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,i){e.scrollTop=i}updateOptions(e){this.updateScrollbarSize(2===e.vertical?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},iu=class{constructor(e,i,r){this.timestamp=e,this.deltaX=i,this.deltaY=r,this.score=0}},id=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(-1===this._front&&-1===this._rear)return!1;let e=1,i=0,r=1,s=this._rear;for(;;){let n=s===this._front?e:Math.pow(2,-r);if(e-=n,i+=this._memory[s].score*n,s===this._front)break;s=(this._capacity+s-1)%this._capacity,r++}return i<=.5}acceptStandardWheelEvent(e){if(eQ){var i;let r=(i=tF(e.browserEvent),eX.INSTANCE.getZoomFactor(i));this.accept(Date.now(),e.deltaX*r,e.deltaY*r)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,i,r){let s=null,n=new iu(e,i,r);-1===this._front&&-1===this._rear?(this._memory[0]=n,this._front=0,this._rear=0):(s=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=n),n.score=this._computeScore(n,s)}_computeScore(e,i){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let r=.5;if(this._isAlmostInt(e.deltaX)&&this._isAlmostInt(e.deltaY)||(r+=.25),i){let s=Math.abs(e.deltaX),n=Math.abs(e.deltaY),o=Math.abs(i.deltaX),l=Math.abs(i.deltaY),a=Math.max(Math.min(s,o),1),h=Math.max(Math.min(n,l),1),c=Math.max(n,l);Math.max(s,o)%a==0&&c%h==0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(e){return .01>Math.abs(Math.round(e)-e)}};id.INSTANCE=new id;var i_=class extends t8{constructor(e,i,r){super(),this._onScroll=this._register(new eV),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new eV),this.onWillScroll=this._onWillScroll.event,this._options=function(e){let i={lazyRender:"u">typeof e.lazyRender&&e.lazyRender,className:"u">typeof e.className?e.className:"",useShadows:!("u">typeof e.useShadows)||e.useShadows,handleMouseWheel:!("u">typeof e.handleMouseWheel)||e.handleMouseWheel,flipAxes:"u">typeof e.flipAxes&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:"u">typeof e.consumeMouseWheelIfScrollbarIsNeeded&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:"u">typeof e.alwaysConsumeMouseWheel&&e.alwaysConsumeMouseWheel,scrollYToX:"u">typeof e.scrollYToX&&e.scrollYToX,mouseWheelScrollSensitivity:"u">typeof e.mouseWheelScrollSensitivity?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:"u">typeof e.fastScrollSensitivity?e.fastScrollSensitivity:5,scrollPredominantAxis:!("u">typeof e.scrollPredominantAxis)||e.scrollPredominantAxis,mouseWheelSmoothScroll:!("u">typeof e.mouseWheelSmoothScroll)||e.mouseWheelSmoothScroll,arrowSize:"u">typeof e.arrowSize?e.arrowSize:11,listenOnDomNode:"u">typeof e.listenOnDomNode?e.listenOnDomNode:null,horizontal:"u">typeof e.horizontal?e.horizontal:1,horizontalScrollbarSize:"u">typeof e.horizontalScrollbarSize?e.horizontalScrollbarSize:10,horizontalSliderSize:"u">typeof e.horizontalSliderSize?e.horizontalSliderSize:0,horizontalHasArrows:"u">typeof e.horizontalHasArrows&&e.horizontalHasArrows,vertical:"u">typeof e.vertical?e.vertical:1,verticalScrollbarSize:"u">typeof e.verticalScrollbarSize?e.verticalScrollbarSize:10,verticalHasArrows:"u">typeof e.verticalHasArrows&&e.verticalHasArrows,verticalSliderSize:"u">typeof e.verticalSliderSize?e.verticalSliderSize:0,scrollByPage:"u">typeof e.scrollByPage&&e.scrollByPage};return i.horizontalSliderSize="u">typeof e.horizontalSliderSize?e.horizontalSliderSize:i.horizontalScrollbarSize,i.verticalSliderSize="u">typeof e.verticalSliderSize?e.verticalSliderSize:i.verticalScrollbarSize,ts&&(i.className+=" mac"),i}(i),this._scrollable=r,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let s={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new ic(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new ih(this._scrollable,this._options,s)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=t4(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=t4(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=t4(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 tA),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=eC(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,ts&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){"u">typeof e.handleMouseWheel&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),"u">typeof e.mouseWheelScrollSensitivity&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),"u">typeof e.fastScrollSensitivity&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),"u">typeof e.scrollPredominantAxis&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),"u">typeof e.horizontal&&(this._options.horizontal=e.horizontal),"u">typeof e.vertical&&(this._options.vertical=e.vertical),"u">typeof e.horizontalScrollbarSize&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),"u">typeof e.verticalScrollbarSize&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),"u">typeof e.scrollByPage&&(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 tB(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=eC(this._mouseWheelToDispose),e)){let e=e=>{this._onMouseWheel(new tB(e))};this._mouseWheelToDispose.push(tJ(this._listenOnDomNode,t2.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let i=id.INSTANCE;i.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let s=e.deltaY*this._options.mouseWheelScrollSensitivity,n=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&n+s===0?n=s=0:Math.abs(s)>=Math.abs(n)?n=0:s=0),this._options.flipAxes&&([s,n]=[n,s]);let o=!ts&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||o)&&!n&&(n=s,s=0),e.browserEvent&&e.browserEvent.altKey&&(n*=this._options.fastScrollSensitivity,s*=this._options.fastScrollSensitivity);let l=this._scrollable.getFutureScrollPosition(),a={};if(s){let e=50*s,i=l.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(a,i)}if(n){let e=50*n,i=l.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(a,i)}a=this._scrollable.validateScrollPosition(a),(l.scrollLeft!==a.scrollLeft||l.scrollTop!==a.scrollTop)&&(this._options.mouseWheelSmoothScroll&&i.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(a):this._scrollable.setScrollPositionNow(a),r=!0)}let s=r;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(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(),i=e.scrollTop>0,r=e.scrollLeft>0,s=r?" left":"",n=i?" top":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${n}`),this._topLeftShadowDomNode.setClassName(`shadow${r||i?" top-left-corner":""}${n}${s}`)}}_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(),500)}},ip=class extends i_{constructor(e,i,r){super(e,i,r)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}},ig=class extends eR{constructor(e,i,r,s,n,o,l,a){super(),this._bufferService=r,this._optionsService=l,this._renderService=a,this._onRequestScrollLines=this._register(new eV),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let h=this._register(new it({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>iD(s.window,e)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{h.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new ip(i,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},h)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(n.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(16&e)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(eF.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(ek(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),i.appendChild(this._styleElement),this._register(ek(()=>this._styleElement.remove())),this._register(eF.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
12
- `)})),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 i=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:i.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,i){i&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!i,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){void 0!==e&&(this._latestYDisp=e),void 0===this._queuedAnimationFrame&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let i=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=i-this._bufferService.buffer.ydisp;0!==r&&(this._latestYDisp=i,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};ig=B([L(2,X),L(3,el),L(4,G),L(5,ed),L(6,et),L(7,eh)],ig);var im=class extends eR{constructor(e,i,r,s,n){super(),this._screenElement=e,this._bufferService=i,this._coreBrowserService=r,this._decorationService=s,this._renderService=n,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(ek(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){void 0===this._animationFrame&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_refreshStyle(e){let i=e.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${i*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,i=e.element){if(!i)return;let r=e.options.x??0;"right"===(e.options.anchor||"left")?i.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":i.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};im=B([L(1,X),L(2,el),L(3,es),L(4,eh)],im);var iv=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let i of this._zones)if(i.color===e.options.overviewRulerOptions.color&&i.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(i,e.marker.line))return;if(this._lineAdjacentToZone(i,e.marker.line,e.options.overviewRulerOptions.position))return void this._addLineToZone(i,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,i){return i>=e.startBufferLine&&i<=e.endBufferLine}_lineAdjacentToZone(e,i,r){return i>=e.startBufferLine-this._linePadding[r||"full"]&&i<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,i){e.startBufferLine=Math.min(e.startBufferLine,i),e.endBufferLine=Math.max(e.endBufferLine,i)}},iS={full:0,left:0,center:0,right:0},iy={full:0,left:0,center:0,right:0},ib={full:0,left:0,center:0,right:0},ix=class extends eR{constructor(e,i,r,s,n,o,l,a){super(),this._viewportElement=e,this._screenElement=i,this._bufferService=r,this._decorationService=s,this._renderService=n,this._optionsService=o,this._themeService=l,this._coreBrowserService=a,this._colorZoneStore=new iv,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(ek(()=>this._canvas?.remove()));let h=this._canvas.getContext("2d");if(h)this._ctx=h;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),i=Math.ceil((this._canvas.width-1)/3);iy.full=this._canvas.width,iy.left=e,iy.center=i,iy.right=e,this._refreshDrawHeightConstants(),ib.full=1,ib.left=1,ib.center=1+iy.left,ib.right=1+iy.left+iy.center}_refreshDrawHeightConstants(){iS.full=Math.round(2*this._coreBrowserService.dpr);let e=Math.round(Math.max(Math.min(this._canvas.height/this._bufferService.buffer.lines.length,12),6)*this._coreBrowserService.dpr);iS.left=e,iS.center=e,iS.right=e}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*iS.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*iS.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*iS.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*iS.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(){for(let e of(this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear(),this._decorationService.decorations))this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let i of e)"full"!==i.position&&this._renderColorZone(i);for(let i of e)"full"===i.position&&this._renderColorZone(i);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(ib[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-iS[e.position||"full"]/2),iy[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+iS[e.position||"full"]))}_queueRefresh(e,i){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=i||this._shouldUpdateAnchor,void 0===this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};ix=B([L(2,X),L(3,es),L(4,eh),L(5,et),L(6,ed),L(7,el)],ix),(d=iM||={}).NUL="\0",d.SOH="\x01",d.STX="\x02",d.ETX="\x03",d.EOT="\x04",d.ENQ="\x05",d.ACK="\x06",d.BEL="\x07",d.BS="\b",d.HT=" ",d.LF=`
13
- `,d.VT="\v",d.FF="\f",d.CR="\r",d.SO="\x0e",d.SI="\x0f",d.DLE="\x10",d.DC1="\x11",d.DC2="\x12",d.DC3="\x13",d.DC4="\x14",d.NAK="\x15",d.SYN="\x16",d.ETB="\x17",d.CAN="\x18",d.EM="\x19",d.SUB="\x1a",d.ESC="\x1b",d.FS="\x1c",d.GS="\x1d",d.RS="\x1e",d.US="\x1f",d.SP=" ",d.DEL="",(f=iP||={}).PAD="€",f.HOP="",f.BPH="‚",f.NBH="ƒ",f.IND="„",f.NEL="…",f.SSA="†",f.ESA="‡",f.HTS="ˆ",f.HTJ="‰",f.VTS="Š",f.PLD="‹",f.PLU="Œ",f.RI="",f.SS2="Ž",f.SS3="",f.DCS="",f.PU1="‘",f.PU2="’",f.STS="“",f.CCH="”",f.MW="•",f.SPA="–",f.EPA="—",f.SOS="˜",f.SGCI="™",f.SCI="š",f.CSI="›",f.ST="œ",f.OSC="",f.PM="ž",f.APC="Ÿ",(iB||={}).ST=`${iM.ESC}\\`;var iw=class{constructor(e,i,r,s,n,o){this._textarea=e,this._compositionView=i,this._bufferService=r,this._optionsService=s,this._coreService=n,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(20===e.keyCode||229===e.keyCode||16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)}_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){let i;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,(i=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start)).length>0&&this._coreService.triggerDataEvent(i,!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 i=this._textarea.value,r=i.replace(e,"");this._dataAlreadySent=r,i.length>e.length?this._coreService.triggerDataEvent(r,!0):i.length<e.length?this._coreService.triggerDataEvent(`${iM.DEL}`,!0):i.length===e.length&&i!==e&&this._coreService.triggerDataEvent(i,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),i=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let n=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(n.width,1)+"px",this._textarea.style.height=Math.max(n.height,1)+"px",this._textarea.style.lineHeight=n.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};iw=B([L(2,X),L(3,et),L(4,J),L(5,eh)],iw);var iC,ik,iE,iD,iR,iM,iP,iB,iL,iT=0,iA=0,iN=0,iO=0,iI={css:"#00000000",rgba:0};(sd=iL||={}).toCss=function(e,i,r,s){return void 0!==s?`#${iK(e)}${iK(i)}${iK(r)}${iK(s)}`:`#${iK(e)}${iK(i)}${iK(r)}`},sd.toRgba=function(e,i,r,s=255){return(e<<24|i<<16|r<<8|s)>>>0},sd.toColor=function(e,i,r,s){return{css:sd.toCss(e,i,r,s),rgba:sd.toRgba(e,i,r,s)}};var iz=sf||={};function iH(e,i){return iO=Math.round(255*i),[iT,iA,iN]=sg.toChannels(e.rgba),{css:iL.toCss(iT,iA,iN,iO),rgba:iL.toRgba(iT,iA,iN,iO)}}iz.blend=function(e,i){if(1==(iO=(255&i.rgba)/255))return{css:i.css,rgba:i.rgba};let r=i.rgba>>24&255,s=i.rgba>>16&255,n=i.rgba>>8&255,o=e.rgba>>24&255,l=e.rgba>>16&255,a=e.rgba>>8&255;return iT=o+Math.round((r-o)*iO),iA=l+Math.round((s-l)*iO),iN=a+Math.round((n-a)*iO),{css:iL.toCss(iT,iA,iN),rgba:iL.toRgba(iT,iA,iN)}},iz.isOpaque=function(e){return(255&e.rgba)==255},iz.ensureContrastRatio=function(e,i,r){let s=sg.ensureContrastRatio(e.rgba,i.rgba,r);if(s)return iL.toColor(s>>24&255,s>>16&255,s>>8&255)},iz.opaque=function(e){let i=(255|e.rgba)>>>0;return[iT,iA,iN]=sg.toChannels(i),{css:iL.toCss(iT,iA,iN),rgba:i}},iz.opacity=iH,iz.multiplyOpacity=function(e,i){return iO=255&e.rgba,iH(e,iO*i/255)},iz.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]},(e=>{let i,r;try{let e=document.createElement("canvas");e.width=1,e.height=1;let s=e.getContext("2d",{willReadFrequently:!0});s&&((i=s).globalCompositeOperation="copy",r=i.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return iT=parseInt(e.slice(1,2).repeat(2),16),iA=parseInt(e.slice(2,3).repeat(2),16),iN=parseInt(e.slice(3,4).repeat(2),16),iL.toColor(iT,iA,iN);case 5:return iT=parseInt(e.slice(1,2).repeat(2),16),iA=parseInt(e.slice(2,3).repeat(2),16),iN=parseInt(e.slice(3,4).repeat(2),16),iO=parseInt(e.slice(4,5).repeat(2),16),iL.toColor(iT,iA,iN,iO);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 s=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(s)return iT=parseInt(s[1]),iA=parseInt(s[2]),iN=parseInt(s[3]),iO=Math.round((void 0===s[5]?1:parseFloat(s[5]))*255),iL.toColor(iT,iA,iN,iO);if(!i||!r||(i.fillStyle=r,i.fillStyle=e,"string"!=typeof i.fillStyle)||(i.fillRect(0,0,1,1),[iT,iA,iN,iO]=i.getImageData(0,0,1,1).data,255!==iO))throw Error("css.toColor: Unsupported css format");return{rgba:iL.toRgba(iT,iA,iN,iO),css:e}}})(s_||={});var iF=sp||={};function ij(e,i,r){let s=e/255,n=i/255,o=r/255;return .2126*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.7152*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))+.0722*(o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4))}iF.relativeLuminance=function(e){return ij(e>>16&255,e>>8&255,255&e)},iF.relativeLuminance2=ij;var iW=sg||={};function i$(e,i,r){let s=e>>24&255,n=e>>16&255,o=e>>8&255,l=i>>24&255,a=i>>16&255,h=i>>8&255,c=iq(sp.relativeLuminance2(l,a,h),sp.relativeLuminance2(s,n,o));for(;c<r&&(l>0||a>0||h>0);)l-=Math.max(0,Math.ceil(.1*l)),a-=Math.max(0,Math.ceil(.1*a)),h-=Math.max(0,Math.ceil(.1*h)),c=iq(sp.relativeLuminance2(l,a,h),sp.relativeLuminance2(s,n,o));return(l<<24|a<<16|h<<8|255)>>>0}function iU(e,i,r){let s=e>>24&255,n=e>>16&255,o=e>>8&255,l=i>>24&255,a=i>>16&255,h=i>>8&255,c=iq(sp.relativeLuminance2(l,a,h),sp.relativeLuminance2(s,n,o));for(;c<r&&(l<255||a<255||h<255);)l=Math.min(255,l+Math.ceil((255-l)*.1)),a=Math.min(255,a+Math.ceil((255-a)*.1)),h=Math.min(255,h+Math.ceil((255-h)*.1)),c=iq(sp.relativeLuminance2(l,a,h),sp.relativeLuminance2(s,n,o));return(l<<24|a<<16|h<<8|255)>>>0}function iK(e){let i=e.toString(16);return i.length<2?"0"+i:i}function iq(e,i){return e<i?(i+.05)/(e+.05):(e+.05)/(i+.05)}iW.blend=function(e,i){if(1==(iO=(255&i)/255))return i;let r=e>>24&255,s=e>>16&255,n=e>>8&255;return iT=r+Math.round(((i>>24&255)-r)*iO),iA=s+Math.round(((i>>16&255)-s)*iO),iN=n+Math.round(((i>>8&255)-n)*iO),iL.toRgba(iT,iA,iN)},iW.ensureContrastRatio=function(e,i,r){let s=sp.relativeLuminance(e>>8),n=sp.relativeLuminance(i>>8);if(iq(s,n)<r){if(n<s){let n=i$(e,i,r),o=iq(s,sp.relativeLuminance(n>>8));if(o<r){let l=iU(e,i,r);return o>iq(s,sp.relativeLuminance(l>>8))?n:l}return n}let o=iU(e,i,r),l=iq(s,sp.relativeLuminance(o>>8));if(l<r){let n=i$(e,i,r);return l>iq(s,sp.relativeLuminance(n>>8))?o:n}return o}},iW.reduceLuminance=i$,iW.increaseLuminance=iU,iW.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]};var iV=class extends W{constructor(e,i,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=i,this._width=r}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()]}},iY=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new U}register(e){let i={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(i),i.id}deregister(e){for(let i=0;i<this._characterJoiners.length;i++)if(this._characterJoiners[i].id===e)return this._characterJoiners.splice(i,1),!0;return!1}getJoinedCharacters(e){if(0===this._characterJoiners.length)return[];let i=this._bufferService.buffer.lines.get(e);if(!i||0===i.length)return[];let r=[],s=i.translateToString(!0),n=0,o=0,l=0,a=i.getFg(0),h=i.getBg(0);for(let e=0;e<i.getTrimmedLength();e++)if(i.loadCell(e,this._workCell),0!==this._workCell.getWidth()){if(this._workCell.fg!==a||this._workCell.bg!==h){if(e-n>1){let e=this._getJoinedRanges(s,l,o,i,n);for(let i=0;i<e.length;i++)r.push(e[i])}n=e,l=o,a=this._workCell.fg,h=this._workCell.bg}o+=this._workCell.getChars().length||1}if(this._bufferService.cols-n>1){let e=this._getJoinedRanges(s,l,o,i,n);for(let i=0;i<e.length;i++)r.push(e[i])}return r}_getJoinedRanges(e,i,r,s,n){let o=e.substring(i,r),l=[];try{l=this._characterJoiners[0].handler(o)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let i=this._characterJoiners[e].handler(o);for(let e=0;e<i.length;e++)iY._mergeRanges(l,i[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(l,s,n),l}_stringRangesToCellRanges(e,i,r){let s=0,n=!1,o=0,l=e[0];if(l){for(let a=r;a<this._bufferService.cols;a++){let r=i.getWidth(a),h=i.getString(a).length||1;if(0!==r){if(!n&&l[0]<=o&&(l[0]=a,n=!0),l[1]<=o){if(l[1]=a,!(l=e[++s]))break;l[0]<=o?(l[0]=a,n=!0):n=!1}o+=h}}l&&(l[1]=this._bufferService.cols)}}static _mergeRanges(e,i){let r=!1;for(let s=0;s<e.length;s++){let n=e[s];if(r){if(i[1]<=n[0])return e[s-1][1]=i[1],e;if(i[1]<=n[1])return e[s-1][1]=Math.max(i[1],n[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(i[1]<=n[0])return e.splice(s,0,i),e;if(i[1]<=n[1])return n[0]=Math.min(i[0],n[0]),e;i[0]<n[1]&&(n[0]=Math.min(i[0],n[0]),r=!0);continue}}return r?e[e.length-1][1]=i[1]:e.push(i),e}};function iX(){return{width:0,height:0}}iY=B([L(0,X)],iY);var iG=class{constructor(e,i,r,s,n,o,l){this._document=e,this._characterJoinerService=i,this._optionsService=r,this._coreBrowserService=s,this._coreService=n,this._decorationService=o,this._themeService=l,this._workCell=new U,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,i,r){this._selectionStart=e,this._selectionEnd=i,this._columnSelectMode=r}createRow(e,i,r,s,n,o,l,a,h,c,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(i),_=this._themeService.colors,p=e.getNoBgTrimmedLength();r&&p<o+1&&(p=o+1);let g,m=0,v="",S=0,y=0,b=0,x=0,w=!1,C=0,k=!1,E=0,D=0,R=[],M=-1!==c&&-1!==u;for(let P=0;P<p;P++){let p;e.loadCell(P,this._workCell);let B=this._workCell.getWidth();if(0===B)continue;let L=!1,T=P>=D,A=P,N=this._workCell;if(f.length>0&&P===f[0][0]&&T){let s=f.shift(),n=this._isCellInSelection(s[0],i);for(S=s[0]+1;S<s[1];S++)T&&=n===this._isCellInSelection(S,i);(T&&=!r||o<s[0]||o>=s[1])?(L=!0,N=new iV(this._workCell,e.translateToString(!0,s[0],s[1]),s[1]-s[0]),A=s[1]-1,B=N.getWidth()):D=s[1]}let O=this._isCellInSelection(P,i),I=r&&P===o,z=M&&P>=c&&P<=u,H=!1;this._decorationService.forEachDecorationAtCell(P,i,void 0,e=>{H=!0});let F=N.getChars()||" ";if(" "===F&&(N.isUnderline()||N.isOverline())&&(F=" "),E=B*a-h.get(F,N.isBold(),N.isItalic()),g)if(m&&(O&&k||!O&&!k&&N.bg===y)&&(O&&k&&_.selectionForeground||N.fg===b)&&N.extended.ext===x&&z===w&&E===C&&!I&&!L&&!H&&T){N.isInvisible()?v+=" ":v+=F,m++;continue}else m&&(g.textContent=v),g=this._document.createElement("span"),m=0,v="";else g=this._document.createElement("span");if(y=N.bg,b=N.fg,x=N.extended.ext,w=z,C=E,k=O,L&&o>=P&&o<=A&&(o=P),!this._coreService.isCursorHidden&&I&&this._coreService.isCursorInitialized){if(R.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&R.push("xterm-cursor-blink"),R.push("bar"===s?"xterm-cursor-bar":"underline"===s?"xterm-cursor-underline":"xterm-cursor-block");else if(n)switch(n){case"outline":R.push("xterm-cursor-outline");break;case"block":R.push("xterm-cursor-block");break;case"bar":R.push("xterm-cursor-bar");break;case"underline":R.push("xterm-cursor-underline")}}if(N.isBold()&&R.push("xterm-bold"),N.isItalic()&&R.push("xterm-italic"),N.isDim()&&R.push("xterm-dim"),v=N.isInvisible()?" ":N.getChars()||" ",N.isUnderline()&&(R.push(`xterm-underline-${N.extended.underlineStyle}`)," "===v&&(v=" "),!N.isUnderlineColorDefault()))if(N.isUnderlineColorRGB())g.style.textDecorationColor=`rgb(${W.toColorRGB(N.getUnderlineColor()).join(",")})`;else{let e=N.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&N.isBold()&&e<8&&(e+=8),g.style.textDecorationColor=_.ansi[e].css}N.isOverline()&&(R.push("xterm-overline")," "===v&&(v=" ")),N.isStrikethrough()&&R.push("xterm-strikethrough"),z&&(g.style.textDecoration="underline");let j=N.getFgColor(),$=N.getFgColorMode(),U=N.getBgColor(),K=N.getBgColorMode(),q=!!N.isInverse();if(q){let e=j;j=U,U=e;let i=$;$=K,K=i}let V,Y,X=!1;switch(this._decorationService.forEachDecorationAtCell(P,i,void 0,e=>{"top"!==e.options.layer&&X||(e.backgroundColorRGB&&(K=0x3000000,U=e.backgroundColorRGB.rgba>>8&0xffffff,V=e.backgroundColorRGB),e.foregroundColorRGB&&($=0x3000000,j=e.foregroundColorRGB.rgba>>8&0xffffff,Y=e.foregroundColorRGB),X="top"===e.options.layer)}),!X&&O&&(U=(V=this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque).rgba>>8&0xffffff,K=0x3000000,X=!0,_.selectionForeground&&($=0x3000000,j=_.selectionForeground.rgba>>8&0xffffff,Y=_.selectionForeground)),X&&R.push("xterm-decoration-top"),K){case 0x1000000:case 0x2000000:p=_.ansi[U],R.push(`xterm-bg-${U}`);break;case 0x3000000:p=iL.toColor(U>>16,U>>8&255,255&U),this._addStyle(g,`background-color:#${iJ((U>>>0).toString(16),"0",6)}`);break;default:q?(p=_.foreground,R.push("xterm-bg-257")):p=_.background}switch(V||N.isDim()&&(V=sf.multiplyOpacity(p,.5)),$){case 0x1000000:case 0x2000000:N.isBold()&&j<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(j+=8),this._applyMinimumContrast(g,p,_.ansi[j],N,V,void 0)||R.push(`xterm-fg-${j}`);break;case 0x3000000:let G=iL.toColor(j>>16&255,j>>8&255,255&j);this._applyMinimumContrast(g,p,G,N,V,Y)||this._addStyle(g,`color:#${iJ(j.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(g,p,_.foreground,N,V,Y)||q&&R.push("xterm-fg-257")}R.length&&(g.className=R.join(" "),R.length=0),I||L||H||!T?g.textContent=v:m++,E!==this.defaultSpacing&&(g.style.letterSpacing=`${E}px`),d.push(g),P=A}return g&&m&&(g.textContent=v),d}_applyMinimumContrast(e,i,r,s,n,o){var l,a,h;if(1===this._optionsService.rawOptions.minimumContrastRatio||57508<=(a=l=s.getCode())&&a<=57558||9472<=(h=l)&&h<=9631)return!1;let c=this._getContrastCache(s),u;if(n||o||(u=c.getColor(i.rgba,r.rgba)),void 0===u){let e=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);u=sf.ensureContrastRatio(n||i,o||r,e),c.setColor((n||i).rgba,(o||r).rgba,u??null)}return!!u&&(this._addStyle(e,`color:${u.css}`),!0)}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,i){e.setAttribute("style",`${e.getAttribute("style")||""}${i};`)}_isCellInSelection(e,i){let r=this._selectionStart,s=this._selectionEnd;return!!r&&!!s&&(this._columnSelectMode?r[0]<=s[0]?e>=r[0]&&i>=r[1]&&e<s[0]&&i<=s[1]:e<r[0]&&i>=r[1]&&e>=s[0]&&i<=s[1]:i>r[1]&&i<s[1]||r[1]===s[1]&&i===r[1]&&e>=r[0]&&e<s[0]||r[1]<s[1]&&i===s[1]&&e<s[0]||r[1]<s[1]&&i===r[1]&&e>=r[0])}};function iJ(e,i,r){for(;e.length<r;)e=i+e;return e}iG=B([L(1,eu),L(2,et),L(3,el),L(4,J),L(5,es),L(6,ed)],iG);var iZ=class{constructor(e,i){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let r=e.createElement("span");r.classList.add("xterm-char-measure-element");let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[r,s,n,o],this._container.appendChild(r),this._container.appendChild(s),this._container.appendChild(n),this._container.appendChild(o),i.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,i,r,s){e===this._font&&i===this._fontSize&&r===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=i,this._weight=r,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,i,r){let s=0;if(!i&&!r&&1===e.length&&(s=e.charCodeAt(0))<256){if(-9999!==this._flat[s])return this._flat[s];let i=this._measure(e,0);return i>0&&(this._flat[s]=i),i}let n=e;i&&(n+="B"),r&&(n+="I");let o=this._holey.get(n);if(void 0===o){let s=0;i&&(s|=1),r&&(s|=2),(o=this._measure(e,s))>0&&this._holey.set(n,o)}return o}_measure(e,i){let r=this._measureElements[i];return r.textContent=e.repeat(32),r.offsetWidth/32}},iQ=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,i,r,s=!1){if(this.selectionStart=i,this.selectionEnd=r,!i||!r||i[0]===r[0]&&i[1]===r[1])return void this.clear();let n=e.buffers.active.ydisp,o=i[1]-n,l=r[1]-n,a=Math.max(o,0),h=Math.min(l,e.rows-1);a>=e.rows||h<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=o,this.viewportEndRow=l,this.viewportCappedStartRow=a,this.viewportCappedEndRow=h,this.startCol=i[0],this.endCol=r[0])}isCellSelected(e,i,r){return!!this.hasSelection&&(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?i>=this.startCol&&r>=this.viewportCappedStartRow&&i<this.endCol&&r<=this.viewportCappedEndRow:i<this.startCol&&r>=this.viewportCappedStartRow&&i>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&i>=this.startCol&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&i>=this.startCol)}},i0="xterm-dom-renderer-owner-",i1="xterm-rows",i2="xterm-fg-",i5="xterm-bg-",i3="xterm-focus",i4="xterm-selection",i6=1,i9=class extends eR{constructor(e,i,r,s,n,o,l,a,h,c,u,d,f,_){super(),this._terminal=e,this._document=i,this._element=r,this._screenElement=s,this._viewportElement=n,this._helperContainer=o,this._linkifier2=l,this._charSizeService=h,this._optionsService=c,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=_,this._terminalClass=i6++,this._rowElements=[],this._selectionRenderModel=new iQ,this.onRequestRedraw=this._register(new eV).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(i1),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(i4),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions={css:{canvas:iX(),cell:iX()},device:{canvas:iX(),cell:iX(),char:{width:0,height:0,left:0,top:0}}},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=a.createInstance(iG,document),this._element.classList.add(i0+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(ek(()=>{this._element.classList.remove(i0+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new iZ(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;for(let i of(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,this._rowElements))i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let i=`${this._terminalSelector} .${i1} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=i,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let i=`${this._terminalSelector} .${i1} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;i+=`${this._terminalSelector} .${i1} .xterm-dim { color: ${sf.multiplyOpacity(e.foreground,.5).css};}${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 r=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,n=`blink_block_${this._terminalClass}`;for(let[o,l]of(i+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}@keyframes ${s} { 50% { box-shadow: none; }}@keyframes ${n} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}${this._terminalSelector} .${i1}.${i3} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${i1}.${i3} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${i1}.${i3} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${i1} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${i1} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${i1} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${i1} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${i1} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}${this._terminalSelector} .${i4} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${i4} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${i4} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`,e.ansi.entries()))i+=`${this._terminalSelector} .${i2}${o} { color: ${l.css}; }${this._terminalSelector} .${i2}${o}.xterm-dim { color: ${sf.multiplyOpacity(l,.5).css}; }${this._terminalSelector} .${i5}${o} { background-color: ${l.css}; }`;i+=`${this._terminalSelector} .${i2}257 { color: ${sf.opaque(e.background).css}; }${this._terminalSelector} .${i2}257.xterm-dim { color: ${sf.multiplyOpacity(sf.opaque(e.background),.5).css}; }${this._terminalSelector} .${i5}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=i}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,i){for(let e=this._rowElements.length;e<=i;e++){let e=this._document.createElement("div");this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,i){this._refreshRowElements(e,i),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(i3),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(i3),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,i,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,i,r),this.renderRows(0,this._bufferService.rows-1),!e||!i||(this._selectionRenderModel.update(this._terminal,e,i,r),!this._selectionRenderModel.hasSelection))return;let s=this._selectionRenderModel.viewportStartRow,n=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,l=this._selectionRenderModel.viewportCappedEndRow,a=this._document.createDocumentFragment();if(r){let r=e[0]>i[0];a.appendChild(this._createSelectionElement(o,r?i[0]:e[0],r?e[0]:i[0],l-o+1))}else{let r=s===o?e[0]:0,h=o===n?i[0]:this._bufferService.cols;if(a.appendChild(this._createSelectionElement(o,r,h)),a.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,l-o-1)),o!==l){let e=n===l?i[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(l,0,e))}}this._selectionContainer.appendChild(a)}_createSelectionElement(e,i,r,s=1){let n=this._document.createElement("div"),o=i*this.dimensions.css.cell.width,l=this.dimensions.css.cell.width*(r-i);return o+l>this.dimensions.css.canvas.width&&(l=this.dimensions.css.canvas.width-o),n.style.height=`${s*this.dimensions.css.cell.height}px`,n.style.top=`${e*this.dimensions.css.cell.height}px`,n.style.left=`${o}px`,n.style.width=`${l}px`,n}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,i){let r=this._bufferService.buffer,s=r.ybase+r.y,n=Math.min(r.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,l=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let h=e;h<=i;h++){let e=h+r.ydisp,i=this._rowElements[h],c=r.lines.get(e);if(!i||!c)break;i.replaceChildren(...this._rowFactory.createRow(c,e,e===s,l,a,n,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${i0}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,i,r,s,n,o){r<0&&(e=0),s<0&&(i=0);let l=this._bufferService.rows-1;r=Math.max(Math.min(r,l),0),s=Math.max(Math.min(s,l),0),n=Math.min(n,this._bufferService.cols);let a=this._bufferService.buffer,h=a.ybase+a.y,c=Math.min(a.x,n-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let l=r;l<=s;++l){let _=l+a.ydisp,p=this._rowElements[l],g=a.lines.get(_);if(!p||!g)break;p.replaceChildren(...this._rowFactory.createRow(g,_,_===h,d,f,c,u,this.dimensions.css.cell.width,this._widthCache,o?l===r?e:0:-1,o?(l===s?i:n)-1:-1))}}};i9=B([L(7,Q),L(8,eo),L(9,et),L(10,X),L(11,J),L(12,el),L(13,ed)],i9);var i8=class extends eR{constructor(e,i,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new eV),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new rt(this._optionsService))}catch{this._measureStrategy=this._register(new re(e,i,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};i8=B([L(2,et)],i8);var i7=class extends eR{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,i){void 0!==e&&e>0&&void 0!==i&&i>0&&(this._result.width=e,this._result.height=i)}},re=class extends i7{constructor(e,i,r){super(),this._document=e,this._parentElement=i,this._optionsService=r,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}},rt=class extends i7{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let i=this._ctx.measureText("W");if(!("width"in i&&"fontBoundingBoxAscent"in i&&"fontBoundingBoxDescent"in i))throw 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}},ri=class extends eR{constructor(e,i,r){super(),this._textarea=e,this._window=i,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new rr(this._window)),this._onDprChange=this._register(new eV),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new eV),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(eF.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(tJ(this._textarea,"focus",()=>this._isFocused=!0)),this._register(tJ(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 void 0===this._cachedIsFocused&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},rr=class extends eR{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new eM),this._onDprChange=this._register(new eV),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(ek(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=tJ(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)}},rs=class extends eR{constructor(){super(),this.linkProviders=[],this._register(ek(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let i=this.linkProviders.indexOf(e);-1!==i&&this.linkProviders.splice(i,1)}}}};function rn(e,i,r){let s=r.getBoundingClientRect(),n=e.getComputedStyle(r),o=parseInt(n.getPropertyValue("padding-left")),l=parseInt(n.getPropertyValue("padding-top"));return[i.clientX-s.left-o,i.clientY-s.top-l]}var ro=class{constructor(e,i){this._renderService=e,this._charSizeService=i}getCoords(e,i,r,s,n){return function(e,i,r,s,n,o,l,a,h){if(!o)return;let c=rn(e,i,r);return c[0]=Math.ceil((c[0]+(h?l/2:0))/l),c[1]=Math.ceil(c[1]/a),c[0]=Math.min(Math.max(c[0],1),s+ +!!h),c[1]=Math.min(Math.max(c[1],1),n),c}(window,e,i,r,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,n)}getMouseReportCoords(e,i){let r=rn(window,e,i);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};ro=B([L(0,eh),L(1,eo)],ro);var rl=class{constructor(e,i){this._renderCallback=e,this._coreBrowserService=i,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,i,r){this._rowCount=r,e=void 0!==e?e:0,i=void 0!==i?i:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,i):i,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return void this._runRefreshCallbacks();let e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},ra={},rh={getSafariVersion:()=>rm,isChromeOS:()=>rw,isFirefox:()=>r_,isIpad:()=>rS,isIphone:()=>ry,isLegacyEdge:()=>rp,isLinux:()=>rx,isMac:()=>rv,isNode:()=>ru,isSafari:()=>rg,isWindows:()=>rb};for(var rc in rh)M(ra,rc,{get:rh[rc],enumerable:!0});var ru="u">typeof R.default&&"title"in R.default,rd=ru?"node":navigator.userAgent,rf=ru?"node":navigator.platform,r_=rd.includes("Firefox"),rp=rd.includes("Edge"),rg=/^((?!chrome|android).)*safari/i.test(rd);function rm(){if(!rg)return 0;let e=rd.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1])}var rv=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(rf),rS="iPad"===rf,ry="iPhone"===rf,rb=["Windows","Win16","Win32","WinCE"].includes(rf),rx=rf.indexOf("Linux")>=0,rw=/\bCrOS\b/.test(rd),rC=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let i=0,r=0,s=e.timeRemaining(),n=0;for(;this._i<this._tasks.length;){if(i=performance.now(),this._tasks[this._i]()||this._i++,1.5*(r=Math.max(i=Math.max(1,performance.now()-i),r))>(n=e.timeRemaining())){s-i<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-i))}ms`),this._start();return}s=n}this.clear()}},rk=class extends rC{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let i=performance.now()+e;return{timeRemaining:()=>Math.max(0,i-performance.now())}}},rE=class extends rC{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},rD=!ru&&"requestIdleCallback"in window?rE:rk,rR=class{constructor(){this._queue=new rD}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},rM=class extends eR{constructor(e,i,r,s,n,o,l,a,h){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=s,this._coreService=n,this._coreBrowserService=a,this._renderer=this._register(new eM),this._pausedResizeTask=new rR,this._observerDisposable=this._register(new eM),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 eV),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new eV),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new eV),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new eV),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new rl((e,i)=>this._renderRows(e,i),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new rP(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(ek(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(l.onResize(()=>this._fullRefresh())),this._register(l.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(l.cols,l.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(l.buffer.y,l.buffer.y,!0))),this._register(h.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,i),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,i)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,i){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});r.observe(i),this._observerDisposable.value=ek(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=void 0===e.isIntersecting?0===e.intersectionRatio:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,i,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput)return void this._syncOutputHandler.bufferRows(e,i);let s=this._syncOutputHandler.flush();s&&(e=Math.min(e,s.start),i=Math.max(i,s.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,i,this._rowCount)}_renderRows(e,i){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput)return void this._syncOutputHandler.bufferRows(e,i);e=Math.min(e,this._rowCount-1),i=Math.min(i,this._rowCount-1),this._renderer.value.renderRows(e,i),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:i}),this._onRender.fire({start:e,end:i}),this._isNextRenderRedrawOnly=!0}}resize(e,i){this._rowCount=i,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(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,i){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,i)):this._renderer.value.handleResize(e,i),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,i,r){this._selectionState.start=e,this._selectionState.end=i,this._selectionState.columnSelectMode=r,this._renderer.value?.handleSelectionChanged(e,i,r)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};rM=B([L(2,et),L(3,eo),L(4,J),L(5,es),L(6,X),L(7,el),L(8,ed)],rM);var rP=class{constructor(e,i,r){this._coreBrowserService=e,this._coreService=i,this._onTimeout=r,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,i){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,i)):(this._start=e,this._end=i,this._isBuffering=!0),void 0===this._timeout&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(void 0!==this._timeout&&(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(){void 0!==this._timeout&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function rB(e,i,r,s){return rN(Math.abs(e-rL(e,r)-(i-rL(i,r)))-function(e,i,r){let s=0,n=e-rL(e,r),o=i-rL(i,r);for(let l=0;l<Math.abs(n-o);l++){let o="A"===function(e,i){return e>i?"A":"B"}(e,i)?-1:1;r.buffer.lines.get(n+o*l)?.isWrapped&&s++}return s}(e,i,r),rA(e>i?"A":"B",s))}function rL(e,i){let r=0,s=i.buffer.lines.get(e),n=s?.isWrapped;for(;n&&e>=0&&e<i.rows;)r++,s=i.buffer.lines.get(--e),n=s?.isWrapped;return r}function rT(e,i,r,s,n,o){let l=e,a=i,h="";for(;(l!==r||a!==s)&&a>=0&&a<o.buffer.lines.length;)l+=n?1:-1,n&&l>o.cols-1?(h+=o.buffer.translateBufferLineToString(a,!1,e,l),l=0,e=0,a++):!n&&l<0&&(h+=o.buffer.translateBufferLineToString(a,!1,0,e+1),e=l=o.cols-1,a--);return h+o.buffer.translateBufferLineToString(a,!1,e,l)}function rA(e,i){return iM.ESC+(i?"O":"[")+e}function rN(e,i){e=Math.floor(e);let r="";for(let s=0;s<e;s++)r+=i;return r}var rO=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._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,i=this.selectionEnd;return!!e&&!!i&&(e[1]>i[1]||e[1]===i[1]&&e[0]>i[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 rI(e,i){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 i*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var rz=RegExp(" ","g"),rH=class extends eR{constructor(e,i,r,s,n,o,l,a,h){super(),this._element=e,this._screenElement=i,this._linkifier=r,this._bufferService=s,this._coreService=n,this._mouseService=o,this._optionsService=l,this._renderService=a,this._coreBrowserService=h,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new U,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new eV),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new eV),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new eV),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new eV),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 rO(this._bufferService),this._activeSelectionMode=0,this._register(ek(()=>{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,i=this._model.finalSelectionEnd;return!!e&&!!i&&(e[0]!==i[0]||e[1]!==i[1])}get selectionText(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;if(!e||!i)return"";let r=this._bufferService.buffer,s=[];if(3===this._activeSelectionMode){if(e[0]===i[0])return"";let n=e[0]<i[0]?e[0]:i[0],o=e[0]<i[0]?i[0]:e[0];for(let l=e[1];l<=i[1];l++){let e=r.translateBufferLineToString(l,!0,n,o);s.push(e)}}else{let n=e[1]===i[1]?i[0]:void 0;s.push(r.translateBufferLineToString(e[1],!0,e[0],n));for(let n=e[1]+1;n<=i[1]-1;n++){let e=r.lines.get(n),i=r.translateBufferLineToString(n,!0);e?.isWrapped?s[s.length-1]+=i:s.push(i)}if(e[1]!==i[1]){let e=r.lines.get(i[1]),n=r.translateBufferLineToString(i[1],!0,0,i[0]);e&&e.isWrapped?s[s.length-1]+=n:s.push(n)}}return s.map(e=>e.replace(rz," ")).join(rb?`\r
14
- `:`
15
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),rx&&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:3===this._activeSelectionMode})}_isClickInSelection(e){let i=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!!r&&!!s&&!!i&&this._areCoordsInSelection(i,r,s)}isCellInSelection(e,i){let r=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!!r&&!!s&&this._areCoordsInSelection([e,i],r,s)}_areCoordsInSelection(e,i,r){return e[1]>i[1]&&e[1]<r[1]||i[1]===r[1]&&e[1]===i[1]&&e[0]>=i[0]&&e[0]<r[0]||i[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||i[1]<r[1]&&e[1]===i[1]&&e[0]>=i[0]}_selectWordAtCursor(e,i){let r=this._linkifier.currentLink?.link?.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=rI(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let s=this._getMouseBufferCoords(e);return!!s&&(this._selectWordAt(s,i),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,i){this._model.clearSelection(),e=Math.max(e,0),i=Math.min(i,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,i],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let i=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(i)return i[0]--,i[1]--,i[1]+=this._bufferService.buffer.ydisp,i}_getMouseEventScrollAmount(e){let i=rn(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return i>=0&&i<=r?0:(i>r&&(i-=r),(i=Math.min(Math.max(i,-50),50)/50)/Math.abs(i)+Math.round(14*i))}shouldForceSelection(e){return rv?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(2===e.button&&this.hasSelection)&&0===e.button){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):1===e.detail?this._handleSingleClick(e):2===e.detail?this._handleDoubleClick(e):3===e.detail&&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(),50)}_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=3*!!this.shouldColumnSelect(e),this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let i=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);i&&i.length!==this._model.selectionStart[0]&&0===i.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let i=this._getMouseBufferCoords(e);i&&(this._activeSelectionMode=2,this._selectLineAt(i[1]))}shouldColumnSelect(e){return e.altKey&&!(rv&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let i=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd)return void this.refresh(!0);2===this._activeSelectionMode?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:1===this._activeSelectionMode&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),3!==this._activeSelectionMode&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let r=this._bufferService.buffer;if(this._model.selectionEnd[1]<r.lines.length){let e=r.lines.get(this._model.selectionEnd[1]);e&&0===e.hasWidth(this._model.selectionEnd[0])&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}i&&i[0]===this._model.selectionEnd[0]&&i[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let i=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&i<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&void 0!==i[0]&&void 0!==i[1]){let e=function(e,i,r,s){var n,o,l,a,h,c,u,d,f,_,p,g,m,v,S,y;let b,x=r.buffer.x,w=r.buffer.y;if(!r.buffer.hasScrollback){let y,b,C;return n=x,(0===rB(o=w,i,l=r,a=s).length?"":rN(rT(n,o,n,o-rL(o,l),!1,l).length,rA("D",a)))+rB(w,i,r,s)+(h=x,c=w,u=e,y=rB(c,d=i,f=r,_=s).length>0?d-rL(d,f):c,C=(p=h,g=c,b=rB(m=u,v=d,S=f,_).length>0?v-rL(v,S):g,p<m&&b<=v||p>=m&&b<v?"C":"D"),rN(rT(h,y,u,d,"C"===C,f).length,rA(C,_)))}if(w===i)return b=x>e?"D":"C",rN(Math.abs(x-e),rA(b,s));b=w>i?"D":"C";let C=Math.abs(w-i);return rN((y=w>i?e:x,r.cols-y+(C-1)*r.cols+1+((w>i?x:e)-1)),rA(b,s))}(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd,r=!!e&&!!i&&(e[0]!==i[0]||e[1]!==i[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,i,r);return}!e||!i||this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&i[0]===this._oldSelectionEnd[0]&&i[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,i,r)}_fireOnSelectionChange(e,i,r){this._oldSelectionStart=e,this._oldSelectionEnd=i,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,i){let r=i;for(let s=0;i>=s;s++){let n=e.loadCell(s,this._workCell).getChars().length;0===this._workCell.getWidth()?r--:n>1&&i!==s&&(r+=n-1)}return r}setSelection(e,i,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,i],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,i,r=!0,s=!0){if(e[0]>=this._bufferService.cols)return;let n=this._bufferService.buffer,o=n.lines.get(e[1]);if(!o)return;let l=n.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(o,e[0]),h=a,c=e[0]-a,u=0,d=0,f=0,_=0;if(" "===l.charAt(a)){for(;a>0&&" "===l.charAt(a-1);)a--;for(;h<l.length&&" "===l.charAt(h+1);)h++}else{let i=e[0],r=e[0];0===o.getWidth(i)&&(u++,i--),2===o.getWidth(r)&&(d++,r++);let s=o.getString(r).length;for(s>1&&(_+=s-1,h+=s-1);i>0&&a>0&&!this._isCharWordSeparator(o.loadCell(i-1,this._workCell));){o.loadCell(i-1,this._workCell);let e=this._workCell.getChars().length;0===this._workCell.getWidth()?(u++,i--):e>1&&(f+=e-1,a-=e-1),a--,i--}for(;r<o.length&&h+1<l.length&&!this._isCharWordSeparator(o.loadCell(r+1,this._workCell));){o.loadCell(r+1,this._workCell);let e=this._workCell.getChars().length;2===this._workCell.getWidth()?(d++,r++):e>1&&(_+=e-1,h+=e-1),h++,r++}}h++;let p=a+c-u+f,g=Math.min(this._bufferService.cols,h-a+u+d-f-_);if(!(!i&&""===l.slice(a,h).trim())){if(r&&0===p&&32!==o.getCodePoint(0)){let i=n.lines.get(e[1]-1);if(i&&o.isWrapped&&32!==i.getCodePoint(this._bufferService.cols-1)){let i=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(i){let e=this._bufferService.cols-i.start;p-=e,g+=e}}}if(s&&p+g===this._bufferService.cols&&32!==o.getCodePoint(this._bufferService.cols-1)){let i=n.lines.get(e[1]+1);if(i?.isWrapped&&32!==i.getCodePoint(0)){let i=this._getWordAt([0,e[1]+1],!1,!1,!0);i&&(g+=i.length)}}return{start:p,length:g}}}_selectWordAt(e,i){let r=this._getWordAt(e,i);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let i=this._getWordAt(e,!0);if(i){let r=e[1];for(;i.start<0;)i.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;i.start+i.length>this._bufferService.cols;)i.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?i.start:i.start+i.length,r]}}_isCharWordSeparator(e){return 0!==e.getWidth()&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let i=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:i.first},end:{x:this._bufferService.cols-1,y:i.last}};this._model.selectionStart=[0,i.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=rI(r,this._bufferService.cols)}};rH=B([L(3,X),L(4,J),L(5,ea),L(6,et),L(7,eh),L(8,el)],rH);var rF=class{constructor(){this._data={}}set(e,i,r){this._data[e]||(this._data[e]={}),this._data[e][i]=r}get(e,i){return this._data[e]?this._data[e][i]:void 0}clear(){this._data={}}},rj=class{constructor(){this._color=new rF,this._css=new rF}setCss(e,i,r){this._css.set(e,i,r)}getCss(e,i){return this._css.get(e,i)}setColor(e,i,r){this._color.set(e,i,r)}getColor(e,i){return this._color.get(e,i)}clear(){this._color.clear(),this._css.clear()}},rW=Object.freeze((()=>{let e=[s_.toColor("#2e3436"),s_.toColor("#cc0000"),s_.toColor("#4e9a06"),s_.toColor("#c4a000"),s_.toColor("#3465a4"),s_.toColor("#75507b"),s_.toColor("#06989a"),s_.toColor("#d3d7cf"),s_.toColor("#555753"),s_.toColor("#ef2929"),s_.toColor("#8ae234"),s_.toColor("#fce94f"),s_.toColor("#729fcf"),s_.toColor("#ad7fa8"),s_.toColor("#34e2e2"),s_.toColor("#eeeeec")],i=[0,95,135,175,215,255];for(let r=0;r<216;r++){let s=i[r/36%6|0],n=i[r/6%6|0],o=i[r%6];e.push({css:iL.toCss(s,n,o),rgba:iL.toRgba(s,n,o)})}for(let i=0;i<24;i++){let r=8+10*i;e.push({css:iL.toCss(r,r,r),rgba:iL.toRgba(r,r,r)})}return e})()),r$=s_.toColor("#ffffff"),rU=s_.toColor("#000000"),rK=s_.toColor("#ffffff"),rq={css:"rgba(255, 255, 255, 0.3)",rgba:0xffffff4d},rV=class extends eR{constructor(e){super(),this._optionsService=e,this._contrastCache=new rj,this._halfContrastCache=new rj,this._onChangeColors=this._register(new eV),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:r$,background:rU,cursor:rK,cursorAccent:rU,selectionForeground:void 0,selectionBackgroundTransparent:rq,selectionBackgroundOpaque:sf.blend(rU,rq),selectionInactiveBackgroundTransparent:rq,selectionInactiveBackgroundOpaque:sf.blend(rU,rq),scrollbarSliderBackground:sf.opacity(r$,.2),scrollbarSliderHoverBackground:sf.opacity(r$,.4),scrollbarSliderActiveBackground:sf.opacity(r$,.5),overviewRulerBorder:r$,ansi:rW.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let i=this._colors;if(i.foreground=rY(e.foreground,r$),i.background=rY(e.background,rU),i.cursor=sf.blend(i.background,rY(e.cursor,rK)),i.cursorAccent=sf.blend(i.background,rY(e.cursorAccent,rU)),i.selectionBackgroundTransparent=rY(e.selectionBackground,rq),i.selectionBackgroundOpaque=sf.blend(i.background,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundTransparent=rY(e.selectionInactiveBackground,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundOpaque=sf.blend(i.background,i.selectionInactiveBackgroundTransparent),i.selectionForeground=e.selectionForeground?rY(e.selectionForeground,iI):void 0,i.selectionForeground===iI&&(i.selectionForeground=void 0),sf.isOpaque(i.selectionBackgroundTransparent)&&(i.selectionBackgroundTransparent=sf.opacity(i.selectionBackgroundTransparent,.3)),sf.isOpaque(i.selectionInactiveBackgroundTransparent)&&(i.selectionInactiveBackgroundTransparent=sf.opacity(i.selectionInactiveBackgroundTransparent,.3)),i.scrollbarSliderBackground=rY(e.scrollbarSliderBackground,sf.opacity(i.foreground,.2)),i.scrollbarSliderHoverBackground=rY(e.scrollbarSliderHoverBackground,sf.opacity(i.foreground,.4)),i.scrollbarSliderActiveBackground=rY(e.scrollbarSliderActiveBackground,sf.opacity(i.foreground,.5)),i.overviewRulerBorder=rY(e.overviewRulerBorder,r$),i.ansi=rW.slice(),i.ansi[0]=rY(e.black,rW[0]),i.ansi[1]=rY(e.red,rW[1]),i.ansi[2]=rY(e.green,rW[2]),i.ansi[3]=rY(e.yellow,rW[3]),i.ansi[4]=rY(e.blue,rW[4]),i.ansi[5]=rY(e.magenta,rW[5]),i.ansi[6]=rY(e.cyan,rW[6]),i.ansi[7]=rY(e.white,rW[7]),i.ansi[8]=rY(e.brightBlack,rW[8]),i.ansi[9]=rY(e.brightRed,rW[9]),i.ansi[10]=rY(e.brightGreen,rW[10]),i.ansi[11]=rY(e.brightYellow,rW[11]),i.ansi[12]=rY(e.brightBlue,rW[12]),i.ansi[13]=rY(e.brightMagenta,rW[13]),i.ansi[14]=rY(e.brightCyan,rW[14]),i.ansi[15]=rY(e.brightWhite,rW[15]),e.extendedAnsi){let r=Math.min(i.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<r;s++)i.ansi[s+16]=rY(e.extendedAnsi[s],rW[s+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(void 0===e){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function rY(e,i){if(void 0!==e)try{return s_.toColor(e)}catch{}return i}rV=B([L(0,et)],rV);var rX=class{constructor(...e){for(let[i,r]of(this._entries=new Map,e))this.set(i,r)}set(e,i){let r=this._entries.get(e);return this._entries.set(e,i),r}forEach(e){for(let[i,r]of this._entries.entries())e(i,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},rG=class{constructor(){this._services=new rX,this._services.set(Q,this)}setService(e,i){this._services.set(e,i)}getService(e){return this._services.get(e)}createInstance(e,...i){let r=(e[q]||[]).sort((e,i)=>e.index-i.index),s=[];for(let i of r){let r=this._services.get(i.id);if(!r)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${i.id._id}.`);s.push(r)}let n=r.length>0?r[0].index:i.length;if(i.length!==n)throw Error(`[createInstance] First service dependency of ${e.name} at position ${n+1} conflicts with ${i.length} static arguments`);return new e(...i,...s)}},rJ={trace:0,debug:1,info:2,warn:3,error:4,off:5},rZ=class extends eR{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=rJ[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)"function"==typeof e[i]&&(e[i]=e[i]())}_log(e,i,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+i,...r)}trace(e,...i){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,i)}debug(e,...i){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,i)}info(e,...i){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,i)}warn(e,...i){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,i)}error(e,...i){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,i)}};rZ=B([L(0,et)],rZ);var rQ=class extends eR{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new eV),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new eV),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new eV),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let i=Array(e);for(let r=0;r<Math.min(e,this.length);r++)i[r]=this._array[this._getCyclicIndex(r)];this._array=i,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let i=this._length;i<e;i++)this._array[i]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,i){this._array[this._getCyclicIndex(e)]=i}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,i,...r){if(i){for(let r=e;r<this._length-i;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+i)];this._length-=i,this.onDeleteEmitter.fire({index:e,amount:i})}for(let i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+r.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<r.length;i++)this._array[this._getCyclicIndex(e+i)]=r[i];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let e=this._length+r.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,i,r){if(!(i<=0)){if(e<0||e>=this._length)throw Error("start argument out of range");if(e+r<0)throw Error("Cannot shift elements in list beyond index 0");if(r>0){for(let s=i-1;s>=0;s--)this.set(e+s+r,this.get(e+s));let s=e+i+r-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<i;s++)this.set(e+s+r,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},r0=Object.freeze(new W),r1=0,r2=class e{constructor(e,i,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);let s=i||U.fromCharData([0,"",1,0]);for(let i=0;i<e;++i)this.setCell(i,s);this.length=e}get(e){let i=this._data[3*e+0],r=2097151&i;return[this._data[3*e+1],2097152&i?this._combined[e]:r?z(r):"",i>>22,2097152&i?this._combined[e].charCodeAt(this._combined[e].length-1):r]}set(e,i){this._data[3*e+1]=i[0],i[1].length>1?(this._combined[e]=i[1],this._data[3*e+0]=2097152|e|i[2]<<22):this._data[3*e+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 0xc00000&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){let i=this._data[3*e+0];return 2097152&i?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&i}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){let i=this._data[3*e+0];return 2097152&i?this._combined[e]:2097151&i?z(2097151&i):""}isProtected(e){return 0x20000000&this._data[3*e+2]}loadCell(e,i){return r1=3*e,i.content=this._data[r1+0],i.fg=this._data[r1+1],i.bg=this._data[r1+2],2097152&i.content&&(i.combinedData=this._combined[e]),0x10000000&i.bg&&(i.extended=this._extendedAttrs[e]),i}setCell(e,i){2097152&i.content&&(this._combined[e]=i.combinedData),0x10000000&i.bg&&(this._extendedAttrs[e]=i.extended),this._data[3*e+0]=i.content,this._data[3*e+1]=i.fg,this._data[3*e+2]=i.bg}setCellFromCodepoint(e,i,r,s){0x10000000&s.bg&&(this._extendedAttrs[e]=s.extended),this._data[3*e+0]=i|r<<22,this._data[3*e+1]=s.fg,this._data[3*e+2]=s.bg}addCodepointToCell(e,i,r){let s=this._data[3*e+0];2097152&s?this._combined[e]+=z(i):2097151&s?(this._combined[e]=z(2097151&s)+z(i),s&=-2097152,s|=2097152):s=4194304|i,r&&(s&=-0xc00001,s|=r<<22),this._data[3*e+0]=s}insertCells(e,i,r){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length-e){let s=new U;for(let r=this.length-e-i-1;r>=0;--r)this.setCell(e+i+r,this.loadCell(e+r,s));for(let s=0;s<i;++s)this.setCell(e+s,r)}else for(let i=e;i<this.length;++i)this.setCell(i,r);2===this.getWidth(this.length-1)&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(e,i,r){if(e%=this.length,i<this.length-e){let s=new U;for(let r=0;r<this.length-e-i;++r)this.setCell(e+r,this.loadCell(e+i+r,s));for(let e=this.length-i;e<this.length;++e)this.setCell(e,r)}else for(let i=e;i<this.length;++i)this.setCell(i,r);e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,r),0!==this.getWidth(e)||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,r)}replaceCells(e,i,r,s=!1){if(s){for(e&&2===this.getWidth(e-1)&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length&&2===this.getWidth(i-1)&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,r);e<i&&e<this.length;)this.isProtected(e)||this.setCell(e,r),e++;return}for(e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length&&2===this.getWidth(i-1)&&this.setCellFromCodepoint(i,0,1,r);e<i&&e<this.length;)this.setCell(e++,r)}resize(e,i){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let r=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*r)this._data=new Uint32Array(this._data.buffer,0,r);else{let e=new Uint32Array(r);e.set(this._data),this._data=e}for(let r=this.length;r<e;++r)this.setCell(r,i)}else{this._data=this._data.subarray(0,r);let i=Object.keys(this._combined);for(let r=0;r<i.length;r++){let s=parseInt(i[r],10);s>=e&&delete this._combined[s]}let s=Object.keys(this._extendedAttrs);for(let i=0;i<s.length;i++){let r=parseInt(s[i],10);r>=e&&delete this._extendedAttrs[r]}}return this.length=e,4*r*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,i=!1){if(i){for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,e);return}this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,e)}copyFrom(e){for(let i in this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={},e._combined)this._combined[i]=e._combined[i];for(let i in this._extendedAttrs={},e._extendedAttrs)this._extendedAttrs[i]=e._extendedAttrs[i];this.isWrapped=e.isWrapped}clone(){let i=new e(0);for(let e in i._data=new Uint32Array(this._data),i.length=this.length,this._combined)i._combined[e]=this._combined[e];for(let e in this._extendedAttrs)i._extendedAttrs[e]=this._extendedAttrs[e];return i.isWrapped=this.isWrapped,i}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||0x3000000&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,i,r,s,n){let o=e._data;if(n)for(let n=s-1;n>=0;n--){for(let e=0;e<3;e++)this._data[(r+n)*3+e]=o[(i+n)*3+e];0x10000000&o[(i+n)*3+2]&&(this._extendedAttrs[r+n]=e._extendedAttrs[i+n])}else for(let n=0;n<s;n++){for(let e=0;e<3;e++)this._data[(r+n)*3+e]=o[(i+n)*3+e];0x10000000&o[(i+n)*3+2]&&(this._extendedAttrs[r+n]=e._extendedAttrs[i+n])}let l=Object.keys(e._combined);for(let s=0;s<l.length;s++){let n=parseInt(l[s],10);n>=i&&(this._combined[n-i+r]=e._combined[n])}}translateToString(e,i,r,s){i=i??0,r=r??this.length,e&&(r=Math.min(r,this.getTrimmedLength())),s&&(s.length=0);let n="";for(;i<r;){let e=this._data[3*i+0],r=2097151&e,o=2097152&e?this._combined[i]:r?z(r):" ";if(n+=o,s)for(let e=0;e<o.length;++e)s.push(i);i+=e>>22||1}return s&&s.push(i),n}};function r5(e,i,r){if(i===e.length-1)return e[i].getTrimmedLength();let s=!e[i].hasContent(r-1)&&1===e[i].getWidth(r-1),n=2===e[i+1].getWidth(0);return s&&n?r-1:r}var r3=class e{constructor(i){this.line=i,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new eV),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),eC(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};r3._nextId=1;var r4={},r6=r4.B;r4[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:"≥","{":"π","|":"≠","}":"£","~":"·"},r4.A={"#":"£"},r4.B=void 0,r4[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},r4.C=r4[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r4.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},r4.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},r4.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},r4.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},r4.E=r4[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},r4.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},r4.H=r4[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r4["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var r9=class{constructor(e,i,r){this._hasScrollback=e,this._optionsService=i,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=r0.clone(),this.savedCharset=r6,this.markers=[],this._nullCell=U.fromCharData([0,"",1,0]),this._whitespaceCell=U.fromCharData([0," ",1,32]),this._isClearing=!1,this._memoryCleanupQueue=new rD,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new rQ(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 $),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 $),this._whitespaceCell}getBlankLine(e,i){return new r2(this._bufferService.cols,this.getNullCell(e),i)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let i=e+this._optionsService.rawOptions.scrollback;return i>0xffffffff?0xffffffff:i}fillViewportRows(e){if(0===this.lines.length){void 0===e&&(e=r0);let i=this._rows;for(;i--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new rQ(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,i){let r=this.getNullCell(r0),s=0,n=this._getCorrectBufferLength(i);if(n>this.lines.maxLength&&(this.lines.maxLength=n),this.lines.length>0){if(this._cols<e)for(let i=0;i<this.lines.length;i++)s+=+this.lines.get(i).resize(e,r);let o=0;if(this._rows<i)for(let s=this._rows;s<i;s++)this.lines.length<i+this.ybase&&(this._optionsService.rawOptions.windowsMode||void 0!==this._optionsService.rawOptions.windowsPty.backend||void 0!==this._optionsService.rawOptions.windowsPty.buildNumber?this.lines.push(new r2(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new r2(e,r)));else for(let e=this._rows;e>i;e--)this.lines.length>i+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(n<this.lines.maxLength){let e=this.lines.length-n;e>0&&(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=n}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,i-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=i-1,this._isReflowEnabled&&(this._reflow(e,i),this._cols>e))for(let i=0;i<this.lines.length;i++)s+=+this.lines.get(i).resize(e,r);this._cols=e,this._rows=i,this._memoryCleanupQueue.clear(),s>.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 i=0;for(;this._memoryCleanupPosition<this.lines.length;)if((i+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory())>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&"conpty"===e.backend&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,i){this._cols!==e&&(e>this._cols?this._reflowLarger(e,i):this._reflowSmaller(e,i))}_reflowLarger(e,i){let r=this._optionsService.rawOptions.reflowCursorLine,s=function(e,i,r,s,n,o){let l=[];for(let a=0;a<e.length-1;a++){let h=a,c=e.get(++h);if(!c.isWrapped)continue;let u=[e.get(a)];for(;h<e.length&&c.isWrapped;)u.push(c),c=e.get(++h);if(!o&&s>=a&&s<h){a+=u.length-1;continue}let d=0,f=r5(u,0,i),_=1,p=0;for(;_<u.length;){let e=r5(u,_,i),s=Math.min(e-p,r-f);u[d].copyCellsFrom(u[_],p,f,s,!1),(f+=s)===r&&(d++,f=0),(p+=s)===e&&(_++,p=0),0===f&&0!==d&&2===u[d-1].getWidth(r-1)&&(u[d].copyCellsFrom(u[d-1],r-1,f++,1,!1),u[d-1].setCell(r-1,n))}u[d].replaceCells(f,r,n);let g=0;for(let e=u.length-1;e>0&&(e>d||0===u[e].getTrimmedLength());e--)g++;g>0&&(l.push(a+u.length-g),l.push(g)),a+=u.length-1}return l}(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(r0),r);if(s.length>0){let r=function(e,i){let r=[],s=0,n=i[0],o=0;for(let l=0;l<e.length;l++)if(n===l){let r=i[++s];e.onDeleteEmitter.fire({index:l-o,amount:r}),l+=r-1,o+=r,n=i[++s]}else r.push(l);return{layout:r,countRemoved:o}}(this.lines,s);(function(e,i){let r=[];for(let s=0;s<i.length;s++)r.push(e.get(i[s]));for(let i=0;i<r.length;i++)e.set(i,r[i]);e.length=i.length})(this.lines,r.layout),this._reflowLargerAdjustViewport(e,i,r.countRemoved)}}_reflowLargerAdjustViewport(e,i,r){let s=this.getNullCell(r0),n=r;for(;n-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length<i&&this.lines.push(new r2(e,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,i){let r=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(r0),n=[],o=0;for(let l=this.lines.length-1;l>=0;l--){let a=this.lines.get(l);if(!a||!a.isWrapped&&a.getTrimmedLength()<=e)continue;let h=[a];for(;a.isWrapped&&l>0;)a=this.lines.get(--l),h.unshift(a);if(!r){let e=this.ybase+this.y;if(e>=l&&e<l+h.length)continue}let c=h[h.length-1].getTrimmedLength(),u=function(e,i,r){let s=[],n=e.map((r,s)=>r5(e,s,i)).reduce((e,i)=>e+i),o=0,l=0,a=0;for(;a<n;){if(n-a<r){s.push(n-a);break}o+=r;let h=r5(e,l,i);o>h&&(o-=h,l++);let c=2===e[l].getWidth(o-1);c&&o--;let u=c?r-1:r;s.push(u),a+=u}return s}(h,this._cols,e),d=u.length-h.length,f;f=0===this.ybase&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let _=[];for(let e=0;e<d;e++){let e=this.getBlankLine(r0,!0);_.push(e)}_.length>0&&(n.push({start:l+h.length+o,newLines:_}),o+=_.length),h.push(..._);let p=u.length-1,g=u[p];0===g&&(g=u[--p]);let m=h.length-d-1,v=c;for(;m>=0;){let e=Math.min(v,g);if(void 0===h[p])break;h[p].copyCellsFrom(h[m],v-e,g-e,e,!0),0==(g-=e)&&(g=u[--p]),0==(v-=e)&&(v=r5(h,Math.max(--m,0),this._cols))}for(let i=0;i<h.length;i++)u[i]<e&&h[i].setCell(u[i],s);let S=d-f;for(;S-- >0;)0===this.ybase?this.y<i-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+o)-i&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+i-1)}if(n.length>0){let e=[],i=[];for(let e=0;e<this.lines.length;e++)i.push(this.lines.get(e));let r=this.lines.length,s=r-1,l=0,a=n[0];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let h=0;for(let c=Math.min(this.lines.maxLength-1,r+o-1);c>=0;c--)if(a&&a.start>s+h){for(let e=a.newLines.length-1;e>=0;e--)this.lines.set(c--,a.newLines[e]);c++,e.push({index:s+1,amount:a.newLines.length}),h+=a.newLines.length,a=n[++l]}else this.lines.set(c,i[s--]);let c=0;for(let i=e.length-1;i>=0;i--)e[i].index+=c,this.lines.onInsertEmitter.fire(e[i]),c+=e[i].amount;let u=Math.max(0,r+o-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,i,r=0,s){let n=this.lines.get(e);return n?n.translateToString(i,r,s):""}getWrappedRangeForLine(e){let i=e,r=e;for(;i>0&&this.lines.get(i).isWrapped;)i--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:i,last:r}}setupTabStops(e){for(null!=e?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(null==e&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(null==e&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let i=0;i<this.markers.length;i++)this.markers[i].line===e&&(this.markers[i].dispose(),this.markers.splice(i--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let i=new r3(e);return this.markers.push(i),i.register(this.lines.onTrim(e=>{i.line-=e,i.line<0&&i.dispose()})),i.register(this.lines.onInsert(e=>{i.line>=e.index&&(i.line+=e.amount)})),i.register(this.lines.onDelete(e=>{i.line>=e.index&&i.line<e.index+e.amount&&i.dispose(),i.line>e.index&&(i.line-=e.amount)})),i.register(i.onDispose(()=>this._removeMarker(i))),i}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},r8=class extends eR{constructor(e,i){super(),this._optionsService=e,this._bufferService=i,this._onBufferActivate=this._register(new eV),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 r9(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new r9(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,i){this._normal.resize(e,i),this._alt.resize(e,i),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},r7=class extends eR{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new eV),this.onResize=this._onResize.event,this._onScroll=this._register(new eV),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,2),this.rows=Math.max(e.rawOptions.rows||0,1),this.buffers=this._register(new r8(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,i){let r=this.cols!==e,s=this.rows!==i;this.cols=e,this.rows=i,this.buffers.resize(e,i),this._onResize.fire({cols:e,rows:i,colsChanged:r,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,i=!1){let r=this.buffer,s;(s=this._cachedBlankLine)&&s.length===this.cols&&s.getFg(0)===e.fg&&s.getBg(0)===e.bg||(s=r.getBlankLine(e,i),this._cachedBlankLine=s),s.isWrapped=i;let n=r.ybase+r.scrollTop,o=r.ybase+r.scrollBottom;if(0===r.scrollTop){let e=r.lines.isFull;o===r.lines.length-1?e?r.lines.recycle().copyFrom(s):r.lines.push(s.clone()):r.lines.splice(o+1,0,s.clone()),e?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let e=o-n+1;r.lines.shiftElements(n+1,e-1,-1),r.lines.set(o,s.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,i){let r=this.buffer;if(e<0){if(0===r.ydisp)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let s=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),s!==r.ydisp&&(i||this._onScroll.fire(r.ydisp))}};r7=B([L(0,et)],r7);var se={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:rv,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},st=["normal","bold","100","200","300","400","500","600","700","800","900"],si=class extends eR{constructor(e){super(),this._onOptionChange=this._register(new eV),this.onOptionChange=this._onOptionChange.event;let i={...se};for(let r in e)if(r in i)try{let s=e[r];i[r]=this._sanitizeAndValidateOption(r,s)}catch(e){console.error(e)}this.rawOptions=i,this.options={...i},this._setupOptions(),this._register(ek(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,i){return this.onOptionChange(r=>{r===e&&i(this.rawOptions[e])})}onMultipleOptionChange(e,i){return this.onOptionChange(r=>{-1!==e.indexOf(r)&&i()})}_setupOptions(){let e=e=>{if(!(e in se))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},i=(e,i)=>{if(!(e in se))throw Error(`No option with key "${e}"`);i=this._sanitizeAndValidateOption(e,i),this.rawOptions[e]!==i&&(this.rawOptions[e]=i,this._onOptionChange.fire(e))};for(let r in this.rawOptions){let s={get:e.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this.options,r,s)}}_sanitizeAndValidateOption(e,i){switch(e){case"cursorStyle":var r;if(i||(i=se[e]),"block"!==(r=i)&&"underline"!==r&&"bar"!==r)throw Error(`"${i}" is not a valid value for ${e}`);break;case"wordSeparator":i||(i=se[e]);break;case"fontWeight":case"fontWeightBold":if("number"==typeof i&&1<=i&&i<=1e3)break;i=st.includes(i)?i:se[e];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw Error(`${e} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,0xffffffff))<0)throw Error(`${e} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&0!==i)throw Error(`${e} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{}}return i}};function sr(e,i=5){if("object"!=typeof e)return e;let r=Array.isArray(e)?[]:{};for(let s in e)r[s]=i<=1?e[s]:e[s]&&sr(e[s],i-1);return r}var ss=Object.freeze({insertMode:!1}),sn=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),so=class extends eR{constructor(e,i,r){super(),this._bufferService=e,this._logService=i,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new eV),this.onData=this._onData.event,this._onUserInput=this._register(new eV),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new eV),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new eV),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=sr(ss),this.decPrivateModes=sr(sn)}reset(){this.modes=sr(ss),this.decPrivateModes=sr(sn)}triggerDataEvent(e,i=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),i&&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))}};so=B([L(0,X),L(1,ee),L(2,et)],so);var sl={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>32!==e.action},DRAG:{events:23,restrict:e=>32!==e.action||3!==e.button},ANY:{events:31,restrict:e=>!0}};function sa(e,i){let r=16*!!e.ctrl|4*!!e.shift|8*!!e.alt;return 4===e.button?(r|=64,r|=e.action):(r|=3&e.button,4&e.button&&(r|=64),8&e.button&&(r|=128),32===e.action?r|=32:0!==e.action||i||(r|=3)),r}var sh=String.fromCharCode,sc={DEFAULT:e=>{let i=[sa(e,!1)+32,e.col+32,e.row+32];return i[0]>255||i[1]>255||i[2]>255?"":`\x1b[M${sh(i[0])}${sh(i[1])}${sh(i[2])}`},SGR:e=>{let i=0===e.action&&4!==e.button?"m":"M";return`\x1b[<${sa(e,!0)};${e.col};${e.row}${i}`},SGR_PIXELS:e=>{let i=0===e.action&&4!==e.button?"m":"M";return`\x1b[<${sa(e,!0)};${e.x};${e.y}${i}`}},su=class extends eR{constructor(e,i,r){for(let s of(super(),this._bufferService=e,this._coreService=i,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new eV),this.onProtocolChange=this._onProtocolChange.event,Object.keys(sl)))this.addProtocol(s,sl[s]);for(let e of Object.keys(sc))this.addEncoding(e,sc[e]);this.reset()}addProtocol(e,i){this._protocols[e]=i}addEncoding(e,i){this._encodings[e]=i}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return 0!==this._protocols[this._activeProtocol].events}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,i,r){if(0===e.deltaY||e.shiftKey||void 0===i||void 0===r)return 0;let s=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=i/r+0,50>Math.abs(e.deltaY)&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(e,i){return i.altKey||i.ctrlKey||i.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||4===e.button&&32===e.action||3===e.button&&32!==e.action||4!==e.button&&(2===e.action||3===e.action)||(e.col++,e.row++,32===e.action&&this._lastEvent&&this._equalEvents(this._lastEvent,e,"SGR_PIXELS"===this._activeEncoding))||!this._protocols[this._activeProtocol].restrict(e))return!1;let i=this._encodings[this._activeEncoding](e);return i&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(i):this._coreService.triggerDataEvent(i,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,i,r){if(r){if(e.x!==i.x||e.y!==i.y)return!1}else if(e.col!==i.col||e.row!==i.row)return!1;return e.button===i.button&&e.action===i.action&&e.ctrl===i.ctrl&&e.alt===i.alt&&e.shift===i.shift}};su=B([L(0,X),L(1,J),L(2,et)],su);var sd,sf,s_,sp,sg,sm,sv=[[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]],sS=[[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]],sy=class{constructor(){if(this.version="6",!sm){(sm=new Uint8Array(65536)).fill(1),sm[0]=0,sm.fill(0,1,32),sm.fill(0,127,160),sm.fill(2,4352,4448),sm[9001]=2,sm[9002]=2,sm.fill(2,11904,42192),sm[12351]=1,sm.fill(2,44032,55204),sm.fill(2,63744,64256),sm.fill(2,65040,65050),sm.fill(2,65072,65136),sm.fill(2,65280,65377),sm.fill(2,65504,65511);for(let e=0;e<sv.length;++e)sm.fill(0,sv[e][0],sv[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?sm[e]:!function(e,i){let r=0,s=i.length-1,n;if(e<i[0][0]||e>i[s][1])return!1;for(;s>=r;)if(e>i[n=r+s>>1][1])r=n+1;else{if(!(e<i[n][0]))return!0;s=n-1}return!1}(e,sS)?e>=131072&&e<=196605||e>=196608&&e<=262141?2:1:0}charProperties(e,i){let r=this.wcwidth(e),s=0===r&&0!==i;if(s){let e=sb.extractWidth(i);0===e?s=!1:e>r&&(r=e)}return sb.createPropertyValue(0,r,s)}},sb=class e{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new eV,this.onChange=this._onChange.event;let e=new sy;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(1&e)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,i,r=!1){return(0xffffff&e)<<3|(3&i)<<1|!!r}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(i){let r=0,s=0,n=i.length;for(let o=0;o<n;++o){let l=i.charCodeAt(o);if(55296<=l&&l<=56319){if(++o>=n)return r+this.wcwidth(l);let e=i.charCodeAt(o);56320<=e&&e<=57343?l=(l-55296)*1024+e-56320+65536:r+=this.wcwidth(e)}let a=this.charProperties(l,s),h=e.extractWidth(a);e.extractShouldJoin(a)&&(h-=e.extractWidth(s)),r+=h,s=a}return r}charProperties(e,i){return this._activeProvider.charProperties(e,i)}},sx=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,i){this._charsets[e]=i,this.glevel===e&&(this.charset=i)}};function sw(e){let i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&i&&(r.isWrapped=0!==i[3]&&32!==i[3])}var sC=class e{constructor(e=32,i=32){if(this.maxLength=e,this.maxSubParamsLength=i,i>256)throw Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(i){let r=new e;if(!i.length)return r;for(let e=+!!Array.isArray(i[0]);e<i.length;++e){let s=i[e];if(Array.isArray(s))for(let e=0;e<s.length;++e)r.addSubParam(s[e]);else r.addParam(s)}return r}clone(){let i=new e(this.maxLength,this.maxSubParamsLength);return i.params.set(this.params),i.length=this.length,i._subParams.set(this._subParams),i._subParamsLength=this._subParamsLength,i._subParamsIdx.set(this._subParamsIdx),i._rejectDigits=this._rejectDigits,i._rejectSubDigits=this._rejectSubDigits,i._digitIsSub=this._digitIsSub,i}toArray(){let e=[];for(let i=0;i<this.length;++i){e.push(this.params[i]);let r=this._subParamsIdx[i]>>8,s=255&this._subParamsIdx[i];s-r>0&&e.push(Array.prototype.slice.call(this._subParams,r,s))}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>0x7fffffff?0x7fffffff: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>0x7fffffff?0x7fffffff:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let i=this._subParamsIdx[e]>>8,r=255&this._subParamsIdx[e];return r-i>0?this._subParams.subarray(i,r):null}getSubParamsAll(){let e={};for(let i=0;i<this.length;++i){let r=this._subParamsIdx[i]>>8,s=255&this._subParamsIdx[i];s-r>0&&(e[i]=this._subParams.slice(r,s))}return e}addDigit(e){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,s=r[i-1];r[i-1]=~s?Math.min(10*s+e,0x7fffffff):e}},sk=[],sE=class{constructor(){this._state=0,this._active=sk,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,i){void 0===this._handlers[e]&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(i),{dispose:()=>{let e=r.indexOf(i);-1!==e&&r.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=sk}reset(){if(2===this._state)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=sk,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||sk,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")}_put(e,i,r){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,i,r);else this._handlerFb(this._id,"PUT",H(e,i,r))}start(){this.reset(),this._state=1}put(e,i,r){if(3!==this._state){if(1===this._state)for(;i<r;){let r=e[i++];if(59===r){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}-1===this._id&&(this._id=0),this._id=10*this._id+r-48}2===this._state&&r-i>0&&this._put(e,i,r)}}end(e,i=!0){if(0!==this._state){if(3!==this._state)if(1===this._state&&this._start(),this._active.length){let r=!1,s=this._active.length-1,n=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,r=i,n=this._stack.fallThrough,this._stack.paused=!1),!n&&!1===r){for(;s>=0&&!0!==(r=this._active[s].end(e));s--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,r;s--}for(;s>=0;s--)if((r=this._active[s].end(!1))instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,r}else this._handlerFb(this._id,"END",e);this._active=sk,this._id=-1,this._state=0}}},sD=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,i,r){this._hitLimit||(this._data+=H(e,i,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let i=!1;if(this._hitLimit)i=!1;else if(e&&(i=this._handler(this._data))instanceof Promise)return i.then(e=>(this._data="",this._hitLimit=!1,e));return this._data="",this._hitLimit=!1,i}},sR=[],sM=class{constructor(){this._handlers=Object.create(null),this._active=sR,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=sR}registerHandler(e,i){void 0===this._handlers[e]&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(i),{dispose:()=>{let e=r.indexOf(i);-1!==e&&r.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=sR,this._ident=0}hook(e,i){if(this.reset(),this._ident=e,this._active=this._handlers[e]||sR,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(i);else this._handlerFb(this._ident,"HOOK",i)}put(e,i,r){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,i,r);else this._handlerFb(this._ident,"PUT",H(e,i,r))}unhook(e,i=!0){if(this._active.length){let r=!1,s=this._active.length-1,n=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,r=i,n=this._stack.fallThrough,this._stack.paused=!1),!n&&!1===r){for(;s>=0&&!0!==(r=this._active[s].unhook(e));s--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,r;s--}for(;s>=0;s--)if((r=this._active[s].unhook(!1))instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,r}else this._handlerFb(this._ident,"UNHOOK",e);this._active=sR,this._ident=0}},sP=new sC;sP.addParam(0);var sB=class{constructor(e){this._handler=e,this._data="",this._params=sP,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():sP,this._data="",this._hitLimit=!1}put(e,i,r){this._hitLimit||(this._data+=H(e,i,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let i=!1;if(this._hitLimit)i=!1;else if(e&&(i=this._handler(this._data,this._params))instanceof Promise)return i.then(e=>(this._params=sP,this._data="",this._hitLimit=!1,e));return this._params=sP,this._data="",this._hitLimit=!1,i}},sL=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,i){this.table.fill(e<<4|i)}add(e,i,r,s){this.table[i<<8|e]=r<<4|s}addMany(e,i,r,s){for(let n=0;n<e.length;n++)this.table[i<<8|e[n]]=r<<4|s}},sT=function(){let e=new sL(4095),i=Array.apply(null,Array(256)).map((e,i)=>i),r=(e,r)=>i.slice(e,r),s=r(32,127),n=r(0,24);n.push(25),n.push.apply(n,r(28,32));let o=r(0,14),l;for(l in e.setDefault(1,0),e.addMany(s,0,2,0),o)e.addMany([24,26,153,154],l,3,0),e.addMany(r(128,144),l,3,0),e.addMany(r(144,152),l,3,0),e.add(156,l,0,0),e.add(27,l,11,1),e.add(157,l,4,8),e.addMany([152,158,159],l,0,7),e.add(155,l,11,3),e.add(144,l,11,9);return e.addMany(n,0,3,0),e.addMany(n,1,3,1),e.add(127,1,0,1),e.addMany(n,8,0,8),e.addMany(n,3,3,3),e.add(127,3,0,3),e.addMany(n,4,3,4),e.add(127,4,0,4),e.addMany(n,6,3,6),e.addMany(n,5,3,5),e.add(127,5,0,5),e.addMany(n,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,7,0,7),e.addMany(n,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(n,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(n,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(n,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(n,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(n,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(160,0,2,0),e.add(160,8,5,8),e.add(160,6,0,6),e.add(160,11,0,11),e.add(160,13,13,13),e}(),sA=class extends eR{constructor(e=sT){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 sC,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,i,r)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,i)=>{},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(ek(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new sE),this._dcsParser=this._register(new sM),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,i=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw Error("only one byte as prefix supported");if((r=e.prefix.charCodeAt(0))&&60>r||r>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 i=0;i<e.intermediates.length;++i){let s=e.intermediates.charCodeAt(i);if(32>s||s>47)throw Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=s}}if(1!==e.final.length)throw Error("final must be a single byte");let s=e.final.charCodeAt(0);if(i[0]>s||s>i[1])throw Error(`final must be in range ${i[0]} .. ${i[1]}`);return r<<=8,r|=s}identToString(e){let i=[];for(;e;)i.push(String.fromCharCode(255&e)),e>>=8;return i.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,i){let r=this._identifier(e,[48,126]);void 0===this._escHandlers[r]&&(this._escHandlers[r]=[]);let s=this._escHandlers[r];return s.push(i),{dispose:()=>{let e=s.indexOf(i);-1!==e&&s.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,i){this._executeHandlers[e.charCodeAt(0)]=i}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,i){let r=this._identifier(e);void 0===this._csiHandlers[r]&&(this._csiHandlers[r]=[]);let s=this._csiHandlers[r];return s.push(i),{dispose:()=>{let e=s.indexOf(i);-1!==e&&s.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,i){return this._dcsParser.registerHandler(this._identifier(e),i)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,i){return this._oscParser.registerHandler(e,i)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,0!==this._parseStack.state&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,i,r,s,n){this._parseStack.state=e,this._parseStack.handlers=i,this._parseStack.handlerPos=r,this._parseStack.transition=s,this._parseStack.chunkPos=n}parse(e,i,r){let s=0,n=0,o=0,l;if(this._parseStack.state)if(2===this._parseStack.state)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(void 0===r||1===this._parseStack.state)throw this._parseStack.state=1,Error("improper continuation due to previous async handler, giving up parsing");let i=this._parseStack.handlers,n=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===r&&n>-1){for(;n>=0&&!0!==(l=i[n](this._params));n--)if(l instanceof Promise)return this._parseStack.handlerPos=n,l}this._parseStack.handlers=[];break;case 4:if(!1===r&&n>-1){for(;n>=0&&!0!==(l=i[n]());n--)if(l instanceof Promise)return this._parseStack.handlerPos=n,l}this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],l=this._dcsParser.unhook(24!==s&&26!==s,r))return l;27===s&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],l=this._oscParser.end(24!==s&&26!==s,r))return l;27===s&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let r=o;r<i;++r){switch(s=e[r],(n=this._transitions.table[this.currentState<<8|(s<160?s:160)])>>4){case 2:for(let n=r+1;;++n)if(n>=i||(s=e[n])<32||s>126&&s<160||++n>=i||(s=e[n])<32||s>126&&s<160||++n>=i||(s=e[n])<32||s>126&&s<160||++n>=i||(s=e[n])<32||s>126&&s<160){this._printHandler(e,r,n),r=n-1;break}break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:r,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let o=this._csiHandlers[this._collect<<8|s],a=o?o.length-1:-1;for(;a>=0&&!0!==(l=o[a](this._params));a--)if(l instanceof Promise)return this._preserveStack(3,o,a,n,r),l;a<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}while(++r<i&&(s=e[r])>47&&s<60)r--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let h=this._escHandlers[this._collect<<8|s],c=h?h.length-1:-1;for(;c>=0&&!0!==(l=h[c]());c--)if(l instanceof Promise)return this._preserveStack(4,h,c,n,r),l;c<0&&this._escHandlerFb(this._collect<<8|s),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|s,this._params);break;case 13:for(let n=r+1;;++n)if(n>=i||24===(s=e[n])||26===s||27===s||s>127&&s<160){this._dcsParser.put(e,r,n),r=n-1;break}break;case 14:if(l=this._dcsParser.unhook(24!==s&&26!==s))return this._preserveStack(6,[],0,n,r),l;27===s&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let n=r+1;;n++)if(n>=i||(s=e[n])<32||s>127&&s<160){this._oscParser.put(e,r,n),r=n-1;break}break;case 6:if(l=this._oscParser.end(24!==s&&26!==s))return this._preserveStack(5,[],0,n,r),l;27===s&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&n}}},sN=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,sO=/^[\da-f]+$/;function sI(e){if(!e)return;let i=e.toLowerCase();if(0===i.indexOf("rgb:")){i=i.slice(4);let e=sN.exec(i);if(e){let i=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/i*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/i*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/i*255)]}}else if(0===i.indexOf("#")&&(i=i.slice(1),sO.exec(i)&&[3,6,9,12].includes(i.length))){let e=i.length/3,r=[0,0,0];for(let s=0;s<3;++s){let n=parseInt(i.slice(e*s,e*s+e),16);r[s]=1===e?n<<4:2===e?n:3===e?n>>4:n>>8}return r}}function sz(e,i){let r=e.toString(16),s=r.length<2?"0"+r:r;switch(i){case 4:return r[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}var sH={"(":0,")":1,"*":2,"+":3,"-":1,".":2};function sF(e,i){if(e>24)return i.setWinLines||!1;switch(e){case 1:return!!i.restoreWin;case 2:return!!i.minimizeWin;case 3:return!!i.setWinPosition;case 4:return!!i.setWinSizePixels;case 5:return!!i.raiseWin;case 6:return!!i.lowerWin;case 7:return!!i.refreshWin;case 8:return!!i.setWinSizeChars;case 9:return!!i.maximizeWin;case 10:return!!i.fullscreenWin;case 11:return!!i.getWinState;case 13:return!!i.getWinPosition;case 14:return!!i.getWinSizePixels;case 15:return!!i.getScreenSizePixels;case 16:return!!i.getCellSizePixels;case 18:return!!i.getWinSizeChars;case 19:return!!i.getScreenSizeChars;case 20:return!!i.getIconTitle;case 21:return!!i.getWinTitle;case 22:return!!i.pushTitle;case 23:return!!i.popTitle;case 24:return!!i.setWinLines}return!1}var sj=0,sW=class extends eR{constructor(e,i,r,s,n,o,l,a,h=new sA){for(let c in super(),this._bufferService=e,this._charsetService=i,this._coreService=r,this._logService=s,this._optionsService=n,this._oscLinkService=o,this._coreMouseService=l,this._unicodeService=a,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new F,this._utf8Decoder=new j,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=r0.clone(),this._eraseAttrDataInternal=r0.clone(),this._onRequestBell=this._register(new eV),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new eV),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new eV),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new eV),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new eV),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new eV),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new eV),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new eV),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new eV),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new eV),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new eV),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new eV),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new eV),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 s$(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,i)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(e),params:i.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,i,r)=>{this._logService.debug("Unknown OSC code: ",{identifier:e,action:i,data:r})}),this._parser.setDcsHandlerFallback((e,i,r)=>{"HOOK"===i&&(r=r.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(e),action:i,payload:r})}),this._parser.setPrintHandler((e,i,r)=>this.print(e,i,r)),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(iM.BEL,()=>this.bell()),this._parser.setExecuteHandler(iM.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(iM.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(iM.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(iM.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(iM.BS,()=>this.backspace()),this._parser.setExecuteHandler(iM.HT,()=>this.tab()),this._parser.setExecuteHandler(iM.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(iM.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(iP.IND,()=>this.index()),this._parser.setExecuteHandler(iP.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(iP.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new sD(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new sD(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new sD(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new sD(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new sD(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new sD(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new sD(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new sD(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new sD(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new sD(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new sD(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new sD(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()),r4)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));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 sB((e,i)=>this.requestStatusString(e,i)))}getAttrData(){return this._curAttrData}_preserveStack(e,i,r,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=i,this._parseStack.decodedLength=r,this._parseStack.position=s}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),5e3))]).catch(e=>{if("#SLOW_TIMEOUT"!==e)throw e;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,i){let r,s=this._activeBuffer.x,n=this._activeBuffer.y,o=0,l=this._parseStack.paused;if(l){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,i))return this._logSlowResolvingAsync(r),r;s=this._parseStack.cursorStartX,n=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>131072&&(o=this._parseStack.position+131072)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${"string"==typeof e?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join("")}"`}`),0===this._logService.logLevel&&this._logService.trace("parsing data (codes)","string"==typeof e?e.split("").map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<131072&&(this._parseBuffer=new Uint32Array(Math.min(e.length,131072))),l||this._dirtyRowTracker.clearRange(),e.length>131072)for(let i=o;i<e.length;i+=131072){let o=i+131072<e.length?i+131072:e.length,l="string"==typeof e?this._stringDecoder.decode(e.substring(i,o),this._parseBuffer):this._utf8Decoder.decode(e.subarray(i,o),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,l))return this._preserveStack(s,n,l,i),this._logSlowResolvingAsync(r),r}else if(!l){let i="string"==typeof e?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,i))return this._preserveStack(s,n,i,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==s||this._activeBuffer.y!==n)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),h=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);h<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(h,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(e,i,r){let s,n,o=this._charsetService.charset,l=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,h=this._coreService.decPrivateModes.wraparound,c=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-i>0&&2===d.getWidth(this._activeBuffer.x-1)&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let _=i;_<r;++_){if((s=e[_])<127&&o){let e=o[String.fromCharCode(s)];e&&(s=e.charCodeAt(0))}let i=this._unicodeService.charProperties(s,f);n=sb.extractWidth(i);let r=sb.extractShouldJoin(i),p=r?sb.extractWidth(f):0;if(f=i,l&&this._onA11yChar.fire(z(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+n-p>a){if(h){let e=d,i=this._activeBuffer.x-p;for(this._activeBuffer.x=p,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),p>0&&d instanceof r2&&d.copyCellsFrom(e,i,0,p,!1);i<a;)e.setCellFromCodepoint(i++,0,1,u)}else if(this._activeBuffer.x=a-1,2===n)continue}if(r&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,s,n);for(let e=n-p;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(c&&(d.insertCells(this._activeBuffer.x,n-p,this._activeBuffer.getNullCell(u)),2===d.getWidth(a-1)&&d.setCellFromCodepoint(a-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,s,n,u),n>0)for(;--n;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<a&&r-i>0&&0===d.getWidth(this._activeBuffer.x)&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,i){return"t"!==e.final||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,i):this._parser.registerCsiHandler(e,e=>!sF(e.params[0],this._optionsService.rawOptions.windowOptions)||i(e))}registerDcsHandler(e,i){return this._parser.registerDcsHandler(e,new sB(i))}registerEscHandler(e,i){return this._parser.registerEscHandler(e,i)}registerOscHandler(e,i){return this._parser.registerOscHandler(e,new sD(i))}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(0===this._activeBuffer.x&&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,i){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+i):(this._activeBuffer.x=e,this._activeBuffer.y=i),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,i){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+i)}cursorUp(e){let i=this._activeBuffer.y-this._activeBuffer.scrollTop;return i>=0?this._moveCursor(0,-Math.min(i,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let i=this._activeBuffer.scrollBottom-this._activeBuffer.y;return i>=0?this._moveCursor(0,Math.min(i,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 i=e.params[0];return 0===i?delete this._activeBuffer.tabs[this._activeBuffer.x]:3===i&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=e.params[0]||1;for(;i--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=e.params[0]||1;for(;i--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let i=e.params[0];return 1===i&&(this._curAttrData.bg|=0x20000000),(2===i||0===i)&&(this._curAttrData.bg&=-0x20000001),!0}_eraseInBufferLine(e,i,r,s=!1,n=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(i,r,this._activeBuffer.getNullCell(this._eraseAttrData()),n),s&&(o.isWrapped=!1)}_resetBufferLine(e,i=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),i),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,i=!1){let r;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,i);r<this._bufferService.rows;r++)this._resetBufferLine(r,i);this._dirtyRowTracker.markDirty(r);break;case 1:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r,0,this._activeBuffer.x+1,!0,i),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,i);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+r)?.getTrimmedLength(););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,i);this._dirtyRowTracker.markDirty(0)}break;case 3:let s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,0),this._onScroll.fire(0))}return!0}eraseInLine(e,i=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,i);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,i);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,i)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let i=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;i--;)this._activeBuffer.lines.splice(n-1,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let i=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;i--;)this._activeBuffer.lines.splice(r,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let i=e.params[0]||1;for(;i--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let i=e.params[0]||1;for(;i--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(r0));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r.deleteCells(0,i,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r.insertCells(0,i,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r.insertCells(this._activeBuffer.x,i,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r.deleteCells(this._activeBuffer.x,i,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let i=this._parser.precedingJoinState;if(!i)return!0;let r=e.params[0]||1,s=sb.extractWidth(i),n=this._activeBuffer.x-s,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(n),l=new Uint32Array(o.length*r),a=0;for(let e=0;e<o.length;){let i=o.codePointAt(e)||0;l[a++]=i,e+=i>65535?2:1}let h=a;for(let e=1;e<r;++e)l.copyWithin(h,0,a),h+=a;return this.print(l,0,h),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(iM.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(iM.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(iM.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(iM.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(iM.ESC+"[>83;40003;0c")),!0}_is(e){return 0===(this._optionsService.rawOptions.termName+"").indexOf(e)}setMode(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,r6),this._charsetService.setgCharset(1,r6),this._charsetService.setgCharset(2,r6),this._charsetService.setgCharset(3,r6);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0}return!0}resetMode(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),1049===e.params[i]&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0)}return!0}requestMode(e,i){let r,s,n,o;(s=r||={})[s.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",s[s.SET=1]="SET",s[s.RESET=2]="RESET",s[s.PERMANENTLY_SET=3]="PERMANENTLY_SET",s[s.PERMANENTLY_RESET=4]="PERMANENTLY_RESET";let l=this._coreService.decPrivateModes,{activeProtocol:a,activeEncoding:h}=this._coreMouseService,c=this._coreService,{buffers:u,cols:d}=this._bufferService,{active:f,alt:_}=u,p=this._optionsService.rawOptions,g=e=>e?1:2,m=e.params[0];return n=m,o=i?2===m?4:4===m?g(c.modes.insertMode):12===m?3:20===m?g(p.convertEol):0:1===m?g(l.applicationCursorKeys):3===m?p.windowOptions.setWinLines?80===d?2:+(132===d):0:6===m?g(l.origin):7===m?g(l.wraparound):8===m?3:9===m?g("X10"===a):12===m?g(p.cursorBlink):25===m?g(!c.isCursorHidden):45===m?g(l.reverseWraparound):66===m?g(l.applicationKeypad):67===m?4:1e3===m?g("VT200"===a):1002===m?g("DRAG"===a):1003===m?g("ANY"===a):1004===m?g(l.sendFocus):1005===m?4:1006===m?g("SGR"===h):1015===m?4:1016===m?g("SGR_PIXELS"===h):1048===m?1:47===m||1047===m||1049===m?g(f===_):2004===m?g(l.bracketedPasteMode):2026===m?g(l.synchronizedOutput):0,c.triggerDataEvent(`${iM.ESC}[${i?"":"?"}${n};${o}$y`),!0}_updateAttrColor(e,i,r,s,n){return 2===i?(e|=0x3000000,e&=-0x1000000,e|=W.fromColorRGB([r,s,n])):5===i&&(e&=-0x3000100,e|=0x2000000|255&r),e}_extractColor(e,i,r){let s=[0,0,-1,0,0,0],n=0,o=0;do{if(s[o+n]=e.params[i+o],e.hasSubParams(i+o)){let r=e.getSubParams(i+o),l=0;do 5===s[1]&&(n=1),s[o+l+1+n]=r[l];while(++l<r.length&&l+o+1+n<s.length)break}if(5===s[1]&&o+n>=2||2===s[1]&&o+n>=5)break;s[1]&&(n=1)}while(++o+i<e.length&&o+n<s.length)for(let e=2;e<s.length;++e)-1===s[e]&&(s[e]=0);switch(s[0]){case 38:r.fg=this._updateAttrColor(r.fg,s[1],s[3],s[4],s[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,s[1],s[3],s[4],s[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,s[1],s[3],s[4],s[5])}return o}_processUnderline(e,i){i.extended=i.extended.clone(),(!~e||e>5)&&(e=1),i.extended.underlineStyle=e,i.fg|=0x10000000,0===e&&(i.fg&=-0x10000001),i.updateExtended()}_processSGR0(e){e.fg=r0.fg,e.bg=r0.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-0x4000000,e.updateExtended()}charAttributes(e){if(1===e.length&&0===e.params[0])return this._processSGR0(this._curAttrData),!0;let i=e.length,r,s=this._curAttrData;for(let n=0;n<i;n++)(r=e.params[n])>=30&&r<=37?(s.fg&=-0x3000100,s.fg|=0x1000000|r-30):r>=40&&r<=47?(s.bg&=-0x3000100,s.bg|=0x1000000|r-40):r>=90&&r<=97?(s.fg&=-0x3000100,s.fg|=0x1000000|r-90|8):r>=100&&r<=107?(s.bg&=-0x3000100,s.bg|=0x1000000|r-100|8):0===r?this._processSGR0(s):1===r?s.fg|=0x8000000:3===r?s.bg|=0x4000000:4===r?(s.fg|=0x10000000,this._processUnderline(e.hasSubParams(n)?e.getSubParams(n)[0]:1,s)):5===r?s.fg|=0x20000000:7===r?s.fg|=0x4000000:8===r?s.fg|=0x40000000:9===r?s.fg|=0x80000000:2===r?s.bg|=0x8000000:21===r?this._processUnderline(2,s):22===r?(s.fg&=-0x8000001,s.bg&=-0x8000001):23===r?s.bg&=-0x4000001:24===r?(s.fg&=-0x10000001,this._processUnderline(0,s)):25===r?s.fg&=-0x20000001:27===r?s.fg&=-0x4000001:28===r?s.fg&=-0x40000001:29===r?s.fg&=0x7fffffff:39===r?(s.fg&=-0x4000000,s.fg|=0xffffff&r0.fg):49===r?(s.bg&=-0x4000000,s.bg|=0xffffff&r0.bg):38===r||48===r||58===r?n+=this._extractColor(e,n,s):53===r?s.bg|=0x40000000:55===r?s.bg&=-0x40000001:59===r?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):100===r?(s.fg&=-0x4000000,s.fg|=0xffffff&r0.fg,s.bg&=-0x4000000,s.bg|=0xffffff&r0.bg):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${iM.ESC}[0n`);break;case 6:let i=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${iM.ESC}[${i};${r}R`)}return!0}deviceStatusPrivate(e){if(6===e.params[0]){let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${iM.ESC}[?${e};${i}R`)}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=r0.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 i=0===e.length?1:e.params[0];if(0===i)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(i){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"}this._coreService.decPrivateModes.cursorBlink=i%2==1}return!0}setScrollRegion(e){let i=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||0===r)&&(r=this._bufferService.rows),r>i&&(this._activeBuffer.scrollTop=i-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!sF(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let i=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==i&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${iM.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(0===i||2===i)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),(0===i||1===i)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:(0===i||2===i)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(0===i||1===i)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}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 i=[],r=e.split(";");for(;r.length>1;){let e=r.shift(),s=r.shift();if(/^\d+$/.exec(e)){let r=parseInt(e);if(sU(r))if("?"===s)i.push({type:0,index:r});else{let e=sI(s);e&&i.push({type:1,index:r,color:e})}}}return i.length&&this._onColor.fire(i),!0}setHyperlink(e){let i=e.indexOf(";");if(-1===i)return!0;let r=e.slice(0,i).trim(),s=e.slice(i+1);return s?this._createHyperlink(r,s):!r.trim()&&this._finishHyperlink()}_createHyperlink(e,i){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),s,n=r.findIndex(e=>e.startsWith("id="));return -1!==n&&(s=r[n].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:i}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,i){let r=e.split(";");for(let e=0;e<r.length&&!(i>=this._specialColors.length);++e,++i)if("?"===r[e])this._onColor.fire([{type:0,index:this._specialColors[i]}]);else{let s=sI(r[e]);s&&this._onColor.fire([{type:1,index:this._specialColors[i],color:s}])}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 i=[],r=e.split(";");for(let e=0;e<r.length;++e)if(/^\d+$/.exec(r[e])){let s=parseInt(r[e]);sU(s)&&i.push({type:2,index:s})}return i.length&&this._onColor.fire(i),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,r6),!0}selectCharset(e){return 2!==e.length?this.selectDefaultCharset():"/"===e[0]||this._charsetService.setgCharset(sH[e[0]],r4[e[1]]||r6),!0}index(){return this._restrictCursor(),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._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=r0.clone(),this._eraseAttrDataInternal=r0.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-0x4000000,this._eraseAttrDataInternal.bg|=0x3ffffff&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new U;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let i=0;i<this._bufferService.rows;++i){let r=this._activeBuffer.ybase+this._activeBuffer.y+i,s=this._activeBuffer.lines.get(r);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,i){let r=e=>(this._coreService.triggerDataEvent(`${iM.ESC}${e}${iM.ESC}\\`),!0),s=this._bufferService.buffer,n=this._optionsService.rawOptions;return r('"q'===e?`P1$r${+!!this._curAttrData.isProtected()}"q`:'"p'===e?'P1$r61;1"p':"r"===e?`P1$r${s.scrollTop+1};${s.scrollBottom+1}r`:"m"===e?"P1$r0m":" q"===e?`P1$r${({block:2,underline:4,bar:6})[n.cursorStyle]-!!n.cursorBlink} q`:"P0$r")}markRangeDirty(e,i){this._dirtyRowTracker.markRangeDirty(e,i)}},s$=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,i){e>i&&(sj=e,e=i,i=sj),e<this.start&&(this.start=e),i>this.end&&(this.end=i)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function sU(e){return 0<=e&&e<256}s$=B([L(0,X)],s$);var sK=class extends eR{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 eV),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,i){let r;if(void 0!==i&&this._syncCalls>i){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,!this._isSyncWriting){for(this._isSyncWriting=!0;r=this._writeBuffer.shift();){this._action(r);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=0x7fffffff,this._isSyncWriting=!1,this._syncCalls=0}}write(e,i){if(this._pendingData>5e7)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(i),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i)}_innerWrite(e=0,i=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],s=this._action(e,i);if(s){let e=e=>performance.now()-r>=12?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(r,e);s.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e);return}let n=this._callbacks[this._bufferOffset];if(n&&n(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-r>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(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()}},sq=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let i=this._bufferService.buffer;if(void 0===e.id){let r=i.addMarker(i.ybase+i.y),s={data:e,id:this._nextId++,lines:[r]};return r.onDispose(()=>this._removeMarkerFromLink(s,r)),this._dataByLinkId.set(s.id,s),s.id}let r=this._getEntryIdKey(e),s=this._entriesWithId.get(r);if(s)return this.addLineToLink(s.id,i.ybase+i.y),s.id;let n=i.addMarker(i.ybase+i.y),o={id:this._nextId++,key:this._getEntryIdKey(e),data:e,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(o,n)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,i){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(e=>e.line!==i)){let e=this._bufferService.buffer.addMarker(i);r.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(r,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,i){let r=e.lines.indexOf(i);-1!==r&&(e.lines.splice(r,1),0===e.lines.length&&(void 0!==e.data.id&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};sq=B([L(0,X)],sq);var sV=!1,sY=class extends eR{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new eM),this._onBinary=this._register(new eV),this.onBinary=this._onBinary.event,this._onData=this._register(new eV),this.onData=this._onData.event,this._onLineFeed=this._register(new eV),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new eV),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new eV),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new eV),this._instantiationService=new rG,this.optionsService=this._register(new si(e)),this._instantiationService.setService(et,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(r7)),this._instantiationService.setService(X,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(rZ)),this._instantiationService.setService(ee,this._logService),this.coreService=this._register(this._instantiationService.createInstance(so)),this._instantiationService.setService(J,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(su)),this._instantiationService.setService(G,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(sb)),this._instantiationService.setService(er,this.unicodeService),this._charsetService=this._instantiationService.createInstance(sx),this._instantiationService.setService(Z,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(sq),this._instantiationService.setService(ei,this._oscLinkService),this._inputHandler=this._register(new sW(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(eF.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(eF.forward(this._bufferService.onResize,this._onResize)),this._register(eF.forward(this.coreService.onData,this._onData)),this._register(eF.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 sK((e,i)=>this._inputHandler.parse(e,i))),this._register(eF.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new eV),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let i in e)this.optionsService.options[i]=e[i]}write(e,i){this._writeBuffer.write(e,i)}writeSync(e,i){this._logService.logLevel<=3&&!sV&&(this._logService.warn("writeSync is unreliable and will be removed soon."),sV=!0),this._writeBuffer.writeSync(e,i)}input(e,i=!0){this.coreService.triggerDataEvent(e,i)}resize(e,i){isNaN(e)||isNaN(i)||(e=Math.max(e,2),i=Math.max(i,1),this._bufferService.resize(e,i))}scroll(e,i=!1){this._bufferService.scroll(e,i)}scrollLines(e,i){this._bufferService.scrollLines(e,i)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;0!==i&&this.scrollLines(i)}registerEscHandler(e,i){return this._inputHandler.registerEscHandler(e,i)}registerDcsHandler(e,i){return this._inputHandler.registerDcsHandler(e,i)}registerCsiHandler(e,i){return this._inputHandler.registerCsiHandler(e,i)}registerOscHandler(e,i){return this._inputHandler.registerOscHandler(e,i)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,i=this.optionsService.rawOptions.windowsPty;i&&void 0!==i.buildNumber&&void 0!==i.buildNumber?e="conpty"===i.backend&&i.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(sw.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(sw(this._bufferService),!1))),this._windowsWrappingHeuristics.value=ek(()=>{for(let i of e)i.dispose()})}}},sX={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:["'",'"']},sG=0,sJ=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new rD,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new rD,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(),0===this._insertedValues.length&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,i)=>this._getKey(e)-this._getKey(i)),i=0,r=0,s=Array(this._array.length+this._insertedValues.length);for(let n=0;n<s.length;n++)r>=this._array.length||this._getKey(e[i])<=this._getKey(this._array[r])?(s[n]=e[i],i++):s[n]=this._array[r++];this._array=s,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),0===this._array.length)return!1;let i=this._getKey(e);if(void 0===i||-1===(sG=this._search(i))||this._getKey(this._array[sG])!==i)return!1;do if(this._array[sG]===e)return 0===this._deletedIndices.length&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(sG),!0;while(++sG<this._array.length&&this._getKey(this._array[sG])===i)return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,i)=>e-i),i=0,r=Array(this._array.length-e.length),s=0;for(let n=0;n<this._array.length;n++)e[i]===n?i++:r[s++]=this._array[n];this._array=r,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&!((sG=this._search(e))<0||sG>=this._array.length)&&this._getKey(this._array[sG])===e)do yield this._array[sG];while(++sG<this._array.length&&this._getKey(this._array[sG])===e)}forEachByKey(e,i){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&!((sG=this._search(e))<0||sG>=this._array.length)&&this._getKey(this._array[sG])===e)do i(this._array[sG]);while(++sG<this._array.length&&this._getKey(this._array[sG])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let i=0,r=this._array.length-1;for(;r>=i;){let s=i+r>>1,n=this._getKey(this._array[s]);if(n>e)r=s-1;else if(n<e)i=s+1;else{for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}}return i}},sZ=0,sQ=0,s0=class extends eR{constructor(){super(),this._decorations=new sJ(e=>e?.marker.line),this._onDecorationRegistered=this._register(new eV),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new eV),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(ek(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let i=new s1(e);if(i){let e=i.marker.onDispose(()=>i.dispose()),r=i.onDispose(()=>{r.dispose(),i&&(this._decorations.delete(i)&&this._onDecorationRemoved.fire(i),e.dispose())});this._decorations.insert(i),this._onDecorationRegistered.fire(i)}return i}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,i,r){let s=0,n=0;for(let o of this._decorations.getKeyIterator(i))n=(s=o.options.x??0)+(o.options.width??1),e>=s&&e<n&&(!r||(o.options.layer??"bottom")===r)&&(yield o)}forEachDecorationAtCell(e,i,r,s){this._decorations.forEachByKey(i,i=>{sQ=(sZ=i.options.x??0)+(i.options.width??1),e>=sZ&&e<sQ&&(!r||(i.options.layer??"bottom")===r)&&s(i)})}},s1=class extends eD{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new eV),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new eV),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return null===this._cachedBg&&(this.options.backgroundColor?this._cachedBg=s_.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return null===this._cachedFg&&(this.options.foregroundColor?this._cachedFg=s_.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},s2=class{constructor(e,i=1e3){this._renderCallback=e,this._debounceThresholdMS=i,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,i,r){this._rowCount=r,e=void 0!==e?e:0,i=void 0!==i?i:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,i):i;let s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=s-this._lastRefreshMs,i=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},i)}}_innerRefresh(){if(void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return;let e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i)}},s5=class extends eR{constructor(e,i,r,s){super(),this._terminal=e,this._coreBrowserService=r,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let n=this._coreBrowserService.mainDocument;this._accessibilityContainer=n.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=n.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._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=n.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new s2(this._renderRows.bind(this))),!this._terminal.element)throw Error("Cannot enable accessibility before Terminal.open");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(`
16
- `))),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(tJ(n,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(ek(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let i=0;i<e;i++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
17
- `&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=A)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,i){this._liveRegionDebouncer.refresh(e,i,this._terminal.rows)}_renderRows(e,i){let r=this._terminal.buffer,s=r.lines.length.toString();for(let n=e;n<=i;n++){let e=r.lines.get(r.ydisp+n),i=[],o=e?.translateToString(!0,void 0,void 0,i)||"",l=(r.ydisp+n+1).toString(),a=this._rowElements[n];a&&(0===o.length?(a.textContent=" ",this._rowColumns.set(a,[0,1])):(a.textContent=o,this._rowColumns.set(a,i)),a.setAttribute("aria-posinset",l),a.setAttribute("aria-setsize",s),this._alignRowWidth(a))}this._announceCharacters()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,i){let r,s,n=e.target,o=this._rowElements[0===i?1:this._rowElements.length-2];if(n.getAttribute("aria-posinset")!==(0===i?"1":`${this._terminal.buffer.lines.length}`)&&e.relatedTarget===o){if(0===i?(r=n,s=this._rowElements.pop(),this._rowContainer.removeChild(s)):(r=this._rowElements.shift(),s=n,this._rowContainer.removeChild(r)),r.removeEventListener("focus",this._topBoundaryFocusListener),s.removeEventListener("focus",this._bottomBoundaryFocusListener),0===i){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(0===i?-1:1),this._rowElements[0===i?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}}_handleSelectionChange(){if(0===this._rowElements.length)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)return void console.error("anchorNode and/or focusNode are null");let i={node:e.anchorNode,offset:e.anchorOffset},r={node:e.focusNode,offset:e.focusOffset};if((i.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||i.node===r.node&&i.offset>r.offset)&&([i,r]=[r,i]),i.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(i={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(i.node))return;let s=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:s,offset:s.textContent?.length??0}),!this._rowContainer.contains(r.node))return;let n=({node:e,offset:i})=>{let r=e instanceof Text?e.parentNode:e,s=parseInt(r?.getAttribute("aria-posinset"),10)-1;if(isNaN(s))return console.warn("row is invalid. Race condition?"),null;let n=this._rowColumns.get(r);if(!n)return console.warn("columns is null. Race condition?"),null;let o=i<n.length?n[i]:n.slice(-1)[0]+1;return o>=this._terminal.cols&&(++s,o=0),{row:s,column:o}},o=n(i),l=n(r);if(!(!o||!l)){if(o.row>l.row||o.row===l.row&&o.column>=l.column)throw Error("invalid range");this._terminal.select(o.column,o.row,(l.row-o.row)*this._terminal.cols-o.column+l.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)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<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let i=e.getBoundingClientRect().width,r=this._rowColumns.get(e)?.slice(-1)?.[0];if(!r)return;let s=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${s/i})`}};s5=B([L(1,Q),L(2,el),L(3,eh)],s5);var s3=class extends eR{constructor(e,i,r,s,n){super(),this._element=e,this._mouseService=i,this._renderService=r,this._bufferService=s,this._linkProviderService=n,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new eV),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new eV),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(ek(()=>{eC(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(tJ(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(tJ(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(tJ(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(tJ(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let i=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;let r=e.composedPath();for(let e=0;e<r.length;e++){let i=r[e];if(i.classList.contains("xterm"))break;if(i.classList.contains("xterm-hover"))return}this._lastBufferCell&&i.x===this._lastBufferCell.x&&i.y===this._lastBufferCell.y||(this._handleHover(i),this._lastBufferCell=i)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,i){this._activeProviderReplies&&i||(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[s,n]of this._linkProviderService.linkProviders.entries())i?this._activeProviderReplies?.get(s)&&(r=this._checkLinkProviderResult(s,e,r)):n.provideLinks(e.y,i=>{if(this._isMouseOut)return;let n=i?.map(e=>({link:e}));this._activeProviderReplies?.set(s,n),r=this._checkLinkProviderResult(s,e,r),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,i){let r=new Set;for(let s=0;s<i.size;s++){let n=i.get(s);if(n)for(let i=0;i<n.length;i++){let s=n[i],o=s.link.range.start.y<e?0:s.link.range.start.x,l=s.link.range.end.y>e?this._bufferService.cols:s.link.range.end.x;for(let e=o;e<=l;e++){if(r.has(e)){n.splice(i--,1);break}r.add(e)}}}}_checkLinkProviderResult(e,i,r){if(!this._activeProviderReplies)return r;let s=this._activeProviderReplies.get(e),n=!1;for(let i=0;i<e;i++)(!this._activeProviderReplies.has(i)||this._activeProviderReplies.get(i))&&(n=!0);if(!n&&s){let e=s.find(e=>this._linkAtPosition(e.link,i));e&&(r=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let e=0;e<this._activeProviderReplies.size;e++){let s=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,i));if(s){r=!0,this._handleNewLink(s);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){var i,r;if(!this._currentLink)return;let s=this._positionFromMouseEvent(e,this._element,this._mouseService);s&&this._mouseDownLink&&(i=this._mouseDownLink.link,r=this._currentLink.link,i.text===r.text&&i.range.start.x===r.range.start.x&&i.range.start.y===r.range.start.y&&i.range.end.x===r.range.end.x&&i.range.end.y===r.range.end.y)&&this._linkAtPosition(this._currentLink.link,s)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,i){this._currentLink&&this._lastMouseEvent&&(!e||!i||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=i)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,eC(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(e.link,i)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||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:i=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let i=0===e.start?0:e.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(i,r),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,i,r){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(r,i.text)}_fireUnderlineEvent(e,i){let r=e.range,s=this._bufferService.buffer.ydisp,n=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-s-1,r.end.x,r.end.y-s-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(n)}_linkLeave(e,i,r){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(r,i.text)}_linkAtPosition(e,i){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,n=i.y*this._bufferService.cols+i.x;return r<=n&&n<=s}_positionFromMouseEvent(e,i,r){let s=r.getCoords(e,i,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,i,r,s,n){return{x1:e,y1:i,x2:r,y2:s,cols:this._bufferService.cols,fg:n}}};s3=B([L(1,ea),L(2,eh),L(3,X),L(4,ef)],s3);var s4=class extends sY{constructor(e={}){super(e),this._linkifier=this._register(new eM),this.browser=ra,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new eM),this._onCursorMove=this._register(new eV),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new eV),this.onKey=this._onKey.event,this._onRender=this._register(new eV),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new eV),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new eV),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new eV),this.onBell=this._onBell.event,this._onFocus=this._register(new eV),this._onBlur=this._register(new eV),this._onA11yCharEmitter=this._register(new eV),this._onA11yTabEmitter=this._register(new eV),this._onWillOpen=this._register(new eV),this._setup(),this._decorationService=this._instantiationService.createInstance(s0),this._instantiationService.setService(es,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(rs),this._instantiationService.setService(ef,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(en)),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(eF.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(eF.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(eF.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(eF.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(ek(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let i of e){let e,r="";switch(i.index){case 256:e="foreground",r="10";break;case 257:e="background",r="11";break;case 258:e="cursor",r="12";break;default:e="ansi",r="4;"+i.index}switch(i.type){case 0:let s=sf.toColorRGB("ansi"===e?this._themeService.colors.ansi[i.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${iM.ESC}]${r};${function(e,i=16){let[r,s,n]=e;return`rgb:${sz(r,i)}/${sz(s,i)}/${sz(n,i)}`}(s)}${iB.ST}`);break;case 1:if("ansi"===e)this._themeService.modifyColors(e=>e.ansi[i.index]=iL.toColor(...i.color));else{let r=e;this._themeService.modifyColors(e=>e[r]=iL.toColor(...i.color))}break;case 2:this._themeService.restoreColor(i.index)}}}_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(s5,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(iM.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(iM.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,i=this.buffer.lines.get(e);if(!i)return;let r=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,n=i.getWidth(r),o=this._renderService.dimensions.css.cell.width*n,l=this.buffer.y*this._renderService.dimensions.css.cell.height,a=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=l+"px",this.textarea.style.width=o+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(tJ(this.element,"copy",e=>{var i;this.hasSelection()&&(i=this._selectionService,e.clipboardData&&e.clipboardData.setData("text/plain",i.selectionText),e.preventDefault())}));let e=e=>{var i,r,s;return i=this.textarea,r=this.coreService,s=this.optionsService,void(e.stopPropagation(),e.clipboardData&&N(e.clipboardData.getData("text/plain"),i,r,s))};this._register(tJ(this.textarea,"paste",e)),this._register(tJ(this.element,"paste",e)),r_?this._register(tJ(this.element,"mousedown",e=>{2===e.button&&I(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(tJ(this.element,"contextmenu",e=>{I(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),rx&&this._register(tJ(this.element,"auxclick",e=>{1===e.button&&O(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(tJ(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(tJ(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(tJ(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(tJ(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(tJ(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(tJ(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(tJ(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 i=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(tJ(this.screenElement,"mousemove",e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",T),rw||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",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(ri,this.textarea,e.ownerDocument.defaultView??window,this._document??"u">typeof window?window.document:null)),this._instantiationService.setService(el,this._coreBrowserService),this._register(tJ(this.textarea,"focus",e=>this._handleTextAreaFocus(e))),this._register(tJ(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(i8,this._document,this._helperContainer),this._instantiationService.setService(eo,this._charSizeService),this._themeService=this._instantiationService.createInstance(rV),this._instantiationService.setService(ed,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(iY),this._instantiationService.setService(eu,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(rM,this.rows,this.screenElement)),this._instantiationService.setService(eh,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(iw,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(ro),this._instantiationService.setService(ea,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(s3,this.screenElement));this.element.appendChild(i);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(ig,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(rH,this.element,this.screenElement,s)),this._instantiationService.setService(ec,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(eF.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(im,this.screenElement)),this._register(tJ(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(s5,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ix,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ix,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(i9,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,i=this.element;function r(i){let r,s,n=e._mouseService.getMouseReportCoords(i,e.screenElement);if(!n)return!1;switch(i.overrideType||i.type){case"mousemove":s=32,void 0===i.buttons?(r=3,void 0!==i.button&&(r=i.button<3?i.button:3)):r=1&i.buttons?0:4&i.buttons?1:2&i.buttons?2:3;break;case"mouseup":s=0,r=i.button<3?i.button:3;break;case"mousedown":s=1,r=i.button<3?i.button:3;break;case"wheel":if(e._customWheelEventHandler&&!1===e._customWheelEventHandler(i))return!1;let o=i.deltaY;if(0===o||0===e.coreMouseService.consumeWheelEvent(i,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr))return!1;s=o<0?0:1,r=4;break;default:return!1}return void 0!==s&&void 0!==r&&!(r>4)&&e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:s,ctrl:i.ctrlKey,alt:i.altKey,shift:i.shiftKey})}let s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},n=e=>(r(e),e.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(e)),o=e=>(r(e),this.cancel(e,!0)),l=e=>{e.buttons&&r(e)},a=e=>{e.buttons||r(e)};this._register(this.coreMouseService.onProtocolChange(e=>{e?("debug"===this.optionsService.rawOptions.logLevel&&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()),8&e?s.mousemove||(i.addEventListener("mousemove",a),s.mousemove=a):(i.removeEventListener("mousemove",s.mousemove),s.mousemove=null),16&e?s.wheel||(i.addEventListener("wheel",o,{passive:!1}),s.wheel=o):(i.removeEventListener("wheel",s.wheel),s.wheel=null),2&e?s.mouseup||(s.mouseup=n):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),4&e?s.mousedrag||(s.mousedrag=l):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(tJ(i,"mousedown",e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return r(e),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(e)})),this._register(tJ(i,"wheel",i=>{if(!s.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(i))return!1;if(!this.buffer.hasScrollback){if(0===i.deltaY)return!1;if(0===e.coreMouseService.consumeWheelEvent(i,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr))return this.cancel(i,!0);let r=iM.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(i.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(r,!0),this.cancel(i,!0)}}},{passive:!1}))}refresh(e,i){this._renderService?.refreshRows(e,i)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,i){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,i),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;0!==i&&this.scrollLines(i)}paste(e){N(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 i=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),i}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}select(e,i,r){this._selectionService.setSelection(e,i,r)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,i){this._selectionService?.selectLines(e,i)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;let i=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!i&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;i||"Dead"!==e.key&&"AltGraph"!==e.key||(this._unprocessedDeadKey=!0);let r=function(e,i,r,s){let n={type:0,cancel:!1,key:void 0},o=!!e.shiftKey|2*!!e.altKey|4*!!e.ctrlKey|8*!!e.metaKey;switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?i?n.key=iM.ESC+"OA":n.key=iM.ESC+"[A":"UIKeyInputLeftArrow"===e.key?i?n.key=iM.ESC+"OD":n.key=iM.ESC+"[D":"UIKeyInputRightArrow"===e.key?i?n.key=iM.ESC+"OC":n.key=iM.ESC+"[C":"UIKeyInputDownArrow"===e.key&&(i?n.key=iM.ESC+"OB":n.key=iM.ESC+"[B");break;case 8:n.key=e.ctrlKey?"\b":iM.DEL,e.altKey&&(n.key=iM.ESC+n.key);break;case 9:if(e.shiftKey){n.key=iM.ESC+"[Z";break}n.key=iM.HT,n.cancel=!0;break;case 13:n.key=e.altKey?iM.ESC+iM.CR:iM.CR,n.cancel=!0;break;case 27:n.key=iM.ESC,e.altKey&&(n.key=iM.ESC+iM.ESC),n.cancel=!0;break;case 37:if(e.metaKey)break;o?n.key=iM.ESC+"[1;"+(o+1)+"D":i?n.key=iM.ESC+"OD":n.key=iM.ESC+"[D";break;case 39:if(e.metaKey)break;o?n.key=iM.ESC+"[1;"+(o+1)+"C":i?n.key=iM.ESC+"OC":n.key=iM.ESC+"[C";break;case 38:if(e.metaKey)break;o?n.key=iM.ESC+"[1;"+(o+1)+"A":i?n.key=iM.ESC+"OA":n.key=iM.ESC+"[A";break;case 40:if(e.metaKey)break;o?n.key=iM.ESC+"[1;"+(o+1)+"B":i?n.key=iM.ESC+"OB":n.key=iM.ESC+"[B";break;case 45:e.shiftKey||e.ctrlKey||(n.key=iM.ESC+"[2~");break;case 46:o?n.key=iM.ESC+"[3;"+(o+1)+"~":n.key=iM.ESC+"[3~";break;case 36:o?n.key=iM.ESC+"[1;"+(o+1)+"H":i?n.key=iM.ESC+"OH":n.key=iM.ESC+"[H";break;case 35:o?n.key=iM.ESC+"[1;"+(o+1)+"F":i?n.key=iM.ESC+"OF":n.key=iM.ESC+"[F";break;case 33:e.shiftKey?n.type=2:e.ctrlKey?n.key=iM.ESC+"[5;"+(o+1)+"~":n.key=iM.ESC+"[5~";break;case 34:e.shiftKey?n.type=3:e.ctrlKey?n.key=iM.ESC+"[6;"+(o+1)+"~":n.key=iM.ESC+"[6~";break;case 112:o?n.key=iM.ESC+"[1;"+(o+1)+"P":n.key=iM.ESC+"OP";break;case 113:o?n.key=iM.ESC+"[1;"+(o+1)+"Q":n.key=iM.ESC+"OQ";break;case 114:o?n.key=iM.ESC+"[1;"+(o+1)+"R":n.key=iM.ESC+"OR";break;case 115:o?n.key=iM.ESC+"[1;"+(o+1)+"S":n.key=iM.ESC+"OS";break;case 116:o?n.key=iM.ESC+"[15;"+(o+1)+"~":n.key=iM.ESC+"[15~";break;case 117:o?n.key=iM.ESC+"[17;"+(o+1)+"~":n.key=iM.ESC+"[17~";break;case 118:o?n.key=iM.ESC+"[18;"+(o+1)+"~":n.key=iM.ESC+"[18~";break;case 119:o?n.key=iM.ESC+"[19;"+(o+1)+"~":n.key=iM.ESC+"[19~";break;case 120:o?n.key=iM.ESC+"[20;"+(o+1)+"~":n.key=iM.ESC+"[20~";break;case 121:o?n.key=iM.ESC+"[21;"+(o+1)+"~":n.key=iM.ESC+"[21~";break;case 122:o?n.key=iM.ESC+"[23;"+(o+1)+"~":n.key=iM.ESC+"[23~";break;case 123:o?n.key=iM.ESC+"[24;"+(o+1)+"~":n.key=iM.ESC+"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if((!r||s)&&e.altKey&&!e.metaKey){let i=sX[e.keyCode]?.[+!!e.shiftKey];if(i)n.key=iM.ESC+i;else if(e.keyCode>=65&&e.keyCode<=90){let i=String.fromCharCode(e.ctrlKey?e.keyCode-64:e.keyCode+32);e.shiftKey&&(i=i.toUpperCase()),n.key=iM.ESC+i}else if(32===e.keyCode)n.key=iM.ESC+(e.ctrlKey?iM.NUL:" ");else if("Dead"===e.key&&e.code.startsWith("Key")){let i=e.code.slice(3,4);e.shiftKey||(i=i.toLowerCase()),n.key=iM.ESC+i,n.cancel=!0}}else!r||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?!e.key||e.ctrlKey||e.altKey||e.metaKey||!(e.keyCode>=48)||1!==e.key.length?e.key&&e.ctrlKey&&("_"===e.key&&(n.key=iM.US),"@"===e.key&&(n.key=iM.NUL)):n.key=e.key:65===e.keyCode&&(n.type=1);else e.keyCode>=65&&e.keyCode<=90?n.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?n.key=iM.NUL:e.keyCode>=51&&e.keyCode<=55?n.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?n.key=iM.DEL:219===e.keyCode?n.key=iM.ESC:220===e.keyCode?n.key=iM.FS:221===e.keyCode&&(n.key=iM.GS)}return n}(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),3===r.type||2===r.type){let i=this.rows-1;return this.scrollLines(2===r.type?-i:i),this.cancel(e,!0)}return 1===r.type&&this.selectAll(),!!(this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&1===e.key.length&&e.key.charCodeAt(0)>=65&&90>=e.key.charCodeAt(0))||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):((r.key===iM.ETX||r.key===iM.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)?this.cancel(e,!0):void(this._keyDownHandled=!0))}_isThirdLevelShift(e,i){let r=e.isMac&&!this.options.macOptionIsMeta&&i.altKey&&!i.ctrlKey&&!i.metaKey||e.isWindows&&i.altKey&&i.ctrlKey&&!i.metaKey||e.isWindows&&i.getModifierState("AltGraph");return"keypress"===i.type?r:r&&(!i.keyCode||i.keyCode>47)}_keyUp(e){var i;this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(16===(i=e).keyCode||17===i.keyCode||18===i.keyCode||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let i;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)i=e.charCode;else if(null===e.which||void 0===e.which)i=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;i=e.which}return!!i&&(!e.altKey&&!e.ctrlKey&&!e.metaKey||!!this._isThirdLevelShift(this.browser,e))&&(i=String.fromCharCode(i),this._onKey.fire({key:i,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&"insertText"===e.inputType&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let i=e.data;return this.coreService.triggerDataEvent(i,!0),this.cancel(e),!0}return!1}resize(e,i){if(e===this.cols&&i===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,i)}_afterResize(e,i){this._charSizeService?.measure()}clear(){if(0!==this.buffer.ybase||0!==this.buffer.y){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<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(r0));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(iM.ESC+"[I"):this.coreService.triggerDataEvent(iM.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let i=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${iM.ESC}[4;${r};${i}t`);break;case 1:let s=this._renderService.dimensions.css.cell.width.toFixed(0),n=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${iM.ESC}[6;${n};${s}t`)}}cancel(e,i){if(!(!this.options.cancelEvents&&!i))return e.preventDefault(),e.stopPropagation(),!1}},s6=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,i){let r={instance:i,dispose:i.dispose,isDisposed:!1};this._addons.push(r),i.dispose=()=>this._wrappedAddonDispose(r),i.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let i=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){i=r;break}if(-1===i)throw Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(i,1)}},s9=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,i){if(!(e<0||e>=this._line.length))return i?(this._line.loadCell(e,i),i):this._line.loadCell(e,new U)}translateToString(e,i,r){return this._line.translateToString(e,i,r)}},s8=class{constructor(e,i){this._buffer=e,this.type=i}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 i=this._buffer.lines.get(e);if(i)return new s9(i)}getNullCell(){return new U}},s7=class extends eR{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new eV),this.onBufferChange=this._onBufferChange.event,this._normal=new s8(this._core.buffers.normal,"normal"),this._alternate=new s8(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)}},ne=class{constructor(e){this._core=e}registerCsiHandler(e,i){return this._core.registerCsiHandler(e,e=>i(e.toArray()))}addCsiHandler(e,i){return this.registerCsiHandler(e,i)}registerDcsHandler(e,i){return this._core.registerDcsHandler(e,(e,r)=>i(e,r.toArray()))}addDcsHandler(e,i){return this.registerDcsHandler(e,i)}registerEscHandler(e,i){return this._core.registerEscHandler(e,i)}addEscHandler(e,i){return this.registerEscHandler(e,i)}registerOscHandler(e,i){return this._core.registerOscHandler(e,i)}addOscHandler(e,i){return this.registerOscHandler(e,i)}},nt=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}},ni=["cols","rows"],nr=0,ns=class extends eR{constructor(e){super(),this._core=this._register(new s4(e)),this._addonManager=this._register(new s6),this._publicOptions={...this._core.options};let i=e=>this._core.options[e],r=(e,i)=>{this._checkReadonlyOptions(e),this._core.options[e]=i};for(let e in this._core.options){let s={get:i.bind(this,e),set:r.bind(this,e)};Object.defineProperty(this._publicOptions,e,s)}}_checkReadonlyOptions(e){if(ni.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||(this._parser=new ne(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new nt(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new s7(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,i="none";switch(this._core.coreMouseService.activeProtocol){case"X10":i="x10";break;case"VT200":i="vt200";break;case"DRAG":i="drag";break;case"ANY":i="any"}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,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 i in e)this._publicOptions[i]=e[i]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,i=!0){this._core.input(e,i)}resize(e,i){this._verifyIntegers(e,i),this._core.resize(e,i)}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,i,r){this._verifyIntegers(e,i,r),this._core.select(e,i,r)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,i){this._verifyIntegers(e,i),this._core.selectLines(e,i)}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,i){this._core.write(e,i)}writeln(e,i){this._core.write(e),this._core.write(`\r
18
- `,i)}paste(e){this._core.paste(e)}refresh(e,i){this._verifyIntegers(e,i),this._core.refresh(e,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return T},set promptLabel(t){T=t},get tooMuchOutput(){return A},set tooMuchOutput(t){A=t}}}_verifyIntegers(...e){for(nr of e)if(nr===1/0||isNaN(nr)||nr%1!=0)throw Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(nr of e)if(nr&&(nr===1/0||isNaN(nr)||nr%1!=0||nr<0))throw Error("This API only accepts positive integers")}},nn=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let i=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(i._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(0===e.css.cell.width||0===e.css.cell.height)return;let i=0===this._terminal.options.scrollback?0:this._terminal.options.overviewRuler?.width||14,r=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(r.getPropertyValue("height")),n=Math.max(0,parseInt(r.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),l={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},a=l.top+l.bottom;return{cols:Math.max(2,Math.floor((n-(l.right+l.left)-i)/e.css.cell.width)),rows:Math.max(1,Math.floor((s-a)/e.css.cell.height))}}};function no({projectId:e,agentId:i,wsUrl:r}){let s=(0,p.useRef)(null),n=(0,p.useRef)(null),o=(0,p.useRef)(null),l=(0,p.useRef)(null),a=(0,p.useCallback)(()=>{if(o.current&&n.current&&s.current)try{o.current.fit();let e=l.current;e&&e.readyState===WebSocket.OPEN&&e.send(JSON.stringify({type:"resize",cols:n.current.cols,rows:n.current.rows}))}catch{}},[]);return(0,p.useEffect)(()=>{if(!s.current)return;let h=new ns({scrollback:1e3,fontSize:12,fontFamily:'"Geist Mono", "JetBrains Mono", "Fira Code", "Cascadia Code", monospace',lineHeight:1.4,letterSpacing:.5,cursorBlink:!1,cursorStyle:"block",theme:{background:"#0a0a0a",foreground:"#e0e0e0",cursor:"#00ff88",cursorAccent:"#0a0a0a",selectionBackground:"#00ff8844",black:"#0a0a0a",red:"#ff4444",green:"#00ff88",yellow:"#ffcc00",blue:"#4488ff",magenta:"#cc44ff",cyan:"#44ccff",white:"#e0e0e0",brightBlack:"#737373",brightRed:"#ff6666",brightGreen:"#00ff88",brightYellow:"#ffdd44",brightBlue:"#66aaff",brightMagenta:"#dd66ff",brightCyan:"#66ddff",brightWhite:"#ffffff"},allowTransparency:!1,drawBoldTextInBrightColors:!0}),c=new nn;h.loadAddon(c),h.open(s.current),n.current=h,o.current=c,requestAnimationFrame(()=>a());let u=new ResizeObserver(()=>a());u.observe(s.current);let d=!1;return(async()=>{let s=r;if(!s){let e="https:"===window.location.protocol?"wss:":"ws:";try{let i=await fetch("/api/config");if(i.ok){let r=(await i.json()).port||8400,n=parseInt(window.location.port,10);s=n&&n!==r?`${e}//${window.location.hostname}:${r}`:`${e}//${window.location.host}`}else s=`${e}//${window.location.host}`}catch{s=`${e}//${window.location.host}`}}if(d)return;let n=new WebSocket(`${s}/ws/terminal?project=${encodeURIComponent(e)}&agent=${encodeURIComponent(i)}`);l.current=n,n.onopen=()=>{n.send(JSON.stringify({type:"resize",cols:h.cols,rows:h.rows}))},n.onmessage=e=>{h.write(e.data)},n.onclose=e=>{h.write(`\r
19
- \x1b[38;2;115;115;115m[session closed: ${e.reason||e.code}]\x1b[0m\r
20
- `)},h.onData(e=>{n.readyState===WebSocket.OPEN&&n.send(e)})})(),()=>{d=!0,u.disconnect(),l.current?.close(),h.dispose(),n.current=null,o.current=null,l.current=null}},[e,i,r,a]),(0,_.jsx)("div",{ref:s,className:"w-full h-full"})}let nl=[{id:"reviewer1",label:"Reviewer1"},{id:"reviewer2",label:"Reviewer2"},{id:"dev",label:"Dev"}],na=["border-r border-b border-border","border-b border-border","col-span-2"],nh=["border-r border-b border-border","border-b border-border","border-r border-border",""];function nc({projectId:e,agents:i=nl,agentStates:r={},onStatusChange:s}){let[n,o]=(0,p.useState)(null),l=i.length>=4?nh:na;return(0,_.jsx)("div",{className:"w-full h-full relative grid grid-rows-2 grid-cols-2",children:i.map((i,a)=>{let h=n===i.id,c=null!==n&&!h;return(0,_.jsxs)("div",{className:`flex flex-col ${h?"absolute inset-0 z-10 bg-bg":`${l[a]||""}`}`,style:c?{visibility:"hidden",overflow:"hidden"}:void 0,children:[(0,_.jsxs)("div",{className:`flex items-center justify-between px-3 shrink-0 border-b border-border ${h?"h-7":"h-6"}`,children:[(0,_.jsxs)("div",{className:`flex items-center gap-1.5 ${!h?"cursor-pointer":""}`,onClick:h?void 0:()=>o(i.id),children:[(0,_.jsxs)("span",{className:"relative inline-flex items-center justify-center w-2 h-2",children:["running"===r[i.id]&&(0,_.jsx)("span",{className:"absolute inline-flex h-full w-full rounded-full bg-accent opacity-60 animate-ping"}),(0,_.jsx)("span",{className:`relative w-1.5 h-1.5 rounded-full ${"running"===r[i.id]?"bg-accent":"error"===r[i.id]?"bg-error":"bg-text-muted"}`})]}),(0,_.jsx)("span",{className:"text-[11px] text-text-muted uppercase tracking-wider",children:i.label})]}),(0,_.jsxs)("div",{className:"flex items-center gap-1",children:["running"!==r[i.id]&&(0,_.jsx)("button",{onClick:()=>{fetch(`/api/agents?project=${encodeURIComponent(e)}&agent=${encodeURIComponent(i.id)}&action=start`,{method:"POST"}).then(e=>e.json()).then(e=>{e.state&&s&&s(i.id,e.state)}).catch(()=>{})},className:"text-[10px] text-text-muted hover:text-accent transition-colors px-0.5",title:"Start",children:"▶"}),"running"===r[i.id]&&(0,_.jsx)("button",{onClick:()=>{fetch(`/api/agents?project=${encodeURIComponent(e)}&agent=${encodeURIComponent(i.id)}&action=stop`,{method:"POST"}).then(e=>e.json()).then(e=>{e.state&&s&&s(i.id,e.state)}).catch(()=>{})},className:"text-[10px] text-text-muted hover:text-error transition-colors px-0.5",title:"Stop",children:"■"}),(0,_.jsx)("button",{onClick:()=>{fetch(`/api/agents?project=${encodeURIComponent(e)}&agent=${encodeURIComponent(i.id)}&action=restart`,{method:"POST"}).then(e=>e.json()).then(e=>{e.state&&s&&s(i.id,e.state)}).catch(()=>{})},className:"text-[10px] text-text-muted hover:text-accent transition-colors px-0.5",title:"Restart",children:"↻"}),"running"===r[i.id]&&(0,_.jsx)("button",{onClick:()=>{fetch(`/api/agents/${encodeURIComponent(e)}/${encodeURIComponent(i.id)}/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:"/compact\n"})}).catch(()=>{})},className:"text-[10px] text-text-muted hover:text-accent transition-colors px-0.5",title:"Compact — frees context/memory when agent is stuck",children:"/c"}),h&&(0,_.jsx)("button",{onClick:()=>o(null),className:"text-[11px] text-text-muted hover:text-text transition-colors ml-1",children:"esc"})]})]}),(0,_.jsx)("div",{className:"flex-1 min-h-0",children:(0,_.jsx)(no,{projectId:e,agentId:i.id})})]},i.id)})})}let nu=[{id:"head",label:"Head"},{id:"reviewer1",label:"Reviewer1"},{id:"reviewer2",label:"Reviewer2"},{id:"dev",label:"Dev"}];function nd({projectId:e,agentStates:i,onStatusChange:r}){let[s,n]=(0,p.useState)(!1);return(0,_.jsxs)("div",{className:"flex flex-col h-full min-h-0",children:[(0,_.jsx)("div",{className:"flex items-center justify-between h-7 px-3 shrink-0 border-b border-border",children:(0,_.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,_.jsx)("span",{className:"text-[11px] text-text-muted uppercase tracking-wider",children:"Agent Terminals"}),(0,_.jsxs)("div",{className:"relative",onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),children:[(0,_.jsx)("button",{type:"button","aria-label":"About agent terminals",className:"w-3.5 h-3.5 rounded-full border border-border text-[9px] text-text-muted hover:text-accent hover:border-accent inline-flex items-center justify-center",children:"?"}),s&&(0,_.jsxs)("div",{role:"tooltip",className:"absolute top-5 left-0 z-20 w-72 p-2 text-[11px] leading-snug text-text bg-bg-surface border border-border shadow-lg",children:["These show what each agent is doing in their CLI session."," ",(0,_.jsx)("b",{children:"Do not type here directly"}),"— use the AgentChattr chat above instead. Agents won't see messages typed in their terminals."]})]})]})}),(0,_.jsx)("div",{className:"flex-1 min-h-0",children:(0,_.jsx)(nc,{projectId:e,agents:nu,agentStates:i,onStatusChange:r})})]})}function nf(){}function n_(){}let np=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ng=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,nm={};function nv(e,i){return((i||nm).jsx?ng:np).test(e)}let nS=/[ \t\n\f\r]/g;function ny(e){return""===e.replace(nS,"")}class nb{constructor(e,i){this.attribute=i,this.property=e}}nb.prototype.attribute="",nb.prototype.booleanish=!1,nb.prototype.boolean=!1,nb.prototype.commaOrSpaceSeparated=!1,nb.prototype.commaSeparated=!1,nb.prototype.defined=!1,nb.prototype.mustUseProperty=!1,nb.prototype.number=!1,nb.prototype.overloadedBoolean=!1,nb.prototype.property="",nb.prototype.spaceSeparated=!1,nb.prototype.space=void 0;let nx=0,nw=nP(),nC=nP(),nk=nP(),nE=nP(),nD=nP(),nR=nP(),nM=nP();function nP(){return 2**++nx}e.s(["boolean",0,nw,"booleanish",0,nC,"commaOrSpaceSeparated",0,nM,"commaSeparated",0,nR,"number",0,nE,"overloadedBoolean",0,nk,"spaceSeparated",0,nD],61163);var nB=e.i(61163);let nL=Object.keys(nB);class nT extends nb{constructor(e,i,r,s){let n=-1;if(super(e,i),function(e,i,r){r&&(e[i]=r)}(this,"space",s),"number"==typeof r)for(;++n<nL.length;){const e=nL[n];!function(e,i,r){r&&(e[i]=r)}(this,nL[n],(r&nB[e])===nB[e])}}}function nA(e){return e.toLowerCase()}nT.prototype.defined=!0;let nN=/[A-Z]/g,nO=/-[a-z]/g,nI=/^data[-\w.:]+$/i;function nz(e){return"-"+e.toLowerCase()}function nH(e){return e.charAt(1).toUpperCase()}let nF={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"};class nj{constructor(e,i,r){this.normal=i,this.property=e,r&&(this.space=r)}}function nW(e,i){let r={},s={};for(let i of e)Object.assign(r,i.property),Object.assign(s,i.normal);return new nj(r,s,i)}function n$(e){let i={},r={};for(let[s,n]of Object.entries(e.properties)){let o=new nT(s,e.transform(e.attributes||{},s),n,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(o.mustUseProperty=!0),i[s]=o,r[nA(s)]=s,r[nA(o.attribute)]=s}return new nj(i,r,e.space)}nj.prototype.normal={},nj.prototype.property={},nj.prototype.space=void 0;let nU=n$({properties:{ariaActiveDescendant:null,ariaAtomic:nC,ariaAutoComplete:null,ariaBusy:nC,ariaChecked:nC,ariaColCount:nE,ariaColIndex:nE,ariaColSpan:nE,ariaControls:nD,ariaCurrent:null,ariaDescribedBy:nD,ariaDetails:null,ariaDisabled:nC,ariaDropEffect:nD,ariaErrorMessage:null,ariaExpanded:nC,ariaFlowTo:nD,ariaGrabbed:nC,ariaHasPopup:null,ariaHidden:nC,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:nD,ariaLevel:nE,ariaLive:null,ariaModal:nC,ariaMultiLine:nC,ariaMultiSelectable:nC,ariaOrientation:null,ariaOwns:nD,ariaPlaceholder:null,ariaPosInSet:nE,ariaPressed:nC,ariaReadOnly:nC,ariaRelevant:null,ariaRequired:nC,ariaRoleDescription:nD,ariaRowCount:nE,ariaRowIndex:nE,ariaRowSpan:nE,ariaSelected:nC,ariaSetSize:nE,ariaSort:null,ariaValueMax:nE,ariaValueMin:nE,ariaValueNow:nE,ariaValueText:null,role:null},transform:(e,i)=>"role"===i?i:"aria-"+i.slice(4).toLowerCase()});function nK(e,i){return i in e?e[i]:i}function nq(e,i){return nK(e,i.toLowerCase())}let nV=n$({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:nR,acceptCharset:nD,accessKey:nD,action:null,allow:null,allowFullScreen:nw,allowPaymentRequest:nw,allowUserMedia:nw,alt:null,as:null,async:nw,autoCapitalize:null,autoComplete:nD,autoFocus:nw,autoPlay:nw,blocking:nD,capture:null,charSet:null,checked:nw,cite:null,className:nD,cols:nE,colSpan:null,content:null,contentEditable:nC,controls:nw,controlsList:nD,coords:nE|nR,crossOrigin:null,data:null,dateTime:null,decoding:null,default:nw,defer:nw,dir:null,dirName:null,disabled:nw,download:nk,draggable:nC,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:nw,formTarget:null,headers:nD,height:nE,hidden:nk,high:nE,href:null,hrefLang:null,htmlFor:nD,httpEquiv:nD,id:null,imageSizes:null,imageSrcSet:null,inert:nw,inputMode:null,integrity:null,is:null,isMap:nw,itemId:null,itemProp:nD,itemRef:nD,itemScope:nw,itemType:nD,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:nw,low:nE,manifest:null,max:null,maxLength:nE,media:null,method:null,min:null,minLength:nE,multiple:nw,muted:nw,name:null,nonce:null,noModule:nw,noValidate:nw,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:nw,optimum:nE,pattern:null,ping:nD,placeholder:null,playsInline:nw,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:nw,referrerPolicy:null,rel:nD,required:nw,reversed:nw,rows:nE,rowSpan:nE,sandbox:nD,scope:null,scoped:nw,seamless:nw,selected:nw,shadowRootClonable:nw,shadowRootDelegatesFocus:nw,shadowRootMode:null,shape:null,size:nE,sizes:null,slot:null,span:nE,spellCheck:nC,src:null,srcDoc:null,srcLang:null,srcSet:null,start:nE,step:null,style:null,tabIndex:nE,target:null,title:null,translate:null,type:null,typeMustMatch:nw,useMap:null,value:nC,width:nE,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:nD,axis:null,background:null,bgColor:null,border:nE,borderColor:null,bottomMargin:nE,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:nw,declare:nw,event:null,face:null,frame:null,frameBorder:null,hSpace:nE,leftMargin:nE,link:null,longDesc:null,lowSrc:null,marginHeight:nE,marginWidth:nE,noResize:nw,noHref:nw,noShade:nw,noWrap:nw,object:null,profile:null,prompt:null,rev:null,rightMargin:nE,rules:null,scheme:null,scrolling:nC,standby:null,summary:null,text:null,topMargin:nE,valueType:null,version:null,vAlign:null,vLink:null,vSpace:nE,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:nw,disableRemotePlayback:nw,prefix:null,property:null,results:nE,security:null,unselectable:null},space:"html",transform:nq}),nY=n$({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:nM,accentHeight:nE,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:nE,amplitude:nE,arabicForm:null,ascent:nE,attributeName:null,attributeType:null,azimuth:nE,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:nE,by:null,calcMode:null,capHeight:nE,className:nD,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:nE,diffuseConstant:nE,direction:null,display:null,dur:null,divisor:nE,dominantBaseline:null,download:nw,dx:null,dy:null,edgeMode:null,editable:null,elevation:nE,enableBackground:null,end:null,event:null,exponent:nE,externalResourcesRequired:null,fill:null,fillOpacity:nE,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:nR,g2:nR,glyphName:nR,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:nE,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:nE,horizOriginX:nE,horizOriginY:nE,id:null,ideographic:nE,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:nE,k:nE,k1:nE,k2:nE,k3:nE,k4:nE,kernelMatrix:nM,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:nE,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:nE,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:nE,overlineThickness:nE,paintOrder:null,panose1:null,path:null,pathLength:nE,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:nD,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:nE,pointsAtY:nE,pointsAtZ:nE,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:nM,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:nM,rev:nM,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:nM,requiredFeatures:nM,requiredFonts:nM,requiredFormats:nM,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:nE,specularExponent:nE,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:nE,strikethroughThickness:nE,string:null,stroke:null,strokeDashArray:nM,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:nE,strokeOpacity:nE,strokeWidth:null,style:null,surfaceScale:nE,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:nM,tabIndex:nE,tableValues:null,target:null,targetX:nE,targetY:nE,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:nM,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:nE,underlineThickness:nE,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:nE,values:null,vAlphabetic:nE,vMathematical:nE,vectorEffect:null,vHanging:nE,vIdeographic:nE,version:null,vertAdvY:nE,vertOriginX:nE,vertOriginY:nE,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:nE,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:nK}),nX=n$({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,i)=>"xlink:"+i.slice(5).toLowerCase()}),nG=n$({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:nq}),nJ=n$({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,i)=>"xml:"+i.slice(3).toLowerCase()}),nZ=nW([nU,nV,nX,nG,nJ],"html"),nQ=nW([nU,nY,nX,nG,nJ],"svg");var n0=e.i(38671);let n1=n5("end"),n2=n5("start");function n5(e){return function(i){let r=i&&i.position&&i.position[e]||{};if("number"==typeof r.line&&r.line>0&&"number"==typeof r.column&&r.column>0)return{line:r.line,column:r.column,offset:"number"==typeof r.offset&&r.offset>-1?r.offset:void 0}}}function n3(e){return e&&"object"==typeof e?"position"in e||"type"in e?n6(e.position):"start"in e||"end"in e?n6(e):"line"in e||"column"in e?n4(e):"":""}function n4(e){return n9(e&&e.line)+":"+n9(e&&e.column)}function n6(e){return n4(e&&e.start)+"-"+n4(e&&e.end)}function n9(e){return e&&"number"==typeof e?e:1}class n8 extends Error{constructor(e,i,r){super(),"string"==typeof i&&(r=i,i=void 0);let s="",n={},o=!1;if(i&&(n="line"in i&&"column"in i||"start"in i&&"end"in i?{place:i}:"type"in i?{ancestors:[i],place:i.position}:{...i}),"string"==typeof e?s=e:!n.cause&&e&&(o=!0,s=e.message,n.cause=e),!n.ruleId&&!n.source&&"string"==typeof r){const e=r.indexOf(":");-1===e?n.ruleId=r:(n.source=r.slice(0,e),n.ruleId=r.slice(e+1))}if(!n.place&&n.ancestors&&n.ancestors){const e=n.ancestors[n.ancestors.length-1];e&&(n.place=e.position)}const l=n.place&&"start"in n.place?n.place.start:n.place;this.ancestors=n.ancestors||void 0,this.cause=n.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=n3(n.place)||"1:1",this.place=n.place||void 0,this.reason=this.message,this.ruleId=n.ruleId||void 0,this.source=n.source||void 0,this.stack=o&&n.cause&&"string"==typeof n.cause.stack?n.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}n8.prototype.file="",n8.prototype.name="",n8.prototype.reason="",n8.prototype.message="",n8.prototype.stack="",n8.prototype.column=void 0,n8.prototype.line=void 0,n8.prototype.ancestors=void 0,n8.prototype.cause=void 0,n8.prototype.fatal=void 0,n8.prototype.place=void 0,n8.prototype.ruleId=void 0,n8.prototype.source=void 0;let n7={}.hasOwnProperty,oe=new Map,ot=/[A-Z]/g,oi=new Set(["table","tbody","thead","tfoot","tr"]),or=new Set(["td","th"]),os="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function on(e,i,r){var s,n,o,l,a,h,c,u,d;let f,_,p,g,m,v,S,y,b,x,w;return"element"===i.type?(s=e,n=i,o=r,_=f=s.schema,"svg"===n.tagName.toLowerCase()&&"html"===f.space&&(s.schema=nQ),s.ancestors.push(n),p=oh(s,n.tagName,!1),g=function(e,i){let r,s,n={};for(s in i.properties)if("children"!==s&&n7.call(i.properties,s)){let o=function(e,i,r){let s=function(e,i){let r=nA(i),s=i,n=nb;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&"data"===r.slice(0,4)&&nI.test(i)){if("-"===i.charAt(4)){let e=i.slice(5).replace(nO,nH);s="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=i.slice(4);if(!nO.test(e)){let r=e.replace(nN,nz);"-"!==r.charAt(0)&&(r="-"+r),i="data"+r}}n=nT}return new n(s,i)}(e.schema,i);if(!(null==r||"number"==typeof r&&Number.isNaN(r))){var n;let i;if(Array.isArray(r)&&(r=s.commaSeparated?(i={},(""===(n=r)[n.length-1]?[...n,""]:n).join((i.padRight?" ":"")+","+(!1===i.padLeft?"":" ")).trim()):r.join(" ").trim()),"style"===s.property){let i="object"==typeof r?r:function(e,i){try{return(0,n0.default)(i,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};let i=new n8("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=os+"#cannot-parse-style-attribute",i}}(e,String(r));return"css"===e.stylePropertyNameCase&&(i=function(e){let i,r={};for(i in e)n7.call(e,i)&&(r[function(e){let i=e.replace(ot,ou);return"ms-"===i.slice(0,3)&&(i="-"+i),i}(i)]=e[i]);return r}(i)),["style",i]}return["react"===e.elementAttributeNameCase&&s.space?nF[s.property]||s.property:s.attribute,r]}}(e,s,i.properties[s]);if(o){let[s,l]=o;e.tableCellAlignToStyle&&"align"===s&&"string"==typeof l&&or.has(i.tagName)?r=l:n[s]=l}}return r&&((n.style||(n.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=r),n}(s,n),m=oa(s,n),oi.has(n.tagName)&&(m=m.filter(function(e){return"string"!=typeof e||!("object"==typeof e?"text"===e.type&&ny(e.value):ny(e))})),oo(s,g,p,n),ol(g,m),s.ancestors.pop(),s.schema=f,s.create(n,p,g,o)):"mdxFlowExpression"===i.type||"mdxTextExpression"===i.type?function(e,i){if(i.data&&i.data.estree&&e.evaluater){let r=i.data.estree.body[0];return nf("ExpressionStatement"===r.type),e.evaluater.evaluateExpression(r.expression)}oc(e,i.position)}(e,i):"mdxJsxFlowElement"===i.type||"mdxJsxTextElement"===i.type?(l=e,a=i,h=r,S=v=l.schema,"svg"===a.name&&"html"===v.space&&(l.schema=nQ),l.ancestors.push(a),y=null===a.name?l.Fragment:oh(l,a.name,!0),b=function(e,i){let r={};for(let s of i.attributes)if("mdxJsxExpressionAttribute"===s.type)if(s.data&&s.data.estree&&e.evaluater){let i=s.data.estree.body[0];nf("ExpressionStatement"===i.type);let n=i.expression;nf("ObjectExpression"===n.type);let o=n.properties[0];nf("SpreadElement"===o.type),Object.assign(r,e.evaluater.evaluateExpression(o.argument))}else oc(e,i.position);else{let n,o=s.name;if(s.value&&"object"==typeof s.value)if(s.value.data&&s.value.data.estree&&e.evaluater){let i=s.value.data.estree.body[0];nf("ExpressionStatement"===i.type),n=e.evaluater.evaluateExpression(i.expression)}else oc(e,i.position);else n=null===s.value||s.value;r[o]=n}return r}(l,a),x=oa(l,a),oo(l,b,y,a),ol(b,x),l.ancestors.pop(),l.schema=v,l.create(a,y,b,h)):"mdxjsEsm"===i.type?function(e,i){if(i.data&&i.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(i.data.estree);oc(e,i.position)}(e,i):"root"===i.type?(c=e,u=i,d=r,ol(w={},oa(c,u)),c.create(u,c.Fragment,w,d)):"text"===i.type?i.value:void 0}function oo(e,i,r,s){"string"!=typeof r&&r!==e.Fragment&&e.passNode&&(i.node=s)}function ol(e,i){if(i.length>0){let r=i.length>1?i:i[0];r&&(e.children=r)}}function oa(e,i){let r=[],s=-1,n=e.passKeys?new Map:oe;for(;++s<i.children.length;){let o,l=i.children[s];if(e.passKeys){let e="element"===l.type?l.tagName:"mdxJsxFlowElement"===l.type||"mdxJsxTextElement"===l.type?l.name:void 0;if(e){let i=n.get(e)||0;o=e+"-"+i,n.set(e,i+1)}}let a=on(e,l,o);void 0!==a&&r.push(a)}return r}function oh(e,i,r){let s;if(r)if(i.includes(".")){let e,r=i.split("."),n=-1;for(;++n<r.length;){let i=nv(r[n])?{type:"Identifier",name:r[n]}:{type:"Literal",value:r[n]};e=e?{type:"MemberExpression",object:e,property:i,computed:!!(n&&"Literal"===i.type),optional:!1}:i}nf(e,"always a result"),s=e}else s=nv(i)&&!/^[a-z]/.test(i)?{type:"Identifier",name:i}:{type:"Literal",value:i};else s={type:"Literal",value:i};if("Literal"===s.type){let i=s.value;return n7.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(s);oc(e)}function oc(e,i){let r=new n8("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:i,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=os+"#cannot-handle-mdx-estrees-without-createevaluater",r}function ou(e){return"-"+e.toLowerCase()}let od={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},of={};function o_(e,i,r){var s;if((s=e)&&"object"==typeof s){if("value"in e)return"html"!==e.type||r?e.value:"";if(i&&"alt"in e&&e.alt)return e.alt;if("children"in e)return op(e.children,i,r)}return Array.isArray(e)?op(e,i,r):""}function op(e,i,r){let s=[],n=-1;for(;++n<e.length;)s[n]=o_(e[n],i,r);return s.join("")}function og(e,i,r,s){let n,o=e.length,l=0;if(i=i<0?-i>o?0:o+i:i>o?o:i,r=r>0?r:0,s.length<1e4)(n=Array.from(s)).unshift(i,r),e.splice(...n);else for(r&&e.splice(i,r);l<s.length;)(n=s.slice(l,l+1e4)).unshift(i,0),e.splice(...n),l+=1e4,i+=1e4}function om(e,i){return e.length>0?(og(e,e.length,0,i),e):i}let ov={}.hasOwnProperty,oS=oB(/[A-Za-z]/),oy=oB(/[\dA-Za-z]/),ob=oB(/[#-'*+\--9=?A-Z^-~]/);function ox(e){return null!==e&&(e<32||127===e)}let ow=oB(/\d/),oC=oB(/[\dA-Fa-f]/),ok=oB(/[!-/:-@[-`{-~]/);function oE(e){return null!==e&&e<-2}function oD(e){return null!==e&&(e<0||32===e)}function oR(e){return -2===e||-1===e||32===e}let oM=oB(/\p{P}|\p{S}/u),oP=oB(/\s/);function oB(e){return function(i){return null!==i&&i>-1&&e.test(String.fromCharCode(i))}}function oL(e,i,r,s){let n=s?s-1:1/0,o=0;return function(s){return oR(s)?(e.enter(r),function s(l){return oR(l)&&o++<n?(e.consume(l),s):(e.exit(r),i(l))}(s)):i(s)}}let oT={tokenize:function(e){let i,r=e.attempt(this.parser.constructs.contentInitial,function(i){return null===i?void e.consume(i):(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),oL(e,r,"linePrefix"))},function(r){return e.enter("paragraph"),function r(s){let n=e.enter("chunkText",{contentType:"text",previous:i});return i&&(i.next=n),i=n,function i(s){if(null===s){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return oE(s)?(e.consume(s),e.exit("chunkText"),r):(e.consume(s),i)}(s)}(r)});return r}},oA={tokenize:function(e){let i,r,s,n=this,o=[],l=0;return a;function a(i){if(l<o.length){let r=o[l];return n.containerState=r[1],e.attempt(r[0].continuation,h,c)(i)}return c(i)}function h(e){if(l++,n.containerState._closeFlow){let r;n.containerState._closeFlow=void 0,i&&v();let s=n.events.length,o=s;for(;o--;)if("exit"===n.events[o][0]&&"chunkFlow"===n.events[o][1].type){r=n.events[o][1].end;break}m(l);let a=s;for(;a<n.events.length;)n.events[a][1].end={...r},a++;return og(n.events,o+1,0,n.events.slice(s)),n.events.length=a,c(e)}return a(e)}function c(r){if(l===o.length){if(!i)return f(r);if(i.currentConstruct&&i.currentConstruct.concrete)return p(r);n.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(oN,u,d)(r)}function u(e){return i&&v(),m(l),f(e)}function d(e){return n.parser.lazy[n.now().line]=l!==o.length,s=n.now().offset,p(e)}function f(i){return n.containerState={},e.attempt(oN,_,p)(i)}function _(e){return l++,o.push([n.currentConstruct,n.containerState]),f(e)}function p(s){if(null===s){i&&v(),m(0),e.consume(s);return}return i=i||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:r}),function i(r){if(null===r){g(e.exit("chunkFlow"),!0),m(0),e.consume(r);return}return oE(r)?(e.consume(r),g(e.exit("chunkFlow")),l=0,n.interrupt=void 0,a):(e.consume(r),i)}(s)}function g(e,o){let a=n.sliceStream(e);if(o&&a.push(null),e.previous=r,r&&(r.next=e),r=e,i.defineSkip(e.start),i.write(a),n.parser.lazy[e.start.line]){let e,r,o=i.events.length;for(;o--;)if(i.events[o][1].start.offset<s&&(!i.events[o][1].end||i.events[o][1].end.offset>s))return;let a=n.events.length,h=a;for(;h--;)if("exit"===n.events[h][0]&&"chunkFlow"===n.events[h][1].type){if(e){r=n.events[h][1].end;break}e=!0}for(m(l),o=a;o<n.events.length;)n.events[o][1].end={...r},o++;og(n.events,h+1,0,n.events.slice(a)),n.events.length=o}}function m(i){let r=o.length;for(;r-- >i;){let i=o[r];n.containerState=i[1],i[0].exit.call(n,e)}o.length=i}function v(){i.write([null]),r=void 0,i=void 0,n.containerState._closeFlow=void 0}}},oN={tokenize:function(e,i,r){return oL(e,e.attempt(this.parser.constructs.document,i,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},oO={partial:!0,tokenize:function(e,i,r){return function(i){return oR(i)?oL(e,s,"linePrefix")(i):s(i)};function s(e){return null===e||oE(e)?i(e):r(e)}}};class oI{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,i){let r=null==i?1/0:i;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,i,r){this.setCursor(Math.trunc(e));let s=this.right.splice(this.right.length-(i||0),1/0);return r&&oz(this.left,r),s.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),oz(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),oz(this.right,e.reverse())}setCursor(e){if(e!==this.left.length&&(!(e>this.left.length)||0!==this.right.length)&&(!(e<0)||0!==this.left.length))if(e<this.left.length){let i=this.left.splice(e,1/0);oz(this.right,i.reverse())}else{let i=this.right.splice(this.left.length+this.right.length-e,1/0);oz(this.left,i.reverse())}}}function oz(e,i){let r=0;if(i.length<1e4)e.push(...i);else for(;r<i.length;)e.push(...i.slice(r,r+1e4)),r+=1e4}function oH(e){let i,r,s,n,o,l,a,h={},c=-1,u=new oI(e);for(;++c<u.length;){for(;c in h;)c=h[c];if(i=u.get(c),c&&"chunkFlow"===i[1].type&&"listItemPrefix"===u.get(c-1)[1].type&&((s=0)<(l=i[1]._tokenizer.events).length&&"lineEndingBlank"===l[s][1].type&&(s+=2),s<l.length&&"content"===l[s][1].type))for(;++s<l.length&&"content"!==l[s][1].type;)"chunkText"===l[s][1].type&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if("enter"===i[0])i[1].contentType&&(Object.assign(h,function(e,i){let r,s,n=e.get(i)[1],o=e.get(i)[2],l=i-1,a=[],h=n._tokenizer;!h&&(h=o.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(h._contentTypeTextTrailing=!0));let c=h.events,u=[],d={},f=-1,_=n,p=0,g=0,m=[0];for(;_;){for(;e.get(++l)[1]!==_;);a.push(l),!_._tokenizer&&(r=o.sliceStream(_),_.next||r.push(null),s&&h.defineSkip(_.start),_._isInFirstContentOfListItem&&(h._gfmTasklistFirstContentOfListItem=!0),h.write(r),_._isInFirstContentOfListItem&&(h._gfmTasklistFirstContentOfListItem=void 0)),s=_,_=_.next}for(_=n;++f<c.length;)"exit"===c[f][0]&&"enter"===c[f-1][0]&&c[f][1].type===c[f-1][1].type&&c[f][1].start.line!==c[f][1].end.line&&(g=f+1,m.push(g),_._tokenizer=void 0,_.previous=void 0,_=_.next);for(h.events=[],_?(_._tokenizer=void 0,_.previous=void 0):m.pop(),f=m.length;f--;){let i=c.slice(m[f],m[f+1]),r=a.pop();u.push([r,r+i.length-1]),e.splice(r,2,i)}for(u.reverse(),f=-1;++f<u.length;)d[p+u[f][0]]=p+u[f][1],p+=u[f][1]-u[f][0]-1;return d}(u,c)),c=h[c],a=!0);else if(i[1]._container){for(s=c,r=void 0;s--;)if("lineEnding"===(n=u.get(s))[1].type||"lineEndingBlank"===n[1].type)"enter"===n[0]&&(r&&(u.get(r)[1].type="lineEndingBlank"),n[1].type="lineEnding",r=s);else if("linePrefix"===n[1].type||"listItemIndent"===n[1].type);else break;r&&(i[1].end={...u.get(r)[1].start},(o=u.slice(r,c)).unshift(i),u.splice(r,c-r+1,o))}}return og(e,0,1/0,u.slice(0)),!a}let oF={resolve:function(e){return oH(e),e},tokenize:function(e,i){let r;return function(i){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),s(i)};function s(i){return null===i?n(i):oE(i)?e.check(oj,o,n)(i):(e.consume(i),s)}function n(r){return e.exit("chunkContent"),e.exit("content"),i(r)}function o(i){return e.consume(i),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,s}}},oj={partial:!0,tokenize:function(e,i,r){let s=this;return function(i){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),oL(e,n,"linePrefix")};function n(n){if(null===n||oE(n))return r(n);let o=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?i(n):e.interrupt(s.parser.constructs.flow,r,i)(n)}}},oW={tokenize:function(e){let i=this,r=e.attempt(oO,function(s){return null===s?void e.consume(s):(e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),i.currentConstruct=void 0,r)},e.attempt(this.parser.constructs.flowInitial,s,oL(e,e.attempt(this.parser.constructs.flow,s,e.attempt(oF,s)),"linePrefix")));return r;function s(s){return null===s?void e.consume(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i.currentConstruct=void 0,r)}}},o$={resolveAll:oV()},oU=oq("string"),oK=oq("text");function oq(e){return{resolveAll:oV("text"===e?oY:void 0),tokenize:function(i){let r=this,s=this.parser.constructs[e],n=i.attempt(s,o,l);return o;function o(e){return h(e)?n(e):l(e)}function l(e){return null===e?void i.consume(e):(i.enter("data"),i.consume(e),a)}function a(e){return h(e)?(i.exit("data"),n(e)):(i.consume(e),a)}function h(e){if(null===e)return!0;let i=s[e],n=-1;if(i)for(;++n<i.length;){let e=i[n];if(!e.previous||e.previous.call(r,r.previous))return!0}return!1}}}}function oV(e){return function(i,r){let s,n=-1;for(;++n<=i.length;)void 0===s?i[n]&&"data"===i[n][1].type&&(s=n,n++):i[n]&&"data"===i[n][1].type||(n!==s+2&&(i[s][1].end=i[n-1][1].end,i.splice(s+2,n-s-2),n=s+2),s=void 0);return e?e(i,r):i}}function oY(e,i){let r=0;for(;++r<=e.length;)if((r===e.length||"lineEnding"===e[r][1].type)&&"data"===e[r-1][1].type){let s,n=e[r-1][1],o=i.sliceStream(n),l=o.length,a=-1,h=0;for(;l--;){let e=o[l];if("string"==typeof e){for(a=e.length;32===e.charCodeAt(a-1);)h++,a--;if(a)break;a=-1}else if(-2===e)s=!0,h++;else if(-1===e);else{l++;break}}if(i._contentTypeTextTrailing&&r===e.length&&(h=0),h){let o={type:r===e.length||s||h<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?a:n.start._bufferIndex+a,_index:n.start._index+l,line:n.end.line,column:n.end.column-h,offset:n.end.offset-h},end:{...n.end}};n.end={...o.start},n.start.offset===n.end.offset?Object.assign(n,o):(e.splice(r,0,["enter",o,i],["exit",o,i]),r+=2)}r++}return e}function oX(e){return null===e||oD(e)||oP(e)?1:oM(e)?2:void 0}function oG(e,i,r){let s=[],n=-1;for(;++n<e.length;){let o=e[n].resolveAll;o&&!s.includes(o)&&(i=o(i,r),s.push(o))}return i}let oJ={name:"attention",resolveAll:function(e,i){let r,s,n,o,l,a,h,c,u=-1;for(;++u<e.length;)if("enter"===e[u][0]&&"attentionSequence"===e[u][1].type&&e[u][1]._close){for(r=u;r--;)if("exit"===e[r][0]&&"attentionSequence"===e[r][1].type&&e[r][1]._open&&i.sliceSerialize(e[r][1]).charCodeAt(0)===i.sliceSerialize(e[u][1]).charCodeAt(0)){if((e[r][1]._close||e[u][1]._open)&&(e[u][1].end.offset-e[u][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[u][1].end.offset-e[u][1].start.offset)%3))continue;a=e[r][1].end.offset-e[r][1].start.offset>1&&e[u][1].end.offset-e[u][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[u][1].start};oZ(d,-a),oZ(f,a),o={type:a>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},l={type:a>1?"strongSequence":"emphasisSequence",start:{...e[u][1].start},end:f},n={type:a>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[u][1].start}},s={type:a>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[r][1].end={...o.start},e[u][1].start={...l.end},h=[],e[r][1].end.offset-e[r][1].start.offset&&(h=om(h,[["enter",e[r][1],i],["exit",e[r][1],i]])),h=om(h,[["enter",s,i],["enter",o,i],["exit",o,i],["enter",n,i]]),h=om(h,oG(i.parser.constructs.insideSpan.null,e.slice(r+1,u),i)),h=om(h,[["exit",n,i],["enter",l,i],["exit",l,i],["exit",s,i]]),e[u][1].end.offset-e[u][1].start.offset?(c=2,h=om(h,[["enter",e[u][1],i],["exit",e[u][1],i]])):c=0,og(e,r-1,u-r+3,h),u=r+h.length-c-2;break}}for(u=-1;++u<e.length;)"attentionSequence"===e[u][1].type&&(e[u][1].type="data");return e},tokenize:function(e,i){let r,s=this.parser.constructs.attentionMarkers.null,n=this.previous,o=oX(n);return function(l){return r=l,e.enter("attentionSequence"),function l(a){if(a===r)return e.consume(a),l;let h=e.exit("attentionSequence"),c=oX(a),u=!c||2===c&&o||s.includes(a),d=!o||2===o&&c||s.includes(n);return h._open=!!(42===r?u:u&&(o||!d)),h._close=!!(42===r?d:d&&(c||!u)),i(a)}(l)}}};function oZ(e,i){e.column+=i,e.offset+=i,e._bufferIndex+=i}let oQ={continuation:{tokenize:function(e,i,r){let s=this;return function(i){return oR(i)?oL(e,n,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):n(i)};function n(s){return e.attempt(oQ,i,r)(s)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,i,r){let s=this;return function(i){if(62===i){let r=s.containerState;return r.open||(e.enter("blockQuote",{_container:!0}),r.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(i),e.exit("blockQuoteMarker"),n}return r(i)};function n(r){return oR(r)?(e.enter("blockQuotePrefixWhitespace"),e.consume(r),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),i):(e.exit("blockQuotePrefix"),i(r))}}},o0={name:"characterEscape",tokenize:function(e,i,r){return function(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),s};function s(s){return ok(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),i):r(s)}}},o1=document.createElement("i");function o2(e){let i="&"+e+";";o1.innerHTML=i;let r=o1.textContent;return(59!==r.charCodeAt(r.length-1)||"semi"===e)&&r!==i&&r}let o5={name:"characterReference",tokenize:function(e,i,r){let s,n,o=this,l=0;return function(i){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(i),e.exit("characterReferenceMarker"),a};function a(i){return 35===i?(e.enter("characterReferenceMarkerNumeric"),e.consume(i),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),s=31,n=oy,c(i))}function h(i){return 88===i||120===i?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(i),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,n=oC,c):(e.enter("characterReferenceValue"),s=7,n=ow,c(i))}function c(a){if(59===a&&l){let s=e.exit("characterReferenceValue");return n!==oy||o2(o.sliceSerialize(s))?(e.enter("characterReferenceMarker"),e.consume(a),e.exit("characterReferenceMarker"),e.exit("characterReference"),i):r(a)}return n(a)&&l++<s?(e.consume(a),c):r(a)}}},o3={partial:!0,tokenize:function(e,i,r){let s=this;return function(i){return null===i?r(i):(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n)};function n(e){return s.parser.lazy[s.now().line]?r(e):i(e)}}},o4={concrete:!0,name:"codeFenced",tokenize:function(e,i,r){let s,n=this,o={partial:!0,tokenize:function(e,i,r){let o=0;return function(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),l};function l(i){return e.enter("codeFencedFence"),oR(i)?oL(e,h,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):h(i)}function h(i){return i===s?(e.enter("codeFencedFenceSequence"),function i(n){return n===s?(o++,e.consume(n),i):o>=a?(e.exit("codeFencedFenceSequence"),oR(n)?oL(e,c,"whitespace")(n):c(n)):r(n)}(i)):r(i)}function c(s){return null===s||oE(s)?(e.exit("codeFencedFence"),i(s)):r(s)}}},l=0,a=0;return function(i){var o;let c;return o=i,l=(c=n.events[n.events.length-1])&&"linePrefix"===c[1].type?c[2].sliceSerialize(c[1],!0).length:0,s=o,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),function i(n){return n===s?(a++,e.consume(n),i):a<3?r(n):(e.exit("codeFencedFenceSequence"),oR(n)?oL(e,h,"whitespace")(n):h(n))}(o)};function h(o){return null===o||oE(o)?(e.exit("codeFencedFence"),n.interrupt?i(o):e.check(o3,u,p)(o)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),function i(n){return null===n||oE(n)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(n)):oR(n)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),oL(e,c,"whitespace")(n)):96===n&&n===s?r(n):(e.consume(n),i)}(o))}function c(i){return null===i||oE(i)?h(i):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),function i(n){return null===n||oE(n)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(n)):96===n&&n===s?r(n):(e.consume(n),i)}(i))}function u(i){return e.attempt(o,p,d)(i)}function d(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),f}function f(i){return l>0&&oR(i)?oL(e,_,"linePrefix",l+1)(i):_(i)}function _(i){return null===i||oE(i)?e.check(o3,u,p)(i):(e.enter("codeFlowValue"),function i(r){return null===r||oE(r)?(e.exit("codeFlowValue"),_(r)):(e.consume(r),i)}(i))}function p(r){return e.exit("codeFenced"),i(r)}}},o6={name:"codeIndented",tokenize:function(e,i,r){let s=this;return function(i){return e.enter("codeIndented"),oL(e,n,"linePrefix",5)(i)};function n(i){let n=s.events[s.events.length-1];return n&&"linePrefix"===n[1].type&&n[2].sliceSerialize(n[1],!0).length>=4?function i(r){return null===r?o(r):oE(r)?e.attempt(o9,i,o)(r):(e.enter("codeFlowValue"),function r(s){return null===s||oE(s)?(e.exit("codeFlowValue"),i(s)):(e.consume(s),r)}(r))}(i):r(i)}function o(r){return e.exit("codeIndented"),i(r)}}},o9={partial:!0,tokenize:function(e,i,r){let s=this;return n;function n(i){return s.parser.lazy[s.now().line]?r(i):oE(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n):oL(e,o,"linePrefix",5)(i)}function o(e){let o=s.events[s.events.length-1];return o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?i(e):oE(e)?n(e):r(e)}}};function o8(e,i,r,s,n,o,l,a,h){let c=h||1/0,u=0;return function(i){return 60===i?(e.enter(s),e.enter(n),e.enter(o),e.consume(i),e.exit(o),d):null===i||32===i||41===i||ox(i)?r(i):(e.enter(s),e.enter(l),e.enter(a),e.enter("chunkString",{contentType:"string"}),p(i))};function d(r){return 62===r?(e.enter(o),e.consume(r),e.exit(o),e.exit(n),e.exit(s),i):(e.enter(a),e.enter("chunkString",{contentType:"string"}),f(r))}function f(i){return 62===i?(e.exit("chunkString"),e.exit(a),d(i)):null===i||60===i||oE(i)?r(i):(e.consume(i),92===i?_:f)}function _(i){return 60===i||62===i||92===i?(e.consume(i),f):f(i)}function p(n){return!u&&(null===n||41===n||oD(n))?(e.exit("chunkString"),e.exit(a),e.exit(l),e.exit(s),i(n)):u<c&&40===n?(e.consume(n),u++,p):41===n?(e.consume(n),u--,p):null===n||32===n||40===n||ox(n)?r(n):(e.consume(n),92===n?g:p)}function g(i){return 40===i||41===i||92===i?(e.consume(i),p):p(i)}}function o7(e,i,r,s,n,o){let l,a=this,h=0;return function(i){return e.enter(s),e.enter(n),e.consume(i),e.exit(n),e.enter(o),c};function c(d){return h>999||null===d||91===d||93===d&&!l||94===d&&!h&&"_hiddenFootnoteSupport"in a.parser.constructs?r(d):93===d?(e.exit(o),e.enter(n),e.consume(d),e.exit(n),e.exit(s),i):oE(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),u(d))}function u(i){return null===i||91===i||93===i||oE(i)||h++>999?(e.exit("chunkString"),c(i)):(e.consume(i),l||(l=!oR(i)),92===i?d:u)}function d(i){return 91===i||92===i||93===i?(e.consume(i),h++,u):u(i)}}function le(e,i,r,s,n,o){let l;return function(i){return 34===i||39===i||40===i?(e.enter(s),e.enter(n),e.consume(i),e.exit(n),l=40===i?41:i,a):r(i)};function a(r){return r===l?(e.enter(n),e.consume(r),e.exit(n),e.exit(s),i):(e.enter(o),h(r))}function h(i){return i===l?(e.exit(o),a(l)):null===i?r(i):oE(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),oL(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(i))}function c(i){return i===l||null===i||oE(i)?(e.exit("chunkString"),h(i)):(e.consume(i),92===i?u:c)}function u(i){return i===l||92===i?(e.consume(i),c):c(i)}}function lt(e,i){let r;return function s(n){return oE(n)?(e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),r=!0,s):oR(n)?oL(e,s,r?"linePrefix":"lineSuffix")(n):i(n)}}function li(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}let lr={partial:!0,tokenize:function(e,i,r){return function(i){return oD(i)?lt(e,s)(i):r(i)};function s(i){return le(e,n,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(i)}function n(i){return oR(i)?oL(e,o,"whitespace")(i):o(i)}function o(e){return null===e||oE(e)?i(e):r(e)}}},ls=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ln=["pre","script","style","textarea"],lo={partial:!0,tokenize:function(e,i,r){return function(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(oO,i,r)}}},ll={partial:!0,tokenize:function(e,i,r){let s=this;return function(i){return oE(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n):r(i)};function n(e){return s.parser.lazy[s.now().line]?r(e):i(e)}}},la={name:"labelEnd",resolveAll:function(e){let i=-1,r=[];for(;++i<e.length;){let s=e[i][1];if(r.push(e[i]),"labelImage"===s.type||"labelLink"===s.type||"labelEnd"===s.type){let e="labelImage"===s.type?4:2;s.type="data",i+=e}}return e.length!==r.length&&og(e,0,e.length,r),e},resolveTo:function(e,i){let r,s,n,o,l=e.length,a=0;for(;l--;)if(r=e[l][1],s){if("link"===r.type||"labelLink"===r.type&&r._inactive)break;"enter"===e[l][0]&&"labelLink"===r.type&&(r._inactive=!0)}else if(n){if("enter"===e[l][0]&&("labelImage"===r.type||"labelLink"===r.type)&&!r._balanced&&(s=l,"labelLink"!==r.type)){a=2;break}}else"labelEnd"===r.type&&(n=l);let h={type:"labelLink"===e[s][1].type?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[s][1].start},end:{...e[n][1].end}},u={type:"labelText",start:{...e[s+a+2][1].end},end:{...e[n-2][1].start}};return o=om(o=[["enter",h,i],["enter",c,i]],e.slice(s+1,s+a+3)),o=om(o,[["enter",u,i]]),o=om(o,oG(i.parser.constructs.insideSpan.null,e.slice(s+a+4,n-3),i)),o=om(o,[["exit",u,i],e[n-2],e[n-1],["exit",c,i]]),o=om(o,e.slice(n+1)),o=om(o,[["exit",h,i]]),og(e,s,e.length,o),e},tokenize:function(e,i,r){let s,n,o=this,l=o.events.length;for(;l--;)if(("labelImage"===o.events[l][1].type||"labelLink"===o.events[l][1].type)&&!o.events[l][1]._balanced){s=o.events[l][1];break}return function(i){return s?s._inactive?u(i):(n=o.parser.defined.includes(li(o.sliceSerialize({start:s.end,end:o.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(i),e.exit("labelMarker"),e.exit("labelEnd"),a):r(i)};function a(i){return 40===i?e.attempt(lh,c,n?c:u)(i):91===i?e.attempt(lc,c,n?h:u)(i):n?c(i):u(i)}function h(i){return e.attempt(lu,c,u)(i)}function c(e){return i(e)}function u(e){return s._balanced=!0,r(e)}}},lh={tokenize:function(e,i,r){return function(i){return e.enter("resource"),e.enter("resourceMarker"),e.consume(i),e.exit("resourceMarker"),s};function s(i){return oD(i)?lt(e,n)(i):n(i)}function n(i){return 41===i?c(i):o8(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(i)}function o(i){return oD(i)?lt(e,a)(i):c(i)}function l(e){return r(e)}function a(i){return 34===i||39===i||40===i?le(e,h,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(i):c(i)}function h(i){return oD(i)?lt(e,c)(i):c(i)}function c(s){return 41===s?(e.enter("resourceMarker"),e.consume(s),e.exit("resourceMarker"),e.exit("resource"),i):r(s)}}},lc={tokenize:function(e,i,r){let s=this;return function(i){return o7.call(s,e,n,o,"reference","referenceMarker","referenceString")(i)};function n(e){return s.parser.defined.includes(li(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?i(e):r(e)}function o(e){return r(e)}}},lu={tokenize:function(e,i,r){return function(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),s};function s(s){return 93===s?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),i):r(s)}}},ld={name:"labelStartImage",resolveAll:la.resolveAll,tokenize:function(e,i,r){let s=this;return function(i){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(i),e.exit("labelImageMarker"),n};function n(i){return 91===i?(e.enter("labelMarker"),e.consume(i),e.exit("labelMarker"),e.exit("labelImage"),o):r(i)}function o(e){return 94===e&&"_hiddenFootnoteSupport"in s.parser.constructs?r(e):i(e)}}},lf={name:"labelStartLink",resolveAll:la.resolveAll,tokenize:function(e,i,r){let s=this;return function(i){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(i),e.exit("labelMarker"),e.exit("labelLink"),n};function n(e){return 94===e&&"_hiddenFootnoteSupport"in s.parser.constructs?r(e):i(e)}}},l_={name:"lineEnding",tokenize:function(e,i){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),oL(e,i,"linePrefix")}}},lp={name:"thematicBreak",tokenize:function(e,i,r){let s,n=0;return function(o){var l;return e.enter("thematicBreak"),s=l=o,function o(l){return l===s?(e.enter("thematicBreakSequence"),function i(r){return r===s?(e.consume(r),n++,i):(e.exit("thematicBreakSequence"),oR(r)?oL(e,o,"whitespace")(r):o(r))}(l)):n>=3&&(null===l||oE(l))?(e.exit("thematicBreak"),i(l)):r(l)}(l)}}},lg={continuation:{tokenize:function(e,i,r){let s=this;return s.containerState._closeFlow=void 0,e.check(oO,function(r){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,oL(e,i,"listItemIndent",s.containerState.size+1)(r)},function(r){return s.containerState.furtherBlankLines||!oR(r)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,n(r)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(lv,i,n)(r))});function n(n){return s.containerState._closeFlow=!0,s.interrupt=void 0,oL(e,e.attempt(lg,i,r),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(n)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,i,r){let s=this,n=s.events[s.events.length-1],o=n&&"linePrefix"===n[1].type?n[2].sliceSerialize(n[1],!0).length:0,l=0;return function(i){let n=s.containerState.type||(42===i||43===i||45===i?"listUnordered":"listOrdered");if("listUnordered"===n?!s.containerState.marker||i===s.containerState.marker:ow(i)){if(s.containerState.type||(s.containerState.type=n,e.enter(n,{_container:!0})),"listUnordered"===n)return e.enter("listItemPrefix"),42===i||45===i?e.check(lp,r,a)(i):a(i);if(!s.interrupt||49===i)return e.enter("listItemPrefix"),e.enter("listItemValue"),function i(n){return ow(n)&&++l<10?(e.consume(n),i):(!s.interrupt||l<2)&&(s.containerState.marker?n===s.containerState.marker:41===n||46===n)?(e.exit("listItemValue"),a(n)):r(n)}(i)}return r(i)};function a(i){return e.enter("listItemMarker"),e.consume(i),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||i,e.check(oO,s.interrupt?r:h,e.attempt(lm,u,c))}function h(e){return s.containerState.initialBlankLine=!0,o++,u(e)}function c(i){return oR(i)?(e.enter("listItemPrefixWhitespace"),e.consume(i),e.exit("listItemPrefixWhitespace"),u):r(i)}function u(r){return s.containerState.size=o+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,i(r)}}},lm={partial:!0,tokenize:function(e,i,r){let s=this;return oL(e,function(e){let n=s.events[s.events.length-1];return!oR(e)&&n&&"listItemPrefixWhitespace"===n[1].type?i(e):r(e)},"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},lv={partial:!0,tokenize:function(e,i,r){let s=this;return oL(e,function(e){let n=s.events[s.events.length-1];return n&&"listItemIndent"===n[1].type&&n[2].sliceSerialize(n[1],!0).length===s.containerState.size?i(e):r(e)},"listItemIndent",s.containerState.size+1)}},lS={name:"setextUnderline",resolveTo:function(e,i){let r,s,n,o=e.length;for(;o--;)if("enter"===e[o][0]){if("content"===e[o][1].type){r=o;break}"paragraph"===e[o][1].type&&(s=o)}else"content"===e[o][1].type&&e.splice(o,1),n||"definition"!==e[o][1].type||(n=o);let l={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",n?(e.splice(s,0,["enter",l,i]),e.splice(n+1,0,["exit",e[r][1],i]),e[r][1].end={...e[n][1].end}):e[r][1]=l,e.push(["exit",l,i]),e},tokenize:function(e,i,r){let s,n=this;return function(i){var l;let a,h=n.events.length;for(;h--;)if("lineEnding"!==n.events[h][1].type&&"linePrefix"!==n.events[h][1].type&&"content"!==n.events[h][1].type){a="paragraph"===n.events[h][1].type;break}return!n.parser.lazy[n.now().line]&&(n.interrupt||a)?(e.enter("setextHeadingLine"),s=i,l=i,e.enter("setextHeadingLineSequence"),function i(r){return r===s?(e.consume(r),i):(e.exit("setextHeadingLineSequence"),oR(r)?oL(e,o,"lineSuffix")(r):o(r))}(l)):r(i)};function o(s){return null===s||oE(s)?(e.exit("setextHeadingLine"),i(s)):r(s)}}};e.s(["attentionMarkers",0,{null:[42,95]},"contentInitial",0,{91:{name:"definition",tokenize:function(e,i,r){let s,n=this;return function(i){var s;return e.enter("definition"),s=i,o7.call(n,e,o,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(s)};function o(i){return(s=li(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),58===i)?(e.enter("definitionMarker"),e.consume(i),e.exit("definitionMarker"),l):r(i)}function l(i){return oD(i)?lt(e,a)(i):a(i)}function a(i){return o8(e,h,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(i)}function h(i){return e.attempt(lr,c,c)(i)}function c(i){return oR(i)?oL(e,u,"whitespace")(i):u(i)}function u(o){return null===o||oE(o)?(e.exit("definition"),n.parser.defined.push(s),i(o)):r(o)}}}},"disable",0,{null:[]},"document",0,{42:lg,43:lg,45:lg,48:lg,49:lg,50:lg,51:lg,52:lg,53:lg,54:lg,55:lg,56:lg,57:lg,62:oQ},"flow",0,{35:{name:"headingAtx",resolve:function(e,i){let r,s,n=e.length-2,o=3;return"whitespace"===e[3][1].type&&(o+=2),n-2>o&&"whitespace"===e[n][1].type&&(n-=2),"atxHeadingSequence"===e[n][1].type&&(o===n-1||n-4>o&&"whitespace"===e[n-2][1].type)&&(n-=o+1===n?2:4),n>o&&(r={type:"atxHeadingText",start:e[o][1].start,end:e[n][1].end},s={type:"chunkText",start:e[o][1].start,end:e[n][1].end,contentType:"text"},og(e,o,n-o+1,[["enter",r,i],["enter",s,i],["exit",s,i],["exit",r,i]])),e},tokenize:function(e,i,r){let s=0;return function(n){var o;return e.enter("atxHeading"),o=n,e.enter("atxHeadingSequence"),function n(o){return 35===o&&s++<6?(e.consume(o),n):null===o||oD(o)?(e.exit("atxHeadingSequence"),function r(s){return 35===s?(e.enter("atxHeadingSequence"),function i(s){return 35===s?(e.consume(s),i):(e.exit("atxHeadingSequence"),r(s))}(s)):null===s||oE(s)?(e.exit("atxHeading"),i(s)):oR(s)?oL(e,r,"whitespace")(s):(e.enter("atxHeadingText"),function i(s){return null===s||35===s||oD(s)?(e.exit("atxHeadingText"),r(s)):(e.consume(s),i)}(s))}(o)):r(o)}(o)}}},42:lp,45:[lS,lp],60:{concrete:!0,name:"htmlFlow",resolveTo:function(e){let i=e.length;for(;i--&&("enter"!==e[i][0]||"htmlFlow"!==e[i][1].type););return i>1&&"linePrefix"===e[i-2][1].type&&(e[i][1].start=e[i-2][1].start,e[i+1][1].start=e[i-2][1].start,e.splice(i-2,2)),e},tokenize:function(e,i,r){let s,n,o,l,a,h=this;return function(i){var r;return r=i,e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(r),c};function c(l){return 33===l?(e.consume(l),u):47===l?(e.consume(l),n=!0,_):63===l?(e.consume(l),s=3,h.interrupt?i:T):oS(l)?(e.consume(l),o=String.fromCharCode(l),p):r(l)}function u(n){return 45===n?(e.consume(n),s=2,d):91===n?(e.consume(n),s=5,l=0,f):oS(n)?(e.consume(n),s=4,h.interrupt?i:T):r(n)}function d(s){return 45===s?(e.consume(s),h.interrupt?i:T):r(s)}function f(s){let n="CDATA[";return s===n.charCodeAt(l++)?(e.consume(s),l===n.length)?h.interrupt?i:k:f:r(s)}function _(i){return oS(i)?(e.consume(i),o=String.fromCharCode(i),p):r(i)}function p(l){if(null===l||47===l||62===l||oD(l)){let a=47===l,c=o.toLowerCase();return!a&&!n&&ln.includes(c)?(s=1,h.interrupt?i(l):k(l)):ls.includes(o.toLowerCase())?(s=6,a)?(e.consume(l),g):h.interrupt?i(l):k(l):(s=7,h.interrupt&&!h.parser.lazy[h.now().line]?r(l):n?function i(r){return oR(r)?(e.consume(r),i):w(r)}(l):m(l))}return 45===l||oy(l)?(e.consume(l),o+=String.fromCharCode(l),p):r(l)}function g(s){return 62===s?(e.consume(s),h.interrupt?i:k):r(s)}function m(i){return 47===i?(e.consume(i),w):58===i||95===i||oS(i)?(e.consume(i),v):oR(i)?(e.consume(i),m):w(i)}function v(i){return 45===i||46===i||58===i||95===i||oy(i)?(e.consume(i),v):S(i)}function S(i){return 61===i?(e.consume(i),y):oR(i)?(e.consume(i),S):m(i)}function y(i){return null===i||60===i||61===i||62===i||96===i?r(i):34===i||39===i?(e.consume(i),a=i,b):oR(i)?(e.consume(i),y):function i(r){return null===r||34===r||39===r||47===r||60===r||61===r||62===r||96===r||oD(r)?S(r):(e.consume(r),i)}(i)}function b(i){return i===a?(e.consume(i),a=null,x):null===i||oE(i)?r(i):(e.consume(i),b)}function x(e){return 47===e||62===e||oR(e)?m(e):r(e)}function w(i){return 62===i?(e.consume(i),C):r(i)}function C(i){return null===i||oE(i)?k(i):oR(i)?(e.consume(i),C):r(i)}function k(i){return 45===i&&2===s?(e.consume(i),M):60===i&&1===s?(e.consume(i),P):62===i&&4===s?(e.consume(i),A):63===i&&3===s?(e.consume(i),T):93===i&&5===s?(e.consume(i),L):oE(i)&&(6===s||7===s)?(e.exit("htmlFlowData"),e.check(lo,N,E)(i)):null===i||oE(i)?(e.exit("htmlFlowData"),E(i)):(e.consume(i),k)}function E(i){return e.check(ll,D,N)(i)}function D(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),R}function R(i){return null===i||oE(i)?E(i):(e.enter("htmlFlowData"),k(i))}function M(i){return 45===i?(e.consume(i),T):k(i)}function P(i){return 47===i?(e.consume(i),o="",B):k(i)}function B(i){if(62===i){let r=o.toLowerCase();return ln.includes(r)?(e.consume(i),A):k(i)}return oS(i)&&o.length<8?(e.consume(i),o+=String.fromCharCode(i),B):k(i)}function L(i){return 93===i?(e.consume(i),T):k(i)}function T(i){return 62===i?(e.consume(i),A):45===i&&2===s?(e.consume(i),T):k(i)}function A(i){return null===i||oE(i)?(e.exit("htmlFlowData"),N(i)):(e.consume(i),A)}function N(r){return e.exit("htmlFlow"),i(r)}}},61:lS,95:lp,96:o4,126:o4},"flowInitial",0,{[-2]:o6,[-1]:o6,32:o6},"insideSpan",0,{null:[oJ,o$]},"string",0,{38:o5,92:o0},"text",0,{[-5]:l_,[-4]:l_,[-3]:l_,33:ld,38:o5,42:oJ,60:[{name:"autolink",tokenize:function(e,i,r){let s=0;return function(i){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(i),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),n};function n(i){return oS(i)?(e.consume(i),o):64===i?r(i):a(i)}function o(i){return 43===i||45===i||46===i||oy(i)?(s=1,function i(r){return 58===r?(e.consume(r),s=0,l):(43===r||45===r||46===r||oy(r))&&s++<32?(e.consume(r),i):(s=0,a(r))}(i)):a(i)}function l(s){return 62===s?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(s),e.exit("autolinkMarker"),e.exit("autolink"),i):null===s||32===s||60===s||ox(s)?r(s):(e.consume(s),l)}function a(i){return 64===i?(e.consume(i),h):ob(i)?(e.consume(i),a):r(i)}function h(n){return oy(n)?function n(o){return 46===o?(e.consume(o),s=0,h):62===o?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(o),e.exit("autolinkMarker"),e.exit("autolink"),i):function i(o){if((45===o||oy(o))&&s++<63){let r=45===o?i:n;return e.consume(o),r}return r(o)}(o)}(n):r(n)}}},{name:"htmlText",tokenize:function(e,i,r){let s,n,o,l=this;return function(i){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(i),a};function a(i){return 33===i?(e.consume(i),h):47===i?(e.consume(i),b):63===i?(e.consume(i),S):oS(i)?(e.consume(i),w):r(i)}function h(i){return 45===i?(e.consume(i),c):91===i?(e.consume(i),n=0,_):oS(i)?(e.consume(i),v):r(i)}function c(i){return 45===i?(e.consume(i),f):r(i)}function u(i){return null===i?r(i):45===i?(e.consume(i),d):oE(i)?(o=u,B(i)):(e.consume(i),u)}function d(i){return 45===i?(e.consume(i),f):u(i)}function f(e){return 62===e?P(e):45===e?d(e):u(e)}function _(i){let s="CDATA[";return i===s.charCodeAt(n++)?(e.consume(i),n===s.length?p:_):r(i)}function p(i){return null===i?r(i):93===i?(e.consume(i),g):oE(i)?(o=p,B(i)):(e.consume(i),p)}function g(i){return 93===i?(e.consume(i),m):p(i)}function m(i){return 62===i?P(i):93===i?(e.consume(i),m):p(i)}function v(i){return null===i||62===i?P(i):oE(i)?(o=v,B(i)):(e.consume(i),v)}function S(i){return null===i?r(i):63===i?(e.consume(i),y):oE(i)?(o=S,B(i)):(e.consume(i),S)}function y(e){return 62===e?P(e):S(e)}function b(i){return oS(i)?(e.consume(i),x):r(i)}function x(i){return 45===i||oy(i)?(e.consume(i),x):function i(r){return oE(r)?(o=i,B(r)):oR(r)?(e.consume(r),i):P(r)}(i)}function w(i){return 45===i||oy(i)?(e.consume(i),w):47===i||62===i||oD(i)?C(i):r(i)}function C(i){return 47===i?(e.consume(i),P):58===i||95===i||oS(i)?(e.consume(i),k):oE(i)?(o=C,B(i)):oR(i)?(e.consume(i),C):P(i)}function k(i){return 45===i||46===i||58===i||95===i||oy(i)?(e.consume(i),k):function i(r){return 61===r?(e.consume(r),E):oE(r)?(o=i,B(r)):oR(r)?(e.consume(r),i):C(r)}(i)}function E(i){return null===i||60===i||61===i||62===i||96===i?r(i):34===i||39===i?(e.consume(i),s=i,D):oE(i)?(o=E,B(i)):oR(i)?(e.consume(i),E):(e.consume(i),R)}function D(i){return i===s?(e.consume(i),s=void 0,M):null===i?r(i):oE(i)?(o=D,B(i)):(e.consume(i),D)}function R(i){return null===i||34===i||39===i||60===i||61===i||96===i?r(i):47===i||62===i||oD(i)?C(i):(e.consume(i),R)}function M(e){return 47===e||62===e||oD(e)?C(e):r(e)}function P(s){return 62===s?(e.consume(s),e.exit("htmlTextData"),e.exit("htmlText"),i):r(s)}function B(i){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),L}function L(i){return oR(i)?oL(e,T,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):T(i)}function T(i){return e.enter("htmlTextData"),o(i)}}}],91:lf,92:[{name:"hardBreakEscape",tokenize:function(e,i,r){return function(i){return e.enter("hardBreakEscape"),e.consume(i),s};function s(s){return oE(s)?(e.exit("hardBreakEscape"),i(s)):r(s)}}},o0],93:la,95:oJ,96:{name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let i,r,s=e.length-4,n=3;if(("lineEnding"===e[3][1].type||"space"===e[n][1].type)&&("lineEnding"===e[s][1].type||"space"===e[s][1].type)){for(i=n;++i<s;)if("codeTextData"===e[i][1].type){e[n][1].type="codeTextPadding",e[s][1].type="codeTextPadding",n+=2,s-=2;break}}for(i=n-1,s++;++i<=s;)void 0===r?i!==s&&"lineEnding"!==e[i][1].type&&(r=i):(i===s||"lineEnding"===e[i][1].type)&&(e[r][1].type="codeTextData",i!==r+2&&(e[r][1].end=e[i-1][1].end,e.splice(r+2,i-r-2),s-=i-r-2,i=r+2),r=void 0);return e},tokenize:function(e,i,r){let s,n,o=0;return function(i){return e.enter("codeText"),e.enter("codeTextSequence"),function i(r){return 96===r?(e.consume(r),o++,i):(e.exit("codeTextSequence"),l(r))}(i)};function l(h){return null===h?r(h):32===h?(e.enter("space"),e.consume(h),e.exit("space"),l):96===h?(n=e.enter("codeTextSequence"),s=0,function r(l){return 96===l?(e.consume(l),s++,r):s===o?(e.exit("codeTextSequence"),e.exit("codeText"),i(l)):(n.type="codeTextData",a(l))}(h)):oE(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),l):(e.enter("codeTextData"),a(h))}function a(i){return null===i||32===i||96===i||oE(i)?(e.exit("codeTextData"),l(i)):(e.consume(i),a)}}}}],94125);var ly=e.i(94125);let lb=/[\0\t\n\r]/g;function lx(e,i){let r=Number.parseInt(e,i);return r<9||11===r||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(65535&r)==65535||(65535&r)==65534||r>1114111?"�":String.fromCodePoint(r)}let lw=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function lC(e,i,r){if(i)return i;if(35===r.charCodeAt(0)){let e=r.charCodeAt(1),i=120===e||88===e;return lx(r.slice(i?2:1),i?16:10)}return o2(r)||e}let lk={}.hasOwnProperty;function lE(e){return{line:e.line,column:e.column,offset:e.offset}}function lD(e,i){if(e)throw Error("Cannot close `"+e.type+"` ("+n3({start:e.start,end:e.end})+"): a different token (`"+i.type+"`, "+n3({start:i.start,end:i.end})+") is open");throw Error("Cannot close document, a token (`"+i.type+"`, "+n3({start:i.start,end:i.end})+") is still open")}function lR(e){let i=this;i.parser=function(r){var s,n;let o,l,a,h;return"object"==typeof(s={...i.data("settings"),...e,extensions:i.data("micromarkExtensions")||[],mdastExtensions:i.data("fromMarkdownExtensions")||[]})&&(n=s,s=void 0),(function(e){let i={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(v),autolinkProtocol:c,autolinkEmail:c,atxHeading:s(p),blockQuote:s(function(){return{type:"blockquote",children:[]}}),characterEscape:c,characterReference:c,codeFenced:s(_),codeFencedFenceInfo:n,codeFencedFenceMeta:n,codeIndented:s(_,n),codeText:s(function(){return{type:"inlineCode",value:""}},n),codeTextData:c,data:c,codeFlowValue:c,definition:s(function(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:n,definitionLabelString:n,definitionTitleString:n,emphasis:s(function(){return{type:"emphasis",children:[]}}),hardBreakEscape:s(g),hardBreakTrailing:s(g),htmlFlow:s(m,n),htmlFlowData:c,htmlText:s(m,n),htmlTextData:c,image:s(function(){return{type:"image",title:null,url:"",alt:null}}),label:n,link:s(v),listItem:s(function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}),listItemValue:function(e){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:s(S,function(){this.data.expectingFirstListItemValue=!0}),listUnordered:s(S),paragraph:s(function(){return{type:"paragraph",children:[]}}),reference:function(){this.data.referenceType="collapsed"},referenceString:n,resourceDestinationString:n,resourceTitleString:n,setextHeading:s(p),strong:s(function(){return{type:"strong",children:[]}}),thematicBreak:s(function(){return{type:"thematicBreak"}})},exit:{atxHeading:l(),atxHeadingSequence:function(e){let i=this.stack[this.stack.length-1];i.depth||(i.depth=this.sliceSerialize(e).length)},autolink:l(),autolinkEmail:function(e){u.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){u.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:l(),characterEscapeValue:u,characterReferenceMarkerHexadecimal:f,characterReferenceMarkerNumeric:f,characterReferenceValue:function(e){let i,r=this.sliceSerialize(e),s=this.data.characterReferenceType;s?(i=lx(r,"characterReferenceMarkerNumeric"===s?10:16),this.data.characterReferenceType=void 0):i=o2(r);let n=this.stack[this.stack.length-1];n.value+=i},characterReference:function(e){this.stack.pop().position.end=lE(e.end)},codeFenced:l(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){let e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){let e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:u,codeIndented:l(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}),codeText:l(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),codeTextData:u,data:u,definition:l(),definitionDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){let i=this.resume(),r=this.stack[this.stack.length-1];r.label=i,r.identifier=li(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:l(),hardBreakEscape:l(d),hardBreakTrailing:l(d),htmlFlow:l(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlFlowData:u,htmlText:l(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlTextData:u,image:l(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let i=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=i,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),label:function(){let e=this.stack[this.stack.length-1],i=this.resume(),r=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===r.type?r.children=e.children:r.alt=i},labelText:function(e){let i=this.sliceSerialize(e),r=this.stack[this.stack.length-2];r.label=i.replace(lw,lC),r.identifier=li(i).toLowerCase()},lineEnding:function(e){let r=this.stack[this.stack.length-1];if(this.data.atHardBreak){r.children[r.children.length-1].position.end=lE(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&i.canContainEols.includes(r.type)&&(c.call(this,e),u.call(this,e))},link:l(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let i=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=i,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:function(e){let i=this.resume(),r=this.stack[this.stack.length-1];r.label=i,r.identifier=li(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){this.data.inReference=void 0},setextHeading:l(function(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:l(),thematicBreak:l()}};!function e(i,r){let s=-1;for(;++s<r.length;){let n=r[s];Array.isArray(n)?e(i,n):function(e,i){let r;for(r in i)if(lk.call(i,r))switch(r){case"canContainEols":{let s=i[r];s&&e[r].push(...s);break}case"transforms":{let s=i[r];s&&e[r].push(...s);break}case"enter":case"exit":{let s=i[r];s&&Object.assign(e[r],s)}}}(i,n)}}(i,(e||{}).mdastExtensions||[]);let r={};return function(e){let s={type:"root",children:[]},l={stack:[s],tokenStack:[],config:i,enter:o,exit:a,buffer:n,resume:h,data:r},c=[],u=-1;for(;++u<e.length;)("listOrdered"===e[u][1].type||"listUnordered"===e[u][1].type)&&("enter"===e[u][0]?c.push(u):u=function(e,i,r){let s,n,o,l,a=i-1,h=-1,c=!1;for(;++a<=r;){let i=e[a];switch(i[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===i[0]?h++:h--,l=void 0;break;case"lineEndingBlank":"enter"===i[0]&&(!s||l||h||o||(o=a),l=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:l=void 0}if(!h&&"enter"===i[0]&&"listItemPrefix"===i[1].type||-1===h&&"exit"===i[0]&&("listUnordered"===i[1].type||"listOrdered"===i[1].type)){if(s){let l=a;for(n=void 0;l--;){let i=e[l];if("lineEnding"===i[1].type||"lineEndingBlank"===i[1].type){if("exit"===i[0])continue;n&&(e[n][1].type="lineEndingBlank",c=!0),i[1].type="lineEnding",n=l}else if("linePrefix"===i[1].type||"blockQuotePrefix"===i[1].type||"blockQuotePrefixWhitespace"===i[1].type||"blockQuoteMarker"===i[1].type||"listItemIndent"===i[1].type);else break}o&&(!n||o<n)&&(s._spread=!0),s.end=Object.assign({},n?e[n][1].start:i[1].end),e.splice(n||a,0,["exit",s,i[2]]),a++,r++}if("listItemPrefix"===i[1].type){let n={type:"listItem",_spread:!1,start:Object.assign({},i[1].start),end:void 0};s=n,e.splice(a,0,["enter",n,i[2]]),a++,r++,o=void 0,l=!0}}}return e[i][1]._spread=c,r}(e,c.pop(),u));for(u=-1;++u<e.length;){let r=i[e[u][0]];lk.call(r,e[u][1].type)&&r[e[u][1].type].call(Object.assign({sliceSerialize:e[u][2].sliceSerialize},l),e[u][1])}if(l.tokenStack.length>0){let e=l.tokenStack[l.tokenStack.length-1];(e[1]||lD).call(l,void 0,e[0])}for(s.position={start:lE(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:lE(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},u=-1;++u<i.transforms.length;)s=i.transforms[u](s)||s;return s};function s(e,i){return function(r){o.call(this,e(r),r),i&&i.call(this,r)}}function n(){this.stack.push({type:"fragment",children:[]})}function o(e,i,r){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([i,r||void 0]),e.position={start:lE(i.start),end:void 0}}function l(e){return function(i){e&&e.call(this,i),a.call(this,i)}}function a(e,i){let r=this.stack.pop(),s=this.tokenStack.pop();if(s)s[0].type!==e.type&&(i?i.call(this,e,s[0]):(s[1]||lD).call(this,e,s[0]));else throw Error("Cannot close `"+e.type+"` ("+n3({start:e.start,end:e.end})+"): it’s not open");r.position.end=lE(e.end)}function h(){var e;return e=this.stack.pop(),o_(e,"boolean"!=typeof of.includeImageAlt||of.includeImageAlt,"boolean"!=typeof of.includeHtml||of.includeHtml)}function c(e){let i=this.stack[this.stack.length-1].children,r=i[i.length-1];r&&"text"===r.type||((r={type:"text",value:""}).position={start:lE(e.start),end:void 0},i.push(r)),this.stack.push(r)}function u(e){let i=this.stack.pop();i.value+=this.sliceSerialize(e),i.position.end=lE(e.end)}function d(){this.data.atHardBreak=!0}function f(e){this.data.characterReferenceType=e.type}function _(){return{type:"code",lang:null,meta:null,value:""}}function p(){return{type:"heading",depth:0,children:[]}}function g(){return{type:"break"}}function m(){return{type:"html",value:""}}function v(){return{type:"link",title:null,url:"",children:[]}}function S(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}})(n)(function(e){for(;!oH(e););return e}((function(e){let i={constructs:function(e){let i={},r=-1;for(;++r<e.length;)!function(e,i){let r;for(r in i){let s,n=(ov.call(e,r)?e[r]:void 0)||(e[r]={}),o=i[r];if(o)for(s in o){ov.call(n,s)||(n[s]=[]);let e=o[s];!function(e,i){let r=-1,s=[];for(;++r<i.length;)("after"===i[r].add?e:s).push(i[r]);og(e,0,0,s)}(n[s],Array.isArray(e)?e:e?[e]:[])}}}(i,e[r]);return i}([ly,...(e||{}).extensions||[]]),content:r(oT),defined:[],document:r(oA),flow:r(oW),lazy:{},string:r(oU),text:r(oK)};return i;function r(e){return function(r){return function(e,i,r){let s={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0},n={},o=[],l=[],a=[],h={attempt:p(function(e,i){g(e,i.from)}),check:p(_),consume:function(e){oE(e)?(s.line++,s.column=1,s.offset+=-3===e?2:1,m()):-1!==e&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===l[s._index].length&&(s._bufferIndex=-1,s._index++)),c.previous=e},enter:function(e,i){let r=i||{};return r.type=e,r.start=f(),c.events.push(["enter",r,c]),a.push(r),r},exit:function(e){let i=a.pop();return i.end=f(),c.events.push(["exit",i,c]),i},interrupt:p(_,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(e){n[e.line]=e.column,m()},events:[],now:f,parser:e,previous:null,sliceSerialize:function(e,i){return function(e,i){let r,s=-1,n=[];for(;++s<e.length;){let o,l=e[s];if("string"==typeof l)o=l;else switch(l){case -5:o="\r";break;case -4:o="\n";break;case -3:o="\r\n";break;case -2:o=i?" ":" ";break;case -1:if(!i&&r)continue;o=" ";break;default:o=String.fromCharCode(l)}r=-2===l,n.push(o)}return n.join("")}(d(e),i)},sliceStream:d,write:function(e){return(l=om(l,e),function(){let e;for(;s._index<l.length;){let r=l[s._index];if("string"==typeof r)for(e=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===e&&s._bufferIndex<r.length;){var i;i=r.charCodeAt(s._bufferIndex),u=u(i)}else u=u(r)}}(),null!==l[l.length-1])?[]:(g(i,0),c.events=oG(o,c.events,c),c.events)}},u=i.tokenize.call(c,h);return i.resolveAll&&o.push(i),c;function d(e){return function(e,i){let r,s=i.start._index,n=i.start._bufferIndex,o=i.end._index,l=i.end._bufferIndex;if(s===o)r=[e[s].slice(n,l)];else{if(r=e.slice(s,o),n>-1){let e=r[0];"string"==typeof e?r[0]=e.slice(n):r.shift()}l>0&&r.push(e[o].slice(0,l))}return r}(l,e)}function f(){let{_bufferIndex:e,_index:i,line:r,column:n,offset:o}=s;return{_bufferIndex:e,_index:i,line:r,column:n,offset:o}}function _(e,i){i.restore()}function p(e,i){return function(r,n,o){var l;let u,d,_,p;return Array.isArray(r)?g(r):"tokenize"in r?g([r]):(l=r,function(e){let i=null!==e&&l[e],r=null!==e&&l.null;return g([...Array.isArray(i)?i:i?[i]:[],...Array.isArray(r)?r:r?[r]:[]])(e)});function g(e){return(u=e,d=0,0===e.length)?o:v(e[d])}function v(e){return function(r){let n,o,l,u,d;return(n=f(),o=c.previous,l=c.currentConstruct,u=c.events.length,d=Array.from(a),p={from:u,restore:function(){s=n,c.previous=o,c.currentConstruct=l,c.events.length=u,a=d,m()}},_=e,e.partial||(c.currentConstruct=e),e.name&&c.parser.constructs.disable.null.includes(e.name))?y(r):e.tokenize.call(i?Object.assign(Object.create(c),i):c,h,S,y)(r)}}function S(i){return e(_,p),n}function y(e){return(p.restore(),++d<u.length)?v(u[d]):o}}}function g(e,i){e.resolveAll&&!o.includes(e)&&o.push(e),e.resolve&&og(c.events,i,c.events.length-i,e.resolve(c.events.slice(i),c)),e.resolveTo&&(c.events=e.resolveTo(c.events,c))}function m(){s.line in n&&s.column<2&&(s.column=n[s.line],s.offset+=n[s.line]-1)}}(i,e,r)}}})(n).document().write((l=1,a="",h=!0,function(e,i,r){let s,n,c,u,d,f=[];for(e=a+("string"==typeof e?e.toString():new TextDecoder(i||void 0).decode(e)),c=0,a="",h&&(65279===e.charCodeAt(0)&&c++,h=void 0);c<e.length;){if(lb.lastIndex=c,u=(s=lb.exec(e))&&void 0!==s.index?s.index:e.length,d=e.charCodeAt(u),!s){a=e.slice(c);break}if(10===d&&c===u&&o)f.push(-3),o=void 0;else switch(o&&(f.push(-5),o=void 0),c<u&&(f.push(e.slice(c,u)),l+=u-c),d){case 0:f.push(65533),l++;break;case 9:for(n=4*Math.ceil(l/4),f.push(-2);l++<n;)f.push(-1);break;case 10:f.push(-4),l=1;break;default:o=!0,l=1}c=u+1}return r&&(o&&f.push(-5),a&&f.push(a),f.push(null)),f})(r,s,!0))))}}let lM="object"==typeof self?self:globalThis,lP=e=>{var i;let r,s;return(i=new Map,r=(e,r)=>(i.set(r,e),e),s=n=>{if(i.has(n))return i.get(n);let[o,l]=e[n];switch(o){case 0:case -1:return r(l,n);case 1:{let e=r([],n);for(let i of l)e.push(s(i));return e}case 2:{let e=r({},n);for(let[i,r]of l)e[s(i)]=s(r);return e}case 3:return r(new Date(l),n);case 4:{let{source:e,flags:i}=l;return r(new RegExp(e,i),n)}case 5:{let e=r(new Map,n);for(let[i,r]of l)e.set(s(i),s(r));return e}case 6:{let e=r(new Set,n);for(let i of l)e.add(s(i));return e}case 7:{let{name:e,message:i}=l;return r(new lM[e](i),n)}case 8:return r(BigInt(l),n);case"BigInt":return r(Object(BigInt(l)),n);case"ArrayBuffer":return r(new Uint8Array(l).buffer,l);case"DataView":{let{buffer:e}=new Uint8Array(l);return r(new DataView(e),l)}}return r(new lM[o](l),n)})(0)},{toString:lB}={},{keys:lL}=Object,lT=e=>{let i=typeof e;if("object"!==i||!e)return[0,i];let r=lB.call(e).slice(8,-1);switch(r){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""];case"DataView":return[1,r]}return r.includes("Array")?[1,r]:r.includes("Error")?[7,r]:[2,r]},lA=([e,i])=>0===e&&("function"===i||"symbol"===i),lN=(e,{json:i,lossy:r}={})=>{var s,n,o;let l,a,h=[];return(s=!(i||r),n=!!i,o=new Map,l=(e,i)=>{let r=h.push(e)-1;return o.set(i,r),r},a=e=>{if(o.has(e))return o.get(e);let[i,r]=lT(e);switch(i){case 0:{let n=e;switch(r){case"bigint":i=8,n=e.toString();break;case"function":case"symbol":if(s)throw TypeError("unable to serialize "+r);n=null;break;case"undefined":return l([-1],e)}return l([i,n],e)}case 1:{if(r){let i=e;return"DataView"===r?i=new Uint8Array(e.buffer):"ArrayBuffer"===r&&(i=new Uint8Array(e)),l([r,[...i]],e)}let s=[],n=l([i,s],e);for(let i of e)s.push(a(i));return n}case 2:{if(r)switch(r){case"BigInt":return l([r,e.toString()],e);case"Boolean":case"Number":case"String":return l([r,e.valueOf()],e)}if(n&&"toJSON"in e)return a(e.toJSON());let o=[],h=l([i,o],e);for(let i of lL(e))(s||!lA(lT(e[i])))&&o.push([a(i),a(e[i])]);return h}case 3:return l([i,e.toISOString()],e);case 4:{let{source:r,flags:s}=e;return l([i,{source:r,flags:s}],e)}case 5:{let r=[],n=l([i,r],e);for(let[i,n]of e)(s||!(lA(lT(i))||lA(lT(n))))&&r.push([a(i),a(n)]);return n}case 6:{let r=[],n=l([i,r],e);for(let i of e)(s||!lA(lT(i)))&&r.push(a(i));return n}}let{message:h}=e;return l([i,{name:r,message:h}],e)})(e),h},lO="function"==typeof structuredClone?(e,i)=>i&&("json"in i||"lossy"in i)?lP(lN(e,i)):structuredClone(e):(e,i)=>lP(lN(e,i));function lI(e){let i=[],r=-1,s=0,n=0;for(;++r<e.length;){let o=e.charCodeAt(r),l="";if(37===o&&oy(e.charCodeAt(r+1))&&oy(e.charCodeAt(r+2)))n=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(l=String.fromCharCode(o));else if(o>55295&&o<57344){let i=e.charCodeAt(r+1);o<56320&&i>56319&&i<57344?(l=String.fromCharCode(o,i),n=1):l="�"}else l=String.fromCharCode(o);l&&(i.push(e.slice(s,r),encodeURIComponent(l)),s=r+n+1,l=""),n&&(r+=n,n=0)}return i.join("")+e.slice(s)}function lz(e,i){let r=[{type:"text",value:"↩"}];return i>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(i)}]}),r}function lH(e,i){return"Back to reference "+(e+1)+(i>1?"-"+i:"")}let lF=function(e){var i,r;if(null==e)return lW;if("function"==typeof e)return lj(e);if("object"==typeof e){return Array.isArray(e)?function(e){let i=[],r=-1;for(;++r<e.length;)i[r]=lF(e[r]);return lj(function(...e){let r=-1;for(;++r<i.length;)if(i[r].apply(this,e))return!0;return!1})}(e):(i=e,lj(function(e){let r;for(r in i)if(e[r]!==i[r])return!1;return!0}))}if("string"==typeof e){return r=e,lj(function(e){return e&&e.type===r})}throw Error("Expected function, string, or object as test")};function lj(e){return function(i,r,s){return!!(function(e){return null!==e&&"object"==typeof e&&"type"in e}(i)&&e.call(this,i,"number"==typeof r?r:void 0,s||void 0))}}function lW(){return!0}let l$=[];function lU(e,i,r,s){var n,o,l;let a,h,c,u,d,f;"function"==typeof i&&"function"!=typeof r?(h=void 0,c=i,a=r):(h=i,c=r,a=s),n=h,o=function(e,i){let r=i[i.length-1],s=r?r.children.indexOf(e):void 0;return c(e,s,r)},l=a,"function"==typeof n&&"function"!=typeof o?(l=o,o=n):u=n,d=lF(u),f=l?-1:1,(function e(i,r,s){let a=i&&"object"==typeof i?i:{};if("string"==typeof a.type){let e="string"==typeof a.tagName?a.tagName:"string"==typeof a.name?a.name:void 0;Object.defineProperty(h,"name",{value:"node ("+i.type+(e?"<"+e+">":"")+")"})}return h;function h(){var a;let h,c,u,_=l$;if((!n||d(i,r,s[s.length-1]||void 0))&&!1===(_=Array.isArray(a=o(i,s))?a:"number"==typeof a?[!0,a]:null==a?l$:[a])[0])return _;if("children"in i&&i.children&&i.children&&"skip"!==_[0])for(c=(l?i.children.length:-1)+f,u=s.concat(i);c>-1&&c<i.children.length;){if(!1===(h=e(i.children[c],c,u)())[0])return h;c="number"==typeof h[1]?h[1]:c+f}return _}})(e,void 0,[])()}function lK(e,i){let r=i.referenceType,s="]";if("collapsed"===r?s+="[]":"full"===r&&(s+="["+(i.label||i.identifier)+"]"),"imageReference"===i.type)return[{type:"text",value:"!["+i.alt+s}];let n=e.all(i),o=n[0];o&&"text"===o.type?o.value="["+o.value:n.unshift({type:"text",value:"["});let l=n[n.length-1];return l&&"text"===l.type?l.value+=s:n.push({type:"text",value:s}),n}function lq(e){let i=e.spread;return null==i?e.children.length>1:i}function lV(e,i,r){let s=0,n=e.length;if(i){let i=e.codePointAt(s);for(;9===i||32===i;)s++,i=e.codePointAt(s)}if(r){let i=e.codePointAt(n-1);for(;9===i||32===i;)n--,i=e.codePointAt(n-1)}return n>s?e.slice(s,n):""}let lY={blockquote:function(e,i){let r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(i),!0)};return e.patch(i,r),e.applyData(i,r)},break:function(e,i){let r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(i,r),[e.applyData(i,r),{type:"text",value:"\n"}]},code:function(e,i){let r=i.value?i.value+"\n":"",s={},n=i.lang?i.lang.split(/\s+/):[];n.length>0&&(s.className=["language-"+n[0]]);let o={type:"element",tagName:"code",properties:s,children:[{type:"text",value:r}]};return i.meta&&(o.data={meta:i.meta}),e.patch(i,o),o={type:"element",tagName:"pre",properties:{},children:[o=e.applyData(i,o)]},e.patch(i,o),o},delete:function(e,i){let r={type:"element",tagName:"del",properties:{},children:e.all(i)};return e.patch(i,r),e.applyData(i,r)},emphasis:function(e,i){let r={type:"element",tagName:"em",properties:{},children:e.all(i)};return e.patch(i,r),e.applyData(i,r)},footnoteReference:function(e,i){let r,s="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=String(i.identifier).toUpperCase(),o=lI(n.toLowerCase()),l=e.footnoteOrder.indexOf(n),a=e.footnoteCounts.get(n);void 0===a?(a=0,e.footnoteOrder.push(n),r=e.footnoteOrder.length):r=l+1,a+=1,e.footnoteCounts.set(n,a);let h={type:"element",tagName:"a",properties:{href:"#"+s+"fn-"+o,id:s+"fnref-"+o+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(r)}]};e.patch(i,h);let c={type:"element",tagName:"sup",properties:{},children:[h]};return e.patch(i,c),e.applyData(i,c)},heading:function(e,i){let r={type:"element",tagName:"h"+i.depth,properties:{},children:e.all(i)};return e.patch(i,r),e.applyData(i,r)},html:function(e,i){if(e.options.allowDangerousHtml){let r={type:"raw",value:i.value};return e.patch(i,r),e.applyData(i,r)}},imageReference:function(e,i){let r=String(i.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return lK(e,i);let n={src:lI(s.url||""),alt:i.alt};null!==s.title&&void 0!==s.title&&(n.title=s.title);let o={type:"element",tagName:"img",properties:n,children:[]};return e.patch(i,o),e.applyData(i,o)},image:function(e,i){let r={src:lI(i.url)};null!==i.alt&&void 0!==i.alt&&(r.alt=i.alt),null!==i.title&&void 0!==i.title&&(r.title=i.title);let s={type:"element",tagName:"img",properties:r,children:[]};return e.patch(i,s),e.applyData(i,s)},inlineCode:function(e,i){let r={type:"text",value:i.value.replace(/\r?\n|\r/g," ")};e.patch(i,r);let s={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(i,s),e.applyData(i,s)},linkReference:function(e,i){let r=String(i.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return lK(e,i);let n={href:lI(s.url||"")};null!==s.title&&void 0!==s.title&&(n.title=s.title);let o={type:"element",tagName:"a",properties:n,children:e.all(i)};return e.patch(i,o),e.applyData(i,o)},link:function(e,i){let r={href:lI(i.url)};null!==i.title&&void 0!==i.title&&(r.title=i.title);let s={type:"element",tagName:"a",properties:r,children:e.all(i)};return e.patch(i,s),e.applyData(i,s)},listItem:function(e,i,r){let s=e.all(i),n=r?function(e){let i=!1;if("list"===e.type){i=e.spread||!1;let r=e.children,s=-1;for(;!i&&++s<r.length;)i=lq(r[s])}return i}(r):lq(i),o={},l=[];if("boolean"==typeof i.checked){let e,r=s[0];r&&"element"===r.type&&"p"===r.tagName?e=r:(e={type:"element",tagName:"p",properties:{},children:[]},s.unshift(e)),e.children.length>0&&e.children.unshift({type:"text",value:" "}),e.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:i.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let a=-1;for(;++a<s.length;){let e=s[a];(n||0!==a||"element"!==e.type||"p"!==e.tagName)&&l.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||n?l.push(e):l.push(...e.children)}let h=s[s.length-1];h&&(n||"element"!==h.type||"p"!==h.tagName)&&l.push({type:"text",value:"\n"});let c={type:"element",tagName:"li",properties:o,children:l};return e.patch(i,c),e.applyData(i,c)},list:function(e,i){let r={},s=e.all(i),n=-1;for("number"==typeof i.start&&1!==i.start&&(r.start=i.start);++n<s.length;){let e=s[n];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}let o={type:"element",tagName:i.ordered?"ol":"ul",properties:r,children:e.wrap(s,!0)};return e.patch(i,o),e.applyData(i,o)},paragraph:function(e,i){let r={type:"element",tagName:"p",properties:{},children:e.all(i)};return e.patch(i,r),e.applyData(i,r)},root:function(e,i){let r={type:"root",children:e.wrap(e.all(i))};return e.patch(i,r),e.applyData(i,r)},strong:function(e,i){let r={type:"element",tagName:"strong",properties:{},children:e.all(i)};return e.patch(i,r),e.applyData(i,r)},table:function(e,i){let r=e.all(i),s=r.shift(),n=[];if(s){let r={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(i.children[0],r),n.push(r)}if(r.length>0){let s={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},o=n2(i.children[1]),l=n1(i.children[i.children.length-1]);o&&l&&(s.position={start:o,end:l}),n.push(s)}let o={type:"element",tagName:"table",properties:{},children:e.wrap(n,!0)};return e.patch(i,o),e.applyData(i,o)},tableCell:function(e,i){let r={type:"element",tagName:"td",properties:{},children:e.all(i)};return e.patch(i,r),e.applyData(i,r)},tableRow:function(e,i,r){let s=r?r.children:void 0,n=0===(s?s.indexOf(i):1)?"th":"td",o=r&&"table"===r.type?r.align:void 0,l=o?o.length:i.children.length,a=-1,h=[];for(;++a<l;){let r=i.children[a],s={},l=o?o[a]:void 0;l&&(s.align=l);let c={type:"element",tagName:n,properties:s,children:[]};r&&(c.children=e.all(r),e.patch(r,c),c=e.applyData(r,c)),h.push(c)}let c={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(i,c),e.applyData(i,c)},text:function(e,i){let r={type:"text",value:function(e){let i=String(e),r=/\r?\n|\r/g,s=r.exec(i),n=0,o=[];for(;s;)o.push(lV(i.slice(n,s.index),n>0,!0),s[0]),n=s.index+s[0].length,s=r.exec(i);return o.push(lV(i.slice(n),n>0,!1)),o.join("")}(String(i.value))};return e.patch(i,r),e.applyData(i,r)},thematicBreak:function(e,i){let r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(i,r),e.applyData(i,r)},toml:lX,yaml:lX,definition:lX,footnoteDefinition:lX};function lX(){}let lG={}.hasOwnProperty,lJ={};function lZ(e,i){e.position&&(i.position=function(e){let i=n2(e),r=n1(e);if(i&&r)return{start:i,end:r}}(e))}function lQ(e,i){let r=i;if(e&&e.data){let i=e.data.hName,s=e.data.hChildren,n=e.data.hProperties;"string"==typeof i&&("element"===r.type?r.tagName=i:r={type:"element",tagName:i,properties:{},children:"children"in r?r.children:[r]}),"element"===r.type&&n&&Object.assign(r.properties,lO(n)),"children"in r&&r.children&&null!=s&&(r.children=s)}return r}function l0(e,i){let r=[],s=-1;for(i&&r.push({type:"text",value:"\n"});++s<e.length;)s&&r.push({type:"text",value:"\n"}),r.push(e[s]);return i&&e.length>0&&r.push({type:"text",value:"\n"}),r}function l1(e){let i=0,r=e.charCodeAt(i);for(;9===r||32===r;)i++,r=e.charCodeAt(i);return e.slice(i)}function l2(e,i){let r,s,n,o,l=(r=i||lJ,s=new Map,n=new Map,o={all:function(e){let i=[];if("children"in e){let r=e.children,s=-1;for(;++s<r.length;){let n=o.one(r[s],e);if(n){if(s&&"break"===r[s-1].type&&(Array.isArray(n)||"text"!==n.type||(n.value=l1(n.value)),!Array.isArray(n)&&"element"===n.type)){let e=n.children[0];e&&"text"===e.type&&(e.value=l1(e.value))}Array.isArray(n)?i.push(...n):i.push(n)}}}return i},applyData:lQ,definitionById:s,footnoteById:n,footnoteCounts:new Map,footnoteOrder:[],handlers:{...lY,...r.handlers},one:function(e,i){let r=e.type,s=o.handlers[r];if(lG.call(o.handlers,r)&&s)return s(o,e,i);if(o.options.passThrough&&o.options.passThrough.includes(r)){if("children"in e){let{children:i,...r}=e,s=lO(r);return s.children=o.all(e),s}return lO(e)}return(o.options.unknownHandler||function(e,i){let r=i.data||{},s="value"in i&&!(lG.call(r,"hProperties")||lG.call(r,"hChildren"))?{type:"text",value:i.value}:{type:"element",tagName:"div",properties:{},children:e.all(i)};return e.patch(i,s),e.applyData(i,s)})(o,e,i)},options:r,patch:lZ,wrap:l0},lU(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){let i="definition"===e.type?s:n,r=String(e.identifier).toUpperCase();i.has(r)||i.set(r,e)}}),o),a=l.one(e,void 0),h=function(e){let i="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||lz,s=e.options.footnoteBackLabel||lH,n=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[],h=-1;for(;++h<e.footnoteOrder.length;){let n=e.footnoteById.get(e.footnoteOrder[h]);if(!n)continue;let o=e.all(n),l=String(n.identifier).toUpperCase(),c=lI(l.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(l);for(;void 0!==f&&++u<=f;){d.length>0&&d.push({type:"text",value:" "});let e="string"==typeof r?r:r(h,u);"string"==typeof e&&(e={type:"text",value:e}),d.push({type:"element",tagName:"a",properties:{href:"#"+i+"fnref-"+c+(u>1?"-"+u:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof s?s:s(h,u),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}let _=o[o.length-1];if(_&&"element"===_.type&&"p"===_.tagName){let e=_.children[_.children.length-1];e&&"text"===e.type?e.value+=" ":_.children.push({type:"text",value:" "}),_.children.push(...d)}else o.push(...d);let p={type:"element",tagName:"li",properties:{id:i+"fn-"+c},children:e.wrap(o,!0)};e.patch(n,p),a.push(p)}if(0!==a.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...lO(l),id:"footnote-label"},children:[{type:"text",value:n}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:"\n"}]}}(l),c=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return h&&(nf("children"in c),c.children.push({type:"text",value:"\n"},h)),c}function l5(e,i){return e&&"run"in e?async function(r,s){let n=l2(r,{file:s,...i});await e.run(n,s)}:function(r,s){return l2(r,{file:s,...e||i})}}function l3(e){if(e)throw e}var l4=e.i(99834);function l6(e){if("object"!=typeof e||null===e)return!1;let i=Object.getPrototypeOf(e);return(null===i||i===Object.prototype||null===Object.getPrototypeOf(i))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}let l9=function(e,i){let r;if(void 0!==i&&"string"!=typeof i)throw TypeError('"ext" argument must be a string');at(e);let s=0,n=-1,o=e.length;if(void 0===i||0===i.length||i.length>e.length){for(;o--;)if(47===e.codePointAt(o)){if(r){s=o+1;break}}else n<0&&(r=!0,n=o+1);return n<0?"":e.slice(s,n)}if(i===e)return"";let l=-1,a=i.length-1;for(;o--;)if(47===e.codePointAt(o)){if(r){s=o+1;break}}else l<0&&(r=!0,l=o+1),a>-1&&(e.codePointAt(o)===i.codePointAt(a--)?a<0&&(n=o):(a=-1,n=l));return s===n?n=l:n<0&&(n=e.length),e.slice(s,n)},l8=function(e){let i;if(at(e),0===e.length)return".";let r=-1,s=e.length;for(;--s;)if(47===e.codePointAt(s)){if(i){r=s;break}}else i||(i=!0);return r<0?47===e.codePointAt(0)?"/":".":1===r&&47===e.codePointAt(0)?"//":e.slice(0,r)},l7=function(e){let i;at(e);let r=e.length,s=-1,n=0,o=-1,l=0;for(;r--;){let a=e.codePointAt(r);if(47===a){if(i){n=r+1;break}continue}s<0&&(i=!0,s=r+1),46===a?o<0?o=r:1!==l&&(l=1):o>-1&&(l=-1)}return o<0||s<0||0===l||1===l&&o===s-1&&o===n+1?"":e.slice(o,s)},ae=function(...e){var i;let r,s,n,o=-1;for(;++o<e.length;)at(e[o]),e[o]&&(n=void 0===n?e[o]:n+"/"+e[o]);return void 0===n?".":(at(i=n),r=47===i.codePointAt(0),0!==(s=function(e,i){let r,s,n="",o=0,l=-1,a=0,h=-1;for(;++h<=e.length;){if(h<e.length)r=e.codePointAt(h);else if(47===r)break;else r=47;if(47===r){if(l===h-1||1===a);else if(l!==h-1&&2===a){if(n.length<2||2!==o||46!==n.codePointAt(n.length-1)||46!==n.codePointAt(n.length-2)){if(n.length>2){if((s=n.lastIndexOf("/"))!==n.length-1){s<0?(n="",o=0):o=(n=n.slice(0,s)).length-1-n.lastIndexOf("/"),l=h,a=0;continue}}else if(n.length>0){n="",o=0,l=h,a=0;continue}}i&&(n=n.length>0?n+"/..":"..",o=2)}else n.length>0?n+="/"+e.slice(l+1,h):n=e.slice(l+1,h),o=h-l-1;l=h,a=0}else 46===r&&a>-1?a++:a=-1}return n}(i,!r)).length||r||(s="."),s.length>0&&47===i.codePointAt(i.length-1)&&(s+="/"),r?"/"+s:s)};function at(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function ai(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}let ar=["history","path","basename","stem","extname","dirname"];class as{constructor(e){let i,r;i=e?ai(e)?{path:e}:"string"==typeof e||function(e){return!!(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in i?"":"/",this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<ar.length;){const e=ar[s];e in i&&void 0!==i[e]&&null!==i[e]&&(this[e]="history"===e?[...i[e]]:i[e])}for(r in i)ar.includes(r)||(this[r]=i[r])}get basename(){return"string"==typeof this.path?l9(this.path):void 0}set basename(e){ao(e,"basename"),an(e,"basename"),this.path=ae(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?l8(this.path):void 0}set dirname(e){al(this.basename,"dirname"),this.path=ae(e||"",this.basename)}get extname(){return"string"==typeof this.path?l7(this.path):void 0}set extname(e){if(an(e,"extname"),al(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw Error("`extname` must start with `.`");if(e.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=ae(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){ai(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!ai(e)){let i=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw i.code="ERR_INVALID_ARG_TYPE",i}if("file:"!==e.protocol){let e=TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){let e=TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}let i=e.pathname,r=-1;for(;++r<i.length;)if(37===i.codePointAt(r)&&50===i.codePointAt(r+1)){let e=i.codePointAt(r+2);if(70===e||102===e){let e=TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(i)}(e)}(e)),ao(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?l9(this.path,this.extname):void 0}set stem(e){ao(e,"stem"),an(e,"stem"),this.path=ae(this.dirname||"",e+(this.extname||""))}fail(e,i,r){let s=this.message(e,i,r);throw s.fatal=!0,s}info(e,i,r){let s=this.message(e,i,r);return s.fatal=void 0,s}message(e,i,r){let s=new n8(e,i,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}}function an(e,i){if(e&&e.includes("/"))throw Error("`"+i+"` cannot be a path: did not expect `/`")}function ao(e,i){if(!e)throw Error("`"+i+"` cannot be empty")}function al(e,i){if(!e)throw Error("Setting `"+i+"` requires `path` to be set too")}let aa=function(e){let i=this.constructor.prototype,r=i[e],s=function(){return r.apply(s,arguments)};return Object.setPrototypeOf(s,i),s},ah={}.hasOwnProperty;class ac extends aa{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=function(){let e=[],i={run:function(...i){let r=-1,s=i.pop();if("function"!=typeof s)throw TypeError("Expected function as last argument, not "+s);!function n(o,...l){let a=e[++r],h=-1;if(o)return void s(o);for(;++h<i.length;)(null===l[h]||void 0===l[h])&&(l[h]=i[h]);i=l,a?(function(e,i){let r;return function(...i){let o,l=e.length>i.length;l&&i.push(s);try{o=e.apply(this,i)}catch(e){if(l&&r)throw e;return s(e)}l||(o&&o.then&&"function"==typeof o.then?o.then(n,s):o instanceof Error?s(o):n(o))};function s(e,...n){r||(r=!0,i(e,...n))}function n(e){s(null,e)}})(a,n)(...l):s(null,...l)}(null,...i)},use:function(r){if("function"!=typeof r)throw TypeError("Expected `middelware` to be a function, not "+r);return e.push(r),i}};return i}()}copy(){let e=new ac,i=-1;for(;++i<this.attachers.length;){let r=this.attachers[i];e.use(...r)}return e.data((0,l4.default)(!0,{},this.namespace)),e}data(e,i){return"string"==typeof e?2==arguments.length?(a_("data",this.frozen),this.namespace[e]=i,this):ah.call(this.namespace,e)&&this.namespace[e]||void 0:e?(a_("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;for(;++this.freezeIndex<this.attachers.length;){let[e,...i]=this.attachers[this.freezeIndex];if(!1===i[0])continue;!0===i[0]&&(i[0]=void 0);let r=e.call(this,...i);"function"==typeof r&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let i=am(e),r=this.parser||this.Parser;return ad("parse",r),r(String(i),i)}process(e,i){let r=this;return this.freeze(),ad("process",this.parser||this.Parser),af("process",this.compiler||this.Compiler),i?s(void 0,i):new Promise(s);function s(s,n){let o=am(e),l=r.parse(o);function a(e,r){e||!r?n(e):s?s(r):(nf(i,"`done` is defined if `resolve` is not"),i(void 0,r))}r.run(l,o,function(e,i,s){var n,o;if(e||!i||!s)return a(e);let l=r.stringify(i,s);"string"==typeof(n=l)||(o=n)&&"object"==typeof o&&"byteLength"in o&&"byteOffset"in o?s.value=l:s.result=l,a(e,s)})}}processSync(e){let i,r=!1;return this.freeze(),ad("processSync",this.parser||this.Parser),af("processSync",this.compiler||this.Compiler),this.process(e,function(e,s){r=!0,l3(e),i=s}),ag("processSync","process",r),nf(i,"we either bailed on an error or have a tree"),i}run(e,i,r){ap(e),this.freeze();let s=this.transformers;return r||"function"!=typeof i||(r=i,i=void 0),r?n(void 0,r):new Promise(n);function n(n,o){nf("function"!=typeof i,"`file` can’t be a `done` anymore, we checked");let l=am(i);s.run(e,l,function(i,s,l){let a=s||e;i?o(i):n?n(a):(nf(r,"`done` is defined if `resolve` is not"),r(void 0,a,l))})}}runSync(e,i){let r,s=!1;return this.run(e,i,function(e,i){l3(e),r=i,s=!0}),ag("runSync","run",s),nf(r,"we either bailed on an error or have a tree"),r}stringify(e,i){this.freeze();let r=am(i),s=this.compiler||this.Compiler;return af("stringify",s),ap(e),s(e,r)}use(e,...i){let r=this.attachers,s=this.namespace;if(a_("use",this.frozen),null==e);else if("function"==typeof e)l(e,i);else if("object"==typeof e)Array.isArray(e)?o(e):n(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function n(e){if(!("plugins"in e)&&!("settings"in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(s.settings=(0,l4.default)(!0,s.settings,e.settings))}function o(e){let i=-1;if(null==e);else if(Array.isArray(e))for(;++i<e.length;)!function(e){if("function"==typeof e)l(e,[]);else if("object"==typeof e)if(Array.isArray(e)){let[i,...r]=e;l(i,r)}else n(e);else throw TypeError("Expected usable value, not `"+e+"`")}(e[i]);else throw TypeError("Expected a list of plugins, not `"+e+"`")}function l(e,i){let s=-1,n=-1;for(;++s<r.length;)if(r[s][0]===e){n=s;break}if(-1===n)r.push([e,...i]);else if(i.length>0){let[s,...o]=i,l=r[n][1];l6(l)&&l6(s)&&(s=(0,l4.default)(!0,l,s)),r[n]=[e,s,...o]}}}}let au=new ac().freeze();function ad(e,i){if("function"!=typeof i)throw TypeError("Cannot `"+e+"` without `parser`")}function af(e,i){if("function"!=typeof i)throw TypeError("Cannot `"+e+"` without `compiler`")}function a_(e,i){if(i)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function ap(e){if(!l6(e)||"string"!=typeof e.type)throw TypeError("Expected node, got `"+e+"`")}function ag(e,i,r){if(!r)throw Error("`"+e+"` finished async. Use `"+i+"` instead")}function am(e){var i;return(i=e)&&"object"==typeof i&&"message"in i&&"messages"in i?e:new as(e)}let av=[],aS={allowDangerousHtml:!0},ay=/^(https?|ircs?|mailto|xmpp)$/i,ab=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function ax(e){var i;let r,s,n,o,l,a=(r=(i=e).rehypePlugins||av,s=i.remarkPlugins||av,n=i.remarkRehypeOptions?{...i.remarkRehypeOptions,...aS}:aS,au().use(lR).use(s).use(l5,n).use(r)),h=(o=e.children||"",l=new as,"string"==typeof o?l.value=o:n_("Unexpected value `"+o+"` for `children` prop, expected `string`"),l);return function(e,i){let r=i.allowedElements,s=i.allowElement,n=i.components,o=i.disallowedElements,l=i.skipHtml,a=i.unwrapDisallowed,h=i.urlTransform||aw;for(let e of ab)Object.hasOwn(i,e.from)&&n_("Unexpected `"+e.from+"` prop, "+(e.to?"use `"+e.to+"` instead":"remove it")+" (see <https://github.com/remarkjs/react-markdown/blob/main/changelog.md#"+e.id+"> for more info)");return r&&o&&n_("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other"),lU(e,function(e,i,n){if("raw"===e.type&&n&&"number"==typeof i)return l?n.children.splice(i,1):n.children[i]={type:"text",value:e.value},i;if("element"===e.type){let i;for(i in od)if(Object.hasOwn(od,i)&&Object.hasOwn(e.properties,i)){let r=e.properties[i],s=od[i];(null===s||s.includes(e.tagName))&&(e.properties[i]=h(String(r||""),i,e))}}if("element"===e.type){let l=r?!r.includes(e.tagName):!!o&&o.includes(e.tagName);if(!l&&s&&"number"==typeof i&&(l=!s(e,i,n)),l&&n&&"number"==typeof i)return a&&e.children?n.children.splice(i,1,...e.children):n.children.splice(i,1),i}}),function(e,i){var r,s,n,o;let l;if(!i||void 0===i.Fragment)throw TypeError("Expected `Fragment` in options");let a=i.filePath||void 0;if(i.development){if("function"!=typeof i.jsxDEV)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=a,s=i.jsxDEV,l=function(e,i,n,o){let l=Array.isArray(n.children),a=n2(e);return s(i,n,o,l,{columnNumber:a?a.column-1:void 0,fileName:r,lineNumber:a?a.line:void 0},void 0)}}else{if("function"!=typeof i.jsx)throw TypeError("Expected `jsx` in production options");if("function"!=typeof i.jsxs)throw TypeError("Expected `jsxs` in production options");n=i.jsx,o=i.jsxs,l=function(e,i,r,s){let l=Array.isArray(r.children)?o:n;return s?l(i,r,s):l(i,r)}}let h={Fragment:i.Fragment,ancestors:[],components:i.components||{},create:l,elementAttributeNameCase:i.elementAttributeNameCase||"react",evaluater:i.createEvaluater?i.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:i.ignoreInvalidStyle||!1,passKeys:!1!==i.passKeys,passNode:i.passNode||!1,schema:"svg"===i.space?nQ:nZ,stylePropertyNameCase:i.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==i.tableCellAlignToStyle},c=on(h,e,void 0);return c&&"string"!=typeof c?c:h.create(e,h.Fragment,{children:c||void 0},void 0)}(e,{Fragment:_.Fragment,components:n,ignoreInvalidStyle:!0,jsx:_.jsx,jsxs:_.jsxs,passKeys:!0,passNode:!0})}(a.runSync(a.parse(h),h),e)}function aw(e){let i=e.indexOf(":"),r=e.indexOf("?"),s=e.indexOf("#"),n=e.indexOf("/");return -1===i||-1!==n&&i>n||-1!==r&&i>r||-1!==s&&i>s||ay.test(e.slice(0,i))?e:""}function aC({projectId:e}){let[i,r]=(0,p.useState)(""),[s,n]=(0,p.useState)(null),[o,l]=(0,p.useState)(!1),[a,h]=(0,p.useState)(""),[c,u]=(0,p.useState)(!1),[d,f]=(0,p.useState)(null),g=(0,p.useRef)(!1);g.current=o;let m=(0,p.useCallback)(async()=>{try{let i=await fetch(`/api/queue?project=${encodeURIComponent(e)}`);if(!i.ok)throw Error(`${i.status}`);let s=await i.json();n(!!s.exists),g.current||r(s.content||""),f(null)}catch(e){f(e.message)}},[e]);(0,p.useEffect)(()=>{m();let e=setInterval(m,1e4);return()=>clearInterval(e)},[m]);let v=async()=>{u(!0),f(null);try{let i=await fetch(`/api/queue?project=${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:a})});if(!i.ok)throw Error(`${i.status}`);r(a),l(!1)}catch(e){f(e.message)}finally{u(!1)}},S=async()=>{u(!0);try{let i=await fetch(`/api/queue?project=${encodeURIComponent(e)}`,{method:"POST"});if(!i.ok)throw Error(`${i.status}`);await m()}catch(e){f(e.message)}finally{u(!1)}};return(0,_.jsxs)("div",{className:"flex flex-col h-full min-h-0 border border-border",children:[(0,_.jsxs)("div",{className:"flex items-center justify-between h-7 px-3 shrink-0 border-b border-border",children:[(0,_.jsx)("span",{className:"text-[11px] text-text-muted uppercase tracking-wider",children:"OVERNIGHT-QUEUE.md"}),(0,_.jsxs)("div",{className:"flex items-center gap-2",children:[d&&(0,_.jsxs)("span",{className:"text-[10px] text-error",children:["err: ",d]}),!o&&s&&(0,_.jsx)("button",{onClick:()=>{h(i),l(!0)},className:"text-[10px] text-text-muted hover:text-accent uppercase tracking-wider",children:"Edit"}),o&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("button",{onClick:v,disabled:c,className:"text-[10px] text-accent hover:text-accent-dim uppercase tracking-wider disabled:opacity-50",children:c?"Saving…":"Save"}),(0,_.jsx)("button",{onClick:()=>{l(!1),h(""),m()},disabled:c,className:"text-[10px] text-text-muted hover:text-text uppercase tracking-wider disabled:opacity-50",children:"Cancel"})]})]})]}),o&&(0,_.jsx)("div",{className:"shrink-0 px-3 py-1.5 border-b border-border bg-bg-surface text-[10px] text-text-muted leading-snug",children:"⚠️ Editing manually may conflict with the Head agent. Use the chat panel to ask Head to update the queue when possible."}),(0,_.jsx)("div",{className:"flex-1 min-h-0 overflow-auto",children:!1===s?(0,_.jsxs)("div",{className:"p-3 text-[11px] text-text-muted",children:[(0,_.jsx)("p",{className:"mb-2",children:"No OVERNIGHT-QUEUE.md for this project yet."}),(0,_.jsx)("button",{onClick:S,disabled:c,className:"px-2 py-1 border border-border hover:border-accent hover:text-accent text-[11px] disabled:opacity-50",children:"Create OVERNIGHT-QUEUE.md from template"})]}):o?(0,_.jsx)("textarea",{value:a,onChange:e=>h(e.target.value),spellCheck:!1,className:"w-full h-full p-3 bg-bg text-text text-[11px] font-mono resize-none outline-none"}):(0,_.jsx)("div",{className:"p-3 text-[12px] text-text prose prose-invert prose-sm max-w-none [&_h1]:text-[14px] [&_h1]:font-semibold [&_h1]:mt-3 [&_h1]:mb-2 [&_h2]:text-[13px] [&_h2]:font-semibold [&_h2]:mt-3 [&_h2]:mb-1.5 [&_h3]:text-[12px] [&_h3]:font-semibold [&_h3]:mt-2 [&_h3]:mb-1 [&_p]:my-1.5 [&_ul]:my-1.5 [&_ul]:pl-4 [&_ul]:list-disc [&_ol]:my-1.5 [&_ol]:pl-4 [&_ol]:list-decimal [&_li]:my-0.5 [&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-2 [&_blockquote]:text-text-muted [&_hr]:my-3 [&_hr]:border-border [&_code]:bg-bg-surface [&_code]:px-1 [&_code]:rounded [&_code]:text-[11px] [&_strong]:text-text [&_a]:text-accent [&_a]:underline",children:(0,_.jsx)(ax,{children:i})})})]})}let ak=[{label:"1 hour",minutes:60},{label:"3 hours",minutes:180},{label:"8 hours",minutes:480},{label:"Until stopped",minutes:0}];function aE(e){if(e<=0)return"0m 0s";let i=Math.floor(e/36e5),r=Math.floor(e%36e5/6e4),s=Math.floor(e%6e4/1e3);return i>0?`${i}h ${r}m`:`${r}m ${s}s`}function aD({projectId:e}){let[i,r]=(0,p.useState)(null),[s,n]=(0,p.useState)(""),[o,l]=(0,p.useState)(15),[a,h]=(0,p.useState)(180),[c,u]=(0,p.useState)(!1),[d,f]=(0,p.useState)(!1),g=(0,p.useRef)(""),m=(0,p.useRef)(!1),v=(0,p.useRef)(!1);(0,p.useEffect)(()=>{g.current=s},[s]),(0,p.useEffect)(()=>{m.current=c},[c]),(0,p.useEffect)(()=>{v.current=d},[d]);let[S,y]=(0,p.useState)(!1),[b,x]=(0,p.useState)(null),[w,C]=(0,p.useState)(""),[k,E]=(0,p.useState)(""),D=(0,p.useMemo)(()=>{let i;return i=`~/.quadwork/${e}/OVERNIGHT-QUEUE.md`,`@head @dev @reviewer1 @reviewer2 — Queue check.
21
- @head: Merge any PR with both approvals, assign next from ${i}.
22
- @dev: Work on assigned ticket or address review feedback.
23
- @reviewer1 & 2: Review open PRs. If @dev pushed fixes, re-review. Post verdict on PR AND notify @dev here.
24
- ALL: Communicate via this chat by tagging agents. Your terminal is NOT visible.`},[e]),R=(0,p.useCallback)(async()=>{try{let i=await fetch("/api/triggers");if(!i.ok)throw Error(`${i.status}`);let s=(await i.json())[e]||null;r(s),s&&(s.message&&!g.current&&(n(s.message),g.current=s.message),!m.current&&(s.enabled&&s.interval?l(Math.max(1,Math.round(s.interval/6e4))):"number"==typeof s.intervalMin&&s.intervalMin>0&&l(s.intervalMin)),!v.current&&"number"==typeof s.durationMin&&s.durationMin>=0&&h(s.durationMin)),x(null)}catch(e){x(e.message)}},[e]);(0,p.useEffect)(()=>{s||n(D)},[D,s]),(0,p.useEffect)(()=>{R();let e=window.setInterval(R,5e3);return()=>window.clearInterval(e)},[R]),(0,p.useEffect)(()=>{if(!i?.enabled){C(""),E("");return}let e=()=>{if(i.nextAt&&C(aE(Math.max(0,i.nextAt-Date.now()))),i.expiresAt){let e=Math.max(0,i.expiresAt-Date.now());E(aE(e)),e<=0&&R()}else E("")};e();let r=window.setInterval(e,1e3);return()=>window.clearInterval(r)},[i?.enabled,i?.nextAt,i?.expiresAt,R]);let M=async()=>{y(!0),x(null);try{let i=await fetch(`/api/triggers/${encodeURIComponent(e)}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({interval:o,duration:a,message:s,sendImmediately:!0})});if(!i.ok)throw Error(`${i.status}`);u(!1),f(!1),await R()}catch(e){x(e.message)}finally{y(!1)}},P=async()=>{y(!0),x(null);try{let n=await fetch(`/api/triggers/${encodeURIComponent(e)}/stop`,{method:"POST"});if(!n.ok)throw Error(`${n.status}`);r({...i||{interval:0,lastSent:null,nextAt:null,expiresAt:null,message:s,intervalMin:o,durationMin:a},enabled:!1}),await R()}catch(e){x(e.message)}finally{y(!1)}},B=!!i?.enabled;return(0,_.jsxs)("div",{className:"flex flex-col border border-border",children:[(0,_.jsxs)("div",{className:"flex items-center justify-between h-7 px-3 shrink-0 border-b border-border",children:[(0,_.jsxs)("span",{className:"text-[11px] text-text-muted uppercase tracking-wider",children:["Scheduled Trigger",B?" (running)":""]}),b&&(0,_.jsxs)("span",{className:"text-[10px] text-error",children:["err: ",b]})]}),B?(0,_.jsxs)("div",{className:"p-3 flex flex-col gap-2",children:[(0,_.jsx)("div",{className:"text-[11px] text-text-muted",children:"Sending:"}),(0,_.jsx)("pre",{className:"text-[11px] font-mono whitespace-pre-wrap text-text bg-bg-surface border border-border p-2 max-h-28 overflow-auto",children:(i?.message||s).slice(0,400)}),(0,_.jsxs)("div",{className:"flex items-center gap-3 flex-wrap text-[11px]",children:[(0,_.jsxs)("span",{className:"flex items-center gap-1",children:[(0,_.jsxs)("span",{className:"relative inline-flex items-center justify-center w-2 h-2",children:[(0,_.jsx)("span",{className:"absolute inline-flex h-full w-full rounded-full bg-accent opacity-60 animate-ping"}),(0,_.jsx)("span",{className:"relative w-1.5 h-1.5 rounded-full bg-accent"})]}),(0,_.jsx)("span",{className:"text-accent",children:"Running"})]}),(0,_.jsxs)("span",{className:"tabular-nums text-text",children:["Next: ",w]}),k&&(0,_.jsxs)("span",{className:"tabular-nums text-text-muted",children:["Stops in: ",k]}),!i?.expiresAt&&(0,_.jsx)("span",{className:"text-text-muted",children:"(until stopped)"})]}),(0,_.jsx)("button",{onClick:P,disabled:S,className:"self-start px-3 py-1 text-[11px] text-text-muted border border-border hover:text-error hover:border-error/40 disabled:opacity-50 transition-colors",children:S?"Stopping…":"Stop Trigger"})]}):(0,_.jsxs)("div",{className:"p-3 flex flex-col gap-2",children:[(0,_.jsx)("label",{className:"text-[10px] text-text-muted uppercase tracking-wider",children:"Message"}),(0,_.jsx)("textarea",{value:s,onChange:e=>n(e.target.value),rows:6,spellCheck:!1,className:"w-full bg-bg text-text text-[11px] font-mono p-2 border border-border outline-none focus:border-accent resize-y"}),(0,_.jsxs)("div",{className:"flex items-center gap-2 flex-wrap text-[11px]",children:[(0,_.jsx)("span",{className:"text-text-muted",children:"Send every"}),(0,_.jsx)("input",{type:"number",value:o,onChange:e=>{l(parseInt(e.target.value,10)||15),u(!0)},min:1,max:1440,className:"w-12 bg-transparent border border-border px-1 py-0.5 text-[11px] text-text outline-none focus:border-accent text-center"}),(0,_.jsx)("span",{className:"text-text-muted",children:"min for"}),(0,_.jsx)("select",{value:a,onChange:e=>{h(parseInt(e.target.value,10)),f(!0)},className:"bg-transparent border border-border px-1 py-0.5 text-[11px] text-text outline-none focus:border-accent cursor-pointer",children:ak.map(e=>(0,_.jsx)("option",{value:e.minutes,className:"bg-bg-surface",children:e.label},e.minutes))})]}),(0,_.jsx)("button",{onClick:M,disabled:S||!s.trim(),className:"self-start px-3 py-1 text-[11px] font-semibold text-bg bg-accent hover:bg-accent-dim disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:S?"Starting…":"Send Message and Start Trigger"})]})]})}function aR({open:e,initialChatId:i="",onClose:r,onSave:s}){let[n,o]=(0,p.useState)(""),[l,a]=(0,p.useState)(i),[h,c]=(0,p.useState)(!1),[u,d]=(0,p.useState)(null);if((0,p.useEffect)(()=>{e&&a(i)},[e,i]),(0,p.useEffect)(()=>{if(!e)return;let i=e=>{"Escape"===e.key&&r()};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[e,r]),!e)return null;let f=async()=>{c(!0),d(null);try{await s(n.trim(),l.trim()),r()}catch(e){d(e.message||"Save failed")}finally{c(!1)}};return(0,_.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:r,role:"dialog","aria-modal":"true","aria-labelledby":"telegram-setup-title",children:(0,_.jsxs)("div",{className:"relative mx-4 max-w-xl w-full max-h-[90vh] overflow-auto rounded-lg border border-white/10 bg-neutral-950 p-6 shadow-2xl",onClick:e=>e.stopPropagation(),children:[(0,_.jsx)("button",{type:"button",onClick:r,"aria-label":"Close",className:"absolute right-3 top-3 rounded p-1 text-neutral-400 hover:bg-white/5 hover:text-white",children:(0,_.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:(0,_.jsx)("path",{d:"M4 4l12 12M16 4L4 16",strokeLinecap:"round"})})}),(0,_.jsx)("h2",{id:"telegram-setup-title",className:"text-base font-semibold text-white",children:"Set up your Telegram Bridge"}),(0,_.jsx)("p",{className:"mt-2 text-[12px] leading-relaxed text-neutral-300",children:"The bridge forwards AgentChattr messages from your project to a Telegram chat, so you can read and reply on your phone."}),(0,_.jsxs)("div",{className:"mt-4 text-[12px] text-neutral-300 space-y-3",children:[(0,_.jsxs)("section",{children:[(0,_.jsx)("h3",{className:"text-[13px] font-semibold text-white",children:"Step 1 — Create a Telegram bot"}),(0,_.jsxs)("ol",{className:"mt-1 pl-4 list-decimal space-y-0.5 text-neutral-300",children:[(0,_.jsxs)("li",{children:["Open Telegram and search for ",(0,_.jsx)("b",{children:"@BotFather"}),"."]}),(0,_.jsxs)("li",{children:["Send ",(0,_.jsx)("code",{className:"bg-white/5 px-1 rounded text-[11px]",children:"/newbot"})," and follow the prompts."]}),(0,_.jsxs)("li",{children:["Choose a name and username (must end in ",(0,_.jsx)("code",{className:"bg-white/5 px-1 rounded text-[11px]",children:"bot"}),")."]}),(0,_.jsxs)("li",{children:["BotFather replies with a ",(0,_.jsx)("b",{children:"bot token"})," that looks like ",(0,_.jsx)("code",{className:"bg-white/5 px-1 rounded text-[11px]",children:"123456:ABC-DEF1234ghIkl…"}),". Copy it."]})]})]}),(0,_.jsxs)("section",{children:[(0,_.jsx)("h3",{className:"text-[13px] font-semibold text-white",children:"Step 2 — Get your chat ID"}),(0,_.jsxs)("ol",{className:"mt-1 pl-4 list-decimal space-y-0.5 text-neutral-300",children:[(0,_.jsx)("li",{children:"Open Telegram and search for your new bot by username."}),(0,_.jsxs)("li",{children:["Click ",(0,_.jsx)("b",{children:"Start"})," and send any message (e.g. ",(0,_.jsx)("code",{className:"bg-white/5 px-1 rounded text-[11px]",children:"hello"}),")."]}),(0,_.jsxs)("li",{children:["Open this URL in your browser (replace ",(0,_.jsx)("code",{className:"bg-white/5 px-1 rounded text-[11px]",children:"YOUR_TOKEN"}),"):",(0,_.jsx)("pre",{className:"mt-1 p-2 bg-white/5 rounded text-[11px] text-neutral-200 overflow-auto",children:"https://api.telegram.org/botYOUR_TOKEN/getUpdates"})]}),(0,_.jsxs)("li",{children:["Look for ",(0,_.jsx)("code",{className:"bg-white/5 px-1 rounded text-[11px]",children:'"chat":{"id":<NUMBER>'})," in the JSON. That number is your ",(0,_.jsx)("b",{children:"chat id"}),"."]})]}),(0,_.jsx)("p",{className:"mt-1 text-neutral-400",children:"Or use this curl command in your terminal:"}),(0,_.jsx)("pre",{className:"mt-1 p-2 bg-white/5 rounded text-[11px] text-neutral-200 overflow-auto",children:"curl -s 'https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates' | grep -o '\"id\":[0-9-]*' | head -1"})]}),(0,_.jsxs)("section",{children:[(0,_.jsx)("h3",{className:"text-[13px] font-semibold text-white",children:"Step 3 — Paste credentials below"}),(0,_.jsxs)("div",{className:"mt-2 flex flex-col gap-2",children:[(0,_.jsxs)("label",{className:"text-[11px] text-neutral-400",children:["Bot token",(0,_.jsx)("input",{type:"password",value:n,onChange:e=>o(e.target.value),placeholder:"123456:ABC-DEF…",className:"mt-0.5 w-full bg-transparent border border-white/10 px-2 py-1 text-[12px] text-white outline-none focus:border-accent font-mono"})]}),(0,_.jsxs)("label",{className:"text-[11px] text-neutral-400",children:["Chat id",(0,_.jsx)("input",{type:"text",value:l,onChange:e=>a(e.target.value),placeholder:"123456789",className:"mt-0.5 w-full bg-transparent border border-white/10 px-2 py-1 text-[12px] text-white outline-none focus:border-accent font-mono"})]}),u&&(0,_.jsx)("div",{className:"text-[11px] text-error",children:u}),(0,_.jsx)("button",{type:"button",onClick:f,disabled:h||!n.trim()||!l.trim(),className:"mt-1 self-start px-3 py-1 text-[11px] font-semibold text-bg bg-accent hover:bg-accent-dim disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:h?"Saving…":"Save and start bridge"})]})]})]})]})})}async function aM(e,i){let r=await fetch(`/api/telegram?action=${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)}),s=await r.json();if(!r.ok||!1===s.ok)throw Error(s.error||`${r.status}`);return s}function aP({projectId:e}){let[i,r]=(0,p.useState)(null),[s,n]=(0,p.useState)(!1),[o,l]=(0,p.useState)(null),[a,h]=(0,p.useState)(!1),c=(0,p.useCallback)(async()=>{try{let i=await fetch(`/api/telegram?project=${encodeURIComponent(e)}`);if(!i.ok)throw Error(`${i.status}`);let s=await i.json();r(s),l(null)}catch(e){l(e.message)}},[e]);(0,p.useEffect)(()=>{c();let e=window.setInterval(c,5e3);return()=>window.clearInterval(e)},[c]);let u=async()=>{n(!0),l(null);try{i&&!i.bridge_installed&&await aM("install",{}),await aM("start",{project_id:e}),await c()}catch(e){l(e.message)}finally{n(!1)}},d=async()=>{n(!0),l(null);try{await aM("stop",{project_id:e}),await c()}catch(e){l(e.message)}finally{n(!1)}},f=async(r,s)=>{await aM("save-config",{project_id:e,bot_token:r,chat_id:s});try{i&&!i.bridge_installed&&await aM("install",{}),await aM("start",{project_id:e})}catch(e){l(e.message)}await c()},g=!!i?.configured,m=!!i?.running;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"flex flex-col border border-border",children:[(0,_.jsxs)("div",{className:"flex items-center justify-between h-7 px-3 shrink-0 border-b border-border",children:[(0,_.jsx)("span",{className:"text-[11px] text-text-muted uppercase tracking-wider",children:"Telegram Bridge"}),o&&(0,_.jsxs)("span",{className:"text-[10px] text-error max-w-[60%] truncate",title:o,children:["err: ",o]})]}),(0,_.jsx)("div",{className:"p-3 flex flex-col gap-2",children:g?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"flex items-center gap-2 text-[11px] flex-wrap",children:[m?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("span",{className:"relative inline-flex items-center justify-center w-2 h-2",children:[(0,_.jsx)("span",{className:"absolute inline-flex h-full w-full rounded-full bg-accent opacity-60 animate-ping"}),(0,_.jsx)("span",{className:"relative w-1.5 h-1.5 rounded-full bg-accent"})]}),(0,_.jsx)("span",{className:"text-accent",children:"Running"})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-text-muted"}),(0,_.jsx)("span",{className:"text-text-muted",children:"Stopped"})]}),i?.bot_username&&(0,_.jsxs)("span",{className:"text-text-muted",children:["· Bot: @",i.bot_username]}),i?.chat_id&&(0,_.jsxs)("span",{className:"text-text-muted tabular-nums",children:["· Chat: ",i.chat_id]})]}),(0,_.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[m?(0,_.jsx)("button",{onClick:d,disabled:s,className:"px-3 py-1 text-[11px] text-text-muted border border-border hover:text-error hover:border-error/40 disabled:opacity-50 transition-colors",children:s?"Stopping…":"Stop"}):(0,_.jsx)("button",{onClick:u,disabled:s,className:"px-3 py-1 text-[11px] font-semibold text-bg bg-accent hover:bg-accent-dim disabled:opacity-50 transition-colors",children:s?"Starting…":"Start"}),(0,_.jsx)("button",{onClick:()=>h(!0),disabled:s,className:"px-3 py-1 text-[11px] text-text-muted border border-border hover:text-text disabled:opacity-50 transition-colors",children:"How to set up"}),(0,_.jsx)("button",{onClick:()=>h(!0),disabled:s,className:"px-3 py-1 text-[11px] text-text-muted border border-border hover:text-text disabled:opacity-50 transition-colors",children:"Edit credentials"})]})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"flex items-center gap-2 text-[11px] text-text-muted",children:[(0,_.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-text-muted"}),(0,_.jsx)("span",{children:"Not configured"})]}),(0,_.jsx)("button",{onClick:()=>h(!0),disabled:s,className:"self-start px-3 py-1 text-[11px] font-semibold text-bg bg-accent hover:bg-accent-dim disabled:opacity-50 transition-colors",children:"Set up Telegram Bridge"})]})})]}),(0,_.jsx)(aR,{open:a,initialChatId:i?.chat_id||"",onClose:()=>h(!1),onSave:f})]})}function aB({projectId:e}){return(0,_.jsxs)("div",{className:"flex flex-col h-full min-h-0",children:[(0,_.jsx)(g,{label:"Operator Features"}),(0,_.jsxs)("div",{className:"flex-1 min-h-0 flex flex-col gap-2 p-2 overflow-auto",children:[(0,_.jsx)("div",{className:"flex-1 min-h-[200px]",children:(0,_.jsx)(aC,{projectId:e})}),(0,_.jsx)(aD,{projectId:e}),(0,_.jsx)(aP,{projectId:e})]})]})}e.s(["default",0,function({projectId:e}){let i=(0,p.useRef)(null),[r,s]=(0,p.useState)(.5),[n,o]=(0,p.useState)(.5),l=(0,p.useRef)(null),[a,h]=(0,p.useState)({});(0,p.useEffect)(()=>{let i=()=>{fetch("/api/agents").then(e=>e.ok?e.json():{}).then(i=>{let r={};for(let[s,n]of Object.entries(i))s.startsWith(`${e}/`)&&(r[s.split("/")[1]]=n.state);h(r)}).catch(()=>{})};i();let r=setInterval(i,5e3);return()=>clearInterval(r)},[e]);let c=(0,p.useCallback)((e,i)=>Math.min((i-4-150)/i,Math.max(150/i,e)),[]);(0,p.useEffect)(()=>{let e=e=>{if(!l.current||!i.current)return;let r=i.current.getBoundingClientRect();"col"===l.current?s(c((e.clientX-r.left)/r.width,r.width)):o(c((e.clientY-r.top)/r.height,r.height))},r=()=>{l.current=null,document.body.style.cursor="",document.body.style.userSelect=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",r),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",r)}},[c]);let u=e=>{l.current=e,document.body.style.cursor="col"===e?"col-resize":"row-resize",document.body.style.userSelect="none"},d=`${100*r}% 4px 1fr`,f=`${100*n}% 4px 1fr`;return(0,_.jsxs)("div",{ref:i,className:"w-full h-full",style:{display:"grid",gridTemplateColumns:d,gridTemplateRows:f},children:[(0,_.jsxs)("div",{className:"flex flex-col overflow-hidden border-2 border-accent",children:[(0,_.jsx)(g,{label:"AgentChattr — primary chat"}),(0,_.jsx)("div",{className:"flex-1 min-h-0",children:(0,_.jsx)(y,{projectId:e})}),(0,_.jsx)(D,{projectId:e})]}),(0,_.jsx)("div",{className:"bg-border cursor-col-resize hover:bg-accent-dim transition-colors",onMouseDown:()=>u("col")}),(0,_.jsx)("div",{className:"flex flex-col overflow-hidden",children:(0,_.jsx)(nd,{projectId:e,agentStates:a,onStatusChange:(e,i)=>{h(r=>({...r,[e]:i}))}})}),(0,_.jsx)("div",{className:"bg-border cursor-row-resize hover:bg-accent-dim transition-colors",onMouseDown:()=>u("row")}),(0,_.jsx)("div",{className:"bg-border cursor-move",onMouseDown:()=>u("col")}),(0,_.jsx)("div",{className:"bg-border cursor-row-resize hover:bg-accent-dim transition-colors",onMouseDown:()=>u("row")}),(0,_.jsxs)("div",{className:"flex flex-col overflow-hidden",children:[(0,_.jsx)(g,{label:"GitHub"}),(0,_.jsx)("div",{className:"flex-1 min-h-0",children:(0,_.jsx)(w,{projectId:e})})]}),(0,_.jsx)("div",{className:"bg-border cursor-col-resize hover:bg-accent-dim transition-colors",onMouseDown:()=>u("col")}),(0,_.jsx)(aB,{projectId:e})]})}],36330)},71714,e=>{e.n(e.i(36330))}]);