@wrenai/genbi 0.0.4 → 0.0.5
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.
- package/README.md +64 -2
- package/dist/assets/{echarts-LTFC-ysd.js → echarts-DYM4hjvk.js} +2 -2
- package/dist/assets/index-A_Wrq7Ey.css +1 -0
- package/dist/assets/{index-Bo--QMUN.js → index-DsH129tV.js} +18 -17
- package/dist/index.html +2 -2
- package/dist-server/harness/bundle/schema.d.ts +38 -0
- package/dist-server/harness/bundle/schema.js +18 -10
- package/dist-server/harness/bundle/version.js +1 -1
- package/dist-server/harness/cli-args.d.ts +10 -2
- package/dist-server/harness/cli-args.js +24 -8
- package/dist-server/harness/cli.js +75 -9
- package/dist-server/harness/compile/cache.js +4 -4
- package/dist-server/harness/compile/compose-profile.d.ts +51 -14
- package/dist-server/harness/compile/compose-profile.js +85 -19
- package/dist-server/harness/compile/context-loader.d.ts +56 -0
- package/dist-server/harness/compile/context-loader.js +237 -0
- package/dist-server/harness/compile/errors.d.ts +19 -0
- package/dist-server/harness/compile/errors.js +35 -0
- package/dist-server/harness/compile/index.d.ts +4 -3
- package/dist-server/harness/compile/index.js +4 -3
- package/dist-server/harness/compile/pipeline.d.ts +15 -7
- package/dist-server/harness/compile/pipeline.js +62 -14
- package/dist-server/harness/compile/resolve-binary.d.ts +2 -2
- package/dist-server/harness/compile/resolve-binary.js +3 -3
- package/dist-server/harness/compile/types.d.ts +29 -0
- package/dist-server/harness/compile/warble-identity.d.ts +11 -0
- package/dist-server/harness/compile/warble-identity.js +13 -0
- package/dist-server/harness/components/ai-step.d.ts +4 -0
- package/dist-server/harness/components/ai-step.js +40 -0
- package/dist-server/harness/components/broker.d.ts +60 -0
- package/dist-server/harness/components/broker.js +117 -0
- package/dist-server/harness/components/capability-card.d.ts +98 -0
- package/dist-server/harness/components/capability-card.js +169 -0
- package/dist-server/harness/components/context.d.ts +2 -0
- package/dist-server/harness/components/context.js +30 -0
- package/dist-server/harness/components/display.d.ts +6 -0
- package/dist-server/harness/components/display.js +29 -0
- package/dist-server/harness/components/egress-judge.d.ts +12 -0
- package/dist-server/harness/components/egress-judge.js +27 -0
- package/dist-server/harness/components/egress.d.ts +142 -0
- package/dist-server/harness/components/egress.js +469 -0
- package/dist-server/harness/components/in-process.d.ts +7 -0
- package/dist-server/harness/components/in-process.js +245 -0
- package/dist-server/harness/components/normalize.d.ts +35 -0
- package/dist-server/harness/components/normalize.js +245 -0
- package/dist-server/harness/components/plan.d.ts +31 -0
- package/dist-server/harness/components/plan.js +184 -0
- package/dist-server/harness/components/report.d.ts +207 -0
- package/dist-server/harness/components/report.js +309 -0
- package/dist-server/harness/components/runner.d.ts +193 -0
- package/dist-server/harness/components/runner.js +492 -0
- package/dist-server/harness/components/semantic-guards.d.ts +20 -0
- package/dist-server/harness/components/semantic-guards.js +42 -0
- package/dist-server/harness/components/terminal-json.d.ts +18 -0
- package/dist-server/harness/components/terminal-json.js +82 -0
- package/dist-server/harness/components/usage.d.ts +14 -0
- package/dist-server/harness/components/usage.js +19 -0
- package/dist-server/harness/components/wren-access.d.ts +29 -0
- package/dist-server/harness/components/wren-access.js +233 -0
- package/dist-server/harness/components/zone-dry-run.d.ts +43 -0
- package/dist-server/harness/components/zone-dry-run.js +107 -0
- package/dist-server/harness/components/zone-gate.d.ts +76 -0
- package/dist-server/harness/components/zone-gate.js +144 -0
- package/dist-server/harness/events/index.d.ts +1 -1
- package/dist-server/harness/events/types.d.ts +52 -0
- package/dist-server/harness/index.d.ts +9 -2
- package/dist-server/harness/index.js +5 -1
- package/dist-server/harness/loop/executor.d.ts +1 -0
- package/dist-server/harness/loop/executor.js +37 -15
- package/dist-server/harness/npm-package-resolve.d.ts +2 -0
- package/dist-server/harness/npm-package-resolve.js +16 -4
- package/dist-server/harness/providers/adapters/openai-compatible.d.ts +13 -0
- package/dist-server/harness/providers/adapters/openai-compatible.js +17 -0
- package/dist-server/harness/providers/adapters/openai.d.ts +7 -0
- package/dist-server/harness/providers/adapters/openai.js +6 -0
- package/dist-server/harness/providers/adapters/pi-ai.d.ts +48 -0
- package/dist-server/harness/providers/adapters/pi-ai.js +518 -0
- package/dist-server/harness/providers/binding.d.ts +45 -4
- package/dist-server/harness/providers/binding.js +44 -8
- package/dist-server/harness/providers/index.d.ts +9 -3
- package/dist-server/harness/providers/index.js +10 -3
- package/dist-server/harness/providers/zone.d.ts +96 -0
- package/dist-server/harness/providers/zone.js +112 -0
- package/dist-server/harness/render/answering-query.d.ts +29 -0
- package/dist-server/harness/render/answering-query.js +62 -0
- package/dist-server/harness/render/envelope.d.ts +6 -0
- package/dist-server/harness/render/envelope.js +10 -3
- package/dist-server/harness/route/adapter-spec.d.ts +8 -9
- package/dist-server/harness/route/adapter-spec.js +13 -14
- package/dist-server/harness/route/codex-ask-events.js +2 -1
- package/dist-server/harness/route/codex-ask.d.ts +4 -0
- package/dist-server/harness/route/codex-ask.js +69 -30
- package/dist-server/harness/route/codex-host-query.d.ts +52 -0
- package/dist-server/harness/route/codex-host-query.js +191 -0
- package/dist-server/harness/route/codex-local-manifest.d.ts +9 -1
- package/dist-server/harness/route/codex-local-manifest.js +96 -15
- package/dist-server/harness/route/codex-wren-proxy.d.ts +33 -0
- package/dist-server/harness/route/codex-wren-proxy.js +227 -0
- package/dist-server/harness/route/describe.js +45 -6
- package/dist-server/harness/route/in-process.d.ts +22 -1
- package/dist-server/harness/route/in-process.js +54 -4
- package/dist-server/harness/route/route.js +5 -2
- package/dist-server/harness/route/types.d.ts +30 -1
- package/dist-server/harness/session/run.js +30 -10
- package/dist-server/harness/setup/runner.d.ts +2 -0
- package/dist-server/harness/setup/runner.js +38 -17
- package/dist-server/harness/setup/yaml-scalar.d.ts +23 -0
- package/dist-server/harness/setup/yaml-scalar.js +62 -0
- package/dist-server/server/adopt.js +1 -17
- package/dist-server/server/app.d.ts +1 -0
- package/dist-server/server/app.js +163 -14
- package/dist-server/server/auth-choice.d.ts +13 -1
- package/dist-server/server/auth-choice.js +66 -1
- package/dist-server/server/bin.js +177 -25
- package/dist-server/server/codex-local-grounding.d.ts +18 -0
- package/dist-server/server/codex-local-grounding.js +92 -0
- package/dist-server/server/codex-native-session.d.ts +25 -0
- package/dist-server/server/codex-native-session.js +1 -0
- package/dist-server/server/codex-runtime-composition.d.ts +34 -0
- package/dist-server/server/codex-runtime-composition.js +250 -0
- package/dist-server/server/codex-structured-ask.d.ts +23 -0
- package/dist-server/server/codex-structured-ask.js +102 -0
- package/dist-server/server/conn-config.js +4 -16
- package/dist-server/server/conversation-socket.d.ts +16 -0
- package/dist-server/server/conversation-socket.js +65 -0
- package/dist-server/server/db.d.ts +46 -0
- package/dist-server/server/db.js +88 -9
- package/dist-server/server/env-detect.d.ts +6 -0
- package/dist-server/server/env-detect.js +7 -0
- package/dist-server/server/fold.d.ts +22 -4
- package/dist-server/server/fold.js +37 -5
- package/dist-server/server/harness.d.ts +2 -2
- package/dist-server/server/harness.js +33 -7
- package/dist-server/server/interactive-terminal.d.ts +10 -6
- package/dist-server/server/interactive-terminal.js +33 -8
- package/dist-server/server/managed-wren-runtime.d.ts +116 -0
- package/dist-server/server/managed-wren-runtime.js +670 -0
- package/dist-server/server/native-artifacts.d.ts +23 -7
- package/dist-server/server/native-artifacts.js +43 -12
- package/dist-server/server/native-component-context.d.ts +19 -0
- package/dist-server/server/native-component-context.js +76 -0
- package/dist-server/server/native-component-preparation.d.ts +20 -0
- package/dist-server/server/native-component-preparation.js +129 -0
- package/dist-server/server/native-component-runtime.d.ts +36 -0
- package/dist-server/server/native-component-runtime.js +92 -0
- package/dist-server/server/native-components.d.ts +84 -0
- package/dist-server/server/native-components.js +160 -0
- package/dist-server/server/native-dispatch-process.d.ts +8 -0
- package/dist-server/server/native-dispatch-process.js +65 -0
- package/dist-server/server/native-runtime-spec.d.ts +89 -0
- package/dist-server/server/native-runtime-spec.js +169 -0
- package/dist-server/server/native-sessions.d.ts +172 -19
- package/dist-server/server/native-sessions.js +839 -244
- package/dist-server/server/native-shutdown.d.ts +6 -0
- package/dist-server/server/native-shutdown.js +28 -0
- package/dist-server/server/native-wren-home.d.ts +18 -0
- package/dist-server/server/native-wren-home.js +262 -0
- package/dist-server/server/node-pty-host.d.ts +2 -1
- package/dist-server/server/node-pty-host.js +3 -2
- package/dist-server/server/profile-registry.d.ts +139 -0
- package/dist-server/server/profile-registry.js +620 -0
- package/dist-server/server/runtime-binding.d.ts +4 -1
- package/dist-server/server/runtime-binding.js +50 -2
- package/dist-server/server/runtime-host/claude-component-step.d.ts +25 -0
- package/dist-server/server/runtime-host/claude-component-step.js +186 -0
- package/dist-server/server/runtime-host/codex-app-server.d.ts +75 -0
- package/dist-server/server/runtime-host/codex-app-server.js +239 -0
- package/dist-server/server/runtime-host/codex-compatibility.d.ts +110 -0
- package/dist-server/server/runtime-host/codex-compatibility.js +162 -0
- package/dist-server/server/runtime-host/codex-component-step.d.ts +19 -0
- package/dist-server/server/runtime-host/codex-component-step.js +308 -0
- package/dist-server/server/runtime-host/codex-conversation.d.ts +109 -0
- package/dist-server/server/runtime-host/codex-conversation.js +295 -0
- package/dist-server/server/runtime-host/codex-direct-tools.d.ts +23 -0
- package/dist-server/server/runtime-host/codex-direct-tools.js +59 -0
- package/dist-server/server/runtime-host/codex-events.d.ts +647 -0
- package/dist-server/server/runtime-host/codex-events.js +66 -0
- package/dist-server/server/runtime-host/codex-policy.d.ts +16 -0
- package/dist-server/server/runtime-host/codex-policy.js +151 -0
- package/dist-server/server/runtime-host/codex-process.d.ts +8 -0
- package/dist-server/server/runtime-host/codex-process.js +96 -0
- package/dist-server/server/runtime-host/codex-rpc.d.ts +47 -0
- package/dist-server/server/runtime-host/codex-rpc.js +182 -0
- package/dist-server/server/runtime-host/codex-session.d.ts +74 -0
- package/dist-server/server/runtime-host/codex-session.js +492 -0
- package/dist-server/server/runtime-host/codex-terminal-protocol.d.ts +35 -0
- package/dist-server/server/runtime-host/codex-terminal-protocol.js +243 -0
- package/dist-server/server/runtime-host/codex-terminal.d.ts +16 -0
- package/dist-server/server/runtime-host/codex-terminal.js +120 -0
- package/dist-server/server/runtime-host/index.d.ts +5 -0
- package/dist-server/server/runtime-host/index.js +3 -0
- package/dist-server/server/runtime-host/local.d.ts +29 -0
- package/dist-server/server/runtime-host/local.js +90 -0
- package/dist-server/server/runtime-host/policy.d.ts +8 -0
- package/dist-server/server/runtime-host/policy.js +78 -0
- package/dist-server/server/runtime-host/types.d.ts +52 -0
- package/dist-server/server/runtime-host/types.js +62 -0
- package/dist-server/server/structured-query-evidence.d.ts +7 -0
- package/dist-server/server/structured-query-evidence.js +47 -0
- package/dist-server/server/structured-runtime.d.ts +52 -0
- package/dist-server/server/structured-runtime.js +130 -0
- package/dist-server/server/structured-scope.d.ts +4 -0
- package/dist-server/server/structured-scope.js +12 -0
- package/dist-server/server/turn.d.ts +6 -1
- package/dist-server/server/turn.js +82 -25
- package/dist-server/server/wire-types.d.ts +67 -3
- package/dist-server/server/wren-profiles.js +1 -1
- package/managed-wren/README.md +60 -0
- package/managed-wren/dependency-wheels.json +282 -0
- package/managed-wren/manifest.json +373 -0
- package/managed-wren/release-inputs.json +45 -0
- package/managed-wren/runtime-tree.cjs +115 -0
- package/managed-wren/source-inputs.json +40 -0
- package/package.json +15 -6
- package/profiles/genbi-default/context/binding.yml +17 -7
- package/profiles/genbi-default/context/context.json +146 -0
- package/profiles/genbi-default/ir.golden.json +39 -43
- package/profiles/genbi-default/profile.yml +31 -0
- package/profiles/genbi-enrich-context/context/binding.yml +14 -3
- package/profiles/genbi-enrich-context/context/context.json +146 -0
- package/profiles/genbi-enrich-context/ir.golden.json +4 -5
- package/profiles/genbi-monitor/context/binding.yml +13 -5
- package/profiles/genbi-monitor/context/context.json +146 -0
- package/profiles/genbi-monitor/ir.golden.json +13 -7
- package/profiles/genbi-report/context/binding.yml +19 -0
- package/profiles/genbi-report/context/context.json +223 -0
- package/profiles/genbi-report/ir.golden.json +328 -0
- package/profiles/genbi-report/profile.yml +38 -0
- package/profiles/genbi-setup/ir.golden.json +3 -1
- package/dist/assets/index-Xs4q7pNo.css +0 -1
|
@@ -337,33 +337,34 @@ html body {
|
|
|
337
337
|
${t}-copy:not(${t}-copy-icon-only)
|
|
338
338
|
`]:{marginInlineStart:0,marginInlineEnd:e.marginXXS}},...TL(e),...EL(e),...DL(),"&-rtl":{direction:`rtl`}}}},()=>({titleMarginTop:`1.2em`,titleMarginBottom:`0.5em`})),kL=e=>{let{prefixCls:t,"aria-label":n,className:r,style:i,classNames:a,styles:o,direction:s,maxLength:c,autoSize:l=!0,value:u,onSave:d,onCancel:f,onEnd:p,component:m,enterIcon:h=v.createElement(bL,null)}=e,g=v.useRef(null),_=v.useRef(!1),y=v.useRef(null),[b,x]=v.useState(u);v.useEffect(()=>{x(u)},[u]),v.useEffect(()=>{if(g.current?.resizableTextArea){let{textArea:e}=g.current.resizableTextArea;e.focus();let{length:t}=e.value;e.setSelectionRange(t,t)}},[]);let S=({target:e})=>{x(e.value.replace(/[\n\r]/g,``))},C=()=>{_.current=!0},w=()=>{_.current=!1},T=({keyCode:e})=>{_.current||(y.current=e)},E=()=>{d(b.trim())},D=({keyCode:e,ctrlKey:t,altKey:n,metaKey:r,shiftKey:i})=>{y.current!==e||_.current||t||n||r||i||(e===J.ENTER?(E(),p?.()):e===J.ESC&&f())},O=()=>{E()},[k,A]=OL(t),j=Y(t,`${t}-edit-content`,{[`${t}-rtl`]:s===`rtl`,[`${t}-${m}`]:!!m},r,a.root,k,A);return v.createElement(`div`,{className:j,style:{...o.root,...i}},v.createElement(jA,{ref:g,maxLength:c,value:b,onChange:S,onKeyDown:T,onKeyUp:D,onCompositionStart:C,onCompositionEnd:w,onBlur:O,"aria-label":n,rows:1,autoSize:l,className:a.textarea,style:o.textarea}),h===null?null:Ou(h,{className:`${t}-edit-content-confirm`}))},AL=(e,t)=>{let n=!1,r=r=>{r.stopPropagation(),r.preventDefault(),r.clipboardData?.clearData(),r.clipboardData?.setData(`text/plain`,e),t&&r.clipboardData?.setData(`text/html`,e),n=!0};try{return document.addEventListener(`copy`,r,{capture:!0}),document.execCommand(`copy`),n}catch{return!1}finally{document.removeEventListener(`copy`,r,{capture:!0})}},jL=async(e,t)=>{try{return t?await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([e],{type:`text/html`}),"text/plain":new Blob([e],{type:`text/plain`})})]):await navigator.clipboard.writeText(e),!0}catch{return!1}};async function ML(e,t){if(typeof e!=`string`)return!1;let n=t?.format===`text/html`;return!!(await jL(e,n)||AL(e,n))}var NL=({copyConfig:e,children:t})=>{let[n,r]=M(!1),[i,a]=v.useState(!1),o={};return e.format&&(o.format=e.format),{copied:n,copyLoading:i,onClick:y(async n=>{n?.preventDefault(),n?.stopPropagation(),a(!0);try{await ML((Pc(e.text)?await e.text():e.text)||Vj(t,{skipEmpty:!0}).join(``)||``,o),a(!1),r(!0,!0),r(!1,{ms:3e3}),e.onCopy?.(n)}catch(e){throw a(!1),e}})}},PL=(e,t)=>{let n=!!e;return v.useMemo(()=>{let r={...t,...n&&Nc(e)?e:null};return[n,r]},[n,e,t])},FL=e=>{let t=(0,v.useRef)(void 0);return(0,v.useEffect)(()=>{t.current=e}),t.current},IL=(e,t,n)=>(0,v.useMemo)(()=>e===!0?{title:t??n}:(0,v.isValidElement)(e)?{title:e}:Nc(e)?{title:t??n,...e}:{title:e},[e,t,n]),LL=(e,t,n,r,i)=>{let{getPrefixCls:a,direction:o,className:s,style:c,classNames:l,styles:u}=cn(`typography`),d=r??o,f=a(`typography`,e),p={...i,prefixCls:f,direction:d},m=(0,v.useMemo)(()=>({root:s}),[s]),h=Kc(c),[g,_]=Jc([m,l,t],[u,h,n],{props:p});return[g,_,f,d]},RL=v.forwardRef((e,t)=>{let{component:n=`article`,className:r,rootClassName:i,children:a,direction:o,style:s,classNames:c,styles:l,prefixCls:u,...d}=e,[f,p]=OL(u),m=Y(u,{[`${u}-rtl`]:o===`rtl`},r,i,f,p,c?.root),h={...l?.root,...s};return v.createElement(n,{...d,className:m,style:h,ref:t},a)}),zL=v.forwardRef((e,t)=>{let{prefixCls:n,className:r,rootClassName:i,direction:a,classNames:o,styles:s,...c}=e,[l,u,d,f]=LL(n,o,s,a,e);return v.createElement(RL,{ref:t,className:Y(r,i),direction:f,classNames:l,styles:u,prefixCls:d,...c})}),BL={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z`}}]},name:`copy`,theme:`outlined`};function VL(){return VL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},VL.apply(this,arguments)}var HL=v.forwardRef((e,t)=>v.createElement(Cs,VL({},e,{ref:t,icon:BL}))),UL=e=>e===!1?[!1,!1]:Vj(e);function WL(e,t,n){return e===!0||e===void 0?t:e||n&&t}function GL(e){let t=document.createElement(`em`);e.appendChild(t);let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return e.removeChild(t),n.left>r.left||r.right>n.right||n.top>r.top||r.bottom>n.bottom}var KL=e=>[`string`,`number`].includes(typeof e),qL=e=>{let{prefixCls:t,copied:n,locale:r,iconOnly:i,tooltips:a,icon:o,tabIndex:s,onCopy:c,loading:l,className:u,style:d}=e,f=UL(a),p=UL(o),{copied:m,copy:h}=r??{},g=n?m:h,_=WL(f[+!!n],g),y=typeof _==`string`?_:g;return v.createElement(ZS,{title:_},v.createElement(`button`,{type:`button`,className:Y(`${t}-copy`,u,{[`${t}-copy-success`]:n,[`${t}-copy-icon-only`]:i}),style:d,onClick:c,"aria-label":y,tabIndex:s},n?WL(p[1],v.createElement(Zx,null),!0):WL(p[0],l?v.createElement(Md,null):v.createElement(HL,null),!0)))},JL=v.forwardRef(({style:e,children:t},n)=>{let r=v.useRef(null);return v.useImperativeHandle(n,()=>({isExceed:()=>{let e=r.current;return e.scrollHeight>e.clientHeight},getHeight:()=>r.current.clientHeight})),v.createElement(`span`,{"aria-hidden":!0,ref:r,style:{position:`fixed`,display:`block`,left:0,top:0,pointerEvents:`none`,backgroundColor:`rgba(255, 0, 0, 0.65)`,...e}},t)}),YL=e=>e.reduce((e,t)=>e+(KL(t)?String(t).length:1),0);function XL(e,t){let n=0,r=[];for(let i=0;i<e.length;i+=1){if(n===t)return r;let a=e[i],o=KL(a)?String(a).length:1,s=n+o;if(s>t){let e=t-n;return r.push(String(a).slice(0,e)),r}r.push(a),n=s}return e}var ZL=0,QL=1,$L=2,eR=3,tR=4,nR={display:`-webkit-box`,overflow:`hidden`,WebkitBoxOrient:`vertical`};function rR(e){let{enableMeasure:t,width:n,text:r,children:i,rows:a,expanded:o,measureDeps:s,miscDeps:c,onEllipsis:l}=e,u=v.useMemo(()=>mt(r),[r]),d=v.useMemo(()=>YL(u),[r]),f=v.useMemo(()=>i(u,!1),[r].concat(tn(s))),[p,m]=v.useState(null),h=v.useRef(null),g=v.useRef(null),_=v.useRef(null),y=v.useRef(null),b=v.useRef(null),[x,C]=v.useState(!1),[w,T]=v.useState(ZL),[E,D]=v.useState(0),[O,k]=v.useState(null);S(()=>{T(t&&n&&d?QL:ZL)},[n,r,a,t,u].concat(tn(s))),S(()=>{if(w===QL){T($L);let e=g.current&&getComputedStyle(g.current).whiteSpace;k(e)}else if(w===$L){let e=!!_.current?.isExceed();T(e?eR:tR),m(e?[0,d]:null),C(e);let t=_.current?.getHeight()||0,n=a===1?0:y.current?.getHeight()||0,r=b.current?.getHeight()||0,i=Math.max(t,n+r);D(i+1),l(e)}},[w]);let A=p?Math.ceil((p[0]+p[1])/2):0;S(()=>{let[e,t]=p||[0,0];if(e!==t){let n=(h.current?.getHeight()||0)>E,r=A;t-e===1&&(r=n?e:t),m(n?[e,r]:[r,t])}},[p,A]);let j=v.useMemo(()=>{if(!t)return i(u,!1);if(w!==eR||!p||p[0]!==p[1]){let e=i(u,!1);return[tR,ZL].includes(w)?e:v.createElement(`span`,{style:{...nR,WebkitLineClamp:a}},e)}return i(o?u:XL(u,p[0]),x)},[o,w,p,u].concat(tn(c))),M={width:n,margin:0,padding:0,whiteSpace:O===`nowrap`?`normal`:`inherit`};return v.createElement(v.Fragment,null,j,w===$L&&v.createElement(v.Fragment,null,v.createElement(JL,{style:{...M,...nR,WebkitLineClamp:a},ref:_},f),v.createElement(JL,{style:{...M,...nR,WebkitLineClamp:a-1},ref:y},f),v.createElement(JL,{style:{...M,...nR,WebkitLineClamp:1},ref:b},i([],!0))),w===eR&&p&&p[0]!==p[1]&&v.createElement(JL,{style:{...M,top:400},ref:h},i(XL(u,A),!0)),w===QL&&v.createElement(`span`,{style:{whiteSpace:`inherit`},ref:g}))}var iR=({enableEllipsis:e,isEllipsis:t,disabled:n,children:r,tooltipProps:i})=>!i?.title||!e?r:v.createElement(ZS,{...i,disabled:!t||n},r);function aR({mark:e,code:t,underline:n,delete:r,strong:i,keyboard:a,italic:o},s){let c=s;function l(e,t){t&&(c=v.createElement(e,{},c))}return l(`strong`,i),l(`u`,n),l(`del`,r),l(`code`,t),l(`mark`,e),l(`kbd`,a),l(`i`,o),c}var oR=`...`,sR=[`delete`,`mark`,`code`,`underline`,`strong`,`keyboard`,`italic`],cR=v.forwardRef((e,t)=>{let{prefixCls:n,className:r,style:i,classNames:a,styles:o,direction:s,type:c,disabled:l,children:u,ellipsis:d,editable:f,copyable:p,actions:m,component:h,title:g,onMouseEnter:_,onMouseLeave:y,...b}=e,[x]=wl(`Text`),C=v.useRef(null),w=v.useRef(null),[E,D,O,k]=LL(n,a,o,s,e),A=ct(b,sR),[j,N]=PL(f),[P,F]=T(!1,N.editing),{triggerType:I=[`icon`]}=N,L=e=>{e&&N.onStart?.(),F(e)},R=FL(P);S(()=>{!P&&R&&w.current?.focus()},[P]);let z=e=>{e?.preventDefault(),L(!0)},B=e=>{N.onChange?.(e),L(!1)},V=()=>{N.onCancel?.(),L(!1)},[H,U]=PL(p),{placement:W=`end`}=m??{},{copied:G,copyLoading:ee,onClick:K}=NL({copyConfig:U,children:u}),[te,re]=v.useState(!1),[ie,q]=v.useState(!1),[ae,oe]=v.useState(!1),[se,ce]=v.useState(!1),[le,ue]=v.useState(!0),[de,fe]=PL(d,{expandable:!1,symbol:e=>e?x?.collapse:x?.expand}),[pe,me]=T(fe.defaultExpanded||!1,fe.expanded),he=de&&(!pe||fe.expandable===`collapsible`),{rows:ge=1}=fe,_e=v.useMemo(()=>he&&(fe.suffix!==void 0||fe.onEllipsis||fe.expandable||j||H),[he,fe,j,H]);S(()=>{de&&!_e&&(re(We(`webkitLineClamp`)),q(We(`textOverflow`)))},[_e,de]);let[ve,ye]=v.useState(he),be=v.useMemo(()=>_e?!1:ge===1?ie:te,[_e,ge,te,ie]);S(()=>{ye(be&&he)},[be,he]);let xe=IL(fe.tooltip,N.text,u),Se=ve&&!!xe.title,Ce=he&&(ve?Se&&se:ae),we=he&&ge===1&&ve,Te=he&&ge>1&&ve,Ee=(e,t)=>{me(t.expanded),fe.onExpand?.(e,t)},[De,Oe]=v.useState(0),[ke,Ae]=M(!1),je=v.useRef(!1),Me=({offsetWidth:e})=>{Oe(e)},Ne=e=>{oe(e),ae!==e&&fe.onEllipsis?.(e)},Pe=v.useCallback(()=>{let e=C.current;if(de&&Se&&e){let t=GL(e);ce(e=>e===t?e:t)}},[de,Se]);v.useEffect(()=>{je.current&&Pe()},[Pe,u,Te,le,De]),v.useEffect(()=>{let e=C.current;if(typeof IntersectionObserver>`u`||!e||!Se||!he)return;let t=new IntersectionObserver(()=>{ue(!!e.offsetParent)});return t.observe(e),()=>{t.disconnect()}},[Se,he]);let Fe=v.useMemo(()=>{if(!(!de||ve))return[N.text,u,g,xe.title].find(KL)},[de,ve,g,xe.title,Ce,N.text]);if(P)return v.createElement(kL,{value:N.text??(typeof u==`string`?u:``),onSave:B,onCancel:V,onEnd:N.onEnd,prefixCls:O,className:r,style:i,direction:k,component:h,maxLength:N.maxLength,autoSize:N.autoSize,enterIcon:N.enterIcon,classNames:E,styles:D});let Ie=()=>{let{expandable:e,symbol:t}=fe;return e?v.createElement(`button`,{type:`button`,key:`expand`,className:Y(`${O}-${pe?`collapse`:`expand`}`,E.action),style:D.action,onClick:e=>Ee(e,{expanded:!pe}),"aria-label":pe?x.collapse:x?.expand},Pc(t)?t(pe):t):null},Le=()=>{if(!j)return;let{icon:e,tooltip:t,tabIndex:n}=N,r=mt(t)[0]||x?.edit,i=typeof r==`string`?r:``;return I.includes(`icon`)?v.createElement(ZS,{key:`edit`,title:t===!1?``:r},v.createElement(`button`,{type:`button`,ref:w,className:Y(`${O}-edit`,E.action),style:D.action,onClick:z,"aria-label":i,tabIndex:n},e||v.createElement(_L,{role:`button`}))):null},Re=()=>H?v.createElement(qL,{key:`copy`,...U,prefixCls:O,copied:G,locale:x,onCopy:K,loading:ee,iconOnly:!Ac(u),className:E.action,style:D.action}):null,ze=e=>{let t=e&&Ie(),n=Le(),r=Re();return!t&&!n&&!r?null:v.createElement(`span`,{key:`operations`,className:Y(`${O}-actions`,E.actions,{[`${O}-actions-start`]:W===`start`}),style:D.actions,onMouseEnter:()=>Ae(!0,!0),onMouseLeave:()=>Ae(!1,{ms:500})},t,n,r)},Be=e=>[e&&!pe&&v.createElement(`span`,{"aria-hidden":!0,key:`ellipsis`},oR),fe.suffix];return v.createElement(Jt,{onResize:Me,disabled:!he},n=>v.createElement(iR,{tooltipProps:xe,enableEllipsis:he,isEllipsis:Ce,disabled:ke},v.createElement(RL,{onMouseEnter:e=>{je.current=!0,Pe(),_?.(e)},onMouseLeave:e=>{je.current=!1,y?.(e)},className:Y({[`${O}-${c}`]:c,[`${O}-disabled`]:l,[`${O}-ellipsis`]:de,[`${O}-ellipsis-single-line`]:we,[`${O}-ellipsis-multiple-line`]:Te,[`${O}-link`]:h===`a`},r),classNames:E,styles:D,prefixCls:O,style:{...i,WebkitLineClamp:Te?ge:void 0},component:h,ref:ne(n,C,t),direction:k,onClick:I.includes(`text`)?z:void 0,"aria-label":Fe?.toString(),title:g,...A},v.createElement(rR,{enableMeasure:he&&!ve,text:u,rows:ge,width:De,onEllipsis:Ne,expanded:pe,measureDeps:[W],miscDeps:[G,pe,ee,j,H,W,x].concat(tn(sR.map(t=>e[t])))},(t,n)=>aR(e,v.createElement(v.Fragment,null,W===`start`?ze(n):null,t.length>0&&n&&!pe&&Fe?v.createElement(`span`,{key:`show-content`,"aria-hidden":!0},t):t,Be(n),W===`start`?null:ze(n)))))))}),lR=v.forwardRef((e,t)=>{let{ellipsis:n,rel:r,children:i,navigate:a,...o}=e,s={...o,rel:r===void 0&&o.target===`_blank`?`noopener noreferrer`:r};return v.createElement(cR,{...s,ref:t,ellipsis:!!n,component:`a`},i)}),uR=v.forwardRef((e,t)=>{let{children:n,...r}=e;return v.createElement(cR,{ref:t,...r,component:`div`},n)}),dR=v.forwardRef((e,t)=>{let{ellipsis:n,children:r,...i}=e,a=v.useMemo(()=>Nc(n)?ct(n,[`expandable`,`rows`]):n,[n]);return v.createElement(cR,{ref:t,...i,ellipsis:a,component:`span`},r)}),fR=[1,2,3,4,5],pR=v.forwardRef((e,t)=>{let{level:n=1,children:r,...i}=e,a=fR.includes(n)?`h${n}`:`h1`;return v.createElement(cR,{ref:t,...i,component:a},r)}),mR=zL;mR.Text=dR,mR.Link=lR,mR.Title=pR,mR.Paragraph=uR;var hR=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},gR=(e=>e?hR(e):hR),_R=e=>e;function vR(e,t=_R){let n=v.useSyncExternalStore(e.subscribe,v.useCallback(()=>t(e.getState()),[e,t]),v.useCallback(()=>t(e.getInitialState()),[e,t]));return v.useDebugValue(n),n}var yR=e=>{let t=gR(e),n=e=>vR(t,e);return Object.assign(n,t),n},bR=(e=>e?yR(e):yR);function xR(e,t){let n;try{n=e()}catch{return}return{getItem:e=>{let r=e=>e===null?null:JSON.parse(e,t?.reviver),i=n.getItem(e)??null;return i instanceof Promise?i.then(r):r(i)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,t?.replacer)),removeItem:e=>n.removeItem(e)}}var SR=e=>t=>{try{let n=e(t);return n instanceof Promise?n:{then(e){return SR(e)(n)},catch(e){return this}}}catch(e){return{then(e){return this},catch(t){return SR(t)(e)}}}},CR=(e,t)=>(n,r,i)=>{let a={storage:xR(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1,s=0,c=new Set,l=new Set,u=a.storage;if(!u)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...e)},r,i);let d=()=>{let e=a.partialize({...r()});return u.setItem(a.name,{state:e,version:a.version})},f=i.setState;i.setState=(e,t)=>(f(e,t),d());let p=e((...e)=>(n(...e),d()),r,i);i.getInitialState=()=>p;let m,h=()=>{if(!u)return;let e=++s;o=!1,c.forEach(e=>e(r()??p));let t=a.onRehydrateStorage?.call(a,r()??p)||void 0;return SR(u.getItem.bind(u))(a.name).then(e=>{if(e){if(typeof e.version==`number`&&e.version!==a.version){if(a.migrate){let t=a.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error(`State loaded from storage couldn't be migrated since no migrate function was provided`)}else return[!1,e.state]}return[!1,void 0]}).then(t=>{if(e!==s)return;let[i,o]=t;if(m=a.merge(o,r()??p),n(m,!0),i)return d()}).then(()=>{e===s&&(t?.(r(),void 0),m=r(),o=!0,l.forEach(e=>e(m)))}).catch(n=>{e===s&&t?.(void 0,n)})};return i.persist={setOptions:e=>{a={...a,...e},e.storage&&(u=e.storage)},clearStorage:()=>{++s,u?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>h(),hasHydrated:()=>o,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(l.add(e),()=>{l.delete(e)})},a.skipHydration||h(),m||p};function wR(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches}var TR=bR()(CR(e=>({themeMode:wR()?`dark`:`light`,sidebarCollapsed:!1,setThemeMode:t=>e({themeMode:t}),toggleThemeMode:()=>e(e=>({themeMode:e.themeMode===`dark`?`light`:`dark`})),setSidebarCollapsed:t=>e({sidebarCollapsed:t}),toggleSidebar:()=>e(e=>({sidebarCollapsed:!e.sidebarCollapsed}))}),{name:`wren-genbi-ui`})),ER={blue6:`#1890ff`,green6:`#52c41a`,gold6:`#faad14`,red5:`#ff4d4f`},DR={light:{ground:`#f0f2f5`,surface:`#ffffff`,surface2:`#f5f5f5`,line:`#f0f0f0`,lineStrong:`#d9d9d9`,ink:`#262626`,ink2:`#434343`,muted:`#65676c`,accent:`#2f54eb`,accentInk:`#1d39c4`,link:`#1890ff`},dark:{ground:`#141414`,surface:`#1f1f1f`,surface2:`#262626`,line:`#303030`,lineStrong:`#434343`,ink:`#f0f0f0`,ink2:`#cfcfcf`,muted:`#8c8c8c`,accent:`#597ef7`,accentInk:`#85a5ff`,link:`#40a9ff`}},OR={light:DR.light.surface2,dark:DR.dark.surface2},kR={light:`0px 3px 6px -4px rgba(0,0,0,.12),0px 6px 16px rgba(0,0,0,.08),0px 9px 28px 8px rgba(0,0,0,.05)`,dark:`0 1px 2px rgba(0,0,0,.5),0 10px 30px rgba(0,0,0,.4)`},AR={verified:ER.green6,estimate:ER.gold6,refused:ER.red5,fontFamilyCode:`'Source Code Pro', ui-monospace, SFMono-Regular, Menlo, monospace`},jR=`-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif`,MR={light:{background:DR.light.surface,foreground:DR.light.ink,cursor:DR.light.accent,selectionBackground:`#d6e4ff`,black:DR.light.ink2,red:`#a8071a`,green:`#135200`,yellow:`#613400`,blue:DR.light.accentInk,magenta:`#391085`,cyan:`#003a8c`,white:`#595959`,brightBlack:DR.light.ink,brightRed:`#cf1322`,brightGreen:`#237804`,brightYellow:`#874d00`,brightBlue:DR.light.accent,brightMagenta:`#531dab`,brightCyan:`#0050b3`,brightWhite:DR.light.ink2},dark:{background:DR.dark.surface,foreground:DR.dark.ink,cursor:DR.dark.accent,selectionBackground:`#111d2c`,black:DR.dark.muted,red:`#ff7875`,green:`#95de64`,yellow:`#ffd666`,blue:DR.dark.accentInk,magenta:`#d3adf7`,cyan:`#5cdbd3`,white:DR.dark.ink,brightBlack:`#bfbfbf`,brightRed:`#ffa39e`,brightGreen:`#b7eb8f`,brightYellow:`#ffe58f`,brightBlue:`#adc6ff`,brightMagenta:`#efdbff`,brightCyan:`#87e8de`,brightWhite:`#ffffff`}};function NR(e){let t=DR[e];return{colorPrimary:t.accent,colorPrimaryHover:t.accentInk,colorPrimaryActive:t.accentInk,colorInfo:t.link,colorLink:t.link,colorLinkHover:t.link,colorSuccess:ER.green6,colorWarning:ER.gold6,colorError:ER.red5,colorBgLayout:t.ground,colorBgContainer:t.surface,colorBgElevated:t.surface,colorBorder:t.lineStrong,colorBorderSecondary:t.line,colorText:t.ink,colorTextSecondary:t.ink2,colorTextTertiary:t.muted,borderRadius:8,borderRadiusSM:4,fontFamily:jR,fontFamilyCode:AR.fontFamilyCode,fontSize:15,boxShadow:kR[e],boxShadowSecondary:kR[e],boxShadowTertiary:kR[e]}}function PR(e){let t=DR[e];return{Card:{bodyPaddingSM:16,headerPaddingSM:12,headerFontSizeSM:14},Table:{headerBg:t.surface2,headerColor:t.muted,headerSplitColor:t.line,borderColor:t.line,cellPaddingBlockSM:8,cellPaddingInlineSM:12,cellFontSizeSM:12},Tag:{defaultBg:t.surface2,defaultColor:t.ink2},Layout:{headerBg:t.surface,bodyBg:t.ground,siderBg:t.surface},Segmented:{trackBg:t.surface2,itemSelectedBg:t.surface,itemColor:t.muted,itemSelectedColor:t.ink},Tree:{nodeSelectedBg:t.surface2,nodeHoverBg:t.surface2}}}var FR={algorithm:mL.defaultAlgorithm,token:NR(`light`),components:PR(`light`),cssVar:{}},IR={algorithm:mL.darkAlgorithm,token:NR(`dark`),components:PR(`dark`),cssVar:{}};function LR(e){return e===`dark`?IR:FR}var RR=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Z=o(((e,t)=>{t.exports=RR()}))();function zR({children:e}){let t=TR(e=>e.themeMode);return(0,v.useEffect)(()=>{document.documentElement.setAttribute(`data-theme`,t),document.documentElement.style.setProperty(`--genbi-surface-2`,OR[t])},[t]),(0,Z.jsx)($u,{theme:LR(t),children:(0,Z.jsx)(hy,{children:e})})}var BR=`modulepreload`,VR=function(e){return`/`+e},HR={},UR=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=VR(t,n),t=s(t),t in HR)return;HR[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:BR,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},WR=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,GR=/^[\\/]{2}/;function KR(e,t){return t+e.replace(/\\/g,`/`)}var qR=`popstate`;function JR(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function YR(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return ez(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:tz(t)}return rz(t,n,null,e)}function XR(e,t){if(e===!1||e==null)throw Error(t)}function ZR(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function QR(){return Math.random().toString(36).substring(2,10)}function $R(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function ez(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?nz(t):t,state:n,key:t&&t.key||r||QR(),mask:i}}function tz({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function nz(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function rz(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=JR(e)?e:ez(h.location,e,t);n&&n(r,e),l=u()+1;let d=$R(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=JR(e)?e:ez(h.location,e,t);n&&n(r,e),l=u();let i=$R(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return iz(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(qR,d),c=e,()=>{i.removeEventListener(qR,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function iz(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),XR(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:tz(t);return i=i.replace(/ $/,`%20`),!n&&GR.test(i)&&(i=r+i),new URL(i,r)}function az(e,t,n=`/`){return oz(e,t,n,!1)}function oz(e,t,n,r,i){let a=Tz((typeof t==`string`?nz(t):t).pathname||`/`,n);if(a==null)return null;let o=i??sz(e),s=null,c=wz(a);for(let e=0;s==null&&e<o.length;++e)s=bz(o[e],c,r);return s}function sz(e){let t=cz(e);return uz(t),t}function cz(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;XR(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=Nz([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(XR(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),cz(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:vz(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=Cz(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of lz(e.path))a(e,t,!0,n)}),t}function lz(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=lz(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function uz(e){e.sort((e,t)=>e.score===t.score?yz(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var dz=/^:[\w-]+$/,fz=3,pz=2,mz=1,hz=10,gz=-2,_z=e=>e===`*`;function vz(e,t){let n=e.split(`/`),r=n.length;return n.some(_z)&&(r+=gz),t&&(r+=pz),n.filter(e=>!_z(e)).reduce((e,t)=>e+(dz.test(t)?fz:t===``?mz:hz),r)}function yz(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function bz(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?Sz(u,l,s.matcher,s.compiledParams):xz(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=xz({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:Nz([a,d.pathname]),pathnameBase:Fz(Nz([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=Nz([a,d.pathnameBase]))}return o}function xz(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Cz(e.path,e.caseSensitive,e.end);return Sz(e,t,n,r)}function Sz(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=Pz(a,1),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=Pz(a.slice(0,a.length-e.length),1)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function Cz(e,t=!1,n=!0){ZR(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function wz(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return ZR(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Tz(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function Ez(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?nz(e):e,a;return n?(n=Mz(n),a=n.startsWith(`/`)||n.startsWith(`\\`)?Dz(n.substring(1),`/`):Dz(n,t)):a=t,{pathname:a,search:Iz(r),hash:Lz(i)}}function Dz(e,t){let n=Pz(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Oz(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function kz(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Az(e){let t=kz(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function jz(e,t,n,r=!1){let i;typeof e==`string`?i=nz(e):(i={...e},XR(!i.pathname||!i.pathname.includes(`?`),Oz(`?`,`pathname`,`search`,i)),XR(!i.pathname||!i.pathname.includes(`#`),Oz(`#`,`pathname`,`hash`,i)),XR(!i.search||!i.search.includes(`#`),Oz(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=Ez(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Mz=e=>e.replace(/[\\/]{2,}/g,`/`),Nz=e=>Mz(e.join(`/`));function Pz(e,t=0){let n=e.length;for(;n>t&&e.charCodeAt(n-1)===47;)n--;return n===e.length?e:e.slice(0,n)}var Fz=e=>Pz(e).replace(/^\/*/,`/`),Iz=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Lz=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Rz=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function zz(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Bz(e){return Nz(e.map(e=>e.route.path).filter(Boolean))||`/`}var Vz=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Hz(e,t){let n=e;if(typeof n!=`string`||!WR.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Vz)try{let e=new URL(window.location.href),r=GR.test(n)?new URL(KR(n,e.protocol)):new URL(n),a=Tz(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{ZR(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Uz=new URL(`http://localhost`);function Wz(e){if(e.createURL)return e.createURL(`/`);try{return new URL(e.createHref(`/`),Uz)}catch{return Uz}}function Gz(e,t){return e.origin===t.origin&&(e.origin!==`null`||e.protocol===t.protocol&&e.host===t.host)}function Kz(e,t){if(e.startsWith(`//`))return!0;let n=t.protocol.toLowerCase();return e.toLowerCase().startsWith(n)?t.host===``||e.slice(n.length).startsWith(`//`):!1}function qz(e,t,n,r){let i=null;try{i=e==null?null:new URL(e,n)}catch{}let a=new URL(t,n),o=i!=null&&!Gz(i,n),s=!Gz(a,n);if(r===`reject`){if(o||s)throw Error(`External navigation is not allowed`)}else if(s&&(i==null||!Kz(e,i)||!Gz(i,a)))throw Error(`External navigation is not allowed`)}var Jz=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Jz);var Yz=[`GET`,...Jz];new Set(Yz);var Xz=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Zz(e){try{return Xz.includes(new URL(e).protocol)}catch{return!1}}var Qz=v.createContext(null);Qz.displayName=`DataRouter`;var $z=v.createContext(null);$z.displayName=`DataRouterState`;var eB=v.createContext(!1);function tB(){return v.useContext(eB)}var nB=v.createContext({isTransitioning:!1});nB.displayName=`ViewTransition`;var rB=v.createContext(new Map);rB.displayName=`Fetchers`;var iB=v.createContext(null);iB.displayName=`Await`;var aB=v.createContext(null);aB.displayName=`Navigation`;var oB=v.createContext(null);oB.displayName=`Location`;var sB=v.createContext({outlet:null,matches:[],isDataRoute:!1});sB.displayName=`Route`;var cB=v.createContext(null);cB.displayName=`RouteError`;var lB=`REACT_ROUTER_ERROR`,uB=`REDIRECT`,dB=`ROUTE_ERROR_RESPONSE`;function fB(e){if(e.startsWith(`${lB}:${uB}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function pB(e){if(e.startsWith(`${lB}:${dB}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Rz(t.status,t.statusText,t.data)}catch{}}function mB(e,{relative:t}={}){XR(hB(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=v.useContext(aB),{hash:i,pathname:a,search:o}=wB(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:Nz([n,a])),r.createHref({pathname:s,search:o,hash:i})}function hB(){return v.useContext(oB)!=null}function gB(){return XR(hB(),`useLocation() may be used only in the context of a <Router> component.`),v.useContext(oB).location}var _B=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function vB(e){v.useContext(aB).static||v.useLayoutEffect(e)}function yB(){let{isDataRoute:e}=v.useContext(sB);return e?VB():bB()}function bB(){XR(hB(),`useNavigate() may be used only in the context of a <Router> component.`);let e=v.useContext(Qz),{basename:t,navigator:n}=v.useContext(aB),{matches:r}=v.useContext(sB),{pathname:i}=gB(),a=JSON.stringify(Az(r)),o=v.useRef(!1);return vB(()=>{o.current=!0}),v.useCallback((r,s={})=>{if(ZR(o.current,_B),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=jz(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:Nz([t,c.pathname])),qz(typeof r==`string`?r:tz(r),n.createHref(c),Wz(n),`reject`),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var xB=v.createContext(null);function SB(e){let t=v.useContext(sB).outlet;return v.useMemo(()=>t&&v.createElement(xB.Provider,{value:e},t),[t,e])}function CB(){let{matches:e}=v.useContext(sB);return e[e.length-1]?.params??{}}function wB(e,{relative:t}={}){let{matches:n}=v.useContext(sB),{pathname:r}=gB(),i=JSON.stringify(Az(n));return v.useMemo(()=>jz(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function TB(e,t){return EB(e,t)}function EB(e,t,n){XR(hB(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=v.useContext(aB),{matches:i}=v.useContext(sB),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;UB(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
339
339
|
|
|
340
|
-
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=gB(),d;if(t){let e=typeof t==`string`?nz(t):t;XR(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):az(e,{pathname:p});ZR(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),ZR(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=NB(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:Nz([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:Nz([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?v.createElement(oB.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function DB(){let e=BB(),t=zz(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=v.createElement(v.Fragment,null,v.createElement(`p`,null,`💿 Hey developer 👋`),v.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,v.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,v.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),v.createElement(v.Fragment,null,v.createElement(`h2`,null,`Unexpected Application Error!`),v.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?v.createElement(`pre`,{style:i},n):null,o)}var OB=v.createElement(DB,null),kB=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=pB(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:v.createElement(sB.Provider,{value:this.props.routeContext},v.createElement(cB.Provider,{value:e,children:this.props.component}));return this.context?v.createElement(jB,{error:e},t):t}};kB.contextType=eB;var AB=new WeakMap;function jB({children:e,error:t}){let{basename:n,navigator:r}=v.useContext(aB);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=fB(t.digest);if(e){let i=AB.get(t);if(i)throw i;let a=Hz(e.location,n),o=a.absoluteURL||a.to;if(qz(e.location,o,Wz(r),`allow-explicit`),Zz(o))throw Error(`Invalid redirect location`);if(Vz&&!AB.get(t)){if(a.isExternal||e.reloadDocument)window.location.href=o;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw AB.set(t,n),n}}return v.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function MB({routeContext:e,match:t,children:n}){let r=v.useContext(Qz);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(sB.Provider,{value:e},n)}function NB(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);XR(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Bz(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||OB,o&&(s<0&&c===0?(UB(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?v.createElement(n.route.Component,null):n.route.element?n.route.element:e,v.createElement(MB,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?v.createElement(kB,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function PB(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function FB(e){let t=v.useContext(Qz);return XR(t,PB(e)),t}function IB(e){let t=v.useContext($z);return XR(t,PB(e)),t}function LB(e){let t=v.useContext(sB);return XR(t,PB(e)),t}function RB(e){let t=LB(e),n=t.matches[t.matches.length-1];return XR(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function zB(){return RB(`useRouteId`)}function BB(){let e=v.useContext(cB),t=IB(`useRouteError`),n=RB(`useRouteError`);return e===void 0?t.errors?.[n]:e}function VB(){let{router:e}=FB(`useNavigate`),t=RB(`useNavigate`),n=v.useRef(!1);return vB(()=>{n.current=!0}),v.useCallback(async(r,i={})=>{ZR(n.current,_B),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var HB={};function UB(e,t,n){!t&&!HB[e]&&(HB[e]=!0,ZR(!1,n))}v.memo(WB);function WB({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return EB(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function GB({to:e,replace:t,state:n,relative:r}){XR(hB(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i,navigator:a}=v.useContext(aB);ZR(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:o}=v.useContext(sB),{pathname:s}=gB(),c=yB(),l=jz(e,Az(o),s,r===`path`);qz(typeof e==`string`?e:tz(e),a.createHref(l),Wz(a),`reject`);let u=JSON.stringify(l);return v.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:r})},[c,u,r,t,n]),null}function KB(e){return SB(e.context)}function qB(e){XR(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function JB({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){XR(!hB(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=v.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=nz(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=v.useMemo(()=>{let e=Tz(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return ZR(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:v.createElement(aB.Provider,{value:c},v.createElement(oB.Provider,{children:t,value:h}))}function YB({children:e,location:t}){return TB(XB(e),t)}v.Component;function XB(e,t=[]){let n=[];return v.Children.forEach(e,(e,r)=>{if(!v.isValidElement(e))return;let i=[...t,r];if(e.type===v.Fragment){n.push.apply(n,XB(e.props.children,i));return}XR(e.type===qB,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),XR(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=XB(e.props.children,i)),n.push(a)}),n}var ZB=`get`,QB=`application/x-www-form-urlencoded`;function $B(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function eV(e){return $B(e)&&e.tagName.toLowerCase()===`button`}function tV(e){return $B(e)&&e.tagName.toLowerCase()===`form`}function nV(e){return $B(e)&&e.tagName.toLowerCase()===`input`}function rV(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function iV(e,t){return e.button===0&&(!t||t===`_self`)&&!rV(e)}var aV=null;function oV(){if(aV===null)try{new FormData(document.createElement(`form`),0),aV=!1}catch{aV=!0}return aV}var sV=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function cV(e){return e!=null&&!sV.has(e)?(ZR(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${QB}"`),null):e}function lV(e,t){let n,r,i,a,o;if(tV(e)){let o=e.getAttribute(`action`);r=o?Tz(o,t):null,n=e.getAttribute(`method`)||ZB,i=cV(e.getAttribute(`enctype`))||QB,a=new FormData(e)}else if(eV(e)||nV(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?Tz(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||ZB,i=cV(e.getAttribute(`formenctype`))||cV(o.getAttribute(`enctype`))||QB,a=new FormData(o,e),!oV()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if($B(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=ZB,r=null,i=QB,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function uV(e,t){if(e===!1||e==null)throw Error(t)}function dV(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return i.pathname=n?i.pathname.endsWith(`/`)?`${i.pathname}_.${r}`:`${i.pathname}.${r}`:i.pathname===`/`?`_root.${r}`:t&&Tz(i.pathname,t)===`/`?`${Pz(t)}/_root.${r}`:`${Pz(i.pathname)}.${r}`,i}async function fV(e,t){if(e.id in t)return t[e.id];try{let n=await UR(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function pV(e){return e!=null&&typeof e.page==`string`}function mV(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function hV(e,t,n){return bV((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await fV(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(mV).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function gV(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function _V(e,t,{includeHydrateFallback:n}={}){return vV(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function vV(e){return[...new Set(e)]}function yV(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function bV(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!pV(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(yV(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function xV(){let e=v.useContext(Qz);return uV(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function SV(){let e=v.useContext($z);return uV(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var CV=v.createContext(void 0);CV.displayName=`FrameworkContext`;function wV(){let e=v.useContext(CV);return uV(e,`You must render this element inside a <HydratedRouter> element`),e}function TV(e,t){let n=v.useContext(CV),[r,i]=v.useState(!1),[a,o]=v.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=v.useRef(null);v.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),v.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:EV(s,p),onBlur:EV(c,m),onMouseEnter:EV(l,p),onMouseLeave:EV(u,m),onTouchStart:EV(d,p)}]:[a,f,{}]:[!1,f,{}]}function EV(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function DV({page:e,...t}){let n=tB(),{nonce:r}=wV(),{router:i}=xV(),a=v.useMemo(()=>az(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?v.createElement(kV,{page:e,matches:a,...t}):v.createElement(AV,{page:e,matches:a,...t})):null}function OV(e){let{manifest:t,routeModules:n}=wV(),[r,i]=v.useState([]);return v.useEffect(()=>{let r=!1;return hV(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function kV({page:e,matches:t,...n}){let r=gB(),{future:i}=wV(),{basename:a}=xV(),o=v.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=dV(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return v.createElement(v.Fragment,null,o.map(e=>v.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function AV({page:e,matches:t,...n}){let r=gB(),{future:i,manifest:a,routeModules:o}=wV(),{basename:s}=xV(),{loaderData:c,matches:l}=SV(),u=v.useMemo(()=>gV(e,t,l,a,r,`data`),[e,t,l,a,r]),d=v.useMemo(()=>gV(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=v.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=dV(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=v.useMemo(()=>_V(d,a),[d,a]),m=OV(d);return v.createElement(v.Fragment,null,f.map(e=>v.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>v.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>v.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function jV(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}v.Component;var MV=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{MV&&(window.__reactRouterVersion=`7.18.3`)}catch{}function NV({basename:e,children:t,useTransitions:n,window:r}){let i=v.useRef();i.current??=YR({window:r,v5Compat:!0});let a=i.current,[o,s]=v.useState({action:a.action,location:a.location}),c=v.useCallback(e=>{n===!1?s(e):v.startTransition(()=>s(e))},[n]);return v.useLayoutEffect(()=>a.listen(c),[a,c]),v.createElement(JB,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}var PV=v.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=v.useContext(aB),y=typeof l==`string`&&WR.test(l),b=Hz(l,h);l=b.to;let x=mB(l,{relative:r}),S=gB(),C=null;if(o){let e=jz(o,[],S.mask?S.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:Nz([h,e.pathname])),C=g.createHref(e)}let[w,T,E]=TV(n,p),D=zV(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function O(t){e&&e(t),t.defaultPrevented||D(t)}let k=!(b.isExternal||i),A=v.createElement(`a`,{...p,...E,href:(k?C:void 0)||b.absoluteURL||x,onClick:k?O:e,ref:jV(m,T),target:c,"data-discover":!y&&t===`render`?`true`:void 0});return w&&!y?v.createElement(v.Fragment,null,A,v.createElement(DV,{page:x})):A});PV.displayName=`Link`;var FV=v.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=wB(a,{relative:c.relative}),d=gB(),f=v.useContext($z),{navigator:p,basename:m}=v.useContext(aB),h=f!=null&&WV(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,y=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),y=y?y.toLowerCase():null,g=g.toLowerCase()),y&&m&&(y=Tz(y,m)||y);let b=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,x=_===g||!r&&_.startsWith(g)&&_.charAt(b)===`/`,S=y!=null&&(y===g||!r&&y.startsWith(g)&&y.charAt(g.length)===`/`),C={isActive:x,isPending:S,isTransitioning:h},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return v.createElement(PV,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});FV.displayName=`NavLink`;var IV=v.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=ZB,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=v.useContext(aB),g=HV(),_=UV(s,{relative:l}),y=o.toLowerCase()===`get`?`get`:`post`,b=typeof s==`string`&&WR.test(s);return v.createElement(`form`,{ref:m,method:y,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?v.startTransition(()=>p()):p()},...p,"data-discover":!b&&e===`render`?`true`:void 0})});IV.displayName=`Form`;function LV(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function RV(e){let t=v.useContext(Qz);return XR(t,LV(e)),t}function zV(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=yB(),d=gB(),f=wB(e,{relative:o});return v.useCallback(p=>{if(iV(p,t)){p.preventDefault();let t=n===void 0?tz(d)===tz(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?v.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}var BV=0,VV=()=>`__${String(++BV)}__`;function HV(){let{router:e}=RV(`useSubmit`),{basename:t}=v.useContext(aB),n=zB(),r=e.fetch,i=e.navigate;return v.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=lV(e,t);if(a.navigate===!1){let e=a.fetcherKey||VV();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function UV(e,{relative:t}={}){let{basename:n}=v.useContext(aB),r=v.useContext(sB);XR(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...wB(e||`.`,{relative:t})},o=gB();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:Nz([n,a.pathname])),tz(a)}function WV(e,{relative:t}={}){let n=v.useContext(nB);XR(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=RV(`useViewTransitionState`),i=wB(e,{relative:t});if(!n.isTransitioning)return!1;let a=Tz(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Tz(n.nextLocation.pathname,r)||n.nextLocation.pathname;return xz(i.pathname,o)!=null||xz(i.pathname,a)!=null}var GV={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M908 640H804V488c0-4.4-3.6-8-8-8H548v-96h108c8.8 0 16-7.2 16-16V80c0-8.8-7.2-16-16-16H368c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h108v96H228c-4.4 0-8 3.6-8 8v152H116c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h288c8.8 0 16-7.2 16-16V656c0-8.8-7.2-16-16-16H292v-88h440v88H620c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h288c8.8 0 16-7.2 16-16V656c0-8.8-7.2-16-16-16zm-564 76v168H176V716h168zm84-408V140h168v168H428zm420 576H680V716h168v168z`}}]},name:`apartment`,theme:`outlined`};function KV(){return KV=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},KV.apply(this,arguments)}var qV=v.forwardRef((e,t)=>v.createElement(Cs,KV({},e,{ref:t,icon:GV}))),JV={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M917.7 148.8l-42.4-42.4c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-76.1 76.1a199.27 199.27 0 00-112.1-34.3c-51.2 0-102.4 19.5-141.5 58.6L432.3 308.7a8.03 8.03 0 000 11.3L704 591.7c1.6 1.6 3.6 2.3 5.7 2.3 2 0 4.1-.8 5.7-2.3l101.9-101.9c68.9-69 77-175.7 24.3-253.5l76.1-76.1c3.1-3.2 3.1-8.3 0-11.4zM769.1 441.7l-59.4 59.4-186.8-186.8 59.4-59.4c24.9-24.9 58.1-38.7 93.4-38.7 35.3 0 68.4 13.7 93.4 38.7 24.9 24.9 38.7 58.1 38.7 93.4 0 35.3-13.8 68.4-38.7 93.4zm-190.2 105a8.03 8.03 0 00-11.3 0L501 613.3 410.7 523l66.7-66.7c3.1-3.1 3.1-8.2 0-11.3L441 408.6a8.03 8.03 0 00-11.3 0L363 475.3l-43-43a7.85 7.85 0 00-5.7-2.3c-2 0-4.1.8-5.7 2.3L206.8 534.2c-68.9 69-77 175.7-24.3 253.5l-76.1 76.1a8.03 8.03 0 000 11.3l42.4 42.4c1.6 1.6 3.6 2.3 5.7 2.3s4.1-.8 5.7-2.3l76.1-76.1c33.7 22.9 72.9 34.3 112.1 34.3 51.2 0 102.4-19.5 141.5-58.6l101.9-101.9c3.1-3.1 3.1-8.2 0-11.3l-43-43 66.7-66.7c3.1-3.1 3.1-8.2 0-11.3l-36.6-36.2zM441.7 769.1a131.32 131.32 0 01-93.4 38.7c-35.3 0-68.4-13.7-93.4-38.7a131.32 131.32 0 01-38.7-93.4c0-35.3 13.7-68.4 38.7-93.4l59.4-59.4 186.8 186.8-59.4 59.4z`}}]},name:`api`,theme:`outlined`};function YV(){return YV=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},YV.apply(this,arguments)}var XV=v.forwardRef((e,t)=>v.createElement(Cs,YV({},e,{ref:t,icon:JV}))),ZV={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H212V212h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H612V212h200v200zM464 544H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H212V612h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H612V612h200v200z`}}]},name:`appstore`,theme:`outlined`};function QV(){return QV=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},QV.apply(this,arguments)}var $V=v.forwardRef((e,t)=>v.createElement(Cs,QV({},e,{ref:t,icon:ZV}))),eH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z`}}]},name:`arrow-left`,theme:`outlined`};function tH(){return tH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},tH.apply(this,arguments)}var nH=v.forwardRef((e,t)=>v.createElement(Cs,tH({},e,{ref:t,icon:eH}))),rH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M869 487.8L491.2 159.9c-2.9-2.5-6.6-3.9-10.5-3.9h-88.5c-7.4 0-10.8 9.2-5.2 14l350.2 304H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h585.1L386.9 854c-5.6 4.9-2.2 14 5.2 14h91.5c1.9 0 3.8-.7 5.2-2L869 536.2a32.07 32.07 0 000-48.4z`}}]},name:`arrow-right`,theme:`outlined`};function iH(){return iH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},iH.apply(this,arguments)}var aH=v.forwardRef((e,t)=>v.createElement(Cs,iH({},e,{ref:t,icon:rH}))),oH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-600-80h56c4.4 0 8-3.6 8-8V560c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v144c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V384c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v320c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V462c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v242c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V304c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v400c0 4.4 3.6 8 8 8z`}}]},name:`bar-chart`,theme:`outlined`};function sH(){return sH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},sH.apply(this,arguments)}var cH=v.forwardRef((e,t)=>v.createElement(Cs,sH({},e,{ref:t,icon:oH}))),lH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-260 72h96v209.9L621.5 312 572 347.4V136zm220 752H232V136h280v296.9c0 3.3 1 6.6 3 9.3a15.9 15.9 0 0022.3 3.7l83.8-59.9 81.4 59.4c2.7 2 6 3.1 9.4 3.1 8.8 0 16-7.2 16-16V136h64v752z`}}]},name:`book`,theme:`outlined`};function uH(){return uH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},uH.apply(this,arguments)}var dH=v.forwardRef((e,t)=>v.createElement(Cs,uH({},e,{ref:t,icon:lH}))),fH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M348 676.1C250 619.4 184 513.4 184 392c0-181.1 146.9-328 328-328s328 146.9 328 328c0 121.4-66 227.4-164 284.1V792c0 17.7-14.3 32-32 32H380c-17.7 0-32-14.3-32-32V676.1zM392 888h240c4.4 0 8 3.6 8 8v32c0 17.7-14.3 32-32 32H416c-17.7 0-32-14.3-32-32v-32c0-4.4 3.6-8 8-8z`}}]},name:`bulb`,theme:`filled`};function pH(){return pH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pH.apply(this,arguments)}var mH=v.forwardRef((e,t)=>v.createElement(Cs,pH({},e,{ref:t,icon:fH}))),hH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M632 888H392c-4.4 0-8 3.6-8 8v32c0 17.7 14.3 32 32 32h192c17.7 0 32-14.3 32-32v-32c0-4.4-3.6-8-8-8zM512 64c-181.1 0-328 146.9-328 328 0 121.4 66 227.4 164 284.1V792c0 17.7 14.3 32 32 32h264c17.7 0 32-14.3 32-32V676.1c98-56.7 164-162.7 164-284.1 0-181.1-146.9-328-328-328zm127.9 549.8L604 634.6V752H420V634.6l-35.9-20.8C305.4 568.3 256 484.5 256 392c0-141.4 114.6-256 256-256s256 114.6 256 256c0 92.5-49.4 176.3-128.1 221.8z`}}]},name:`bulb`,theme:`outlined`};function gH(){return gH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gH.apply(this,arguments)}var _H=v.forwardRef((e,t)=>v.createElement(Cs,gH({},e,{ref:t,icon:hH}))),vH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z`}},{tag:`path`,attrs:{d:`M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z`}}]},name:`check-circle`,theme:`outlined`};function yH(){return yH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},yH.apply(this,arguments)}var bH=v.forwardRef((e,t)=>v.createElement(Cs,yH({},e,{ref:t,icon:vH}))),xH={icon:{tag:`svg`,attrs:{"fill-rule":`evenodd`,viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm0 76c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm128.01 198.83c.03 0 .05.01.09.06l45.02 45.01a.2.2 0 01.05.09.12.12 0 010 .07c0 .02-.01.04-.05.08L557.25 512l127.87 127.86a.27.27 0 01.05.06v.02a.12.12 0 010 .07c0 .03-.01.05-.05.09l-45.02 45.02a.2.2 0 01-.09.05.12.12 0 01-.07 0c-.02 0-.04-.01-.08-.05L512 557.25 384.14 685.12c-.04.04-.06.05-.08.05a.12.12 0 01-.07 0c-.03 0-.05-.01-.09-.05l-45.02-45.02a.2.2 0 01-.05-.09.12.12 0 010-.07c0-.02.01-.04.06-.08L466.75 512 338.88 384.14a.27.27 0 01-.05-.06l-.01-.02a.12.12 0 010-.07c0-.03.01-.05.05-.09l45.02-45.02a.2.2 0 01.09-.05.12.12 0 01.07 0c.02 0 .04.01.08.06L512 466.75l127.86-127.86c.04-.05.06-.06.08-.06a.12.12 0 01.07 0z`}}]},name:`close-circle`,theme:`outlined`};function SH(){return SH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},SH.apply(this,arguments)}var CH=v.forwardRef((e,t)=>v.createElement(Cs,SH({},e,{ref:t,icon:xH}))),wH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M518.3 459a8 8 0 00-12.6 0l-112 141.7a7.98 7.98 0 006.3 12.9h73.9V856c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V613.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 459z`}},{tag:`path`,attrs:{d:`M811.4 366.7C765.6 245.9 648.9 160 512.2 160S258.8 245.8 213 366.6C127.3 389.1 64 467.2 64 560c0 110.5 89.5 200 199.9 200H304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8h-40.1c-33.7 0-65.4-13.4-89-37.7-23.5-24.2-36-56.8-34.9-90.6.9-26.4 9.9-51.2 26.2-72.1 16.7-21.3 40.1-36.8 66.1-43.7l37.9-9.9 13.9-36.6c8.6-22.8 20.6-44.1 35.7-63.4a245.6 245.6 0 0152.4-49.9c41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.2c19.9 14 37.5 30.8 52.4 49.9 15.1 19.3 27.1 40.7 35.7 63.4l13.8 36.5 37.8 10C846.1 454.5 884 503.8 884 560c0 33.1-12.9 64.3-36.3 87.7a123.07 123.07 0 01-87.6 36.3H720c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h40.1C870.5 760 960 670.5 960 560c0-92.7-63.1-170.7-148.6-193.3z`}}]},name:`cloud-upload`,theme:`outlined`};function TH(){return TH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},TH.apply(this,arguments)}var EH=v.forwardRef((e,t)=>v.createElement(Cs,TH({},e,{ref:t,icon:wH}))),DH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M516 673c0 4.4 3.4 8 7.5 8h185c4.1 0 7.5-3.6 7.5-8v-48c0-4.4-3.4-8-7.5-8h-185c-4.1 0-7.5 3.6-7.5 8v48zm-194.9 6.1l192-161c3.8-3.2 3.8-9.1 0-12.3l-192-160.9A7.95 7.95 0 00308 351v62.7c0 2.4 1 4.6 2.9 6.1L420.7 512l-109.8 92.2a8.1 8.1 0 00-2.9 6.1V673c0 6.8 7.9 10.5 13.1 6.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z`}}]},name:`code`,theme:`outlined`};function OH(){return OH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},OH.apply(this,arguments)}var kH=v.forwardRef((e,t)=>v.createElement(Cs,OH({},e,{ref:t,icon:DH}))),AH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M301.3 496.7c-23.8 0-40.2-10.5-41.6-26.9H205c.9 43.4 36.9 70.3 93.9 70.3 59.1 0 95-28.4 95-75.5 0-35.8-20-55.9-64.5-64.5l-29.1-5.6c-23.8-4.7-33.8-11.9-33.8-24.2 0-15 13.3-24.5 33.4-24.5 20.1 0 35.3 11.1 36.6 27h53c-.9-41.7-37.5-70.3-90.3-70.3-54.4 0-89.7 28.9-89.7 73 0 35.5 21.2 58 62.5 65.8l29.7 5.9c25.8 5.2 35.6 11.9 35.6 24.4.1 14.7-14.5 25.1-36 25.1z`}},{tag:`path`,attrs:{d:`M928 140H96c-17.7 0-32 14.3-32 32v496c0 17.7 14.3 32 32 32h380v112H304c-8.8 0-16 7.2-16 16v48c0 4.4 3.6 8 8 8h432c4.4 0 8-3.6 8-8v-48c0-8.8-7.2-16-16-16H548V700h380c17.7 0 32-14.3 32-32V172c0-17.7-14.3-32-32-32zm-40 488H136V212h752v416z`}},{tag:`path`,attrs:{d:`M828.5 486.7h-95.8V308.5h-57.4V534h153.2zm-298.6 53.4c14.1 0 27.2-2 39.1-5.8l13.3 20.3h53.3L607.9 511c21.1-20 33-51.1 33-89.8 0-73.3-43.3-118.8-110.9-118.8s-111.2 45.3-111.2 118.8c-.1 73.7 43 118.9 111.1 118.9zm0-190c31.6 0 52.7 27.7 52.7 71.1 0 16.7-3.6 30.6-10 40.5l-5.2-6.9h-48.8L542 491c-3.9.9-8 1.4-12.2 1.4-31.7 0-52.8-27.5-52.8-71.2.1-43.6 21.2-71.1 52.9-71.1z`}}]},name:`console-sql`,theme:`outlined`};function jH(){return jH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jH.apply(this,arguments)}var MH=v.forwardRef((e,t)=>v.createElement(Cs,jH({},e,{ref:t,icon:AH}))),NH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-600 72h560v208H232V136zm560 480H232V408h560v208zm0 272H232V680h560v208zM304 240a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0z`}}]},name:`database`,theme:`outlined`};function PH(){return PH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},PH.apply(this,arguments)}var FH=v.forwardRef((e,t)=>v.createElement(Cs,PH({},e,{ref:t,icon:NH}))),IH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M888.3 693.2c-42.5-24.6-94.3-18-129.2 12.8l-53-30.7V523.6c0-15.7-8.4-30.3-22-38.1l-136-78.3v-67.1c44.2-15 76-56.8 76-106.1 0-61.9-50.1-112-112-112s-112 50.1-112 112c0 49.3 31.8 91.1 76 106.1v67.1l-136 78.3c-13.6 7.8-22 22.4-22 38.1v151.6l-53 30.7c-34.9-30.8-86.8-37.4-129.2-12.8-53.5 31-71.7 99.4-41 152.9 30.8 53.5 98.9 71.9 152.2 41 42.5-24.6 62.7-73 53.6-118.8l48.7-28.3 140.6 81c6.8 3.9 14.4 5.9 22 5.9s15.2-2 22-5.9L674.5 740l48.7 28.3c-9.1 45.7 11.2 94.2 53.6 118.8 53.3 30.9 121.5 12.6 152.2-41 30.8-53.6 12.6-122-40.7-152.9zm-673 138.4a47.6 47.6 0 01-65.2-17.6c-13.2-22.9-5.4-52.3 17.5-65.5a47.6 47.6 0 0165.2 17.6c13.2 22.9 5.4 52.3-17.5 65.5zM522 463.8zM464 234a48.01 48.01 0 0196 0 48.01 48.01 0 01-96 0zm170 446.2l-122 70.3-122-70.3V539.8l122-70.3 122 70.3v140.4zm239.9 133.9c-13.2 22.9-42.4 30.8-65.2 17.6-22.8-13.2-30.7-42.6-17.5-65.5s42.4-30.8 65.2-17.6c22.9 13.2 30.7 42.5 17.5 65.5z`}}]},name:`deployment-unit`,theme:`outlined`};function LH(){return LH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},LH.apply(this,arguments)}var RH=v.forwardRef((e,t)=>v.createElement(Cs,LH({},e,{ref:t,icon:IH}))),zH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z`}},{tag:`path`,attrs:{d:`M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z`}}]},name:`exclamation-circle`,theme:`outlined`};function BH(){return BH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},BH.apply(this,arguments)}var VH=v.forwardRef((e,t)=>v.createElement(Cs,BH({},e,{ref:t,icon:zH}))),HH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M512 472a40 40 0 1080 0 40 40 0 10-80 0zm367 352.9L696.3 352V178H768v-68H256v68h71.7v174L145 824.9c-2.8 7.4-4.3 15.2-4.3 23.1 0 35.3 28.7 64 64 64h614.6c7.9 0 15.7-1.5 23.1-4.3 33-12.7 49.4-49.8 36.6-82.8zM395.7 364.7V180h232.6v184.7L719.2 600c-20.7-5.3-42.1-8-63.9-8-61.2 0-119.2 21.5-165.3 60a188.78 188.78 0 01-121.3 43.9c-32.7 0-64.1-8.3-91.8-23.7l118.8-307.5zM210.5 844l41.7-107.8c35.7 18.1 75.4 27.8 116.6 27.8 61.2 0 119.2-21.5 165.3-60 33.9-28.2 76.3-43.9 121.3-43.9 35 0 68.4 9.5 97.6 27.1L813.5 844h-603z`}}]},name:`experiment`,theme:`outlined`};function UH(){return UH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},UH.apply(this,arguments)}var WH=v.forwardRef((e,t)=>v.createElement(Cs,UH({},e,{ref:t,icon:HH}))),GH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M688 312v-48c0-4.4-3.6-8-8-8H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8zm-392 88c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H296zm144 452H208V148h560v344c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V108c0-17.7-14.3-32-32-32H168c-17.7 0-32 14.3-32 32v784c0 17.7 14.3 32 32 32h272c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm445.7 51.5l-93.3-93.3C814.7 780.7 828 743.9 828 704c0-97.2-78.8-176-176-176s-176 78.8-176 176 78.8 176 176 176c35.8 0 69-10.7 96.8-29l94.7 94.7c1.6 1.6 3.6 2.3 5.6 2.3s4.1-.8 5.6-2.3l31-31a7.9 7.9 0 000-11.2zM652 816c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z`}}]},name:`file-search`,theme:`outlined`};function KH(){return KH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},KH.apply(this,arguments)}var qH=v.forwardRef((e,t)=>v.createElement(Cs,KH({},e,{ref:t,icon:GH}))),JH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M841 370c3-3.3 2.7-8.3-.6-11.3a8.24 8.24 0 00-5.3-2.1h-72.6c-2.4 0-4.6 1-6.1 2.8L633.5 504.6a7.96 7.96 0 01-13.4-1.9l-63.5-141.3a7.9 7.9 0 00-7.3-4.7H380.7l.9-4.7 8-42.3c10.5-55.4 38-81.4 85.8-81.4 18.6 0 35.5 1.7 48.8 4.7l14.1-66.8c-22.6-4.7-35.2-6.1-54.9-6.1-103.3 0-156.4 44.3-175.9 147.3l-9.4 49.4h-97.6c-3.8 0-7.1 2.7-7.8 6.4L181.9 415a8.07 8.07 0 007.8 9.7H284l-89 429.9a8.07 8.07 0 007.8 9.7H269c3.8 0 7.1-2.7 7.8-6.4l89.7-433.1h135.8l68.2 139.1c1.4 2.9 1 6.4-1.2 8.8l-180.6 203c-2.9 3.3-2.6 8.4.7 11.3 1.5 1.3 3.4 2 5.3 2h72.7c2.4 0 4.6-1 6.1-2.8l123.7-146.7c2.8-3.4 7.9-3.8 11.3-1 .9.8 1.6 1.7 2.1 2.8L676.4 784c1.3 2.8 4.1 4.7 7.3 4.7h64.6a8.02 8.02 0 007.2-11.5l-95.2-198.9c-1.4-2.9-.9-6.4 1.3-8.8L841 370z`}}]},name:`function`,theme:`outlined`};function YH(){return YH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},YH.apply(this,arguments)}var XH=v.forwardRef((e,t)=>v.createElement(Cs,YH({},e,{ref:t,icon:JH}))),ZH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z`}},{tag:`path`,attrs:{d:`M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z`}}]},name:`info-circle`,theme:`outlined`};function QH(){return QH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},QH.apply(this,arguments)}var $H=v.forwardRef((e,t)=>v.createElement(Cs,QH({},e,{ref:t,icon:ZH}))),eU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM305.8 637.7c3.1 3.1 8.1 3.1 11.3 0l138.3-137.6L583 628.5c3.1 3.1 8.2 3.1 11.3 0l275.4-275.3c3.1-3.1 3.1-8.2 0-11.3l-39.6-39.6a8.03 8.03 0 00-11.3 0l-230 229.9L461.4 404a8.03 8.03 0 00-11.3 0L266.3 586.7a8.03 8.03 0 000 11.3l39.5 39.7z`}}]},name:`line-chart`,theme:`outlined`};function tU(){return tU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},tU.apply(this,arguments)}var nU=v.forwardRef((e,t)=>v.createElement(Cs,tU({},e,{ref:t,icon:eU}))),rU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 000 13.8z`}}]},name:`menu-fold`,theme:`outlined`};function iU(){return iU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},iU.apply(this,arguments)}var aU=v.forwardRef((e,t)=>v.createElement(Cs,iU({},e,{ref:t,icon:rU}))),oU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM142.4 642.1L298.7 519a8.84 8.84 0 000-13.9L142.4 381.9c-5.8-4.6-14.4-.5-14.4 6.9v246.3a8.9 8.9 0 0014.4 7z`}}]},name:`menu-unfold`,theme:`outlined`};function sU(){return sU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},sU.apply(this,arguments)}var cU=v.forwardRef((e,t)=>v.createElement(Cs,sU({},e,{ref:t,icon:oU}))),lU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M464 512a48 48 0 1096 0 48 48 0 10-96 0zm200 0a48 48 0 1096 0 48 48 0 10-96 0zm-400 0a48 48 0 1096 0 48 48 0 10-96 0zm661.2-173.6c-22.6-53.7-55-101.9-96.3-143.3a444.35 444.35 0 00-143.3-96.3C630.6 75.7 572.2 64 512 64h-2c-60.6.3-119.3 12.3-174.5 35.9a445.35 445.35 0 00-142 96.5c-40.9 41.3-73 89.3-95.2 142.8-23 55.4-34.6 114.3-34.3 174.9A449.4 449.4 0 00112 714v152a46 46 0 0046 46h152.1A449.4 449.4 0 00510 960h2.1c59.9 0 118-11.6 172.7-34.3a444.48 444.48 0 00142.8-95.2c41.3-40.9 73.8-88.7 96.5-142 23.6-55.2 35.6-113.9 35.9-174.5.3-60.9-11.5-120-34.8-175.6zm-151.1 438C704 845.8 611 884 512 884h-1.7c-60.3-.3-120.2-15.3-173.1-43.5l-8.4-4.5H188V695.2l-4.5-8.4C155.3 633.9 140.3 574 140 513.7c-.4-99.7 37.7-193.3 107.6-263.8 69.8-70.5 163.1-109.5 262.8-109.9h1.7c50 0 98.5 9.7 144.2 28.9 44.6 18.7 84.6 45.6 119 80 34.3 34.3 61.3 74.4 80 119 19.4 46.2 29.1 95.2 28.9 145.8-.6 99.6-39.7 192.9-110.1 262.7z`}}]},name:`message`,theme:`outlined`};function uU(){return uU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},uU.apply(this,arguments)}var dU=v.forwardRef((e,t)=>v.createElement(Cs,uU({},e,{ref:t,icon:lU}))),fU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M696 480H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z`}},{tag:`path`,attrs:{d:`M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z`}}]},name:`minus-circle`,theme:`outlined`};function pU(){return pU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pU.apply(this,arguments)}var mU=v.forwardRef((e,t)=>v.createElement(Cs,pU({},e,{ref:t,icon:fU}))),hU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M843.5 737.4c-12.4-75.2-79.2-129.1-155.3-125.4S550.9 676 546 752c-153.5-4.8-208-40.7-199.1-113.7 3.3-27.3 19.8-41.9 50.1-49 18.4-4.3 38.8-4.9 57.3-3.2 1.7.2 3.5.3 5.2.5 11.3 2.7 22.8 5 34.3 6.8 34.1 5.6 68.8 8.4 101.8 6.6 92.8-5 156-45.9 159.2-132.7 3.1-84.1-54.7-143.7-147.9-183.6-29.9-12.8-61.6-22.7-93.3-30.2-14.3-3.4-26.3-5.7-35.2-7.2-7.9-75.9-71.5-133.8-147.8-134.4-76.3-.6-140.9 56.1-150.1 131.9s40 146.3 114.2 163.9c74.2 17.6 149.9-23.3 175.7-95.1 9.4 1.7 18.7 3.6 28 5.8 28.2 6.6 56.4 15.4 82.4 26.6 70.7 30.2 109.3 70.1 107.5 119.9-1.6 44.6-33.6 65.2-96.2 68.6-27.5 1.5-57.6-.9-87.3-5.8-8.3-1.4-15.9-2.8-22.6-4.3-3.9-.8-6.6-1.5-7.8-1.8l-3.1-.6c-2.2-.3-5.9-.8-10.7-1.3-25-2.3-52.1-1.5-78.5 4.6-55.2 12.9-93.9 47.2-101.1 105.8-15.7 126.2 78.6 184.7 276 188.9 29.1 70.4 106.4 107.9 179.6 87 73.3-20.9 119.3-93.4 106.9-168.6zM329.1 345.2a83.3 83.3 0 11.01-166.61 83.3 83.3 0 01-.01 166.61zM695.6 845a83.3 83.3 0 11.01-166.61A83.3 83.3 0 01695.6 845z`}}]},name:`node-index`,theme:`outlined`};function gU(){return gU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gU.apply(this,arguments)}var _U=v.forwardRef((e,t)=>v.createElement(Cs,gU({},e,{ref:t,icon:hU}))),vU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M878.3 392.1L631.9 145.7c-6.5-6.5-15-9.7-23.5-9.7s-17 3.2-23.5 9.7L423.8 306.9c-12.2-1.4-24.5-2-36.8-2-73.2 0-146.4 24.1-206.5 72.3a33.23 33.23 0 00-2.7 49.4l181.7 181.7-215.4 215.2a15.8 15.8 0 00-4.6 9.8l-3.4 37.2c-.9 9.4 6.6 17.4 15.9 17.4.5 0 1 0 1.5-.1l37.2-3.4c3.7-.3 7.2-2 9.8-4.6l215.4-215.4 181.7 181.7c6.5 6.5 15 9.7 23.5 9.7 9.7 0 19.3-4.2 25.9-12.4 56.3-70.3 79.7-158.3 70.2-243.4l161.1-161.1c12.9-12.8 12.9-33.8 0-46.8zM666.2 549.3l-24.5 24.5 3.8 34.4a259.92 259.92 0 01-30.4 153.9L262 408.8c12.9-7.1 26.3-13.1 40.3-17.9 27.2-9.4 55.7-14.1 84.7-14.1 9.6 0 19.3.5 28.9 1.6l34.4 3.8 24.5-24.5L608.5 224 800 415.5 666.2 549.3z`}}]},name:`pushpin`,theme:`outlined`};function yU(){return yU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},yU.apply(this,arguments)}var bU=v.forwardRef((e,t)=>v.createElement(Cs,yU({},e,{ref:t,icon:vU}))),xU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M300 328a60 60 0 10120 0 60 60 0 10-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 10120 0 60 60 0 10-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z`}}]},name:`robot`,theme:`outlined`};function SU(){return SU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},SU.apply(this,arguments)}var CU=v.forwardRef((e,t)=>v.createElement(Cs,SU({},e,{ref:t,icon:xU}))),wU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M893.3 293.3L730.7 130.7c-7.5-7.5-16.7-13-26.7-16V112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 184h256v104H384V184zm456 656H184V184h136v136c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V205.8l136 136V840zM512 442c-79.5 0-144 64.5-144 144s64.5 144 144 144 144-64.5 144-144-64.5-144-144-144zm0 224c-44.2 0-80-35.8-80-80s35.8-80 80-80 80 35.8 80 80-35.8 80-80 80z`}}]},name:`save`,theme:`outlined`};function TU(){return TU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},TU.apply(this,arguments)}var EU=v.forwardRef((e,t)=>v.createElement(Cs,TU({},e,{ref:t,icon:wU}))),DU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M931.4 498.9L94.9 79.5c-3.4-1.7-7.3-2.1-11-1.2a15.99 15.99 0 00-11.7 19.3l86.2 352.2c1.3 5.3 5.2 9.6 10.4 11.3l147.7 50.7-147.6 50.7c-5.2 1.8-9.1 6-10.3 11.3L72.2 926.5c-.9 3.7-.5 7.6 1.2 10.9 3.9 7.9 13.5 11.1 21.5 7.2l836.5-417c3.1-1.5 5.6-4.1 7.2-7.1 3.9-8 .7-17.6-7.2-21.6zM170.8 826.3l50.3-205.6 295.2-101.3c2.3-.8 4.2-2.6 5-5 1.4-4.2-.8-8.7-5-10.2L221.1 403 171 198.2l628 314.9-628.2 313.2z`}}]},name:`send`,theme:`outlined`};function OU(){return OU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},OU.apply(this,arguments)}var kU=v.forwardRef((e,t)=>v.createElement(Cs,OU({},e,{ref:t,icon:DU}))),AU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z`}}]},name:`setting`,theme:`outlined`};function jU(){return jU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jU.apply(this,arguments)}var MU=v.forwardRef((e,t)=>v.createElement(Cs,jU({},e,{ref:t,icon:AU}))),NU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M752 664c-28.5 0-54.8 10-75.4 26.7L469.4 540.8a160.68 160.68 0 000-57.6l207.2-149.9C697.2 350 723.5 360 752 360c66.2 0 120-53.8 120-120s-53.8-120-120-120-120 53.8-120 120c0 11.6 1.6 22.7 4.7 33.3L439.9 415.8C410.7 377.1 364.3 352 312 352c-88.4 0-160 71.6-160 160s71.6 160 160 160c52.3 0 98.7-25.1 127.9-63.8l196.8 142.5c-3.1 10.6-4.7 21.8-4.7 33.3 0 66.2 53.8 120 120 120s120-53.8 120-120-53.8-120-120-120zm0-476c28.7 0 52 23.3 52 52s-23.3 52-52 52-52-23.3-52-52 23.3-52 52-52zM312 600c-48.5 0-88-39.5-88-88s39.5-88 88-88 88 39.5 88 88-39.5 88-88 88zm440 236c-28.7 0-52-23.3-52-52s23.3-52 52-52 52 23.3 52 52-23.3 52-52 52z`}}]},name:`share-alt`,theme:`outlined`};function PU(){return PU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},PU.apply(this,arguments)}var FU=v.forwardRef((e,t)=>v.createElement(Cs,PU({},e,{ref:t,icon:NU}))),IU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372 0-89 31.3-170.8 83.5-234.8l523.3 523.3C682.8 852.7 601 884 512 884zm288.5-137.2L277.2 223.5C341.2 171.3 423 140 512 140c205.4 0 372 166.6 372 372 0 89-31.3 170.8-83.5 234.8z`}}]},name:`stop`,theme:`outlined`};function LU(){return LU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},LU.apply(this,arguments)}var RU=v.forwardRef((e,t)=>v.createElement(Cs,LU({},e,{ref:t,icon:IU}))),zU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M168 504.2c1-43.7 10-86.1 26.9-126 17.3-41 42.1-77.7 73.7-109.4S337 212.3 378 195c42.4-17.9 87.4-27 133.9-27s91.5 9.1 133.8 27A341.5 341.5 0 01755 268.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.7 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c0-6.7-7.7-10.5-12.9-6.3l-56.4 44.1C765.8 155.1 646.2 92 511.8 92 282.7 92 96.3 275.6 92 503.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8zm756 7.8h-60c-4.4 0-7.9 3.5-8 7.8-1 43.7-10 86.1-26.9 126-17.3 41-42.1 77.8-73.7 109.4A342.45 342.45 0 01512.1 856a342.24 342.24 0 01-243.2-100.8c-9.9-9.9-19.2-20.4-27.8-31.4l60.2-47a8 8 0 00-3-14.1l-175.7-43c-5-1.2-9.9 2.6-9.9 7.7l-.7 181c0 6.7 7.7 10.5 12.9 6.3l56.4-44.1C258.2 868.9 377.8 932 512.2 932c229.2 0 415.5-183.7 419.8-411.8a8 8 0 00-8-8.2z`}}]},name:`sync`,theme:`outlined`};function BU(){return BU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},BU.apply(this,arguments)}var VU=v.forwardRef((e,t)=>v.createElement(Cs,BU({},e,{ref:t,icon:zU}))),HU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 208H676V232h212v136zm0 224H676V432h212v160zM412 432h200v160H412V432zm200-64H412V232h200v136zm-476 64h212v160H136V432zm0-200h212v136H136V232zm0 424h212v136H136V656zm276 0h200v136H412V656zm476 136H676V656h212v136z`}}]},name:`table`,theme:`outlined`};function UU(){return UU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},UU.apply(this,arguments)}var WU=v.forwardRef((e,t)=>v.createElement(Cs,UU({},e,{ref:t,icon:HU}))),GU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M848 359.3H627.7L825.8 109c4.1-5.3.4-13-6.3-13H436c-2.8 0-5.5 1.5-6.9 4L170 547.5c-3.1 5.3.7 12 6.9 12h174.4l-89.4 357.6c-1.9 7.8 7.5 13.3 13.3 7.7L853.5 373c5.2-4.9 1.7-13.7-5.5-13.7zM378.2 732.5l60.3-241H281.1l189.6-327.4h224.6L487 427.4h211L378.2 732.5z`}}]},name:`thunderbolt`,theme:`outlined`};function KU(){return KU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},KU.apply(this,arguments)}var qU=v.forwardRef((e,t)=>v.createElement(Cs,KU({},e,{ref:t,icon:GU}))),JU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M876.6 239.5c-.5-.9-1.2-1.8-2-2.5-5-5-13.1-5-18.1 0L684.2 409.3l-67.9-67.9L788.7 169c.8-.8 1.4-1.6 2-2.5 3.6-6.1 1.6-13.9-4.5-17.5-98.2-58-226.8-44.7-311.3 39.7-67 67-89.2 162-66.5 247.4l-293 293c-3 3-2.8 7.9.3 11l169.7 169.7c3.1 3.1 8.1 3.3 11 .3l292.9-292.9c85.5 22.8 180.5.7 247.6-66.4 84.4-84.5 97.7-213.1 39.7-311.3zM786 499.8c-58.1 58.1-145.3 69.3-214.6 33.6l-8.8 8.8-.1-.1-274 274.1-79.2-79.2 230.1-230.1s0 .1.1.1l52.8-52.8c-35.7-69.3-24.5-156.5 33.6-214.6a184.2 184.2 0 01144-53.5L537 318.9a32.05 32.05 0 000 45.3l124.5 124.5a32.05 32.05 0 0045.3 0l132.8-132.8c3.7 51.8-14.4 104.8-53.6 143.9z`}}]},name:`tool`,theme:`outlined`};function YU(){return YU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},YU.apply(this,arguments)}var XU=v.forwardRef((e,t)=>v.createElement(Cs,YU({},e,{ref:t,icon:JU}))),ZU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z`}}]},name:`unordered-list`,theme:`outlined`};function QU(){return QU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},QU.apply(this,arguments)}var $U=v.forwardRef((e,t)=>v.createElement(Cs,QU({},e,{ref:t,icon:ZU}))),eW={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z`}}]},name:`warning`,theme:`outlined`};function tW(){return tW=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},tW.apply(this,arguments)}var nW=v.forwardRef((e,t)=>v.createElement(Cs,tW({},e,{ref:t,icon:eW}))),rW={shell:{appName:`WrenAI`,themeToLight:`Switch to light theme`,themeToDark:`Switch to dark theme`,collapseSidebar:`Collapse sidebar`,expandSidebar:`Expand sidebar`},nav:{setup:`Setup`,ask:`Ask`,sessions:`Sessions`,artifacts:`Artifacts`,context:`Context`,harness:`Harness`,eval:`Eval`},state:{loading:`Loading…`,emptyTitle:`Nothing here yet`,errorTitle:`Something went wrong`,retry:`Retry`},status:{verified:`Verified`,estimate:`Estimate`,refused:`Refused`,unverified:`Unverified`},envelope:{noTableData:`No table data`,derivationTitle:`How this was derived`,estimateBasisNote:`projection · basis verified`,definitionSql:`SQL`,definitionSources:`Sources`,definitionFilters:`Filters`,definitionNoneFallback:`—`,definitionEmptyFallback:`none`,unsupportedBlockPrefix:`Unsupported block: "`,unsupportedBlockSuffix:`"`,couldNotRender:`This content couldn't be rendered`},ask:{sessionsHeader:`Sessions`,newSession:`New session`,noSessions:`No sessions yet`,emptyTitle:`Ask anything about your data`,emptyDescription:`Questions and answers in this session will appear here.`,composerLabel:`Ask a question`,composerPlaceholder:`Ask a question…`,send:`Send`,turnPending:`Working on your request…`,workLog:`Work log`,executionTrace:`Execution trace`,stepRunning:`running`,stepDone:`done`,stepError:`error`,stepToggleLabel:`Toggle step details`,stepInputLabel:`Input`,stepActionLabel:`Action`,stepOutputLabel:`Output`,stepDurationLabel:`Duration`,stepResultLabel:`Result`,stepErrorDetailLabel:`Error`,stepReasoningLabel:`Reasoning`,refusalFixLabel:`How to unblock this`,artifact:`Artifact`,save:`Save to Artifacts`,saved:`Saved`,publish:`Publish`,published:`Published`,publishedTitle:`Published`,shareLink:`Share link`,accessScope:`Access`,shareLinkPending:`Sharing is not available yet — this link is a placeholder and does not open.`,streamErrorTitle:`The connection to the agent was lost`,streamErrorGeneric:`The harness stream reported an error.`,streamConnectionLost:`Lost connection to the harness stream.`,harnessUnreachable:`Failed to reach the harness.`},context:{filesHeader:`Files`,pageLead:`Models, relationships, and cubes, plus knowledge (instructions and verified Question-SQL pairs) — the semantic layer the agent binds to.`,overview:`Overview`,backToOverview:`Back to overview`,projectPathLabel:`Project path`,projectPathNotBound:`Not bound to a filesystem path`,modelsTitle:`Models`,relationshipsTitle:`Relationships`,measuresTitle:`Measures`,knowledgeTitle:`Knowledge`,columns:`Columns`,erDiagramAriaLabel:`Entity relationship diagram`,erColumnCount:`cols`,erPrimaryKey:`PK`,erForeignKey:`FK`,additive:`Additive`,nonAdditive:`Non-additive`,instructionsPresent:`Instructions present`,yes:`Yes`,no:`No`,verifiedPairCount:`Verified Question-SQL pairs`,verifiedPairsNotTracked:`Not tracked`,verifiedPairsNotTrackedHint:`This project has no verified-pairs source yet.`,inferredKeyHint:`Inferred from the primary key and relationship conditions — a heuristic, not authoritative.`,inferredMeasureHint:`Inferred from the measure's expression — a heuristic, not authoritative.`,viewImpact:`View impact`,modelsStat:`models`,relationshipsStat:`relationships`,measuresStat:`measures`,fileEmptyTitle:`Select a file`,fileEmptyDescription:`Choose a file from the tree to view its contents.`,emptyTitle:`No semantic layer loaded`,emptyDescription:`Connect a project to see its models, relationships, and cubes.`,impactTitle:`Impact`,impactLoadingTitle:`Loading impact…`,impactErrorTitle:`Could not load impact`,impactLoadFailedMessage:`Failed to load impact data.`,overviewErrorTitle:`Could not load semantic layer`,overviewLoadFailedMessage:`Failed to load the semantic overview.`,filesErrorTitle:`Could not load files`,filesLoadFailedMessage:`Failed to load the project file tree.`,impactSeed:`Changed entity`,impactSeverity:`Worst-case severity`,downstreamDependents:`Downstream dependents`,downstreamByKind:`Grouped by kind`,noDownstream:`No downstream dependents.`,kindModel:`Model`,kindMeasure:`Measure`,kindRelationship:`Relationship`,kindView:`View`,severityNone:`None`,severityCompatibility:`Compatibility`,severityStructural:`Structural`,severitySemantic:`Semantic`,brokenPairsTitle:`Broken verified pairs`,noBrokenPairs:`No verified pairs affected.`,brokenPairsQuestion:`Question`,brokenPairsHits:`Hits`,edit:`Edit`,editInVsCode:`Open in VS Code`,editInCursor:`Open in Cursor`,editWithClaudeCli:`Claude Code CLI`,editModalTitle:`Claude Code CLI prompt`,editModalDescription:`Copy this prompt into the Claude Code CLI to make the change.`,copyPrompt:`Copy prompt`,promptCopied:`Copied`,outOfScopeTitle:`Not available yet`,outOfScopeInlineEditing:`In-app YAML/SQL editing`,outOfScopeCopilot:`Context Copilot`,outOfScopeDeployReview:`Deploy-time blast-radius review`,outOfScopeHint:`Planned for a later phase — use the Edit menu for now.`,enrichmentTitle:`Optional context enrichment`,nativeEnrichmentLead:`Continue enrichment in the real vendor CLI. The interactive session owns its review and approval steps.`,nativeEnrichmentBffReady:`This local BFF can open a terminal session in the bound project.`,nativeEnrichmentBffRequired:`A local BFF is required to open an embedded terminal. You can still copy a command and run it from the bound project.`,continueClaudeCli:`Continue in Claude CLI`,continueCodexCli:`Continue in Codex CLI`,copyCommand:`Copy command`,nativeEnrichmentCopyHint:`The copy fallback starts the selected CLI in the project directory; it does not launch a terminal from the browser.`,terminalTitle:`Interactive enrichment terminal`,terminalLead:`This is the selected vendor CLI running in the bound project. Its output and interaction are not an Ask transcript.`,terminalAriaLabel:`Interactive CLI terminal`,terminalInvalidTarget:`This interactive CLI target is not supported.`,terminalStartFailed:`The interactive terminal could not start. Check the local BFF and generated enrichment artifacts, then try again.`,terminalConnectionFailed:`The terminal connection was lost.`,terminalExited:`The interactive CLI session has exited. Reload Context to inspect changed files and revision.`,reloadContext:`Reload Context`,enrichmentIntro:`Review optional business context after Compile and bind. This never blocks Ask.`,enrichmentUnavailable:`Finish the foundation and Compile and bind before enrichment is available. Ask is unchanged.`,enrichmentReady:`Foundation is ready. Start enrichment now or return later without changing Ask.`,enrichmentSkipForNow:`Skip for now`,enrichmentDismissed:`Enrichment is hidden for now. Ask is unchanged.`,enrichmentShow:`Show enrichment`,enrichmentStartGrill:`Start Grill`,enrichmentStartAutopilot:`Start Auto-pilot`,enrichmentGrill:`Grill`,enrichmentAutopilot:`Auto-pilot`,enrichmentAccept:`Accept`,enrichmentEdit:`Edit`,enrichmentSkip:`Skip`,enrichmentApprove:`Approve change`,enrichmentRetry:`Reconcile`,enrichmentReapply:`Reapply`,enrichmentCancel:`Cancel run`,enrichmentReview:`Review one proposal at a time`,enrichmentConfidence:`Confidence`,enrichmentEvidence:`Evidence summary`,enrichmentAwaitingApproval:`Accepted change awaits host approval.`,enrichmentStatusAwaitingApproval:`Awaiting approval`,enrichmentStatusReconcile:`Reconciliation required`,enrichmentStatusDrafting:`Drafting proposal`,enrichmentStatusFailed:`Failed`,enrichmentAutopilotPause:`Auto-pilot paused. Review is needed before it can continue.`,enrichmentApplying:`Applying the accepted change.`,enrichmentReconcile:`Apply outcome needs reconciliation before another attempt.`,enrichmentReadyToReapply:`The change was not applied and can be reapplied.`,enrichmentCancelled:`This enrichment run was cancelled. Ask remains available.`,enrichmentCompleted:`This enrichment run is complete.`,enrichmentNoAction:`No proposal needs a decision right now.`,enrichmentAudit:`Audit summary`,enrichmentApplied:`Applied`,enrichmentSkipped:`Skipped`,enrichmentReverted:`Reverted`,enrichmentFailed:`Failed`,enrichmentReconcileNeeded:`Needs reconciliation`,enrichmentEditTitle:`Edit enrichment proposal`,enrichmentEditSink:`Target`,enrichmentEditKind:`Change type`,enrichmentEditSummary:`Evidence summary`,enrichmentEditDraft:`Proposed change`,enrichmentEditConfidence:`Confidence (0 to 1)`,enrichmentEditSubmit:`Resubmit for review`,enrichmentEditCancel:`Keep reviewing`,enrichmentEditRequired:`Enter a value.`,enrichmentEditConfidenceRange:`Use a number from 0 to 1.`,enrichmentRequestFailed:`Could not update enrichment. Reload the latest status and try again.`,enrichmentLoading:`Loading enrichment status…`,enrichmentLoadFailed:`Could not load enrichment status. Try again.`,enrichmentCapabilityUnavailable:`This action is unavailable because the required host capability is not configured.`,enrichmentDraftUnavailable:`Enrichment is unavailable until a compatible draft capability is configured.`,enrichmentDraftRequiresClaude:`Enrichment is unavailable with the current subscription provider. Switch the runtime to a Claude subscription to use it.`,enrichmentActionStale:`This review changed elsewhere. Reloaded status is required before trying again.`,enrichmentActionFailed:`The action did not complete. Review the current status and try again.`,enrichmentOutcomePending:`Pending review`,enrichmentOutcomeApplied:`Applied`,enrichmentOutcomeSkipped:`Skipped`,enrichmentOutcomeReverted:`Reverted`,enrichmentOutcomeFailed:`Failed`,enrichmentOutcomeReconcile:`Needs reconciliation`,enrichmentAuditHistory:`Outcome history`},harness:{profilesHeader:`Profiles`,pageSubtitle:`selected purpose · active runtime · executable components`,pageLeadPrefix:`The selected`,pageLeadSuffix:`profile is shown with its active runtime target and executable components.`,executionTitle:`Execution path`,executionNote:`This selected purpose is the active execution path for this view.`,purpose:`Purpose`,profile:`Profile`,compiledDispatchTarget:`Compiled dispatch target`,setupRunnerTarget:`Setup runner`,nativeSessionTarget:`Native session target`,readiness:`Readiness`,ready:`Ready`,unavailable:`Unavailable`,available:`Available`,availableVia:`Available via`,availability:`Availability`,reason:`Reason`,reasonUnavailable:`The configured runtime cannot execute this component.`,programmaticallyUnavailable:`Not available on compiled dispatch target`,targetNotConfigured:`Runtime binding required`,componentsNote:`Availability and any reason are shown with each component.`,technicalDiagnosticsTitle:`Technical diagnostics`,technicalDiagnosticsNote:`Expand a section for implementation and configuration detail.`,runtimeDiagnosticsTitle:`Runtime and model binding`,authenticationBackend:`Authentication back-end`,dispatcherImplementation:`Dispatcher implementation`,profileDiagnosticsTitle:`Profile and compiled bundle`,nativeBindingDiagnosticsTitle:`Native runtime binding`,bindingGeneration:`Binding generation`,profileStatusBound:`Bound`,emptyTitle:`No profile selected`,emptyDescription:`Select a profile from the sidebar to see its status.`,loadErrorTitle:`Could not load harness`,loadFailedMessage:`Failed to load harness.`,profileTitle:`Profile`,source:`Source`,boundContext:`Bound context`,verifyGate:`Verify gate`,verifyGateOn:`On`,verifyGateOff:`Off`,dispatchTarget:`Dispatch target`,bundle:`Compiled bundle`,status:`Status`,runtimeTitle:`Runtime · back-end`,activeBackend:`Active back-end`,alsoAvailable:`Also available`,alsoAvailableHint:`Another back-end this same profile can run against — a framework fact, not the running configuration.`,subscriptionAvailable:`Subscription (Claude Agent SDK)`,dispatcher:`Dispatcher`,dispatcherClaudeAgentSdk:`Claude Agent SDK`,dispatcherCodexLocal:`Codex local`,dispatcherInProcess:`In-process`,tier:`Tier`,model:`Model`,runtimeBackendNote:`The same profile can run against different runtime back-ends — subscription, API key, local, or an org gateway.`,agentProfilesTitle:`Agent profiles`,profileColumn:`Profile`,role:`Role`,roleOrchestrator:`Orchestrator`,roleSubAgent:`Sub-agent`,tierModel:`Tier → model`,capabilitiesColumn:`Capabilities`,callableAs:`Callable as`,agentProfilesNote:`Sub-agent profiles spawn as gated tools of the orchestrator — not concurrent processes.`,addProfile:`Add profile`,importProfile:`Import from warble Hub`,connectionTitle:`Data source · connection`,connectionType:`Type`,connectionLocation:`Location`,connectionVia:`Via`,tablesSynced:`Tables synced`,lastSync:`Last sync`,health:`Health`,healthHealthy:`Healthy`,healthDegraded:`Degraded`,healthDown:`Down`,testConnection:`Test connection`,resyncTables:`Re-sync tables`,manageSource:`Manage source`,componentsTitle:`Components`,component:`Component`,componentType:`Type`,realization:`Realization`,tiers:`Tiers`,toolsLabel:`Tools`,outputBlocksLabel:`Output blocks`,stepConsumes:`Consumes`,stepProduces:`Produces`,stepGuard:`Guard`,stepFoldInto:`Fold into`,stepMaxAttempts:`Max attempts`,outcomeLabel:`Outcome`,noneFallback:`none`,capabilityResolutionTitle:`Capability resolution`,capability:`Capability`,outcome:`Outcome`,outcomeNative:`Native`,outcomeRealizeVia:`Realize via`,providedBy:`Provided by`,criticality:`Criticality`,guardrailsTitle:`Guardrails`,enforcement:`Enforcement`,locked:`Locked`,recompile:`Re-compile`,outOfScopeTitle:`Not available yet`,outOfScopeHint:`Planned for a later phase.`},setup:{stepsHeader:`Setup`,pageLead:`A guided, agent-led first run: connect a data source, build context, bind a profile, then ask.`,stepDone:`Done`,stepCurrent:`In progress`,stepTodo:`Not started`,resetAction:`Reset setup`,resetConfirmTitle:`Reset setup?`,resetConfirmDescription:`Clears all setup progress and settings and unbinds the project so you can start over. Your scaffolded project files (including .env) are kept on disk.`,resetConfirmOk:`Reset`,resetConfirmCancel:`Cancel`,modeChoiceTitle:`Get started`,modeChoiceDescription:`Choose how you want to set up this workspace.`,modeCreateTitle:`Create a new project`,modeCreateDescription:`Scaffold a fresh project: connect a data source, build context, and bind a profile. The connection profile is saved in this workspace only — your existing wren CLI profiles and active profile elsewhere on this machine are left untouched.`,modeCreateAction:`Create new project`,modeAdoptTitle:`Adopt an existing project`,modeAdoptDescription:`Point at an existing wren project directory that already has a connection profile. Uses your existing wren CLI profiles as-is; nothing about your existing setup is changed.`,modeAdoptAction:`Adopt existing project`,runtimeTitle:`Runtime & models`,runtimeDescription:`Choose how you authenticate and which model backs each tier.`,authModeLabel:`Authentication`,authModeAriaLabel:`Authentication mode`,authSubscription:`Personal subscription`,authSubscriptionProviderLabel:`Subscription provider`,authSubscriptionProviderAriaLabel:`Subscription provider`,authSubscriptionClaude:`Claude`,authSubscriptionCodex:`ChatGPT / Codex`,authByo:`API key (BYO)`,authLocal:`Local`,runtimeComingSoon:`coming soon`,runtimeUnavailable:`temporarily unavailable`,tierModelsLabel:`Model per tier`,tierOrchestrator:`Orchestrator`,tierStrong:`Strong`,tierCheap:`Cheap`,tierModelAriaOrchestrator:`Model for orchestrator tier`,tierModelAriaStrong:`Model for strong tier`,tierModelAriaCheap:`Model for cheap tier`,hybridLabel:`Hybrid routing`,hybridDescription:`Route steps across different providers or a cloud/local mix (e.g. a local model for some steps).`,authSubscriptionWarning:`Uses your personal Claude subscription — for personal, single-operator use only (not multi-user or hosted). May be subject to the provider’s Terms of Service.`,authCodexSubscriptionWarning:`Uses local automation through your personal ChatGPT/Codex subscription. Use only for personal, single-operator workflows — not multi-user, hosted, shared, or always-on service use. Availability and use may be subject to OpenAI terms and product limits.`,authSubscriptionLoggedOut:`This subscription CLI is not logged in on the BFF host. Sign in from the same environment, then reload detection before continuing.`,authByoAdapterLabel:`API key adapter`,authByoAdapterAriaLabel:`API key adapter`,authByoAdapterAnthropic:`Anthropic`,authByoAdapterOpenaiCompatible:`OpenAI-compatible`,authByoEnvDetected:`detected on the server`,authByoEnvMissing:`not set on the server — set it in the BFF process environment before continuing`,authByoModelLabel:`Model`,authByoModelPlaceholder:`e.g. claude-sonnet-4-5-20250929`,authByoModelRequired:`Model is required — neither adapter has a default.`,authByoModelLooksLikeUrl:`Model looks like a URL — check that Model and Base URL weren’t swapped.`,authByoBaseUrlLabel:`Base URL`,authByoBaseUrlPlaceholder:`https://…`,authByoBaseUrlRequired:`Base URL is required for the OpenAI-compatible adapter.`,authByoBaseUrlInvalid:`Base URL must be an absolute http(s) URL — check that Model and Base URL weren’t swapped.`,tierAdapterLocal:`Local (OpenAI-compatible)`,subscriptionDriverModelLabel:`Subscription driver model`,subscriptionDriverModelHint:`This drives the subscription dispatcher. It is not a compiled profile tier.`,subscriptionModelsLabel:`Available models`,subscriptionModelsRefresh:`Refresh`,subscriptionModelsSignedInHint:`Suggestions are available to your signed-in subscription provider. You can still enter any model ID.`,subscriptionModelsUnavailable:`Model suggestions are unavailable`,subscriptionModelsFreeTextHint:`You can still enter a model ID manually and save valid settings.`,subscriptionModelDefault:`Provider default`,subscriptionModelPlaceholder:`Search models or enter a model ID`,subscriptionModelCustomUnverified:`Custom / unverified model`,hybridLimitationsTitle:`Hybrid limitations`,hybridLimitationsDescription:`Non-Anthropic render steps can wall-hit; OpenAI-compatible routing has no streaming or retry; cost savings are not yet proven.`,codexTierBehaviorTitle:`Codex subscription`,codexTierBehaviorDescription:`The separate driver model and cheap/strong model values continue to feed the Codex dispatcher. Per-tier adapter/Base URL overrides are not used by that dispatcher.`,defaultModelLabel:`Default model`,defaultModelPlaceholder:`Used by every tier without a model override`,defaultModelHint:`Tier rows below are explicit overrides. Model names are free text.`,compiledTiersLabel:`Compiled bundle tiers`,tierDiscoveryErrorTitle:`Could not load compiled bundle tiers`,tierAdapterAriaPrefix:`Adapter for`,tierModelAriaPrefix:`Model for`,tierModelPlaceholder:`Search models or enter a required model ID`,tierModelOutsideUnion:`This tier will not save. Claude per-step tiers accept only: `,tierDefaultModelPrefix:`Default:`,tierBaseUrlAriaPrefix:`Base URL for`,tierBaseUrlPlaceholder:`https://… (required)`,missingAdapterCredentialsTitle:`Missing adapter credentials`,missingAdapterCredentialsSuffix:`must be set on the BFF server for the configured tier adapters.`,saveRuntime:`Save runtime settings`,savingRuntime:`Saving…`,runtimeSaveErrorTitle:`Saving runtime settings failed`,runtimeConfiguredMessage:`Runtime configured. Next, connect a data source.`,connectTitle:`Connect a data source`,connectDescription:`Pick a data source to connect to your workspace.`,connectSourceAriaLabel:`Data source`,connectProjectNameLabel:`Project name`,connectProjectNamePlaceholder:`my-project`,connectAction:`Connect`,connectCreateAction:`Create project`,connectSourceLabel:`Data source`,connectVariantLabel:`Connection type`,connectVariantHint:`This source can be connected more than one way; the credentials asked for depend on your choice.`,connectFieldOptional:` (optional)`,connectCredentialFileEncoded:`Encoded from `,connectCredentialFileError:`Could not read that file.`,connectCredentialPastePlaceholder:`…or paste the base64 value`,connectSourcePlaceholder:`Search a data source…`,connectSourceCatalogPartial:`Could not read the installed wren’s connector list — showing a partial set.`,connectedNote:`Data source connected.`,connectingNote:`Connecting…`,dataSourceConnectedMessage:`Data source connected. Next, build your context — models, cubes, and knowledge.`,connectNeedsInputTitle:`Credentials needed`,connectNeedsInputMessage:`Enter the credentials below to finish connecting this data source.`,connectEnvFieldsLoadError:`Couldn't load the credential fields — you can still continue if you've set them another way.`,connectEnvSubmitAction:`Save & continue`,connectResumeAction:`I've filled .env — continue`,connectErrorTitle:`Connecting the data source failed`,connectFailureTitle:`We couldn't finish connecting your data source.`,connectFailureDescription:`Your project and data source are still saved. Retry to let the setup agent continue from where it stopped.`,continueAndRepair:`Continue & repair`,connectFailureHistoryMessage:`The setup agent couldn't finish connecting the data source.`,contextFailureTitle:`We couldn't finish building the data model.`,contextFailureDescription:`Your data source is still connected. Retry to let the setup agent continue building the data model from where it stopped.`,contextFailureHistoryMessage:`The setup agent couldn't finish building the data model.`,failureTechnicalDetails:`Technical details`,failureProjectSource:`Project: `,decisionTitle:`Decision needed`,adoptTitle:`Adopt an existing project`,adoptDescription:`Enter the path to an existing wren project — we'll verify it and bind it.`,adoptPathLabel:`Project path`,adoptPathPlaceholder:`/path/to/my-project`,adoptAction:`Verify & adopt`,adoptVerifyingNote:`Verifying project…`,adoptBoundMessage:`Project verified and bound. Setup is nearly done — bind a profile next.`,adoptErrorTitle:`Adopting the project failed`,contextTitle:`Build data model`,contextDescription:`Discover the connected schema and build its semantic model foundation.`,contextModels:`Models`,contextRelationships:`Relationships`,contextAction:`Build data model`,contextBuiltNote:`Data model foundation built.`,contextBuildingNote:`Building context…`,contextBuiltMessage:`Context built. Compile and bind a profile to turn the verify gate on.`,contextNeedsInputTitle:`More information needed`,contextNeedsInputMessage:`The agent needs more information before it can finish building context. Try again below.`,contextErrorTitle:`Building context failed`,bindTitle:`Bind profile`,bindDescription:`Compile the context into a profile and turn the verify gate on.`,bindVerifyGateLabel:`Verify gate`,bindVerifyGateOn:`On`,bindVerifyGateOff:`Off`,bindAction:`Compile and bind`,bindDoneNote:`Profile bound.`,profileBoundMessage:`Profile bound and the verify gate is on — you're ready to ask questions.`,askTitle:`Ask`,askDescription:`Setup is complete — ask a question about your data.`,askCta:`Go to Ask`,emptyTitle:`Select a step`,emptyDescription:`Choose a step from the sidebar to see its details.`},eval:{runsHeader:`Runs`,pageLead:`Run your profile over a golden question set to score verified correctness and catch regressions before they ship.`,emptyTitle:`No eval runs yet`,emptyDescription:`Run an eval to see global scores here.`,loadErrorTitle:`Could not load eval runs`,loadFailedMessage:`Failed to load eval runs.`,globalTab:`Global`,questionsTab:`Questions`,scoreLabel:`Score`,gateThresholdLabel:`Gate threshold`,gatePass:`Pass`,gateFail:`Fail`,regressionsLabel:`Regressions`,costLabel:`Cost`,p50Label:`p50 latency`,trendTitle:`Score trend`,trendAriaLabel:`Eval score trend chart`,byComponentTitle:`By component`,componentColumn:`Component`,scoreColumn:`Score`,deltaColumn:`Change`,outOfScopeTitle:`Not available yet`,outOfScopeQuestionList:`Question list`,outOfScopeQuestionDetail:`Question detail`,outOfScopeScoreHistory:`Per-question score history`,outOfScopeHint:`Planned for a later phase.`},artifacts:{listHeader:`Artifacts`,pageLead:`Every saved GenBI output — dashboard, report, or chart — with its verified state, publish status, and source.`,emptyTitle:`No artifacts yet`,emptyDescription:`Save a dashboard, report, or chart from an Ask session to see it here.`,loadErrorTitle:`Could not load artifacts`,loadFailedMessage:`Failed to load artifacts.`,detailErrorTitle:`Could not load artifact detail`,detailLoadFailedMessage:`Failed to load artifact detail.`,kindDashboard:`Dashboard`,kindReport:`Report`,kindChart:`Chart`,kindLabel:`Kind`,statusLabel:`Status`,sharedLabel:`Shared`,notSharedLabel:`Not shared`,sourceLabel:`Source`,publishTitle:`Publish`,publish:`Publish`,shareLink:`Share link`,accessScope:`Access`,shareLinkPending:`Sharing is not available yet — this link is a placeholder and does not open.`,notPublished:`Not published yet.`,fileLocation:`File`,unpin:`Unpin`,previewTitle:`Preview`,htmlPreviewNote:`Shown as a safe, non-executable text preview.`,detailUnavailableNote:`This artifact's full detail isn't available yet — the connected workspace stores its metadata only.`}};function Q(e){let t=e.split(`.`).reduce((e,t)=>e?.[t],rW);return typeof t==`string`?t:e}function iW(e,t,n){let r=new Set(t.map(e=>e.tier)),i=[e];return r.size>1&&i.push(`split`),n===`scheduled`&&i.push(`scheduled`),i.join(` · `)}function aW(){return!0}function oW(){return``}var sW=class extends Error{status;code;constructor(e,t,n){super(e),this.status=t,this.code=n,this.name=`BffRequestError`}};function cW(e){return e instanceof sW&&e.status===409&&e.code===`native_session_launch_action_stale`}async function lW(e,t){let n=await fetch(`${oW()}${e}`,{...t,headers:{"Content-Type":`application/json`,...t?.headers}});if(!n.ok){let t=await n.json().catch(()=>void 0);throw new sW(t?.error??`Request to ${e} failed: ${n.status} ${n.statusText}`,n.status,typeof t?.code==`string`?t.code:void 0)}if(n.status!==204)return n.json()}function uW(e){return lW(`/api/sessions`,{method:`POST`,body:JSON.stringify(e?{title:e}:{})})}function dW(e){return lW(`/api/sessions/${e}`)}function fW(){return lW(`/api/sessions`)}function pW(e,t){return lW(`/api/sessions/${e}/turns`,{method:`POST`,body:JSON.stringify({question:t})})}function mW(e,t){return`${oW()}/api/sessions/${e}/stream?turn=${encodeURIComponent(t)}`}function hW(e){return lW(`/api/context/impact/${encodeURIComponent(e)}`)}function gW(){return lW(`/api/context/overview`)}function _W(){return lW(`/api/context/files`)}function vW(){return lW(`/api/native-sessions`)}function yW(){return lW(`/api/native-sessions/readiness`)}function bW(e){return lW(`/api/native-sessions/${encodeURIComponent(e)}`)}function xW(e,t,n){let r=t instanceof AbortSignal?t:n,i=typeof t==`object`&&!(t instanceof AbortSignal)?t:{intent:`open_existing`};return lW(`/api/native-sessions`,{method:`POST`,body:JSON.stringify({purpose:e,...i}),signal:r})}function SW(e){return lW(`/api/native-sessions/${encodeURIComponent(e)}/recovery`)}function CW(e,t,n,r){return lW(`/api/native-sessions/${encodeURIComponent(e)}/recovery-action`,{method:`POST`,body:JSON.stringify({capability:t,expectedVersion:n,action:r})})}function wW(e,t){return lW(`/api/native-sessions/${encodeURIComponent(e)}/stop`,{method:`POST`,body:JSON.stringify({capability:t})})}function TW(e,t){return`${(oW()||window.location.origin).replace(/^http/,`ws`)}/api/native-sessions/${encodeURIComponent(e)}/attach?cap=${encodeURIComponent(t)}`}function EW(){return lW(`/api/context/enrichment`)}function DW(){return lW(`/api/eval/runs`)}function OW(e){return lW(`/api/eval/runs/${e}`)}function kW(e){return{key:e.id,sessionId:e.sessionId,name:e.name,kind:e.artifactKind,location:e.location,verified:e.verified,createdAt:e.createdAt,...e.published?{publish:e.published}:{},...e.nativeSessionId?{nativeSessionId:e.nativeSessionId}:{},...e.nativeSessionId?{source:{label:`Session`,href:`/sessions/${encodeURIComponent(e.nativeSessionId)}`}}:{}}}function AW(){return lW(`/api/artifacts`).then(e=>e.map(kW))}async function jW(e){try{return await lW(`/api/artifacts/${encodeURIComponent(e)}/content`)}catch{return{form:`unavailable`,reason:`unreadable`}}}function MW(e,t){if(t.form===`unavailable`)return e;switch(e.kind){case`dashboard`:case`chart`:return t.form===`envelope`?{...e,envelope:t.envelope}:e;case`report`:return{...e,preview:t.form===`envelope`?{kind:`envelope`,envelope:t.envelope}:{kind:`html`,html:t.text}}}}function NW(e){return Promise.all([lW(`/api/artifacts/${encodeURIComponent(e)}`).then(e=>kW(e)),jW(e)]).then(([e,t])=>MW(e,t))}function PW(e,t){return lW(`/api/sessions/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}/save`,{method:`POST`}).then(({savedAt:e})=>({savedAt:e}))}function FW(e,t){return lW(`/api/sessions/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}/unsave`,{method:`POST`}).then(({unsavedAt:e})=>({unsavedAt:e}))}function IW(e){return lW(`/api/artifacts/${encodeURIComponent(e)}/unsave`,{method:`POST`})}function LW(e,t,n=`workspace`){return lW(`/api/sessions/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}/publish`,{method:`POST`,body:JSON.stringify({scope:n})}).then(({link:e,scope:t})=>({link:e,scope:t}))}function RW(){return lW(`/api/setup/steps`)}function zW(){return lW(`/api/config/runtime`)}function BW(){return lW(`/api/config/runtime/readiness`)}function VW(){return lW(`/api/config/runtime/tiers`)}function HW(e){return lW(`/api/config/runtime`,{method:`PUT`,body:JSON.stringify(e)})}function UW(){return lW(`/api/config/env-detect`)}function WW(){return lW(`/api/config/subscription-detect`)}function GW(e,t=!1){return lW(`/api/config/subscription-models?provider=${encodeURIComponent(e)}&refresh=${t?`1`:`0`}`)}function KW(){return lW(`/api/setup/mode`)}function qW(){return lW(`/api/setup/recovery`)}function JW(e){return lW(`/api/setup/mode`,{method:`POST`,body:JSON.stringify({mode:e})})}var YW=class extends Error{sessionId;decision;constructor(e,t,n){super(n??t.detail??`Setup requires a decision.`),this.name=`SetupDecisionRequiredError`,this.sessionId=e,this.decision=t}};function XW(e,t,n){return fetch(`${oW()}/api/setup/connect`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({projectName:e,sourceType:t,...n?{variant:n}:{}})}).then(async e=>{let t=await e.json().catch(()=>void 0);if(e.status===409&&t?.status===`needs_decision`&&t.decision)throw new YW(t.sessionId??``,t.decision,t?.error);if(!e.ok)throw Error(t?.error??`Request to /api/setup/connect failed: ${e.status} ${e.statusText}`);return t})}function ZW(){return lW(`/api/setup/connect/resume`,{method:`POST`,body:JSON.stringify({})})}function QW(){return lW(`/api/setup/source-catalog`)}function $W(){return lW(`/api/setup/connect/env-fields`)}function eG(e){return lW(`/api/setup/connect/env`,{method:`POST`,body:JSON.stringify({values:e})})}function tG(){return lW(`/api/setup/context`,{method:`POST`,body:JSON.stringify({})})}function nG(e,t){return fetch(`${oW()}/api/setup/adopt`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t?{projectPath:e,profile:t}:{projectPath:e})}).then(async e=>{let t=await e.json().catch(()=>void 0);if(e.status===409&&t?.status===`needs_decision`)return t;if(!e.ok)throw Error(t?.error??`Request to /api/setup/adopt failed: ${e.status} ${e.statusText}`);return t})}function rG(e,t){return lW(`/api/setup/decision`,{method:`POST`,body:JSON.stringify({sessionId:e,choiceId:t})})}function iG(){return lW(`/api/setup/compile-bind`,{method:`POST`})}function aG(){return lW(`/api/setup/reset`,{method:`POST`})}function oG(e){let t=e.steps.map(e=>({name:e.name,tier:e.tier,consumes:e.consumes,produces:e.produces,realization:e.realization,...e.guard===void 0?{}:{guard:e.guard},...e.foldInto===void 0?{}:{foldInto:e.foldInto},...e.maxAttempts===void 0?{}:{maxAttempts:e.maxAttempts}}));return{id:e.id,name:e.name,componentType:e.componentType,realizationKind:e.realizationKind,realizationLabel:iW(e.realizationKind,t,e.trigger),trigger:e.trigger,outcome:e.outcome,callableAs:e.callableAs,model:e.model,tiers:e.tiers,capabilities:e.capabilities.map(e=>({capability:e.capability,outcome:e.outcome,providedBy:e.providedBy,...e.criticality===void 0?{}:{criticality:e.criticality}})),guardrails:e.guardrails.map(e=>({name:e.name,enforcement:e.enforcement,locked:e.locked,...e.threshold===void 0?{}:{threshold:e.threshold}})),tools:e.tools,outputBlocks:e.outputBlocks,steps:t,status:e.status,...e.unavailableReason===void 0?{}:{unavailableReason:e.unavailableReason},...e.nativeAvailability===void 0?{}:{nativeAvailability:e.nativeAvailability}}}function sG(e,t){let n=new Map;for(let e of t)for(let t of e.capabilities)n.has(t.capability)||n.set(t.capability,t);let r=e.runtime.tierModels.find(e=>e.tier===`strong`)?.model??e.runtime.tierModels[0]?.model??``;return{name:e.profile.name,role:`orchestrator`,tierModel:r,capabilities:Array.from(n.values()),status:e.profile.status}}function cG(e){return lW(`/api/harness?purpose=${encodeURIComponent(e)}`).then(e=>{let t=e.components.map(oG);return{purpose:e.purpose,profile:{id:e.profile.id,name:e.profile.name,boundContext:e.profile.boundContext,verifyGate:e.profile.verifyGate,bundleId:e.profile.bundleId,bundleVersion:e.profile.bundleVersion,irVersion:e.profile.irVersion,dispatchTarget:e.profile.dispatchTarget,bundleHash:e.profile.bundleHash,status:e.profile.status},runtime:{backend:e.runtime.backend,label:e.runtime.label,tierModels:e.runtime.tierModels,...e.runtime.dispatcher===void 0?{}:{dispatcher:e.runtime.dispatcher}},connection:e.connection,components:t,agentProfiles:[sG(e,t)],nativeSessions:e.nativeSessions}})}var lG=`wren-genbi-native-session-capability:`,uG=`wren-genbi-native-session-recovery-capability:`,dG=`wren-genbi-native-session-return-source:`;function fG(){try{return typeof window>`u`?void 0:window.sessionStorage}catch{return}}function pG(e){return fG()?.getItem(`${lG}${e}`)??void 0}function mG(e,t){fG()?.setItem(`${lG}${e}`,t)}function hG(e){fG()?.removeItem(`${lG}${e}`)}function gG(e){return fG()?.getItem(`${uG}${e}`)??void 0}function _G(e,t){fG()?.setItem(`${uG}${e}`,t)}function vG(e){fG()?.removeItem(`${uG}${e}`)}function yG(e){let t=fG()?.getItem(`${dG}${e}`);return t===`setup`||t===`context`?t:void 0}function bG(e,t){fG()?.setItem(`${dG}${e}`,t)}function xG(e){fG()?.removeItem(`${dG}${e}`)}var SG=Object.defineProperty,CG=Object.getOwnPropertyDescriptor,wG=(e,t)=>{for(var n in t)SG(e,n,{get:t[n],enumerable:!0})},TG=(e,t,n,r)=>{for(var i=r>1?void 0:r?CG(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&SG(t,n,i),i},EG=(e,t)=>(n,r)=>t(n,r,e),DG=`Terminal input`,OG={get:()=>DG,set:e=>DG=e},kG=`Too much output to announce, navigate to rows manually to read`,AG={get:()=>kG,set:e=>kG=e};function jG(e){return e.replace(/\r?\n/g,`\r`)}function MG(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function NG(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function PG(e,t,n,r){e.stopPropagation(),e.clipboardData&&FG(e.clipboardData.getData(`text/plain`),t,n,r)}function FG(e,t,n,r){e=jG(e),e=MG(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function IG(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function LG(e,t,n,r,i){IG(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function RG(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function zG(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var BG=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},VG=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},HG=``,UG=` `,WG=class e{constructor(){this.fg=0,this.bg=0,this.extended=new GG}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},GG=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},KG=class e extends WG{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new GG,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?RG(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},qG=`di$target`,JG=`di$dependencies`,YG=new Map;function XG(e){return e[JG]||[]}function ZG(e){if(YG.has(e))return YG.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);QG(t,e,r)};return t._id=e,YG.set(e,t),t}function QG(e,t,n){t[qG]===t?t[JG].push({id:e,index:n}):(t[JG]=[{id:e,index:n}],t[qG]=t)}var $G=ZG(`BufferService`),eK=ZG(`CoreMouseService`),tK=ZG(`CoreService`),nK=ZG(`CharsetService`),rK=ZG(`InstantiationService`),iK=ZG(`LogService`),aK=ZG(`OptionsService`),oK=ZG(`OscLinkService`),sK=ZG(`UnicodeService`),cK=ZG(`DecorationService`),lK=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new KG,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):uK(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};lK=TG([EG(0,$G),EG(1,aK),EG(2,oK)],lK);function uK(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
340
|
+
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=gB(),d;if(t){let e=typeof t==`string`?nz(t):t;XR(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):az(e,{pathname:p});ZR(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),ZR(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=NB(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:Nz([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:Nz([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?v.createElement(oB.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function DB(){let e=BB(),t=zz(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=v.createElement(v.Fragment,null,v.createElement(`p`,null,`💿 Hey developer 👋`),v.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,v.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,v.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),v.createElement(v.Fragment,null,v.createElement(`h2`,null,`Unexpected Application Error!`),v.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?v.createElement(`pre`,{style:i},n):null,o)}var OB=v.createElement(DB,null),kB=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=pB(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:v.createElement(sB.Provider,{value:this.props.routeContext},v.createElement(cB.Provider,{value:e,children:this.props.component}));return this.context?v.createElement(jB,{error:e},t):t}};kB.contextType=eB;var AB=new WeakMap;function jB({children:e,error:t}){let{basename:n,navigator:r}=v.useContext(aB);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=fB(t.digest);if(e){let i=AB.get(t);if(i)throw i;let a=Hz(e.location,n),o=a.absoluteURL||a.to;if(qz(e.location,o,Wz(r),`allow-explicit`),Zz(o))throw Error(`Invalid redirect location`);if(Vz&&!AB.get(t)){if(a.isExternal||e.reloadDocument)window.location.href=o;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw AB.set(t,n),n}}return v.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function MB({routeContext:e,match:t,children:n}){let r=v.useContext(Qz);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(sB.Provider,{value:e},n)}function NB(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);XR(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Bz(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||OB,o&&(s<0&&c===0?(UB(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?v.createElement(n.route.Component,null):n.route.element?n.route.element:e,v.createElement(MB,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?v.createElement(kB,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function PB(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function FB(e){let t=v.useContext(Qz);return XR(t,PB(e)),t}function IB(e){let t=v.useContext($z);return XR(t,PB(e)),t}function LB(e){let t=v.useContext(sB);return XR(t,PB(e)),t}function RB(e){let t=LB(e),n=t.matches[t.matches.length-1];return XR(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function zB(){return RB(`useRouteId`)}function BB(){let e=v.useContext(cB),t=IB(`useRouteError`),n=RB(`useRouteError`);return e===void 0?t.errors?.[n]:e}function VB(){let{router:e}=FB(`useNavigate`),t=RB(`useNavigate`),n=v.useRef(!1);return vB(()=>{n.current=!0}),v.useCallback(async(r,i={})=>{ZR(n.current,_B),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var HB={};function UB(e,t,n){!t&&!HB[e]&&(HB[e]=!0,ZR(!1,n))}v.memo(WB);function WB({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return EB(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function GB({to:e,replace:t,state:n,relative:r}){XR(hB(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i,navigator:a}=v.useContext(aB);ZR(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:o}=v.useContext(sB),{pathname:s}=gB(),c=yB(),l=jz(e,Az(o),s,r===`path`);qz(typeof e==`string`?e:tz(e),a.createHref(l),Wz(a),`reject`);let u=JSON.stringify(l);return v.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:r})},[c,u,r,t,n]),null}function KB(e){return SB(e.context)}function qB(e){XR(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function JB({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){XR(!hB(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=v.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=nz(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=v.useMemo(()=>{let e=Tz(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return ZR(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:v.createElement(aB.Provider,{value:c},v.createElement(oB.Provider,{children:t,value:h}))}function YB({children:e,location:t}){return TB(XB(e),t)}v.Component;function XB(e,t=[]){let n=[];return v.Children.forEach(e,(e,r)=>{if(!v.isValidElement(e))return;let i=[...t,r];if(e.type===v.Fragment){n.push.apply(n,XB(e.props.children,i));return}XR(e.type===qB,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),XR(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=XB(e.props.children,i)),n.push(a)}),n}var ZB=`get`,QB=`application/x-www-form-urlencoded`;function $B(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function eV(e){return $B(e)&&e.tagName.toLowerCase()===`button`}function tV(e){return $B(e)&&e.tagName.toLowerCase()===`form`}function nV(e){return $B(e)&&e.tagName.toLowerCase()===`input`}function rV(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function iV(e,t){return e.button===0&&(!t||t===`_self`)&&!rV(e)}var aV=null;function oV(){if(aV===null)try{new FormData(document.createElement(`form`),0),aV=!1}catch{aV=!0}return aV}var sV=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function cV(e){return e!=null&&!sV.has(e)?(ZR(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${QB}"`),null):e}function lV(e,t){let n,r,i,a,o;if(tV(e)){let o=e.getAttribute(`action`);r=o?Tz(o,t):null,n=e.getAttribute(`method`)||ZB,i=cV(e.getAttribute(`enctype`))||QB,a=new FormData(e)}else if(eV(e)||nV(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?Tz(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||ZB,i=cV(e.getAttribute(`formenctype`))||cV(o.getAttribute(`enctype`))||QB,a=new FormData(o,e),!oV()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if($B(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=ZB,r=null,i=QB,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function uV(e,t){if(e===!1||e==null)throw Error(t)}function dV(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return i.pathname=n?i.pathname.endsWith(`/`)?`${i.pathname}_.${r}`:`${i.pathname}.${r}`:i.pathname===`/`?`_root.${r}`:t&&Tz(i.pathname,t)===`/`?`${Pz(t)}/_root.${r}`:`${Pz(i.pathname)}.${r}`,i}async function fV(e,t){if(e.id in t)return t[e.id];try{let n=await UR(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function pV(e){return e!=null&&typeof e.page==`string`}function mV(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function hV(e,t,n){return bV((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await fV(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(mV).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function gV(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function _V(e,t,{includeHydrateFallback:n}={}){return vV(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function vV(e){return[...new Set(e)]}function yV(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function bV(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!pV(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(yV(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function xV(){let e=v.useContext(Qz);return uV(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function SV(){let e=v.useContext($z);return uV(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var CV=v.createContext(void 0);CV.displayName=`FrameworkContext`;function wV(){let e=v.useContext(CV);return uV(e,`You must render this element inside a <HydratedRouter> element`),e}function TV(e,t){let n=v.useContext(CV),[r,i]=v.useState(!1),[a,o]=v.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=v.useRef(null);v.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),v.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:EV(s,p),onBlur:EV(c,m),onMouseEnter:EV(l,p),onMouseLeave:EV(u,m),onTouchStart:EV(d,p)}]:[a,f,{}]:[!1,f,{}]}function EV(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function DV({page:e,...t}){let n=tB(),{nonce:r}=wV(),{router:i}=xV(),a=v.useMemo(()=>az(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?v.createElement(kV,{page:e,matches:a,...t}):v.createElement(AV,{page:e,matches:a,...t})):null}function OV(e){let{manifest:t,routeModules:n}=wV(),[r,i]=v.useState([]);return v.useEffect(()=>{let r=!1;return hV(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function kV({page:e,matches:t,...n}){let r=gB(),{future:i}=wV(),{basename:a}=xV(),o=v.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=dV(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return v.createElement(v.Fragment,null,o.map(e=>v.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function AV({page:e,matches:t,...n}){let r=gB(),{future:i,manifest:a,routeModules:o}=wV(),{basename:s}=xV(),{loaderData:c,matches:l}=SV(),u=v.useMemo(()=>gV(e,t,l,a,r,`data`),[e,t,l,a,r]),d=v.useMemo(()=>gV(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=v.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=dV(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=v.useMemo(()=>_V(d,a),[d,a]),m=OV(d);return v.createElement(v.Fragment,null,f.map(e=>v.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>v.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>v.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function jV(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}v.Component;var MV=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{MV&&(window.__reactRouterVersion=`7.18.3`)}catch{}function NV({basename:e,children:t,useTransitions:n,window:r}){let i=v.useRef();i.current??=YR({window:r,v5Compat:!0});let a=i.current,[o,s]=v.useState({action:a.action,location:a.location}),c=v.useCallback(e=>{n===!1?s(e):v.startTransition(()=>s(e))},[n]);return v.useLayoutEffect(()=>a.listen(c),[a,c]),v.createElement(JB,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}var PV=v.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=v.useContext(aB),y=typeof l==`string`&&WR.test(l),b=Hz(l,h);l=b.to;let x=mB(l,{relative:r}),S=gB(),C=null;if(o){let e=jz(o,[],S.mask?S.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:Nz([h,e.pathname])),C=g.createHref(e)}let[w,T,E]=TV(n,p),D=zV(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function O(t){e&&e(t),t.defaultPrevented||D(t)}let k=!(b.isExternal||i),A=v.createElement(`a`,{...p,...E,href:(k?C:void 0)||b.absoluteURL||x,onClick:k?O:e,ref:jV(m,T),target:c,"data-discover":!y&&t===`render`?`true`:void 0});return w&&!y?v.createElement(v.Fragment,null,A,v.createElement(DV,{page:x})):A});PV.displayName=`Link`;var FV=v.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=wB(a,{relative:c.relative}),d=gB(),f=v.useContext($z),{navigator:p,basename:m}=v.useContext(aB),h=f!=null&&WV(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,y=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),y=y?y.toLowerCase():null,g=g.toLowerCase()),y&&m&&(y=Tz(y,m)||y);let b=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,x=_===g||!r&&_.startsWith(g)&&_.charAt(b)===`/`,S=y!=null&&(y===g||!r&&y.startsWith(g)&&y.charAt(g.length)===`/`),C={isActive:x,isPending:S,isTransitioning:h},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return v.createElement(PV,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});FV.displayName=`NavLink`;var IV=v.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=ZB,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=v.useContext(aB),g=HV(),_=UV(s,{relative:l}),y=o.toLowerCase()===`get`?`get`:`post`,b=typeof s==`string`&&WR.test(s);return v.createElement(`form`,{ref:m,method:y,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?v.startTransition(()=>p()):p()},...p,"data-discover":!b&&e===`render`?`true`:void 0})});IV.displayName=`Form`;function LV(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function RV(e){let t=v.useContext(Qz);return XR(t,LV(e)),t}function zV(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=yB(),d=gB(),f=wB(e,{relative:o});return v.useCallback(p=>{if(iV(p,t)){p.preventDefault();let t=n===void 0?tz(d)===tz(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?v.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}var BV=0,VV=()=>`__${String(++BV)}__`;function HV(){let{router:e}=RV(`useSubmit`),{basename:t}=v.useContext(aB),n=zB(),r=e.fetch,i=e.navigate;return v.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=lV(e,t);if(a.navigate===!1){let e=a.fetcherKey||VV();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function UV(e,{relative:t}={}){let{basename:n}=v.useContext(aB),r=v.useContext(sB);XR(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...wB(e||`.`,{relative:t})},o=gB();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:Nz([n,a.pathname])),tz(a)}function WV(e,{relative:t}={}){let n=v.useContext(nB);XR(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=RV(`useViewTransitionState`),i=wB(e,{relative:t});if(!n.isTransitioning)return!1;let a=Tz(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Tz(n.nextLocation.pathname,r)||n.nextLocation.pathname;return xz(i.pathname,o)!=null||xz(i.pathname,a)!=null}var GV={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M908 640H804V488c0-4.4-3.6-8-8-8H548v-96h108c8.8 0 16-7.2 16-16V80c0-8.8-7.2-16-16-16H368c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h108v96H228c-4.4 0-8 3.6-8 8v152H116c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h288c8.8 0 16-7.2 16-16V656c0-8.8-7.2-16-16-16H292v-88h440v88H620c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h288c8.8 0 16-7.2 16-16V656c0-8.8-7.2-16-16-16zm-564 76v168H176V716h168zm84-408V140h168v168H428zm420 576H680V716h168v168z`}}]},name:`apartment`,theme:`outlined`};function KV(){return KV=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},KV.apply(this,arguments)}var qV=v.forwardRef((e,t)=>v.createElement(Cs,KV({},e,{ref:t,icon:GV}))),JV={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M917.7 148.8l-42.4-42.4c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-76.1 76.1a199.27 199.27 0 00-112.1-34.3c-51.2 0-102.4 19.5-141.5 58.6L432.3 308.7a8.03 8.03 0 000 11.3L704 591.7c1.6 1.6 3.6 2.3 5.7 2.3 2 0 4.1-.8 5.7-2.3l101.9-101.9c68.9-69 77-175.7 24.3-253.5l76.1-76.1c3.1-3.2 3.1-8.3 0-11.4zM769.1 441.7l-59.4 59.4-186.8-186.8 59.4-59.4c24.9-24.9 58.1-38.7 93.4-38.7 35.3 0 68.4 13.7 93.4 38.7 24.9 24.9 38.7 58.1 38.7 93.4 0 35.3-13.8 68.4-38.7 93.4zm-190.2 105a8.03 8.03 0 00-11.3 0L501 613.3 410.7 523l66.7-66.7c3.1-3.1 3.1-8.2 0-11.3L441 408.6a8.03 8.03 0 00-11.3 0L363 475.3l-43-43a7.85 7.85 0 00-5.7-2.3c-2 0-4.1.8-5.7 2.3L206.8 534.2c-68.9 69-77 175.7-24.3 253.5l-76.1 76.1a8.03 8.03 0 000 11.3l42.4 42.4c1.6 1.6 3.6 2.3 5.7 2.3s4.1-.8 5.7-2.3l76.1-76.1c33.7 22.9 72.9 34.3 112.1 34.3 51.2 0 102.4-19.5 141.5-58.6l101.9-101.9c3.1-3.1 3.1-8.2 0-11.3l-43-43 66.7-66.7c3.1-3.1 3.1-8.2 0-11.3l-36.6-36.2zM441.7 769.1a131.32 131.32 0 01-93.4 38.7c-35.3 0-68.4-13.7-93.4-38.7a131.32 131.32 0 01-38.7-93.4c0-35.3 13.7-68.4 38.7-93.4l59.4-59.4 186.8 186.8-59.4 59.4z`}}]},name:`api`,theme:`outlined`};function YV(){return YV=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},YV.apply(this,arguments)}var XV=v.forwardRef((e,t)=>v.createElement(Cs,YV({},e,{ref:t,icon:JV}))),ZV={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H212V212h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H612V212h200v200zM464 544H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H212V612h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H612V612h200v200z`}}]},name:`appstore`,theme:`outlined`};function QV(){return QV=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},QV.apply(this,arguments)}var $V=v.forwardRef((e,t)=>v.createElement(Cs,QV({},e,{ref:t,icon:ZV}))),eH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z`}}]},name:`arrow-left`,theme:`outlined`};function tH(){return tH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},tH.apply(this,arguments)}var nH=v.forwardRef((e,t)=>v.createElement(Cs,tH({},e,{ref:t,icon:eH}))),rH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M869 487.8L491.2 159.9c-2.9-2.5-6.6-3.9-10.5-3.9h-88.5c-7.4 0-10.8 9.2-5.2 14l350.2 304H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h585.1L386.9 854c-5.6 4.9-2.2 14 5.2 14h91.5c1.9 0 3.8-.7 5.2-2L869 536.2a32.07 32.07 0 000-48.4z`}}]},name:`arrow-right`,theme:`outlined`};function iH(){return iH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},iH.apply(this,arguments)}var aH=v.forwardRef((e,t)=>v.createElement(Cs,iH({},e,{ref:t,icon:rH}))),oH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-600-80h56c4.4 0 8-3.6 8-8V560c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v144c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V384c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v320c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V462c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v242c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V304c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v400c0 4.4 3.6 8 8 8z`}}]},name:`bar-chart`,theme:`outlined`};function sH(){return sH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},sH.apply(this,arguments)}var cH=v.forwardRef((e,t)=>v.createElement(Cs,sH({},e,{ref:t,icon:oH}))),lH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-260 72h96v209.9L621.5 312 572 347.4V136zm220 752H232V136h280v296.9c0 3.3 1 6.6 3 9.3a15.9 15.9 0 0022.3 3.7l83.8-59.9 81.4 59.4c2.7 2 6 3.1 9.4 3.1 8.8 0 16-7.2 16-16V136h64v752z`}}]},name:`book`,theme:`outlined`};function uH(){return uH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},uH.apply(this,arguments)}var dH=v.forwardRef((e,t)=>v.createElement(Cs,uH({},e,{ref:t,icon:lH}))),fH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M348 676.1C250 619.4 184 513.4 184 392c0-181.1 146.9-328 328-328s328 146.9 328 328c0 121.4-66 227.4-164 284.1V792c0 17.7-14.3 32-32 32H380c-17.7 0-32-14.3-32-32V676.1zM392 888h240c4.4 0 8 3.6 8 8v32c0 17.7-14.3 32-32 32H416c-17.7 0-32-14.3-32-32v-32c0-4.4 3.6-8 8-8z`}}]},name:`bulb`,theme:`filled`};function pH(){return pH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pH.apply(this,arguments)}var mH=v.forwardRef((e,t)=>v.createElement(Cs,pH({},e,{ref:t,icon:fH}))),hH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M632 888H392c-4.4 0-8 3.6-8 8v32c0 17.7 14.3 32 32 32h192c17.7 0 32-14.3 32-32v-32c0-4.4-3.6-8-8-8zM512 64c-181.1 0-328 146.9-328 328 0 121.4 66 227.4 164 284.1V792c0 17.7 14.3 32 32 32h264c17.7 0 32-14.3 32-32V676.1c98-56.7 164-162.7 164-284.1 0-181.1-146.9-328-328-328zm127.9 549.8L604 634.6V752H420V634.6l-35.9-20.8C305.4 568.3 256 484.5 256 392c0-141.4 114.6-256 256-256s256 114.6 256 256c0 92.5-49.4 176.3-128.1 221.8z`}}]},name:`bulb`,theme:`outlined`};function gH(){return gH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gH.apply(this,arguments)}var _H=v.forwardRef((e,t)=>v.createElement(Cs,gH({},e,{ref:t,icon:hH}))),vH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z`}},{tag:`path`,attrs:{d:`M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z`}}]},name:`check-circle`,theme:`outlined`};function yH(){return yH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},yH.apply(this,arguments)}var bH=v.forwardRef((e,t)=>v.createElement(Cs,yH({},e,{ref:t,icon:vH}))),xH={icon:{tag:`svg`,attrs:{"fill-rule":`evenodd`,viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm0 76c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm128.01 198.83c.03 0 .05.01.09.06l45.02 45.01a.2.2 0 01.05.09.12.12 0 010 .07c0 .02-.01.04-.05.08L557.25 512l127.87 127.86a.27.27 0 01.05.06v.02a.12.12 0 010 .07c0 .03-.01.05-.05.09l-45.02 45.02a.2.2 0 01-.09.05.12.12 0 01-.07 0c-.02 0-.04-.01-.08-.05L512 557.25 384.14 685.12c-.04.04-.06.05-.08.05a.12.12 0 01-.07 0c-.03 0-.05-.01-.09-.05l-45.02-45.02a.2.2 0 01-.05-.09.12.12 0 010-.07c0-.02.01-.04.06-.08L466.75 512 338.88 384.14a.27.27 0 01-.05-.06l-.01-.02a.12.12 0 010-.07c0-.03.01-.05.05-.09l45.02-45.02a.2.2 0 01.09-.05.12.12 0 01.07 0c.02 0 .04.01.08.06L512 466.75l127.86-127.86c.04-.05.06-.06.08-.06a.12.12 0 01.07 0z`}}]},name:`close-circle`,theme:`outlined`};function SH(){return SH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},SH.apply(this,arguments)}var CH=v.forwardRef((e,t)=>v.createElement(Cs,SH({},e,{ref:t,icon:xH}))),wH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M518.3 459a8 8 0 00-12.6 0l-112 141.7a7.98 7.98 0 006.3 12.9h73.9V856c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V613.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 459z`}},{tag:`path`,attrs:{d:`M811.4 366.7C765.6 245.9 648.9 160 512.2 160S258.8 245.8 213 366.6C127.3 389.1 64 467.2 64 560c0 110.5 89.5 200 199.9 200H304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8h-40.1c-33.7 0-65.4-13.4-89-37.7-23.5-24.2-36-56.8-34.9-90.6.9-26.4 9.9-51.2 26.2-72.1 16.7-21.3 40.1-36.8 66.1-43.7l37.9-9.9 13.9-36.6c8.6-22.8 20.6-44.1 35.7-63.4a245.6 245.6 0 0152.4-49.9c41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.2c19.9 14 37.5 30.8 52.4 49.9 15.1 19.3 27.1 40.7 35.7 63.4l13.8 36.5 37.8 10C846.1 454.5 884 503.8 884 560c0 33.1-12.9 64.3-36.3 87.7a123.07 123.07 0 01-87.6 36.3H720c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h40.1C870.5 760 960 670.5 960 560c0-92.7-63.1-170.7-148.6-193.3z`}}]},name:`cloud-upload`,theme:`outlined`};function TH(){return TH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},TH.apply(this,arguments)}var EH=v.forwardRef((e,t)=>v.createElement(Cs,TH({},e,{ref:t,icon:wH}))),DH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M516 673c0 4.4 3.4 8 7.5 8h185c4.1 0 7.5-3.6 7.5-8v-48c0-4.4-3.4-8-7.5-8h-185c-4.1 0-7.5 3.6-7.5 8v48zm-194.9 6.1l192-161c3.8-3.2 3.8-9.1 0-12.3l-192-160.9A7.95 7.95 0 00308 351v62.7c0 2.4 1 4.6 2.9 6.1L420.7 512l-109.8 92.2a8.1 8.1 0 00-2.9 6.1V673c0 6.8 7.9 10.5 13.1 6.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z`}}]},name:`code`,theme:`outlined`};function OH(){return OH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},OH.apply(this,arguments)}var kH=v.forwardRef((e,t)=>v.createElement(Cs,OH({},e,{ref:t,icon:DH}))),AH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M301.3 496.7c-23.8 0-40.2-10.5-41.6-26.9H205c.9 43.4 36.9 70.3 93.9 70.3 59.1 0 95-28.4 95-75.5 0-35.8-20-55.9-64.5-64.5l-29.1-5.6c-23.8-4.7-33.8-11.9-33.8-24.2 0-15 13.3-24.5 33.4-24.5 20.1 0 35.3 11.1 36.6 27h53c-.9-41.7-37.5-70.3-90.3-70.3-54.4 0-89.7 28.9-89.7 73 0 35.5 21.2 58 62.5 65.8l29.7 5.9c25.8 5.2 35.6 11.9 35.6 24.4.1 14.7-14.5 25.1-36 25.1z`}},{tag:`path`,attrs:{d:`M928 140H96c-17.7 0-32 14.3-32 32v496c0 17.7 14.3 32 32 32h380v112H304c-8.8 0-16 7.2-16 16v48c0 4.4 3.6 8 8 8h432c4.4 0 8-3.6 8-8v-48c0-8.8-7.2-16-16-16H548V700h380c17.7 0 32-14.3 32-32V172c0-17.7-14.3-32-32-32zm-40 488H136V212h752v416z`}},{tag:`path`,attrs:{d:`M828.5 486.7h-95.8V308.5h-57.4V534h153.2zm-298.6 53.4c14.1 0 27.2-2 39.1-5.8l13.3 20.3h53.3L607.9 511c21.1-20 33-51.1 33-89.8 0-73.3-43.3-118.8-110.9-118.8s-111.2 45.3-111.2 118.8c-.1 73.7 43 118.9 111.1 118.9zm0-190c31.6 0 52.7 27.7 52.7 71.1 0 16.7-3.6 30.6-10 40.5l-5.2-6.9h-48.8L542 491c-3.9.9-8 1.4-12.2 1.4-31.7 0-52.8-27.5-52.8-71.2.1-43.6 21.2-71.1 52.9-71.1z`}}]},name:`console-sql`,theme:`outlined`};function jH(){return jH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jH.apply(this,arguments)}var MH=v.forwardRef((e,t)=>v.createElement(Cs,jH({},e,{ref:t,icon:AH}))),NH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-600 72h560v208H232V136zm560 480H232V408h560v208zm0 272H232V680h560v208zM304 240a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0z`}}]},name:`database`,theme:`outlined`};function PH(){return PH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},PH.apply(this,arguments)}var FH=v.forwardRef((e,t)=>v.createElement(Cs,PH({},e,{ref:t,icon:NH}))),IH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M888.3 693.2c-42.5-24.6-94.3-18-129.2 12.8l-53-30.7V523.6c0-15.7-8.4-30.3-22-38.1l-136-78.3v-67.1c44.2-15 76-56.8 76-106.1 0-61.9-50.1-112-112-112s-112 50.1-112 112c0 49.3 31.8 91.1 76 106.1v67.1l-136 78.3c-13.6 7.8-22 22.4-22 38.1v151.6l-53 30.7c-34.9-30.8-86.8-37.4-129.2-12.8-53.5 31-71.7 99.4-41 152.9 30.8 53.5 98.9 71.9 152.2 41 42.5-24.6 62.7-73 53.6-118.8l48.7-28.3 140.6 81c6.8 3.9 14.4 5.9 22 5.9s15.2-2 22-5.9L674.5 740l48.7 28.3c-9.1 45.7 11.2 94.2 53.6 118.8 53.3 30.9 121.5 12.6 152.2-41 30.8-53.6 12.6-122-40.7-152.9zm-673 138.4a47.6 47.6 0 01-65.2-17.6c-13.2-22.9-5.4-52.3 17.5-65.5a47.6 47.6 0 0165.2 17.6c13.2 22.9 5.4 52.3-17.5 65.5zM522 463.8zM464 234a48.01 48.01 0 0196 0 48.01 48.01 0 01-96 0zm170 446.2l-122 70.3-122-70.3V539.8l122-70.3 122 70.3v140.4zm239.9 133.9c-13.2 22.9-42.4 30.8-65.2 17.6-22.8-13.2-30.7-42.6-17.5-65.5s42.4-30.8 65.2-17.6c22.9 13.2 30.7 42.5 17.5 65.5z`}}]},name:`deployment-unit`,theme:`outlined`};function LH(){return LH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},LH.apply(this,arguments)}var RH=v.forwardRef((e,t)=>v.createElement(Cs,LH({},e,{ref:t,icon:IH}))),zH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z`}},{tag:`path`,attrs:{d:`M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z`}}]},name:`exclamation-circle`,theme:`outlined`};function BH(){return BH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},BH.apply(this,arguments)}var VH=v.forwardRef((e,t)=>v.createElement(Cs,BH({},e,{ref:t,icon:zH}))),HH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M512 472a40 40 0 1080 0 40 40 0 10-80 0zm367 352.9L696.3 352V178H768v-68H256v68h71.7v174L145 824.9c-2.8 7.4-4.3 15.2-4.3 23.1 0 35.3 28.7 64 64 64h614.6c7.9 0 15.7-1.5 23.1-4.3 33-12.7 49.4-49.8 36.6-82.8zM395.7 364.7V180h232.6v184.7L719.2 600c-20.7-5.3-42.1-8-63.9-8-61.2 0-119.2 21.5-165.3 60a188.78 188.78 0 01-121.3 43.9c-32.7 0-64.1-8.3-91.8-23.7l118.8-307.5zM210.5 844l41.7-107.8c35.7 18.1 75.4 27.8 116.6 27.8 61.2 0 119.2-21.5 165.3-60 33.9-28.2 76.3-43.9 121.3-43.9 35 0 68.4 9.5 97.6 27.1L813.5 844h-603z`}}]},name:`experiment`,theme:`outlined`};function UH(){return UH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},UH.apply(this,arguments)}var WH=v.forwardRef((e,t)=>v.createElement(Cs,UH({},e,{ref:t,icon:HH}))),GH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M688 312v-48c0-4.4-3.6-8-8-8H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8zm-392 88c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H296zm144 452H208V148h560v344c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V108c0-17.7-14.3-32-32-32H168c-17.7 0-32 14.3-32 32v784c0 17.7 14.3 32 32 32h272c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm445.7 51.5l-93.3-93.3C814.7 780.7 828 743.9 828 704c0-97.2-78.8-176-176-176s-176 78.8-176 176 78.8 176 176 176c35.8 0 69-10.7 96.8-29l94.7 94.7c1.6 1.6 3.6 2.3 5.6 2.3s4.1-.8 5.6-2.3l31-31a7.9 7.9 0 000-11.2zM652 816c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z`}}]},name:`file-search`,theme:`outlined`};function KH(){return KH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},KH.apply(this,arguments)}var qH=v.forwardRef((e,t)=>v.createElement(Cs,KH({},e,{ref:t,icon:GH}))),JH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M841 370c3-3.3 2.7-8.3-.6-11.3a8.24 8.24 0 00-5.3-2.1h-72.6c-2.4 0-4.6 1-6.1 2.8L633.5 504.6a7.96 7.96 0 01-13.4-1.9l-63.5-141.3a7.9 7.9 0 00-7.3-4.7H380.7l.9-4.7 8-42.3c10.5-55.4 38-81.4 85.8-81.4 18.6 0 35.5 1.7 48.8 4.7l14.1-66.8c-22.6-4.7-35.2-6.1-54.9-6.1-103.3 0-156.4 44.3-175.9 147.3l-9.4 49.4h-97.6c-3.8 0-7.1 2.7-7.8 6.4L181.9 415a8.07 8.07 0 007.8 9.7H284l-89 429.9a8.07 8.07 0 007.8 9.7H269c3.8 0 7.1-2.7 7.8-6.4l89.7-433.1h135.8l68.2 139.1c1.4 2.9 1 6.4-1.2 8.8l-180.6 203c-2.9 3.3-2.6 8.4.7 11.3 1.5 1.3 3.4 2 5.3 2h72.7c2.4 0 4.6-1 6.1-2.8l123.7-146.7c2.8-3.4 7.9-3.8 11.3-1 .9.8 1.6 1.7 2.1 2.8L676.4 784c1.3 2.8 4.1 4.7 7.3 4.7h64.6a8.02 8.02 0 007.2-11.5l-95.2-198.9c-1.4-2.9-.9-6.4 1.3-8.8L841 370z`}}]},name:`function`,theme:`outlined`};function YH(){return YH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},YH.apply(this,arguments)}var XH=v.forwardRef((e,t)=>v.createElement(Cs,YH({},e,{ref:t,icon:JH}))),ZH={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z`}},{tag:`path`,attrs:{d:`M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z`}}]},name:`info-circle`,theme:`outlined`};function QH(){return QH=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},QH.apply(this,arguments)}var $H=v.forwardRef((e,t)=>v.createElement(Cs,QH({},e,{ref:t,icon:ZH}))),eU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM305.8 637.7c3.1 3.1 8.1 3.1 11.3 0l138.3-137.6L583 628.5c3.1 3.1 8.2 3.1 11.3 0l275.4-275.3c3.1-3.1 3.1-8.2 0-11.3l-39.6-39.6a8.03 8.03 0 00-11.3 0l-230 229.9L461.4 404a8.03 8.03 0 00-11.3 0L266.3 586.7a8.03 8.03 0 000 11.3l39.5 39.7z`}}]},name:`line-chart`,theme:`outlined`};function tU(){return tU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},tU.apply(this,arguments)}var nU=v.forwardRef((e,t)=>v.createElement(Cs,tU({},e,{ref:t,icon:eU}))),rU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 000 13.8z`}}]},name:`menu-fold`,theme:`outlined`};function iU(){return iU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},iU.apply(this,arguments)}var aU=v.forwardRef((e,t)=>v.createElement(Cs,iU({},e,{ref:t,icon:rU}))),oU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM142.4 642.1L298.7 519a8.84 8.84 0 000-13.9L142.4 381.9c-5.8-4.6-14.4-.5-14.4 6.9v246.3a8.9 8.9 0 0014.4 7z`}}]},name:`menu-unfold`,theme:`outlined`};function sU(){return sU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},sU.apply(this,arguments)}var cU=v.forwardRef((e,t)=>v.createElement(Cs,sU({},e,{ref:t,icon:oU}))),lU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M464 512a48 48 0 1096 0 48 48 0 10-96 0zm200 0a48 48 0 1096 0 48 48 0 10-96 0zm-400 0a48 48 0 1096 0 48 48 0 10-96 0zm661.2-173.6c-22.6-53.7-55-101.9-96.3-143.3a444.35 444.35 0 00-143.3-96.3C630.6 75.7 572.2 64 512 64h-2c-60.6.3-119.3 12.3-174.5 35.9a445.35 445.35 0 00-142 96.5c-40.9 41.3-73 89.3-95.2 142.8-23 55.4-34.6 114.3-34.3 174.9A449.4 449.4 0 00112 714v152a46 46 0 0046 46h152.1A449.4 449.4 0 00510 960h2.1c59.9 0 118-11.6 172.7-34.3a444.48 444.48 0 00142.8-95.2c41.3-40.9 73.8-88.7 96.5-142 23.6-55.2 35.6-113.9 35.9-174.5.3-60.9-11.5-120-34.8-175.6zm-151.1 438C704 845.8 611 884 512 884h-1.7c-60.3-.3-120.2-15.3-173.1-43.5l-8.4-4.5H188V695.2l-4.5-8.4C155.3 633.9 140.3 574 140 513.7c-.4-99.7 37.7-193.3 107.6-263.8 69.8-70.5 163.1-109.5 262.8-109.9h1.7c50 0 98.5 9.7 144.2 28.9 44.6 18.7 84.6 45.6 119 80 34.3 34.3 61.3 74.4 80 119 19.4 46.2 29.1 95.2 28.9 145.8-.6 99.6-39.7 192.9-110.1 262.7z`}}]},name:`message`,theme:`outlined`};function uU(){return uU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},uU.apply(this,arguments)}var dU=v.forwardRef((e,t)=>v.createElement(Cs,uU({},e,{ref:t,icon:lU}))),fU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M696 480H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z`}},{tag:`path`,attrs:{d:`M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z`}}]},name:`minus-circle`,theme:`outlined`};function pU(){return pU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pU.apply(this,arguments)}var mU=v.forwardRef((e,t)=>v.createElement(Cs,pU({},e,{ref:t,icon:fU}))),hU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M843.5 737.4c-12.4-75.2-79.2-129.1-155.3-125.4S550.9 676 546 752c-153.5-4.8-208-40.7-199.1-113.7 3.3-27.3 19.8-41.9 50.1-49 18.4-4.3 38.8-4.9 57.3-3.2 1.7.2 3.5.3 5.2.5 11.3 2.7 22.8 5 34.3 6.8 34.1 5.6 68.8 8.4 101.8 6.6 92.8-5 156-45.9 159.2-132.7 3.1-84.1-54.7-143.7-147.9-183.6-29.9-12.8-61.6-22.7-93.3-30.2-14.3-3.4-26.3-5.7-35.2-7.2-7.9-75.9-71.5-133.8-147.8-134.4-76.3-.6-140.9 56.1-150.1 131.9s40 146.3 114.2 163.9c74.2 17.6 149.9-23.3 175.7-95.1 9.4 1.7 18.7 3.6 28 5.8 28.2 6.6 56.4 15.4 82.4 26.6 70.7 30.2 109.3 70.1 107.5 119.9-1.6 44.6-33.6 65.2-96.2 68.6-27.5 1.5-57.6-.9-87.3-5.8-8.3-1.4-15.9-2.8-22.6-4.3-3.9-.8-6.6-1.5-7.8-1.8l-3.1-.6c-2.2-.3-5.9-.8-10.7-1.3-25-2.3-52.1-1.5-78.5 4.6-55.2 12.9-93.9 47.2-101.1 105.8-15.7 126.2 78.6 184.7 276 188.9 29.1 70.4 106.4 107.9 179.6 87 73.3-20.9 119.3-93.4 106.9-168.6zM329.1 345.2a83.3 83.3 0 11.01-166.61 83.3 83.3 0 01-.01 166.61zM695.6 845a83.3 83.3 0 11.01-166.61A83.3 83.3 0 01695.6 845z`}}]},name:`node-index`,theme:`outlined`};function gU(){return gU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gU.apply(this,arguments)}var _U=v.forwardRef((e,t)=>v.createElement(Cs,gU({},e,{ref:t,icon:hU}))),vU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M878.3 392.1L631.9 145.7c-6.5-6.5-15-9.7-23.5-9.7s-17 3.2-23.5 9.7L423.8 306.9c-12.2-1.4-24.5-2-36.8-2-73.2 0-146.4 24.1-206.5 72.3a33.23 33.23 0 00-2.7 49.4l181.7 181.7-215.4 215.2a15.8 15.8 0 00-4.6 9.8l-3.4 37.2c-.9 9.4 6.6 17.4 15.9 17.4.5 0 1 0 1.5-.1l37.2-3.4c3.7-.3 7.2-2 9.8-4.6l215.4-215.4 181.7 181.7c6.5 6.5 15 9.7 23.5 9.7 9.7 0 19.3-4.2 25.9-12.4 56.3-70.3 79.7-158.3 70.2-243.4l161.1-161.1c12.9-12.8 12.9-33.8 0-46.8zM666.2 549.3l-24.5 24.5 3.8 34.4a259.92 259.92 0 01-30.4 153.9L262 408.8c12.9-7.1 26.3-13.1 40.3-17.9 27.2-9.4 55.7-14.1 84.7-14.1 9.6 0 19.3.5 28.9 1.6l34.4 3.8 24.5-24.5L608.5 224 800 415.5 666.2 549.3z`}}]},name:`pushpin`,theme:`outlined`};function yU(){return yU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},yU.apply(this,arguments)}var bU=v.forwardRef((e,t)=>v.createElement(Cs,yU({},e,{ref:t,icon:vU}))),xU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M300 328a60 60 0 10120 0 60 60 0 10-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 10120 0 60 60 0 10-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z`}}]},name:`robot`,theme:`outlined`};function SU(){return SU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},SU.apply(this,arguments)}var CU=v.forwardRef((e,t)=>v.createElement(Cs,SU({},e,{ref:t,icon:xU}))),wU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M893.3 293.3L730.7 130.7c-7.5-7.5-16.7-13-26.7-16V112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 184h256v104H384V184zm456 656H184V184h136v136c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V205.8l136 136V840zM512 442c-79.5 0-144 64.5-144 144s64.5 144 144 144 144-64.5 144-144-64.5-144-144-144zm0 224c-44.2 0-80-35.8-80-80s35.8-80 80-80 80 35.8 80 80-35.8 80-80 80z`}}]},name:`save`,theme:`outlined`};function TU(){return TU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},TU.apply(this,arguments)}var EU=v.forwardRef((e,t)=>v.createElement(Cs,TU({},e,{ref:t,icon:wU}))),DU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M931.4 498.9L94.9 79.5c-3.4-1.7-7.3-2.1-11-1.2a15.99 15.99 0 00-11.7 19.3l86.2 352.2c1.3 5.3 5.2 9.6 10.4 11.3l147.7 50.7-147.6 50.7c-5.2 1.8-9.1 6-10.3 11.3L72.2 926.5c-.9 3.7-.5 7.6 1.2 10.9 3.9 7.9 13.5 11.1 21.5 7.2l836.5-417c3.1-1.5 5.6-4.1 7.2-7.1 3.9-8 .7-17.6-7.2-21.6zM170.8 826.3l50.3-205.6 295.2-101.3c2.3-.8 4.2-2.6 5-5 1.4-4.2-.8-8.7-5-10.2L221.1 403 171 198.2l628 314.9-628.2 313.2z`}}]},name:`send`,theme:`outlined`};function OU(){return OU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},OU.apply(this,arguments)}var kU=v.forwardRef((e,t)=>v.createElement(Cs,OU({},e,{ref:t,icon:DU}))),AU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z`}}]},name:`setting`,theme:`outlined`};function jU(){return jU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jU.apply(this,arguments)}var MU=v.forwardRef((e,t)=>v.createElement(Cs,jU({},e,{ref:t,icon:AU}))),NU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M752 664c-28.5 0-54.8 10-75.4 26.7L469.4 540.8a160.68 160.68 0 000-57.6l207.2-149.9C697.2 350 723.5 360 752 360c66.2 0 120-53.8 120-120s-53.8-120-120-120-120 53.8-120 120c0 11.6 1.6 22.7 4.7 33.3L439.9 415.8C410.7 377.1 364.3 352 312 352c-88.4 0-160 71.6-160 160s71.6 160 160 160c52.3 0 98.7-25.1 127.9-63.8l196.8 142.5c-3.1 10.6-4.7 21.8-4.7 33.3 0 66.2 53.8 120 120 120s120-53.8 120-120-53.8-120-120-120zm0-476c28.7 0 52 23.3 52 52s-23.3 52-52 52-52-23.3-52-52 23.3-52 52-52zM312 600c-48.5 0-88-39.5-88-88s39.5-88 88-88 88 39.5 88 88-39.5 88-88 88zm440 236c-28.7 0-52-23.3-52-52s23.3-52 52-52 52 23.3 52 52-23.3 52-52 52z`}}]},name:`share-alt`,theme:`outlined`};function PU(){return PU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},PU.apply(this,arguments)}var FU=v.forwardRef((e,t)=>v.createElement(Cs,PU({},e,{ref:t,icon:NU}))),IU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372 0-89 31.3-170.8 83.5-234.8l523.3 523.3C682.8 852.7 601 884 512 884zm288.5-137.2L277.2 223.5C341.2 171.3 423 140 512 140c205.4 0 372 166.6 372 372 0 89-31.3 170.8-83.5 234.8z`}}]},name:`stop`,theme:`outlined`};function LU(){return LU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},LU.apply(this,arguments)}var RU=v.forwardRef((e,t)=>v.createElement(Cs,LU({},e,{ref:t,icon:IU}))),zU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M168 504.2c1-43.7 10-86.1 26.9-126 17.3-41 42.1-77.7 73.7-109.4S337 212.3 378 195c42.4-17.9 87.4-27 133.9-27s91.5 9.1 133.8 27A341.5 341.5 0 01755 268.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.7 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c0-6.7-7.7-10.5-12.9-6.3l-56.4 44.1C765.8 155.1 646.2 92 511.8 92 282.7 92 96.3 275.6 92 503.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8zm756 7.8h-60c-4.4 0-7.9 3.5-8 7.8-1 43.7-10 86.1-26.9 126-17.3 41-42.1 77.8-73.7 109.4A342.45 342.45 0 01512.1 856a342.24 342.24 0 01-243.2-100.8c-9.9-9.9-19.2-20.4-27.8-31.4l60.2-47a8 8 0 00-3-14.1l-175.7-43c-5-1.2-9.9 2.6-9.9 7.7l-.7 181c0 6.7 7.7 10.5 12.9 6.3l56.4-44.1C258.2 868.9 377.8 932 512.2 932c229.2 0 415.5-183.7 419.8-411.8a8 8 0 00-8-8.2z`}}]},name:`sync`,theme:`outlined`};function BU(){return BU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},BU.apply(this,arguments)}var VU=v.forwardRef((e,t)=>v.createElement(Cs,BU({},e,{ref:t,icon:zU}))),HU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 208H676V232h212v136zm0 224H676V432h212v160zM412 432h200v160H412V432zm200-64H412V232h200v136zm-476 64h212v160H136V432zm0-200h212v136H136V232zm0 424h212v136H136V656zm276 0h200v136H412V656zm476 136H676V656h212v136z`}}]},name:`table`,theme:`outlined`};function UU(){return UU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},UU.apply(this,arguments)}var WU=v.forwardRef((e,t)=>v.createElement(Cs,UU({},e,{ref:t,icon:HU}))),GU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M848 359.3H627.7L825.8 109c4.1-5.3.4-13-6.3-13H436c-2.8 0-5.5 1.5-6.9 4L170 547.5c-3.1 5.3.7 12 6.9 12h174.4l-89.4 357.6c-1.9 7.8 7.5 13.3 13.3 7.7L853.5 373c5.2-4.9 1.7-13.7-5.5-13.7zM378.2 732.5l60.3-241H281.1l189.6-327.4h224.6L487 427.4h211L378.2 732.5z`}}]},name:`thunderbolt`,theme:`outlined`};function KU(){return KU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},KU.apply(this,arguments)}var qU=v.forwardRef((e,t)=>v.createElement(Cs,KU({},e,{ref:t,icon:GU}))),JU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M876.6 239.5c-.5-.9-1.2-1.8-2-2.5-5-5-13.1-5-18.1 0L684.2 409.3l-67.9-67.9L788.7 169c.8-.8 1.4-1.6 2-2.5 3.6-6.1 1.6-13.9-4.5-17.5-98.2-58-226.8-44.7-311.3 39.7-67 67-89.2 162-66.5 247.4l-293 293c-3 3-2.8 7.9.3 11l169.7 169.7c3.1 3.1 8.1 3.3 11 .3l292.9-292.9c85.5 22.8 180.5.7 247.6-66.4 84.4-84.5 97.7-213.1 39.7-311.3zM786 499.8c-58.1 58.1-145.3 69.3-214.6 33.6l-8.8 8.8-.1-.1-274 274.1-79.2-79.2 230.1-230.1s0 .1.1.1l52.8-52.8c-35.7-69.3-24.5-156.5 33.6-214.6a184.2 184.2 0 01144-53.5L537 318.9a32.05 32.05 0 000 45.3l124.5 124.5a32.05 32.05 0 0045.3 0l132.8-132.8c3.7 51.8-14.4 104.8-53.6 143.9z`}}]},name:`tool`,theme:`outlined`};function YU(){return YU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},YU.apply(this,arguments)}var XU=v.forwardRef((e,t)=>v.createElement(Cs,YU({},e,{ref:t,icon:JU}))),ZU={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z`}}]},name:`unordered-list`,theme:`outlined`};function QU(){return QU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},QU.apply(this,arguments)}var $U=v.forwardRef((e,t)=>v.createElement(Cs,QU({},e,{ref:t,icon:ZU}))),eW={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z`}}]},name:`warning`,theme:`outlined`};function tW(){return tW=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},tW.apply(this,arguments)}var nW=v.forwardRef((e,t)=>v.createElement(Cs,tW({},e,{ref:t,icon:eW}))),rW={shell:{appName:`WrenAI`,themeToLight:`Switch to light theme`,themeToDark:`Switch to dark theme`,collapseSidebar:`Collapse sidebar`,expandSidebar:`Expand sidebar`},nav:{setup:`Setup`,ask:`Ask`,sessions:`Sessions`,artifacts:`Artifacts`,context:`Context`,harness:`Harness`,eval:`Eval`},state:{loading:`Loading…`,emptyTitle:`Nothing here yet`,errorTitle:`Something went wrong`,retry:`Retry`},status:{verified:`Verified`,estimate:`Estimate`,refused:`Refused`,unverified:`Unverified`},envelope:{queryVerification:`Query rows and SQL verified. Metric and time-range interpretation is not independently verified.`,interpretationTitle:`Time range and metric interpretation`,definitionUnknown:`Not supplied by the query tool`,noTableData:`No table data`,derivationTitle:`How this was derived`,estimateBasisNote:`projection · basis verified`,definitionSql:`SQL`,definitionSources:`Sources`,definitionFilters:`Filters`,definitionNoneFallback:`—`,definitionEmptyFallback:`none`,unavailableValue:`N/A`,unavailableReasonPrefix:`Not available: `,unsupportedBlockPrefix:`Unsupported block: "`,unsupportedBlockSuffix:`"`,couldNotRender:`This content couldn't be rendered`},ask:{sessionsHeader:`Sessions`,newSession:`New session`,noSessions:`No sessions yet`,emptyTitle:`Ask anything about your data`,emptyDescription:`Questions and answers in this session will appear here.`,composerLabel:`Ask a question`,composerPlaceholder:`Ask a question…`,send:`Send`,turnPending:`Working on your request…`,workLog:`Work log`,executionTrace:`Execution trace`,stepRunning:`running`,stepDone:`done`,stepError:`error`,stepToggleLabel:`Toggle step details`,stepInputLabel:`Input`,stepActionLabel:`Action`,stepOutputLabel:`Output`,stepDurationLabel:`Duration`,stepResultLabel:`Result`,stepErrorDetailLabel:`Error`,stepReasoningLabel:`Reasoning`,refusalFixLabel:`How to unblock this`,artifact:`Artifact`,save:`Save to Artifacts`,saved:`Saved`,publish:`Publish`,published:`Published`,publishedTitle:`Published`,shareLink:`Share link`,accessScope:`Access`,shareLinkPending:`Sharing is not available yet — this link is a placeholder and does not open.`,streamErrorTitle:`The connection to the agent was lost`,streamErrorGeneric:`The harness stream reported an error.`,streamConnectionLost:`Lost connection to the harness stream.`,harnessUnreachable:`Failed to reach the harness.`},context:{filesHeader:`Files`,pageLead:`Models, relationships, and cubes, plus knowledge (instructions and verified Question-SQL pairs) — the semantic layer the agent binds to.`,overview:`Overview`,backToOverview:`Back to overview`,projectPathLabel:`Project path`,projectPathNotBound:`Not bound to a filesystem path`,modelsTitle:`Models`,relationshipsTitle:`Relationships`,measuresTitle:`Measures`,knowledgeTitle:`Knowledge`,columns:`Columns`,erDiagramAriaLabel:`Entity relationship diagram`,erColumnCount:`cols`,erPrimaryKey:`PK`,erForeignKey:`FK`,additive:`Additive`,nonAdditive:`Non-additive`,instructionsPresent:`Instructions present`,yes:`Yes`,no:`No`,verifiedPairCount:`Verified Question-SQL pairs`,verifiedPairsNotTracked:`Not tracked`,verifiedPairsNotTrackedHint:`This project has no verified-pairs source yet.`,inferredKeyHint:`Inferred from the primary key and relationship conditions — a heuristic, not authoritative.`,inferredMeasureHint:`Inferred from the measure's expression — a heuristic, not authoritative.`,viewImpact:`View impact`,modelsStat:`models`,relationshipsStat:`relationships`,measuresStat:`measures`,fileEmptyTitle:`Select a file`,fileEmptyDescription:`Choose a file from the tree to view its contents.`,emptyTitle:`No semantic layer loaded`,emptyDescription:`Connect a project to see its models, relationships, and cubes.`,impactTitle:`Impact`,impactLoadingTitle:`Loading impact…`,impactErrorTitle:`Could not load impact`,impactLoadFailedMessage:`Failed to load impact data.`,overviewErrorTitle:`Could not load semantic layer`,overviewLoadFailedMessage:`Failed to load the semantic overview.`,filesErrorTitle:`Could not load files`,filesLoadFailedMessage:`Failed to load the project file tree.`,impactSeed:`Changed entity`,impactSeverity:`Worst-case severity`,downstreamDependents:`Downstream dependents`,downstreamByKind:`Grouped by kind`,noDownstream:`No downstream dependents.`,kindModel:`Model`,kindMeasure:`Measure`,kindRelationship:`Relationship`,kindView:`View`,severityNone:`None`,severityCompatibility:`Compatibility`,severityStructural:`Structural`,severitySemantic:`Semantic`,brokenPairsTitle:`Broken verified pairs`,noBrokenPairs:`No verified pairs affected.`,brokenPairsQuestion:`Question`,brokenPairsHits:`Hits`,edit:`Edit`,editInVsCode:`Open in VS Code`,editInCursor:`Open in Cursor`,editWithClaudeCli:`Claude Code CLI`,editModalTitle:`Claude Code CLI prompt`,editModalDescription:`Copy this prompt into the Claude Code CLI to make the change.`,copyPrompt:`Copy prompt`,promptCopied:`Copied`,outOfScopeTitle:`Not available yet`,outOfScopeInlineEditing:`In-app YAML/SQL editing`,outOfScopeCopilot:`Context Copilot`,outOfScopeDeployReview:`Deploy-time blast-radius review`,outOfScopeHint:`Planned for a later phase — use the Edit menu for now.`,enrichmentTitle:`Optional context enrichment`,nativeEnrichmentLead:`Continue enrichment in the real vendor CLI. The interactive session owns its review and approval steps.`,nativeEnrichmentBffReady:`This local BFF can open a terminal session in the bound project.`,nativeEnrichmentBffRequired:`A local BFF is required to open an embedded terminal. You can still copy a command and run it from the bound project.`,continueClaudeCli:`Continue in Claude CLI`,continueCodexCli:`Continue in Codex CLI`,copyCommand:`Copy command`,nativeEnrichmentCopyHint:`The copy fallback starts the selected CLI in the project directory; it does not launch a terminal from the browser.`,terminalTitle:`Interactive enrichment terminal`,terminalLead:`This is the selected vendor CLI running in the bound project. Its output and interaction are not an Ask transcript.`,terminalAriaLabel:`Interactive CLI terminal`,terminalInvalidTarget:`This interactive CLI target is not supported.`,terminalStartFailed:`The interactive terminal could not start. Check the local BFF and generated enrichment artifacts, then try again.`,terminalConnectionFailed:`The terminal connection was lost.`,terminalExited:`The interactive CLI session has exited. Reload Context to inspect changed files and revision.`,reloadContext:`Reload Context`,enrichmentIntro:`Review optional business context after Compile and bind. This never blocks Ask.`,enrichmentUnavailable:`Finish the foundation and Compile and bind before enrichment is available. Ask is unchanged.`,enrichmentReady:`Foundation is ready. Start enrichment now or return later without changing Ask.`,enrichmentSkipForNow:`Skip for now`,enrichmentDismissed:`Enrichment is hidden for now. Ask is unchanged.`,enrichmentShow:`Show enrichment`,enrichmentStartGrill:`Start Grill`,enrichmentStartAutopilot:`Start Auto-pilot`,enrichmentGrill:`Grill`,enrichmentAutopilot:`Auto-pilot`,enrichmentAccept:`Accept`,enrichmentEdit:`Edit`,enrichmentSkip:`Skip`,enrichmentApprove:`Approve change`,enrichmentRetry:`Reconcile`,enrichmentReapply:`Reapply`,enrichmentCancel:`Cancel run`,enrichmentReview:`Review one proposal at a time`,enrichmentConfidence:`Confidence`,enrichmentEvidence:`Evidence summary`,enrichmentAwaitingApproval:`Accepted change awaits host approval.`,enrichmentStatusAwaitingApproval:`Awaiting approval`,enrichmentStatusReconcile:`Reconciliation required`,enrichmentStatusDrafting:`Drafting proposal`,enrichmentStatusFailed:`Failed`,enrichmentAutopilotPause:`Auto-pilot paused. Review is needed before it can continue.`,enrichmentApplying:`Applying the accepted change.`,enrichmentReconcile:`Apply outcome needs reconciliation before another attempt.`,enrichmentReadyToReapply:`The change was not applied and can be reapplied.`,enrichmentCancelled:`This enrichment run was cancelled. Ask remains available.`,enrichmentCompleted:`This enrichment run is complete.`,enrichmentNoAction:`No proposal needs a decision right now.`,enrichmentAudit:`Audit summary`,enrichmentApplied:`Applied`,enrichmentSkipped:`Skipped`,enrichmentReverted:`Reverted`,enrichmentFailed:`Failed`,enrichmentReconcileNeeded:`Needs reconciliation`,enrichmentEditTitle:`Edit enrichment proposal`,enrichmentEditSink:`Target`,enrichmentEditKind:`Change type`,enrichmentEditSummary:`Evidence summary`,enrichmentEditDraft:`Proposed change`,enrichmentEditConfidence:`Confidence (0 to 1)`,enrichmentEditSubmit:`Resubmit for review`,enrichmentEditCancel:`Keep reviewing`,enrichmentEditRequired:`Enter a value.`,enrichmentEditConfidenceRange:`Use a number from 0 to 1.`,enrichmentRequestFailed:`Could not update enrichment. Reload the latest status and try again.`,enrichmentLoading:`Loading enrichment status…`,enrichmentLoadFailed:`Could not load enrichment status. Try again.`,enrichmentCapabilityUnavailable:`This action is unavailable because the required host capability is not configured.`,enrichmentDraftUnavailable:`Enrichment is unavailable until a compatible draft capability is configured.`,enrichmentDraftRequiresClaude:`Enrichment is unavailable with the current subscription provider. Switch the runtime to a Claude subscription to use it.`,enrichmentActionStale:`This review changed elsewhere. Reloaded status is required before trying again.`,enrichmentActionFailed:`The action did not complete. Review the current status and try again.`,enrichmentOutcomePending:`Pending review`,enrichmentOutcomeApplied:`Applied`,enrichmentOutcomeSkipped:`Skipped`,enrichmentOutcomeReverted:`Reverted`,enrichmentOutcomeFailed:`Failed`,enrichmentOutcomeReconcile:`Needs reconciliation`,enrichmentAuditHistory:`Outcome history`},harness:{profilesHeader:`Profiles`,pageSubtitle:`selected purpose · active runtime · executable components`,pageLeadPrefix:`The selected`,pageLeadSuffix:`profile is shown with its active runtime target and executable components.`,executionTitle:`Execution path`,executionNote:`This selected purpose is the active execution path for this view.`,purpose:`Purpose`,profile:`Profile`,compiledDispatchTarget:`Compiled dispatch target`,setupRunnerTarget:`Setup runner`,nativeSessionTarget:`Native session target`,readiness:`Readiness`,ready:`Ready`,unavailable:`Unavailable`,available:`Available`,availableVia:`Available via`,availability:`Availability`,reason:`Reason`,reasonUnavailable:`The configured runtime cannot execute this component.`,programmaticallyUnavailable:`Not available on compiled dispatch target`,targetNotConfigured:`Runtime binding required`,componentsNote:`Availability and any reason are shown with each component.`,technicalDiagnosticsTitle:`Technical diagnostics`,technicalDiagnosticsNote:`Expand a section for implementation and configuration detail.`,runtimeDiagnosticsTitle:`Runtime and model binding`,authenticationBackend:`Authentication back-end`,dispatcherImplementation:`Dispatcher implementation`,profileDiagnosticsTitle:`Profile and compiled bundle`,nativeBindingDiagnosticsTitle:`Native runtime binding`,bindingGeneration:`Binding generation`,profileStatusBound:`Bound`,emptyTitle:`No profile selected`,emptyDescription:`Select a profile from the sidebar to see its status.`,systemPurposeMeta:`system purpose`,profilesLoadFailed:`Could not load the profile registry.`,addProfileTitle:`Add profile`,addProfileLead:`Register a Warble profile directory on this machine. The BFF copies it, checks it, and lists the verdict here.`,addProfilePathLabel:`Profile directory (absolute path)`,addProfileButton:`Register`,addProfileRegistered:`Profile registered.`,addProfileRefused:`Profile registered but not selectable:`,addProfileFixtureNote:`Fixture mode: the registry below is sample data and cannot register profiles.`,removeProfile:`Remove`,removeProfileConfirm:`Remove this profile and its copy?`,fixtureRegistryBadge:`Fixture`,profileReadinessUnavailable:`Not selectable`,loadErrorTitle:`Could not load harness`,loadFailedMessage:`Failed to load harness.`,profileTitle:`Profile`,source:`Source`,boundContext:`Bound context`,verifyGate:`Verify gate`,verifyGateOn:`On`,verifyGateOff:`Off`,dispatchTarget:`Dispatch target`,bundle:`Compiled bundle`,status:`Status`,runtimeTitle:`Runtime · back-end`,activeBackend:`Active back-end`,alsoAvailable:`Also available`,alsoAvailableHint:`Another back-end this same profile can run against — a framework fact, not the running configuration.`,subscriptionAvailable:`Subscription (Claude Agent SDK)`,dispatcher:`Dispatcher`,dispatcherClaudeAgentSdk:`Claude Agent SDK`,dispatcherCodexLocal:`Codex local`,dispatcherInProcess:`In-process`,tier:`Tier`,model:`Model`,runtimeBackendNote:`The same profile can run against different runtime back-ends — subscription, API key, local, or an org gateway.`,agentProfilesTitle:`Agent profiles`,profileColumn:`Profile`,role:`Role`,roleOrchestrator:`Orchestrator`,roleSubAgent:`Sub-agent`,tierModel:`Tier → model`,capabilitiesColumn:`Capabilities`,callableAs:`Callable as`,agentProfilesNote:`Sub-agent profiles spawn as gated tools of the orchestrator — not concurrent processes.`,addProfile:`Add profile`,importProfile:`Import from warble Hub`,connectionTitle:`Data source · connection`,connectionType:`Type`,connectionLocation:`Location`,connectionVia:`Via`,tablesSynced:`Tables synced`,lastSync:`Last sync`,health:`Health`,healthHealthy:`Healthy`,healthDegraded:`Degraded`,healthDown:`Down`,testConnection:`Test connection`,resyncTables:`Re-sync tables`,manageSource:`Manage source`,componentsTitle:`Components`,component:`Component`,componentType:`Type`,realization:`Realization`,tiers:`Tiers`,toolsLabel:`Tools`,outputBlocksLabel:`Output blocks`,stepConsumes:`Consumes`,stepProduces:`Produces`,stepGuard:`Guard`,stepFoldInto:`Fold into`,stepMaxAttempts:`Max attempts`,outcomeLabel:`Outcome`,noneFallback:`none`,capabilityResolutionTitle:`Capability resolution`,capability:`Capability`,outcome:`Outcome`,outcomeNative:`Native`,outcomeRealizeVia:`Realize via`,providedBy:`Provided by`,criticality:`Criticality`,guardrailsTitle:`Guardrails`,enforcement:`Enforcement`,locked:`Locked`,recompile:`Re-compile`,outOfScopeTitle:`Not available yet`,outOfScopeHint:`Planned for a later phase.`},setup:{stepsHeader:`Setup`,pageLead:`A guided, agent-led first run: connect a data source, build context, bind a profile, then ask.`,stepDone:`Done`,stepCurrent:`In progress`,stepTodo:`Not started`,resetAction:`Reset setup`,resetConfirmTitle:`Reset setup?`,resetConfirmDescription:`Clears all setup progress and settings and unbinds the project so you can start over. Your scaffolded project files (including .env) are kept on disk.`,resetConfirmOk:`Reset`,resetConfirmCancel:`Cancel`,modeChoiceTitle:`Get started`,modeChoiceDescription:`Choose how you want to set up this workspace.`,modeCreateTitle:`Create a new project`,modeCreateDescription:`Scaffold a fresh project: connect a data source, build context, and bind a profile. The connection profile is saved in this workspace only — your existing wren CLI profiles and active profile elsewhere on this machine are left untouched.`,modeCreateAction:`Create new project`,modeAdoptTitle:`Adopt an existing project`,modeAdoptDescription:`Point at an existing wren project directory that already has a connection profile. Uses your existing wren CLI profiles as-is; nothing about your existing setup is changed.`,modeAdoptAction:`Adopt existing project`,runtimeTitle:`Runtime & models`,runtimeDescription:`Choose how you authenticate and which model backs each tier.`,authModeLabel:`Authentication`,authModeAriaLabel:`Authentication mode`,authSubscription:`Personal subscription`,authSubscriptionProviderLabel:`Subscription provider`,authSubscriptionProviderAriaLabel:`Subscription provider`,authSubscriptionClaude:`Claude`,authSubscriptionCodex:`ChatGPT / Codex`,authByo:`API key (BYO)`,authLocal:`Local`,authGateway:`Org gateway (pi-ai)`,gatewayDescription:`Routes every tier through pi-ai to the provider your organization chose (a built-in pi-ai provider, or your own OpenAI-compatible endpoint). Runs in-process on the BFF.`,gatewayProviderLabel:`Gateway provider`,gatewayProviderPlaceholder:`pi-ai provider id, e.g. openrouter or amazon-bedrock`,gatewayBaseUrlLabel:`Base URL (optional)`,gatewayBaseUrlPlaceholder:`https://… — only for a custom OpenAI-compatible endpoint`,gatewayBaseUrlInvalid:`Base URL must be an absolute http(s) URL.`,gatewayModelLabel:`Default model`,gatewayModelPlaceholder:`Search the pi-ai catalog or enter a model ID`,gatewayCatalogUnavailable:`The pi-ai catalog is unavailable on this server; enter provider and model IDs manually.`,gatewayKeyDetected:`GENBI_GATEWAY_API_KEY is set on the server.`,gatewayKeyMissing:`GENBI_GATEWAY_API_KEY is not set on the server — set it in the BFF process environment before saving.`,runtimeComingSoon:`coming soon`,runtimeUnavailable:`temporarily unavailable`,tierModelsLabel:`Model per tier`,tierOrchestrator:`Orchestrator`,tierStrong:`Strong`,tierCheap:`Cheap`,tierModelAriaOrchestrator:`Model for orchestrator tier`,tierModelAriaStrong:`Model for strong tier`,tierModelAriaCheap:`Model for cheap tier`,hybridLabel:`Hybrid routing`,hybridDescription:`Route steps across different providers or a cloud/local mix (e.g. a local model for some steps).`,authSubscriptionWarning:`Uses your personal Claude subscription — for personal, single-operator use only (not multi-user or hosted). May be subject to the provider’s Terms of Service.`,authCodexSubscriptionWarning:`Uses local automation through your personal ChatGPT/Codex subscription. Use only for personal, single-operator workflows — not multi-user, hosted, shared, or always-on service use. Availability and use may be subject to OpenAI terms and product limits.`,authSubscriptionLoggedOut:`This subscription CLI is not logged in on the BFF host. Sign in from the same environment, then reload detection before continuing.`,authByoAdapterLabel:`API key adapter`,authByoAdapterAriaLabel:`API key adapter`,authByoAdapterAnthropic:`Anthropic`,authByoAdapterOpenaiCompatible:`OpenAI-compatible`,authByoEnvDetected:`detected on the server`,authByoEnvMissing:`not set on the server — set it in the BFF process environment before continuing`,authByoModelLabel:`Model`,authByoModelPlaceholder:`e.g. claude-sonnet-4-5-20250929`,authByoModelRequired:`Model is required — neither adapter has a default.`,authByoModelLooksLikeUrl:`Model looks like a URL — check that Model and Base URL weren’t swapped.`,authByoBaseUrlLabel:`Base URL`,authByoBaseUrlPlaceholder:`https://…`,authByoBaseUrlRequired:`Base URL is required for the OpenAI-compatible adapter.`,authByoBaseUrlInvalid:`Base URL must be an absolute http(s) URL — check that Model and Base URL weren’t swapped.`,tierAdapterLocal:`Local (OpenAI-compatible)`,subscriptionDriverModelLabel:`Subscription driver model`,subscriptionDriverModelHint:`This drives the subscription dispatcher. It is not a compiled profile tier.`,subscriptionModelsLabel:`Available models`,subscriptionModelsRefresh:`Refresh`,subscriptionModelsSignedInHint:`Suggestions are available to your signed-in subscription provider. You can still enter any model ID.`,subscriptionModelsUnavailable:`Model suggestions are unavailable`,subscriptionModelsFreeTextHint:`You can still enter a model ID manually and save valid settings.`,subscriptionModelDefault:`Provider default`,subscriptionModelPlaceholder:`Search models or enter a model ID`,subscriptionModelCustomUnverified:`Custom / unverified model`,hybridLimitationsTitle:`Hybrid limitations`,hybridLimitationsDescription:`Non-Anthropic render steps can wall-hit; OpenAI-compatible routing has no streaming or retry; cost savings are not yet proven.`,codexTierBehaviorTitle:`Codex subscription`,codexTierBehaviorDescription:`The separate driver model and cheap/strong model values continue to feed the Codex dispatcher. Per-tier adapter/Base URL overrides are not used by that dispatcher.`,defaultModelLabel:`Default model`,defaultModelPlaceholder:`Used by every tier without a model override`,defaultModelHint:`Tier rows below are explicit overrides. Model names are free text.`,compiledTiersLabel:`Compiled bundle tiers`,tierDiscoveryErrorTitle:`Could not load compiled bundle tiers`,tierAdapterAriaPrefix:`Adapter for`,tierModelAriaPrefix:`Model for`,tierModelPlaceholder:`Search models or enter a required model ID`,tierModelOutsideUnion:`This tier will not save. Claude per-step tiers accept only: `,tierDefaultModelPrefix:`Default:`,tierBaseUrlAriaPrefix:`Base URL for`,tierBaseUrlPlaceholder:`https://… (required)`,missingAdapterCredentialsTitle:`Missing adapter credentials`,missingAdapterCredentialsSuffix:`must be set on the BFF server for the configured tier adapters.`,saveRuntime:`Save runtime settings`,savingRuntime:`Saving…`,runtimeSaveErrorTitle:`Saving runtime settings failed`,runtimeConfiguredMessage:`Runtime configured. Next, connect a data source.`,connectTitle:`Connect a data source`,connectDescription:`Pick a data source to connect to your workspace.`,connectSourceAriaLabel:`Data source`,connectProjectNameLabel:`Project name`,connectProjectNamePlaceholder:`my-project`,connectAction:`Connect`,connectCreateAction:`Create project`,connectSourceLabel:`Data source`,connectVariantLabel:`Connection type`,connectVariantHint:`This source can be connected more than one way; the credentials asked for depend on your choice.`,connectFieldOptional:` (optional)`,connectCredentialFileEncoded:`Encoded from `,connectCredentialFileError:`Could not read that file.`,connectCredentialPastePlaceholder:`…or paste the base64 value`,connectSourcePlaceholder:`Search a data source…`,connectSourceCatalogPartial:`Could not read the installed wren’s connector list — showing a partial set.`,connectedNote:`Data source connected.`,connectingNote:`Connecting…`,dataSourceConnectedMessage:`Data source connected. Next, build your context — models, cubes, and knowledge.`,connectNeedsInputTitle:`Credentials needed`,connectNeedsInputMessage:`Enter the credentials below to finish connecting this data source.`,connectEnvFieldsLoadError:`Couldn't load the credential fields — you can still continue if you've set them another way.`,connectEnvSubmitAction:`Save & continue`,connectResumeAction:`I've filled .env — continue`,connectErrorTitle:`Connecting the data source failed`,connectFailureTitle:`We couldn't finish connecting your data source.`,connectFailureDescription:`Your project and data source are still saved. Retry to let the setup agent continue from where it stopped.`,continueAndRepair:`Continue & repair`,connectFailureHistoryMessage:`The setup agent couldn't finish connecting the data source.`,contextFailureTitle:`We couldn't finish building the data model.`,contextFailureDescription:`Your data source is still connected. Retry to let the setup agent continue building the data model from where it stopped.`,contextFailureHistoryMessage:`The setup agent couldn't finish building the data model.`,failureTechnicalDetails:`Technical details`,failureProjectSource:`Project: `,decisionTitle:`Decision needed`,adoptTitle:`Adopt an existing project`,adoptDescription:`Enter the path to an existing wren project — we'll verify it and bind it.`,adoptPathLabel:`Project path`,adoptPathPlaceholder:`/path/to/my-project`,adoptAction:`Verify & adopt`,adoptVerifyingNote:`Verifying project…`,adoptBoundMessage:`Project verified and bound. Setup is nearly done — bind a profile next.`,adoptErrorTitle:`Adopting the project failed`,contextTitle:`Build data model`,contextDescription:`Discover the connected schema and build its semantic model foundation.`,contextModels:`Models`,contextRelationships:`Relationships`,contextAction:`Build data model`,contextBuiltNote:`Data model foundation built.`,contextBuildingNote:`Building context…`,contextBuiltMessage:`Context built. Compile and bind a profile to turn the verify gate on.`,contextNeedsInputTitle:`More information needed`,contextNeedsInputMessage:`The agent needs more information before it can finish building context. Try again below.`,contextErrorTitle:`Building context failed`,bindTitle:`Bind profile`,bindDescription:`Compile the context into a profile and turn the verify gate on.`,bindVerifyGateLabel:`Verify gate`,bindVerifyGateOn:`On`,bindVerifyGateOff:`Off`,bindAction:`Compile and bind`,bindDoneNote:`Profile bound.`,profileBoundMessage:`Profile bound and the verify gate is on — you're ready to ask questions.`,askTitle:`Ask`,askDescription:`Setup is complete — ask a question about your data.`,askCta:`Go to Ask`,emptyTitle:`Select a step`,emptyDescription:`Choose a step from the sidebar to see its details.`},eval:{runsHeader:`Runs`,pageLead:`Run your profile over a golden question set to score verified correctness and catch regressions before they ship.`,emptyTitle:`No eval runs yet`,emptyDescription:`Run an eval to see global scores here.`,loadErrorTitle:`Could not load eval runs`,loadFailedMessage:`Failed to load eval runs.`,globalTab:`Global`,questionsTab:`Questions`,scoreLabel:`Score`,gateThresholdLabel:`Gate threshold`,gatePass:`Pass`,gateFail:`Fail`,regressionsLabel:`Regressions`,costLabel:`Cost`,p50Label:`p50 latency`,trendTitle:`Score trend`,trendAriaLabel:`Eval score trend chart`,byComponentTitle:`By component`,componentColumn:`Component`,scoreColumn:`Score`,deltaColumn:`Change`,outOfScopeTitle:`Not available yet`,outOfScopeQuestionList:`Question list`,outOfScopeQuestionDetail:`Question detail`,outOfScopeScoreHistory:`Per-question score history`,outOfScopeHint:`Planned for a later phase.`},artifacts:{listHeader:`Artifacts`,pageLead:`Every saved GenBI output — dashboard, report, or chart — with its verified state, publish status, and source.`,emptyTitle:`No artifacts yet`,emptyDescription:`Save a dashboard, report, or chart from an Ask session to see it here.`,loadErrorTitle:`Could not load artifacts`,loadFailedMessage:`Failed to load artifacts.`,detailErrorTitle:`Could not load artifact detail`,detailLoadFailedMessage:`Failed to load artifact detail.`,kindDashboard:`Dashboard`,kindReport:`Report`,kindChart:`Chart`,kindLabel:`Kind`,statusLabel:`Status`,sharedLabel:`Shared`,notSharedLabel:`Not shared`,sourceLabel:`Source`,publishTitle:`Publish`,publish:`Publish`,shareLink:`Share link`,accessScope:`Access`,shareLinkPending:`Sharing is not available yet — this link is a placeholder and does not open.`,notPublished:`Not published yet.`,fileLocation:`File`,unpin:`Unpin`,previewTitle:`Preview`,htmlPreviewNote:`Shown as a safe, non-executable text preview.`,detailUnavailableNote:`This artifact's full detail isn't available yet — the connected workspace stores its metadata only.`}};function Q(e){let t=e.split(`.`).reduce((e,t)=>e?.[t],rW);return typeof t==`string`?t:e}function iW(e,t,n){let r=new Set(t.map(e=>e.tier)),i=[e];return r.size>1&&i.push(`split`),n===`scheduled`&&i.push(`scheduled`),i.join(` · `)}function aW(){return!0}function oW(){return``}var sW=class extends Error{status;code;constructor(e,t,n){super(e),this.status=t,this.code=n,this.name=`BffRequestError`}};function cW(e){return e instanceof sW&&e.status===409&&e.code===`native_session_launch_action_stale`}async function lW(e,t){let n=await fetch(`${oW()}${e}`,{...t,headers:{"Content-Type":`application/json`,...t?.headers}});if(!n.ok){let t=await n.json().catch(()=>void 0);throw new sW(t?.error??`Request to ${e} failed: ${n.status} ${n.statusText}`,n.status,typeof t?.code==`string`?t.code:void 0)}if(n.status!==204)return n.json()}function uW(e){return lW(`/api/sessions`,{method:`POST`,body:JSON.stringify(e?{title:e}:{})})}function dW(e){return lW(`/api/sessions/${e}`)}function fW(){return lW(`/api/sessions`)}function pW(e,t){return lW(`/api/sessions/${e}/turns`,{method:`POST`,body:JSON.stringify({question:t})})}function mW(e,t){return`${oW()}/api/sessions/${e}/stream?turn=${encodeURIComponent(t)}`}function hW(e){return lW(`/api/context/impact/${encodeURIComponent(e)}`)}function gW(){return lW(`/api/context/overview`)}function _W(){return lW(`/api/context/files`)}function vW(){return lW(`/api/native-sessions`)}function yW(){return lW(`/api/native-sessions/readiness`)}function bW(e){return lW(`/api/native-sessions/${encodeURIComponent(e)}`)}function xW(e,t,n){let r=t instanceof AbortSignal?t:n,i=typeof t==`object`&&!(t instanceof AbortSignal)?t:{intent:`open_existing`};return lW(`/api/native-sessions`,{method:`POST`,body:JSON.stringify({purpose:e,...i}),signal:r})}function SW(e){return lW(`/api/native-sessions/${encodeURIComponent(e)}/recovery`)}function CW(e,t,n,r){return lW(`/api/native-sessions/${encodeURIComponent(e)}/recovery-action`,{method:`POST`,body:JSON.stringify({capability:t,expectedVersion:n,action:r})})}function wW(e,t){return lW(`/api/native-sessions/${encodeURIComponent(e)}/stop`,{method:`POST`,body:JSON.stringify({capability:t})})}function TW(e,t){return`${(oW()||window.location.origin).replace(/^http/,`ws`)}/api/native-sessions/${encodeURIComponent(e)}/attach?cap=${encodeURIComponent(t)}`}function EW(){return lW(`/api/context/enrichment`)}function DW(){return lW(`/api/eval/runs`)}function OW(e){return lW(`/api/eval/runs/${e}`)}function kW(e){return{key:e.id,sessionId:e.sessionId,name:e.name,kind:e.artifactKind,location:e.location,verified:e.verified,createdAt:e.createdAt,...e.published?{publish:e.published}:{},...e.nativeSessionId?{nativeSessionId:e.nativeSessionId}:{},...e.nativeSessionId?{source:{label:`Session`,href:`/sessions/${encodeURIComponent(e.nativeSessionId)}`}}:{}}}function AW(){return lW(`/api/artifacts`).then(e=>e.map(kW))}async function jW(e){try{return await lW(`/api/artifacts/${encodeURIComponent(e)}/content`)}catch{return{form:`unavailable`,reason:`unreadable`}}}function MW(e,t){if(t.form===`unavailable`)return e;switch(e.kind){case`dashboard`:case`chart`:return t.form===`envelope`?{...e,envelope:t.envelope}:e;case`report`:return{...e,preview:t.form===`envelope`?{kind:`envelope`,envelope:t.envelope}:{kind:`html`,html:t.text}}}}function NW(e){return Promise.all([lW(`/api/artifacts/${encodeURIComponent(e)}`).then(e=>kW(e)),jW(e)]).then(([e,t])=>MW(e,t))}function PW(e,t){return lW(`/api/sessions/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}/save`,{method:`POST`}).then(({savedAt:e})=>({savedAt:e}))}function FW(e,t){return lW(`/api/sessions/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}/unsave`,{method:`POST`}).then(({unsavedAt:e})=>({unsavedAt:e}))}function IW(e){return lW(`/api/artifacts/${encodeURIComponent(e)}/unsave`,{method:`POST`})}function LW(e,t,n=`workspace`){return lW(`/api/sessions/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}/publish`,{method:`POST`,body:JSON.stringify({scope:n})}).then(({link:e,scope:t})=>({link:e,scope:t}))}function RW(){return lW(`/api/setup/steps`)}function zW(){return lW(`/api/config/runtime`)}function BW(){return lW(`/api/config/runtime/readiness`)}function VW(){return lW(`/api/config/runtime/tiers`)}function HW(e){return lW(`/api/config/runtime`,{method:`PUT`,body:JSON.stringify(e)})}function UW(){return lW(`/api/config/env-detect`)}function WW(){return lW(`/api/config/subscription-detect`)}function GW(e){return lW(`/api/harness/gateway-models${e?.trim()?`?provider=${encodeURIComponent(e.trim())}`:``}`)}function KW(e,t=!1){return lW(`/api/config/subscription-models?provider=${encodeURIComponent(e)}&refresh=${t?`1`:`0`}`)}function qW(){return lW(`/api/setup/mode`)}function JW(){return lW(`/api/setup/recovery`)}function YW(e){return lW(`/api/setup/mode`,{method:`POST`,body:JSON.stringify({mode:e})})}var XW=class extends Error{sessionId;decision;constructor(e,t,n){super(n??t.detail??`Setup requires a decision.`),this.name=`SetupDecisionRequiredError`,this.sessionId=e,this.decision=t}};function ZW(e,t,n){return fetch(`${oW()}/api/setup/connect`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({projectName:e,sourceType:t,...n?{variant:n}:{}})}).then(async e=>{let t=await e.json().catch(()=>void 0);if(e.status===409&&t?.status===`needs_decision`&&t.decision)throw new XW(t.sessionId??``,t.decision,t?.error);if(!e.ok)throw Error(t?.error??`Request to /api/setup/connect failed: ${e.status} ${e.statusText}`);return t})}function QW(){return lW(`/api/setup/connect/resume`,{method:`POST`,body:JSON.stringify({})})}function $W(){return lW(`/api/setup/source-catalog`)}function eG(){return lW(`/api/setup/connect/env-fields`)}function tG(e){return lW(`/api/setup/connect/env`,{method:`POST`,body:JSON.stringify({values:e})})}function nG(){return lW(`/api/setup/context`,{method:`POST`,body:JSON.stringify({})})}function rG(e,t){return fetch(`${oW()}/api/setup/adopt`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t?{projectPath:e,profile:t}:{projectPath:e})}).then(async e=>{let t=await e.json().catch(()=>void 0);if(e.status===409&&t?.status===`needs_decision`)return t;if(!e.ok)throw Error(t?.error??`Request to /api/setup/adopt failed: ${e.status} ${e.statusText}`);return t})}function iG(e,t){return lW(`/api/setup/decision`,{method:`POST`,body:JSON.stringify({sessionId:e,choiceId:t})})}function aG(){return lW(`/api/setup/compile-bind`,{method:`POST`})}function oG(){return lW(`/api/setup/reset`,{method:`POST`})}function sG(){return lW(`/api/profiles`)}function cG(e){return lW(`/api/profiles`,{method:`POST`,body:JSON.stringify({sourcePath:e})})}async function lG(e){await lW(`/api/profiles/${encodeURIComponent(e)}`,{method:`DELETE`})}function uG(e){let t=e.steps.map(e=>({name:e.name,tier:e.tier,consumes:e.consumes,produces:e.produces,realization:e.realization,...e.guard===void 0?{}:{guard:e.guard},...e.foldInto===void 0?{}:{foldInto:e.foldInto},...e.maxAttempts===void 0?{}:{maxAttempts:e.maxAttempts}}));return{id:e.id,name:e.name,componentType:e.componentType,realizationKind:e.realizationKind,realizationLabel:iW(e.realizationKind,t,e.trigger),trigger:e.trigger,outcome:e.outcome,callableAs:e.callableAs,model:e.model,tiers:e.tiers,capabilities:e.capabilities.map(e=>({capability:e.capability,outcome:e.outcome,providedBy:e.providedBy,...e.criticality===void 0?{}:{criticality:e.criticality}})),guardrails:e.guardrails.map(e=>({name:e.name,enforcement:e.enforcement,locked:e.locked,...e.threshold===void 0?{}:{threshold:e.threshold}})),tools:e.tools,outputBlocks:e.outputBlocks,steps:t,status:e.status,...e.unavailableReason===void 0?{}:{unavailableReason:e.unavailableReason},...e.nativeAvailability===void 0?{}:{nativeAvailability:e.nativeAvailability}}}function dG(e,t){let n=new Map;for(let e of t)for(let t of e.capabilities)n.has(t.capability)||n.set(t.capability,t);let r=e.runtime.tierModels.find(e=>e.tier===`strong`)?.model??e.runtime.tierModels[0]?.model??``;return{name:e.profile.name,role:`orchestrator`,tierModel:r,capabilities:Array.from(n.values()),status:e.profile.status}}function fG(e,t){return lW(`/api/harness?${`purpose=${encodeURIComponent(e)}${t===void 0?``:`&profile=${encodeURIComponent(t)}`}`}`).then(e=>{let t=e.components.map(uG);return{purpose:e.purpose,profile:{id:e.profile.id,name:e.profile.name,boundContext:e.profile.boundContext,verifyGate:e.profile.verifyGate,bundleId:e.profile.bundleId,bundleVersion:e.profile.bundleVersion,irVersion:e.profile.irVersion,dispatchTarget:e.profile.dispatchTarget,bundleHash:e.profile.bundleHash,status:e.profile.status},runtime:{backend:e.runtime.backend,label:e.runtime.label,tierModels:e.runtime.tierModels,...e.runtime.dispatcher===void 0?{}:{dispatcher:e.runtime.dispatcher}},connection:e.connection,components:t,agentProfiles:[dG(e,t)],nativeSessions:e.nativeSessions}})}var pG=`wren-genbi-native-session-capability:`,mG=`wren-genbi-native-session-recovery-capability:`,hG=`wren-genbi-native-session-return-source:`;function gG(){try{return typeof window>`u`?void 0:window.sessionStorage}catch{return}}function _G(e){return gG()?.getItem(`${pG}${e}`)??void 0}function vG(e,t){gG()?.setItem(`${pG}${e}`,t)}function yG(e){gG()?.removeItem(`${pG}${e}`)}function bG(e){return gG()?.getItem(`${mG}${e}`)??void 0}function xG(e,t){gG()?.setItem(`${mG}${e}`,t)}function SG(e){gG()?.removeItem(`${mG}${e}`)}function CG(e){let t=gG()?.getItem(`${hG}${e}`);return t===`setup`||t===`context`?t:void 0}function wG(e,t){gG()?.setItem(`${hG}${e}`,t)}function TG(e){gG()?.removeItem(`${hG}${e}`)}var EG=Object.defineProperty,DG=Object.getOwnPropertyDescriptor,OG=(e,t)=>{for(var n in t)EG(e,n,{get:t[n],enumerable:!0})},kG=(e,t,n,r)=>{for(var i=r>1?void 0:r?DG(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&EG(t,n,i),i},AG=(e,t)=>(n,r)=>t(n,r,e),jG=`Terminal input`,MG={get:()=>jG,set:e=>jG=e},NG=`Too much output to announce, navigate to rows manually to read`,PG={get:()=>NG,set:e=>NG=e};function FG(e){return e.replace(/\r?\n/g,`\r`)}function IG(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function LG(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function RG(e,t,n,r){e.stopPropagation(),e.clipboardData&&zG(e.clipboardData.getData(`text/plain`),t,n,r)}function zG(e,t,n,r){e=FG(e),e=IG(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function BG(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function VG(e,t,n,r,i){BG(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function HG(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function UG(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var WG=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},GG=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},KG=``,qG=` `,JG=class e{constructor(){this.fg=0,this.bg=0,this.extended=new YG}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},YG=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},XG=class e extends JG{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new YG,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?HG(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ZG=`di$target`,QG=`di$dependencies`,$G=new Map;function eK(e){return e[QG]||[]}function tK(e){if($G.has(e))return $G.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);nK(t,e,r)};return t._id=e,$G.set(e,t),t}function nK(e,t,n){t[ZG]===t?t[QG].push({id:e,index:n}):(t[QG]=[{id:e,index:n}],t[ZG]=t)}var rK=tK(`BufferService`),iK=tK(`CoreMouseService`),aK=tK(`CoreService`),oK=tK(`CharsetService`),sK=tK(`InstantiationService`),cK=tK(`LogService`),lK=tK(`OptionsService`),uK=tK(`OscLinkService`),dK=tK(`UnicodeService`),fK=tK(`DecorationService`),pK=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new XG,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):mK(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};pK=kG([AG(0,rK),AG(1,lK),AG(2,uK)],pK);function mK(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
341
341
|
|
|
342
|
-
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var
|
|
342
|
+
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var hK=tK(`CharSizeService`),gK=tK(`CoreBrowserService`),_K=tK(`MouseService`),vK=tK(`RenderService`),yK=tK(`SelectionService`),bK=tK(`CharacterJoinerService`),xK=tK(`ThemeService`),SK=tK(`LinkProviderService`),CK=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?kK.isErrorNoTelemetry(e)?new kK(e.message+`
|
|
343
343
|
|
|
344
344
|
`+e.stack):Error(e.message+`
|
|
345
345
|
|
|
346
|
-
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function bK(e){SK(e)||yK.onUnexpectedError(e)}var xK=`Canceled`;function SK(e){return e instanceof CK||e instanceof Error&&e.name===xK&&e.message===xK}var CK=class extends Error{constructor(){super(xK),this.name=this.message}};function wK(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var TK=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},EK=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function DK(e,t=0){return e[e.length-(1+t)]}var OK;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(OK||={});var kK=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||OK.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};kK.empty=new kK(e=>{});function AK(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var jK;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(jK||={});var MK=null;function NK(e){return MK?.trackDisposable(e),e}function PK(e){MK?.markAsDisposed(e)}function FK(e,t){MK?.setParent(e,t)}function IK(e){return MK?.markAsSingleton(e),e}function LK(e){if(jK.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function RK(...e){return zK(()=>LK(e))}function zK(e){let t=NK({dispose:AK(()=>{PK(t),e()})});return t}var BK=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,NK(this)}dispose(){this._isDisposed||(PK(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{LK(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return FK(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),FK(e,null))}};BK.DISABLE_DISPOSED_WARNING=!1;var VK=BK,HK=class{constructor(){this._store=new VK,NK(this),FK(this._store,this)}dispose(){PK(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};HK.None=Object.freeze({dispose(){}});var UK=class{constructor(){this._isDisposed=!1,NK(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&FK(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,PK(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&FK(e,null),e}},WK=typeof window==`object`?window:globalThis,GK=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};GK.Undefined=new GK(void 0);var KK=GK,qK=class{constructor(){this._first=KK.Undefined,this._last=KK.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===KK.Undefined}clear(){let e=this._first;for(;e!==KK.Undefined;){let t=e.next;e.prev=KK.Undefined,e.next=KK.Undefined,e=t}this._first=KK.Undefined,this._last=KK.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new KK(e);if(this._first===KK.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==KK.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==KK.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==KK.Undefined&&e.next!==KK.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===KK.Undefined&&e.next===KK.Undefined?(this._first=KK.Undefined,this._last=KK.Undefined):e.next===KK.Undefined?(this._last=this._last.prev,this._last.next=KK.Undefined):e.prev===KK.Undefined&&(this._first=this._first.next,this._first.prev=KK.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==KK.Undefined;)yield e.element,e=e.next}},JK=globalThis.performance&&typeof globalThis.performance.now==`function`,YK=class e{static create(t){return new e(t)}constructor(e){this._now=JK&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},XK;(e=>{e.None=()=>HK.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(RK(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new cq({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new cq({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new cq({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new cq({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new cq({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function x(e){return new Promise(t=>n(e)(t))}e.toPromise=x;function S(e){let t=new cq;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class T{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new cq(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(e,t){return new T(e,t).emitter.event}e.fromObservable=E;function D(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof VK?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=D})(XK||={});var ZK=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new YK,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}}};ZK.all=new Set,ZK._idPool=0;var QK=ZK,$K=-1,eq=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new rq(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};eq._idPool=1;var tq=eq,nq=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
|
|
346
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function wK(e){EK(e)||CK.onUnexpectedError(e)}var TK=`Canceled`;function EK(e){return e instanceof DK||e instanceof Error&&e.name===TK&&e.message===TK}var DK=class extends Error{constructor(){super(TK),this.name=this.message}};function OK(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var kK=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},AK=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function jK(e,t=0){return e[e.length-(1+t)]}var MK;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(MK||={});var NK=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||MK.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};NK.empty=new NK(e=>{});function PK(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var FK;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(FK||={});var IK=null;function LK(e){return IK?.trackDisposable(e),e}function RK(e){IK?.markAsDisposed(e)}function zK(e,t){IK?.setParent(e,t)}function BK(e){return IK?.markAsSingleton(e),e}function VK(e){if(FK.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function HK(...e){return UK(()=>VK(e))}function UK(e){let t=LK({dispose:PK(()=>{RK(t),e()})});return t}var WK=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,LK(this)}dispose(){this._isDisposed||(RK(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{VK(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return zK(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),zK(e,null))}};WK.DISABLE_DISPOSED_WARNING=!1;var GK=WK,KK=class{constructor(){this._store=new GK,LK(this),zK(this._store,this)}dispose(){RK(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};KK.None=Object.freeze({dispose(){}});var qK=class{constructor(){this._isDisposed=!1,LK(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&zK(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,RK(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&zK(e,null),e}},JK=typeof window==`object`?window:globalThis,YK=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};YK.Undefined=new YK(void 0);var XK=YK,ZK=class{constructor(){this._first=XK.Undefined,this._last=XK.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===XK.Undefined}clear(){let e=this._first;for(;e!==XK.Undefined;){let t=e.next;e.prev=XK.Undefined,e.next=XK.Undefined,e=t}this._first=XK.Undefined,this._last=XK.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new XK(e);if(this._first===XK.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==XK.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==XK.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==XK.Undefined&&e.next!==XK.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===XK.Undefined&&e.next===XK.Undefined?(this._first=XK.Undefined,this._last=XK.Undefined):e.next===XK.Undefined?(this._last=this._last.prev,this._last.next=XK.Undefined):e.prev===XK.Undefined&&(this._first=this._first.next,this._first.prev=XK.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==XK.Undefined;)yield e.element,e=e.next}},QK=globalThis.performance&&typeof globalThis.performance.now==`function`,$K=class e{static create(t){return new e(t)}constructor(e){this._now=QK&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},eq;(e=>{e.None=()=>KK.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(HK(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new fq({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new fq({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new fq({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new fq({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new fq({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function x(e){return new Promise(t=>n(e)(t))}e.toPromise=x;function S(e){let t=new fq;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class T{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new fq(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(e,t){return new T(e,t).emitter.event}e.fromObservable=E;function D(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof GK?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=D})(eq||={});var tq=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new $K,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}}};tq.all=new Set,tq._idPool=0;var nq=tq,rq=-1,iq=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new sq(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};iq._idPool=1;var aq=iq,oq=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
|
|
347
347
|
`).slice(2).join(`
|
|
348
|
-
`))}},rq=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},iq=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},aq=0,oq=class{constructor(e){this.value=e,this.id=aq++}},sq=2,cq=class{constructor(e){this._size=0,this._options=e,this._leakageMon=$K>0||this._options?.leakWarningThreshold?new tq(e?.onListenerError??bK,this._options?.leakWarningThreshold??$K):void 0,this._perfMon=this._options?._profName?new QK(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,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new iq(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||bK)(n),HK.None}if(this._disposed)return HK.None;t&&(e=e.bind(t));let r=new oq(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=nq.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof oq?(this._deliveryQueue??=new lq,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=zK(()=>{i?.(),this._removeListener(r)});return n instanceof VK?n.add(a):Array.isArray(n)&&n.push(a),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*sq<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||bK;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[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 oq)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},lq=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},uq=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new cq,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new cq,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};uq.INSTANCE=new uq;var dq=uq;function fq(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}dq.INSTANCE.onDidChangeZoomLevel;function pq(e){return dq.INSTANCE.getZoomFactor(e)}dq.INSTANCE.onDidChangeFullscreen;var mq=typeof navigator==`object`?navigator.userAgent:``,hq=mq.indexOf(`Firefox`)>=0,gq=mq.indexOf(`AppleWebKit`)>=0,_q=mq.indexOf(`Chrome`)>=0,vq=!_q&&mq.indexOf(`Safari`)>=0;mq.indexOf(`Electron/`),mq.indexOf(`Android`);var yq=!1;if(typeof WK.matchMedia==`function`){let e=WK.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=WK.matchMedia(`(display-mode: fullscreen)`);yq=e.matches,fq(WK,e,({matches:e})=>{yq&&t.matches||(yq=e)})}function bq(){return yq}var xq=`en`,Sq=!1,Cq=!1,wq=!1,Tq=!1,Eq=!1,Dq=xq,Oq,kq=globalThis,Aq;typeof kq.vscode<`u`&&typeof kq.vscode.process<`u`?Aq=kq.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(Aq=process);var jq=typeof Aq?.versions?.electron==`string`&&Aq?.type===`renderer`;if(typeof Aq==`object`){Sq=Aq.platform===`win32`,Cq=Aq.platform===`darwin`,wq=Aq.platform===`linux`,wq&&Aq.env.SNAP&&Aq.env.SNAP_REVISION,Aq.env.CI||Aq.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Dq=xq;let e=Aq.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,Dq=t.resolvedLanguage||xq,t.languagePack?.translationsConfigFile}catch{}Tq=!0}else typeof navigator==`object`&&!jq?(Oq=navigator.userAgent,Sq=Oq.indexOf(`Windows`)>=0,Cq=Oq.indexOf(`Macintosh`)>=0,(Oq.indexOf(`Macintosh`)>=0||Oq.indexOf(`iPad`)>=0||Oq.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,wq=Oq.indexOf(`Linux`)>=0,Oq?.indexOf(`Mobi`),Eq=!0,Dq=globalThis._VSCODE_NLS_LANGUAGE||xq,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var Mq=Sq,Nq=Cq,Pq=wq,Fq=Tq;Eq&&typeof kq.importScripts==`function`&&kq.origin;var Iq=Oq,Lq=Dq,Rq;(e=>{function t(){return Lq}e.value=t;function n(){return Lq.length===2?Lq===`en`:Lq.length>=3&&Lq[0]===`e`&&Lq[1]===`n`&&Lq[2]===`-`}e.isDefaultVariant=n;function r(){return Lq===`en`}e.isDefault=r})(Rq||={});var zq=typeof kq.postMessage==`function`&&!kq.importScripts;(()=>{if(zq){let e=[];kq.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),kq.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var Bq=!!(Iq&&Iq.indexOf(`Chrome`)>=0);Iq&&Iq.indexOf(`Firefox`),!Bq&&Iq&&Iq.indexOf(`Safari`),Iq&&Iq.indexOf(`Edg/`),Iq&&Iq.indexOf(`Android`);var Vq=typeof navigator==`object`?navigator:{};Fq||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||Vq&&Vq.clipboard&&Vq.clipboard.writeText,Fq||Vq&&Vq.clipboard&&Vq.clipboard.readText,Fq||bq()||Vq.keyboard,`ontouchstart`in WK||Vq.maxTouchPoints,WK.PointerEvent&&(`ontouchstart`in WK||navigator.maxTouchPoints);var Hq=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Uq=new Hq,Wq=new Hq,Gq=new Hq,Kq=Array(230),qq;(e=>{function t(e){return Uq.keyCodeToStr(e)}e.toString=t;function n(e){return Uq.strToKeyCode(e)}e.fromString=n;function r(e){return Wq.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return Gq.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return Wq.strToKeyCode(e)||Gq.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return Uq.keyCodeToStr(e)}e.toElectronAccelerator=o})(qq||={});var Jq=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new Yq([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},Yq=class{constructor(e){if(e.length===0)throw wK(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=`;`),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function Xq(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return qq.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(hq)switch(t){case 59:return 85;case 60:if(Pq)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Nq)return 57}else if(gq&&(Nq&&t===93||!Nq&&t===92))return 57;return Kq[t]||0}var Zq=Nq?256:2048,Qq=512,$q=1024,eJ=Nq?2048:256,tJ=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.(`AltGraph`),this.keyCode=Xq(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,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;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=Zq),this.altKey&&(t|=Qq),this.shiftKey&&(t|=$q),this.metaKey&&(t|=eJ),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Jq(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},nJ=new WeakMap;function rJ(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!==`null`&&n.origin!==`null`&&t.origin!==n.origin)return null}catch{return null}return e.parent}var iJ=class{static getSameOriginWindowChain(e){let t=nJ.get(e);if(!t){t=[],nJ.set(e,t);let n=e,r;do r=rJ(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let e of i){let i=e.window.deref();if(n+=i?.scrollY??0,r+=i?.scrollX??0,i===t||!e.iframeElement)break;let a=e.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},aJ=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type===`dblclick`&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX==`number`?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=iJ.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},oJ=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(_q){let e=navigator.userAgent.match(/Chrome\/(\d+)/);r=(e?parseInt(e[1]):123)<=122}if(e){let t=e,n=e,i=e.view?.devicePixelRatio||1;if(typeof t.wheelDeltaY<`u`)this.deltaY=r?t.wheelDeltaY/(120*i):t.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<`u`&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(e.type===`wheel`){let t=e;this.deltaY=t.deltaMode===t.DOM_DELTA_LINE?hq&&!Nq?-e.deltaY/3:-e.deltaY:-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)this.deltaX=vq&&Mq?-(t.wheelDeltaX/120):r?t.wheelDeltaX/(120*i):t.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<`u`&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type===`wheel`){let t=e;this.deltaX=t.deltaMode===t.DOM_DELTA_LINE?hq&&!Nq?-e.deltaX/3:-e.deltaX:-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(this.deltaY=r?e.wheelDelta/(120*i):e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},sJ=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),cJ;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof lJ?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:XK.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:sJ})})(cJ||={});var lJ=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?sJ:(this._emitter||=new cq,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},uJ=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e==`function`&&typeof t==`number`&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new EK(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new EK(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},dJ=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new EK(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=zK(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var fJ;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(fJ||={});var pJ=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new cq,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await XK.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};pJ.EMPTY=pJ.fromArray([]);function mJ(e){return hJ(e,0)}function hJ(e,t){switch(typeof e){case`object`:return e===null?gJ(349,t):Array.isArray(e)?yJ(e,t):bJ(e,t);case`string`:return vJ(e,t);case`boolean`:return _J(e,t);case`number`:return gJ(e,t);case`undefined`:return gJ(937,t);default:return gJ(617,t)}}function gJ(e,t){return(t<<5)-t+e|0}function _J(e,t){return gJ(e?433:863,t)}function vJ(e,t){t=gJ(149417,t);for(let n=0,r=e.length;n<r;n++)t=gJ(e.charCodeAt(n),t);return t}function yJ(e,t){return t=gJ(104579,t),e.reduce((e,t)=>hJ(t,e),t)}function bJ(e,t){return t=gJ(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=vJ(n,t),hJ(e[n],t)),t)}var{registerWindow:xJ,getWindow:SJ,getDocument:CJ,getWindows:wJ,getWindowsCount:TJ,getWindowId:EJ,getWindowById:DJ,hasWindow:OJ,onDidRegisterWindow:kJ,onWillUnregisterWindow:AJ,onDidUnregisterWindow:jJ}=function(){let e=new Map,t={window:WK,disposables:new VK};e.set(WK.vscodeWindowId,t);let n=new cq,r=new cq,i=new cq;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return HK.None;let a=new VK,o={window:t,disposables:a.add(new VK)};return e.set(t.vscodeWindowId,o),a.add(zK(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(NJ(t,HJ.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:WK},getDocument(e){return SJ(e).document}}}(),MJ=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function NJ(e,t,n,r){return new MJ(e,t,n,r)}function PJ(e,t){return function(n){return t(new aJ(e,n))}}function FJ(e){return function(t){return e(new tJ(t))}}var IJ=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=PJ(SJ(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=FJ(n)),NJ(e,t,i,r)},LJ,RJ=class extends dJ{constructor(e){super(),this.defaultTarget=e&&SJ(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},zJ=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){bK(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(zJ.sort),a.shift().execute();r.set(i,!1)};LJ=(t,r,a=0)=>{let o=EJ(t),s=new zJ(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})();var BJ=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};BJ.None=new BJ(0,0);function VJ(e){let t=e.getBoundingClientRect(),n=SJ(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=mJ(n),a=r.get(i);if(a)a.users+=1;else{let o=new cq,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(zK(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var HJ={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:gq?`webkitAnimationStart`:`animationstart`,ANIMATION_END:gq?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:gq?`webkitAnimationIteration`:`animationiteration`},UJ=class{constructor(e){this.domNode=e,this._maxWidth=``,this._width=``,this._height=``,this._top=``,this._left=``,this._bottom=``,this._right=``,this._paddingTop=``,this._paddingLeft=``,this._paddingBottom=``,this._paddingRight=``,this._fontFamily=``,this._fontWeight=``,this._fontSize=``,this._fontStyle=``,this._fontFeatureSettings=``,this._fontVariationSettings=``,this._textDecoration=``,this._lineHeight=``,this._letterSpacing=``,this._className=``,this._display=``,this._position=``,this._visibility=``,this._color=``,this._backgroundColor=``,this._layerHint=!1,this._contain=`none`,this._boxShadow=``}setMaxWidth(e){let t=WJ(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=WJ(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=WJ(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=WJ(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=WJ(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=WJ(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=WJ(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=WJ(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=WJ(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=WJ(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=WJ(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=WJ(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=WJ(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=WJ(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?`translate3d(0px, 0px, 0px)`:``)}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function WJ(e){return typeof e==`number`?`${e}px`:e}function GJ(e){return new UJ(e)}var KJ=class{constructor(){this._hooks=new VK,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add(zK(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=SJ(e)}this._hooks.add(NJ(a,HJ.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(NJ(a,HJ.POINTER_UP,e=>this.stopMonitoring(!0)))}};function qJ(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}var JJ;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(JJ||={});var YJ=class e extends HK{constructor(){super(),this.dispatched=!1,this.targets=new qK,this.ignoreTargets=new qK,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(XK.runAndSubscribe(kJ,({window:e,disposables:t})=>{t.add(NJ(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(NJ(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(NJ(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:WK,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=IK(new e),zK(e.INSTANCE.targets.push(t))):HK.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=IK(new e),zK(e.INSTANCE.ignoreTargets.push(t))):HK.None}static isTouchDevice(){return`ontouchstart`in WK||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n<r;n++){let r=e.targetTouches.item(n);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let i=this.newGestureEvent(JJ.Start,r.target);i.pageX=r.pageX,i.pageY=r.pageY,this.dispatchEvent(i)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let a=0,o=n.changedTouches.length;a<o;a++){let o=n.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn(`move of an UNKNOWN touch`,o);continue}let s=this.activeTouches[o.identifier],c=Date.now()-s.initialTimeStamp;if(c<e.HOLD_DELAY&&Math.abs(s.initialPageX-DK(s.rollingPageX))<30&&Math.abs(s.initialPageY-DK(s.rollingPageY))<30){let e=this.newGestureEvent(JJ.Tap,s.initialTarget);e.pageX=DK(s.rollingPageX),e.pageY=DK(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-DK(s.rollingPageX))<30&&Math.abs(s.initialPageY-DK(s.rollingPageY))<30){let e=this.newGestureEvent(JJ.Contextmenu,s.initialTarget);e.pageX=DK(s.rollingPageX),e.pageY=DK(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=DK(s.rollingPageX),n=DK(s.rollingPageY),i=DK(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(JJ.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===JJ.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===JJ.Change||t.type===JJ.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=LJ(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(JJ.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n<r;n++){let r=e.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn(`end of an UNKNOWN touch`,r);continue}let i=this.activeTouches[r.identifier],a=this.newGestureEvent(JJ.Change,i.initialTarget);a.translationX=r.pageX-DK(i.rollingPageX),a.translationY=r.pageY-DK(i.rollingPageY),a.pageX=r.pageX,a.pageY=r.pageY,this.dispatchEvent(a),i.rollingPageX.length>3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}};YJ.SCROLL_FRICTION=-.005,YJ.HOLD_DELAY=700,YJ.CLEAR_TAP_COUNT_TIME=400,TG([qJ],YJ,`isTouchDevice`,1);var XJ=YJ,ZJ=class extends HK{onclick(e,t){this._register(NJ(e,HJ.CLICK,n=>t(new aJ(SJ(e),n))))}onmousedown(e,t){this._register(NJ(e,HJ.MOUSE_DOWN,n=>t(new aJ(SJ(e),n))))}onmouseover(e,t){this._register(NJ(e,HJ.MOUSE_OVER,n=>t(new aJ(SJ(e),n))))}onmouseleave(e,t){this._register(NJ(e,HJ.MOUSE_LEAVE,n=>t(new aJ(SJ(e),n))))}onkeydown(e,t){this._register(NJ(e,HJ.KEY_DOWN,e=>t(new tJ(e))))}onkeyup(e,t){this._register(NJ(e,HJ.KEY_UP,e=>t(new tJ(e))))}oninput(e,t){this._register(NJ(e,HJ.INPUT,t))}onblur(e,t){this._register(NJ(e,HJ.BLUR,t))}onfocus(e,t){this._register(NJ(e,HJ.FOCUS,t))}onchange(e,t){this._register(NJ(e,HJ.CHANGE,t))}ignoreGesture(e){return XJ.ignoreTarget(e)}},QJ=11,$J=class extends ZJ{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement(`div`),this.bgDomNode.className=`arrow-background`,this.bgDomNode.style.position=`absolute`,this.bgDomNode.style.width=e.bgWidth+`px`,this.bgDomNode.style.height=e.bgHeight+`px`,typeof e.top<`u`&&(this.bgDomNode.style.top=`0px`),typeof e.left<`u`&&(this.bgDomNode.style.left=`0px`),typeof e.bottom<`u`&&(this.bgDomNode.style.bottom=`0px`),typeof e.right<`u`&&(this.bgDomNode.style.right=`0px`),this.domNode=document.createElement(`div`),this.domNode.className=e.className,this.domNode.style.position=`absolute`,this.domNode.style.width=QJ+`px`,this.domNode.style.height=QJ+`px`,typeof e.top<`u`&&(this.domNode.style.top=e.top+`px`),typeof e.left<`u`&&(this.domNode.style.left=e.left+`px`),typeof e.bottom<`u`&&(this.domNode.style.bottom=e.bottom+`px`),typeof e.right<`u`&&(this.domNode.style.right=e.right+`px`),this._pointerMoveMonitor=this._register(new KJ),this._register(IJ(this.bgDomNode,HJ.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(IJ(this.domNode,HJ.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new RJ),this._pointerdownScheduleRepeatTimer=this._register(new uJ)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,SJ(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},eY=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<`u`?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<`u`?t.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},tY=class extends HK{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new cq),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new eY(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>`u`?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>`u`?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new aY(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=aY.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},nY=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function rY(e,t){let n=t-e;return function(t){return e+n*sY(t)}}function iY(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var aY=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.duration=r,this.startTime=n,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,t,n){if(Math.abs(e-t)>2.5*n){let r,i;return e<t?(r=e+.75*n,i=t-.75*n):(r=e-.75*n,i=t+.75*n),iY(rY(e,r),rY(i,t),.33)}return rY(e,t)}dispose(){this.animationFrameDisposable!==null&&(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 t=(e-this.startTime)/this.duration;return t<1?new nY(this.scrollLeft(t),this.scrollTop(t),!1):new nY(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return e.start(t,n,r)}static start(t,n,r){r+=10;let i=Date.now()-10;return new e(t,n,i,r)}};function oY(e){return e**3}function sY(e){return 1-oY(1-e)}var cY=class extends HK{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new uJ)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3||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(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_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`:``)))}},lY=140,uY=class extends ZJ{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 cY(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new KJ),this._shouldRender=!0,this.domNode=GJ(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(NJ(this.domNode.domNode,HJ.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new $J(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=GJ(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register(NJ(this.slider.domNode,HJ.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=VJ(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if(Mq&&a>lY){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName(`active`,!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},dY=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},fY=class extends uY{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new dY(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:`horizontal`,scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),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,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},pY=class extends uY{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new dY(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:`vertical`,scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),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,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},mY=500,hY=50,gY=!0,_Y=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},vY=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,t=0,n=1,r=this._rear;do{let i=r===this._front?e:2**-n;if(e-=i,t+=this._memory[r].score*i,r===this._front)break;r=(this._capacity+r-1)%this._capacity,n++}while(!0);return t<=.5}acceptStandardWheelEvent(e){if(_q){let t=pq(SJ(e.browserEvent));this.accept(Date.now(),e.deltaX*t,e.deltaY*t)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,n){let r=null,i=new _Y(e,t,n);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(r=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]=i),i.score=this._computeScore(i,r)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};vY.INSTANCE=new vY;var yY=vY,bY=class extends ZJ{constructor(e,t,n){super(),this._onScroll=this._register(new cq),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new cq),this.onWillScroll=this._onWillScroll.event,this._options=SY(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new pY(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new fY(this._scrollable,this._options,r)),this._domNode=document.createElement(`div`),this._domNode.className=`xterm-scrollable-element `+this._options.className,this._domNode.setAttribute(`role`,`presentation`),this._domNode.style.position=`relative`,this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=GJ(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=GJ(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=GJ(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 uJ),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=LK(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,Nq&&(this._options.className+=` mac`),this._domNode.className=`xterm-scrollable-element `+this._options.className}updateOptions(e){typeof e.handleMouseWheel<`u`&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<`u`&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<`u`&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<`u`&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<`u`&&(this._options.horizontal=e.horizontal),typeof e.vertical<`u`&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<`u`&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<`u`&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<`u`&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new oJ(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=LK(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(NJ(this._listenOnDomNode,HJ.MOUSE_WHEEL,e=>{this._onMouseWheel(new oJ(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=yY.INSTANCE;gY&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!Nq&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=hY*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=hY*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(gY&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),mY)}},xY=class extends bY{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function SY(e){let t={lazyRender:typeof e.lazyRender<`u`&&e.lazyRender,className:typeof e.className<`u`?e.className:``,useShadows:typeof e.useShadows<`u`?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<`u`?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<`u`&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`&&e.alwaysConsumeMouseWheel,scrollYToX:typeof e.scrollYToX<`u`&&e.scrollYToX,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<`u`?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<`u`?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<`u`?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<`u`?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<`u`?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<`u`?e.listenOnDomNode:null,horizontal:typeof e.horizontal<`u`?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<`u`?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<`u`&&e.horizontalHasArrows,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`&&e.verticalHasArrows,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`&&e.scrollByPage};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,Nq&&(t.className+=` mac`),t}var CY=class extends HK{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new cq),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new tY({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>LJ(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new xY(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(XK.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(zK(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(zK(()=>this._styleElement.remove())),this._register(XK.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.colors.scrollbarSliderActiveBackground.css};`,`}`].join(`
|
|
349
|
-
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};CY=TG([EG(2,$G),EG(3,fK),EG(4,eK),EG(5,_K),EG(6,aK),EG(7,mK)],CY);var wY=class extends HK{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(zK(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:``:t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};wY=TG([EG(1,$G),EG(2,fK),EG(3,cK),EG(4,mK)],wY);var TY=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<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,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},EY={full:0,left:0,center:0,right:0},DY={full:0,left:0,center:0,right:0},OY={full:0,left:0,center:0,right:0},kY=class extends HK{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new TY,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(zK(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw Error(`Ctx cannot be null`);this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange(`overviewRuler`,()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);DY.full=this._canvas.width,DY.left=e,DY.center=t,DY.right=e,this._refreshDrawHeightConstants(),OY.full=1,OY.left=1,OY.center=1+DY.left,OY.right=1+DY.left+DY.center}_refreshDrawHeightConstants(){EY.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);EY.left=t,EY.center=t,EY.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*EY.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*EY.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*EY.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*EY.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(OY[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-EY[e.position||`full`]/2),DY[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+EY[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};kY=TG([EG(2,$G),EG(3,cK),EG(4,mK),EG(5,aK),EG(6,_K),EG(7,fK)],kY);var $;(e=>(e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=`
|
|
350
|
-
`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))($||={});var AY;(e=>(e.PAD=``,e.HOP=``,e.BPH=``,e.NBH=``,e.IND=``,e.NEL=`
`,e.SSA=``,e.ESA=``,e.HTS=``,e.HTJ=``,e.VTS=``,e.PLD=``,e.PLU=``,e.RI=``,e.SS2=``,e.SS3=``,e.DCS=``,e.PU1=``,e.PU2=``,e.STS=``,e.CCH=``,e.MW=``,e.SPA=``,e.EPA=``,e.SOS=``,e.SGCI=``,e.SCI=``,e.CSI=``,e.ST=``,e.OSC=``,e.PM=``,e.APC=``))(AY||={});var jY;(e=>e.ST=`${$.ESC}\\`)(jY||={});var MY=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${$.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};MY=TG([EG(2,$G),EG(3,aK),EG(4,tK),EG(5,mK)],MY);var NY=0,PY=0,FY=0,IY=0,LY={css:`#00000000`,rgba:0},RY;(e=>{function t(e,t,n,r){return r===void 0?`#${UY(e)}${UY(t)}${UY(n)}`:`#${UY(e)}${UY(t)}${UY(n)}${UY(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(RY||={});var zY;(e=>{function t(e,t){if(IY=(t.rgba&255)/255,IY===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return NY=a+Math.round((n-a)*IY),PY=o+Math.round((r-o)*IY),FY=s+Math.round((i-s)*IY),{css:RY.toCss(NY,PY,FY),rgba:RY.toRgba(NY,PY,FY)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=HY.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return RY.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[NY,PY,FY]=HY.toChannels(t),{css:RY.toCss(NY,PY,FY),rgba:t}}e.opaque=i;function a(e,t){return IY=Math.round(t*255),[NY,PY,FY]=HY.toChannels(e.rgba),{css:RY.toCss(NY,PY,FY,IY),rgba:RY.toRgba(NY,PY,FY,IY)}}e.opacity=a;function o(e,t){return IY=e.rgba&255,a(e,IY*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(zY||={});var BY;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return NY=parseInt(e.slice(1,2).repeat(2),16),PY=parseInt(e.slice(2,3).repeat(2),16),FY=parseInt(e.slice(3,4).repeat(2),16),RY.toColor(NY,PY,FY);case 5:return NY=parseInt(e.slice(1,2).repeat(2),16),PY=parseInt(e.slice(2,3).repeat(2),16),FY=parseInt(e.slice(3,4).repeat(2),16),IY=parseInt(e.slice(4,5).repeat(2),16),RY.toColor(NY,PY,FY,IY);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return NY=parseInt(r[1]),PY=parseInt(r[2]),FY=parseInt(r[3]),IY=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),RY.toColor(NY,PY,FY,IY);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[NY,PY,FY,IY]=t.getImageData(0,0,1,1).data,IY!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:RY.toRgba(NY,PY,FY,IY),css:e}}e.toColor=r})(BY||={});var VY;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(VY||={});var HY;(e=>{function t(e,t){if(IY=(t&255)/255,IY===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return NY=a+Math.round((n-a)*IY),PY=o+Math.round((r-o)*IY),FY=s+Math.round((i-s)*IY),RY.toRgba(NY,PY,FY)}e.blend=t;function n(e,t,n){let a=VY.relativeLuminance(e>>8),o=VY.relativeLuminance(t>>8);if(WY(a,o)<n){if(o<a){let o=r(e,t,n),s=WY(a,VY.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>WY(a,VY.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=WY(a,VY.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>WY(a,VY.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=WY(VY.relativeLuminance2(o,s,c),VY.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=WY(VY.relativeLuminance2(o,s,c),VY.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=WY(VY.relativeLuminance2(o,s,c),VY.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=WY(VY.relativeLuminance2(o,s,c),VY.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(HY||={});function UY(e){let t=e.toString(16);return t.length<2?`0`+t:t}function WY(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var GY=class extends WG{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},KY=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new KG}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,o=0,s=t.getFg(0),c=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==s||this._workCell.bg!==c){if(e-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,o=a,s=this._workCell.fg,c=this._workCell.bg}a+=this._workCell.getChars().length||UG.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(e,t,n,r,i){let a=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(a)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let t=this._characterJoiners[e].handler(a);for(let e=0;e<t.length;e++)KY._mergeRanges(o,t[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,o=e[r];if(o){for(let s=n;s<this._bufferService.cols;s++){let n=t.getWidth(s),c=t.getString(s).length||UG.length;if(n!==0){if(!i&&o[0]<=a&&(o[0]=s,i=!0),o[1]<=a){if(o[1]=s,o=e[++r],!o)break;o[0]<=a?(o[0]=s,i=!0):i=!1}a+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};KY=TG([EG(0,$G)],KY);function qY(e){return 57508<=e&&e<=57558}function JY(e){return 9472<=e&&e<=9631}function YY(e){return qY(e)||JY(e)}function XY(){return{css:{canvas:ZY(),cell:ZY()},device:{canvas:ZY(),cell:ZY(),char:{width:0,height:0,left:0,top:0}}}}function ZY(){return{width:0,height:0}}var QY=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new KG,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,a,o,s,c,l,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<a+1&&(m=a+1);let h,g=0,_=``,v=0,y=0,b=0,x=0,S=!1,C=0,w=!1,T=0,E=0,D=[],O=l!==-1&&u!==-1;for(let k=0;k<m;k++){e.loadCell(k,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let A=!1,j=k>=E,M=k,N=this._workCell;if(f.length>0&&k===f[0][0]&&j){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)j&&=i===this._isCellInSelection(v,t);j&&=!n||a<r[0]||a>=r[1],j?(A=!0,N=new GY(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),M=r[1]-1,m=N.getWidth()):E=r[1]}let P=this._isCellInSelection(k,t),F=n&&k===a,I=O&&k>=l&&k<=u,L=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{L=!0});let R=N.getChars()||UG;if(R===` `&&(N.isUnderline()||N.isOverline())&&(R=`\xA0`),T=m*s-c.get(R,N.isBold(),N.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(P&&w||!P&&!w&&N.bg===y)&&(P&&w&&p.selectionForeground||N.fg===b)&&N.extended.ext===x&&I===S&&T===C&&!F&&!A&&!L&&j){N.isInvisible()?_+=UG:_+=R,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=N.bg,b=N.fg,x=N.extended.ext,S=I,C=T,w=P,A&&a>=k&&a<=M&&(a=k),!this._coreService.isCursorHidden&&F&&this._coreService.isCursorInitialized){if(D.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&D.push(`xterm-cursor-blink`),D.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:D.push(`xterm-cursor-outline`);break;case`block`:D.push(`xterm-cursor-block`);break;case`bar`:D.push(`xterm-cursor-bar`);break;case`underline`:D.push(`xterm-cursor-underline`)}}if(N.isBold()&&D.push(`xterm-bold`),N.isItalic()&&D.push(`xterm-italic`),N.isDim()&&D.push(`xterm-dim`),_=N.isInvisible()?UG:N.getChars()||UG,N.isUnderline()&&(D.push(`xterm-underline-${N.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!N.isUnderlineColorDefault())){if(N.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${WG.toColorRGB(N.getUnderlineColor()).join(`,`)})`;else{let e=N.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&N.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}}N.isOverline()&&(D.push(`xterm-overline`),_===` `&&(_=`\xA0`)),N.isStrikethrough()&&D.push(`xterm-strikethrough`),I&&(h.style.textDecoration=`underline`);let z=N.getFgColor(),B=N.getFgColorMode(),V=N.getBgColor(),H=N.getBgColorMode(),U=!!N.isInverse();if(U){let e=z;z=V,V=e;let t=B;B=H,H=t}let W,G,ee=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{e.options.layer!==`top`&&ee||(e.backgroundColorRGB&&(H=50331648,V=e.backgroundColorRGB.rgba>>8&16777215,W=e.backgroundColorRGB),e.foregroundColorRGB&&(B=50331648,z=e.foregroundColorRGB.rgba>>8&16777215,G=e.foregroundColorRGB),ee=e.options.layer===`top`)}),!ee&&P&&(W=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,V=W.rgba>>8&16777215,H=50331648,ee=!0,p.selectionForeground&&(B=50331648,z=p.selectionForeground.rgba>>8&16777215,G=p.selectionForeground)),ee&&D.push(`xterm-decoration-top`);let K;switch(H){case 16777216:case 33554432:K=p.ansi[V],D.push(`xterm-bg-${V}`);break;case 50331648:K=RY.toColor(V>>16,V>>8&255,V&255),this._addStyle(h,`background-color:#${$Y((V>>>0).toString(16),`0`,6)}`);break;default:U?(K=p.foreground,D.push(`xterm-bg-257`)):K=p.background}switch(W||N.isDim()&&(W=zY.multiplyOpacity(K,.5)),B){case 16777216:case 33554432:N.isBold()&&z<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(z+=8),this._applyMinimumContrast(h,K,p.ansi[z],N,W,void 0)||D.push(`xterm-fg-${z}`);break;case 50331648:let e=RY.toColor(z>>16&255,z>>8&255,z&255);this._applyMinimumContrast(h,K,e,N,W,G)||this._addStyle(h,`color:#${$Y(z.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,K,p.foreground,N,W,G)||U&&D.push(`xterm-fg-257`)}D.length&&=(h.className=D.join(` `),0),!F&&!A&&!L&&j?g++:h.textContent=_,T!==this.defaultSpacing&&(h.style.letterSpacing=`${T}px`),d.push(h),k=M}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||YY(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=zY.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};QY=TG([EG(1,gK),EG(2,aK),EG(3,fK),EG(4,tK),EG(5,cK),EG(6,_K)],QY);function $Y(e,t,n){for(;e.length<n;)e=t+e;return e}var eX=class{constructor(e,t){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 n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.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,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},tX=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function nX(){return new tX}var rX=`xterm-dom-renderer-owner-`,iX=`xterm-rows`,aX=`xterm-fg-`,oX=`xterm-bg-`,sX=`xterm-focus`,cX=`xterm-selection`,lX=1,uX=class extends HK{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=lX++,this._rowElements=[],this._selectionRenderModel=nX(),this.onRequestRedraw=this._register(new cq).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(iX),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(cX),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=XY(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(QY,document),this._element.classList.add(rX+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(zK(()=>{this._element.classList.remove(rX+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new eX(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${iX} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${iX} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${iX} .xterm-dim { color: ${zY.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${iX}.${sX} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${iX}.${sX} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${iX}.${sX} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${iX} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${iX} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${iX} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${iX} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${iX} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${cX} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${cX} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${cX} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${aX}${n} { color: ${r.css}; }${this._terminalSelector} .${aX}${n}.xterm-dim { color: ${zY.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${oX}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${aX}257 { color: ${zY.opaque(e.background).css}; }${this._terminalSelector} .${aX}257.xterm-dim { color: ${zY.multiplyOpacity(zY.opaque(e.background),.5).css}; }${this._terminalSelector} .${oX}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(sX),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(sX),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${rX}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};uX=TG([EG(7,rK),EG(8,dK),EG(9,aK),EG(10,$G),EG(11,tK),EG(12,fK),EG(13,_K)],uX);var dX=class extends HK{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new cq),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new mX(this._optionsService))}catch{this._measureStrategy=this._register(new pX(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};dX=TG([EG(2,aK)],dX);var fX=class extends HK{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},pX=class extends fX{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},mX=class extends fX{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},hX=class extends HK{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new gX(this._window)),this._onDprChange=this._register(new cq),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new cq),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(XK.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(NJ(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(NJ(this._textarea,`blur`,()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},gX=class extends HK{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new UK),this._onDprChange=this._register(new cq),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(zK(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=NJ(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)}},_X=class extends HK{constructor(){super(),this.linkProviders=[],this._register(zK(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function vX(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function yX(e,t,n,r,i,a,o,s,c){if(!a)return;let l=vX(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+ +!!c),l[1]=Math.min(Math.max(l[1],1),i),l}var bX=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return yX(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=vX(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};bX=TG([EG(0,mK),EG(1,dK)],bX);var xX=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},SX={};wG(SX,{getSafariVersion:()=>kX,isChromeOS:()=>FX,isFirefox:()=>EX,isIpad:()=>jX,isIphone:()=>MX,isLegacyEdge:()=>DX,isLinux:()=>PX,isMac:()=>AX,isNode:()=>CX,isSafari:()=>OX,isWindows:()=>NX});var CX=typeof process<`u`&&`title`in process,wX=CX?`node`:navigator.userAgent,TX=CX?`node`:navigator.platform,EX=wX.includes(`Firefox`),DX=wX.includes(`Edge`),OX=/^((?!chrome|android).)*safari/i.test(wX);function kX(){if(!OX)return 0;let e=wX.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var AX=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(TX),jX=TX===`iPad`,MX=TX===`iPhone`,NX=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(TX),PX=TX.indexOf(`Linux`)>=0,FX=/\bCrOS\b/.test(wX),IX=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),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},LX=class extends IX{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},RX=class extends IX{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},zX=!CX&&`requestIdleCallback`in window?RX:LX,BX=class{constructor(){this._queue=new zX}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},VX=class extends HK{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new UK),this._pausedResizeTask=new BX,this._observerDisposable=this._register(new UK),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 cq),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new cq),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new cq),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new cq),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new xX((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new HX(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(zK(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=zK(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};VX=TG([EG(2,aK),EG(3,dK),EG(4,tK),EG(5,cK),EG(6,$G),EG(7,fK),EG(8,_K)],VX);var HX=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function UX(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return KX(i,a,e,t,n,r)+qX(a,t,n,r)+JX(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,tZ(Math.abs(i-e),eZ(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return tZ(GX(a>t?e:i,n)+(s-1)*n.cols+1+WX(a>t?i:e,n),eZ(o,r))}function WX(e,t){return e-1}function GX(e,t){return t.cols-e}function KX(e,t,n,r,i,a){return qX(t,r,i,a).length===0?``:tZ($X(e,t,e,t-XX(t,i),!1,i).length,eZ(`D`,a))}function qX(e,t,n,r){let i=e-XX(e,n),a=t-XX(t,n);return tZ(Math.abs(i-a)-YX(e,t,n),eZ(QX(e,t),r))}function JX(e,t,n,r,i,a){let o;o=qX(t,r,i,a).length>0?r-XX(r,i):t;let s=r,c=ZX(e,t,n,r,i,a);return tZ($X(e,o,n,s,c===`C`,i).length,eZ(c,a))}function YX(e,t,n){let r=0,i=e-XX(e,n),a=t-XX(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=QX(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function XX(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function ZX(e,t,n,r,i,a){let o;return o=qX(n,r,i,a).length>0?r-XX(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function QX(e,t){return e>t?`A`:`B`}function $X(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&s<a.buffer.lines.length;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function eZ(e,t){let n=t?`O`:`[`;return $.ESC+n+e}function tZ(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var nZ=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.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,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function rZ(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var iZ=50,aZ=15,oZ=50,sZ=500,cZ=RegExp(`\xA0`,`g`),lZ=class extends HK{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new KG,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new cq),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new cq),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new cq),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new cq),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 nZ(this._bufferService),this._activeSelectionMode=0,this._register(zK(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map(e=>e.replace(cZ,` `)).join(NX?`\r
|
|
348
|
+
`))}},sq=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},cq=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},lq=0,uq=class{constructor(e){this.value=e,this.id=lq++}},dq=2,fq=class{constructor(e){this._size=0,this._options=e,this._leakageMon=rq>0||this._options?.leakWarningThreshold?new aq(e?.onListenerError??wK,this._options?.leakWarningThreshold??rq):void 0,this._perfMon=this._options?._profName?new nq(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,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new cq(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||wK)(n),KK.None}if(this._disposed)return KK.None;t&&(e=e.bind(t));let r=new uq(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=oq.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof uq?(this._deliveryQueue??=new pq,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=UK(()=>{i?.(),this._removeListener(r)});return n instanceof GK?n.add(a):Array.isArray(n)&&n.push(a),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*dq<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||wK;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[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 uq)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},pq=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},mq=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new fq,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new fq,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};mq.INSTANCE=new mq;var hq=mq;function gq(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}hq.INSTANCE.onDidChangeZoomLevel;function _q(e){return hq.INSTANCE.getZoomFactor(e)}hq.INSTANCE.onDidChangeFullscreen;var vq=typeof navigator==`object`?navigator.userAgent:``,yq=vq.indexOf(`Firefox`)>=0,bq=vq.indexOf(`AppleWebKit`)>=0,xq=vq.indexOf(`Chrome`)>=0,Sq=!xq&&vq.indexOf(`Safari`)>=0;vq.indexOf(`Electron/`),vq.indexOf(`Android`);var Cq=!1;if(typeof JK.matchMedia==`function`){let e=JK.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=JK.matchMedia(`(display-mode: fullscreen)`);Cq=e.matches,gq(JK,e,({matches:e})=>{Cq&&t.matches||(Cq=e)})}function wq(){return Cq}var Tq=`en`,Eq=!1,Dq=!1,Oq=!1,kq=!1,Aq=!1,jq=Tq,Mq,Nq=globalThis,Pq;typeof Nq.vscode<`u`&&typeof Nq.vscode.process<`u`?Pq=Nq.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(Pq=process);var Fq=typeof Pq?.versions?.electron==`string`&&Pq?.type===`renderer`;if(typeof Pq==`object`){Eq=Pq.platform===`win32`,Dq=Pq.platform===`darwin`,Oq=Pq.platform===`linux`,Oq&&Pq.env.SNAP&&Pq.env.SNAP_REVISION,Pq.env.CI||Pq.env.BUILD_ARTIFACTSTAGINGDIRECTORY,jq=Tq;let e=Pq.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,jq=t.resolvedLanguage||Tq,t.languagePack?.translationsConfigFile}catch{}kq=!0}else typeof navigator==`object`&&!Fq?(Mq=navigator.userAgent,Eq=Mq.indexOf(`Windows`)>=0,Dq=Mq.indexOf(`Macintosh`)>=0,(Mq.indexOf(`Macintosh`)>=0||Mq.indexOf(`iPad`)>=0||Mq.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,Oq=Mq.indexOf(`Linux`)>=0,Mq?.indexOf(`Mobi`),Aq=!0,jq=globalThis._VSCODE_NLS_LANGUAGE||Tq,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var Iq=Eq,Lq=Dq,Rq=Oq,zq=kq;Aq&&typeof Nq.importScripts==`function`&&Nq.origin;var Bq=Mq,Vq=jq,Hq;(e=>{function t(){return Vq}e.value=t;function n(){return Vq.length===2?Vq===`en`:Vq.length>=3&&Vq[0]===`e`&&Vq[1]===`n`&&Vq[2]===`-`}e.isDefaultVariant=n;function r(){return Vq===`en`}e.isDefault=r})(Hq||={});var Uq=typeof Nq.postMessage==`function`&&!Nq.importScripts;(()=>{if(Uq){let e=[];Nq.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Nq.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var Wq=!!(Bq&&Bq.indexOf(`Chrome`)>=0);Bq&&Bq.indexOf(`Firefox`),!Wq&&Bq&&Bq.indexOf(`Safari`),Bq&&Bq.indexOf(`Edg/`),Bq&&Bq.indexOf(`Android`);var Gq=typeof navigator==`object`?navigator:{};zq||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||Gq&&Gq.clipboard&&Gq.clipboard.writeText,zq||Gq&&Gq.clipboard&&Gq.clipboard.readText,zq||wq()||Gq.keyboard,`ontouchstart`in JK||Gq.maxTouchPoints,JK.PointerEvent&&(`ontouchstart`in JK||navigator.maxTouchPoints);var Kq=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},qq=new Kq,Jq=new Kq,Yq=new Kq,Xq=Array(230),Zq;(e=>{function t(e){return qq.keyCodeToStr(e)}e.toString=t;function n(e){return qq.strToKeyCode(e)}e.fromString=n;function r(e){return Jq.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return Yq.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return Jq.strToKeyCode(e)||Yq.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return qq.keyCodeToStr(e)}e.toElectronAccelerator=o})(Zq||={});var Qq=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new $q([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},$q=class{constructor(e){if(e.length===0)throw OK(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=`;`),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function eJ(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return Zq.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(yq)switch(t){case 59:return 85;case 60:if(Rq)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Lq)return 57}else if(bq&&(Lq&&t===93||!Lq&&t===92))return 57;return Xq[t]||0}var tJ=Lq?256:2048,nJ=512,rJ=1024,iJ=Lq?2048:256,aJ=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.(`AltGraph`),this.keyCode=eJ(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,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;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=tJ),this.altKey&&(t|=nJ),this.shiftKey&&(t|=rJ),this.metaKey&&(t|=iJ),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Qq(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},oJ=new WeakMap;function sJ(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!==`null`&&n.origin!==`null`&&t.origin!==n.origin)return null}catch{return null}return e.parent}var cJ=class{static getSameOriginWindowChain(e){let t=oJ.get(e);if(!t){t=[],oJ.set(e,t);let n=e,r;do r=sJ(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let e of i){let i=e.window.deref();if(n+=i?.scrollY??0,r+=i?.scrollX??0,i===t||!e.iframeElement)break;let a=e.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},lJ=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type===`dblclick`&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX==`number`?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=cJ.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},uJ=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(xq){let e=navigator.userAgent.match(/Chrome\/(\d+)/);r=(e?parseInt(e[1]):123)<=122}if(e){let t=e,n=e,i=e.view?.devicePixelRatio||1;if(typeof t.wheelDeltaY<`u`)this.deltaY=r?t.wheelDeltaY/(120*i):t.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<`u`&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(e.type===`wheel`){let t=e;this.deltaY=t.deltaMode===t.DOM_DELTA_LINE?yq&&!Lq?-e.deltaY/3:-e.deltaY:-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)this.deltaX=Sq&&Iq?-(t.wheelDeltaX/120):r?t.wheelDeltaX/(120*i):t.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<`u`&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type===`wheel`){let t=e;this.deltaX=t.deltaMode===t.DOM_DELTA_LINE?yq&&!Lq?-e.deltaX/3:-e.deltaX:-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(this.deltaY=r?e.wheelDelta/(120*i):e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},dJ=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),fJ;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof pJ?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:eq.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:dJ})})(fJ||={});var pJ=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?dJ:(this._emitter||=new fq,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},mJ=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e==`function`&&typeof t==`number`&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new AK(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new AK(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},hJ=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new AK(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=UK(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var gJ;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(gJ||={});var _J=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new fq,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await eq.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};_J.EMPTY=_J.fromArray([]);function vJ(e){return yJ(e,0)}function yJ(e,t){switch(typeof e){case`object`:return e===null?bJ(349,t):Array.isArray(e)?CJ(e,t):wJ(e,t);case`string`:return SJ(e,t);case`boolean`:return xJ(e,t);case`number`:return bJ(e,t);case`undefined`:return bJ(937,t);default:return bJ(617,t)}}function bJ(e,t){return(t<<5)-t+e|0}function xJ(e,t){return bJ(e?433:863,t)}function SJ(e,t){t=bJ(149417,t);for(let n=0,r=e.length;n<r;n++)t=bJ(e.charCodeAt(n),t);return t}function CJ(e,t){return t=bJ(104579,t),e.reduce((e,t)=>yJ(t,e),t)}function wJ(e,t){return t=bJ(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=SJ(n,t),yJ(e[n],t)),t)}var{registerWindow:TJ,getWindow:EJ,getDocument:DJ,getWindows:OJ,getWindowsCount:kJ,getWindowId:AJ,getWindowById:jJ,hasWindow:MJ,onDidRegisterWindow:NJ,onWillUnregisterWindow:PJ,onDidUnregisterWindow:FJ}=function(){let e=new Map,t={window:JK,disposables:new GK};e.set(JK.vscodeWindowId,t);let n=new fq,r=new fq,i=new fq;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return KK.None;let a=new GK,o={window:t,disposables:a.add(new GK)};return e.set(t.vscodeWindowId,o),a.add(UK(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(LJ(t,KJ.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:JK},getDocument(e){return EJ(e).document}}}(),IJ=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function LJ(e,t,n,r){return new IJ(e,t,n,r)}function RJ(e,t){return function(n){return t(new lJ(e,n))}}function zJ(e){return function(t){return e(new aJ(t))}}var BJ=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=RJ(EJ(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=zJ(n)),LJ(e,t,i,r)},VJ,HJ=class extends hJ{constructor(e){super(),this.defaultTarget=e&&EJ(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},UJ=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){wK(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(UJ.sort),a.shift().execute();r.set(i,!1)};VJ=(t,r,a=0)=>{let o=AJ(t),s=new UJ(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})();var WJ=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};WJ.None=new WJ(0,0);function GJ(e){let t=e.getBoundingClientRect(),n=EJ(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=vJ(n),a=r.get(i);if(a)a.users+=1;else{let o=new fq,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(UK(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var KJ={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:bq?`webkitAnimationStart`:`animationstart`,ANIMATION_END:bq?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:bq?`webkitAnimationIteration`:`animationiteration`},qJ=class{constructor(e){this.domNode=e,this._maxWidth=``,this._width=``,this._height=``,this._top=``,this._left=``,this._bottom=``,this._right=``,this._paddingTop=``,this._paddingLeft=``,this._paddingBottom=``,this._paddingRight=``,this._fontFamily=``,this._fontWeight=``,this._fontSize=``,this._fontStyle=``,this._fontFeatureSettings=``,this._fontVariationSettings=``,this._textDecoration=``,this._lineHeight=``,this._letterSpacing=``,this._className=``,this._display=``,this._position=``,this._visibility=``,this._color=``,this._backgroundColor=``,this._layerHint=!1,this._contain=`none`,this._boxShadow=``}setMaxWidth(e){let t=JJ(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=JJ(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=JJ(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=JJ(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=JJ(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=JJ(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=JJ(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=JJ(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=JJ(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=JJ(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=JJ(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=JJ(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=JJ(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=JJ(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?`translate3d(0px, 0px, 0px)`:``)}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function JJ(e){return typeof e==`number`?`${e}px`:e}function YJ(e){return new qJ(e)}var XJ=class{constructor(){this._hooks=new GK,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add(UK(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=EJ(e)}this._hooks.add(LJ(a,KJ.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(LJ(a,KJ.POINTER_UP,e=>this.stopMonitoring(!0)))}};function ZJ(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}var QJ;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(QJ||={});var $J=class e extends KK{constructor(){super(),this.dispatched=!1,this.targets=new ZK,this.ignoreTargets=new ZK,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(eq.runAndSubscribe(NJ,({window:e,disposables:t})=>{t.add(LJ(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(LJ(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(LJ(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:JK,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=BK(new e),UK(e.INSTANCE.targets.push(t))):KK.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=BK(new e),UK(e.INSTANCE.ignoreTargets.push(t))):KK.None}static isTouchDevice(){return`ontouchstart`in JK||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n<r;n++){let r=e.targetTouches.item(n);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let i=this.newGestureEvent(QJ.Start,r.target);i.pageX=r.pageX,i.pageY=r.pageY,this.dispatchEvent(i)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let a=0,o=n.changedTouches.length;a<o;a++){let o=n.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn(`move of an UNKNOWN touch`,o);continue}let s=this.activeTouches[o.identifier],c=Date.now()-s.initialTimeStamp;if(c<e.HOLD_DELAY&&Math.abs(s.initialPageX-jK(s.rollingPageX))<30&&Math.abs(s.initialPageY-jK(s.rollingPageY))<30){let e=this.newGestureEvent(QJ.Tap,s.initialTarget);e.pageX=jK(s.rollingPageX),e.pageY=jK(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-jK(s.rollingPageX))<30&&Math.abs(s.initialPageY-jK(s.rollingPageY))<30){let e=this.newGestureEvent(QJ.Contextmenu,s.initialTarget);e.pageX=jK(s.rollingPageX),e.pageY=jK(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=jK(s.rollingPageX),n=jK(s.rollingPageY),i=jK(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(QJ.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===QJ.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===QJ.Change||t.type===QJ.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=VJ(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(QJ.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n<r;n++){let r=e.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn(`end of an UNKNOWN touch`,r);continue}let i=this.activeTouches[r.identifier],a=this.newGestureEvent(QJ.Change,i.initialTarget);a.translationX=r.pageX-jK(i.rollingPageX),a.translationY=r.pageY-jK(i.rollingPageY),a.pageX=r.pageX,a.pageY=r.pageY,this.dispatchEvent(a),i.rollingPageX.length>3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}};$J.SCROLL_FRICTION=-.005,$J.HOLD_DELAY=700,$J.CLEAR_TAP_COUNT_TIME=400,kG([ZJ],$J,`isTouchDevice`,1);var eY=$J,tY=class extends KK{onclick(e,t){this._register(LJ(e,KJ.CLICK,n=>t(new lJ(EJ(e),n))))}onmousedown(e,t){this._register(LJ(e,KJ.MOUSE_DOWN,n=>t(new lJ(EJ(e),n))))}onmouseover(e,t){this._register(LJ(e,KJ.MOUSE_OVER,n=>t(new lJ(EJ(e),n))))}onmouseleave(e,t){this._register(LJ(e,KJ.MOUSE_LEAVE,n=>t(new lJ(EJ(e),n))))}onkeydown(e,t){this._register(LJ(e,KJ.KEY_DOWN,e=>t(new aJ(e))))}onkeyup(e,t){this._register(LJ(e,KJ.KEY_UP,e=>t(new aJ(e))))}oninput(e,t){this._register(LJ(e,KJ.INPUT,t))}onblur(e,t){this._register(LJ(e,KJ.BLUR,t))}onfocus(e,t){this._register(LJ(e,KJ.FOCUS,t))}onchange(e,t){this._register(LJ(e,KJ.CHANGE,t))}ignoreGesture(e){return eY.ignoreTarget(e)}},nY=11,rY=class extends tY{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement(`div`),this.bgDomNode.className=`arrow-background`,this.bgDomNode.style.position=`absolute`,this.bgDomNode.style.width=e.bgWidth+`px`,this.bgDomNode.style.height=e.bgHeight+`px`,typeof e.top<`u`&&(this.bgDomNode.style.top=`0px`),typeof e.left<`u`&&(this.bgDomNode.style.left=`0px`),typeof e.bottom<`u`&&(this.bgDomNode.style.bottom=`0px`),typeof e.right<`u`&&(this.bgDomNode.style.right=`0px`),this.domNode=document.createElement(`div`),this.domNode.className=e.className,this.domNode.style.position=`absolute`,this.domNode.style.width=nY+`px`,this.domNode.style.height=nY+`px`,typeof e.top<`u`&&(this.domNode.style.top=e.top+`px`),typeof e.left<`u`&&(this.domNode.style.left=e.left+`px`),typeof e.bottom<`u`&&(this.domNode.style.bottom=e.bottom+`px`),typeof e.right<`u`&&(this.domNode.style.right=e.right+`px`),this._pointerMoveMonitor=this._register(new XJ),this._register(BJ(this.bgDomNode,KJ.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(BJ(this.domNode,KJ.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new HJ),this._pointerdownScheduleRepeatTimer=this._register(new mJ)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,EJ(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},iY=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<`u`?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<`u`?t.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},aY=class extends KK{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new fq),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new iY(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>`u`?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>`u`?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new lY(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=lY.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},oY=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function sY(e,t){let n=t-e;return function(t){return e+n*dY(t)}}function cY(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var lY=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.duration=r,this.startTime=n,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,t,n){if(Math.abs(e-t)>2.5*n){let r,i;return e<t?(r=e+.75*n,i=t-.75*n):(r=e-.75*n,i=t+.75*n),cY(sY(e,r),sY(i,t),.33)}return sY(e,t)}dispose(){this.animationFrameDisposable!==null&&(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 t=(e-this.startTime)/this.duration;return t<1?new oY(this.scrollLeft(t),this.scrollTop(t),!1):new oY(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return e.start(t,n,r)}static start(t,n,r){r+=10;let i=Date.now()-10;return new e(t,n,i,r)}};function uY(e){return e**3}function dY(e){return 1-uY(1-e)}var fY=class extends KK{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new mJ)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3||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(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_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`:``)))}},pY=140,mY=class extends tY{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 fY(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new XJ),this._shouldRender=!0,this.domNode=YJ(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(LJ(this.domNode.domNode,KJ.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new rY(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=YJ(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register(LJ(this.slider.domNode,KJ.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=GJ(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if(Iq&&a>pY){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName(`active`,!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},hY=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},gY=class extends mY{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new hY(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:`horizontal`,scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),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,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},_Y=class extends mY{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new hY(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:`vertical`,scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),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,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},vY=500,yY=50,bY=!0,xY=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},SY=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,t=0,n=1,r=this._rear;do{let i=r===this._front?e:2**-n;if(e-=i,t+=this._memory[r].score*i,r===this._front)break;r=(this._capacity+r-1)%this._capacity,n++}while(!0);return t<=.5}acceptStandardWheelEvent(e){if(xq){let t=_q(EJ(e.browserEvent));this.accept(Date.now(),e.deltaX*t,e.deltaY*t)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,n){let r=null,i=new xY(e,t,n);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(r=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]=i),i.score=this._computeScore(i,r)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};SY.INSTANCE=new SY;var CY=SY,wY=class extends tY{constructor(e,t,n){super(),this._onScroll=this._register(new fq),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new fq),this.onWillScroll=this._onWillScroll.event,this._options=EY(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new _Y(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new gY(this._scrollable,this._options,r)),this._domNode=document.createElement(`div`),this._domNode.className=`xterm-scrollable-element `+this._options.className,this._domNode.setAttribute(`role`,`presentation`),this._domNode.style.position=`relative`,this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=YJ(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=YJ(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=YJ(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 mJ),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=VK(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,Lq&&(this._options.className+=` mac`),this._domNode.className=`xterm-scrollable-element `+this._options.className}updateOptions(e){typeof e.handleMouseWheel<`u`&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<`u`&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<`u`&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<`u`&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<`u`&&(this._options.horizontal=e.horizontal),typeof e.vertical<`u`&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<`u`&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<`u`&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<`u`&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new uJ(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=VK(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(LJ(this._listenOnDomNode,KJ.MOUSE_WHEEL,e=>{this._onMouseWheel(new uJ(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=CY.INSTANCE;bY&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!Lq&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=yY*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=yY*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(bY&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),vY)}},TY=class extends wY{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function EY(e){let t={lazyRender:typeof e.lazyRender<`u`&&e.lazyRender,className:typeof e.className<`u`?e.className:``,useShadows:typeof e.useShadows<`u`?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<`u`?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<`u`&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`&&e.alwaysConsumeMouseWheel,scrollYToX:typeof e.scrollYToX<`u`&&e.scrollYToX,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<`u`?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<`u`?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<`u`?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<`u`?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<`u`?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<`u`?e.listenOnDomNode:null,horizontal:typeof e.horizontal<`u`?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<`u`?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<`u`&&e.horizontalHasArrows,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`&&e.verticalHasArrows,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`&&e.scrollByPage};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,Lq&&(t.className+=` mac`),t}var DY=class extends KK{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new fq),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new aY({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>VJ(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new TY(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(eq.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(UK(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(UK(()=>this._styleElement.remove())),this._register(eq.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.colors.scrollbarSliderActiveBackground.css};`,`}`].join(`
|
|
349
|
+
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};DY=kG([AG(2,rK),AG(3,gK),AG(4,iK),AG(5,xK),AG(6,lK),AG(7,vK)],DY);var OY=class extends KK{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(UK(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:``:t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};OY=kG([AG(1,rK),AG(2,gK),AG(3,fK),AG(4,vK)],OY);var kY=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<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,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},AY={full:0,left:0,center:0,right:0},jY={full:0,left:0,center:0,right:0},MY={full:0,left:0,center:0,right:0},NY=class extends KK{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new kY,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(UK(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw Error(`Ctx cannot be null`);this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange(`overviewRuler`,()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);jY.full=this._canvas.width,jY.left=e,jY.center=t,jY.right=e,this._refreshDrawHeightConstants(),MY.full=1,MY.left=1,MY.center=1+jY.left,MY.right=1+jY.left+jY.center}_refreshDrawHeightConstants(){AY.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);AY.left=t,AY.center=t,AY.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*AY.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*AY.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*AY.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*AY.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(MY[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-AY[e.position||`full`]/2),jY[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+AY[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};NY=kG([AG(2,rK),AG(3,fK),AG(4,vK),AG(5,lK),AG(6,xK),AG(7,gK)],NY);var $;(e=>(e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=`
|
|
350
|
+
`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))($||={});var PY;(e=>(e.PAD=``,e.HOP=``,e.BPH=``,e.NBH=``,e.IND=``,e.NEL=`
`,e.SSA=``,e.ESA=``,e.HTS=``,e.HTJ=``,e.VTS=``,e.PLD=``,e.PLU=``,e.RI=``,e.SS2=``,e.SS3=``,e.DCS=``,e.PU1=``,e.PU2=``,e.STS=``,e.CCH=``,e.MW=``,e.SPA=``,e.EPA=``,e.SOS=``,e.SGCI=``,e.SCI=``,e.CSI=``,e.ST=``,e.OSC=``,e.PM=``,e.APC=``))(PY||={});var FY;(e=>e.ST=`${$.ESC}\\`)(FY||={});var IY=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${$.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};IY=kG([AG(2,rK),AG(3,lK),AG(4,aK),AG(5,vK)],IY);var LY=0,RY=0,zY=0,BY=0,VY={css:`#00000000`,rgba:0},HY;(e=>{function t(e,t,n,r){return r===void 0?`#${qY(e)}${qY(t)}${qY(n)}`:`#${qY(e)}${qY(t)}${qY(n)}${qY(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(HY||={});var UY;(e=>{function t(e,t){if(BY=(t.rgba&255)/255,BY===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return LY=a+Math.round((n-a)*BY),RY=o+Math.round((r-o)*BY),zY=s+Math.round((i-s)*BY),{css:HY.toCss(LY,RY,zY),rgba:HY.toRgba(LY,RY,zY)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=KY.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return HY.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[LY,RY,zY]=KY.toChannels(t),{css:HY.toCss(LY,RY,zY),rgba:t}}e.opaque=i;function a(e,t){return BY=Math.round(t*255),[LY,RY,zY]=KY.toChannels(e.rgba),{css:HY.toCss(LY,RY,zY,BY),rgba:HY.toRgba(LY,RY,zY,BY)}}e.opacity=a;function o(e,t){return BY=e.rgba&255,a(e,BY*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(UY||={});var WY;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return LY=parseInt(e.slice(1,2).repeat(2),16),RY=parseInt(e.slice(2,3).repeat(2),16),zY=parseInt(e.slice(3,4).repeat(2),16),HY.toColor(LY,RY,zY);case 5:return LY=parseInt(e.slice(1,2).repeat(2),16),RY=parseInt(e.slice(2,3).repeat(2),16),zY=parseInt(e.slice(3,4).repeat(2),16),BY=parseInt(e.slice(4,5).repeat(2),16),HY.toColor(LY,RY,zY,BY);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return LY=parseInt(r[1]),RY=parseInt(r[2]),zY=parseInt(r[3]),BY=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),HY.toColor(LY,RY,zY,BY);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[LY,RY,zY,BY]=t.getImageData(0,0,1,1).data,BY!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:HY.toRgba(LY,RY,zY,BY),css:e}}e.toColor=r})(WY||={});var GY;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(GY||={});var KY;(e=>{function t(e,t){if(BY=(t&255)/255,BY===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return LY=a+Math.round((n-a)*BY),RY=o+Math.round((r-o)*BY),zY=s+Math.round((i-s)*BY),HY.toRgba(LY,RY,zY)}e.blend=t;function n(e,t,n){let a=GY.relativeLuminance(e>>8),o=GY.relativeLuminance(t>>8);if(JY(a,o)<n){if(o<a){let o=r(e,t,n),s=JY(a,GY.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>JY(a,GY.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=JY(a,GY.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>JY(a,GY.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=JY(GY.relativeLuminance2(o,s,c),GY.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=JY(GY.relativeLuminance2(o,s,c),GY.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=JY(GY.relativeLuminance2(o,s,c),GY.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=JY(GY.relativeLuminance2(o,s,c),GY.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(KY||={});function qY(e){let t=e.toString(16);return t.length<2?`0`+t:t}function JY(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var YY=class extends JG{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},XY=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new XG}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,o=0,s=t.getFg(0),c=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==s||this._workCell.bg!==c){if(e-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,o=a,s=this._workCell.fg,c=this._workCell.bg}a+=this._workCell.getChars().length||qG.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(e,t,n,r,i){let a=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(a)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let t=this._characterJoiners[e].handler(a);for(let e=0;e<t.length;e++)XY._mergeRanges(o,t[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,o=e[r];if(o){for(let s=n;s<this._bufferService.cols;s++){let n=t.getWidth(s),c=t.getString(s).length||qG.length;if(n!==0){if(!i&&o[0]<=a&&(o[0]=s,i=!0),o[1]<=a){if(o[1]=s,o=e[++r],!o)break;o[0]<=a?(o[0]=s,i=!0):i=!1}a+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};XY=kG([AG(0,rK)],XY);function ZY(e){return 57508<=e&&e<=57558}function QY(e){return 9472<=e&&e<=9631}function $Y(e){return ZY(e)||QY(e)}function eX(){return{css:{canvas:tX(),cell:tX()},device:{canvas:tX(),cell:tX(),char:{width:0,height:0,left:0,top:0}}}}function tX(){return{width:0,height:0}}var nX=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new XG,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,a,o,s,c,l,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<a+1&&(m=a+1);let h,g=0,_=``,v=0,y=0,b=0,x=0,S=!1,C=0,w=!1,T=0,E=0,D=[],O=l!==-1&&u!==-1;for(let k=0;k<m;k++){e.loadCell(k,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let A=!1,j=k>=E,M=k,N=this._workCell;if(f.length>0&&k===f[0][0]&&j){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)j&&=i===this._isCellInSelection(v,t);j&&=!n||a<r[0]||a>=r[1],j?(A=!0,N=new YY(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),M=r[1]-1,m=N.getWidth()):E=r[1]}let P=this._isCellInSelection(k,t),F=n&&k===a,I=O&&k>=l&&k<=u,L=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{L=!0});let R=N.getChars()||qG;if(R===` `&&(N.isUnderline()||N.isOverline())&&(R=`\xA0`),T=m*s-c.get(R,N.isBold(),N.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(P&&w||!P&&!w&&N.bg===y)&&(P&&w&&p.selectionForeground||N.fg===b)&&N.extended.ext===x&&I===S&&T===C&&!F&&!A&&!L&&j){N.isInvisible()?_+=qG:_+=R,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=N.bg,b=N.fg,x=N.extended.ext,S=I,C=T,w=P,A&&a>=k&&a<=M&&(a=k),!this._coreService.isCursorHidden&&F&&this._coreService.isCursorInitialized){if(D.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&D.push(`xterm-cursor-blink`),D.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:D.push(`xterm-cursor-outline`);break;case`block`:D.push(`xterm-cursor-block`);break;case`bar`:D.push(`xterm-cursor-bar`);break;case`underline`:D.push(`xterm-cursor-underline`)}}if(N.isBold()&&D.push(`xterm-bold`),N.isItalic()&&D.push(`xterm-italic`),N.isDim()&&D.push(`xterm-dim`),_=N.isInvisible()?qG:N.getChars()||qG,N.isUnderline()&&(D.push(`xterm-underline-${N.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!N.isUnderlineColorDefault())){if(N.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${JG.toColorRGB(N.getUnderlineColor()).join(`,`)})`;else{let e=N.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&N.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}}N.isOverline()&&(D.push(`xterm-overline`),_===` `&&(_=`\xA0`)),N.isStrikethrough()&&D.push(`xterm-strikethrough`),I&&(h.style.textDecoration=`underline`);let z=N.getFgColor(),B=N.getFgColorMode(),V=N.getBgColor(),H=N.getBgColorMode(),U=!!N.isInverse();if(U){let e=z;z=V,V=e;let t=B;B=H,H=t}let W,G,ee=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{e.options.layer!==`top`&&ee||(e.backgroundColorRGB&&(H=50331648,V=e.backgroundColorRGB.rgba>>8&16777215,W=e.backgroundColorRGB),e.foregroundColorRGB&&(B=50331648,z=e.foregroundColorRGB.rgba>>8&16777215,G=e.foregroundColorRGB),ee=e.options.layer===`top`)}),!ee&&P&&(W=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,V=W.rgba>>8&16777215,H=50331648,ee=!0,p.selectionForeground&&(B=50331648,z=p.selectionForeground.rgba>>8&16777215,G=p.selectionForeground)),ee&&D.push(`xterm-decoration-top`);let K;switch(H){case 16777216:case 33554432:K=p.ansi[V],D.push(`xterm-bg-${V}`);break;case 50331648:K=HY.toColor(V>>16,V>>8&255,V&255),this._addStyle(h,`background-color:#${rX((V>>>0).toString(16),`0`,6)}`);break;default:U?(K=p.foreground,D.push(`xterm-bg-257`)):K=p.background}switch(W||N.isDim()&&(W=UY.multiplyOpacity(K,.5)),B){case 16777216:case 33554432:N.isBold()&&z<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(z+=8),this._applyMinimumContrast(h,K,p.ansi[z],N,W,void 0)||D.push(`xterm-fg-${z}`);break;case 50331648:let e=HY.toColor(z>>16&255,z>>8&255,z&255);this._applyMinimumContrast(h,K,e,N,W,G)||this._addStyle(h,`color:#${rX(z.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,K,p.foreground,N,W,G)||U&&D.push(`xterm-fg-257`)}D.length&&=(h.className=D.join(` `),0),!F&&!A&&!L&&j?g++:h.textContent=_,T!==this.defaultSpacing&&(h.style.letterSpacing=`${T}px`),d.push(h),k=M}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||$Y(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=UY.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};nX=kG([AG(1,bK),AG(2,lK),AG(3,gK),AG(4,aK),AG(5,fK),AG(6,xK)],nX);function rX(e,t,n){for(;e.length<n;)e=t+e;return e}var iX=class{constructor(e,t){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 n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.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,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},aX=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function oX(){return new aX}var sX=`xterm-dom-renderer-owner-`,cX=`xterm-rows`,lX=`xterm-fg-`,uX=`xterm-bg-`,dX=`xterm-focus`,fX=`xterm-selection`,pX=1,mX=class extends KK{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=pX++,this._rowElements=[],this._selectionRenderModel=oX(),this.onRequestRedraw=this._register(new fq).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(cX),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(fX),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=eX(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(nX,document),this._element.classList.add(sX+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(UK(()=>{this._element.classList.remove(sX+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new iX(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${cX} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${cX} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${cX} .xterm-dim { color: ${UY.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${cX}.${dX} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${cX}.${dX} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${cX}.${dX} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${cX} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${cX} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${cX} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${cX} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${cX} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${fX} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${fX} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${fX} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${lX}${n} { color: ${r.css}; }${this._terminalSelector} .${lX}${n}.xterm-dim { color: ${UY.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${uX}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${lX}257 { color: ${UY.opaque(e.background).css}; }${this._terminalSelector} .${lX}257.xterm-dim { color: ${UY.multiplyOpacity(UY.opaque(e.background),.5).css}; }${this._terminalSelector} .${uX}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(dX),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(dX),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${sX}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};mX=kG([AG(7,sK),AG(8,hK),AG(9,lK),AG(10,rK),AG(11,aK),AG(12,gK),AG(13,xK)],mX);var hX=class extends KK{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new fq),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new vX(this._optionsService))}catch{this._measureStrategy=this._register(new _X(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};hX=kG([AG(2,lK)],hX);var gX=class extends KK{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},_X=class extends gX{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},vX=class extends gX{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},yX=class extends KK{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new bX(this._window)),this._onDprChange=this._register(new fq),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new fq),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(eq.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(LJ(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(LJ(this._textarea,`blur`,()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},bX=class extends KK{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new qK),this._onDprChange=this._register(new fq),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(UK(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=LJ(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)}},xX=class extends KK{constructor(){super(),this.linkProviders=[],this._register(UK(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function SX(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function CX(e,t,n,r,i,a,o,s,c){if(!a)return;let l=SX(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+ +!!c),l[1]=Math.min(Math.max(l[1],1),i),l}var wX=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return CX(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=SX(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};wX=kG([AG(0,vK),AG(1,hK)],wX);var TX=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},EX={};OG(EX,{getSafariVersion:()=>NX,isChromeOS:()=>zX,isFirefox:()=>AX,isIpad:()=>FX,isIphone:()=>IX,isLegacyEdge:()=>jX,isLinux:()=>RX,isMac:()=>PX,isNode:()=>DX,isSafari:()=>MX,isWindows:()=>LX});var DX=typeof process<`u`&&`title`in process,OX=DX?`node`:navigator.userAgent,kX=DX?`node`:navigator.platform,AX=OX.includes(`Firefox`),jX=OX.includes(`Edge`),MX=/^((?!chrome|android).)*safari/i.test(OX);function NX(){if(!MX)return 0;let e=OX.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var PX=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(kX),FX=kX===`iPad`,IX=kX===`iPhone`,LX=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(kX),RX=kX.indexOf(`Linux`)>=0,zX=/\bCrOS\b/.test(OX),BX=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),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},VX=class extends BX{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},HX=class extends BX{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},UX=!DX&&`requestIdleCallback`in window?HX:VX,WX=class{constructor(){this._queue=new UX}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},GX=class extends KK{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new qK),this._pausedResizeTask=new WX,this._observerDisposable=this._register(new qK),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 fq),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new fq),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new fq),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new fq),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new TX((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new KX(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(UK(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=UK(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};GX=kG([AG(2,lK),AG(3,hK),AG(4,aK),AG(5,fK),AG(6,rK),AG(7,gK),AG(8,xK)],GX);var KX=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function qX(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return XX(i,a,e,t,n,r)+ZX(a,t,n,r)+QX(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,aZ(Math.abs(i-e),iZ(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return aZ(YX(a>t?e:i,n)+(s-1)*n.cols+1+JX(a>t?i:e,n),iZ(o,r))}function JX(e,t){return e-1}function YX(e,t){return t.cols-e}function XX(e,t,n,r,i,a){return ZX(t,r,i,a).length===0?``:aZ(rZ(e,t,e,t-eZ(t,i),!1,i).length,iZ(`D`,a))}function ZX(e,t,n,r){let i=e-eZ(e,n),a=t-eZ(t,n);return aZ(Math.abs(i-a)-$X(e,t,n),iZ(nZ(e,t),r))}function QX(e,t,n,r,i,a){let o;o=ZX(t,r,i,a).length>0?r-eZ(r,i):t;let s=r,c=tZ(e,t,n,r,i,a);return aZ(rZ(e,o,n,s,c===`C`,i).length,iZ(c,a))}function $X(e,t,n){let r=0,i=e-eZ(e,n),a=t-eZ(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=nZ(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function eZ(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function tZ(e,t,n,r,i,a){let o;return o=ZX(n,r,i,a).length>0?r-eZ(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function nZ(e,t){return e>t?`A`:`B`}function rZ(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&s<a.buffer.lines.length;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function iZ(e,t){let n=t?`O`:`[`;return $.ESC+n+e}function aZ(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var oZ=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.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,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function sZ(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var cZ=50,lZ=15,uZ=50,dZ=500,fZ=RegExp(`\xA0`,`g`),pZ=class extends KK{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new XG,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new fq),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new fq),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new fq),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new fq),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 oZ(this._bufferService),this._activeSelectionMode=0,this._register(UK(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map(e=>e.replace(fZ,` `)).join(LX?`\r
|
|
351
351
|
`:`
|
|
352
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),PX&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=rZ(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=vX(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-iZ),iZ),t/=iZ,t/Math.abs(t)+Math.round(t*(aZ-1)))}shouldForceSelection(e){return AX?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),oZ)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(AX&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&e.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[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?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<sZ&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=UX(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c<o.length&&o.charAt(c+1)===` `;)c++}else{let t=e[0],n=e[0];a.getWidth(t)===0&&(u++,t--),a.getWidth(n)===2&&(d++,n++);let r=a.getString(n).length;for(r>1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n<a.length&&c+1<o.length&&!this._isCharWordSeparator(a.loadCell(n+1,this._workCell));){a.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,n++):e>1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(!(!t&&o.slice(s,c).trim()===``)){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=rZ(n,this._bufferService.cols)}};lZ=TG([EG(3,$G),EG(4,tK),EG(5,pK),EG(6,aK),EG(7,mK),EG(8,fK)],lZ);var uZ=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},dZ=class{constructor(){this._color=new uZ,this._css=new uZ}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},fZ=Object.freeze((()=>{let e=[BY.toColor(`#2e3436`),BY.toColor(`#cc0000`),BY.toColor(`#4e9a06`),BY.toColor(`#c4a000`),BY.toColor(`#3465a4`),BY.toColor(`#75507b`),BY.toColor(`#06989a`),BY.toColor(`#d3d7cf`),BY.toColor(`#555753`),BY.toColor(`#ef2929`),BY.toColor(`#8ae234`),BY.toColor(`#fce94f`),BY.toColor(`#729fcf`),BY.toColor(`#ad7fa8`),BY.toColor(`#34e2e2`),BY.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:RY.toCss(r,i,a),rgba:RY.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:RY.toCss(n,n,n),rgba:RY.toRgba(n,n,n)})}return e})()),pZ=BY.toColor(`#ffffff`),mZ=BY.toColor(`#000000`),hZ=BY.toColor(`#ffffff`),gZ=mZ,_Z={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},vZ=pZ,yZ=class extends HK{constructor(e){super(),this._optionsService=e,this._contrastCache=new dZ,this._halfContrastCache=new dZ,this._onChangeColors=this._register(new cq),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:pZ,background:mZ,cursor:hZ,cursorAccent:gZ,selectionForeground:void 0,selectionBackgroundTransparent:_Z,selectionBackgroundOpaque:zY.blend(mZ,_Z),selectionInactiveBackgroundTransparent:_Z,selectionInactiveBackgroundOpaque:zY.blend(mZ,_Z),scrollbarSliderBackground:zY.opacity(pZ,.2),scrollbarSliderHoverBackground:zY.opacity(pZ,.4),scrollbarSliderActiveBackground:zY.opacity(pZ,.5),overviewRulerBorder:pZ,ansi:fZ.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange(`minimumContrastRatio`,()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange(`theme`,()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=bZ(e.foreground,pZ),t.background=bZ(e.background,mZ),t.cursor=zY.blend(t.background,bZ(e.cursor,hZ)),t.cursorAccent=zY.blend(t.background,bZ(e.cursorAccent,gZ)),t.selectionBackgroundTransparent=bZ(e.selectionBackground,_Z),t.selectionBackgroundOpaque=zY.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=bZ(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=zY.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?bZ(e.selectionForeground,LY):void 0,t.selectionForeground===LY&&(t.selectionForeground=void 0),zY.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=zY.opacity(t.selectionBackgroundTransparent,.3)),zY.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=zY.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=bZ(e.scrollbarSliderBackground,zY.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=bZ(e.scrollbarSliderHoverBackground,zY.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=bZ(e.scrollbarSliderActiveBackground,zY.opacity(t.foreground,.5)),t.overviewRulerBorder=bZ(e.overviewRulerBorder,vZ),t.ansi=fZ.slice(),t.ansi[0]=bZ(e.black,fZ[0]),t.ansi[1]=bZ(e.red,fZ[1]),t.ansi[2]=bZ(e.green,fZ[2]),t.ansi[3]=bZ(e.yellow,fZ[3]),t.ansi[4]=bZ(e.blue,fZ[4]),t.ansi[5]=bZ(e.magenta,fZ[5]),t.ansi[6]=bZ(e.cyan,fZ[6]),t.ansi[7]=bZ(e.white,fZ[7]),t.ansi[8]=bZ(e.brightBlack,fZ[8]),t.ansi[9]=bZ(e.brightRed,fZ[9]),t.ansi[10]=bZ(e.brightGreen,fZ[10]),t.ansi[11]=bZ(e.brightYellow,fZ[11]),t.ansi[12]=bZ(e.brightBlue,fZ[12]),t.ansi[13]=bZ(e.brightMagenta,fZ[13]),t.ansi[14]=bZ(e.brightCyan,fZ[14]),t.ansi[15]=bZ(e.brightWhite,fZ[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=bZ(e.extendedAnsi[r],fZ[r+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(e===void 0){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()}}};yZ=TG([EG(0,aK)],yZ);function bZ(e,t){if(e!==void 0)try{return BY.toColor(e)}catch{}return t}var xZ=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},SZ=class{constructor(){this._services=new xZ,this._services.set(rK,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=XG(e).sort((e,t)=>e.index-t.index),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},CZ={trace:0,debug:1,info:2,warn:3,error:4,off:5},wZ=`xterm.js: `,TZ=class extends HK{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),EZ=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=CZ[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:wZ)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};TZ=TG([EG(0,aK)],TZ);var EZ,DZ=class extends HK{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new cq),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new cq),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new cq),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 t=Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}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,t,...n){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<n.length;t++)this._array[this._getCyclicIndex(e+t)]=n[t];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},OZ=3,kZ=Object.freeze(new WG),AZ=0,jZ=2,MZ=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*OZ);let r=t||KG.fromCharData([0,HG,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*OZ+0],n=t&2097151;return[this._data[e*OZ+1],t&2097152?this._combined[e]:n?RG(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*OZ+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*OZ+0]=e|2097152|t[2]<<22):this._data[e*OZ+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*OZ+0]>>22}hasWidth(e){return this._data[e*OZ+0]&12582912}getFg(e){return this._data[e*OZ+1]}getBg(e){return this._data[e*OZ+2]}hasContent(e){return this._data[e*OZ+0]&4194303}getCodePoint(e){let t=this._data[e*OZ+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*OZ+0]&2097152}getString(e){let t=this._data[e*OZ+0];return t&2097152?this._combined[e]:t&2097151?RG(t&2097151):``}isProtected(e){return this._data[e*OZ+2]&536870912}loadCell(e,t){return AZ=e*OZ,t.content=this._data[AZ+0],t.fg=this._data[AZ+1],t.bg=this._data[AZ+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*OZ+0]=t.content,this._data[e*OZ+1]=t.fg,this._data[e*OZ+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*OZ+0]=t|n<<22,this._data[e*OZ+1]=r.fg,this._data[e*OZ+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*OZ+0];r&2097152?this._combined[e]+=RG(t):r&2097151?(this._combined[e]=RG(r&2097151)+RG(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*OZ+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new KG;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;r<t;++r)this.setCell(e+r,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,t,n){if(e%=this.length,t<this.length-e){let r=new KG;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,t,n,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return this._data.length*4*jZ<this._data.buffer.byteLength;let n=e*OZ;if(e>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);let t=Object.keys(this._combined);for(let n=0;n<t.length;n++){let r=parseInt(t[n],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t<r.length;t++){let n=parseInt(r[t],10);n>=e&&delete this._extendedAttrs[n]}}return this.length=e,n*4*jZ<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*jZ<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t){for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);return}this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}copyFrom(e){this.length===e.length?this._data.set(e._data):this._data=new Uint32Array(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let t=new e(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let e in this._combined)t._combined[e]=this._combined[e];for(let e in this._extendedAttrs)t._extendedAttrs[e]=this._extendedAttrs[e];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*OZ+0]&4194303)return e+(this._data[e*OZ+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*OZ+0]&4194303||this._data[e*OZ+2]&50331648)return e+(this._data[e*OZ+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<OZ;e++)this._data[(n+i)*OZ+e]=a[(t+i)*OZ+e];a[(t+i)*OZ+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<OZ;e++)this._data[(n+i)*OZ+e]=a[(t+i)*OZ+e];a[(t+i)*OZ+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}let o=Object.keys(e._combined);for(let r=0;r<o.length;r++){let i=parseInt(o[r],10);i>=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t<n;){let e=this._data[t*OZ+0],n=e&2097151,a=e&2097152?this._combined[t]:n?RG(n):UG;if(i+=a,r)for(let e=0;e<a.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}};function NZ(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length-1;s++){let c=s,l=e.get(++c);if(!l.isWrapped)continue;let u=[e.get(s)];for(;c<e.length&&l.isWrapped;)u.push(l),l=e.get(++c);if(!a&&r>=s&&r<c){s+=u.length-1;continue}let d=0,f=LZ(u,d,t),p=1,m=0;for(;p<u.length;){let e=LZ(u,p,t),r=e-m,a=n-f,o=Math.min(r,a);u[d].copyCellsFrom(u[p],m,f,o,!1),f+=o,f===n&&(d++,f=0),m+=o,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(n-1)===2&&(u[d].copyCellsFrom(u[d-1],n-1,f++,1,!1),u[d-1].setCell(n-1,i))}u[d].replaceCells(f,n,i);let h=0;for(let e=u.length-1;e>0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o}function PZ(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;o<e.length;o++)if(i===o){let n=t[++r];e.onDeleteEmitter.fire({index:o-a,amount:n}),o+=n-1,a+=n,i=t[++r]}else n.push(o);return{layout:n,countRemoved:a}}function FZ(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let t=0;t<n.length;t++)e.set(t,n[t]);e.length=t.length}function IZ(e,t,n){let r=[],i=e.map((n,r)=>LZ(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;s<i;){if(i-s<n){r.push(i-s);break}a+=n;let c=LZ(e,o,t);a>c&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function LZ(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var RZ=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new cq),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),LK(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};RZ._nextId=1;var zZ=RZ,BZ={},VZ=BZ.B;BZ[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:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},BZ.A={"#":`£`},BZ.B=void 0,BZ[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},BZ.C=BZ[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},BZ.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},BZ.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},BZ.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},BZ.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},BZ.E=BZ[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},BZ.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},BZ.H=BZ[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},BZ[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var HZ=4294967295,UZ=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=kZ.clone(),this.savedCharset=VZ,this.markers=[],this._nullCell=KG.fromCharData([0,HG,1,0]),this._whitespaceCell=KG.fromCharData([0,UG,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new zX,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new DZ(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 GG),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 GG),this._whitespaceCell}getBlankLine(e,t){return new MZ(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>HZ?HZ:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=kZ);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new DZ(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(kZ),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);let a=0;if(this._rows<t)for(let r=this._rows;r<t;r++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new MZ(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new MZ(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let e=this.lines.length-i;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=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=NZ(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(kZ),n);if(r.length>0){let n=PZ(this.lines,r);FZ(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(kZ),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new MZ(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(kZ),i=[],a=0;for(let o=this.lines.length-1;o>=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e<o+c.length)continue}let l=c[c.length-1].getTrimmedLength(),u=IZ(c,this._cols,e),d=u.length-c.length,f;f=this.ybase===0&&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 p=[];for(let e=0;e<d;e++){let e=this.getBlankLine(kZ,!0);p.push(e)}p.length>0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=LZ(c,Math.max(g,0),this._cols))}for(let t=0;t<c.length;t++)u[t]<e&&c[t].setCell(u[t],r);let v=d-f;for(;v-->0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.length>0){let e=[],t=[];for(let e=0;e<this.lines.length;e++)t.push(this.lines.get(e));let n=this.lines.length,r=n-1,o=0,s=i[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+a-1);l>=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+a-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e==null?(this.tabs={},e=0):this.tabs[e]||(e=this.prevStop(e));e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e??=this.x;!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(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 t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,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 t=new zZ(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},WZ=class extends HK{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new cq),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 UZ(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new UZ(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},GZ=2,KZ=1,qZ=class extends HK{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new cq),this.onResize=this._onResize.event,this._onScroll=this._register(new cq),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,GZ),this.rows=Math.max(e.rawOptions.rows||0,KZ),this.buffers=this._register(new WZ(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};qZ=TG([EG(0,aK)],qZ);var JZ={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:AX,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},YZ=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],XZ=class extends HK{constructor(e){super(),this._onOptionChange=this._register(new cq),this.onOptionChange=this._onOptionChange.event;let t={...JZ};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(zK(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=e=>{if(!(e in JZ))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in JZ))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=JZ[e],!ZZ(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=JZ[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=YZ.includes(t)?t:JZ[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case`minimumContrastRatio`:t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case`scrollback`:if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={}}return t}};function ZZ(e){return e===`block`||e===`underline`||e===`bar`}function QZ(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&QZ(e[r],t-1);return n}var $Z=Object.freeze({insertMode:!1}),eQ=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),tQ=class extends HK{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new cq),this.onData=this._onData.event,this._onUserInput=this._register(new cq),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new cq),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new cq),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=QZ($Z),this.decPrivateModes=QZ(eQ)}reset(){this.modes=QZ($Z),this.decPrivateModes=QZ(eQ)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace(`sending binary (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};tQ=TG([EG(0,$G),EG(1,iK),EG(2,aK)],tQ);var nQ={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>e.action!==32||e.button!==3},ANY:{events:31,restrict:e=>!0}};function rQ(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var iQ=String.fromCharCode,aQ={DEFAULT:e=>{let t=[rQ(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${iQ(t[0])}${iQ(t[1])}${iQ(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${rQ(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${rQ(e,!0)};${e.x};${e.y}${t}`}},oQ=class extends HK{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new cq),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(nQ))this.addProtocol(e,nQ[e]);for(let e of Object.keys(aQ))this.addEncoding(e,aQ[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};oQ=TG([EG(0,$G),EG(1,tK),EG(2,aK)],oQ);var sQ=[[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]],cQ=[[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]],lQ;function uQ(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var dQ=class{constructor(){if(this.version=`6`,!lQ){lQ=new Uint8Array(65536),lQ.fill(1),lQ[0]=0,lQ.fill(0,1,32),lQ.fill(0,127,160),lQ.fill(2,4352,4448),lQ[9001]=2,lQ[9002]=2,lQ.fill(2,11904,42192),lQ[12351]=1,lQ.fill(2,44032,55204),lQ.fill(2,63744,64256),lQ.fill(2,65040,65050),lQ.fill(2,65072,65136),lQ.fill(2,65280,65377),lQ.fill(2,65504,65511);for(let e=0;e<sQ.length;++e)lQ.fill(0,sQ[e][0],sQ[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?lQ[e]:uQ(e,cQ)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=fQ.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return fQ.createPropertyValue(0,n,r)}},fQ=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new cq,this.onChange=this._onChange.event;let e=new dQ;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return!!(e&1)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let o=t.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},pQ=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function mQ(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var hQ=2147483647,gQ=256,_Q=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>gQ)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=+!!Array.isArray(t[0]);e<t.length;++e){let r=t[e];if(Array.isArray(r))for(let e=0;e<r.length;++e)n.addSubParam(r[e]);else n.addParam(r)}return n}clone(){let t=new e(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>hQ?hQ: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>hQ?hQ:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,hQ):e}},vQ=[],yQ=class{constructor(){this._state=0,this._active=vQ,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=vQ}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=vQ,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||vQ,!this._active.length)this._handlerFb(this._id,`START`);else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,zG(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3){if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,`END`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}}this._active=vQ,this._id=-1,this._state=0}}},bQ=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=zG(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data=``,this._hitLimit=!1,e));return this._data=``,this._hitLimit=!1,t}},xQ=[],SQ=class{constructor(){this._handlers=Object.create(null),this._active=xQ,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=xQ}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=xQ,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||xQ,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,zG(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=xQ,this._ident=0}},CQ=new _Q;CQ.addParam(0);var wQ=class{constructor(e){this._handler=e,this._data=``,this._params=CQ,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():CQ,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=zG(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=CQ,this._data=``,this._hitLimit=!1,e));return this._params=CQ,this._data=``,this._hitLimit=!1,t}},TQ=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},EQ=160,DQ=function(){let e=new TQ(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(EQ,0,2,0),e.add(EQ,8,5,8),e.add(EQ,6,0,6),e.add(EQ,11,0,11),e.add(EQ,13,13,13),e}(),OQ=class extends HK{constructor(e=DQ){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 _Q,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(zK(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new yQ),this._dcsParser=this._register(new SQ),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state){if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}}for(let n=a;n<t;++n){switch(r=e[n],i=this._transitions.table[this.currentState<<8|(r<160?r:EQ)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<EQ){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<EQ){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<EQ){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<EQ){this._printHandler(e,n,i),n=i-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],s=a?a.length-1:-1;for(;s>=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++n<t&&(r=e[n])>47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r<EQ){this._dcsParser.put(e,n,i),n=i-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,n),o;r===27&&(i|=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 i=n+1;;i++)if(i>=t||(r=e[i])<32||r>127&&r<EQ){this._oscParser.put(e,n,i),n=i-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=i&15}}},kQ=/^([\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})$/,AQ=/^[\da-f]+$/;function jQ(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=kQ.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),AQ.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}}function MQ(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function NQ(e,t=16){let[n,r,i]=e;return`rgb:${MQ(n,t)}/${MQ(r,t)}/${MQ(i,t)}`}var PQ={"(":0,")":1,"*":2,"+":3,"-":1,".":2},FQ=131072,IQ=10;function LQ(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var RQ=5e3,zQ=0,BQ=class extends HK{constructor(e,t,n,r,i,a,o,s,c=new OQ){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new BG,this._utf8Decoder=new VG,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=kZ.clone(),this._eraseAttrDataInternal=kZ.clone(),this._onRequestBell=this._register(new cq),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new cq),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new cq),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new cq),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new cq),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new cq),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new cq),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new cq),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new cq),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new cq),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new cq),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new cq),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new cq),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 VQ(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler($.BEL,()=>this.bell()),this._parser.setExecuteHandler($.LF,()=>this.lineFeed()),this._parser.setExecuteHandler($.VT,()=>this.lineFeed()),this._parser.setExecuteHandler($.FF,()=>this.lineFeed()),this._parser.setExecuteHandler($.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler($.BS,()=>this.backspace()),this._parser.setExecuteHandler($.HT,()=>this.tab()),this._parser.setExecuteHandler($.SO,()=>this.shiftOut()),this._parser.setExecuteHandler($.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(AY.IND,()=>this.index()),this._parser.setExecuteHandler(AY.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(AY.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new bQ(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new bQ(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new bQ(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new bQ(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new bQ(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new bQ(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new bQ(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new bQ(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new bQ(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new bQ(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new bQ(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new bQ(e=>this.restoreCursorColor(e))),this._parser.registerEscHandler({final:`7`},()=>this.saveCursor()),this._parser.registerEscHandler({final:`8`},()=>this.restoreCursor()),this._parser.registerEscHandler({final:`D`},()=>this.index()),this._parser.registerEscHandler({final:`E`},()=>this.nextLine()),this._parser.registerEscHandler({final:`H`},()=>this.tabSet()),this._parser.registerEscHandler({final:`M`},()=>this.reverseIndex()),this._parser.registerEscHandler({final:`=`},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:`>`},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:`c`},()=>this.fullReset()),this._parser.registerEscHandler({final:`n`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`o`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`|`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`}`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`~`},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:`%`,final:`@`},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:`%`,final:`G`},()=>this.selectDefaultCharset());for(let e in BZ)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new wQ((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),RQ))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${RQ} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>FQ&&(a=this._parseStack.position+FQ)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<FQ&&(this._parseBuffer=new Uint32Array(Math.min(e.length,FQ))),o||this._dirtyRowTracker.clearRange(),e.length>FQ)for(let t=a;t<e.length;t+=FQ){let a=t+FQ<e.length?t+FQ:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(s,this._bufferService.rows-1)})}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=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&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;p<n;++p){if(r=e[p],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,f);i=fQ.extractWidth(t);let n=fQ.extractShouldJoin(t),m=n?fQ.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(RG(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-m>s){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof MZ&&d.copyCellsFrom(e,t,0,m,!1);t<s;)e.setCellFromCodepoint(t++,0,1,u)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-m;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<s&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>!LQ(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new wQ(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new bQ(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,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 t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,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}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.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 t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)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 t=e.params[0]||1;for(;t--;)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(kZ));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 t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.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 t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=fQ.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent($.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent($.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent($.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent($.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent($.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,VZ),this._charsetService.setgCharset(1,VZ),this._charsetService.setgCharset(2,VZ),this._charsetService.setgCharset(3,VZ);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 t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){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:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&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,t){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${$.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=WG.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=kZ.fg,e.bg=kZ.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=kZ.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=kZ.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=kZ.fg&16777215,r.bg&=-67108864,r.bg|=kZ.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${$.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[?${e};${t}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=kZ.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle=`block`;break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle=`underline`;break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle=`bar`}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!LQ(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${$.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>IQ&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>IQ&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(HQ(n)){if(r===`?`)t.push({type:0,index:n});else{let e=jQ(r);e&&t.push({type:1,index:n,color:e})}}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):!n.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=jQ(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e]);HQ(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!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,VZ),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(PQ[e[0]],BZ[e[1]]||VZ),!0):(this.selectDefaultCharset(),!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=kZ.clone(),this._eraseAttrDataInternal=kZ.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new KG;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=e=>(this._coreService.triggerDataEvent(`${$.ESC}${e}${$.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},VQ=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,t){e>t&&(zQ=e,e=t,t=zQ),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};VQ=TG([EG(0,$G)],VQ);function HQ(e){return 0<=e&&e<256}var UQ=5e7,WQ=12,GQ=50,KQ=class extends HK{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 cq),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>UQ)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>performance.now()-n>=WQ?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=WQ)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>GQ&&(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()}},qQ=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};qQ=TG([EG(0,$G)],qQ);var JQ=!1,YQ=class extends HK{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new UK),this._onBinary=this._register(new cq),this.onBinary=this._onBinary.event,this._onData=this._register(new cq),this.onData=this._onData.event,this._onLineFeed=this._register(new cq),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new cq),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new cq),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new cq),this._instantiationService=new SZ,this.optionsService=this._register(new XZ(e)),this._instantiationService.setService(aK,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(qZ)),this._instantiationService.setService($G,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(TZ)),this._instantiationService.setService(iK,this._logService),this.coreService=this._register(this._instantiationService.createInstance(tQ)),this._instantiationService.setService(tK,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(oQ)),this._instantiationService.setService(eK,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(fQ)),this._instantiationService.setService(sK,this.unicodeService),this._charsetService=this._instantiationService.createInstance(pQ),this._instantiationService.setService(nK,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(qQ),this._instantiationService.setService(oK,this._oscLinkService),this._inputHandler=this._register(new BQ(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(XK.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(XK.forward(this._bufferService.onResize,this._onResize)),this._register(XK.forward(this.coreService.onData,this._onData)),this._register(XK.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 KQ((e,t)=>this._inputHandler.parse(e,t))),this._register(XK.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new cq),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!JQ&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),JQ=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,GZ),t=Math.max(t,KZ),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(mQ.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(mQ(this._bufferService),!1))),this._windowsWrappingHeuristics.value=zK(()=>{for(let t of e)t.dispose()})}}},XQ={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};function ZQ(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=+!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?i.key=t?$.ESC+`OA`:$.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?i.key=t?$.ESC+`OD`:$.ESC+`[D`:e.key===`UIKeyInputRightArrow`?i.key=t?$.ESC+`OC`:$.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(i.key=t?$.ESC+`OB`:$.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:$.DEL,e.altKey&&(i.key=$.ESC+i.key);break;case 9:if(e.shiftKey){i.key=$.ESC+`[Z`;break}i.key=$.HT,i.cancel=!0;break;case 13:i.key=e.altKey?$.ESC+$.CR:$.CR,i.cancel=!0;break;case 27:i.key=$.ESC,e.altKey&&(i.key=$.ESC+$.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`D`:t?$.ESC+`OD`:$.ESC+`[D`;break;case 39:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`C`:t?$.ESC+`OC`:$.ESC+`[C`;break;case 38:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`A`:t?$.ESC+`OA`:$.ESC+`[A`;break;case 40:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`B`:t?$.ESC+`OB`:$.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=$.ESC+`[2~`);break;case 46:i.key=a?$.ESC+`[3;`+(a+1)+`~`:$.ESC+`[3~`;break;case 36:i.key=a?$.ESC+`[1;`+(a+1)+`H`:t?$.ESC+`OH`:$.ESC+`[H`;break;case 35:i.key=a?$.ESC+`[1;`+(a+1)+`F`:t?$.ESC+`OF`:$.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:i.key=e.ctrlKey?$.ESC+`[5;`+(a+1)+`~`:$.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:i.key=e.ctrlKey?$.ESC+`[6;`+(a+1)+`~`:$.ESC+`[6~`;break;case 112:i.key=a?$.ESC+`[1;`+(a+1)+`P`:$.ESC+`OP`;break;case 113:i.key=a?$.ESC+`[1;`+(a+1)+`Q`:$.ESC+`OQ`;break;case 114:i.key=a?$.ESC+`[1;`+(a+1)+`R`:$.ESC+`OR`;break;case 115:i.key=a?$.ESC+`[1;`+(a+1)+`S`:$.ESC+`OS`;break;case 116:i.key=a?$.ESC+`[15;`+(a+1)+`~`:$.ESC+`[15~`;break;case 117:i.key=a?$.ESC+`[17;`+(a+1)+`~`:$.ESC+`[17~`;break;case 118:i.key=a?$.ESC+`[18;`+(a+1)+`~`:$.ESC+`[18~`;break;case 119:i.key=a?$.ESC+`[19;`+(a+1)+`~`:$.ESC+`[19~`;break;case 120:i.key=a?$.ESC+`[20;`+(a+1)+`~`:$.ESC+`[20~`;break;case 121:i.key=a?$.ESC+`[21;`+(a+1)+`~`:$.ESC+`[21~`;break;case 122:i.key=a?$.ESC+`[23;`+(a+1)+`~`:$.ESC+`[23~`;break;case 123:i.key=a?$.ESC+`[24;`+(a+1)+`~`:$.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=$.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=$.DEL:e.keyCode===219?i.key=$.ESC:e.keyCode===220?i.key=$.FS:e.keyCode===221&&(i.key=$.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=XQ[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=$.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=$.ESC+n}else if(e.keyCode===32)i.key=$.ESC+(e.ctrlKey?$.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=$.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=$.US),e.key===`@`&&(i.key=$.NUL))}return i}var QQ=0,$Q=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new zX,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new zX,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(QQ=this._search(t),QQ===-1)||this._getKey(this._array[QQ])!==t)return!1;do if(this._array[QQ]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(QQ),!0;while(++QQ<this._array.length&&this._getKey(this._array[QQ])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(QQ=this._search(e),!(QQ<0||QQ>=this._array.length)&&this._getKey(this._array[QQ])===e))do yield this._array[QQ];while(++QQ<this._array.length&&this._getKey(this._array[QQ])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(QQ=this._search(e),!(QQ<0||QQ>=this._array.length)&&this._getKey(this._array[QQ])===e))do t(this._array[QQ]);while(++QQ<this._array.length&&this._getKey(this._array[QQ])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},e$=0,t$=0,n$=class extends HK{constructor(){super(),this._decorations=new $Q(e=>e?.marker.line),this._onDecorationRegistered=this._register(new cq),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new cq),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(zK(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new r$(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,t=>{e$=t.options.x??0,t$=e$+(t.options.width??1),e>=e$&&e<t$&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},r$=class extends VK{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new cq),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new cq),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 this._cachedBg===null&&(this._cachedBg=this.options.backgroundColor?BY.toColor(this.options.backgroundColor):void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this._cachedFg=this.options.foregroundColor?BY.toColor(this.options.foregroundColor):void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},i$=1e3,a$=class{constructor(e,t=i$){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},o$=20,s$=class extends HK{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;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=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new a$(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(`
|
|
353
|
-
`))),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(
|
|
354
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===o$+1&&(this._liveRegion.textContent+=AG.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(!(!a||!o)){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;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 t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};s$=TG([EG(1,rK),EG(2,fK),EG(3,mK)],s$);var c$=class extends HK{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new cq),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new cq),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(zK(()=>{LK(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(NJ(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(NJ(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(NJ(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(NJ(this._element,`mouseup`,this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_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,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)(!this._activeProviderReplies.has(t)||this._activeProviderReplies.get(t))&&(i=!0);if(!i&&r){let e=r.find(e=>this._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&l$(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,LK(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};c$=TG([EG(1,pK),EG(2,mK),EG(3,$G),EG(4,vK)],c$);function l$(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var u$=class extends YQ{constructor(e={}){super(e),this._linkifier=this._register(new UK),this.browser=SX,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new UK),this._onCursorMove=this._register(new cq),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new cq),this.onKey=this._onKey.event,this._onRender=this._register(new cq),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new cq),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new cq),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new cq),this.onBell=this._onBell.event,this._onFocus=this._register(new cq),this._onBlur=this._register(new cq),this._onA11yCharEmitter=this._register(new cq),this._onA11yTabEmitter=this._register(new cq),this._onWillOpen=this._register(new cq),this._setup(),this._decorationService=this._instantiationService.createInstance(n$),this._instantiationService.setService(cK,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(_X),this._instantiationService.setService(vK,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(lK)),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(XK.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(XK.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(XK.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(XK.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(zK(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=zY.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${$.ESC}]${n};${NQ(r)}${jY.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=RY.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=RY.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.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(s$,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.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($.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(NJ(this.element,`copy`,e=>{this.hasSelection()&&NG(e,this._selectionService)}));let e=e=>PG(e,this.textarea,this.coreService,this.optionsService);this._register(NJ(this.textarea,`paste`,e)),this._register(NJ(this.element,`paste`,e)),EX?this._register(NJ(this.element,`mousedown`,e=>{e.button===2&&LG(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(NJ(this.element,`contextmenu`,e=>{LG(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),PX&&this._register(NJ(this.element,`auxclick`,e=>{e.button===1&&IG(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(NJ(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(NJ(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(NJ(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(NJ(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(NJ(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(NJ(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(NJ(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._register(NJ(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,OG.get()),FX||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange(`disableStdin`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(hX,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(fK,this._coreBrowserService),this._register(NJ(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(NJ(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(dX,this._document,this._helperContainer),this._instantiationService.setService(dK,this._charSizeService),this._themeService=this._instantiationService.createInstance(yZ),this._instantiationService.setService(_K,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(KY),this._instantiationService.setService(gK,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(VX,this.rows,this.screenElement)),this._instantiationService.setService(mK,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(MY,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(bX),this._instantiationService.setService(pK,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(c$,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(CY,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(lZ,this.element,this.screenElement,r)),this._instantiationService.setService(hK,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(XK.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(wY,this.screenElement)),this._register(NJ(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(s$,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(kY,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(kY,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(uX,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=t.buttons&1?0:t.buttons&4?1:t.buttons&2?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(NJ(t,`mousedown`,e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)})),this._register(NJ(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=$.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){FG(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key===`Dead`||e.key===`AltGraph`)&&(this._unprocessedDeadKey=!0);let n=ZQ(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===$.ETX||n.key===$.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(d$(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(kZ));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($.ESC+`[I`):this.coreService.triggerDataEvent($.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${$.ESC}[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${$.ESC}[6;${r};${n}t`)}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function d$(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var f$=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},p$=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new KG)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},m$=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new p$(t)}getNullCell(){return new KG}},h$=class extends HK{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new cq),this.onBufferChange=this._onBufferChange.event,this._normal=new m$(this._core.buffers.normal,`normal`),this._alternate=new m$(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)}},g$=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},_$=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}},v$=[`cols`,`rows`],y$=0,b$=class extends HK{constructor(e){super(),this._core=this._register(new u$(e)),this._addonManager=this._register(new f$),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(v$.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||=new g$(this._core),this._parser}get unicode(){return this._checkProposedApi(),new _$(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||=this._register(new h$(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
355
|
-
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return OG.get()},set promptLabel(e){OG.set(e)},get tooMuchOutput(){return AG.get()},set tooMuchOutput(e){AG.set(e)}}}_verifyIntegers(...e){for(y$ of e)if(y$===1/0||isNaN(y$)||y$%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(y$ of e)if(y$&&(y$===1/0||isNaN(y$)||y$%1!=0||y$<0))throw Error(`This API only accepts positive integers`)}},x$=2,S$=1,C$=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(x$,Math.floor(u/e.css.cell.width)),rows:Math.max(S$,Math.floor(l/e.css.cell.height))}}},w$={fontSize:14,lineHeight:1.24,fontFamily:`'Noto Sans Mono CJK TC', 'Noto Sans Mono CJK SC', 'Source Han Mono TC', 'Source Han Mono SC', 'Sarasa Mono TC', 'Sarasa Mono SC', 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', 'Microsoft JhengHei', 'Microsoft YaHei', 'PingFang TC', 'PingFang SC', monospace`},T$=`[Earlier terminal output was truncated; showing the retained tail.]`;function E$({sessionId:e,onExit:t,onConnected:n,onConnectionLost:r,reconnectNonce:i}){let a=(0,v.useRef)(null),o=(0,v.useRef)(void 0),s=(0,v.useRef)(void 0),c=TR(e=>e.themeMode),[l,u]=(0,v.useState)();return(0,v.useEffect)(()=>{let i=pG(e);if(!i||!a.current){u(`This browser session does not have the capability to attach to this terminal.`);return}let l,d=!1,f=!1,p=!1,m=new b$({cursorBlink:!0,convertEol:!0,...w$,theme:MR[c]});s.current=m;let h=new C$;m.loadAddon(h),m.open(a.current),m.focus();let g=-1,_=-1,v=-1,y=-1,b=({forceFit:e=!1,sync:t=!1}={})=>{let n=a.current?.getBoundingClientRect(),r=n&&(n.width!==g||n.height!==_);if(!n||!e&&!r)return;g=n.width,_=n.height,h.fit();let i=m.cols!==v||m.rows!==y;v=m.cols,y=m.rows,d&&l?.readyState===WebSocket.OPEN&&(t||i)&&l.send(JSON.stringify({type:`resize`,columns:m.cols,rows:m.rows}))},x=new ResizeObserver(()=>b());x.observe(a.current);let S=()=>b({forceFit:!0});o.current=S,document.fonts?.ready.then(()=>{f||b({forceFit:!0})});let C=m.onData(e=>{l?.readyState===WebSocket.OPEN&&l.send(JSON.stringify({type:`input`,data:e}))});return l=new WebSocket(TW(e,i)),l.onopen=()=>{d=!0,u(void 0),n(),b({forceFit:!0,sync:!0}),m.focus()},l.onmessage=e=>{try{let n=JSON.parse(String(e.data));n.type===`replay`&&n.truncated===!0&&m.writeln(`\r\n${T$}\r\n`),n.type===`data`&&typeof n.data==`string`&&m.write(n.data),n.type===`exit`&&typeof n.exitCode==`number`&&(p=!0,m.writeln(`\r\n[session exited: ${n.exitCode}]`),t(n.exitCode))}catch{}},l.onerror=()=>{f||(u(`The terminal connection was lost.`),r())},l.onclose=()=>{!f&&!p&&(u(`The terminal connection was closed.`),r())},()=>{f=!0,s.current===m&&(s.current=void 0),o.current===S&&(o.current=void 0),C.dispose(),x.disconnect(),l?.close(),m.dispose()}},[e,i,t,n,r]),(0,v.useEffect)(()=>{s.current&&(s.current.options.theme=MR[c]),o.current?.()},[c]),(0,Z.jsxs)(`div`,{className:`sessions-terminal-wrap`,children:[l?(0,Z.jsx)(`div`,{className:`sessions-terminal-message`,role:`status`,children:l}):null,(0,Z.jsx)(`div`,{ref:a,className:`sessions-terminal`,"aria-label":`Native agent terminal`,tabIndex:-1})]})}var D$={claude:`This Claude session cannot be resumed. Restart creates a new isolated session.`,codex:`This Codex session cannot be resumed. Restart creates a new isolated session.`},O$={claude:`Restart starts a separate Claude conversation in a new isolated terminal.`,codex:`Restart starts a separate Codex conversation in a new isolated terminal.`};function k$(e){return e===`exited`||e===`stopped`||e===`interrupted`||e===`failed`||e===`stale`}function A$(e){if(!k$(e.status))return[];let t=e.lifecycle,n={kind:`restart`,label:`Restart in a new session`,reason:t?.liveAction===`resume`?O$[e.vendor]:t?.reason??D$[e.vendor]};return t?.liveAction===`resume`&&t.resumeAvailable?[{kind:`resume`,label:`Resume conversation`,reason:t.reason??`Resume continues the retained Claude conversation in a new isolated terminal.`},n]:[n]}var j$={analysis:`Analyze data`,setup:`Set up a project`,context_enrichment:`Enrich context`},M$={claude:`Claude`,codex:`Codex`},N$={claude:`Claude CLI`,codex:`Codex CLI`},P$={creating:`Starting`,running:`Running`,detached:`Detached`,exited:`Exited`,stopped:`Stopped`,interrupted:`Unavailable`,failed:`Failed`,stale:`Stale`};function F$(e){let t=Math.max(0,Date.now()-new Date(e).getTime()),n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}var I$=class extends Error{constructor(){super(`This browser cannot create a secure session action. Reload in a supported browser and try again.`),this.name=`NativeSessionLaunchIdError`}};function L$(){let e=globalThis.crypto;return{...typeof e?.randomUUID==`function`?{randomUUID:()=>e.randomUUID()}:{},...typeof e?.getRandomValues==`function`?{getRandomValues:t=>{e.getRandomValues(t)}}:{}}}function R$(e){return e.toString(16).padStart(2,`0`)}function z$(e=L$()){if(e.randomUUID)return e.randomUUID();if(!e.getRandomValues)throw new I$;let t=new Uint8Array(new ArrayBuffer(16));e.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=[...t].map(R$);return`${n.slice(0,4).join(``)}-${n.slice(4,6).join(``)}-${n.slice(6,8).join(``)}-${n.slice(8,10).join(``)}-${n.slice(10,16).join(``)}`}var B$=0,V$=0,H$=new Map,U$=new Map,W$=new Map;function G$(e){return e.status===`creating`||e.status===`running`||e.status===`detached`}function K$(e){G$(e)||hG(e.id)}var q$=new Map;function J$(e,t){return`${t}:${e}`}function Y$(e){let t=q$.get(e);if(t)return t;let n={idempotencyKey:z$()};return q$.set(e,n),n}function X$(e,t){let n=q$.get(e);n&&(!t||n===t)&&q$.delete(e)}function Z$(e){return JSON.stringify([e.purpose,e.vendor,e.scopeKind,e.scopeId,e.projectIdentity,e.bindingGeneration,e.projectRevision,e.runtimeGeneration??null])}function Q$(e){let t=Z$(e),n=H$.get(e.id);if(n?.scope===t)return n;let r={scope:t,idempotencyKey:z$()};return H$.set(e.id,r),r}function $$(e,t){let n=H$.get(e.id);n&&(!t||n===t)&&H$.delete(e.id)}function e1(e){let t=Z$(e),n=U$.get(e.id);if(n?.scope===t)return n;let r={scope:t,idempotencyKey:z$()};return U$.set(e.id,r),r}function t1(e,t){let n=U$.get(e.id);n&&(!t||n===t)&&U$.delete(e.id)}function n1(e){let t=new Map(e.map(e=>[e.id,e]));for(let[e,n]of H$){let r=t.get(e);(!r||n.scope!==Z$(r))&&H$.delete(e)}for(let[e,n]of U$){let r=t.get(e);(!r||n.scope!==Z$(r))&&U$.delete(e)}}function r1(e){return[...e].sort((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime())}var i1=bR((e,t)=>({sessions:[],loading:!1,readinessLoading:!1,async load(){let t=++V$;e({loading:!0,error:void 0});try{let{sessions:n}=await vW();if(t!==V$)return;n1(n),n.forEach(K$),e({sessions:r1(n),loading:!1})}catch(n){if(t!==V$)return;e({loading:!1,error:n instanceof Error?n.message:`Sessions are unavailable.`})}},refresh(e){let n=W$.get(e);if(n)return n;let r;return r=bW(e).then(({session:e})=>(K$(e),t().replace(e),e)).catch(()=>void 0).finally(()=>{W$.get(e)===r&&W$.delete(e)}),W$.set(e,r),r},async refreshReadiness(){let n=++B$;e({readiness:void 0,readinessLoading:!0,readinessError:void 0});try{let r=await yW();if(n!==B$)return t().readiness;let i=t().readiness?.runtime?.generation,a=r.runtime?.generation;return i!==void 0&&a!==void 0&&a<i?(e({readinessLoading:!1}),t().readiness):(e({readiness:r,readinessLoading:!1,readinessError:void 0}),r)}catch(r){if(n!==B$)return t().readiness;e({readiness:void 0,readinessLoading:!1,readinessError:r instanceof Error?r.message:`Native terminal hosting is unavailable.`});return}},createSession(e,n,r){let i=J$(e,r),a=Y$(i);if(a.request)return a.request;let o=xW(e,{intent:`start_separate`,idempotencyKey:a.idempotencyKey}).then(({session:e,capability:r,recoveryCapability:o})=>(X$(i,a),r&&mG(e.id,r),o&&_G(e.id,o),n&&bG(e.id,n),t().replace(e),e)).catch(e=>{throw cW(e)&&X$(i,a),e}).finally(()=>{q$.get(i)===a&&(a.request=void 0)});return a.request=o,o},async openSession(e,n,r){try{let{session:i,capability:a,recoveryCapability:o}=await xW(e,{intent:`open_existing`,sessionId:n});return a&&mG(i.id,a),o&&_G(i.id,o),r&&bG(i.id,r),t().replace(i),i}catch(e){throw t().refresh(n),e}},async restartSession(e,n,r){let i=Q$(e);try{let a={intent:`start_separate`,idempotencyKey:i.idempotencyKey},{session:o,capability:s,recoveryCapability:c}=r?await xW(e.purpose,a,r):await xW(e.purpose,a);return $$(e,i),s&&mG(o.id,s),c&&_G(o.id,c),n&&bG(o.id,n),t().replace(o),o}catch(t){throw cW(t)&&$$(e,i),t}},async resumeSession(e,n,r){let i=e1(e);try{let a={intent:`resume`,sessionId:e.id,idempotencyKey:i.idempotencyKey},{session:o,capability:s,recoveryCapability:c}=r?await xW(e.purpose,a,r):await xW(e.purpose,a);return t1(e,i),s&&mG(o.id,s),c&&_G(o.id,c),n&&bG(o.id,n),t().replace(o),o}catch(n){throw cW(n)&&t1(e,i),t().refresh(e.id),n}},async actOnSetupRecovery(e,n,r,i){let a=yG(e),o=await CW(e,n,r,i);if(vG(e),!o){hG(e),await t().refresh(e);return}return hG(e),o.capability&&mG(o.session.id,o.capability),o.recoveryCapability&&_G(o.session.id,o.recoveryCapability),a&&bG(o.session.id,a),t().replace(o.session),o.session},replace(t){K$(t);let n=H$.get(t.id);n&&n.scope!==Z$(t)&&$$(t,n);let r=U$.get(t.id);r&&r.scope!==Z$(t)&&t1(t,r),e(e=>({sessions:r1([t,...e.sessions.filter(e=>e.id!==t.id)])}))}}));function a1(e){return e.status===`running`||e.status===`detached`}function o1(){let[e,t]=(0,v.useState)(()=>typeof window<`u`&&window.innerWidth<=640);return(0,v.useEffect)(()=>{let e=()=>t(window.innerWidth<=640);return window.addEventListener(`resize`,e),e(),()=>window.removeEventListener(`resize`,e)},[]),e}function s1(){return(0,Z.jsxs)(`main`,{className:`sessions-empty`,"aria-labelledby":`sessions-empty-title`,children:[(0,Z.jsx)(`h1`,{id:`sessions-empty-title`,children:`Sessions`}),(0,Z.jsx)(`p`,{children:`Open an existing session or start a separate native agent session from the sidebar.`})]})}function c1(){let{id:e}=CB(),t=yB(),n=i1(e=>e.sessions),r=i1(e=>e.loading),i=i1(e=>e.error),a=i1(e=>e.load),o=i1(e=>e.refresh),s=i1(e=>e.replace),c=i1(e=>e.actOnSetupRecovery),l=i1(e=>e.resumeSession),u=i1(e=>e.restartSession),d=n.find(t=>t.id===e),[f,p]=(0,v.useState)(0),[m,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)(!1),[y,b]=(0,v.useState)(!1),[x,S]=(0,v.useState)(),[C,w]=(0,v.useState)(!1),[T,E]=(0,v.useState)(),[D,O]=(0,v.useState)(!1),[k,A]=(0,v.useState)(),[j,M]=(0,v.useState)(),[N,P]=(0,v.useState)(),[F,I]=(0,v.useState)(!1),L=o1(),R=aW();(0,v.useEffect)(()=>{R&&e&&!d&&o(e)},[R,e,d,o]),(0,v.useEffect)(()=>{_(!1),h(!1)},[e]),(0,v.useEffect)(()=>{d?.purpose===`setup`&&d.status===`stopped`&&vG(d.id)},[d]),(0,v.useEffect)(()=>{d&&!a1(d)&&hG(d.id)},[d]),(0,v.useEffect)(()=>{if(!R||!d||d.purpose!==`setup`){M(void 0);return}let e=!0;return SW(d.id).then(({recovery:t})=>{e&&M(t)}).catch(()=>{e&&M(void 0)}),()=>{e=!1}},[R,d]);let z=(0,v.useCallback)(e=>{h(!1),d&&s({...d,status:`exited`,exitCode:e,endedAt:new Date().toISOString(),updatedAt:new Date().toISOString()})},[s,d]),B=(0,v.useCallback)(()=>{_(!1),h(!1)},[]),V=(0,v.useCallback)(()=>{_(!0),e?o(e).finally(()=>h(!1)):h(!1)},[e,o]);if(!e)return(0,Z.jsx)(s1,{});if(!R)return(0,Z.jsx)(`main`,{className:`sessions-empty`,children:(0,Z.jsx)(al,{type:`info`,title:`Sessions require a local BFF connection`,description:`Connect this browser to a local GenBI BFF to create or attach native sessions.`})});if(i)return(0,Z.jsx)(`main`,{className:`sessions-empty`,children:(0,Z.jsx)(al,{type:`error`,title:`Sessions are unavailable`,description:i,action:(0,Z.jsx)(ST,{onClick:()=>void a(),children:`Retry`})})});if(!d)return(0,Z.jsx)(`main`,{className:`sessions-empty`,children:r?(0,Z.jsx)(Bj,{tip:`Loading session…`}):(0,Z.jsx)(al,{type:`warning`,title:`Session not found`,description:`This session may have been removed or is unavailable.`,action:(0,Z.jsx)(ST,{onClick:()=>t(`/sessions`),children:`Back to Sessions`})})});let H=pG(d.id),U=yG(d.id),W=a1(d)&&!!H,G=A$(d),ee=G.find(e=>e.kind===`resume`),K=G.find(e=>e.kind===`restart`),te=async()=>{if(H){b(!0),S(void 0);try{await wW(d.id,H),hG(d.id),vG(d.id),await o(d.id)}catch(e){S(e instanceof Error?e.message:`The native session could not be stopped.`)}finally{b(!1)}}},ne=P$[d.status],re=()=>{U&&(xG(d.id),t(U===`setup`?`/setup`:`/context`,{state:{nativeSessionReturn:U}}))},ie=async(e,n)=>{let r=gG(d.id);if(!r){P(`Recovery action capability is unavailable in this browser session. Open the original browser session to act.`);return}I(!0),P(void 0);try{let i=await c(d.id,r,n,e);i?t(`/sessions/${i.id}`,{replace:!0}):await o(d.id)}catch(e){P(e instanceof Error?e.message:`Native Setup recovery action could not be completed.`);let t=await SW(d.id).then(({recovery:e})=>e).catch(()=>void 0);M(t)}finally{I(!1)}},q=async()=>{if(K){w(!0),E(void 0);try{let e=await u(d,U);hG(d.id),vG(d.id),t(`/sessions/${e.id}`,{replace:!0})}catch(e){E(e instanceof Error?e.message:`A new native session could not be started.`)}finally{w(!1)}}},ae=async()=>{if(ee){O(!0),A(void 0);try{let e=await l(d,U);hG(d.id),vG(d.id),t(`/sessions/${e.id}`,{replace:!0})}catch(e){A(e instanceof Error?e.message:`The retained conversation could not be resumed.`)}finally{O(!1)}}},oe=a1(d)&&!!H&&!g,se=d.status!==`stopped`&&!a1(d),ce=d.purpose===`setup`&&d.status===`failed`&&!j;return(0,Z.jsxs)(`main`,{className:`sessions-workbench${L?` is-compact`:``}`,"data-testid":`sessions-workbench`,children:[(0,Z.jsxs)(`header`,{className:`sessions-toolbar`,children:[(0,Z.jsxs)(`div`,{className:`sessions-toolbar-title`,children:[(0,Z.jsx)(`strong`,{children:j$[d.purpose]}),(0,Z.jsxs)(`span`,{children:[d.dispatchProfile??d.agent,` · `,d.dispatchTarget?N$[d.vendor]:d.vendor]})]}),(0,Z.jsx)(iL,{variant:`filled`,color:d.status===`running`?`processing`:d.status===`failed`||d.status===`stale`?`error`:`default`,children:ne}),(0,Z.jsxs)(`div`,{className:`sessions-toolbar-actions`,children:[W?(0,Z.jsx)(ST,{size:`small`,icon:(0,Z.jsx)(Zj,{}),loading:m,disabled:m,onClick:()=>{h(!0),_(!1),p(e=>e+1)},children:`Reconnect`}):null,d.status===`running`||d.status===`detached`?(0,Z.jsx)(ST,{size:`small`,danger:!0,icon:(0,Z.jsx)(RU,{}),loading:y,onClick:()=>void te(),children:`Stop`}):null,ee?(0,Z.jsx)(ST,{size:`small`,loading:D,disabled:C,onClick:()=>void ae(),children:ee.label}):null,K?(0,Z.jsx)(ST,{size:`small`,loading:C,disabled:D,onClick:()=>void q(),children:K.label}):null,U?(0,Z.jsxs)(ST,{size:`small`,onClick:re,children:[`Return to `,U===`setup`?`Setup`:`Context`]}):null]}),x?(0,Z.jsxs)(`span`,{className:`sessions-toolbar-error`,role:`alert`,children:[`Unable to stop this session. `,x,` Reconnect and try again.`]}):null,T?(0,Z.jsxs)(`span`,{className:`sessions-toolbar-error`,role:`alert`,children:[`Unable to restart this session. `,T]}):null,k?(0,Z.jsxs)(`span`,{className:`sessions-toolbar-error`,role:`alert`,children:[`Unable to resume this conversation. `,k,` Restart remains available.`]}):null,j||ce?(0,Z.jsxs)(`section`,{className:`sessions-recovery`,"aria-label":`Setup recovery`,"aria-live":`polite`,children:[j?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`strong`,{children:[`Setup recovery: `,j.state.replaceAll(`_`,` `)]}),(0,Z.jsxs)(`span`,{children:[j.phase,` · update `,j.sequence]}),j.state===`reported_complete`?(0,Z.jsx)(`span`,{children:j.completionValidated?`Canonical Setup artifacts validated.`:`Completion was reported, but canonical Setup artifacts are not yet valid.`}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`strong`,{children:`Setup recovery: launch failed`}),(0,Z.jsx)(`span`,{children:`No producer recovery update was received.`})]}),ce?(0,Z.jsx)(ST,{size:`small`,loading:F,onClick:()=>void ie(`retry`,0),children:`Retry in a new session`}):null,se&&j?.state===`retryable_failure`?(0,Z.jsx)(ST,{size:`small`,loading:F,onClick:()=>void ie(`retry`,j.version),children:`Retry in a new session`}):null,se&&(j?.state===`needs_input`||j?.state===`needs_decision`)?(0,Z.jsx)(ST,{size:`small`,loading:F,onClick:()=>void ie(`continue`,j.version),children:`Continue in a new session`}):null,se&&j?.state===`needs_decision`?(0,Z.jsx)(ST,{size:`small`,danger:!0,loading:F,onClick:()=>void ie(`stop`,j.version),children:`Stop`}):null,N?(0,Z.jsxs)(`span`,{className:`sessions-toolbar-error`,role:`alert`,children:[`Recovery action failed. `,N]}):null]}):null]}),oe?(0,Z.jsx)(E$,{sessionId:d.id,reconnectNonce:f,onExit:z,onConnected:B,onConnectionLost:V}):(0,Z.jsx)(`section`,{className:`sessions-terminal-state`,"aria-live":`polite`,children:(0,Z.jsx)(al,{type:d.status===`failed`||d.status===`stale`||d.status===`interrupted`?`error`:`info`,title:a1(d)&&!H?`Terminal capability unavailable in this browser session`:`Session ${ne.toLowerCase()}`,description:K?`${d.failure?`${d.failure} `:``}${ee?`${ee.reason} ${K.reason}`:K.reason}`:d.failure??(a1(d)&&!H?`Open or create this session in the browser session that owns it, then reconnect. Capabilities are never stored by the server.`:`This native terminal is not available for attachment.`)})})]})}var l1={verified:!0,summary:`Top 5 customers by revenue this quarter.`,blocks:[{type:`table`,columns:[`Customer`,`Revenue`,`Orders`],rows:[[`Acme Corp`,128400,42],[`Globex`,98200,31],[`Initech`,76500,27],[`Umbrella`,64100,19],[`Soylent`,51800,22]]},{type:`definition`,sql:`SELECT customer, SUM(amount) AS revenue, COUNT(*) AS orders
|
|
352
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){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:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=sZ(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=SX(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-cZ),cZ),t/=cZ,t/Math.abs(t)+Math.round(t*(lZ-1)))}shouldForceSelection(e){return PX?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),uZ)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(PX&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&e.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[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?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<dZ&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=qX(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c<o.length&&o.charAt(c+1)===` `;)c++}else{let t=e[0],n=e[0];a.getWidth(t)===0&&(u++,t--),a.getWidth(n)===2&&(d++,n++);let r=a.getString(n).length;for(r>1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n<a.length&&c+1<o.length&&!this._isCharWordSeparator(a.loadCell(n+1,this._workCell));){a.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,n++):e>1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(!(!t&&o.slice(s,c).trim()===``)){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=sZ(n,this._bufferService.cols)}};pZ=kG([AG(3,rK),AG(4,aK),AG(5,_K),AG(6,lK),AG(7,vK),AG(8,gK)],pZ);var mZ=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},hZ=class{constructor(){this._color=new mZ,this._css=new mZ}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},gZ=Object.freeze((()=>{let e=[WY.toColor(`#2e3436`),WY.toColor(`#cc0000`),WY.toColor(`#4e9a06`),WY.toColor(`#c4a000`),WY.toColor(`#3465a4`),WY.toColor(`#75507b`),WY.toColor(`#06989a`),WY.toColor(`#d3d7cf`),WY.toColor(`#555753`),WY.toColor(`#ef2929`),WY.toColor(`#8ae234`),WY.toColor(`#fce94f`),WY.toColor(`#729fcf`),WY.toColor(`#ad7fa8`),WY.toColor(`#34e2e2`),WY.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:HY.toCss(r,i,a),rgba:HY.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:HY.toCss(n,n,n),rgba:HY.toRgba(n,n,n)})}return e})()),_Z=WY.toColor(`#ffffff`),vZ=WY.toColor(`#000000`),yZ=WY.toColor(`#ffffff`),bZ=vZ,xZ={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},SZ=_Z,CZ=class extends KK{constructor(e){super(),this._optionsService=e,this._contrastCache=new hZ,this._halfContrastCache=new hZ,this._onChangeColors=this._register(new fq),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:_Z,background:vZ,cursor:yZ,cursorAccent:bZ,selectionForeground:void 0,selectionBackgroundTransparent:xZ,selectionBackgroundOpaque:UY.blend(vZ,xZ),selectionInactiveBackgroundTransparent:xZ,selectionInactiveBackgroundOpaque:UY.blend(vZ,xZ),scrollbarSliderBackground:UY.opacity(_Z,.2),scrollbarSliderHoverBackground:UY.opacity(_Z,.4),scrollbarSliderActiveBackground:UY.opacity(_Z,.5),overviewRulerBorder:_Z,ansi:gZ.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange(`minimumContrastRatio`,()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange(`theme`,()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=wZ(e.foreground,_Z),t.background=wZ(e.background,vZ),t.cursor=UY.blend(t.background,wZ(e.cursor,yZ)),t.cursorAccent=UY.blend(t.background,wZ(e.cursorAccent,bZ)),t.selectionBackgroundTransparent=wZ(e.selectionBackground,xZ),t.selectionBackgroundOpaque=UY.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=wZ(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=UY.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?wZ(e.selectionForeground,VY):void 0,t.selectionForeground===VY&&(t.selectionForeground=void 0),UY.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=UY.opacity(t.selectionBackgroundTransparent,.3)),UY.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=UY.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=wZ(e.scrollbarSliderBackground,UY.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=wZ(e.scrollbarSliderHoverBackground,UY.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=wZ(e.scrollbarSliderActiveBackground,UY.opacity(t.foreground,.5)),t.overviewRulerBorder=wZ(e.overviewRulerBorder,SZ),t.ansi=gZ.slice(),t.ansi[0]=wZ(e.black,gZ[0]),t.ansi[1]=wZ(e.red,gZ[1]),t.ansi[2]=wZ(e.green,gZ[2]),t.ansi[3]=wZ(e.yellow,gZ[3]),t.ansi[4]=wZ(e.blue,gZ[4]),t.ansi[5]=wZ(e.magenta,gZ[5]),t.ansi[6]=wZ(e.cyan,gZ[6]),t.ansi[7]=wZ(e.white,gZ[7]),t.ansi[8]=wZ(e.brightBlack,gZ[8]),t.ansi[9]=wZ(e.brightRed,gZ[9]),t.ansi[10]=wZ(e.brightGreen,gZ[10]),t.ansi[11]=wZ(e.brightYellow,gZ[11]),t.ansi[12]=wZ(e.brightBlue,gZ[12]),t.ansi[13]=wZ(e.brightMagenta,gZ[13]),t.ansi[14]=wZ(e.brightCyan,gZ[14]),t.ansi[15]=wZ(e.brightWhite,gZ[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=wZ(e.extendedAnsi[r],gZ[r+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(e===void 0){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()}}};CZ=kG([AG(0,lK)],CZ);function wZ(e,t){if(e!==void 0)try{return WY.toColor(e)}catch{}return t}var TZ=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},EZ=class{constructor(){this._services=new TZ,this._services.set(sK,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=eK(e).sort((e,t)=>e.index-t.index),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},DZ={trace:0,debug:1,info:2,warn:3,error:4,off:5},OZ=`xterm.js: `,kZ=class extends KK{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),AZ=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=DZ[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:OZ)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};kZ=kG([AG(0,lK)],kZ);var AZ,jZ=class extends KK{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new fq),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new fq),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new fq),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 t=Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}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,t,...n){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<n.length;t++)this._array[this._getCyclicIndex(e+t)]=n[t];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},MZ=3,NZ=Object.freeze(new JG),PZ=0,FZ=2,IZ=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*MZ);let r=t||XG.fromCharData([0,KG,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*MZ+0],n=t&2097151;return[this._data[e*MZ+1],t&2097152?this._combined[e]:n?HG(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*MZ+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*MZ+0]=e|2097152|t[2]<<22):this._data[e*MZ+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*MZ+0]>>22}hasWidth(e){return this._data[e*MZ+0]&12582912}getFg(e){return this._data[e*MZ+1]}getBg(e){return this._data[e*MZ+2]}hasContent(e){return this._data[e*MZ+0]&4194303}getCodePoint(e){let t=this._data[e*MZ+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*MZ+0]&2097152}getString(e){let t=this._data[e*MZ+0];return t&2097152?this._combined[e]:t&2097151?HG(t&2097151):``}isProtected(e){return this._data[e*MZ+2]&536870912}loadCell(e,t){return PZ=e*MZ,t.content=this._data[PZ+0],t.fg=this._data[PZ+1],t.bg=this._data[PZ+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*MZ+0]=t.content,this._data[e*MZ+1]=t.fg,this._data[e*MZ+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*MZ+0]=t|n<<22,this._data[e*MZ+1]=r.fg,this._data[e*MZ+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*MZ+0];r&2097152?this._combined[e]+=HG(t):r&2097151?(this._combined[e]=HG(r&2097151)+HG(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*MZ+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new XG;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;r<t;++r)this.setCell(e+r,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,t,n){if(e%=this.length,t<this.length-e){let r=new XG;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,t,n,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return this._data.length*4*FZ<this._data.buffer.byteLength;let n=e*MZ;if(e>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);let t=Object.keys(this._combined);for(let n=0;n<t.length;n++){let r=parseInt(t[n],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t<r.length;t++){let n=parseInt(r[t],10);n>=e&&delete this._extendedAttrs[n]}}return this.length=e,n*4*FZ<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*FZ<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t){for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);return}this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}copyFrom(e){this.length===e.length?this._data.set(e._data):this._data=new Uint32Array(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let t=new e(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let e in this._combined)t._combined[e]=this._combined[e];for(let e in this._extendedAttrs)t._extendedAttrs[e]=this._extendedAttrs[e];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*MZ+0]&4194303)return e+(this._data[e*MZ+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*MZ+0]&4194303||this._data[e*MZ+2]&50331648)return e+(this._data[e*MZ+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<MZ;e++)this._data[(n+i)*MZ+e]=a[(t+i)*MZ+e];a[(t+i)*MZ+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<MZ;e++)this._data[(n+i)*MZ+e]=a[(t+i)*MZ+e];a[(t+i)*MZ+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}let o=Object.keys(e._combined);for(let r=0;r<o.length;r++){let i=parseInt(o[r],10);i>=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t<n;){let e=this._data[t*MZ+0],n=e&2097151,a=e&2097152?this._combined[t]:n?HG(n):qG;if(i+=a,r)for(let e=0;e<a.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}};function LZ(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length-1;s++){let c=s,l=e.get(++c);if(!l.isWrapped)continue;let u=[e.get(s)];for(;c<e.length&&l.isWrapped;)u.push(l),l=e.get(++c);if(!a&&r>=s&&r<c){s+=u.length-1;continue}let d=0,f=VZ(u,d,t),p=1,m=0;for(;p<u.length;){let e=VZ(u,p,t),r=e-m,a=n-f,o=Math.min(r,a);u[d].copyCellsFrom(u[p],m,f,o,!1),f+=o,f===n&&(d++,f=0),m+=o,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(n-1)===2&&(u[d].copyCellsFrom(u[d-1],n-1,f++,1,!1),u[d-1].setCell(n-1,i))}u[d].replaceCells(f,n,i);let h=0;for(let e=u.length-1;e>0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o}function RZ(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;o<e.length;o++)if(i===o){let n=t[++r];e.onDeleteEmitter.fire({index:o-a,amount:n}),o+=n-1,a+=n,i=t[++r]}else n.push(o);return{layout:n,countRemoved:a}}function zZ(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let t=0;t<n.length;t++)e.set(t,n[t]);e.length=t.length}function BZ(e,t,n){let r=[],i=e.map((n,r)=>VZ(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;s<i;){if(i-s<n){r.push(i-s);break}a+=n;let c=VZ(e,o,t);a>c&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function VZ(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var HZ=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new fq),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),VK(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};HZ._nextId=1;var UZ=HZ,WZ={},GZ=WZ.B;WZ[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:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},WZ.A={"#":`£`},WZ.B=void 0,WZ[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},WZ.C=WZ[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},WZ.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},WZ.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},WZ.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},WZ.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},WZ.E=WZ[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},WZ.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},WZ.H=WZ[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},WZ[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var KZ=4294967295,qZ=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=NZ.clone(),this.savedCharset=GZ,this.markers=[],this._nullCell=XG.fromCharData([0,KG,1,0]),this._whitespaceCell=XG.fromCharData([0,qG,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new UX,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new jZ(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 YG),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 YG),this._whitespaceCell}getBlankLine(e,t){return new IZ(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>KZ?KZ:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=NZ);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new jZ(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(NZ),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);let a=0;if(this._rows<t)for(let r=this._rows;r<t;r++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new IZ(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new IZ(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let e=this.lines.length-i;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=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=LZ(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(NZ),n);if(r.length>0){let n=RZ(this.lines,r);zZ(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(NZ),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new IZ(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(NZ),i=[],a=0;for(let o=this.lines.length-1;o>=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e<o+c.length)continue}let l=c[c.length-1].getTrimmedLength(),u=BZ(c,this._cols,e),d=u.length-c.length,f;f=this.ybase===0&&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 p=[];for(let e=0;e<d;e++){let e=this.getBlankLine(NZ,!0);p.push(e)}p.length>0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=VZ(c,Math.max(g,0),this._cols))}for(let t=0;t<c.length;t++)u[t]<e&&c[t].setCell(u[t],r);let v=d-f;for(;v-->0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.length>0){let e=[],t=[];for(let e=0;e<this.lines.length;e++)t.push(this.lines.get(e));let n=this.lines.length,r=n-1,o=0,s=i[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+a-1);l>=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+a-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e==null?(this.tabs={},e=0):this.tabs[e]||(e=this.prevStop(e));e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e??=this.x;!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(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 t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,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 t=new UZ(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},JZ=class extends KK{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new fq),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 qZ(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new qZ(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},YZ=2,XZ=1,ZZ=class extends KK{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new fq),this.onResize=this._onResize.event,this._onScroll=this._register(new fq),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,YZ),this.rows=Math.max(e.rawOptions.rows||0,XZ),this.buffers=this._register(new JZ(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};ZZ=kG([AG(0,lK)],ZZ);var QZ={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:PX,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},$Z=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],eQ=class extends KK{constructor(e){super(),this._onOptionChange=this._register(new fq),this.onOptionChange=this._onOptionChange.event;let t={...QZ};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(UK(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=e=>{if(!(e in QZ))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in QZ))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=QZ[e],!tQ(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=QZ[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=$Z.includes(t)?t:QZ[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case`minimumContrastRatio`:t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case`scrollback`:if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={}}return t}};function tQ(e){return e===`block`||e===`underline`||e===`bar`}function nQ(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&nQ(e[r],t-1);return n}var rQ=Object.freeze({insertMode:!1}),iQ=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),aQ=class extends KK{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new fq),this.onData=this._onData.event,this._onUserInput=this._register(new fq),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new fq),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new fq),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=nQ(rQ),this.decPrivateModes=nQ(iQ)}reset(){this.modes=nQ(rQ),this.decPrivateModes=nQ(iQ)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace(`sending binary (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};aQ=kG([AG(0,rK),AG(1,cK),AG(2,lK)],aQ);var oQ={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>e.action!==32||e.button!==3},ANY:{events:31,restrict:e=>!0}};function sQ(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var cQ=String.fromCharCode,lQ={DEFAULT:e=>{let t=[sQ(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${cQ(t[0])}${cQ(t[1])}${cQ(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${sQ(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${sQ(e,!0)};${e.x};${e.y}${t}`}},uQ=class extends KK{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new fq),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(oQ))this.addProtocol(e,oQ[e]);for(let e of Object.keys(lQ))this.addEncoding(e,lQ[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};uQ=kG([AG(0,rK),AG(1,aK),AG(2,lK)],uQ);var dQ=[[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]],fQ=[[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]],pQ;function mQ(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var hQ=class{constructor(){if(this.version=`6`,!pQ){pQ=new Uint8Array(65536),pQ.fill(1),pQ[0]=0,pQ.fill(0,1,32),pQ.fill(0,127,160),pQ.fill(2,4352,4448),pQ[9001]=2,pQ[9002]=2,pQ.fill(2,11904,42192),pQ[12351]=1,pQ.fill(2,44032,55204),pQ.fill(2,63744,64256),pQ.fill(2,65040,65050),pQ.fill(2,65072,65136),pQ.fill(2,65280,65377),pQ.fill(2,65504,65511);for(let e=0;e<dQ.length;++e)pQ.fill(0,dQ[e][0],dQ[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?pQ[e]:mQ(e,fQ)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=gQ.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return gQ.createPropertyValue(0,n,r)}},gQ=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new fq,this.onChange=this._onChange.event;let e=new hQ;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return!!(e&1)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let o=t.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},_Q=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function vQ(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var yQ=2147483647,bQ=256,xQ=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>bQ)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=+!!Array.isArray(t[0]);e<t.length;++e){let r=t[e];if(Array.isArray(r))for(let e=0;e<r.length;++e)n.addSubParam(r[e]);else n.addParam(r)}return n}clone(){let t=new e(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>yQ?yQ: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>yQ?yQ:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,yQ):e}},SQ=[],CQ=class{constructor(){this._state=0,this._active=SQ,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=SQ}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=SQ,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||SQ,!this._active.length)this._handlerFb(this._id,`START`);else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,UG(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3){if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,`END`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}}this._active=SQ,this._id=-1,this._state=0}}},wQ=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=UG(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data=``,this._hitLimit=!1,e));return this._data=``,this._hitLimit=!1,t}},TQ=[],EQ=class{constructor(){this._handlers=Object.create(null),this._active=TQ,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=TQ}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=TQ,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||TQ,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,UG(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=TQ,this._ident=0}},DQ=new xQ;DQ.addParam(0);var OQ=class{constructor(e){this._handler=e,this._data=``,this._params=DQ,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():DQ,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=UG(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=DQ,this._data=``,this._hitLimit=!1,e));return this._params=DQ,this._data=``,this._hitLimit=!1,t}},kQ=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},AQ=160,jQ=function(){let e=new kQ(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(AQ,0,2,0),e.add(AQ,8,5,8),e.add(AQ,6,0,6),e.add(AQ,11,0,11),e.add(AQ,13,13,13),e}(),MQ=class extends KK{constructor(e=jQ){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 xQ,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(UK(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new CQ),this._dcsParser=this._register(new EQ),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state){if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}}for(let n=a;n<t;++n){switch(r=e[n],i=this._transitions.table[this.currentState<<8|(r<160?r:AQ)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<AQ){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<AQ){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<AQ){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<AQ){this._printHandler(e,n,i),n=i-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],s=a?a.length-1:-1;for(;s>=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++n<t&&(r=e[n])>47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r<AQ){this._dcsParser.put(e,n,i),n=i-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,n),o;r===27&&(i|=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 i=n+1;;i++)if(i>=t||(r=e[i])<32||r>127&&r<AQ){this._oscParser.put(e,n,i),n=i-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=i&15}}},NQ=/^([\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})$/,PQ=/^[\da-f]+$/;function FQ(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=NQ.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),PQ.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}}function IQ(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function LQ(e,t=16){let[n,r,i]=e;return`rgb:${IQ(n,t)}/${IQ(r,t)}/${IQ(i,t)}`}var RQ={"(":0,")":1,"*":2,"+":3,"-":1,".":2},zQ=131072,BQ=10;function VQ(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var HQ=5e3,UQ=0,WQ=class extends KK{constructor(e,t,n,r,i,a,o,s,c=new MQ){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new WG,this._utf8Decoder=new GG,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=NZ.clone(),this._eraseAttrDataInternal=NZ.clone(),this._onRequestBell=this._register(new fq),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new fq),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new fq),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new fq),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new fq),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new fq),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new fq),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new fq),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new fq),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new fq),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new fq),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new fq),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new fq),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 GQ(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler($.BEL,()=>this.bell()),this._parser.setExecuteHandler($.LF,()=>this.lineFeed()),this._parser.setExecuteHandler($.VT,()=>this.lineFeed()),this._parser.setExecuteHandler($.FF,()=>this.lineFeed()),this._parser.setExecuteHandler($.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler($.BS,()=>this.backspace()),this._parser.setExecuteHandler($.HT,()=>this.tab()),this._parser.setExecuteHandler($.SO,()=>this.shiftOut()),this._parser.setExecuteHandler($.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(PY.IND,()=>this.index()),this._parser.setExecuteHandler(PY.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(PY.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new wQ(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new wQ(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new wQ(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new wQ(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new wQ(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new wQ(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new wQ(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new wQ(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new wQ(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new wQ(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new wQ(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new wQ(e=>this.restoreCursorColor(e))),this._parser.registerEscHandler({final:`7`},()=>this.saveCursor()),this._parser.registerEscHandler({final:`8`},()=>this.restoreCursor()),this._parser.registerEscHandler({final:`D`},()=>this.index()),this._parser.registerEscHandler({final:`E`},()=>this.nextLine()),this._parser.registerEscHandler({final:`H`},()=>this.tabSet()),this._parser.registerEscHandler({final:`M`},()=>this.reverseIndex()),this._parser.registerEscHandler({final:`=`},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:`>`},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:`c`},()=>this.fullReset()),this._parser.registerEscHandler({final:`n`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`o`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`|`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`}`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`~`},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:`%`,final:`@`},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:`%`,final:`G`},()=>this.selectDefaultCharset());for(let e in WZ)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new OQ((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),HQ))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${HQ} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>zQ&&(a=this._parseStack.position+zQ)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<zQ&&(this._parseBuffer=new Uint32Array(Math.min(e.length,zQ))),o||this._dirtyRowTracker.clearRange(),e.length>zQ)for(let t=a;t<e.length;t+=zQ){let a=t+zQ<e.length?t+zQ:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(s,this._bufferService.rows-1)})}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=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&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;p<n;++p){if(r=e[p],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,f);i=gQ.extractWidth(t);let n=gQ.extractShouldJoin(t),m=n?gQ.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(HG(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-m>s){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof IZ&&d.copyCellsFrom(e,t,0,m,!1);t<s;)e.setCellFromCodepoint(t++,0,1,u)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-m;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<s&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>!VQ(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new OQ(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new wQ(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,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 t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,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}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.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 t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)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 t=e.params[0]||1;for(;t--;)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(NZ));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 t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.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 t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=gQ.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent($.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent($.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent($.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent($.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent($.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,GZ),this._charsetService.setgCharset(1,GZ),this._charsetService.setgCharset(2,GZ),this._charsetService.setgCharset(3,GZ);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 t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){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:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&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,t){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${$.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=JG.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=NZ.fg,e.bg=NZ.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=NZ.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=NZ.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=NZ.fg&16777215,r.bg&=-67108864,r.bg|=NZ.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${$.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[?${e};${t}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=NZ.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle=`block`;break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle=`underline`;break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle=`bar`}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!VQ(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${$.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>BQ&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>BQ&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(KQ(n)){if(r===`?`)t.push({type:0,index:n});else{let e=FQ(r);e&&t.push({type:1,index:n,color:e})}}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):!n.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=FQ(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e]);KQ(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!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,GZ),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(RQ[e[0]],WZ[e[1]]||GZ),!0):(this.selectDefaultCharset(),!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=NZ.clone(),this._eraseAttrDataInternal=NZ.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new XG;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=e=>(this._coreService.triggerDataEvent(`${$.ESC}${e}${$.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},GQ=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,t){e>t&&(UQ=e,e=t,t=UQ),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};GQ=kG([AG(0,rK)],GQ);function KQ(e){return 0<=e&&e<256}var qQ=5e7,JQ=12,YQ=50,XQ=class extends KK{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 fq),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>qQ)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>performance.now()-n>=JQ?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=JQ)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>YQ&&(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()}},ZQ=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};ZQ=kG([AG(0,rK)],ZQ);var QQ=!1,$Q=class extends KK{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new qK),this._onBinary=this._register(new fq),this.onBinary=this._onBinary.event,this._onData=this._register(new fq),this.onData=this._onData.event,this._onLineFeed=this._register(new fq),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new fq),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new fq),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new fq),this._instantiationService=new EZ,this.optionsService=this._register(new eQ(e)),this._instantiationService.setService(lK,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(ZZ)),this._instantiationService.setService(rK,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(kZ)),this._instantiationService.setService(cK,this._logService),this.coreService=this._register(this._instantiationService.createInstance(aQ)),this._instantiationService.setService(aK,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(uQ)),this._instantiationService.setService(iK,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(gQ)),this._instantiationService.setService(dK,this.unicodeService),this._charsetService=this._instantiationService.createInstance(_Q),this._instantiationService.setService(oK,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(ZQ),this._instantiationService.setService(uK,this._oscLinkService),this._inputHandler=this._register(new WQ(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(eq.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(eq.forward(this._bufferService.onResize,this._onResize)),this._register(eq.forward(this.coreService.onData,this._onData)),this._register(eq.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 XQ((e,t)=>this._inputHandler.parse(e,t))),this._register(eq.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new fq),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!QQ&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),QQ=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,YZ),t=Math.max(t,XZ),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(vQ.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(vQ(this._bufferService),!1))),this._windowsWrappingHeuristics.value=UK(()=>{for(let t of e)t.dispose()})}}},e$={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};function t$(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=+!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?i.key=t?$.ESC+`OA`:$.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?i.key=t?$.ESC+`OD`:$.ESC+`[D`:e.key===`UIKeyInputRightArrow`?i.key=t?$.ESC+`OC`:$.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(i.key=t?$.ESC+`OB`:$.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:$.DEL,e.altKey&&(i.key=$.ESC+i.key);break;case 9:if(e.shiftKey){i.key=$.ESC+`[Z`;break}i.key=$.HT,i.cancel=!0;break;case 13:i.key=e.altKey?$.ESC+$.CR:$.CR,i.cancel=!0;break;case 27:i.key=$.ESC,e.altKey&&(i.key=$.ESC+$.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`D`:t?$.ESC+`OD`:$.ESC+`[D`;break;case 39:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`C`:t?$.ESC+`OC`:$.ESC+`[C`;break;case 38:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`A`:t?$.ESC+`OA`:$.ESC+`[A`;break;case 40:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`B`:t?$.ESC+`OB`:$.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=$.ESC+`[2~`);break;case 46:i.key=a?$.ESC+`[3;`+(a+1)+`~`:$.ESC+`[3~`;break;case 36:i.key=a?$.ESC+`[1;`+(a+1)+`H`:t?$.ESC+`OH`:$.ESC+`[H`;break;case 35:i.key=a?$.ESC+`[1;`+(a+1)+`F`:t?$.ESC+`OF`:$.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:i.key=e.ctrlKey?$.ESC+`[5;`+(a+1)+`~`:$.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:i.key=e.ctrlKey?$.ESC+`[6;`+(a+1)+`~`:$.ESC+`[6~`;break;case 112:i.key=a?$.ESC+`[1;`+(a+1)+`P`:$.ESC+`OP`;break;case 113:i.key=a?$.ESC+`[1;`+(a+1)+`Q`:$.ESC+`OQ`;break;case 114:i.key=a?$.ESC+`[1;`+(a+1)+`R`:$.ESC+`OR`;break;case 115:i.key=a?$.ESC+`[1;`+(a+1)+`S`:$.ESC+`OS`;break;case 116:i.key=a?$.ESC+`[15;`+(a+1)+`~`:$.ESC+`[15~`;break;case 117:i.key=a?$.ESC+`[17;`+(a+1)+`~`:$.ESC+`[17~`;break;case 118:i.key=a?$.ESC+`[18;`+(a+1)+`~`:$.ESC+`[18~`;break;case 119:i.key=a?$.ESC+`[19;`+(a+1)+`~`:$.ESC+`[19~`;break;case 120:i.key=a?$.ESC+`[20;`+(a+1)+`~`:$.ESC+`[20~`;break;case 121:i.key=a?$.ESC+`[21;`+(a+1)+`~`:$.ESC+`[21~`;break;case 122:i.key=a?$.ESC+`[23;`+(a+1)+`~`:$.ESC+`[23~`;break;case 123:i.key=a?$.ESC+`[24;`+(a+1)+`~`:$.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=$.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=$.DEL:e.keyCode===219?i.key=$.ESC:e.keyCode===220?i.key=$.FS:e.keyCode===221&&(i.key=$.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=e$[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=$.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=$.ESC+n}else if(e.keyCode===32)i.key=$.ESC+(e.ctrlKey?$.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=$.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=$.US),e.key===`@`&&(i.key=$.NUL))}return i}var n$=0,r$=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new UX,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new UX,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(n$=this._search(t),n$===-1)||this._getKey(this._array[n$])!==t)return!1;do if(this._array[n$]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(n$),!0;while(++n$<this._array.length&&this._getKey(this._array[n$])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(n$=this._search(e),!(n$<0||n$>=this._array.length)&&this._getKey(this._array[n$])===e))do yield this._array[n$];while(++n$<this._array.length&&this._getKey(this._array[n$])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(n$=this._search(e),!(n$<0||n$>=this._array.length)&&this._getKey(this._array[n$])===e))do t(this._array[n$]);while(++n$<this._array.length&&this._getKey(this._array[n$])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},i$=0,a$=0,o$=class extends KK{constructor(){super(),this._decorations=new r$(e=>e?.marker.line),this._onDecorationRegistered=this._register(new fq),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new fq),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(UK(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new s$(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,t=>{i$=t.options.x??0,a$=i$+(t.options.width??1),e>=i$&&e<a$&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},s$=class extends GK{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new fq),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new fq),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 this._cachedBg===null&&(this._cachedBg=this.options.backgroundColor?WY.toColor(this.options.backgroundColor):void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this._cachedFg=this.options.foregroundColor?WY.toColor(this.options.foregroundColor):void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},c$=1e3,l$=class{constructor(e,t=c$){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},u$=20,d$=class extends KK{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;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=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new l$(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(`
|
|
353
|
+
`))),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(LJ(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(UK(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<u$+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
354
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===u$+1&&(this._liveRegion.textContent+=PG.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(!(!a||!o)){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;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 t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};d$=kG([AG(1,sK),AG(2,gK),AG(3,vK)],d$);var f$=class extends KK{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new fq),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new fq),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(UK(()=>{VK(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(LJ(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(LJ(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(LJ(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(LJ(this._element,`mouseup`,this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_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,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)(!this._activeProviderReplies.has(t)||this._activeProviderReplies.get(t))&&(i=!0);if(!i&&r){let e=r.find(e=>this._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&p$(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,VK(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};f$=kG([AG(1,_K),AG(2,vK),AG(3,rK),AG(4,SK)],f$);function p$(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var m$=class extends $Q{constructor(e={}){super(e),this._linkifier=this._register(new qK),this.browser=EX,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new qK),this._onCursorMove=this._register(new fq),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new fq),this.onKey=this._onKey.event,this._onRender=this._register(new fq),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new fq),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new fq),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new fq),this.onBell=this._onBell.event,this._onFocus=this._register(new fq),this._onBlur=this._register(new fq),this._onA11yCharEmitter=this._register(new fq),this._onA11yTabEmitter=this._register(new fq),this._onWillOpen=this._register(new fq),this._setup(),this._decorationService=this._instantiationService.createInstance(o$),this._instantiationService.setService(fK,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(xX),this._instantiationService.setService(SK,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(pK)),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(eq.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(eq.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(eq.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(eq.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(UK(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=UY.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${$.ESC}]${n};${LQ(r)}${FY.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=HY.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=HY.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.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(d$,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.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($.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(LJ(this.element,`copy`,e=>{this.hasSelection()&&LG(e,this._selectionService)}));let e=e=>RG(e,this.textarea,this.coreService,this.optionsService);this._register(LJ(this.textarea,`paste`,e)),this._register(LJ(this.element,`paste`,e)),AX?this._register(LJ(this.element,`mousedown`,e=>{e.button===2&&VG(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(LJ(this.element,`contextmenu`,e=>{VG(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),RX&&this._register(LJ(this.element,`auxclick`,e=>{e.button===1&&BG(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(LJ(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(LJ(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(LJ(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(LJ(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(LJ(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(LJ(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(LJ(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._register(LJ(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,MG.get()),zX||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange(`disableStdin`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(yX,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(gK,this._coreBrowserService),this._register(LJ(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(LJ(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(hX,this._document,this._helperContainer),this._instantiationService.setService(hK,this._charSizeService),this._themeService=this._instantiationService.createInstance(CZ),this._instantiationService.setService(xK,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(XY),this._instantiationService.setService(bK,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(GX,this.rows,this.screenElement)),this._instantiationService.setService(vK,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(IY,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(wX),this._instantiationService.setService(_K,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(f$,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(DY,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(pZ,this.element,this.screenElement,r)),this._instantiationService.setService(yK,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(eq.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(OY,this.screenElement)),this._register(LJ(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(d$,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(NY,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(NY,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(mX,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=t.buttons&1?0:t.buttons&4?1:t.buttons&2?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(LJ(t,`mousedown`,e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)})),this._register(LJ(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=$.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){zG(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key===`Dead`||e.key===`AltGraph`)&&(this._unprocessedDeadKey=!0);let n=t$(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===$.ETX||n.key===$.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(h$(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(NZ));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($.ESC+`[I`):this.coreService.triggerDataEvent($.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${$.ESC}[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${$.ESC}[6;${r};${n}t`)}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function h$(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var g$=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},_$=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new XG)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},v$=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new _$(t)}getNullCell(){return new XG}},y$=class extends KK{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new fq),this.onBufferChange=this._onBufferChange.event,this._normal=new v$(this._core.buffers.normal,`normal`),this._alternate=new v$(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)}},b$=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},x$=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}},S$=[`cols`,`rows`],C$=0,w$=class extends KK{constructor(e){super(),this._core=this._register(new m$(e)),this._addonManager=this._register(new g$),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(S$.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||=new b$(this._core),this._parser}get unicode(){return this._checkProposedApi(),new x$(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||=this._register(new y$(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
355
|
+
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return MG.get()},set promptLabel(e){MG.set(e)},get tooMuchOutput(){return PG.get()},set tooMuchOutput(e){PG.set(e)}}}_verifyIntegers(...e){for(C$ of e)if(C$===1/0||isNaN(C$)||C$%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(C$ of e)if(C$&&(C$===1/0||isNaN(C$)||C$%1!=0||C$<0))throw Error(`This API only accepts positive integers`)}},T$=2,E$=1,D$=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(T$,Math.floor(u/e.css.cell.width)),rows:Math.max(E$,Math.floor(l/e.css.cell.height))}}},O$={fontSize:14,lineHeight:1.24,fontFamily:`'Noto Sans Mono CJK TC', 'Noto Sans Mono CJK SC', 'Source Han Mono TC', 'Source Han Mono SC', 'Sarasa Mono TC', 'Sarasa Mono SC', 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', 'Microsoft JhengHei', 'Microsoft YaHei', 'PingFang TC', 'PingFang SC', monospace`},k$=`[Earlier terminal output was truncated; showing the retained tail.]`;function A$({sessionId:e,onExit:t,onConnected:n,onConnectionLost:r,reconnectNonce:i}){let a=(0,v.useRef)(null),o=(0,v.useRef)(void 0),s=(0,v.useRef)(void 0),c=TR(e=>e.themeMode),[l,u]=(0,v.useState)();return(0,v.useEffect)(()=>{let i=_G(e);if(!i||!a.current){u(`This browser session does not have the capability to attach to this terminal.`);return}let l,d=!1,f=!1,p=!1,m=new w$({cursorBlink:!0,convertEol:!0,...O$,theme:MR[c]});s.current=m;let h=new D$;m.loadAddon(h),m.open(a.current),m.focus();let g=-1,_=-1,v=-1,y=-1,b=({forceFit:e=!1,sync:t=!1}={})=>{let n=a.current?.getBoundingClientRect(),r=n&&(n.width!==g||n.height!==_);if(!n||!e&&!r)return;g=n.width,_=n.height,h.fit();let i=m.cols!==v||m.rows!==y;v=m.cols,y=m.rows,d&&l?.readyState===WebSocket.OPEN&&(t||i)&&l.send(JSON.stringify({type:`resize`,columns:m.cols,rows:m.rows}))},x=new ResizeObserver(()=>b());x.observe(a.current);let S=()=>b({forceFit:!0});o.current=S,document.fonts?.ready.then(()=>{f||b({forceFit:!0})});let C=m.onData(e=>{l?.readyState===WebSocket.OPEN&&l.send(JSON.stringify({type:`input`,data:e}))});return l=new WebSocket(TW(e,i)),l.onopen=()=>{d=!0,u(void 0),n(),b({forceFit:!0,sync:!0}),m.focus()},l.onmessage=e=>{try{let n=JSON.parse(String(e.data));n.type===`replay`&&n.truncated===!0&&m.writeln(`\r\n${k$}\r\n`),n.type===`data`&&typeof n.data==`string`&&m.write(n.data),n.type===`exit`&&typeof n.exitCode==`number`&&(p=!0,m.writeln(`\r\n[session exited: ${n.exitCode}]`),t(n.exitCode))}catch{}},l.onerror=()=>{f||(u(`The terminal connection was lost.`),r())},l.onclose=()=>{!f&&!p&&(u(`The terminal connection was closed.`),r())},()=>{f=!0,s.current===m&&(s.current=void 0),o.current===S&&(o.current=void 0),C.dispose(),x.disconnect(),l?.close(),m.dispose()}},[e,i,t,n,r]),(0,v.useEffect)(()=>{s.current&&(s.current.options.theme=MR[c]),o.current?.()},[c]),(0,Z.jsxs)(`div`,{className:`sessions-terminal-wrap`,children:[l?(0,Z.jsx)(`div`,{className:`sessions-terminal-message`,role:`status`,children:l}):null,(0,Z.jsx)(`div`,{ref:a,className:`sessions-terminal`,"aria-label":`Native agent terminal`,tabIndex:-1})]})}function j$(e){let t=new Map;for(let n of e){if(n.type!==`event`)continue;let{method:e,params:r}=n.event;if(e===`item/started`||e===`item/completed`){let e=r.item;if(!e)continue;let n=`${r.turnId}:${e.id}`;e.type===`agentMessage`&&t.set(n,{id:n,label:`Codex`,text:e.text??``}),e.type===`userMessage`&&t.set(n,{id:n,label:`You`,text:(e.content??[]).map(e=>e.text).join(`
|
|
356
|
+
`)}),e.type===`dynamicToolCall`&&t.set(n,{id:n,label:`Analysis tool`,text:e.status===`inProgress`?`Working…`:e.success===!1||e.status===`failed`?`Failed`:`Completed`})}else if(e===`item/agentMessage/delta`){let e=`${r.turnId}:${r.itemId}`,n=t.get(e);t.set(e,{id:e,label:`Codex`,text:(n?.text??``)+(r.delta??``)})}}return[...t.values()]}function M$({sessionId:e,reconnectNonce:t,onExit:n,onConnected:r,onConnectionLost:i}){let a=(0,v.useRef)(void 0),[o,s]=(0,v.useState)([]),[c,l]=(0,v.useState)(`opening`),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(),[m,h]=(0,v.useState)(``),[g,_]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let t=_G(e);if(!t)return;s([]),l(`opening`),d(!1),p(void 0),_(!1);let o=new URL(TW(e,t));o.pathname=o.pathname.replace(/\/attach$/,`/conversation`),o.searchParams.set(`after`,`0`);let c=new WebSocket(o.toString());a.current=c;let u=!1,f=!1,m=0,h=-1,g=[],v=0;return c.onmessage=e=>{if(!u)try{let t=String(e.data);if(new TextEncoder().encode(t).length>1048576)throw Error(`frame too large`);let i=JSON.parse(t);if(i.type===`error`){_(!1),p(i.code===`busy`?`A response is already in progress.`:`The request could not complete.`);return}if(i.type===`replay`){if(h!==-1||!Number.isSafeInteger(i.throughSequence)||i.throughSequence<0)throw Error(`replay`);h=i.throughSequence,l(i.state),d(i.truncated),r();return}if(h===-1||!Number.isSafeInteger(i.sequence)||i.sequence<=m||i.type!==`event`&&i.type!==`state`)throw Error(`sequence`);m=i.sequence;let a=new TextEncoder().encode(t).length;for(g.push({frame:i,bytes:a}),v+=a;g.length>256||v>1048576;)v-=g.shift().bytes,d(!0);s(g.map(e=>e.frame)),i.type===`state`&&(i.sequence>h&&(l(i.state),_(!1)),(i.state===`failed`||i.state===`closed`)&&(f=!0,n(+(i.state===`failed`))))}catch{p(`The conversation stream is invalid.`),c.close()}},c.onerror=()=>{!u&&!f&&i()},c.onclose=()=>{!u&&!f&&i()},()=>{u=!0,g=[],a.current===c&&(a.current=void 0),c.close()}},[e,t,n,r,i]);let y=()=>{if(!(c!==`ready`||g||!m.trim()||a.current?.readyState!==WebSocket.OPEN)){if(new TextEncoder().encode(m).length>262144){p(`The question is too long.`);return}_(!0),p(void 0),a.current.send(JSON.stringify({type:`prompt`,text:m})),h(``)}};return(0,Z.jsxs)(`section`,{className:`sessions-conversation`,"aria-label":`Codex conversation`,children:[u?(0,Z.jsx)(al,{type:`info`,title:`Earlier conversation was truncated; showing the retained tail.`}):null,f?(0,Z.jsx)(al,{type:`error`,title:f}):null,(0,Z.jsx)(`div`,{className:`sessions-conversation-messages`,role:`log`,"aria-live":`polite`,children:j$(o).map(e=>(0,Z.jsxs)(`article`,{children:[(0,Z.jsx)(`strong`,{children:e.label}),(0,Z.jsx)(`p`,{style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:e.text})]},e.id))}),(0,Z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),y()},children:[(0,Z.jsx)(MA.TextArea,{"aria-label":`Message Codex`,value:m,onChange:e=>h(e.target.value),disabled:c!==`ready`||g,rows:3}),(0,Z.jsx)(ST,{htmlType:`submit`,type:`primary`,disabled:c!==`ready`||g||!m.trim(),children:`Send`}),(0,Z.jsx)(ST,{disabled:c!==`running`,onClick:()=>a.current?.send(JSON.stringify({type:`interrupt`})),children:`Cancel response`})]})]})}var N$={claude:`This Claude session cannot be resumed. Restart creates a new isolated session.`,codex:`This Codex session cannot be resumed. Restart creates a new isolated session.`},P$={claude:`Restart starts a separate Claude conversation in a new isolated terminal.`,codex:`Restart starts a separate Codex conversation in a new isolated terminal.`};function F$(e){return e===`exited`||e===`stopped`||e===`interrupted`||e===`failed`||e===`stale`}function I$(e){if(!F$(e.status))return[];let t=e.lifecycle,n={kind:`restart`,label:`Restart in a new session`,reason:t?.liveAction===`resume`?P$[e.vendor]:t?.reason??N$[e.vendor]};return t?.liveAction===`resume`&&t.resumeAvailable?[{kind:`resume`,label:`Resume conversation`,reason:t.reason??`Resume continues the retained Claude conversation in a new isolated terminal.`},n]:[n]}var L$={analysis:`Analyze data`,setup:`Set up a project`,context_enrichment:`Enrich context`},R$={claude:`Claude`,codex:`Codex`},z$={claude:`Claude CLI`,codex:`Codex CLI`},B$={creating:`Starting`,running:`Running`,detached:`Detached`,exited:`Exited`,stopped:`Stopped`,interrupted:`Unavailable`,failed:`Failed`,stale:`Stale`};function V$(e){let t=Math.max(0,Date.now()-new Date(e).getTime()),n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}var H$=class extends Error{constructor(){super(`This browser cannot create a secure session action. Reload in a supported browser and try again.`),this.name=`NativeSessionLaunchIdError`}};function U$(){let e=globalThis.crypto;return{...typeof e?.randomUUID==`function`?{randomUUID:()=>e.randomUUID()}:{},...typeof e?.getRandomValues==`function`?{getRandomValues:t=>{e.getRandomValues(t)}}:{}}}function W$(e){return e.toString(16).padStart(2,`0`)}function G$(e=U$()){if(e.randomUUID)return e.randomUUID();if(!e.getRandomValues)throw new H$;let t=new Uint8Array(new ArrayBuffer(16));e.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=[...t].map(W$);return`${n.slice(0,4).join(``)}-${n.slice(4,6).join(``)}-${n.slice(6,8).join(``)}-${n.slice(8,10).join(``)}-${n.slice(10,16).join(``)}`}var K$=0,q$=0,J$=new Map,Y$=new Map,X$=new Map;function Z$(e){return e.status===`creating`||e.status===`running`||e.status===`detached`}function Q$(e){Z$(e)||yG(e.id)}var $$=new Map,e1=`genbi-default`;function t1(e,t){return`${t}:${e}`}function n1(e){let t=$$.get(e);if(t)return t;let n={idempotencyKey:G$()};return $$.set(e,n),n}function r1(e,t){let n=$$.get(e);n&&(!t||n===t)&&$$.delete(e)}function i1(e){return JSON.stringify([e.purpose,e.vendor,e.scopeKind,e.scopeId,e.projectIdentity,e.bindingGeneration,e.projectRevision,e.runtimeGeneration??null,e.entryVerb??null,e.dispatchProfile??null])}function a1(e){let t=i1(e),n=J$.get(e.id);if(n?.scope===t)return n;let r={scope:t,idempotencyKey:G$()};return J$.set(e.id,r),r}function o1(e,t){let n=J$.get(e.id);n&&(!t||n===t)&&J$.delete(e.id)}function s1(e){let t=i1(e),n=Y$.get(e.id);if(n?.scope===t)return n;let r={scope:t,idempotencyKey:G$()};return Y$.set(e.id,r),r}function c1(e,t){let n=Y$.get(e.id);n&&(!t||n===t)&&Y$.delete(e.id)}function l1(e){let t=new Map(e.map(e=>[e.id,e]));for(let[e,n]of J$){let r=t.get(e);(!r||n.scope!==i1(r))&&J$.delete(e)}for(let[e,n]of Y$){let r=t.get(e);(!r||n.scope!==i1(r))&&Y$.delete(e)}}function u1(e){return[...e].sort((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime())}var d1=bR((e,t)=>({sessions:[],loading:!1,readinessLoading:!1,async load(){let t=++q$;e({loading:!0,error:void 0});try{let{sessions:n}=await vW();if(t!==q$)return;l1(n),n.forEach(Q$),e({sessions:u1(n),loading:!1})}catch(n){if(t!==q$)return;e({loading:!1,error:n instanceof Error?n.message:`Sessions are unavailable.`})}},refresh(e){let n=X$.get(e);if(n)return n;let r;return r=bW(e).then(({session:e})=>(Q$(e),t().replace(e),e)).catch(()=>void 0).finally(()=>{X$.get(e)===r&&X$.delete(e)}),X$.set(e,r),r},async refreshReadiness(){let n=++K$;e({readiness:void 0,readinessLoading:!0,readinessError:void 0});try{let r=await yW();if(n!==K$)return t().readiness;let i=t().readiness?.runtime?.generation,a=r.runtime?.generation;return i!==void 0&&a!==void 0&&a<i?(e({readinessLoading:!1}),t().readiness):(e({readiness:r,readinessLoading:!1,readinessError:void 0}),r)}catch(r){if(n!==K$)return t().readiness;e({readiness:void 0,readinessLoading:!1,readinessError:r instanceof Error?r.message:`Native terminal hosting is unavailable.`});return}},createSession(e,n,r,i,a){let o=a!==void 0&&a!==`genbi-default`?a:void 0,s=`${t1(e,r)}:${i??`default`}:${o??`default`}`,c=n1(s);if(c.request)return c.request;let l=xW(e,{intent:`start_separate`,idempotencyKey:c.idempotencyKey,...i?{entryVerb:i}:{},...o?{profile:o}:{}}).then(({session:e,capability:r,recoveryCapability:i})=>(r1(s,c),r&&vG(e.id,r),i&&xG(e.id,i),n&&wG(e.id,n),t().replace(e),e)).catch(e=>{throw cW(e)&&r1(s,c),e}).finally(()=>{$$.get(s)===c&&(c.request=void 0)});return c.request=l,l},async openSession(e,n,r){try{let{session:i,capability:a,recoveryCapability:o}=await xW(e,{intent:`open_existing`,sessionId:n});return a&&vG(i.id,a),o&&xG(i.id,o),r&&wG(i.id,r),t().replace(i),i}catch(e){throw t().refresh(n),e}},async restartSession(e,n,r){let i=a1(e);try{let a=e.purpose===`analysis`&&e.dispatchProfile&&e.dispatchProfile!==`genbi-default`?e.dispatchProfile:void 0,o={intent:`start_separate`,idempotencyKey:i.idempotencyKey,...e.entryVerb?{entryVerb:e.entryVerb}:{},...a?{profile:a}:{}},{session:s,capability:c,recoveryCapability:l}=r?await xW(e.purpose,o,r):await xW(e.purpose,o);return o1(e,i),c&&vG(s.id,c),l&&xG(s.id,l),n&&wG(s.id,n),t().replace(s),s}catch(t){throw cW(t)&&o1(e,i),t}},async resumeSession(e,n,r){let i=s1(e);try{let a={intent:`resume`,sessionId:e.id,idempotencyKey:i.idempotencyKey},{session:o,capability:s,recoveryCapability:c}=r?await xW(e.purpose,a,r):await xW(e.purpose,a);return c1(e,i),s&&vG(o.id,s),c&&xG(o.id,c),n&&wG(o.id,n),t().replace(o),o}catch(n){throw cW(n)&&c1(e,i),t().refresh(e.id),n}},async actOnSetupRecovery(e,n,r,i){let a=CG(e),o=await CW(e,n,r,i);if(SG(e),!o){yG(e),await t().refresh(e);return}return yG(e),o.capability&&vG(o.session.id,o.capability),o.recoveryCapability&&xG(o.session.id,o.recoveryCapability),a&&wG(o.session.id,a),t().replace(o.session),o.session},replace(t){Q$(t);let n=J$.get(t.id);n&&n.scope!==i1(t)&&o1(t,n);let r=Y$.get(t.id);r&&r.scope!==i1(t)&&c1(t,r),e(e=>({sessions:u1([t,...e.sessions.filter(e=>e.id!==t.id)])}))}}));function f1(e){return e.status===`running`||e.status===`detached`}function p1(){let[e,t]=(0,v.useState)(()=>typeof window<`u`&&window.innerWidth<=640);return(0,v.useEffect)(()=>{let e=()=>t(window.innerWidth<=640);return window.addEventListener(`resize`,e),e(),()=>window.removeEventListener(`resize`,e)},[]),e}function m1(){return(0,Z.jsxs)(`main`,{className:`sessions-empty`,"aria-labelledby":`sessions-empty-title`,children:[(0,Z.jsx)(`h1`,{id:`sessions-empty-title`,children:`Sessions`}),(0,Z.jsx)(`p`,{children:`Open an existing session or start a separate native agent session from the sidebar.`})]})}function h1(){let{id:e}=CB(),t=yB(),n=d1(e=>e.sessions),r=d1(e=>e.loading),i=d1(e=>e.error),a=d1(e=>e.load),o=d1(e=>e.refresh),s=d1(e=>e.replace),c=d1(e=>e.actOnSetupRecovery),l=d1(e=>e.resumeSession),u=d1(e=>e.restartSession),d=n.find(t=>t.id===e),[f,p]=(0,v.useState)(0),[m,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)(!1),[y,b]=(0,v.useState)(!1),[x,S]=(0,v.useState)(),[C,w]=(0,v.useState)(!1),[T,E]=(0,v.useState)(),[D,O]=(0,v.useState)(!1),[k,A]=(0,v.useState)(),[j,M]=(0,v.useState)(),[N,P]=(0,v.useState)(),[F,I]=(0,v.useState)(!1),L=p1(),R=aW();(0,v.useEffect)(()=>{R&&e&&!d&&o(e)},[R,e,d,o]),(0,v.useEffect)(()=>{_(!1),h(!1)},[e]),(0,v.useEffect)(()=>{d?.purpose===`setup`&&d.status===`stopped`&&SG(d.id)},[d]),(0,v.useEffect)(()=>{d&&!f1(d)&&yG(d.id)},[d]),(0,v.useEffect)(()=>{if(!R||!d||d.purpose!==`setup`){M(void 0);return}let e=!0;return SW(d.id).then(({recovery:t})=>{e&&M(t)}).catch(()=>{e&&M(void 0)}),()=>{e=!1}},[R,d]);let z=(0,v.useCallback)(e=>{h(!1),d&&s({...d,status:`exited`,exitCode:e,endedAt:new Date().toISOString(),updatedAt:new Date().toISOString()})},[s,d]),B=(0,v.useCallback)(()=>{h(!1),_(!0),e&&o(e)},[e,o]),V=(0,v.useCallback)(()=>{_(!1),h(!1)},[]),H=(0,v.useCallback)(()=>{_(!0),e?o(e).finally(()=>h(!1)):h(!1)},[e,o]);if(!e)return(0,Z.jsx)(m1,{});if(!R)return(0,Z.jsx)(`main`,{className:`sessions-empty`,children:(0,Z.jsx)(al,{type:`info`,title:`Sessions require a local BFF connection`,description:`Connect this browser to a local GenBI BFF to create or attach native sessions.`})});if(i)return(0,Z.jsx)(`main`,{className:`sessions-empty`,children:(0,Z.jsx)(al,{type:`error`,title:`Sessions are unavailable`,description:i,action:(0,Z.jsx)(ST,{onClick:()=>void a(),children:`Retry`})})});if(!d)return(0,Z.jsx)(`main`,{className:`sessions-empty`,children:r?(0,Z.jsx)(Bj,{tip:`Loading session…`}):(0,Z.jsx)(al,{type:`warning`,title:`Session not found`,description:`This session may have been removed or is unavailable.`,action:(0,Z.jsx)(ST,{onClick:()=>t(`/sessions`),children:`Back to Sessions`})})});let U=_G(d.id),W=CG(d.id),G=f1(d)&&!!U,ee=I$(d),K=ee.find(e=>e.kind===`resume`),te=ee.find(e=>e.kind===`restart`),ne=async()=>{if(U){b(!0),S(void 0);try{await wW(d.id,U),yG(d.id),SG(d.id),await o(d.id)}catch(e){S(e instanceof Error?e.message:`The native session could not be stopped.`)}finally{b(!1)}}},re=B$[d.status],ie=()=>{W&&(TG(d.id),t(W===`setup`?`/setup`:`/context`,{state:{nativeSessionReturn:W}}))},q=async(e,n)=>{let r=bG(d.id);if(!r){P(`Recovery action capability is unavailable in this browser session. Open the original browser session to act.`);return}I(!0),P(void 0);try{let i=await c(d.id,r,n,e);i?t(`/sessions/${i.id}`,{replace:!0}):await o(d.id)}catch(e){P(e instanceof Error?e.message:`Native Setup recovery action could not be completed.`);let t=await SW(d.id).then(({recovery:e})=>e).catch(()=>void 0);M(t)}finally{I(!1)}},ae=async()=>{if(te){w(!0),E(void 0);try{let e=await u(d,W);yG(d.id),SG(d.id),t(`/sessions/${e.id}`,{replace:!0})}catch(e){E(e instanceof Error?e.message:`A new native session could not be started.`)}finally{w(!1)}}},oe=async()=>{if(K){O(!0),A(void 0);try{let e=await l(d,W);yG(d.id),SG(d.id),t(`/sessions/${e.id}`,{replace:!0})}catch(e){A(e instanceof Error?e.message:`The retained conversation could not be resumed.`)}finally{O(!1)}}},se=f1(d)&&!!U&&!g,ce=d.status!==`stopped`&&!f1(d),le=d.purpose===`setup`&&d.status===`failed`&&!j;return(0,Z.jsxs)(`main`,{className:`sessions-workbench${L?` is-compact`:``}`,"data-testid":`sessions-workbench`,children:[(0,Z.jsxs)(`header`,{className:`sessions-toolbar`,children:[(0,Z.jsxs)(`div`,{className:`sessions-toolbar-title`,children:[(0,Z.jsx)(`strong`,{children:d.entryVerb===`generate_dashboard`?`Build a dashboard`:L$[d.purpose]}),(0,Z.jsxs)(`span`,{children:[d.dispatchProfile??d.agent,` · `,d.dispatchTarget?z$[d.vendor]:d.vendor]})]}),(0,Z.jsx)(iL,{variant:`filled`,color:d.status===`running`?`processing`:d.status===`failed`||d.status===`stale`?`error`:`default`,children:re}),(0,Z.jsxs)(`div`,{className:`sessions-toolbar-actions`,children:[G?(0,Z.jsx)(ST,{size:`small`,icon:(0,Z.jsx)(Zj,{}),loading:m,disabled:m,onClick:()=>{h(!0),_(!1),p(e=>e+1)},children:`Reconnect`}):null,d.status===`running`||d.status===`detached`?(0,Z.jsx)(ST,{size:`small`,danger:!0,icon:(0,Z.jsx)(RU,{}),loading:y,onClick:()=>void ne(),children:`Stop`}):null,K?(0,Z.jsx)(ST,{size:`small`,loading:D,disabled:C,onClick:()=>void oe(),children:K.label}):null,te?(0,Z.jsx)(ST,{size:`small`,loading:C,disabled:D,onClick:()=>void ae(),children:te.label}):null,W?(0,Z.jsxs)(ST,{size:`small`,onClick:ie,children:[`Return to `,W===`setup`?`Setup`:`Context`]}):null]}),x?(0,Z.jsxs)(`span`,{className:`sessions-toolbar-error`,role:`alert`,children:[`Unable to stop this session. `,x,` Reconnect and try again.`]}):null,T?(0,Z.jsxs)(`span`,{className:`sessions-toolbar-error`,role:`alert`,children:[`Unable to restart this session. `,T]}):null,k?(0,Z.jsxs)(`span`,{className:`sessions-toolbar-error`,role:`alert`,children:[`Unable to resume this conversation. `,k,` Restart remains available.`]}):null,j||le?(0,Z.jsxs)(`section`,{className:`sessions-recovery`,"aria-label":`Setup recovery`,"aria-live":`polite`,children:[j?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`strong`,{children:[`Setup recovery: `,j.state.replaceAll(`_`,` `)]}),(0,Z.jsxs)(`span`,{children:[j.phase,` · update `,j.sequence]}),j.state===`reported_complete`?(0,Z.jsx)(`span`,{children:j.completionValidated?`Canonical Setup artifacts validated.`:`Completion was reported, but canonical Setup artifacts are not yet valid.`}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`strong`,{children:`Setup recovery: launch failed`}),(0,Z.jsx)(`span`,{children:`No producer recovery update was received.`})]}),le?(0,Z.jsx)(ST,{size:`small`,loading:F,onClick:()=>void q(`retry`,0),children:`Retry in a new session`}):null,ce&&j?.state===`retryable_failure`?(0,Z.jsx)(ST,{size:`small`,loading:F,onClick:()=>void q(`retry`,j.version),children:`Retry in a new session`}):null,ce&&(j?.state===`needs_input`||j?.state===`needs_decision`)?(0,Z.jsx)(ST,{size:`small`,loading:F,onClick:()=>void q(`continue`,j.version),children:`Continue in a new session`}):null,ce&&j?.state===`needs_decision`?(0,Z.jsx)(ST,{size:`small`,danger:!0,loading:F,onClick:()=>void q(`stop`,j.version),children:`Stop`}):null,N?(0,Z.jsxs)(`span`,{className:`sessions-toolbar-error`,role:`alert`,children:[`Recovery action failed. `,N]}):null]}):null]}),se&&d.transport===`conversation`?(0,Z.jsx)(M$,{sessionId:d.id,reconnectNonce:f,onExit:B,onConnected:V,onConnectionLost:H}):se?(0,Z.jsx)(A$,{sessionId:d.id,reconnectNonce:f,onExit:z,onConnected:V,onConnectionLost:H}):(0,Z.jsx)(`section`,{className:`sessions-terminal-state`,"aria-live":`polite`,children:(0,Z.jsx)(al,{type:d.status===`failed`||d.status===`stale`||d.status===`interrupted`?`error`:`info`,title:f1(d)&&!U?`${d.transport===`conversation`?`Conversation`:`Terminal`} capability unavailable in this browser session`:`Session ${re.toLowerCase()}`,description:te?`${d.failure?`${d.failure} `:``}${K?`${K.reason} ${te.reason}`:te.reason}`:d.failure??(f1(d)&&!U?`Open or create this session in the browser session that owns it, then reconnect. Capabilities are never stored by the server.`:`This native ${d.transport===`conversation`?`conversation`:`terminal`} is not available for attachment.`)})})]})}var g1={verified:!0,summary:`Top 5 customers by revenue this quarter.`,blocks:[{type:`table`,columns:[`Customer`,`Revenue`,`Orders`],rows:[[`Acme Corp`,128400,42],[`Globex`,98200,31],[`Initech`,76500,27],[`Umbrella`,64100,19],[`Soylent`,51800,22]]},{type:`definition`,sql:`SELECT customer, SUM(amount) AS revenue, COUNT(*) AS orders
|
|
356
357
|
FROM orders
|
|
357
358
|
WHERE order_date >= DATE_TRUNC('quarter', CURRENT_DATE)
|
|
358
359
|
GROUP BY customer
|
|
359
360
|
ORDER BY revenue DESC
|
|
360
|
-
LIMIT 5`,source_tables:[`orders`,`customers`],filters:[`order_date >= current quarter`]}]},
|
|
361
|
+
LIMIT 5`,source_tables:[`orders`,`customers`],filters:[`order_date >= current quarter`]}]},_1={verified:!0,summary:`Revenue overview for the last 6 months.`,blocks:[{type:`kpi_card`,label:`Revenue (MTD)`,value:`$418.9k`,delta:12.4,unit:`%`},{type:`kpi_card`,label:`New customers`,value:137,delta:8},{type:`kpi_card`,label:`Churn`,value:`2.1%`,delta:-.3,unit:`pp`},{type:`chart`,chart_type:`bar`,x:`month`,series:[`revenue`],rows:[{month:`Feb`,revenue:302e3},{month:`Mar`,revenue:331e3},{month:`Apr`,revenue:358e3},{month:`May`,revenue:372e3},{month:`Jun`,revenue:401e3},{month:`Jul`,revenue:419e3}]},{type:`table`,columns:[`Plan`,`MRR`,`Accounts`],rows:[[`Enterprise`,24e4,48],[`Team`,132e3,210],[`Starter`,47e3,940]]}]},v1={answerQuery:g1,dashboard:_1,explainChange:{verified:!0,blocks:[{type:`narrative`,title:`Why did revenue rise in July?`,text:`July revenue grew 4.5% over June, driven mainly by the Enterprise plan.
|
|
361
362
|
|
|
362
|
-
Two new Enterprise accounts (Acme Corp, Globex) contributed $38k of the $18k net increase, partly offset by one Team-plan downgrade.`}]},forecast:{estimate:!0,verified:!1,summary:`Projected revenue for the next 3 months (linear trend on verified history).`,blocks:[{type:`chart`,chart_type:`line`,x:`month`,series:[`projected`],rows:[{month:`Aug`,projected:436e3},{month:`Sep`,projected:452e3},{month:`Oct`,projected:469e3}]}]},withUnknownBlock:{verified:!0,blocks:[{type:`narrative`,text:`This answer includes a block this UI version does not render yet.`},{type:`timeline`,events:[{at:`2026-07-01`,label:`launch`}]}]}},
|
|
363
|
+
Two new Enterprise accounts (Acme Corp, Globex) contributed $38k of the $18k net increase, partly offset by one Team-plan downgrade.`}]},forecast:{estimate:!0,verified:!1,summary:`Projected revenue for the next 3 months (linear trend on verified history).`,blocks:[{type:`chart`,chart_type:`line`,x:`month`,series:[`projected`],rows:[{month:`Aug`,projected:436e3},{month:`Sep`,projected:452e3},{month:`Oct`,projected:469e3}]}]},withUnknownBlock:{verified:!0,blocks:[{type:`narrative`,text:`This answer includes a block this UI version does not render yet.`},{type:`timeline`,events:[{at:`2026-07-01`,label:`launch`}]}]}},y1={s1:{id:`s1`,title:`Top customers by revenue`,updatedAt:`2m ago`,events:[{id:`s1-e1`,kind:`user`,text:`What does MRR mean?`},{id:`s1-e2`,kind:`answer`,answer:{form:`text`,verified:!0,dataAnswer:!1,text:`MRR stands for Monthly Recurring Revenue — subscription revenue normalized to a monthly cadence.`}},{id:`s1-e3`,kind:`user`,text:`Top customers by revenue`},{id:`s1-e4`,kind:`answer`,answer:{form:`rich`,envelope:v1.answerQuery}},{id:`s1-e5`,kind:`user`,text:`Turn this into a dashboard`},{id:`s1-e6`,kind:`clarify`,prompt:`Which time range should the dashboard cover?`,chips:[`This month`,`This quarter`,`Last 12 months`]},{id:`s1-e7`,kind:`user`,text:`This quarter`},{id:`s1-e8`,kind:`answer`,answer:{form:`rich`,envelope:v1.dashboard}},{id:`s1-e9`,kind:`artifact`,name:`Revenue dashboard`,artifactKind:`dashboard`,location:`artifacts/revenue-dashboard.json`,artifactId:`fixture-artifact-revenue-dashboard`},{id:`s1-e10`,kind:`published`,artifactName:`Revenue dashboard`,link:`https://share.genbi.example/revenue-dashboard`,scope:`workspace`},{id:`s1-e11`,kind:`user`,text:`Forecast revenue for next quarter`},{id:`s1-e12`,kind:`answer`,answer:{form:`rich`,envelope:v1.forecast},trace:[{id:`s1-w0`,label:`Route`,state:`done`,kind:`decision`,depth:0,detail:`→ forecast: forecasting intent (next quarter)`},{id:`s1-w1`,label:`Query verified history`,state:`done`,kind:`tool`,depth:0,input:{sql:`SELECT date_trunc('month', order_date) AS month, SUM(revenue)
|
|
363
364
|
FROM verified_orders
|
|
364
365
|
GROUP BY 1
|
|
365
|
-
ORDER BY 1`},detail:`Returned 12 rows (Jan–Dec) from verified_orders.`},{id:`s1-w2`,label:`Delegate: forecast sub-agent`,state:`done`,kind:`subagent`,depth:0},{id:`s1-w3`,label:`Fit trend model`,state:`done`,kind:`tool`,parent:`s1-w2`,depth:1},{id:`s1-w4`,label:`Verify gate`,state:`done`,kind:`decision`,depth:0,detail:`verified — grounded in a successful data-access`}]},{id:`s1-e13`,kind:`user`,text:`What is Jane Doe's exact salary?`},{id:`s1-e14`,kind:`refusal`,reason:`This question needs a column your role cannot read.`,fix:`Ask a workspace admin to grant read access, or ask about an aggregate that does not expose individual values.`}],workLog:[]},s2:{id:`s2`,title:`Monthly signups trend`,updatedAt:`1h ago`,events:[{id:`s2-e1`,kind:`user`,text:`Monthly signups trend`},{id:`s2-e2`,kind:`answer`,answer:{form:`rich`,envelope:d1.explainChange},trace:[{id:`s2-w0a`,label:`resolve_intent`,state:`done`,kind:`step`,depth:0,detail:`query_intent: Monthly count of new signups over time, ordered chronologically — a trend line.`},{id:`s2-w0b`,label:`generate_sql`,state:`done`,kind:`step`,depth:0,detail:`Selected the signups_monthly model; grouping by month and ordering ascending to form the trend.`},{id:`s2-w1`,label:`query`,state:`error`,kind:`tool`,depth:0,input:{sql:`SELECT month, signup_cnt FROM signups_monthly ORDER BY month`},detail:`column "signup_cnt" does not exist — did you mean "signup_count"?`},{id:`s2-w2`,label:`query`,state:`done`,kind:`tool`,depth:0,input:{sql:`SELECT month, signup_count FROM signups_monthly ORDER BY month`},detail:`Returned 12 rows from signups_monthly.`}]}],workLog:[]},s3:{id:`s3`,title:`Churn by plan`,updatedAt:`yesterday`,events:[{id:`s3-e1`,kind:`user`,text:`Churn by plan`},{id:`s3-e2`,kind:`answer`,answer:{form:`rich`,envelope:d1.forecast}}],workLog:[]}},p1=0;function m1(e){return p1+=1,`${e}-${p1}`}function h1(e,t,n){return aW()&&n?_1(n,e,t):y1(e,t)}function g1(e,t){e.addEventListener(`worklog`,e=>{t.onWorkLog?.(JSON.parse(e.data))}),e.addEventListener(`event`,e=>{t.onEvent?.(JSON.parse(e.data))}),e.addEventListener(`done`,()=>{t.onDone?.(),e.close()}),e.addEventListener(`error`,n=>{if(`data`in n){let e=Q(`ask.streamErrorGeneric`);try{e=JSON.parse(n.data).message}catch{}t.onError?.(e)}else t.onError?.(Q(`ask.streamConnectionLost`));e.close()})}function _1(e,t,n){let r=!1,i;return pW(e,t).then(t=>{if(!r){if(t.clarify){let e={id:m1(`e`),kind:`clarify`,prompt:t.clarify.prompt,chips:t.clarify.chips};n.onEvent?.(e),n.onDone?.();return}i=new EventSource(mW(e,t.turnId)),g1(i,n)}}).catch(e=>{r||n.onError?.(e instanceof Error?e.message:Q(`ask.harnessUnreachable`))}),()=>{r=!0,i?.close()}}function v1(e,t,n){let r=new EventSource(mW(e,t));return g1(r,n),()=>r.close()}function y1(e,t){let n=[],r=!1,i=(e,t)=>{n.push(setTimeout(()=>{r||t()},e))},a=()=>{r=!0,n.forEach(clearTimeout)},o=e.toLowerCase(),s=(e,t,n={})=>({id:m1(`step`),label:e,state:t,kind:`tool`,...n});if(/\berror\b/.test(o)){let e=s(`Understanding question`,`running`);return i(80,()=>t.onWorkLog?.([e])),i(260,()=>t.onWorkLog?.([{...e,state:`error`}])),i(300,()=>t.onError?.(Q(`ask.streamConnectionLost`))),a}if(/salary|ssn|password/.test(o)){let e=s(`Checking access policy`,`running`);return i(80,()=>t.onWorkLog?.([e])),i(240,()=>t.onWorkLog?.([{...e,state:`error`}])),i(280,()=>{let e={id:m1(`e`),kind:`refusal`,reason:`This question needs a column your role cannot read.`,fix:`Ask a workspace admin to grant read access, or ask about an aggregate that does not expose individual values.`};t.onEvent?.(e),t.onDone?.()}),a}if(/clarify|which\b|compare/.test(o))return i(120,()=>{let e={id:m1(`e`),kind:`clarify`,prompt:`Which time range should I use?`,chips:[`This month`,`This quarter`,`Last 12 months`]};t.onEvent?.(e),t.onDone?.()}),a;if(/forecast|predict/.test(o)){let e=s(`Query verified history`,`running`,{depth:0}),n=s(`Delegate: forecast sub-agent`,`running`,{kind:`subagent`,depth:0}),r=s(`Fit trend model`,`running`,{parent:n.id,depth:1});return i(80,()=>t.onWorkLog?.([e])),i(220,()=>t.onWorkLog?.([{...e,state:`done`},n])),i(360,()=>t.onWorkLog?.([{...e,state:`done`},n,r])),i(520,()=>t.onWorkLog?.([{...e,state:`done`},{...n,state:`done`},{...r,state:`done`}])),i(560,()=>{let e={id:m1(`e`),kind:`answer`,answer:{form:`rich`,envelope:d1.forecast}};t.onEvent?.(e),t.onDone?.()}),a}if(/dashboard/.test(o)){let e=s(`Query verified history`,`running`,{depth:0});return i(80,()=>t.onWorkLog?.([e])),i(260,()=>t.onWorkLog?.([{...e,state:`done`}])),i(300,()=>{let e={id:m1(`e`),kind:`answer`,answer:{form:`rich`,envelope:d1.dashboard}};t.onEvent?.(e)}),i(420,()=>{let e={id:m1(`e`),kind:`artifact`,name:`Revenue dashboard`,artifactKind:`dashboard`,location:`artifacts/revenue-dashboard.json`,artifactId:m1(`fixture-artifact`)};t.onEvent?.(e),t.onDone?.()}),a}if(/why\b|explain/.test(o)){let e=s(`Compare periods`,`running`,{depth:0});return i(80,()=>t.onWorkLog?.([e])),i(240,()=>t.onWorkLog?.([{...e,state:`done`}])),i(280,()=>{let e={id:m1(`e`),kind:`answer`,answer:{form:`rich`,envelope:d1.explainChange}};t.onEvent?.(e),t.onDone?.()}),a}if(e.trim().split(/\s+/).length<=2){let n=s(`Understanding question`,`running`,{depth:0});return i(80,()=>t.onWorkLog?.([n])),i(220,()=>t.onWorkLog?.([{...n,state:`done`}])),i(260,()=>{let n={id:m1(`e`),kind:`answer`,answer:{form:`text`,verified:!0,dataAnswer:!1,text:`Got it — "${e}" is noted. Ask a fuller question and I will pull verified data.`}};t.onEvent?.(n),t.onDone?.()}),a}let c=s(`Parse question`,`running`,{depth:0}),l=s(`Query verified data`,`running`,{depth:0});return i(80,()=>t.onWorkLog?.([c])),i(260,()=>t.onWorkLog?.([{...c,state:`done`},l])),i(440,()=>t.onWorkLog?.([{...c,state:`done`},{...l,state:`done`}])),i(480,()=>{let e={id:m1(`e`),kind:`answer`,answer:{form:`rich`,envelope:d1.answerQuery}};t.onEvent?.(e),t.onDone?.()}),a}function b1(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(r.kind===`saved`&&r.artifactId===t)return!0;if(r.kind===`unsaved`&&r.artifactId===t)return!1}return!1}var x1=`draft`;function S1(e){return{id:e,title:`New session`,updatedAt:`now`,events:[],workLog:[]}}function C1(e,t=60){let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t-1)}…`:n}var w1={};function T1(e,t,n,r,i){let a=n().backendSessionId[e];if(a)return Promise.resolve(a);if(e in w1)return w1[e];let o=uW(t).then(t=>(r(n=>({backendSessionId:{...n.backendSessionId,[e]:t.id},...i?i(t.id,n):{}})),t.id)).finally(()=>{delete w1[e]});return w1[e]=o,o}var E1=bR()((e,t)=>({sessionsById:{...f1},streaming:{},streamError:{},backendSessionId:{},sessionList:[],getOrCreate:n=>{let r=t().sessionsById[n];if(r)return r;let i=S1(n);return e(e=>({sessionsById:{...e.sessionsById,[n]:i}})),n===`draft`||!aW()?i:(e(e=>({backendSessionId:{...e.backendSessionId,[n]:n}})),dW(n).then(t=>{e(e=>{let r=e.sessionsById[n];return!r||r.events.length>0||e.streaming[n]?e:{sessionsById:{...e.sessionsById,[n]:t}}})}).catch(()=>{}),i)},sendMessage:(n,r)=>{let i=r.trim();if(!i)return;t().getOrCreate(n);let a={id:m1(`e`),kind:`user`,text:i};e(e=>{let t=e.sessionsById[n]??S1(n);return{sessionsById:{...e.sessionsById,[n]:{...t,events:[...t.events,a],workLog:[]}},streaming:{...e.streaming,[n]:!0},streamError:{...e.streamError,[n]:void 0}}});let o=n,s={onWorkLog:t=>{e(e=>{let n=e.sessionsById[o];return n?{sessionsById:{...e.sessionsById,[o]:{...n,workLog:t}}}:e})},onEvent:t=>{e(e=>{let n=e.sessionsById[o];if(!n)return e;let r=t.kind===`answer`&&n.workLog.length>0?{...t,trace:n.workLog}:t;return{sessionsById:{...e.sessionsById,[o]:{...n,events:[...n.events,r]}}}})},onError:t=>{e(e=>({streaming:{...e.streaming,[o]:!1},streamError:{...e.streamError,[o]:t}}))},onDone:()=>{e(e=>({streaming:{...e.streaming,[o]:!1}}))}};if(aW()){let r=n===`draft`&&!t().backendSessionId[n];T1(n,r?C1(i):void 0,t,e,r?(e,t)=>{let r=t.sessionsById[n];return r?(o=e,{sessionsById:{...t.sessionsById,[e]:{...r,id:e}},backendSessionId:{...t.backendSessionId,[n]:e,[e]:e},streaming:{...t.streaming,[e]:t.streaming[n]},streamError:{...t.streamError,[e]:t.streamError[n]}}):{}}:void 0).then(e=>(r&&t().loadSessions(),h1(i,s,e))).catch(e=>{s.onError?.(e instanceof Error?e.message:Q(`ask.harnessUnreachable`))})}else h1(i,s)},loadSessions:()=>{aW()&&fW().then(t=>{e({sessionList:t})}).catch(()=>{})},async startStructuredSession(){if(!aW()){let t=m1(`structured-session`),n=S1(t);return e(e=>({sessionsById:{...e.sessionsById,[t]:n}})),t}let t=await uW(`New Structured Ask`),n={...S1(t.id),title:t.title,updatedAt:t.updatedAt};return e(e=>({sessionsById:{...e.sessionsById,[t.id]:n},backendSessionId:{...e.backendSessionId,[t.id]:t.id},sessionList:[{id:t.id,title:t.title,updatedAt:t.updatedAt},...e.sessionList.filter(e=>e.id!==t.id)]})),t.id},clearDraft:()=>{e(e=>{let{[x1]:t,...n}=e.sessionsById,{[x1]:r,...i}=e.backendSessionId,{[x1]:a,...o}=e.streaming,{[x1]:s,...c}=e.streamError;return{sessionsById:n,backendSessionId:i,streaming:o,streamError:c}})},saveArtifact:(n,r)=>{let i=t().sessionsById[n];if(!i)return;let a=i.events.find(e=>e.kind===`artifact`&&e.id===r);if(!a||b1(i.events,a.artifactId))return;let o=t=>{e(e=>{let r=e.sessionsById[n];return!r||b1(r.events,a.artifactId)?e:{sessionsById:{...e.sessionsById,[n]:{...r,events:[...r.events,t]}}}})};if(aW()){if(!a.artifactId)return;PW(t().backendSessionId[n]??n,a.artifactId).then(({savedAt:e})=>{o({id:m1(`e`),kind:`saved`,artifactId:a.artifactId,artifactName:a.name,savedAt:e})}).catch(()=>{});return}o({id:m1(`e`),kind:`saved`,artifactId:a.artifactId,artifactName:a.name,savedAt:new Date().toISOString()})},publishArtifact:(n,r)=>{let i=t().sessionsById[n];if(!i)return;let a=i.events.find(e=>e.kind===`artifact`&&e.id===r);if(!a||i.events.some(e=>e.kind===`published`&&e.artifactName===a.name))return;let o=t=>{e(e=>{let r=e.sessionsById[n];return!r||r.events.some(e=>e.kind===`published`&&e.artifactName===a.name)?e:{sessionsById:{...e.sessionsById,[n]:{...r,events:[...r.events,t]}}}})};if(aW()){if(!a.artifactId)return;LW(t().backendSessionId[n]??n,a.artifactId).then(({link:e,scope:t})=>{o({id:m1(`e`),kind:`published`,artifactName:a.name,link:e,scope:t})}).catch(()=>{});return}o({id:m1(`e`),kind:`published`,artifactName:a.name,link:`https://share.genbi.example/${r}`,scope:`workspace`})}}));function D1(e){return e?`/sessions/ask/${encodeURIComponent(e)}`:`/sessions/ask`}var O1=[`analysis`,`context_enrichment`];function k1({live:e,readiness:t}){let n=yB(),r=i1(e=>e.createSession),i=i1(e=>e.openSession),a=i1(e=>e.load),o=E1(e=>e.startStructuredSession),s=i1(e=>e.sessions),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(`analysis`),[f,p]=(0,v.useState)(),[m,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)(!1),y=(t?.purposes??t)?.[u],b=!!y?.available,x=g?[]:s.filter(e=>e.purpose===u&&(e.status===`running`||e.status===`detached`)),S=async()=>{let i=e?t===void 0?`Checking native terminal availability.`:y?.reason:`Native terminal sessions require a local BFF connection.`;if(i){p(i);return}h(!0),p(void 0);try{let e=await r(u,void 0,`sessions-new`);l(!1),n(`/sessions/${e.id}`)}catch(e){p(e instanceof Error?e.message:`A native session could not be started.`)}finally{h(!1)}},C=async t=>{if(!e){p(`Native terminal sessions require a local BFF connection.`);return}h(!0),p(void 0);try{let e=await i(u,t);l(!1),n(`/sessions/${e.id}`)}catch(e){p(e instanceof Error?e.message:`The selected native session could not be opened.`)}finally{h(!1)}},w=async()=>{h(!0),p(void 0);try{let e=await o();l(!1),n(D1(e))}catch(e){p(e instanceof Error?e.message:`A Structured Ask session could not be created.`)}finally{h(!1)}},T=(0,Z.jsxs)(`div`,{className:`sessions-new-menu`,"aria-label":`New session options`,children:[(0,Z.jsx)(mR.Text,{strong:!0,children:`New session`}),(0,Z.jsxs)(`section`,{"aria-label":`Structured Ask session`,children:[(0,Z.jsx)(mR.Text,{strong:!0,children:`Structured Ask`}),(0,Z.jsx)(mR.Paragraph,{type:`secondary`,children:`Chart-first answers, dashboards, and follow-up questions.`}),(0,Z.jsx)(ST,{type:`primary`,loading:m,onClick:()=>void w(),children:`Start Structured Ask`})]}),(0,Z.jsxs)(`section`,{"aria-label":`Native terminal session`,children:[(0,Z.jsx)(mR.Text,{strong:!0,children:`Native terminal`}),(0,Z.jsx)(mR.Paragraph,{type:`secondary`,children:`Open a running terminal or start a separate CLI session for analysis or context enrichment.`}),(0,Z.jsx)(BT.Group,{name:`native-session-purpose`,value:u,onChange:e=>d(e.target.value),"aria-label":`Native terminal purpose`,children:(0,Z.jsx)(eA,{orientation:`vertical`,children:O1.map(e=>(0,Z.jsx)(BT,{value:e,children:j$[e]},e))})}),(0,Z.jsxs)(mR.Text,{type:`secondary`,children:[`Runtime target: `,y?.targetLabel??`not configured`,` · `,y?.profile??`no dispatch profile`]}),y?.reason?(0,Z.jsx)(mR.Text,{type:`secondary`,children:y.reason}):null,x.length?(0,Z.jsxs)(`section`,{className:`sessions-new-existing`,"aria-label":`Open existing native sessions`,children:[(0,Z.jsx)(mR.Text,{strong:!0,children:`Open existing`}),x.map(e=>{let t=`Open existing ${j$[e.purpose]} session ${e.id.slice(-8)}`;return(0,Z.jsx)(ST,{"aria-label":t,title:t,loading:m,onClick:()=>void C(e.id),children:t},e.id)})]}):null,f?(0,Z.jsx)(mR.Text,{type:`danger`,role:`alert`,children:f}):null,(0,Z.jsx)(ST,{type:`primary`,disabled:!b,onClick:()=>void S(),loading:m,children:`Start separate native terminal`})]})]});return(0,Z.jsx)(aC,{content:T,overlayClassName:`sessions-new-popover`,trigger:`click`,open:c,onOpenChange:e=>{if(l(e),!e){p(void 0),_(!1);return}_(!0),a().finally(()=>_(!1))},placement:`bottomLeft`,children:(0,Z.jsx)(ST,{block:!0,icon:(0,Z.jsx)(SE,{}),children:`New session`})})}function A1(){let e=yB(),{id:t,sessionId:n}=CB(),r=i1(e=>e.sessions),i=i1(e=>e.load),a=i1(e=>e.loading),o=i1(e=>e.error),s=i1(e=>e.readiness),c=i1(e=>e.readinessLoading),l=i1(e=>e.readinessError),u=i1(e=>e.refreshReadiness),d=E1(e=>e.sessionList),f=E1(e=>e.sessionsById),p=E1(e=>e.loadSessions),m=aW();(0,v.useEffect)(()=>{m&&i()},[m,i]),(0,v.useEffect)(()=>{m&&p()},[m,p]),(0,v.useEffect)(()=>{m&&u()},[m,u]);let h=r.filter(e=>e.status===`running`||e.status===`detached`||e.status===`creating`),g=s?.purposes??s,_=r.filter(e=>!h.includes(e)),y=m?d:Object.values(f).filter(e=>e.id!==`draft`).map(e=>({id:e.id,title:e.title,updatedAt:e.updatedAt})),b=n??t,x=y.length?(0,Z.jsxs)(`section`,{className:`sessions-sidebar-group`,"aria-label":`Structured Ask sessions`,children:[(0,Z.jsx)(mR.Text,{type:`secondary`,className:`sessions-sidebar-heading`,children:`Structured Ask`}),y.map(t=>(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>e(D1(t.id)),"aria-current":t.id===b?`page`:void 0,className:`sessions-sidebar-item ${t.id===b?`is-selected`:``}`,children:[(0,Z.jsxs)(`span`,{className:`sessions-sidebar-title sessions-sidebar-title-row`,children:[(0,Z.jsx)(`span`,{className:`sessions-sidebar-purpose`,title:t.title,children:t.title}),(0,Z.jsx)(`span`,{className:`sessions-sidebar-id`,title:t.id,"aria-label":`Session ID ${t.id}`,children:t.id.slice(-8)})]}),(0,Z.jsx)(`span`,{className:`sessions-sidebar-meta`,children:(0,Z.jsx)(`span`,{children:F$(t.updatedAt)})})]},t.id))]}):null,S=(t,n)=>(0,Z.jsxs)(`section`,{className:`sessions-sidebar-group`,"aria-label":t,children:[(0,Z.jsx)(mR.Text,{type:`secondary`,className:`sessions-sidebar-heading`,children:t}),n.map(t=>(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>e(`/sessions/${t.id}`),"aria-current":t.id===b?`page`:void 0,className:`sessions-sidebar-item ${t.id===b?`is-selected`:``}`,children:[(0,Z.jsxs)(`span`,{className:`sessions-sidebar-title sessions-sidebar-title-row`,children:[(0,Z.jsx)(`span`,{className:`sessions-sidebar-purpose`,children:j$[t.purpose]}),(0,Z.jsx)(`span`,{className:`sessions-sidebar-id`,title:t.id,"aria-label":`Session ID ${t.id}`,children:t.id.slice(-8)})]}),(0,Z.jsxs)(`span`,{className:`sessions-sidebar-meta`,children:[(0,Z.jsx)(`span`,{children:`Native terminal`}),(0,Z.jsx)(`span`,{children:M$[t.vendor]}),(0,Z.jsx)(`span`,{children:P$[t.status]}),(0,Z.jsx)(`span`,{children:F$(t.updatedAt)})]})]},t.id))]});return(0,Z.jsxs)(`nav`,{className:`sessions-sidebar`,"aria-label":`Sessions`,children:[(0,Z.jsx)(`div`,{className:`sessions-sidebar-new`,children:(0,Z.jsx)(k1,{live:m,readiness:s})}),m?null:(0,Z.jsx)(`div`,{className:`sessions-sidebar-state`,role:`status`,children:`Native terminal sessions require a local BFF connection.`}),m&&l?(0,Z.jsxs)(`div`,{className:`sessions-sidebar-state`,role:`alert`,children:[`Native host is unavailable. `,l]}):null,m&&c&&!s&&!l?(0,Z.jsx)(`div`,{className:`sessions-sidebar-state`,role:`status`,children:`Checking native terminal availability…`}):null,m&&g&&!O1.some(e=>g[e]?.available)?(0,Z.jsx)(`div`,{className:`sessions-sidebar-state`,role:`alert`,children:`No native terminal target is available on this host. Structured Ask remains available.`}):null,m&&o?(0,Z.jsxs)(`div`,{className:`sessions-sidebar-state`,role:`alert`,children:[`Sessions are unavailable. `,o]}):null,x,m&&!o&&!a&&r.length===0?(0,Z.jsx)(`div`,{className:`sessions-sidebar-state`,children:`No native sessions yet. Start a native terminal session or a Structured Ask.`}):null,h.length?S(`Running`,h):null,_.length?S(`Recent`,_):null]})}function j1({title:e,extra:t,note:n,children:r,bodyStyle:i,className:a}){return(0,Z.jsxs)(PD,{title:e,extra:t,size:`small`,className:a,styles:{body:i},children:[r,n!=null&&(0,Z.jsx)(`div`,{style:{marginTop:8,opacity:.65,fontSize:12},children:n})]})}function M1({label:e,value:t}){return(0,Z.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,gap:16,padding:`4px 0`},children:[(0,Z.jsx)(`span`,{style:{opacity:.65,flexShrink:0},children:e}),(0,Z.jsx)(`span`,{style:{textAlign:`right`,minWidth:0,overflowWrap:`anywhere`},children:t})]})}var N1={verified:{color:AR.verified,icon:(0,Z.jsx)(bH,{}),label:Q(`status.verified`)},estimate:{color:AR.estimate,icon:(0,Z.jsx)(VH,{}),label:Q(`status.estimate`)},refused:{color:AR.refused,icon:(0,Z.jsx)(CH,{}),label:Q(`status.refused`)},unverified:{color:`default`,icon:(0,Z.jsx)(cA,{}),label:Q(`status.unverified`)}};function P1({state:e,label:t}){let n=N1[e];return(0,Z.jsx)(iL,{color:n.color,icon:n.icon,bordered:!0,children:t??n.label})}function F1(e){return e===!0?`verified`:`unverified`}function I1({option:e,height:t=280,className:n,ariaLabel:r=`chart`}){let i=(0,v.useRef)(null),a=(0,v.useRef)(null),o=(0,v.useRef)(e);o.current=e;let s=TR(e=>e.themeMode);return(0,v.useEffect)(()=>{let e=!1,t;return UR(()=>import(`./echarts-LTFC-ysd.js`).then(n=>{if(e||!i.current)return;let r=n.init(i.current,s===`dark`?`dark`:void 0,{renderer:`canvas`});r.setOption(o.current,!0),a.current=r,t=new ResizeObserver(()=>r.resize()),t.observe(i.current)}),[]),()=>{e=!0,t?.disconnect(),a.current?.dispose(),a.current=null}},[s]),(0,v.useEffect)(()=>{a.current?.setOption(e,!0)},[e]),(0,Z.jsx)(`div`,{ref:i,className:n,style:{width:`100%`,height:t,background:`transparent`},role:`img`,"aria-label":r})}function L1(e){return(0,Z.jsx)(GI,{size:`small`,scroll:{x:`max-content`},pagination:e.pagination??{pageSize:10,hideOnSinglePage:!0},...e})}function R1({status:e,title:t,description:n,action:r,onRetry:i}){return(e=>(0,Z.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,minHeight:240,padding:24},role:`status`,children:e}))(e===`loading`?(0,Z.jsx)(Bj,{tip:t??Q(`state.loading`),size:`large`}):e===`error`?(0,Z.jsx)(pM,{status:`warning`,title:t??Q(`state.errorTitle`),subTitle:n,extra:r??(i&&(0,Z.jsx)(ST,{type:`primary`,onClick:i,children:Q(`state.retry`)}))}):(0,Z.jsx)(jx,{description:(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{children:t??Q(`state.emptyTitle`)}),n!=null&&(0,Z.jsx)(`div`,{style:{opacity:.65,marginTop:4},children:n})]}),children:r}))}var z1=class extends v.Component{state={hasError:!1};static getDerivedStateFromError(e){return{hasError:!0,message:e instanceof Error?e.message:String(e)}}render(){return this.state.hasError?this.props.fallback??(0,Z.jsx)(al,{type:`warning`,showIcon:!0,message:Q(`envelope.couldNotRender`),description:this.state.message}):this.props.children}};function B1({maxWidth:e=1e3,title:t,lead:n,actions:r,children:i,className:a}){return(0,Z.jsxs)(`div`,{className:[`genbi-page`,a].filter(Boolean).join(` `),style:{maxWidth:e},children:[t!=null&&(0,Z.jsxs)(`div`,{className:`genbi-page-head`,children:[(0,Z.jsxs)(`div`,{className:`genbi-page-head-text`,children:[(0,Z.jsx)(mR.Title,{level:2,className:`genbi-page-title`,children:t}),n!=null&&(0,Z.jsx)(`p`,{className:`genbi-page-lead`,children:n})]}),r!=null&&(0,Z.jsx)(`div`,{className:`genbi-page-actions`,children:r})]}),(0,Z.jsx)(`div`,{className:`genbi-page-body`,children:i})]})}var V1={label:`Structured Ask · Turn this into a dashboard`,href:`/sessions/ask/s1`};function H1(e){return e.type===`kpi_card`}function U1(e){return e.type===`chart`}function W1(e){return e.type===`table`}function G1(e){return{verified:!0,blocks:e}}var K1=[{key:`a1`,name:`Revenue dashboard`,kind:`dashboard`,verified:!0,createdAt:`2026-07-17 09:20`,location:`artifacts/revenue-dashboard.json`,publish:{link:`https://share.genbi.example/revenue-dashboard`,scope:`workspace`},tiles:[...u1.blocks.filter(H1).map((e,t)=>({key:`revenue-dashboard-kpi-${t}`,title:e.label,envelope:G1([e]),source:V1})),...u1.blocks.filter(U1).map((e,t)=>({key:`revenue-dashboard-chart-${t}`,title:`Revenue trend`,envelope:G1([e]),source:V1})),...u1.blocks.filter(W1).map((e,t)=>({key:`revenue-dashboard-table-${t}`,title:`MRR by plan`,envelope:G1([e]),source:V1}))]},{key:`a2`,name:`Q3 business review`,kind:`report`,verified:!0,createdAt:`2026-07-14 16:05`,location:`artifacts/q3-business-review.html`,source:{label:`Compiled from 12 verified Q3 answers`},preview:{kind:`html`,html:`<h1>Q3 Business Review</h1>
|
|
366
|
-
<p>Revenue grew 9% quarter over quarter, led by the Enterprise plan.</p>`}},{key:`a3`,name:`Monthly signups trend`,kind:`chart`,verified:!0,createdAt:`2026-07-16 11:40`,location:`artifacts/monthly-signups-trend.json`,source:{label:`Structured Ask · Monthly signups trend`,href:`/sessions/ask/s2`},envelope:{verified:!0,summary:`New signups by month, last 6 months.`,blocks:[{type:`chart`,chart_type:`line`,x:`month`,series:[`signups`],rows:[{month:`Feb`,signups:210},{month:`Mar`,signups:244},{month:`Apr`,signups:268},{month:`May`,signups:281},{month:`Jun`,signups:305},{month:`Jul`,signups:322}]}]}}];function q1(e){return Object.fromEntries(e.map(e=>[e.key,e]))}function J1(e,t){return{...e,publish:t}}var Y1=bR()((e,t)=>({selectedKey:K1[0]?.key??``,summaries:K1,detailsByKey:q1(K1),error:void 0,detailError:void 0,select:n=>{e({selectedKey:n,detailError:void 0}),!(!aW()||t().detailsByKey[n])&&NW(n).then(t=>{e(e=>({detailsByKey:{...e.detailsByKey,[t.key]:t},detailError:void 0}))}).catch(t=>{e({detailError:t instanceof Error?t.message:Q(`artifacts.detailLoadFailedMessage`)})})},loadArtifacts:()=>{aW()&&AW().then(n=>{e(e=>({summaries:n,error:void 0,selectedKey:n.some(t=>t.key===e.selectedKey)?e.selectedKey:n[0]?.key??e.selectedKey}));let r=t().selectedKey;r&&!t().detailsByKey[r]&&t().select(r)}).catch(t=>{e({error:t instanceof Error?t.message:Q(`artifacts.loadFailedMessage`)})})},publish:n=>{let r=t().summaries.find(e=>e.key===n)?.sessionId;if(aW()&&r){LW(r,n).then(t=>{e(e=>({summaries:e.summaries.map(e=>e.key===n?J1(e,t):e),detailsByKey:e.detailsByKey[n]?{...e.detailsByKey,[n]:J1(e.detailsByKey[n],t)}:e.detailsByKey}))}).catch(()=>{});return}let i={link:`https://share.genbi.example/${n}`,scope:`workspace`};e(e=>({summaries:e.summaries.map(e=>e.key===n&&!e.publish?J1(e,i):e),detailsByKey:e.detailsByKey[n]&&!e.detailsByKey[n].publish?{...e.detailsByKey,[n]:J1(e.detailsByKey[n],i)}:e.detailsByKey}))},unpin:n=>{let r=t().summaries.find(e=>e.key===n),i=r?.sessionId,a=()=>{e(e=>{let t=e.summaries.filter(e=>e.key!==n),r={...e.detailsByKey};return delete r[n],{summaries:t,detailsByKey:r,selectedKey:e.selectedKey===n?t[0]?.key??``:e.selectedKey}})};if(aW()&&i){(r?.nativeSessionId===void 0?FW(i,n):IW(n)).then(a).catch(()=>{});return}a()}})),X1=[`kpi_card`,`table`,`chart`,`definition`,`narrative`];function Z1(e){return X1.includes(e.type)}function Q1({block:e}){let{label:t,value:n,unit:r,delta:i}=e,a=typeof i==`number`&&Number.isFinite(i);return(0,Z.jsx)(EM,{title:t,value:n,suffix:(0,Z.jsxs)(`span`,{style:{fontSize:14},children:[r?(0,Z.jsxs)(`span`,{style:{opacity:.65},children:[` `,r]}):null,a&&(0,Z.jsxs)(`span`,{style:{marginLeft:8,color:`var(--ant-color-text-secondary)`},children:[a&&i>=0?(0,Z.jsx)(rI,{}):(0,Z.jsx)(eI,{}),Math.abs(i)]})]})})}function $1({block:e}){let t=e.columns??[],n=e.rows??[],r=(0,v.useMemo)(()=>t.map((e,t)=>({title:e,dataIndex:`c${t}`,key:`c${t}`})),[t]),i=(0,v.useMemo)(()=>n.map((e,n)=>{let r={key:n};return t.forEach((t,n)=>{r[`c${n}`]=(Array.isArray(e)?e[n]:e[t])??null}),r}),[n,t]);return t.length===0?(0,Z.jsx)(jx,{image:jx.PRESENTED_IMAGE_SIMPLE,description:Q(`envelope.noTableData`)}):(0,Z.jsx)(L1,{columns:r,dataSource:i})}function e0(e){if(typeof e==`number`)return Number.isFinite(e)?e:null;if(e==null)return null;let t=Number(e);return Number.isFinite(t)?t:null}function t0(e,t,n){return Array.isArray(e)?{x:e[0]??null,values:n.map((t,n)=>e0(e[n+1]))}:{x:e[t]??null,values:n.map(t=>e0(e[t]))}}function n0(e){let{chart_type:t,x:n,series:r,rows:i}=e,a=i.map(e=>t0(e,n,r)),o=a.map(e=>String(e.x??``));if(t===`pie`)return{tooltip:{trigger:`item`},legend:{bottom:0},series:[{type:`pie`,radius:`65%`,data:a.map(e=>({name:String(e.x??``),value:e.values[0]??0}))}]};let s=t===`scatter`,c=t===`area`;return{tooltip:{trigger:s?`item`:`axis`},legend:{data:r,bottom:0},grid:{left:8,right:16,top:24,bottom:32,containLabel:!0},xAxis:{type:`category`,data:o},yAxis:{type:`value`},series:r.map((e,n)=>({name:e,type:c?`line`:s?`scatter`:t,...c?{areaStyle:{}}:{},data:a.map(e=>e.values[n])}))}}function r0({block:e,height:t}){let n=(0,v.useMemo)(()=>n0(e),[e]);return(0,Z.jsx)(I1,{option:n,height:t,ariaLabel:`${e.chart_type} chart`})}function i0({block:e}){let{sql:t,source_tables:n,filters:r}=e;return(0,Z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(mR.Text,{type:`secondary`,style:{fontSize:12},children:Q(`envelope.definitionSql`)}),(0,Z.jsx)(`pre`,{style:{margin:`4px 0 0`,padding:12,borderRadius:8,overflowX:`auto`,fontFamily:AR.fontFamilyCode,fontSize:13,background:`var(--ant-color-fill-quaternary)`},children:(0,Z.jsx)(`code`,{children:t})})]}),(0,Z.jsx)(M1,{label:Q(`envelope.definitionSources`),value:n.length?(0,Z.jsx)(`span`,{children:n.map(e=>(0,Z.jsx)(iL,{style:{marginInlineEnd:4},children:e},e))}):Q(`envelope.definitionNoneFallback`)}),(0,Z.jsx)(M1,{label:Q(`envelope.definitionFilters`),value:r.length?(0,Z.jsx)(`span`,{children:r.map(e=>(0,Z.jsx)(iL,{color:`blue`,style:{marginInlineEnd:4},children:e},e))}):Q(`envelope.definitionEmptyFallback`)})]})}function a0({block:e}){let t=e.text.split(/\n{2,}/).filter(Boolean);return(0,Z.jsxs)(`div`,{children:[e.title?(0,Z.jsx)(mR.Title,{level:5,style:{marginTop:0},children:e.title}):null,t.map((e,t)=>(0,Z.jsx)(mR.Paragraph,{style:{marginBottom:8},children:e},t))]})}function o0({block:e}){return(0,Z.jsx)(al,{type:`info`,showIcon:!0,message:`${Q(`envelope.unsupportedBlockPrefix`)}${e.type}${Q(`envelope.unsupportedBlockSuffix`)}`,description:(0,Z.jsx)(`pre`,{style:{margin:0,fontSize:12,overflowX:`auto`},children:(0,Z.jsx)(`code`,{children:JSON.stringify(e,null,2)})})})}function s0({block:e}){if(!Z1(e))return(0,Z.jsx)(o0,{block:e});switch(e.type){case`kpi_card`:return(0,Z.jsx)(Q1,{block:e});case`table`:return(0,Z.jsx)($1,{block:e});case`chart`:return(0,Z.jsx)(r0,{block:e});case`definition`:return(0,Z.jsx)(i0,{block:e});case`narrative`:return(0,Z.jsx)(a0,{block:e})}}function c0(e){if(e.type===`definition`)return Q(`envelope.derivationTitle`)}function l0(e){return e.estimate===!0?`estimate`:F1(e.verified)}function u0({envelope:e}){let t=l0(e),n=0;for(;n<e.blocks.length&&e.blocks[n].type===`kpi_card`;)n+=1;let r=e.blocks.slice(0,n),i=e.blocks.slice(n);return(0,Z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16},children:[(0,Z.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,Z.jsx)(P1,{state:t}),t===`estimate`&&(0,Z.jsx)(mR.Text,{type:`secondary`,style:{fontSize:12},children:Q(`envelope.estimateBasisNote`)})]}),e.summary?(0,Z.jsx)(mR.Paragraph,{style:{marginBottom:0},children:e.summary}):null,r.length>0&&(0,Z.jsx)(mM,{gutter:[16,16],children:r.map((e,t)=>(0,Z.jsx)(XO,{xs:12,md:8,lg:6,children:(0,Z.jsx)(j1,{children:(0,Z.jsx)(z1,{children:(0,Z.jsx)(s0,{block:e})})})},t))}),i.map((e,t)=>(0,Z.jsx)(j1,{title:c0(e),children:(0,Z.jsx)(z1,{children:(0,Z.jsx)(s0,{block:e})})},t))]})}var d0={dashboard:Q(`artifacts.kindDashboard`),report:Q(`artifacts.kindReport`),chart:Q(`artifacts.kindChart`)};function f0({artifact:e,onUnpin:t}){return(0,Z.jsxs)(j1,{title:e.name,extra:(0,Z.jsx)(ST,{size:`small`,icon:(0,Z.jsx)(bU,{}),onClick:t,children:Q(`artifacts.unpin`)}),children:[(0,Z.jsx)(M1,{label:Q(`artifacts.kindLabel`),value:d0[e.kind]}),(0,Z.jsx)(M1,{label:Q(`artifacts.fileLocation`),value:(0,Z.jsx)(`code`,{children:e.location})}),(0,Z.jsx)(M1,{label:Q(`artifacts.statusLabel`),value:(0,Z.jsx)(P1,{state:F1(e.verified)})})]})}function p0({source:e}){return(0,Z.jsxs)(mR.Text,{type:`secondary`,style:{fontSize:12},children:[Q(`artifacts.sourceLabel`),`: `,e.href?(0,Z.jsx)(PV,{to:e.href,children:e.label}):e.label]})}function m0({artifact:e,onPublish:t,onUnpin:n}){return(0,Z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16},children:[(0,Z.jsx)(f0,{artifact:e,onUnpin:n}),!e.nativeSessionId&&!1,e.tiles&&e.tiles.length>0?(0,Z.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(280px, 1fr))`,gap:16},children:e.tiles.map(e=>(0,Z.jsx)(j1,{title:e.title,note:(0,Z.jsx)(p0,{source:e.source}),children:(0,Z.jsx)(u0,{envelope:e.envelope})},e.key))}):e.envelope?(0,Z.jsx)(j1,{note:e.source&&(0,Z.jsx)(p0,{source:e.source}),children:(0,Z.jsx)(u0,{envelope:e.envelope})}):(0,Z.jsx)(mR.Text,{type:`secondary`,children:Q(`artifacts.detailUnavailableNote`)})]})}function h0({artifact:e,onPublish:t,onUnpin:n}){return(0,Z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16},children:[(0,Z.jsx)(f0,{artifact:e,onUnpin:n}),!1,e.preview?(0,Z.jsx)(j1,{title:Q(`artifacts.previewTitle`),note:e.source&&(0,Z.jsx)(p0,{source:e.source}),children:e.preview.kind===`envelope`?(0,Z.jsx)(u0,{envelope:e.preview.envelope}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(mR.Text,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:8},children:Q(`artifacts.htmlPreviewNote`)}),(0,Z.jsx)(`pre`,{style:{margin:0,padding:12,borderRadius:8,overflowX:`auto`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,fontFamily:AR.fontFamilyCode,fontSize:12,background:`var(--ant-color-fill-quaternary)`},children:(0,Z.jsx)(`code`,{children:e.preview.html})})]})}):(0,Z.jsx)(mR.Text,{type:`secondary`,children:Q(`artifacts.detailUnavailableNote`)})]})}function g0({artifact:e,onPublish:t,onUnpin:n}){return(0,Z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16},children:[(0,Z.jsx)(f0,{artifact:e,onUnpin:n}),!1,e.envelope?(0,Z.jsx)(j1,{note:e.source&&(0,Z.jsx)(p0,{source:e.source}),children:(0,Z.jsx)(u0,{envelope:e.envelope})}):(0,Z.jsx)(mR.Text,{type:`secondary`,children:Q(`artifacts.detailUnavailableNote`)})]})}function _0(){let e=Y1(e=>e.selectedKey),t=Y1(e=>e.summaries),n=Y1(e=>e.detailsByKey),r=Y1(e=>e.loadArtifacts),i=Y1(e=>e.select),a=Y1(e=>e.publish),o=Y1(e=>e.unpin),s=Y1(e=>e.error),c=Y1(e=>e.detailError);(0,v.useEffect)(()=>{r()},[r]);let l=aW(),u=t.find(t=>t.key===e),d=n[e],f;return f=l&&s?(0,Z.jsx)(R1,{status:`error`,title:Q(`artifacts.loadErrorTitle`),description:s,onRetry:r}):u?l&&c&&!d?(0,Z.jsx)(R1,{status:`error`,title:Q(`artifacts.detailErrorTitle`),description:c,onRetry:()=>i(e)}):d?d.kind===`dashboard`?(0,Z.jsx)(m0,{artifact:d,onPublish:()=>a(d.key),onUnpin:()=>o(d.key)}):d.kind===`report`?(0,Z.jsx)(h0,{artifact:d,onPublish:()=>a(d.key),onUnpin:()=>o(d.key)}):(0,Z.jsx)(g0,{artifact:d,onPublish:()=>a(d.key),onUnpin:()=>o(d.key)}):(0,Z.jsx)(R1,{status:`loading`}):(0,Z.jsx)(R1,{status:`empty`,title:Q(`artifacts.emptyTitle`),description:Q(`artifacts.emptyDescription`)}),(0,Z.jsx)(B1,{maxWidth:1e3,title:Q(`nav.artifacts`),lead:Q(`artifacts.pageLead`),children:f})}var v0={dashboard:(0,Z.jsx)($V,{}),report:(0,Z.jsx)(aA,{}),chart:(0,Z.jsx)(cH,{})},y0={dashboard:Q(`artifacts.kindDashboard`),report:Q(`artifacts.kindReport`),chart:Q(`artifacts.kindChart`)};function b0({shared:e}){return(0,Z.jsx)(iL,{color:e?AR.verified:`default`,icon:e?(0,Z.jsx)(FU,{}):(0,Z.jsx)(mU,{}),bordered:!0,children:Q(e?`artifacts.sharedLabel`:`artifacts.notSharedLabel`)})}function x0(){let e=Y1(e=>e.summaries),t=Y1(e=>e.selectedKey),n=Y1(e=>e.select);return(0,Z.jsx)(`nav`,{"aria-label":Q(`artifacts.listHeader`),style:{minWidth:0},children:(0,Z.jsx)(`ul`,{className:`genbi-artifacts-list`,children:e.map(e=>{let r=e.key===t;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`genbi-arow${r?` is-sel`:``}`,"aria-current":r?`true`:void 0,onClick:()=>n(e.key),children:[(0,Z.jsx)(`span`,{className:`genbi-aicon`,"aria-label":y0[e.kind],children:v0[e.kind]}),(0,Z.jsx)(`span`,{className:`genbi-atext`,children:(0,Z.jsx)(`span`,{className:`genbi-aname`,title:e.name,children:e.name})}),(0,Z.jsxs)(`span`,{className:`genbi-abadges`,children:[(0,Z.jsx)(P1,{state:F1(e.verified)}),(0,Z.jsx)(b0,{shared:!!e.publish})]})]})},e.key)})})})}var S0=0;function C0(e,t){let n=e?.run,r=t.run;return!n||!r?!0:r.bindingGeneration===n.bindingGeneration?r.id!==n.id||r.version>=n.version:r.bindingGeneration>n.bindingGeneration}var w0=bR()((e,t)=>({viewMode:`overview`,selectedFileKey:void 0,impactSeedKey:void 0,liveImpactByKey:{},impactError:void 0,liveOverview:void 0,overviewLoading:!1,overviewError:void 0,liveFiles:void 0,filesLoading:!1,filesError:void 0,enrichment:void 0,enrichmentLoading:!1,enrichmentError:void 0,selectFile:t=>e({viewMode:`file`,selectedFileKey:t}),showOverview:()=>e({viewMode:`overview`}),showImpact:t=>{e({viewMode:`impact`,impactSeedKey:t,impactError:void 0}),aW()&&hW(t).then(n=>{e(e=>({liveImpactByKey:{...e.liveImpactByKey,[t]:n}}))}).catch(t=>{e({impactError:t instanceof Error?t.message:Q(`context.impactLoadFailedMessage`)})})},loadOverview:()=>{aW()&&(e({overviewLoading:!0,overviewError:void 0}),gW().then(t=>{e({liveOverview:t,overviewLoading:!1,overviewError:void 0})}).catch(t=>{e({overviewLoading:!1,overviewError:t instanceof Error?t.message:Q(`context.overviewLoadFailedMessage`)})}))},loadFiles:()=>{aW()&&(e({filesLoading:!0,filesError:void 0}),_W().then(t=>{e({liveFiles:t,filesLoading:!1,filesError:void 0})}).catch(t=>{e({filesLoading:!1,filesError:t instanceof Error?t.message:Q(`context.filesLoadFailedMessage`)})}))},loadEnrichment:()=>{if(!aW()||typeof EW!=`function`)return;let t=++S0;e({enrichmentLoading:!0,enrichmentError:void 0}),EW().then(n=>e(e=>t!==S0||!C0(e.enrichment,n)?{enrichmentLoading:!1}:{enrichment:n,enrichmentLoading:!1,enrichmentError:void 0})).catch(n=>{t===S0&&e({enrichmentLoading:!1,enrichmentError:Q(`context.enrichmentLoadFailed`)})})},refreshCanonical:()=>{t().loadOverview(),t().loadFiles(),t().loadEnrichment()}}));function T0(e,t,n){let{nodeWidth:r,columnGap:i=80,rowGap:a=40,componentGap:o=60}=n,s=new Map(e.map(e=>[e.key,e.height])),c=new Set(e.map(e=>e.key)),l=new Map;for(let e of c)l.set(e,new Set);for(let e of t)e.fromModel!==e.toModel&&(!c.has(e.fromModel)||!c.has(e.toModel)||(l.get(e.fromModel).add(e.toModel),l.get(e.toModel).add(e.fromModel)));let u=r+i,d=new Map,f=new Set,p=[],m=0;for(let t of e){if(f.has(t.key))continue;let e=new Map([[t.key,0]]),n=[[t.key]];f.add(t.key);let r=[t.key];for(;r.length>0;){let t=r.shift(),i=e.get(t),a=l.get(t)??new Set;for(let t of a){if(f.has(t))continue;f.add(t);let a=i+1;e.set(t,a),(n[a]??=[]).push(t),r.push(t)}}if(n.length===1&&n[0].length===1){p.push(t.key);continue}let i=0;for(let e=0;e<n.length;e++){let t=n[e]??[],r=0;for(let n of t)d.set(n,{x:e*u,y:m+r}),r+=s.get(n)+a;i=Math.max(i,r-a)}m+=i+o}if(p.length>0){let e=Math.max(1,Math.ceil(Math.sqrt(p.length))),t=m;for(let n=0;n<p.length;n+=e){let r=p.slice(n,n+e),i=Math.max(...r.map(e=>s.get(e)));r.forEach((e,n)=>{d.set(e,{x:n*u,y:t})}),t+=i+a}}return d}var E0=200,D0=34,O0=26,k0=20;function A0(e){switch(e){case`one-to-one`:return`1:1`;case`one-to-many`:return`1:N`;case`many-to-one`:return`N:1`;case`many-to-many`:return`N:N`}}function j0(e){return D0+e.columns.length*O0}function M0({models:e,relationships:t,impact:n,onSelectModel:r}){if(e.length===0)return null;let i=e.some(e=>!e.position)?T0(e.map(e=>({key:e.key,height:j0(e)})),t,{nodeWidth:E0}):void 0,a=new Map(e.map(e=>{let t=e.position??i?.get(e.key)??{x:0,y:0};return[e.key,{x:t.x+k0,y:t.y+k0,width:E0,height:j0(e)}]})),o=Math.max(...[...a.values()].map(e=>e.x+e.width))+k0,s=Math.max(...[...a.values()].map(e=>e.y+e.height))+k0;return(0,Z.jsx)(`div`,{className:`genbi-canvas-er`,children:(0,Z.jsxs)(`div`,{className:`genbi-er-inner`,style:{width:o,height:s},children:[(0,Z.jsx)(`svg`,{className:`genbi-er-edges${n?` is-impact`:``}`,role:`img`,"aria-label":Q(`context.erDiagramAriaLabel`),width:o,height:s,children:t.map(e=>{let t=a.get(e.fromModel),r=a.get(e.toModel);if(!t||!r)return null;let i=t.x+t.width,o=t.y+t.height/2,s=r.x,c=r.y+r.height/2,l=(i+s)/2,u=n&&(e.fromModel===n.selectedKey&&n.affectedKeys.includes(e.toModel)||e.toModel===n.selectedKey&&n.affectedKeys.includes(e.fromModel))?`is-active`:void 0;return(0,Z.jsxs)(`g`,{"data-testid":`er-edge-${e.key}`,children:[(0,Z.jsx)(`path`,{className:u,d:`M ${i},${o} C ${l},${o} ${l},${c} ${s},${c}`}),(0,Z.jsx)(`circle`,{className:u,cx:i,cy:o,r:3}),(0,Z.jsx)(`circle`,{className:u,cx:s,cy:c,r:3}),(0,Z.jsx)(`text`,{x:l,y:(o+c)/2-6,textAnchor:`middle`,children:A0(e.type)})]},e.key)})}),e.map(e=>{let t=a.get(e.key),i=n?.selectedKey===e.key,o=!i&&!!n?.affectedKeys.includes(e.key),s=[`genbi-mnode`,r&&`is-interactive`,i&&`is-selected`,o&&`is-affected`].filter(Boolean).join(` `),c={left:t.x,top:t.y,width:t.width},l=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`genbi-mh`,children:[(0,Z.jsx)(WU,{}),(0,Z.jsx)(`span`,{children:e.name}),(0,Z.jsxs)(`span`,{className:`genbi-cnt`,children:[e.columns.length,` `,Q(`context.erColumnCount`)]})]}),(0,Z.jsx)(`ul`,{children:e.columns.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`span`,{className:`genbi-fn`,children:e.name}),e.key&&(0,Z.jsx)(ZS,{title:Q(`context.inferredKeyHint`),children:(0,Z.jsx)(`span`,{className:`genbi-key genbi-key-${e.key}`,children:e.key===`pk`?Q(`context.erPrimaryKey`):Q(`context.erForeignKey`)})}),(0,Z.jsx)(`span`,{className:`genbi-ft`,children:e.type})]},e.name))})]});return r?(0,Z.jsx)(`button`,{type:`button`,"data-testid":`er-node-${e.key}`,className:s,style:c,onClick:()=>r(e.key),"aria-label":`${Q(`context.viewImpact`)}: ${e.name}`,children:l},e.key):(0,Z.jsx)(`div`,{"data-testid":`er-node-${e.key}`,className:s,style:c,children:l},e.key)})]})})}function N0({purpose:e,title:t,lead:n,returnSource:r}){let i=yB(),a=i1(e=>e.createSession),o=i1(e=>e.readiness),s=i1(e=>e.readinessLoading),c=i1(e=>e.readinessError),l=i1(e=>e.refreshReadiness),u=aW(),[d,f]=(0,v.useState)(!1),[p,m]=(0,v.useState)(),h=o?.purposes?.[e]??o?.[e];(0,v.useEffect)(()=>{u&&l()},[u,l]);let g=async()=>{if(h?.available){f(!0),m(void 0);try{let t=await a(e,r,r);i(`/sessions/${t.id}`)}catch(e){m(e instanceof Error?e.message:`A native session could not be started.`)}finally{f(!1)}}};return(0,Z.jsxs)(`section`,{"aria-label":`${t} native session`,children:[(0,Z.jsx)(mR.Title,{level:4,children:t}),(0,Z.jsx)(mR.Paragraph,{children:n}),u?null:(0,Z.jsx)(mR.Text,{type:`secondary`,children:`A local BFF connection is required to start a native session.`}),u&&s&&!o&&!p?(0,Z.jsx)(mR.Text,{type:`secondary`,children:`Checking native session availability…`}):null,h?.reason?(0,Z.jsx)(mR.Text,{type:`secondary`,children:h.reason}):null,p||c?(0,Z.jsx)(mR.Text,{type:`danger`,role:`alert`,children:p??c}):null,(0,Z.jsx)(eA,{style:{display:`flex`,marginTop:12},wrap:!0,children:(0,Z.jsxs)(ST,{"aria-label":`Start separate ${h?.targetLabel??`interactive CLI`} session`,type:`primary`,icon:(0,Z.jsx)(kH,{}),loading:d,disabled:!u||!h?.available,onClick:()=>void g(),children:[`Start separate `,h?.targetLabel??`interactive CLI`,` session · `,h?.profile??`runtime binding required`]})})]})}function P0(){return(0,Z.jsxs)(j1,{title:Q(`context.enrichmentTitle`),children:[(0,Z.jsx)(N0,{purpose:`context_enrichment`,title:`Enrich context with a native session`,lead:`Continue in the Sessions workbench. The server fences this session to the current bound project generation and revision.`,returnSource:`context`}),(0,Z.jsx)(mR.Paragraph,{type:`secondary`,style:{marginTop:12},children:`Existing enrichment ledger and canonicalization routes remain available for compatibility.`})]})}var F0=`acme-genbi`,I0=`/Users/you/wren-projects/acme-genbi`,L0=[{key:`model.orders`,name:`orders`,position:{x:300,y:24},columns:[{name:`order_id`,type:`varchar`,key:`pk`},{name:`customer_id`,type:`varchar`,key:`fk`},{name:`product_id`,type:`varchar`,key:`fk`},{name:`order_date`,type:`date`},{name:`amount`,type:`decimal`}]},{key:`model.customers`,name:`customers`,position:{x:24,y:190},columns:[{name:`customer_id`,type:`varchar`,key:`pk`},{name:`name`,type:`varchar`},{name:`plan`,type:`varchar`},{name:`signed_up_at`,type:`date`}]},{key:`model.products`,name:`products`,position:{x:580,y:190},columns:[{name:`product_id`,type:`varchar`,key:`pk`},{name:`name`,type:`varchar`},{name:`category`,type:`varchar`}]}],R0=[{key:`relationship.orders_customers`,name:`orders_customers`,fromModel:`model.orders`,toModel:`model.customers`,type:`many-to-one`},{key:`relationship.orders_products`,name:`orders_products`,fromModel:`model.orders`,toModel:`model.products`,type:`many-to-one`}],z0=[{key:`measure.revenue`,name:`revenue`,baseModel:`model.orders`,expression:`SUM(amount)`,additivity:`additive`},{key:`measure.churn_rate`,name:`churn_rate`,baseModel:`model.customers`,expression:`churned_customers / total_customers`,additivity:`non-additive`}],B0={instructionsPresent:!0,verifiedPairCount:18},V0={"model.orders":{seed:{key:`model.orders`,name:`orders`,kind:`model`},downstream:[{key:`relationship.orders_customers`,name:`orders_customers`,kind:`relationship`},{key:`relationship.orders_products`,name:`orders_products`,kind:`relationship`},{key:`measure.revenue`,name:`revenue`,kind:`measure`},{key:`view.top_customers`,name:`top_customers`,kind:`view`}],severity:`semantic`},"model.customers":{seed:{key:`model.customers`,name:`customers`,kind:`model`},downstream:[{key:`relationship.orders_customers`,name:`orders_customers`,kind:`relationship`},{key:`measure.churn_rate`,name:`churn_rate`,kind:`measure`},{key:`view.top_customers`,name:`top_customers`,kind:`view`}],severity:`structural`},"model.products":{seed:{key:`model.products`,name:`products`,kind:`model`},downstream:[{key:`relationship.orders_products`,name:`orders_products`,kind:`relationship`}],severity:`compatibility`},"relationship.orders_customers":{seed:{key:`relationship.orders_customers`,name:`orders_customers`,kind:`relationship`},downstream:[{key:`measure.revenue`,name:`revenue`,kind:`measure`},{key:`view.top_customers`,name:`top_customers`,kind:`view`}],severity:`structural`},"relationship.orders_products":{seed:{key:`relationship.orders_products`,name:`orders_products`,kind:`relationship`},downstream:[{key:`measure.revenue`,name:`revenue`,kind:`measure`}],severity:`compatibility`},"measure.revenue":{seed:{key:`measure.revenue`,name:`revenue`,kind:`measure`},downstream:[{key:`view.top_customers`,name:`top_customers`,kind:`view`}],severity:`structural`},"measure.churn_rate":{seed:{key:`measure.churn_rate`,name:`churn_rate`,kind:`measure`},downstream:[],severity:`none`},"view.top_customers":{seed:{key:`view.top_customers`,name:`top_customers`,kind:`view`},downstream:[],severity:`none`}},H0={"model.orders":[{question:`Which plan has the most churn by revenue?`,refs:[`customers`,`orders`,`measure.revenue`],hitDownstreamKeys:[`measure.revenue`]},{question:`What is total revenue by customer this quarter?`,refs:[`customers`,`orders`,`total_revenue`],hitDownstreamKeys:[`orders`,`total_revenue`]}]},U0=[{key:`root`,title:`wren_project`,children:[{key:`dir.models`,title:`models`,children:[{key:`model.orders`,title:`orders.model.yaml`,kind:`model`,path:`wren_project/models/orders.model.yaml`,content:`# wren_project/models/orders.model.yaml
|
|
366
|
+
ORDER BY 1`},detail:`Returned 12 rows (Jan–Dec) from verified_orders.`},{id:`s1-w2`,label:`Delegate: forecast sub-agent`,state:`done`,kind:`subagent`,depth:0},{id:`s1-w3`,label:`Fit trend model`,state:`done`,kind:`tool`,parent:`s1-w2`,depth:1},{id:`s1-w4`,label:`Verify gate`,state:`done`,kind:`decision`,depth:0,detail:`verified — grounded in a successful data-access`}]},{id:`s1-e13`,kind:`user`,text:`What is Jane Doe's exact salary?`},{id:`s1-e14`,kind:`refusal`,reason:`This question needs a column your role cannot read.`,fix:`Ask a workspace admin to grant read access, or ask about an aggregate that does not expose individual values.`}],workLog:[]},s2:{id:`s2`,title:`Monthly signups trend`,updatedAt:`1h ago`,events:[{id:`s2-e1`,kind:`user`,text:`Monthly signups trend`},{id:`s2-e2`,kind:`answer`,answer:{form:`rich`,envelope:v1.explainChange},trace:[{id:`s2-w0a`,label:`resolve_intent`,state:`done`,kind:`step`,depth:0,detail:`query_intent: Monthly count of new signups over time, ordered chronologically — a trend line.`},{id:`s2-w0b`,label:`generate_sql`,state:`done`,kind:`step`,depth:0,detail:`Selected the signups_monthly model; grouping by month and ordering ascending to form the trend.`},{id:`s2-w1`,label:`query`,state:`error`,kind:`tool`,depth:0,input:{sql:`SELECT month, signup_cnt FROM signups_monthly ORDER BY month`},detail:`column "signup_cnt" does not exist — did you mean "signup_count"?`},{id:`s2-w2`,label:`query`,state:`done`,kind:`tool`,depth:0,input:{sql:`SELECT month, signup_count FROM signups_monthly ORDER BY month`},detail:`Returned 12 rows from signups_monthly.`}]}],workLog:[]},s3:{id:`s3`,title:`Churn by plan`,updatedAt:`yesterday`,events:[{id:`s3-e1`,kind:`user`,text:`Churn by plan`},{id:`s3-e2`,kind:`answer`,answer:{form:`rich`,envelope:v1.forecast}}],workLog:[]}},b1=0;function x1(e){return b1+=1,`${e}-${b1}`}function S1(e,t,n){return aW()&&n?w1(n,e,t):E1(e,t)}function C1(e,t){e.addEventListener(`worklog`,e=>{t.onWorkLog?.(JSON.parse(e.data))}),e.addEventListener(`event`,e=>{t.onEvent?.(JSON.parse(e.data))}),e.addEventListener(`done`,()=>{t.onDone?.(),e.close()}),e.addEventListener(`error`,n=>{if(`data`in n){let e=Q(`ask.streamErrorGeneric`);try{e=JSON.parse(n.data).message}catch{}t.onError?.(e)}else t.onError?.(Q(`ask.streamConnectionLost`));e.close()})}function w1(e,t,n){let r=!1,i;return pW(e,t).then(t=>{if(!r){if(t.clarify){let e={id:x1(`e`),kind:`clarify`,prompt:t.clarify.prompt,chips:t.clarify.chips};n.onEvent?.(e),n.onDone?.();return}i=new EventSource(mW(e,t.turnId)),C1(i,n)}}).catch(e=>{r||n.onError?.(e instanceof Error?e.message:Q(`ask.harnessUnreachable`))}),()=>{r=!0,i?.close()}}function T1(e,t,n){let r=new EventSource(mW(e,t));return C1(r,n),()=>r.close()}function E1(e,t){let n=[],r=!1,i=(e,t)=>{n.push(setTimeout(()=>{r||t()},e))},a=()=>{r=!0,n.forEach(clearTimeout)},o=e.toLowerCase(),s=(e,t,n={})=>({id:x1(`step`),label:e,state:t,kind:`tool`,...n});if(/\berror\b/.test(o)){let e=s(`Understanding question`,`running`);return i(80,()=>t.onWorkLog?.([e])),i(260,()=>t.onWorkLog?.([{...e,state:`error`}])),i(300,()=>t.onError?.(Q(`ask.streamConnectionLost`))),a}if(/salary|ssn|password/.test(o)){let e=s(`Checking access policy`,`running`);return i(80,()=>t.onWorkLog?.([e])),i(240,()=>t.onWorkLog?.([{...e,state:`error`}])),i(280,()=>{let e={id:x1(`e`),kind:`refusal`,reason:`This question needs a column your role cannot read.`,fix:`Ask a workspace admin to grant read access, or ask about an aggregate that does not expose individual values.`};t.onEvent?.(e),t.onDone?.()}),a}if(/clarify|which\b|compare/.test(o))return i(120,()=>{let e={id:x1(`e`),kind:`clarify`,prompt:`Which time range should I use?`,chips:[`This month`,`This quarter`,`Last 12 months`]};t.onEvent?.(e),t.onDone?.()}),a;if(/forecast|predict/.test(o)){let e=s(`Query verified history`,`running`,{depth:0}),n=s(`Delegate: forecast sub-agent`,`running`,{kind:`subagent`,depth:0}),r=s(`Fit trend model`,`running`,{parent:n.id,depth:1});return i(80,()=>t.onWorkLog?.([e])),i(220,()=>t.onWorkLog?.([{...e,state:`done`},n])),i(360,()=>t.onWorkLog?.([{...e,state:`done`},n,r])),i(520,()=>t.onWorkLog?.([{...e,state:`done`},{...n,state:`done`},{...r,state:`done`}])),i(560,()=>{let e={id:x1(`e`),kind:`answer`,answer:{form:`rich`,envelope:v1.forecast}};t.onEvent?.(e),t.onDone?.()}),a}if(/dashboard/.test(o)){let e=s(`Query verified history`,`running`,{depth:0});return i(80,()=>t.onWorkLog?.([e])),i(260,()=>t.onWorkLog?.([{...e,state:`done`}])),i(300,()=>{let e={id:x1(`e`),kind:`answer`,answer:{form:`rich`,envelope:v1.dashboard}};t.onEvent?.(e)}),i(420,()=>{let e={id:x1(`e`),kind:`artifact`,name:`Revenue dashboard`,artifactKind:`dashboard`,location:`artifacts/revenue-dashboard.json`,artifactId:x1(`fixture-artifact`)};t.onEvent?.(e),t.onDone?.()}),a}if(/why\b|explain/.test(o)){let e=s(`Compare periods`,`running`,{depth:0});return i(80,()=>t.onWorkLog?.([e])),i(240,()=>t.onWorkLog?.([{...e,state:`done`}])),i(280,()=>{let e={id:x1(`e`),kind:`answer`,answer:{form:`rich`,envelope:v1.explainChange}};t.onEvent?.(e),t.onDone?.()}),a}if(e.trim().split(/\s+/).length<=2){let n=s(`Understanding question`,`running`,{depth:0});return i(80,()=>t.onWorkLog?.([n])),i(220,()=>t.onWorkLog?.([{...n,state:`done`}])),i(260,()=>{let n={id:x1(`e`),kind:`answer`,answer:{form:`text`,verified:!0,dataAnswer:!1,text:`Got it — "${e}" is noted. Ask a fuller question and I will pull verified data.`}};t.onEvent?.(n),t.onDone?.()}),a}let c=s(`Parse question`,`running`,{depth:0}),l=s(`Query verified data`,`running`,{depth:0});return i(80,()=>t.onWorkLog?.([c])),i(260,()=>t.onWorkLog?.([{...c,state:`done`},l])),i(440,()=>t.onWorkLog?.([{...c,state:`done`},{...l,state:`done`}])),i(480,()=>{let e={id:x1(`e`),kind:`answer`,answer:{form:`rich`,envelope:v1.answerQuery}};t.onEvent?.(e),t.onDone?.()}),a}function D1(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(r.kind===`saved`&&r.artifactId===t)return!0;if(r.kind===`unsaved`&&r.artifactId===t)return!1}return!1}var O1=`draft`;function k1(e){return{id:e,title:`New session`,updatedAt:`now`,events:[],workLog:[]}}function A1(e,t=60){let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t-1)}…`:n}var j1={};function M1(e,t,n,r,i){let a=n().backendSessionId[e];if(a)return Promise.resolve(a);if(e in j1)return j1[e];let o=uW(t).then(t=>(r(n=>({backendSessionId:{...n.backendSessionId,[e]:t.id},...i?i(t.id,n):{}})),t.id)).finally(()=>{delete j1[e]});return j1[e]=o,o}var N1=bR()((e,t)=>({sessionsById:{...y1},streaming:{},streamError:{},backendSessionId:{},sessionList:[],getOrCreate:n=>{let r=t().sessionsById[n];if(r)return r;let i=k1(n);return e(e=>({sessionsById:{...e.sessionsById,[n]:i}})),n===`draft`||!aW()?i:(e(e=>({backendSessionId:{...e.backendSessionId,[n]:n}})),dW(n).then(t=>{e(e=>{let r=e.sessionsById[n];return!r||r.events.length>0||e.streaming[n]?e:{sessionsById:{...e.sessionsById,[n]:t}}})}).catch(()=>{}),i)},sendMessage:(n,r)=>{let i=r.trim();if(!i)return;t().getOrCreate(n);let a={id:x1(`e`),kind:`user`,text:i};e(e=>{let t=e.sessionsById[n]??k1(n);return{sessionsById:{...e.sessionsById,[n]:{...t,events:[...t.events,a],workLog:[]}},streaming:{...e.streaming,[n]:!0},streamError:{...e.streamError,[n]:void 0}}});let o=n,s={onWorkLog:t=>{e(e=>{let n=e.sessionsById[o];return n?{sessionsById:{...e.sessionsById,[o]:{...n,workLog:t}}}:e})},onEvent:t=>{e(e=>{let n=e.sessionsById[o];if(!n)return e;let r=t.kind===`answer`&&n.workLog.length>0?{...t,trace:n.workLog}:t;return{sessionsById:{...e.sessionsById,[o]:{...n,events:[...n.events,r]}}}})},onError:t=>{e(e=>({streaming:{...e.streaming,[o]:!1},streamError:{...e.streamError,[o]:t}}))},onDone:()=>{e(e=>({streaming:{...e.streaming,[o]:!1}}))}};if(aW()){let r=n===`draft`&&!t().backendSessionId[n];M1(n,r?A1(i):void 0,t,e,r?(e,t)=>{let r=t.sessionsById[n];return r?(o=e,{sessionsById:{...t.sessionsById,[e]:{...r,id:e}},backendSessionId:{...t.backendSessionId,[n]:e,[e]:e},streaming:{...t.streaming,[e]:t.streaming[n]},streamError:{...t.streamError,[e]:t.streamError[n]}}):{}}:void 0).then(e=>(r&&t().loadSessions(),S1(i,s,e))).catch(e=>{s.onError?.(e instanceof Error?e.message:Q(`ask.harnessUnreachable`))})}else S1(i,s)},loadSessions:()=>{aW()&&fW().then(t=>{e({sessionList:t})}).catch(()=>{})},async startStructuredSession(){if(!aW()){let t=x1(`structured-session`),n=k1(t);return e(e=>({sessionsById:{...e.sessionsById,[t]:n}})),t}let t=await uW(`New Structured Ask`),n={...k1(t.id),title:t.title,updatedAt:t.updatedAt};return e(e=>({sessionsById:{...e.sessionsById,[t.id]:n},backendSessionId:{...e.backendSessionId,[t.id]:t.id},sessionList:[{id:t.id,title:t.title,updatedAt:t.updatedAt},...e.sessionList.filter(e=>e.id!==t.id)]})),t.id},clearDraft:()=>{e(e=>{let{[O1]:t,...n}=e.sessionsById,{[O1]:r,...i}=e.backendSessionId,{[O1]:a,...o}=e.streaming,{[O1]:s,...c}=e.streamError;return{sessionsById:n,backendSessionId:i,streaming:o,streamError:c}})},saveArtifact:(n,r)=>{let i=t().sessionsById[n];if(!i)return;let a=i.events.find(e=>e.kind===`artifact`&&e.id===r);if(!a||D1(i.events,a.artifactId))return;let o=t=>{e(e=>{let r=e.sessionsById[n];return!r||D1(r.events,a.artifactId)?e:{sessionsById:{...e.sessionsById,[n]:{...r,events:[...r.events,t]}}}})};if(aW()){if(!a.artifactId)return;PW(t().backendSessionId[n]??n,a.artifactId).then(({savedAt:e})=>{o({id:x1(`e`),kind:`saved`,artifactId:a.artifactId,artifactName:a.name,savedAt:e})}).catch(()=>{});return}o({id:x1(`e`),kind:`saved`,artifactId:a.artifactId,artifactName:a.name,savedAt:new Date().toISOString()})},publishArtifact:(n,r)=>{let i=t().sessionsById[n];if(!i)return;let a=i.events.find(e=>e.kind===`artifact`&&e.id===r);if(!a||i.events.some(e=>e.kind===`published`&&e.artifactName===a.name))return;let o=t=>{e(e=>{let r=e.sessionsById[n];return!r||r.events.some(e=>e.kind===`published`&&e.artifactName===a.name)?e:{sessionsById:{...e.sessionsById,[n]:{...r,events:[...r.events,t]}}}})};if(aW()){if(!a.artifactId)return;LW(t().backendSessionId[n]??n,a.artifactId).then(({link:e,scope:t})=>{o({id:x1(`e`),kind:`published`,artifactName:a.name,link:e,scope:t})}).catch(()=>{});return}o({id:x1(`e`),kind:`published`,artifactName:a.name,link:`https://share.genbi.example/${r}`,scope:`workspace`})}}));function P1(e){return e?`/sessions/ask/${encodeURIComponent(e)}`:`/sessions/ask`}var F1=[`analysis`,`context_enrichment`];function I1({live:e,readiness:t}){let n=yB(),r=d1(e=>e.createSession),i=d1(e=>e.openSession),a=d1(e=>e.load),o=N1(e=>e.startStructuredSession),s=d1(e=>e.sessions),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(`analysis`),[f,p]=(0,v.useState)(`answer_query`),[m,h]=(0,v.useState)(e1),[g,_]=(0,v.useState)(),[y,b]=(0,v.useState)(!1),[x,S]=(0,v.useState)(!1),C=(t?.purposes??t)?.[u],w=u===`analysis`&&t?.profiles?Object.values(t.profiles):[],T=w.length>0,E=T?w.find(e=>e.id===m)??w.find(e=>e.id===`genbi-default`):void 0,D=E!==void 0&&E.id!==`genbi-default`,O=E??(T?void 0:C),k=!!O?.available,A=u===`analysis`&&C?.target===`codex:interactive`&&!D,j=x?[]:s.filter(e=>e.purpose===u&&(e.status===`running`||e.status===`detached`)),M=async()=>{let i=e?t===void 0?`Checking native terminal availability.`:O?.reason:`Native terminal sessions require a local BFF connection.`;if(i){_(i);return}b(!0),_(void 0);try{let e=await r(u,void 0,`sessions-new`,A?f:void 0,D?E.id:void 0);l(!1),n(`/sessions/${e.id}`)}catch(e){_(e instanceof Error?e.message:`A native session could not be started.`)}finally{b(!1)}},N=async t=>{if(!e){_(`Native terminal sessions require a local BFF connection.`);return}b(!0),_(void 0);try{let e=await i(u,t);l(!1),n(`/sessions/${e.id}`)}catch(e){_(e instanceof Error?e.message:`The selected native session could not be opened.`)}finally{b(!1)}},P=async()=>{b(!0),_(void 0);try{let e=await o();l(!1),n(P1(e))}catch(e){_(e instanceof Error?e.message:`A Structured Ask session could not be created.`)}finally{b(!1)}},F=(0,Z.jsxs)(`div`,{className:`sessions-new-menu`,"aria-label":`New session options`,children:[(0,Z.jsx)(mR.Text,{strong:!0,children:`New session`}),(0,Z.jsxs)(`section`,{"aria-label":`Structured Ask session`,children:[(0,Z.jsx)(mR.Text,{strong:!0,children:`Structured Ask`}),(0,Z.jsx)(mR.Paragraph,{type:`secondary`,children:`Chart-first answers, dashboards, and follow-up questions.`}),(0,Z.jsx)(ST,{type:`primary`,loading:y,onClick:()=>void P(),children:`Start Structured Ask`})]}),(0,Z.jsxs)(`section`,{"aria-label":`Native terminal session`,children:[(0,Z.jsx)(mR.Text,{strong:!0,children:`Native terminal`}),(0,Z.jsx)(mR.Paragraph,{type:`secondary`,children:`Open a running terminal or start a separate CLI session for analysis or context enrichment.`}),(0,Z.jsx)(BT.Group,{name:`native-session-purpose`,value:u,onChange:e=>d(e.target.value),"aria-label":`Native terminal purpose`,children:(0,Z.jsx)(eA,{orientation:`vertical`,children:F1.map(e=>(0,Z.jsx)(BT,{value:e,children:L$[e]},e))})}),T?(0,Z.jsxs)(`label`,{className:`sessions-new-profile`,children:[(0,Z.jsx)(mR.Text,{strong:!0,children:`Conversation profile`}),(0,Z.jsx)(cS,{"aria-label":`Conversation profile`,value:E?.id,onChange:e=>h(e),disabled:y,virtual:!1,options:w.map(e=>({value:e.id,label:e.id===`genbi-default`?`${e.id} (default)`:e.id,disabled:!e.available,title:e.available?void 0:e.reason})),optionRender:e=>{let t=w.find(t=>t.id===e.value);return(0,Z.jsxs)(`span`,{className:`sessions-new-profile-option`,"data-available":t?.available?`true`:`false`,children:[(0,Z.jsx)(`span`,{children:e.label}),t&&!t.available?(0,Z.jsx)(mR.Text,{type:`secondary`,className:`sessions-new-profile-reason`,children:t.reason??`Not selectable`}):null]})}}),D?(0,Z.jsxs)(mR.Text,{type:`secondary`,children:[`Enters at `,E.entryKind===`agent`?`the ${E.entryVerb??`pinned`} component`:`the profile scope`,`; the entry was decided when the profile was admitted.`]}):null]}):null,A?(0,Z.jsxs)(`fieldset`,{disabled:y,children:[(0,Z.jsx)(`legend`,{children:`Start with`}),(0,Z.jsx)(BT.Group,{name:`native-session-entry`,value:f,onChange:e=>p(e.target.value),"aria-label":`Session entry`,children:(0,Z.jsxs)(eA,{orientation:`vertical`,children:[(0,Z.jsx)(BT,{value:`answer_query`,children:`Answer a question`}),(0,Z.jsx)(BT,{value:`generate_dashboard`,children:`Build a dashboard`})]})}),(0,Z.jsx)(mR.Paragraph,{type:`secondary`,children:`This session keeps the selected entry. Start another session to change it.`})]}):null,(0,Z.jsxs)(mR.Text,{type:`secondary`,children:[`Runtime target: `,O?.targetLabel??`not configured`,` · `,O?.profile??`no dispatch profile`]}),O?.reason?(0,Z.jsx)(mR.Text,{type:`secondary`,"data-testid":`native-session-reason`,children:O.reason}):null,j.length?(0,Z.jsxs)(`section`,{className:`sessions-new-existing`,"aria-label":`Open existing native sessions`,children:[(0,Z.jsx)(mR.Text,{strong:!0,children:`Open existing`}),j.map(e=>{let t=`Open existing ${L$[e.purpose]} session ${e.id.slice(-8)}`;return(0,Z.jsx)(ST,{"aria-label":t,title:t,loading:y,onClick:()=>void N(e.id),children:t},e.id)})]}):null,g?(0,Z.jsx)(mR.Text,{type:`danger`,role:`alert`,children:g}):null,(0,Z.jsx)(ST,{type:`primary`,disabled:!k,onClick:()=>void M(),loading:y,children:`Start separate native terminal`})]})]});return(0,Z.jsx)(aC,{content:F,overlayClassName:`sessions-new-popover`,trigger:`click`,open:c,onOpenChange:e=>{if(l(e),!e){_(void 0),S(!1);return}S(!0),a().finally(()=>S(!1))},placement:`bottomLeft`,children:(0,Z.jsx)(ST,{block:!0,icon:(0,Z.jsx)(SE,{}),children:`New session`})})}function L1(){let e=yB(),{id:t,sessionId:n}=CB(),r=d1(e=>e.sessions),i=d1(e=>e.load),a=d1(e=>e.loading),o=d1(e=>e.error),s=d1(e=>e.readiness),c=d1(e=>e.readinessLoading),l=d1(e=>e.readinessError),u=d1(e=>e.refreshReadiness),d=N1(e=>e.sessionList),f=N1(e=>e.sessionsById),p=N1(e=>e.loadSessions),m=aW();(0,v.useEffect)(()=>{m&&i()},[m,i]),(0,v.useEffect)(()=>{m&&p()},[m,p]),(0,v.useEffect)(()=>{m&&u()},[m,u]);let h=r.filter(e=>e.status===`running`||e.status===`detached`||e.status===`creating`),g=s?.purposes??s,_=s?.runtimeHost?.selectedReadiness,y=r.filter(e=>!h.includes(e)),b=m?d:Object.values(f).filter(e=>e.id!==`draft`).map(e=>({id:e.id,title:e.title,updatedAt:e.updatedAt})),x=n??t,S=b.length?(0,Z.jsxs)(`section`,{className:`sessions-sidebar-group`,"aria-label":`Structured Ask sessions`,children:[(0,Z.jsx)(mR.Text,{type:`secondary`,className:`sessions-sidebar-heading`,children:`Structured Ask`}),b.map(t=>(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>e(P1(t.id)),"aria-current":t.id===x?`page`:void 0,className:`sessions-sidebar-item ${t.id===x?`is-selected`:``}`,children:[(0,Z.jsxs)(`span`,{className:`sessions-sidebar-title sessions-sidebar-title-row`,children:[(0,Z.jsx)(`span`,{className:`sessions-sidebar-purpose`,title:t.title,children:t.title}),(0,Z.jsx)(`span`,{className:`sessions-sidebar-id`,title:t.id,"aria-label":`Session ID ${t.id}`,children:t.id.slice(-8)})]}),(0,Z.jsx)(`span`,{className:`sessions-sidebar-meta`,children:(0,Z.jsx)(`span`,{children:V$(t.updatedAt)})})]},t.id))]}):null,C=(t,n)=>(0,Z.jsxs)(`section`,{className:`sessions-sidebar-group`,"aria-label":t,children:[(0,Z.jsx)(mR.Text,{type:`secondary`,className:`sessions-sidebar-heading`,children:t}),n.map(t=>(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>e(`/sessions/${t.id}`),"aria-current":t.id===x?`page`:void 0,className:`sessions-sidebar-item ${t.id===x?`is-selected`:``}`,children:[(0,Z.jsxs)(`span`,{className:`sessions-sidebar-title sessions-sidebar-title-row`,children:[(0,Z.jsx)(`span`,{className:`sessions-sidebar-purpose`,children:L$[t.purpose]}),(0,Z.jsx)(`span`,{className:`sessions-sidebar-id`,title:t.id,"aria-label":`Session ID ${t.id}`,children:t.id.slice(-8)})]}),(0,Z.jsxs)(`span`,{className:`sessions-sidebar-meta`,children:[(0,Z.jsx)(`span`,{children:`Native terminal`}),t.dispatchProfile&&t.dispatchProfile!==`genbi-default`&&t.purpose===`analysis`?(0,Z.jsx)(`span`,{title:`Conversation profile`,children:t.dispatchProfile}):null,(0,Z.jsx)(`span`,{children:R$[t.vendor]}),(0,Z.jsx)(`span`,{children:B$[t.status]}),(0,Z.jsx)(`span`,{children:V$(t.updatedAt)})]})]},t.id))]});return(0,Z.jsxs)(`nav`,{className:`sessions-sidebar`,"aria-label":`Sessions`,children:[(0,Z.jsx)(`div`,{className:`sessions-sidebar-new`,children:(0,Z.jsx)(I1,{live:m,readiness:s})}),m?null:(0,Z.jsx)(`div`,{className:`sessions-sidebar-state`,role:`status`,children:`Native terminal sessions require a local BFF connection.`}),m&&l?(0,Z.jsxs)(`div`,{className:`sessions-sidebar-state`,role:`alert`,children:[`Native host is unavailable. `,l]}):null,m&&c&&!s&&!l?(0,Z.jsx)(`div`,{className:`sessions-sidebar-state`,role:`status`,children:`Checking native terminal availability…`}):null,m&&_&&_.state!==`ready`?(0,Z.jsxs)(`div`,{className:`sessions-sidebar-state`,role:`status`,children:[`Runtime host: `,_.message]}):null,m&&g&&!F1.some(e=>g[e]?.available)?(0,Z.jsx)(`div`,{className:`sessions-sidebar-state`,role:`alert`,children:`No native terminal target is available on this host. Structured Ask remains available.`}):null,m&&o?(0,Z.jsxs)(`div`,{className:`sessions-sidebar-state`,role:`alert`,children:[`Sessions are unavailable. `,o]}):null,S,m&&!o&&!a&&r.length===0?(0,Z.jsx)(`div`,{className:`sessions-sidebar-state`,children:`No native sessions yet. Start a native terminal session or a Structured Ask.`}):null,h.length?C(`Running`,h):null,y.length?C(`Recent`,y):null]})}function R1({title:e,extra:t,note:n,children:r,bodyStyle:i,className:a}){return(0,Z.jsxs)(PD,{title:e,extra:t,size:`small`,className:a,styles:{body:i},children:[r,n!=null&&(0,Z.jsx)(`div`,{style:{marginTop:8,opacity:.65,fontSize:12},children:n})]})}function z1({label:e,value:t}){return(0,Z.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,gap:16,padding:`4px 0`},children:[(0,Z.jsx)(`span`,{style:{opacity:.65,flexShrink:0},children:e}),(0,Z.jsx)(`span`,{style:{textAlign:`right`,minWidth:0,overflowWrap:`anywhere`},children:t})]})}var B1={verified:{color:AR.verified,icon:(0,Z.jsx)(bH,{}),label:Q(`status.verified`)},estimate:{color:AR.estimate,icon:(0,Z.jsx)(VH,{}),label:Q(`status.estimate`)},refused:{color:AR.refused,icon:(0,Z.jsx)(CH,{}),label:Q(`status.refused`)},unverified:{color:`default`,icon:(0,Z.jsx)(cA,{}),label:Q(`status.unverified`)}};function V1({state:e,label:t}){let n=B1[e];return(0,Z.jsx)(iL,{color:n.color,icon:n.icon,bordered:!0,children:t??n.label})}function H1(e){return e===!0?`verified`:`unverified`}function U1({option:e,height:t=280,className:n,ariaLabel:r=`chart`}){let i=(0,v.useRef)(null),a=(0,v.useRef)(null),o=(0,v.useRef)(e);o.current=e;let s=TR(e=>e.themeMode);return(0,v.useEffect)(()=>{let e=!1,t;return UR(()=>import(`./echarts-DYM4hjvk.js`).then(n=>{if(e||!i.current)return;let r=n.init(i.current,s===`dark`?`dark`:void 0,{renderer:`canvas`});r.setOption(o.current,!0),a.current=r,t=new ResizeObserver(()=>r.resize()),t.observe(i.current)}),[]),()=>{e=!0,t?.disconnect(),a.current?.dispose(),a.current=null}},[s]),(0,v.useEffect)(()=>{a.current?.setOption(e,!0)},[e]),(0,Z.jsx)(`div`,{ref:i,className:n,style:{width:`100%`,height:t,background:`transparent`},role:`img`,"aria-label":r})}function W1(e){return(0,Z.jsx)(GI,{size:`small`,scroll:{x:`max-content`},pagination:e.pagination??{pageSize:10,hideOnSinglePage:!0},...e})}function G1({status:e,title:t,description:n,action:r,onRetry:i}){return(e=>(0,Z.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,minHeight:240,padding:24},role:`status`,children:e}))(e===`loading`?(0,Z.jsx)(Bj,{tip:t??Q(`state.loading`),size:`large`}):e===`error`?(0,Z.jsx)(pM,{status:`warning`,title:t??Q(`state.errorTitle`),subTitle:n,extra:r??(i&&(0,Z.jsx)(ST,{type:`primary`,onClick:i,children:Q(`state.retry`)}))}):(0,Z.jsx)(jx,{description:(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{children:t??Q(`state.emptyTitle`)}),n!=null&&(0,Z.jsx)(`div`,{style:{opacity:.65,marginTop:4},children:n})]}),children:r}))}var K1=class extends v.Component{state={hasError:!1};static getDerivedStateFromError(e){return{hasError:!0,message:e instanceof Error?e.message:String(e)}}render(){return this.state.hasError?this.props.fallback??(0,Z.jsx)(al,{type:`warning`,showIcon:!0,message:Q(`envelope.couldNotRender`),description:this.state.message}):this.props.children}};function q1({maxWidth:e=1e3,title:t,lead:n,actions:r,children:i,className:a}){return(0,Z.jsxs)(`div`,{className:[`genbi-page`,a].filter(Boolean).join(` `),style:{maxWidth:e},children:[t!=null&&(0,Z.jsxs)(`div`,{className:`genbi-page-head`,children:[(0,Z.jsxs)(`div`,{className:`genbi-page-head-text`,children:[(0,Z.jsx)(mR.Title,{level:2,className:`genbi-page-title`,children:t}),n!=null&&(0,Z.jsx)(`p`,{className:`genbi-page-lead`,children:n})]}),r!=null&&(0,Z.jsx)(`div`,{className:`genbi-page-actions`,children:r})]}),(0,Z.jsx)(`div`,{className:`genbi-page-body`,children:i})]})}var J1={label:`Structured Ask · Turn this into a dashboard`,href:`/sessions/ask/s1`};function Y1(e){return e.type===`kpi_card`}function X1(e){return e.type===`chart`}function Z1(e){return e.type===`table`}function Q1(e){return{verified:!0,blocks:e}}var $1=[{key:`a1`,name:`Revenue dashboard`,kind:`dashboard`,verified:!0,createdAt:`2026-07-17 09:20`,location:`artifacts/revenue-dashboard.json`,publish:{link:`https://share.genbi.example/revenue-dashboard`,scope:`workspace`},tiles:[..._1.blocks.filter(Y1).map((e,t)=>({key:`revenue-dashboard-kpi-${t}`,title:e.label,envelope:Q1([e]),source:J1})),..._1.blocks.filter(X1).map((e,t)=>({key:`revenue-dashboard-chart-${t}`,title:`Revenue trend`,envelope:Q1([e]),source:J1})),..._1.blocks.filter(Z1).map((e,t)=>({key:`revenue-dashboard-table-${t}`,title:`MRR by plan`,envelope:Q1([e]),source:J1}))]},{key:`a2`,name:`Q3 business review`,kind:`report`,verified:!0,createdAt:`2026-07-14 16:05`,location:`artifacts/q3-business-review.html`,source:{label:`Compiled from 12 verified Q3 answers`},preview:{kind:`html`,html:`<h1>Q3 Business Review</h1>
|
|
367
|
+
<p>Revenue grew 9% quarter over quarter, led by the Enterprise plan.</p>`}},{key:`a3`,name:`Monthly signups trend`,kind:`chart`,verified:!0,createdAt:`2026-07-16 11:40`,location:`artifacts/monthly-signups-trend.json`,source:{label:`Structured Ask · Monthly signups trend`,href:`/sessions/ask/s2`},envelope:{verified:!0,summary:`New signups by month, last 6 months.`,blocks:[{type:`chart`,chart_type:`line`,x:`month`,series:[`signups`],rows:[{month:`Feb`,signups:210},{month:`Mar`,signups:244},{month:`Apr`,signups:268},{month:`May`,signups:281},{month:`Jun`,signups:305},{month:`Jul`,signups:322}]}]}}];function e0(e){return Object.fromEntries(e.map(e=>[e.key,e]))}function t0(e,t){return{...e,publish:t}}var n0=bR()((e,t)=>({selectedKey:$1[0]?.key??``,summaries:$1,detailsByKey:e0($1),error:void 0,detailError:void 0,select:n=>{e({selectedKey:n,detailError:void 0}),!(!aW()||t().detailsByKey[n])&&NW(n).then(t=>{e(e=>({detailsByKey:{...e.detailsByKey,[t.key]:t},detailError:void 0}))}).catch(t=>{e({detailError:t instanceof Error?t.message:Q(`artifacts.detailLoadFailedMessage`)})})},loadArtifacts:()=>{aW()&&AW().then(n=>{e(e=>({summaries:n,error:void 0,selectedKey:n.some(t=>t.key===e.selectedKey)?e.selectedKey:n[0]?.key??e.selectedKey}));let r=t().selectedKey;r&&!t().detailsByKey[r]&&t().select(r)}).catch(t=>{e({error:t instanceof Error?t.message:Q(`artifacts.loadFailedMessage`)})})},publish:n=>{let r=t().summaries.find(e=>e.key===n)?.sessionId;if(aW()&&r){LW(r,n).then(t=>{e(e=>({summaries:e.summaries.map(e=>e.key===n?t0(e,t):e),detailsByKey:e.detailsByKey[n]?{...e.detailsByKey,[n]:t0(e.detailsByKey[n],t)}:e.detailsByKey}))}).catch(()=>{});return}let i={link:`https://share.genbi.example/${n}`,scope:`workspace`};e(e=>({summaries:e.summaries.map(e=>e.key===n&&!e.publish?t0(e,i):e),detailsByKey:e.detailsByKey[n]&&!e.detailsByKey[n].publish?{...e.detailsByKey,[n]:t0(e.detailsByKey[n],i)}:e.detailsByKey}))},unpin:n=>{let r=t().summaries.find(e=>e.key===n),i=r?.sessionId,a=()=>{e(e=>{let t=e.summaries.filter(e=>e.key!==n),r={...e.detailsByKey};return delete r[n],{summaries:t,detailsByKey:r,selectedKey:e.selectedKey===n?t[0]?.key??``:e.selectedKey}})};if(aW()&&i){(r?.nativeSessionId===void 0?FW(i,n):IW(n)).then(a).catch(()=>{});return}a()}})),r0=[`kpi_card`,`table`,`chart`,`definition`,`narrative`,`unavailable`];function i0(e){return r0.includes(e.type)}function a0({block:e}){let{label:t,value:n,unit:r,delta:i}=e,a=typeof i==`number`&&Number.isFinite(i);return(0,Z.jsx)(EM,{title:t,value:n,suffix:(0,Z.jsxs)(`span`,{style:{fontSize:14},children:[r?(0,Z.jsxs)(`span`,{style:{opacity:.65},children:[` `,r]}):null,a&&(0,Z.jsxs)(`span`,{style:{marginLeft:8,color:`var(--ant-color-text-secondary)`},children:[a&&i>=0?(0,Z.jsx)(rI,{}):(0,Z.jsx)(eI,{}),Math.abs(i)]})]})})}function o0({block:e}){let t=e.columns??[],n=e.rows??[],r=(0,v.useMemo)(()=>t.map((e,t)=>({title:e,dataIndex:`c${t}`,key:`c${t}`})),[t]),i=(0,v.useMemo)(()=>n.map((e,n)=>{let r={key:n};return t.forEach((t,n)=>{r[`c${n}`]=(Array.isArray(e)?e[n]:e[t])??null}),r}),[n,t]);return t.length===0?(0,Z.jsx)(jx,{image:jx.PRESENTED_IMAGE_SIMPLE,description:Q(`envelope.noTableData`)}):(0,Z.jsx)(W1,{columns:r,dataSource:i})}function s0(e){if(typeof e==`number`)return Number.isFinite(e)?e:null;if(e==null)return null;let t=Number(e);return Number.isFinite(t)?t:null}function c0(e,t,n){return Array.isArray(e)?{x:e[0]??null,values:n.map((t,n)=>s0(e[n+1]))}:{x:e[t]??null,values:n.map(t=>s0(e[t]))}}function l0(e){let{chart_type:t,x:n,series:r,rows:i}=e,a=i.map(e=>c0(e,n,r)),o=a.map(e=>String(e.x??``));if(t===`pie`)return{tooltip:{trigger:`item`},legend:{bottom:0},series:[{type:`pie`,radius:`65%`,data:a.map(e=>({name:String(e.x??``),value:e.values[0]??0}))}]};let s=t===`scatter`,c=t===`area`;return{tooltip:{trigger:s?`item`:`axis`},legend:{data:r,bottom:0},grid:{left:8,right:16,top:24,bottom:32,containLabel:!0},xAxis:{type:`category`,data:o},yAxis:{type:`value`},series:r.map((e,n)=>({name:e,type:c?`line`:s?`scatter`:t,...c?{areaStyle:{}}:{},data:a.map(e=>e.values[n])}))}}function u0({block:e,height:t}){let n=(0,v.useMemo)(()=>l0(e),[e]);return(0,Z.jsx)(U1,{option:n,height:t,ariaLabel:`${e.chart_type} chart`})}function d0({block:e}){let{sql:t,source_tables:n,filters:r}=e;return(0,Z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(mR.Text,{type:`secondary`,style:{fontSize:12},children:Q(`envelope.definitionSql`)}),(0,Z.jsx)(`pre`,{style:{margin:`4px 0 0`,padding:12,borderRadius:8,overflowX:`auto`,fontFamily:AR.fontFamilyCode,fontSize:13,background:`var(--ant-color-fill-quaternary)`},children:(0,Z.jsx)(`code`,{children:t})})]}),(0,Z.jsx)(z1,{label:Q(`envelope.definitionSources`),value:n?.length?(0,Z.jsx)(`span`,{children:n.map(e=>(0,Z.jsx)(iL,{style:{marginInlineEnd:4},children:e},e))}):Q(n===void 0?`envelope.definitionUnknown`:`envelope.definitionNoneFallback`)}),(0,Z.jsx)(z1,{label:Q(`envelope.definitionFilters`),value:r?.length?(0,Z.jsx)(`span`,{children:r.map(e=>(0,Z.jsx)(iL,{color:`blue`,style:{marginInlineEnd:4},children:e},e))}):Q(r===void 0?`envelope.definitionUnknown`:`envelope.definitionEmptyFallback`)})]})}function f0({block:e}){let t=e.text.split(/\n{2,}/).filter(Boolean);return(0,Z.jsxs)(`div`,{children:[e.title?(0,Z.jsx)(mR.Title,{level:5,style:{marginTop:0},children:e.title}):null,t.map((e,t)=>(0,Z.jsx)(mR.Paragraph,{style:{marginBottom:8},children:e},t))]})}function p0({block:e}){return(0,Z.jsx)(al,{type:`warning`,showIcon:!0,message:`${e.label}: ${Q(`envelope.unavailableValue`)}`,description:(0,Z.jsxs)(`span`,{children:[Q(`envelope.unavailableReasonPrefix`),(0,Z.jsx)(`code`,{children:e.reason_category}),e.note?` — ${e.note}`:null]})})}function m0({block:e}){return(0,Z.jsx)(al,{type:`info`,showIcon:!0,message:`${Q(`envelope.unsupportedBlockPrefix`)}${e.type}${Q(`envelope.unsupportedBlockSuffix`)}`,description:(0,Z.jsx)(`pre`,{style:{margin:0,fontSize:12,overflowX:`auto`},children:(0,Z.jsx)(`code`,{children:JSON.stringify(e,null,2)})})})}function h0({block:e}){if(!i0(e))return(0,Z.jsx)(m0,{block:e});switch(e.type){case`kpi_card`:return(0,Z.jsx)(a0,{block:e});case`table`:return(0,Z.jsx)(o0,{block:e});case`chart`:return(0,Z.jsx)(u0,{block:e});case`definition`:return(0,Z.jsx)(d0,{block:e});case`narrative`:return(0,Z.jsx)(f0,{block:e});case`unavailable`:return(0,Z.jsx)(p0,{block:e})}}function g0(e){if(e.type===`definition`)return Q(`envelope.derivationTitle`)}function _0(e){return e.estimate===!0?`estimate`:H1(e.verified)}function v0({envelope:e}){let t=_0(e),n=0;for(;n<e.blocks.length&&e.blocks[n].type===`kpi_card`;)n+=1;let r=e.blocks.slice(0,n),i=e.blocks.slice(n);return(0,Z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16},children:[(0,Z.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,Z.jsx)(V1,{state:t}),t===`estimate`&&(0,Z.jsx)(mR.Text,{type:`secondary`,style:{fontSize:12},children:Q(`envelope.estimateBasisNote`)})]}),e.verificationScope===`query-results`&&(0,Z.jsx)(mR.Text,{type:`secondary`,children:Q(`envelope.queryVerification`)}),e.summary?(0,Z.jsx)(mR.Paragraph,{style:{marginBottom:0},children:e.summary}):null,e.explanation&&(0,Z.jsx)(R1,{title:Q(`envelope.interpretationTitle`),children:(0,Z.jsx)(mR.Paragraph,{style:{marginBottom:0,whiteSpace:`pre-wrap`},children:e.explanation})}),r.length>0&&(0,Z.jsx)(mM,{gutter:[16,16],children:r.map((e,t)=>(0,Z.jsx)(XO,{xs:12,md:8,lg:6,children:(0,Z.jsx)(R1,{children:(0,Z.jsx)(K1,{children:(0,Z.jsx)(h0,{block:e})})})},t))}),i.map((e,t)=>(0,Z.jsx)(R1,{title:g0(e),children:(0,Z.jsx)(K1,{children:(0,Z.jsx)(h0,{block:e})})},t))]})}var y0={dashboard:Q(`artifacts.kindDashboard`),report:Q(`artifacts.kindReport`),chart:Q(`artifacts.kindChart`)};function b0({artifact:e,onUnpin:t}){return(0,Z.jsxs)(R1,{title:e.name,extra:(0,Z.jsx)(ST,{size:`small`,icon:(0,Z.jsx)(bU,{}),onClick:t,children:Q(`artifacts.unpin`)}),children:[(0,Z.jsx)(z1,{label:Q(`artifacts.kindLabel`),value:y0[e.kind]}),(0,Z.jsx)(z1,{label:Q(`artifacts.fileLocation`),value:(0,Z.jsx)(`code`,{children:e.location})}),(0,Z.jsx)(z1,{label:Q(`artifacts.statusLabel`),value:(0,Z.jsx)(V1,{state:H1(e.verified)})})]})}function x0({source:e}){return(0,Z.jsxs)(mR.Text,{type:`secondary`,style:{fontSize:12},children:[Q(`artifacts.sourceLabel`),`: `,e.href?(0,Z.jsx)(PV,{to:e.href,children:e.label}):e.label]})}function S0({artifact:e,onPublish:t,onUnpin:n}){return(0,Z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16},children:[(0,Z.jsx)(b0,{artifact:e,onUnpin:n}),!e.nativeSessionId&&!1,e.tiles&&e.tiles.length>0?(0,Z.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(280px, 1fr))`,gap:16},children:e.tiles.map(e=>(0,Z.jsx)(R1,{title:e.title,note:(0,Z.jsx)(x0,{source:e.source}),children:(0,Z.jsx)(v0,{envelope:e.envelope})},e.key))}):e.envelope?(0,Z.jsx)(R1,{note:e.source&&(0,Z.jsx)(x0,{source:e.source}),children:(0,Z.jsx)(v0,{envelope:e.envelope})}):(0,Z.jsx)(mR.Text,{type:`secondary`,children:Q(`artifacts.detailUnavailableNote`)})]})}function C0({artifact:e,onPublish:t,onUnpin:n}){return(0,Z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16},children:[(0,Z.jsx)(b0,{artifact:e,onUnpin:n}),!1,e.preview?(0,Z.jsx)(R1,{title:Q(`artifacts.previewTitle`),note:e.source&&(0,Z.jsx)(x0,{source:e.source}),children:e.preview.kind===`envelope`?(0,Z.jsx)(v0,{envelope:e.preview.envelope}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(mR.Text,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:8},children:Q(`artifacts.htmlPreviewNote`)}),(0,Z.jsx)(`pre`,{style:{margin:0,padding:12,borderRadius:8,overflowX:`auto`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,fontFamily:AR.fontFamilyCode,fontSize:12,background:`var(--ant-color-fill-quaternary)`},children:(0,Z.jsx)(`code`,{children:e.preview.html})})]})}):(0,Z.jsx)(mR.Text,{type:`secondary`,children:Q(`artifacts.detailUnavailableNote`)})]})}function w0({artifact:e,onPublish:t,onUnpin:n}){return(0,Z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16},children:[(0,Z.jsx)(b0,{artifact:e,onUnpin:n}),!1,e.envelope?(0,Z.jsx)(R1,{note:e.source&&(0,Z.jsx)(x0,{source:e.source}),children:(0,Z.jsx)(v0,{envelope:e.envelope})}):(0,Z.jsx)(mR.Text,{type:`secondary`,children:Q(`artifacts.detailUnavailableNote`)})]})}function T0(){let e=n0(e=>e.selectedKey),t=n0(e=>e.summaries),n=n0(e=>e.detailsByKey),r=n0(e=>e.loadArtifacts),i=n0(e=>e.select),a=n0(e=>e.publish),o=n0(e=>e.unpin),s=n0(e=>e.error),c=n0(e=>e.detailError);(0,v.useEffect)(()=>{r()},[r]);let l=aW(),u=t.find(t=>t.key===e),d=n[e],f;return f=l&&s?(0,Z.jsx)(G1,{status:`error`,title:Q(`artifacts.loadErrorTitle`),description:s,onRetry:r}):u?l&&c&&!d?(0,Z.jsx)(G1,{status:`error`,title:Q(`artifacts.detailErrorTitle`),description:c,onRetry:()=>i(e)}):d?d.kind===`dashboard`?(0,Z.jsx)(S0,{artifact:d,onPublish:()=>a(d.key),onUnpin:()=>o(d.key)}):d.kind===`report`?(0,Z.jsx)(C0,{artifact:d,onPublish:()=>a(d.key),onUnpin:()=>o(d.key)}):(0,Z.jsx)(w0,{artifact:d,onPublish:()=>a(d.key),onUnpin:()=>o(d.key)}):(0,Z.jsx)(G1,{status:`loading`}):(0,Z.jsx)(G1,{status:`empty`,title:Q(`artifacts.emptyTitle`),description:Q(`artifacts.emptyDescription`)}),(0,Z.jsx)(q1,{maxWidth:1e3,title:Q(`nav.artifacts`),lead:Q(`artifacts.pageLead`),children:f})}var E0={dashboard:(0,Z.jsx)($V,{}),report:(0,Z.jsx)(aA,{}),chart:(0,Z.jsx)(cH,{})},D0={dashboard:Q(`artifacts.kindDashboard`),report:Q(`artifacts.kindReport`),chart:Q(`artifacts.kindChart`)};function O0({shared:e}){return(0,Z.jsx)(iL,{color:e?AR.verified:`default`,icon:e?(0,Z.jsx)(FU,{}):(0,Z.jsx)(mU,{}),bordered:!0,children:Q(e?`artifacts.sharedLabel`:`artifacts.notSharedLabel`)})}function k0(){let e=n0(e=>e.summaries),t=n0(e=>e.selectedKey),n=n0(e=>e.select);return(0,Z.jsx)(`nav`,{"aria-label":Q(`artifacts.listHeader`),style:{minWidth:0},children:(0,Z.jsx)(`ul`,{className:`genbi-artifacts-list`,children:e.map(e=>{let r=e.key===t;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`genbi-arow${r?` is-sel`:``}`,"aria-current":r?`true`:void 0,onClick:()=>n(e.key),children:[(0,Z.jsx)(`span`,{className:`genbi-aicon`,"aria-label":D0[e.kind],children:E0[e.kind]}),(0,Z.jsx)(`span`,{className:`genbi-atext`,children:(0,Z.jsx)(`span`,{className:`genbi-aname`,title:e.name,children:e.name})}),(0,Z.jsxs)(`span`,{className:`genbi-abadges`,children:[(0,Z.jsx)(V1,{state:H1(e.verified)}),(0,Z.jsx)(O0,{shared:!!e.publish})]})]})},e.key)})})})}var A0=0;function j0(e,t){let n=e?.run,r=t.run;return!n||!r?!0:r.bindingGeneration===n.bindingGeneration?r.id!==n.id||r.version>=n.version:r.bindingGeneration>n.bindingGeneration}var M0=bR()((e,t)=>({viewMode:`overview`,selectedFileKey:void 0,impactSeedKey:void 0,liveImpactByKey:{},impactError:void 0,liveOverview:void 0,overviewLoading:!1,overviewError:void 0,liveFiles:void 0,filesLoading:!1,filesError:void 0,enrichment:void 0,enrichmentLoading:!1,enrichmentError:void 0,selectFile:t=>e({viewMode:`file`,selectedFileKey:t}),showOverview:()=>e({viewMode:`overview`}),showImpact:t=>{e({viewMode:`impact`,impactSeedKey:t,impactError:void 0}),aW()&&hW(t).then(n=>{e(e=>({liveImpactByKey:{...e.liveImpactByKey,[t]:n}}))}).catch(t=>{e({impactError:t instanceof Error?t.message:Q(`context.impactLoadFailedMessage`)})})},loadOverview:()=>{aW()&&(e({overviewLoading:!0,overviewError:void 0}),gW().then(t=>{e({liveOverview:t,overviewLoading:!1,overviewError:void 0})}).catch(t=>{e({overviewLoading:!1,overviewError:t instanceof Error?t.message:Q(`context.overviewLoadFailedMessage`)})}))},loadFiles:()=>{aW()&&(e({filesLoading:!0,filesError:void 0}),_W().then(t=>{e({liveFiles:t,filesLoading:!1,filesError:void 0})}).catch(t=>{e({filesLoading:!1,filesError:t instanceof Error?t.message:Q(`context.filesLoadFailedMessage`)})}))},loadEnrichment:()=>{if(!aW()||typeof EW!=`function`)return;let t=++A0;e({enrichmentLoading:!0,enrichmentError:void 0}),EW().then(n=>e(e=>t!==A0||!j0(e.enrichment,n)?{enrichmentLoading:!1}:{enrichment:n,enrichmentLoading:!1,enrichmentError:void 0})).catch(n=>{t===A0&&e({enrichmentLoading:!1,enrichmentError:Q(`context.enrichmentLoadFailed`)})})},refreshCanonical:()=>{t().loadOverview(),t().loadFiles(),t().loadEnrichment()}}));function N0(e,t,n){let{nodeWidth:r,columnGap:i=80,rowGap:a=40,componentGap:o=60}=n,s=new Map(e.map(e=>[e.key,e.height])),c=new Set(e.map(e=>e.key)),l=new Map;for(let e of c)l.set(e,new Set);for(let e of t)e.fromModel!==e.toModel&&(!c.has(e.fromModel)||!c.has(e.toModel)||(l.get(e.fromModel).add(e.toModel),l.get(e.toModel).add(e.fromModel)));let u=r+i,d=new Map,f=new Set,p=[],m=0;for(let t of e){if(f.has(t.key))continue;let e=new Map([[t.key,0]]),n=[[t.key]];f.add(t.key);let r=[t.key];for(;r.length>0;){let t=r.shift(),i=e.get(t),a=l.get(t)??new Set;for(let t of a){if(f.has(t))continue;f.add(t);let a=i+1;e.set(t,a),(n[a]??=[]).push(t),r.push(t)}}if(n.length===1&&n[0].length===1){p.push(t.key);continue}let i=0;for(let e=0;e<n.length;e++){let t=n[e]??[],r=0;for(let n of t)d.set(n,{x:e*u,y:m+r}),r+=s.get(n)+a;i=Math.max(i,r-a)}m+=i+o}if(p.length>0){let e=Math.max(1,Math.ceil(Math.sqrt(p.length))),t=m;for(let n=0;n<p.length;n+=e){let r=p.slice(n,n+e),i=Math.max(...r.map(e=>s.get(e)));r.forEach((e,n)=>{d.set(e,{x:n*u,y:t})}),t+=i+a}}return d}var P0=200,F0=34,I0=26,L0=20;function R0(e){switch(e){case`one-to-one`:return`1:1`;case`one-to-many`:return`1:N`;case`many-to-one`:return`N:1`;case`many-to-many`:return`N:N`}}function z0(e){return F0+e.columns.length*I0}function B0({models:e,relationships:t,impact:n,onSelectModel:r}){if(e.length===0)return null;let i=e.some(e=>!e.position)?N0(e.map(e=>({key:e.key,height:z0(e)})),t,{nodeWidth:P0}):void 0,a=new Map(e.map(e=>{let t=e.position??i?.get(e.key)??{x:0,y:0};return[e.key,{x:t.x+L0,y:t.y+L0,width:P0,height:z0(e)}]})),o=Math.max(...[...a.values()].map(e=>e.x+e.width))+L0,s=Math.max(...[...a.values()].map(e=>e.y+e.height))+L0;return(0,Z.jsx)(`div`,{className:`genbi-canvas-er`,children:(0,Z.jsxs)(`div`,{className:`genbi-er-inner`,style:{width:o,height:s},children:[(0,Z.jsx)(`svg`,{className:`genbi-er-edges${n?` is-impact`:``}`,role:`img`,"aria-label":Q(`context.erDiagramAriaLabel`),width:o,height:s,children:t.map(e=>{let t=a.get(e.fromModel),r=a.get(e.toModel);if(!t||!r)return null;let i=t.x+t.width,o=t.y+t.height/2,s=r.x,c=r.y+r.height/2,l=(i+s)/2,u=n&&(e.fromModel===n.selectedKey&&n.affectedKeys.includes(e.toModel)||e.toModel===n.selectedKey&&n.affectedKeys.includes(e.fromModel))?`is-active`:void 0;return(0,Z.jsxs)(`g`,{"data-testid":`er-edge-${e.key}`,children:[(0,Z.jsx)(`path`,{className:u,d:`M ${i},${o} C ${l},${o} ${l},${c} ${s},${c}`}),(0,Z.jsx)(`circle`,{className:u,cx:i,cy:o,r:3}),(0,Z.jsx)(`circle`,{className:u,cx:s,cy:c,r:3}),(0,Z.jsx)(`text`,{x:l,y:(o+c)/2-6,textAnchor:`middle`,children:R0(e.type)})]},e.key)})}),e.map(e=>{let t=a.get(e.key),i=n?.selectedKey===e.key,o=!i&&!!n?.affectedKeys.includes(e.key),s=[`genbi-mnode`,r&&`is-interactive`,i&&`is-selected`,o&&`is-affected`].filter(Boolean).join(` `),c={left:t.x,top:t.y,width:t.width},l=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`genbi-mh`,children:[(0,Z.jsx)(WU,{}),(0,Z.jsx)(`span`,{children:e.name}),(0,Z.jsxs)(`span`,{className:`genbi-cnt`,children:[e.columns.length,` `,Q(`context.erColumnCount`)]})]}),(0,Z.jsx)(`ul`,{children:e.columns.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`span`,{className:`genbi-fn`,children:e.name}),e.key&&(0,Z.jsx)(ZS,{title:Q(`context.inferredKeyHint`),children:(0,Z.jsx)(`span`,{className:`genbi-key genbi-key-${e.key}`,children:e.key===`pk`?Q(`context.erPrimaryKey`):Q(`context.erForeignKey`)})}),(0,Z.jsx)(`span`,{className:`genbi-ft`,children:e.type})]},e.name))})]});return r?(0,Z.jsx)(`button`,{type:`button`,"data-testid":`er-node-${e.key}`,className:s,style:c,onClick:()=>r(e.key),"aria-label":`${Q(`context.viewImpact`)}: ${e.name}`,children:l},e.key):(0,Z.jsx)(`div`,{"data-testid":`er-node-${e.key}`,className:s,style:c,children:l},e.key)})]})})}function V0({purpose:e,title:t,lead:n,returnSource:r}){let i=yB(),a=d1(e=>e.createSession),o=d1(e=>e.readiness),s=d1(e=>e.readinessLoading),c=d1(e=>e.readinessError),l=d1(e=>e.refreshReadiness),u=aW(),[d,f]=(0,v.useState)(!1),[p,m]=(0,v.useState)(),h=o?.purposes?.[e]??o?.[e];(0,v.useEffect)(()=>{u&&l()},[u,l]);let g=async()=>{if(h?.available){f(!0),m(void 0);try{let t=await a(e,r,r);i(`/sessions/${t.id}`)}catch(e){m(e instanceof Error?e.message:`A native session could not be started.`)}finally{f(!1)}}};return(0,Z.jsxs)(`section`,{"aria-label":`${t} native session`,children:[(0,Z.jsx)(mR.Title,{level:4,children:t}),(0,Z.jsx)(mR.Paragraph,{children:n}),u?null:(0,Z.jsx)(mR.Text,{type:`secondary`,children:`A local BFF connection is required to start a native session.`}),u&&s&&!o&&!p?(0,Z.jsx)(mR.Text,{type:`secondary`,children:`Checking native session availability…`}):null,h?.reason?(0,Z.jsx)(mR.Text,{type:`secondary`,children:h.reason}):null,p||c?(0,Z.jsx)(mR.Text,{type:`danger`,role:`alert`,children:p??c}):null,(0,Z.jsx)(eA,{style:{display:`flex`,marginTop:12},wrap:!0,children:(0,Z.jsxs)(ST,{"aria-label":`Start separate ${h?.targetLabel??`interactive CLI`} session`,type:`primary`,icon:(0,Z.jsx)(kH,{}),loading:d,disabled:!u||!h?.available,onClick:()=>void g(),children:[`Start separate `,h?.targetLabel??`interactive CLI`,` session · `,h?.profile??`runtime binding required`]})})]})}function H0(){return(0,Z.jsxs)(R1,{title:Q(`context.enrichmentTitle`),children:[(0,Z.jsx)(V0,{purpose:`context_enrichment`,title:`Enrich context with a native session`,lead:`Continue in the Sessions workbench. The server fences this session to the current bound project generation and revision.`,returnSource:`context`}),(0,Z.jsx)(mR.Paragraph,{type:`secondary`,style:{marginTop:12},children:`Existing enrichment ledger and canonicalization routes remain available for compatibility.`})]})}var U0=`acme-genbi`,W0=`/Users/you/wren-projects/acme-genbi`,G0=[{key:`model.orders`,name:`orders`,position:{x:300,y:24},columns:[{name:`order_id`,type:`varchar`,key:`pk`},{name:`customer_id`,type:`varchar`,key:`fk`},{name:`product_id`,type:`varchar`,key:`fk`},{name:`order_date`,type:`date`},{name:`amount`,type:`decimal`}]},{key:`model.customers`,name:`customers`,position:{x:24,y:190},columns:[{name:`customer_id`,type:`varchar`,key:`pk`},{name:`name`,type:`varchar`},{name:`plan`,type:`varchar`},{name:`signed_up_at`,type:`date`}]},{key:`model.products`,name:`products`,position:{x:580,y:190},columns:[{name:`product_id`,type:`varchar`,key:`pk`},{name:`name`,type:`varchar`},{name:`category`,type:`varchar`}]}],K0=[{key:`relationship.orders_customers`,name:`orders_customers`,fromModel:`model.orders`,toModel:`model.customers`,type:`many-to-one`},{key:`relationship.orders_products`,name:`orders_products`,fromModel:`model.orders`,toModel:`model.products`,type:`many-to-one`}],q0=[{key:`measure.revenue`,name:`revenue`,baseModel:`model.orders`,expression:`SUM(amount)`,additivity:`additive`},{key:`measure.churn_rate`,name:`churn_rate`,baseModel:`model.customers`,expression:`churned_customers / total_customers`,additivity:`non-additive`}],J0={instructionsPresent:!0,verifiedPairCount:18},Y0={"model.orders":{seed:{key:`model.orders`,name:`orders`,kind:`model`},downstream:[{key:`relationship.orders_customers`,name:`orders_customers`,kind:`relationship`},{key:`relationship.orders_products`,name:`orders_products`,kind:`relationship`},{key:`measure.revenue`,name:`revenue`,kind:`measure`},{key:`view.top_customers`,name:`top_customers`,kind:`view`}],severity:`semantic`},"model.customers":{seed:{key:`model.customers`,name:`customers`,kind:`model`},downstream:[{key:`relationship.orders_customers`,name:`orders_customers`,kind:`relationship`},{key:`measure.churn_rate`,name:`churn_rate`,kind:`measure`},{key:`view.top_customers`,name:`top_customers`,kind:`view`}],severity:`structural`},"model.products":{seed:{key:`model.products`,name:`products`,kind:`model`},downstream:[{key:`relationship.orders_products`,name:`orders_products`,kind:`relationship`}],severity:`compatibility`},"relationship.orders_customers":{seed:{key:`relationship.orders_customers`,name:`orders_customers`,kind:`relationship`},downstream:[{key:`measure.revenue`,name:`revenue`,kind:`measure`},{key:`view.top_customers`,name:`top_customers`,kind:`view`}],severity:`structural`},"relationship.orders_products":{seed:{key:`relationship.orders_products`,name:`orders_products`,kind:`relationship`},downstream:[{key:`measure.revenue`,name:`revenue`,kind:`measure`}],severity:`compatibility`},"measure.revenue":{seed:{key:`measure.revenue`,name:`revenue`,kind:`measure`},downstream:[{key:`view.top_customers`,name:`top_customers`,kind:`view`}],severity:`structural`},"measure.churn_rate":{seed:{key:`measure.churn_rate`,name:`churn_rate`,kind:`measure`},downstream:[],severity:`none`},"view.top_customers":{seed:{key:`view.top_customers`,name:`top_customers`,kind:`view`},downstream:[],severity:`none`}},X0={"model.orders":[{question:`Which plan has the most churn by revenue?`,refs:[`customers`,`orders`,`measure.revenue`],hitDownstreamKeys:[`measure.revenue`]},{question:`What is total revenue by customer this quarter?`,refs:[`customers`,`orders`,`total_revenue`],hitDownstreamKeys:[`orders`,`total_revenue`]}]},Z0=[{key:`root`,title:`wren_project`,children:[{key:`dir.models`,title:`models`,children:[{key:`model.orders`,title:`orders.model.yaml`,kind:`model`,path:`wren_project/models/orders.model.yaml`,content:`# wren_project/models/orders.model.yaml
|
|
367
368
|
name: orders
|
|
368
369
|
columns:
|
|
369
370
|
- name: order_id
|
|
@@ -436,6 +437,6 @@ layer. This file is a status summary, not the full pair store.
|
|
|
436
437
|
3. "Top 5 customers by revenue" → \`top_customers\` view, limit 5.
|
|
437
438
|
|
|
438
439
|
… 15 more verified pairs omitted from this fixture for brevity.
|
|
439
|
-
`}]}]}];function
|
|
440
|
-
`)}function X0(e,t){let n=t.replace(/^\/+/,``);return e?`${e.replace(/\/+$/,``)}/${n}`:`/${n}`}function Z0({filePath:e,projectPath:t,projectName:n,downstream:r,verifiedPairCount:i}){let[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),l=X0(t,e),u=Y0({filePath:l,projectName:n,downstream:r,verifiedPairCount:i}),d=[{key:`vscode`,label:(0,Z.jsx)(`a`,{href:`vscode://file${l}`,rel:`noreferrer`,children:Q(`context.editInVsCode`)})},{key:`cursor`,label:(0,Z.jsx)(`a`,{href:`cursor://file${l}`,rel:`noreferrer`,children:Q(`context.editInCursor`)})},{key:`claude-cli`,label:Q(`context.editWithClaudeCli`),onClick:()=>o(!0)}];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(nA,{menu:{items:d},trigger:[`click`],children:(0,Z.jsxs)(ST,{icon:(0,Z.jsx)(kH,{}),children:[Q(`context.edit`),` `,(0,Z.jsx)(eS,{})]})}),(0,Z.jsxs)(Wj,{title:Q(`context.editModalTitle`),open:a,onCancel:()=>{o(!1),c(!1)},footer:(0,Z.jsx)(ST,{type:`primary`,icon:(0,Z.jsx)(HL,{}),onClick:async()=>{navigator.clipboard?.writeText&&await navigator.clipboard.writeText(u),c(!0)},children:Q(s?`context.promptCopied`:`context.copyPrompt`)}),children:[(0,Z.jsx)(mR.Paragraph,{type:`secondary`,children:Q(`context.editModalDescription`)}),(0,Z.jsx)(`pre`,{style:{fontFamily:AR.fontFamilyCode,fontSize:12,whiteSpace:`pre-wrap`,background:`var(--ant-color-fill-secondary)`,borderRadius:8,padding:12,maxHeight:320,overflow:`auto`},children:u})]})]})}function Q0(e,t){for(let n of e)t[n.key]=n,n.children&&Q0(n.children,t)}function $0(){let e=w0(e=>e.selectedFileKey),t=w0(e=>e.showOverview),n=w0(e=>e.showImpact),r=w0(e=>e.liveFiles),i=w0(e=>e.filesLoading),a=w0(e=>e.filesError),o=w0(e=>e.loadFiles),s=w0(e=>e.liveOverview),c=aW(),l=(0,v.useMemo)(()=>{if(!r)return;let e={};return Q0(r,e),e},[r]);if(c&&i&&!r)return(0,Z.jsx)(R1,{status:`loading`});if(c&&a&&!r)return(0,Z.jsx)(R1,{status:`error`,title:Q(`context.filesErrorTitle`),description:a,onRetry:o});let u=e?c?l?.[e]:G0[e]:void 0;if(!u||!u.content)return(0,Z.jsx)(R1,{status:`empty`,title:Q(`context.fileEmptyTitle`),description:Q(`context.fileEmptyDescription`)});let d=!c&&u.entityKey?V0[u.entityKey]:void 0,f=c?s?.knowledge.verifiedPairCount??0:B0.verifiedPairCount;return(0,Z.jsxs)(j1,{title:u.title,extra:(0,Z.jsxs)(eA,{children:[(d||c&&u.entityKey)&&(0,Z.jsx)(ST,{icon:(0,Z.jsx)(qV,{}),onClick:()=>n(u.entityKey),children:Q(`context.viewImpact`)}),u.path&&(0,Z.jsx)(Z0,{filePath:u.path,projectPath:c?s?.projectPath??``:`/Users/you/wren-projects/acme-genbi`,projectName:c?s?.projectName??`acme-genbi`:`acme-genbi`,downstream:d?.downstream??[],verifiedPairCount:f})]}),children:[(0,Z.jsx)(ST,{type:`link`,icon:(0,Z.jsx)(nH,{}),onClick:t,style:{paddingLeft:0,marginBottom:8},children:Q(`context.backToOverview`)}),(0,Z.jsx)(`pre`,{style:{fontFamily:AR.fontFamilyCode,fontSize:13,lineHeight:1.5,background:`var(--ant-color-fill-secondary)`,borderRadius:8,padding:16,overflow:`auto`,margin:0,whiteSpace:u.kind===`knowledge`?`pre-wrap`:`pre`,wordBreak:u.kind===`knowledge`?`break-word`:`normal`},children:u.content})]})}var e2={semantic:{color:AR.refused,icon:(0,Z.jsx)(qU,{}),label:Q(`context.severitySemantic`)},structural:{color:AR.estimate,icon:(0,Z.jsx)(nW,{}),label:Q(`context.severityStructural`)},compatibility:{color:ER.blue6,icon:(0,Z.jsx)($H,{}),label:Q(`context.severityCompatibility`)},none:{color:AR.verified,icon:(0,Z.jsx)(bH,{}),label:Q(`context.severityNone`)}};function t2({severity:e}){let t=e2[e];return(0,Z.jsx)(iL,{color:t.color,icon:t.icon,bordered:!0,children:t.label})}function n2(e,t){let n=new Set(e.downstream.filter(e=>e.kind===`relationship`).map(e=>e.key)),r=new Set;for(let i of t)n.has(i.key)&&(i.fromModel!==e.seed.key&&r.add(i.fromModel),i.toModel!==e.seed.key&&r.add(i.toModel));return[...r]}var r2={model:Q(`context.kindModel`),measure:Q(`context.kindMeasure`),relationship:Q(`context.kindRelationship`),view:Q(`context.kindView`)},i2=[`model`,`relationship`,`measure`,`view`];function a2(e){let t=new Map;for(let n of e)t.set(n.kind,(t.get(n.kind)??0)+1);return i2.filter(e=>t.has(e)).map(e=>({kind:e,count:t.get(e)}))}function o2(e){let t={};for(let n of e)t[n.key]=n.name;return t}function s2(){let e=w0(e=>e.impactSeedKey),t=w0(e=>e.showOverview),n=w0(e=>e.showImpact),r=w0(e=>e.liveImpactByKey),i=w0(e=>e.impactError),a=w0(e=>e.liveOverview),o=aW(),s=o?a?.models??[]:L0,c=o?a?.relationships??[]:R0,l=e?r[e]:void 0,u=e?o?l?.blastRadius:V0[e]:void 0,d=e?o?l?.brokenPairs??[]:H0[e]??[]:[];if(!e)return(0,Z.jsx)(R1,{status:`empty`,title:Q(`context.emptyTitle`)});if(o&&i)return(0,Z.jsx)(R1,{status:`error`,title:Q(`context.impactErrorTitle`),description:i,onRetry:()=>n(e)});if(!u)return(0,Z.jsx)(R1,{status:o?`loading`:`empty`,title:Q(o?`context.impactLoadingTitle`:`context.emptyTitle`)});let f=a2(u.downstream),p=o2(u.downstream);return(0,Z.jsxs)(j1,{title:Q(`context.impactTitle`),children:[(0,Z.jsx)(ST,{type:`link`,icon:(0,Z.jsx)(nH,{}),onClick:t,style:{paddingLeft:0,marginBottom:8},children:Q(`context.backToOverview`)}),(0,Z.jsx)(M1,{label:Q(`context.impactSeed`),value:(0,Z.jsxs)(Z.Fragment,{children:[u.seed.name,` `,(0,Z.jsx)(iL,{children:r2[u.seed.kind]})]})}),(0,Z.jsx)(M1,{label:Q(`context.impactSeverity`),value:(0,Z.jsx)(t2,{severity:u.severity})}),u.seed.kind===`model`&&(0,Z.jsx)(`div`,{style:{marginTop:16,overflowX:`auto`},children:(0,Z.jsx)(M0,{models:s,relationships:c,impact:{selectedKey:u.seed.key,affectedKeys:n2(u,c)}})}),(0,Z.jsx)(`div`,{style:{marginTop:16,fontWeight:500},children:Q(`context.downstreamByKind`)}),f.length===0?(0,Z.jsx)(`div`,{style:{opacity:.65,padding:`8px 0`},children:Q(`context.noDownstream`)}):(0,Z.jsx)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`,marginTop:8},children:f.map(({kind:e,count:t})=>(0,Z.jsxs)(iL,{children:[r2[e],`: `,t]},e))}),(0,Z.jsx)(`div`,{style:{marginTop:16,fontWeight:500},children:Q(`context.downstreamDependents`)}),(0,Z.jsx)(L1,{rowKey:`key`,dataSource:u.downstream,columns:[{title:`Name`,dataIndex:`name`,key:`name`},{title:`Kind`,dataIndex:`kind`,key:`kind`,render:e=>(0,Z.jsx)(iL,{children:r2[e]})}]}),(0,Z.jsx)(`div`,{style:{marginTop:16,fontWeight:500},children:Q(`context.brokenPairsTitle`)}),d.length===0?(0,Z.jsx)(`div`,{style:{opacity:.65,padding:`8px 0`},children:Q(`context.noBrokenPairs`)}):(0,Z.jsx)(L1,{rowKey:`question`,dataSource:d,columns:[{title:Q(`context.brokenPairsQuestion`),dataIndex:`question`,key:`question`},{title:Q(`context.brokenPairsHits`),dataIndex:`hitDownstreamKeys`,key:`hitDownstreamKeys`,render:e=>(0,Z.jsx)(Z.Fragment,{children:e.map(e=>(0,Z.jsx)(iL,{children:p[e]??e},e))})}]}),(0,Z.jsx)(ZS,{title:Q(`context.outOfScopeHint`),children:(0,Z.jsx)(ST,{icon:(0,Z.jsx)(EH,{}),disabled:!0,style:{marginTop:16},children:Q(`context.outOfScopeDeployReview`)})})]})}function c2(){let e=w0(e=>e.viewMode),t=w0(e=>e.loadOverview),n=w0(e=>e.loadFiles),r=w0(e=>e.loadEnrichment),i=w0(e=>e.refreshCanonical),a=gB();(0,v.useEffect)(()=>{a.state?.nativeSessionReturn===`context`?i():(t(),n(),r())},[t,n,r,a.state,i]);let o;return o=e===`file`?(0,Z.jsx)($0,{}):e===`impact`?(0,Z.jsx)(s2,{}):(0,Z.jsx)(q0,{}),(0,Z.jsx)(B1,{maxWidth:1180,title:Q(`nav.context`),lead:Q(`context.pageLead`),children:o})}var l2={model:(0,Z.jsx)(WU,{}),relationship:(0,Z.jsx)(qV,{}),cube:(0,Z.jsx)(XH,{}),knowledge:(0,Z.jsx)(dH,{}),view:(0,Z.jsx)(SA,{})};function u2(e,t=new Set){for(let n of e)n.children&&(t.add(n.key),u2(n.children,t));return t}function d2({nodes:e,depth:t,expanded:n,onToggle:r,selectedFileKey:i,onSelectFile:a}){return(0,Z.jsx)(Z.Fragment,{children:e.map(e=>{let o=12+t*16;if(e.children){let s=n.has(e.key);return(0,Z.jsxs)(`li`,{className:`genbi-tdir`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`genbi-trow genbi-tdirhdr`,style:{paddingLeft:o},"aria-expanded":s,onClick:()=>r(e.key),children:[(0,Z.jsx)(`span`,{className:`genbi-chev${s?` is-open`:``}`,"aria-hidden":`true`,children:(0,Z.jsx)(jm,{})}),(0,Z.jsx)(`span`,{className:`genbi-fi`,"aria-hidden":`true`,children:(0,Z.jsx)(eF,{})}),(0,Z.jsx)(`span`,{className:`genbi-tname`,children:e.title})]}),s&&(0,Z.jsx)(`ul`,{className:`genbi-tchildren`,children:(0,Z.jsx)(d2,{nodes:e.children,depth:t+1,expanded:n,onToggle:r,selectedFileKey:i,onSelectFile:a})})]},e.key)}let s=e.key===i;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`genbi-trow genbi-tfile${s?` is-sel`:``}`,style:{paddingLeft:o+16},"aria-current":s?`true`:void 0,onClick:()=>a(e.key),children:[(0,Z.jsx)(`span`,{className:`genbi-fi`,"aria-hidden":`true`,children:e.kind?l2[e.kind]:null}),(0,Z.jsx)(`span`,{className:`genbi-tname`,children:e.title})]})},e.key)})})}function f2(){let e=w0(e=>e.selectedFileKey),t=w0(e=>e.selectFile),n=w0(e=>e.liveFiles),r=aW(),i=r?n??[]:U0,a=!r&&i.length===1&&i[0]?.children?i[0]:void 0,o=a?.children??i,[s,c]=(0,v.useState)(()=>u2(o));return(0,v.useEffect)(()=>{r&&n&&c(u2(o))},[r,n,o]),(0,Z.jsxs)(`nav`,{"aria-label":Q(`context.filesHeader`),className:`genbi-filetree`,children:[a&&(0,Z.jsxs)(`div`,{className:`genbi-rail-proj`,children:[(0,Z.jsx)(eF,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`genbi-tname`,children:a.title})]}),(0,Z.jsx)(`ul`,{className:`genbi-ttree`,children:(0,Z.jsx)(d2,{nodes:o,depth:0,expanded:s,onToggle:e=>{c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},selectedFileKey:e,onSelectFile:t})})]})}var p2=[`setup`,`analysis`,`context_enrichment`],m2=0,h2=bR()((e,t)=>({selectedPurpose:`analysis`,harness:void 0,loading:!1,error:void 0,selectProfile:n=>{p2.includes(n)&&(e({selectedPurpose:n,harness:void 0,loading:!1,error:void 0}),t().loadHarness())},loadHarness:()=>{if(!aW())return;let n=t().selectedPurpose,r=++m2;e({loading:!0,error:void 0}),cG(n).then(i=>{r===m2&&t().selectedPurpose===n&&e({harness:i,loading:!1,error:void 0})}).catch(i=>{r===m2&&t().selectedPurpose===n&&e({loading:!1,error:i instanceof Error?i.message:Q(`harness.loadFailedMessage`)})})}})),g2={id:`genbi-default`,name:`Genbi Default`,boundContext:`jaffle-wren`,verifyGate:!0,bundleId:`genbi-default@claude-agent-sdk:local`,bundleVersion:`0.1`,irVersion:`0.4`,dispatchTarget:`claude-agent-sdk:local`,bundleHash:`4a7f9c2`,status:`Bound`},_2={backend:`subscription`,label:`Subscription (claude)`,tierModels:[{tier:`cheap`,model:`claude-haiku`},{tier:`strong`,model:`claude-sonnet`}],dispatcher:`claude-agent-sdk`},v2={type:`PostgreSQL`,location:`analytics-prod`,via:`query engine`,tablesSynced:14,lastSync:`5m ago`,health:`healthy`};function y2(e){return{...e,realizationLabel:iW(e.realizationKind,e.steps,e.trigger)}}var b2=y2({id:`explore_model`,name:`Explore Model`,componentType:`analytical`,realizationKind:`skill`,trigger:`one_shot`,outcome:`none`,callableAs:`explore_model`,model:`claude-haiku`,tiers:[{tier:`cheap`,model:`claude-haiku`}],capabilities:[{capability:`semantic_introspection`,outcome:`realize-via`,providedBy:`runtime`,criticality:`required`},{capability:`llm:cheap`,outcome:`native`,providedBy:`runtime`,criticality:`required`}],guardrails:[{name:`read_only_execution`,enforcement:`read_only`,locked:!0}],tools:[{name:`semantic_introspect`,source:`mcp:sample/semantic_introspect`}],outputBlocks:[],steps:[{name:`summarize_semantics`,tier:`cheap`,consumes:[`raw_introspect_result`],produces:`semantic_summary`,realization:`independent`}],status:`ready`}),x2=y2({id:`answer_query`,name:`Answer Query`,componentType:`analytical`,realizationKind:`skill`,trigger:`one_shot`,outcome:`none`,callableAs:`answer_query`,model:`claude-sonnet`,tiers:[{tier:`cheap`,model:`claude-haiku`},{tier:`strong`,model:`claude-sonnet`}],capabilities:[{capability:`sql_execution:read_only`,outcome:`native`,providedBy:`runtime`,criticality:`required`},{capability:`llm:per_step_tier`,outcome:`realize-via`,providedBy:`runtime`,criticality:`required`},{capability:`llm:strong`,outcome:`native`,providedBy:`runtime`,criticality:`required`},{capability:`llm:cheap`,outcome:`native`,providedBy:`runtime`,criticality:`required`},{capability:`render_contract`,outcome:`native`,providedBy:`runtime`,criticality:`required`}],guardrails:[{name:`deterministic_gate`,enforcement:`gated_check`,locked:!0},{name:`read_only_execution`,enforcement:`read_only`,locked:!0},{name:`row_limit`,enforcement:`threshold_limit`,locked:!1,threshold:1e3},{name:`statement_timeout`,enforcement:`generic`,locked:!1,threshold:30}],tools:[{name:`query`,source:`mcp:sample/query`}],outputBlocks:[`table`,`definition`],steps:[{name:`resolve_intent`,tier:`cheap`,consumes:[],produces:`query_intent`,realization:`independent`},{name:`generate_sql`,tier:`strong`,consumes:[`query_intent`],produces:`query_result`,realization:`independent`},{name:`repair_sql`,tier:`strong`,consumes:[`query_result`],produces:`repaired_result`,realization:`repair_fold`,guard:`on_failure`,foldInto:`generate_sql`,maxAttempts:1}],status:`ready`}),S2=[b2,x2,y2({id:`generate_dashboard`,name:`Generate Dashboard`,componentType:`analytical`,realizationKind:`skill`,trigger:`one_shot`,outcome:`none`,callableAs:`generate_dashboard`,model:`claude-haiku`,tiers:[{tier:`strong`,model:`claude-sonnet`},{tier:`cheap`,model:`claude-haiku`}],capabilities:[{capability:`sql_execution:read_only`,outcome:`native`,providedBy:`runtime`,criticality:`required`},{capability:`genbi_build`,outcome:`native`,providedBy:`runtime`,criticality:`required`},{capability:`render_contract`,outcome:`native`,providedBy:`runtime`,criticality:`required`},{capability:`artifact_write`,outcome:`realize-via`,providedBy:`runtime`,criticality:`safety-critical`},{capability:`llm:per_step_tier`,outcome:`realize-via`,providedBy:`runtime`,criticality:`required`},{capability:`llm:strong`,outcome:`native`,providedBy:`runtime`,criticality:`required`},{capability:`llm:cheap`,outcome:`native`,providedBy:`runtime`,criticality:`required`}],guardrails:[{name:`artifact_write`,enforcement:`scoped_write`,locked:!0},{name:`read_only_execution`,enforcement:`read_only`,locked:!0}],tools:[{name:`query`,source:`mcp:sample/query`},{name:`build_dashboard`,source:`mcp:sample/build_dashboard`},{name:`write_artifact`,source:`native`}],outputBlocks:[`kpi_card`,`table`,`chart`,`definition`],steps:[{name:`plan_dashboard`,tier:`strong`,consumes:[],produces:`dashboard_plan`,realization:`independent`},{name:`compose_layout`,tier:`cheap`,consumes:[`dashboard_plan`],produces:`dashboard`,realization:`independent`}],status:`ready`}),y2({id:`explain_change`,name:`Explain Change`,componentType:`analytical`,realizationKind:`skill`,trigger:`one_shot`,outcome:`none`,callableAs:`explain_change`,model:`claude-sonnet`,tiers:[{tier:`strong`,model:`claude-sonnet`}],capabilities:[{capability:`sql_execution:read_only`,outcome:`native`,providedBy:`runtime`,criticality:`required`},{capability:`render_contract`,outcome:`native`,providedBy:`runtime`,criticality:`required`},{capability:`artifact_write`,outcome:`realize-via`,providedBy:`runtime`,criticality:`safety-critical`},{capability:`llm:strong`,outcome:`native`,providedBy:`runtime`,criticality:`required`}],guardrails:[{name:`additivity_guard`,enforcement:`gated_check`,locked:!0},{name:`artifact_write`,enforcement:`scoped_write`,locked:!0},{name:`drill_depth_limit`,enforcement:`threshold_limit`,locked:!1,threshold:3},{name:`read_only_execution`,enforcement:`read_only`,locked:!0}],tools:[{name:`query`,source:`mcp:sample/query`},{name:`write_artifact`,source:`native`}],outputBlocks:[`narrative`],steps:[{name:`plan_decomposition`,tier:`strong`,consumes:[],produces:`decomposition_plan`,realization:`independent`},{name:`synthesize_drivers`,tier:`strong`,consumes:[`decomposition_plan`],produces:`driver_explanation`,realization:`independent`}],status:`ready`}),y2({id:`monitor_freshness`,name:`Monitor Freshness`,componentType:`assertive`,realizationKind:`tool`,trigger:`scheduled`,outcome:`assertion`,callableAs:`monitor_freshness`,model:`claude-haiku`,tiers:[{tier:`cheap`,model:`claude-haiku`}],capabilities:[{capability:`scheduler`,outcome:`realize-via`,providedBy:`runtime`,criticality:`required`},{capability:`sql_execution:read_only`,outcome:`native`,providedBy:`runtime`,criticality:`required`},{capability:`notify_channel`,outcome:`realize-via`,providedBy:`runtime`,criticality:`required`},{capability:`llm:cheap`,outcome:`native`,providedBy:`runtime`,criticality:`required`}],guardrails:[{name:`read_only_execution`,enforcement:`read_only`,locked:!0},{name:`alert_routing`,enforcement:`routing`,locked:!1}],tools:[{name:`check_freshness`,source:`mcp:sample/check_freshness`}],outputBlocks:[`status`],steps:[{name:`assess_severity`,tier:`cheap`,consumes:[`freshness_reading`],produces:`severity_verdict`,realization:`independent`,guard:`on_flag`}],status:`ready`})],C2=[y2({...b2,id:`connect_source`,name:`Connect Source`,callableAs:`connect_source`,capabilities:[{capability:`connection_setup`,outcome:`realize-via`,providedBy:`runtime`,criticality:`required`},{capability:`llm:strong`,outcome:`native`,providedBy:`runtime`,criticality:`required`}],guardrails:[{name:`setup_execution`,enforcement:`write_scope`,locked:!0}],tools:[{name:`connect_source`,source:`mcp:setup/connect_source`}],model:`claude-sonnet`,tiers:[{tier:`strong`,model:`claude-sonnet`}],steps:[{name:`connect`,tier:`strong`,consumes:[],produces:`connection_summary`,realization:`independent`}]}),y2({...b2,id:`build_context`,name:`Build Context`,callableAs:`build_context`,capabilities:[{capability:`context_build`,outcome:`realize-via`,providedBy:`runtime`,criticality:`required`},{capability:`llm:strong`,outcome:`native`,providedBy:`runtime`,criticality:`required`}],guardrails:[{name:`setup_execution`,enforcement:`write_scope`,locked:!0}],tools:[{name:`build_context`,source:`mcp:setup/build_context`}],model:`claude-sonnet`,tiers:[{tier:`strong`,model:`claude-sonnet`}],steps:[{name:`build`,tier:`strong`,consumes:[],produces:`context_summary`,realization:`independent`}]})],w2=[y2({...b2,id:`inspect_context`,name:`Inspect Context`,callableAs:`inspect_context`,capabilities:[{capability:`semantic_introspection`,outcome:`realize-via`,providedBy:`runtime`,criticality:`required`}],tools:[{name:`inspect_context`,source:`mcp:context/inspect_context`}],steps:[{name:`inspect`,tier:`cheap`,consumes:[],produces:`enrichment_gaps`,realization:`independent`}]}),y2({...x2,id:`draft_enrichment`,name:`Draft Enrichment`,callableAs:`draft_enrichment`,capabilities:[{capability:`context_enrichment`,outcome:`realize-via`,providedBy:`runtime`,criticality:`required`}],tools:[{name:`draft_enrichment`,source:`mcp:context/draft_enrichment`}],steps:[{name:`draft`,tier:`strong`,consumes:[`enrichment_gaps`],produces:`enrichment_proposal`,realization:`independent`}]}),y2({...x2,id:`apply_enrichment`,name:`Apply Enrichment`,callableAs:`apply_enrichment`,outcome:`mutation`,model:`—`,tiers:[],capabilities:[],guardrails:[],tools:[],outputBlocks:[],steps:[],status:`ready`,nativeAvailability:{viaLabel:`Claude CLI`,compiledDispatchTarget:`claude-agent-sdk:local`,compiledUnavailableReason:`component is unavailable on the configured runtime`}})];function T2(e){let t=new Map;for(let n of e)for(let e of n.capabilities)t.has(e.capability)||t.set(e.capability,e);return Array.from(t.values())}function E2(e,t){return[{name:e.name,role:`orchestrator`,tierModel:`claude-sonnet`,capabilities:T2(t),status:e.status},{name:`Forecast Trend`,role:`sub-agent`,tierModel:`claude-sonnet`,capabilities:[],status:`Planned (Phase 3)`}]}function D2(e,t,n,r){return{purpose:e===`setup`?{purpose:e,profile:`genbi-setup`,scopeKind:`bootstrap`,executionKind:`setup_runner`,target:`claude-agent-sdk:setup`,targetLabel:`Claude Setup runner`,available:!0}:{purpose:e,profile:e===`analysis`?`genbi-default`:`genbi-enrich-context`,scopeKind:`bound_project`,executionKind:`native_session`,target:`claude-code:interactive`,targetLabel:`Claude CLI`,available:!0},profile:t,runtime:_2,connection:r,components:n,agentProfiles:E2(t,n),nativeSessions:{binding:{configured:!0,generation:1,targetLabel:`Claude CLI`},dispatches:[{purpose:`setup`,profile:`genbi-setup`,scopeKind:`bootstrap`,targetLabel:`Claude CLI`,available:!0},{purpose:`analysis`,profile:`genbi-default`,scopeKind:`bound_project`,targetLabel:`Claude CLI`,available:!0},{purpose:`context_enrichment`,profile:`genbi-enrich-context`,scopeKind:`bound_project`,targetLabel:`Claude CLI`,available:!0}]}}}var O2={analysis:D2(`analysis`,g2,S2,v2),setup:D2(`setup`,{...g2,id:`genbi-setup`,name:`Genbi Setup`,boundContext:`Bootstrap workspace (no project bound)`,bundleId:`genbi-setup@claude-agent-sdk:local`,status:`Bootstrap`},C2,{type:`—`,location:`—`,via:`Bootstrap workspace`,tablesSynced:0,lastSync:`—`,health:`degraded`}),context_enrichment:D2(`context_enrichment`,{...g2,id:`genbi-enrich-context`,name:`Genbi Enrich Context`,bundleId:`genbi-enrich-context@claude-agent-sdk:local`},w2,v2)};O2.analysis;function k2({profiles:e}){return(0,Z.jsx)(L1,{rowKey:`name`,dataSource:e,onRow:e=>e.role===`sub-agent`?{style:{opacity:.55}}:{},columns:[{title:Q(`harness.profileColumn`),dataIndex:`name`,key:`name`},{title:Q(`harness.role`),dataIndex:`role`,key:`role`,render:e=>Q(e===`orchestrator`?`harness.roleOrchestrator`:`harness.roleSubAgent`)},{title:Q(`harness.tierModel`),dataIndex:`tierModel`,key:`tierModel`},{title:Q(`harness.capabilitiesColumn`),dataIndex:`capabilities`,key:`capabilities`,render:e=>(0,Z.jsx)(Z.Fragment,{children:e.map(e=>(0,Z.jsx)(iL,{bordered:!0,style:{marginBottom:4},children:e.capability},e.capability))})},{title:Q(`harness.callableAs`),dataIndex:`callableAs`,key:`callableAs`,render:e=>e??`—`},{title:Q(`harness.status`),dataIndex:`status`,key:`status`}]})}var A2={native:{color:AR.verified,icon:(0,Z.jsx)(bH,{}),label:Q(`harness.outcomeNative`)},"realize-via":{color:AR.estimate,icon:(0,Z.jsx)(XV,{}),label:Q(`harness.outcomeRealizeVia`)}};function j2({outcome:e}){let t=A2[e];return(0,Z.jsx)(iL,{color:t.color,icon:t.icon,bordered:!0,children:t.label})}function M2({components:e}){let t=new Map;for(let n of e)for(let e of n.capabilities)t.has(e.capability)||t.set(e.capability,e);let n=Array.from(t.values());return(0,Z.jsx)(L1,{rowKey:`capability`,dataSource:n,columns:[{title:Q(`harness.capability`),dataIndex:`capability`,key:`capability`},{title:Q(`harness.outcome`),dataIndex:`outcome`,key:`outcome`,render:e=>(0,Z.jsx)(j2,{outcome:e})},{title:Q(`harness.providedBy`),dataIndex:`providedBy`,key:`providedBy`},{title:Q(`harness.criticality`),dataIndex:`criticality`,key:`criticality`,render:e=>e??`—`}]})}function N2({steps:e}){return(0,Z.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8,padding:`4px 0`},children:e.map(e=>(0,Z.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:8,flexWrap:`wrap`},children:[(0,Z.jsx)(iL,{bordered:!0,children:e.tier}),(0,Z.jsx)(`strong`,{children:e.name}),(0,Z.jsxs)(`span`,{style:{opacity:.65,fontSize:12},children:[Q(`harness.stepConsumes`),`: `,e.consumes.length>0?e.consumes.join(`, `):`—`,` →`,` `,Q(`harness.stepProduces`),`: `,e.produces]}),(0,Z.jsx)(iL,{color:e.realization===`repair_fold`?AR.estimate:void 0,bordered:!0,children:e.realization}),e.guard&&(0,Z.jsxs)(iL,{bordered:!0,children:[Q(`harness.stepGuard`),`: `,e.guard]}),e.realization===`repair_fold`&&(0,Z.jsxs)(`span`,{style:{opacity:.65,fontSize:12},children:[Q(`harness.stepFoldInto`),`: `,e.foldInto,` · `,Q(`harness.stepMaxAttempts`),`: `,e.maxAttempts]})]},e.name))})}function P2({components:e}){return(0,Z.jsx)(L1,{rowKey:`id`,dataSource:e,expandable:{rowExpandable:e=>e.status!==`unavailable`,expandedRowRender:e=>(0,Z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:[(0,Z.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:8,flexWrap:`wrap`},children:[(0,Z.jsxs)(`span`,{style:{opacity:.65,fontSize:12},children:[Q(`harness.toolsLabel`),`:`]}),e.tools.length>0?e.tools.map(e=>(0,Z.jsx)(iL,{bordered:!0,children:e.name},e.name)):(0,Z.jsx)(`span`,{style:{opacity:.65,fontSize:12},children:Q(`harness.noneFallback`)})]}),(0,Z.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:8,flexWrap:`wrap`},children:[(0,Z.jsxs)(`span`,{style:{opacity:.65,fontSize:12},children:[Q(`harness.outputBlocksLabel`),`:`]}),e.outputBlocks.length>0?e.outputBlocks.map(e=>(0,Z.jsx)(iL,{bordered:!0,children:e},e)):(0,Z.jsx)(`span`,{style:{opacity:.65,fontSize:12},children:Q(`harness.noneFallback`)})]}),e.outcome!==`none`&&(0,Z.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:8,flexWrap:`wrap`},children:[(0,Z.jsxs)(`span`,{style:{opacity:.65,fontSize:12},children:[Q(`harness.outcomeLabel`),`:`]}),(0,Z.jsx)(iL,{bordered:!0,children:e.outcome})]}),e.nativeAvailability&&(0,Z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,Z.jsxs)(`span`,{style:{opacity:.65,fontSize:12},children:[Q(`harness.programmaticallyUnavailable`),`:`]}),(0,Z.jsx)(M1,{label:Q(`harness.compiledDispatchTarget`),value:e.nativeAvailability.compiledDispatchTarget}),(0,Z.jsx)(M1,{label:Q(`harness.reason`),value:e.nativeAvailability.compiledUnavailableReason})]}),(0,Z.jsx)(N2,{steps:e.steps})]})},columns:[{title:Q(`harness.component`),dataIndex:`name`,key:`name`},{title:Q(`harness.availability`),key:`availability`,render:(e,t)=>t.status===`unavailable`?(0,Z.jsxs)(iL,{color:`warning`,children:[Q(`harness.unavailable`),`: `,t.unavailableReason??Q(`harness.reasonUnavailable`)]}):t.nativeAvailability?(0,Z.jsxs)(iL,{color:`success`,children:[Q(`harness.availableVia`),` `,t.nativeAvailability.viaLabel]}):(0,Z.jsx)(iL,{color:`success`,children:Q(`harness.available`)})},{title:Q(`harness.callableAs`),dataIndex:`callableAs`,key:`callableAs`},{title:Q(`harness.componentType`),dataIndex:`componentType`,key:`componentType`},{title:Q(`harness.realization`),dataIndex:`realizationLabel`,key:`realizationLabel`}]})}var F2={healthy:{color:AR.verified,icon:(0,Z.jsx)(bH,{}),label:Q(`harness.healthHealthy`)},degraded:{color:AR.estimate,icon:(0,Z.jsx)(nW,{}),label:Q(`harness.healthDegraded`)},down:{color:AR.refused,icon:(0,Z.jsx)(CH,{}),label:Q(`harness.healthDown`)}};function I2({health:e}){let t=F2[e];return(0,Z.jsx)(iL,{color:t.color,icon:t.icon,bordered:!0,children:t.label})}function L2({components:e}){let t=new Map;for(let n of e)for(let e of n.guardrails)t.has(e.name)||t.set(e.name,e);let n=Array.from(t.values());return(0,Z.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`},children:n.map(e=>(0,Z.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`6px 0`,borderTop:`1px solid var(--ant-color-border-secondary)`},children:[(0,Z.jsx)(`strong`,{children:e.name}),(0,Z.jsx)(iL,{bordered:!0,children:e.enforcement}),e.locked?(0,Z.jsx)(iL,{color:AR.verified,bordered:!0,children:Q(`harness.locked`)}):e.threshold===void 0?null:(0,Z.jsx)(iL,{bordered:!0,children:e.threshold})]},e.name))})}var R2={"claude-agent-sdk":Q(`harness.dispatcherClaudeAgentSdk`),"codex-local":Q(`harness.dispatcherCodexLocal`),"in-process":Q(`harness.dispatcherInProcess`)};function z2({harness:e}){let{purpose:t,profile:n,runtime:r,connection:i,components:a,agentProfiles:o,nativeSessions:s}=e,c=t.targetLabel??Q(`harness.targetNotConfigured`),l=t.executionKind===`setup_runner`?Q(`harness.setupRunnerTarget`):Q(`harness.nativeSessionTarget`),u=t.available?Q(`harness.ready`):Q(`harness.unavailable`);return(0,Z.jsxs)(eA,{className:`harness-overview`,orientation:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(mR.Paragraph,{type:`secondary`,style:{maxWidth:`64ch`},children:[Q(`harness.pageLeadPrefix`),` `,(0,Z.jsx)(`strong`,{children:t.profile}),` `,Q(`harness.pageLeadSuffix`)]}),(0,Z.jsxs)(j1,{title:Q(`harness.executionTitle`),note:Q(`harness.executionNote`),extra:(0,Z.jsx)(iL,{color:t.available?AR.verified:AR.estimate,icon:t.available?(0,Z.jsx)(bH,{}):(0,Z.jsx)(CH,{}),bordered:!0,children:u}),children:[(0,Z.jsxs)(`div`,{className:`harness-execution-path`,"aria-label":Q(`harness.executionTitle`),children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(mR.Text,{type:`secondary`,children:Q(`harness.purpose`)}),(0,Z.jsx)(`strong`,{children:t.purpose})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(mR.Text,{type:`secondary`,children:Q(`harness.compiledDispatchTarget`)}),(0,Z.jsx)(`strong`,{children:n.dispatchTarget})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(mR.Text,{type:`secondary`,children:l}),(0,Z.jsx)(`strong`,{children:c})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(mR.Text,{type:`secondary`,children:Q(`harness.readiness`)}),(0,Z.jsx)(`strong`,{children:u})]})]}),(0,Z.jsx)(M1,{label:Q(`harness.profile`),value:t.profile}),!t.available&&t.reason&&(0,Z.jsx)(M1,{label:Q(`harness.reason`),value:t.reason})]}),(0,Z.jsx)(j1,{title:Q(`harness.componentsTitle`),note:Q(`harness.componentsNote`),children:(0,Z.jsx)(P2,{components:a})}),(0,Z.jsx)(j1,{title:Q(`harness.technicalDiagnosticsTitle`),note:Q(`harness.technicalDiagnosticsNote`),children:(0,Z.jsx)(Zm,{destroyOnHidden:!0,items:[{key:`runtime`,label:Q(`harness.runtimeDiagnosticsTitle`),children:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(M1,{label:Q(`harness.authenticationBackend`),value:r.label}),r.dispatcher!==void 0&&(0,Z.jsx)(M1,{label:Q(`harness.dispatcherImplementation`),value:R2[r.dispatcher]}),(0,Z.jsx)(L1,{rowKey:`tier`,dataSource:r.tierModels,columns:[{title:Q(`harness.tier`),dataIndex:`tier`,key:`tier`},{title:Q(`harness.model`),dataIndex:`model`,key:`model`}]})]})},{key:`profile`,label:Q(`harness.profileDiagnosticsTitle`),children:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(M1,{label:Q(`harness.source`),value:`warble · IR v${n.irVersion}`}),(0,Z.jsx)(M1,{label:Q(`harness.boundContext`),value:n.boundContext}),(0,Z.jsx)(M1,{label:Q(`harness.verifyGate`),value:(0,Z.jsx)(iL,{color:n.verifyGate?AR.verified:AR.refused,icon:n.verifyGate?(0,Z.jsx)(bH,{}):(0,Z.jsx)(CH,{}),bordered:!0,children:n.verifyGate?Q(`harness.verifyGateOn`):Q(`harness.verifyGateOff`)})}),(0,Z.jsx)(M1,{label:Q(`harness.bundle`),value:`${n.bundleId} · v${n.bundleVersion} · ${n.bundleHash}`})]})},{key:`connection`,label:Q(`harness.connectionTitle`),children:(0,Z.jsxs)(`div`,{className:`harness-diagnostic-grid`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(M1,{label:Q(`harness.connectionType`),value:i.type}),(0,Z.jsx)(M1,{label:Q(`harness.connectionLocation`),value:i.location}),(0,Z.jsx)(M1,{label:Q(`harness.connectionVia`),value:i.via})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(M1,{label:Q(`harness.health`),value:(0,Z.jsx)(I2,{health:i.health})}),(0,Z.jsx)(M1,{label:Q(`harness.tablesSynced`),value:i.tablesSynced}),(0,Z.jsx)(M1,{label:Q(`harness.lastSync`),value:i.lastSync})]})]})},{key:`agent-profiles`,label:Q(`harness.agentProfilesTitle`),children:(0,Z.jsx)(k2,{profiles:o})},{key:`capabilities`,label:Q(`harness.capabilityResolutionTitle`),children:(0,Z.jsx)(M2,{components:a})},{key:`guardrails`,label:Q(`harness.guardrailsTitle`),children:(0,Z.jsx)(L2,{components:a})},{key:`native-session-binding`,label:Q(`harness.nativeBindingDiagnosticsTitle`),children:(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(M1,{label:Q(`harness.bindingGeneration`),value:s.binding.generation})})}]})})]})}function B2(){let e=h2(e=>e.selectedPurpose),t=h2(e=>e.harness),n=h2(e=>e.loading),r=h2(e=>e.error),i=h2(e=>e.loadHarness);(0,v.useEffect)(()=>{i()},[i]);let a=aW(),o=a?t:O2[e],s;return s=a&&n&&!t?(0,Z.jsx)(R1,{status:`loading`}):a&&r&&!t?(0,Z.jsx)(R1,{status:`error`,title:Q(`harness.loadErrorTitle`),description:r,onRetry:i}):o&&o.purpose.purpose===e?(0,Z.jsx)(z2,{harness:o}):(0,Z.jsx)(R1,{status:`empty`,title:Q(`harness.emptyTitle`),description:Q(`harness.emptyDescription`)}),(0,Z.jsx)(B1,{maxWidth:1e3,title:Q(`nav.harness`),lead:Q(`harness.pageSubtitle`),children:s})}function V2({header:e,items:t,emptyHint:n,selectedKey:r,onSelect:i}){let[a,o]=(0,v.useState)(t[0]?.key),s=r??a,c=e=>{i?i(e):o(e)};return(0,Z.jsxs)(`nav`,{"aria-label":e,style:{padding:`12px 8px`},children:[(0,Z.jsx)(mR.Text,{type:`secondary`,style:{fontSize:11,textTransform:`uppercase`,letterSpacing:.6,padding:`0 8px`},children:e}),(0,Z.jsxs)(`div`,{style:{marginTop:8,display:`flex`,flexDirection:`column`,gap:2},children:[t.length===0&&(0,Z.jsx)(`div`,{style:{padding:8,opacity:.6,fontSize:13},children:n??`—`}),t.map(e=>{let t=e.key===s;return(0,Z.jsxs)(`button`,{type:`button`,"aria-current":t,"aria-disabled":e.disabled,disabled:e.disabled,onClick:()=>!e.disabled&&c(e.key),style:{textAlign:`left`,border:`none`,borderRadius:6,padding:`6px 8px`,cursor:e.disabled?`default`:`pointer`,background:t?`var(--ant-color-fill-secondary)`:`transparent`,color:`inherit`,font:`inherit`,opacity:e.disabled?.5:1},children:[(0,Z.jsx)(`div`,{style:{fontSize:13,lineHeight:1.3},children:e.label}),e.meta&&(0,Z.jsx)(`div`,{style:{fontSize:11,opacity:.6},children:e.meta})]},e.key)})]})]})}function H2(){let e=h2(e=>e.selectedPurpose),t=h2(e=>e.selectProfile),n=h2(e=>e.harness),r={setup:`Setup`,analysis:`Analyze data`,context_enrichment:`Context enrichment`},i=p2.map(e=>({key:e,label:r[e],meta:n?.purpose.purpose===e?n.purpose.profile:void 0}));return(0,Z.jsx)(V2,{header:Q(`harness.profilesHeader`),items:i,selectedKey:e,onSelect:e=>t(e)})}var U2=[{key:`runtime`,title:`Runtime & models`,state:`current`},{key:`connect`,title:`Connect data source`,state:`todo`},{key:`context`,title:`Build data model`,state:`todo`},{key:`bind`,title:`Bind profile`,state:`todo`},{key:`ask`,title:`Ask`,state:`todo`}],W2={authMode:`subscription`,subscriptionProvider:`claude`,tierModels:{claude:[{tier:`strong`,model:``},{tier:`cheap`,model:``}],codex:[{tier:`strong`,model:``},{tier:`cheap`,model:``}]}.claude,hybrid:!1,deployment:`personal`},G2=[{key:`postgres`,label:`PostgreSQL`},{key:`bigquery`,label:`BigQuery`},{key:`snowflake`,label:`Snowflake`},{key:`duckdb`,label:`Local file (CSV / DuckDB)`}],K2={models:6,relationships:3},q2={id:`m0`,role:`assistant`,text:`Let's get your workspace ready. Start with runtime & models below — pick how you authenticate and which model backs each tier.`},J2=1,Y2=0;function X2(){return`m${J2++}`}function Z2(e,t,n){return e.map(e=>e.key===t?{...e,state:`done`}:e.key===n?{...e,state:`current`}:e)}function Q2(e,t){let n=e.findIndex(e=>e.key===t);return n===-1||n===e.length-1?t:e[n+1].key}function $2(e,t){if(!e.some(e=>e.state===`running`))return e;let n=t===`ok`?`done`:`error`;return e.map(e=>e.state===`running`?{...e,state:n}:e)}var e4={workLog:[],streaming:!1,needsInput:!1,envFieldsLoading:!1,submittingEnv:!1},t4={workLog:[],streaming:!1,needsInput:!1},n4={verifying:!1,resolving:!1},r4={models:0,relationships:0},i4={anthropic:!1,openaiCompatible:!1},a4=aW()?{claude:!1,codex:!1}:{claude:!0,codex:!1},o4=bR()((e,t)=>{function n(n,r,i=`connect`){return{onWorkLog:t=>e(e=>({connectStream:{...e.connectStream,workLog:t}})),onEvent:r=>{if(t().connectStream.activeUnsubscribe?.(),r.status===`ok`)e(e=>({steps:Z2(e.steps,`connect`,`context`),selectedStepKey:`context`,connectedSourceKey:n,connectStream:{...e.connectStream,streaming:!1,terminal:r,needsInput:!1,activeUnsubscribe:void 0},messages:[...e.messages,{id:X2(),role:`assistant`,text:Q(`setup.dataSourceConnectedMessage`),workLog:e.connectStream.workLog,terminal:r}]}));else if(r.status===`needs_decision`&&r.decision){let t=r.decision;e(e=>({connectStream:{...e.connectStream,streaming:!1,terminal:r,needsInput:!1,decision:t,activeUnsubscribe:void 0},messages:[...e.messages,{id:X2(),role:`assistant`,text:t.detail??r.message,workLog:e.connectStream.workLog,terminal:r}]}))}else e(e=>({connectStream:{...e.connectStream,streaming:!1,terminal:r,needsInput:!0,activeUnsubscribe:void 0},messages:[...e.messages,{id:X2(),role:`assistant`,text:r.message,workLog:e.connectStream.workLog,terminal:r}]}))},onError:a=>{t().connectStream.activeUnsubscribe?.(),e(e=>({connectStream:{...e.connectStream,streaming:!1,error:a,failure:{attempt:i,projectName:r,sourceType:n,error:a,workLog:$2(e.connectStream.workLog,`error`)},workLog:$2(e.connectStream.workLog,`error`),activeUnsubscribe:void 0},messages:[...e.messages,{id:X2(),role:`assistant`,text:Q(`setup.connectFailureHistoryMessage`),workLog:$2(e.connectStream.workLog,`error`)}]}))},onDone:()=>{t().connectStream.activeUnsubscribe?.(),e(e=>({connectStream:{...e.connectStream,streaming:!1,activeUnsubscribe:void 0}}))}}}function r(){gW().then(t=>e({contextSummary:{models:t.models.length,relationships:t.relationships.length}})).catch(()=>{})}function i(){return{onWorkLog:t=>e(e=>({contextStream:{...e.contextStream,workLog:t}})),onEvent:n=>{if(t().contextStream.activeUnsubscribe?.(),n.status===`ok`)e(e=>({steps:Z2(e.steps,`context`,`bind`),selectedStepKey:`bind`,contextStream:{...e.contextStream,streaming:!1,terminal:n,needsInput:!1,activeUnsubscribe:void 0},messages:[...e.messages,{id:X2(),role:`assistant`,text:Q(`setup.contextBuiltMessage`),workLog:$2(e.contextStream.workLog,`ok`),terminal:n}]})),r();else if(n.status===`needs_decision`&&n.decision){let t=n.decision;e(e=>({contextStream:{...e.contextStream,streaming:!1,terminal:n,needsInput:!1,decision:t,activeUnsubscribe:void 0},messages:[...e.messages,{id:X2(),role:`assistant`,text:t.detail??n.message,workLog:$2(e.contextStream.workLog,`error`),terminal:n}]}))}else e(e=>({contextStream:{...e.contextStream,streaming:!1,terminal:n,needsInput:!0,activeUnsubscribe:void 0},messages:[...e.messages,{id:X2(),role:`assistant`,text:n.message,workLog:$2(e.contextStream.workLog,`error`),terminal:n}]}))},onError:n=>{t().contextStream.activeUnsubscribe?.(),e(e=>({contextStream:{...e.contextStream,streaming:!1,error:n,failure:{attempt:`context`,projectName:e.connectStream.projectName??e.connectStream.failure?.projectName??``,sourceType:e.connectedSourceKey??e.connectStream.failure?.sourceType??``,error:n,workLog:$2(e.contextStream.workLog,`error`)},workLog:$2(e.contextStream.workLog,`error`),activeUnsubscribe:void 0},messages:[...e.messages,{id:X2(),role:`assistant`,text:Q(`setup.contextFailureHistoryMessage`),workLog:$2(e.contextStream.workLog,`error`)}]}))},onDone:()=>{t().contextStream.activeUnsubscribe?.(),e(e=>({contextStream:{...e.contextStream,streaming:!1,activeUnsubscribe:void 0}}))}}}return{steps:U2,selectedStepKey:`runtime`,runtimeSettings:W2,runtimeSettingsGeneration:0,runtimeSettingsDirty:!1,sourceCatalog:[],sourceCatalogDegradedReason:void 0,sourceCatalogLoading:!1,runtimeTierNames:aW()?[]:W2.tierModels.map(e=>e.tier),runtimeTierNamesError:void 0,adapterEnvStatus:i4,subscriptionLoginStatus:a4,subscriptionModelCatalogs:{},subscriptionModelCatalogLoading:{},subscriptionModelCatalogErrors:{},runtimeSettingsSaving:!1,runtimeSettingsError:void 0,verifyGate:!1,connectedSourceKey:void 0,messages:[q2],setupMode:void 0,setupModeLoading:aW(),setupModeChoosing:!1,setupModeError:void 0,connectStream:e4,contextStream:t4,adoptStream:n4,contextSummary:r4,selectStep:t=>e({selectedStepKey:t}),chooseSetupMode:t=>{aW()&&(e({setupModeChoosing:!0,setupModeError:void 0}),JW(t).then(({mode:t,steps:n})=>e({setupMode:t,steps:n,setupModeChoosing:!1})).catch(t=>{e({setupModeChoosing:!1,setupModeError:t instanceof Error?t.message:Q(`ask.streamErrorGeneric`)})}))},adoptProject:(n,i)=>{if(!aW())return;let{decision:a,sessionId:o}=t().adoptStream;e({adoptStream:{...n4,verifying:!0}}),nG(n,i).then(t=>{if(t.status===`ok`){e(e=>({steps:Z2(Z2(e.steps,`adopt`,`context`),`context`,`bind`),selectedStepKey:`bind`,adoptStream:n4,messages:[...e.messages,{id:X2(),role:`assistant`,text:Q(`setup.adoptBoundMessage`)}]})),r();return}if(t.status===`needs_decision`&&t.decision){let n=t.decision;e(e=>({adoptStream:{...n4,decision:n,sessionId:t.sessionId},messages:[...e.messages,{id:X2(),role:`assistant`,text:n.detail??t.message}]}));return}if(i&&a){e({adoptStream:{...n4,decision:a,sessionId:o,error:t.message}});return}e({adoptStream:{...n4,error:t.message}})}).catch(t=>{let n=t instanceof Error?t.message:Q(`ask.streamErrorGeneric`);if(i&&a){e({adoptStream:{...n4,decision:a,sessionId:o,error:n}});return}e({adoptStream:{...n4,error:n}})})},resolveAdoptDecision:n=>{let{sessionId:r}=t().adoptStream;!aW()||!r||(e(e=>({adoptStream:{...e.adoptStream,resolving:!0,error:void 0}})),rG(r,n).then(t=>{if(`turnId`in t){e(e=>({steps:Z2(e.steps,`adopt`,`context`),selectedStepKey:`context`,adoptStream:n4,contextStream:{...t4,streaming:!0}}));let n=v1(t.sessionId,t.turnId,i());e(e=>({contextStream:{...e.contextStream,sessionId:t.sessionId,activeUnsubscribe:n}}));return}e({setupMode:void 0,adoptStream:n4})}).catch(t=>{let n=t instanceof Error?t.message:Q(`ask.streamErrorGeneric`);e(e=>({adoptStream:{...e.adoptStream,resolving:!1,error:n}}))}))},updateRuntimeSettings:t=>e(e=>({runtimeSettings:{...e.runtimeSettings,...t},runtimeSettingsGeneration:e.runtimeSettingsGeneration+1,runtimeSettingsDirty:!0})),selectSubscriptionProvider:n=>{let r=t();if((r.runtimeSettings.subscriptionProvider??`claude`)===n){r.loadSubscriptionModelCatalog(n);return}e(e=>({runtimeSettings:{...e.runtimeSettings,subscriptionProvider:n,subscriptionDriverModel:``,apiKeyModel:``,tierModels:e.runtimeTierNames.map(e=>({tier:e}))},runtimeSettingsGeneration:e.runtimeSettingsGeneration+1,runtimeSettingsDirty:!0})),t().loadSubscriptionModelCatalog(n)},loadSubscriptionModelCatalog:(n,r=!1)=>{if(!aW())return;let i=++Y2;e(e=>({subscriptionModelCatalogLoading:{...e.subscriptionModelCatalogLoading,[n]:!0},subscriptionModelCatalogErrors:{...e.subscriptionModelCatalogErrors,[n]:void 0}})),GW(n,r).then(r=>{(t().runtimeSettings.subscriptionProvider??`claude`)===n&&i===Y2&&e(e=>({subscriptionModelCatalogs:{...e.subscriptionModelCatalogs,[n]:r},subscriptionModelCatalogLoading:{...e.subscriptionModelCatalogLoading,[n]:!1},subscriptionModelCatalogErrors:{...e.subscriptionModelCatalogErrors,[n]:r.status===`unavailable`?r.code:void 0}}))}).catch(()=>{(t().runtimeSettings.subscriptionProvider??`claude`)===n&&i===Y2&&e(e=>({subscriptionModelCatalogLoading:{...e.subscriptionModelCatalogLoading,[n]:!1},subscriptionModelCatalogErrors:{...e.subscriptionModelCatalogErrors,[n]:`runtime_unavailable`}}))})},saveRuntimeSettings:()=>{if(!aW()){e(e=>{let t=Q2(e.steps,`runtime`);return{steps:Z2(e.steps,`runtime`,t),selectedStepKey:t,messages:[...e.messages,{id:X2(),role:`assistant`,text:Q(`setup.runtimeConfiguredMessage`)}]}});return}let n=t(),r=n.runtimeTierNames.map(e=>{let t=n.runtimeSettings.tierModels.find(t=>t.tier===e);return{tier:e,...t?.model===void 0?{}:{model:t.model}}});e(e=>({runtimeSettingsSaving:!0,runtimeSettingsError:void 0,runtimeSettingsGeneration:e.runtimeSettingsGeneration+1,runtimeSettingsDirty:!0})),HW({...n.runtimeSettings,authMode:`subscription`,hybrid:!1,apiKeyModel:``,apiKeyAdapter:`anthropic`,tierModels:r}).then(({warnings:t,nativeSessionBinding:n,...r})=>{e(e=>{let i=Q2(e.steps,`runtime`);return{runtimeSettings:r,nativeSessionBinding:n,runtimeSettingsSaving:!1,runtimeSettingsError:void 0,steps:Z2(e.steps,`runtime`,i),selectedStepKey:i,messages:[...e.messages,{id:X2(),role:`assistant`,text:Q(`setup.runtimeConfiguredMessage`)},...t.map(e=>({id:X2(),role:`assistant`,text:e}))]}}),i1.getState().refreshReadiness()}).catch(t=>{e({runtimeSettingsSaving:!1,runtimeSettingsError:t instanceof Error?t.message:Q(`ask.streamErrorGeneric`)})})},connectDataSource:(r,i,a)=>{if(!aW()){e(e=>({steps:Z2(e.steps,`connect`,`context`),selectedStepKey:`context`,connectedSourceKey:i,messages:[...e.messages,{id:X2(),role:`assistant`,text:Q(`setup.dataSourceConnectedMessage`)}]}));return}t().connectStream.activeUnsubscribe?.(),e({connectStream:{...e4,streaming:!0,sourceType:i,projectName:r}}),XW(r,i,a).then(({sessionId:t,turnId:a})=>{let o=v1(t,a,n(i,r));e(e=>({connectStream:{...e.connectStream,sessionId:t,activeUnsubscribe:o}}))}).catch(t=>{if(t instanceof YW){e(e=>({connectStream:{...e.connectStream,streaming:!1,sessionId:t.sessionId,decision:t.decision},messages:[...e.messages,{id:X2(),role:`assistant`,text:t.decision.detail??t.message}]}));return}let n=t instanceof Error?t.message:Q(`ask.streamErrorGeneric`);e(e=>({connectStream:{...e.connectStream,streaming:!1,error:n}}))})},resumeConnect:()=>{if(!aW())return;let r=t().connectStream,i=r.failure,a=r.sourceType??i?.sourceType??``,o=r.projectName??i?.projectName??``;r.activeUnsubscribe?.(),e({connectStream:{...e4,streaming:!0,sourceType:a,projectName:o}}),ZW().then(({sessionId:t,turnId:r})=>{let i=v1(t,r,n(a,o,`connect_resume`));e(e=>({connectStream:{...e.connectStream,sessionId:t,activeUnsubscribe:i}}))}).catch(t=>{let n=t instanceof Error?t.message:Q(`ask.streamErrorGeneric`);e(e=>({connectStream:{...e.connectStream,streaming:!1,error:n}}))})},retryConnectFailure:()=>{let e=t().connectStream.failure;if(e){if(e.attempt===`connect_resume`){t().resumeConnect();return}t().connectDataSource(e.projectName,e.sourceType)}},fetchSourceCatalog:()=>{aW()&&(e({sourceCatalogLoading:!0}),QW().then(t=>e({sourceCatalog:t.sources,sourceCatalogDegradedReason:t.fromCli?void 0:t.degradedReason??Q(`setup.connectSourceCatalogPartial`),sourceCatalogLoading:!1})).catch(t=>{e({sourceCatalog:[],sourceCatalogDegradedReason:t instanceof Error?t.message:Q(`setup.connectSourceCatalogPartial`),sourceCatalogLoading:!1})}))},fetchConnectEnvFields:()=>{aW()&&(e(e=>({connectStream:{...e.connectStream,envFieldsError:void 0,envFieldsLoading:!0}})),$W().then(({fields:t})=>e(e=>({connectStream:{...e.connectStream,envFields:t,envFieldsLoading:!1}}))).catch(t=>{let n=t instanceof Error?t.message:Q(`setup.connectEnvFieldsLoadError`);e(e=>({connectStream:{...e.connectStream,envFieldsError:n,envFieldsLoading:!1}}))}))},submitConnectEnv:n=>{aW()&&(e(e=>({connectStream:{...e.connectStream,submittingEnv:!0}})),eG(n).then(()=>{e(e=>({connectStream:{...e.connectStream,submittingEnv:!1}})),t().resumeConnect()}).catch(t=>{let n=t instanceof Error?t.message:Q(`ask.streamErrorGeneric`);e(e=>({connectStream:{...e.connectStream,submittingEnv:!1,error:n}}))}))},resolveConnectDecision:r=>{let{sessionId:i,sourceType:a}=t().connectStream;!aW()||!i||(e(e=>({connectStream:{...e.connectStream,streaming:!0,error:void 0}})),rG(i,r).then(t=>{if(`turnId`in t){let r=v1(t.sessionId,t.turnId,n(a??``,``));e(e=>({connectStream:{...e.connectStream,sessionId:t.sessionId,decision:void 0,activeUnsubscribe:r}}));return}e(r===`rename`?{connectStream:{...e4,sourceType:a}}:{connectStream:e4})}).catch(t=>{let n=t instanceof Error?t.message:Q(`ask.streamErrorGeneric`);e(e=>({connectStream:{...e.connectStream,streaming:!1,error:n}}))}))},resolveContextDecision:n=>{let{sessionId:r}=t().contextStream;!aW()||!r||(e(e=>({contextStream:{...e.contextStream,streaming:!0,error:void 0}})),rG(r,n).then(t=>{if(`turnId`in t){let n=v1(t.sessionId,t.turnId,i());e(e=>({contextStream:{...e.contextStream,workLog:[],sessionId:t.sessionId,decision:void 0,activeUnsubscribe:n}}));return}if(`event`in t){e(e=>({contextStream:{...e.contextStream,streaming:!1,decision:void 0}})),i().onEvent?.(t.event);return}e(e=>({contextStream:{...e.contextStream,streaming:!1,decision:void 0}}))}).catch(t=>{let n=t instanceof Error?t.message:Q(`ask.streamErrorGeneric`);e(e=>({contextStream:{...e.contextStream,streaming:!1,error:n}}))}))},buildContext:()=>{if(!aW()){e(e=>({steps:Z2(e.steps,`context`,`bind`),selectedStepKey:`bind`,contextSummary:K2,messages:[...e.messages,{id:X2(),role:`assistant`,text:Q(`setup.contextBuiltMessage`)}]}));return}t().contextStream.activeUnsubscribe?.(),e({contextStream:{...t4,streaming:!0}}),tG().then(({sessionId:t,turnId:n})=>{let r=v1(t,n,i());e(e=>({contextStream:{...e.contextStream,sessionId:t,activeUnsubscribe:r}}))}).catch(t=>{let n=t instanceof Error?t.message:Q(`ask.streamErrorGeneric`);e(e=>({contextStream:{...e.contextStream,streaming:!1,error:n}}))})},retryContextFailure:()=>{t().contextStream.failure?.attempt===`context`&&t().buildContext()},compileAndBind:()=>{e(e=>({steps:Z2(e.steps,`bind`,`ask`),selectedStepKey:`ask`,verifyGate:!0,messages:[...e.messages,{id:X2(),role:`assistant`,text:Q(`setup.profileBoundMessage`)}]})),aW()&&iG().then(({steps:t,verifyGatePassed:n})=>e({steps:t,verifyGate:n})).catch(()=>{})},refreshCanonical:()=>{aW()&&(RW().then(t=>{let n=[...t].reverse().find(e=>e.state===`current`)?.key??t.find(e=>e.state!==`done`)?.key;e(n?{steps:t,selectedStepKey:n}:{steps:t})}).catch(()=>{}),KW().then(({mode:t})=>e({setupMode:t,setupModeLoading:!1})).catch(()=>e({setupModeLoading:!1})),gW().then(t=>e({contextSummary:{models:t.models.length,relationships:t.relationships.length}})).catch(()=>{}))},hydrate:()=>{if(!aW())return;let n=()=>!t().steps.some(e=>e.state===`done`),r=t().runtimeSettingsGeneration,i=()=>n()&&!t().runtimeSettingsDirty&&t().runtimeSettingsGeneration===r;KW().then(({mode:t})=>e({setupMode:t,setupModeLoading:!1})).catch(()=>e({setupModeLoading:!1})),qW().then(({failure:n,needsInput:r,sessionId:i,decision:a})=>{if(!(t().connectStream.streaming||t().contextStream.streaming)){if((a?.kind===`max_turns_continue`||a?.kind===`schema_discovery_retry`)&&i){e({selectedStepKey:`context`,contextStream:{...t4,sessionId:i,decision:a}});return}if(r&&i){let t={id:`recovery-needs-input-${i}`,kind:`setup_status`,status:`needs_input`,message:r.message};if(r.attempt===`context`){e({selectedStepKey:`context`,contextStream:{...t4,sessionId:i,terminal:t,needsInput:!0,workLog:r.workLog}});return}e({selectedStepKey:`connect`,connectStream:{...e4,sessionId:i,terminal:t,needsInput:!0,sourceType:r.sourceType,projectName:r.projectName,workLog:r.workLog,failure:n}});return}if(n){if(n.attempt===`context`){e({selectedStepKey:`context`,contextStream:{...t4,error:n.error,failure:n,workLog:n.workLog}});return}e({selectedStepKey:`connect`,connectStream:{...e4,error:n.error,failure:n,sourceType:n.sourceType,projectName:n.projectName,workLog:n.workLog}})}}}).catch(()=>{}),RW().then(t=>{if(!n())return;let r=[...t].reverse().find(e=>e.state===`current`)?.key??t.find(e=>e.state!==`done`)?.key;e(r?{steps:t,selectedStepKey:r}:{steps:t})}).catch(()=>{}),zW().then(n=>{i()&&(e({runtimeSettings:n}),t().loadSubscriptionModelCatalog(n.subscriptionProvider??`claude`))}).catch(()=>{}),BW().then(t=>{!i()||t.valid||e({runtimeSettingsError:t.correction})}).catch(()=>{}),VW().then(t=>e({runtimeTierNames:t,runtimeTierNamesError:void 0})).catch(t=>{e({runtimeTierNames:[],runtimeTierNamesError:t instanceof Error?t.message:Q(`ask.streamErrorGeneric`)})}),UW().then(t=>e({adapterEnvStatus:t})).catch(()=>{}),WW().then(t=>e({subscriptionLoginStatus:t})).catch(()=>{})},resetSetup:()=>{t().connectStream.activeUnsubscribe?.(),t().contextStream.activeUnsubscribe?.(),e(e=>({steps:U2,selectedStepKey:`runtime`,runtimeSettings:W2,runtimeSettingsGeneration:e.runtimeSettingsGeneration+1,runtimeSettingsDirty:!1,subscriptionLoginStatus:a4,subscriptionModelCatalogs:{},subscriptionModelCatalogLoading:{},subscriptionModelCatalogErrors:{},runtimeSettingsSaving:!1,runtimeSettingsError:void 0,nativeSessionBinding:void 0,verifyGate:!1,connectedSourceKey:void 0,messages:[q2],setupMode:void 0,setupModeLoading:!1,setupModeChoosing:!1,setupModeError:void 0,connectStream:e4,contextStream:t4,adoptStream:n4,contextSummary:r4})),aW()&&aG().then(({steps:t,runtimeSettings:n})=>{e({steps:t,runtimeSettings:n});let r=WW().then(t=>e({subscriptionLoginStatus:t})).catch(()=>{}),i=VW().then(t=>e({runtimeTierNames:t,runtimeTierNamesError:void 0})).catch(t=>{e({runtimeTierNames:[],runtimeTierNamesError:t instanceof Error?t.message:Q(`ask.streamErrorGeneric`)})});return Promise.all([r,i]).then(()=>i1.getState().refreshReadiness())}).catch(()=>{})}}});function s4({children:e}){return(0,Z.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`flex-start`},children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:24,height:24,borderRadius:`50%`,marginTop:2,flexShrink:0,background:`var(--ant-color-fill-secondary)`,color:`var(--ant-color-text-secondary)`},children:(0,Z.jsx)(CU,{style:{fontSize:13}})}),(0,Z.jsx)(`div`,{style:{flex:1,minWidth:0},children:e})]})}var c4={running:(0,Z.jsx)(Md,{spin:!0}),done:(0,Z.jsx)(bH,{}),error:(0,Z.jsx)(CH,{})},l4={running:`var(--ant-color-text-secondary)`,done:`var(--ant-color-success)`,error:`var(--ant-color-error)`},u4={running:Q(`ask.stepRunning`),done:Q(`ask.stepDone`),error:Q(`ask.stepError`)},d4={tool:(0,Z.jsx)(XU,{}),subagent:(0,Z.jsx)(qV,{}),step:(0,Z.jsx)(_H,{}),decision:(0,Z.jsx)(_U,{})};function f4(e){return e.state===`error`?Q(`ask.stepErrorDetailLabel`):e.kind===`step`?Q(`ask.stepReasoningLabel`):Q(`ask.stepResultLabel`)}function p4(e){return e.kind===`decision`?!1:e.input!==void 0||e.detail!==void 0||e.inspection!==void 0}function m4(e){return typeof e==`object`&&e&&`sql`in e&&typeof e.sql==`string`?e.sql:JSON.stringify(e,null,2)}function h4(e){return e<1e3?`${e} ms`:`${(e/1e3).toFixed(e%1e3==0?0:1)} s`}function g4({steps:e,title:t,defaultOpen:n=!1}){let[r,i]=(0,v.useState)({}),[a,o]=(0,v.useState)(n);if(e.length===0)return null;let s=e=>i(t=>({...t,[e]:!t[e]})),c=(0,Z.jsx)(`ul`,{"aria-label":Q(`ask.workLog`),style:{listStyle:`none`,margin:0,padding:`8px 12px`,display:`flex`,flexDirection:`column`,gap:4,fontFamily:AR.fontFamilyCode,fontSize:12,background:`var(--ant-color-fill-tertiary)`,borderRadius:8},children:e.map(e=>{let t=p4(e),n=t&&!!r[e.id],i=e.kind===`decision`?e.detail??e.inspection?.error??e.inspection?.output:void 0,a=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:c4[e.state]}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:d4[e.kind]}),(0,Z.jsx)(`span`,{style:{color:`var(--ant-color-text)`},children:e.label}),i!==void 0&&(0,Z.jsx)(`span`,{style:{color:`var(--ant-color-text-secondary)`,minWidth:0,whiteSpace:`normal`,wordBreak:`break-word`},children:i}),(0,Z.jsxs)(`span`,{style:{fontSize:10,opacity:.65},children:[`(`,u4[e.state],`)`]}),t&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,style:{marginInlineStart:`auto`,opacity:.65},children:n?(0,Z.jsx)(eS,{}):(0,Z.jsx)(jm,{})})]});return(0,Z.jsxs)(`li`,{style:{display:`flex`,flexDirection:`column`,gap:4,paddingLeft:(e.depth??0)*16},children:[t?(0,Z.jsx)(`button`,{type:`button`,"aria-expanded":n,"aria-label":`${e.label} (${u4[e.state]}) — ${Q(`ask.stepToggleLabel`)}`,onClick:()=>s(e.id),style:{display:`flex`,alignItems:`center`,gap:6,width:`100%`,background:`transparent`,border:`none`,padding:0,margin:0,font:`inherit`,textAlign:`left`,cursor:`pointer`,color:l4[e.state]},children:a}):(0,Z.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,color:l4[e.state]},children:a}),t&&n&&(0,Z.jsxs)(`div`,{style:{marginInlineStart:20,padding:`6px 8px`,borderRadius:6,background:`var(--ant-color-fill-quaternary)`,color:`var(--ant-color-text)`,display:`flex`,flexDirection:`column`,gap:6},children:[e.input!==void 0&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{style:{fontSize:10,opacity:.65},children:Q(`ask.stepInputLabel`)}),(0,Z.jsx)(`pre`,{style:{margin:`2px 0 0`,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:(0,Z.jsx)(`code`,{children:m4(e.input)})})]}),e.detail!==void 0&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{style:{fontSize:10,opacity:.65},children:f4(e)}),(0,Z.jsx)(`div`,{style:{marginTop:2,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:e.detail})]}),e.inspection!==void 0&&(0,Z.jsxs)(Z.Fragment,{children:[e.inspection.action!==void 0&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{style:{fontSize:10,opacity:.65},children:Q(`ask.stepActionLabel`)}),(0,Z.jsx)(`pre`,{style:{margin:`2px 0 0`,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:(0,Z.jsx)(`code`,{children:e.inspection.action})})]}),e.inspection.output!==void 0&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{style:{fontSize:10,opacity:.65},children:Q(`ask.stepOutputLabel`)}),(0,Z.jsx)(`div`,{style:{marginTop:2,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:e.inspection.output})]}),e.inspection.error!==void 0&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{style:{fontSize:10,opacity:.65},children:Q(`ask.stepErrorDetailLabel`)}),(0,Z.jsx)(`div`,{style:{marginTop:2,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:e.inspection.error})]}),e.inspection.durationMs!==void 0&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`span`,{style:{fontSize:10,opacity:.65},children:[Q(`ask.stepDurationLabel`),`: `]}),(0,Z.jsx)(`span`,{children:h4(e.inspection.durationMs)})]})]})]})]},e.id)})});return t===void 0?c:(0,Z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":a,onClick:()=>o(e=>!e),style:{display:`flex`,alignItems:`center`,gap:6,width:`fit-content`,background:`transparent`,border:`none`,padding:0,margin:0,font:`inherit`,fontSize:12,cursor:`pointer`,color:`var(--ant-color-text-secondary)`},children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:a?(0,Z.jsx)(eS,{}):(0,Z.jsx)(jm,{})}),(0,Z.jsx)(`span`,{children:t})]}),a&&c]})}function _4({messages:e}){return(0,Z.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:e.map(e=>e.role===`assistant`?(0,Z.jsx)(s4,{children:(0,Z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:[(0,Z.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,Z.jsx)(mR.Text,{children:e.text}),e.terminal?.status===`ok`&&(0,Z.jsx)(bH,{"aria-hidden":`true`,style:{color:`var(--ant-color-success)`}}),e.terminal?.status===`needs_input`&&(0,Z.jsx)(VH,{"aria-hidden":`true`,style:{color:`var(--ant-color-warning)`}})]}),e.workLog&&e.workLog.length>0&&(0,Z.jsx)(g4,{steps:e.workLog,title:Q(`ask.executionTrace`)})]})},e.id):(0,Z.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`},children:(0,Z.jsx)(`div`,{style:{maxWidth:`80%`,background:`var(--ant-color-primary-bg)`,borderRadius:12,padding:`8px 12px`},children:(0,Z.jsx)(mR.Text,{children:e.text})})},e.id))})}var v4=[`inherit`,`opus`,`sonnet`,`haiku`],y4=[{label:Q(`setup.authSubscription`),value:`subscription`},{label:Q(`setup.authByo`),value:`byo`,disabled:!0},{label:Q(`setup.authLocal`),value:`local`,disabled:!0}],b4=[{label:`Claude CLI`,value:`claude`},{label:`Codex CLI`,value:`codex`}],x4=e=>{try{let t=new URL(e).protocol;return t===`http:`||t===`https:`}catch{return!1}};function S4({label:e,value:t,placeholder:n,catalog:r,allowedModels:i,onChange:a}){let[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(t),u=e=>r?.status===`ready`?r.models.find(t=>t.model.trim()===e):void 0,d=(i?i.map(e=>{let t=u(e);return{value:e,searchText:`${t?.displayName??e} ${e} ${t?.description??``}`.toLowerCase(),label:(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{style:{fontWeight:500},children:t?.displayName??e}),(0,Z.jsx)(`div`,{style:{opacity:.7,fontSize:12},children:e}),t?.description&&(0,Z.jsx)(`div`,{style:{opacity:.7,fontSize:12},children:t.description})]})}}):r?.status===`ready`?r.models.map(e=>({value:e.model,searchText:`${e.displayName} ${e.model} ${e.description??``}`.toLowerCase(),label:(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{style:{fontWeight:500},children:[e.displayName,e.isDefault?` · ${Q(`setup.subscriptionModelDefault`)}`:``]}),(0,Z.jsx)(`div`,{style:{opacity:.7,fontSize:12},children:e.model}),e.description&&(0,Z.jsx)(`div`,{style:{opacity:.7,fontSize:12},children:e.description})]})})):[]).filter(e=>e.searchText.includes(c.toLowerCase())),f=t.trim(),p=i?f.length>0&&!i.includes(f):!1,m=!i&&f.length>0&&r?.status===`ready`&&!r.models.some(e=>e.model.trim()===f);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(hS,{"aria-label":e,value:t,options:d,open:o&&d.length>0,defaultActiveFirstOption:!0,getPopupContainer:e=>e.parentElement??document.body,filterOption:!1,onFocus:()=>{l(t),s(!0)},onOpenChange:s,onSearch:e=>{l(e),s(!0)},onChange:a,onSelect:e=>{l(e),s(!1),a(e)},children:(0,Z.jsx)(MA,{"aria-label":e,placeholder:n})}),m&&(0,Z.jsx)(`div`,{role:`status`,style:{color:`#ad6800`,fontSize:12,marginTop:4},children:Q(`setup.subscriptionModelCustomUnverified`)}),p&&(0,Z.jsxs)(`div`,{role:`alert`,style:{color:`#a8071a`,fontSize:12,marginTop:4},children:[Q(`setup.tierModelOutsideUnion`),i?.join(`, `)]})]})}function C4(){let e=o4(e=>e.runtimeSettings),t=o4(e=>e.runtimeTierNames),n=o4(e=>e.runtimeTierNamesError),r=o4(e=>e.updateRuntimeSettings),i=o4(e=>e.selectSubscriptionProvider),a=o4(e=>e.loadSubscriptionModelCatalog),o=o4(e=>e.subscriptionModelCatalogs),s=o4(e=>e.subscriptionModelCatalogLoading),c=o4(e=>e.subscriptionModelCatalogErrors),l=o4(e=>e.saveRuntimeSettings),u=o4(e=>e.subscriptionLoginStatus),d=o4(e=>e.runtimeSettingsSaving),f=o4(e=>e.runtimeSettingsError),p=e.subscriptionProvider??`claude`,m=o[p],h=s[p]??!1,g=c[p],_=t=>e.tierModels.find(e=>e.tier===t)??{tier:t},v=(t,n)=>{let i=_(t),a=e.tierModels.some(e=>e.tier===t)?e.tierModels.map(e=>e.tier===t?{...e,...n}:e):[...e.tierModels,{...i,...n}];r({tierModels:a})},y=t.length>0&&t.every(e=>{let t=_(e).model?.trim();return!!t&&!x4(t)}),b=u[p],x=d||!y||!b||!e.subscriptionDriverModel?.trim();return(0,Z.jsx)(j1,{title:Q(`setup.runtimeTitle`),note:Q(`setup.runtimeDescription`),children:(0,Z.jsxs)(eA,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{style:{marginBottom:8,fontWeight:500},children:Q(`setup.authModeLabel`)}),(0,Z.jsx)(uk,{"aria-label":Q(`setup.authModeAriaLabel`),value:`subscription`,options:y4,onChange:()=>{}})]}),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{style:{marginBottom:8,fontWeight:500},children:`Interactive CLI target`}),(0,Z.jsx)(uk,{"aria-label":`Interactive CLI target`,value:p,options:b4,onChange:e=>i(e)}),(0,Z.jsx)(al,{style:{marginTop:8},type:b?`warning`:`error`,showIcon:!0,message:Q(b?p===`codex`?`setup.authCodexSubscriptionWarning`:`setup.authSubscriptionWarning`:`setup.authSubscriptionLoggedOut`)})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(eA,{align:`center`,style:{marginBottom:4},children:[(0,Z.jsx)(`span`,{style:{fontWeight:500},children:Q(`setup.subscriptionModelsLabel`)}),(0,Z.jsx)(ST,{size:`small`,loading:h,onClick:()=>a(p,!0),children:Q(`setup.subscriptionModelsRefresh`)})]}),g&&(0,Z.jsx)(al,{style:{marginBottom:8},type:`warning`,showIcon:!0,message:Q(`setup.subscriptionModelsUnavailable`),description:`${g}. ${Q(`setup.subscriptionModelsFreeTextHint`)}`}),!g&&(0,Z.jsx)(`div`,{style:{opacity:.65,fontSize:12,marginBottom:8},children:Q(`setup.subscriptionModelsSignedInHint`)}),(0,Z.jsx)(`div`,{style:{marginBottom:4,fontWeight:500},children:Q(`setup.subscriptionDriverModelLabel`)}),(0,Z.jsx)(S4,{label:Q(`setup.subscriptionDriverModelLabel`),value:e.subscriptionDriverModel??``,placeholder:Q(`setup.subscriptionModelPlaceholder`),catalog:m,onChange:e=>r({subscriptionDriverModel:e})}),(0,Z.jsx)(`div`,{style:{opacity:.65,fontSize:12,marginTop:4},children:Q(`setup.subscriptionDriverModelHint`)})]})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{style:{marginBottom:8,fontWeight:500},children:Q(`setup.compiledTiersLabel`)}),n&&(0,Z.jsx)(al,{style:{marginBottom:8},type:`error`,showIcon:!0,message:Q(`setup.tierDiscoveryErrorTitle`),description:n}),(0,Z.jsx)(eA,{direction:`vertical`,size:12,style:{width:`100%`},children:t.map(e=>{let t=_(e),n=`${Q(`setup.tierModelAriaPrefix`)} ${e} tier`;return(0,Z.jsxs)(`div`,{style:{border:`1px solid #f0f0f0`,borderRadius:6,padding:12},children:[(0,Z.jsx)(`div`,{style:{fontWeight:500,marginBottom:8},children:e}),(0,Z.jsx)(S4,{label:n,value:t.model??``,placeholder:Q(`setup.tierModelPlaceholder`),catalog:m,allowedModels:p===`claude`?v4:void 0,onChange:t=>v(e,{model:t})})]},e)})})]}),f&&(0,Z.jsx)(al,{type:`error`,showIcon:!0,message:Q(`setup.runtimeSaveErrorTitle`),description:f}),(0,Z.jsx)(ST,{type:`primary`,disabled:x,onClick:l,children:Q(d?`setup.savingRuntime`:`setup.saveRuntime`)})]})})}function w4({decision:e,resolving:t,onChoose:n}){return(0,Z.jsx)(j1,{title:Q(`setup.decisionTitle`),children:(0,Z.jsxs)(eA,{direction:`vertical`,size:16,style:{width:`100%`},children:[e.detail&&(0,Z.jsx)(mR.Text,{children:e.detail}),(0,Z.jsx)(eA,{wrap:!0,children:e.options.map((e,r)=>(0,Z.jsx)(ST,{type:r===0?`primary`:`default`,disabled:t,loading:t,onClick:()=>n(e.id),children:e.label},e.id))})]})})}function T4({failure:e,step:t,retrying:n,onRetry:r}){let i=Q(t===`connect`?`setup.connectFailureTitle`:`setup.contextFailureTitle`),a=Q(t===`connect`?`setup.connectFailureDescription`:`setup.contextFailureDescription`);return(0,Z.jsx)(al,{type:`error`,showIcon:!0,message:i,description:(0,Z.jsxs)(eA,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsx)(mR.Text,{children:a}),(0,Z.jsxs)(mR.Text,{type:`secondary`,children:[Q(`setup.failureProjectSource`),e.projectName,` · `,e.sourceType]}),(0,Z.jsx)(ST,{type:`primary`,onClick:r,loading:n,disabled:n,children:Q(`setup.continueAndRepair`)}),(0,Z.jsx)(Zm,{size:`small`,items:[{key:`technical-details`,label:Q(`setup.failureTechnicalDetails`),children:(0,Z.jsxs)(eA,{direction:`vertical`,size:8,style:{width:`100%`},children:[(0,Z.jsx)(mR.Paragraph,{style:{margin:0,whiteSpace:`pre-wrap`},children:e.error}),(0,Z.jsx)(g4,{steps:e.workLog})]})}]})]})})}function E4({field:e,value:t,onChange:n}){let[r,i]=(0,v.useState)(void 0),[a,o]=(0,v.useState)(void 0),s=e=>{let t=new FileReader;t.onerror=()=>o(Q(`setup.connectCredentialFileError`)),t.onload=()=>{let r=t.result;if(typeof r!=`string`){o(Q(`setup.connectCredentialFileError`));return}let a=r.indexOf(`,`);o(void 0),i(e.name),n(a>=0?r.slice(a+1):r)},t.readAsDataURL(e)};return(0,Z.jsxs)(eA,{direction:`vertical`,size:6,style:{width:`100%`},children:[(0,Z.jsx)(`input`,{type:`file`,accept:`application/json,.json`,"aria-label":`${e.label??e.key} file`,onChange:e=>{let t=e.target.files?.[0];t&&s(t)}}),r&&!a&&(0,Z.jsxs)(mR.Text,{type:`secondary`,style:{fontSize:12},children:[Q(`setup.connectCredentialFileEncoded`),r]}),a&&(0,Z.jsx)(al,{type:`error`,showIcon:!0,message:a}),(0,Z.jsx)(MA.Password,{placeholder:Q(`setup.connectCredentialPastePlaceholder`),value:t,onChange:e=>{i(void 0),n(e.target.value)}})]})}var D4=`postgres`;function O4(){let e=o4(e=>e.connectedSourceKey),t=o4(e=>e.connectDataSource),n=o4(e=>e.resumeConnect),r=o4(e=>e.fetchConnectEnvFields),i=o4(e=>e.submitConnectEnv),a=o4(e=>e.resolveConnectDecision),o=o4(e=>e.retryConnectFailure),s=o4(e=>e.connectStream),c=o4(e=>e.sourceCatalog),l=o4(e=>e.sourceCatalogDegradedReason),u=o4(e=>e.sourceCatalogLoading),d=o4(e=>e.fetchSourceCatalog),[f,p]=(0,v.useState)(e??D4),[m,h]=(0,v.useState)(void 0),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)({}),x=(c.length>0?c:G2.map(e=>({key:e.key,label:e.label}))).map(e=>({label:e.label,value:e.key})),S=(c.find(e=>e.key===f)?.variants??[]).flatMap(e=>e.discriminator?[e.discriminator.value]:[]);(0,v.useEffect)(()=>{h(S.length>1?S[0]:void 0)},[f,c]);let{streaming:C,workLog:w,error:T,needsInput:E,decision:D,envFields:O,envFieldsError:k,envFieldsLoading:A,submittingEnv:j,failure:M}=s;(0,v.useEffect)(()=>{d()},[d]),(0,v.useEffect)(()=>{M&&(_(M.projectName),p(M.sourceType))},[M]),(0,v.useEffect)(()=>{E&&(b({}),r())},[E,r]);let N=C||E||!!D,P=g.trim().length>0&&!N,F=e=>{e===`rename`&&_(``),a(e)},I=Q(e?`setup.connectedNote`:C?`setup.connectingNote`:`setup.connectDescription`);return(0,Z.jsx)(j1,{title:Q(`setup.connectTitle`),note:I,children:(0,Z.jsxs)(eA,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(`label`,{style:{display:`block`},children:[(0,Z.jsx)(mR.Text,{strong:!0,style:{display:`block`,marginBottom:6},children:Q(`setup.connectSourceLabel`)}),(0,Z.jsx)(cS,{"aria-label":Q(`setup.connectSourceAriaLabel`),showSearch:!0,value:f,options:x,loading:u,disabled:N,placeholder:Q(`setup.connectSourcePlaceholder`),style:{width:`100%`,maxWidth:420},optionFilterProp:`label`,getPopupContainer:e=>e.parentElement??document.body,onChange:e=>p(e)}),S.length>1&&(0,Z.jsxs)(`div`,{style:{marginTop:12},children:[(0,Z.jsx)(mR.Text,{strong:!0,style:{display:`block`,marginBottom:6},children:Q(`setup.connectVariantLabel`)}),(0,Z.jsx)(cS,{"aria-label":Q(`setup.connectVariantLabel`),value:m,options:S.map(e=>({label:e,value:e})),disabled:N,style:{width:`100%`,maxWidth:420},getPopupContainer:e=>e.parentElement??document.body,onChange:e=>h(e)}),(0,Z.jsx)(mR.Text,{type:`secondary`,style:{display:`block`,fontSize:12,marginTop:4},children:Q(`setup.connectVariantHint`)})]}),l&&(0,Z.jsx)(`div`,{role:`status`,style:{color:`#ad6800`,fontSize:12,marginTop:4},children:l})]}),(0,Z.jsxs)(`label`,{style:{display:`block`},children:[(0,Z.jsx)(mR.Text,{strong:!0,style:{display:`block`,marginBottom:6},children:Q(`setup.connectProjectNameLabel`)}),(0,Z.jsx)(MA,{placeholder:Q(`setup.connectProjectNamePlaceholder`),value:g,disabled:N,onChange:e=>_(e.target.value)})]}),(0,Z.jsx)(ST,{type:`primary`,disabled:!P,loading:C,onClick:()=>t(g.trim(),f,m),children:Q(`setup.connectCreateAction`)}),!M&&(0,Z.jsx)(g4,{steps:w}),D&&(0,Z.jsx)(w4,{decision:D,resolving:C,onChoose:F}),!D&&E&&(0,Z.jsx)(j1,{title:Q(`setup.connectNeedsInputTitle`),note:Q(`setup.connectNeedsInputMessage`),children:(0,Z.jsxs)(eA,{direction:`vertical`,size:16,style:{width:`100%`},children:[k&&(0,Z.jsx)(al,{type:`warning`,showIcon:!0,message:k}),A?(0,Z.jsx)(Bj,{}):O&&O.length>0?(0,Z.jsxs)(Z.Fragment,{children:[O.map(e=>(0,Z.jsxs)(`label`,{style:{display:`block`},children:[(0,Z.jsxs)(mR.Text,{strong:!0,style:{display:`block`},children:[e.label??e.key,e.required===!1&&(0,Z.jsx)(mR.Text,{type:`secondary`,style:{fontWeight:400},children:Q(`setup.connectFieldOptional`)})]}),(0,Z.jsx)(mR.Text,{type:`secondary`,style:{display:`block`,fontSize:12},children:e.key}),e.description&&(0,Z.jsx)(mR.Text,{type:`secondary`,style:{display:`block`,fontSize:12,marginTop:2},children:e.description}),(0,Z.jsx)(`div`,{style:{marginTop:6},children:e.fixedValue===void 0?e.fileEncoded?(0,Z.jsx)(E4,{field:e,value:y[e.key]??``,onChange:t=>b(n=>({...n,[e.key]:t}))}):e.secret?(0,Z.jsx)(MA.Password,{placeholder:e.example,value:y[e.key]??``,onChange:t=>b(n=>({...n,[e.key]:t.target.value}))}):(0,Z.jsx)(MA,{placeholder:e.example??e.defaultValue,value:y[e.key]??``,onChange:t=>b(n=>({...n,[e.key]:t.target.value}))}):(0,Z.jsx)(MA,{value:e.fixedValue,disabled:!0,"aria-label":e.label??e.key})})]},e.key)),(0,Z.jsx)(ST,{type:`primary`,loading:j||C,onClick:()=>i({...Object.fromEntries((O??[]).flatMap(e=>e.fixedValue===void 0?[]:[[e.key,e.fixedValue]])),...y}),children:Q(`setup.connectEnvSubmitAction`)})]}):(0,Z.jsx)(ST,{size:`small`,onClick:()=>n(),loading:C,children:Q(`setup.connectResumeAction`)})]})}),M&&(0,Z.jsx)(T4,{failure:M,step:`connect`,retrying:C,onRetry:o}),!M&&T&&(0,Z.jsx)(al,{type:`error`,showIcon:!0,message:Q(`setup.connectErrorTitle`),description:T})]})})}function k4(){let e=o4(e=>e.adoptStream),t=o4(e=>e.adoptProject),n=o4(e=>e.resolveAdoptDecision),[r,i]=(0,v.useState)(``),{verifying:a,error:o,decision:s,resolving:c}=e,l=a||!!s,u=r.trim().length>0&&!l,d=s?.kind===`select_profile`,f=Q(a?`setup.adoptVerifyingNote`:`setup.adoptDescription`);return(0,Z.jsx)(j1,{title:Q(`setup.adoptTitle`),note:f,children:(0,Z.jsxs)(eA,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(`label`,{style:{display:`block`},children:[(0,Z.jsx)(mR.Text,{strong:!0,style:{display:`block`,marginBottom:6},children:Q(`setup.adoptPathLabel`)}),(0,Z.jsx)(MA,{placeholder:Q(`setup.adoptPathPlaceholder`),value:r,disabled:l,onChange:e=>i(e.target.value)})]}),(0,Z.jsx)(ST,{type:`primary`,disabled:!u,loading:a,onClick:()=>t(r.trim()),children:Q(`setup.adoptAction`)}),o&&(0,Z.jsx)(al,{type:`error`,showIcon:!0,message:Q(`setup.adoptErrorTitle`),description:o}),s&&(0,Z.jsx)(w4,{decision:s,resolving:d?a:c,onChoose:d?e=>t(r.trim(),e):n})]})})}function A4(){let e=o4(e=>e.buildContext),t=o4(e=>e.resolveContextDecision),n=o4(e=>e.retryContextFailure),r=o4(e=>e.contextStream),i=o4(e=>e.contextSummary),{streaming:a,workLog:o,error:s,failure:c,needsInput:l,decision:u,terminal:d}=r,f=d?.status===`ok`?Q(`setup.contextBuiltNote`):Q(a?`setup.contextBuildingNote`:`setup.contextDescription`);return(0,Z.jsx)(j1,{title:Q(`setup.contextTitle`),note:f,children:(0,Z.jsxs)(eA,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(M1,{label:Q(`setup.contextModels`),value:i.models}),(0,Z.jsx)(M1,{label:Q(`setup.contextRelationships`),value:i.relationships})]}),(0,Z.jsx)(ST,{type:`primary`,disabled:a||!!u,loading:a,onClick:e,children:Q(`setup.contextAction`)}),a&&o.length>0&&(0,Z.jsx)(g4,{steps:o}),u&&(0,Z.jsx)(w4,{decision:u,resolving:a,onChoose:t}),!u&&l&&(0,Z.jsx)(al,{type:`warning`,showIcon:!0,message:Q(`setup.contextNeedsInputTitle`),description:d?.message??Q(`setup.contextNeedsInputMessage`)}),c&&(0,Z.jsx)(T4,{failure:c,step:`context`,retrying:a,onRetry:n}),!c&&s&&(0,Z.jsx)(al,{type:`error`,showIcon:!0,message:Q(`setup.contextErrorTitle`)})]})})}function j4(){let e=o4(e=>e.verifyGate),t=o4(e=>e.compileAndBind);return(0,Z.jsx)(j1,{title:Q(`setup.bindTitle`),note:Q(e?`setup.bindDoneNote`:`setup.bindDescription`),children:(0,Z.jsxs)(eA,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(M1,{label:Q(`setup.bindVerifyGateLabel`),value:(0,Z.jsx)(iL,{color:e?AR.verified:AR.refused,icon:e?(0,Z.jsx)(bH,{}):(0,Z.jsx)(CH,{}),bordered:!0,children:Q(e?`setup.bindVerifyGateOn`:`setup.bindVerifyGateOff`)})}),(0,Z.jsx)(ST,{type:`primary`,onClick:t,disabled:e,children:Q(`setup.bindAction`)})]})})}function M4(){let e=yB(),t=E1(e=>e.startStructuredSession),[n,r]=(0,v.useState)(!1),[i,a]=(0,v.useState)(),o=async()=>{r(!0),a(void 0);try{e(D1(await t()))}catch(e){a(e instanceof Error?e.message:`A Structured Ask session could not be created.`)}finally{r(!1)}};return(0,Z.jsx)(j1,{title:Q(`setup.askTitle`),note:Q(`setup.askDescription`),children:(0,Z.jsxs)(eA,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(ST,{type:`primary`,icon:(0,Z.jsx)(aH,{}),loading:n,onClick:()=>void o(),children:Q(`setup.askCta`)}),i?(0,Z.jsx)(mR.Text,{type:`danger`,role:`alert`,children:i}):null]})})}function N4(){switch(o4(e=>e.selectedStepKey)){case`runtime`:return(0,Z.jsx)(C4,{});case`connect`:return(0,Z.jsx)(O4,{});case`adopt`:return(0,Z.jsx)(k4,{});case`context`:return(0,Z.jsx)(A4,{});case`bind`:return(0,Z.jsx)(j4,{});case`ask`:return(0,Z.jsx)(M4,{});default:return(0,Z.jsx)(R1,{status:`empty`,title:Q(`setup.emptyTitle`),description:Q(`setup.emptyDescription`)})}}function P4(){let e=o4(e=>e.setupModeLoading),t=o4(e=>e.setupModeChoosing),n=o4(e=>e.setupModeError),r=o4(e=>e.chooseSetupMode);return e?(0,Z.jsx)(j1,{title:Q(`setup.modeChoiceTitle`),children:(0,Z.jsx)(Bj,{})}):(0,Z.jsx)(j1,{title:Q(`setup.modeChoiceTitle`),note:Q(`setup.modeChoiceDescription`),children:(0,Z.jsxs)(eA,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(PD,{size:`small`,children:(0,Z.jsxs)(eA,{direction:`vertical`,size:8,style:{width:`100%`},children:[(0,Z.jsx)(mR.Text,{strong:!0,children:Q(`setup.modeCreateTitle`)}),(0,Z.jsx)(mR.Text,{type:`secondary`,children:Q(`setup.modeCreateDescription`)}),(0,Z.jsx)(ST,{type:`primary`,disabled:t,loading:t,onClick:()=>r(`create`),children:Q(`setup.modeCreateAction`)})]})}),(0,Z.jsx)(PD,{size:`small`,children:(0,Z.jsxs)(eA,{direction:`vertical`,size:8,style:{width:`100%`},children:[(0,Z.jsx)(mR.Text,{strong:!0,children:Q(`setup.modeAdoptTitle`)}),(0,Z.jsx)(mR.Text,{type:`secondary`,children:Q(`setup.modeAdoptDescription`)}),(0,Z.jsx)(ST,{disabled:t,loading:t,onClick:()=>r(`adopt`),children:Q(`setup.modeAdoptAction`)})]})}),n&&(0,Z.jsx)(al,{type:`error`,showIcon:!0,message:n})]})})}function F4(){let e=o4(e=>e.messages),t=o4(e=>e.hydrate),n=o4(e=>e.refreshCanonical),r=o4(e=>e.setupMode),i=gB();(0,v.useEffect)(()=>{i.state?.nativeSessionReturn===`setup`?n():t()},[t,i.state,n]);let a=aW()&&!r;return(0,Z.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`},children:(0,Z.jsx)(`div`,{style:{flex:1,overflow:`auto`},children:(0,Z.jsx)(B1,{maxWidth:720,title:Q(`nav.setup`),lead:Q(`setup.pageLead`),children:a?(0,Z.jsx)(P4,{}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_4,{messages:e}),(0,Z.jsx)(N4,{})]})})})})}var I4={done:{color:AR.verified,icon:(0,Z.jsx)(bH,{}),label:Q(`setup.stepDone`)},current:{color:AR.estimate,icon:(0,Z.jsx)(VU,{}),label:Q(`setup.stepCurrent`)},todo:{icon:(0,Z.jsx)(Gk,{}),label:Q(`setup.stepTodo`)}};function L4({state:e}){let t=I4[e];return(0,Z.jsx)(iL,{color:t.color,icon:t.icon,bordered:!0,children:t.label})}function R4(e){return e.key===`context`?Q(`setup.contextTitle`):e.title}function z4(){let e=o4(e=>e.steps),t=o4(e=>e.selectedStepKey),n=o4(e=>e.selectStep),r=o4(e=>e.resetSetup),i=o4(e=>e.setupMode),a=e.find(e=>e.key===`runtime`)?.state===`done`;return aW()&&!i?null:(0,Z.jsxs)(`nav`,{"aria-label":Q(`setup.stepsHeader`),style:{padding:12},children:[(0,Z.jsx)(`div`,{style:{fontSize:12,fontWeight:600,color:`var(--ant-color-text-tertiary)`,textTransform:`uppercase`,letterSpacing:.4,padding:`4px 8px`},children:Q(`setup.stepsHeader`)}),(0,Z.jsx)(`ul`,{style:{listStyle:`none`,margin:0,padding:0},children:e.map((e,r)=>{let i=e.key===t;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,"aria-current":i?`true`:void 0,disabled:e.key!==`runtime`&&!a,onClick:()=>n(e.key),style:{display:`flex`,flexDirection:`column`,gap:4,alignItems:`flex-start`,width:`100%`,textAlign:`left`,padding:`8px 8px`,marginBottom:2,border:`none`,borderRadius:8,cursor:e.key!==`runtime`&&!a?`not-allowed`:`pointer`,background:i?`var(--ant-color-fill-secondary)`:`transparent`,color:`var(--ant-color-text)`},children:[(0,Z.jsxs)(`span`,{style:{fontSize:13,fontWeight:i?600:400},children:[r+1,`. `,R4(e)]}),(e.key!==`ask`||e.state!==`current`)&&(0,Z.jsx)(L4,{state:e.state})]})},e.key)})}),(0,Z.jsx)(`div`,{style:{padding:`8px`},children:(0,Z.jsx)(Jj,{title:Q(`setup.resetConfirmTitle`),description:(0,Z.jsx)(`div`,{style:{maxWidth:260},children:Q(`setup.resetConfirmDescription`)}),okText:Q(`setup.resetConfirmOk`),cancelText:Q(`setup.resetConfirmCancel`),okButtonProps:{danger:!0},onConfirm:()=>r(),children:(0,Z.jsx)(ST,{type:`text`,danger:!0,size:`small`,icon:(0,Z.jsx)(Zj,{}),children:Q(`setup.resetAction`)})})})]})}var B4=.9,V4=[{id:`run-131`,when:`2026-07-17 09:14`,score:.93,gateThreshold:B4,gatePass:!0,regressions:0,cost:`$0.84`,p50:`1.2s`},{id:`run-130`,when:`2026-07-16 09:02`,score:.91,gateThreshold:B4,gatePass:!0,regressions:1,cost:`$0.81`,p50:`1.3s`},{id:`run-129`,when:`2026-07-15 09:10`,score:.88,gateThreshold:B4,gatePass:!1,regressions:3,cost:`$0.79`,p50:`1.5s`},{id:`run-128`,when:`2026-07-14 09:05`,score:.9,gateThreshold:B4,gatePass:!0,regressions:0,cost:`$0.77`,p50:`1.4s`},{id:`run-127`,when:`2026-07-13 09:00`,score:.89,gateThreshold:B4,gatePass:!0,regressions:0,cost:`$0.75`,p50:`1.4s`}],H4={"run-131":[{component:`Schema retrieval`,score:.97,delta:.01},{component:`SQL generation`,score:.94,delta:.03},{component:`Verification`,score:.95,delta:0},{component:`Narrative`,score:.88,delta:.02}],"run-130":[{component:`Schema retrieval`,score:.96,delta:0},{component:`SQL generation`,score:.91,delta:-.02},{component:`Verification`,score:.95,delta:.01},{component:`Narrative`,score:.86,delta:.01}],"run-129":[{component:`Schema retrieval`,score:.96,delta:-.01},{component:`SQL generation`,score:.93,delta:-.04},{component:`Verification`,score:.94,delta:-.03},{component:`Narrative`,score:.85,delta:-.02}],"run-128":[{component:`Schema retrieval`,score:.97,delta:.01},{component:`SQL generation`,score:.97,delta:.02},{component:`Verification`,score:.97,delta:.01},{component:`Narrative`,score:.87,delta:0}],"run-127":[{component:`Schema retrieval`,score:.96,delta:0},{component:`SQL generation`,score:.95,delta:0},{component:`Verification`,score:.96,delta:0},{component:`Narrative`,score:.87,delta:0}]},U4=bR()((e,t)=>({selectedRunId:V4[0].id,runs:V4,componentScoresByRunId:H4,loadingRuns:!1,error:void 0,selectRun:n=>{e({selectedRunId:n}),!(!aW()||t().componentScoresByRunId[n])&&OW(n).then(({componentScores:t})=>{e(e=>({componentScoresByRunId:{...e.componentScoresByRunId,[n]:t}}))}).catch(()=>{})},loadRuns:()=>{aW()&&(e({loadingRuns:!0,error:void 0}),DW().then(n=>{e(e=>({runs:n,loadingRuns:!1,error:void 0,selectedRunId:n.some(t=>t.id===e.selectedRunId)?e.selectedRunId:n[0]?.id??e.selectedRunId}));let r=t().selectedRunId;r&&!t().componentScoresByRunId[r]&&t().selectRun(r)}).catch(t=>{e({loadingRuns:!1,error:t instanceof Error?t.message:Q(`eval.loadFailedMessage`)})}))}}));function W4({pass:e}){return(0,Z.jsx)(iL,{color:e?AR.verified:AR.refused,icon:e?(0,Z.jsx)(bH,{}):(0,Z.jsx)(CH,{}),bordered:!0,children:Q(e?`eval.gatePass`:`eval.gateFail`)})}function G4({run:e}){return(0,Z.jsx)(j1,{title:`${e.id} · ${e.when}`,extra:(0,Z.jsx)(W4,{pass:e.gatePass}),children:(0,Z.jsxs)(mM,{gutter:[16,16],children:[(0,Z.jsx)(XO,{xs:12,md:8,lg:4,children:(0,Z.jsx)(EM,{title:Q(`eval.scoreLabel`),value:e.score,precision:2})}),(0,Z.jsx)(XO,{xs:12,md:8,lg:4,children:(0,Z.jsx)(EM,{title:Q(`eval.gateThresholdLabel`),value:e.gateThreshold,precision:2})}),(0,Z.jsx)(XO,{xs:12,md:8,lg:4,children:(0,Z.jsx)(EM,{title:Q(`eval.regressionsLabel`),value:e.regressions})}),(0,Z.jsx)(XO,{xs:12,md:8,lg:4,children:(0,Z.jsx)(EM,{title:Q(`eval.costLabel`),value:e.cost})}),(0,Z.jsx)(XO,{xs:12,md:8,lg:4,children:(0,Z.jsx)(EM,{title:Q(`eval.p50Label`),value:e.p50})})]})})}function K4(e){let t=[...e].reverse();return{tooltip:{trigger:`axis`},grid:{left:8,right:16,top:24,bottom:32,containLabel:!0},xAxis:{type:`category`,data:t.map(e=>e.id)},yAxis:{type:`value`,min:0,max:1},series:[{name:`score`,type:`line`,data:t.map(e=>e.score)}]}}function q4({runs:e}){let t=(0,v.useMemo)(()=>K4(e),[e]);return(0,Z.jsx)(j1,{title:Q(`eval.trendTitle`),children:(0,Z.jsx)(I1,{option:t,height:220,ariaLabel:Q(`eval.trendAriaLabel`)})})}function J4(e){return e>=0?`+${e.toFixed(2)}`:e.toFixed(2)}function Y4({components:e}){return(0,Z.jsx)(j1,{title:Q(`eval.byComponentTitle`),children:(0,Z.jsx)(L1,{rowKey:`component`,dataSource:e,columns:[{title:Q(`eval.componentColumn`),dataIndex:`component`,key:`component`},{title:Q(`eval.scoreColumn`),dataIndex:`score`,key:`score`,render:e=>e.toFixed(2)},{title:Q(`eval.deltaColumn`),dataIndex:`delta`,key:`delta`,render:e=>J4(e)}]})})}function X4(){return(0,Z.jsx)(j1,{title:Q(`eval.outOfScopeTitle`),children:(0,Z.jsxs)(eA,{wrap:!0,children:[(0,Z.jsx)(ZS,{title:Q(`eval.outOfScopeHint`),children:(0,Z.jsx)(ST,{icon:(0,Z.jsx)($U,{}),disabled:!0,children:Q(`eval.outOfScopeQuestionList`)})}),(0,Z.jsx)(ZS,{title:Q(`eval.outOfScopeHint`),children:(0,Z.jsx)(ST,{icon:(0,Z.jsx)(qH,{}),disabled:!0,children:Q(`eval.outOfScopeQuestionDetail`)})}),(0,Z.jsx)(ZS,{title:Q(`eval.outOfScopeHint`),children:(0,Z.jsx)(ST,{icon:(0,Z.jsx)(nU,{}),disabled:!0,children:Q(`eval.outOfScopeScoreHistory`)})})]})})}function Z4(){let e=U4(e=>e.selectedRunId),t=U4(e=>e.runs),n=U4(e=>e.componentScoresByRunId),r=U4(e=>e.loadRuns),i=U4(e=>e.loadingRuns),a=U4(e=>e.error),o=t.find(t=>t.id===e);(0,v.useEffect)(()=>{r()},[r]);let s=aW(),c;return c=s&&i?(0,Z.jsx)(R1,{status:`loading`}):s&&a?(0,Z.jsx)(R1,{status:`error`,title:Q(`eval.loadErrorTitle`),description:a,onRetry:r}):o?(0,Z.jsxs)(eA,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(uk,{value:`global`,options:[{label:Q(`eval.globalTab`),value:`global`},{label:Q(`eval.questionsTab`),value:`questions`,disabled:!0}]}),(0,Z.jsx)(G4,{run:o}),(0,Z.jsx)(q4,{runs:t}),(0,Z.jsx)(Y4,{components:n[o.id]??[]}),(0,Z.jsx)(X4,{})]}):(0,Z.jsx)(R1,{status:`empty`,title:Q(`eval.emptyTitle`),description:Q(`eval.emptyDescription`)}),(0,Z.jsx)(B1,{maxWidth:1e3,title:Q(`nav.eval`),lead:Q(`eval.pageLead`),children:c})}function Q4(){let e=U4(e=>e.selectedRunId),t=U4(e=>e.selectRun),n=U4(e=>e.runs).map(e=>({key:e.id,label:e.id,meta:`${e.score.toFixed(2)} · ${e.gatePass?Q(`eval.gatePass`):Q(`eval.gateFail`)}`}));return(0,Z.jsx)(V2,{header:Q(`eval.runsHeader`),items:n,selectedKey:e,onSelect:t})}var $4=[{key:`setup`,path:`/setup`,label:Q(`nav.setup`),icon:(0,Z.jsx)(MU,{}),Page:F4,Sidebar:z4},{key:`sessions`,path:`/sessions`,label:Q(`nav.sessions`),icon:(0,Z.jsx)(MH,{}),Page:c1,Sidebar:A1},{key:`artifacts`,path:`/artifacts`,label:Q(`nav.artifacts`),icon:(0,Z.jsx)($V,{}),Page:_0,Sidebar:x0},{key:`context`,path:`/context`,label:Q(`nav.context`),icon:(0,Z.jsx)(FH,{}),Page:c2,Sidebar:f2},{key:`harness`,path:`/harness`,label:Q(`nav.harness`),icon:(0,Z.jsx)(RH,{}),Page:B2,Sidebar:H2},{key:`eval`,path:`/eval`,label:Q(`nav.eval`),icon:(0,Z.jsx)(WH,{}),Page:Z4,Sidebar:Q4}].filter(e=>e.key!==`eval`||!1),e3=[],t3=`/sessions`;function n3(){let e=TR(e=>e.themeMode),t=TR(e=>e.toggleThemeMode),n=TR(e=>e.sidebarCollapsed),r=TR(e=>e.toggleSidebar),i=e===`dark`;return(0,Z.jsxs)(VA.Header,{style:{display:`flex`,alignItems:`center`,gap:16,paddingInline:16,borderBottom:`1px solid var(--ant-color-border-secondary)`,background:`var(--ant-color-bg-container)`},children:[(0,Z.jsx)(ZS,{placement:`bottom`,title:Q(n?`shell.expandSidebar`:`shell.collapseSidebar`),children:(0,Z.jsx)(ST,{type:`text`,"aria-label":Q(n?`shell.expandSidebar`:`shell.collapseSidebar`),icon:n?(0,Z.jsx)(cU,{}):(0,Z.jsx)(aU,{}),onClick:r})}),(0,Z.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},children:(0,Z.jsx)(`img`,{src:i?`/wrenai_logo_white.png`:`/wrenai_logo.png`,alt:Q(`shell.appName`),height:24})}),(0,Z.jsx)(`nav`,{"aria-label":`Primary`,style:{flex:1},children:(0,Z.jsx)(eA,{size:4,children:$4.map(e=>(0,Z.jsxs)(FV,{to:e.path,style:({isActive:e})=>({display:`inline-flex`,alignItems:`center`,gap:6,padding:`6px 12px`,borderRadius:6,fontSize:14,textDecoration:`none`,color:e?`var(--ant-color-primary)`:`var(--ant-color-text)`,background:e?`var(--ant-color-primary-bg)`:`transparent`}),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,style:{display:`inline-flex`},children:e.icon}),e.label]},e.key))})}),(0,Z.jsx)(ZS,{title:Q(i?`shell.themeToLight`:`shell.themeToDark`),children:(0,Z.jsx)(ST,{type:`text`,"aria-label":Q(i?`shell.themeToLight`:`shell.themeToDark`),icon:i?(0,Z.jsx)(mH,{}):(0,Z.jsx)(_H,{}),onClick:t})})]})}function r3(){let{pathname:e}=gB();return[...$4,...e3].sort((e,t)=>t.path.length-e.path.length).find(t=>e===t.path||e.startsWith(`${t.path}/`))}function i3(){let e=TR(e=>e.sidebarCollapsed),t=r3()?.Sidebar;return(0,Z.jsx)(VA.Sider,{"data-testid":`contextual-sidebar`,collapsible:!0,collapsed:e,collapsedWidth:0,trigger:null,width:248,theme:`light`,style:{background:`var(--ant-color-bg-container)`,borderRight:`1px solid var(--ant-color-border-secondary)`,overflow:`auto`},children:t?(0,Z.jsx)(t,{}):null})}function a3(){let e=r3()?.key===`sessions`;return(0,Z.jsxs)(VA,{style:{height:`100vh`},children:[(0,Z.jsx)(n3,{}),(0,Z.jsxs)(VA,{children:[(0,Z.jsx)(i3,{}),(0,Z.jsx)(VA.Content,{"data-testid":`app-content`,style:{overflow:e?`hidden`:`auto`,minHeight:0,background:e?`var(--ant-color-bg-container)`:`var(--ant-color-bg-layout)`},children:(0,Z.jsx)(KB,{})})]})]})}function o3({onSend:e,disabled:t}){let[n,r]=(0,v.useState)(``),i=()=>{let t=n.trim();t&&(e(t),r(``))};return(0,Z.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,Z.jsx)(MA,{"aria-label":Q(`ask.composerLabel`),placeholder:Q(`ask.composerPlaceholder`),value:n,onChange:e=>r(e.target.value),onPressEnter:i,disabled:t}),(0,Z.jsx)(ST,{type:`primary`,icon:(0,Z.jsx)(kU,{}),onClick:i,disabled:t||!n.trim(),children:Q(`ask.send`)})]})}function s3({event:e,saved:t,onSave:n,published:r,onPublish:i}){return(0,Z.jsx)(j1,{title:(0,Z.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:6},children:[(0,Z.jsx)($V,{"aria-hidden":`true`}),e.name]}),extra:(0,Z.jsxs)(`div`,{style:{display:`inline-flex`,gap:8},children:[(0,Z.jsx)(ST,{size:`small`,type:t?`default`:`primary`,icon:(0,Z.jsx)(EU,{}),disabled:t,onClick:n,children:Q(t?`ask.saved`:`ask.save`)}),void 0]}),children:(0,Z.jsx)(mR.Text,{type:`secondary`,children:e.location})})}function c3({event:e,onSelect:t,disabled:n}){return(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(mR.Paragraph,{style:{marginBottom:8},children:e.prompt}),(0,Z.jsx)(eA,{wrap:!0,children:e.chips.map((e,r)=>(0,Z.jsx)(ST,{size:`small`,disabled:n,onClick:()=>t(e),children:e},`${e}-${r}`))})]})}function l3({event:e}){return(0,Z.jsxs)(j1,{title:(0,Z.jsx)(P1,{state:`refused`}),children:[(0,Z.jsx)(mR.Paragraph,{style:{marginBottom:8},children:e.reason}),(0,Z.jsxs)(mR.Text,{type:`secondary`,children:[Q(`ask.refusalFixLabel`),`: `,e.fix]})]})}function u3({answer:e}){return(0,Z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:[e.dataAnswer&&(0,Z.jsx)(P1,{state:F1(e.verified)}),(0,Z.jsx)(mR.Paragraph,{style:{marginBottom:0},children:e.text})]})}function d3({event:e}){return(0,Z.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`},children:(0,Z.jsx)(`div`,{style:{maxWidth:`80%`,background:`var(--ant-color-primary-bg)`,borderRadius:12,padding:`8px 12px`},children:(0,Z.jsx)(mR.Text,{children:e.text})})})}function f3({events:e,onChipSelect:t,onSave:n,onPublish:r}){return(0,Z.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16},children:e.map((i,a)=>{switch(i.kind){case`user`:return(0,Z.jsx)(d3,{event:i},i.id);case`clarify`:{let n=a===e.length-1;return(0,Z.jsx)(s4,{children:(0,Z.jsx)(c3,{event:i,onSelect:t,disabled:!n})},i.id)}case`answer`:return(0,Z.jsx)(s4,{children:(0,Z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:[i.trace&&i.trace.length>0&&(0,Z.jsx)(g4,{steps:i.trace,title:Q(`ask.executionTrace`)}),i.answer.form===`rich`?(0,Z.jsx)(u0,{envelope:i.answer.envelope}):(0,Z.jsx)(u3,{answer:i.answer})]})},i.id);case`refusal`:return(0,Z.jsx)(s4,{children:(0,Z.jsx)(l3,{event:i})},i.id);case`artifact`:{let t=b1(e,i.artifactId),a=e.some(e=>e.kind===`published`&&e.artifactName===i.name);return(0,Z.jsx)(s4,{children:(0,Z.jsx)(s3,{event:i,saved:t,onSave:()=>n(i.id),published:a,onPublish:()=>r(i.id)})},i.id)}case`published`:return null;case`saved`:case`unsaved`:return null;default:return null}})})}function p3({sessionId:e}){let t=yB(),n=E1(t=>t.sessionsById[e]),r=E1(t=>t.streaming[e]??!1),i=E1(t=>t.streamError[e]),a=E1(e=>e.sendMessage),o=E1(e=>e.saveArtifact),s=E1(e=>e.publishArtifact),c=E1(e=>e.getOrCreate),l=E1(e=>e.clearDraft),u=E1(t=>e===`draft`?t.backendSessionId[x1]:void 0);(0,v.useEffect)(()=>{c(e)},[e,c]),(0,v.useEffect)(()=>{u&&(t(D1(u),{replace:!0}),l())},[u,t,l]);let d=n?.events??[],f=n?.workLog??[],p=(0,v.useMemo)(()=>[...d].reverse().find(e=>e.kind===`user`)?.text,[d]);return(0,Z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`},children:[(0,Z.jsx)(`div`,{style:{flex:1,overflow:`auto`},children:(0,Z.jsxs)(B1,{maxWidth:840,children:[d.length===0?(0,Z.jsx)(R1,{status:`empty`,title:Q(`ask.emptyTitle`),description:Q(`ask.emptyDescription`)}):(0,Z.jsx)(f3,{events:d,onChipSelect:t=>a(e,t),onSave:t=>o(e,t),onPublish:t=>s(e,t)}),r&&f.length===0&&(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,style:{display:`flex`,alignItems:`center`,gap:8,padding:`10px 12px`,color:`var(--ant-color-text-secondary)`},children:[(0,Z.jsx)(Md,{spin:!0,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:Q(`ask.turnPending`)})]}),r&&f.length>0&&(0,Z.jsx)(g4,{steps:f}),i&&(0,Z.jsx)(al,{type:`error`,showIcon:!0,message:Q(`ask.streamErrorTitle`),description:i,action:p?(0,Z.jsx)(ST,{type:`link`,size:`small`,onClick:()=>a(e,p),children:Q(`state.retry`)}):void 0})]})}),(0,Z.jsx)(`div`,{style:{maxWidth:840,margin:`0 auto`,width:`100%`,padding:`0 26px 16px`,boxSizing:`border-box`},children:(0,Z.jsx)(o3,{onSend:t=>a(e,t),disabled:r})})]})}function m3(){let{sessionId:e}=CB();return(0,Z.jsx)(p3,{sessionId:e??`draft`})}function h3(){let{sessionId:e}=CB();return(0,Z.jsx)(GB,{to:D1(e),replace:!0})}function g3(){return(0,Z.jsx)(YB,{children:(0,Z.jsxs)(qB,{element:(0,Z.jsx)(a3,{}),children:[(0,Z.jsx)(qB,{index:!0,element:(0,Z.jsx)(GB,{to:t3,replace:!0})}),$4.map(({key:e,path:t,Page:n})=>(0,Z.jsx)(qB,{path:t,element:(0,Z.jsx)(n,{})},e)),e3.map(({key:e,path:t,Page:n})=>(0,Z.jsx)(qB,{path:t,element:(0,Z.jsx)(n,{})},e)),(0,Z.jsx)(qB,{path:`/sessions/ask`,element:(0,Z.jsx)(m3,{})}),(0,Z.jsx)(qB,{path:`/sessions/ask/:sessionId`,element:(0,Z.jsx)(m3,{})}),(0,Z.jsx)(qB,{path:`/ask`,element:(0,Z.jsx)(h3,{})}),(0,Z.jsx)(qB,{path:`/ask/:sessionId`,element:(0,Z.jsx)(h3,{})}),(0,Z.jsx)(qB,{path:`/sessions/:id`,element:(0,Z.jsx)(c1,{})}),(0,Z.jsx)(qB,{path:`*`,element:(0,Z.jsx)(GB,{to:t3,replace:!0})})]})})}function _3(){return(0,Z.jsx)(NV,{children:(0,Z.jsx)(g3,{})})}var v3=document.getElementById(`root`);if(!v3)throw Error(`Root element #root not found`);(0,wt.createRoot)(v3).render((0,Z.jsx)(v.StrictMode,{children:(0,Z.jsx)(zR,{children:(0,Z.jsx)(_3,{})})}));export{s as t};
|
|
441
|
-
//# sourceMappingURL=index-
|
|
440
|
+
`}]}]}];function Q0(e,t){for(let n of e)t[n.key]=n,n.children&&Q0(n.children,t)}var $0=(()=>{let e={};return Q0(Z0,e),e})();function e2({additivity:e}){let t=e===`additive`;return(0,Z.jsx)(ZS,{title:Q(`context.inferredMeasureHint`),children:(0,Z.jsx)(iL,{color:t?AR.verified:AR.estimate,icon:t?(0,Z.jsx)(bH,{}):(0,Z.jsx)(CH,{}),bordered:!0,children:Q(t?`context.additive`:`context.nonAdditive`)})})}function t2(){let e=M0(e=>e.showImpact),t=M0(e=>e.liveOverview),n=M0(e=>e.overviewLoading),r=M0(e=>e.overviewError),i=M0(e=>e.loadOverview),a=aW();if(a&&n&&!t)return(0,Z.jsx)(G1,{status:`loading`});if(a&&r&&!t)return(0,Z.jsx)(G1,{status:`error`,title:Q(`context.overviewErrorTitle`),description:r,onRetry:i});let o=a?t?.models??[]:G0,s=a?t?.relationships??[]:K0,c=a?t?.measures??[]:q0,l=a?t?.knowledge??J0:J0,u=a?t?.projectName??`acme-genbi`:U0,d=a?t?.projectPath??``:W0;return o.length===0?(0,Z.jsx)(G1,{status:`empty`,title:Q(`context.emptyTitle`),description:Q(`context.emptyDescription`)}):(0,Z.jsxs)(`div`,{className:`genbi-mdl-wrap`,children:[(0,Z.jsxs)(`div`,{className:`genbi-project-identity`,children:[(0,Z.jsx)(`span`,{className:`genbi-project-name`,children:u}),d?(0,Z.jsxs)(`span`,{className:`genbi-project-path`,children:[Q(`context.projectPathLabel`),`: `,(0,Z.jsx)(`code`,{children:d})]}):(0,Z.jsx)(`span`,{className:`genbi-project-path genbi-project-path-unbound`,children:Q(`context.projectPathNotBound`)})]}),(0,Z.jsxs)(`div`,{className:`genbi-mdl-toolbar`,children:[(0,Z.jsxs)(`span`,{className:`genbi-mdl-stat`,children:[(0,Z.jsx)(`b`,{children:o.length}),` `,Q(`context.modelsStat`)]}),(0,Z.jsx)(`span`,{className:`genbi-mdl-stat-sep`,"aria-hidden":`true`,children:`·`}),(0,Z.jsxs)(`span`,{className:`genbi-mdl-stat`,children:[(0,Z.jsx)(`b`,{children:s.length}),` `,Q(`context.relationshipsStat`)]}),(0,Z.jsx)(`span`,{className:`genbi-mdl-stat-sep`,"aria-hidden":`true`,children:`·`}),(0,Z.jsxs)(`span`,{className:`genbi-mdl-stat`,children:[(0,Z.jsx)(`b`,{children:c.length}),` `,Q(`context.measuresStat`)]})]}),(0,Z.jsx)(H0,{}),(0,Z.jsxs)(`div`,{className:`genbi-mdl-layout`,children:[(0,Z.jsx)(R1,{title:Q(`context.overview`),children:(0,Z.jsx)(B0,{models:o,relationships:s,onSelectModel:e})}),(0,Z.jsxs)(`div`,{className:`genbi-mdl-side`,children:[(0,Z.jsx)(R1,{title:Q(`context.measuresTitle`),children:c.map(t=>(0,Z.jsxs)(`div`,{className:`genbi-measure`,children:[(0,Z.jsxs)(`div`,{className:`genbi-mtxt`,children:[(0,Z.jsx)(`div`,{className:`genbi-mname`,children:t.name}),(0,Z.jsx)(`div`,{className:`genbi-mexpr`,children:t.expression})]}),(0,Z.jsxs)(`div`,{className:`genbi-measure-actions`,children:[(0,Z.jsx)(e2,{additivity:t.additivity}),(0,Z.jsx)(ST,{type:`link`,size:`small`,onClick:()=>e(t.key),children:Q(`context.viewImpact`)})]})]},t.key))}),(0,Z.jsx)(R1,{title:Q(`context.relationshipsTitle`),children:s.map(t=>{let n=o.find(e=>e.key===t.fromModel)?.name??t.fromModel,r=o.find(e=>e.key===t.toModel)?.name??t.toModel;return(0,Z.jsxs)(`div`,{className:`genbi-relrow`,children:[(0,Z.jsxs)(`span`,{className:`genbi-relname`,children:[n,` → `,r,` `,(0,Z.jsx)(iL,{children:t.type})]}),(0,Z.jsx)(ST,{type:`link`,size:`small`,onClick:()=>e(t.key),children:Q(`context.viewImpact`)})]},t.key)})}),(0,Z.jsx)(R1,{title:Q(`context.knowledgeTitle`),children:(0,Z.jsxs)(`div`,{className:`genbi-kstat`,children:[(0,Z.jsxs)(`div`,{className:`genbi-kstat-item`,children:[(0,Z.jsx)(`div`,{className:`genbi-num`,children:l.instructionsPresent?Q(`context.yes`):Q(`context.no`)}),(0,Z.jsx)(`div`,{className:`genbi-lbl`,children:Q(`context.instructionsPresent`)})]}),(0,Z.jsxs)(`div`,{className:`genbi-kstat-item`,children:[a&&l.verifiedPairCount===0?(0,Z.jsx)(ZS,{title:Q(`context.verifiedPairsNotTrackedHint`),children:(0,Z.jsx)(`div`,{className:`genbi-num genbi-num-muted`,children:Q(`context.verifiedPairsNotTracked`)})}):(0,Z.jsx)(`div`,{className:`genbi-num`,children:l.verifiedPairCount}),(0,Z.jsx)(`div`,{className:`genbi-lbl`,children:Q(`context.verifiedPairCount`)})]})]})}),(0,Z.jsx)(R1,{title:Q(`context.outOfScopeTitle`),children:(0,Z.jsxs)(`div`,{className:`genbi-outscope`,children:[(0,Z.jsx)(ZS,{title:Q(`context.outOfScopeHint`),children:(0,Z.jsx)(ST,{icon:(0,Z.jsx)(_L,{}),disabled:!0,size:`small`,block:!0,children:Q(`context.outOfScopeInlineEditing`)})}),(0,Z.jsx)(ZS,{title:Q(`context.outOfScopeHint`),children:(0,Z.jsx)(ST,{icon:(0,Z.jsx)(dU,{}),disabled:!0,size:`small`,block:!0,children:Q(`context.outOfScopeCopilot`)})})]})})]})]})]})}var n2={model:`model`,measure:`measure`,relationship:`relationship`,view:`view`};function r2({filePath:e,projectName:t,downstream:n,verifiedPairCount:r}){let i=[];if(i.push(`Project: ${t}`),i.push(`File: ${e}`),i.push(``),n.length===0)i.push(`Downstream dependents: none known.`);else{i.push(`Downstream dependents:`);for(let e of n)i.push(`- ${e.name} (${n2[e.kind]})`)}return i.push(``),i.push(`Verify gate: this change must re-pass all ${r} verified Question-SQL pairs before it can be deployed.`),i.join(`
|
|
441
|
+
`)}function i2(e,t){let n=t.replace(/^\/+/,``);return e?`${e.replace(/\/+$/,``)}/${n}`:`/${n}`}function a2({filePath:e,projectPath:t,projectName:n,downstream:r,verifiedPairCount:i}){let[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),l=i2(t,e),u=r2({filePath:l,projectName:n,downstream:r,verifiedPairCount:i}),d=[{key:`vscode`,label:(0,Z.jsx)(`a`,{href:`vscode://file${l}`,rel:`noreferrer`,children:Q(`context.editInVsCode`)})},{key:`cursor`,label:(0,Z.jsx)(`a`,{href:`cursor://file${l}`,rel:`noreferrer`,children:Q(`context.editInCursor`)})},{key:`claude-cli`,label:Q(`context.editWithClaudeCli`),onClick:()=>o(!0)}];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(nA,{menu:{items:d},trigger:[`click`],children:(0,Z.jsxs)(ST,{icon:(0,Z.jsx)(kH,{}),children:[Q(`context.edit`),` `,(0,Z.jsx)(eS,{})]})}),(0,Z.jsxs)(Wj,{title:Q(`context.editModalTitle`),open:a,onCancel:()=>{o(!1),c(!1)},footer:(0,Z.jsx)(ST,{type:`primary`,icon:(0,Z.jsx)(HL,{}),onClick:async()=>{navigator.clipboard?.writeText&&await navigator.clipboard.writeText(u),c(!0)},children:Q(s?`context.promptCopied`:`context.copyPrompt`)}),children:[(0,Z.jsx)(mR.Paragraph,{type:`secondary`,children:Q(`context.editModalDescription`)}),(0,Z.jsx)(`pre`,{style:{fontFamily:AR.fontFamilyCode,fontSize:12,whiteSpace:`pre-wrap`,background:`var(--ant-color-fill-secondary)`,borderRadius:8,padding:12,maxHeight:320,overflow:`auto`},children:u})]})]})}function o2(e,t){for(let n of e)t[n.key]=n,n.children&&o2(n.children,t)}function s2(){let e=M0(e=>e.selectedFileKey),t=M0(e=>e.showOverview),n=M0(e=>e.showImpact),r=M0(e=>e.liveFiles),i=M0(e=>e.filesLoading),a=M0(e=>e.filesError),o=M0(e=>e.loadFiles),s=M0(e=>e.liveOverview),c=aW(),l=(0,v.useMemo)(()=>{if(!r)return;let e={};return o2(r,e),e},[r]);if(c&&i&&!r)return(0,Z.jsx)(G1,{status:`loading`});if(c&&a&&!r)return(0,Z.jsx)(G1,{status:`error`,title:Q(`context.filesErrorTitle`),description:a,onRetry:o});let u=e?c?l?.[e]:$0[e]:void 0;if(!u||!u.content)return(0,Z.jsx)(G1,{status:`empty`,title:Q(`context.fileEmptyTitle`),description:Q(`context.fileEmptyDescription`)});let d=!c&&u.entityKey?Y0[u.entityKey]:void 0,f=c?s?.knowledge.verifiedPairCount??0:J0.verifiedPairCount;return(0,Z.jsxs)(R1,{title:u.title,extra:(0,Z.jsxs)(eA,{children:[(d||c&&u.entityKey)&&(0,Z.jsx)(ST,{icon:(0,Z.jsx)(qV,{}),onClick:()=>n(u.entityKey),children:Q(`context.viewImpact`)}),u.path&&(0,Z.jsx)(a2,{filePath:u.path,projectPath:c?s?.projectPath??``:`/Users/you/wren-projects/acme-genbi`,projectName:c?s?.projectName??`acme-genbi`:`acme-genbi`,downstream:d?.downstream??[],verifiedPairCount:f})]}),children:[(0,Z.jsx)(ST,{type:`link`,icon:(0,Z.jsx)(nH,{}),onClick:t,style:{paddingLeft:0,marginBottom:8},children:Q(`context.backToOverview`)}),(0,Z.jsx)(`pre`,{style:{fontFamily:AR.fontFamilyCode,fontSize:13,lineHeight:1.5,background:`var(--ant-color-fill-secondary)`,borderRadius:8,padding:16,overflow:`auto`,margin:0,whiteSpace:u.kind===`knowledge`?`pre-wrap`:`pre`,wordBreak:u.kind===`knowledge`?`break-word`:`normal`},children:u.content})]})}var c2={semantic:{color:AR.refused,icon:(0,Z.jsx)(qU,{}),label:Q(`context.severitySemantic`)},structural:{color:AR.estimate,icon:(0,Z.jsx)(nW,{}),label:Q(`context.severityStructural`)},compatibility:{color:ER.blue6,icon:(0,Z.jsx)($H,{}),label:Q(`context.severityCompatibility`)},none:{color:AR.verified,icon:(0,Z.jsx)(bH,{}),label:Q(`context.severityNone`)}};function l2({severity:e}){let t=c2[e];return(0,Z.jsx)(iL,{color:t.color,icon:t.icon,bordered:!0,children:t.label})}function u2(e,t){let n=new Set(e.downstream.filter(e=>e.kind===`relationship`).map(e=>e.key)),r=new Set;for(let i of t)n.has(i.key)&&(i.fromModel!==e.seed.key&&r.add(i.fromModel),i.toModel!==e.seed.key&&r.add(i.toModel));return[...r]}var d2={model:Q(`context.kindModel`),measure:Q(`context.kindMeasure`),relationship:Q(`context.kindRelationship`),view:Q(`context.kindView`)},f2=[`model`,`relationship`,`measure`,`view`];function p2(e){let t=new Map;for(let n of e)t.set(n.kind,(t.get(n.kind)??0)+1);return f2.filter(e=>t.has(e)).map(e=>({kind:e,count:t.get(e)}))}function m2(e){let t={};for(let n of e)t[n.key]=n.name;return t}function h2(){let e=M0(e=>e.impactSeedKey),t=M0(e=>e.showOverview),n=M0(e=>e.showImpact),r=M0(e=>e.liveImpactByKey),i=M0(e=>e.impactError),a=M0(e=>e.liveOverview),o=aW(),s=o?a?.models??[]:G0,c=o?a?.relationships??[]:K0,l=e?r[e]:void 0,u=e?o?l?.blastRadius:Y0[e]:void 0,d=e?o?l?.brokenPairs??[]:X0[e]??[]:[];if(!e)return(0,Z.jsx)(G1,{status:`empty`,title:Q(`context.emptyTitle`)});if(o&&i)return(0,Z.jsx)(G1,{status:`error`,title:Q(`context.impactErrorTitle`),description:i,onRetry:()=>n(e)});if(!u)return(0,Z.jsx)(G1,{status:o?`loading`:`empty`,title:Q(o?`context.impactLoadingTitle`:`context.emptyTitle`)});let f=p2(u.downstream),p=m2(u.downstream);return(0,Z.jsxs)(R1,{title:Q(`context.impactTitle`),children:[(0,Z.jsx)(ST,{type:`link`,icon:(0,Z.jsx)(nH,{}),onClick:t,style:{paddingLeft:0,marginBottom:8},children:Q(`context.backToOverview`)}),(0,Z.jsx)(z1,{label:Q(`context.impactSeed`),value:(0,Z.jsxs)(Z.Fragment,{children:[u.seed.name,` `,(0,Z.jsx)(iL,{children:d2[u.seed.kind]})]})}),(0,Z.jsx)(z1,{label:Q(`context.impactSeverity`),value:(0,Z.jsx)(l2,{severity:u.severity})}),u.seed.kind===`model`&&(0,Z.jsx)(`div`,{style:{marginTop:16,overflowX:`auto`},children:(0,Z.jsx)(B0,{models:s,relationships:c,impact:{selectedKey:u.seed.key,affectedKeys:u2(u,c)}})}),(0,Z.jsx)(`div`,{style:{marginTop:16,fontWeight:500},children:Q(`context.downstreamByKind`)}),f.length===0?(0,Z.jsx)(`div`,{style:{opacity:.65,padding:`8px 0`},children:Q(`context.noDownstream`)}):(0,Z.jsx)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`,marginTop:8},children:f.map(({kind:e,count:t})=>(0,Z.jsxs)(iL,{children:[d2[e],`: `,t]},e))}),(0,Z.jsx)(`div`,{style:{marginTop:16,fontWeight:500},children:Q(`context.downstreamDependents`)}),(0,Z.jsx)(W1,{rowKey:`key`,dataSource:u.downstream,columns:[{title:`Name`,dataIndex:`name`,key:`name`},{title:`Kind`,dataIndex:`kind`,key:`kind`,render:e=>(0,Z.jsx)(iL,{children:d2[e]})}]}),(0,Z.jsx)(`div`,{style:{marginTop:16,fontWeight:500},children:Q(`context.brokenPairsTitle`)}),d.length===0?(0,Z.jsx)(`div`,{style:{opacity:.65,padding:`8px 0`},children:Q(`context.noBrokenPairs`)}):(0,Z.jsx)(W1,{rowKey:`question`,dataSource:d,columns:[{title:Q(`context.brokenPairsQuestion`),dataIndex:`question`,key:`question`},{title:Q(`context.brokenPairsHits`),dataIndex:`hitDownstreamKeys`,key:`hitDownstreamKeys`,render:e=>(0,Z.jsx)(Z.Fragment,{children:e.map(e=>(0,Z.jsx)(iL,{children:p[e]??e},e))})}]}),(0,Z.jsx)(ZS,{title:Q(`context.outOfScopeHint`),children:(0,Z.jsx)(ST,{icon:(0,Z.jsx)(EH,{}),disabled:!0,style:{marginTop:16},children:Q(`context.outOfScopeDeployReview`)})})]})}function g2(){let e=M0(e=>e.viewMode),t=M0(e=>e.loadOverview),n=M0(e=>e.loadFiles),r=M0(e=>e.loadEnrichment),i=M0(e=>e.refreshCanonical),a=gB();(0,v.useEffect)(()=>{a.state?.nativeSessionReturn===`context`?i():(t(),n(),r())},[t,n,r,a.state,i]);let o;return o=e===`file`?(0,Z.jsx)(s2,{}):e===`impact`?(0,Z.jsx)(h2,{}):(0,Z.jsx)(t2,{}),(0,Z.jsx)(q1,{maxWidth:1180,title:Q(`nav.context`),lead:Q(`context.pageLead`),children:o})}var _2={model:(0,Z.jsx)(WU,{}),relationship:(0,Z.jsx)(qV,{}),cube:(0,Z.jsx)(XH,{}),knowledge:(0,Z.jsx)(dH,{}),view:(0,Z.jsx)(SA,{})};function v2(e,t=new Set){for(let n of e)n.children&&(t.add(n.key),v2(n.children,t));return t}function y2({nodes:e,depth:t,expanded:n,onToggle:r,selectedFileKey:i,onSelectFile:a}){return(0,Z.jsx)(Z.Fragment,{children:e.map(e=>{let o=12+t*16;if(e.children){let s=n.has(e.key);return(0,Z.jsxs)(`li`,{className:`genbi-tdir`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`genbi-trow genbi-tdirhdr`,style:{paddingLeft:o},"aria-expanded":s,onClick:()=>r(e.key),children:[(0,Z.jsx)(`span`,{className:`genbi-chev${s?` is-open`:``}`,"aria-hidden":`true`,children:(0,Z.jsx)(jm,{})}),(0,Z.jsx)(`span`,{className:`genbi-fi`,"aria-hidden":`true`,children:(0,Z.jsx)(eF,{})}),(0,Z.jsx)(`span`,{className:`genbi-tname`,children:e.title})]}),s&&(0,Z.jsx)(`ul`,{className:`genbi-tchildren`,children:(0,Z.jsx)(y2,{nodes:e.children,depth:t+1,expanded:n,onToggle:r,selectedFileKey:i,onSelectFile:a})})]},e.key)}let s=e.key===i;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`genbi-trow genbi-tfile${s?` is-sel`:``}`,style:{paddingLeft:o+16},"aria-current":s?`true`:void 0,onClick:()=>a(e.key),children:[(0,Z.jsx)(`span`,{className:`genbi-fi`,"aria-hidden":`true`,children:e.kind?_2[e.kind]:null}),(0,Z.jsx)(`span`,{className:`genbi-tname`,children:e.title})]})},e.key)})})}function b2(){let e=M0(e=>e.selectedFileKey),t=M0(e=>e.selectFile),n=M0(e=>e.liveFiles),r=aW(),i=r?n??[]:Z0,a=!r&&i.length===1&&i[0]?.children?i[0]:void 0,o=a?.children??i,[s,c]=(0,v.useState)(()=>v2(o));return(0,v.useEffect)(()=>{r&&n&&c(v2(o))},[r,n,o]),(0,Z.jsxs)(`nav`,{"aria-label":Q(`context.filesHeader`),className:`genbi-filetree`,children:[a&&(0,Z.jsxs)(`div`,{className:`genbi-rail-proj`,children:[(0,Z.jsx)(eF,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`genbi-tname`,children:a.title})]}),(0,Z.jsx)(`ul`,{className:`genbi-ttree`,children:(0,Z.jsx)(y2,{nodes:o,depth:0,expanded:s,onToggle:e=>{c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},selectedFileKey:e,onSelectFile:t})})]})}var x2={id:`genbi-default`,name:`Genbi Default`,boundContext:`jaffle-wren`,verifyGate:!0,bundleId:`genbi-default@claude-agent-sdk:local`,bundleVersion:`0.1`,irVersion:`0.4`,dispatchTarget:`claude-agent-sdk:local`,bundleHash:`4a7f9c2`,status:`Bound`},S2={backend:`subscription`,label:`Subscription (claude)`,tierModels:[{tier:`cheap`,model:`claude-haiku`},{tier:`strong`,model:`claude-sonnet`}],dispatcher:`claude-agent-sdk`},C2={type:`PostgreSQL`,location:`analytics-prod`,via:`query engine`,tablesSynced:14,lastSync:`5m ago`,health:`healthy`};function w2(e){return{...e,realizationLabel:iW(e.realizationKind,e.steps,e.trigger)}}var T2=w2({id:`explore_model`,name:`Explore Model`,componentType:`analytical`,realizationKind:`skill`,trigger:`one_shot`,outcome:`none`,callableAs:`explore_model`,model:`claude-haiku`,tiers:[{tier:`cheap`,model:`claude-haiku`}],capabilities:[{capability:`semantic_introspection`,outcome:`realize-via`,providedBy:`runtime`,criticality:`required`},{capability:`llm:cheap`,outcome:`native`,providedBy:`runtime`,criticality:`required`}],guardrails:[{name:`read_only_execution`,enforcement:`read_only`,locked:!0}],tools:[{name:`semantic_introspect`,source:`mcp:sample/semantic_introspect`}],outputBlocks:[],steps:[{name:`summarize_semantics`,tier:`cheap`,consumes:[`raw_introspect_result`],produces:`semantic_summary`,realization:`independent`}],status:`ready`}),E2=w2({id:`answer_query`,name:`Answer Query`,componentType:`analytical`,realizationKind:`skill`,trigger:`one_shot`,outcome:`none`,callableAs:`answer_query`,model:`claude-sonnet`,tiers:[{tier:`cheap`,model:`claude-haiku`},{tier:`strong`,model:`claude-sonnet`}],capabilities:[{capability:`sql_execution:read_only`,outcome:`native`,providedBy:`runtime`,criticality:`required`},{capability:`llm:per_step_tier`,outcome:`realize-via`,providedBy:`runtime`,criticality:`required`},{capability:`llm:strong`,outcome:`native`,providedBy:`runtime`,criticality:`required`},{capability:`llm:cheap`,outcome:`native`,providedBy:`runtime`,criticality:`required`},{capability:`render_contract`,outcome:`native`,providedBy:`runtime`,criticality:`required`}],guardrails:[{name:`deterministic_gate`,enforcement:`gated_check`,locked:!0},{name:`read_only_execution`,enforcement:`read_only`,locked:!0},{name:`row_limit`,enforcement:`threshold_limit`,locked:!1,threshold:1e3},{name:`statement_timeout`,enforcement:`generic`,locked:!1,threshold:30}],tools:[{name:`query`,source:`mcp:sample/query`}],outputBlocks:[`table`,`definition`],steps:[{name:`resolve_intent`,tier:`cheap`,consumes:[],produces:`query_intent`,realization:`independent`},{name:`generate_sql`,tier:`strong`,consumes:[`query_intent`],produces:`query_result`,realization:`independent`},{name:`repair_sql`,tier:`strong`,consumes:[`query_result`],produces:`repaired_result`,realization:`repair_fold`,guard:`on_failure`,foldInto:`generate_sql`,maxAttempts:1}],status:`ready`}),D2=[T2,E2,w2({id:`generate_dashboard`,name:`Generate Dashboard`,componentType:`analytical`,realizationKind:`skill`,trigger:`one_shot`,outcome:`none`,callableAs:`generate_dashboard`,model:`claude-haiku`,tiers:[{tier:`strong`,model:`claude-sonnet`},{tier:`cheap`,model:`claude-haiku`}],capabilities:[{capability:`sql_execution:read_only`,outcome:`native`,providedBy:`runtime`,criticality:`required`},{capability:`genbi_build`,outcome:`native`,providedBy:`runtime`,criticality:`required`},{capability:`render_contract`,outcome:`native`,providedBy:`runtime`,criticality:`required`},{capability:`artifact_write`,outcome:`realize-via`,providedBy:`runtime`,criticality:`safety-critical`},{capability:`llm:per_step_tier`,outcome:`realize-via`,providedBy:`runtime`,criticality:`required`},{capability:`llm:strong`,outcome:`native`,providedBy:`runtime`,criticality:`required`},{capability:`llm:cheap`,outcome:`native`,providedBy:`runtime`,criticality:`required`}],guardrails:[{name:`artifact_write`,enforcement:`scoped_write`,locked:!0},{name:`read_only_execution`,enforcement:`read_only`,locked:!0}],tools:[{name:`query`,source:`mcp:sample/query`},{name:`build_dashboard`,source:`mcp:sample/build_dashboard`},{name:`write_artifact`,source:`native`}],outputBlocks:[`kpi_card`,`table`,`chart`,`definition`],steps:[{name:`plan_dashboard`,tier:`strong`,consumes:[],produces:`dashboard_plan`,realization:`independent`},{name:`compose_layout`,tier:`cheap`,consumes:[`dashboard_plan`],produces:`dashboard`,realization:`independent`}],status:`ready`}),w2({id:`explain_change`,name:`Explain Change`,componentType:`analytical`,realizationKind:`skill`,trigger:`one_shot`,outcome:`none`,callableAs:`explain_change`,model:`claude-sonnet`,tiers:[{tier:`strong`,model:`claude-sonnet`}],capabilities:[{capability:`sql_execution:read_only`,outcome:`native`,providedBy:`runtime`,criticality:`required`},{capability:`render_contract`,outcome:`native`,providedBy:`runtime`,criticality:`required`},{capability:`artifact_write`,outcome:`realize-via`,providedBy:`runtime`,criticality:`safety-critical`},{capability:`llm:strong`,outcome:`native`,providedBy:`runtime`,criticality:`required`}],guardrails:[{name:`additivity_guard`,enforcement:`gated_check`,locked:!0},{name:`artifact_write`,enforcement:`scoped_write`,locked:!0},{name:`drill_depth_limit`,enforcement:`threshold_limit`,locked:!1,threshold:3},{name:`read_only_execution`,enforcement:`read_only`,locked:!0}],tools:[{name:`query`,source:`mcp:sample/query`},{name:`write_artifact`,source:`native`}],outputBlocks:[`narrative`],steps:[{name:`plan_decomposition`,tier:`strong`,consumes:[],produces:`decomposition_plan`,realization:`independent`},{name:`synthesize_drivers`,tier:`strong`,consumes:[`decomposition_plan`],produces:`driver_explanation`,realization:`independent`}],status:`ready`}),w2({id:`monitor_freshness`,name:`Monitor Freshness`,componentType:`assertive`,realizationKind:`tool`,trigger:`scheduled`,outcome:`assertion`,callableAs:`monitor_freshness`,model:`claude-haiku`,tiers:[{tier:`cheap`,model:`claude-haiku`}],capabilities:[{capability:`scheduler`,outcome:`realize-via`,providedBy:`runtime`,criticality:`required`},{capability:`sql_execution:read_only`,outcome:`native`,providedBy:`runtime`,criticality:`required`},{capability:`notify_channel`,outcome:`realize-via`,providedBy:`runtime`,criticality:`required`},{capability:`llm:cheap`,outcome:`native`,providedBy:`runtime`,criticality:`required`}],guardrails:[{name:`read_only_execution`,enforcement:`read_only`,locked:!0},{name:`alert_routing`,enforcement:`routing`,locked:!1}],tools:[{name:`check_freshness`,source:`mcp:sample/check_freshness`}],outputBlocks:[`status`],steps:[{name:`assess_severity`,tier:`cheap`,consumes:[`freshness_reading`],produces:`severity_verdict`,realization:`independent`,guard:`on_flag`}],status:`ready`})],O2=[w2({...T2,id:`connect_source`,name:`Connect Source`,callableAs:`connect_source`,capabilities:[{capability:`connection_setup`,outcome:`realize-via`,providedBy:`runtime`,criticality:`required`},{capability:`llm:strong`,outcome:`native`,providedBy:`runtime`,criticality:`required`}],guardrails:[{name:`setup_execution`,enforcement:`write_scope`,locked:!0}],tools:[{name:`connect_source`,source:`mcp:setup/connect_source`}],model:`claude-sonnet`,tiers:[{tier:`strong`,model:`claude-sonnet`}],steps:[{name:`connect`,tier:`strong`,consumes:[],produces:`connection_summary`,realization:`independent`}]}),w2({...T2,id:`build_context`,name:`Build Context`,callableAs:`build_context`,capabilities:[{capability:`context_build`,outcome:`realize-via`,providedBy:`runtime`,criticality:`required`},{capability:`llm:strong`,outcome:`native`,providedBy:`runtime`,criticality:`required`}],guardrails:[{name:`setup_execution`,enforcement:`write_scope`,locked:!0}],tools:[{name:`build_context`,source:`mcp:setup/build_context`}],model:`claude-sonnet`,tiers:[{tier:`strong`,model:`claude-sonnet`}],steps:[{name:`build`,tier:`strong`,consumes:[],produces:`context_summary`,realization:`independent`}]})],k2=[w2({...T2,id:`inspect_context`,name:`Inspect Context`,callableAs:`inspect_context`,capabilities:[{capability:`semantic_introspection`,outcome:`realize-via`,providedBy:`runtime`,criticality:`required`}],tools:[{name:`inspect_context`,source:`mcp:context/inspect_context`}],steps:[{name:`inspect`,tier:`cheap`,consumes:[],produces:`enrichment_gaps`,realization:`independent`}]}),w2({...E2,id:`draft_enrichment`,name:`Draft Enrichment`,callableAs:`draft_enrichment`,capabilities:[{capability:`context_enrichment`,outcome:`realize-via`,providedBy:`runtime`,criticality:`required`}],tools:[{name:`draft_enrichment`,source:`mcp:context/draft_enrichment`}],steps:[{name:`draft`,tier:`strong`,consumes:[`enrichment_gaps`],produces:`enrichment_proposal`,realization:`independent`}]}),w2({...E2,id:`apply_enrichment`,name:`Apply Enrichment`,callableAs:`apply_enrichment`,outcome:`mutation`,model:`—`,tiers:[],capabilities:[],guardrails:[],tools:[],outputBlocks:[],steps:[],status:`ready`,nativeAvailability:{viaLabel:`Claude CLI`,compiledDispatchTarget:`claude-agent-sdk:local`,compiledUnavailableReason:`component is unavailable on the configured runtime`}})];function A2(e){let t=new Map;for(let n of e)for(let e of n.capabilities)t.has(e.capability)||t.set(e.capability,e);return Array.from(t.values())}function j2(e,t){return[{name:e.name,role:`orchestrator`,tierModel:`claude-sonnet`,capabilities:A2(t),status:e.status},{name:`Forecast Trend`,role:`sub-agent`,tierModel:`claude-sonnet`,capabilities:[],status:`Planned (Phase 3)`}]}function M2(e,t,n,r){return{purpose:e===`setup`?{purpose:e,profile:`genbi-setup`,scopeKind:`bootstrap`,executionKind:`setup_runner`,target:`claude-agent-sdk:setup`,targetLabel:`Claude Setup runner`,available:!0}:{purpose:e,profile:e===`analysis`?`genbi-default`:`genbi-enrich-context`,scopeKind:`bound_project`,executionKind:`native_session`,target:`claude-code:interactive`,targetLabel:`Claude CLI`,available:!0},profile:t,runtime:S2,connection:r,components:n,agentProfiles:j2(t,n),nativeSessions:{binding:{configured:!0,generation:1,targetLabel:`Claude CLI`},dispatches:[{purpose:`setup`,profile:`genbi-setup`,scopeKind:`bootstrap`,targetLabel:`Claude CLI`,available:!0},{purpose:`analysis`,profile:`genbi-default`,scopeKind:`bound_project`,targetLabel:`Claude CLI`,available:!0},{purpose:`context_enrichment`,profile:`genbi-enrich-context`,scopeKind:`bound_project`,targetLabel:`Claude CLI`,available:!0}]}}}var N2={analysis:M2(`analysis`,x2,D2,C2),setup:M2(`setup`,{...x2,id:`genbi-setup`,name:`Genbi Setup`,boundContext:`Bootstrap workspace (no project bound)`,bundleId:`genbi-setup@claude-agent-sdk:local`,status:`Bootstrap`},O2,{type:`—`,location:`—`,via:`Bootstrap workspace`,tablesSynced:0,lastSync:`—`,health:`degraded`}),context_enrichment:M2(`context_enrichment`,{...x2,id:`genbi-enrich-context`,name:`Genbi Enrich Context`,bundleId:`genbi-enrich-context@claude-agent-sdk:local`},k2,C2)};N2.analysis;var P2=[{id:`genbi-setup`,kind:`builtin`,role:`system`,selectable:!1,admission:{status:`admitted`,reason:`system purpose profile: dispatched by its host purpose, never selectable for a conversation`,checkedAt:`2026-10-01T00:00:00.000Z`},components:[],createdAt:`2026-10-01T00:00:00.000Z`,updatedAt:`2026-10-01T00:00:00.000Z`},{id:`genbi-enrich-context`,kind:`builtin`,role:`system`,selectable:!1,admission:{status:`admitted`,reason:`system purpose profile: dispatched by its host purpose, never selectable for a conversation`,checkedAt:`2026-10-01T00:00:00.000Z`},components:[],createdAt:`2026-10-01T00:00:00.000Z`,updatedAt:`2026-10-01T00:00:00.000Z`},{id:`genbi-default`,kind:`builtin`,role:`conversation`,selectable:!0,admission:{status:`admitted`,checkedAt:`2026-10-01T00:00:00.000Z`},entry:{kind:`scope`},irVersion:`0.9`,components:[],createdAt:`2026-10-01T00:00:00.000Z`,updatedAt:`2026-10-01T00:00:00.000Z`},{id:`genbi-report`,kind:`builtin`,role:`conversation`,selectable:!0,admission:{status:`admitted`,checkedAt:`2026-10-01T00:00:00.000Z`},entry:{kind:`agent`,verb:`plan_report`},irVersion:`0.9`,components:[],createdAt:`2026-10-01T00:00:00.000Z`,updatedAt:`2026-10-01T00:00:00.000Z`},{id:`genbi-monitor`,kind:`builtin`,role:`conversation`,selectable:!1,admission:{status:`unavailable`,reason:`component "monitor_freshness" is outside the host's execution scope: type="assertive", trigger="scheduled", outcome="assertion" (a conversation profile may only mount type="analytical", trigger="one_shot", outcome="none")`,checkedAt:`2026-10-01T00:00:00.000Z`},irVersion:`0.9`,components:[],createdAt:`2026-10-01T00:00:00.000Z`,updatedAt:`2026-10-01T00:00:00.000Z`},{id:`team-kpis`,kind:`user`,role:`conversation`,selectable:!0,admission:{status:`admitted`,checkedAt:`2026-10-01T00:00:00.000Z`},entry:{kind:`scope`},irVersion:`0.9`,components:[],sourceDir:`/workspace/profiles/team-kpis`,createdAt:`2026-10-01T00:00:00.000Z`,updatedAt:`2026-10-01T00:00:00.000Z`}],F2=[`setup`,`analysis`,`context_enrichment`],I2=`genbi-default`,L2=0,R2=0,z2=bR()((e,t)=>({selectedPurpose:`analysis`,selectedProfile:I2,harness:void 0,loading:!1,error:void 0,profiles:aW()?[]:P2,profilesLoading:!1,profilesError:void 0,addProfileResult:void 0,selectProfile:n=>{F2.includes(n)&&(e({selectedPurpose:n,selectedProfile:I2,harness:void 0,loading:!1,error:void 0}),t().loadHarness())},selectConversationProfile:n=>{e({selectedPurpose:`analysis`,selectedProfile:n,harness:void 0,loading:!1,error:void 0}),t().loadHarness()},loadHarness:()=>{if(!aW())return;let n=t().selectedPurpose,r=t().selectedProfile,i=++L2;e({loading:!0,error:void 0}),fG(n,n===`analysis`&&r!==`genbi-default`?r:void 0).then(a=>{i===L2&&t().selectedPurpose===n&&t().selectedProfile===r&&e({harness:a,loading:!1,error:void 0})}).catch(a=>{i===L2&&t().selectedPurpose===n&&t().selectedProfile===r&&e({loading:!1,error:a instanceof Error?a.message:Q(`harness.loadFailedMessage`)})})},async loadProfiles(){if(!aW()){e({profiles:P2,profilesLoading:!1,profilesError:void 0});return}let t=++R2;e({profilesLoading:!0,profilesError:void 0});try{let{profiles:n}=await sG();if(t!==R2)return;e({profiles:n,profilesLoading:!1})}catch(n){if(t!==R2)return;e({profilesLoading:!1,profilesError:n instanceof Error?n.message:Q(`harness.profilesLoadFailed`)})}},async registerProfile(n){if(aW()){e({addProfileResult:void 0});try{let{profile:r}=await cG(n);e({addProfileResult:r.selectable?{kind:`registered`,message:Q(`harness.addProfileRegistered`),profile:r}:{kind:`refused`,message:`${Q(`harness.addProfileRefused`)} ${r.admission.reason??Q(`harness.profileReadinessUnavailable`)}`,profile:r}}),await t().loadProfiles(),r.selectable&&t().selectConversationProfile(r.id)}catch(t){e({addProfileResult:{kind:`error`,message:t instanceof Error?t.message:Q(`harness.profilesLoadFailed`)}})}}},async removeProfile(n){aW()&&(await lG(n),t().selectedProfile===n&&e({selectedProfile:I2,harness:void 0}),await t().loadProfiles(),t().selectedPurpose===`analysis`&&t().loadHarness())}}));function B2({profiles:e}){return(0,Z.jsx)(W1,{rowKey:`name`,dataSource:e,onRow:e=>e.role===`sub-agent`?{style:{opacity:.55}}:{},columns:[{title:Q(`harness.profileColumn`),dataIndex:`name`,key:`name`},{title:Q(`harness.role`),dataIndex:`role`,key:`role`,render:e=>Q(e===`orchestrator`?`harness.roleOrchestrator`:`harness.roleSubAgent`)},{title:Q(`harness.tierModel`),dataIndex:`tierModel`,key:`tierModel`},{title:Q(`harness.capabilitiesColumn`),dataIndex:`capabilities`,key:`capabilities`,render:e=>(0,Z.jsx)(Z.Fragment,{children:e.map(e=>(0,Z.jsx)(iL,{bordered:!0,style:{marginBottom:4},children:e.capability},e.capability))})},{title:Q(`harness.callableAs`),dataIndex:`callableAs`,key:`callableAs`,render:e=>e??`—`},{title:Q(`harness.status`),dataIndex:`status`,key:`status`}]})}var V2={native:{color:AR.verified,icon:(0,Z.jsx)(bH,{}),label:Q(`harness.outcomeNative`)},"realize-via":{color:AR.estimate,icon:(0,Z.jsx)(XV,{}),label:Q(`harness.outcomeRealizeVia`)}};function H2({outcome:e}){let t=V2[e];return(0,Z.jsx)(iL,{color:t.color,icon:t.icon,bordered:!0,children:t.label})}function U2({components:e}){let t=new Map;for(let n of e)for(let e of n.capabilities)t.has(e.capability)||t.set(e.capability,e);let n=Array.from(t.values());return(0,Z.jsx)(W1,{rowKey:`capability`,dataSource:n,columns:[{title:Q(`harness.capability`),dataIndex:`capability`,key:`capability`},{title:Q(`harness.outcome`),dataIndex:`outcome`,key:`outcome`,render:e=>(0,Z.jsx)(H2,{outcome:e})},{title:Q(`harness.providedBy`),dataIndex:`providedBy`,key:`providedBy`},{title:Q(`harness.criticality`),dataIndex:`criticality`,key:`criticality`,render:e=>e??`—`}]})}function W2({steps:e}){return(0,Z.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8,padding:`4px 0`},children:e.map(e=>(0,Z.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:8,flexWrap:`wrap`},children:[(0,Z.jsx)(iL,{bordered:!0,children:e.tier}),(0,Z.jsx)(`strong`,{children:e.name}),(0,Z.jsxs)(`span`,{style:{opacity:.65,fontSize:12},children:[Q(`harness.stepConsumes`),`: `,e.consumes.length>0?e.consumes.join(`, `):`—`,` →`,` `,Q(`harness.stepProduces`),`: `,e.produces]}),(0,Z.jsx)(iL,{color:e.realization===`repair_fold`?AR.estimate:void 0,bordered:!0,children:e.realization}),e.guard&&(0,Z.jsxs)(iL,{bordered:!0,children:[Q(`harness.stepGuard`),`: `,e.guard]}),e.realization===`repair_fold`&&(0,Z.jsxs)(`span`,{style:{opacity:.65,fontSize:12},children:[Q(`harness.stepFoldInto`),`: `,e.foldInto,` · `,Q(`harness.stepMaxAttempts`),`: `,e.maxAttempts]})]},e.name))})}function G2({components:e}){return(0,Z.jsx)(W1,{rowKey:`id`,dataSource:e,expandable:{rowExpandable:e=>e.status!==`unavailable`,expandedRowRender:e=>(0,Z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:[(0,Z.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:8,flexWrap:`wrap`},children:[(0,Z.jsxs)(`span`,{style:{opacity:.65,fontSize:12},children:[Q(`harness.toolsLabel`),`:`]}),e.tools.length>0?e.tools.map(e=>(0,Z.jsx)(iL,{bordered:!0,children:e.name},e.name)):(0,Z.jsx)(`span`,{style:{opacity:.65,fontSize:12},children:Q(`harness.noneFallback`)})]}),(0,Z.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:8,flexWrap:`wrap`},children:[(0,Z.jsxs)(`span`,{style:{opacity:.65,fontSize:12},children:[Q(`harness.outputBlocksLabel`),`:`]}),e.outputBlocks.length>0?e.outputBlocks.map(e=>(0,Z.jsx)(iL,{bordered:!0,children:e},e)):(0,Z.jsx)(`span`,{style:{opacity:.65,fontSize:12},children:Q(`harness.noneFallback`)})]}),e.outcome!==`none`&&(0,Z.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:8,flexWrap:`wrap`},children:[(0,Z.jsxs)(`span`,{style:{opacity:.65,fontSize:12},children:[Q(`harness.outcomeLabel`),`:`]}),(0,Z.jsx)(iL,{bordered:!0,children:e.outcome})]}),e.nativeAvailability&&(0,Z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,Z.jsxs)(`span`,{style:{opacity:.65,fontSize:12},children:[Q(`harness.programmaticallyUnavailable`),`:`]}),(0,Z.jsx)(z1,{label:Q(`harness.compiledDispatchTarget`),value:e.nativeAvailability.compiledDispatchTarget}),(0,Z.jsx)(z1,{label:Q(`harness.reason`),value:e.nativeAvailability.compiledUnavailableReason})]}),(0,Z.jsx)(W2,{steps:e.steps})]})},columns:[{title:Q(`harness.component`),dataIndex:`name`,key:`name`},{title:Q(`harness.availability`),key:`availability`,render:(e,t)=>t.status===`unavailable`?(0,Z.jsxs)(iL,{color:`warning`,children:[Q(`harness.unavailable`),`: `,t.unavailableReason??Q(`harness.reasonUnavailable`)]}):t.nativeAvailability?(0,Z.jsxs)(iL,{color:`success`,children:[Q(`harness.availableVia`),` `,t.nativeAvailability.viaLabel]}):(0,Z.jsx)(iL,{color:`success`,children:Q(`harness.available`)})},{title:Q(`harness.callableAs`),dataIndex:`callableAs`,key:`callableAs`},{title:Q(`harness.componentType`),dataIndex:`componentType`,key:`componentType`},{title:Q(`harness.realization`),dataIndex:`realizationLabel`,key:`realizationLabel`}]})}var K2={healthy:{color:AR.verified,icon:(0,Z.jsx)(bH,{}),label:Q(`harness.healthHealthy`)},degraded:{color:AR.estimate,icon:(0,Z.jsx)(nW,{}),label:Q(`harness.healthDegraded`)},down:{color:AR.refused,icon:(0,Z.jsx)(CH,{}),label:Q(`harness.healthDown`)}};function q2({health:e}){let t=K2[e];return(0,Z.jsx)(iL,{color:t.color,icon:t.icon,bordered:!0,children:t.label})}function J2({components:e}){let t=new Map;for(let n of e)for(let e of n.guardrails)t.has(e.name)||t.set(e.name,e);let n=Array.from(t.values());return(0,Z.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`},children:n.map(e=>(0,Z.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`6px 0`,borderTop:`1px solid var(--ant-color-border-secondary)`},children:[(0,Z.jsx)(`strong`,{children:e.name}),(0,Z.jsx)(iL,{bordered:!0,children:e.enforcement}),e.locked?(0,Z.jsx)(iL,{color:AR.verified,bordered:!0,children:Q(`harness.locked`)}):e.threshold===void 0?null:(0,Z.jsx)(iL,{bordered:!0,children:e.threshold})]},e.name))})}var Y2={"claude-agent-sdk":Q(`harness.dispatcherClaudeAgentSdk`),"codex-local":Q(`harness.dispatcherCodexLocal`),"in-process":Q(`harness.dispatcherInProcess`)};function X2({harness:e}){let{purpose:t,profile:n,runtime:r,connection:i,components:a,agentProfiles:o,nativeSessions:s}=e,c=t.targetLabel??Q(`harness.targetNotConfigured`),l=t.executionKind===`setup_runner`?Q(`harness.setupRunnerTarget`):Q(`harness.nativeSessionTarget`),u=t.available?Q(`harness.ready`):Q(`harness.unavailable`);return(0,Z.jsxs)(eA,{className:`harness-overview`,orientation:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(mR.Paragraph,{type:`secondary`,style:{maxWidth:`64ch`},children:[Q(`harness.pageLeadPrefix`),` `,(0,Z.jsx)(`strong`,{children:t.profile}),` `,Q(`harness.pageLeadSuffix`)]}),(0,Z.jsxs)(R1,{title:Q(`harness.executionTitle`),note:Q(`harness.executionNote`),extra:(0,Z.jsx)(iL,{color:t.available?AR.verified:AR.estimate,icon:t.available?(0,Z.jsx)(bH,{}):(0,Z.jsx)(CH,{}),bordered:!0,children:u}),children:[(0,Z.jsxs)(`div`,{className:`harness-execution-path`,"aria-label":Q(`harness.executionTitle`),children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(mR.Text,{type:`secondary`,children:Q(`harness.purpose`)}),(0,Z.jsx)(`strong`,{children:t.purpose})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(mR.Text,{type:`secondary`,children:Q(`harness.compiledDispatchTarget`)}),(0,Z.jsx)(`strong`,{children:n.dispatchTarget})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(mR.Text,{type:`secondary`,children:l}),(0,Z.jsx)(`strong`,{children:c})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(mR.Text,{type:`secondary`,children:Q(`harness.readiness`)}),(0,Z.jsx)(`strong`,{children:u})]})]}),(0,Z.jsx)(z1,{label:Q(`harness.profile`),value:t.profile}),!t.available&&t.reason&&(0,Z.jsx)(z1,{label:Q(`harness.reason`),value:t.reason})]}),(0,Z.jsx)(R1,{title:Q(`harness.componentsTitle`),note:Q(`harness.componentsNote`),children:(0,Z.jsx)(G2,{components:a})}),(0,Z.jsx)(R1,{title:Q(`harness.technicalDiagnosticsTitle`),note:Q(`harness.technicalDiagnosticsNote`),children:(0,Z.jsx)(Zm,{destroyOnHidden:!0,items:[{key:`runtime`,label:Q(`harness.runtimeDiagnosticsTitle`),children:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(z1,{label:Q(`harness.authenticationBackend`),value:r.label}),r.dispatcher!==void 0&&(0,Z.jsx)(z1,{label:Q(`harness.dispatcherImplementation`),value:Y2[r.dispatcher]}),(0,Z.jsx)(W1,{rowKey:`tier`,dataSource:r.tierModels,columns:[{title:Q(`harness.tier`),dataIndex:`tier`,key:`tier`},{title:Q(`harness.model`),dataIndex:`model`,key:`model`}]})]})},{key:`profile`,label:Q(`harness.profileDiagnosticsTitle`),children:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(z1,{label:Q(`harness.source`),value:`warble · IR v${n.irVersion}`}),(0,Z.jsx)(z1,{label:Q(`harness.boundContext`),value:n.boundContext}),(0,Z.jsx)(z1,{label:Q(`harness.verifyGate`),value:(0,Z.jsx)(iL,{color:n.verifyGate?AR.verified:AR.refused,icon:n.verifyGate?(0,Z.jsx)(bH,{}):(0,Z.jsx)(CH,{}),bordered:!0,children:n.verifyGate?Q(`harness.verifyGateOn`):Q(`harness.verifyGateOff`)})}),(0,Z.jsx)(z1,{label:Q(`harness.bundle`),value:`${n.bundleId} · v${n.bundleVersion} · ${n.bundleHash}`})]})},{key:`connection`,label:Q(`harness.connectionTitle`),children:(0,Z.jsxs)(`div`,{className:`harness-diagnostic-grid`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(z1,{label:Q(`harness.connectionType`),value:i.type}),(0,Z.jsx)(z1,{label:Q(`harness.connectionLocation`),value:i.location}),(0,Z.jsx)(z1,{label:Q(`harness.connectionVia`),value:i.via})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(z1,{label:Q(`harness.health`),value:(0,Z.jsx)(q2,{health:i.health})}),(0,Z.jsx)(z1,{label:Q(`harness.tablesSynced`),value:i.tablesSynced}),(0,Z.jsx)(z1,{label:Q(`harness.lastSync`),value:i.lastSync})]})]})},{key:`agent-profiles`,label:Q(`harness.agentProfilesTitle`),children:(0,Z.jsx)(B2,{profiles:o})},{key:`capabilities`,label:Q(`harness.capabilityResolutionTitle`),children:(0,Z.jsx)(U2,{components:a})},{key:`guardrails`,label:Q(`harness.guardrailsTitle`),children:(0,Z.jsx)(J2,{components:a})},{key:`native-session-binding`,label:Q(`harness.nativeBindingDiagnosticsTitle`),children:(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(z1,{label:Q(`harness.bindingGeneration`),value:s.binding.generation})})}]})})]})}function Z2(){let e=z2(e=>e.selectedPurpose),t=z2(e=>e.selectedProfile),n=z2(e=>e.harness),r=z2(e=>e.loading),i=z2(e=>e.error),a=z2(e=>e.loadHarness);(0,v.useEffect)(()=>{a()},[a]);let o=aW(),s=o?n:e===`analysis`&&t!==`genbi-default`?{...N2.analysis,purpose:{...N2.analysis.purpose,profile:t}}:N2[e],c;return c=o&&r&&!n?(0,Z.jsx)(G1,{status:`loading`}):o&&i&&!n?(0,Z.jsx)(G1,{status:`error`,title:Q(`harness.loadErrorTitle`),description:i,onRetry:a}):s&&s.purpose.purpose===e?(0,Z.jsx)(X2,{harness:s}):(0,Z.jsx)(G1,{status:`empty`,title:Q(`harness.emptyTitle`),description:Q(`harness.emptyDescription`)}),(0,Z.jsx)(q1,{maxWidth:1e3,title:Q(`nav.harness`),lead:Q(`harness.pageSubtitle`),children:c})}function Q2({header:e,items:t,emptyHint:n,selectedKey:r,onSelect:i}){let[a,o]=(0,v.useState)(t[0]?.key),s=r??a,c=e=>{i?i(e):o(e)};return(0,Z.jsxs)(`nav`,{"aria-label":e,style:{padding:`12px 8px`},children:[(0,Z.jsx)(mR.Text,{type:`secondary`,style:{fontSize:11,textTransform:`uppercase`,letterSpacing:.6,padding:`0 8px`},children:e}),(0,Z.jsxs)(`div`,{style:{marginTop:8,display:`flex`,flexDirection:`column`,gap:2},children:[t.length===0&&(0,Z.jsx)(`div`,{style:{padding:8,opacity:.6,fontSize:13},children:n??`—`}),t.map(e=>{let t=e.key===s;return(0,Z.jsxs)(`button`,{type:`button`,"aria-current":t,"aria-disabled":e.disabled,disabled:e.disabled,onClick:()=>!e.disabled&&c(e.key),style:{textAlign:`left`,border:`none`,borderRadius:6,padding:`6px 8px`,cursor:e.disabled?`default`:`pointer`,background:t?`var(--ant-color-fill-secondary)`:`transparent`,color:`inherit`,font:`inherit`,opacity:e.disabled?.5:1},children:[(0,Z.jsx)(`div`,{style:{fontSize:13,lineHeight:1.3},children:e.label}),e.meta&&(0,Z.jsx)(`div`,{style:{fontSize:11,opacity:.6},children:e.meta})]},e.key)})]})]})}function $2(){let e=z2(e=>e.selectedPurpose),t=z2(e=>e.selectedProfile),n=z2(e=>e.selectProfile),r=z2(e=>e.selectConversationProfile),i=z2(e=>e.harness),a=z2(e=>e.profiles),o=z2(e=>e.profilesError),s=z2(e=>e.loadProfiles),c=z2(e=>e.registerProfile),l=z2(e=>e.removeProfile),u=z2(e=>e.addProfileResult),d=aW(),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)(),[y,b]=(0,v.useState)();(0,v.useEffect)(()=>{s()},[s]);let x={setup:`Setup`,analysis:`Analyze data`,context_enrichment:`Context enrichment`},S=[`setup`,`context_enrichment`].map(e=>({key:e,label:x[e],meta:i?.purpose.purpose===e?i.purpose.profile:Q(`harness.systemPurposeMeta`)})),C=a.filter(e=>e.role===`conversation`),w=[...C.filter(e=>e.id===I2),...C.filter(e=>e.id!==I2)],T=(w.length?w:[{id:I2,selectable:!0,admission:{status:`admitted`,checkedAt:``},kind:`builtin`,role:`conversation`,components:[],createdAt:``,updatedAt:``}]).map(e=>({key:e.id===`genbi-default`?`analysis`:`profile:${e.id}`,label:e.id===`genbi-default`?x.analysis:e.id,meta:e.id===`genbi-default`?e.id:e.selectable?`${e.kind===`user`?`user · `:``}${e.entry?.kind===`agent`?`enters at ${e.entry.verb??`one component`}`:`scope entry`}`:`${Q(`harness.profileReadinessUnavailable`)} · ${e.admission.reason??``}`,disabled:!e.selectable})),E=e===`analysis`&&t!==`genbi-default`?`profile:${t}`:e,D=C.filter(e=>e.kind===`user`),O=e=>{if(e.startsWith(`profile:`)){r(e.slice(8));return}n(e)},k=async()=>{h(!0);try{await c(f.trim())}finally{h(!1)}},A=async e=>{_(e),b(void 0);try{await l(e)}catch(e){b(e instanceof Error?e.message:String(e))}finally{_(void 0)}};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Q2,{header:Q(`harness.profilesHeader`),items:[...S,...T],selectedKey:E,onSelect:O}),(0,Z.jsxs)(`section`,{"aria-label":Q(`harness.addProfileTitle`),style:{padding:`4px 16px 12px`,display:`flex`,flexDirection:`column`,gap:8},children:[(0,Z.jsxs)(mR.Text,{type:`secondary`,style:{fontSize:11,textTransform:`uppercase`,letterSpacing:.6},children:[Q(`harness.addProfileTitle`),` `,d?null:(0,Z.jsx)(iL,{style:{marginInlineStart:6},children:Q(`harness.fixtureRegistryBadge`)})]}),d?(0,Z.jsx)(mR.Text,{type:`secondary`,style:{fontSize:12},children:Q(`harness.addProfileLead`)}):(0,Z.jsx)(mR.Text,{type:`secondary`,style:{fontSize:12},children:Q(`harness.addProfileFixtureNote`)}),o?(0,Z.jsx)(al,{type:`error`,showIcon:!0,message:Q(`harness.profilesLoadFailed`),description:o}):null,(0,Z.jsx)(MA,{"aria-label":Q(`harness.addProfilePathLabel`),placeholder:`/absolute/path/to/profile`,value:f,disabled:!d||m,onChange:e=>p(e.target.value),onPressEnter:()=>{d&&f.trim()&&k()}}),(0,Z.jsx)(ST,{type:`primary`,size:`small`,disabled:!d||!f.trim(),loading:m,onClick:()=>void k(),children:Q(`harness.addProfileButton`)}),u?(0,Z.jsx)(al,{role:`status`,type:u.kind===`registered`?`success`:u.kind===`refused`?`warning`:`error`,showIcon:!0,message:u.kind===`error`?u.message:`${u.profile?.id??``}: ${u.message}`}):null,d&&D.length?(0,Z.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:D.map(e=>(0,Z.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8},children:[(0,Z.jsx)(mR.Text,{style:{fontSize:12},title:e.sourceDir,children:e.id}),(0,Z.jsx)(Jj,{title:Q(`harness.removeProfileConfirm`),onConfirm:()=>void A(e.id),okText:Q(`harness.removeProfile`),children:(0,Z.jsx)(ST,{size:`small`,danger:!0,loading:g===e.id,"aria-label":`${Q(`harness.removeProfile`)} ${e.id}`,children:Q(`harness.removeProfile`)})})]},e.id))}):null,y?(0,Z.jsx)(al,{type:`error`,showIcon:!0,message:y}):null]})]})}var e4=[{key:`runtime`,title:`Runtime & models`,state:`current`},{key:`connect`,title:`Connect data source`,state:`todo`},{key:`context`,title:`Build data model`,state:`todo`},{key:`bind`,title:`Bind profile`,state:`todo`},{key:`ask`,title:`Ask`,state:`todo`}],t4={authMode:`subscription`,subscriptionProvider:`claude`,tierModels:{claude:[{tier:`strong`,model:``},{tier:`cheap`,model:``}],codex:[{tier:`strong`,model:``},{tier:`cheap`,model:``}]}.claude,hybrid:!1,deployment:`personal`},n4=[{key:`postgres`,label:`PostgreSQL`},{key:`bigquery`,label:`BigQuery`},{key:`snowflake`,label:`Snowflake`},{key:`duckdb`,label:`Local file (CSV / DuckDB)`}],r4={models:6,relationships:3},i4={id:`m0`,role:`assistant`,text:`Let's get your workspace ready. Start with runtime & models below — pick how you authenticate and which model backs each tier.`},a4=1,o4=0;function s4(){return`m${a4++}`}function c4(e,t,n){return e.map(e=>e.key===t?{...e,state:`done`}:e.key===n?{...e,state:`current`}:e)}function l4(e,t){let n=e.findIndex(e=>e.key===t);return n===-1||n===e.length-1?t:e[n+1].key}function u4(e,t){if(!e.some(e=>e.state===`running`))return e;let n=t===`ok`?`done`:`error`;return e.map(e=>e.state===`running`?{...e,state:n}:e)}var d4={workLog:[],streaming:!1,needsInput:!1,envFieldsLoading:!1,submittingEnv:!1},f4={workLog:[],streaming:!1,needsInput:!1},p4={verifying:!1,resolving:!1},m4={models:0,relationships:0},h4={anthropic:!1,openaiCompatible:!1},g4=aW()?{claude:!1,codex:!1}:{claude:!0,codex:!1},_4=bR()((e,t)=>{function n(n,r,i=`connect`){return{onWorkLog:t=>e(e=>({connectStream:{...e.connectStream,workLog:t}})),onEvent:r=>{if(t().connectStream.activeUnsubscribe?.(),r.status===`ok`)e(e=>({steps:c4(e.steps,`connect`,`context`),selectedStepKey:`context`,connectedSourceKey:n,connectStream:{...e.connectStream,streaming:!1,terminal:r,needsInput:!1,activeUnsubscribe:void 0},messages:[...e.messages,{id:s4(),role:`assistant`,text:Q(`setup.dataSourceConnectedMessage`),workLog:e.connectStream.workLog,terminal:r}]}));else if(r.status===`needs_decision`&&r.decision){let t=r.decision;e(e=>({connectStream:{...e.connectStream,streaming:!1,terminal:r,needsInput:!1,decision:t,activeUnsubscribe:void 0},messages:[...e.messages,{id:s4(),role:`assistant`,text:t.detail??r.message,workLog:e.connectStream.workLog,terminal:r}]}))}else e(e=>({connectStream:{...e.connectStream,streaming:!1,terminal:r,needsInput:!0,activeUnsubscribe:void 0},messages:[...e.messages,{id:s4(),role:`assistant`,text:r.message,workLog:e.connectStream.workLog,terminal:r}]}))},onError:a=>{t().connectStream.activeUnsubscribe?.(),e(e=>({connectStream:{...e.connectStream,streaming:!1,error:a,failure:{attempt:i,projectName:r,sourceType:n,error:a,workLog:u4(e.connectStream.workLog,`error`)},workLog:u4(e.connectStream.workLog,`error`),activeUnsubscribe:void 0},messages:[...e.messages,{id:s4(),role:`assistant`,text:Q(`setup.connectFailureHistoryMessage`),workLog:u4(e.connectStream.workLog,`error`)}]}))},onDone:()=>{t().connectStream.activeUnsubscribe?.(),e(e=>({connectStream:{...e.connectStream,streaming:!1,activeUnsubscribe:void 0}}))}}}function r(){gW().then(t=>e({contextSummary:{models:t.models.length,relationships:t.relationships.length}})).catch(()=>{})}function i(){return{onWorkLog:t=>e(e=>({contextStream:{...e.contextStream,workLog:t}})),onEvent:n=>{if(t().contextStream.activeUnsubscribe?.(),n.status===`ok`)e(e=>({steps:c4(e.steps,`context`,`bind`),selectedStepKey:`bind`,contextStream:{...e.contextStream,streaming:!1,terminal:n,needsInput:!1,activeUnsubscribe:void 0},messages:[...e.messages,{id:s4(),role:`assistant`,text:Q(`setup.contextBuiltMessage`),workLog:u4(e.contextStream.workLog,`ok`),terminal:n}]})),r();else if(n.status===`needs_decision`&&n.decision){let t=n.decision;e(e=>({contextStream:{...e.contextStream,streaming:!1,terminal:n,needsInput:!1,decision:t,activeUnsubscribe:void 0},messages:[...e.messages,{id:s4(),role:`assistant`,text:t.detail??n.message,workLog:u4(e.contextStream.workLog,`error`),terminal:n}]}))}else e(e=>({contextStream:{...e.contextStream,streaming:!1,terminal:n,needsInput:!0,activeUnsubscribe:void 0},messages:[...e.messages,{id:s4(),role:`assistant`,text:n.message,workLog:u4(e.contextStream.workLog,`error`),terminal:n}]}))},onError:n=>{t().contextStream.activeUnsubscribe?.(),e(e=>({contextStream:{...e.contextStream,streaming:!1,error:n,failure:{attempt:`context`,projectName:e.connectStream.projectName??e.connectStream.failure?.projectName??``,sourceType:e.connectedSourceKey??e.connectStream.failure?.sourceType??``,error:n,workLog:u4(e.contextStream.workLog,`error`)},workLog:u4(e.contextStream.workLog,`error`),activeUnsubscribe:void 0},messages:[...e.messages,{id:s4(),role:`assistant`,text:Q(`setup.contextFailureHistoryMessage`),workLog:u4(e.contextStream.workLog,`error`)}]}))},onDone:()=>{t().contextStream.activeUnsubscribe?.(),e(e=>({contextStream:{...e.contextStream,streaming:!1,activeUnsubscribe:void 0}}))}}}return{steps:e4,selectedStepKey:`runtime`,runtimeSettings:t4,runtimeSettingsGeneration:0,runtimeSettingsDirty:!1,sourceCatalog:[],sourceCatalogDegradedReason:void 0,sourceCatalogLoading:!1,runtimeTierNames:aW()?[]:t4.tierModels.map(e=>e.tier),runtimeTierNamesError:void 0,adapterEnvStatus:h4,subscriptionLoginStatus:g4,subscriptionModelCatalogs:{},subscriptionModelCatalogLoading:{},subscriptionModelCatalogErrors:{},runtimeSettingsSaving:!1,runtimeSettingsError:void 0,verifyGate:!1,connectedSourceKey:void 0,messages:[i4],setupMode:void 0,setupModeLoading:aW(),setupModeChoosing:!1,setupModeError:void 0,connectStream:d4,contextStream:f4,adoptStream:p4,contextSummary:m4,selectStep:t=>e({selectedStepKey:t}),chooseSetupMode:t=>{aW()&&(e({setupModeChoosing:!0,setupModeError:void 0}),YW(t).then(({mode:t,steps:n})=>e({setupMode:t,steps:n,setupModeChoosing:!1})).catch(t=>{e({setupModeChoosing:!1,setupModeError:t instanceof Error?t.message:Q(`ask.streamErrorGeneric`)})}))},adoptProject:(n,i)=>{if(!aW())return;let{decision:a,sessionId:o}=t().adoptStream;e({adoptStream:{...p4,verifying:!0}}),rG(n,i).then(t=>{if(t.status===`ok`){e(e=>({steps:c4(c4(e.steps,`adopt`,`context`),`context`,`bind`),selectedStepKey:`bind`,adoptStream:p4,messages:[...e.messages,{id:s4(),role:`assistant`,text:Q(`setup.adoptBoundMessage`)}]})),r();return}if(t.status===`needs_decision`&&t.decision){let n=t.decision;e(e=>({adoptStream:{...p4,decision:n,sessionId:t.sessionId},messages:[...e.messages,{id:s4(),role:`assistant`,text:n.detail??t.message}]}));return}if(i&&a){e({adoptStream:{...p4,decision:a,sessionId:o,error:t.message}});return}e({adoptStream:{...p4,error:t.message}})}).catch(t=>{let n=t instanceof Error?t.message:Q(`ask.streamErrorGeneric`);if(i&&a){e({adoptStream:{...p4,decision:a,sessionId:o,error:n}});return}e({adoptStream:{...p4,error:n}})})},resolveAdoptDecision:n=>{let{sessionId:r}=t().adoptStream;!aW()||!r||(e(e=>({adoptStream:{...e.adoptStream,resolving:!0,error:void 0}})),iG(r,n).then(t=>{if(`turnId`in t){e(e=>({steps:c4(e.steps,`adopt`,`context`),selectedStepKey:`context`,adoptStream:p4,contextStream:{...f4,streaming:!0}}));let n=T1(t.sessionId,t.turnId,i());e(e=>({contextStream:{...e.contextStream,sessionId:t.sessionId,activeUnsubscribe:n}}));return}e({setupMode:void 0,adoptStream:p4})}).catch(t=>{let n=t instanceof Error?t.message:Q(`ask.streamErrorGeneric`);e(e=>({adoptStream:{...e.adoptStream,resolving:!1,error:n}}))}))},updateRuntimeSettings:t=>e(e=>({runtimeSettings:{...e.runtimeSettings,...t},runtimeSettingsGeneration:e.runtimeSettingsGeneration+1,runtimeSettingsDirty:!0})),selectSubscriptionProvider:n=>{let r=t();if((r.runtimeSettings.subscriptionProvider??`claude`)===n){r.loadSubscriptionModelCatalog(n);return}e(e=>({runtimeSettings:{...e.runtimeSettings,subscriptionProvider:n,subscriptionDriverModel:``,apiKeyModel:``,tierModels:e.runtimeTierNames.map(e=>({tier:e}))},runtimeSettingsGeneration:e.runtimeSettingsGeneration+1,runtimeSettingsDirty:!0})),t().loadSubscriptionModelCatalog(n)},loadSubscriptionModelCatalog:(n,r=!1)=>{if(!aW())return;let i=++o4;e(e=>({subscriptionModelCatalogLoading:{...e.subscriptionModelCatalogLoading,[n]:!0},subscriptionModelCatalogErrors:{...e.subscriptionModelCatalogErrors,[n]:void 0}})),KW(n,r).then(r=>{(t().runtimeSettings.subscriptionProvider??`claude`)===n&&i===o4&&e(e=>({subscriptionModelCatalogs:{...e.subscriptionModelCatalogs,[n]:r},subscriptionModelCatalogLoading:{...e.subscriptionModelCatalogLoading,[n]:!1},subscriptionModelCatalogErrors:{...e.subscriptionModelCatalogErrors,[n]:r.status===`unavailable`?r.code:void 0}}))}).catch(()=>{(t().runtimeSettings.subscriptionProvider??`claude`)===n&&i===o4&&e(e=>({subscriptionModelCatalogLoading:{...e.subscriptionModelCatalogLoading,[n]:!1},subscriptionModelCatalogErrors:{...e.subscriptionModelCatalogErrors,[n]:`runtime_unavailable`}}))})},saveRuntimeSettings:()=>{if(!aW()){e(e=>{let t=l4(e.steps,`runtime`);return{steps:c4(e.steps,`runtime`,t),selectedStepKey:t,messages:[...e.messages,{id:s4(),role:`assistant`,text:Q(`setup.runtimeConfiguredMessage`)}]}});return}let n=t(),r=n.runtimeSettings.authMode===`gateway`,i=n.runtimeTierNames.map(e=>{let t=n.runtimeSettings.tierModels.find(t=>t.tier===e),i=r?t?.model?.trim()||void 0:t?.model;return{tier:e,...i===void 0?{}:{model:i}}});e(e=>({runtimeSettingsSaving:!0,runtimeSettingsError:void 0,runtimeSettingsGeneration:e.runtimeSettingsGeneration+1,runtimeSettingsDirty:!0})),HW({...n.runtimeSettings,authMode:r?`gateway`:`subscription`,...r?{gatewayProvider:n.runtimeSettings.gatewayProvider?.trim()??``,gatewayModel:n.runtimeSettings.gatewayModel?.trim()??``,gatewayBaseURL:n.runtimeSettings.gatewayBaseURL?.trim()??``}:{},hybrid:!1,apiKeyModel:``,apiKeyAdapter:`anthropic`,tierModels:i}).then(({warnings:t,nativeSessionBinding:n,...r})=>{e(e=>{let i=l4(e.steps,`runtime`);return{runtimeSettings:r,nativeSessionBinding:n,runtimeSettingsSaving:!1,runtimeSettingsError:void 0,steps:c4(e.steps,`runtime`,i),selectedStepKey:i,messages:[...e.messages,{id:s4(),role:`assistant`,text:Q(`setup.runtimeConfiguredMessage`)},...t.map(e=>({id:s4(),role:`assistant`,text:e}))]}}),d1.getState().refreshReadiness()}).catch(t=>{e({runtimeSettingsSaving:!1,runtimeSettingsError:t instanceof Error?t.message:Q(`ask.streamErrorGeneric`)})})},connectDataSource:(r,i,a)=>{if(!aW()){e(e=>({steps:c4(e.steps,`connect`,`context`),selectedStepKey:`context`,connectedSourceKey:i,messages:[...e.messages,{id:s4(),role:`assistant`,text:Q(`setup.dataSourceConnectedMessage`)}]}));return}t().connectStream.activeUnsubscribe?.(),e({connectStream:{...d4,streaming:!0,sourceType:i,projectName:r}}),ZW(r,i,a).then(({sessionId:t,turnId:a})=>{let o=T1(t,a,n(i,r));e(e=>({connectStream:{...e.connectStream,sessionId:t,activeUnsubscribe:o}}))}).catch(t=>{if(t instanceof XW){e(e=>({connectStream:{...e.connectStream,streaming:!1,sessionId:t.sessionId,decision:t.decision},messages:[...e.messages,{id:s4(),role:`assistant`,text:t.decision.detail??t.message}]}));return}let n=t instanceof Error?t.message:Q(`ask.streamErrorGeneric`);e(e=>({connectStream:{...e.connectStream,streaming:!1,error:n}}))})},resumeConnect:()=>{if(!aW())return;let r=t().connectStream,i=r.failure,a=r.sourceType??i?.sourceType??``,o=r.projectName??i?.projectName??``;r.activeUnsubscribe?.(),e({connectStream:{...d4,streaming:!0,sourceType:a,projectName:o}}),QW().then(({sessionId:t,turnId:r})=>{let i=T1(t,r,n(a,o,`connect_resume`));e(e=>({connectStream:{...e.connectStream,sessionId:t,activeUnsubscribe:i}}))}).catch(t=>{let n=t instanceof Error?t.message:Q(`ask.streamErrorGeneric`);e(e=>({connectStream:{...e.connectStream,streaming:!1,error:n}}))})},retryConnectFailure:()=>{let e=t().connectStream.failure;if(e){if(e.attempt===`connect_resume`){t().resumeConnect();return}t().connectDataSource(e.projectName,e.sourceType)}},fetchSourceCatalog:()=>{aW()&&(e({sourceCatalogLoading:!0}),$W().then(t=>e({sourceCatalog:t.sources,sourceCatalogDegradedReason:t.fromCli?void 0:t.degradedReason??Q(`setup.connectSourceCatalogPartial`),sourceCatalogLoading:!1})).catch(t=>{e({sourceCatalog:[],sourceCatalogDegradedReason:t instanceof Error?t.message:Q(`setup.connectSourceCatalogPartial`),sourceCatalogLoading:!1})}))},fetchConnectEnvFields:()=>{aW()&&(e(e=>({connectStream:{...e.connectStream,envFieldsError:void 0,envFieldsLoading:!0}})),eG().then(({fields:t})=>e(e=>({connectStream:{...e.connectStream,envFields:t,envFieldsLoading:!1}}))).catch(t=>{let n=t instanceof Error?t.message:Q(`setup.connectEnvFieldsLoadError`);e(e=>({connectStream:{...e.connectStream,envFieldsError:n,envFieldsLoading:!1}}))}))},submitConnectEnv:n=>{aW()&&(e(e=>({connectStream:{...e.connectStream,submittingEnv:!0}})),tG(n).then(()=>{e(e=>({connectStream:{...e.connectStream,submittingEnv:!1}})),t().resumeConnect()}).catch(t=>{let n=t instanceof Error?t.message:Q(`ask.streamErrorGeneric`);e(e=>({connectStream:{...e.connectStream,submittingEnv:!1,error:n}}))}))},resolveConnectDecision:r=>{let{sessionId:i,sourceType:a}=t().connectStream;!aW()||!i||(e(e=>({connectStream:{...e.connectStream,streaming:!0,error:void 0}})),iG(i,r).then(t=>{if(`turnId`in t){let r=T1(t.sessionId,t.turnId,n(a??``,``));e(e=>({connectStream:{...e.connectStream,sessionId:t.sessionId,decision:void 0,activeUnsubscribe:r}}));return}e(r===`rename`?{connectStream:{...d4,sourceType:a}}:{connectStream:d4})}).catch(t=>{let n=t instanceof Error?t.message:Q(`ask.streamErrorGeneric`);e(e=>({connectStream:{...e.connectStream,streaming:!1,error:n}}))}))},resolveContextDecision:n=>{let{sessionId:r}=t().contextStream;!aW()||!r||(e(e=>({contextStream:{...e.contextStream,streaming:!0,error:void 0}})),iG(r,n).then(t=>{if(`turnId`in t){let n=T1(t.sessionId,t.turnId,i());e(e=>({contextStream:{...e.contextStream,workLog:[],sessionId:t.sessionId,decision:void 0,activeUnsubscribe:n}}));return}if(`event`in t){e(e=>({contextStream:{...e.contextStream,streaming:!1,decision:void 0}})),i().onEvent?.(t.event);return}e(e=>({contextStream:{...e.contextStream,streaming:!1,decision:void 0}}))}).catch(t=>{let n=t instanceof Error?t.message:Q(`ask.streamErrorGeneric`);e(e=>({contextStream:{...e.contextStream,streaming:!1,error:n}}))}))},buildContext:()=>{if(!aW()){e(e=>({steps:c4(e.steps,`context`,`bind`),selectedStepKey:`bind`,contextSummary:r4,messages:[...e.messages,{id:s4(),role:`assistant`,text:Q(`setup.contextBuiltMessage`)}]}));return}t().contextStream.activeUnsubscribe?.(),e({contextStream:{...f4,streaming:!0}}),nG().then(({sessionId:t,turnId:n})=>{let r=T1(t,n,i());e(e=>({contextStream:{...e.contextStream,sessionId:t,activeUnsubscribe:r}}))}).catch(t=>{let n=t instanceof Error?t.message:Q(`ask.streamErrorGeneric`);e(e=>({contextStream:{...e.contextStream,streaming:!1,error:n}}))})},retryContextFailure:()=>{t().contextStream.failure?.attempt===`context`&&t().buildContext()},compileAndBind:()=>{e(e=>({steps:c4(e.steps,`bind`,`ask`),selectedStepKey:`ask`,verifyGate:!0,messages:[...e.messages,{id:s4(),role:`assistant`,text:Q(`setup.profileBoundMessage`)}]})),aW()&&aG().then(({steps:t,verifyGatePassed:n})=>e({steps:t,verifyGate:n})).catch(()=>{})},refreshCanonical:()=>{aW()&&(RW().then(t=>{let n=[...t].reverse().find(e=>e.state===`current`)?.key??t.find(e=>e.state!==`done`)?.key;e(n?{steps:t,selectedStepKey:n}:{steps:t})}).catch(()=>{}),qW().then(({mode:t})=>e({setupMode:t,setupModeLoading:!1})).catch(()=>e({setupModeLoading:!1})),gW().then(t=>e({contextSummary:{models:t.models.length,relationships:t.relationships.length}})).catch(()=>{}))},hydrate:()=>{if(!aW())return;let n=()=>!t().steps.some(e=>e.state===`done`),r=t().runtimeSettingsGeneration,i=()=>n()&&!t().runtimeSettingsDirty&&t().runtimeSettingsGeneration===r;qW().then(({mode:t})=>e({setupMode:t,setupModeLoading:!1})).catch(()=>e({setupModeLoading:!1})),JW().then(({failure:n,needsInput:r,sessionId:i,decision:a})=>{if(!(t().connectStream.streaming||t().contextStream.streaming)){if((a?.kind===`max_turns_continue`||a?.kind===`schema_discovery_retry`)&&i){e({selectedStepKey:`context`,contextStream:{...f4,sessionId:i,decision:a}});return}if(r&&i){let t={id:`recovery-needs-input-${i}`,kind:`setup_status`,status:`needs_input`,message:r.message};if(r.attempt===`context`){e({selectedStepKey:`context`,contextStream:{...f4,sessionId:i,terminal:t,needsInput:!0,workLog:r.workLog}});return}e({selectedStepKey:`connect`,connectStream:{...d4,sessionId:i,terminal:t,needsInput:!0,sourceType:r.sourceType,projectName:r.projectName,workLog:r.workLog,failure:n}});return}if(n){if(n.attempt===`context`){e({selectedStepKey:`context`,contextStream:{...f4,error:n.error,failure:n,workLog:n.workLog}});return}e({selectedStepKey:`connect`,connectStream:{...d4,error:n.error,failure:n,sourceType:n.sourceType,projectName:n.projectName,workLog:n.workLog}})}}}).catch(()=>{}),RW().then(t=>{if(!n())return;let r=[...t].reverse().find(e=>e.state===`current`)?.key??t.find(e=>e.state!==`done`)?.key;e(r?{steps:t,selectedStepKey:r}:{steps:t})}).catch(()=>{}),zW().then(n=>{i()&&(e({runtimeSettings:n}),t().loadSubscriptionModelCatalog(n.subscriptionProvider??`claude`))}).catch(()=>{}),BW().then(t=>{!i()||t.valid||e({runtimeSettingsError:t.correction})}).catch(()=>{}),VW().then(t=>e({runtimeTierNames:t,runtimeTierNamesError:void 0})).catch(t=>{e({runtimeTierNames:[],runtimeTierNamesError:t instanceof Error?t.message:Q(`ask.streamErrorGeneric`)})}),UW().then(t=>e({adapterEnvStatus:t})).catch(()=>{}),WW().then(t=>e({subscriptionLoginStatus:t})).catch(()=>{})},resetSetup:()=>{t().connectStream.activeUnsubscribe?.(),t().contextStream.activeUnsubscribe?.(),e(e=>({steps:e4,selectedStepKey:`runtime`,runtimeSettings:t4,runtimeSettingsGeneration:e.runtimeSettingsGeneration+1,runtimeSettingsDirty:!1,subscriptionLoginStatus:g4,subscriptionModelCatalogs:{},subscriptionModelCatalogLoading:{},subscriptionModelCatalogErrors:{},runtimeSettingsSaving:!1,runtimeSettingsError:void 0,nativeSessionBinding:void 0,verifyGate:!1,connectedSourceKey:void 0,messages:[i4],setupMode:void 0,setupModeLoading:!1,setupModeChoosing:!1,setupModeError:void 0,connectStream:d4,contextStream:f4,adoptStream:p4,contextSummary:m4})),aW()&&oG().then(({steps:t,runtimeSettings:n})=>{e({steps:t,runtimeSettings:n});let r=WW().then(t=>e({subscriptionLoginStatus:t})).catch(()=>{}),i=VW().then(t=>e({runtimeTierNames:t,runtimeTierNamesError:void 0})).catch(t=>{e({runtimeTierNames:[],runtimeTierNamesError:t instanceof Error?t.message:Q(`ask.streamErrorGeneric`)})});return Promise.all([r,i]).then(()=>d1.getState().refreshReadiness())}).catch(()=>{})}}});function v4({children:e}){return(0,Z.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`flex-start`},children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:24,height:24,borderRadius:`50%`,marginTop:2,flexShrink:0,background:`var(--ant-color-fill-secondary)`,color:`var(--ant-color-text-secondary)`},children:(0,Z.jsx)(CU,{style:{fontSize:13}})}),(0,Z.jsx)(`div`,{style:{flex:1,minWidth:0},children:e})]})}var y4={running:(0,Z.jsx)(Md,{spin:!0}),done:(0,Z.jsx)(bH,{}),error:(0,Z.jsx)(CH,{})},b4={running:`var(--ant-color-text-secondary)`,done:`var(--ant-color-success)`,error:`var(--ant-color-error)`},x4={running:Q(`ask.stepRunning`),done:Q(`ask.stepDone`),error:Q(`ask.stepError`)},S4={tool:(0,Z.jsx)(XU,{}),subagent:(0,Z.jsx)(qV,{}),step:(0,Z.jsx)(_H,{}),decision:(0,Z.jsx)(_U,{})};function C4(e){return e.state===`error`?Q(`ask.stepErrorDetailLabel`):e.kind===`step`?Q(`ask.stepReasoningLabel`):Q(`ask.stepResultLabel`)}function w4(e){return e.kind===`decision`?!1:e.input!==void 0||e.detail!==void 0||e.inspection!==void 0}function T4(e){return typeof e==`object`&&e&&`sql`in e&&typeof e.sql==`string`?e.sql:JSON.stringify(e,null,2)}function E4(e){return e<1e3?`${e} ms`:`${(e/1e3).toFixed(e%1e3==0?0:1)} s`}function D4({steps:e,title:t,defaultOpen:n=!1}){let[r,i]=(0,v.useState)({}),[a,o]=(0,v.useState)(n);if(e.length===0)return null;let s=e=>i(t=>({...t,[e]:!t[e]})),c=(0,Z.jsx)(`ul`,{"aria-label":Q(`ask.workLog`),style:{listStyle:`none`,margin:0,padding:`8px 12px`,display:`flex`,flexDirection:`column`,gap:4,fontFamily:AR.fontFamilyCode,fontSize:12,background:`var(--ant-color-fill-tertiary)`,borderRadius:8},children:e.map(e=>{let t=w4(e),n=t&&!!r[e.id],i=e.kind===`decision`?e.detail??e.inspection?.error??e.inspection?.output:void 0,a=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:y4[e.state]}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:S4[e.kind]}),(0,Z.jsx)(`span`,{style:{color:`var(--ant-color-text)`},children:e.label}),i!==void 0&&(0,Z.jsx)(`span`,{style:{color:`var(--ant-color-text-secondary)`,minWidth:0,whiteSpace:`normal`,wordBreak:`break-word`},children:i}),(0,Z.jsxs)(`span`,{style:{fontSize:10,opacity:.65},children:[`(`,x4[e.state],`)`]}),t&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,style:{marginInlineStart:`auto`,opacity:.65},children:n?(0,Z.jsx)(eS,{}):(0,Z.jsx)(jm,{})})]});return(0,Z.jsxs)(`li`,{style:{display:`flex`,flexDirection:`column`,gap:4,paddingLeft:(e.depth??0)*16},children:[t?(0,Z.jsx)(`button`,{type:`button`,"aria-expanded":n,"aria-label":`${e.label} (${x4[e.state]}) — ${Q(`ask.stepToggleLabel`)}`,onClick:()=>s(e.id),style:{display:`flex`,alignItems:`center`,gap:6,width:`100%`,background:`transparent`,border:`none`,padding:0,margin:0,font:`inherit`,textAlign:`left`,cursor:`pointer`,color:b4[e.state]},children:a}):(0,Z.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,color:b4[e.state]},children:a}),t&&n&&(0,Z.jsxs)(`div`,{style:{marginInlineStart:20,padding:`6px 8px`,borderRadius:6,background:`var(--ant-color-fill-quaternary)`,color:`var(--ant-color-text)`,display:`flex`,flexDirection:`column`,gap:6},children:[e.input!==void 0&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{style:{fontSize:10,opacity:.65},children:Q(`ask.stepInputLabel`)}),(0,Z.jsx)(`pre`,{style:{margin:`2px 0 0`,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:(0,Z.jsx)(`code`,{children:T4(e.input)})})]}),e.detail!==void 0&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{style:{fontSize:10,opacity:.65},children:C4(e)}),(0,Z.jsx)(`div`,{style:{marginTop:2,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:e.detail})]}),e.inspection!==void 0&&(0,Z.jsxs)(Z.Fragment,{children:[e.inspection.action!==void 0&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{style:{fontSize:10,opacity:.65},children:Q(`ask.stepActionLabel`)}),(0,Z.jsx)(`pre`,{style:{margin:`2px 0 0`,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:(0,Z.jsx)(`code`,{children:e.inspection.action})})]}),e.inspection.output!==void 0&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{style:{fontSize:10,opacity:.65},children:Q(`ask.stepOutputLabel`)}),(0,Z.jsx)(`div`,{style:{marginTop:2,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:e.inspection.output})]}),e.inspection.error!==void 0&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{style:{fontSize:10,opacity:.65},children:Q(`ask.stepErrorDetailLabel`)}),(0,Z.jsx)(`div`,{style:{marginTop:2,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:e.inspection.error})]}),e.inspection.durationMs!==void 0&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`span`,{style:{fontSize:10,opacity:.65},children:[Q(`ask.stepDurationLabel`),`: `]}),(0,Z.jsx)(`span`,{children:E4(e.inspection.durationMs)})]})]})]})]},e.id)})});return t===void 0?c:(0,Z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":a,onClick:()=>o(e=>!e),style:{display:`flex`,alignItems:`center`,gap:6,width:`fit-content`,background:`transparent`,border:`none`,padding:0,margin:0,font:`inherit`,fontSize:12,cursor:`pointer`,color:`var(--ant-color-text-secondary)`},children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:a?(0,Z.jsx)(eS,{}):(0,Z.jsx)(jm,{})}),(0,Z.jsx)(`span`,{children:t})]}),a&&c]})}function O4({messages:e}){return(0,Z.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:e.map(e=>e.role===`assistant`?(0,Z.jsx)(v4,{children:(0,Z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:[(0,Z.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,Z.jsx)(mR.Text,{children:e.text}),e.terminal?.status===`ok`&&(0,Z.jsx)(bH,{"aria-hidden":`true`,style:{color:`var(--ant-color-success)`}}),e.terminal?.status===`needs_input`&&(0,Z.jsx)(VH,{"aria-hidden":`true`,style:{color:`var(--ant-color-warning)`}})]}),e.workLog&&e.workLog.length>0&&(0,Z.jsx)(D4,{steps:e.workLog,title:Q(`ask.executionTrace`)})]})},e.id):(0,Z.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`},children:(0,Z.jsx)(`div`,{style:{maxWidth:`80%`,background:`var(--ant-color-primary-bg)`,borderRadius:12,padding:`8px 12px`},children:(0,Z.jsx)(mR.Text,{children:e.text})})},e.id))})}var k4=[`inherit`,`opus`,`sonnet`,`haiku`],A4=[{label:Q(`setup.authSubscription`),value:`subscription`},{label:Q(`setup.authGateway`),value:`gateway`},{label:Q(`setup.authByo`),value:`byo`,disabled:!0},{label:Q(`setup.authLocal`),value:`local`,disabled:!0}],j4=[{label:`Claude CLI`,value:`claude`},{label:`Codex CLI`,value:`codex`}],M4=e=>{try{let t=new URL(e).protocol;return t===`http:`||t===`https:`}catch{return!1}};function N4({label:e,value:t,placeholder:n,catalog:r,allowedModels:i,onChange:a}){let[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(t),u=e=>r?.status===`ready`?r.models.find(t=>t.model.trim()===e):void 0,d=(i?i.map(e=>{let t=u(e);return{value:e,searchText:`${t?.displayName??e} ${e} ${t?.description??``}`.toLowerCase(),label:(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{style:{fontWeight:500},children:t?.displayName??e}),(0,Z.jsx)(`div`,{style:{opacity:.7,fontSize:12},children:e}),t?.description&&(0,Z.jsx)(`div`,{style:{opacity:.7,fontSize:12},children:t.description})]})}}):r?.status===`ready`?r.models.map(e=>({value:e.model,searchText:`${e.displayName} ${e.model} ${e.description??``}`.toLowerCase(),label:(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{style:{fontWeight:500},children:[e.displayName,e.isDefault?` · ${Q(`setup.subscriptionModelDefault`)}`:``]}),(0,Z.jsx)(`div`,{style:{opacity:.7,fontSize:12},children:e.model}),e.description&&(0,Z.jsx)(`div`,{style:{opacity:.7,fontSize:12},children:e.description})]})})):[]).filter(e=>e.searchText.includes(c.toLowerCase())),f=t.trim(),p=i?f.length>0&&!i.includes(f):!1,m=!i&&f.length>0&&r?.status===`ready`&&!r.models.some(e=>e.model.trim()===f);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(hS,{"aria-label":e,value:t,options:d,open:o&&d.length>0,defaultActiveFirstOption:!0,getPopupContainer:e=>e.parentElement??document.body,filterOption:!1,onFocus:()=>{l(t),s(!0)},onOpenChange:s,onSearch:e=>{l(e),s(!0)},onChange:a,onSelect:e=>{l(e),s(!1),a(e)},children:(0,Z.jsx)(MA,{"aria-label":e,placeholder:n})}),m&&(0,Z.jsx)(`div`,{role:`status`,style:{color:`#ad6800`,fontSize:12,marginTop:4},children:Q(`setup.subscriptionModelCustomUnverified`)}),p&&(0,Z.jsxs)(`div`,{role:`alert`,style:{color:`#a8071a`,fontSize:12,marginTop:4},children:[Q(`setup.tierModelOutsideUnion`),i?.join(`, `)]})]})}function P4(e,t){let[n,r]=(0,v.useState)();return(0,v.useEffect)(()=>{if(!t||!aW())return;let n=!1;return GW(e).then(e=>{n||r(e)},()=>{n||r({status:`unavailable`,reason:`request failed`})}),()=>{n=!0}},[e,t]),n}function F4(){let e=_4(e=>e.runtimeSettings),t=_4(e=>e.runtimeTierNames),n=_4(e=>e.runtimeTierNamesError),r=_4(e=>e.updateRuntimeSettings),i=_4(e=>e.selectSubscriptionProvider),a=_4(e=>e.loadSubscriptionModelCatalog),o=_4(e=>e.subscriptionModelCatalogs),s=_4(e=>e.subscriptionModelCatalogLoading),c=_4(e=>e.subscriptionModelCatalogErrors),l=_4(e=>e.saveRuntimeSettings),u=_4(e=>e.subscriptionLoginStatus),d=_4(e=>e.runtimeSettingsSaving),f=_4(e=>e.runtimeSettingsError),p=_4(e=>e.adapterEnvStatus),m=e.authMode===`gateway`,h=e.gatewayProvider??``,g=e.gatewayBaseURL??``,_=e.gatewayModel??``,v=P4(h.trim(),m),y=g.trim().length>0&&!M4(g.trim()),b=v?.status===`ready`&&v.models.length>0&&!g.trim()?{status:`ready`,models:v.models.map(e=>({model:e.model,displayName:e.displayName}))}:void 0,x=v?.status===`ready`?v.providers.filter(e=>e.includes(h.trim())).map(e=>({value:e})):[],S=e.subscriptionProvider??`claude`,C=o[S],w=s[S]??!1,T=c[S],E=t=>e.tierModels.find(e=>e.tier===t)??{tier:t},D=(t,n)=>{let i=E(t),a=e.tierModels.some(e=>e.tier===t)?e.tierModels.map(e=>e.tier===t?{...e,...n}:e):[...e.tierModels,{...i,...n}];r({tierModels:a})},O=t.length>0&&t.every(e=>{let t=E(e).model?.trim()||(m?_.trim():``);return!!t&&!M4(t)}),k=u[S],A=m?d||!O||!h.trim()||y:d||!O||!k||!e.subscriptionDriverModel?.trim();return(0,Z.jsx)(R1,{title:Q(`setup.runtimeTitle`),note:Q(`setup.runtimeDescription`),children:(0,Z.jsxs)(eA,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{style:{marginBottom:8,fontWeight:500},children:Q(`setup.authModeLabel`)}),(0,Z.jsx)(uk,{"aria-label":Q(`setup.authModeAriaLabel`),value:m?`gateway`:`subscription`,options:A4,onChange:e=>{(e===`gateway`||e===`subscription`)&&r({authMode:e})}})]}),m?(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{style:{opacity:.65,fontSize:12,marginBottom:8},children:Q(`setup.gatewayDescription`)}),(0,Z.jsx)(al,{style:{marginBottom:8},type:p.gateway?`success`:`warning`,showIcon:!0,message:p.gateway?Q(`setup.gatewayKeyDetected`):Q(`setup.gatewayKeyMissing`)}),v?.status===`unavailable`&&(0,Z.jsx)(al,{style:{marginBottom:8},type:`info`,showIcon:!0,message:Q(`setup.gatewayCatalogUnavailable`)}),(0,Z.jsx)(`div`,{style:{marginBottom:4,fontWeight:500},children:Q(`setup.gatewayProviderLabel`)}),(0,Z.jsx)(hS,{"aria-label":Q(`setup.gatewayProviderLabel`),value:h,options:x,getPopupContainer:e=>e.parentElement??document.body,onChange:e=>r({gatewayProvider:e}),children:(0,Z.jsx)(MA,{"aria-label":Q(`setup.gatewayProviderLabel`),placeholder:Q(`setup.gatewayProviderPlaceholder`)})}),(0,Z.jsx)(`div`,{style:{marginTop:12,marginBottom:4,fontWeight:500},children:Q(`setup.gatewayBaseUrlLabel`)}),(0,Z.jsx)(MA,{"aria-label":Q(`setup.gatewayBaseUrlLabel`),value:g,placeholder:Q(`setup.gatewayBaseUrlPlaceholder`),onChange:e=>r({gatewayBaseURL:e.target.value})}),y&&(0,Z.jsx)(`div`,{role:`alert`,style:{color:`#a8071a`,fontSize:12,marginTop:4},children:Q(`setup.gatewayBaseUrlInvalid`)}),(0,Z.jsx)(`div`,{style:{marginTop:12,marginBottom:4,fontWeight:500},children:Q(`setup.gatewayModelLabel`)}),(0,Z.jsx)(N4,{label:Q(`setup.gatewayModelLabel`),value:_,placeholder:Q(`setup.gatewayModelPlaceholder`),catalog:b,onChange:e=>r({gatewayModel:e})}),(0,Z.jsx)(`div`,{style:{opacity:.65,fontSize:12,marginTop:4},children:Q(`setup.defaultModelHint`)})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{style:{marginBottom:8,fontWeight:500},children:`Interactive CLI target`}),(0,Z.jsx)(uk,{"aria-label":`Interactive CLI target`,value:S,options:j4,onChange:e=>i(e)}),(0,Z.jsx)(al,{style:{marginTop:8},type:k?`warning`:`error`,showIcon:!0,message:Q(k?S===`codex`?`setup.authCodexSubscriptionWarning`:`setup.authSubscriptionWarning`:`setup.authSubscriptionLoggedOut`)})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(eA,{align:`center`,style:{marginBottom:4},children:[(0,Z.jsx)(`span`,{style:{fontWeight:500},children:Q(`setup.subscriptionModelsLabel`)}),(0,Z.jsx)(ST,{size:`small`,loading:w,onClick:()=>a(S,!0),children:Q(`setup.subscriptionModelsRefresh`)})]}),T&&(0,Z.jsx)(al,{style:{marginBottom:8},type:`warning`,showIcon:!0,message:Q(`setup.subscriptionModelsUnavailable`),description:`${T}. ${Q(`setup.subscriptionModelsFreeTextHint`)}`}),!T&&(0,Z.jsx)(`div`,{style:{opacity:.65,fontSize:12,marginBottom:8},children:Q(`setup.subscriptionModelsSignedInHint`)}),(0,Z.jsx)(`div`,{style:{marginBottom:4,fontWeight:500},children:Q(`setup.subscriptionDriverModelLabel`)}),(0,Z.jsx)(N4,{label:Q(`setup.subscriptionDriverModelLabel`),value:e.subscriptionDriverModel??``,placeholder:Q(`setup.subscriptionModelPlaceholder`),catalog:C,onChange:e=>r({subscriptionDriverModel:e})}),(0,Z.jsx)(`div`,{style:{opacity:.65,fontSize:12,marginTop:4},children:Q(`setup.subscriptionDriverModelHint`)})]})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{style:{marginBottom:8,fontWeight:500},children:Q(`setup.compiledTiersLabel`)}),n&&(0,Z.jsx)(al,{style:{marginBottom:8},type:`error`,showIcon:!0,message:Q(`setup.tierDiscoveryErrorTitle`),description:n}),(0,Z.jsx)(eA,{direction:`vertical`,size:12,style:{width:`100%`},children:t.map(e=>{let t=E(e),n=`${Q(`setup.tierModelAriaPrefix`)} ${e} tier`;return(0,Z.jsxs)(`div`,{style:{border:`1px solid #f0f0f0`,borderRadius:6,padding:12},children:[(0,Z.jsx)(`div`,{style:{fontWeight:500,marginBottom:8},children:e}),m?(0,Z.jsx)(N4,{label:n,value:t.model??``,placeholder:_.trim()?`${Q(`setup.tierDefaultModelPrefix`)} ${_.trim()}`:Q(`setup.tierModelPlaceholder`),catalog:b,onChange:t=>D(e,{model:t})}):(0,Z.jsx)(N4,{label:n,value:t.model??``,placeholder:Q(`setup.tierModelPlaceholder`),catalog:C,allowedModels:S===`claude`?k4:void 0,onChange:t=>D(e,{model:t})})]},e)})})]}),f&&(0,Z.jsx)(al,{type:`error`,showIcon:!0,message:Q(`setup.runtimeSaveErrorTitle`),description:f}),(0,Z.jsx)(ST,{type:`primary`,disabled:A,onClick:l,children:Q(d?`setup.savingRuntime`:`setup.saveRuntime`)})]})})}function I4({decision:e,resolving:t,onChoose:n}){return(0,Z.jsx)(R1,{title:Q(`setup.decisionTitle`),children:(0,Z.jsxs)(eA,{direction:`vertical`,size:16,style:{width:`100%`},children:[e.detail&&(0,Z.jsx)(mR.Text,{children:e.detail}),(0,Z.jsx)(eA,{wrap:!0,children:e.options.map((e,r)=>(0,Z.jsx)(ST,{type:r===0?`primary`:`default`,disabled:t,loading:t,onClick:()=>n(e.id),children:e.label},e.id))})]})})}function L4({failure:e,step:t,retrying:n,onRetry:r}){let i=Q(t===`connect`?`setup.connectFailureTitle`:`setup.contextFailureTitle`),a=Q(t===`connect`?`setup.connectFailureDescription`:`setup.contextFailureDescription`);return(0,Z.jsx)(al,{type:`error`,showIcon:!0,message:i,description:(0,Z.jsxs)(eA,{direction:`vertical`,size:12,style:{width:`100%`},children:[(0,Z.jsx)(mR.Text,{children:a}),(0,Z.jsxs)(mR.Text,{type:`secondary`,children:[Q(`setup.failureProjectSource`),e.projectName,` · `,e.sourceType]}),(0,Z.jsx)(ST,{type:`primary`,onClick:r,loading:n,disabled:n,children:Q(`setup.continueAndRepair`)}),(0,Z.jsx)(Zm,{size:`small`,items:[{key:`technical-details`,label:Q(`setup.failureTechnicalDetails`),children:(0,Z.jsxs)(eA,{direction:`vertical`,size:8,style:{width:`100%`},children:[(0,Z.jsx)(mR.Paragraph,{style:{margin:0,whiteSpace:`pre-wrap`},children:e.error}),(0,Z.jsx)(D4,{steps:e.workLog})]})}]})]})})}function R4({field:e,value:t,onChange:n}){let[r,i]=(0,v.useState)(void 0),[a,o]=(0,v.useState)(void 0),s=e=>{let t=new FileReader;t.onerror=()=>o(Q(`setup.connectCredentialFileError`)),t.onload=()=>{let r=t.result;if(typeof r!=`string`){o(Q(`setup.connectCredentialFileError`));return}let a=r.indexOf(`,`);o(void 0),i(e.name),n(a>=0?r.slice(a+1):r)},t.readAsDataURL(e)};return(0,Z.jsxs)(eA,{direction:`vertical`,size:6,style:{width:`100%`},children:[(0,Z.jsx)(`input`,{type:`file`,accept:`application/json,.json`,"aria-label":`${e.label??e.key} file`,onChange:e=>{let t=e.target.files?.[0];t&&s(t)}}),r&&!a&&(0,Z.jsxs)(mR.Text,{type:`secondary`,style:{fontSize:12},children:[Q(`setup.connectCredentialFileEncoded`),r]}),a&&(0,Z.jsx)(al,{type:`error`,showIcon:!0,message:a}),(0,Z.jsx)(MA.Password,{placeholder:Q(`setup.connectCredentialPastePlaceholder`),value:t,onChange:e=>{i(void 0),n(e.target.value)}})]})}var z4=`postgres`;function B4(){let e=_4(e=>e.connectedSourceKey),t=_4(e=>e.connectDataSource),n=_4(e=>e.resumeConnect),r=_4(e=>e.fetchConnectEnvFields),i=_4(e=>e.submitConnectEnv),a=_4(e=>e.resolveConnectDecision),o=_4(e=>e.retryConnectFailure),s=_4(e=>e.connectStream),c=_4(e=>e.sourceCatalog),l=_4(e=>e.sourceCatalogDegradedReason),u=_4(e=>e.sourceCatalogLoading),d=_4(e=>e.fetchSourceCatalog),[f,p]=(0,v.useState)(e??z4),[m,h]=(0,v.useState)(void 0),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)({}),x=(c.length>0?c:n4.map(e=>({key:e.key,label:e.label}))).map(e=>({label:e.label,value:e.key})),S=(c.find(e=>e.key===f)?.variants??[]).flatMap(e=>e.discriminator?[e.discriminator.value]:[]);(0,v.useEffect)(()=>{h(S.length>1?S[0]:void 0)},[f,c]);let{streaming:C,workLog:w,error:T,needsInput:E,decision:D,envFields:O,envFieldsError:k,envFieldsLoading:A,submittingEnv:j,failure:M}=s;(0,v.useEffect)(()=>{d()},[d]),(0,v.useEffect)(()=>{M&&(_(M.projectName),p(M.sourceType))},[M]),(0,v.useEffect)(()=>{E&&(b({}),r())},[E,r]);let N=C||E||!!D,P=g.trim().length>0&&!N,F=e=>{e===`rename`&&_(``),a(e)},I=Q(e?`setup.connectedNote`:C?`setup.connectingNote`:`setup.connectDescription`);return(0,Z.jsx)(R1,{title:Q(`setup.connectTitle`),note:I,children:(0,Z.jsxs)(eA,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(`label`,{style:{display:`block`},children:[(0,Z.jsx)(mR.Text,{strong:!0,style:{display:`block`,marginBottom:6},children:Q(`setup.connectSourceLabel`)}),(0,Z.jsx)(cS,{"aria-label":Q(`setup.connectSourceAriaLabel`),showSearch:!0,value:f,options:x,loading:u,disabled:N,placeholder:Q(`setup.connectSourcePlaceholder`),style:{width:`100%`,maxWidth:420},optionFilterProp:`label`,getPopupContainer:e=>e.parentElement??document.body,onChange:e=>p(e)}),S.length>1&&(0,Z.jsxs)(`div`,{style:{marginTop:12},children:[(0,Z.jsx)(mR.Text,{strong:!0,style:{display:`block`,marginBottom:6},children:Q(`setup.connectVariantLabel`)}),(0,Z.jsx)(cS,{"aria-label":Q(`setup.connectVariantLabel`),value:m,options:S.map(e=>({label:e,value:e})),disabled:N,style:{width:`100%`,maxWidth:420},getPopupContainer:e=>e.parentElement??document.body,onChange:e=>h(e)}),(0,Z.jsx)(mR.Text,{type:`secondary`,style:{display:`block`,fontSize:12,marginTop:4},children:Q(`setup.connectVariantHint`)})]}),l&&(0,Z.jsx)(`div`,{role:`status`,style:{color:`#ad6800`,fontSize:12,marginTop:4},children:l})]}),(0,Z.jsxs)(`label`,{style:{display:`block`},children:[(0,Z.jsx)(mR.Text,{strong:!0,style:{display:`block`,marginBottom:6},children:Q(`setup.connectProjectNameLabel`)}),(0,Z.jsx)(MA,{placeholder:Q(`setup.connectProjectNamePlaceholder`),value:g,disabled:N,onChange:e=>_(e.target.value)})]}),(0,Z.jsx)(ST,{type:`primary`,disabled:!P,loading:C,onClick:()=>t(g.trim(),f,m),children:Q(`setup.connectCreateAction`)}),!M&&(0,Z.jsx)(D4,{steps:w}),D&&(0,Z.jsx)(I4,{decision:D,resolving:C,onChoose:F}),!D&&E&&(0,Z.jsx)(R1,{title:Q(`setup.connectNeedsInputTitle`),note:Q(`setup.connectNeedsInputMessage`),children:(0,Z.jsxs)(eA,{direction:`vertical`,size:16,style:{width:`100%`},children:[k&&(0,Z.jsx)(al,{type:`warning`,showIcon:!0,message:k}),A?(0,Z.jsx)(Bj,{}):O&&O.length>0?(0,Z.jsxs)(Z.Fragment,{children:[O.map(e=>(0,Z.jsxs)(`label`,{style:{display:`block`},children:[(0,Z.jsxs)(mR.Text,{strong:!0,style:{display:`block`},children:[e.label??e.key,e.required===!1&&(0,Z.jsx)(mR.Text,{type:`secondary`,style:{fontWeight:400},children:Q(`setup.connectFieldOptional`)})]}),(0,Z.jsx)(mR.Text,{type:`secondary`,style:{display:`block`,fontSize:12},children:e.key}),e.description&&(0,Z.jsx)(mR.Text,{type:`secondary`,style:{display:`block`,fontSize:12,marginTop:2},children:e.description}),(0,Z.jsx)(`div`,{style:{marginTop:6},children:e.fixedValue===void 0?e.fileEncoded?(0,Z.jsx)(R4,{field:e,value:y[e.key]??``,onChange:t=>b(n=>({...n,[e.key]:t}))}):e.secret?(0,Z.jsx)(MA.Password,{placeholder:e.example,value:y[e.key]??``,onChange:t=>b(n=>({...n,[e.key]:t.target.value}))}):(0,Z.jsx)(MA,{placeholder:e.example??e.defaultValue,value:y[e.key]??``,onChange:t=>b(n=>({...n,[e.key]:t.target.value}))}):(0,Z.jsx)(MA,{value:e.fixedValue,disabled:!0,"aria-label":e.label??e.key})})]},e.key)),(0,Z.jsx)(ST,{type:`primary`,loading:j||C,onClick:()=>i({...Object.fromEntries((O??[]).flatMap(e=>e.fixedValue===void 0?[]:[[e.key,e.fixedValue]])),...y}),children:Q(`setup.connectEnvSubmitAction`)})]}):(0,Z.jsx)(ST,{size:`small`,onClick:()=>n(),loading:C,children:Q(`setup.connectResumeAction`)})]})}),M&&(0,Z.jsx)(L4,{failure:M,step:`connect`,retrying:C,onRetry:o}),!M&&T&&(0,Z.jsx)(al,{type:`error`,showIcon:!0,message:Q(`setup.connectErrorTitle`),description:T})]})})}function V4(){let e=_4(e=>e.adoptStream),t=_4(e=>e.adoptProject),n=_4(e=>e.resolveAdoptDecision),[r,i]=(0,v.useState)(``),{verifying:a,error:o,decision:s,resolving:c}=e,l=a||!!s,u=r.trim().length>0&&!l,d=s?.kind===`select_profile`,f=Q(a?`setup.adoptVerifyingNote`:`setup.adoptDescription`);return(0,Z.jsx)(R1,{title:Q(`setup.adoptTitle`),note:f,children:(0,Z.jsxs)(eA,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(`label`,{style:{display:`block`},children:[(0,Z.jsx)(mR.Text,{strong:!0,style:{display:`block`,marginBottom:6},children:Q(`setup.adoptPathLabel`)}),(0,Z.jsx)(MA,{placeholder:Q(`setup.adoptPathPlaceholder`),value:r,disabled:l,onChange:e=>i(e.target.value)})]}),(0,Z.jsx)(ST,{type:`primary`,disabled:!u,loading:a,onClick:()=>t(r.trim()),children:Q(`setup.adoptAction`)}),o&&(0,Z.jsx)(al,{type:`error`,showIcon:!0,message:Q(`setup.adoptErrorTitle`),description:o}),s&&(0,Z.jsx)(I4,{decision:s,resolving:d?a:c,onChoose:d?e=>t(r.trim(),e):n})]})})}function H4(){let e=_4(e=>e.buildContext),t=_4(e=>e.resolveContextDecision),n=_4(e=>e.retryContextFailure),r=_4(e=>e.contextStream),i=_4(e=>e.contextSummary),{streaming:a,workLog:o,error:s,failure:c,needsInput:l,decision:u,terminal:d}=r,f=d?.status===`ok`?Q(`setup.contextBuiltNote`):Q(a?`setup.contextBuildingNote`:`setup.contextDescription`);return(0,Z.jsx)(R1,{title:Q(`setup.contextTitle`),note:f,children:(0,Z.jsxs)(eA,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(z1,{label:Q(`setup.contextModels`),value:i.models}),(0,Z.jsx)(z1,{label:Q(`setup.contextRelationships`),value:i.relationships})]}),(0,Z.jsx)(ST,{type:`primary`,disabled:a||!!u,loading:a,onClick:e,children:Q(`setup.contextAction`)}),a&&o.length>0&&(0,Z.jsx)(D4,{steps:o}),u&&(0,Z.jsx)(I4,{decision:u,resolving:a,onChoose:t}),!u&&l&&(0,Z.jsx)(al,{type:`warning`,showIcon:!0,message:Q(`setup.contextNeedsInputTitle`),description:d?.message??Q(`setup.contextNeedsInputMessage`)}),c&&(0,Z.jsx)(L4,{failure:c,step:`context`,retrying:a,onRetry:n}),!c&&s&&(0,Z.jsx)(al,{type:`error`,showIcon:!0,message:Q(`setup.contextErrorTitle`)})]})})}function U4(){let e=_4(e=>e.verifyGate),t=_4(e=>e.compileAndBind);return(0,Z.jsx)(R1,{title:Q(`setup.bindTitle`),note:Q(e?`setup.bindDoneNote`:`setup.bindDescription`),children:(0,Z.jsxs)(eA,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(z1,{label:Q(`setup.bindVerifyGateLabel`),value:(0,Z.jsx)(iL,{color:e?AR.verified:AR.refused,icon:e?(0,Z.jsx)(bH,{}):(0,Z.jsx)(CH,{}),bordered:!0,children:Q(e?`setup.bindVerifyGateOn`:`setup.bindVerifyGateOff`)})}),(0,Z.jsx)(ST,{type:`primary`,onClick:t,disabled:e,children:Q(`setup.bindAction`)})]})})}function W4(){let e=yB(),t=N1(e=>e.startStructuredSession),[n,r]=(0,v.useState)(!1),[i,a]=(0,v.useState)(),o=async()=>{r(!0),a(void 0);try{e(P1(await t()))}catch(e){a(e instanceof Error?e.message:`A Structured Ask session could not be created.`)}finally{r(!1)}};return(0,Z.jsx)(R1,{title:Q(`setup.askTitle`),note:Q(`setup.askDescription`),children:(0,Z.jsxs)(eA,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(ST,{type:`primary`,icon:(0,Z.jsx)(aH,{}),loading:n,onClick:()=>void o(),children:Q(`setup.askCta`)}),i?(0,Z.jsx)(mR.Text,{type:`danger`,role:`alert`,children:i}):null]})})}function G4(){switch(_4(e=>e.selectedStepKey)){case`runtime`:return(0,Z.jsx)(F4,{});case`connect`:return(0,Z.jsx)(B4,{});case`adopt`:return(0,Z.jsx)(V4,{});case`context`:return(0,Z.jsx)(H4,{});case`bind`:return(0,Z.jsx)(U4,{});case`ask`:return(0,Z.jsx)(W4,{});default:return(0,Z.jsx)(G1,{status:`empty`,title:Q(`setup.emptyTitle`),description:Q(`setup.emptyDescription`)})}}function K4(){let e=_4(e=>e.setupModeLoading),t=_4(e=>e.setupModeChoosing),n=_4(e=>e.setupModeError),r=_4(e=>e.chooseSetupMode);return e?(0,Z.jsx)(R1,{title:Q(`setup.modeChoiceTitle`),children:(0,Z.jsx)(Bj,{})}):(0,Z.jsx)(R1,{title:Q(`setup.modeChoiceTitle`),note:Q(`setup.modeChoiceDescription`),children:(0,Z.jsxs)(eA,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(PD,{size:`small`,children:(0,Z.jsxs)(eA,{direction:`vertical`,size:8,style:{width:`100%`},children:[(0,Z.jsx)(mR.Text,{strong:!0,children:Q(`setup.modeCreateTitle`)}),(0,Z.jsx)(mR.Text,{type:`secondary`,children:Q(`setup.modeCreateDescription`)}),(0,Z.jsx)(ST,{type:`primary`,disabled:t,loading:t,onClick:()=>r(`create`),children:Q(`setup.modeCreateAction`)})]})}),(0,Z.jsx)(PD,{size:`small`,children:(0,Z.jsxs)(eA,{direction:`vertical`,size:8,style:{width:`100%`},children:[(0,Z.jsx)(mR.Text,{strong:!0,children:Q(`setup.modeAdoptTitle`)}),(0,Z.jsx)(mR.Text,{type:`secondary`,children:Q(`setup.modeAdoptDescription`)}),(0,Z.jsx)(ST,{disabled:t,loading:t,onClick:()=>r(`adopt`),children:Q(`setup.modeAdoptAction`)})]})}),n&&(0,Z.jsx)(al,{type:`error`,showIcon:!0,message:n})]})})}function q4(){let e=_4(e=>e.messages),t=_4(e=>e.hydrate),n=_4(e=>e.refreshCanonical),r=_4(e=>e.setupMode),i=gB();(0,v.useEffect)(()=>{i.state?.nativeSessionReturn===`setup`?n():t()},[t,i.state,n]);let a=aW()&&!r;return(0,Z.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`},children:(0,Z.jsx)(`div`,{style:{flex:1,overflow:`auto`},children:(0,Z.jsx)(q1,{maxWidth:720,title:Q(`nav.setup`),lead:Q(`setup.pageLead`),children:a?(0,Z.jsx)(K4,{}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(O4,{messages:e}),(0,Z.jsx)(G4,{})]})})})})}var J4={done:{color:AR.verified,icon:(0,Z.jsx)(bH,{}),label:Q(`setup.stepDone`)},current:{color:AR.estimate,icon:(0,Z.jsx)(VU,{}),label:Q(`setup.stepCurrent`)},todo:{icon:(0,Z.jsx)(Gk,{}),label:Q(`setup.stepTodo`)}};function Y4({state:e}){let t=J4[e];return(0,Z.jsx)(iL,{color:t.color,icon:t.icon,bordered:!0,children:t.label})}function X4(e){return e.key===`context`?Q(`setup.contextTitle`):e.title}function Z4(){let e=_4(e=>e.steps),t=_4(e=>e.selectedStepKey),n=_4(e=>e.selectStep),r=_4(e=>e.resetSetup),i=_4(e=>e.setupMode),a=e.find(e=>e.key===`runtime`)?.state===`done`;return aW()&&!i?null:(0,Z.jsxs)(`nav`,{"aria-label":Q(`setup.stepsHeader`),style:{padding:12},children:[(0,Z.jsx)(`div`,{style:{fontSize:12,fontWeight:600,color:`var(--ant-color-text-tertiary)`,textTransform:`uppercase`,letterSpacing:.4,padding:`4px 8px`},children:Q(`setup.stepsHeader`)}),(0,Z.jsx)(`ul`,{style:{listStyle:`none`,margin:0,padding:0},children:e.map((e,r)=>{let i=e.key===t;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,"aria-current":i?`true`:void 0,disabled:e.key!==`runtime`&&!a,onClick:()=>n(e.key),style:{display:`flex`,flexDirection:`column`,gap:4,alignItems:`flex-start`,width:`100%`,textAlign:`left`,padding:`8px 8px`,marginBottom:2,border:`none`,borderRadius:8,cursor:e.key!==`runtime`&&!a?`not-allowed`:`pointer`,background:i?`var(--ant-color-fill-secondary)`:`transparent`,color:`var(--ant-color-text)`},children:[(0,Z.jsxs)(`span`,{style:{fontSize:13,fontWeight:i?600:400},children:[r+1,`. `,X4(e)]}),(e.key!==`ask`||e.state!==`current`)&&(0,Z.jsx)(Y4,{state:e.state})]})},e.key)})}),(0,Z.jsx)(`div`,{style:{padding:`8px`},children:(0,Z.jsx)(Jj,{title:Q(`setup.resetConfirmTitle`),description:(0,Z.jsx)(`div`,{style:{maxWidth:260},children:Q(`setup.resetConfirmDescription`)}),okText:Q(`setup.resetConfirmOk`),cancelText:Q(`setup.resetConfirmCancel`),okButtonProps:{danger:!0},onConfirm:()=>r(),children:(0,Z.jsx)(ST,{type:`text`,danger:!0,size:`small`,icon:(0,Z.jsx)(Zj,{}),children:Q(`setup.resetAction`)})})})]})}var Q4=.9,$4=[{id:`run-131`,when:`2026-07-17 09:14`,score:.93,gateThreshold:Q4,gatePass:!0,regressions:0,cost:`$0.84`,p50:`1.2s`},{id:`run-130`,when:`2026-07-16 09:02`,score:.91,gateThreshold:Q4,gatePass:!0,regressions:1,cost:`$0.81`,p50:`1.3s`},{id:`run-129`,when:`2026-07-15 09:10`,score:.88,gateThreshold:Q4,gatePass:!1,regressions:3,cost:`$0.79`,p50:`1.5s`},{id:`run-128`,when:`2026-07-14 09:05`,score:.9,gateThreshold:Q4,gatePass:!0,regressions:0,cost:`$0.77`,p50:`1.4s`},{id:`run-127`,when:`2026-07-13 09:00`,score:.89,gateThreshold:Q4,gatePass:!0,regressions:0,cost:`$0.75`,p50:`1.4s`}],e3={"run-131":[{component:`Schema retrieval`,score:.97,delta:.01},{component:`SQL generation`,score:.94,delta:.03},{component:`Verification`,score:.95,delta:0},{component:`Narrative`,score:.88,delta:.02}],"run-130":[{component:`Schema retrieval`,score:.96,delta:0},{component:`SQL generation`,score:.91,delta:-.02},{component:`Verification`,score:.95,delta:.01},{component:`Narrative`,score:.86,delta:.01}],"run-129":[{component:`Schema retrieval`,score:.96,delta:-.01},{component:`SQL generation`,score:.93,delta:-.04},{component:`Verification`,score:.94,delta:-.03},{component:`Narrative`,score:.85,delta:-.02}],"run-128":[{component:`Schema retrieval`,score:.97,delta:.01},{component:`SQL generation`,score:.97,delta:.02},{component:`Verification`,score:.97,delta:.01},{component:`Narrative`,score:.87,delta:0}],"run-127":[{component:`Schema retrieval`,score:.96,delta:0},{component:`SQL generation`,score:.95,delta:0},{component:`Verification`,score:.96,delta:0},{component:`Narrative`,score:.87,delta:0}]},t3=bR()((e,t)=>({selectedRunId:$4[0].id,runs:$4,componentScoresByRunId:e3,loadingRuns:!1,error:void 0,selectRun:n=>{e({selectedRunId:n}),!(!aW()||t().componentScoresByRunId[n])&&OW(n).then(({componentScores:t})=>{e(e=>({componentScoresByRunId:{...e.componentScoresByRunId,[n]:t}}))}).catch(()=>{})},loadRuns:()=>{aW()&&(e({loadingRuns:!0,error:void 0}),DW().then(n=>{e(e=>({runs:n,loadingRuns:!1,error:void 0,selectedRunId:n.some(t=>t.id===e.selectedRunId)?e.selectedRunId:n[0]?.id??e.selectedRunId}));let r=t().selectedRunId;r&&!t().componentScoresByRunId[r]&&t().selectRun(r)}).catch(t=>{e({loadingRuns:!1,error:t instanceof Error?t.message:Q(`eval.loadFailedMessage`)})}))}}));function n3({pass:e}){return(0,Z.jsx)(iL,{color:e?AR.verified:AR.refused,icon:e?(0,Z.jsx)(bH,{}):(0,Z.jsx)(CH,{}),bordered:!0,children:Q(e?`eval.gatePass`:`eval.gateFail`)})}function r3({run:e}){return(0,Z.jsx)(R1,{title:`${e.id} · ${e.when}`,extra:(0,Z.jsx)(n3,{pass:e.gatePass}),children:(0,Z.jsxs)(mM,{gutter:[16,16],children:[(0,Z.jsx)(XO,{xs:12,md:8,lg:4,children:(0,Z.jsx)(EM,{title:Q(`eval.scoreLabel`),value:e.score,precision:2})}),(0,Z.jsx)(XO,{xs:12,md:8,lg:4,children:(0,Z.jsx)(EM,{title:Q(`eval.gateThresholdLabel`),value:e.gateThreshold,precision:2})}),(0,Z.jsx)(XO,{xs:12,md:8,lg:4,children:(0,Z.jsx)(EM,{title:Q(`eval.regressionsLabel`),value:e.regressions})}),(0,Z.jsx)(XO,{xs:12,md:8,lg:4,children:(0,Z.jsx)(EM,{title:Q(`eval.costLabel`),value:e.cost})}),(0,Z.jsx)(XO,{xs:12,md:8,lg:4,children:(0,Z.jsx)(EM,{title:Q(`eval.p50Label`),value:e.p50})})]})})}function i3(e){let t=[...e].reverse();return{tooltip:{trigger:`axis`},grid:{left:8,right:16,top:24,bottom:32,containLabel:!0},xAxis:{type:`category`,data:t.map(e=>e.id)},yAxis:{type:`value`,min:0,max:1},series:[{name:`score`,type:`line`,data:t.map(e=>e.score)}]}}function a3({runs:e}){let t=(0,v.useMemo)(()=>i3(e),[e]);return(0,Z.jsx)(R1,{title:Q(`eval.trendTitle`),children:(0,Z.jsx)(U1,{option:t,height:220,ariaLabel:Q(`eval.trendAriaLabel`)})})}function o3(e){return e>=0?`+${e.toFixed(2)}`:e.toFixed(2)}function s3({components:e}){return(0,Z.jsx)(R1,{title:Q(`eval.byComponentTitle`),children:(0,Z.jsx)(W1,{rowKey:`component`,dataSource:e,columns:[{title:Q(`eval.componentColumn`),dataIndex:`component`,key:`component`},{title:Q(`eval.scoreColumn`),dataIndex:`score`,key:`score`,render:e=>e.toFixed(2)},{title:Q(`eval.deltaColumn`),dataIndex:`delta`,key:`delta`,render:e=>o3(e)}]})})}function c3(){return(0,Z.jsx)(R1,{title:Q(`eval.outOfScopeTitle`),children:(0,Z.jsxs)(eA,{wrap:!0,children:[(0,Z.jsx)(ZS,{title:Q(`eval.outOfScopeHint`),children:(0,Z.jsx)(ST,{icon:(0,Z.jsx)($U,{}),disabled:!0,children:Q(`eval.outOfScopeQuestionList`)})}),(0,Z.jsx)(ZS,{title:Q(`eval.outOfScopeHint`),children:(0,Z.jsx)(ST,{icon:(0,Z.jsx)(qH,{}),disabled:!0,children:Q(`eval.outOfScopeQuestionDetail`)})}),(0,Z.jsx)(ZS,{title:Q(`eval.outOfScopeHint`),children:(0,Z.jsx)(ST,{icon:(0,Z.jsx)(nU,{}),disabled:!0,children:Q(`eval.outOfScopeScoreHistory`)})})]})})}function l3(){let e=t3(e=>e.selectedRunId),t=t3(e=>e.runs),n=t3(e=>e.componentScoresByRunId),r=t3(e=>e.loadRuns),i=t3(e=>e.loadingRuns),a=t3(e=>e.error),o=t.find(t=>t.id===e);(0,v.useEffect)(()=>{r()},[r]);let s=aW(),c;return c=s&&i?(0,Z.jsx)(G1,{status:`loading`}):s&&a?(0,Z.jsx)(G1,{status:`error`,title:Q(`eval.loadErrorTitle`),description:a,onRetry:r}):o?(0,Z.jsxs)(eA,{direction:`vertical`,size:16,style:{width:`100%`},children:[(0,Z.jsx)(uk,{value:`global`,options:[{label:Q(`eval.globalTab`),value:`global`},{label:Q(`eval.questionsTab`),value:`questions`,disabled:!0}]}),(0,Z.jsx)(r3,{run:o}),(0,Z.jsx)(a3,{runs:t}),(0,Z.jsx)(s3,{components:n[o.id]??[]}),(0,Z.jsx)(c3,{})]}):(0,Z.jsx)(G1,{status:`empty`,title:Q(`eval.emptyTitle`),description:Q(`eval.emptyDescription`)}),(0,Z.jsx)(q1,{maxWidth:1e3,title:Q(`nav.eval`),lead:Q(`eval.pageLead`),children:c})}function u3(){let e=t3(e=>e.selectedRunId),t=t3(e=>e.selectRun),n=t3(e=>e.runs).map(e=>({key:e.id,label:e.id,meta:`${e.score.toFixed(2)} · ${e.gatePass?Q(`eval.gatePass`):Q(`eval.gateFail`)}`}));return(0,Z.jsx)(Q2,{header:Q(`eval.runsHeader`),items:n,selectedKey:e,onSelect:t})}var d3=[{key:`setup`,path:`/setup`,label:Q(`nav.setup`),icon:(0,Z.jsx)(MU,{}),Page:q4,Sidebar:Z4},{key:`sessions`,path:`/sessions`,label:Q(`nav.sessions`),icon:(0,Z.jsx)(MH,{}),Page:h1,Sidebar:L1},{key:`artifacts`,path:`/artifacts`,label:Q(`nav.artifacts`),icon:(0,Z.jsx)($V,{}),Page:T0,Sidebar:k0},{key:`context`,path:`/context`,label:Q(`nav.context`),icon:(0,Z.jsx)(FH,{}),Page:g2,Sidebar:b2},{key:`harness`,path:`/harness`,label:Q(`nav.harness`),icon:(0,Z.jsx)(RH,{}),Page:Z2,Sidebar:$2},{key:`eval`,path:`/eval`,label:Q(`nav.eval`),icon:(0,Z.jsx)(WH,{}),Page:l3,Sidebar:u3}].filter(e=>e.key!==`eval`||!1),f3=[],p3=`/sessions`;function m3(){let e=TR(e=>e.themeMode),t=TR(e=>e.toggleThemeMode),n=TR(e=>e.sidebarCollapsed),r=TR(e=>e.toggleSidebar),i=e===`dark`;return(0,Z.jsxs)(VA.Header,{style:{display:`flex`,alignItems:`center`,gap:16,paddingInline:16,borderBottom:`1px solid var(--ant-color-border-secondary)`,background:`var(--ant-color-bg-container)`},children:[(0,Z.jsx)(ZS,{placement:`bottom`,title:Q(n?`shell.expandSidebar`:`shell.collapseSidebar`),children:(0,Z.jsx)(ST,{type:`text`,"aria-label":Q(n?`shell.expandSidebar`:`shell.collapseSidebar`),icon:n?(0,Z.jsx)(cU,{}):(0,Z.jsx)(aU,{}),onClick:r})}),(0,Z.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},children:(0,Z.jsx)(`img`,{src:i?`/wrenai_logo_white.png`:`/wrenai_logo.png`,alt:Q(`shell.appName`),height:24})}),(0,Z.jsx)(`nav`,{"aria-label":`Primary`,style:{flex:1},children:(0,Z.jsx)(eA,{size:4,children:d3.map(e=>(0,Z.jsxs)(FV,{to:e.path,style:({isActive:e})=>({display:`inline-flex`,alignItems:`center`,gap:6,padding:`6px 12px`,borderRadius:6,fontSize:14,textDecoration:`none`,color:e?`var(--ant-color-primary)`:`var(--ant-color-text)`,background:e?`var(--ant-color-primary-bg)`:`transparent`}),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,style:{display:`inline-flex`},children:e.icon}),e.label]},e.key))})}),(0,Z.jsx)(ZS,{title:Q(i?`shell.themeToLight`:`shell.themeToDark`),children:(0,Z.jsx)(ST,{type:`text`,"aria-label":Q(i?`shell.themeToLight`:`shell.themeToDark`),icon:i?(0,Z.jsx)(mH,{}):(0,Z.jsx)(_H,{}),onClick:t})})]})}function h3(){let{pathname:e}=gB();return[...d3,...f3].sort((e,t)=>t.path.length-e.path.length).find(t=>e===t.path||e.startsWith(`${t.path}/`))}function g3(){let e=TR(e=>e.sidebarCollapsed),t=h3()?.Sidebar;return(0,Z.jsx)(VA.Sider,{"data-testid":`contextual-sidebar`,collapsible:!0,collapsed:e,collapsedWidth:0,trigger:null,width:248,theme:`light`,style:{background:`var(--ant-color-bg-container)`,borderRight:`1px solid var(--ant-color-border-secondary)`,overflow:`auto`},children:t?(0,Z.jsx)(t,{}):null})}function _3(){let e=h3()?.key===`sessions`;return(0,Z.jsxs)(VA,{style:{height:`100vh`},children:[(0,Z.jsx)(m3,{}),(0,Z.jsxs)(VA,{children:[(0,Z.jsx)(g3,{}),(0,Z.jsx)(VA.Content,{"data-testid":`app-content`,style:{overflow:e?`hidden`:`auto`,minHeight:0,background:e?`var(--ant-color-bg-container)`:`var(--ant-color-bg-layout)`},children:(0,Z.jsx)(KB,{})})]})]})}function v3({onSend:e,disabled:t}){let[n,r]=(0,v.useState)(``),i=()=>{let t=n.trim();t&&(e(t),r(``))};return(0,Z.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,Z.jsx)(MA,{"aria-label":Q(`ask.composerLabel`),placeholder:Q(`ask.composerPlaceholder`),value:n,onChange:e=>r(e.target.value),onPressEnter:i,disabled:t}),(0,Z.jsx)(ST,{type:`primary`,icon:(0,Z.jsx)(kU,{}),onClick:i,disabled:t||!n.trim(),children:Q(`ask.send`)})]})}function y3({event:e,saved:t,onSave:n,published:r,onPublish:i}){return(0,Z.jsx)(R1,{title:(0,Z.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:6},children:[(0,Z.jsx)($V,{"aria-hidden":`true`}),e.name]}),extra:(0,Z.jsxs)(`div`,{style:{display:`inline-flex`,gap:8},children:[(0,Z.jsx)(ST,{size:`small`,type:t?`default`:`primary`,icon:(0,Z.jsx)(EU,{}),disabled:t,onClick:n,children:Q(t?`ask.saved`:`ask.save`)}),void 0]}),children:(0,Z.jsx)(mR.Text,{type:`secondary`,children:e.location})})}function b3({event:e,onSelect:t,disabled:n}){return(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(mR.Paragraph,{style:{marginBottom:8},children:e.prompt}),(0,Z.jsx)(eA,{wrap:!0,children:e.chips.map((e,r)=>(0,Z.jsx)(ST,{size:`small`,disabled:n,onClick:()=>t(e),children:e},`${e}-${r}`))})]})}function x3({event:e}){return(0,Z.jsxs)(R1,{title:(0,Z.jsx)(V1,{state:`refused`}),children:[(0,Z.jsx)(mR.Paragraph,{style:{marginBottom:8},children:e.reason}),(0,Z.jsxs)(mR.Text,{type:`secondary`,children:[Q(`ask.refusalFixLabel`),`: `,e.fix]})]})}function S3({answer:e}){return(0,Z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:[e.dataAnswer&&(0,Z.jsx)(V1,{state:H1(e.verified)}),(0,Z.jsx)(mR.Paragraph,{style:{marginBottom:0,whiteSpace:`pre-wrap`},children:e.text})]})}function C3({event:e}){return(0,Z.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`},children:(0,Z.jsx)(`div`,{style:{maxWidth:`80%`,background:`var(--ant-color-primary-bg)`,borderRadius:12,padding:`8px 12px`},children:(0,Z.jsx)(mR.Text,{children:e.text})})})}function w3({events:e,onChipSelect:t,onSave:n,onPublish:r}){return(0,Z.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16},children:e.map((i,a)=>{switch(i.kind){case`user`:return(0,Z.jsx)(C3,{event:i},i.id);case`clarify`:{let n=a===e.length-1;return(0,Z.jsx)(v4,{children:(0,Z.jsx)(b3,{event:i,onSelect:t,disabled:!n})},i.id)}case`answer`:return(0,Z.jsx)(v4,{children:(0,Z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:[i.trace&&i.trace.length>0&&(0,Z.jsx)(D4,{steps:i.trace,title:Q(`ask.executionTrace`)}),i.answer.form===`rich`?(0,Z.jsx)(v0,{envelope:i.answer.envelope}):(0,Z.jsx)(S3,{answer:i.answer})]})},i.id);case`refusal`:return(0,Z.jsx)(v4,{children:(0,Z.jsx)(x3,{event:i})},i.id);case`artifact`:{let t=D1(e,i.artifactId),a=e.some(e=>e.kind===`published`&&e.artifactName===i.name);return(0,Z.jsx)(v4,{children:(0,Z.jsx)(y3,{event:i,saved:t,onSave:()=>n(i.id),published:a,onPublish:()=>r(i.id)})},i.id)}case`published`:return null;case`saved`:case`unsaved`:return null;default:return null}})})}function T3({sessionId:e}){let t=yB(),n=N1(t=>t.sessionsById[e]),r=N1(t=>t.streaming[e]??!1),i=N1(t=>t.streamError[e]),a=N1(e=>e.sendMessage),o=N1(e=>e.saveArtifact),s=N1(e=>e.publishArtifact),c=N1(e=>e.getOrCreate),l=N1(e=>e.clearDraft),u=N1(t=>e===`draft`?t.backendSessionId[O1]:void 0);(0,v.useEffect)(()=>{c(e)},[e,c]),(0,v.useEffect)(()=>{u&&(t(P1(u),{replace:!0}),l())},[u,t,l]);let d=n?.events??[],f=n?.workLog??[],p=(0,v.useMemo)(()=>[...d].reverse().find(e=>e.kind===`user`)?.text,[d]);return(0,Z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`},children:[(0,Z.jsx)(`div`,{style:{flex:1,overflow:`auto`},children:(0,Z.jsxs)(q1,{maxWidth:840,children:[d.length===0?(0,Z.jsx)(G1,{status:`empty`,title:Q(`ask.emptyTitle`),description:Q(`ask.emptyDescription`)}):(0,Z.jsx)(w3,{events:d,onChipSelect:t=>a(e,t),onSave:t=>o(e,t),onPublish:t=>s(e,t)}),r&&f.length===0&&(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,style:{display:`flex`,alignItems:`center`,gap:8,padding:`10px 12px`,color:`var(--ant-color-text-secondary)`},children:[(0,Z.jsx)(Md,{spin:!0,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:Q(`ask.turnPending`)})]}),r&&f.length>0&&(0,Z.jsx)(D4,{steps:f}),i&&(0,Z.jsx)(al,{type:`error`,showIcon:!0,message:Q(`ask.streamErrorTitle`),description:i,action:p?(0,Z.jsx)(ST,{type:`link`,size:`small`,onClick:()=>a(e,p),children:Q(`state.retry`)}):void 0})]})}),(0,Z.jsx)(`div`,{style:{maxWidth:840,margin:`0 auto`,width:`100%`,padding:`0 26px 16px`,boxSizing:`border-box`},children:(0,Z.jsx)(v3,{onSend:t=>a(e,t),disabled:r})})]})}function E3(){let{sessionId:e}=CB();return(0,Z.jsx)(T3,{sessionId:e??`draft`})}function D3(){let{sessionId:e}=CB();return(0,Z.jsx)(GB,{to:P1(e),replace:!0})}function O3(){return(0,Z.jsx)(YB,{children:(0,Z.jsxs)(qB,{element:(0,Z.jsx)(_3,{}),children:[(0,Z.jsx)(qB,{index:!0,element:(0,Z.jsx)(GB,{to:p3,replace:!0})}),d3.map(({key:e,path:t,Page:n})=>(0,Z.jsx)(qB,{path:t,element:(0,Z.jsx)(n,{})},e)),f3.map(({key:e,path:t,Page:n})=>(0,Z.jsx)(qB,{path:t,element:(0,Z.jsx)(n,{})},e)),(0,Z.jsx)(qB,{path:`/sessions/ask`,element:(0,Z.jsx)(E3,{})}),(0,Z.jsx)(qB,{path:`/sessions/ask/:sessionId`,element:(0,Z.jsx)(E3,{})}),(0,Z.jsx)(qB,{path:`/ask`,element:(0,Z.jsx)(D3,{})}),(0,Z.jsx)(qB,{path:`/ask/:sessionId`,element:(0,Z.jsx)(D3,{})}),(0,Z.jsx)(qB,{path:`/sessions/:id`,element:(0,Z.jsx)(h1,{})}),(0,Z.jsx)(qB,{path:`*`,element:(0,Z.jsx)(GB,{to:p3,replace:!0})})]})})}function k3(){return(0,Z.jsx)(NV,{children:(0,Z.jsx)(O3,{})})}var A3=document.getElementById(`root`);if(!A3)throw Error(`Root element #root not found`);(0,wt.createRoot)(A3).render((0,Z.jsx)(v.StrictMode,{children:(0,Z.jsx)(zR,{children:(0,Z.jsx)(k3,{})})}));export{s as t};
|
|
442
|
+
//# sourceMappingURL=index-DsH129tV.js.map
|