tower-studio 0.1.15 β 0.1.17
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/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +3 -3
- package/.next/cache/.previewinfo +1 -1
- package/.next/cache/.rscinfo +1 -1
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/diagnostics/route-bundle-stats.json +95 -95
- package/.next/fallback-build-manifest.json +3 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/_not-found/page/server-reference-manifest.json +23 -23
- package/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +14 -14
- package/.next/server/app/_not-found.segments/_full.segment.rsc +14 -14
- package/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
- package/.next/server/app/_not-found.segments/_index.segment.rsc +9 -9
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/internal/assistant/route.js +1 -1
- package/.next/server/app/api/internal/assistant/route.js.nft.json +1 -1
- package/.next/server/app/api/internal/terminal/[taskId]/start/route.js +2 -2
- package/.next/server/app/api/internal/terminal/[taskId]/start/route.js.nft.json +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +14 -14
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/index.segments/_full.segment.rsc +14 -14
- package/.next/server/app/index.segments/_head.segment.rsc +4 -4
- package/.next/server/app/index.segments/_index.segment.rsc +9 -9
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/missions/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/missions/page/server-reference-manifest.json +49 -49
- package/.next/server/app/missions/page.js +1 -1
- package/.next/server/app/missions/page.js.nft.json +1 -1
- package/.next/server/app/missions/page_client-reference-manifest.js +1 -1
- package/.next/server/app/onboarding/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/onboarding/page/server-reference-manifest.json +23 -23
- package/.next/server/app/onboarding/page.js.nft.json +1 -1
- package/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
- package/.next/server/app/onboarding.html +1 -1
- package/.next/server/app/onboarding.rsc +16 -16
- package/.next/server/app/onboarding.segments/_full.segment.rsc +16 -16
- package/.next/server/app/onboarding.segments/_head.segment.rsc +4 -4
- package/.next/server/app/onboarding.segments/_index.segment.rsc +9 -9
- package/.next/server/app/onboarding.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/onboarding.segments/onboarding/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/onboarding.segments/onboarding.segment.rsc +3 -3
- package/.next/server/app/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/page/server-reference-manifest.json +23 -23
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/settings/page/server-reference-manifest.json +56 -80
- package/.next/server/app/settings/page.js +1 -1
- package/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings.html +1 -1
- package/.next/server/app/settings.rsc +16 -16
- package/.next/server/app/settings.segments/_full.segment.rsc +16 -16
- package/.next/server/app/settings.segments/_head.segment.rsc +4 -4
- package/.next/server/app/settings.segments/_index.segment.rsc +9 -9
- package/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/settings.segments/settings.segment.rsc +3 -3
- package/.next/server/app/workspaces/[workspaceId]/archive/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/workspaces/[workspaceId]/archive/page/server-reference-manifest.json +77 -77
- package/.next/server/app/workspaces/[workspaceId]/archive/page.js.nft.json +1 -1
- package/.next/server/app/workspaces/[workspaceId]/archive/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspaces/[workspaceId]/assets/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/workspaces/[workspaceId]/assets/page/server-reference-manifest.json +64 -64
- package/.next/server/app/workspaces/[workspaceId]/assets/page.js.nft.json +1 -1
- package/.next/server/app/workspaces/[workspaceId]/assets/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspaces/[workspaceId]/notes/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/workspaces/[workspaceId]/notes/page/server-reference-manifest.json +61 -61
- package/.next/server/app/workspaces/[workspaceId]/notes/page.js.nft.json +1 -1
- package/.next/server/app/workspaces/[workspaceId]/notes/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspaces/[workspaceId]/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/workspaces/[workspaceId]/page/server-reference-manifest.json +51 -51
- package/.next/server/app/workspaces/[workspaceId]/page.js +1 -1
- package/.next/server/app/workspaces/[workspaceId]/page.js.nft.json +1 -1
- package/.next/server/app/workspaces/[workspaceId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/server-reference-manifest.json +23 -23
- package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page.js.nft.json +1 -1
- package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/server-reference-manifest.json +56 -56
- package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js +2 -2
- package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js.nft.json +1 -1
- package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspaces/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/workspaces/page/server-reference-manifest.json +43 -43
- package/.next/server/app/workspaces/page.js.nft.json +1 -1
- package/.next/server/app/workspaces/page_client-reference-manifest.js +1 -1
- package/.next/server/chunks/0uz~_next_dist_esm_build_templates_app-route_05yec2y.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__00~8_qz._.js +4 -0
- package/.next/server/chunks/[root-of-the-server]__05mc_xk._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0p5iuez._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__0rb-ear._.js +4 -0
- package/.next/server/chunks/project_f_tower_0n1s3ym._.js +1 -1
- package/.next/server/chunks/project_f_tower_src_11e.cv5._.js +1 -1
- package/.next/server/chunks/ssr/04uy_src_app_workspaces_[workspaceId]_tasks_[taskId]_task-page-client_tsx_01.s1p0._.js +1 -1
- package/.next/server/chunks/ssr/0y0r_f_tower_src_app_workspaces_[workspaceId]_assets_assets-page-client_tsx_0n4g3bn._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0-x7b4t._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__00.lowc._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__007tg36._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__025.0xa._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__04u4kb4._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__05a17ca._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__06qzctf._.js +1 -1
- package/.next/server/chunks/ssr/{[root-of-the-server]__0wkjslq._.js β [root-of-the-server]__08-2pn1._.js} +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0_47k-j._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0aidehy._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0ex911v._.js +30 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0ffdrwp._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0i4rk9v._.js +3 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0r6gkos._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0u26l~e._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0uca1bc._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0w7gbe7._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0xe-o3g._.js +1 -1
- package/.next/server/chunks/ssr/{[root-of-the-server]__0fb0m0v._.js β [root-of-the-server]__0z9azne._.js} +2 -2
- package/.next/server/chunks/ssr/[root-of-the-server]__0zaw-fl._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__13b2wve._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__13eo85g._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__13x5mmo._.js +1 -1
- package/.next/server/chunks/ssr/project_f_tower_0-wsdce._.js +3 -0
- package/.next/server/chunks/ssr/project_f_tower_0.nfmle._.js +3 -0
- package/.next/server/chunks/ssr/project_f_tower_0.txwd8._.js +1 -1
- package/.next/server/chunks/ssr/{project_f_tower_0u8bo7w._.js β project_f_tower_0ai4twk._.js} +2 -2
- package/.next/server/chunks/ssr/{project_f_tower_06z7x~2._.js β project_f_tower_0e3m009._.js} +2 -2
- package/.next/server/chunks/ssr/project_f_tower_0f0-wva._.js +1 -1
- package/.next/server/chunks/ssr/project_f_tower_0hgtev9._.js +1 -1
- package/.next/server/chunks/ssr/project_f_tower_0ivvjwd._.js +1 -1
- package/.next/server/chunks/ssr/{project_f_tower_0ntkd-l._.js β project_f_tower_0jhlcus._.js} +2 -2
- package/.next/server/chunks/ssr/project_f_tower_0jy~1uf._.js +1 -1
- package/.next/server/chunks/ssr/project_f_tower_0l6ssf8._.js +1 -1
- package/.next/server/chunks/ssr/project_f_tower_0o5.y1e._.js +1 -1
- package/.next/server/chunks/ssr/project_f_tower_0uu8dha._.js +3 -0
- package/.next/server/chunks/ssr/project_f_tower_0w01kgd._.js +3 -0
- package/.next/server/chunks/ssr/project_f_tower_0ym-aea._.js +1 -1
- package/.next/server/chunks/ssr/{project_f_tower_0qepwa~._.js β project_f_tower_0zqkh.-._.js} +2 -2
- package/.next/server/chunks/ssr/{project_f_tower_src_0w26c.x._.js β project_f_tower_src_03-54or._.js} +2 -2
- package/.next/server/chunks/ssr/project_f_tower_src_actions_agent-actions_ts_0.s4~m-._.js +2 -2
- package/.next/server/chunks/ssr/project_f_tower_src_actions_file-actions_ts_02i742t._.js +1 -1
- package/.next/server/chunks/ssr/project_f_tower_src_app_missions_missions-client_tsx_0ums4qx._.js +1 -1
- package/.next/server/chunks/ssr/project_f_tower_src_app_onboarding_page_tsx_0_9_yoq._.js +1 -1
- package/.next/server/chunks/ssr/project_f_tower_src_app_settings_page_tsx_0oo06~d._.js +1 -1
- package/.next/server/chunks/ssr/project_f_tower_src_app_workspaces_[workspaceId]_board-page-client_tsx_0jmj1xz._.js +1 -1
- package/.next/server/chunks/ssr/{project_f_tower_0u6dr5n._.js β project_f_tower_src_components_ui_input_tsx_02yu4ri._.js} +2 -2
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +231 -255
- package/.next/static/chunks/{09wk17shlbfp6.js β 037e47w8xw0vw.js} +1 -1
- package/.next/static/chunks/{0qz_w~ilkw07_.js β 083e56klgnjgy.js} +1 -1
- package/.next/static/chunks/0a8x8yl_kme06.js +1 -0
- package/.next/static/chunks/{0jz83jbb6_ldj.js β 0cqsk~mfhg.i5.js} +1 -1
- package/.next/static/chunks/{0gpckquc5j5cx.js β 0i_v_7f3gdmz4.js} +1 -1
- package/.next/static/chunks/0j.~gle~mn8uy.js +1 -0
- package/.next/static/chunks/{0_-rw81.wbmu..js β 0nyip_341~xyg.js} +2 -2
- package/.next/static/chunks/0rt2m4hy13qby.js +1 -0
- package/.next/static/chunks/0s4zpgzk~au6x.css +1 -0
- package/.next/static/chunks/{0qnz9q6uieuv8.js β 0sszltblb5pss.js} +1 -1
- package/.next/static/chunks/0x5iegao~6ge3.js +1 -0
- package/.next/static/chunks/{05_0-v~c00b__.js β 0x6gp.e04de4e.js} +1 -1
- package/.next/static/chunks/{12x6kubkc37zq.js β 0zz4ryeh6j~.x.js} +1 -1
- package/.next/static/chunks/{0n3o6vvrc4ks4.js β 110k271zgqb6h.js} +1 -1
- package/.next/static/chunks/{0nvuuwr.v3r4k.js β 125_gss3san00.js} +1 -1
- package/.next/static/chunks/12wq.0xcxup1q.js +1 -0
- package/.next/static/chunks/187llw593phxu.js +1 -0
- package/.next/trace +2 -2
- package/.next/trace-build +1 -1
- package/package.json +4 -2
- package/scripts/init-db.ts +0 -17
- package/.next/server/chunks/[root-of-the-server]__02~bq0q._.js +0 -4
- package/.next/server/chunks/[root-of-the-server]__0~33o~m._.js +0 -4
- package/.next/server/chunks/ssr/[root-of-the-server]__0fp7reb._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0fwuc5u._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0nmyvwk._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0y3o4rp._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__11j4k9o._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__13cjs8r._.js +0 -3
- package/.next/server/chunks/ssr/project_f_tower_04g3~44._.js +0 -30
- package/.next/server/chunks/ssr/project_f_tower_08d6__q._.js +0 -3
- package/.next/server/chunks/ssr/project_f_tower_0arf7nr._.js +0 -3
- package/.next/server/chunks/ssr/project_f_tower_135-_23._.js +0 -3
- package/.next/static/chunks/0-ggl6l3h5syr.js +0 -1
- package/.next/static/chunks/04pjsuj.mivbh.css +0 -1
- package/.next/static/chunks/05tpf5j-jft-k.js +0 -1
- package/.next/static/chunks/0_vexk9jnxj9q.js +0 -1
- package/.next/static/chunks/0h0m-v8uoeq~u.js +0 -1
- package/.next/static/chunks/0ynxf.i-o3-xn.js +0 -1
- package/.next/static/chunks/0zio-v5989p.b.js +0 -1
- /package/.next/static/{QCWJhjbC4McTn-0CAT1Gx β Gxj1QMzOqxH1St959O3yh}/_buildManifest.js +0 -0
- /package/.next/static/{QCWJhjbC4McTn-0CAT1Gx β Gxj1QMzOqxH1St959O3yh}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{QCWJhjbC4McTn-0CAT1Gx β Gxj1QMzOqxH1St959O3yh}/_ssgManifest.js +0 -0
|
@@ -80,4 +80,4 @@ out vec4 outColor;
|
|
|
80
80
|
|
|
81
81
|
void main() {
|
|
82
82
|
outColor = v_color;
|
|
83
|
-
}`,o0=8*Float32Array.BYTES_PER_ELEMENT,o1=class{constructor(){this.attributes=new Float32Array(160),this.count=0}},o5=0,o2=0,o3=0,o4=0,o6=0,o8=0,o7=0,o9=class extends np{constructor(e,i,s,r){super(),this._terminal=e,this._gl=i,this._dimensions=s,this._themeService=r,this._vertices=new o1,this._verticesCursor=new o1;let n=this._gl;this._program=n$(oz(n,oJ,oQ)),this._register(nf(()=>n.deleteProgram(this._program))),this._projectionLocation=n$(n.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=n.createVertexArray(),n.bindVertexArray(this._vertexArrayObject);let o=new Float32Array([0,0,1,0,0,1,1,1]),a=n.createBuffer();this._register(nf(()=>n.deleteBuffer(a))),n.bindBuffer(n.ARRAY_BUFFER,a),n.bufferData(n.ARRAY_BUFFER,o,n.STATIC_DRAW),n.enableVertexAttribArray(3),n.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let h=new Uint8Array([0,1,2,3]),l=n.createBuffer();this._register(nf(()=>n.deleteBuffer(l))),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,l),n.bufferData(n.ELEMENT_ARRAY_BUFFER,h,n.STATIC_DRAW),this._attributesBuffer=n$(n.createBuffer()),this._register(nf(()=>n.deleteBuffer(this._attributesBuffer))),n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.enableVertexAttribArray(0),n.vertexAttribPointer(0,2,n.FLOAT,!1,o0,0),n.vertexAttribDivisor(0,1),n.enableVertexAttribArray(1),n.vertexAttribPointer(1,2,n.FLOAT,!1,o0,2*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(1,1),n.enableVertexAttribArray(2),n.vertexAttribPointer(2,4,n.FLOAT,!1,o0,4*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(e=>{this._updateCachedColors(e),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let i=this._gl;i.useProgram(this._program),i.bindVertexArray(this._vertexArrayObject),i.uniformMatrix4fv(this._projectionLocation,!1,oF),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.bufferData(i.ARRAY_BUFFER,e.attributes,i.DYNAMIC_DRAW),i.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,i.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let i=this._terminal,s=this._vertices,r=1,n,o,a,h,l,c,d,_,u,f,g;for(n=0;n<i.rows;n++){for(a=-1,h=0,l=0,c=!1,o=0;o<i.cols;o++)d=(n*i.cols+o)*4,_=e.cells[d+1],f=!!(0x4000000&(u=e.cells[d+2])),(_!==h||u!==l&&(c||f))&&((0!==h||c&&0!==l)&&(g=8*r++,this._updateRectangle(s,g,l,h,a,o,n)),a=o,h=_,l=u,c=f);(0!==h||c&&0!==l)&&(g=8*r++,this._updateRectangle(s,g,l,h,a,i.cols,n))}s.count=r}updateCursor(e){let i=this._verticesCursor,s=e.cursor;if(!s||"block"===s.style){i.count=0;return}let r,n=0;("bar"===s.style||"outline"===s.style)&&(r=8*n++,this._addRectangleFloat(i.attributes,r,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,"bar"===s.style?s.dpr*s.cursorWidth:s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),("underline"===s.style||"outline"===s.style)&&(r=8*n++,this._addRectangleFloat(i.attributes,r,s.x*this._dimensions.device.cell.width,(s.y+1)*this._dimensions.device.cell.height-s.dpr,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat)),"outline"===s.style&&(r=8*n++,this._addRectangleFloat(i.attributes,r,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat),r=8*n++,this._addRectangleFloat(i.attributes,r,(s.x+s.width)*this._dimensions.device.cell.width-s.dpr,s.y*this._dimensions.device.cell.height,s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),i.count=n}_updateRectangle(e,i,s,r,n,o,a){if(0x4000000&s)switch(0x3000000&s){case 0x1000000:case 0x2000000:o5=this._themeService.colors.ansi[255&s].rgba;break;case 0x3000000:o5=(0xffffff&s)<<8;break;default:o5=this._themeService.colors.foreground.rgba}else switch(0x3000000&r){case 0x1000000:case 0x2000000:o5=this._themeService.colors.ansi[255&r].rgba;break;case 0x3000000:o5=(0xffffff&r)<<8;break;default:o5=this._themeService.colors.background.rgba}e.attributes.length<i+4&&(e.attributes=function(e,i){let s=new Float32Array(Math.min(2*e.length,i));for(let i=0;i<e.length;i++)s[i]=e[i];return s}(e.attributes,this._terminal.rows*this._terminal.cols*8)),o2=n*this._dimensions.device.cell.width,o3=a*this._dimensions.device.cell.height,o4=(o5>>24&255)/255,o6=(o5>>16&255)/255,o8=(o5>>8&255)/255,o7=1,this._addRectangle(e.attributes,i,o2,o3,(o-n)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,o4,o6,o8,o7)}_addRectangle(e,i,s,r,n,o,a,h,l,c){e[i]=s/this._dimensions.device.canvas.width,e[i+1]=r/this._dimensions.device.canvas.height,e[i+2]=n/this._dimensions.device.canvas.width,e[i+3]=o/this._dimensions.device.canvas.height,e[i+4]=a,e[i+5]=h,e[i+6]=l,e[i+7]=c}_addRectangleFloat(e,i,s,r,n,o,a){e[i]=s/this._dimensions.device.canvas.width,e[i+1]=r/this._dimensions.device.canvas.height,e[i+2]=n/this._dimensions.device.canvas.width,e[i+3]=o/this._dimensions.device.canvas.height,e[i+4]=a[0],e[i+5]=a[1],e[i+6]=a[2],e[i+7]=a[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(255&e.rgba)/255])}},ae=class extends np{constructor(e,i,s,r,n,o,a,h){super(),this._container=i,this._alpha=n,this._coreBrowserService=o,this._optionsService=a,this._themeService=h,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${s}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(i=>{this._refreshCharAtlas(e,i),this.reset(e)})),this._register(nf(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=n$(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,i,s){}handleSelectionChanged(e,i,s,r=!1){}_setTransparency(e,i){if(i===this._alpha)return;let s=this._canvas;this._alpha=i,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,s),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,i){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=oP(e,this._optionsService.rawOptions,i,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,i){this._deviceCellWidth=i.device.cell.width,this._deviceCellHeight=i.device.cell.height,this._deviceCharWidth=i.device.char.width,this._deviceCharHeight=i.device.char.height,this._deviceCharLeft=i.device.char.left,this._deviceCharTop=i.device.char.top,this._canvas.width=i.device.canvas.width,this._canvas.height=i.device.canvas.height,this._canvas.style.width=`${i.css.canvas.width}px`,this._canvas.style.height=`${i.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,i,s=1){this._ctx.fillRect(e*this._deviceCellWidth,(i+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,s*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,i,s,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,i*this._deviceCellHeight,s*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,i*this._deviceCellHeight,s*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,i,s,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=n4,this._clipCell(s,r,i.getWidth()),this._ctx.fillText(i.getChars(),s*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,i,s){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,i*this._deviceCellHeight,s*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,i,s){let r=i?e.options.fontWeightBold:e.options.fontWeight;return`${s?"italic":""} ${r} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},at=class extends ae{constructor(e,i,s,r,n,o,a){super(s,e,"link",i,!0,n,o,a),this._register(r.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(r.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}resize(e,i){super.resize(e,i),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){var i;if(257===e.fg?this._ctx.fillStyle=this._themeService.colors.background.css:void 0!==e.fg&&((0x3000000&(i=e.fg))==0x1000000||(0x3000000&i)==0x2000000)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let i=e.y1+1;i<e.y2;i++)this._fillBottomLineAtCells(0,i,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},ai="object"==typeof window?window:globalThis,as=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ok,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ok,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,i){if(this.getZoomLevel(i)===e)return;let s=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(s,e),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),e)}setFullscreen(e,i){if(this.isFullscreen(i)===e)return;let s=this.getWindowId(i);this.mapWindowIdToFullScreen.set(s,e),this._onDidChangeFullscreen.fire(s)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};as.INSTANCE=new as,as.INSTANCE.onDidChangeZoomLevel,as.INSTANCE.onDidChangeFullscreen;var ar="object"==typeof navigator?navigator.userAgent:"";ar.indexOf("Firefox"),ar.indexOf("AppleWebKit"),ar.indexOf("Chrome")>=0||ar.indexOf("Safari"),ar.indexOf("Electron/"),ar.indexOf("Android");var an=!1;if("function"==typeof ai.matchMedia){let e=ai.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),i=ai.matchMedia("(display-mode: fullscreen)");an=e.matches,ao=e,"string"==typeof ao&&(ao=ai.matchMedia(ao)),ao.addEventListener("change",({matches:e})=>{an&&i.matches||(an=e)})}var ao,aa,ah,al=!1,ac=!1,ad="en",a_=globalThis;"u">typeof a_.vscode&&"u">typeof a_.vscode.process?ah=a_.vscode.process:"u">typeof x.default&&"string"==typeof x.default?.versions?.node&&(ah=x.default);var au="string"==typeof ah?.versions?.electron&&ah?.type==="renderer";if("object"==typeof ah){ah.platform,ah.platform,"linux"===ah.platform&&ah.env.SNAP&&ah.env.SNAP_REVISION,ah.env.CI||ah.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ad="en";let e=ah.env.VSCODE_NLS_CONFIG;if(e)try{let i=JSON.parse(e);i.userLocale,i.osLocale,ad=i.resolvedLanguage||"en",i.languagePack?.translationsConfigFile}catch{}al=!0}else"object"!=typeof navigator||au?console.error("Unable to resolve platform."):((aa=navigator.userAgent).indexOf("Windows"),aa.indexOf("Macintosh"),(aa.indexOf("Macintosh")>=0||aa.indexOf("iPad")>=0||aa.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,aa.indexOf("Linux"),aa?.indexOf("Mobi"),ac=!0,ad=globalThis._VSCODE_NLS_LANGUAGE||"en",navigator.language.toLowerCase());var af=al;ac&&"function"==typeof a_.importScripts&&a_.origin;var ag,ap=aa,av=ad;(aL=ag||={}).value=function(){return av},aL.isDefaultVariant=function(){return 2===av.length?"en"===av:av.length>=3&&"e"===av[0]&&"n"===av[1]&&"-"===av[2]},aL.isDefault=function(){return"en"===av};var am="function"==typeof a_.postMessage&&!a_.importScripts,aS=(()=>{if(am){let e=[];a_.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.id===i.data.vscodeScheduleAsyncWork){e.splice(s,1),r.callback();return}}});let i=0;return s=>{let r=++i;e.push({id:r,callback:s}),a_.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})(),aw=!!(ap&&ap.indexOf("Chrome")>=0);ap&&ap.indexOf("Firefox"),!aw&&ap&&ap.indexOf("Safari"),ap&&ap.indexOf("Edg/"),ap&&ap.indexOf("Android");var ab="object"==typeof navigator?navigator:{};af||document.queryCommandSupported&&document.queryCommandSupported("copy")||ab&&ab.clipboard&&ab.clipboard.writeText,af||ab&&ab.clipboard&&ab.clipboard.readText,af||an||ab.keyboard,"ontouchstart"in ai||ab.maxTouchPoints,ai.PointerEvent&&("ontouchstart"in ai||navigator.maxTouchPoints);var aC=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,i){this._keyCodeToStr[e]=i,this._strToKeyCode[i.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},ay=new aC,ax=new aC,ak=new aC;(aM=aE||={}).toString=function(e){return ay.keyCodeToStr(e)},aM.fromString=function(e){return ay.strToKeyCode(e)},aM.toUserSettingsUS=function(e){return ax.keyCodeToStr(e)},aM.toUserSettingsGeneral=function(e){return ak.keyCodeToStr(e)},aM.fromUserSettings=function(e){return ax.strToKeyCode(e)||ak.strToKeyCode(e)},aM.toElectronAccelerator=function(e){if(e>=98&&e<=113)return null;switch(e){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return ay.keyCodeToStr(e)};var aL,aM,aE,aR,aB=Object.freeze(function(e,i){let s=setTimeout(e.bind(i),0);return{dispose(){clearTimeout(s)}}});(S=aR||={}).isCancellationToken=function(e){return e===S.None||e===S.Cancelled||e instanceof aD||!!e&&"object"==typeof e&&"boolean"==typeof e.isCancellationRequested&&"function"==typeof e.onCancellationRequested},S.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ov.None}),S.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:aB});var aD=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?aB:(this._emitter||(this._emitter=new ok),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};Symbol("MicrotaskDelay"),(w=b||={}).settled=async function(e){let i,s=await Promise.all(e.map(e=>e.then(e=>e,e=>{i||(i=e)})));if("u">typeof i)throw i;return s},w.withAsyncBody=function(e){return new Promise(async(i,s)=>{try{await e(i,s)}catch(e){s(e)}})};var aT=class e{static fromArray(i){return new e(e=>{e.emitMany(i)})}static fromPromise(i){return new e(async e=>{e.emitMany(await i)})}static fromPromises(i){return new e(async e=>{await Promise.all(i.map(async i=>e.emitOne(await i)))})}static merge(i){return new e(async e=>{await Promise.all(i.map(async i=>{for await(let s of i)e.emitOne(s)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new ok,queueMicrotask(async()=>{let i={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(i)),this.resolve()}catch(e){this.reject(e)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{for(;;){if(2===this._state)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(1===this._state)return{done:!0,value:void 0};await ov.toPromise(this._onStateChanged.event)}},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(i,s){return new e(async e=>{for await(let r of i)e.emitOne(s(r))})}map(i){return e.map(this,i)}static filter(i,s){return new e(async e=>{for await(let r of i)s(r)&&e.emitOne(r)})}filter(i){return e.filter(this,i)}static coalesce(i){return e.filter(i,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let i=[];for await(let s of e)i.push(s);return i}toPromise(){return e.toPromise(this)}emitOne(e){0===this._state&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){0===this._state&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){0===this._state&&(this._state=1,this._onStateChanged.fire())}reject(e){0===this._state&&(this._state=2,this._error=e,this._onStateChanged.fire())}};aT.EMPTY=aT.fromArray([]);function aA(e,i){return(i<<5)-i+e|0}function aP(e,i){i=aA(149417,i);for(let s=0,r=e.length;s<r;s++)i=aA(e.charCodeAt(s),i);return i}new DataView(new ArrayBuffer(320));var{registerWindow:aO,getWindow:aI,getDocument:aW,getWindows:aN,getWindowsCount:aF,getWindowId:az,getWindowById:aH,hasWindow:a$,onDidRegisterWindow:aU,onWillUnregisterWindow:aK,onDidUnregisterWindow:aq}=(f=new Map,g={window:ai,disposables:new ng},f.set(ai.vscodeWindowId,g),p=new ok,v=new ok,m=new ok,{onDidRegisterWindow:p.event,onWillUnregisterWindow:m.event,onDidUnregisterWindow:v.event,registerWindow(e){var i,s;if(f.has(e.vscodeWindowId))return np.None;let r=new ng,n={window:e,disposables:r.add(new ng)};return f.set(e.vscodeWindowId,n),r.add(nf(()=>{f.delete(e.vscodeWindowId),v.fire(e)})),r.add((i=e,s=aG.BEFORE_UNLOAD,new aV(i,s,()=>{m.fire(e)},void 0))),p.fire(n),r},getWindows:()=>f.values(),getWindowsCount:()=>f.size,getWindowId:e=>e.vscodeWindowId,hasWindow:e=>f.has(e),getWindowById:function(e,i){return("number"==typeof e?f.get(e):void 0)??(i?g:void 0)},getWindow:e=>e?.ownerDocument?.defaultView?e.ownerDocument.defaultView.window:e?.view?e.view.window:ai,getDocument:e=>aI(e).document}),aV=class{constructor(e,i,s,r){this._node=e,this._type=i,this._handler=s,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}},aY=class e{constructor(e,i){this.width=e,this.height=i}with(i=this.width,s=this.height){return i!==this.width||s!==this.height?new e(i,s):this}static is(e){return"object"==typeof e&&"number"==typeof e.height&&"number"==typeof e.width}static lift(i){return i instanceof e?i:new e(i.width,i.height)}static equals(e,i){return e===i||!!e&&!!i&&e.width===i.width&&e.height===i.height}};aY.None=new aY(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,i,s){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let n=function e(i,s){switch(typeof i){case"object":var r,n,o,a;return null===i?aA(349,s):Array.isArray(i)?(r=i,n=aA(104579,n=s),r.reduce((i,s)=>e(s,i),n)):(o=i,a=aA(181387,a=s),Object.keys(o).sort().reduce((i,s)=>(i=aP(s,i),e(o[s],i)),a));case"string":return aP(i,s);case"boolean":return aA(i?433:863,s);case"number":return aA(i,s);case"undefined":return aA(937,s);default:return aA(617,s)}}(s,0),o=r.get(n);if(o)o.users+=1;else{let a=new ok,h=new MutationObserver(e=>a.fire(e));h.observe(e,s);let l=o={users:1,observer:h,onDidMutate:a.event};i.add(nf(()=>{l.users-=1,0===l.users&&(a.dispose(),h.disconnect(),r?.delete(n),r?.size===0&&this.mutationObservers.delete(e))})),r.set(n,o)}return o.onDidMutate}};var aG={BEFORE_UNLOAD:"beforeunload"},aj=class extends np{constructor(e,i,s,r,n,o,a,h,l){if(super(),this._terminal=e,this._characterJoinerService=i,this._charSizeService=s,this._coreBrowserService=r,this._coreService=n,this._decorationService=o,this._optionsService=a,this._themeService=h,this._cursorBlinkStateManager=new nv,this._charAtlasDisposable=this._register(new nv),this._observerDisposable=this._register(new nv),this._model=new oZ,this._workCell=new oN,this._workCell2=new oN,this._rectangleRenderer=this._register(new nv),this._glyphRenderer=this._register(new nv),this._onChangeTextureAtlas=this._register(new ok),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ok),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ok),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new ok),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new ok),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._gl=this._canvas.getContext("webgl2",{antialias:!1,depth:!1,preserveDrawingBuffer:l}),!this._gl)throw Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new n3(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new at(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,a,this._themeService)],this.dimensions={css:{canvas:nq(),cell:nq()},device:{canvas:nq(),cell:nq(),char:{width:0,height:0,left:0,top:0}}},this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(a.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(function(e,i,s){return new aV(e,i,s,void 0)}(this._canvas,"webglcontextlost",e=>{console.log("webglcontextlost event received"),e.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(e)},3e3)})),this._register(function(e,i,s){return new aV(e,i,s,void 0)}(this._canvas,"webglcontextrestored",e=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,oO(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=oW(this._canvas,this._coreBrowserService.window,(e,i)=>this._setCanvasDevicePixelDimensions(e,i)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=oW(this._canvas,e,(e,i)=>this._setCanvasDevicePixelDimensions(e,i))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(nf(()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),oO(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,i){for(let e of(this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows),this._renderLayers))e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,i,s){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,i,s);this._model.selection.update(this._core,e,i,s),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new o9(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new oj(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=oP(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=nu(ov.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),ov.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){for(let e of(this._clearModel(!0),this._renderLayers))e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,i){if(!this._isAttached)if(!this._core.screenElement?.isConnected||!this._charSizeService.width||!this._charSizeService.height)return;else this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;for(let s of this._renderLayers)s.handleGridChanged(this._terminal,e,i);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,i),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new oI(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,i){let s=this._core,r=this._workCell,n,o,a,h,l,c,d=0,_=!0,u,f,g,p,v,m,S,w,b;e=aZ(e,s.rows-1,0),i=aZ(i,s.rows-1,0);let C=this._coreService.decPrivateModes.cursorStyle??s.options.cursorStyle??"block",y=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,x=y-s.buffer.ydisp,k=Math.min(this._terminal.buffer.active.cursorX,s.cols-1),L=-1,M=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let E=!1;for(o=e;o<=i;o++)for(a=o+s.buffer.ydisp,h=s.buffer.lines.get(a),this._model.lineLengths[o]=0,g=y===a,d=0,l=this._characterJoinerService.getJoinedCharacters(a),w=0;w<s.cols;w++){if(n=this._cellColorResolver.result.bg,h.loadCell(w,r),0===w&&(n=this._cellColorResolver.result.bg),c=!1,_=w>=d,u=w,l.length>0&&w===l[0][0]&&_){f=l.shift();let e=this._model.selection.isCellSelected(this._terminal,f[0],a);for(S=f[0]+1;S<f[1];S++)_&&=e===this._model.selection.isCellSelected(this._terminal,S,a);(_&&=!g||k<f[0]||k>=f[1])?(c=!0,r=new aX(r,h.translateToString(!0,f[0],f[1]),f[1]-f[0]),u=f[1]-1):d=f[1]}if(p=r.getChars(),v=r.getCode(),S=(o*s.cols+w)*4,this._cellColorResolver.resolve(r,w,a,this.dimensions.device.cell.width),M&&a===y&&(w===k&&(this._model.cursor={x:k,y:x,width:r.getWidth(),style:this._coreBrowserService.isFocused?C:s.options.cursorInactiveStyle,cursorWidth:s.options.cursorWidth,dpr:this._devicePixelRatio},L=k+r.getWidth()-1),w>=k&&w<=L&&(this._coreBrowserService.isFocused&&"block"===C||!1===this._coreBrowserService.isFocused&&"block"===s.options.cursorInactiveStyle)&&(this._cellColorResolver.result.fg=0x3000000|this._themeService.colors.cursorAccent.rgba>>8&0xffffff,this._cellColorResolver.result.bg=0x3000000|this._themeService.colors.cursor.rgba>>8&0xffffff)),0!==v&&(this._model.lineLengths[o]=w+1),(this._model.cells[S]!==v||this._model.cells[S+1]!==this._cellColorResolver.result.bg||this._model.cells[S+2]!==this._cellColorResolver.result.fg||this._model.cells[S+3]!==this._cellColorResolver.result.ext)&&(E=!0,p.length>1&&(v|=0x80000000),this._model.cells[S]=v,this._model.cells[S+1]=this._cellColorResolver.result.bg,this._model.cells[S+2]=this._cellColorResolver.result.fg,this._model.cells[S+3]=this._cellColorResolver.result.ext,m=r.getWidth(),this._glyphRenderer.value.updateCell(w,o,v,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,p,m,n),c)){for(r=this._workCell,w++;w<=u;w++)b=(o*s.cols+w)*4,this._glyphRenderer.value.updateCell(w,o,0,0,0,0,"",0,0),this._model.cells[b]=0,this._model.cells[b+1]=this._cellColorResolver.result.bg,this._model.cells[b+2]=this._cellColorResolver.result.fg,this._model.cells[b+3]=this._cellColorResolver.result.ext;w--}}E&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=1===this._optionsService.rawOptions.lineHeight?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,i){this._canvas.width===e&&this._canvas.height===i||(this._canvas.width=e,this._canvas.height=i,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},aX=class extends oc{constructor(e,i,s){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=i,this._width=s}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function aZ(e,i,s=0){return Math.max(Math.min(e,i),s)}var aJ="di$target",aQ="di$dependencies",a0=new Map;function a1(e){if(a0.has(e))return a0.get(e);let i=function(e,s,r){var n,o,a;if(3!=arguments.length)throw Error("@IServiceName-decorator can only be used to decorate a parameter");n=i,o=e,a=r,o[aJ]===o?o[aQ].push({id:n,index:a}):(o[aQ]=[{id:n,index:a}],o[aJ]=o)};return i._id=e,a0.set(e,i),i}a1("BufferService"),a1("CoreMouseService"),a1("CoreService"),a1("CharsetService"),a1("InstantiationService"),a1("LogService");var a5=a1("OptionsService");a1("OscLinkService"),a1("UnicodeService"),a1("DecorationService");var a2={trace:0,debug:1,info:2,warn:3,error:4,off:5},a3=class extends np{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=a2[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)"function"==typeof e[i]&&(e[i]=e[i]())}_log(e,i,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+i,...s)}trace(e,...i){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,i)}debug(e,...i){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,i)}info(e,...i){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,i)}warn(e,...i){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,i)}error(e,...i){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,i)}};a3=((e,i,s,r)=>{for(var n,o=r>1?void 0:r?ns(i,s):i,a=e.length-1;a>=0;a--)(n=e[a])&&(o=(r?n(i,s,o):n(o))||o);return r&&o&&ni(i,s,o),o})([(e,i)=>a5(e,i,0)],a3);var a4=class extends np{constructor(e){if(ny&&16>function(){if(!ny)return 0;let e=nS.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1])}()&&!document.createElement("canvas").getContext("webgl2",{antialias:!1,depth:!1,preserveDrawingBuffer:!0}))throw Error("Webgl2 is only supported on Safari 16 and above");super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new ok),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ok),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ok),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new ok),this.onContextLoss=this._onContextLoss.event}activate(e){let i=e._core;if(!e.element)return void this._register(i.onWillOpen(()=>this.activate(e)));this._terminal=e;let s=i.coreService,r=i.optionsService,n=i._renderService,o=i._characterJoinerService,a=i._charSizeService,h=i._coreBrowserService,l=i._decorationService,c=i._logService,d=i._themeService;this._renderer=this._register(new aj(e,o,a,h,s,l,r,d,this._preserveDrawingBuffer)),this._register(ov.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(ov.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(ov.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(ov.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this._register(nf(()=>{if(this._terminal._core._store._isDisposed)return;let i=this._terminal._core._renderService;i.setRenderer(this._terminal._core._createRenderer()),i.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}},a6=class{constructor(e,i,s,r={}){this._terminal=e,this._regex=i,this._handler=s,this._options=r}provideLinks(e,i){let s=a8.computeLink(e,this._regex,this._terminal,this._handler);i(this._addCallbacks(s))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(i,s)=>{if(this._options.hover){let{range:r}=e;this._options.hover(i,s,r)}},e))}},a8=class e{static computeLink(i,s,r,n){let o=RegExp(s.source,(s.flags||"")+"g"),[a,h]=e._getWindowedLineStrings(i-1,r),l=a.join(""),c,d=[];for(;c=o.exec(l);){let i=c[0];if(!function(e){try{let i=new URL(e),s=i.password&&i.username?`${i.protocol}//${i.username}:${i.password}@${i.host}`:i.username?`${i.protocol}//${i.username}@${i.host}`:`${i.protocol}//${i.host}`;return e.toLocaleLowerCase().startsWith(s.toLocaleLowerCase())}catch{return!1}}(i))continue;let[s,o]=e._mapStrIdx(r,h,0,c.index),[a,l]=e._mapStrIdx(r,s,o,i.length);if(-1===s||-1===o||-1===a||-1===l)continue;let _={start:{x:o+1,y:s+1},end:{x:l,y:a+1}};d.push({range:_,text:i,activate:n})}return d}static _getWindowedLineStrings(e,i){let s,r=e,n=e,o=0,a="",h=[];if(s=i.buffer.active.getLine(e)){let e=s.translateToString(!0);if(s.isWrapped&&" "!==e[0]){for(o=0;(s=i.buffer.active.getLine(--r))&&o<2048&&(o+=(a=s.translateToString(!0)).length,h.push(a),!(!s.isWrapped||-1!==a.indexOf(" "))););h.reverse()}for(h.push(e),o=0;(s=i.buffer.active.getLine(++n))&&s.isWrapped&&o<2048&&(o+=(a=s.translateToString(!0)).length,h.push(a),-1===a.indexOf(" ")););}return[h,r]}static _mapStrIdx(e,i,s,r){let n=e.buffer.active,o=n.getNullCell(),a=s;for(;r;){let e=n.getLine(i);if(!e)return[-1,-1];for(let s=a;s<e.length;++s){e.getCell(s,o);let a=o.getChars();if(o.getWidth()&&(r-=a.length||1,s===e.length-1&&""===a)){let e=n.getLine(i+1);e&&e.isWrapped&&(e.getCell(0,o),2===o.getWidth()&&(r+=1))}if(r<0)return[i,s]}i++,a=0}return[i,a]}},a7=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function a9(e,i){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}var he=class{constructor(e=a9,i={}){this._handler=e,this._options=i}activate(e){this._terminal=e;let i=this._options,s=i.urlRegex||a7;this._linkProvider=this._terminal.registerLinkProvider(new a6(this._terminal,s,this._handler,i))}dispose(){this._linkProvider?.dispose()}},ht=e.i(275283);let hi=/(?:\.\.?\/|[a-zA-Z0-9_@][a-zA-Z0-9_\-.]*\/)[a-zA-Z0-9_\-.\/@]+\.\w+/g,hs=/^(?::(\d+)(?::(\d+))?|\((\d+)(?:,\s*(\d+))?\)|\[(\d+)(?:,\s*(\d+))?\])/;class hr{terminal;worktreePath;onFileOpen;constructor(e,i,s){this.terminal=e,this.worktreePath=i,this.onFileOpen=s}provideLinks(e,i){let s=this.terminal.buffer.active.getLine(e);if(!s)return i(void 0);let r=s.translateToString(),n=function(e){let i,s=[];for(hi.lastIndex=0;null!==(i=hi.exec(e));){let r,n,o=i[0],a=i.index,h=e.slice(a+o.length).match(hs),l=o.length;if(h&&0===h.index){l+=h[0].length;let e=h[1]??h[3]??h[5],i=h[2]??h[4]??h[6];r=e?parseInt(e,10):void 0,n=i?parseInt(i,10):void 0}s.push({path:o,startIndex:a,totalLength:l,line:r,col:n})}return s}(r);if(0===n.length)return i(void 0);i(n.map(i=>({range:{start:{x:i.startIndex+1,y:e},end:{x:i.startIndex+i.totalLength+1,y:e}},text:r.slice(i.startIndex,i.startIndex+i.totalLength),activate:()=>{this.onFileOpen(`${this.worktreePath}/${i.path}`,i.line,i.col)}})))}}var hn=e.i(625054),ho=e.i(370951);e.s(["TaskTerminal",0,function({taskId:e,worktreePath:i,onSessionEnd:s,onFileOpen:r,useCanvasRenderer:n=!1}){let{t:o}=(0,hn.useI18n)(),{resolvedTheme:a}=(0,ht.useTheme)(),h=(0,y.useRef)(null),l=(0,y.useRef)(null),c=(0,y.useRef)(null),d=(0,y.useRef)(null),_=(0,y.useRef)(s);_.current=s;let u=(0,y.useRef)(r);u.current=r;let[f,g]=(0,y.useState)("connecting"),[p,v]=(0,y.useState)(!1);if((0,y.useEffect)(()=>{if(!i||!h.current)return;let s=new ne({fontFamily:"Menlo, Monaco, 'Courier New', monospace",fontSize:13,scrollback:5e3,cursorBlink:!0,allowTransparency:!1,theme:"light"!==a?{background:"#0a0a0a",foreground:"#e5e5e5"}:{background:"#fafafa",foreground:"#171717"}}),r=new nt;s.loadAddon(r),s.open(h.current);let o=null;if(!n)try{(o=new a4).onContextLoss(()=>{o?.dispose(),o=null}),s.loadAddon(o)}catch{}let f=new he((e,i)=>{window.open(i,"_blank")});s.loadAddon(f),i&&s.registerLinkProvider(new hr(s,i,(e,i,s)=>{u.current?.(e,i,s)})),r.fit(),s.focus();let p=null,m=null,S=!1,w=null,b=!1;return(0,ho.getActualWsPort)().then(i=>{S||function i(r){if(S||b)return;g("connecting");let n=new WebSocket(`ws://localhost:${r}/terminal?taskId=${encodeURIComponent(e)}`);p=n,n.addEventListener("open",()=>{n.send(JSON.stringify({type:"resize",cols:s.cols,rows:s.rows})),s.focus(),g("connected"),v(!0),setTimeout(()=>v(!1),2e3)}),n.addEventListener("message",e=>{let i=e.data;"string"==typeof i?s.write(i):i instanceof Blob?i.text().then(e=>s.write(e)):i instanceof ArrayBuffer&&s.write(new Uint8Array(i))}),m?.dispose(),m=s.onData(e=>{n.readyState===WebSocket.OPEN&&n.send(e)}),n.addEventListener("close",e=>{if(e.code>=4e3){b=!0,g("disconnected"),_.current?.(e.code-4e3);return}g("disconnected"),S||b||(w=setTimeout(()=>i(r),3e3))}),n.addEventListener("error",()=>{}),c.current=n}(i)}),l.current=s,d.current=r,()=>{S=!0,w&&clearTimeout(w),m?.dispose(),f.dispose(),o?.dispose(),r.dispose(),s.dispose(),p?.close(),l.current=null,c.current=null,d.current=null}},[e,i]),(0,y.useEffect)(()=>{if(!i||!h.current)return;let e=d.current,s=c.current,r=l.current;e&&r&&requestAnimationFrame(()=>{e.fit(),s?.readyState===WebSocket.OPEN&&s.send(JSON.stringify({type:"resize",cols:r.cols,rows:r.rows}))});let n=null,o=h.current,a=new ResizeObserver(()=>{n&&clearTimeout(n),n=setTimeout(()=>{let e=d.current,i=c.current,s=l.current;e&&s&&(e.fit(),i?.readyState===WebSocket.OPEN&&i.send(JSON.stringify({type:"resize",cols:s.cols,rows:s.rows})))},100)});return a.observe(o),()=>{n&&clearTimeout(n),a.disconnect()}},[e,i]),(0,y.useEffect)(()=>{let e=l.current;if(!e)return;let i="light"!==a;e.options.theme=i?{background:"#0a0a0a",foreground:"#e5e5e5"}:{background:"#fafafa",foreground:"#171717"}},[a]),!i)return(0,C.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center bg-[#0a0a0a] text-center",children:[(0,C.jsx)("p",{className:"text-sm text-neutral-400",children:o("terminal.noWorktree")}),(0,C.jsx)("p",{className:"text-xs text-neutral-600 mt-1",children:o("terminal.noWorktreeDesc")})]});let m=o("connected"===f?"terminal.connected":"connecting"===f?"terminal.connecting":"terminal.disconnected");return(0,C.jsxs)("div",{className:"relative h-full w-full bg-[#0a0a0a]",children:[(0,C.jsxs)("div",{className:["absolute right-3 top-3 z-10 flex items-center gap-1.5 rounded px-2 py-0.5 text-xs transition-opacity duration-500","connected"===f&&!p?"opacity-0 pointer-events-none":"opacity-100","bg-black/40 backdrop-blur-sm"].join(" "),title:m,children:[(0,C.jsx)("span",{className:`h-2 w-2 rounded-full ${"connected"===f?"bg-green-500":"connecting"===f?"bg-yellow-500":"bg-red-500"}`}),(0,C.jsx)("span",{className:"text-neutral-300",children:m})]}),(0,C.jsx)("div",{ref:h,className:"h-full w-full overflow-hidden"})]})}],714062)},467005,e=>{e.n(e.i(714062))}]);
|
|
83
|
+
}`,o0=8*Float32Array.BYTES_PER_ELEMENT,o1=class{constructor(){this.attributes=new Float32Array(160),this.count=0}},o5=0,o2=0,o3=0,o4=0,o6=0,o8=0,o7=0,o9=class extends np{constructor(e,i,s,r){super(),this._terminal=e,this._gl=i,this._dimensions=s,this._themeService=r,this._vertices=new o1,this._verticesCursor=new o1;let n=this._gl;this._program=n$(oz(n,oJ,oQ)),this._register(nf(()=>n.deleteProgram(this._program))),this._projectionLocation=n$(n.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=n.createVertexArray(),n.bindVertexArray(this._vertexArrayObject);let o=new Float32Array([0,0,1,0,0,1,1,1]),a=n.createBuffer();this._register(nf(()=>n.deleteBuffer(a))),n.bindBuffer(n.ARRAY_BUFFER,a),n.bufferData(n.ARRAY_BUFFER,o,n.STATIC_DRAW),n.enableVertexAttribArray(3),n.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let h=new Uint8Array([0,1,2,3]),l=n.createBuffer();this._register(nf(()=>n.deleteBuffer(l))),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,l),n.bufferData(n.ELEMENT_ARRAY_BUFFER,h,n.STATIC_DRAW),this._attributesBuffer=n$(n.createBuffer()),this._register(nf(()=>n.deleteBuffer(this._attributesBuffer))),n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.enableVertexAttribArray(0),n.vertexAttribPointer(0,2,n.FLOAT,!1,o0,0),n.vertexAttribDivisor(0,1),n.enableVertexAttribArray(1),n.vertexAttribPointer(1,2,n.FLOAT,!1,o0,2*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(1,1),n.enableVertexAttribArray(2),n.vertexAttribPointer(2,4,n.FLOAT,!1,o0,4*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(e=>{this._updateCachedColors(e),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let i=this._gl;i.useProgram(this._program),i.bindVertexArray(this._vertexArrayObject),i.uniformMatrix4fv(this._projectionLocation,!1,oF),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.bufferData(i.ARRAY_BUFFER,e.attributes,i.DYNAMIC_DRAW),i.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,i.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let i=this._terminal,s=this._vertices,r=1,n,o,a,h,l,c,d,_,u,f,g;for(n=0;n<i.rows;n++){for(a=-1,h=0,l=0,c=!1,o=0;o<i.cols;o++)d=(n*i.cols+o)*4,_=e.cells[d+1],f=!!(0x4000000&(u=e.cells[d+2])),(_!==h||u!==l&&(c||f))&&((0!==h||c&&0!==l)&&(g=8*r++,this._updateRectangle(s,g,l,h,a,o,n)),a=o,h=_,l=u,c=f);(0!==h||c&&0!==l)&&(g=8*r++,this._updateRectangle(s,g,l,h,a,i.cols,n))}s.count=r}updateCursor(e){let i=this._verticesCursor,s=e.cursor;if(!s||"block"===s.style){i.count=0;return}let r,n=0;("bar"===s.style||"outline"===s.style)&&(r=8*n++,this._addRectangleFloat(i.attributes,r,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,"bar"===s.style?s.dpr*s.cursorWidth:s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),("underline"===s.style||"outline"===s.style)&&(r=8*n++,this._addRectangleFloat(i.attributes,r,s.x*this._dimensions.device.cell.width,(s.y+1)*this._dimensions.device.cell.height-s.dpr,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat)),"outline"===s.style&&(r=8*n++,this._addRectangleFloat(i.attributes,r,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat),r=8*n++,this._addRectangleFloat(i.attributes,r,(s.x+s.width)*this._dimensions.device.cell.width-s.dpr,s.y*this._dimensions.device.cell.height,s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),i.count=n}_updateRectangle(e,i,s,r,n,o,a){if(0x4000000&s)switch(0x3000000&s){case 0x1000000:case 0x2000000:o5=this._themeService.colors.ansi[255&s].rgba;break;case 0x3000000:o5=(0xffffff&s)<<8;break;default:o5=this._themeService.colors.foreground.rgba}else switch(0x3000000&r){case 0x1000000:case 0x2000000:o5=this._themeService.colors.ansi[255&r].rgba;break;case 0x3000000:o5=(0xffffff&r)<<8;break;default:o5=this._themeService.colors.background.rgba}e.attributes.length<i+4&&(e.attributes=function(e,i){let s=new Float32Array(Math.min(2*e.length,i));for(let i=0;i<e.length;i++)s[i]=e[i];return s}(e.attributes,this._terminal.rows*this._terminal.cols*8)),o2=n*this._dimensions.device.cell.width,o3=a*this._dimensions.device.cell.height,o4=(o5>>24&255)/255,o6=(o5>>16&255)/255,o8=(o5>>8&255)/255,o7=1,this._addRectangle(e.attributes,i,o2,o3,(o-n)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,o4,o6,o8,o7)}_addRectangle(e,i,s,r,n,o,a,h,l,c){e[i]=s/this._dimensions.device.canvas.width,e[i+1]=r/this._dimensions.device.canvas.height,e[i+2]=n/this._dimensions.device.canvas.width,e[i+3]=o/this._dimensions.device.canvas.height,e[i+4]=a,e[i+5]=h,e[i+6]=l,e[i+7]=c}_addRectangleFloat(e,i,s,r,n,o,a){e[i]=s/this._dimensions.device.canvas.width,e[i+1]=r/this._dimensions.device.canvas.height,e[i+2]=n/this._dimensions.device.canvas.width,e[i+3]=o/this._dimensions.device.canvas.height,e[i+4]=a[0],e[i+5]=a[1],e[i+6]=a[2],e[i+7]=a[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(255&e.rgba)/255])}},ae=class extends np{constructor(e,i,s,r,n,o,a,h){super(),this._container=i,this._alpha=n,this._coreBrowserService=o,this._optionsService=a,this._themeService=h,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${s}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(i=>{this._refreshCharAtlas(e,i),this.reset(e)})),this._register(nf(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=n$(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,i,s){}handleSelectionChanged(e,i,s,r=!1){}_setTransparency(e,i){if(i===this._alpha)return;let s=this._canvas;this._alpha=i,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,s),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,i){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=oP(e,this._optionsService.rawOptions,i,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,i){this._deviceCellWidth=i.device.cell.width,this._deviceCellHeight=i.device.cell.height,this._deviceCharWidth=i.device.char.width,this._deviceCharHeight=i.device.char.height,this._deviceCharLeft=i.device.char.left,this._deviceCharTop=i.device.char.top,this._canvas.width=i.device.canvas.width,this._canvas.height=i.device.canvas.height,this._canvas.style.width=`${i.css.canvas.width}px`,this._canvas.style.height=`${i.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,i,s=1){this._ctx.fillRect(e*this._deviceCellWidth,(i+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,s*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,i,s,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,i*this._deviceCellHeight,s*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,i*this._deviceCellHeight,s*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,i,s,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=n4,this._clipCell(s,r,i.getWidth()),this._ctx.fillText(i.getChars(),s*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,i,s){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,i*this._deviceCellHeight,s*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,i,s){let r=i?e.options.fontWeightBold:e.options.fontWeight;return`${s?"italic":""} ${r} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},at=class extends ae{constructor(e,i,s,r,n,o,a){super(s,e,"link",i,!0,n,o,a),this._register(r.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(r.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}resize(e,i){super.resize(e,i),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){var i;if(257===e.fg?this._ctx.fillStyle=this._themeService.colors.background.css:void 0!==e.fg&&((0x3000000&(i=e.fg))==0x1000000||(0x3000000&i)==0x2000000)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let i=e.y1+1;i<e.y2;i++)this._fillBottomLineAtCells(0,i,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},ai="object"==typeof window?window:globalThis,as=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ok,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ok,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,i){if(this.getZoomLevel(i)===e)return;let s=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(s,e),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),e)}setFullscreen(e,i){if(this.isFullscreen(i)===e)return;let s=this.getWindowId(i);this.mapWindowIdToFullScreen.set(s,e),this._onDidChangeFullscreen.fire(s)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};as.INSTANCE=new as,as.INSTANCE.onDidChangeZoomLevel,as.INSTANCE.onDidChangeFullscreen;var ar="object"==typeof navigator?navigator.userAgent:"";ar.indexOf("Firefox"),ar.indexOf("AppleWebKit"),ar.indexOf("Chrome")>=0||ar.indexOf("Safari"),ar.indexOf("Electron/"),ar.indexOf("Android");var an=!1;if("function"==typeof ai.matchMedia){let e=ai.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),i=ai.matchMedia("(display-mode: fullscreen)");an=e.matches,ao=e,"string"==typeof ao&&(ao=ai.matchMedia(ao)),ao.addEventListener("change",({matches:e})=>{an&&i.matches||(an=e)})}var ao,aa,ah,al=!1,ac=!1,ad="en",a_=globalThis;"u">typeof a_.vscode&&"u">typeof a_.vscode.process?ah=a_.vscode.process:"u">typeof x.default&&"string"==typeof x.default?.versions?.node&&(ah=x.default);var au="string"==typeof ah?.versions?.electron&&ah?.type==="renderer";if("object"==typeof ah){ah.platform,ah.platform,"linux"===ah.platform&&ah.env.SNAP&&ah.env.SNAP_REVISION,ah.env.CI||ah.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ad="en";let e=ah.env.VSCODE_NLS_CONFIG;if(e)try{let i=JSON.parse(e);i.userLocale,i.osLocale,ad=i.resolvedLanguage||"en",i.languagePack?.translationsConfigFile}catch{}al=!0}else"object"!=typeof navigator||au?console.error("Unable to resolve platform."):((aa=navigator.userAgent).indexOf("Windows"),aa.indexOf("Macintosh"),(aa.indexOf("Macintosh")>=0||aa.indexOf("iPad")>=0||aa.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,aa.indexOf("Linux"),aa?.indexOf("Mobi"),ac=!0,ad=globalThis._VSCODE_NLS_LANGUAGE||"en",navigator.language.toLowerCase());var af=al;ac&&"function"==typeof a_.importScripts&&a_.origin;var ag,ap=aa,av=ad;(aL=ag||={}).value=function(){return av},aL.isDefaultVariant=function(){return 2===av.length?"en"===av:av.length>=3&&"e"===av[0]&&"n"===av[1]&&"-"===av[2]},aL.isDefault=function(){return"en"===av};var am="function"==typeof a_.postMessage&&!a_.importScripts,aS=(()=>{if(am){let e=[];a_.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.id===i.data.vscodeScheduleAsyncWork){e.splice(s,1),r.callback();return}}});let i=0;return s=>{let r=++i;e.push({id:r,callback:s}),a_.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})(),aw=!!(ap&&ap.indexOf("Chrome")>=0);ap&&ap.indexOf("Firefox"),!aw&&ap&&ap.indexOf("Safari"),ap&&ap.indexOf("Edg/"),ap&&ap.indexOf("Android");var ab="object"==typeof navigator?navigator:{};af||document.queryCommandSupported&&document.queryCommandSupported("copy")||ab&&ab.clipboard&&ab.clipboard.writeText,af||ab&&ab.clipboard&&ab.clipboard.readText,af||an||ab.keyboard,"ontouchstart"in ai||ab.maxTouchPoints,ai.PointerEvent&&("ontouchstart"in ai||navigator.maxTouchPoints);var aC=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,i){this._keyCodeToStr[e]=i,this._strToKeyCode[i.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},ay=new aC,ax=new aC,ak=new aC;(aM=aE||={}).toString=function(e){return ay.keyCodeToStr(e)},aM.fromString=function(e){return ay.strToKeyCode(e)},aM.toUserSettingsUS=function(e){return ax.keyCodeToStr(e)},aM.toUserSettingsGeneral=function(e){return ak.keyCodeToStr(e)},aM.fromUserSettings=function(e){return ax.strToKeyCode(e)||ak.strToKeyCode(e)},aM.toElectronAccelerator=function(e){if(e>=98&&e<=113)return null;switch(e){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return ay.keyCodeToStr(e)};var aL,aM,aE,aR,aB=Object.freeze(function(e,i){let s=setTimeout(e.bind(i),0);return{dispose(){clearTimeout(s)}}});(S=aR||={}).isCancellationToken=function(e){return e===S.None||e===S.Cancelled||e instanceof aD||!!e&&"object"==typeof e&&"boolean"==typeof e.isCancellationRequested&&"function"==typeof e.onCancellationRequested},S.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ov.None}),S.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:aB});var aD=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?aB:(this._emitter||(this._emitter=new ok),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};Symbol("MicrotaskDelay"),(w=b||={}).settled=async function(e){let i,s=await Promise.all(e.map(e=>e.then(e=>e,e=>{i||(i=e)})));if("u">typeof i)throw i;return s},w.withAsyncBody=function(e){return new Promise(async(i,s)=>{try{await e(i,s)}catch(e){s(e)}})};var aT=class e{static fromArray(i){return new e(e=>{e.emitMany(i)})}static fromPromise(i){return new e(async e=>{e.emitMany(await i)})}static fromPromises(i){return new e(async e=>{await Promise.all(i.map(async i=>e.emitOne(await i)))})}static merge(i){return new e(async e=>{await Promise.all(i.map(async i=>{for await(let s of i)e.emitOne(s)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new ok,queueMicrotask(async()=>{let i={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(i)),this.resolve()}catch(e){this.reject(e)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{for(;;){if(2===this._state)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(1===this._state)return{done:!0,value:void 0};await ov.toPromise(this._onStateChanged.event)}},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(i,s){return new e(async e=>{for await(let r of i)e.emitOne(s(r))})}map(i){return e.map(this,i)}static filter(i,s){return new e(async e=>{for await(let r of i)s(r)&&e.emitOne(r)})}filter(i){return e.filter(this,i)}static coalesce(i){return e.filter(i,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let i=[];for await(let s of e)i.push(s);return i}toPromise(){return e.toPromise(this)}emitOne(e){0===this._state&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){0===this._state&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){0===this._state&&(this._state=1,this._onStateChanged.fire())}reject(e){0===this._state&&(this._state=2,this._error=e,this._onStateChanged.fire())}};aT.EMPTY=aT.fromArray([]);function aA(e,i){return(i<<5)-i+e|0}function aP(e,i){i=aA(149417,i);for(let s=0,r=e.length;s<r;s++)i=aA(e.charCodeAt(s),i);return i}new DataView(new ArrayBuffer(320));var{registerWindow:aO,getWindow:aI,getDocument:aW,getWindows:aN,getWindowsCount:aF,getWindowId:az,getWindowById:aH,hasWindow:a$,onDidRegisterWindow:aU,onWillUnregisterWindow:aK,onDidUnregisterWindow:aq}=(f=new Map,g={window:ai,disposables:new ng},f.set(ai.vscodeWindowId,g),p=new ok,v=new ok,m=new ok,{onDidRegisterWindow:p.event,onWillUnregisterWindow:m.event,onDidUnregisterWindow:v.event,registerWindow(e){var i,s;if(f.has(e.vscodeWindowId))return np.None;let r=new ng,n={window:e,disposables:r.add(new ng)};return f.set(e.vscodeWindowId,n),r.add(nf(()=>{f.delete(e.vscodeWindowId),v.fire(e)})),r.add((i=e,s=aG.BEFORE_UNLOAD,new aV(i,s,()=>{m.fire(e)},void 0))),p.fire(n),r},getWindows:()=>f.values(),getWindowsCount:()=>f.size,getWindowId:e=>e.vscodeWindowId,hasWindow:e=>f.has(e),getWindowById:function(e,i){return("number"==typeof e?f.get(e):void 0)??(i?g:void 0)},getWindow:e=>e?.ownerDocument?.defaultView?e.ownerDocument.defaultView.window:e?.view?e.view.window:ai,getDocument:e=>aI(e).document}),aV=class{constructor(e,i,s,r){this._node=e,this._type=i,this._handler=s,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}},aY=class e{constructor(e,i){this.width=e,this.height=i}with(i=this.width,s=this.height){return i!==this.width||s!==this.height?new e(i,s):this}static is(e){return"object"==typeof e&&"number"==typeof e.height&&"number"==typeof e.width}static lift(i){return i instanceof e?i:new e(i.width,i.height)}static equals(e,i){return e===i||!!e&&!!i&&e.width===i.width&&e.height===i.height}};aY.None=new aY(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,i,s){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let n=function e(i,s){switch(typeof i){case"object":var r,n,o,a;return null===i?aA(349,s):Array.isArray(i)?(r=i,n=aA(104579,n=s),r.reduce((i,s)=>e(s,i),n)):(o=i,a=aA(181387,a=s),Object.keys(o).sort().reduce((i,s)=>(i=aP(s,i),e(o[s],i)),a));case"string":return aP(i,s);case"boolean":return aA(i?433:863,s);case"number":return aA(i,s);case"undefined":return aA(937,s);default:return aA(617,s)}}(s,0),o=r.get(n);if(o)o.users+=1;else{let a=new ok,h=new MutationObserver(e=>a.fire(e));h.observe(e,s);let l=o={users:1,observer:h,onDidMutate:a.event};i.add(nf(()=>{l.users-=1,0===l.users&&(a.dispose(),h.disconnect(),r?.delete(n),r?.size===0&&this.mutationObservers.delete(e))})),r.set(n,o)}return o.onDidMutate}};var aG={BEFORE_UNLOAD:"beforeunload"},aj=class extends np{constructor(e,i,s,r,n,o,a,h,l){if(super(),this._terminal=e,this._characterJoinerService=i,this._charSizeService=s,this._coreBrowserService=r,this._coreService=n,this._decorationService=o,this._optionsService=a,this._themeService=h,this._cursorBlinkStateManager=new nv,this._charAtlasDisposable=this._register(new nv),this._observerDisposable=this._register(new nv),this._model=new oZ,this._workCell=new oN,this._workCell2=new oN,this._rectangleRenderer=this._register(new nv),this._glyphRenderer=this._register(new nv),this._onChangeTextureAtlas=this._register(new ok),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ok),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ok),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new ok),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new ok),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._gl=this._canvas.getContext("webgl2",{antialias:!1,depth:!1,preserveDrawingBuffer:l}),!this._gl)throw Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new n3(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new at(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,a,this._themeService)],this.dimensions={css:{canvas:nq(),cell:nq()},device:{canvas:nq(),cell:nq(),char:{width:0,height:0,left:0,top:0}}},this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(a.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(function(e,i,s){return new aV(e,i,s,void 0)}(this._canvas,"webglcontextlost",e=>{console.log("webglcontextlost event received"),e.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(e)},3e3)})),this._register(function(e,i,s){return new aV(e,i,s,void 0)}(this._canvas,"webglcontextrestored",e=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,oO(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=oW(this._canvas,this._coreBrowserService.window,(e,i)=>this._setCanvasDevicePixelDimensions(e,i)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=oW(this._canvas,e,(e,i)=>this._setCanvasDevicePixelDimensions(e,i))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(nf(()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),oO(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,i){for(let e of(this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows),this._renderLayers))e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,i,s){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,i,s);this._model.selection.update(this._core,e,i,s),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new o9(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new oj(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=oP(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=nu(ov.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),ov.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){for(let e of(this._clearModel(!0),this._renderLayers))e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,i){if(!this._isAttached)if(!this._core.screenElement?.isConnected||!this._charSizeService.width||!this._charSizeService.height)return;else this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;for(let s of this._renderLayers)s.handleGridChanged(this._terminal,e,i);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,i),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new oI(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,i){let s=this._core,r=this._workCell,n,o,a,h,l,c,d=0,_=!0,u,f,g,p,v,m,S,w,b;e=aZ(e,s.rows-1,0),i=aZ(i,s.rows-1,0);let C=this._coreService.decPrivateModes.cursorStyle??s.options.cursorStyle??"block",y=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,x=y-s.buffer.ydisp,k=Math.min(this._terminal.buffer.active.cursorX,s.cols-1),L=-1,M=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let E=!1;for(o=e;o<=i;o++)for(a=o+s.buffer.ydisp,h=s.buffer.lines.get(a),this._model.lineLengths[o]=0,g=y===a,d=0,l=this._characterJoinerService.getJoinedCharacters(a),w=0;w<s.cols;w++){if(n=this._cellColorResolver.result.bg,h.loadCell(w,r),0===w&&(n=this._cellColorResolver.result.bg),c=!1,_=w>=d,u=w,l.length>0&&w===l[0][0]&&_){f=l.shift();let e=this._model.selection.isCellSelected(this._terminal,f[0],a);for(S=f[0]+1;S<f[1];S++)_&&=e===this._model.selection.isCellSelected(this._terminal,S,a);(_&&=!g||k<f[0]||k>=f[1])?(c=!0,r=new aX(r,h.translateToString(!0,f[0],f[1]),f[1]-f[0]),u=f[1]-1):d=f[1]}if(p=r.getChars(),v=r.getCode(),S=(o*s.cols+w)*4,this._cellColorResolver.resolve(r,w,a,this.dimensions.device.cell.width),M&&a===y&&(w===k&&(this._model.cursor={x:k,y:x,width:r.getWidth(),style:this._coreBrowserService.isFocused?C:s.options.cursorInactiveStyle,cursorWidth:s.options.cursorWidth,dpr:this._devicePixelRatio},L=k+r.getWidth()-1),w>=k&&w<=L&&(this._coreBrowserService.isFocused&&"block"===C||!1===this._coreBrowserService.isFocused&&"block"===s.options.cursorInactiveStyle)&&(this._cellColorResolver.result.fg=0x3000000|this._themeService.colors.cursorAccent.rgba>>8&0xffffff,this._cellColorResolver.result.bg=0x3000000|this._themeService.colors.cursor.rgba>>8&0xffffff)),0!==v&&(this._model.lineLengths[o]=w+1),(this._model.cells[S]!==v||this._model.cells[S+1]!==this._cellColorResolver.result.bg||this._model.cells[S+2]!==this._cellColorResolver.result.fg||this._model.cells[S+3]!==this._cellColorResolver.result.ext)&&(E=!0,p.length>1&&(v|=0x80000000),this._model.cells[S]=v,this._model.cells[S+1]=this._cellColorResolver.result.bg,this._model.cells[S+2]=this._cellColorResolver.result.fg,this._model.cells[S+3]=this._cellColorResolver.result.ext,m=r.getWidth(),this._glyphRenderer.value.updateCell(w,o,v,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,p,m,n),c)){for(r=this._workCell,w++;w<=u;w++)b=(o*s.cols+w)*4,this._glyphRenderer.value.updateCell(w,o,0,0,0,0,"",0,0),this._model.cells[b]=0,this._model.cells[b+1]=this._cellColorResolver.result.bg,this._model.cells[b+2]=this._cellColorResolver.result.fg,this._model.cells[b+3]=this._cellColorResolver.result.ext;w--}}E&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=1===this._optionsService.rawOptions.lineHeight?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,i){this._canvas.width===e&&this._canvas.height===i||(this._canvas.width=e,this._canvas.height=i,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},aX=class extends oc{constructor(e,i,s){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=i,this._width=s}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function aZ(e,i,s=0){return Math.max(Math.min(e,i),s)}var aJ="di$target",aQ="di$dependencies",a0=new Map;function a1(e){if(a0.has(e))return a0.get(e);let i=function(e,s,r){var n,o,a;if(3!=arguments.length)throw Error("@IServiceName-decorator can only be used to decorate a parameter");n=i,o=e,a=r,o[aJ]===o?o[aQ].push({id:n,index:a}):(o[aQ]=[{id:n,index:a}],o[aJ]=o)};return i._id=e,a0.set(e,i),i}a1("BufferService"),a1("CoreMouseService"),a1("CoreService"),a1("CharsetService"),a1("InstantiationService"),a1("LogService");var a5=a1("OptionsService");a1("OscLinkService"),a1("UnicodeService"),a1("DecorationService");var a2={trace:0,debug:1,info:2,warn:3,error:4,off:5},a3=class extends np{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=a2[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)"function"==typeof e[i]&&(e[i]=e[i]())}_log(e,i,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+i,...s)}trace(e,...i){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,i)}debug(e,...i){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,i)}info(e,...i){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,i)}warn(e,...i){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,i)}error(e,...i){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,i)}};a3=((e,i,s,r)=>{for(var n,o=r>1?void 0:r?ns(i,s):i,a=e.length-1;a>=0;a--)(n=e[a])&&(o=(r?n(i,s,o):n(o))||o);return r&&o&&ni(i,s,o),o})([(e,i)=>a5(e,i,0)],a3);var a4=class extends np{constructor(e){if(ny&&16>function(){if(!ny)return 0;let e=nS.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1])}()&&!document.createElement("canvas").getContext("webgl2",{antialias:!1,depth:!1,preserveDrawingBuffer:!0}))throw Error("Webgl2 is only supported on Safari 16 and above");super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new ok),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ok),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ok),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new ok),this.onContextLoss=this._onContextLoss.event}activate(e){let i=e._core;if(!e.element)return void this._register(i.onWillOpen(()=>this.activate(e)));this._terminal=e;let s=i.coreService,r=i.optionsService,n=i._renderService,o=i._characterJoinerService,a=i._charSizeService,h=i._coreBrowserService,l=i._decorationService,c=i._logService,d=i._themeService;this._renderer=this._register(new aj(e,o,a,h,s,l,r,d,this._preserveDrawingBuffer)),this._register(ov.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(ov.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(ov.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(ov.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this._register(nf(()=>{if(this._terminal._core._store._isDisposed)return;let i=this._terminal._core._renderService;i.setRenderer(this._terminal._core._createRenderer()),i.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}},a6=class{constructor(e,i,s,r={}){this._terminal=e,this._regex=i,this._handler=s,this._options=r}provideLinks(e,i){let s=a8.computeLink(e,this._regex,this._terminal,this._handler);i(this._addCallbacks(s))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(i,s)=>{if(this._options.hover){let{range:r}=e;this._options.hover(i,s,r)}},e))}},a8=class e{static computeLink(i,s,r,n){let o=RegExp(s.source,(s.flags||"")+"g"),[a,h]=e._getWindowedLineStrings(i-1,r),l=a.join(""),c,d=[];for(;c=o.exec(l);){let i=c[0];if(!function(e){try{let i=new URL(e),s=i.password&&i.username?`${i.protocol}//${i.username}:${i.password}@${i.host}`:i.username?`${i.protocol}//${i.username}@${i.host}`:`${i.protocol}//${i.host}`;return e.toLocaleLowerCase().startsWith(s.toLocaleLowerCase())}catch{return!1}}(i))continue;let[s,o]=e._mapStrIdx(r,h,0,c.index),[a,l]=e._mapStrIdx(r,s,o,i.length);if(-1===s||-1===o||-1===a||-1===l)continue;let _={start:{x:o+1,y:s+1},end:{x:l,y:a+1}};d.push({range:_,text:i,activate:n})}return d}static _getWindowedLineStrings(e,i){let s,r=e,n=e,o=0,a="",h=[];if(s=i.buffer.active.getLine(e)){let e=s.translateToString(!0);if(s.isWrapped&&" "!==e[0]){for(o=0;(s=i.buffer.active.getLine(--r))&&o<2048&&(o+=(a=s.translateToString(!0)).length,h.push(a),!(!s.isWrapped||-1!==a.indexOf(" "))););h.reverse()}for(h.push(e),o=0;(s=i.buffer.active.getLine(++n))&&s.isWrapped&&o<2048&&(o+=(a=s.translateToString(!0)).length,h.push(a),-1===a.indexOf(" ")););}return[h,r]}static _mapStrIdx(e,i,s,r){let n=e.buffer.active,o=n.getNullCell(),a=s;for(;r;){let e=n.getLine(i);if(!e)return[-1,-1];for(let s=a;s<e.length;++s){e.getCell(s,o);let a=o.getChars();if(o.getWidth()&&(r-=a.length||1,s===e.length-1&&""===a)){let e=n.getLine(i+1);e&&e.isWrapped&&(e.getCell(0,o),2===o.getWidth()&&(r+=1))}if(r<0)return[i,s]}i++,a=0}return[i,a]}},a7=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function a9(e,i){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}var he=class{constructor(e=a9,i={}){this._handler=e,this._options=i}activate(e){this._terminal=e;let i=this._options,s=i.urlRegex||a7;this._linkProvider=this._terminal.registerLinkProvider(new a6(this._terminal,s,this._handler,i))}dispose(){this._linkProvider?.dispose()}},ht=e.i(275283);let hi=/(?:\.\.?\/|[a-zA-Z0-9_@][a-zA-Z0-9_\-.]*\/)[a-zA-Z0-9_\-.\/@]+\.\w+/g,hs=/^(?::(\d+)(?::(\d+))?|\((\d+)(?:,\s*(\d+))?\)|\[(\d+)(?:,\s*(\d+))?\])/;class hr{terminal;worktreePath;onFileOpen;constructor(e,i,s){this.terminal=e,this.worktreePath=i,this.onFileOpen=s}provideLinks(e,i){let s=this.terminal.buffer.active.getLine(e);if(!s)return i(void 0);let r=s.translateToString(),n=function(e){let i,s=[];for(hi.lastIndex=0;null!==(i=hi.exec(e));){let r,n,o=i[0],a=i.index,h=e.slice(a+o.length).match(hs),l=o.length;if(h&&0===h.index){l+=h[0].length;let e=h[1]??h[3]??h[5],i=h[2]??h[4]??h[6];r=e?parseInt(e,10):void 0,n=i?parseInt(i,10):void 0}s.push({path:o,startIndex:a,totalLength:l,line:r,col:n})}return s}(r);if(0===n.length)return i(void 0);i(n.map(i=>({range:{start:{x:i.startIndex+1,y:e},end:{x:i.startIndex+i.totalLength+1,y:e}},text:r.slice(i.startIndex,i.startIndex+i.totalLength),activate:()=>{this.onFileOpen(`${this.worktreePath}/${i.path}`,i.line,i.col)}})))}}var hn=e.i(625054),ho=e.i(595774);e.s(["TaskTerminal",0,function({taskId:e,worktreePath:i,onSessionEnd:s,onFileOpen:r,useCanvasRenderer:n=!1}){let{t:o}=(0,hn.useI18n)(),{resolvedTheme:a}=(0,ht.useTheme)(),h=(0,y.useRef)(null),l=(0,y.useRef)(null),c=(0,y.useRef)(null),d=(0,y.useRef)(null),_=(0,y.useRef)(s);_.current=s;let u=(0,y.useRef)(r);u.current=r;let[f,g]=(0,y.useState)("connecting"),[p,v]=(0,y.useState)(!1);if((0,y.useEffect)(()=>{if(!i||!h.current)return;let s=new ne({fontFamily:"Menlo, Monaco, 'Courier New', monospace",fontSize:13,scrollback:5e3,cursorBlink:!0,allowTransparency:!1,rescaleOverlappingGlyphs:!0,theme:"light"!==a?{background:"#0a0a0a",foreground:"#e5e5e5"}:{background:"#fafafa",foreground:"#171717"}}),r=new nt;s.loadAddon(r),s.open(h.current);let o=h.current.querySelector(".xterm-helper-textarea");o&&(o.style.opacity="0");let f=null;if(!n)try{(f=new a4).onContextLoss(()=>{f?.dispose(),f=null}),s.loadAddon(f)}catch{}let p=new he((e,i)=>{window.open(i,"_blank")});s.loadAddon(p),i&&s.registerLinkProvider(new hr(s,i,(e,i,s)=>{u.current?.(e,i,s)})),r.fit(),s.focus();let m=null,S=null,w=!1,b=null,C=!1;return(0,ho.getActualWsPort)().then(i=>{w||function i(r){if(w||C)return;g("connecting");let n=new WebSocket(`ws://localhost:${r}/terminal?taskId=${encodeURIComponent(e)}`);m=n,n.addEventListener("open",()=>{n.send(JSON.stringify({type:"resize",cols:s.cols,rows:s.rows})),s.focus(),g("connected"),v(!0),setTimeout(()=>v(!1),2e3)}),n.addEventListener("message",e=>{let i=e.data;"string"==typeof i?s.write(i):i instanceof Blob?i.text().then(e=>s.write(e)):i instanceof ArrayBuffer&&s.write(new Uint8Array(i))}),S?.dispose(),S=s.onData(e=>{n.readyState===WebSocket.OPEN&&n.send(e)}),n.addEventListener("close",e=>{if(e.code>=4e3){C=!0,g("disconnected"),_.current?.(e.code-4e3);return}g("disconnected"),w||C||(b=setTimeout(()=>i(r),3e3))}),n.addEventListener("error",()=>{}),c.current=n}(i)}),l.current=s,d.current=r,()=>{w=!0,b&&clearTimeout(b),S?.dispose(),p.dispose(),f?.dispose(),r.dispose(),s.dispose(),m?.close(),l.current=null,c.current=null,d.current=null}},[e,i]),(0,y.useEffect)(()=>{if(!i||!h.current)return;let e=d.current,s=c.current,r=l.current;e&&r&&requestAnimationFrame(()=>{e.fit(),s?.readyState===WebSocket.OPEN&&s.send(JSON.stringify({type:"resize",cols:r.cols,rows:r.rows}))});let n=null,o=h.current,a=new ResizeObserver(()=>{n&&clearTimeout(n),n=setTimeout(()=>{let e=d.current,i=c.current,s=l.current;e&&s&&(e.fit(),i?.readyState===WebSocket.OPEN&&i.send(JSON.stringify({type:"resize",cols:s.cols,rows:s.rows})))},100)});return a.observe(o),()=>{n&&clearTimeout(n),a.disconnect()}},[e,i]),(0,y.useEffect)(()=>{let e=l.current;if(!e)return;let i="light"!==a;e.options.theme=i?{background:"#0a0a0a",foreground:"#e5e5e5"}:{background:"#fafafa",foreground:"#171717"}},[a]),!i)return(0,C.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center bg-[#0a0a0a] text-center",children:[(0,C.jsx)("p",{className:"text-sm text-neutral-400",children:o("terminal.noWorktree")}),(0,C.jsx)("p",{className:"text-xs text-neutral-600 mt-1",children:o("terminal.noWorktreeDesc")})]});let m=o("connected"===f?"terminal.connected":"connecting"===f?"terminal.connecting":"terminal.disconnected");return(0,C.jsxs)("div",{className:"relative h-full w-full bg-[#0a0a0a]",children:[(0,C.jsxs)("div",{className:["absolute right-3 top-3 z-10 flex items-center gap-1.5 rounded px-2 py-0.5 text-xs transition-opacity duration-500","connected"===f&&!p?"opacity-0 pointer-events-none":"opacity-100","bg-black/40 backdrop-blur-sm"].join(" "),title:m,children:[(0,C.jsx)("span",{className:`h-2 w-2 rounded-full ${"connected"===f?"bg-green-500":"connecting"===f?"bg-yellow-500":"bg-red-500"}`}),(0,C.jsx)("span",{className:"text-neutral-300",children:m})]}),(0,C.jsx)("div",{ref:h,className:"h-full w-full overflow-hidden"})]})}],714062)},467005,e=>{e.n(e.i(714062))}]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,899561,(e,t,r)=>{var s;"u">typeof __nccwpck_require__&&(__nccwpck_require__.ab="/ROOT/project/f/tower/node_modules/.pnpm/next@16.2.1_@babel+core@7.29.0_@playwright+test@1.58.2_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/next/dist/compiled/os-browserify/"),(s={}).endianness=function(){return"LE"},s.hostname=function(){return"u">typeof location?location.hostname:""},s.loadavg=function(){return[]},s.uptime=function(){return 0},s.freemem=function(){return Number.MAX_VALUE},s.totalmem=function(){return Number.MAX_VALUE},s.cpus=function(){return[]},s.type=function(){return"Browser"},s.release=function(){return"u">typeof navigator?navigator.appVersion:""},s.networkInterfaces=s.getNetworkInterfaces=function(){return{}},s.arch=function(){return"javascript"},s.platform=function(){return"browser"},s.tmpdir=s.tmpDir=function(){return"/tmp"},s.EOL="\n",s.homedir=function(){return"/"},t.exports=s},171159,(e,t,r)=>{!function(){"use strict";var e={114:function(e){function t(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function r(e,t){for(var r,s="",a=0,n=-1,o=0,i=0;i<=e.length;++i){if(i<e.length)r=e.charCodeAt(i);else if(47===r)break;else r=47;if(47===r){if(n===i-1||1===o);else if(n!==i-1&&2===o){if(s.length<2||2!==a||46!==s.charCodeAt(s.length-1)||46!==s.charCodeAt(s.length-2)){if(s.length>2){var l=s.lastIndexOf("/");if(l!==s.length-1){-1===l?(s="",a=0):a=(s=s.slice(0,l)).length-1-s.lastIndexOf("/"),n=i,o=0;continue}}else if(2===s.length||1===s.length){s="",a=0,n=i,o=0;continue}}t&&(s.length>0?s+="/..":s="..",a=2)}else s.length>0?s+="/"+e.slice(n+1,i):s=e.slice(n+1,i),a=i-n-1;n=i,o=0}else 46===r&&-1!==o?++o:o=-1}return s}var s={resolve:function(){for(var e,s,a="",n=!1,o=arguments.length-1;o>=-1&&!n;o--)o>=0?s=arguments[o]:(void 0===e&&(e=""),s=e),t(s),0!==s.length&&(a=s+"/"+a,n=47===s.charCodeAt(0));if(a=r(a,!n),n)if(a.length>0)return"/"+a;else return"/";return a.length>0?a:"."},normalize:function(e){if(t(e),0===e.length)return".";var s=47===e.charCodeAt(0),a=47===e.charCodeAt(e.length-1);return(0!==(e=r(e,!s)).length||s||(e="."),e.length>0&&a&&(e+="/"),s)?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0==arguments.length)return".";for(var e,r=0;r<arguments.length;++r){var a=arguments[r];t(a),a.length>0&&(void 0===e?e=a:e+="/"+a)}return void 0===e?".":s.normalize(e)},relative:function(e,r){if(t(e),t(r),e===r||(e=s.resolve(e))===(r=s.resolve(r)))return"";for(var a=1;a<e.length&&47===e.charCodeAt(a);++a);for(var n=e.length,o=n-a,i=1;i<r.length&&47===r.charCodeAt(i);++i);for(var l=r.length-i,c=o<l?o:l,d=-1,u=0;u<=c;++u){if(u===c){if(l>c){if(47===r.charCodeAt(i+u))return r.slice(i+u+1);else if(0===u)return r.slice(i+u)}else o>c&&(47===e.charCodeAt(a+u)?d=u:0===u&&(d=0));break}var m=e.charCodeAt(a+u);if(m!==r.charCodeAt(i+u))break;47===m&&(d=u)}var x="";for(u=a+d+1;u<=n;++u)(u===n||47===e.charCodeAt(u))&&(0===x.length?x+="..":x+="/..");return x.length>0?x+r.slice(i+d):(i+=d,47===r.charCodeAt(i)&&++i,r.slice(i))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var r=e.charCodeAt(0),s=47===r,a=-1,n=!0,o=e.length-1;o>=1;--o)if(47===(r=e.charCodeAt(o))){if(!n){a=o;break}}else n=!1;return -1===a?s?"/":".":s&&1===a?"//":e.slice(0,a)},basename:function(e,r){if(void 0!==r&&"string"!=typeof r)throw TypeError('"ext" argument must be a string');t(e);var s,a=0,n=-1,o=!0;if(void 0!==r&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var i=r.length-1,l=-1;for(s=e.length-1;s>=0;--s){var c=e.charCodeAt(s);if(47===c){if(!o){a=s+1;break}}else -1===l&&(o=!1,l=s+1),i>=0&&(c===r.charCodeAt(i)?-1==--i&&(n=s):(i=-1,n=l))}return a===n?n=l:-1===n&&(n=e.length),e.slice(a,n)}for(s=e.length-1;s>=0;--s)if(47===e.charCodeAt(s)){if(!o){a=s+1;break}}else -1===n&&(o=!1,n=s+1);return -1===n?"":e.slice(a,n)},extname:function(e){t(e);for(var r=-1,s=0,a=-1,n=!0,o=0,i=e.length-1;i>=0;--i){var l=e.charCodeAt(i);if(47===l){if(!n){s=i+1;break}continue}-1===a&&(n=!1,a=i+1),46===l?-1===r?r=i:1!==o&&(o=1):-1!==r&&(o=-1)}return -1===r||-1===a||0===o||1===o&&r===a-1&&r===s+1?"":e.slice(r,a)},format:function(e){var t,r;if(null===e||"object"!=typeof e)throw TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return t=e.dir||e.root,r=e.base||(e.name||"")+(e.ext||""),t?t===e.root?t+r:t+"/"+r:r},parse:function(e){t(e);var r,s={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return s;var a=e.charCodeAt(0),n=47===a;n?(s.root="/",r=1):r=0;for(var o=-1,i=0,l=-1,c=!0,d=e.length-1,u=0;d>=r;--d){if(47===(a=e.charCodeAt(d))){if(!c){i=d+1;break}continue}-1===l&&(c=!1,l=d+1),46===a?-1===o?o=d:1!==u&&(u=1):-1!==o&&(u=-1)}return -1===o||-1===l||0===u||1===u&&o===l-1&&o===i+1?-1!==l&&(0===i&&n?s.base=s.name=e.slice(1,l):s.base=s.name=e.slice(i,l)):(0===i&&n?(s.name=e.slice(1,o),s.base=e.slice(1,l)):(s.name=e.slice(i,o),s.base=e.slice(i,l)),s.ext=e.slice(o,l)),i>0?s.dir=e.slice(0,i-1):n&&(s.dir="/"),s},sep:"/",delimiter:":",win32:null,posix:null};s.posix=s,e.exports=s}},r={};function s(t){var a=r[t];if(void 0!==a)return a.exports;var n=r[t]={exports:{}},o=!0;try{e[t](n,n.exports,s),o=!1}finally{o&&delete r[t]}return n.exports}s.ab="/ROOT/project/f/tower/node_modules/.pnpm/next@16.2.1_@babel+core@7.29.0_@playwright+test@1.58.2_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/next/dist/compiled/path-browserify/",t.exports=s(114)}()},400395,e=>{"use strict";let t=(0,e.i(863961).default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);e.s(["default",0,t])},178755,e=>{"use strict";var t=e.i(432377),r=e.i(85212),s=e.i(309542),a=e.i(631325),n=e.i(565037),o=e.i(780156),i=e.i(923344),l=e.i(909260),c=e.i(746357),d=e.i(863961);let u=(0,d.default)("chevrons-left",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]),m=(0,d.default)("tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);var x=e.i(555159),h=e.i(478430);let p=(0,d.default)("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);var f=e.i(942252),g=e.i(142124),j=e.i(718837),b=e.i(11915),v=e.i(711296),w=e.i(831349),N=e.i(543485);let y=(0,N.createServerReference)("407b2af6329533534febb291b9b6995ca0c57ecfb6",N.callServer,void 0,N.findSourceMapURL,"createWorkspace"),k=(0,N.createServerReference)("60557d38533851a85e3b22aff36176ee7e8ce42871",N.callServer,void 0,N.findSourceMapURL,"updateWorkspace"),C=(0,N.createServerReference)("40d7736a6bd6d01f427300af149cbed5f8178fd0b7",N.callServer,void 0,N.findSourceMapURL,"deleteWorkspace"),S=(0,N.createServerReference)("403e569967f7e40ef9f95a932fd1402ccf721dc22e",N.callServer,void 0,N.findSourceMapURL,"getLabelsForWorkspace"),T=(0,N.createServerReference)("405fdc9c4d8b06477fa2fab70470ea3bcd09a3af4e",N.callServer,void 0,N.findSourceMapURL,"createLabel"),D=(0,N.createServerReference)("40f99af0c2ef3e8f82b39d8517d51f004fa12d9445",N.callServer,void 0,N.findSourceMapURL,"deleteLabel");var P=e.i(625054),R=e.i(286302);let M=["π","π","π―","π‘","π§","π¦","π¨","π","π¬","π","π","ποΈ"];function A({workspaces:e}){let d,j=(0,s.useRouter)(),w=(0,s.usePathname)(),{t:N}=(0,P.useI18n)(),[S,T]=(0,r.useState)(!1);(0,r.useEffect)(()=>{"true"===localStorage.getItem("sidebar-collapsed")&&T(!0)},[]);let[D,z]=(0,r.useState)(!1),[L,O]=(0,r.useState)(!1),[I,B]=(0,r.useState)(!1),[F,_]=(0,r.useState)(null),[U,W]=(0,r.useState)(""),[H,K]=(0,r.useState)(M[0]),[V,q]=(0,r.useState)(null),X=w.split("/workspaces/")[1]?.split("/")[0],G=(0,r.useCallback)(()=>{T(e=>{let t=!e;return localStorage.setItem("sidebar-collapsed",String(t)),t})},[]),J=(0,r.useCallback)(async()=>{if(!U.trim())return;let e=await y({name:U.trim(),description:H});W(""),K(M[0]),z(!1),j.refresh(),j.push(`/workspaces/${e.id}`)},[U,H,j]),Y=(0,r.useCallback)(async()=>{U.trim()&&V&&(await k(V,{name:U.trim(),description:H}),W(""),O(!1),q(null),j.refresh())},[U,H,V,j]),Z=(0,r.useCallback)(e=>{q(e.id),W(e.name),K(e.description&&M.includes(e.description)?e.description:M[0]),O(!0)},[]),Q=(0,r.useCallback)(async(t,r)=>{if(e.length<=1)return void R.toast.error(N("sidebar.lastWorkspaceError"));if(confirm(N("sidebar.deleteConfirm",{name:r})))try{await C(t),j.refresh(),X===t&&j.push("/workspaces")}catch{R.toast.error(N("sidebar.lastWorkspaceError"))}},[X,j,N,e.length]),ee=(0,r.useCallback)(e=>{_(e),B(!0)},[]),et=e=>e.description&&M.includes(e.description)?e.description:e.name.charAt(0).toUpperCase();if(S){let r;return(0,t.jsxs)("aside",{className:"flex h-screen w-14 flex-col items-center border-r border-border bg-sidebar py-3",children:[(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:G,className:"mb-4 flex h-9 w-9 items-center justify-center rounded-lg bg-primary/10 ring-1 ring-primary/20 transition-transform hover:scale-105"}),children:(0,t.jsx)("img",{src:"/logo.png",alt:"Tower",className:"h-6 w-6 rounded"})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:N("sidebar.expand")})]}),(0,t.jsx)(g.ScrollArea,{className:"flex-1 min-h-0",children:(0,t.jsxs)("div",{className:"flex flex-col items-center gap-1 px-0.5 pt-1",children:[e.map(e=>{let r=X===e.id,s=et(e);return(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:()=>{r||j.push(`/workspaces/${e.id}`)},className:`flex h-9 w-9 items-center justify-center rounded-lg transition-all ${r?"ring-1 ring-primary/20 text-foreground cursor-default":"text-muted-foreground hover:text-foreground cursor-pointer"}`}),children:(0,t.jsx)("span",{className:"flex h-7 w-7 items-center justify-center rounded-md bg-muted text-sm",children:M.includes(s)?s:(0,t.jsx)("span",{className:"text-xs font-semibold",children:s})})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:e.name})]},e.id)}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{"data-tour":"create-workspace",onClick:()=>z(!0),className:"flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"}),children:(0,t.jsx)(o.Plus,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:N("sidebar.newWorkspace")})]})]})}),(0,t.jsxs)("div",{className:"mt-2 flex flex-col items-center gap-1",children:[(r=X||e[0]?.id)?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:()=>j.push(`/workspaces/${r}/notes`),className:`rounded-lg p-2 transition-colors ${w.includes("/notes")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,t.jsx)(x.FileText,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:N("sidebar.notes")})]}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:()=>j.push(`/workspaces/${r}/assets`),className:`rounded-lg p-2 transition-colors ${w.includes("/assets")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,t.jsx)(h.FolderOpen,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:N("sidebar.assets")})]}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:()=>j.push(`/workspaces/${r}/archive`),className:`rounded-lg p-2 transition-colors ${w.includes("/archive")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,t.jsx)(n.Archive,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:N("sidebar.archive")})]})]}):null,(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:()=>j.push("/missions"),className:`rounded-lg p-2 transition-colors ${"/missions"===w?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,t.jsx)(p,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:N("missions.navLabel")})]})]}),(0,t.jsx)($,{open:D,onOpenChange:z,title:N("workspace.create"),name:U,onNameChange:W,icon:H,onIconChange:K,onSubmit:J,submitLabel:N("common.create"),nameLabel:N("workspace.name"),iconLabel:N("workspace.icon"),namePlaceholder:N("workspace.namePlaceholder"),cancelLabel:N("common.cancel")})]})}return(0,t.jsxs)("aside",{className:"noise relative flex h-screen w-56 flex-col border-r border-border bg-sidebar",children:[(0,t.jsxs)("div",{className:"relative z-10 flex items-center gap-3 px-4 py-4",children:[(0,t.jsx)("img",{src:"/logo.png",alt:"Tower",className:"h-9 w-9 rounded-lg"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("div",{className:"text-sm font-semibold tracking-tight text-foreground",children:"Tower"}),(0,t.jsx)("div",{className:"text-[10px] font-medium uppercase tracking-widest text-muted-foreground",children:"Studio"})]}),(0,t.jsx)(v.Button,{variant:"ghost",size:"icon-xs",onClick:G,className:"text-muted-foreground",title:N("sidebar.collapse"),children:(0,t.jsx)(u,{className:"h-4 w-4"})})]}),(0,t.jsxs)("div",{className:"relative z-10 flex items-center justify-between px-4 py-2",children:[(0,t.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:N("sidebar.workspace")}),(0,t.jsx)(v.Button,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground","data-tour":"create-workspace",onClick:()=>{W(""),K(M[0]),z(!0)},title:N("sidebar.newWorkspace"),children:(0,t.jsx)(o.Plus,{className:"h-3.5 w-3.5"})})]}),(0,t.jsx)(g.ScrollArea,{className:"relative z-10 mt-2 flex-1 min-h-0",children:(0,t.jsx)("div",{className:"px-2 py-1",children:e.map(r=>{var s;let a,n,o,d=X===r.id,u=et(r);return(0,t.jsxs)("div",{className:`group relative flex items-center rounded-lg transition-all ${d?"bg-accent ring-1 ring-primary/15":"hover:bg-accent/60"}`,children:[(0,t.jsxs)("button",{onClick:()=>{d||j.push(`/workspaces/${r.id}`)},className:`flex flex-1 items-center gap-2.5 px-3 py-2.5 text-left ${d?"cursor-default":"cursor-pointer"}`,children:[(0,t.jsx)("span",{className:"flex h-7 w-7 items-center justify-center rounded-md bg-muted text-sm",children:M.includes(u)?u:(0,t.jsx)("span",{className:"text-xs font-semibold text-muted-foreground",children:u})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:`truncate text-sm font-medium ${d?"text-foreground":"text-secondary-foreground"}`,children:r.name}),(0,t.jsx)("div",{className:"text-[11px] text-muted-foreground",children:(s=r.updatedAt,n=Math.floor((a=Date.now()-new Date(s).getTime())/6e4),o=Math.floor(a/36e5),n<60?`${n}m ago`:o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`)})]})]}),(0,t.jsxs)(f.DropdownMenu,{children:[(0,t.jsx)(f.DropdownMenuTrigger,{render:(0,t.jsx)("button",{className:"mr-2 rounded-md p-1 text-muted-foreground opacity-0 transition-all hover:bg-background hover:text-foreground group-hover:opacity-100",onClick:e=>e.stopPropagation()}),children:(0,t.jsx)(c.MoreHorizontal,{className:"h-3.5 w-3.5"})}),(0,t.jsxs)(f.DropdownMenuContent,{align:"start",side:"right",children:[(0,t.jsxs)(f.DropdownMenuItem,{onClick:()=>Z(r),children:[(0,t.jsx)(i.Pencil,{className:"mr-2 h-3.5 w-3.5"}),N("sidebar.rename")]}),(0,t.jsxs)(f.DropdownMenuItem,{onClick:()=>ee(r.id),children:[(0,t.jsx)(m,{className:"mr-2 h-3.5 w-3.5"}),N("sidebar.manageLabels")]}),(0,t.jsxs)(f.DropdownMenuItem,{className:e.length<=1?"text-muted-foreground opacity-50":"text-rose-400",disabled:e.length<=1,onClick:()=>Q(r.id,r.name),children:[(0,t.jsx)(l.Trash2,{className:"mr-2 h-3.5 w-3.5"}),N("sidebar.delete")]})]})]})]},r.id)})})}),(0,t.jsxs)(a.default,{href:"/missions",className:`relative z-10 flex items-center gap-2 border-t border-border px-4 py-3 text-[11px] cursor-pointer transition-colors ${"/missions"===w?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,t.jsx)(p,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:N("missions.navLabel")})]}),(d=X||e[0]?.id)?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(a.default,{href:`/workspaces/${d}/notes`,className:"relative z-10 flex items-center gap-2 border-t border-border px-4 py-3 text-[11px] text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:[(0,t.jsx)(x.FileText,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:N("sidebar.notes")})]}),(0,t.jsxs)(a.default,{href:`/workspaces/${d}/assets`,className:"relative z-10 flex items-center gap-2 px-4 py-3 text-[11px] text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:[(0,t.jsx)(h.FolderOpen,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:N("sidebar.assets")})]}),(0,t.jsxs)(a.default,{href:`/workspaces/${d}/archive`,className:"relative z-10 flex items-center gap-2 px-4 py-3 text-[11px] text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:[(0,t.jsx)(n.Archive,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:N("sidebar.archive")})]})]}):null,(0,t.jsx)($,{open:D,onOpenChange:z,title:N("workspace.create"),name:U,onNameChange:W,icon:H,onIconChange:K,onSubmit:J,submitLabel:N("common.create"),nameLabel:N("workspace.name"),iconLabel:N("workspace.icon"),namePlaceholder:N("workspace.namePlaceholder"),cancelLabel:N("common.cancel")}),(0,t.jsx)($,{open:L,onOpenChange:e=>{O(e),e||q(null)},title:N("workspace.edit"),name:U,onNameChange:W,icon:H,onIconChange:K,onSubmit:Y,submitLabel:N("common.save"),nameLabel:N("workspace.name"),iconLabel:N("workspace.icon"),namePlaceholder:N("workspace.namePlaceholder"),cancelLabel:N("common.cancel")}),F&&(0,t.jsx)(E,{open:I,onOpenChange:e=>{B(e),e||_(null)},workspaceId:F})]})}function $({open:e,onOpenChange:r,title:s,name:a,onNameChange:n,icon:o,onIconChange:i,onSubmit:l,submitLabel:c,nameLabel:d,iconLabel:u,namePlaceholder:m,cancelLabel:x}){return(0,t.jsx)(j.Dialog,{open:e,onOpenChange:r,disablePointerDismissal:!0,children:(0,t.jsxs)(j.DialogContent,{className:"sm:max-w-sm",children:[(0,t.jsx)(j.DialogHeader,{children:(0,t.jsx)(j.DialogTitle,{children:s})}),(0,t.jsxs)("div",{className:"space-y-4 py-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:d}),(0,t.jsx)(w.Input,{placeholder:m,value:a,onChange:e=>n(e.target.value),onKeyDown:e=>"Enter"===e.key&&e.preventDefault(),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:u}),(0,t.jsx)("div",{className:"mt-1.5 grid grid-cols-6 gap-1.5",children:M.map(e=>(0,t.jsx)("button",{onClick:()=>i(e),className:`flex h-10 w-10 items-center justify-center rounded-lg text-lg transition-all ${o===e?"bg-primary/15 ring-2 ring-primary/30 scale-110":"bg-muted hover:bg-accent"}`,children:e},e))})]})]}),(0,t.jsxs)(j.DialogFooter,{children:[(0,t.jsx)(v.Button,{variant:"outline",onClick:()=>r(!1),children:x}),(0,t.jsx)(v.Button,{onClick:l,disabled:!a.trim(),className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:c})]})]})})}let z=["#3b82f6","#ef4444","#f59e0b","#10b981","#8b5cf6","#ec4899","#06b6d4","#f97316"];function E({open:e,onOpenChange:s,workspaceId:a}){let{t:n}=(0,P.useI18n)(),[o,i]=(0,r.useState)([]),[l,c]=(0,r.useState)(""),[d,u]=(0,r.useState)(z[0]);(0,r.useEffect)(()=>{e&&S(a).then(i)},[e,a]);let m=async()=>{l.trim()&&(await T({name:l.trim(),color:d,workspaceId:a}),i(await S(a)),c(""))},x=async e=>{await D(e),i(t=>t.filter(t=>t.id!==e))};return(0,t.jsx)(j.Dialog,{open:e,onOpenChange:s,disablePointerDismissal:!0,children:(0,t.jsxs)(j.DialogContent,{className:"sm:max-w-sm",children:[(0,t.jsx)(j.DialogHeader,{children:(0,t.jsx)(j.DialogTitle,{children:n("label.manage")})}),(0,t.jsxs)("div",{className:"space-y-3 py-2",children:[o.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"h-3 w-3 rounded-full",style:{backgroundColor:e.color}}),(0,t.jsx)("span",{className:"flex-1 text-sm text-foreground",children:e.name}),e.isBuiltin?(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground",children:n("label.builtin")}):(0,t.jsx)("button",{onClick:()=>x(e.id),className:"text-xs text-rose-400 hover:text-rose-300",children:n("common.delete")})]},e.id)),(0,t.jsxs)("div",{className:"border-t border-border pt-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(w.Input,{placeholder:n("label.name"),value:l,onChange:e=>c(e.target.value),onKeyDown:e=>"Enter"===e.key&&e.preventDefault(),className:"flex-1 h-8"}),(0,t.jsx)(v.Button,{size:"sm",onClick:m,disabled:!l.trim(),className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:n("label.add")})]}),(0,t.jsx)("div",{className:"mt-2 flex gap-1.5",children:z.map(e=>(0,t.jsx)("button",{onClick:()=>u(e),className:`h-5 w-5 rounded-full transition-all ${d===e?"ring-2 ring-offset-2 ring-offset-background ring-foreground/30 scale-110":""}`,style:{backgroundColor:e}},e))})]})]})]})})}var L=e.i(275283),O=e.i(677436),I=e.i(103295);let B=(0,d.default)("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);var F=e.i(802461),_=e.i(867900),U=e.i(811424),W=e.i(809250);e.s([],732490),e.i(732490),e.i(129893);var H=e.i(793988),K=e.i(499875);let V=r.createContext(void 0);function q(){let e=r.useContext(V);if(void 0===e)throw Error((0,K.default)(13));return e}let X={imageLoadingStatus:()=>null},G=r.forwardRef(function(e,s){let{className:a,render:n,...o}=e,[i,l]=r.useState("idle"),c=r.useMemo(()=>({imageLoadingStatus:i,setImageLoadingStatus:l}),[i,l]),d=(0,H.useRenderElement)("span",e,{state:{imageLoadingStatus:i},ref:s,props:o,stateAttributesMapping:X});return(0,t.jsx)(V.Provider,{value:c,children:d})});var J=e.i(357030),Y=e.i(284060),Z=e.i(412360),Q=e.i(144909),ee=e.i(883993),et=e.i(166508);let er={...X,...Q.transitionStatusMapping},es=r.forwardRef(function(e,t){let{className:s,render:a,onLoadingStatusChange:n,referrerPolicy:o,crossOrigin:i,...l}=e,c=q(),d=function(e,{referrerPolicy:t,crossOrigin:s}){let[a,n]=r.useState("idle");return(0,Y.useIsoLayoutEffect)(()=>{if(!e)return n("error"),et.NOOP;let r=!0,a=new window.Image,o=e=>()=>{r&&n(e)};return n("loading"),a.onload=o("loaded"),a.onerror=o("error"),t&&(a.referrerPolicy=t),a.crossOrigin=s??null,a.src=e,()=>{r=!1}},[e,s,t]),a}(e.src,{referrerPolicy:o,crossOrigin:i}),u="loaded"===d,{mounted:m,transitionStatus:x,setMounted:h}=(0,ee.useTransitionStatus)(u),p=r.useRef(null),f=(0,J.useStableCallback)(e=>{n?.(e),c.setImageLoadingStatus(e)});(0,Y.useIsoLayoutEffect)(()=>{"idle"!==d&&f(d)},[d,f]),(0,Z.useOpenChangeComplete)({open:u,ref:p,onComplete(){u||h(!1)}});let g=(0,H.useRenderElement)("img",e,{state:{imageLoadingStatus:d,transitionStatus:x},ref:[t,p],props:l,stateAttributesMapping:er,enabled:m});return m?g:null});var ea=e.i(617406);let en=r.forwardRef(function(e,t){let{className:s,render:a,delay:n,...o}=e,{imageLoadingStatus:i}=q(),[l,c]=r.useState(void 0===n),d=(0,ea.useTimeout)();return r.useEffect(()=>(void 0!==n&&d.start(n,()=>c(!0)),d.clear),[d,n]),(0,H.useRenderElement)("span",e,{state:{imageLoadingStatus:i},ref:t,props:o,stateAttributesMapping:X,enabled:"loaded"!==i&&l})});e.s(["Fallback",0,en,"Image",0,es,"Root",0,G],50152);var eo=e.i(50152),eo=eo,ei=e.i(937756);function el({className:e,size:r="default",...s}){return(0,t.jsx)(eo.Root,{"data-slot":"avatar","data-size":r,className:(0,ei.cn)("group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten",e),...s})}function ec({className:e,...r}){return(0,t.jsx)(eo.Fallback,{"data-slot":"avatar-fallback",className:(0,ei.cn)("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",e),...r})}let ed=(0,d.default)("folder-kanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);var eu=e.i(357334);let em=(0,d.default)("sticky-note",[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}]]),ex=(0,d.default)("package-2",[["path",{d:"M12 3v6",key:"1holv5"}],["path",{d:"M16.76 3a2 2 0 0 1 1.8 1.1l2.23 4.479a2 2 0 0 1 .21.891V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9.472a2 2 0 0 1 .211-.894L5.45 4.1A2 2 0 0 1 7.24 3z",key:"187q7i"}],["path",{d:"M3.054 9.013h17.893",key:"grwhos"}]]);var eh=e.i(996032);let ep=(0,N.createServerReference)("608f69f95a3beba367f60aa9887945df91c205a5a8",N.callServer,void 0,N.findSourceMapURL,"globalSearch");var ef=e.i(632426);let eg=[{id:"all",key:"search.all",icon:O.Search},{id:"task",key:"search.task",icon:x.FileText},{id:"project",key:"search.project",icon:ed},{id:"repository",key:"search.repository",icon:eu.GitBranch},{id:"note",key:"search.note",icon:em},{id:"asset",key:"search.asset",icon:ex}],ej=["task","project","repository","note","asset"],eb={task:"search.task",project:"search.project",repository:"search.repository",note:"search.note",asset:"search.asset"};function ev({result:e,onSelect:r}){let s=eg.find(t=>t.id===e.type)?.icon??x.FileText;return(0,t.jsxs)("button",{onClick:()=>r(e),className:"flex w-full items-center gap-3 border-b border-border/30 px-4 py-3 text-left transition-colors hover:bg-accent last:border-b-0",children:[(0,t.jsx)("div",{className:"rounded-md bg-muted p-1.5",children:(0,t.jsx)(s,{className:"h-3.5 w-3.5 text-muted-foreground"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:"text-sm font-medium text-foreground truncate",children:e.title}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:e.subtitle}),e.snippet&&(0,t.jsx)("div",{className:"text-xs text-muted-foreground/70 truncate mt-0.5",children:e.snippet})]})]})}function ew({open:e,onOpenChange:a}){let n,{t:o}=(0,P.useI18n)(),i=(0,s.useRouter)(),[l,c]=(0,r.useState)(""),[d,u]=(0,r.useState)("all"),[m,x]=(0,r.useState)([]),[h,p]=(0,r.useState)(!1),[f,b]=(0,r.useState)(250),w=(0,r.useRef)(null),N=(0,r.useRef)(null);(0,r.useEffect)(()=>{e&&((0,ef.getConfigValue)("search.debounceMs",250).then(b),setTimeout(()=>w.current?.focus(),100),c(""),x([]))},[e]),(0,r.useEffect)(()=>{if(N.current&&clearTimeout(N.current),!l.trim()){x([]),p(!1);return}p(!0);let e=!1;return N.current=setTimeout(async()=>{let t=await ep(l,d);e||(x(t),p(!1))},f),()=>{N.current&&clearTimeout(N.current),e=!0}},[l,d,f]);let y=(0,r.useCallback)(e=>{i.push(e.navigateTo),a(!1)},[i,a]);return(0,t.jsx)(j.Dialog,{open:e,onOpenChange:a,children:(0,t.jsxs)(j.DialogContent,{className:"sm:max-w-lg p-0 gap-0 overflow-hidden !top-[10vh] !-translate-y-0",showCloseButton:!1,children:[(0,t.jsxs)("div",{className:"flex items-center border-b border-border px-4",children:[(0,t.jsx)(O.Search,{className:"h-4 w-4 text-muted-foreground"}),(0,t.jsx)("input",{ref:w,value:l,onChange:e=>c(e.target.value),placeholder:o("search.placeholder"),className:"flex-1 bg-transparent px-3 py-3.5 text-sm text-foreground placeholder-muted-foreground outline-none"}),l&&(0,t.jsx)(v.Button,{variant:"ghost",size:"icon",onClick:()=>{c(""),x([])},className:"text-muted-foreground",children:(0,t.jsx)(eh.X,{className:"h-3.5 w-3.5"})})]}),(0,t.jsx)("div",{className:"flex items-center gap-1 border-b border-border px-4 py-2",children:eg.map(e=>{let r=e.icon;return(0,t.jsxs)("button",{onClick:()=>u(e.id),className:`flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-all ${d===e.id?"bg-primary/10 text-primary ring-1 ring-primary/20":"text-muted-foreground hover:bg-accent hover:text-foreground"}`,children:[(0,t.jsx)(r,{className:"h-3 w-3"}),o(e.key)]},e.id)})}),(0,t.jsxs)(g.ScrollArea,{className:"max-h-80",children:[!l.trim()&&(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-sm text-muted-foreground",children:o("search.typeToSearch")}),l.trim()&&0===m.length&&!h&&(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-sm text-muted-foreground",children:o("search.noResults")}),"all"===d&&m.length>0&&(n=m.reduce((e,t)=>((e[t.type]??=[]).push(t),e),{}),ej.filter(e=>n[e]?.length).map(e=>(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"px-4 py-1.5 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground bg-muted/50",children:o(eb[e])}),n[e].map(e=>(0,t.jsx)(ev,{result:e,onSelect:y},`${e.type}-${e.id}`))]},e))),"all"!==d&&m.map(e=>(0,t.jsx)(ev,{result:e,onSelect:y},`${e.type}-${e.id}`))]})]})})}var eN=e.i(86982),ey=e.i(946960),ek=e.i(893832),eC=e.i(894296),eS=e.i(239358),eT=e.i(584685),eD=e.i(540032);function eP(e){return e.replace(/\.git\/?$/,"")}e.i(899561),e.i(171159);let eR=(0,N.createServerReference)("406f4c33d6ee0b57f32ef36912f062f165599174b0",N.callServer,void 0,N.findSourceMapURL,"resolveGitLocalPath");var eM=e.i(670074);function eA({open:e,onOpenChange:s,onCreateProject:a}){let{t:n,locale:o}=(0,P.useI18n)(),[i,l]=(0,r.useState)(""),[c,d]=(0,r.useState)(""),[u,m]=(0,r.useState)(""),[x,h]=(0,r.useState)(""),[p,f]=(0,r.useState)(""),[g,N]=(0,r.useState)(!1),[y,k]=(0,r.useState)("FRONTEND"),[C,S]=(0,r.useState)("idle"),[T,D]=(0,r.useState)(""),[M,A]=(0,r.useState)(!1),$=()=>{l(""),d(""),m(""),h(""),f(""),N(!1),k("FRONTEND"),S("idle"),D(""),A(!1)},z=async()=>{if(p.trim()&&!M&&"success"===C){A(!0);try{let e=await (0,eM.analyzeProjectDirectory)(p.trim(),o);m(e)}catch{R.toast.error(n("project.analyzeError"))}finally{A(!1)}}},E=async e=>{h(e),S("idle"),D("");let t=function(e){let t,r=e.match(/^git@([^:]+):(.+)$/);if(r)return{host:r[1],pathSegments:eP(r[2]).split("/").filter(Boolean)};try{t=new URL(e)}catch{return null}return{host:t.hostname,pathSegments:eP(decodeURIComponent(t.pathname)).split("/").filter(Boolean)}}(e);t&&t.pathSegments.length>0&&l(t.pathSegments[t.pathSegments.length-1]),g||f(await eR(e))},L=async()=>{if(x.trim()&&p.trim()){S("cloning"),D("");try{let e=function(e){let t=e.trim();if(!t)return"";if(t.startsWith("git@")||t.startsWith("ssh://")||t.endsWith(".git"))return t;try{let e=new URL(t),r=e.hostname,s=decodeURIComponent(e.pathname).split("/").filter(Boolean);if("code.iflytek.com"===r){let e=[...s];"osc"===e[0]&&"_source"===e[1]&&(e=e.slice(2));let a=e.indexOf("-");if(a>0&&(e=e.slice(0,a)),0===e.length)return t;return`https://${r}/${e.join("/")}.git`}return`${e.origin}${e.pathname.replace(/\/$/,"")}.git`}catch{return t}}(x.trim()),t=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clone",url:e,path:p.trim()})}),r=await t.json();if(!t.ok){S("error"),D(r.error||"Clone failed");return}S("success")}catch{S("error"),D("Network error")}}},O=async()=>{i.trim()&&(await a?.({name:i.trim(),alias:c.trim()||void 0,description:u.trim()||void 0,gitUrl:x.trim()||void 0,localPath:p.trim()||void 0,projectType:y}),$(),s(!1))};return(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(j.Dialog,{open:e,onOpenChange:e=>{s(e),e||$()},disablePointerDismissal:!0,children:(0,t.jsxs)(j.DialogContent,{style:{maxWidth:"32rem"},children:[(0,t.jsx)(j.DialogHeader,{children:(0,t.jsx)(j.DialogTitle,{children:n("topbar.newProject")})}),(0,t.jsxs)("div",{className:"space-y-4 py-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.gitUrl")}),(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:n("project.gitUrlHint")}),(0,t.jsx)(w.Input,{placeholder:n("project.gitPlaceholder"),value:x,onChange:e=>E(e.target.value),className:"mt-1.5 font-mono text-xs"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.localPath")}),(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:n("project.localPathHint")}),(0,t.jsx)(w.Input,{placeholder:n("project.localPathPlaceholder"),value:p,onChange:e=>{f(e.target.value),N(!0)},className:"mt-1.5 font-mono text-xs w-full"}),p.trim().startsWith("~")&&(0,t.jsxs)("p",{className:"mt-1 flex items-center gap-1 text-[11px] text-amber-400",children:[(0,t.jsx)(eC.AlertCircle,{className:"h-3 w-3"}),n("project.tildeWarning")]}),x.trim()&&p.trim()&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,t.jsxs)(v.Button,{type:"button",disabled:"cloning"===C||"success"===C,onClick:L,className:"gap-1.5 text-xs bg-emerald-500/15 text-emerald-300 ring-1 ring-emerald-500/25 hover:bg-emerald-500/25 disabled:opacity-50",children:["cloning"===C?(0,t.jsx)(ey.Loader2,{className:"h-3 w-3 animate-spin"}):"success"===C?(0,t.jsx)(ek.Check,{className:"h-3 w-3"}):(0,t.jsx)(eu.GitBranch,{className:"h-3 w-3"}),"cloning"===C?n("git.cloning"):"success"===C?n("git.cloned"):n("git.clone")]}),"error"===C&&(0,t.jsxs)("span",{className:"flex items-center gap-1 text-[11px] text-rose-400",children:[(0,t.jsx)(eC.AlertCircle,{className:"h-3 w-3"}),T]}),"success"===C&&(0,t.jsx)("span",{className:"text-[11px] text-emerald-400",children:n("git.cloneSuccess")})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.name")}),(0,t.jsx)(w.Input,{placeholder:n("project.namePlaceholder"),value:i,onChange:e=>l(e.target.value),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.type.label")}),(0,t.jsx)("div",{className:"mt-1.5",children:(0,t.jsx)(eT.SegmentedControl,{options:[{value:"FRONTEND",label:n("project.type.frontend")},{value:"BACKEND",label:n("project.type.backend")}],value:y,onChange:k})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.alias")}),(0,t.jsx)(w.Input,{placeholder:n("project.aliasPlaceholder"),value:c,onChange:e=>d(e.target.value),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mt-0.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.description")}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsxs)(b.TooltipTrigger,{render:(0,t.jsx)(v.Button,{type:"button",variant:"ghost",onClick:z,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!p.trim()||M?"opacity-50":""}`}),children:[M?(0,t.jsx)(ey.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(eS.Sparkles,{className:"h-3 w-3"}),M?n("project.analyzing"):n("project.genDesc")]}),(0,t.jsx)(b.TooltipContent,{children:p.trim()?"success"!==C?n("project.genDescNotCloned"):n("project.genDescReady"):n("project.genDescNoPath")})]})]}),(0,t.jsx)(eD.Textarea,{placeholder:n("project.descPlaceholder"),value:u,onChange:e=>m(e.target.value),rows:3,className:"mt-1.5 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none max-h-[200px] overflow-y-auto"})]})]}),(0,t.jsxs)(j.DialogFooter,{children:[(0,t.jsx)(v.Button,{variant:"outline",onClick:()=>{s(!1),$()},children:n("common.cancel")}),(0,t.jsx)(v.Button,{onClick:O,disabled:!i.trim()||M,className:"bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",children:n("common.create")})]})]})})})}var e$=e.i(400395),e$=e$,ez=e.i(921280),eE=e.i(330521);let eL=(0,N.createServerReference)("60c9debab62ab636e3bb82d67fe9d032e6722bba52",N.callServer,void 0,N.findSourceMapURL,"migrateProjectPath"),eO=(0,N.createServerReference)("40d22d8522ddcd2962bee63eb58d49f34d0df34faf",N.callServer,void 0,N.findSourceMapURL,"checkMigrationSafety");function eI({open:e,onOpenChange:s,onCreateProject:a}){let{t:n,locale:o}=(0,P.useI18n)(),[i,l]=(0,r.useState)(""),[c,d]=(0,r.useState)(""),[u,m]=(0,r.useState)(""),[x,p]=(0,r.useState)(""),[f,g]=(0,r.useState)(""),[N,y]=(0,r.useState)(!1),[k,C]=(0,r.useState)("FRONTEND"),[S,T]=(0,r.useState)(!1),[D,M]=(0,r.useState)(!1),[A,$]=(0,r.useState)(""),[z,E]=(0,r.useState)(!1),[L,O]=(0,r.useState)(""),[I,B]=(0,r.useState)(""),[F,_]=(0,r.useState)(!1),[U,W]=(0,r.useState)(!1),H=()=>{l(""),d(""),m(""),p(""),g(""),C("FRONTEND"),T(!1),M(!1),$(""),E(!1),O(""),B(""),_(!1),W(!1)},K=async e=>{g(e),T(!1),M(!1),$(""),O(""),B(""),_(!1),l(e.split("/").filter(Boolean).pop()??"");try{let t=await fetch(`/api/git?path=${encodeURIComponent(e)}`);if(t.ok){let e=await t.json();if(e.isGit&&e.remoteUrl){p(e.remoteUrl),T(!0);let t=e.remoteUrl.match(/\/([^/]+?)(?:\.git)?$/);t&&l(t[1])}}}catch{}},V=(0,r.useCallback)(async e=>{if(M(e),O(""),B(""),_(!1),!e)return void $("");if(x)try{let e=await eR(x);e&&($(e),e===f&&_(!0))}catch{}if(f)try{let e=await fetch(`/api/git?path=${encodeURIComponent(f)}&checkWorktrees=true`);e.ok&&(await e.json()).hasWorktrees&&B(n("project.worktreeWarning"))}catch{}},[x,f]),q=async()=>{if(f&&!U){W(!0);try{let e=await (0,eM.analyzeProjectDirectory)(f.trim(),o);m(e)}catch{R.toast.error(n("project.analyzeError"))}finally{W(!1)}}},X=async()=>{if(!i.trim())return;let e={name:i.trim(),alias:c.trim()||void 0,description:u.trim()||void 0,gitUrl:x.trim()||void 0,localPath:f.trim()||void 0,projectType:k},t=await a?.(e);if(D&&A&&A!==f&&t&&"id"in t){E(!0),O("");let e=await eO(t.id);if(!e.safe){O(e.reason),E(!1);return}let r=await eL(t.id,A);if(E(!1),!r.success)return void O(r.error??n("project.migrateError"));R.toast.success(n("project.migrateSuccess"))}H(),s(!1)},G=!i.trim()||!f.trim()||z||U||D&&!!I;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j.Dialog,{open:e,onOpenChange:e=>{s(e),e||H()},disablePointerDismissal:!0,children:(0,t.jsxs)(j.DialogContent,{style:{maxWidth:"32rem"},children:[(0,t.jsx)(j.DialogHeader,{children:(0,t.jsx)(j.DialogTitle,{children:n("topbar.importProject")})}),(0,t.jsxs)("div",{className:"space-y-4 py-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.localPath")}),(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:n("project.importHint")}),(0,t.jsxs)("div",{className:"mt-1.5 flex gap-2",children:[(0,t.jsx)(w.Input,{value:f,readOnly:!0,placeholder:n("project.localPathPlaceholder"),className:"flex-1 font-mono text-xs bg-muted/30"}),(0,t.jsxs)(v.Button,{type:"button",variant:"outline",onClick:()=>y(!0),className:"shrink-0 gap-1.5",children:[(0,t.jsx)(h.FolderOpen,{className:"h-3.5 w-3.5"}),n("folder.browse")]})]}),S&&(0,t.jsx)("p",{className:"mt-1.5 text-[11px] text-emerald-400",children:n("project.autoDetected")})]}),x&&(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.gitUrl")}),(0,t.jsx)(w.Input,{value:x,onChange:e=>p(e.target.value),className:"mt-1.5 font-mono text-xs"})]}),S&&f&&(0,t.jsxs)("div",{className:"rounded-md border border-border p-3 space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-xs font-medium",children:n("project.migrate")}),(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:n("project.migrateHint")})]}),(0,t.jsx)(eE.Switch,{checked:D,onCheckedChange:e=>V(e)})]}),D&&(0,t.jsxs)("div",{className:"space-y-2 pt-1",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-[10px] font-medium text-muted-foreground",children:n("project.targetPath")}),(0,t.jsx)(w.Input,{value:A,onChange:e=>{$(e.target.value),_(e.target.value===f)},placeholder:"/path/to/canonical/location",className:"mt-1 font-mono text-xs"})]}),F&&(0,t.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-sky-400",children:[(0,t.jsx)(e$.default,{className:"h-3 w-3"}),n("project.samePathInfo")]}),I&&(0,t.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-amber-400",children:[(0,t.jsx)(eC.AlertCircle,{className:"h-3 w-3"}),I]}),L&&(0,t.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-rose-400",children:[(0,t.jsx)(eC.AlertCircle,{className:"h-3 w-3"}),L]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.name")}),(0,t.jsx)(w.Input,{placeholder:n("project.namePlaceholder"),value:i,onChange:e=>l(e.target.value),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.type.label")}),(0,t.jsx)("div",{className:"mt-1.5",children:(0,t.jsx)(eT.SegmentedControl,{options:[{value:"FRONTEND",label:n("project.type.frontend")},{value:"BACKEND",label:n("project.type.backend")}],value:k,onChange:C})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.alias")}),(0,t.jsx)(w.Input,{placeholder:n("project.aliasPlaceholder"),value:c,onChange:e=>d(e.target.value),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mt-0.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.description")}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsxs)(b.TooltipTrigger,{render:(0,t.jsx)(v.Button,{type:"button",variant:"ghost",onClick:q,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!f||U?"opacity-50":""}`}),children:[U?(0,t.jsx)(ey.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(eS.Sparkles,{className:"h-3 w-3"}),U?n("project.analyzing"):n("project.genDesc")]}),(0,t.jsx)(b.TooltipContent,{children:f?n("project.genDescReady"):n("project.genDescNoPath")})]})]}),(0,t.jsx)(eD.Textarea,{placeholder:n("project.descPlaceholder"),value:u,onChange:e=>m(e.target.value),rows:3,className:"mt-1.5 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none max-h-[200px] overflow-y-auto"})]})]}),(0,t.jsxs)(j.DialogFooter,{children:[(0,t.jsx)(v.Button,{variant:"outline",onClick:()=>{s(!1),H()},children:n("common.cancel")}),(0,t.jsx)(v.Button,{onClick:X,disabled:G,className:"bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",children:z?n("project.migrating"):n("common.create")})]})]})}),(0,t.jsx)(ez.FolderBrowserDialog,{open:N,onOpenChange:y,onSelect:e=>K(e)})]})}function eB({onCreateProject:e,username:a}){let{t:n,locale:i,setLocale:l}=(0,P.useI18n)(),{isOpen:c,toggleAssistant:d}=(0,eN.useAssistant)(),{resolvedTheme:u,toggleTheme:m,triggerRef:x}=function(){let{resolvedTheme:e,setTheme:t}=(0,L.useTheme)(),s=(0,r.useRef)(null),a=(0,r.useCallback)(r=>{let s="dark"===e?"light":"dark";if("u">typeof document&&"startViewTransition"in document&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){let e=r?.clientX??window.innerWidth/2,a=r?.clientY??0,n=Math.hypot(Math.max(e,window.innerWidth-e),Math.max(a,window.innerHeight-a));document.startViewTransition(()=>{t(s)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${e}px ${a}px)`,`circle(${n}px at ${e}px ${a}px)`]},{duration:400,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})}else t(s)},[e,t]);return{resolvedTheme:e,toggleTheme:a,triggerRef:s}}(),p=(0,s.useRouter)(),[g,j]=(0,r.useState)(!1),[w,N]=(0,r.useState)(!1),[y,k]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"k"===e.key&&(e.preventDefault(),j(!0))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("header",{className:"flex h-12 items-center justify-between border-b border-border bg-background/80 px-5 backdrop-blur-sm",children:[(0,t.jsx)("div",{className:"w-40"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)(v.Button,{variant:"outline",onClick:()=>j(!0),className:"h-8 w-[400px] justify-start gap-2 bg-muted/50 text-muted-foreground hover:bg-muted",children:[(0,t.jsx)(O.Search,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{className:"flex-1 text-left",suppressHydrationWarning:!0,children:n("topbar.searchPlaceholder")}),(0,t.jsxs)("kbd",{className:"mr-1 flex items-center gap-0.5 rounded border border-border bg-background px-1.5 py-0.5 text-[10px] font-mono",children:[(0,t.jsx)(B,{className:"h-2.5 w-2.5"}),"K"]})]}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{delay:500,render:(0,t.jsx)("button",{"data-tour":"open-assistant",onClick:d,"aria-label":n("assistant.iconLabel"),className:["cursor-pointer rounded-lg p-2 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",c?"bg-accent text-foreground":""].join(" ")}),children:(0,t.jsx)(_.Bot,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{children:n("assistant.iconLabel")})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsxs)(b.TooltipTrigger,{render:(0,t.jsx)(v.Button,{variant:"ghost",onClick:()=>l("zh"===i?"en":"zh"),className:"text-muted-foreground"}),children:[(0,t.jsx)(F.Globe,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{className:"text-[11px] font-semibold",children:"zh"===i?"EN":"δΈ"})]}),(0,t.jsx)(b.TooltipContent,{children:n("settings.language")})]}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)(v.Button,{ref:x,variant:"ghost",size:"icon",onClick:m,className:"text-muted-foreground"}),children:"dark"===u?(0,t.jsx)(U.Sun,{className:"h-4 w-4"}):(0,t.jsx)(W.Moon,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{children:n("settings.theme")})]}),(0,t.jsx)("div",{className:"h-4 w-px bg-border"}),(0,t.jsxs)(v.Button,{variant:"outline",className:"gap-1.5 ring-1 ring-border hover:bg-accent",onClick:()=>k(!0),children:[(0,t.jsx)(h.FolderOpen,{className:"h-3.5 w-3.5"}),n("topbar.importProject")]}),(0,t.jsxs)(v.Button,{"data-tour":"create-project",className:"gap-1.5 bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",onClick:()=>N(!0),children:[(0,t.jsx)(o.Plus,{className:"h-3.5 w-3.5"}),n("topbar.newProject")]}),(0,t.jsxs)(f.DropdownMenu,{children:[(0,t.jsx)(f.DropdownMenuTrigger,{render:(0,t.jsxs)("button",{className:"ml-0.5 flex cursor-pointer items-center gap-1.5 rounded-lg px-2.5 py-1 transition-colors hover:bg-accent",children:[a&&(0,t.jsx)("span",{className:"max-w-[80px] truncate text-xs text-muted-foreground",children:a}),(0,t.jsx)(el,{className:"h-7 w-7 ring-1 ring-border",children:(0,t.jsx)(ec,{className:"bg-emerald-500/20 text-emerald-400 text-[10px] font-semibold",children:a?a.trim().split(/\s+/).filter(e=>e.length>0).slice(0,2).map(e=>e[0].toUpperCase()).join(""):"U"})})]})}),(0,t.jsx)(f.DropdownMenuContent,{align:"end",sideOffset:8,className:"w-40",children:(0,t.jsxs)(f.DropdownMenuItem,{onClick:()=>p.push("/settings"),children:[(0,t.jsx)(I.Settings,{className:"mr-2 h-3.5 w-3.5"}),n("settings.title")]})})]})]})]}),(0,t.jsx)(ew,{open:g,onOpenChange:j}),(0,t.jsx)(eA,{open:w,onOpenChange:N,onCreateProject:e}),(0,t.jsx)(eI,{open:y,onOpenChange:k,onCreateProject:e})]})}var eF=e.i(79769),e_=r,eU=e.i(126741);class eW extends e_.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error("[ErrorBoundary]",e,t)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 p-8 text-center",children:[(0,t.jsx)(eC.AlertCircle,{className:"h-8 w-8 text-destructive"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium text-foreground",children:"Something went wrong"}),(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:this.state.error?.message??"An unexpected error occurred"})]}),(0,t.jsxs)(v.Button,{variant:"outline",onClick:()=>this.setState({hasError:!1,error:null}),children:[(0,t.jsx)(eU.RefreshCw,{className:"mr-2 h-3.5 w-3.5"}),"Retry"]})]}):this.props.children}}var eH=e.i(244501),eK=e.i(415411),eV=e.i(458851);let eq=(0,eK.default)(()=>e.A(97351).then(e=>({default:e.AssistantChat})),{loadableGenerated:{modules:[834880]},ssr:!1});function eX({mode:e}){let{isOpen:r,closeAssistant:s,sessions:a,activeSessionId:n,createNewSession:i,switchSession:c,removeSession:d}=(0,eN.useAssistant)(),{t:u}=(0,P.useI18n)(),m=a.find(e=>e.id===n),x=m?.title??u("assistant.newSession");return(0,t.jsxs)("div",{className:"sidebar"===e?"min-w-[320px] max-w-[480px] w-[30vw] shrink-0 border-r border-border flex flex-col bg-sidebar overflow-hidden":"flex flex-col h-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"header-sm flex items-center px-4 gap-2 bg-sidebar",children:[(0,t.jsx)(_.Bot,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-semibold text-foreground shrink-0",children:u("assistant.title")}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsxs)(f.DropdownMenu,{children:[(0,t.jsxs)(f.DropdownMenuTrigger,{className:"flex items-center gap-1 h-8 px-2 rounded-md text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground max-w-[120px] truncate","aria-label":u("assistant.sessionList"),children:[(0,t.jsx)("span",{className:"truncate",children:x}),(0,t.jsx)(eV.ChevronDown,{className:"h-3 w-3 shrink-0"})]}),(0,t.jsxs)(f.DropdownMenuContent,{side:"bottom",align:"end",sideOffset:4,children:[0===a.length?(0,t.jsx)("div",{className:"px-2 py-4 text-xs text-muted-foreground text-center",children:u("assistant.noSessions")}):a.map(e=>(0,t.jsxs)(f.DropdownMenuItem,{className:"flex items-center justify-between gap-2 pr-1",onClick:()=>c(e.id),children:[(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 min-w-0",children:[(0,t.jsx)("span",{className:"text-xs truncate max-w-[140px]",children:e.title}),(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground",children:function(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<60)return`${t}s ago`;let r=Math.floor(t/60);if(r<60)return`${r}m ago`;let s=Math.floor(r/60);if(s<24)return`${s}h ago`;let a=Math.floor(s/24);return`${a}d ago`}(e.updatedAt)})]}),(0,t.jsx)(v.Button,{variant:"ghost",className:"h-6 w-6 p-0 shrink-0 opacity-50 hover:opacity-100 hover:text-destructive",onClick:t=>{t.stopPropagation(),d(e.id)},"aria-label":u("assistant.deleteSession"),children:(0,t.jsx)(l.Trash2,{className:"h-3 w-3"})})]},e.id)),a.length>0&&(0,t.jsx)(f.DropdownMenuSeparator,{}),(0,t.jsxs)(f.DropdownMenuItem,{onClick:i,children:[(0,t.jsx)(o.Plus,{className:"h-3 w-3 mr-1"}),(0,t.jsx)("span",{className:"text-xs",children:u("assistant.newSession")})]})]})]}),(0,t.jsx)(v.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:i,"aria-label":u("assistant.newSession"),children:(0,t.jsx)(o.Plus,{className:"h-4 w-4"})})]}),(0,t.jsx)(v.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:s,"aria-label":u("assistant.closeLabel"),children:(0,t.jsx)(eh.X,{className:"h-4 w-4"})})]}),(0,t.jsx)("div",{className:"flex-1 overflow-hidden",children:r?(0,t.jsx)(eq,{}):null})]})}var eG=e.i(316403);function eJ({onDismiss:e}){let{t:s}=(0,P.useI18n)(),[a,n]=(0,r.useState)(!1);(0,r.useEffect)(()=>{"Notification"in window&&"default"===window.Notification.permission&&n(!0)},[]);let o=async()=>{"default"!==await window.Notification.requestPermission()&&(n(!1),e?.())};return a?(0,t.jsxs)("div",{className:"fixed top-3 left-1/2 -translate-x-1/2 z-[9999] w-auto max-w-lg bg-card border rounded-lg shadow-lg px-4 py-2.5 flex items-center gap-3 animate-in fade-in slide-in-from-top-4 duration-500",children:[(0,t.jsx)(eG.Bell,{className:"h-4 w-4 shrink-0 text-primary"}),(0,t.jsx)("span",{className:"flex-1 text-sm",children:s("notification.permissionPrompt")}),(0,t.jsx)(v.Button,{size:"default",onClick:o,children:s("notification.allow")}),(0,t.jsx)(v.Button,{variant:"ghost",size:"default",onClick:()=>{n(!1),e?.()},children:s("notification.dismiss")})]}):null}var eY=e.i(370951),eZ=e.i(690175);let eQ=[{target:"create-workspace",titleKey:"tour.step1.title",descKey:"tour.step1.desc",placement:"right"},{target:"create-project",titleKey:"tour.step2.title",descKey:"tour.step2.desc",placement:"bottom",waitForTarget:!0},{target:"open-assistant",titleKey:"tour.step3.title",descKey:"tour.step3.desc",placement:"bottom"}];function e0({onComplete:e}){let{t:s}=(0,P.useI18n)(),[a,n]=(0,r.useState)(0),[o,i]=(0,r.useState)(null),[l,c]=(0,r.useState)(!1),d=(0,r.useRef)(null),u=eQ[a],m=(0,r.useCallback)(async()=>{await (0,eZ.setConfigValue)("onboarding.tourCompleted",!0),e()},[e]),x=(0,r.useCallback)(()=>u?document.querySelector(`[data-tour="${u.target}"]`):null,[u]),h=(0,r.useCallback)(()=>{let e=x();e?(i(e.getBoundingClientRect()),c(!0)):c(!1)},[x]);(0,r.useEffect)(()=>{h();let e=null;!l&&u?.waitForTarget&&(d.current=new MutationObserver(()=>{let t=x();t&&(i(t.getBoundingClientRect()),c(!0),d.current?.disconnect(),e&&clearTimeout(e))}),d.current.observe(document.body,{childList:!0,subtree:!0}),e=setTimeout(()=>{!x()&&(n(e=>{let t=e+1;return t<eQ.length?t:e}),a>=eQ.length-1&&m())},5e3));let t=()=>h();return window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{d.current?.disconnect(),e&&clearTimeout(e),window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[a,u,x,h,l,m]),(0,r.useEffect)(()=>{let e=setInterval(h,1e3);return()=>clearInterval(e)},[h]);let p=(0,r.useCallback)(()=>{a<eQ.length-1?(n(e=>e+1),c(!1)):m()},[a]);return u?(0,t.jsx)(t.Fragment,{children:l&&o&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"fixed inset-0 z-[10000]",style:{background:`radial-gradient(
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,899561,(e,t,r)=>{var s;"u">typeof __nccwpck_require__&&(__nccwpck_require__.ab="/ROOT/project/f/tower/node_modules/.pnpm/next@16.2.1_@babel+core@7.29.0_@playwright+test@1.58.2_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/next/dist/compiled/os-browserify/"),(s={}).endianness=function(){return"LE"},s.hostname=function(){return"u">typeof location?location.hostname:""},s.loadavg=function(){return[]},s.uptime=function(){return 0},s.freemem=function(){return Number.MAX_VALUE},s.totalmem=function(){return Number.MAX_VALUE},s.cpus=function(){return[]},s.type=function(){return"Browser"},s.release=function(){return"u">typeof navigator?navigator.appVersion:""},s.networkInterfaces=s.getNetworkInterfaces=function(){return{}},s.arch=function(){return"javascript"},s.platform=function(){return"browser"},s.tmpdir=s.tmpDir=function(){return"/tmp"},s.EOL="\n",s.homedir=function(){return"/"},t.exports=s},171159,(e,t,r)=>{!function(){"use strict";var e={114:function(e){function t(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function r(e,t){for(var r,s="",a=0,n=-1,o=0,i=0;i<=e.length;++i){if(i<e.length)r=e.charCodeAt(i);else if(47===r)break;else r=47;if(47===r){if(n===i-1||1===o);else if(n!==i-1&&2===o){if(s.length<2||2!==a||46!==s.charCodeAt(s.length-1)||46!==s.charCodeAt(s.length-2)){if(s.length>2){var l=s.lastIndexOf("/");if(l!==s.length-1){-1===l?(s="",a=0):a=(s=s.slice(0,l)).length-1-s.lastIndexOf("/"),n=i,o=0;continue}}else if(2===s.length||1===s.length){s="",a=0,n=i,o=0;continue}}t&&(s.length>0?s+="/..":s="..",a=2)}else s.length>0?s+="/"+e.slice(n+1,i):s=e.slice(n+1,i),a=i-n-1;n=i,o=0}else 46===r&&-1!==o?++o:o=-1}return s}var s={resolve:function(){for(var e,s,a="",n=!1,o=arguments.length-1;o>=-1&&!n;o--)o>=0?s=arguments[o]:(void 0===e&&(e=""),s=e),t(s),0!==s.length&&(a=s+"/"+a,n=47===s.charCodeAt(0));if(a=r(a,!n),n)if(a.length>0)return"/"+a;else return"/";return a.length>0?a:"."},normalize:function(e){if(t(e),0===e.length)return".";var s=47===e.charCodeAt(0),a=47===e.charCodeAt(e.length-1);return(0!==(e=r(e,!s)).length||s||(e="."),e.length>0&&a&&(e+="/"),s)?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0==arguments.length)return".";for(var e,r=0;r<arguments.length;++r){var a=arguments[r];t(a),a.length>0&&(void 0===e?e=a:e+="/"+a)}return void 0===e?".":s.normalize(e)},relative:function(e,r){if(t(e),t(r),e===r||(e=s.resolve(e))===(r=s.resolve(r)))return"";for(var a=1;a<e.length&&47===e.charCodeAt(a);++a);for(var n=e.length,o=n-a,i=1;i<r.length&&47===r.charCodeAt(i);++i);for(var l=r.length-i,c=o<l?o:l,d=-1,u=0;u<=c;++u){if(u===c){if(l>c){if(47===r.charCodeAt(i+u))return r.slice(i+u+1);else if(0===u)return r.slice(i+u)}else o>c&&(47===e.charCodeAt(a+u)?d=u:0===u&&(d=0));break}var m=e.charCodeAt(a+u);if(m!==r.charCodeAt(i+u))break;47===m&&(d=u)}var x="";for(u=a+d+1;u<=n;++u)(u===n||47===e.charCodeAt(u))&&(0===x.length?x+="..":x+="/..");return x.length>0?x+r.slice(i+d):(i+=d,47===r.charCodeAt(i)&&++i,r.slice(i))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var r=e.charCodeAt(0),s=47===r,a=-1,n=!0,o=e.length-1;o>=1;--o)if(47===(r=e.charCodeAt(o))){if(!n){a=o;break}}else n=!1;return -1===a?s?"/":".":s&&1===a?"//":e.slice(0,a)},basename:function(e,r){if(void 0!==r&&"string"!=typeof r)throw TypeError('"ext" argument must be a string');t(e);var s,a=0,n=-1,o=!0;if(void 0!==r&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var i=r.length-1,l=-1;for(s=e.length-1;s>=0;--s){var c=e.charCodeAt(s);if(47===c){if(!o){a=s+1;break}}else -1===l&&(o=!1,l=s+1),i>=0&&(c===r.charCodeAt(i)?-1==--i&&(n=s):(i=-1,n=l))}return a===n?n=l:-1===n&&(n=e.length),e.slice(a,n)}for(s=e.length-1;s>=0;--s)if(47===e.charCodeAt(s)){if(!o){a=s+1;break}}else -1===n&&(o=!1,n=s+1);return -1===n?"":e.slice(a,n)},extname:function(e){t(e);for(var r=-1,s=0,a=-1,n=!0,o=0,i=e.length-1;i>=0;--i){var l=e.charCodeAt(i);if(47===l){if(!n){s=i+1;break}continue}-1===a&&(n=!1,a=i+1),46===l?-1===r?r=i:1!==o&&(o=1):-1!==r&&(o=-1)}return -1===r||-1===a||0===o||1===o&&r===a-1&&r===s+1?"":e.slice(r,a)},format:function(e){var t,r;if(null===e||"object"!=typeof e)throw TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return t=e.dir||e.root,r=e.base||(e.name||"")+(e.ext||""),t?t===e.root?t+r:t+"/"+r:r},parse:function(e){t(e);var r,s={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return s;var a=e.charCodeAt(0),n=47===a;n?(s.root="/",r=1):r=0;for(var o=-1,i=0,l=-1,c=!0,d=e.length-1,u=0;d>=r;--d){if(47===(a=e.charCodeAt(d))){if(!c){i=d+1;break}continue}-1===l&&(c=!1,l=d+1),46===a?-1===o?o=d:1!==u&&(u=1):-1!==o&&(u=-1)}return -1===o||-1===l||0===u||1===u&&o===l-1&&o===i+1?-1!==l&&(0===i&&n?s.base=s.name=e.slice(1,l):s.base=s.name=e.slice(i,l)):(0===i&&n?(s.name=e.slice(1,o),s.base=e.slice(1,l)):(s.name=e.slice(i,o),s.base=e.slice(i,l)),s.ext=e.slice(o,l)),i>0?s.dir=e.slice(0,i-1):n&&(s.dir="/"),s},sep:"/",delimiter:":",win32:null,posix:null};s.posix=s,e.exports=s}},r={};function s(t){var a=r[t];if(void 0!==a)return a.exports;var n=r[t]={exports:{}},o=!0;try{e[t](n,n.exports,s),o=!1}finally{o&&delete r[t]}return n.exports}s.ab="/ROOT/project/f/tower/node_modules/.pnpm/next@16.2.1_@babel+core@7.29.0_@playwright+test@1.58.2_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/next/dist/compiled/path-browserify/",t.exports=s(114)}()},400395,e=>{"use strict";let t=(0,e.i(863961).default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);e.s(["default",0,t])},178755,e=>{"use strict";var t=e.i(432377),r=e.i(85212),s=e.i(309542),a=e.i(631325),n=e.i(565037),o=e.i(780156),i=e.i(923344),l=e.i(909260),c=e.i(746357),d=e.i(863961);let u=(0,d.default)("chevrons-left",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]),m=(0,d.default)("tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);var x=e.i(555159),h=e.i(478430);let p=(0,d.default)("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);var f=e.i(942252),g=e.i(142124),j=e.i(718837),b=e.i(11915),v=e.i(711296),w=e.i(831349),N=e.i(543485);let y=(0,N.createServerReference)("4053cafa02cfb9b55db9d70ab047af599c29eeab39",N.callServer,void 0,N.findSourceMapURL,"createWorkspace"),k=(0,N.createServerReference)("60382ca4975ce6e8a3b876b6a2415db12da405a8d8",N.callServer,void 0,N.findSourceMapURL,"updateWorkspace"),C=(0,N.createServerReference)("4023799bb1b6e289b1eea80ca7e9f2e796aeccfd47",N.callServer,void 0,N.findSourceMapURL,"deleteWorkspace"),S=(0,N.createServerReference)("401b4febc29d245dbea2f3b93a5a36d6be2b17db72",N.callServer,void 0,N.findSourceMapURL,"getLabelsForWorkspace"),T=(0,N.createServerReference)("404ada0c6930a1e775347f7dcdf03527fce7fb1f3b",N.callServer,void 0,N.findSourceMapURL,"createLabel"),D=(0,N.createServerReference)("40d11c3253d7863ddc15a680b4feb0124c7adaf829",N.callServer,void 0,N.findSourceMapURL,"deleteLabel");var P=e.i(625054),R=e.i(286302);let M=["π","π","π―","π‘","π§","π¦","π¨","π","π¬","π","π","ποΈ"];function A({workspaces:e}){let d,j=(0,s.useRouter)(),w=(0,s.usePathname)(),{t:N}=(0,P.useI18n)(),[S,T]=(0,r.useState)(!1);(0,r.useEffect)(()=>{"true"===localStorage.getItem("sidebar-collapsed")&&T(!0)},[]);let[D,z]=(0,r.useState)(!1),[L,O]=(0,r.useState)(!1),[I,B]=(0,r.useState)(!1),[F,_]=(0,r.useState)(null),[U,W]=(0,r.useState)(""),[H,K]=(0,r.useState)(M[0]),[V,q]=(0,r.useState)(null),X=w.split("/workspaces/")[1]?.split("/")[0],G=(0,r.useCallback)(()=>{T(e=>{let t=!e;return localStorage.setItem("sidebar-collapsed",String(t)),t})},[]),J=(0,r.useCallback)(async()=>{if(!U.trim())return;let e=await y({name:U.trim(),description:H});W(""),K(M[0]),z(!1),j.refresh(),j.push(`/workspaces/${e.id}`)},[U,H,j]),Y=(0,r.useCallback)(async()=>{U.trim()&&V&&(await k(V,{name:U.trim(),description:H}),W(""),O(!1),q(null),j.refresh())},[U,H,V,j]),Z=(0,r.useCallback)(e=>{q(e.id),W(e.name),K(e.description&&M.includes(e.description)?e.description:M[0]),O(!0)},[]),Q=(0,r.useCallback)(async(t,r)=>{if(e.length<=1)return void R.toast.error(N("sidebar.lastWorkspaceError"));if(confirm(N("sidebar.deleteConfirm",{name:r})))try{await C(t),j.refresh(),X===t&&j.push("/workspaces")}catch{R.toast.error(N("sidebar.lastWorkspaceError"))}},[X,j,N,e.length]),ee=(0,r.useCallback)(e=>{_(e),B(!0)},[]),et=e=>e.description&&M.includes(e.description)?e.description:e.name.charAt(0).toUpperCase();if(S){let r;return(0,t.jsxs)("aside",{className:"flex h-screen w-14 flex-col items-center border-r border-border bg-sidebar py-3",children:[(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:G,className:"mb-4 flex h-9 w-9 items-center justify-center rounded-lg bg-primary/10 ring-1 ring-primary/20 transition-transform hover:scale-105"}),children:(0,t.jsx)("img",{src:"/logo.png",alt:"Tower",className:"h-6 w-6 rounded"})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:N("sidebar.expand")})]}),(0,t.jsx)(g.ScrollArea,{className:"flex-1 min-h-0",children:(0,t.jsxs)("div",{className:"flex flex-col items-center gap-1 px-0.5 pt-1",children:[e.map(e=>{let r=X===e.id,s=et(e);return(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:()=>{r||j.push(`/workspaces/${e.id}`)},className:`flex h-9 w-9 items-center justify-center rounded-lg transition-all ${r?"ring-1 ring-primary/20 text-foreground cursor-default":"text-muted-foreground hover:text-foreground cursor-pointer"}`}),children:(0,t.jsx)("span",{className:"flex h-7 w-7 items-center justify-center rounded-md bg-muted text-sm",children:M.includes(s)?s:(0,t.jsx)("span",{className:"text-xs font-semibold",children:s})})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:e.name})]},e.id)}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{"data-tour":"create-workspace",onClick:()=>z(!0),className:"flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"}),children:(0,t.jsx)(o.Plus,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:N("sidebar.newWorkspace")})]})]})}),(0,t.jsxs)("div",{className:"mt-2 flex flex-col items-center gap-1",children:[(r=X||e[0]?.id)?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:()=>j.push(`/workspaces/${r}/notes`),className:`rounded-lg p-2 transition-colors ${w.includes("/notes")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,t.jsx)(x.FileText,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:N("sidebar.notes")})]}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:()=>j.push(`/workspaces/${r}/assets`),className:`rounded-lg p-2 transition-colors ${w.includes("/assets")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,t.jsx)(h.FolderOpen,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:N("sidebar.assets")})]}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:()=>j.push(`/workspaces/${r}/archive`),className:`rounded-lg p-2 transition-colors ${w.includes("/archive")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,t.jsx)(n.Archive,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:N("sidebar.archive")})]})]}):null,(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:()=>j.push("/missions"),className:`rounded-lg p-2 transition-colors ${"/missions"===w?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,t.jsx)(p,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:N("missions.navLabel")})]})]}),(0,t.jsx)($,{open:D,onOpenChange:z,title:N("workspace.create"),name:U,onNameChange:W,icon:H,onIconChange:K,onSubmit:J,submitLabel:N("common.create"),nameLabel:N("workspace.name"),iconLabel:N("workspace.icon"),namePlaceholder:N("workspace.namePlaceholder"),cancelLabel:N("common.cancel")})]})}return(0,t.jsxs)("aside",{className:"noise relative flex h-screen w-56 flex-col border-r border-border bg-sidebar",children:[(0,t.jsxs)("div",{className:"relative z-10 flex items-center gap-3 px-4 py-4",children:[(0,t.jsx)("img",{src:"/logo.png",alt:"Tower",className:"h-9 w-9 rounded-lg"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("div",{className:"text-sm font-semibold tracking-tight text-foreground",children:"Tower"}),(0,t.jsx)("div",{className:"text-[10px] font-medium uppercase tracking-widest text-muted-foreground",children:"Studio"})]}),(0,t.jsx)(v.Button,{variant:"ghost",size:"icon-xs",onClick:G,className:"text-muted-foreground",title:N("sidebar.collapse"),children:(0,t.jsx)(u,{className:"h-4 w-4"})})]}),(0,t.jsxs)("div",{className:"relative z-10 flex items-center justify-between px-4 py-2",children:[(0,t.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:N("sidebar.workspace")}),(0,t.jsx)(v.Button,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground","data-tour":"create-workspace",onClick:()=>{W(""),K(M[0]),z(!0)},title:N("sidebar.newWorkspace"),children:(0,t.jsx)(o.Plus,{className:"h-3.5 w-3.5"})})]}),(0,t.jsx)(g.ScrollArea,{className:"relative z-10 mt-2 flex-1 min-h-0",children:(0,t.jsx)("div",{className:"px-2 py-1",children:e.map(r=>{var s;let a,n,o,d=X===r.id,u=et(r);return(0,t.jsxs)("div",{className:`group relative flex items-center rounded-lg transition-all ${d?"bg-accent ring-1 ring-primary/15":"hover:bg-accent/60"}`,children:[(0,t.jsxs)("button",{onClick:()=>{d||j.push(`/workspaces/${r.id}`)},className:`flex flex-1 items-center gap-2.5 px-3 py-2.5 text-left ${d?"cursor-default":"cursor-pointer"}`,children:[(0,t.jsx)("span",{className:"flex h-7 w-7 items-center justify-center rounded-md bg-muted text-sm",children:M.includes(u)?u:(0,t.jsx)("span",{className:"text-xs font-semibold text-muted-foreground",children:u})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:`truncate text-sm font-medium ${d?"text-foreground":"text-secondary-foreground"}`,children:r.name}),(0,t.jsx)("div",{className:"text-[11px] text-muted-foreground",children:(s=r.updatedAt,n=Math.floor((a=Date.now()-new Date(s).getTime())/6e4),o=Math.floor(a/36e5),n<60?`${n}m ago`:o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`)})]})]}),(0,t.jsxs)(f.DropdownMenu,{children:[(0,t.jsx)(f.DropdownMenuTrigger,{render:(0,t.jsx)("button",{className:"mr-2 rounded-md p-1 text-muted-foreground opacity-0 transition-all hover:bg-background hover:text-foreground group-hover:opacity-100",onClick:e=>e.stopPropagation()}),children:(0,t.jsx)(c.MoreHorizontal,{className:"h-3.5 w-3.5"})}),(0,t.jsxs)(f.DropdownMenuContent,{align:"start",side:"right",children:[(0,t.jsxs)(f.DropdownMenuItem,{onClick:()=>Z(r),children:[(0,t.jsx)(i.Pencil,{className:"mr-2 h-3.5 w-3.5"}),N("sidebar.rename")]}),(0,t.jsxs)(f.DropdownMenuItem,{onClick:()=>ee(r.id),children:[(0,t.jsx)(m,{className:"mr-2 h-3.5 w-3.5"}),N("sidebar.manageLabels")]}),(0,t.jsxs)(f.DropdownMenuItem,{className:e.length<=1?"text-muted-foreground opacity-50":"text-rose-400",disabled:e.length<=1,onClick:()=>Q(r.id,r.name),children:[(0,t.jsx)(l.Trash2,{className:"mr-2 h-3.5 w-3.5"}),N("sidebar.delete")]})]})]})]},r.id)})})}),(0,t.jsxs)(a.default,{href:"/missions",className:`relative z-10 flex items-center gap-2 border-t border-border px-4 py-3 text-[11px] cursor-pointer transition-colors ${"/missions"===w?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,t.jsx)(p,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:N("missions.navLabel")})]}),(d=X||e[0]?.id)?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(a.default,{href:`/workspaces/${d}/notes`,className:"relative z-10 flex items-center gap-2 border-t border-border px-4 py-3 text-[11px] text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:[(0,t.jsx)(x.FileText,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:N("sidebar.notes")})]}),(0,t.jsxs)(a.default,{href:`/workspaces/${d}/assets`,className:"relative z-10 flex items-center gap-2 px-4 py-3 text-[11px] text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:[(0,t.jsx)(h.FolderOpen,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:N("sidebar.assets")})]}),(0,t.jsxs)(a.default,{href:`/workspaces/${d}/archive`,className:"relative z-10 flex items-center gap-2 px-4 py-3 text-[11px] text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:[(0,t.jsx)(n.Archive,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:N("sidebar.archive")})]})]}):null,(0,t.jsx)($,{open:D,onOpenChange:z,title:N("workspace.create"),name:U,onNameChange:W,icon:H,onIconChange:K,onSubmit:J,submitLabel:N("common.create"),nameLabel:N("workspace.name"),iconLabel:N("workspace.icon"),namePlaceholder:N("workspace.namePlaceholder"),cancelLabel:N("common.cancel")}),(0,t.jsx)($,{open:L,onOpenChange:e=>{O(e),e||q(null)},title:N("workspace.edit"),name:U,onNameChange:W,icon:H,onIconChange:K,onSubmit:Y,submitLabel:N("common.save"),nameLabel:N("workspace.name"),iconLabel:N("workspace.icon"),namePlaceholder:N("workspace.namePlaceholder"),cancelLabel:N("common.cancel")}),F&&(0,t.jsx)(E,{open:I,onOpenChange:e=>{B(e),e||_(null)},workspaceId:F})]})}function $({open:e,onOpenChange:r,title:s,name:a,onNameChange:n,icon:o,onIconChange:i,onSubmit:l,submitLabel:c,nameLabel:d,iconLabel:u,namePlaceholder:m,cancelLabel:x}){return(0,t.jsx)(j.Dialog,{open:e,onOpenChange:r,disablePointerDismissal:!0,children:(0,t.jsxs)(j.DialogContent,{className:"sm:max-w-sm",children:[(0,t.jsx)(j.DialogHeader,{children:(0,t.jsx)(j.DialogTitle,{children:s})}),(0,t.jsxs)("div",{className:"space-y-4 py-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:d}),(0,t.jsx)(w.Input,{placeholder:m,value:a,onChange:e=>n(e.target.value),onKeyDown:e=>"Enter"===e.key&&e.preventDefault(),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:u}),(0,t.jsx)("div",{className:"mt-1.5 grid grid-cols-6 gap-1.5",children:M.map(e=>(0,t.jsx)("button",{onClick:()=>i(e),className:`flex h-10 w-10 items-center justify-center rounded-lg text-lg transition-all ${o===e?"bg-primary/15 ring-2 ring-primary/30 scale-110":"bg-muted hover:bg-accent"}`,children:e},e))})]})]}),(0,t.jsxs)(j.DialogFooter,{children:[(0,t.jsx)(v.Button,{variant:"outline",onClick:()=>r(!1),children:x}),(0,t.jsx)(v.Button,{onClick:l,disabled:!a.trim(),className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:c})]})]})})}let z=["#3b82f6","#ef4444","#f59e0b","#10b981","#8b5cf6","#ec4899","#06b6d4","#f97316"];function E({open:e,onOpenChange:s,workspaceId:a}){let{t:n}=(0,P.useI18n)(),[o,i]=(0,r.useState)([]),[l,c]=(0,r.useState)(""),[d,u]=(0,r.useState)(z[0]);(0,r.useEffect)(()=>{e&&S(a).then(i)},[e,a]);let m=async()=>{l.trim()&&(await T({name:l.trim(),color:d,workspaceId:a}),i(await S(a)),c(""))},x=async e=>{await D(e),i(t=>t.filter(t=>t.id!==e))};return(0,t.jsx)(j.Dialog,{open:e,onOpenChange:s,disablePointerDismissal:!0,children:(0,t.jsxs)(j.DialogContent,{className:"sm:max-w-sm",children:[(0,t.jsx)(j.DialogHeader,{children:(0,t.jsx)(j.DialogTitle,{children:n("label.manage")})}),(0,t.jsxs)("div",{className:"space-y-3 py-2",children:[o.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"h-3 w-3 rounded-full",style:{backgroundColor:e.color}}),(0,t.jsx)("span",{className:"flex-1 text-sm text-foreground",children:e.name}),e.isBuiltin?(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground",children:n("label.builtin")}):(0,t.jsx)("button",{onClick:()=>x(e.id),className:"text-xs text-rose-400 hover:text-rose-300",children:n("common.delete")})]},e.id)),(0,t.jsxs)("div",{className:"border-t border-border pt-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(w.Input,{placeholder:n("label.name"),value:l,onChange:e=>c(e.target.value),onKeyDown:e=>"Enter"===e.key&&e.preventDefault(),className:"flex-1 h-8"}),(0,t.jsx)(v.Button,{size:"sm",onClick:m,disabled:!l.trim(),className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:n("label.add")})]}),(0,t.jsx)("div",{className:"mt-2 flex gap-1.5",children:z.map(e=>(0,t.jsx)("button",{onClick:()=>u(e),className:`h-5 w-5 rounded-full transition-all ${d===e?"ring-2 ring-offset-2 ring-offset-background ring-foreground/30 scale-110":""}`,style:{backgroundColor:e}},e))})]})]})]})})}var L=e.i(275283),O=e.i(677436),I=e.i(103295);let B=(0,d.default)("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);var F=e.i(802461),_=e.i(867900),U=e.i(811424),W=e.i(809250);e.s([],732490),e.i(732490),e.i(129893);var H=e.i(793988),K=e.i(499875);let V=r.createContext(void 0);function q(){let e=r.useContext(V);if(void 0===e)throw Error((0,K.default)(13));return e}let X={imageLoadingStatus:()=>null},G=r.forwardRef(function(e,s){let{className:a,render:n,...o}=e,[i,l]=r.useState("idle"),c=r.useMemo(()=>({imageLoadingStatus:i,setImageLoadingStatus:l}),[i,l]),d=(0,H.useRenderElement)("span",e,{state:{imageLoadingStatus:i},ref:s,props:o,stateAttributesMapping:X});return(0,t.jsx)(V.Provider,{value:c,children:d})});var J=e.i(357030),Y=e.i(284060),Z=e.i(412360),Q=e.i(144909),ee=e.i(883993),et=e.i(166508);let er={...X,...Q.transitionStatusMapping},es=r.forwardRef(function(e,t){let{className:s,render:a,onLoadingStatusChange:n,referrerPolicy:o,crossOrigin:i,...l}=e,c=q(),d=function(e,{referrerPolicy:t,crossOrigin:s}){let[a,n]=r.useState("idle");return(0,Y.useIsoLayoutEffect)(()=>{if(!e)return n("error"),et.NOOP;let r=!0,a=new window.Image,o=e=>()=>{r&&n(e)};return n("loading"),a.onload=o("loaded"),a.onerror=o("error"),t&&(a.referrerPolicy=t),a.crossOrigin=s??null,a.src=e,()=>{r=!1}},[e,s,t]),a}(e.src,{referrerPolicy:o,crossOrigin:i}),u="loaded"===d,{mounted:m,transitionStatus:x,setMounted:h}=(0,ee.useTransitionStatus)(u),p=r.useRef(null),f=(0,J.useStableCallback)(e=>{n?.(e),c.setImageLoadingStatus(e)});(0,Y.useIsoLayoutEffect)(()=>{"idle"!==d&&f(d)},[d,f]),(0,Z.useOpenChangeComplete)({open:u,ref:p,onComplete(){u||h(!1)}});let g=(0,H.useRenderElement)("img",e,{state:{imageLoadingStatus:d,transitionStatus:x},ref:[t,p],props:l,stateAttributesMapping:er,enabled:m});return m?g:null});var ea=e.i(617406);let en=r.forwardRef(function(e,t){let{className:s,render:a,delay:n,...o}=e,{imageLoadingStatus:i}=q(),[l,c]=r.useState(void 0===n),d=(0,ea.useTimeout)();return r.useEffect(()=>(void 0!==n&&d.start(n,()=>c(!0)),d.clear),[d,n]),(0,H.useRenderElement)("span",e,{state:{imageLoadingStatus:i},ref:t,props:o,stateAttributesMapping:X,enabled:"loaded"!==i&&l})});e.s(["Fallback",0,en,"Image",0,es,"Root",0,G],50152);var eo=e.i(50152),eo=eo,ei=e.i(937756);function el({className:e,size:r="default",...s}){return(0,t.jsx)(eo.Root,{"data-slot":"avatar","data-size":r,className:(0,ei.cn)("group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten",e),...s})}function ec({className:e,...r}){return(0,t.jsx)(eo.Fallback,{"data-slot":"avatar-fallback",className:(0,ei.cn)("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",e),...r})}let ed=(0,d.default)("folder-kanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);var eu=e.i(357334);let em=(0,d.default)("sticky-note",[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}]]),ex=(0,d.default)("package-2",[["path",{d:"M12 3v6",key:"1holv5"}],["path",{d:"M16.76 3a2 2 0 0 1 1.8 1.1l2.23 4.479a2 2 0 0 1 .21.891V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9.472a2 2 0 0 1 .211-.894L5.45 4.1A2 2 0 0 1 7.24 3z",key:"187q7i"}],["path",{d:"M3.054 9.013h17.893",key:"grwhos"}]]);var eh=e.i(996032);let ep=(0,N.createServerReference)("609244a9f3f4f377d81d0ae7115b92c04e7345c72c",N.callServer,void 0,N.findSourceMapURL,"globalSearch");var ef=e.i(856681);let eg=[{id:"all",key:"search.all",icon:O.Search},{id:"task",key:"search.task",icon:x.FileText},{id:"project",key:"search.project",icon:ed},{id:"repository",key:"search.repository",icon:eu.GitBranch},{id:"note",key:"search.note",icon:em},{id:"asset",key:"search.asset",icon:ex}],ej=["task","project","repository","note","asset"],eb={task:"search.task",project:"search.project",repository:"search.repository",note:"search.note",asset:"search.asset"};function ev({result:e,onSelect:r}){let s=eg.find(t=>t.id===e.type)?.icon??x.FileText;return(0,t.jsxs)("button",{onClick:()=>r(e),className:"flex w-full items-center gap-3 border-b border-border/30 px-4 py-3 text-left transition-colors hover:bg-accent last:border-b-0",children:[(0,t.jsx)("div",{className:"rounded-md bg-muted p-1.5",children:(0,t.jsx)(s,{className:"h-3.5 w-3.5 text-muted-foreground"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:"text-sm font-medium text-foreground truncate",children:e.title}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:e.subtitle}),e.snippet&&(0,t.jsx)("div",{className:"text-xs text-muted-foreground/70 truncate mt-0.5",children:e.snippet})]})]})}function ew({open:e,onOpenChange:a}){let n,{t:o}=(0,P.useI18n)(),i=(0,s.useRouter)(),[l,c]=(0,r.useState)(""),[d,u]=(0,r.useState)("all"),[m,x]=(0,r.useState)([]),[h,p]=(0,r.useState)(!1),[f,b]=(0,r.useState)(250),w=(0,r.useRef)(null),N=(0,r.useRef)(null);(0,r.useEffect)(()=>{e&&((0,ef.getConfigValue)("search.debounceMs",250).then(b),setTimeout(()=>w.current?.focus(),100),c(""),x([]))},[e]),(0,r.useEffect)(()=>{if(N.current&&clearTimeout(N.current),!l.trim()){x([]),p(!1);return}p(!0);let e=!1;return N.current=setTimeout(async()=>{let t=await ep(l,d);e||(x(t),p(!1))},f),()=>{N.current&&clearTimeout(N.current),e=!0}},[l,d,f]);let y=(0,r.useCallback)(e=>{i.push(e.navigateTo),a(!1)},[i,a]);return(0,t.jsx)(j.Dialog,{open:e,onOpenChange:a,children:(0,t.jsxs)(j.DialogContent,{className:"sm:max-w-lg p-0 gap-0 overflow-hidden !top-[10vh] !-translate-y-0",showCloseButton:!1,children:[(0,t.jsxs)("div",{className:"flex items-center border-b border-border px-4",children:[(0,t.jsx)(O.Search,{className:"h-4 w-4 text-muted-foreground"}),(0,t.jsx)("input",{ref:w,value:l,onChange:e=>c(e.target.value),placeholder:o("search.placeholder"),className:"flex-1 bg-transparent px-3 py-3.5 text-sm text-foreground placeholder-muted-foreground outline-none"}),l&&(0,t.jsx)(v.Button,{variant:"ghost",size:"icon",onClick:()=>{c(""),x([])},className:"text-muted-foreground",children:(0,t.jsx)(eh.X,{className:"h-3.5 w-3.5"})})]}),(0,t.jsx)("div",{className:"flex items-center gap-1 border-b border-border px-4 py-2",children:eg.map(e=>{let r=e.icon;return(0,t.jsxs)("button",{onClick:()=>u(e.id),className:`flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-all ${d===e.id?"bg-primary/10 text-primary ring-1 ring-primary/20":"text-muted-foreground hover:bg-accent hover:text-foreground"}`,children:[(0,t.jsx)(r,{className:"h-3 w-3"}),o(e.key)]},e.id)})}),(0,t.jsxs)(g.ScrollArea,{className:"max-h-80",children:[!l.trim()&&(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-sm text-muted-foreground",children:o("search.typeToSearch")}),l.trim()&&0===m.length&&!h&&(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-sm text-muted-foreground",children:o("search.noResults")}),"all"===d&&m.length>0&&(n=m.reduce((e,t)=>((e[t.type]??=[]).push(t),e),{}),ej.filter(e=>n[e]?.length).map(e=>(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"px-4 py-1.5 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground bg-muted/50",children:o(eb[e])}),n[e].map(e=>(0,t.jsx)(ev,{result:e,onSelect:y},`${e.type}-${e.id}`))]},e))),"all"!==d&&m.map(e=>(0,t.jsx)(ev,{result:e,onSelect:y},`${e.type}-${e.id}`))]})]})})}var eN=e.i(86982),ey=e.i(946960),ek=e.i(893832),eC=e.i(894296),eS=e.i(239358),eT=e.i(584685),eD=e.i(540032);function eP(e){return e.replace(/\.git\/?$/,"")}e.i(899561),e.i(171159);let eR=(0,N.createServerReference)("405f61fe259486435dbe10e4e794fd1e184ebe56aa",N.callServer,void 0,N.findSourceMapURL,"resolveGitLocalPath");var eM=e.i(981955);function eA({open:e,onOpenChange:s,onCreateProject:a}){let{t:n,locale:o}=(0,P.useI18n)(),[i,l]=(0,r.useState)(""),[c,d]=(0,r.useState)(""),[u,m]=(0,r.useState)(""),[x,h]=(0,r.useState)(""),[p,f]=(0,r.useState)(""),[g,N]=(0,r.useState)(!1),[y,k]=(0,r.useState)("FRONTEND"),[C,S]=(0,r.useState)("idle"),[T,D]=(0,r.useState)(""),[M,A]=(0,r.useState)(!1),$=()=>{l(""),d(""),m(""),h(""),f(""),N(!1),k("FRONTEND"),S("idle"),D(""),A(!1)},z=async()=>{if(p.trim()&&!M&&"success"===C){A(!0);try{let e=await (0,eM.analyzeProjectDirectory)(p.trim(),o);m(e)}catch{R.toast.error(n("project.analyzeError"))}finally{A(!1)}}},E=async e=>{h(e),S("idle"),D("");let t=function(e){let t,r=e.match(/^git@([^:]+):(.+)$/);if(r)return{host:r[1],pathSegments:eP(r[2]).split("/").filter(Boolean)};try{t=new URL(e)}catch{return null}return{host:t.hostname,pathSegments:eP(decodeURIComponent(t.pathname)).split("/").filter(Boolean)}}(e);t&&t.pathSegments.length>0&&l(t.pathSegments[t.pathSegments.length-1]),g||f(await eR(e))},L=async()=>{if(x.trim()&&p.trim()){S("cloning"),D("");try{let e=function(e){let t=e.trim();if(!t)return"";if(t.startsWith("git@")||t.startsWith("ssh://")||t.endsWith(".git"))return t;try{let e=new URL(t),r=e.hostname,s=decodeURIComponent(e.pathname).split("/").filter(Boolean);if("code.iflytek.com"===r){let e=[...s];"osc"===e[0]&&"_source"===e[1]&&(e=e.slice(2));let a=e.indexOf("-");if(a>0&&(e=e.slice(0,a)),0===e.length)return t;return`https://${r}/${e.join("/")}.git`}return`${e.origin}${e.pathname.replace(/\/$/,"")}.git`}catch{return t}}(x.trim()),t=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clone",url:e,path:p.trim()})}),r=await t.json();if(!t.ok){S("error"),D(r.error||"Clone failed");return}S("success")}catch{S("error"),D("Network error")}}},O=async()=>{i.trim()&&(await a?.({name:i.trim(),alias:c.trim()||void 0,description:u.trim()||void 0,gitUrl:x.trim()||void 0,localPath:p.trim()||void 0,projectType:y}),$(),s(!1))};return(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(j.Dialog,{open:e,onOpenChange:e=>{s(e),e||$()},disablePointerDismissal:!0,children:(0,t.jsxs)(j.DialogContent,{style:{maxWidth:"32rem"},children:[(0,t.jsx)(j.DialogHeader,{children:(0,t.jsx)(j.DialogTitle,{children:n("topbar.newProject")})}),(0,t.jsxs)("div",{className:"space-y-4 py-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.gitUrl")}),(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:n("project.gitUrlHint")}),(0,t.jsx)(w.Input,{placeholder:n("project.gitPlaceholder"),value:x,onChange:e=>E(e.target.value),className:"mt-1.5 font-mono text-xs"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.localPath")}),(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:n("project.localPathHint")}),(0,t.jsx)(w.Input,{placeholder:n("project.localPathPlaceholder"),value:p,onChange:e=>{f(e.target.value),N(!0)},className:"mt-1.5 font-mono text-xs w-full"}),p.trim().startsWith("~")&&(0,t.jsxs)("p",{className:"mt-1 flex items-center gap-1 text-[11px] text-amber-400",children:[(0,t.jsx)(eC.AlertCircle,{className:"h-3 w-3"}),n("project.tildeWarning")]}),x.trim()&&p.trim()&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,t.jsxs)(v.Button,{type:"button",disabled:"cloning"===C||"success"===C,onClick:L,className:"gap-1.5 text-xs bg-emerald-500/15 text-emerald-300 ring-1 ring-emerald-500/25 hover:bg-emerald-500/25 disabled:opacity-50",children:["cloning"===C?(0,t.jsx)(ey.Loader2,{className:"h-3 w-3 animate-spin"}):"success"===C?(0,t.jsx)(ek.Check,{className:"h-3 w-3"}):(0,t.jsx)(eu.GitBranch,{className:"h-3 w-3"}),"cloning"===C?n("git.cloning"):"success"===C?n("git.cloned"):n("git.clone")]}),"error"===C&&(0,t.jsxs)("span",{className:"flex items-center gap-1 text-[11px] text-rose-400",children:[(0,t.jsx)(eC.AlertCircle,{className:"h-3 w-3"}),T]}),"success"===C&&(0,t.jsx)("span",{className:"text-[11px] text-emerald-400",children:n("git.cloneSuccess")})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.name")}),(0,t.jsx)(w.Input,{placeholder:n("project.namePlaceholder"),value:i,onChange:e=>l(e.target.value),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.type.label")}),(0,t.jsx)("div",{className:"mt-1.5",children:(0,t.jsx)(eT.SegmentedControl,{options:[{value:"FRONTEND",label:n("project.type.frontend")},{value:"BACKEND",label:n("project.type.backend")}],value:y,onChange:k})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.alias")}),(0,t.jsx)(w.Input,{placeholder:n("project.aliasPlaceholder"),value:c,onChange:e=>d(e.target.value),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mt-0.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.description")}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsxs)(b.TooltipTrigger,{render:(0,t.jsx)(v.Button,{type:"button",variant:"ghost",onClick:z,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!p.trim()||M?"opacity-50":""}`}),children:[M?(0,t.jsx)(ey.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(eS.Sparkles,{className:"h-3 w-3"}),M?n("project.analyzing"):n("project.genDesc")]}),(0,t.jsx)(b.TooltipContent,{children:p.trim()?"success"!==C?n("project.genDescNotCloned"):n("project.genDescReady"):n("project.genDescNoPath")})]})]}),(0,t.jsx)(eD.Textarea,{placeholder:n("project.descPlaceholder"),value:u,onChange:e=>m(e.target.value),rows:3,className:"mt-1.5 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none max-h-[200px] overflow-y-auto"})]})]}),(0,t.jsxs)(j.DialogFooter,{children:[(0,t.jsx)(v.Button,{variant:"outline",onClick:()=>{s(!1),$()},children:n("common.cancel")}),(0,t.jsx)(v.Button,{onClick:O,disabled:!i.trim()||M,className:"bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",children:n("common.create")})]})]})})})}var e$=e.i(400395),e$=e$,ez=e.i(921280),eE=e.i(330521);let eL=(0,N.createServerReference)("6088dcf2196516975ad5c496c5ac1b71f5932a6e39",N.callServer,void 0,N.findSourceMapURL,"migrateProjectPath"),eO=(0,N.createServerReference)("40e803ed0564bd5bb60bc440ffa8fa78032b84210f",N.callServer,void 0,N.findSourceMapURL,"checkMigrationSafety");function eI({open:e,onOpenChange:s,onCreateProject:a}){let{t:n,locale:o}=(0,P.useI18n)(),[i,l]=(0,r.useState)(""),[c,d]=(0,r.useState)(""),[u,m]=(0,r.useState)(""),[x,p]=(0,r.useState)(""),[f,g]=(0,r.useState)(""),[N,y]=(0,r.useState)(!1),[k,C]=(0,r.useState)("FRONTEND"),[S,T]=(0,r.useState)(!1),[D,M]=(0,r.useState)(!1),[A,$]=(0,r.useState)(""),[z,E]=(0,r.useState)(!1),[L,O]=(0,r.useState)(""),[I,B]=(0,r.useState)(""),[F,_]=(0,r.useState)(!1),[U,W]=(0,r.useState)(!1),H=()=>{l(""),d(""),m(""),p(""),g(""),C("FRONTEND"),T(!1),M(!1),$(""),E(!1),O(""),B(""),_(!1),W(!1)},K=async e=>{g(e),T(!1),M(!1),$(""),O(""),B(""),_(!1),l(e.split("/").filter(Boolean).pop()??"");try{let t=await fetch(`/api/git?path=${encodeURIComponent(e)}`);if(t.ok){let e=await t.json();if(e.isGit&&e.remoteUrl){p(e.remoteUrl),T(!0);let t=e.remoteUrl.match(/\/([^/]+?)(?:\.git)?$/);t&&l(t[1])}}}catch{}},V=(0,r.useCallback)(async e=>{if(M(e),O(""),B(""),_(!1),!e)return void $("");if(x)try{let e=await eR(x);e&&($(e),e===f&&_(!0))}catch{}if(f)try{let e=await fetch(`/api/git?path=${encodeURIComponent(f)}&checkWorktrees=true`);e.ok&&(await e.json()).hasWorktrees&&B(n("project.worktreeWarning"))}catch{}},[x,f]),q=async()=>{if(f&&!U){W(!0);try{let e=await (0,eM.analyzeProjectDirectory)(f.trim(),o);m(e)}catch{R.toast.error(n("project.analyzeError"))}finally{W(!1)}}},X=async()=>{if(!i.trim())return;let e={name:i.trim(),alias:c.trim()||void 0,description:u.trim()||void 0,gitUrl:x.trim()||void 0,localPath:f.trim()||void 0,projectType:k},t=await a?.(e);if(D&&A&&A!==f&&t&&"id"in t){E(!0),O("");let e=await eO(t.id);if(!e.safe){O(e.reason),E(!1);return}let r=await eL(t.id,A);if(E(!1),!r.success)return void O(r.error??n("project.migrateError"));R.toast.success(n("project.migrateSuccess"))}H(),s(!1)},G=!i.trim()||!f.trim()||z||U||D&&!!I;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j.Dialog,{open:e,onOpenChange:e=>{s(e),e||H()},disablePointerDismissal:!0,children:(0,t.jsxs)(j.DialogContent,{style:{maxWidth:"32rem"},children:[(0,t.jsx)(j.DialogHeader,{children:(0,t.jsx)(j.DialogTitle,{children:n("topbar.importProject")})}),(0,t.jsxs)("div",{className:"space-y-4 py-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.localPath")}),(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:n("project.importHint")}),(0,t.jsxs)("div",{className:"mt-1.5 flex gap-2",children:[(0,t.jsx)(w.Input,{value:f,readOnly:!0,placeholder:n("project.localPathPlaceholder"),className:"flex-1 font-mono text-xs bg-muted/30"}),(0,t.jsxs)(v.Button,{type:"button",variant:"outline",onClick:()=>y(!0),className:"shrink-0 gap-1.5",children:[(0,t.jsx)(h.FolderOpen,{className:"h-3.5 w-3.5"}),n("folder.browse")]})]}),S&&(0,t.jsx)("p",{className:"mt-1.5 text-[11px] text-emerald-400",children:n("project.autoDetected")})]}),x&&(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.gitUrl")}),(0,t.jsx)(w.Input,{value:x,onChange:e=>p(e.target.value),className:"mt-1.5 font-mono text-xs"})]}),S&&f&&(0,t.jsxs)("div",{className:"rounded-md border border-border p-3 space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-xs font-medium",children:n("project.migrate")}),(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:n("project.migrateHint")})]}),(0,t.jsx)(eE.Switch,{checked:D,onCheckedChange:e=>V(e)})]}),D&&(0,t.jsxs)("div",{className:"space-y-2 pt-1",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-[10px] font-medium text-muted-foreground",children:n("project.targetPath")}),(0,t.jsx)(w.Input,{value:A,onChange:e=>{$(e.target.value),_(e.target.value===f)},placeholder:"/path/to/canonical/location",className:"mt-1 font-mono text-xs"})]}),F&&(0,t.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-sky-400",children:[(0,t.jsx)(e$.default,{className:"h-3 w-3"}),n("project.samePathInfo")]}),I&&(0,t.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-amber-400",children:[(0,t.jsx)(eC.AlertCircle,{className:"h-3 w-3"}),I]}),L&&(0,t.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-rose-400",children:[(0,t.jsx)(eC.AlertCircle,{className:"h-3 w-3"}),L]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.name")}),(0,t.jsx)(w.Input,{placeholder:n("project.namePlaceholder"),value:i,onChange:e=>l(e.target.value),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.type.label")}),(0,t.jsx)("div",{className:"mt-1.5",children:(0,t.jsx)(eT.SegmentedControl,{options:[{value:"FRONTEND",label:n("project.type.frontend")},{value:"BACKEND",label:n("project.type.backend")}],value:k,onChange:C})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.alias")}),(0,t.jsx)(w.Input,{placeholder:n("project.aliasPlaceholder"),value:c,onChange:e=>d(e.target.value),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mt-0.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.description")}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsxs)(b.TooltipTrigger,{render:(0,t.jsx)(v.Button,{type:"button",variant:"ghost",onClick:q,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!f||U?"opacity-50":""}`}),children:[U?(0,t.jsx)(ey.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(eS.Sparkles,{className:"h-3 w-3"}),U?n("project.analyzing"):n("project.genDesc")]}),(0,t.jsx)(b.TooltipContent,{children:f?n("project.genDescReady"):n("project.genDescNoPath")})]})]}),(0,t.jsx)(eD.Textarea,{placeholder:n("project.descPlaceholder"),value:u,onChange:e=>m(e.target.value),rows:3,className:"mt-1.5 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none max-h-[200px] overflow-y-auto"})]})]}),(0,t.jsxs)(j.DialogFooter,{children:[(0,t.jsx)(v.Button,{variant:"outline",onClick:()=>{s(!1),H()},children:n("common.cancel")}),(0,t.jsx)(v.Button,{onClick:X,disabled:G,className:"bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",children:z?n("project.migrating"):n("common.create")})]})]})}),(0,t.jsx)(ez.FolderBrowserDialog,{open:N,onOpenChange:y,onSelect:e=>K(e)})]})}function eB({onCreateProject:e,username:a}){let{t:n,locale:i,setLocale:l}=(0,P.useI18n)(),{isOpen:c,toggleAssistant:d}=(0,eN.useAssistant)(),{resolvedTheme:u,toggleTheme:m,triggerRef:x}=function(){let{resolvedTheme:e,setTheme:t}=(0,L.useTheme)(),s=(0,r.useRef)(null),a=(0,r.useCallback)(r=>{let s="dark"===e?"light":"dark";if("u">typeof document&&"startViewTransition"in document&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){let e=r?.clientX??window.innerWidth/2,a=r?.clientY??0,n=Math.hypot(Math.max(e,window.innerWidth-e),Math.max(a,window.innerHeight-a));document.startViewTransition(()=>{t(s)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${e}px ${a}px)`,`circle(${n}px at ${e}px ${a}px)`]},{duration:400,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})}else t(s)},[e,t]);return{resolvedTheme:e,toggleTheme:a,triggerRef:s}}(),p=(0,s.useRouter)(),[g,j]=(0,r.useState)(!1),[w,N]=(0,r.useState)(!1),[y,k]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"k"===e.key&&(e.preventDefault(),j(!0))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("header",{className:"flex h-12 items-center justify-between border-b border-border bg-background/80 px-5 backdrop-blur-sm",children:[(0,t.jsx)("div",{className:"w-40"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)(v.Button,{variant:"outline",onClick:()=>j(!0),className:"h-8 w-[400px] justify-start gap-2 bg-muted/50 text-muted-foreground hover:bg-muted",children:[(0,t.jsx)(O.Search,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{className:"flex-1 text-left",suppressHydrationWarning:!0,children:n("topbar.searchPlaceholder")}),(0,t.jsxs)("kbd",{className:"mr-1 flex items-center gap-0.5 rounded border border-border bg-background px-1.5 py-0.5 text-[10px] font-mono",children:[(0,t.jsx)(B,{className:"h-2.5 w-2.5"}),"K"]})]}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{delay:500,render:(0,t.jsx)("button",{"data-tour":"open-assistant",onClick:d,"aria-label":n("assistant.iconLabel"),className:["cursor-pointer rounded-lg p-2 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",c?"bg-accent text-foreground":""].join(" ")}),children:(0,t.jsx)(_.Bot,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{children:n("assistant.iconLabel")})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsxs)(b.TooltipTrigger,{render:(0,t.jsx)(v.Button,{variant:"ghost",onClick:()=>l("zh"===i?"en":"zh"),className:"text-muted-foreground"}),children:[(0,t.jsx)(F.Globe,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{className:"text-[11px] font-semibold",children:"zh"===i?"EN":"δΈ"})]}),(0,t.jsx)(b.TooltipContent,{children:n("settings.language")})]}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)(v.Button,{ref:x,variant:"ghost",size:"icon",onClick:m,className:"text-muted-foreground"}),children:"dark"===u?(0,t.jsx)(U.Sun,{className:"h-4 w-4"}):(0,t.jsx)(W.Moon,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{children:n("settings.theme")})]}),(0,t.jsx)("div",{className:"h-4 w-px bg-border"}),(0,t.jsxs)(v.Button,{variant:"outline",className:"gap-1.5 ring-1 ring-border hover:bg-accent",onClick:()=>k(!0),children:[(0,t.jsx)(h.FolderOpen,{className:"h-3.5 w-3.5"}),n("topbar.importProject")]}),(0,t.jsxs)(v.Button,{"data-tour":"create-project",className:"gap-1.5 bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",onClick:()=>N(!0),children:[(0,t.jsx)(o.Plus,{className:"h-3.5 w-3.5"}),n("topbar.newProject")]}),(0,t.jsxs)(f.DropdownMenu,{children:[(0,t.jsx)(f.DropdownMenuTrigger,{render:(0,t.jsxs)("button",{className:"ml-0.5 flex cursor-pointer items-center gap-1.5 rounded-lg px-2.5 py-1 transition-colors hover:bg-accent",children:[a&&(0,t.jsx)("span",{className:"max-w-[80px] truncate text-xs text-muted-foreground",children:a}),(0,t.jsx)(el,{className:"h-7 w-7 ring-1 ring-border",children:(0,t.jsx)(ec,{className:"bg-emerald-500/20 text-emerald-400 text-[10px] font-semibold",children:a?a.trim().split(/\s+/).filter(e=>e.length>0).slice(0,2).map(e=>e[0].toUpperCase()).join(""):"U"})})]})}),(0,t.jsx)(f.DropdownMenuContent,{align:"end",sideOffset:8,className:"w-40",children:(0,t.jsxs)(f.DropdownMenuItem,{onClick:()=>p.push("/settings"),children:[(0,t.jsx)(I.Settings,{className:"mr-2 h-3.5 w-3.5"}),n("settings.title")]})})]})]})]}),(0,t.jsx)(ew,{open:g,onOpenChange:j}),(0,t.jsx)(eA,{open:w,onOpenChange:N,onCreateProject:e}),(0,t.jsx)(eI,{open:y,onOpenChange:k,onCreateProject:e})]})}var eF=e.i(79769),e_=r,eU=e.i(126741);class eW extends e_.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error("[ErrorBoundary]",e,t)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 p-8 text-center",children:[(0,t.jsx)(eC.AlertCircle,{className:"h-8 w-8 text-destructive"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium text-foreground",children:"Something went wrong"}),(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:this.state.error?.message??"An unexpected error occurred"})]}),(0,t.jsxs)(v.Button,{variant:"outline",onClick:()=>this.setState({hasError:!1,error:null}),children:[(0,t.jsx)(eU.RefreshCw,{className:"mr-2 h-3.5 w-3.5"}),"Retry"]})]}):this.props.children}}var eH=e.i(73367),eK=e.i(415411),eV=e.i(458851);let eq=(0,eK.default)(()=>e.A(97351).then(e=>({default:e.AssistantChat})),{loadableGenerated:{modules:[834880]},ssr:!1});function eX({mode:e}){let{isOpen:r,closeAssistant:s,sessions:a,activeSessionId:n,createNewSession:i,switchSession:c,removeSession:d}=(0,eN.useAssistant)(),{t:u}=(0,P.useI18n)(),m=a.find(e=>e.id===n),x=m?.title??u("assistant.newSession");return(0,t.jsxs)("div",{className:"sidebar"===e?"min-w-[320px] max-w-[480px] w-[30vw] shrink-0 border-r border-border flex flex-col bg-sidebar overflow-hidden":"flex flex-col h-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"header-sm flex items-center px-4 gap-2 bg-sidebar",children:[(0,t.jsx)(_.Bot,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-semibold text-foreground shrink-0",children:u("assistant.title")}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsxs)(f.DropdownMenu,{children:[(0,t.jsxs)(f.DropdownMenuTrigger,{className:"flex items-center gap-1 h-8 px-2 rounded-md text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground max-w-[120px] truncate","aria-label":u("assistant.sessionList"),children:[(0,t.jsx)("span",{className:"truncate",children:x}),(0,t.jsx)(eV.ChevronDown,{className:"h-3 w-3 shrink-0"})]}),(0,t.jsxs)(f.DropdownMenuContent,{side:"bottom",align:"end",sideOffset:4,children:[0===a.length?(0,t.jsx)("div",{className:"px-2 py-4 text-xs text-muted-foreground text-center",children:u("assistant.noSessions")}):a.map(e=>(0,t.jsxs)(f.DropdownMenuItem,{className:"flex items-center justify-between gap-2 pr-1",onClick:()=>c(e.id),children:[(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 min-w-0",children:[(0,t.jsx)("span",{className:"text-xs truncate max-w-[140px]",children:e.title}),(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground",children:function(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<60)return`${t}s ago`;let r=Math.floor(t/60);if(r<60)return`${r}m ago`;let s=Math.floor(r/60);if(s<24)return`${s}h ago`;let a=Math.floor(s/24);return`${a}d ago`}(e.updatedAt)})]}),(0,t.jsx)(v.Button,{variant:"ghost",className:"h-6 w-6 p-0 shrink-0 opacity-50 hover:opacity-100 hover:text-destructive",onClick:t=>{t.stopPropagation(),d(e.id)},"aria-label":u("assistant.deleteSession"),children:(0,t.jsx)(l.Trash2,{className:"h-3 w-3"})})]},e.id)),a.length>0&&(0,t.jsx)(f.DropdownMenuSeparator,{}),(0,t.jsxs)(f.DropdownMenuItem,{onClick:i,children:[(0,t.jsx)(o.Plus,{className:"h-3 w-3 mr-1"}),(0,t.jsx)("span",{className:"text-xs",children:u("assistant.newSession")})]})]})]}),(0,t.jsx)(v.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:i,"aria-label":u("assistant.newSession"),children:(0,t.jsx)(o.Plus,{className:"h-4 w-4"})})]}),(0,t.jsx)(v.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:s,"aria-label":u("assistant.closeLabel"),children:(0,t.jsx)(eh.X,{className:"h-4 w-4"})})]}),(0,t.jsx)("div",{className:"flex-1 overflow-hidden",children:r?(0,t.jsx)(eq,{}):null})]})}var eG=e.i(316403);function eJ({onDismiss:e}){let{t:s}=(0,P.useI18n)(),[a,n]=(0,r.useState)(!1);(0,r.useEffect)(()=>{"Notification"in window&&"default"===window.Notification.permission&&n(!0)},[]);let o=async()=>{"default"!==await window.Notification.requestPermission()&&(n(!1),e?.())};return a?(0,t.jsxs)("div",{className:"fixed top-3 left-1/2 -translate-x-1/2 z-[9999] w-auto max-w-lg bg-card border rounded-lg shadow-lg px-4 py-2.5 flex items-center gap-3 animate-in fade-in slide-in-from-top-4 duration-500",children:[(0,t.jsx)(eG.Bell,{className:"h-4 w-4 shrink-0 text-primary"}),(0,t.jsx)("span",{className:"flex-1 text-sm",children:s("notification.permissionPrompt")}),(0,t.jsx)(v.Button,{size:"default",onClick:o,children:s("notification.allow")}),(0,t.jsx)(v.Button,{variant:"ghost",size:"default",onClick:()=>{n(!1),e?.()},children:s("notification.dismiss")})]}):null}var eY=e.i(595774),eZ=e.i(490028);let eQ=[{target:"create-workspace",titleKey:"tour.step1.title",descKey:"tour.step1.desc",placement:"right"},{target:"create-project",titleKey:"tour.step2.title",descKey:"tour.step2.desc",placement:"bottom",waitForTarget:!0},{target:"open-assistant",titleKey:"tour.step3.title",descKey:"tour.step3.desc",placement:"bottom"}];function e0({onComplete:e}){let{t:s}=(0,P.useI18n)(),[a,n]=(0,r.useState)(0),[o,i]=(0,r.useState)(null),[l,c]=(0,r.useState)(!1),d=(0,r.useRef)(null),u=eQ[a],m=(0,r.useCallback)(async()=>{await (0,eZ.setConfigValue)("onboarding.tourCompleted",!0),e()},[e]),x=(0,r.useCallback)(()=>u?document.querySelector(`[data-tour="${u.target}"]`):null,[u]),h=(0,r.useCallback)(()=>{let e=x();e?(i(e.getBoundingClientRect()),c(!0)):c(!1)},[x]);(0,r.useEffect)(()=>{h();let e=null;!l&&u?.waitForTarget&&(d.current=new MutationObserver(()=>{let t=x();t&&(i(t.getBoundingClientRect()),c(!0),d.current?.disconnect(),e&&clearTimeout(e))}),d.current.observe(document.body,{childList:!0,subtree:!0}),e=setTimeout(()=>{!x()&&(n(e=>{let t=e+1;return t<eQ.length?t:e}),a>=eQ.length-1&&m())},5e3));let t=()=>h();return window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{d.current?.disconnect(),e&&clearTimeout(e),window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[a,u,x,h,l,m]),(0,r.useEffect)(()=>{let e=setInterval(h,1e3);return()=>clearInterval(e)},[h]);let p=(0,r.useCallback)(()=>{a<eQ.length-1?(n(e=>e+1),c(!1)):m()},[a]);return u?(0,t.jsx)(t.Fragment,{children:l&&o&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"fixed inset-0 z-[10000]",style:{background:`radial-gradient(
|
|
2
2
|
ellipse at ${o.left+o.width/2}px ${o.top+o.height/2}px,
|
|
3
3
|
transparent ${Math.max(o.width,o.height)}px,
|
|
4
4
|
rgba(0,0,0,0.6) ${Math.max(o.width,o.height)+30}px
|