conductor-oss 0.26.13 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/package.json +5 -5
  2. package/web/.next/standalone/packages/web/.next/BUILD_ID +1 -1
  3. package/web/.next/standalone/packages/web/.next/app-path-routes-manifest.json +5 -5
  4. package/web/.next/standalone/packages/web/.next/build-manifest.json +3 -3
  5. package/web/.next/standalone/packages/web/.next/prerender-manifest.json +3 -3
  6. package/web/.next/standalone/packages/web/.next/react-loadable-manifest.json +7 -7
  7. package/web/.next/standalone/packages/web/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/web/.next/standalone/packages/web/.next/server/app/_global-error.html +1 -1
  9. package/web/.next/standalone/packages/web/.next/server/app/_global-error.rsc +1 -1
  10. package/web/.next/standalone/packages/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/web/.next/standalone/packages/web/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  12. package/web/.next/standalone/packages/web/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  13. package/web/.next/standalone/packages/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  14. package/web/.next/standalone/packages/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  15. package/web/.next/standalone/packages/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  16. package/web/.next/standalone/packages/web/.next/server/app/_not-found/page.js +1 -1
  17. package/web/.next/standalone/packages/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  18. package/web/.next/standalone/packages/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  19. package/web/.next/standalone/packages/web/.next/server/app/bridge/connect/page.js +1 -1
  20. package/web/.next/standalone/packages/web/.next/server/app/bridge/connect/page.js.nft.json +1 -1
  21. package/web/.next/standalone/packages/web/.next/server/app/bridge/connect/page_client-reference-manifest.js +1 -1
  22. package/web/.next/standalone/packages/web/.next/server/app/page.js +1 -1
  23. package/web/.next/standalone/packages/web/.next/server/app/page.js.nft.json +1 -1
  24. package/web/.next/standalone/packages/web/.next/server/app/page_client-reference-manifest.js +1 -1
  25. package/web/.next/standalone/packages/web/.next/server/app/sessions/[id]/page.js +1 -1
  26. package/web/.next/standalone/packages/web/.next/server/app/sessions/[id]/page.js.nft.json +1 -1
  27. package/web/.next/standalone/packages/web/.next/server/app/sessions/[id]/page_client-reference-manifest.js +1 -1
  28. package/web/.next/standalone/packages/web/.next/server/app/settings/bridge/page.js +1 -1
  29. package/web/.next/standalone/packages/web/.next/server/app/settings/bridge/page.js.nft.json +1 -1
  30. package/web/.next/standalone/packages/web/.next/server/app/settings/bridge/page_client-reference-manifest.js +1 -1
  31. package/web/.next/standalone/packages/web/.next/server/app/sign-in/[[...sign-in]]/page.js +1 -1
  32. package/web/.next/standalone/packages/web/.next/server/app/sign-in/[[...sign-in]]/page.js.nft.json +1 -1
  33. package/web/.next/standalone/packages/web/.next/server/app/sign-in/[[...sign-in]]/page_client-reference-manifest.js +1 -1
  34. package/web/.next/standalone/packages/web/.next/server/app/sign-in/hosted/page.js +1 -1
  35. package/web/.next/standalone/packages/web/.next/server/app/sign-in/hosted/page.js.nft.json +1 -1
  36. package/web/.next/standalone/packages/web/.next/server/app/sign-in/hosted/page_client-reference-manifest.js +1 -1
  37. package/web/.next/standalone/packages/web/.next/server/app/sign-in/sso-callback/page.js +1 -1
  38. package/web/.next/standalone/packages/web/.next/server/app/sign-in/sso-callback/page.js.nft.json +1 -1
  39. package/web/.next/standalone/packages/web/.next/server/app/sign-in/sso-callback/page_client-reference-manifest.js +1 -1
  40. package/web/.next/standalone/packages/web/.next/server/app/unlock/page.js +1 -1
  41. package/web/.next/standalone/packages/web/.next/server/app/unlock/page.js.nft.json +1 -1
  42. package/web/.next/standalone/packages/web/.next/server/app/unlock/page_client-reference-manifest.js +1 -1
  43. package/web/.next/standalone/packages/web/.next/server/app-paths-manifest.json +5 -5
  44. package/web/.next/standalone/packages/web/.next/server/chunks/3984.js +1 -0
  45. package/web/.next/standalone/packages/web/.next/server/chunks/5164.js +3 -3
  46. package/web/.next/standalone/packages/web/.next/server/chunks/7164.js +1 -1
  47. package/web/.next/standalone/packages/web/.next/server/chunks/8063.js +1 -1
  48. package/web/.next/standalone/packages/web/.next/server/chunks/8156.js +1 -0
  49. package/web/.next/standalone/packages/web/.next/server/chunks/9455.js +1 -1
  50. package/web/.next/standalone/packages/web/.next/server/middleware-build-manifest.js +1 -1
  51. package/web/.next/standalone/packages/web/.next/server/middleware-react-loadable-manifest.js +1 -1
  52. package/web/.next/standalone/packages/web/.next/server/pages/500.html +1 -1
  53. package/web/.next/standalone/packages/web/.next/server/server-reference-manifest.js +1 -1
  54. package/web/.next/standalone/packages/web/.next/server/server-reference-manifest.json +1 -1
  55. package/web/.next/standalone/packages/web/.next/static/chunks/1225.67d5480ff2528e77.js +3 -0
  56. package/web/.next/standalone/packages/web/.next/static/chunks/{2452-c6e8306f50b6f426.js → 2452-70f8a3ac1c83e765.js} +1 -1
  57. package/web/.next/standalone/packages/web/.next/static/chunks/3954-2ec1b72cda164a54.js +1 -0
  58. package/web/.next/standalone/packages/web/.next/static/chunks/4443.a76e807760bf0c48.js +1 -0
  59. package/web/.next/standalone/packages/web/.next/static/chunks/{7220-0f3715e27cdde61f.js → 7220-b032a34ec85663c1.js} +1 -1
  60. package/web/.next/standalone/packages/web/.next/static/chunks/910.7e64deaee744cc48.js +1 -0
  61. package/web/.next/{static/chunks/app/bridge/connect/page-46a3ad20e3c8e755.js → standalone/packages/web/.next/static/chunks/app/bridge/connect/page-1a57083d52bbb24e.js} +1 -1
  62. package/web/.next/standalone/packages/web/.next/static/chunks/app/layout-dc581f7752f8f902.js +1 -0
  63. package/web/.next/standalone/packages/web/.next/static/chunks/webpack-b00a97aef39a2f86.js +1 -0
  64. package/web/.next/static/chunks/1225.67d5480ff2528e77.js +3 -0
  65. package/web/.next/static/chunks/{2452-c6e8306f50b6f426.js → 2452-70f8a3ac1c83e765.js} +1 -1
  66. package/web/.next/static/chunks/3954-2ec1b72cda164a54.js +1 -0
  67. package/web/.next/static/chunks/4443.a76e807760bf0c48.js +1 -0
  68. package/web/.next/static/chunks/{7220-0f3715e27cdde61f.js → 7220-b032a34ec85663c1.js} +1 -1
  69. package/web/.next/static/chunks/910.7e64deaee744cc48.js +1 -0
  70. package/web/.next/{standalone/packages/web/.next/static/chunks/app/bridge/connect/page-46a3ad20e3c8e755.js → static/chunks/app/bridge/connect/page-1a57083d52bbb24e.js} +1 -1
  71. package/web/.next/static/chunks/app/layout-dc581f7752f8f902.js +1 -0
  72. package/web/.next/static/chunks/webpack-b00a97aef39a2f86.js +1 -0
  73. package/web/.next/standalone/packages/web/.next/server/chunks/4299.js +0 -1
  74. package/web/.next/standalone/packages/web/.next/server/chunks/5782.js +0 -1
  75. package/web/.next/standalone/packages/web/.next/static/chunks/3954-8737ba0845209eda.js +0 -1
  76. package/web/.next/standalone/packages/web/.next/static/chunks/4443.d88cedc4121d7b54.js +0 -1
  77. package/web/.next/standalone/packages/web/.next/static/chunks/4953.6dca52908750af8c.js +0 -1
  78. package/web/.next/standalone/packages/web/.next/static/chunks/8191.1700cccd2f013926.js +0 -1
  79. package/web/.next/standalone/packages/web/.next/static/chunks/app/layout-eb0ab3874443f170.js +0 -1
  80. package/web/.next/standalone/packages/web/.next/static/chunks/webpack-b4460421d078e5aa.js +0 -1
  81. package/web/.next/static/chunks/3954-8737ba0845209eda.js +0 -1
  82. package/web/.next/static/chunks/4443.d88cedc4121d7b54.js +0 -1
  83. package/web/.next/static/chunks/4953.6dca52908750af8c.js +0 -1
  84. package/web/.next/static/chunks/8191.1700cccd2f013926.js +0 -1
  85. package/web/.next/static/chunks/app/layout-eb0ab3874443f170.js +0 -1
  86. package/web/.next/static/chunks/webpack-b4460421d078e5aa.js +0 -1
  87. /package/web/.next/standalone/packages/web/.next/static/{DA2cUC5YhaQ0LVErrFDb1 → iQHshe8u90Puhi4XxboRO}/_buildManifest.js +0 -0
  88. /package/web/.next/standalone/packages/web/.next/static/{DA2cUC5YhaQ0LVErrFDb1 → iQHshe8u90Puhi4XxboRO}/_ssgManifest.js +0 -0
  89. /package/web/.next/static/{DA2cUC5YhaQ0LVErrFDb1 → iQHshe8u90Puhi4XxboRO}/_buildManifest.js +0 -0
  90. /package/web/.next/static/{DA2cUC5YhaQ0LVErrFDb1 → iQHshe8u90Puhi4XxboRO}/_ssgManifest.js +0 -0
@@ -0,0 +1,3 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1225],{32009:()=>{},41225:(e,t,n)=>{"use strict";n.r(t),n.d(t,{RemoteSessionTerminal:()=>F});var r=n(54568),l=n(7620),o=n(65587),s=n.n(o),i=n(58299),a=n(60527),c=n(14796),u=n(36645),d=n(82797),h=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(0===e.css.cell.width||0===e.css.cell.height)return;let t=0===this._terminal.options.scrollback?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue("height")),l=Math.max(0,parseInt(n.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),s={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},i=s.top+s.bottom;return{cols:Math.max(2,Math.floor((l-(s.right+s.left)-t)/e.css.cell.width)),rows:Math.max(1,Math.floor((r-i)/e.css.cell.height))}}},m=n(36439);n(32009);var f=n(76081),p=n(31404),w=n(61369),b=n(14810),x=n(86181);async function g(e){let{imageBlob:t,projectId:n,taskRef:r,bridgeId:l,fileName:o}=e,s=new FormData;s.append("projectId",n),r&&s.append("taskRef",r);let i=o??`clipboard-${Date.now()}.png`;s.append("files",t,i);let a=await fetch((0,p.S)("/api/attachments",l),{method:"POST",body:s});if(!a.ok){let e=await a.json().catch(()=>null);throw Error(e?.error??`Failed to upload image (${a.status})`)}let c=await a.json(),u=Array.isArray(c.files)&&c.files.length>0?c.files[0]:c,d=u?.path??c.path,h=u?.absolutePath??c.absolutePath;if(!d&&!h)throw Error("Image upload succeeded but did not return a usable file path");return{path:d??h??"",absolutePath:h??d??""}}async function v(e){if(!e.items)return null;for(let t=0;t<e.items.length;t++){let n=e.items[t];if(n.type.startsWith("image/")){let e=n.getAsFile();if(e)return e}}return null}let y=new Set(["archived","killed","terminated","restored"]),k={background:"#060404",foreground:"#efe8e1",cursor:"#f4b37c",cursorAccent:"#060404",selectionBackground:"rgba(244, 179, 124, 0.24)",black:"#060404",red:"#ff8f7a",green:"#18c58f",yellow:"#f0b35d",blue:"#8ea6ff",magenta:"#d19be8",cyan:"#75d6d0",white:"#efe8e1",brightBlack:"#7d746e",brightRed:"#ffb39e",brightGreen:"#5be0b0",brightYellow:"#ffd089",brightBlue:"#b6c7ff",brightMagenta:"#e4c0f1",brightCyan:"#9fe8e2",brightWhite:"#fff8f2"};function S(e,t,n=!0){e.reset(),t.length>0&&e.write(t),n&&e.scrollToBottom()}function E(e){let t=new TextEncoder().encode(e),n=new Uint8Array(t.length+1);return n[0]=48,n.set(t,1),n}async function N(e,t){let n=await fetch((0,p.S)(`/api/sessions/${encodeURIComponent(e)}/output?lines=500`,t),{cache:"no-store"}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error??`Failed to load terminal output (${n.status})`);return"string"==typeof r?.output?r.output:""}async function j(e,t){let n=await fetch((0,p.S)(`/api/sessions/${encodeURIComponent(e)}/terminal/relay`,t),{method:"POST",cache:"no-store"}),r=await n.json().catch(()=>null);if(!n.ok||!r?.wsUrl)throw Error(r?.error??`Failed to attach relay terminal (${n.status})`);return r.wsUrl}async function M(e,t){let n=await fetch((0,p.S)(`/api/sessions/${encodeURIComponent(e)}/terminal/token`,t),{cache:"no-store"}),r=await n.json().catch(()=>null);if(n.ok)return{available:!0};if(404===n.status||409===n.status)return{available:!1,reason:r?.error??null};throw Error(r?.error??`Failed to resolve relay terminal availability (${n.status})`)}async function _(e,t,n){let r=await fetch((0,p.S)(`/api/sessions/${encodeURIComponent(e)}/actions`,n),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"send",message:t})});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(e?.error??`Failed to send message (${r.status})`)}}function F({sessionId:e,projectId:t,bridgeId:n,sessionState:o,runtimeMode:p,pendingInsert:L,immersiveMobileMode:C=!1}){let T=(0,l.useRef)(null),P=(0,l.useRef)(null),R=(0,l.useRef)(null),A=(0,l.useRef)(null),z=(0,l.useRef)(null),D=(0,l.useRef)(null),W=(0,l.useRef)(new TextDecoder),$=(0,l.useRef)({cols:120,rows:32}),H=(0,l.useRef)(0),I=(0,l.useRef)(0),O=(0,l.useRef)([]),B=(0,l.useRef)(!0),[q,U]=(0,l.useState)(!1),[J,V]=(0,l.useState)(!0),[X,G]=(0,l.useState)(null),[Y,K]=(0,l.useState)(null),[Q,Z]=(0,l.useState)(""),[ee,et]=(0,l.useState)(!1),[en,er]=(0,l.useState)(null),[el,eo]=(0,l.useState)(null),[es,ei]=(0,l.useState)(0),ea=(0,l.useMemo)(()=>o.trim().toLowerCase(),[o]),ec=p?.trim().toLowerCase()??null,eu=y.has(ea),ed="ttyd"===ec,eh=!!ed&&!eu,em=!ed&&!C&&b.G.has(ea),ef=!eh,ep=ef||null!==Y,ew=(0,l.useMemo)(()=>n?(0,w.kw)(n):null,[n]),eb=(0,l.useCallback)(()=>{let e=z.current;if(z.current=null,e)try{e.close()}catch{}},[]),ex=(0,l.useCallback)(e=>{let t=z.current;if(!t||t.readyState!==WebSocket.OPEN)throw Error("Relay terminal is not connected.");t.send(e)},[]),eg=(0,l.useCallback)(()=>{let{cols:e,rows:t}=$.current;ex(JSON.stringify({columns:e,rows:t}))},[ex]),ev=(0,l.useCallback)(()=>{for(let e of O.current)window.clearTimeout(e);O.current=[]},[]),ey=(0,l.useCallback)(()=>{let e=R.current;if(!e)return;let t=(0,x.Jn)(T.current?.clientWidth??window.innerWidth);e.options.fontFamily=t.fontFamily,e.options.fontSize=t.fontSize,e.options.lineHeight=t.lineHeight},[]),ek=(0,l.useCallback)(()=>{let e=R.current,t=A.current;if(!e||!t)return null;ey();let n=e.cols,r=e.rows;t.fit(),B.current&&e.scrollToBottom();let l={cols:e.cols,rows:e.rows};return($.current=l,l.cols<2||l.rows<2)?null:{...l,changed:l.cols!==n||l.rows!==r}},[ey]),eS=(0,l.useCallback)((e,t=!1)=>{let n=ek();if(!n)return null;if($.current={cols:n.cols,rows:n.rows},!eh)return n;let r=z.current;if(!r||r.readyState!==WebSocket.OPEN)return n;try{if("handshake"===e)eg();else{var l,o;let e,s;(t||n.changed)&&r.send((l=n.cols,o=n.rows,e=new TextEncoder().encode(JSON.stringify({columns:l,rows:o})),(s=new Uint8Array(e.length+1))[0]=49,s.set(e,1),s))}}catch{}return n},[eh,ek,eg]),eE=(0,l.useCallback)(()=>{ev(),window.requestAnimationFrame(()=>{eS("handshake",!0)}),O.current.push(window.setTimeout(()=>{eS("handshake",!0)},120),window.setTimeout(()=>{eS("handshake",!0)},360))},[ev,eS]),eN=(0,l.useCallback)(()=>{if(!eh)return;null!==D.current&&window.clearTimeout(D.current);let e=Math.min(4e3,500*2**I.current);I.current=Math.min(I.current+1,3),D.current=window.setTimeout(()=>{ei(e=>e+1)},e)},[eh]);(0,l.useEffect)(()=>{let r=T.current;if(!r)return;r.textContent="";let l=(0,x.Jn)(window.innerWidth),o=new m.Terminal({allowTransparency:!0,convertEol:!0,cursorBlink:eh,disableStdin:!eh,fontFamily:l.fontFamily,fontSize:l.fontSize,lineHeight:l.lineHeight,letterSpacing:.2,scrollback:4e3,theme:k});o.open(r);let s=new h;o.loadAddon(s),R.current=o,A.current=s;let i=r.querySelector(".xterm-viewport")??r.querySelector(".xterm-scrollable-element"),a=()=>{B.current=(0,x.ox)(i)};a(),i?.addEventListener("scroll",a,{passive:!0});let c=function(e,t){let n="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,r="u"<typeof navigator?0:navigator.maxTouchPoints||0;if(!n&&r<=0)return null;let l=t.querySelector(".xterm"),o=t.querySelector(".xterm-viewport")??t.querySelector(".xterm-scrollable-element");if(!l||!o)return null;let s=e=>{let n=e?"none":"pan-y";t.style.setProperty("touch-action",n),l.style.setProperty("touch-action",n),o.style.setProperty("touch-action",n),o.style.setProperty("-webkit-overflow-scrolling","touch")},i=()=>e._core??e.core??null,a=()=>{let e=i();return e?.coreMouseService??e?._coreMouseService??null},c=()=>"none"!==(()=>{let t=e.modes?.mouseTrackingMode;if("string"==typeof t&&t.length>0)return t.toLowerCase();let n=a(),r=n?.activeProtocol;return"string"==typeof r&&r.length>0?r.toLowerCase():n?.areMouseEventsActive?"unknown":"none"})(),u=!1,d=0,h=0,m=0,f=!1,p=()=>{u=!1},w=e=>{if(1!==e.touches.length){s(c()),p();return}let t=e.touches[0];d=t.clientX,h=t.clientY,m=window.performance?.now?.()??Date.now(),f=!1,s(c()),u=!0},b=t=>{if(!u||1!==t.touches.length)return;let n=t.touches[0],r=d-n.clientX,s=h-n.clientY;if((d=n.clientX,h=n.clientY,!(.5>Math.abs(r)&&.5>Math.abs(s)))&&(f=!0,c()&&(t.cancelable&&t.preventDefault(),!((e,t,n)=>{let r=i(),o=r?._mouseService||r?.mouseService,s=a(),c=r?.viewport,u=r?.screenElement||l.querySelector(".xterm-screen");if(!o||"function"!=typeof o.getMouseReportCoords||!s||"function"!=typeof s.triggerMouseEvent||!s.areMouseEventsActive||!c||"function"!=typeof c.getLinesScrolled||!u)return!1;let d={clientX:t,clientY:n,deltaY:e,deltaMode:"function"==typeof WheelEvent&&"number"==typeof WheelEvent.DOM_DELTA_PIXEL?WheelEvent.DOM_DELTA_PIXEL:0,altKey:!1,ctrlKey:!1,shiftKey:!1};if(!c.getLinesScrolled(d))return!1;let h=o.getMouseReportCoords(d,u);return!!h&&s.triggerMouseEvent({col:h.col,row:h.row,x:h.x,y:h.y,button:4,action:e<0?0:1,ctrl:!1,alt:!1,shift:!1})})(s,n.clientX,n.clientY)&&!((t,n,r,s)=>{if("function"!=typeof WheelEvent)return!1;let i=document.elementFromPoint(r,s)??e.element??l,a=o.scrollTop,c=new WheelEvent("wheel",{deltaX:t,deltaY:n,deltaMode:0,bubbles:!0,cancelable:!0,composed:!0,clientX:r,clientY:s});return!i.dispatchEvent(c)||c.defaultPrevented||o.scrollTop!==a})(r,s,n.clientX,n.clientY)))){let e=Math.max(0,o.scrollHeight-o.clientHeight);o.scrollTop=Math.max(0,Math.min(e,o.scrollTop+s))}},x=()=>{let t=(window.performance?.now?.()??Date.now())-m;!f&&t<300&&e.focus(),s(c()),p()};return l.addEventListener("touchstart",w,{passive:!0}),l.addEventListener("touchmove",b,{passive:!1}),l.addEventListener("touchend",x,{passive:!0}),l.addEventListener("touchcancel",x,{passive:!0}),s(c()),()=>{l.removeEventListener("touchstart",w),l.removeEventListener("touchmove",b),l.removeEventListener("touchend",x),l.removeEventListener("touchcancel",x),t.style.removeProperty("touch-action"),l.style.removeProperty("touch-action"),o.style.removeProperty("touch-action"),o.style.removeProperty("-webkit-overflow-scrolling")}}(o,r),u=o.onData(e=>{if(eh)try{ex(E(e)),G(null)}catch(e){G(e instanceof Error?e.message:"Failed to send terminal input.")}}),d=()=>{o.focus()},f=async r=>{if(eh&&r.clipboardData)try{let l=await v(r.clipboardData);if(l){r.preventDefault();try{let r=await g({imageBlob:l,projectId:t,taskRef:e,bridgeId:n}),o=r.absolutePath||r.path;ex(E(`\r
2
+ [pasted image: ${o}]\r
3
+ `))}catch{}}}catch{}};return r.addEventListener("click",d),r.addEventListener("paste",f),o.focus(),window.requestAnimationFrame(()=>{eS("resize",!0)}),()=>{r.removeEventListener("click",d),r.removeEventListener("paste",f),i?.removeEventListener("scroll",a),u.dispose(),c?.(),o.dispose(),R.current=null,A.current=null}},[eh,t,ex,eS,n,e]),(0,l.useEffect)(()=>{H.current=0,I.current=0,B.current=!0,U(!1),V(!0),G(null),K(null),Z(""),et(!1),er(null),eo(null),W.current=new TextDecoder,R.current&&(S(R.current,"",!0),R.current.options.disableStdin=!eh,R.current.options.cursorBlink=eh),ev(),eb()},[ev,eb,eh,e]),(0,l.useEffect)(()=>{let e=T.current,t=R.current;if(!e||!t)return;t.options.disableStdin=!eh||z.current?.readyState!==WebSocket.OPEN,t.options.cursorBlink=eh&&z.current?.readyState===WebSocket.OPEN;let n=()=>{eS("resize")},r=()=>{eh?eS("handshake",!0):ek()};n();let l="u"<typeof ResizeObserver?null:new ResizeObserver(()=>{n()}),o=window.visualViewport,s=()=>{"visible"===document.visibilityState&&r()},i="u"<typeof document?null:document.fonts,a=!1;return l?.observe(e),window.addEventListener("resize",n),o?.addEventListener("resize",n),o?.addEventListener("scroll",n),document.addEventListener("visibilitychange",s),i?.addEventListener?.("loadingdone",r),i?.ready.then(()=>{a||r()}).catch(()=>{}),()=>{a=!0,l?.disconnect(),window.removeEventListener("resize",n),o?.removeEventListener("resize",n),o?.removeEventListener("scroll",n),document.removeEventListener("visibilitychange",s),i?.removeEventListener?.("loadingdone",r)}},[eh,ek,eS]),(0,l.useEffect)(()=>{if(ep){let t=!1;return V(!0),N(e,n).then(e=>{t||(R.current&&S(R.current,e,!0),U(e.length>0),G(null))}).catch(e=>{t||G(e instanceof Error?e.message:"Failed to load terminal output.")}).finally(()=>{t||V(!1)}),()=>{t=!0}}let t=!1;return V(!0),G(null),K(null),M(e,n).then(r=>{if(!t)return r.available?j(e,n).then(e=>{if(t)return;eb();let n=new WebSocket(e);n.binaryType="arraybuffer",z.current=n,n.onopen=()=>{I.current=0,W.current=new TextDecoder,U(!1),R.current&&(S(R.current,"",B.current),R.current.options.disableStdin=!1,R.current.options.cursorBlink=!0);try{eS("handshake",!0),eE(),G(null)}catch(e){G(e instanceof Error?e.message:"Failed to initialize terminal.")}finally{V(!1)}},n.onmessage=e=>{let t=R.current;if(!t)return;let n="string"==typeof e.data?new TextEncoder().encode(e.data):new Uint8Array(e.data);if(0!==n.length&&48===n[0]){let e=W.current.decode(n.slice(1),{stream:!0});e.length>0&&(t.write(e),B.current&&t.scrollToBottom(),U(!0))}},n.onerror=()=>{t||G("Relay terminal connection failed.")},n.onclose=()=>{z.current=null,R.current&&(R.current.options.disableStdin=!0,R.current.options.cursorBlink=!1),t||(G("Relay terminal disconnected."),eN())}}):void K(r.reason??"This session no longer exposes a live ttyd terminal.")}).catch(e=>{t||(G(e instanceof Error?e.message:"Failed to connect relay terminal."),V(!1),eN())}),()=>{t=!0,ev(),null!==D.current&&(window.clearTimeout(D.current),D.current=null),eb()}},[n,ev,eb,es,eE,eN,e,ep,eS]),(0,l.useEffect)(()=>{if(!L||L.nonce<=H.current)return;H.current=L.nonce;let e=L.inlineText.trim();if(0!==e.length&&eh)try{ex(E(`${e} `)),G(null),eo(null)}catch(e){eo(e instanceof Error?e.message:"Failed to queue terminal input.")}},[eh,L,ex]);let ej=(0,l.useCallback)(async()=>{let t=Q.trim();if(0!==t.length&&!ee){et(!0),er(null);try{await _(e,t,n),Z(""),P.current?.focus()}catch(e){er(e instanceof Error?e.message:"Failed to send message.")}finally{et(!1)}}},[n,Q,ee,e]),eM=(0,l.useCallback)(()=>{I.current=0,G(null),K(null),ei(e=>e+1)},[]),e_=eh?"Connecting live terminal":em?"Session is waiting for input":"Live terminal is not active",eF=Y??X??(eh?"Reconnecting to the existing relay terminal.":ed?"This ttyd terminal is no longer attached. It only closes after an explicit kill or archive.":em?"Send a follow-up below to relaunch the agent in a fresh ttyd terminal.":b.x.has(ea)?"This session no longer exposes a relay terminal. Wait for it to relaunch or open the session overview.":`Session status is \`${ea}\`. Relay terminals only run while a ttyd runtime is active.`);return(0,r.jsxs)("div",{className:"group/terminal relative flex h-full min-h-0 min-w-0 w-full flex-1 flex-col overflow-hidden rounded-none border-0 bg-[#060404] lg:rounded-[14px] lg:border lg:border-white/10 lg:shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]",children:[(0,r.jsx)("div",{className:"absolute right-2 top-2 z-10 flex items-center gap-2 sm:right-3 sm:top-3",children:(0,r.jsx)(f.$,{type:"button",size:"icon",variant:"ghost",className:"h-9 w-9 rounded-full border border-white/10 bg-[#141010]/92 text-[#c9c0b7] backdrop-blur-sm hover:bg-[#201818] sm:h-7 sm:w-7",onClick:eM,"aria-label":"Reload relay terminal",children:J?(0,r.jsx)(i.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(a.A,{className:"h-3.5 w-3.5"})})}),(0,r.jsxs)("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden px-0.5 pb-0 pt-0.5 lg:px-1.5 lg:pb-1 lg:pt-3 w-full",children:[(0,r.jsx)("div",{ref:T,className:"h-full min-h-0 w-full flex-1 overflow-hidden overscroll-contain rounded-[10px] bg-[#060404] px-2 py-2 text-left touch-pan-y [&_.xterm]:h-full [&_.xterm]:w-full [&_.xterm]:px-1 [&_.xterm-screen]:h-full [&_.xterm-screen]:w-full [&_.xterm-viewport]:overflow-y-auto [&_.xterm-viewport]:overscroll-contain [&_.xterm-viewport]:[-webkit-overflow-scrolling:touch] [&_.xterm-scrollable-element]:overscroll-contain [&_.xterm-scrollable-element]:[-webkit-overflow-scrolling:touch]"}),J||q?null:(0,r.jsx)("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-[#060404]/84 px-4",children:(0,r.jsx)("div",{className:"max-w-lg rounded-[16px] border border-white/10 bg-[#141010]/92 p-5 text-[#efe8e1] shadow-[0_24px_48px_rgba(0,0,0,0.34)]",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("div",{className:"mt-0.5 rounded-full border border-white/10 bg-[#201818] p-2 text-[#c9c0b7]",children:X?(0,r.jsx)(c.A,{className:"h-4 w-4"}):(0,r.jsx)(i.A,{className:`h-4 w-4 ${eh?"animate-spin":""}`})}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("div",{className:"text-[14px] font-medium",children:e_}),(0,r.jsx)("div",{className:"mt-1 text-[12px] leading-5 text-[#a79c94]",children:eF})]})]})})}),J?(0,r.jsx)("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-[#060404]/84",children:(0,r.jsxs)("div",{className:"flex items-center gap-2 rounded-full border border-white/10 bg-[#141010]/92 px-3 py-2 text-[12px] text-[#c9c0b7] backdrop-blur-sm",children:[(0,r.jsx)(i.A,{className:"h-3.5 w-3.5 animate-spin"}),(0,r.jsx)("span",{children:ef?"Loading terminal output…":"Connecting relay terminal…"})]})}):null]}),!em&&el?(0,r.jsx)("div",{className:"absolute inset-x-0 bottom-0 z-10 border-t border-white/12 bg-[#161212] px-3 py-2 text-[11px] text-[#ffb39e] backdrop-blur-sm [padding-bottom:env(safe-area-inset-bottom)]",children:(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsx)(c.A,{className:"h-3 w-3 shrink-0"}),(0,r.jsx)("span",{className:"truncate",children:el}),(0,r.jsx)("button",{type:"button",className:"ml-auto shrink-0 text-[#8e847d] hover:text-[#c9c0b7]",onClick:()=>eo(null),children:(0,r.jsx)(u.A,{className:"h-3 w-3"})})]})}):null,em?(0,r.jsxs)("div",{className:"absolute inset-x-0 bottom-0 z-10 border-t border-white/12 bg-[#161212] backdrop-blur-sm [padding-bottom:env(safe-area-inset-bottom)]",children:[el?(0,r.jsxs)("div",{className:"flex items-center gap-1.5 px-3 pt-1.5 text-[11px] text-[#ffb39e]",children:[(0,r.jsx)(c.A,{className:"h-3 w-3 shrink-0"}),(0,r.jsx)("span",{className:"truncate",children:el}),(0,r.jsx)("button",{type:"button",className:"ml-auto shrink-0 text-[#8e847d] hover:text-[#c9c0b7]",onClick:()=>eo(null),children:(0,r.jsx)(u.A,{className:"h-3 w-3"})})]}):null,en?(0,r.jsxs)("div",{className:"flex items-center gap-1.5 px-3 pt-1.5 text-[11px] text-[#ff8f7a]",children:[(0,r.jsx)(c.A,{className:"h-3 w-3 shrink-0"}),(0,r.jsx)("span",{className:"truncate",children:en}),(0,r.jsx)("button",{type:"button",className:"ml-auto shrink-0 text-[#8e847d] hover:text-[#c9c0b7]",onClick:()=>er(null),children:(0,r.jsx)(u.A,{className:"h-3 w-3"})})]}):null,(0,r.jsxs)("form",{onSubmit:e=>{e.preventDefault(),ej()},className:"flex items-center gap-2 px-2 py-2 lg:px-3",children:[(0,r.jsx)("input",{ref:P,value:Q,onChange:e=>Z(e.target.value),placeholder:"Send a follow-up message…",disabled:ee,className:"h-8 min-w-0 flex-1 rounded-md border border-white/10 bg-[#0c0808] px-2.5 text-[12px] text-[#efe8e1] outline-none placeholder:text-[#7d746e] focus:border-white/20 disabled:opacity-50",onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),e.currentTarget.blur())}}),(0,r.jsx)(f.$,{type:"submit",size:"icon",variant:"ghost",disabled:ee||0===Q.trim().length,className:"h-8 w-8 shrink-0 rounded-md border border-white/10 bg-[#0c0808] text-[#c9c0b7] hover:bg-[#201818] disabled:opacity-30","aria-label":"Send message",children:ee?(0,r.jsx)(i.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(d.A,{className:"h-3.5 w-3.5"})})]})]}):null,X?(0,r.jsx)("div",{className:"absolute inset-x-0 bottom-0 z-10 border-t border-white/12 bg-[#161212] px-3 py-2 text-[11px] text-[#ffb39e] backdrop-blur-sm [padding-bottom:env(safe-area-inset-bottom)]",children:(0,r.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,r.jsx)(c.A,{className:"h-3 w-3 shrink-0"}),(0,r.jsx)("span",{className:"truncate",children:X})]}),ew?(0,r.jsx)(s(),{href:ew,className:"shrink-0 text-[11px] font-medium text-[#ffd089] underline underline-offset-2 hover:text-[#fff8f2]",children:"Open bridge recovery"}):null]})}):null]})}},86181:(e,t,n)=>{"use strict";n.d(t,{Jn:()=>o,k$:()=>s,ox:()=>l});let r='MesloLGM Nerd Font, MesloLGM NF, MesloLGS NF, MesloLGS Nerd Font, Hack Nerd Font, FiraCode Nerd Font, JetBrainsMono Nerd Font, CaskaydiaCove Nerd Font, Menlo, Monaco, "Courier New", SF Mono, SF Pro, monospace';function l(e,t=.5){return!e||e.scrollHeight-e.clientHeight-e.scrollTop<=t}function o(e){var t;return(t="number"==typeof e&&Number.isFinite(e)&&e>0?e:1280)<420?{fontFamily:"'SF Mono', Menlo, Monaco, monospace",fontSize:10,lineHeight:1.1}:t<560?{fontFamily:"'SF Mono', Menlo, Monaco, monospace",fontSize:11,lineHeight:1.15}:t<768?{fontFamily:"'SF Mono', Menlo, Monaco, monospace",fontSize:12,lineHeight:1.2}:t<1024?{fontFamily:r,fontSize:13,lineHeight:1.2}:{fontFamily:r,fontSize:14,lineHeight:1.2}}function s(){var e;return"function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,"u"<typeof navigator||navigator.maxTouchPoints,e=window.innerWidth,window.innerHeight,e<1024}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2452],{40443:(e,t,s)=>{s.d(t,{Wu:()=>r,Zp:()=>i,aR:()=>l});var a=s(54568),n=s(46916);let i=(0,s(7620).forwardRef)(({className:e,...t},s)=>(0,a.jsx)("div",{ref:s,className:(0,n.cn)("surface-card rounded-[var(--radius-md)] border",e),...t}));function l({className:e,...t}){return(0,a.jsx)("div",{className:(0,n.cn)("flex items-center gap-2 border-b border-[var(--vk-border)] px-3 py-2",e),...t})}function r({className:e,...t}){return(0,a.jsx)("div",{className:(0,n.cn)("px-3 py-2",e),...t})}i.displayName="Card"},42452:(e,t,s)=>{s.r(t),s.d(t,{SessionDetail:()=>ed});var a=s(54568),n=s(42925),i=s(7620),l=s(79748),r=s(7920),c=s(69863),o=s(97380),d=s(46548),x=s(90466),u=s(35131),m=s(46916);let h=u.bL,p=(0,i.forwardRef)(({className:e,...t},s)=>(0,a.jsx)(u.B8,{ref:s,className:(0,m.cn)("inline-flex max-w-full items-center gap-0.5 overflow-x-auto rounded-[3px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] p-0.5 whitespace-nowrap touch-pan-x [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",e),...t}));p.displayName="TabsList";let f=(0,i.forwardRef)(({className:e,...t},s)=>(0,a.jsx)(u.l9,{ref:s,className:(0,m.cn)("inline-flex min-h-[34px] shrink-0 items-center gap-1.5 rounded-[3px] px-2.5 py-1.5 text-[12px] text-[var(--vk-text-muted)]","data-[state=active]:bg-[var(--vk-bg-active)] data-[state=active]:text-[var(--vk-text-normal)]","hover:text-[var(--vk-text-normal)]","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[var(--vk-orange)]",e),...t}));f.displayName="TabsTrigger";let v=(0,i.forwardRef)(({className:e,...t},s)=>(0,a.jsx)(u.UC,{ref:s,className:(0,m.cn)("focus-visible:outline-none",e),...t}));v.displayName="TabsContent";var g=s(40443),b=s(76081),j=s(35821),w=s(34309),k=s(59706),N=s(34041),y=s(76265),S=s(45894),C=s(26463),$=s(96249),A=s(58299),I=s(56050),E=s(23555),_=s(60527),F=s(58588),M=s(99844),R=s(5881),L=s(90124);let D=(0,n.default)(()=>s.e(4535).then(s.bind(s,74535)).then(e=>e.SessionDiff),{loadableGenerated:{webpack:()=>[74535]},loading:()=>(0,a.jsx)("div",{className:"flex h-32 items-center justify-center text-[12px] text-[var(--vk-text-muted)]",children:"Loading changes…"}),ssr:!1});function q({text:e}){let[t,s]=(0,i.useState)(!1);async function n(){try{await navigator.clipboard.writeText(e),s(!0),window.setTimeout(()=>s(!1),1400)}catch{}}return(0,a.jsxs)("button",{type:"button",onClick:()=>void n(),className:"inline-flex max-w-[180px] items-center gap-1 font-mono text-[11px] text-[var(--vk-text-muted)] transition-colors hover:text-[var(--vk-text-normal)]",children:[(0,a.jsx)("span",{className:"truncate",children:e}),t?(0,a.jsx)(w.A,{className:"h-3 w-3 shrink-0 text-emerald-400"}):(0,a.jsx)(k.A,{className:"h-3 w-3 shrink-0 opacity-50"})]})}function P(e,t){let s=e.metadata[t];return"string"==typeof s&&s.trim().length>0?s:void 0}function T(e){if(!e)return null;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:null}function U({node:e,depth:t,selectedPath:s,expandedDirs:n,onToggleDir:i,onSelectFile:l}){let r=n.has(e.path),c=e.path===s,o=8+16*t;return e.isDir?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("button",{type:"button",onClick:()=>i(e.path),className:"flex w-full items-center gap-1.5 py-1.5 text-left text-[12px] text-[var(--vk-text-muted)] hover:bg-white/4 active:bg-white/6",style:{paddingLeft:o},children:[r?(0,a.jsx)(N.A,{className:"h-3 w-3 shrink-0 opacity-50"}):(0,a.jsx)(y.A,{className:"h-3 w-3 shrink-0 opacity-50"}),r?(0,a.jsx)(S.A,{className:"h-3.5 w-3.5 shrink-0 text-amber-400/70"}):(0,a.jsx)(C.A,{className:"h-3.5 w-3.5 shrink-0 text-amber-400/70"}),(0,a.jsx)("span",{className:"truncate",children:e.name})]}),r?e.children.map(e=>(0,a.jsx)(U,{node:e,depth:t+1,selectedPath:s,expandedDirs:n,onToggleDir:i,onSelectFile:l},e.path)):null]}):(0,a.jsxs)("button",{type:"button",onClick:()=>l(e.path),className:`flex w-full items-center gap-1.5 py-1.5 pr-2 text-left text-[12px] transition-colors ${c?"bg-blue-500/10 text-[var(--vk-text-strong)]":"text-[var(--vk-text-normal)] hover:bg-white/4"}`,style:{paddingLeft:o+16},children:[(0,a.jsx)($.A,{className:"h-3.5 w-3.5 shrink-0 text-[var(--vk-text-muted)]"}),(0,a.jsx)("span",{className:"truncate",children:e.name})]})}let O={js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",mjs:"javascript",cjs:"javascript",mts:"typescript",cts:"typescript",html:"html",htm:"html",css:"css",scss:"scss",sass:"sass",less:"less",vue:"vue",svelte:"svelte",astro:"astro",json:"json",jsonc:"jsonc",json5:"json5",yaml:"yaml",yml:"yaml",toml:"toml",ini:"ini",xml:"xml",svg:"xml",plist:"xml",csv:"csv",tsv:"csv",md:"markdown",mdx:"mdx",tex:"latex",rst:"rst",rs:"rust",go:"go",c:"c",h:"c",cpp:"cpp",cc:"cpp",cxx:"cpp",hpp:"cpp",hh:"cpp",cs:"csharp",java:"java",kt:"kotlin",kts:"kotlin",scala:"scala",swift:"swift",m:"objective-c",mm:"objective-cpp",zig:"zig",nim:"nim",v:"v",d:"d",py:"python",pyi:"python",rb:"ruby",php:"php",pl:"perl",pm:"perl",lua:"lua",r:"r",R:"r",jl:"julia",ex:"elixir",exs:"elixir",erl:"erlang",hrl:"erlang",hs:"haskell",lhs:"haskell",clj:"clojure",cljs:"clojure",ml:"ocaml",mli:"ocaml",fs:"fsharp",fsx:"fsharp",sh:"bash",bash:"bash",zsh:"bash",fish:"fish",ps1:"powershell",psm1:"powershell",bat:"bat",cmd:"bat",dockerfile:"dockerfile",containerfile:"dockerfile",tf:"hcl",hcl:"hcl",nix:"nix",sql:"sql",graphql:"graphql",gql:"graphql",prisma:"prisma",proto:"protobuf",thrift:"thrift",makefile:"makefile",cmake:"cmake",asm:"asm",s:"asm",diff:"diff",patch:"diff",log:"log",txt:"plaintext",env:"dotenv",lock:"json"},z={makefile:"makefile",Makefile:"makefile",dockerfile:"dockerfile",Dockerfile:"dockerfile",containerfile:"dockerfile",Containerfile:"dockerfile",gemfile:"ruby",Gemfile:"ruby",rakefile:"ruby",Rakefile:"ruby",cmakelists:"cmake",CMakeLists:"cmake",".gitignore":"gitignore",".dockerignore":"gitignore",".editorconfig":"ini",".prettierrc":"json",".eslintrc":"json",".babelrc":"json",".env":"dotenv",".env.local":"dotenv",".env.production":"dotenv","tsconfig.json":"jsonc","jsconfig.json":"jsonc"},W=new Set(["png","jpg","jpeg","gif","webp","svg","ico","bmp","avif"]);function B(e){let t=e.split("/").pop()??"",s=t.lastIndexOf(".");return s>=0?t.slice(s+1).toLowerCase():""}function Z({code:e,lang:t}){let[n,l]=(0,i.useState)(null),r=(0,i.useRef)(e),c=(0,i.useRef)(t);if((0,i.useEffect)(()=>{r.current=e,c.current=t;let a=!1;return(async()=>{try{let{codeToHtml:n}=await s.e(2228).then(s.bind(s,42228));if(a)return;let i=await n(e,{lang:t,theme:"github-dark-default"});a||r.current!==e||c.current!==t||l(i)}catch{if(a)return;try{let{codeToHtml:t}=await s.e(2228).then(s.bind(s,42228));if(a)return;let n=await t(e,{lang:"plaintext",theme:"github-dark-default"});a||l(n)}catch{a||l(null)}}})(),()=>{a=!0}},[e,t]),!n){let t=e.split("\n"),s=String(t.length).length;return(0,a.jsx)("div",{className:"inline-block min-w-full align-top",children:(0,a.jsx)("table",{className:"min-w-full border-collapse font-mono text-[11px] leading-5",children:(0,a.jsx)("tbody",{children:t.map((e,t)=>(0,a.jsxs)("tr",{className:"hover:bg-white/3",children:[(0,a.jsx)("td",{className:"select-none whitespace-nowrap border-r border-white/6 px-2 text-right text-[var(--vk-text-muted)] opacity-40",style:{minWidth:`${s+2}ch`},children:t+1}),(0,a.jsx)("td",{className:"whitespace-pre px-3 text-[var(--vk-text-normal)]",children:e||"\xa0"})]},t))})})})}return(0,a.jsx)("div",{className:"shiki-viewer inline-block min-w-full align-top [&_.shiki]:!bg-transparent [&_.shiki]:p-0 [&_code]:text-[11px] [&_code]:leading-5 [&_pre]:!bg-transparent [&_pre]:!p-0",dangerouslySetInnerHTML:{__html:n}})}function G({sessionId:e,filePath:t}){let[s,n]=(0,i.useState)(null),[l,r]=(0,i.useState)(!0),[c,o]=(0,i.useState)(null),[d,x]=(0,i.useState)(!1),[u,m]=(0,i.useState)(!1),[h,p]=(0,i.useState)(0);if((0,i.useEffect)(()=>{let s=!1;r(!0),o(null),n(null),x(!1),m(!1),p(0);let a=new URLSearchParams({path:t});return fetch(`/api/sessions/${encodeURIComponent(e)}/files?${a.toString()}`,{cache:"no-store"}).then(async e=>{if(!e.ok)throw Error(`Failed to load file (${e.status})`);return e.json()}).then(e=>{s||(e.binary?x(!0):n("string"==typeof e.content?e.content:""),m(!!e.truncated),p("number"==typeof e.size?e.size:0))}).catch(e=>{s||o(e instanceof Error?e.message:"Failed to load file")}).finally(()=>{s||r(!1)}),()=>{s=!0}},[e,t]),l)return(0,a.jsxs)("div",{className:"flex h-full items-center justify-center gap-2 text-[12px] text-[var(--vk-text-muted)]",children:[(0,a.jsx)(A.A,{className:"h-4 w-4 animate-spin"}),"Loading…"]});if(c)return(0,a.jsx)("div",{className:"flex h-full items-center justify-center px-4 text-center text-[12px] text-red-400",children:c});if(d&&W.has(B(t))){let s=new URLSearchParams({path:t,raw:"1"}),n=`/api/sessions/${encodeURIComponent(e)}/files?${s.toString()}`;return(0,a.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-4",children:[(0,a.jsx)("img",{src:n,alt:t,className:"max-h-[60vh] max-w-full rounded-md object-contain"}),(0,a.jsxs)("span",{className:"text-[11px] text-[var(--vk-text-muted)]",children:[t.split("/").pop(),h>0?` \xb7 ${J(h)}`:""]})]})}if(d){let e=B(t);return(0,a.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 px-4 text-center",children:[(0,a.jsx)("div",{className:"rounded-lg bg-white/4 p-4",children:(0,a.jsx)($.A,{className:"mx-auto h-8 w-8 text-[var(--vk-text-muted)]"})}),(0,a.jsxs)("p",{className:"text-[12px] text-[var(--vk-text-muted)]",children:["Binary file",e?` (.${e})`:""," — preview not available"]}),h>0?(0,a.jsx)("p",{className:"text-[11px] text-[var(--vk-text-muted)] opacity-60",children:J(h)}):null]})}let f=function(e){let t=e.split("/").pop()??"";if(z[t])return z[t];let s=t.lastIndexOf(".");if(s>=0){let e=t.slice(s+1).toLowerCase();if(O[e])return O[e]}return"plaintext"}(t);return(0,a.jsxs)("div",{className:"flex h-full min-h-0 min-w-0 flex-col",children:[u?(0,a.jsxs)("div",{className:"shrink-0 border-b border-amber-500/20 bg-amber-500/8 px-3 py-1 text-[11px] text-amber-300",children:["File truncated",h>0?` (${J(h)} total)`:""]}):null,(0,a.jsx)("div",{className:"min-h-0 min-w-0 flex-1 overflow-auto overscroll-contain touch-pan-x touch-pan-y py-2",children:(0,a.jsx)(Z,{code:s??"",lang:f})})]})}function J(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function V({sessionId:e,active:t}){let[s,n]=(0,i.useState)([]),[l,r]=(0,i.useState)(!0),[c,o]=(0,i.useState)(null),[d,x]=(0,i.useState)(!1),[u,m]=(0,i.useState)(""),[h,p]=(0,i.useState)(null),[f,v]=(0,i.useState)(new Set),g=(0,i.useRef)(!0),b=(0,i.useCallback)(async()=>{try{r(!0);let t=await fetch(`/api/sessions/${encodeURIComponent(e)}/files`,{cache:"no-store"});if(!t.ok)throw Error(`Failed to load files (${t.status})`);let s=await t.json();if(!g.current)return;n(s.files??[]),x(!!s.truncated),o(null)}catch(e){if(!g.current)return;o(e instanceof Error?e.message:"Failed to load files")}finally{g.current&&r(!1)}},[e]);(0,i.useEffect)(()=>(g.current=!0,t&&b(),()=>{g.current=!1}),[t,b]);let j=(0,i.useMemo)(()=>(function(e){let t={name:"",path:"",children:[],isDir:!0};for(let s of e){let e=s.split("/"),a=t,n="";for(let t=0;t<e.length;t++){let s=e[t];n=n?`${n}/${s}`:s;let i=t===e.length-1,l=a.children.find(e=>e.name===s);l||(l={name:s,path:n,children:[],isDir:!i},a.children.push(l)),a=l}}return function e(t){for(let s of(t.sort((e,t)=>e.isDir!==t.isDir?e.isDir?-1:1:e.name.localeCompare(t.name,void 0,{sensitivity:"base"})),t))s.children.length>0&&e(s.children);return t}(t.children)})(s),[s]),w=(0,i.useMemo)(()=>(function(e,t){if(!t)return e;let s=t.toLowerCase();return function e(t){let a=[];for(let n of t)(function e(t){return!!(t.name.toLowerCase().includes(s)||t.path.toLowerCase().includes(s))||t.children.some(e)})(n)&&(n.isDir?a.push({...n,children:e(n.children)}):a.push(n));return a}(e)})(j,u.trim()),[j,u]);(0,i.useEffect)(()=>{if(u.trim()){let e=new Set;!function t(s){for(let a of s)a.isDir&&(e.add(a.path),t(a.children))}(w),v(e)}},[w,u]);let k=(0,i.useCallback)(e=>{v(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),N=(0,i.useCallback)(e=>{p(e)},[]),y=(0,i.useCallback)(()=>{p(null)},[]);if(l&&0===s.length)return(0,a.jsxs)("div",{className:"flex h-full items-center justify-center gap-2 text-[12px] text-[var(--vk-text-muted)]",children:[(0,a.jsx)(A.A,{className:"h-4 w-4 animate-spin"}),"Loading workspace files…"]});if(c)return(0,a.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-4 text-center",children:[(0,a.jsx)("p",{className:"text-[12px] text-red-400",children:c}),(0,a.jsx)("button",{type:"button",onClick:()=>void b(),className:"text-[11px] text-[var(--vk-text-muted)] underline hover:text-[var(--vk-text-normal)]",children:"Retry"})]});let S=h?(0,a.jsxs)("div",{className:"flex h-full min-h-0 min-w-0 flex-col lg:hidden",children:[(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-white/8 px-2 py-2",children:[(0,a.jsx)("button",{type:"button",onClick:y,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-[var(--vk-text-muted)] hover:bg-white/6","aria-label":"Back to file list",children:(0,a.jsx)(I.A,{className:"h-4 w-4"})}),(0,a.jsx)($.A,{className:"h-3.5 w-3.5 shrink-0 text-[var(--vk-text-muted)]"}),(0,a.jsx)("span",{className:"truncate font-mono text-[11px] text-[var(--vk-text-strong)]",children:h})]}),(0,a.jsx)("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:(0,a.jsx)(G,{sessionId:e,filePath:h})})]}):null;return(0,a.jsxs)("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto overscroll-contain lg:overflow-hidden",children:[S,(0,a.jsxs)("div",{className:`flex shrink-0 items-center gap-2 border-b border-white/8 px-2 py-1.5 ${h?"hidden lg:flex":""}`,children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 rounded-md bg-white/4 px-2 py-1.5",children:[(0,a.jsx)(E.A,{className:"h-3.5 w-3.5 shrink-0 text-[var(--vk-text-muted)]"}),(0,a.jsx)("input",{type:"text",value:u,onChange:e=>m(e.target.value),placeholder:"Search files…",className:"min-w-0 flex-1 bg-transparent text-[12px] text-[var(--vk-text-normal)] outline-none placeholder:text-[var(--vk-text-muted)]"})]}),(0,a.jsx)("button",{type:"button",onClick:()=>void b(),disabled:l,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-[var(--vk-text-muted)] hover:bg-white/6 disabled:opacity-50","aria-label":"Refresh files",children:(0,a.jsx)(_.A,{className:`h-3.5 w-3.5 ${l?"animate-spin":""}`})})]}),d?(0,a.jsx)("div",{className:`shrink-0 border-b border-amber-500/20 bg-amber-500/8 px-3 py-1.5 text-[11px] text-amber-300 ${h?"hidden lg:block":""}`,children:"File list truncated (4000 file limit)"}):null,(0,a.jsxs)("div",{className:`min-h-0 flex-1 lg:flex lg:flex-row ${h?"hidden lg:flex":"flex flex-col"}`,children:[(0,a.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain py-1 lg:max-w-[320px] lg:border-r lg:border-white/8",children:0===w.length?(0,a.jsx)("div",{className:"px-3 py-6 text-center text-[12px] text-[var(--vk-text-muted)]",children:u?"No files match your search.":"No files in workspace."}):w.map(e=>(0,a.jsx)(U,{node:e,depth:0,selectedPath:h,expandedDirs:f,onToggleDir:k,onSelectFile:N},e.path))}),(0,a.jsx)("div",{className:"hidden min-h-0 min-w-0 flex-1 lg:block",children:h?(0,a.jsxs)("div",{className:"flex h-full min-h-0 min-w-0 flex-col",children:[(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-white/8 px-3 py-2",children:[(0,a.jsx)($.A,{className:"h-3.5 w-3.5 shrink-0 text-[var(--vk-text-muted)]"}),(0,a.jsx)("span",{className:"truncate font-mono text-[11px] text-[var(--vk-text-strong)]",children:h})]}),(0,a.jsx)("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:(0,a.jsx)(G,{sessionId:e,filePath:h})})]}):(0,a.jsx)("div",{className:"flex h-full items-center justify-center text-[12px] text-[var(--vk-text-muted)]",children:"Select a file to view its contents"})})]})]})}function H({session:e,sessionId:t,active:s}){let[n,l]=(0,i.useState)("changes"),r=(0,i.useMemo)(()=>P(e,"task")??P(e,"prompt")??("string"==typeof e.task?e.task:"")??("string"==typeof e.prompt?e.prompt:""),[e]),c=(0,i.useMemo)(()=>P(e,"agent")??("string"==typeof e.agent?e.agent:""),[e]),o=(0,i.useMemo)(()=>(function(e,t){if(!e||!t)return"";let s=new Date(e).getTime(),a=new Date(t).getTime();if(!Number.isFinite(s)||!Number.isFinite(a)||a<s)return"";let n=Math.floor((a-s)/6e4);if(n<1)return"<1m";if(n<60)return`${n}m`;let i=Math.floor(n/60);return`${i}h ${n%60}m`})(P(e,"startedAt")??e.startedAt,P(e,"finishedAt")??e.finishedAt),[e]),d=(0,i.useMemo)(()=>(function(e){if("number"==typeof e.cost)return e.cost;let t=e.metadata.cost;if("string"!=typeof t)return 0;try{let e=JSON.parse(t),s="number"==typeof e.estimatedCostUsd?e.estimatedCostUsd:0,a="number"==typeof e.totalUSD?e.totalUSD:0;return s??a}catch{return 0}})(e),[e]),x=(0,i.useMemo)(()=>T(P(e,"queuePosition")),[e]),u=(0,i.useMemo)(()=>T(P(e,"queueDepth")),[e]),m=(0,i.useMemo)(()=>P(e,"recoveryState")??"",[e]),h=(0,i.useMemo)(()=>"queued"===e.status?x?`Waiting in queue at position ${x}${u?` of ${u}`:""}.`:"Waiting in the launch queue.":"requeued_after_restart"===m?"Session recovered after backend restart and requeued.":"reattach_pending"===m?"Recovering terminal runtime after backend restart.":"detached_runtime"===m?"Backend restarted while agent may still be running.":"resume_required"===m?"Session recovered after restart. Send a message to resume.":"",[u,x,m,e.status]);return(0,a.jsxs)("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto overscroll-contain lg:overflow-hidden",children:[h?(0,a.jsx)("div",{className:"shrink-0 border-b border-amber-500/20 bg-amber-500/8 px-3 py-2",children:(0,a.jsx)("p",{className:"text-[12px] leading-snug text-amber-300",children:h})}):null,r?(0,a.jsx)("div",{className:"shrink-0 border-b border-white/8 px-3 py-2.5",children:(0,a.jsx)("p",{className:"line-clamp-3 whitespace-pre-wrap text-[13px] leading-relaxed text-[var(--vk-text-normal)]",children:r})}):null,(0,a.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-x-4 gap-y-1 border-b border-white/8 px-3 py-2 text-[11px] text-[var(--vk-text-muted)]",children:[c?(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(L.N,{seed:{label:c},className:"h-4 w-4"}),(0,a.jsx)("span",{children:c})]}):null,e.branch?(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)(F.A,{className:"h-3 w-3 shrink-0"}),(0,a.jsx)(q,{text:e.branch})]}):null,o?(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)(M.A,{className:"h-3 w-3 shrink-0"}),(0,a.jsx)("span",{children:o})]}):null,d>0?(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)(R.A,{className:"h-3 w-3 shrink-0"}),(0,a.jsxs)("span",{children:["$",d.toFixed(3)]})]}):null]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-0 border-b border-white/8 px-2",children:[(0,a.jsx)("button",{type:"button",onClick:()=>l("changes"),className:`px-3 py-2 text-[12px] font-medium transition-colors ${"changes"===n?"border-b-2 border-[var(--vk-orange)] text-[var(--vk-text-strong)]":"border-b-2 border-transparent text-[var(--vk-text-muted)] hover:text-[var(--vk-text-normal)]"}`,children:"Changes"}),(0,a.jsx)("button",{type:"button",onClick:()=>l("files"),className:`px-3 py-2 text-[12px] font-medium transition-colors ${"files"===n?"border-b-2 border-[var(--vk-orange)] text-[var(--vk-text-strong)]":"border-b-2 border-transparent text-[var(--vk-text-muted)] hover:text-[var(--vk-text-normal)]"}`,children:"Files"})]}),(0,a.jsx)("div",{className:"min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain",children:"changes"===n?(0,a.jsx)(D,{sessionId:t,active:s},t):(0,a.jsx)(V,{sessionId:t,active:s&&"files"===n})})]})}var K=s(40448),Q=s(50549),X=s(26083),Y=s(31404),ee=s(59207);let et="block h-5 w-5 shrink-0 object-contain",es=[{id:"finder",label:"Finder"},{id:"cursor",label:"Cursor"},{id:"antigravity",label:"Antigravity"},{id:"windsurf",label:"Windsurf"},{id:"zed",label:"Zed"},{id:"xcode",label:"Xcode"},{id:"vscode",label:"VS Code"},{id:"vscode-insiders",label:"VS Code Insiders"},{id:"intellij-idea",label:"IntelliJ IDEA"},{id:"custom",label:"Custom"}],ea={finder:{kind:"image",imageSrc:"/icons/ide/finder.svg",className:et},vscode:{kind:"image",imageSrc:"/icons/ide/vscode-dark.svg",className:et},"vscode-insiders":{kind:"image",imageSrc:"/icons/ide/vscode-insiders.svg",className:et},cursor:{kind:"image",imageSrc:"/icons/ide/cursor-dark.svg",className:et},windsurf:{kind:"image",imageSrc:"/icons/ide/windsurf-dark.svg",className:et},"intellij-idea":{kind:"image",imageSrc:"/icons/ide/intellij.svg",className:et},zed:{kind:"image",imageSrc:"/icons/ide/zed-dark.svg",className:et},xcode:{kind:"image",imageSrc:"/icons/ide/xcode.svg",className:et},antigravity:{kind:"image",imageSrc:"/icons/ide/antigravity-dark.svg",className:et},custom:{kind:"icon",className:`${et} text-[var(--vk-text-muted)]`}};function en({editorId:e,label:t}){let s=ea[e];return s?"icon"===s.kind?(0,a.jsx)(Q.A,{className:s?.className??`${et} text-[var(--vk-text-muted)]`}):(0,a.jsx)("img",{src:s.imageSrc,alt:`${t} logo`,className:s.className}):(0,a.jsx)(Q.A,{className:`${et} text-[var(--vk-text-muted)]`})}function ei({projectId:e,bridgeId:t}){let{preferences:s}=(0,ee.g)(t),[n,l]=(0,i.useState)(null),r=(0,i.useMemo)(()=>{var e;return e=s?.ide??"vscode",es.find(t=>t.id===e)??{id:e,label:e}},[s?.ide]);async function c(s){if(e&&!n){l(s);try{let a=await fetch((0,Y.S)(`/api/projects/${encodeURIComponent(e)}/open`,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ide:s})}),n=await a.json().catch(()=>null);if(!a.ok)throw Error(n?.error??`Failed to open project (${a.status})`)}catch(e){window.alert(e instanceof Error?e.message:"Failed to open project")}finally{l(null)}}}return(0,a.jsxs)(K.bL,{children:[(0,a.jsx)(K.l9,{asChild:!0,children:(0,a.jsxs)("button",{type:"button",disabled:!e||null!==n,className:"inline-flex h-9 items-center gap-2 rounded-[6px] border border-[rgba(255,255,255,0.08)] bg-[rgba(255,255,255,0.03)] px-3 text-[13px] text-[var(--vk-text-normal)] transition hover:bg-[rgba(255,255,255,0.06)] disabled:cursor-not-allowed disabled:opacity-60","aria-label":"Open project in code editor",title:e?`Open project in ${r.label}`:"No project selected",children:[n?(0,a.jsx)(A.A,{className:"h-4 w-4 animate-spin text-[var(--vk-text-muted)]"}):(0,a.jsx)(X.A,{className:"h-4 w-4 text-[var(--vk-text-muted)]"}),(0,a.jsx)("span",{className:"hidden font-medium sm:inline",children:"Open"}),(0,a.jsx)(N.A,{className:"h-3.5 w-3.5 text-[var(--vk-text-muted)]"})]})}),(0,a.jsx)(K.ZL,{children:(0,a.jsx)(K.UC,{align:"end",sideOffset:8,className:"z-50 min-w-[240px] rounded-[8px] border border-[rgba(255,255,255,0.08)] bg-[#1c1a19] p-2 shadow-[0_18px_50px_rgba(0,0,0,0.45)]",children:es.map(e=>(0,a.jsxs)(K.q7,{onSelect:()=>void c(e.id),className:"flex min-h-[44px] cursor-default items-center gap-3 rounded-[6px] px-3 py-2 text-[14px] text-[#f3efea] outline-none transition hover:bg-[rgba(255,255,255,0.06)] focus:bg-[rgba(255,255,255,0.06)]",children:[(0,a.jsx)(en,{editorId:e.id,label:e.label}),(0,a.jsx)("span",{className:"flex-1",children:e.label}),r.id===e.id?(0,a.jsx)(w.A,{className:"h-4 w-4 text-[var(--vk-text-muted)]"}):null]},e.id))})})]})}let el=(0,n.default)(()=>s.e(3954).then(s.bind(s,83954)).then(e=>e.SessionTerminal),{loadableGenerated:{webpack:()=>[83954]},loading:()=>(0,a.jsx)("div",{className:"flex h-full min-h-[240px] items-center justify-center text-[13px] text-[var(--vk-text-muted)]",children:"Loading terminal..."})}),er=(0,n.default)(()=>Promise.all([s.e(307),s.e(4089)]).then(s.bind(s,54089)).then(e=>e.SessionPreview),{loadableGenerated:{webpack:()=>[54089]},loading:()=>(0,a.jsx)("div",{className:"flex h-full min-h-[240px] items-center justify-center text-[13px] text-[var(--vk-text-muted)]",children:"Loading preview..."})}),ec=(0,n.default)(()=>s.e(1874).then(s.bind(s,81874)).then(e=>e.SessionSkills),{loadableGenerated:{webpack:()=>[81874]},loading:()=>(0,a.jsx)("div",{className:"flex h-full min-h-[240px] items-center justify-center text-[13px] text-[var(--vk-text-muted)]",children:"Loading skills..."})});function eo(e){return"overview"===e||"terminal"===e||"preview"===e||"skills"===e?e:"terminal"}function ed({sessionId:e,initialSession:t=null,bridgeId:s=null,immersiveMobileMode:n=!1,active:u=!0,onOpenSidebar:m}){let w=(0,l.usePathname)(),k=(0,l.useRouter)(),N=(0,l.useSearchParams)(),{session:y,loading:S,error:C}=(0,j.w)(e,t,{enabled:u,bridgeId:s}),$=(0,i.useRef)(0),A=(0,i.useRef)(!1),[I,E]=(0,i.useState)(null),_=(0,i.useMemo)(()=>eo(N.get("tab")),[N]),F=(0,i.useCallback)(e=>{let t=eo(e),s=new URLSearchParams(N.toString());"terminal"===t?s.delete("tab"):s.set("tab",t);let a=s.toString(),n=a.length>0?`${w}?${a}`:w;k.replace(n,{scroll:!1})},[w,k,N]),M=(0,i.useCallback)(e=>{$.current+=1,E({nonce:$.current,...e})},[]);(0,i.useEffect)(()=>{A.current=!1,$.current=0,E(null)},[e]);let R=(0,i.useCallback)(e=>{e&&u&&"terminal"===_&&!A.current&&(A.current=!0,F("preview"))},[u,_,F]);if(S)return(0,a.jsx)("div",{className:"flex h-full items-center justify-center p-6",children:(0,a.jsx)(g.Zp,{className:"w-full max-w-md",children:(0,a.jsx)(g.Wu,{className:"py-7 text-center text-[13px] text-[var(--text-muted)]",children:"Loading session workspace..."})})});if(C)return(0,a.jsx)("div",{className:"flex h-full items-center justify-center p-6",children:(0,a.jsx)(g.Zp,{className:"w-full max-w-md border-[color:color-mix(in_srgb,var(--status-error)_45%,transparent)]",children:(0,a.jsx)(g.Wu,{className:"py-7 text-center text-[13px] text-[var(--status-error)]",children:C})})});if(!y)return(0,a.jsx)("div",{className:"flex h-full items-center justify-center p-6",children:(0,a.jsx)(g.Zp,{className:"w-full max-w-md",children:(0,a.jsx)(g.Wu,{className:"py-7 text-center text-[13px] text-[var(--text-muted)]",children:"Session not found"})})});let L="string"==typeof y.status?y.status:"unknown",D=function(e){switch(e){case"needs_input":return"needs input";case"working":return"working";case"running":return"running";case"spawning":return"spawning";case"queued":return"queued";default:return e.replace(/[_-]+/g," ")}}(L),q=function(e){switch(e){case"working":case"running":return"bg-amber-400";case"needs_input":return"bg-blue-400";case"spawning":case"queued":default:return"bg-gray-400";case"done":return"bg-emerald-400";case"errored":return"bg-red-400";case"stuck":return"bg-orange-500";case"terminated":case"killed":return"bg-gray-500"}}(L),P="working"===L||"running"===L||"spawning"===L||"queued"===L||"needs_input"===L,T="queued"!==L&&"spawning"!==L,U=u&&n&&"terminal"===_,O=u&&"preview"===_,z="min-h-[38px] gap-1.5 px-2.5 text-[12px] sm:min-h-0 sm:px-3",W=(0,a.jsxs)(p,{className:"flex w-full overflow-x-auto sm:w-fit sm:inline-flex",children:[(0,a.jsxs)(f,{value:"overview",className:z,children:[(0,a.jsx)(r.A,{className:"h-3.5 w-3.5"}),"Overview"]}),(0,a.jsxs)(f,{value:"terminal",className:z,children:[(0,a.jsx)(c.A,{className:"h-3.5 w-3.5"}),"Terminal"]}),(0,a.jsxs)(f,{value:"preview",className:z,children:[(0,a.jsx)(o.A,{className:"h-3.5 w-3.5"}),"Preview"]}),(0,a.jsxs)(f,{value:"skills",className:z,children:[(0,a.jsx)(d.A,{className:"h-3.5 w-3.5"}),"Skills"]})]});return(0,a.jsx)("div",{className:`flex h-full min-h-0 min-w-0 w-full flex-col ${U?"overflow-hidden bg-[#060404]":"overflow-y-auto overscroll-contain lg:overflow-hidden"}`,children:(0,a.jsxs)(h,{value:_,onValueChange:F,className:U?"flex min-h-0 min-w-0 w-full flex-1 flex-col gap-0 p-0":"flex min-h-0 min-w-0 w-full flex-1 flex-col gap-1 p-1 lg:gap-2 lg:p-3",children:[U?(0,a.jsxs)("div",{className:"flex shrink-0 flex-col border-b border-white/10 bg-[#0d0908]",children:[(0,a.jsxs)("div",{className:"flex h-10 items-center gap-2 px-2",children:[m?(0,a.jsx)(b.$,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 text-[#8e847d] hover:text-[#c9c0b7]",onClick:m,"aria-label":"Open workspace panel",children:(0,a.jsx)(x.A,{className:"h-4 w-4"})}):null,(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[(0,a.jsx)("span",{className:`inline-block h-2 w-2 shrink-0 rounded-full ${q}${P?" animate-pulse":""}`}),(0,a.jsx)("span",{className:"text-[12px] font-medium text-[#efe8e1]",children:D}),(0,a.jsxs)("span",{className:"font-mono text-[10px] text-[#8e847d]",children:["\xb7 ",e.slice(0,7)]})]}),T?(0,a.jsx)(ei,{projectId:y.projectId,bridgeId:y.bridgeId??null}):null]}),(0,a.jsx)("div",{className:"px-1.5 pb-1.5",children:W})]}):(0,a.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1.5 sm:flex-nowrap",children:[W,(0,a.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 sm:ml-auto sm:w-auto sm:justify-end",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:`inline-block h-2 w-2 shrink-0 rounded-full ${q}${P?" animate-pulse":""}`}),(0,a.jsx)("span",{className:"text-[11px] text-[var(--vk-text-muted)]",children:D}),(0,a.jsxs)("span",{className:"hidden font-mono text-[10px] text-[var(--vk-text-muted)] sm:inline",children:["\xb7 ",e.slice(0,7)]})]}),T?(0,a.jsx)(ei,{projectId:y.projectId,bridgeId:y.bridgeId??null}):null]})]}),(0,a.jsxs)("div",{className:"relative min-h-0 min-w-0 flex-1 overflow-hidden",children:[(0,a.jsx)(v,{value:"overview",className:"min-h-0 h-full min-w-0 w-full overflow-hidden focus-visible:outline-none [&[hidden]]:block data-[state=inactive]:pointer-events-none data-[state=inactive]:absolute data-[state=inactive]:inset-0 data-[state=inactive]:invisible data-[state=inactive]:opacity-0",children:(0,a.jsx)(H,{session:y,sessionId:e,active:u&&"overview"===_})}),(0,a.jsx)(v,{value:"terminal",forceMount:!0,className:U?"flex min-h-0 h-full min-w-0 w-full flex-col overflow-hidden bg-[#060404] focus-visible:outline-none [&[hidden]]:block data-[state=inactive]:pointer-events-none data-[state=inactive]:absolute data-[state=inactive]:inset-0 data-[state=inactive]:invisible data-[state=inactive]:opacity-0":"flex min-h-0 h-full min-w-0 flex-col w-full overflow-hidden bg-transparent focus-visible:outline-none [&[hidden]]:block data-[state=inactive]:pointer-events-none data-[state=inactive]:absolute data-[state=inactive]:inset-0 data-[state=inactive]:invisible data-[state=inactive]:opacity-0",children:(0,a.jsx)(el,{sessionId:e,bridgeId:y.bridgeId??null,sessionState:L,runtimeMode:y.metadata.runtimeMode?.trim()??null,pendingInsert:I,immersiveMobileMode:U})}),(0,a.jsx)(v,{value:"preview",className:"min-h-0 h-full min-w-0 w-full overflow-hidden focus-visible:outline-none [&[hidden]]:block data-[state=inactive]:pointer-events-none data-[state=inactive]:absolute data-[state=inactive]:inset-0 data-[state=inactive]:invisible data-[state=inactive]:opacity-0",children:O?(0,a.jsx)(er,{sessionId:e,active:O,onQueueTerminalInsert:M,onConnectionChange:R},e):null}),(0,a.jsx)(v,{value:"skills",className:"min-h-0 h-full min-w-0 w-full overflow-hidden focus-visible:outline-none [&[hidden]]:block data-[state=inactive]:pointer-events-none data-[state=inactive]:absolute data-[state=inactive]:inset-0 data-[state=inactive]:invisible data-[state=inactive]:opacity-0",children:(0,a.jsx)(ec,{session:y,sessionId:e,active:u&&"skills"===_})})]})]},e)})}},59207:(e,t,s)=>{s.d(t,{g:()=>l});var a=s(7620),n=s(31404);function i(e){return!e||"object"!=typeof e||Array.isArray(e)?{}:{...e}}function l(e,t){let s=t?.enabled??!0,[l,r]=(0,a.useState)(null),[c,o]=(0,a.useState)(s),[d,x]=(0,a.useState)(null),u=(0,a.useCallback)(async()=>{if(!s){r(null),x(null),o(!1);return}try{var t;let s,a,l,c=await fetch((0,n.S)("/api/preferences",e)),o=await c.json().catch(()=>null);if(!c.ok)throw Error(o?.error??o?.reason??`Failed to load preferences: ${c.status}`);r((t=o?.preferences,s=i(t),l=(a=i(s.notifications)).soundFile,{onboardingAcknowledged:!0===s.onboardingAcknowledged,codingAgent:"string"==typeof s.codingAgent&&s.codingAgent.trim().length>0?s.codingAgent.trim():"claude-code",ide:"string"==typeof s.ide&&s.ide.trim().length>0?s.ide.trim():"vscode",markdownEditor:"string"==typeof s.markdownEditor&&s.markdownEditor.trim().length>0?s.markdownEditor.trim():"obsidian",markdownEditorPath:"string"==typeof s.markdownEditorPath?s.markdownEditorPath.trim():"",notifications:{soundEnabled:!1!==a.soundEnabled,soundFile:null===l?null:"string"==typeof l&&l.trim().length>0?l.trim():"abstract-sound-4"}})),x(null)}catch(e){r(null),x(e instanceof Error?e.message:"Failed to load preferences")}finally{o(!1)}},[e,s]);return(0,a.useEffect)(()=>{s&&u()},[s,u]),{preferences:s?l:null,loading:!!s&&c,error:s?d:null,refresh:u}}}}]);
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2452],{40443:(e,t,s)=>{s.d(t,{Wu:()=>r,Zp:()=>i,aR:()=>l});var a=s(54568),n=s(46916);let i=(0,s(7620).forwardRef)(({className:e,...t},s)=>(0,a.jsx)("div",{ref:s,className:(0,n.cn)("surface-card rounded-[var(--radius-md)] border",e),...t}));function l({className:e,...t}){return(0,a.jsx)("div",{className:(0,n.cn)("flex items-center gap-2 border-b border-[var(--vk-border)] px-3 py-2",e),...t})}function r({className:e,...t}){return(0,a.jsx)("div",{className:(0,n.cn)("px-3 py-2",e),...t})}i.displayName="Card"},42452:(e,t,s)=>{s.r(t),s.d(t,{SessionDetail:()=>ed});var a=s(54568),n=s(42925),i=s(7620),l=s(79748),r=s(7920),c=s(69863),o=s(97380),d=s(46548),x=s(90466),u=s(35131),m=s(46916);let h=u.bL,p=(0,i.forwardRef)(({className:e,...t},s)=>(0,a.jsx)(u.B8,{ref:s,className:(0,m.cn)("inline-flex max-w-full items-center gap-0.5 overflow-x-auto rounded-[3px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] p-0.5 whitespace-nowrap touch-pan-x [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",e),...t}));p.displayName="TabsList";let f=(0,i.forwardRef)(({className:e,...t},s)=>(0,a.jsx)(u.l9,{ref:s,className:(0,m.cn)("inline-flex min-h-[34px] shrink-0 items-center gap-1.5 rounded-[3px] px-2.5 py-1.5 text-[12px] text-[var(--vk-text-muted)]","data-[state=active]:bg-[var(--vk-bg-active)] data-[state=active]:text-[var(--vk-text-normal)]","hover:text-[var(--vk-text-normal)]","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[var(--vk-orange)]",e),...t}));f.displayName="TabsTrigger";let v=(0,i.forwardRef)(({className:e,...t},s)=>(0,a.jsx)(u.UC,{ref:s,className:(0,m.cn)("focus-visible:outline-none",e),...t}));v.displayName="TabsContent";var g=s(40443),b=s(76081),j=s(35821),w=s(34309),k=s(59706),N=s(34041),y=s(76265),S=s(45894),C=s(26463),$=s(96249),A=s(58299),I=s(56050),E=s(23555),_=s(60527),F=s(58588),M=s(99844),R=s(5881),L=s(90124);let D=(0,n.default)(()=>s.e(4535).then(s.bind(s,74535)).then(e=>e.SessionDiff),{loadableGenerated:{webpack:()=>[74535]},loading:()=>(0,a.jsx)("div",{className:"flex h-32 items-center justify-center text-[12px] text-[var(--vk-text-muted)]",children:"Loading changes…"}),ssr:!1});function q({text:e}){let[t,s]=(0,i.useState)(!1);async function n(){try{await navigator.clipboard.writeText(e),s(!0),window.setTimeout(()=>s(!1),1400)}catch{}}return(0,a.jsxs)("button",{type:"button",onClick:()=>void n(),className:"inline-flex max-w-[180px] items-center gap-1 font-mono text-[11px] text-[var(--vk-text-muted)] transition-colors hover:text-[var(--vk-text-normal)]",children:[(0,a.jsx)("span",{className:"truncate",children:e}),t?(0,a.jsx)(w.A,{className:"h-3 w-3 shrink-0 text-emerald-400"}):(0,a.jsx)(k.A,{className:"h-3 w-3 shrink-0 opacity-50"})]})}function P(e,t){let s=e.metadata[t];return"string"==typeof s&&s.trim().length>0?s:void 0}function T(e){if(!e)return null;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:null}function U({node:e,depth:t,selectedPath:s,expandedDirs:n,onToggleDir:i,onSelectFile:l}){let r=n.has(e.path),c=e.path===s,o=8+16*t;return e.isDir?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("button",{type:"button",onClick:()=>i(e.path),className:"flex w-full items-center gap-1.5 py-1.5 text-left text-[12px] text-[var(--vk-text-muted)] hover:bg-white/4 active:bg-white/6",style:{paddingLeft:o},children:[r?(0,a.jsx)(N.A,{className:"h-3 w-3 shrink-0 opacity-50"}):(0,a.jsx)(y.A,{className:"h-3 w-3 shrink-0 opacity-50"}),r?(0,a.jsx)(S.A,{className:"h-3.5 w-3.5 shrink-0 text-amber-400/70"}):(0,a.jsx)(C.A,{className:"h-3.5 w-3.5 shrink-0 text-amber-400/70"}),(0,a.jsx)("span",{className:"truncate",children:e.name})]}),r?e.children.map(e=>(0,a.jsx)(U,{node:e,depth:t+1,selectedPath:s,expandedDirs:n,onToggleDir:i,onSelectFile:l},e.path)):null]}):(0,a.jsxs)("button",{type:"button",onClick:()=>l(e.path),className:`flex w-full items-center gap-1.5 py-1.5 pr-2 text-left text-[12px] transition-colors ${c?"bg-blue-500/10 text-[var(--vk-text-strong)]":"text-[var(--vk-text-normal)] hover:bg-white/4"}`,style:{paddingLeft:o+16},children:[(0,a.jsx)($.A,{className:"h-3.5 w-3.5 shrink-0 text-[var(--vk-text-muted)]"}),(0,a.jsx)("span",{className:"truncate",children:e.name})]})}let O={js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",mjs:"javascript",cjs:"javascript",mts:"typescript",cts:"typescript",html:"html",htm:"html",css:"css",scss:"scss",sass:"sass",less:"less",vue:"vue",svelte:"svelte",astro:"astro",json:"json",jsonc:"jsonc",json5:"json5",yaml:"yaml",yml:"yaml",toml:"toml",ini:"ini",xml:"xml",svg:"xml",plist:"xml",csv:"csv",tsv:"csv",md:"markdown",mdx:"mdx",tex:"latex",rst:"rst",rs:"rust",go:"go",c:"c",h:"c",cpp:"cpp",cc:"cpp",cxx:"cpp",hpp:"cpp",hh:"cpp",cs:"csharp",java:"java",kt:"kotlin",kts:"kotlin",scala:"scala",swift:"swift",m:"objective-c",mm:"objective-cpp",zig:"zig",nim:"nim",v:"v",d:"d",py:"python",pyi:"python",rb:"ruby",php:"php",pl:"perl",pm:"perl",lua:"lua",r:"r",R:"r",jl:"julia",ex:"elixir",exs:"elixir",erl:"erlang",hrl:"erlang",hs:"haskell",lhs:"haskell",clj:"clojure",cljs:"clojure",ml:"ocaml",mli:"ocaml",fs:"fsharp",fsx:"fsharp",sh:"bash",bash:"bash",zsh:"bash",fish:"fish",ps1:"powershell",psm1:"powershell",bat:"bat",cmd:"bat",dockerfile:"dockerfile",containerfile:"dockerfile",tf:"hcl",hcl:"hcl",nix:"nix",sql:"sql",graphql:"graphql",gql:"graphql",prisma:"prisma",proto:"protobuf",thrift:"thrift",makefile:"makefile",cmake:"cmake",asm:"asm",s:"asm",diff:"diff",patch:"diff",log:"log",txt:"plaintext",env:"dotenv",lock:"json"},z={makefile:"makefile",Makefile:"makefile",dockerfile:"dockerfile",Dockerfile:"dockerfile",containerfile:"dockerfile",Containerfile:"dockerfile",gemfile:"ruby",Gemfile:"ruby",rakefile:"ruby",Rakefile:"ruby",cmakelists:"cmake",CMakeLists:"cmake",".gitignore":"gitignore",".dockerignore":"gitignore",".editorconfig":"ini",".prettierrc":"json",".eslintrc":"json",".babelrc":"json",".env":"dotenv",".env.local":"dotenv",".env.production":"dotenv","tsconfig.json":"jsonc","jsconfig.json":"jsonc"},W=new Set(["png","jpg","jpeg","gif","webp","svg","ico","bmp","avif"]);function B(e){let t=e.split("/").pop()??"",s=t.lastIndexOf(".");return s>=0?t.slice(s+1).toLowerCase():""}function Z({code:e,lang:t}){let[n,l]=(0,i.useState)(null),r=(0,i.useRef)(e),c=(0,i.useRef)(t);if((0,i.useEffect)(()=>{r.current=e,c.current=t;let a=!1;return(async()=>{try{let{codeToHtml:n}=await s.e(2228).then(s.bind(s,42228));if(a)return;let i=await n(e,{lang:t,theme:"github-dark-default"});a||r.current!==e||c.current!==t||l(i)}catch{if(a)return;try{let{codeToHtml:t}=await s.e(2228).then(s.bind(s,42228));if(a)return;let n=await t(e,{lang:"plaintext",theme:"github-dark-default"});a||l(n)}catch{a||l(null)}}})(),()=>{a=!0}},[e,t]),!n){let t=e.split("\n"),s=String(t.length).length;return(0,a.jsx)("div",{className:"inline-block min-w-full align-top",children:(0,a.jsx)("table",{className:"min-w-full border-collapse font-mono text-[11px] leading-5",children:(0,a.jsx)("tbody",{children:t.map((e,t)=>(0,a.jsxs)("tr",{className:"hover:bg-white/3",children:[(0,a.jsx)("td",{className:"select-none whitespace-nowrap border-r border-white/6 px-2 text-right text-[var(--vk-text-muted)] opacity-40",style:{minWidth:`${s+2}ch`},children:t+1}),(0,a.jsx)("td",{className:"whitespace-pre px-3 text-[var(--vk-text-normal)]",children:e||"\xa0"})]},t))})})})}return(0,a.jsx)("div",{className:"shiki-viewer inline-block min-w-full align-top [&_.shiki]:!bg-transparent [&_.shiki]:p-0 [&_code]:text-[11px] [&_code]:leading-5 [&_pre]:!bg-transparent [&_pre]:!p-0",dangerouslySetInnerHTML:{__html:n}})}function G({sessionId:e,filePath:t}){let[s,n]=(0,i.useState)(null),[l,r]=(0,i.useState)(!0),[c,o]=(0,i.useState)(null),[d,x]=(0,i.useState)(!1),[u,m]=(0,i.useState)(!1),[h,p]=(0,i.useState)(0);if((0,i.useEffect)(()=>{let s=!1;r(!0),o(null),n(null),x(!1),m(!1),p(0);let a=new URLSearchParams({path:t});return fetch(`/api/sessions/${encodeURIComponent(e)}/files?${a.toString()}`,{cache:"no-store"}).then(async e=>{if(!e.ok)throw Error(`Failed to load file (${e.status})`);return e.json()}).then(e=>{s||(e.binary?x(!0):n("string"==typeof e.content?e.content:""),m(!!e.truncated),p("number"==typeof e.size?e.size:0))}).catch(e=>{s||o(e instanceof Error?e.message:"Failed to load file")}).finally(()=>{s||r(!1)}),()=>{s=!0}},[e,t]),l)return(0,a.jsxs)("div",{className:"flex h-full items-center justify-center gap-2 text-[12px] text-[var(--vk-text-muted)]",children:[(0,a.jsx)(A.A,{className:"h-4 w-4 animate-spin"}),"Loading…"]});if(c)return(0,a.jsx)("div",{className:"flex h-full items-center justify-center px-4 text-center text-[12px] text-red-400",children:c});if(d&&W.has(B(t))){let s=new URLSearchParams({path:t,raw:"1"}),n=`/api/sessions/${encodeURIComponent(e)}/files?${s.toString()}`;return(0,a.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-4",children:[(0,a.jsx)("img",{src:n,alt:t,className:"max-h-[60vh] max-w-full rounded-md object-contain"}),(0,a.jsxs)("span",{className:"text-[11px] text-[var(--vk-text-muted)]",children:[t.split("/").pop(),h>0?` \xb7 ${J(h)}`:""]})]})}if(d){let e=B(t);return(0,a.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 px-4 text-center",children:[(0,a.jsx)("div",{className:"rounded-lg bg-white/4 p-4",children:(0,a.jsx)($.A,{className:"mx-auto h-8 w-8 text-[var(--vk-text-muted)]"})}),(0,a.jsxs)("p",{className:"text-[12px] text-[var(--vk-text-muted)]",children:["Binary file",e?` (.${e})`:""," — preview not available"]}),h>0?(0,a.jsx)("p",{className:"text-[11px] text-[var(--vk-text-muted)] opacity-60",children:J(h)}):null]})}let f=function(e){let t=e.split("/").pop()??"";if(z[t])return z[t];let s=t.lastIndexOf(".");if(s>=0){let e=t.slice(s+1).toLowerCase();if(O[e])return O[e]}return"plaintext"}(t);return(0,a.jsxs)("div",{className:"flex h-full min-h-0 min-w-0 flex-col",children:[u?(0,a.jsxs)("div",{className:"shrink-0 border-b border-amber-500/20 bg-amber-500/8 px-3 py-1 text-[11px] text-amber-300",children:["File truncated",h>0?` (${J(h)} total)`:""]}):null,(0,a.jsx)("div",{className:"min-h-0 min-w-0 flex-1 overflow-auto overscroll-contain touch-pan-x touch-pan-y py-2",children:(0,a.jsx)(Z,{code:s??"",lang:f})})]})}function J(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function V({sessionId:e,active:t}){let[s,n]=(0,i.useState)([]),[l,r]=(0,i.useState)(!0),[c,o]=(0,i.useState)(null),[d,x]=(0,i.useState)(!1),[u,m]=(0,i.useState)(""),[h,p]=(0,i.useState)(null),[f,v]=(0,i.useState)(new Set),g=(0,i.useRef)(!0),b=(0,i.useCallback)(async()=>{try{r(!0);let t=await fetch(`/api/sessions/${encodeURIComponent(e)}/files`,{cache:"no-store"});if(!t.ok)throw Error(`Failed to load files (${t.status})`);let s=await t.json();if(!g.current)return;n(s.files??[]),x(!!s.truncated),o(null)}catch(e){if(!g.current)return;o(e instanceof Error?e.message:"Failed to load files")}finally{g.current&&r(!1)}},[e]);(0,i.useEffect)(()=>(g.current=!0,t&&b(),()=>{g.current=!1}),[t,b]);let j=(0,i.useMemo)(()=>(function(e){let t={name:"",path:"",children:[],isDir:!0};for(let s of e){let e=s.split("/"),a=t,n="";for(let t=0;t<e.length;t++){let s=e[t];n=n?`${n}/${s}`:s;let i=t===e.length-1,l=a.children.find(e=>e.name===s);l||(l={name:s,path:n,children:[],isDir:!i},a.children.push(l)),a=l}}return function e(t){for(let s of(t.sort((e,t)=>e.isDir!==t.isDir?e.isDir?-1:1:e.name.localeCompare(t.name,void 0,{sensitivity:"base"})),t))s.children.length>0&&e(s.children);return t}(t.children)})(s),[s]),w=(0,i.useMemo)(()=>(function(e,t){if(!t)return e;let s=t.toLowerCase();return function e(t){let a=[];for(let n of t)(function e(t){return!!(t.name.toLowerCase().includes(s)||t.path.toLowerCase().includes(s))||t.children.some(e)})(n)&&(n.isDir?a.push({...n,children:e(n.children)}):a.push(n));return a}(e)})(j,u.trim()),[j,u]);(0,i.useEffect)(()=>{if(u.trim()){let e=new Set;!function t(s){for(let a of s)a.isDir&&(e.add(a.path),t(a.children))}(w),v(e)}},[w,u]);let k=(0,i.useCallback)(e=>{v(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),N=(0,i.useCallback)(e=>{p(e)},[]),y=(0,i.useCallback)(()=>{p(null)},[]);if(l&&0===s.length)return(0,a.jsxs)("div",{className:"flex h-full items-center justify-center gap-2 text-[12px] text-[var(--vk-text-muted)]",children:[(0,a.jsx)(A.A,{className:"h-4 w-4 animate-spin"}),"Loading workspace files…"]});if(c)return(0,a.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-4 text-center",children:[(0,a.jsx)("p",{className:"text-[12px] text-red-400",children:c}),(0,a.jsx)("button",{type:"button",onClick:()=>void b(),className:"text-[11px] text-[var(--vk-text-muted)] underline hover:text-[var(--vk-text-normal)]",children:"Retry"})]});let S=h?(0,a.jsxs)("div",{className:"flex h-full min-h-0 min-w-0 flex-col lg:hidden",children:[(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-white/8 px-2 py-2",children:[(0,a.jsx)("button",{type:"button",onClick:y,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-[var(--vk-text-muted)] hover:bg-white/6","aria-label":"Back to file list",children:(0,a.jsx)(I.A,{className:"h-4 w-4"})}),(0,a.jsx)($.A,{className:"h-3.5 w-3.5 shrink-0 text-[var(--vk-text-muted)]"}),(0,a.jsx)("span",{className:"truncate font-mono text-[11px] text-[var(--vk-text-strong)]",children:h})]}),(0,a.jsx)("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:(0,a.jsx)(G,{sessionId:e,filePath:h})})]}):null;return(0,a.jsxs)("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto overscroll-contain lg:overflow-hidden",children:[S,(0,a.jsxs)("div",{className:`flex shrink-0 items-center gap-2 border-b border-white/8 px-2 py-1.5 ${h?"hidden lg:flex":""}`,children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 rounded-md bg-white/4 px-2 py-1.5",children:[(0,a.jsx)(E.A,{className:"h-3.5 w-3.5 shrink-0 text-[var(--vk-text-muted)]"}),(0,a.jsx)("input",{type:"text",value:u,onChange:e=>m(e.target.value),placeholder:"Search files…",className:"min-w-0 flex-1 bg-transparent text-[12px] text-[var(--vk-text-normal)] outline-none placeholder:text-[var(--vk-text-muted)]"})]}),(0,a.jsx)("button",{type:"button",onClick:()=>void b(),disabled:l,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-[var(--vk-text-muted)] hover:bg-white/6 disabled:opacity-50","aria-label":"Refresh files",children:(0,a.jsx)(_.A,{className:`h-3.5 w-3.5 ${l?"animate-spin":""}`})})]}),d?(0,a.jsx)("div",{className:`shrink-0 border-b border-amber-500/20 bg-amber-500/8 px-3 py-1.5 text-[11px] text-amber-300 ${h?"hidden lg:block":""}`,children:"File list truncated (4000 file limit)"}):null,(0,a.jsxs)("div",{className:`min-h-0 flex-1 lg:flex lg:flex-row ${h?"hidden lg:flex":"flex flex-col"}`,children:[(0,a.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain py-1 lg:max-w-[320px] lg:border-r lg:border-white/8",children:0===w.length?(0,a.jsx)("div",{className:"px-3 py-6 text-center text-[12px] text-[var(--vk-text-muted)]",children:u?"No files match your search.":"No files in workspace."}):w.map(e=>(0,a.jsx)(U,{node:e,depth:0,selectedPath:h,expandedDirs:f,onToggleDir:k,onSelectFile:N},e.path))}),(0,a.jsx)("div",{className:"hidden min-h-0 min-w-0 flex-1 lg:block",children:h?(0,a.jsxs)("div",{className:"flex h-full min-h-0 min-w-0 flex-col",children:[(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-white/8 px-3 py-2",children:[(0,a.jsx)($.A,{className:"h-3.5 w-3.5 shrink-0 text-[var(--vk-text-muted)]"}),(0,a.jsx)("span",{className:"truncate font-mono text-[11px] text-[var(--vk-text-strong)]",children:h})]}),(0,a.jsx)("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:(0,a.jsx)(G,{sessionId:e,filePath:h})})]}):(0,a.jsx)("div",{className:"flex h-full items-center justify-center text-[12px] text-[var(--vk-text-muted)]",children:"Select a file to view its contents"})})]})]})}function H({session:e,sessionId:t,active:s}){let[n,l]=(0,i.useState)("changes"),r=(0,i.useMemo)(()=>P(e,"task")??P(e,"prompt")??("string"==typeof e.task?e.task:"")??("string"==typeof e.prompt?e.prompt:""),[e]),c=(0,i.useMemo)(()=>P(e,"agent")??("string"==typeof e.agent?e.agent:""),[e]),o=(0,i.useMemo)(()=>(function(e,t){if(!e||!t)return"";let s=new Date(e).getTime(),a=new Date(t).getTime();if(!Number.isFinite(s)||!Number.isFinite(a)||a<s)return"";let n=Math.floor((a-s)/6e4);if(n<1)return"<1m";if(n<60)return`${n}m`;let i=Math.floor(n/60);return`${i}h ${n%60}m`})(P(e,"startedAt")??e.startedAt,P(e,"finishedAt")??e.finishedAt),[e]),d=(0,i.useMemo)(()=>(function(e){if("number"==typeof e.cost)return e.cost;let t=e.metadata.cost;if("string"!=typeof t)return 0;try{let e=JSON.parse(t),s="number"==typeof e.estimatedCostUsd?e.estimatedCostUsd:0,a="number"==typeof e.totalUSD?e.totalUSD:0;return s??a}catch{return 0}})(e),[e]),x=(0,i.useMemo)(()=>T(P(e,"queuePosition")),[e]),u=(0,i.useMemo)(()=>T(P(e,"queueDepth")),[e]),m=(0,i.useMemo)(()=>P(e,"recoveryState")??"",[e]),h=(0,i.useMemo)(()=>"queued"===e.status?x?`Waiting in queue at position ${x}${u?` of ${u}`:""}.`:"Waiting in the launch queue.":"requeued_after_restart"===m?"Session recovered after backend restart and requeued.":"reattach_pending"===m?"Recovering terminal runtime after backend restart.":"detached_runtime"===m?"Backend restarted while agent may still be running.":"resume_required"===m?"Session recovered after restart. Send a message to resume.":"",[u,x,m,e.status]);return(0,a.jsxs)("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto overscroll-contain lg:overflow-hidden",children:[h?(0,a.jsx)("div",{className:"shrink-0 border-b border-amber-500/20 bg-amber-500/8 px-3 py-2",children:(0,a.jsx)("p",{className:"text-[12px] leading-snug text-amber-300",children:h})}):null,r?(0,a.jsx)("div",{className:"shrink-0 border-b border-white/8 px-3 py-2.5",children:(0,a.jsx)("p",{className:"line-clamp-3 whitespace-pre-wrap text-[13px] leading-relaxed text-[var(--vk-text-normal)]",children:r})}):null,(0,a.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-x-4 gap-y-1 border-b border-white/8 px-3 py-2 text-[11px] text-[var(--vk-text-muted)]",children:[c?(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(L.N,{seed:{label:c},className:"h-4 w-4"}),(0,a.jsx)("span",{children:c})]}):null,e.branch?(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)(F.A,{className:"h-3 w-3 shrink-0"}),(0,a.jsx)(q,{text:e.branch})]}):null,o?(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)(M.A,{className:"h-3 w-3 shrink-0"}),(0,a.jsx)("span",{children:o})]}):null,d>0?(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)(R.A,{className:"h-3 w-3 shrink-0"}),(0,a.jsxs)("span",{children:["$",d.toFixed(3)]})]}):null]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-0 border-b border-white/8 px-2",children:[(0,a.jsx)("button",{type:"button",onClick:()=>l("changes"),className:`px-3 py-2 text-[12px] font-medium transition-colors ${"changes"===n?"border-b-2 border-[var(--vk-orange)] text-[var(--vk-text-strong)]":"border-b-2 border-transparent text-[var(--vk-text-muted)] hover:text-[var(--vk-text-normal)]"}`,children:"Changes"}),(0,a.jsx)("button",{type:"button",onClick:()=>l("files"),className:`px-3 py-2 text-[12px] font-medium transition-colors ${"files"===n?"border-b-2 border-[var(--vk-orange)] text-[var(--vk-text-strong)]":"border-b-2 border-transparent text-[var(--vk-text-muted)] hover:text-[var(--vk-text-normal)]"}`,children:"Files"})]}),(0,a.jsx)("div",{className:"min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain",children:"changes"===n?(0,a.jsx)(D,{sessionId:t,active:s},t):(0,a.jsx)(V,{sessionId:t,active:s&&"files"===n})})]})}var K=s(40448),Q=s(50549),X=s(26083),Y=s(31404),ee=s(59207);let et="block h-5 w-5 shrink-0 object-contain",es=[{id:"finder",label:"Finder"},{id:"cursor",label:"Cursor"},{id:"antigravity",label:"Antigravity"},{id:"windsurf",label:"Windsurf"},{id:"zed",label:"Zed"},{id:"xcode",label:"Xcode"},{id:"vscode",label:"VS Code"},{id:"vscode-insiders",label:"VS Code Insiders"},{id:"intellij-idea",label:"IntelliJ IDEA"},{id:"custom",label:"Custom"}],ea={finder:{kind:"image",imageSrc:"/icons/ide/finder.svg",className:et},vscode:{kind:"image",imageSrc:"/icons/ide/vscode-dark.svg",className:et},"vscode-insiders":{kind:"image",imageSrc:"/icons/ide/vscode-insiders.svg",className:et},cursor:{kind:"image",imageSrc:"/icons/ide/cursor-dark.svg",className:et},windsurf:{kind:"image",imageSrc:"/icons/ide/windsurf-dark.svg",className:et},"intellij-idea":{kind:"image",imageSrc:"/icons/ide/intellij.svg",className:et},zed:{kind:"image",imageSrc:"/icons/ide/zed-dark.svg",className:et},xcode:{kind:"image",imageSrc:"/icons/ide/xcode.svg",className:et},antigravity:{kind:"image",imageSrc:"/icons/ide/antigravity-dark.svg",className:et},custom:{kind:"icon",className:`${et} text-[var(--vk-text-muted)]`}};function en({editorId:e,label:t}){let s=ea[e];return s?"icon"===s.kind?(0,a.jsx)(Q.A,{className:s?.className??`${et} text-[var(--vk-text-muted)]`}):(0,a.jsx)("img",{src:s.imageSrc,alt:`${t} logo`,className:s.className}):(0,a.jsx)(Q.A,{className:`${et} text-[var(--vk-text-muted)]`})}function ei({projectId:e,bridgeId:t}){let{preferences:s}=(0,ee.g)(t),[n,l]=(0,i.useState)(null),r=(0,i.useMemo)(()=>{var e;return e=s?.ide??"vscode",es.find(t=>t.id===e)??{id:e,label:e}},[s?.ide]);async function c(s){if(e&&!n){l(s);try{let a=await fetch((0,Y.S)(`/api/projects/${encodeURIComponent(e)}/open`,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ide:s})}),n=await a.json().catch(()=>null);if(!a.ok)throw Error(n?.error??`Failed to open project (${a.status})`)}catch(e){window.alert(e instanceof Error?e.message:"Failed to open project")}finally{l(null)}}}return(0,a.jsxs)(K.bL,{children:[(0,a.jsx)(K.l9,{asChild:!0,children:(0,a.jsxs)("button",{type:"button",disabled:!e||null!==n,className:"inline-flex h-9 items-center gap-2 rounded-[6px] border border-[rgba(255,255,255,0.08)] bg-[rgba(255,255,255,0.03)] px-3 text-[13px] text-[var(--vk-text-normal)] transition hover:bg-[rgba(255,255,255,0.06)] disabled:cursor-not-allowed disabled:opacity-60","aria-label":"Open project in code editor",title:e?`Open project in ${r.label}`:"No project selected",children:[n?(0,a.jsx)(A.A,{className:"h-4 w-4 animate-spin text-[var(--vk-text-muted)]"}):(0,a.jsx)(X.A,{className:"h-4 w-4 text-[var(--vk-text-muted)]"}),(0,a.jsx)("span",{className:"hidden font-medium sm:inline",children:"Open"}),(0,a.jsx)(N.A,{className:"h-3.5 w-3.5 text-[var(--vk-text-muted)]"})]})}),(0,a.jsx)(K.ZL,{children:(0,a.jsx)(K.UC,{align:"end",sideOffset:8,className:"z-50 min-w-[240px] rounded-[8px] border border-[rgba(255,255,255,0.08)] bg-[#1c1a19] p-2 shadow-[0_18px_50px_rgba(0,0,0,0.45)]",children:es.map(e=>(0,a.jsxs)(K.q7,{onSelect:()=>void c(e.id),className:"flex min-h-[44px] cursor-default items-center gap-3 rounded-[6px] px-3 py-2 text-[14px] text-[#f3efea] outline-none transition hover:bg-[rgba(255,255,255,0.06)] focus:bg-[rgba(255,255,255,0.06)]",children:[(0,a.jsx)(en,{editorId:e.id,label:e.label}),(0,a.jsx)("span",{className:"flex-1",children:e.label}),r.id===e.id?(0,a.jsx)(w.A,{className:"h-4 w-4 text-[var(--vk-text-muted)]"}):null]},e.id))})})]})}let el=(0,n.default)(()=>s.e(3954).then(s.bind(s,83954)).then(e=>e.SessionTerminal),{loadableGenerated:{webpack:()=>[83954]},loading:()=>(0,a.jsx)("div",{className:"flex h-full min-h-[240px] items-center justify-center text-[13px] text-[var(--vk-text-muted)]",children:"Loading terminal..."})}),er=(0,n.default)(()=>Promise.all([s.e(307),s.e(4089)]).then(s.bind(s,54089)).then(e=>e.SessionPreview),{loadableGenerated:{webpack:()=>[54089]},loading:()=>(0,a.jsx)("div",{className:"flex h-full min-h-[240px] items-center justify-center text-[13px] text-[var(--vk-text-muted)]",children:"Loading preview..."})}),ec=(0,n.default)(()=>s.e(1874).then(s.bind(s,81874)).then(e=>e.SessionSkills),{loadableGenerated:{webpack:()=>[81874]},loading:()=>(0,a.jsx)("div",{className:"flex h-full min-h-[240px] items-center justify-center text-[13px] text-[var(--vk-text-muted)]",children:"Loading skills..."})});function eo(e){return"overview"===e||"terminal"===e||"preview"===e||"skills"===e?e:"terminal"}function ed({sessionId:e,initialSession:t=null,bridgeId:s=null,immersiveMobileMode:n=!1,active:u=!0,onOpenSidebar:m}){let w=(0,l.usePathname)(),k=(0,l.useRouter)(),N=(0,l.useSearchParams)(),{session:y,loading:S,error:C}=(0,j.w)(e,t,{enabled:u,bridgeId:s}),$=(0,i.useRef)(0),A=(0,i.useRef)(!1),[I,E]=(0,i.useState)(null),_=(0,i.useMemo)(()=>eo(N.get("tab")),[N]),F=(0,i.useCallback)(e=>{let t=eo(e),s=new URLSearchParams(N.toString());"terminal"===t?s.delete("tab"):s.set("tab",t);let a=s.toString(),n=a.length>0?`${w}?${a}`:w;k.replace(n,{scroll:!1})},[w,k,N]),M=(0,i.useCallback)(e=>{$.current+=1,E({nonce:$.current,...e})},[]);(0,i.useEffect)(()=>{A.current=!1,$.current=0,E(null)},[e]);let R=(0,i.useCallback)(e=>{e&&u&&"terminal"===_&&!A.current&&(A.current=!0,F("preview"))},[u,_,F]);if(S)return(0,a.jsx)("div",{className:"flex h-full items-center justify-center p-6",children:(0,a.jsx)(g.Zp,{className:"w-full max-w-md",children:(0,a.jsx)(g.Wu,{className:"py-7 text-center text-[13px] text-[var(--text-muted)]",children:"Loading session workspace..."})})});if(C)return(0,a.jsx)("div",{className:"flex h-full items-center justify-center p-6",children:(0,a.jsx)(g.Zp,{className:"w-full max-w-md border-[color:color-mix(in_srgb,var(--status-error)_45%,transparent)]",children:(0,a.jsx)(g.Wu,{className:"py-7 text-center text-[13px] text-[var(--status-error)]",children:C})})});if(!y)return(0,a.jsx)("div",{className:"flex h-full items-center justify-center p-6",children:(0,a.jsx)(g.Zp,{className:"w-full max-w-md",children:(0,a.jsx)(g.Wu,{className:"py-7 text-center text-[13px] text-[var(--text-muted)]",children:"Session not found"})})});let L="string"==typeof y.status?y.status:"unknown",D=function(e){switch(e){case"needs_input":return"needs input";case"working":return"working";case"running":return"running";case"spawning":return"spawning";case"queued":return"queued";default:return e.replace(/[_-]+/g," ")}}(L),q=function(e){switch(e){case"working":case"running":return"bg-amber-400";case"needs_input":return"bg-blue-400";case"spawning":case"queued":default:return"bg-gray-400";case"done":return"bg-emerald-400";case"errored":return"bg-red-400";case"stuck":return"bg-orange-500";case"terminated":case"killed":return"bg-gray-500"}}(L),P="working"===L||"running"===L||"spawning"===L||"queued"===L||"needs_input"===L,T="queued"!==L&&"spawning"!==L,U=u&&n&&"terminal"===_,O=u&&"preview"===_,z="min-h-[38px] gap-1.5 px-2.5 text-[12px] sm:min-h-0 sm:px-3",W=(0,a.jsxs)(p,{className:"flex w-full overflow-x-auto sm:w-fit sm:inline-flex",children:[(0,a.jsxs)(f,{value:"overview",className:z,children:[(0,a.jsx)(r.A,{className:"h-3.5 w-3.5"}),"Overview"]}),(0,a.jsxs)(f,{value:"terminal",className:z,children:[(0,a.jsx)(c.A,{className:"h-3.5 w-3.5"}),"Terminal"]}),(0,a.jsxs)(f,{value:"preview",className:z,children:[(0,a.jsx)(o.A,{className:"h-3.5 w-3.5"}),"Preview"]}),(0,a.jsxs)(f,{value:"skills",className:z,children:[(0,a.jsx)(d.A,{className:"h-3.5 w-3.5"}),"Skills"]})]});return(0,a.jsx)("div",{className:`flex h-full min-h-0 min-w-0 w-full flex-col ${U?"overflow-hidden bg-[#060404]":"overflow-y-auto overscroll-contain lg:overflow-hidden"}`,children:(0,a.jsxs)(h,{value:_,onValueChange:F,className:U?"flex min-h-0 min-w-0 w-full flex-1 flex-col gap-0 p-0":"flex min-h-0 min-w-0 w-full flex-1 flex-col gap-1 p-1 lg:gap-2 lg:p-3",children:[U?(0,a.jsxs)("div",{className:"flex shrink-0 flex-col border-b border-white/10 bg-[#0d0908]",children:[(0,a.jsxs)("div",{className:"flex h-10 items-center gap-2 px-2",children:[m?(0,a.jsx)(b.$,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 text-[#8e847d] hover:text-[#c9c0b7]",onClick:m,"aria-label":"Open workspace panel",children:(0,a.jsx)(x.A,{className:"h-4 w-4"})}):null,(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[(0,a.jsx)("span",{className:`inline-block h-2 w-2 shrink-0 rounded-full ${q}${P?" animate-pulse":""}`}),(0,a.jsx)("span",{className:"text-[12px] font-medium text-[#efe8e1]",children:D}),(0,a.jsxs)("span",{className:"font-mono text-[10px] text-[#8e847d]",children:["\xb7 ",e.slice(0,7)]})]}),T?(0,a.jsx)(ei,{projectId:y.projectId,bridgeId:y.bridgeId??null}):null]}),(0,a.jsx)("div",{className:"px-1.5 pb-1.5",children:W})]}):(0,a.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1.5 sm:flex-nowrap",children:[W,(0,a.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 sm:ml-auto sm:w-auto sm:justify-end",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:`inline-block h-2 w-2 shrink-0 rounded-full ${q}${P?" animate-pulse":""}`}),(0,a.jsx)("span",{className:"text-[11px] text-[var(--vk-text-muted)]",children:D}),(0,a.jsxs)("span",{className:"hidden font-mono text-[10px] text-[var(--vk-text-muted)] sm:inline",children:["\xb7 ",e.slice(0,7)]})]}),T?(0,a.jsx)(ei,{projectId:y.projectId,bridgeId:y.bridgeId??null}):null]})]}),(0,a.jsxs)("div",{className:"relative min-h-0 min-w-0 flex-1 overflow-hidden",children:[(0,a.jsx)(v,{value:"overview",className:"min-h-0 h-full min-w-0 w-full overflow-hidden focus-visible:outline-none [&[hidden]]:block data-[state=inactive]:pointer-events-none data-[state=inactive]:absolute data-[state=inactive]:inset-0 data-[state=inactive]:invisible data-[state=inactive]:opacity-0",children:(0,a.jsx)(H,{session:y,sessionId:e,active:u&&"overview"===_})}),(0,a.jsx)(v,{value:"terminal",forceMount:!0,className:U?"flex min-h-0 h-full min-w-0 w-full flex-col overflow-hidden bg-[#060404] focus-visible:outline-none [&[hidden]]:block data-[state=inactive]:pointer-events-none data-[state=inactive]:absolute data-[state=inactive]:inset-0 data-[state=inactive]:invisible data-[state=inactive]:opacity-0":"flex min-h-0 h-full min-w-0 flex-col w-full overflow-hidden bg-transparent focus-visible:outline-none [&[hidden]]:block data-[state=inactive]:pointer-events-none data-[state=inactive]:absolute data-[state=inactive]:inset-0 data-[state=inactive]:invisible data-[state=inactive]:opacity-0",children:(0,a.jsx)(el,{sessionId:e,projectId:y.projectId,bridgeId:y.bridgeId??null,sessionState:L,runtimeMode:y.metadata.runtimeMode?.trim()??null,pendingInsert:I,immersiveMobileMode:U})}),(0,a.jsx)(v,{value:"preview",className:"min-h-0 h-full min-w-0 w-full overflow-hidden focus-visible:outline-none [&[hidden]]:block data-[state=inactive]:pointer-events-none data-[state=inactive]:absolute data-[state=inactive]:inset-0 data-[state=inactive]:invisible data-[state=inactive]:opacity-0",children:O?(0,a.jsx)(er,{sessionId:e,active:O,onQueueTerminalInsert:M,onConnectionChange:R},e):null}),(0,a.jsx)(v,{value:"skills",className:"min-h-0 h-full min-w-0 w-full overflow-hidden focus-visible:outline-none [&[hidden]]:block data-[state=inactive]:pointer-events-none data-[state=inactive]:absolute data-[state=inactive]:inset-0 data-[state=inactive]:invisible data-[state=inactive]:opacity-0",children:(0,a.jsx)(ec,{session:y,sessionId:e,active:u&&"skills"===_})})]})]},e)})}},59207:(e,t,s)=>{s.d(t,{g:()=>l});var a=s(7620),n=s(31404);function i(e){return!e||"object"!=typeof e||Array.isArray(e)?{}:{...e}}function l(e,t){let s=t?.enabled??!0,[l,r]=(0,a.useState)(null),[c,o]=(0,a.useState)(s),[d,x]=(0,a.useState)(null),u=(0,a.useCallback)(async()=>{if(!s){r(null),x(null),o(!1);return}try{var t;let s,a,l,c=await fetch((0,n.S)("/api/preferences",e)),o=await c.json().catch(()=>null);if(!c.ok)throw Error(o?.error??o?.reason??`Failed to load preferences: ${c.status}`);r((t=o?.preferences,s=i(t),l=(a=i(s.notifications)).soundFile,{onboardingAcknowledged:!0===s.onboardingAcknowledged,codingAgent:"string"==typeof s.codingAgent&&s.codingAgent.trim().length>0?s.codingAgent.trim():"claude-code",ide:"string"==typeof s.ide&&s.ide.trim().length>0?s.ide.trim():"vscode",markdownEditor:"string"==typeof s.markdownEditor&&s.markdownEditor.trim().length>0?s.markdownEditor.trim():"obsidian",markdownEditorPath:"string"==typeof s.markdownEditorPath?s.markdownEditorPath.trim():"",notifications:{soundEnabled:!1!==a.soundEnabled,soundFile:null===l?null:"string"==typeof l&&l.trim().length>0?l.trim():"abstract-sound-4"}})),x(null)}catch(e){r(null),x(e instanceof Error?e.message:"Failed to load preferences")}finally{o(!1)}},[e,s]);return(0,a.useEffect)(()=>{s&&u()},[s,u]),{preferences:s?l:null,loading:!!s&&c,error:s?d:null,refresh:u}}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3954],{14796:(e,t,n)=>{n.d(t,{A:()=>l});let l=(0,n(13454).A)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},14810:(e,t,n)=>{n.d(t,{G:()=>r,x:()=>l});let l=new Set(["queued","spawning","running","working","needs_input","stuck"]),r=new Set(["done","needs_input","stuck","errored","terminated","killed"])},82797:(e,t,n)=>{n.d(t,{A:()=>l});let l=(0,n(13454).A)("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])},83954:(e,t,n)=>{n.r(t),n.d(t,{SessionTerminal:()=>k});var l=n(54568),r=n(26083),a=n(58299),s=n(60527),i=n(14796),o=n(36645),c=n(82797),d=n(7620),u=n(76081);let m=(0,n(42925).default)(()=>Promise.all([n.e(4887),n.e(5134),n.e(1225)]).then(n.bind(n,41225)).then(e=>e.RemoteSessionTerminal),{loadableGenerated:{webpack:()=>[41225]},ssr:!1});var h=n(31404),p=n(14810),f=n(63680);function x(e){return"127.0.0.1"===e||"localhost"===e||"::1"===e}function b(e){return e.length>1&&e.endsWith("/")?e.replace(/\/+$/,""):e}async function w(e,t){let n=await fetch((0,h.S)(`/api/sessions/${encodeURIComponent(e)}/terminal/token`,t?.bridgeId),{cache:"no-store",signal:t?.signal}),l=await n.json().catch(()=>null),r="string"==typeof l?.ttydHttpUrl&&l.ttydHttpUrl.trim().length>0?l.ttydHttpUrl.trim():null,a="string"==typeof l?.ttydWsUrl&&l.ttydWsUrl.trim().length>0?l.ttydWsUrl.trim():null;if(401===n.status||403===n.status)return{interactive:!1,ttydHttpUrl:null,ttydWsUrl:null,reason:l?.error??"Terminal access denied"};if(!n.ok)throw Error(l?.error??`Failed to resolve terminal token: ${n.status}`);return{interactive:!0,ttydHttpUrl:r,ttydWsUrl:a}}async function g(e,t){let n=function(){let e=function(){if("u"<typeof document)return null;let e=document.querySelector('meta[name="conductor-backend-url"]'),t=e?.content?.trim();if(!t)return null;try{let e=window.location.origin,n=new URL(t,e);if("http:"!==n.protocol&&"https:"!==n.protocol)return null;{let e=new URL(window.location.origin);x(n.hostname)&&!x(e.hostname)&&(n.hostname=e.hostname,"https:"===e.protocol&&"http:"===n.protocol&&(n.protocol="https:"))}return n.toString()}catch{return null}}();if(e)return e;let t=f.env.NEXT_PUBLIC_CONDUCTOR_BACKEND_URL?.trim();if(t)return t;let{protocol:n,hostname:l,origin:r,port:a}=window.location;return"3000"===a||"4747"===a?`${n}//${l}:4749`:r}(),l=await w(e,t);if(!l.interactive)return{terminalUrl:null,interactive:!1,reason:l.reason};let r=function(e,t,n){let l=e??t;if(!l)return null;try{let e=new URL(l,n);return"ws:"===e.protocol&&(e.protocol="http:"),"wss:"===e.protocol&&(e.protocol="https:"),"/ws"===e.pathname?e.pathname="/":e.pathname.endsWith("/ws")&&(e.pathname=b(e.pathname.slice(0,-3))),e.pathname=b(e.pathname),e.hash="",e.toString()}catch{return null}}(l.ttydHttpUrl,l.ttydWsUrl,n);return r?{terminalUrl:r,interactive:!0,reason:null}:{terminalUrl:null,interactive:!1,reason:"Failed to resolve the ttyd terminal URL."}}let y=new Set(["archived","killed","terminated","restored"]);async function v(e,t,n){let l=await fetch((0,h.S)(`/api/sessions/${encodeURIComponent(e)}/keys`,n),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({keys:t})});if(!l.ok){let e=await l.json().catch(()=>null);throw Error(e?.error??`Failed to queue terminal input (${l.status})`)}}function j(e){try{let t=new URL(e,window.location.origin);return t.searchParams.delete("token"),t.hash="",t.toString()}catch{return e}}function N(e){let{sessionId:t,projectId:n,bridgeId:m,sessionState:f,runtimeMode:x,pendingInsert:b,immersiveMobileMode:w=!1}=e,N=(0,d.useRef)(null),k=(0,d.useRef)(0),S=(0,d.useRef)(0),U=(0,d.useMemo)(()=>f.trim().toLowerCase(),[f]),C=x?.trim().toLowerCase()??null,A="ttyd"===C,_=A?!y.has(U):p.x.has(U),E=!A&&!w&&p.G.has(U),[R,I]=(0,d.useState)(null),[T,$]=(0,d.useState)(_),[L,M]=(0,d.useState)(null),[O,z]=(0,d.useState)(!1),[F,W]=(0,d.useState)(0),[D,q]=(0,d.useState)(""),[H,P]=(0,d.useState)(!1),[G,B]=(0,d.useState)(null),[J,K]=(0,d.useState)(null),X=(0,d.useRef)(null);(0,d.useEffect)(()=>{X.current=R},[R]),(0,d.useEffect)(()=>{k.current=0,S.current=0,I(null),$(_),M(null),z(!1),W(0),q(""),P(!1),B(null),K(null)},[_,t]),(0,d.useEffect)(()=>{if(!_){$(!1),M(null);return}let e=!1,n=null,l=new AbortController;return $(!0),M(null),g(t,{signal:l.signal,bridgeId:m}).then(t=>{if(!e){if(S.current=0,t.interactive&&t.terminalUrl){var n,l;n=X.current,l=t.terminalUrl,n&&j(n)===j(l)||(z(!1),I(t.terminalUrl)),M(null);return}X.current||(I(null),z(!1)),M(t.reason??"Live ttyd terminal is unavailable.")}}).catch(t=>{if(e||t instanceof DOMException&&"AbortError"===t.name)return;let l=!!X.current;if(l||(I(null),z(!1)),M(t instanceof Error?t.message:"Failed to resolve ttyd terminal."),!l){let e=S.current,t=Math.min(4e3,500*2**e);S.current=Math.min(e+1,3),n=window.setTimeout(()=>{W(e=>e+1)},t)}}).finally(()=>{e||$(!1)}),()=>{e=!0,l.abort(),null!==n&&window.clearTimeout(n)}},[m,F,_,t]),(0,d.useEffect)(()=>{if(!b||b.nonce<=k.current)return;k.current=b.nonce;let e=b.inlineText.trim();if(0===e.length)return;let n=!1;return v(t,`${e} `,m).then(()=>{n||K(null)}).catch(e=>{n||K(e instanceof Error?e.message:"Failed to queue terminal input.")}),()=>{n=!0}},[m,b,t]);let Q=(0,d.useCallback)(async()=>{let e=D.trim();if(0!==e.length&&!H){P(!0),B(null);try{let n=await fetch((0,h.S)(`/api/sessions/${encodeURIComponent(t)}/actions`,m),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"send",message:e})});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error??`Failed to send message (${n.status})`)}q(""),N.current?.focus()}catch(e){B(e instanceof Error?e.message:"Failed to send message")}finally{P(!1)}}},[m,D,H,t]);(0,d.useEffect)(()=>{},[L,_,O,C,G,J,T,t,R,A]);let V=(0,d.useCallback)(()=>{M(null),S.current=0,W(e=>e+1)},[]),Y=_?"Connecting live terminal":E?"Session is waiting for input":"Live terminal is not active",Z=L??(_?"Reconnecting to the existing ttyd terminal.":A?"This ttyd terminal is no longer attached. It only closes after an explicit kill or archive.":E?"Send a follow-up below to relaunch the agent in a fresh ttyd terminal.":`Session status is \`${U}\`. Interactive ttyd terminals only run while the agent is active.`);return(0,l.jsxs)("div",{className:w?"group/terminal relative flex h-full min-h-0 min-w-0 w-full flex-1 flex-col overflow-hidden bg-[#060404]":"group/terminal relative flex h-full min-h-0 min-w-0 w-full flex-1 flex-col overflow-hidden rounded-none border-0 bg-[#060404] lg:rounded-[14px] lg:border lg:border-white/10 lg:shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]",children:[(0,l.jsxs)("div",{className:"absolute right-2 top-2 z-10 flex items-center gap-2 sm:right-3 sm:top-3",children:[R?(0,l.jsx)("a",{href:R,target:"_blank",rel:"noreferrer",className:"inline-flex h-9 w-9 items-center justify-center rounded-full border border-white/10 bg-[#141010]/92 text-[#c9c0b7] backdrop-blur-sm transition hover:bg-[#201818] sm:h-7 sm:w-7","aria-label":"Open ttyd terminal in a new tab",children:(0,l.jsx)(r.A,{className:"h-3.5 w-3.5"})}):null,(0,l.jsx)(u.$,{type:"button",size:"icon",variant:"ghost",className:"h-9 w-9 rounded-full border border-white/10 bg-[#141010]/92 text-[#c9c0b7] backdrop-blur-sm hover:bg-[#201818] sm:h-7 sm:w-7",onClick:V,"aria-label":"Reload ttyd terminal",children:T?(0,l.jsx)(a.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,l.jsx)(s.A,{className:"h-3.5 w-3.5"})})]}),(0,l.jsx)("div",{className:w?"min-h-0 min-w-0 flex-1 overflow-hidden px-0 pb-0 pt-0 w-full":"min-h-0 min-w-0 flex-1 overflow-hidden px-0.5 pb-0 pt-0.5 lg:px-1.5 lg:pb-1 lg:pt-3 w-full",children:_&&R?(0,l.jsxs)("div",{className:"relative h-full w-full overflow-hidden rounded-[10px] bg-[#060404]",children:[O?null:(0,l.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-[#060404]",children:(0,l.jsxs)("div",{className:"flex items-center gap-2 rounded-full border border-white/10 bg-[#141010]/92 px-3 py-2 text-[12px] text-[#c9c0b7] backdrop-blur-sm",children:[(0,l.jsx)(a.A,{className:"h-3.5 w-3.5 animate-spin"}),(0,l.jsx)("span",{children:"Loading ttyd terminal…"})]})}),(0,l.jsx)("iframe",{title:`ttyd terminal for ${t}`,src:R,className:"h-full w-full border-0 bg-[#060404]",allow:"clipboard-read; clipboard-write",loading:"eager",onLoad:()=>{z(!0),M(null)}})]}):(0,l.jsx)("div",{className:"flex h-full items-center justify-center p-4",children:(0,l.jsx)("div",{className:"max-w-lg rounded-[16px] border border-white/10 bg-[#141010]/92 p-5 text-[#efe8e1] shadow-[0_24px_48px_rgba(0,0,0,0.34)]",children:(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("div",{className:"mt-0.5 rounded-full border border-white/10 bg-[#201818] p-2 text-[#c9c0b7]",children:L?(0,l.jsx)(i.A,{className:"h-4 w-4"}):(0,l.jsx)(a.A,{className:`h-4 w-4 ${T?"animate-spin":""}`})}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsx)("div",{className:"text-[14px] font-medium",children:Y}),(0,l.jsx)("div",{className:"mt-1 text-[12px] leading-5 text-[#a79c94]",children:Z}),R?(0,l.jsx)("div",{className:"mt-3",children:(0,l.jsx)("a",{href:R,target:"_blank",rel:"noreferrer",className:"text-[12px] text-[#d7c6b7] underline underline-offset-4",children:"Open the ttyd terminal directly"})}):null]})]})})})}),!E&&J?(0,l.jsx)("div",{className:"absolute inset-x-0 bottom-0 z-10 border-t border-white/12 bg-[#161212] px-3 py-2 text-[11px] text-[#ffb39e] backdrop-blur-sm [padding-bottom:env(safe-area-inset-bottom)]",children:(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,l.jsx)(i.A,{className:"h-3 w-3 shrink-0"}),(0,l.jsx)("span",{className:"truncate",children:J}),(0,l.jsx)("button",{type:"button",className:"ml-auto shrink-0 text-[#8e847d] hover:text-[#c9c0b7]",onClick:()=>K(null),children:(0,l.jsx)(o.A,{className:"h-3 w-3"})})]})}):null,E?(0,l.jsxs)("div",{className:"absolute inset-x-0 bottom-0 z-10 border-t border-white/12 bg-[#161212] backdrop-blur-sm [padding-bottom:env(safe-area-inset-bottom)]",children:[J?(0,l.jsxs)("div",{className:"flex items-center gap-1.5 px-3 pt-1.5 text-[11px] text-[#ffb39e]",children:[(0,l.jsx)(i.A,{className:"h-3 w-3 shrink-0"}),(0,l.jsx)("span",{className:"truncate",children:J}),(0,l.jsx)("button",{type:"button",className:"ml-auto shrink-0 text-[#8e847d] hover:text-[#c9c0b7]",onClick:()=>K(null),children:(0,l.jsx)(o.A,{className:"h-3 w-3"})})]}):null,G?(0,l.jsxs)("div",{className:"flex items-center gap-1.5 px-3 pt-1.5 text-[11px] text-[#ff8f7a]",children:[(0,l.jsx)(i.A,{className:"h-3 w-3 shrink-0"}),(0,l.jsx)("span",{className:"truncate",children:G}),(0,l.jsx)("button",{type:"button",className:"ml-auto shrink-0 text-[#8e847d] hover:text-[#c9c0b7]",onClick:()=>B(null),children:(0,l.jsx)(o.A,{className:"h-3 w-3"})})]}):null,(0,l.jsxs)("form",{onSubmit:e=>{e.preventDefault(),Q()},className:"flex items-center gap-2 px-2 py-2 lg:px-3",children:[(0,l.jsx)("input",{ref:N,value:D,onChange:e=>q(e.target.value),placeholder:"Send a follow-up message…",disabled:H,className:"h-8 min-w-0 flex-1 rounded-md border border-white/10 bg-[#0c0808] px-2.5 text-[12px] text-[#efe8e1] outline-none placeholder:text-[#7d746e] focus:border-white/20 disabled:opacity-50",onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),e.currentTarget.blur())}}),(0,l.jsx)(u.$,{type:"submit",size:"icon",variant:"ghost",disabled:H||0===D.trim().length,className:"h-8 w-8 shrink-0 rounded-md border border-white/10 bg-[#0c0808] text-[#c9c0b7] hover:bg-[#201818] disabled:opacity-30","aria-label":"Send message",children:H?(0,l.jsx)(a.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,l.jsx)(c.A,{className:"h-3.5 w-3.5"})})]})]}):null]})}let k=(0,d.memo)(function(e){return e.bridgeId?.trim()?(0,l.jsx)(m,{...e}):(0,l.jsx)(N,{...e})},function(e,t){var n,l;return e.sessionId===t.sessionId&&e.projectId===t.projectId&&e.bridgeId===t.bridgeId&&e.sessionState===t.sessionState&&e.runtimeMode===t.runtimeMode&&e.immersiveMobileMode===t.immersiveMobileMode&&((n=e.pendingInsert)===(l=t.pendingInsert)||!!n&&!!l&&n.nonce===l.nonce&&n.inlineText===l.inlineText)})}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4443],{34443:(e,l,a)=>{a.r(l),a.d(l,{KeylessCreatorOrReader:()=>r});var s=a(79748),n=a(7620),t=a(85388);let r=e=>{var l;let{children:a}=e,r=(null==(l=(0,s.useSelectedLayoutSegments)()[0])?void 0:l.startsWith("/_not-found"))||!1,[i,c]=n.useActionState(t.a,null);return((0,n.useEffect)(()=>{r||n.startTransition(()=>{c()})},[r]),n.isValidElement(a))?n.cloneElement(a,{key:null==i?void 0:i.publishableKey,publishableKey:null==i?void 0:i.publishableKey,__internal_keyless_claimKeylessApplicationUrl:null==i?void 0:i.claimUrl,__internal_keyless_copyInstanceKeysUrl:null==i?void 0:i.apiKeysUrl,__internal_bypassMissingPublishableKey:!0}):a}},85388:(e,l,a)=>{a.d(l,{a:()=>n});var s=a(5974);let n=(0,s.createServerReference)("0010316a15562f2e235a0a63ec82b4eccf2e483bea",s.callServer,void 0,s.findSourceMapURL,"createOrReadKeylessAction")}}]);
@@ -1,4 +1,4 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7220],{2609:(e,t,r)=>{"use strict";r.d(t,{T5:()=>s.T5,hP:()=>n.hP,nO:()=>s.nO,yC:()=>o}),r(16744);var n=r(70590),s=r(87835);function o(e,t,r){let s=t.path||(null==r?void 0:r.path);return"path"===(t.routing||(null==r?void 0:r.routing)||"path")?s?{...r,...t,routing:"path"}:n.sb.throw((0,n.kd)(e)):t.path?n.sb.throw((0,n.s7)(e)):{...r,...t,path:void 0}}},5974:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={callServer:function(){return o.callServer},createServerReference:function(){return i.createServerReference},findSourceMapURL:function(){return a.findSourceMapURL}};for(var s in n)Object.defineProperty(t,s,{enumerable:!0,get:n[s]});let o=r(34273),a=r(16409),i=r(97102)},6974:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"RouterContext",{enumerable:!0,get:function(){return n}});let n=r(74468)._(r(7620)).default.createContext(null)},10594:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={default:function(){return h},handleClientScriptLoad:function(){return v},initScriptLoader:function(){return y}};for(var s in n)Object.defineProperty(t,s,{enumerable:!0,get:n[s]});let o=r(74468),a=r(99649),i=r(54568),l=o._(r(97509)),c=a._(r(7620)),u=r(2737),d=r(66161),p=r(71341),f=new Map,b=new Set,m=e=>{let{src:t,id:r,onLoad:n=()=>{},onReady:s=null,dangerouslySetInnerHTML:o,children:a="",strategy:i="afterInteractive",onError:c,stylesheets:u}=e,p=r||t;if(p&&b.has(p))return;if(f.has(t)){b.add(p),f.get(t).then(n,c);return}let m=()=>{s&&s(),b.add(p)},v=document.createElement("script"),y=new Promise((e,t)=>{v.addEventListener("load",function(t){e(),n&&n.call(this,t),m()}),v.addEventListener("error",function(e){t(e)})}).catch(function(e){c&&c(e)});o?(v.innerHTML=o.__html||"",m()):a?(v.textContent="string"==typeof a?a:Array.isArray(a)?a.join(""):"",m()):t&&(v.src=t,f.set(t,y)),(0,d.setAttributesFromProps)(v,e),"worker"===i&&v.setAttribute("type","text/partytown"),v.setAttribute("data-nscript",i),u&&(e=>{if(l.default.preinit)return e.forEach(e=>{l.default.preinit(e,{as:"style"})});{let t=document.head;e.forEach(e=>{let r=document.createElement("link");r.type="text/css",r.rel="stylesheet",r.href=e,t.appendChild(r)})}})(u),document.body.appendChild(v)};function v(e){let{strategy:t="afterInteractive"}=e;"lazyOnload"===t?window.addEventListener("load",()=>{(0,p.requestIdleCallback)(()=>m(e))}):m(e)}function y(e){e.forEach(v),[...document.querySelectorAll('[data-nscript="beforeInteractive"]'),...document.querySelectorAll('[data-nscript="beforePageRender"]')].forEach(e=>{let t=e.id||e.getAttribute("src");b.add(t)})}function _(e){let{id:t,src:r="",onLoad:n=()=>{},onReady:s=null,strategy:o="afterInteractive",onError:a,stylesheets:d,...f}=e,{updateScripts:v,scripts:y,getIsSsr:_,appDir:h,nonce:g}=(0,c.useContext)(u.HeadManagerContext);g=f.nonce||g;let w=(0,c.useRef)(!1);(0,c.useEffect)(()=>{let e=t||r;w.current||(s&&e&&b.has(e)&&s(),w.current=!0)},[s,t,r]);let E=(0,c.useRef)(!1);if((0,c.useEffect)(()=>{if(!E.current){if("afterInteractive"===o)m(e);else"lazyOnload"===o&&("complete"===document.readyState?(0,p.requestIdleCallback)(()=>m(e)):window.addEventListener("load",()=>{(0,p.requestIdleCallback)(()=>m(e))}));E.current=!0}},[e,o]),("beforeInteractive"===o||"worker"===o)&&(v?(y[o]=(y[o]||[]).concat([{id:t,src:r,onLoad:n,onReady:s,onError:a,...f,nonce:g}]),v(y)):_&&_()?b.add(t||r):_&&!_()&&m({...e,nonce:g})),h){if(d&&d.forEach(e=>{l.default.preinit(e,{as:"style"})}),"beforeInteractive"===o)if(!r)return f.dangerouslySetInnerHTML&&(f.children=f.dangerouslySetInnerHTML.__html,delete f.dangerouslySetInnerHTML),(0,i.jsx)("script",{nonce:g,dangerouslySetInnerHTML:{__html:`(self.__next_s=self.__next_s||[]).push(${JSON.stringify([0,{...f,id:t}])})`}});else return l.default.preload(r,f.integrity?{as:"script",integrity:f.integrity,nonce:g,crossOrigin:f.crossOrigin}:{as:"script",nonce:g,crossOrigin:f.crossOrigin}),(0,i.jsx)("script",{nonce:g,dangerouslySetInnerHTML:{__html:`(self.__next_s=self.__next_s||[]).push(${JSON.stringify([r,{...f,id:t}])})`}});"afterInteractive"===o&&r&&l.default.preload(r,f.integrity?{as:"script",integrity:f.integrity,nonce:g,crossOrigin:f.crossOrigin}:{as:"script",nonce:g,crossOrigin:f.crossOrigin})}return null}Object.defineProperty(_,"__nextScript",{value:!0});let h=_;("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},30679:(e,t,r)=>{"use strict";r.d(t,{PromisifiedAuthProvider:()=>l,d:()=>c});var n=r(30524),s=r(2609),o=r(45836),a=r(7620);let i=a.createContext(null);function l({authPromise:e,children:t}){return a.createElement(i.Provider,{value:e},t)}function c(e={}){let t=(0,o.useRouter)(),r=a.useContext(i),l=r;return(r&&"then"in r&&(l=a.use(r)),"u"<typeof window)?t?(0,n.As)(e):(0,s.hP)({...l,...e}):(0,n.As)({...l,...e})}},31008:e=>{e.exports={style:{fontFamily:"'JetBrains Mono', 'JetBrains Mono Fallback'",fontStyle:"normal"},className:"__className_6d24ac",variable:"__variable_6d24ac"}},36727:(e,t,r)=>{"use strict";r.r(t),r.d(t,{KeylessCookieSync:()=>a});var n=r(79748),s=r(7620),o=r(38036);function a(e){var t;let a=(null==(t=(0,n.useSelectedLayoutSegments)()[0])?void 0:t.startsWith("/_not-found"))||!1;return(0,s.useEffect)(()=>{o.I&&!a&&r.e(8191).then(r.bind(r,8191)).then(t=>t.syncKeylessConfigAction({...e,returnUrl:window.location.href}))},[a]),e.children}},37204:(e,t,r)=>{"use strict";r.r(t),r.d(t,{ClientClerkProvider:()=>U});var n=r(30524),s=r(20602);let o=new Set;var a=r(42925),i=r(79748),l=r(99321),c=r(7620);let u="u">typeof window?c.useLayoutEffect:c.useEffect,d=c.createContext(void 0);d.displayName="ClerkNextOptionsCtx";let p=()=>{let e=c.useContext(d);return null==e?void 0:e.value},f=e=>{let{children:t,options:r}=e;return c.createElement(d.Provider,{value:{value:r}},t)};var b=r(2609),m=r(10594),v=r.n(m);function y(e){let{publishableKey:t,clerkJSUrl:r,clerkJSVersion:s,clerkJSVariant:o,nonce:a}=p(),{domain:i,proxyUrl:l}=(0,n.ho)();if(!t)return null;let u={domain:i,proxyUrl:l,publishableKey:t,clerkJSUrl:r,clerkJSVersion:s,clerkJSVariant:o,nonce:a},d=(0,b.nO)(u),f="app"===e.router?"script":v();return c.createElement(f,{src:d,"data-clerk-js-script":!0,async:!0,defer:"pages"!==e.router&&void 0,crossOrigin:"anonymous",strategy:"pages"===e.router?"beforeInteractive":void 0,...(0,b.T5)(u)})}var _=r(38036),h=r(76975),g=r(67160),w=r(63680);let E=e=>{var t;return{...e,publishableKey:e.publishableKey||w.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY||"",clerkJSUrl:e.clerkJSUrl||w.env.NEXT_PUBLIC_CLERK_JS_URL,clerkJSVersion:e.clerkJSVersion||w.env.NEXT_PUBLIC_CLERK_JS_VERSION,proxyUrl:e.proxyUrl||w.env.NEXT_PUBLIC_CLERK_PROXY_URL||"",domain:e.domain||w.env.NEXT_PUBLIC_CLERK_DOMAIN||"",isSatellite:e.isSatellite||(0,h.zz)(w.env.NEXT_PUBLIC_CLERK_IS_SATELLITE),signInUrl:e.signInUrl||w.env.NEXT_PUBLIC_CLERK_SIGN_IN_URL||"",signUpUrl:e.signUpUrl||w.env.NEXT_PUBLIC_CLERK_SIGN_UP_URL||"",signInForceRedirectUrl:e.signInForceRedirectUrl||w.env.NEXT_PUBLIC_CLERK_SIGN_IN_FORCE_REDIRECT_URL||"",signUpForceRedirectUrl:e.signUpForceRedirectUrl||w.env.NEXT_PUBLIC_CLERK_SIGN_UP_FORCE_REDIRECT_URL||"",signInFallbackRedirectUrl:e.signInFallbackRedirectUrl||w.env.NEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URL||"",signUpFallbackRedirectUrl:e.signUpFallbackRedirectUrl||w.env.NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URL||"",afterSignInUrl:e.afterSignInUrl||w.env.NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL||"",afterSignUpUrl:e.afterSignUpUrl||w.env.NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL||"",newSubscriptionRedirectUrl:e.newSubscriptionRedirectUrl||w.env.NEXT_PUBLIC_CLERK_CHECKOUT_CONTINUE_URL||"",telemetry:null!=(t=e.telemetry)?t:{disabled:(0,h.zz)(w.env.NEXT_PUBLIC_CLERK_TELEMETRY_DISABLED),debug:(0,h.zz)(w.env.NEXT_PUBLIC_CLERK_TELEMETRY_DEBUG)},sdkMetadata:g.tm}};var x=r(3102),C=r(57042);let k=()=>{var e,t;let r=(0,n.ho)(),{pagesRouter:s}=(0,C.r)();return null==(t=r.telemetry)||t.record((0,x.YF)({router:s?"pages":"app",...(null==(e=null==globalThis?void 0:globalThis.next)?void 0:e.version)?{nextjsVersion:globalThis.next.version}:{}})),null};var L=r(43458),R=r(85033),T=r(34729);let I=e=>{var t;return null!=window.__clerk_internal_navigations||(window.__clerk_internal_navigations={}),null!=(t=window.__clerk_internal_navigations)[e]||(t[e]={}),window.__clerk_internal_navigations[e]},S=e=>{let{windowNav:t,routerNav:r,name:n}=e,s=(0,i.usePathname)(),[o,a]=(0,c.useTransition)();t&&(I(n).fun=(e,s)=>new Promise(o=>{var i,l;null!=(i=I(n)).promisesBuffer||(i.promisesBuffer=[]),null==(l=I(n).promisesBuffer)||l.push(o),a(()=>{var n,o,a;if((null==(n=null==s?void 0:s.__internal_metadata)?void 0:n.navigationType)==="internal")t((null!=(a=null==(o=window.next)?void 0:o.version)?a:"")<"14.1.0"?history.state:null,"",e);else r(e)})}));let l=()=>{var e;null==(e=I(n).promisesBuffer)||e.forEach(e=>e()),I(n).promisesBuffer=[]};return(0,c.useEffect)(()=>(l(),l),[]),(0,c.useEffect)(()=>{o||l()},[s,o]),(0,c.useCallback)((e,t)=>I(n).fun(e,t),[])},j=(0,a.default)(()=>r.e(4443).then(r.bind(r,34443)).then(e=>e.KeylessCreatorOrReader),{loadableGenerated:{webpack:()=>[34443]}}),P=e=>{let t,r;if(L.M0){var a,d;let e=`Clerk:
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7220],{2609:(e,t,r)=>{"use strict";r.d(t,{T5:()=>s.T5,hP:()=>n.hP,nO:()=>s.nO,yC:()=>o}),r(16744);var n=r(70590),s=r(87835);function o(e,t,r){let s=t.path||(null==r?void 0:r.path);return"path"===(t.routing||(null==r?void 0:r.routing)||"path")?s?{...r,...t,routing:"path"}:n.sb.throw((0,n.kd)(e)):t.path?n.sb.throw((0,n.s7)(e)):{...r,...t,path:void 0}}},5974:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={callServer:function(){return o.callServer},createServerReference:function(){return i.createServerReference},findSourceMapURL:function(){return a.findSourceMapURL}};for(var s in n)Object.defineProperty(t,s,{enumerable:!0,get:n[s]});let o=r(34273),a=r(16409),i=r(97102)},6974:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"RouterContext",{enumerable:!0,get:function(){return n}});let n=r(74468)._(r(7620)).default.createContext(null)},10594:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={default:function(){return h},handleClientScriptLoad:function(){return v},initScriptLoader:function(){return y}};for(var s in n)Object.defineProperty(t,s,{enumerable:!0,get:n[s]});let o=r(74468),a=r(99649),i=r(54568),l=o._(r(97509)),c=a._(r(7620)),u=r(2737),d=r(66161),p=r(71341),f=new Map,b=new Set,m=e=>{let{src:t,id:r,onLoad:n=()=>{},onReady:s=null,dangerouslySetInnerHTML:o,children:a="",strategy:i="afterInteractive",onError:c,stylesheets:u}=e,p=r||t;if(p&&b.has(p))return;if(f.has(t)){b.add(p),f.get(t).then(n,c);return}let m=()=>{s&&s(),b.add(p)},v=document.createElement("script"),y=new Promise((e,t)=>{v.addEventListener("load",function(t){e(),n&&n.call(this,t),m()}),v.addEventListener("error",function(e){t(e)})}).catch(function(e){c&&c(e)});o?(v.innerHTML=o.__html||"",m()):a?(v.textContent="string"==typeof a?a:Array.isArray(a)?a.join(""):"",m()):t&&(v.src=t,f.set(t,y)),(0,d.setAttributesFromProps)(v,e),"worker"===i&&v.setAttribute("type","text/partytown"),v.setAttribute("data-nscript",i),u&&(e=>{if(l.default.preinit)return e.forEach(e=>{l.default.preinit(e,{as:"style"})});{let t=document.head;e.forEach(e=>{let r=document.createElement("link");r.type="text/css",r.rel="stylesheet",r.href=e,t.appendChild(r)})}})(u),document.body.appendChild(v)};function v(e){let{strategy:t="afterInteractive"}=e;"lazyOnload"===t?window.addEventListener("load",()=>{(0,p.requestIdleCallback)(()=>m(e))}):m(e)}function y(e){e.forEach(v),[...document.querySelectorAll('[data-nscript="beforeInteractive"]'),...document.querySelectorAll('[data-nscript="beforePageRender"]')].forEach(e=>{let t=e.id||e.getAttribute("src");b.add(t)})}function _(e){let{id:t,src:r="",onLoad:n=()=>{},onReady:s=null,strategy:o="afterInteractive",onError:a,stylesheets:d,...f}=e,{updateScripts:v,scripts:y,getIsSsr:_,appDir:h,nonce:g}=(0,c.useContext)(u.HeadManagerContext);g=f.nonce||g;let w=(0,c.useRef)(!1);(0,c.useEffect)(()=>{let e=t||r;w.current||(s&&e&&b.has(e)&&s(),w.current=!0)},[s,t,r]);let E=(0,c.useRef)(!1);if((0,c.useEffect)(()=>{if(!E.current){if("afterInteractive"===o)m(e);else"lazyOnload"===o&&("complete"===document.readyState?(0,p.requestIdleCallback)(()=>m(e)):window.addEventListener("load",()=>{(0,p.requestIdleCallback)(()=>m(e))}));E.current=!0}},[e,o]),("beforeInteractive"===o||"worker"===o)&&(v?(y[o]=(y[o]||[]).concat([{id:t,src:r,onLoad:n,onReady:s,onError:a,...f,nonce:g}]),v(y)):_&&_()?b.add(t||r):_&&!_()&&m({...e,nonce:g})),h){if(d&&d.forEach(e=>{l.default.preinit(e,{as:"style"})}),"beforeInteractive"===o)if(!r)return f.dangerouslySetInnerHTML&&(f.children=f.dangerouslySetInnerHTML.__html,delete f.dangerouslySetInnerHTML),(0,i.jsx)("script",{nonce:g,dangerouslySetInnerHTML:{__html:`(self.__next_s=self.__next_s||[]).push(${JSON.stringify([0,{...f,id:t}])})`}});else return l.default.preload(r,f.integrity?{as:"script",integrity:f.integrity,nonce:g,crossOrigin:f.crossOrigin}:{as:"script",nonce:g,crossOrigin:f.crossOrigin}),(0,i.jsx)("script",{nonce:g,dangerouslySetInnerHTML:{__html:`(self.__next_s=self.__next_s||[]).push(${JSON.stringify([r,{...f,id:t}])})`}});"afterInteractive"===o&&r&&l.default.preload(r,f.integrity?{as:"script",integrity:f.integrity,nonce:g,crossOrigin:f.crossOrigin}:{as:"script",nonce:g,crossOrigin:f.crossOrigin})}return null}Object.defineProperty(_,"__nextScript",{value:!0});let h=_;("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},30679:(e,t,r)=>{"use strict";r.d(t,{PromisifiedAuthProvider:()=>l,d:()=>c});var n=r(30524),s=r(2609),o=r(45836),a=r(7620);let i=a.createContext(null);function l({authPromise:e,children:t}){return a.createElement(i.Provider,{value:e},t)}function c(e={}){let t=(0,o.useRouter)(),r=a.useContext(i),l=r;return(r&&"then"in r&&(l=a.use(r)),"u"<typeof window)?t?(0,n.As)(e):(0,s.hP)({...l,...e}):(0,n.As)({...l,...e})}},31008:e=>{e.exports={style:{fontFamily:"'JetBrains Mono', 'JetBrains Mono Fallback'",fontStyle:"normal"},className:"__className_6d24ac",variable:"__variable_6d24ac"}},36727:(e,t,r)=>{"use strict";r.r(t),r.d(t,{KeylessCookieSync:()=>a});var n=r(79748),s=r(7620),o=r(38036);function a(e){var t;let a=(null==(t=(0,n.useSelectedLayoutSegments)()[0])?void 0:t.startsWith("/_not-found"))||!1;return(0,s.useEffect)(()=>{o.I&&!a&&r.e(910).then(r.bind(r,90910)).then(t=>t.syncKeylessConfigAction({...e,returnUrl:window.location.href}))},[a]),e.children}},37204:(e,t,r)=>{"use strict";r.r(t),r.d(t,{ClientClerkProvider:()=>U});var n=r(30524),s=r(20602);let o=new Set;var a=r(42925),i=r(79748),l=r(99321),c=r(7620);let u="u">typeof window?c.useLayoutEffect:c.useEffect,d=c.createContext(void 0);d.displayName="ClerkNextOptionsCtx";let p=()=>{let e=c.useContext(d);return null==e?void 0:e.value},f=e=>{let{children:t,options:r}=e;return c.createElement(d.Provider,{value:{value:r}},t)};var b=r(2609),m=r(10594),v=r.n(m);function y(e){let{publishableKey:t,clerkJSUrl:r,clerkJSVersion:s,clerkJSVariant:o,nonce:a}=p(),{domain:i,proxyUrl:l}=(0,n.ho)();if(!t)return null;let u={domain:i,proxyUrl:l,publishableKey:t,clerkJSUrl:r,clerkJSVersion:s,clerkJSVariant:o,nonce:a},d=(0,b.nO)(u),f="app"===e.router?"script":v();return c.createElement(f,{src:d,"data-clerk-js-script":!0,async:!0,defer:"pages"!==e.router&&void 0,crossOrigin:"anonymous",strategy:"pages"===e.router?"beforeInteractive":void 0,...(0,b.T5)(u)})}var _=r(38036),h=r(76975),g=r(67160),w=r(63680);let E=e=>{var t;return{...e,publishableKey:e.publishableKey||w.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY||"",clerkJSUrl:e.clerkJSUrl||w.env.NEXT_PUBLIC_CLERK_JS_URL,clerkJSVersion:e.clerkJSVersion||w.env.NEXT_PUBLIC_CLERK_JS_VERSION,proxyUrl:e.proxyUrl||w.env.NEXT_PUBLIC_CLERK_PROXY_URL||"",domain:e.domain||w.env.NEXT_PUBLIC_CLERK_DOMAIN||"",isSatellite:e.isSatellite||(0,h.zz)(w.env.NEXT_PUBLIC_CLERK_IS_SATELLITE),signInUrl:e.signInUrl||w.env.NEXT_PUBLIC_CLERK_SIGN_IN_URL||"",signUpUrl:e.signUpUrl||w.env.NEXT_PUBLIC_CLERK_SIGN_UP_URL||"",signInForceRedirectUrl:e.signInForceRedirectUrl||w.env.NEXT_PUBLIC_CLERK_SIGN_IN_FORCE_REDIRECT_URL||"",signUpForceRedirectUrl:e.signUpForceRedirectUrl||w.env.NEXT_PUBLIC_CLERK_SIGN_UP_FORCE_REDIRECT_URL||"",signInFallbackRedirectUrl:e.signInFallbackRedirectUrl||w.env.NEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URL||"",signUpFallbackRedirectUrl:e.signUpFallbackRedirectUrl||w.env.NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URL||"",afterSignInUrl:e.afterSignInUrl||w.env.NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL||"",afterSignUpUrl:e.afterSignUpUrl||w.env.NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL||"",newSubscriptionRedirectUrl:e.newSubscriptionRedirectUrl||w.env.NEXT_PUBLIC_CLERK_CHECKOUT_CONTINUE_URL||"",telemetry:null!=(t=e.telemetry)?t:{disabled:(0,h.zz)(w.env.NEXT_PUBLIC_CLERK_TELEMETRY_DISABLED),debug:(0,h.zz)(w.env.NEXT_PUBLIC_CLERK_TELEMETRY_DEBUG)},sdkMetadata:g.tm}};var x=r(3102),C=r(57042);let k=()=>{var e,t;let r=(0,n.ho)(),{pagesRouter:s}=(0,C.r)();return null==(t=r.telemetry)||t.record((0,x.YF)({router:s?"pages":"app",...(null==(e=null==globalThis?void 0:globalThis.next)?void 0:e.version)?{nextjsVersion:globalThis.next.version}:{}})),null};var L=r(43458),R=r(40490),T=r(4430);let I=e=>{var t;return null!=window.__clerk_internal_navigations||(window.__clerk_internal_navigations={}),null!=(t=window.__clerk_internal_navigations)[e]||(t[e]={}),window.__clerk_internal_navigations[e]},S=e=>{let{windowNav:t,routerNav:r,name:n}=e,s=(0,i.usePathname)(),[o,a]=(0,c.useTransition)();t&&(I(n).fun=(e,s)=>new Promise(o=>{var i,l;null!=(i=I(n)).promisesBuffer||(i.promisesBuffer=[]),null==(l=I(n).promisesBuffer)||l.push(o),a(()=>{var n,o,a;if((null==(n=null==s?void 0:s.__internal_metadata)?void 0:n.navigationType)==="internal")t((null!=(a=null==(o=window.next)?void 0:o.version)?a:"")<"14.1.0"?history.state:null,"",e);else r(e)})}));let l=()=>{var e;null==(e=I(n).promisesBuffer)||e.forEach(e=>e()),I(n).promisesBuffer=[]};return(0,c.useEffect)(()=>(l(),l),[]),(0,c.useEffect)(()=>{o||l()},[s,o]),(0,c.useCallback)((e,t)=>I(n).fun(e,t),[])},j=(0,a.default)(()=>r.e(4443).then(r.bind(r,34443)).then(e=>e.KeylessCreatorOrReader),{loadableGenerated:{webpack:()=>[34443]}}),P=e=>{let t,r;if(L.M0){var a,d;let e=`Clerk:
2
2
  Your current Next.js version (${l.version}) will be deprecated in the next major release of "@clerk/nextjs". Please upgrade to next@14.1.0 or later.`;(0,s.M)()?(a=e,o.has(a)||(o.add(a),console.warn(a))):(d=`
3
3
  \x1b[43m----------
4
4
  ${e}
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[910],{85388:(e,c,a)=>{a.d(c,{a:()=>d});var r=a(5974);let d=(0,r.createServerReference)("0010316a15562f2e235a0a63ec82b4eccf2e483bea",r.callServer,void 0,r.findSourceMapURL,"createOrReadKeylessAction")},90910:(e,c,a)=>{a.r(c),a.d(c,{createOrReadKeylessAction:()=>r.a,deleteKeylessAction:()=>t,detectKeylessEnvDriftAction:()=>d.A,syncKeylessConfigAction:()=>n});var r=a(85388),d=a(40490),s=a(5974);let t=(0,s.createServerReference)("00e41d4ea541cfcb0d268dc5d867ae08edf6ccdecf",s.callServer,void 0,s.findSourceMapURL,"deleteKeylessAction"),n=(0,s.createServerReference)("404ad2930940cd25a1b8378ae8baa82456105dbd86",s.callServer,void 0,s.findSourceMapURL,"syncKeylessConfigAction")}}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1063],{26083:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(13454).A)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])},69863:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(13454).A)("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]])},69902:(e,t,s)=>{"use strict";s.d(t,{PublicPageShell:()=>n,PublicPanel:()=>d,PublicSection:()=>l});var a=s(54568),i=s(82175),r=s(46916);function n({children:e,className:t}){return(0,a.jsx)("main",{className:"min-h-screen bg-[var(--bg-canvas)] text-[var(--text-strong)]",children:(0,a.jsxs)("div",{className:"mx-auto flex min-h-screen w-full max-w-6xl flex-col px-6 py-8 sm:px-8 sm:py-10",children:[(0,a.jsxs)("header",{className:"flex items-center gap-3 border-b border-[var(--border-soft)] pb-6",children:[(0,a.jsx)("img",{src:"/icon.svg",alt:"Conductor icon",width:40,height:40,className:"h-10 w-10 rounded-[10px] border border-[var(--border-soft)] bg-[var(--bg-panel)] p-1.5"}),(0,a.jsx)(i.default,{src:"/brand/conductor-wordmark-dark.png",alt:"Conductor",width:320,height:62,priority:!0,className:"h-auto w-[168px] sm:w-[220px]"})]}),(0,a.jsx)("div",{className:(0,r.cn)("flex-1 py-10 sm:py-12",t),children:e})]})})}function d({children:e,className:t}){return(0,a.jsx)("section",{className:(0,r.cn)("surface-card rounded-[var(--radius-lg)] border border-[var(--border-soft)] bg-[var(--bg-panel)]",t),children:e})}function l({eyebrow:e,title:t,description:s,children:i,className:n}){return(0,a.jsxs)("div",{className:(0,r.cn)("space-y-4",n),children:[e?(0,a.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.24em] text-[var(--text-muted)]",children:e}):null,(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("h1",{className:"text-3xl font-semibold tracking-[-0.02em] text-[var(--text-strong)] sm:text-4xl",children:t}),s?(0,a.jsx)("p",{className:"max-w-2xl text-base leading-7 text-[var(--text-muted)] sm:text-lg",children:s}):null]}),i]})}},77522:(e,t,s)=>{"use strict";s.d(t,{C:()=>a,n:()=>i});let a=new Set(["archived","done","killed","errored","terminated","merged","cleanup"]);function i(e){return"merged"===e.status||"archived"===e.status||"killed"===e.status||"errored"===e.status||"cleanup"===e.status||"done"===e.status||"terminated"===e.status||e.pr&&("merged"===e.pr.state||"closed"===e.pr.state)?"done":"mergeable"===e.status||"approved"===e.status||e.pr?.mergeability.mergeable?"merge":"waiting_input"===e.activity||"blocked"===e.activity||"needs_input"===e.status||"stuck"===e.status?"respond":"queued"===e.status?"pending":"exited"===e.activity?"respond":"ci_failed"===e.status||"changes_requested"===e.status||e.pr&&("failing"===e.pr.ciStatus||"changes_requested"===e.pr.reviewDecision||!e.pr.mergeability.noConflicts)?"review":"review_pending"===e.status||e.pr&&!e.pr.isDraft&&("pending"===e.pr.reviewDecision||"none"===e.pr.reviewDecision)?"pending":"working"}},81677:(e,t,s)=>{"use strict";s.d(t,{default:()=>P});var a=s(54568),i=s(7620),r=s(65587),n=s.n(r),d=s(81167),l=s(60527),c=s(58299),o=s(69863),m=s(63322),x=s(59706),v=s(13454);let p=(0,v.A)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);var h=s(34041),u=s(87242),g=s(2099);let b=(0,v.A)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);var f=s(36645),j=s(15321),k=s(39702),w=s(69902),N=s(83954),y=s(76081),_=s(44522),C=s(11984),$=s(46916),A=s(26167),S=s(61369),I=s(31404),E=s(15115),R=s(77522);function z(e){return`${e.hostname} \xb7 ${e.os}/${e.arch}${(0,E.wj)(e.last_status?.version)}`}function M({children:e,className:t,id:s}){return(0,a.jsx)("section",{id:s,className:(0,$.cn)("rounded-[24px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] p-6","shadow-[0_18px_36px_rgba(0,0,0,0.2)]",t),children:e})}function U({children:e}){return(0,a.jsx)("p",{className:"text-[11px] font-semibold uppercase tracking-[0.24em] text-[var(--vk-text-muted)]",children:e})}function T({children:e}){return(0,a.jsx)("div",{className:"rounded-full border border-[var(--vk-border)] bg-[var(--vk-bg-main)] px-3 py-1.5 text-xs text-[var(--vk-text-muted)]",children:e})}function O({title:e,description:t,command:s,children:i,footer:r}){return(0,a.jsxs)("div",{className:"rounded-[20px] border border-[var(--vk-border)] bg-[var(--vk-bg-main)] p-5",children:[(0,a.jsx)("h3",{className:"text-base font-semibold text-[var(--vk-text-strong)]",children:e}),(0,a.jsx)("p",{className:"mt-2 text-sm leading-6 text-[var(--vk-text-muted)]",children:t}),i,(0,a.jsx)("pre",{className:"mt-4 overflow-x-auto whitespace-pre-wrap break-all rounded-[16px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-4 py-3 font-mono text-sm leading-6 text-[var(--vk-text-normal)]",children:s}),r?(0,a.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:r}):null]})}function P({initialClaimToken:e=null,initialSelectedDeviceId:t=null,dashboardUrl:s,relayUrl:r,installScriptUrl:v}){let[F,L]=(0,i.useState)([]),[q,B]=(0,i.useState)(null),[D,V]=(0,i.useState)(null),[G,J]=(0,i.useState)(!0),[W,H]=(0,i.useState)(!1),[Y,K]=(0,i.useState)(null),[Q,X]=(0,i.useState)(null),[Z,ee]=(0,i.useState)(null),[et,es]=(0,i.useState)(!1),[ea,ei]=(0,i.useState)(!1),[er,en]=(0,i.useState)(null),[ed,el]=(0,i.useState)(null),[ec,eo]=(0,i.useState)(e?"pending":"idle"),[em,ex]=(0,i.useState)(!1),[ev,ep]=(0,i.useState)(null),[eh,eu]=(0,i.useState)(null),[eg,eb]=(0,i.useState)(null),[ef,ej]=(0,i.useState)(t),[ek,ew]=(0,i.useState)({deviceId:null,phase:"idle",message:null}),[eN,ey]=(0,i.useState)({deviceId:null,kind:null,status:"idle",message:null}),e_=(0,i.useRef)(new Set),eC=!!r?.trim(),e$=(0,i.useMemo)(()=>(0,S.$y)(v,s,r),[s,v,r]),eA=(0,i.useMemo)(()=>(0,S.G7)(v),[v]),eS=(0,i.useMemo)(()=>(0,S.hI)(s,r),[s,r]),eI=(0,i.useMemo)(()=>(0,S.zd)(q,r),[q,r]),eE=F.filter(e=>e.connected),eR=(0,i.useMemo)(()=>eh?F.find(e=>e.device_id===eh.deviceId)??null:null,[eh,F]),ez=(0,i.useMemo)(()=>eg?F.find(e=>e.device_id===eg)??null:null,[F,eg]),eM=(0,i.useMemo)(()=>F.find(e=>e.device_id===ef)??eR??ez??eE[0]??F[0]??null,[eR,eE,F,ez,ef]),eU=(0,i.useMemo)(()=>(eR?.connected?eR:null)??(ez?.connected?ez:null)??(eM?.connected?eM:null)??eE[0]??null,[eR,eE,ez,eM]),eT=eU?`/?bridge=${encodeURIComponent(eU.device_id)}`:null,eO=!!eM&&"running"===eN.status&&eN.deviceId===eM?.device_id,eP=eO&&"repair"===eN.kind,eF=eO&&"restart"===eN.kind,eL=!!eM&&(eN.deviceId===eM?.device_id&&(0,C.Az)(eN.message)||ek.deviceId===eM?.device_id&&(0,C.Az)(ek.message));(0,i.useEffect)(()=>{ej(e=>e&&(0===F.length||F.some(t=>t.device_id===e))?e:t&&(0===F.length||F.some(e=>e.device_id===t))?t:eR?.device_id??ez?.device_id??eE[0]?.device_id??F[0]?.device_id??null)},[eR,eE,F,t,ez]),(0,i.useEffect)(()=>{let e=()=>{eb((0,_.Tr)()?.deviceId??null)};return e(),window.addEventListener("focus",e),window.addEventListener("storage",e),()=>{window.removeEventListener("focus",e),window.removeEventListener("storage",e)}},[]);let eq=(0,i.useCallback)(async()=>{if(!eC){J(!1),L([]),ee(null);return}J(!0);try{let e=await fetch("/api/bridge/devices",{cache:"no-store"}),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error??`Failed to load devices (${e.status})`);L((0,E.oH)(t?.devices)),ee(null)}catch(e){L([]),ee(e instanceof Error?e.message:"Failed to load paired devices.")}finally{J(!1)}},[eC]),eB=(0,i.useCallback)(async()=>{if(e){if(!eC){eo("idle"),ep("Bridge relay URL is not configured.");return}eo("pending"),ep(null);try{let t=await fetch("/api/bridge/devices/claims/complete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({claim_token:e})}),s=await t.json().catch(()=>null);if(!t.ok||!s?.paired||!s.device_id||!s.device_name)throw Error(s?.error??`Failed to pair this laptop (${t.status})`);eu({deviceId:s.device_id,deviceName:s.device_name}),(0,_.m7)({deviceId:s.device_id,deviceName:s.device_name}),eb(s.device_id),eo("paired"),await eq()}catch(e){eo("idle"),ep(e instanceof Error?e.message:"Failed to complete the laptop claim.")}}},[e,eC,eq]);async function eD(){if(!eC)return void ee("Bridge relay URL is not configured.");H(!0),X(null);try{let e=await fetch("/api/bridge/devices/code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),t=await e.json().catch(()=>null);if(!e.ok||!t?.code)throw Error(t?.error??`Failed to create pairing code (${e.status})`);B(t.code),V(t.expires_in??null),ee(null)}catch(e){ee(e instanceof Error?e.message:"Failed to create pairing code.")}finally{H(!1)}}async function eV(e,t){try{await navigator.clipboard.writeText(e),X(t),ee(null)}catch(e){X(null),ee(e instanceof Error?e.message:"Failed to copy command.")}}async function eG(e){if(eC){K(e);try{let t=await fetch(`/api/bridge/devices/${encodeURIComponent(e)}`,{method:"DELETE"}),s=await t.json().catch(()=>null);if(!t.ok)throw Error(s?.error??`Failed to revoke device (${t.status})`);await eq()}catch(e){ee(e instanceof Error?e.message:"Failed to revoke device.")}finally{K(null)}}}async function eJ(e){if(eC){ey({deviceId:e.device_id,kind:"restart",status:"running",message:`Restarting the bridge service on ${e.device_name}.`});try{let t=await (0,A.b)(e.device_id);ey({deviceId:e.device_id,kind:"restart",status:"completed",message:t}),window.setTimeout(()=>{eq()},2e3)}catch(t){ey({deviceId:e.device_id,kind:"restart",status:"failed",message:t instanceof Error?t.message:`Failed to restart ${e.device_name}.`})}}}async function eW(e){if(eC){ey({deviceId:e.device_id,kind:"repair",status:"running",message:`Reinstalling the bridge service on ${e.device_name}.`});try{let t=await (0,A.E)(e.device_id,v);ey({deviceId:e.device_id,kind:"repair",status:"completed",message:t}),window.setTimeout(()=>{eq()},2e3)}catch(t){ey({deviceId:e.device_id,kind:"repair",status:"failed",message:t instanceof Error?t.message:`Failed to repair ${e.device_name}.`})}}}async function eH(e){eC&&(await (0,_.jV)(e,ew),window.setTimeout(()=>{eq()},2e3))}async function eY(){if(!eC){es(!0),ei(!1),en("Bridge relay URL is not configured.");return}es(!0),ei(!0),en(null),el(null);try{var e;let t=eE[0];if(!t)throw Error("Connect a laptop first, then reopen the device terminal test.");let s=await fetch((0,I.S)("/api/sessions",t.device_id),{cache:"no-store"}),a=await s.json().catch(()=>null);if(!s.ok){let e=a&&!Array.isArray(a)?a.error:null;throw Error(e??`Failed to load sessions (${s.status})`)}let i=(e=Array.isArray(a)?a:a?.sessions??[]).find(e=>!R.C.has(e.status))??e[0]??null;if(!i)throw Error("Create or resume a session first, then reopen the bridge terminal test.");el(i)}catch(e){en(e instanceof Error?e.message:"Failed to load a session for bridge testing.")}finally{ei(!1)}}return(0,i.useEffect)(()=>{eC?eq():J(!1)},[eC,eq]),(0,i.useEffect)(()=>{if(e){if(!eC){eo("idle"),ep("Bridge relay URL is not configured.");return}eB()}},[eB,e,eC]),(0,i.useEffect)(()=>{let e=(eR?.connected?eR:null)??(ez?.connected?ez:null)??(eM?.connected?eM:null);!e||e_.current.has(e.device_id)||(e_.current.add(e.device_id),(0,_.jV)(e,ew))},[ec,eR,ez,eM]),(0,i.useEffect)(()=>{!ez||ez.connected||ek.message||ew({deviceId:ez.device_id,phase:"checking",message:`Waiting for ${ez.device_name} to come online so Conductor can finish checking its package version.`})},[ek.message,ez]),(0,i.useEffect)(()=>{let t=!!eg&&!ez?.connected,s=!!ef&&!eM?.connected;if(!e&&("paired"!==ec||0!==eE.length)&&!t&&!s)return;let a=window.setInterval(()=>{eq()},4e3);return()=>{window.clearInterval(a)}},[ec,eE.length,e,eg,ez?.connected,eq,eM?.connected,ef]),(0,i.useEffect)(()=>{!eC||e||q||W||!em||eD()},[W,e,q,eC,em]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(w.PublicPageShell,{className:"py-8 sm:py-10",children:(0,a.jsxs)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-5",children:[(0,a.jsx)(M,{children:(0,a.jsxs)("div",{className:"flex flex-col gap-5 lg:flex-row lg:items-start lg:justify-between",children:[(0,a.jsxs)("div",{className:"max-w-3xl",children:[(0,a.jsx)(U,{children:"Conductor Bridge"}),(0,a.jsx)("h1",{className:"mt-3 text-3xl font-semibold tracking-[-0.03em] text-[var(--vk-text-strong)] sm:text-4xl",children:"Connect a laptop"}),(0,a.jsx)("p",{className:"mt-3 text-base leading-7 text-[var(--vk-text-muted)]",children:"Pair one machine, keep the bridge daemon running on it, and use it from the normal Conductor dashboard."}),(0,a.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,a.jsxs)(T,{children:[F.length," paired"]}),(0,a.jsxs)(T,{children:[eE.length," online"]}),(0,a.jsx)(T,{children:eU?`${eU.device_name} ready`:eM?`${eM.device_name} selected`:"No device selected"})]})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 lg:justify-end",children:[eT?(0,a.jsx)(y.$,{asChild:!0,variant:"primary",size:"lg",children:(0,a.jsxs)(n(),{href:eT,children:[(0,a.jsx)(d.A,{className:"h-4 w-4"}),"Open ",eU?.device_name??"device"]})}):(0,a.jsx)(y.$,{asChild:!0,variant:"primary",size:"lg",children:(0,a.jsxs)("a",{href:"#bridge-setup",children:[(0,a.jsx)(d.A,{className:"h-4 w-4"}),"Set up this laptop"]})}),(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"lg",disabled:!eC,onClick:()=>{eq()},children:[(0,a.jsx)(l.A,{className:"h-4 w-4"}),"Refresh"]}),(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"lg",disabled:!eC||ea||0===eE.length,onClick:()=>{eY()},children:[ea?(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(o.A,{className:"h-4 w-4"}),"Test connection"]})]})]})}),eC?null:(0,a.jsxs)(M,{className:"border-[color:color-mix(in_srgb,var(--vk-orange)_34%,transparent)] bg-[color:color-mix(in_srgb,var(--vk-orange)_12%,transparent)] shadow-none",children:[(0,a.jsx)(U,{children:"Bridge relay"}),(0,a.jsx)("h2",{className:"mt-2 text-xl font-semibold text-[var(--vk-text-strong)]",children:"Bridge relay URL is not configured"}),(0,a.jsxs)("p",{className:"mt-2 text-sm leading-6 text-[var(--vk-text-muted)]",children:["Set ",(0,a.jsx)("code",{children:"CONDUCTOR_BRIDGE_RELAY_URL"})," to enable paired-device refresh, claims, and bridge management on this page."]})]}),eU?(0,a.jsx)(M,{className:"border-[rgba(24,197,143,0.32)] bg-[rgba(24,197,143,0.08)] shadow-none",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(U,{children:"Ready to use"}),(0,a.jsxs)("h2",{className:"mt-2 text-xl font-semibold text-[var(--vk-text-strong)]",children:[eU.device_name," is online"]}),(0,a.jsx)("p",{className:"mt-2 text-sm leading-6 text-[var(--vk-text-muted)]",children:"Continue into the dashboard with this laptop selected, or open a live bridge test."})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,a.jsx)(y.$,{asChild:!0,variant:"primary",size:"lg",children:(0,a.jsxs)(n(),{href:eT??"/",children:[(0,a.jsx)(d.A,{className:"h-4 w-4"}),"Open dashboard"]})}),(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"lg",disabled:!eC||ea,onClick:()=>{eY()},children:[(0,a.jsx)(o.A,{className:"h-4 w-4"}),"Open terminal test"]})]})]})}):null,Z?(0,a.jsx)("div",{className:"rounded-[20px] border border-[color:color-mix(in_srgb,var(--vk-red)_30%,transparent)] bg-[color:color-mix(in_srgb,var(--vk-red)_12%,transparent)] px-5 py-4 text-sm text-[var(--vk-red)]",children:Z}):null,e?(0,a.jsxs)(M,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[(0,a.jsxs)("div",{className:"max-w-3xl",children:[(0,a.jsx)(U,{children:"Device-first pairing"}),(0,a.jsx)("h2",{className:"mt-2 text-xl font-semibold text-[var(--vk-text-strong)]",children:"paired"===ec?"This laptop is paired":"Finishing this laptop claim"}),(0,a.jsx)("p",{className:"mt-2 text-sm leading-6 text-[var(--vk-text-muted)]",children:"paired"===ec?"The local command can now finish the handshake on the same machine. This page will keep refreshing until the laptop reports online.":"Conductor is binding the currently-running machine to your account and returning device credentials to that local command."})]}),eh?(0,a.jsx)(y.$,{asChild:!0,variant:"primary",size:"lg",children:(0,a.jsxs)(n(),{href:`/?bridge=${encodeURIComponent(eh.deviceId)}`,children:[(0,a.jsx)(d.A,{className:"h-4 w-4"}),"Open ",eh.deviceName]})}):null]}),(0,a.jsx)("div",{className:"mt-5 rounded-[18px] border border-[var(--vk-border)] bg-[var(--vk-bg-main)] px-4 py-4 text-sm text-[var(--vk-text-muted)]",children:"pending"===ec?(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin"}),"Waiting for the local command to receive its one-time device credentials."]}):"paired"===ec&&eh?(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)(m.A,{className:"mt-0.5 h-4 w-4 text-[var(--vk-green)]"}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"font-medium text-[var(--vk-text-strong)]",children:[eh.deviceName," is now paired."]}),(0,a.jsx)("div",{className:"mt-1",children:eR?.connected?"This laptop is online and ready to use.":"The bridge service is restarting for this laptop now. This page will refresh until it reports online."}),ek.message?(0,a.jsxs)("div",{className:(0,$.cn)("mt-2 flex flex-wrap items-center gap-2 text-xs leading-5","failed"===ek.phase?"text-[var(--vk-red)]":"skipped"===ek.phase?"text-[var(--vk-text-muted)]":"text-[var(--vk-text-faint)]"),children:[(0,a.jsx)("span",{className:"inline-flex items-center rounded-full border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--vk-text-muted)]",children:(0,_.qv)(ek.phase)}),(0,a.jsx)("span",{children:ek.message})]}):null]})]}):ev?(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("div",{className:"text-[var(--vk-red)]",children:ev}),(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"md",onClick:()=>{eB()},children:[(0,a.jsx)(l.A,{className:"h-4 w-4"}),"Retry claim"]})]}):null})]}):null,(0,a.jsxs)("div",{className:"grid gap-5 lg:grid-cols-[minmax(0,1.08fr)_minmax(0,0.92fr)]",children:[(0,a.jsxs)(M,{id:"bridge-setup",children:[(0,a.jsx)(U,{children:"Setup"}),(0,a.jsx)("h2",{className:"mt-2 text-xl font-semibold text-[var(--vk-text-strong)]",children:"Connect this laptop"}),(0,a.jsx)("p",{className:"mt-2 text-sm leading-6 text-[var(--vk-text-muted)]",children:"Most users only need one command. It runs through `npx`, chooses the right installer for this OS, opens the browser, and pairs the current laptop to this dashboard."}),(0,a.jsx)("div",{className:"mt-5",children:(0,a.jsx)(O,{title:"Recommended command",description:"Run this once on the laptop you want to use. Works on macOS, Linux, and Windows anywhere `npx` is available.",command:e$,footer:(0,a.jsxs)(y.$,{type:"button",variant:"primary",size:"md",onClick:()=>{eV(e$,"setup")},children:["setup"===Q?(0,a.jsx)(m.A,{className:"h-4 w-4"}):(0,a.jsx)(x.A,{className:"h-4 w-4"}),"setup"===Q?"Setup command copied":"Copy setup command"]})})}),(0,a.jsxs)("ol",{className:"mt-5 grid gap-3 sm:grid-cols-3",children:[(0,a.jsxs)("li",{className:"rounded-[18px] border border-[var(--vk-border)] bg-[var(--vk-bg-main)] px-4 py-4",children:[(0,a.jsx)("div",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-[var(--vk-text-muted)]",children:"Step 1"}),(0,a.jsx)("p",{className:"mt-2 text-sm leading-6 text-[var(--vk-text-normal)]",children:"Run the command in Terminal, PowerShell, or Command Prompt on the laptop you want to pair."})]}),(0,a.jsxs)("li",{className:"rounded-[18px] border border-[var(--vk-border)] bg-[var(--vk-bg-main)] px-4 py-4",children:[(0,a.jsx)("div",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-[var(--vk-text-muted)]",children:"Step 2"}),(0,a.jsx)("p",{className:"mt-2 text-sm leading-6 text-[var(--vk-text-normal)]",children:"Finish sign-in in the browser tab the command opens."})]}),(0,a.jsxs)("li",{className:"rounded-[18px] border border-[var(--vk-border)] bg-[var(--vk-bg-main)] px-4 py-4",children:[(0,a.jsx)("div",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-[var(--vk-text-muted)]",children:"Step 3"}),(0,a.jsx)("p",{className:"mt-2 text-sm leading-6 text-[var(--vk-text-normal)]",children:"Leave the bridge daemon running so the laptop stays available."})]})]}),(0,a.jsxs)("div",{className:"mt-5 rounded-[20px] border border-[var(--vk-border)] bg-[var(--vk-bg-main)]",children:[(0,a.jsxs)("button",{type:"button",className:"flex w-full items-center justify-between gap-4 px-5 py-4 text-left",onClick:()=>{ex(e=>!e)},children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-sm font-medium text-[var(--vk-text-strong)]",children:"Advanced options"}),(0,a.jsx)("div",{className:"mt-1 text-sm text-[var(--vk-text-muted)]",children:"Use these only if the default setup flow is not right for your case."})]}),em?(0,a.jsx)(p,{className:"h-4 w-4 text-[var(--vk-text-muted)]"}):(0,a.jsx)(h.A,{className:"h-4 w-4 text-[var(--vk-text-muted)]"})]}),em?(0,a.jsxs)("div",{className:"space-y-4 border-t border-[var(--vk-border)] px-4 py-4",children:[(0,a.jsx)(O,{title:"Install only",description:"Install the bridge now, then connect later from a new shell.",command:eA,footer:(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"md",onClick:()=>{eV(eA,"install")},children:[(0,a.jsx)(x.A,{className:"h-4 w-4"}),"install"===Q?"Install command copied":"Copy install command"]})}),(0,a.jsx)(O,{title:"Already installed",description:"Use this when the bridge is already installed on the laptop.",command:eS,footer:(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"md",onClick:()=>{eV(eS,"connect")},children:[(0,a.jsx)(x.A,{className:"h-4 w-4"}),"connect"===Q?"Connect command copied":"Copy connect command"]})}),(0,a.jsx)(O,{title:"Manual fallback",description:"Use a one-time code only if the browser claim flow cannot finish on the same machine.",command:eI,children:(0,a.jsx)("div",{className:"mt-4 rounded-[16px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-4 py-4",children:(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-[var(--vk-text-muted)]",children:"One-time code"}),(0,a.jsx)("div",{className:"mt-3 font-mono text-4xl font-semibold tracking-[0.18em] text-[var(--vk-text-strong)]",children:q??"------"}),(0,a.jsx)("div",{className:"mt-3 text-sm text-[var(--vk-text-muted)]",children:q?`Valid for about ${Math.max(1,Math.round((D??600)/60))} minutes.`:"Generate a code to reveal the manual pair command."})]}),(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"md",disabled:W||!eC,onClick:()=>{eD()},children:[W?(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(l.A,{className:"h-4 w-4"}),q?"Generate new code":"Generate code"]})]})}),footer:(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"md",disabled:!q||!eC,onClick:()=>{eV(eI,"manual")},children:["manual"===Q?(0,a.jsx)(m.A,{className:"h-4 w-4"}):(0,a.jsx)(x.A,{className:"h-4 w-4"}),"manual"===Q?"Manual command copied":"Copy manual command"]})})]}):null]})]}),(0,a.jsxs)(M,{children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(U,{children:"Devices"}),(0,a.jsx)("h2",{className:"mt-2 text-xl font-semibold text-[var(--vk-text-strong)]",children:"Paired devices"}),(0,a.jsx)("p",{className:"mt-2 text-sm leading-6 text-[var(--vk-text-muted)]",children:"Pick a laptop below, then continue into the dashboard with that device selected."})]}),(0,a.jsxs)(T,{children:[F.length," total"]})]}),eM?(0,a.jsx)("div",{className:"mt-5 rounded-[18px] border border-[var(--vk-border)] bg-[var(--vk-bg-main)] px-4 py-4",children:(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("div",{className:"text-base font-semibold text-[var(--vk-text-strong)]",children:eM.device_name}),(0,a.jsx)(k.J,{connected:eM.connected,title:`${eM.device_name} is ${eM.connected?"online":"offline"}`})]}),(0,a.jsx)("div",{className:"text-sm text-[var(--vk-text-muted)]",children:z(eM)}),ek.message&&ek.deviceId===eM.device_id?(0,a.jsxs)("div",{className:(0,$.cn)("flex flex-wrap items-center gap-2 text-xs leading-5","failed"===ek.phase?"text-[var(--vk-red)]":"skipped"===ek.phase?"text-[var(--vk-text-muted)]":"text-[var(--vk-text-faint)]"),children:[(0,a.jsx)("span",{className:"inline-flex items-center rounded-full border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--vk-text-muted)]",children:(0,_.qv)(ek.phase)}),(0,a.jsx)("span",{children:ek.message})]}):null,eN.message&&eN.deviceId===eM.device_id?(0,a.jsx)("div",{className:(0,$.cn)("text-xs leading-5","failed"===eN.status?"text-[var(--vk-red)]":"completed"===eN.status?"text-[var(--vk-green)]":"text-[var(--vk-text-faint)]"),children:eN.message}):null,eL?(0,a.jsx)(j.i,{deviceId:eM.device_id,deviceName:eM.device_name,dashboardUrl:s,installScriptUrl:v,relayUrl:r}):null,eM.connected?(0,a.jsxs)("div",{className:"flex w-full flex-wrap gap-2",children:[(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"md",disabled:eO||(0,_.xv)(ek,eM.device_id),onClick:()=>{eW(eM)},children:[eP?(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(u.A,{className:"h-4 w-4"}),"Repair bridge"]}),(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"md",disabled:(0,_.xv)(ek,eM.device_id)||eO,onClick:()=>{eH(eM)},children:[(0,_.xv)(ek,eM.device_id)?(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(g.A,{className:"h-4 w-4"}),(0,_.xv)(ek,eM.device_id)?"Updating...":"Update Conductor"]}),(0,a.jsx)(y.$,{asChild:!0,variant:"primary",size:"md",children:(0,a.jsxs)(n(),{href:`/?bridge=${encodeURIComponent(eM.device_id)}`,children:[(0,a.jsx)(d.A,{className:"h-4 w-4"}),"Continue with ",eM.device_name]})}),(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"md",disabled:eO||(0,_.xv)(ek,eM.device_id),onClick:()=>{eJ(eM)},children:[eF?(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(l.A,{className:"h-4 w-4"}),"Restart service"]})]}):(0,a.jsx)("div",{className:"text-sm text-[var(--vk-text-muted)]",children:"This laptop is paired, but it is not online right now."})]})}):null,(0,a.jsx)("div",{className:"mt-5 space-y-3",children:G?(0,a.jsxs)("div",{className:"flex items-center gap-3 rounded-[18px] border border-[var(--vk-border)] bg-[var(--vk-bg-main)] px-4 py-4 text-sm text-[var(--vk-text-muted)]",children:[(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin"}),"Loading paired devices..."]}):F.length>0?F.map(e=>{let t=eM?.device_id===e.device_id,s=(0,_.xv)(ek,e.device_id),i="running"===eN.status&&eN.deviceId===e.device_id,r=i&&"repair"===eN.kind,d=i&&"restart"===eN.kind;return(0,a.jsx)("div",{className:(0,$.cn)("rounded-[18px] border bg-[var(--vk-bg-main)] p-4",t?"border-[var(--vk-orange)]":"border-[var(--vk-border)]"),children:(0,a.jsxs)("div",{className:"flex flex-col gap-4 xl:flex-row xl:items-start xl:justify-between",children:[(0,a.jsxs)("button",{type:"button",className:"min-w-0 flex-1 text-left",onClick:()=>{ej(e.device_id)},children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("div",{className:"truncate text-base font-medium text-[var(--vk-text-strong)]",children:e.device_name}),(0,a.jsx)(k.J,{connected:e.connected,title:`${e.device_name} is ${e.connected?"online":"offline"}`}),t?(0,a.jsx)("span",{className:"rounded-full border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-2 py-1 text-[11px] text-[var(--vk-text-muted)]",children:"Selected"}):null]}),(0,a.jsx)("div",{className:"mt-2 text-sm text-[var(--vk-text-muted)]",children:z(e)}),(0,a.jsxs)("div",{className:"mt-1 text-xs text-[var(--vk-text-muted)]",children:["Relay: ",e.last_status?.hostname??e.hostname,(0,E.wj)(e.last_status?.version)]}),ek.message&&ek.deviceId===e.device_id?(0,a.jsxs)("div",{className:(0,$.cn)("mt-2 flex flex-wrap items-center gap-2 text-xs leading-5","failed"===ek.phase?"text-[var(--vk-red)]":"skipped"===ek.phase?"text-[var(--vk-text-muted)]":"text-[var(--vk-text-faint)]"),children:[(0,a.jsx)("span",{className:"inline-flex items-center rounded-full border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--vk-text-muted)]",children:(0,_.qv)(ek.phase)}),(0,a.jsx)("span",{children:ek.message})]}):null,eN.message&&eN.deviceId===e.device_id?(0,a.jsx)("div",{className:(0,$.cn)("mt-2 text-xs leading-5","failed"===eN.status?"text-[var(--vk-red)]":"completed"===eN.status?"text-[var(--vk-green)]":"text-[var(--vk-text-faint)]"),children:eN.message}):null]}),(0,a.jsxs)("div",{className:"flex w-full flex-wrap items-center gap-2 xl:w-auto xl:justify-end",children:[e.connected?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(y.$,{asChild:!0,variant:t?"primary":"outline",size:"md",children:(0,a.jsx)(n(),{href:`/?bridge=${encodeURIComponent(e.device_id)}`,children:t?"Continue":"Open"})}),(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"md",disabled:i||s,onClick:()=>{ej(e.device_id),eW(e)},children:[r?(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(u.A,{className:"h-4 w-4"}),"Repair"]}),(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"md",disabled:s||i,onClick:()=>{ej(e.device_id),eH(e)},children:[s?(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(g.A,{className:"h-4 w-4"}),s?"Updating...":"Update"]}),(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"md",disabled:i||s,onClick:()=>{ej(e.device_id),eJ(e)},children:[d?(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(l.A,{className:"h-4 w-4"}),"Restart"]})]}):(0,a.jsx)("span",{className:"text-xs text-[var(--vk-text-muted)]",children:"Offline"}),(0,a.jsx)(y.$,{type:"button",variant:"ghost",size:"icon",disabled:Y===e.device_id,onClick:()=>{eG(e.device_id)},"aria-label":`Revoke ${e.device_name}`,children:Y===e.device_id?(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(b,{className:"h-4 w-4"})})]})]})},e.device_id)}):(0,a.jsx)("div",{className:"rounded-[18px] border border-dashed border-[var(--vk-border)] bg-[var(--vk-bg-main)] px-4 py-6 text-sm text-[var(--vk-text-muted)]",children:"No laptops have been paired yet. Run the setup command on the laptop you want to use."})})]})]})]})}),et?(0,a.jsxs)("div",{className:"fixed inset-0 z-[85] flex items-start justify-center overflow-y-auto bg-black/70 px-3 py-3 sm:items-center sm:py-0",children:[(0,a.jsx)("button",{type:"button",className:"absolute inset-0","aria-label":"Close bridge terminal test",onClick:()=>{es(!1)}}),(0,a.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"bridge-test-title",className:"relative z-10 flex max-h-[92vh] w-full max-w-6xl flex-col overflow-hidden rounded-[24px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] shadow-[0_28px_80px_rgba(0,0,0,0.4)]",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-4 border-b border-[var(--vk-border)] px-5 py-5 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.24em] text-[var(--vk-text-muted)]",children:"Bridge terminal test"}),(0,a.jsx)("h2",{id:"bridge-test-title",className:"mt-2 text-xl font-semibold text-[var(--vk-text-strong)]",children:"Live session over Conductor Bridge"}),(0,a.jsx)("p",{className:"mt-2 max-w-2xl text-sm leading-6 text-[var(--vk-text-muted)]",children:ed?`${ed.projectId}${ed.branch?` \xb7 ${ed.branch}`:""}`:"Open a session here to verify terminal input and output through the bridge."})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)(k.J,{connected:eE.length>0,title:`${eE.length} connected device${1===eE.length?"":"s"}`}),(0,a.jsx)(y.$,{type:"button",variant:"ghost",size:"icon",onClick:()=>{es(!1)},"aria-label":"Close bridge test modal",children:(0,a.jsx)(f.A,{className:"h-4 w-4"})})]})]}),(0,a.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col px-5 py-5",children:[0===eE.length?(0,a.jsx)("div",{className:"mb-4 rounded-[18px] border border-[color:color-mix(in_srgb,var(--vk-red)_28%,transparent)] bg-[color:color-mix(in_srgb,var(--vk-red)_10%,transparent)] px-4 py-3 text-sm text-[var(--vk-text-muted)]",children:"No paired bridge reports as online right now. Reconnect a laptop to test the live terminal path."}):null,ea?(0,a.jsx)("div",{className:"flex min-h-[360px] flex-1 items-center justify-center rounded-[20px] border border-[var(--vk-border)] bg-[var(--vk-bg-main)] text-sm text-[var(--vk-text-muted)]",children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin"}),"Preparing a session for the bridge test..."]})}):er?(0,a.jsx)("div",{className:"rounded-[20px] border border-[color:color-mix(in_srgb,var(--vk-red)_30%,transparent)] bg-[color:color-mix(in_srgb,var(--vk-red)_12%,transparent)] px-5 py-4 text-sm text-[var(--vk-red)]",children:er}):ed?(0,a.jsx)("div",{className:"min-h-[420px] flex-1 overflow-hidden rounded-[20px] border border-[var(--vk-border)] bg-[#060404]",children:(0,a.jsx)(N.SessionTerminal,{sessionId:ed.id,bridgeId:ed.bridgeId,sessionState:ed.status,pendingInsert:null})}):(0,a.jsx)("div",{className:"rounded-[20px] border border-dashed border-[var(--vk-border)] bg-[var(--vk-bg-main)] px-5 py-10 text-sm text-[var(--vk-text-muted)]",children:"No session is available for bridge testing yet."})]})]})]}):null]})}},82767:(e,t,s)=>{Promise.resolve().then(s.t.bind(s,65587,23)),Promise.resolve().then(s.bind(s,69902)),Promise.resolve().then(s.bind(s,81677))}},e=>{e.O(0,[3357,5587,1455,1257,2175,9702,3954,587,1968,7358],()=>e(e.s=82767)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1063],{26083:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(13454).A)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])},69863:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(13454).A)("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]])},69902:(e,t,s)=>{"use strict";s.d(t,{PublicPageShell:()=>n,PublicPanel:()=>d,PublicSection:()=>l});var a=s(54568),i=s(82175),r=s(46916);function n({children:e,className:t}){return(0,a.jsx)("main",{className:"min-h-screen bg-[var(--bg-canvas)] text-[var(--text-strong)]",children:(0,a.jsxs)("div",{className:"mx-auto flex min-h-screen w-full max-w-6xl flex-col px-6 py-8 sm:px-8 sm:py-10",children:[(0,a.jsxs)("header",{className:"flex items-center gap-3 border-b border-[var(--border-soft)] pb-6",children:[(0,a.jsx)("img",{src:"/icon.svg",alt:"Conductor icon",width:40,height:40,className:"h-10 w-10 rounded-[10px] border border-[var(--border-soft)] bg-[var(--bg-panel)] p-1.5"}),(0,a.jsx)(i.default,{src:"/brand/conductor-wordmark-dark.png",alt:"Conductor",width:320,height:62,priority:!0,className:"h-auto w-[168px] sm:w-[220px]"})]}),(0,a.jsx)("div",{className:(0,r.cn)("flex-1 py-10 sm:py-12",t),children:e})]})})}function d({children:e,className:t}){return(0,a.jsx)("section",{className:(0,r.cn)("surface-card rounded-[var(--radius-lg)] border border-[var(--border-soft)] bg-[var(--bg-panel)]",t),children:e})}function l({eyebrow:e,title:t,description:s,children:i,className:n}){return(0,a.jsxs)("div",{className:(0,r.cn)("space-y-4",n),children:[e?(0,a.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.24em] text-[var(--text-muted)]",children:e}):null,(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("h1",{className:"text-3xl font-semibold tracking-[-0.02em] text-[var(--text-strong)] sm:text-4xl",children:t}),s?(0,a.jsx)("p",{className:"max-w-2xl text-base leading-7 text-[var(--text-muted)] sm:text-lg",children:s}):null]}),i]})}},77522:(e,t,s)=>{"use strict";s.d(t,{C:()=>a,n:()=>i});let a=new Set(["archived","done","killed","errored","terminated","merged","cleanup"]);function i(e){return"merged"===e.status||"archived"===e.status||"killed"===e.status||"errored"===e.status||"cleanup"===e.status||"done"===e.status||"terminated"===e.status||e.pr&&("merged"===e.pr.state||"closed"===e.pr.state)?"done":"mergeable"===e.status||"approved"===e.status||e.pr?.mergeability.mergeable?"merge":"waiting_input"===e.activity||"blocked"===e.activity||"needs_input"===e.status||"stuck"===e.status?"respond":"queued"===e.status?"pending":"exited"===e.activity?"respond":"ci_failed"===e.status||"changes_requested"===e.status||e.pr&&("failing"===e.pr.ciStatus||"changes_requested"===e.pr.reviewDecision||!e.pr.mergeability.noConflicts)?"review":"review_pending"===e.status||e.pr&&!e.pr.isDraft&&("pending"===e.pr.reviewDecision||"none"===e.pr.reviewDecision)?"pending":"working"}},81677:(e,t,s)=>{"use strict";s.d(t,{default:()=>P});var a=s(54568),i=s(7620),r=s(65587),n=s.n(r),d=s(81167),l=s(60527),c=s(58299),o=s(69863),m=s(63322),x=s(59706),v=s(13454);let p=(0,v.A)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);var h=s(34041),u=s(87242),g=s(2099);let b=(0,v.A)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);var f=s(36645),j=s(15321),k=s(39702),w=s(69902),N=s(83954),y=s(76081),_=s(44522),C=s(11984),$=s(46916),A=s(26167),S=s(61369),I=s(31404),E=s(15115),R=s(77522);function z(e){return`${e.hostname} \xb7 ${e.os}/${e.arch}${(0,E.wj)(e.last_status?.version)}`}function M({children:e,className:t,id:s}){return(0,a.jsx)("section",{id:s,className:(0,$.cn)("rounded-[24px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] p-6","shadow-[0_18px_36px_rgba(0,0,0,0.2)]",t),children:e})}function U({children:e}){return(0,a.jsx)("p",{className:"text-[11px] font-semibold uppercase tracking-[0.24em] text-[var(--vk-text-muted)]",children:e})}function T({children:e}){return(0,a.jsx)("div",{className:"rounded-full border border-[var(--vk-border)] bg-[var(--vk-bg-main)] px-3 py-1.5 text-xs text-[var(--vk-text-muted)]",children:e})}function O({title:e,description:t,command:s,children:i,footer:r}){return(0,a.jsxs)("div",{className:"rounded-[20px] border border-[var(--vk-border)] bg-[var(--vk-bg-main)] p-5",children:[(0,a.jsx)("h3",{className:"text-base font-semibold text-[var(--vk-text-strong)]",children:e}),(0,a.jsx)("p",{className:"mt-2 text-sm leading-6 text-[var(--vk-text-muted)]",children:t}),i,(0,a.jsx)("pre",{className:"mt-4 overflow-x-auto whitespace-pre-wrap break-all rounded-[16px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-4 py-3 font-mono text-sm leading-6 text-[var(--vk-text-normal)]",children:s}),r?(0,a.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:r}):null]})}function P({initialClaimToken:e=null,initialSelectedDeviceId:t=null,dashboardUrl:s,relayUrl:r,installScriptUrl:v}){let[F,L]=(0,i.useState)([]),[q,B]=(0,i.useState)(null),[D,V]=(0,i.useState)(null),[G,J]=(0,i.useState)(!0),[W,H]=(0,i.useState)(!1),[Y,K]=(0,i.useState)(null),[Q,X]=(0,i.useState)(null),[Z,ee]=(0,i.useState)(null),[et,es]=(0,i.useState)(!1),[ea,ei]=(0,i.useState)(!1),[er,en]=(0,i.useState)(null),[ed,el]=(0,i.useState)(null),[ec,eo]=(0,i.useState)(e?"pending":"idle"),[em,ex]=(0,i.useState)(!1),[ev,ep]=(0,i.useState)(null),[eh,eu]=(0,i.useState)(null),[eg,eb]=(0,i.useState)(null),[ef,ej]=(0,i.useState)(t),[ek,ew]=(0,i.useState)({deviceId:null,phase:"idle",message:null}),[eN,ey]=(0,i.useState)({deviceId:null,kind:null,status:"idle",message:null}),e_=(0,i.useRef)(new Set),eC=!!r?.trim(),e$=(0,i.useMemo)(()=>(0,S.$y)(v,s,r),[s,v,r]),eA=(0,i.useMemo)(()=>(0,S.G7)(v),[v]),eS=(0,i.useMemo)(()=>(0,S.hI)(s,r),[s,r]),eI=(0,i.useMemo)(()=>(0,S.zd)(q,r),[q,r]),eE=F.filter(e=>e.connected),eR=(0,i.useMemo)(()=>eh?F.find(e=>e.device_id===eh.deviceId)??null:null,[eh,F]),ez=(0,i.useMemo)(()=>eg?F.find(e=>e.device_id===eg)??null:null,[F,eg]),eM=(0,i.useMemo)(()=>F.find(e=>e.device_id===ef)??eR??ez??eE[0]??F[0]??null,[eR,eE,F,ez,ef]),eU=(0,i.useMemo)(()=>(eR?.connected?eR:null)??(ez?.connected?ez:null)??(eM?.connected?eM:null)??eE[0]??null,[eR,eE,ez,eM]),eT=eU?`/?bridge=${encodeURIComponent(eU.device_id)}`:null,eO=!!eM&&"running"===eN.status&&eN.deviceId===eM?.device_id,eP=eO&&"repair"===eN.kind,eF=eO&&"restart"===eN.kind,eL=!!eM&&(eN.deviceId===eM?.device_id&&(0,C.Az)(eN.message)||ek.deviceId===eM?.device_id&&(0,C.Az)(ek.message));(0,i.useEffect)(()=>{ej(e=>e&&(0===F.length||F.some(t=>t.device_id===e))?e:t&&(0===F.length||F.some(e=>e.device_id===t))?t:eR?.device_id??ez?.device_id??eE[0]?.device_id??F[0]?.device_id??null)},[eR,eE,F,t,ez]),(0,i.useEffect)(()=>{let e=()=>{eb((0,_.Tr)()?.deviceId??null)};return e(),window.addEventListener("focus",e),window.addEventListener("storage",e),()=>{window.removeEventListener("focus",e),window.removeEventListener("storage",e)}},[]);let eq=(0,i.useCallback)(async()=>{if(!eC){J(!1),L([]),ee(null);return}J(!0);try{let e=await fetch("/api/bridge/devices",{cache:"no-store"}),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error??`Failed to load devices (${e.status})`);L((0,E.oH)(t?.devices)),ee(null)}catch(e){L([]),ee(e instanceof Error?e.message:"Failed to load paired devices.")}finally{J(!1)}},[eC]),eB=(0,i.useCallback)(async()=>{if(e){if(!eC){eo("idle"),ep("Bridge relay URL is not configured.");return}eo("pending"),ep(null);try{let t=await fetch("/api/bridge/devices/claims/complete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({claim_token:e})}),s=await t.json().catch(()=>null);if(!t.ok||!s?.paired||!s.device_id||!s.device_name)throw Error(s?.error??`Failed to pair this laptop (${t.status})`);eu({deviceId:s.device_id,deviceName:s.device_name}),(0,_.m7)({deviceId:s.device_id,deviceName:s.device_name}),eb(s.device_id),eo("paired"),await eq()}catch(e){eo("idle"),ep(e instanceof Error?e.message:"Failed to complete the laptop claim.")}}},[e,eC,eq]);async function eD(){if(!eC)return void ee("Bridge relay URL is not configured.");H(!0),X(null);try{let e=await fetch("/api/bridge/devices/code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),t=await e.json().catch(()=>null);if(!e.ok||!t?.code)throw Error(t?.error??`Failed to create pairing code (${e.status})`);B(t.code),V(t.expires_in??null),ee(null)}catch(e){ee(e instanceof Error?e.message:"Failed to create pairing code.")}finally{H(!1)}}async function eV(e,t){try{await navigator.clipboard.writeText(e),X(t),ee(null)}catch(e){X(null),ee(e instanceof Error?e.message:"Failed to copy command.")}}async function eG(e){if(eC){K(e);try{let t=await fetch(`/api/bridge/devices/${encodeURIComponent(e)}`,{method:"DELETE"}),s=await t.json().catch(()=>null);if(!t.ok)throw Error(s?.error??`Failed to revoke device (${t.status})`);await eq()}catch(e){ee(e instanceof Error?e.message:"Failed to revoke device.")}finally{K(null)}}}async function eJ(e){if(eC){ey({deviceId:e.device_id,kind:"restart",status:"running",message:`Restarting the bridge service on ${e.device_name}.`});try{let t=await (0,A.b)(e.device_id);ey({deviceId:e.device_id,kind:"restart",status:"completed",message:t}),window.setTimeout(()=>{eq()},2e3)}catch(t){ey({deviceId:e.device_id,kind:"restart",status:"failed",message:t instanceof Error?t.message:`Failed to restart ${e.device_name}.`})}}}async function eW(e){if(eC){ey({deviceId:e.device_id,kind:"repair",status:"running",message:`Reinstalling the bridge service on ${e.device_name}.`});try{let t=await (0,A.E)(e.device_id,v);ey({deviceId:e.device_id,kind:"repair",status:"completed",message:t}),window.setTimeout(()=>{eq()},2e3)}catch(t){ey({deviceId:e.device_id,kind:"repair",status:"failed",message:t instanceof Error?t.message:`Failed to repair ${e.device_name}.`})}}}async function eH(e){eC&&(await (0,_.jV)(e,ew),window.setTimeout(()=>{eq()},2e3))}async function eY(){if(!eC){es(!0),ei(!1),en("Bridge relay URL is not configured.");return}es(!0),ei(!0),en(null),el(null);try{var e;let t=eE[0];if(!t)throw Error("Connect a laptop first, then reopen the device terminal test.");let s=await fetch((0,I.S)("/api/sessions",t.device_id),{cache:"no-store"}),a=await s.json().catch(()=>null);if(!s.ok){let e=a&&!Array.isArray(a)?a.error:null;throw Error(e??`Failed to load sessions (${s.status})`)}let i=(e=Array.isArray(a)?a:a?.sessions??[]).find(e=>!R.C.has(e.status))??e[0]??null;if(!i)throw Error("Create or resume a session first, then reopen the bridge terminal test.");el(i)}catch(e){en(e instanceof Error?e.message:"Failed to load a session for bridge testing.")}finally{ei(!1)}}return(0,i.useEffect)(()=>{eC?eq():J(!1)},[eC,eq]),(0,i.useEffect)(()=>{if(e){if(!eC){eo("idle"),ep("Bridge relay URL is not configured.");return}eB()}},[eB,e,eC]),(0,i.useEffect)(()=>{let e=(eR?.connected?eR:null)??(ez?.connected?ez:null)??(eM?.connected?eM:null);!e||e_.current.has(e.device_id)||(e_.current.add(e.device_id),(0,_.jV)(e,ew))},[ec,eR,ez,eM]),(0,i.useEffect)(()=>{!ez||ez.connected||ek.message||ew({deviceId:ez.device_id,phase:"checking",message:`Waiting for ${ez.device_name} to come online so Conductor can finish checking its package version.`})},[ek.message,ez]),(0,i.useEffect)(()=>{let t=!!eg&&!ez?.connected,s=!!ef&&!eM?.connected;if(!e&&("paired"!==ec||0!==eE.length)&&!t&&!s)return;let a=window.setInterval(()=>{eq()},4e3);return()=>{window.clearInterval(a)}},[ec,eE.length,e,eg,ez?.connected,eq,eM?.connected,ef]),(0,i.useEffect)(()=>{!eC||e||q||W||!em||eD()},[W,e,q,eC,em]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(w.PublicPageShell,{className:"py-8 sm:py-10",children:(0,a.jsxs)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-5",children:[(0,a.jsx)(M,{children:(0,a.jsxs)("div",{className:"flex flex-col gap-5 lg:flex-row lg:items-start lg:justify-between",children:[(0,a.jsxs)("div",{className:"max-w-3xl",children:[(0,a.jsx)(U,{children:"Conductor Bridge"}),(0,a.jsx)("h1",{className:"mt-3 text-3xl font-semibold tracking-[-0.03em] text-[var(--vk-text-strong)] sm:text-4xl",children:"Connect a laptop"}),(0,a.jsx)("p",{className:"mt-3 text-base leading-7 text-[var(--vk-text-muted)]",children:"Pair one machine, keep the bridge daemon running on it, and use it from the normal Conductor dashboard."}),(0,a.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,a.jsxs)(T,{children:[F.length," paired"]}),(0,a.jsxs)(T,{children:[eE.length," online"]}),(0,a.jsx)(T,{children:eU?`${eU.device_name} ready`:eM?`${eM.device_name} selected`:"No device selected"})]})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 lg:justify-end",children:[eT?(0,a.jsx)(y.$,{asChild:!0,variant:"primary",size:"lg",children:(0,a.jsxs)(n(),{href:eT,children:[(0,a.jsx)(d.A,{className:"h-4 w-4"}),"Open ",eU?.device_name??"device"]})}):(0,a.jsx)(y.$,{asChild:!0,variant:"primary",size:"lg",children:(0,a.jsxs)("a",{href:"#bridge-setup",children:[(0,a.jsx)(d.A,{className:"h-4 w-4"}),"Set up this laptop"]})}),(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"lg",disabled:!eC,onClick:()=>{eq()},children:[(0,a.jsx)(l.A,{className:"h-4 w-4"}),"Refresh"]}),(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"lg",disabled:!eC||ea||0===eE.length,onClick:()=>{eY()},children:[ea?(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(o.A,{className:"h-4 w-4"}),"Test connection"]})]})]})}),eC?null:(0,a.jsxs)(M,{className:"border-[color:color-mix(in_srgb,var(--vk-orange)_34%,transparent)] bg-[color:color-mix(in_srgb,var(--vk-orange)_12%,transparent)] shadow-none",children:[(0,a.jsx)(U,{children:"Bridge relay"}),(0,a.jsx)("h2",{className:"mt-2 text-xl font-semibold text-[var(--vk-text-strong)]",children:"Bridge relay URL is not configured"}),(0,a.jsxs)("p",{className:"mt-2 text-sm leading-6 text-[var(--vk-text-muted)]",children:["Set ",(0,a.jsx)("code",{children:"CONDUCTOR_BRIDGE_RELAY_URL"})," to enable paired-device refresh, claims, and bridge management on this page."]})]}),eU?(0,a.jsx)(M,{className:"border-[rgba(24,197,143,0.32)] bg-[rgba(24,197,143,0.08)] shadow-none",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(U,{children:"Ready to use"}),(0,a.jsxs)("h2",{className:"mt-2 text-xl font-semibold text-[var(--vk-text-strong)]",children:[eU.device_name," is online"]}),(0,a.jsx)("p",{className:"mt-2 text-sm leading-6 text-[var(--vk-text-muted)]",children:"Continue into the dashboard with this laptop selected, or open a live bridge test."})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,a.jsx)(y.$,{asChild:!0,variant:"primary",size:"lg",children:(0,a.jsxs)(n(),{href:eT??"/",children:[(0,a.jsx)(d.A,{className:"h-4 w-4"}),"Open dashboard"]})}),(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"lg",disabled:!eC||ea,onClick:()=>{eY()},children:[(0,a.jsx)(o.A,{className:"h-4 w-4"}),"Open terminal test"]})]})]})}):null,Z?(0,a.jsx)("div",{className:"rounded-[20px] border border-[color:color-mix(in_srgb,var(--vk-red)_30%,transparent)] bg-[color:color-mix(in_srgb,var(--vk-red)_12%,transparent)] px-5 py-4 text-sm text-[var(--vk-red)]",children:Z}):null,e?(0,a.jsxs)(M,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[(0,a.jsxs)("div",{className:"max-w-3xl",children:[(0,a.jsx)(U,{children:"Device-first pairing"}),(0,a.jsx)("h2",{className:"mt-2 text-xl font-semibold text-[var(--vk-text-strong)]",children:"paired"===ec?"This laptop is paired":"Finishing this laptop claim"}),(0,a.jsx)("p",{className:"mt-2 text-sm leading-6 text-[var(--vk-text-muted)]",children:"paired"===ec?"The local command can now finish the handshake on the same machine. This page will keep refreshing until the laptop reports online.":"Conductor is binding the currently-running machine to your account and returning device credentials to that local command."})]}),eh?(0,a.jsx)(y.$,{asChild:!0,variant:"primary",size:"lg",children:(0,a.jsxs)(n(),{href:`/?bridge=${encodeURIComponent(eh.deviceId)}`,children:[(0,a.jsx)(d.A,{className:"h-4 w-4"}),"Open ",eh.deviceName]})}):null]}),(0,a.jsx)("div",{className:"mt-5 rounded-[18px] border border-[var(--vk-border)] bg-[var(--vk-bg-main)] px-4 py-4 text-sm text-[var(--vk-text-muted)]",children:"pending"===ec?(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin"}),"Waiting for the local command to receive its one-time device credentials."]}):"paired"===ec&&eh?(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)(m.A,{className:"mt-0.5 h-4 w-4 text-[var(--vk-green)]"}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"font-medium text-[var(--vk-text-strong)]",children:[eh.deviceName," is now paired."]}),(0,a.jsx)("div",{className:"mt-1",children:eR?.connected?"This laptop is online and ready to use.":"The bridge service is restarting for this laptop now. This page will refresh until it reports online."}),ek.message?(0,a.jsxs)("div",{className:(0,$.cn)("mt-2 flex flex-wrap items-center gap-2 text-xs leading-5","failed"===ek.phase?"text-[var(--vk-red)]":"skipped"===ek.phase?"text-[var(--vk-text-muted)]":"text-[var(--vk-text-faint)]"),children:[(0,a.jsx)("span",{className:"inline-flex items-center rounded-full border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--vk-text-muted)]",children:(0,_.qv)(ek.phase)}),(0,a.jsx)("span",{children:ek.message})]}):null]})]}):ev?(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("div",{className:"text-[var(--vk-red)]",children:ev}),(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"md",onClick:()=>{eB()},children:[(0,a.jsx)(l.A,{className:"h-4 w-4"}),"Retry claim"]})]}):null})]}):null,(0,a.jsxs)("div",{className:"grid gap-5 lg:grid-cols-[minmax(0,1.08fr)_minmax(0,0.92fr)]",children:[(0,a.jsxs)(M,{id:"bridge-setup",children:[(0,a.jsx)(U,{children:"Setup"}),(0,a.jsx)("h2",{className:"mt-2 text-xl font-semibold text-[var(--vk-text-strong)]",children:"Connect this laptop"}),(0,a.jsx)("p",{className:"mt-2 text-sm leading-6 text-[var(--vk-text-muted)]",children:"Most users only need one command. It runs through `npx`, chooses the right installer for this OS, opens the browser, and pairs the current laptop to this dashboard."}),(0,a.jsx)("div",{className:"mt-5",children:(0,a.jsx)(O,{title:"Recommended command",description:"Run this once on the laptop you want to use. Works on macOS, Linux, and Windows anywhere `npx` is available.",command:e$,footer:(0,a.jsxs)(y.$,{type:"button",variant:"primary",size:"md",onClick:()=>{eV(e$,"setup")},children:["setup"===Q?(0,a.jsx)(m.A,{className:"h-4 w-4"}):(0,a.jsx)(x.A,{className:"h-4 w-4"}),"setup"===Q?"Setup command copied":"Copy setup command"]})})}),(0,a.jsxs)("ol",{className:"mt-5 grid gap-3 sm:grid-cols-3",children:[(0,a.jsxs)("li",{className:"rounded-[18px] border border-[var(--vk-border)] bg-[var(--vk-bg-main)] px-4 py-4",children:[(0,a.jsx)("div",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-[var(--vk-text-muted)]",children:"Step 1"}),(0,a.jsx)("p",{className:"mt-2 text-sm leading-6 text-[var(--vk-text-normal)]",children:"Run the command in Terminal, PowerShell, or Command Prompt on the laptop you want to pair."})]}),(0,a.jsxs)("li",{className:"rounded-[18px] border border-[var(--vk-border)] bg-[var(--vk-bg-main)] px-4 py-4",children:[(0,a.jsx)("div",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-[var(--vk-text-muted)]",children:"Step 2"}),(0,a.jsx)("p",{className:"mt-2 text-sm leading-6 text-[var(--vk-text-normal)]",children:"Finish sign-in in the browser tab the command opens."})]}),(0,a.jsxs)("li",{className:"rounded-[18px] border border-[var(--vk-border)] bg-[var(--vk-bg-main)] px-4 py-4",children:[(0,a.jsx)("div",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-[var(--vk-text-muted)]",children:"Step 3"}),(0,a.jsx)("p",{className:"mt-2 text-sm leading-6 text-[var(--vk-text-normal)]",children:"Leave the bridge daemon running so the laptop stays available."})]})]}),(0,a.jsxs)("div",{className:"mt-5 rounded-[20px] border border-[var(--vk-border)] bg-[var(--vk-bg-main)]",children:[(0,a.jsxs)("button",{type:"button",className:"flex w-full items-center justify-between gap-4 px-5 py-4 text-left",onClick:()=>{ex(e=>!e)},children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-sm font-medium text-[var(--vk-text-strong)]",children:"Advanced options"}),(0,a.jsx)("div",{className:"mt-1 text-sm text-[var(--vk-text-muted)]",children:"Use these only if the default setup flow is not right for your case."})]}),em?(0,a.jsx)(p,{className:"h-4 w-4 text-[var(--vk-text-muted)]"}):(0,a.jsx)(h.A,{className:"h-4 w-4 text-[var(--vk-text-muted)]"})]}),em?(0,a.jsxs)("div",{className:"space-y-4 border-t border-[var(--vk-border)] px-4 py-4",children:[(0,a.jsx)(O,{title:"Install only",description:"Install the bridge now, then connect later from a new shell.",command:eA,footer:(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"md",onClick:()=>{eV(eA,"install")},children:[(0,a.jsx)(x.A,{className:"h-4 w-4"}),"install"===Q?"Install command copied":"Copy install command"]})}),(0,a.jsx)(O,{title:"Already installed",description:"Use this when the bridge is already installed on the laptop.",command:eS,footer:(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"md",onClick:()=>{eV(eS,"connect")},children:[(0,a.jsx)(x.A,{className:"h-4 w-4"}),"connect"===Q?"Connect command copied":"Copy connect command"]})}),(0,a.jsx)(O,{title:"Manual fallback",description:"Use a one-time code only if the browser claim flow cannot finish on the same machine.",command:eI,children:(0,a.jsx)("div",{className:"mt-4 rounded-[16px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-4 py-4",children:(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-[var(--vk-text-muted)]",children:"One-time code"}),(0,a.jsx)("div",{className:"mt-3 font-mono text-4xl font-semibold tracking-[0.18em] text-[var(--vk-text-strong)]",children:q??"------"}),(0,a.jsx)("div",{className:"mt-3 text-sm text-[var(--vk-text-muted)]",children:q?`Valid for about ${Math.max(1,Math.round((D??600)/60))} minutes.`:"Generate a code to reveal the manual pair command."})]}),(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"md",disabled:W||!eC,onClick:()=>{eD()},children:[W?(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(l.A,{className:"h-4 w-4"}),q?"Generate new code":"Generate code"]})]})}),footer:(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"md",disabled:!q||!eC,onClick:()=>{eV(eI,"manual")},children:["manual"===Q?(0,a.jsx)(m.A,{className:"h-4 w-4"}):(0,a.jsx)(x.A,{className:"h-4 w-4"}),"manual"===Q?"Manual command copied":"Copy manual command"]})})]}):null]})]}),(0,a.jsxs)(M,{children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(U,{children:"Devices"}),(0,a.jsx)("h2",{className:"mt-2 text-xl font-semibold text-[var(--vk-text-strong)]",children:"Paired devices"}),(0,a.jsx)("p",{className:"mt-2 text-sm leading-6 text-[var(--vk-text-muted)]",children:"Pick a laptop below, then continue into the dashboard with that device selected."})]}),(0,a.jsxs)(T,{children:[F.length," total"]})]}),eM?(0,a.jsx)("div",{className:"mt-5 rounded-[18px] border border-[var(--vk-border)] bg-[var(--vk-bg-main)] px-4 py-4",children:(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("div",{className:"text-base font-semibold text-[var(--vk-text-strong)]",children:eM.device_name}),(0,a.jsx)(k.J,{connected:eM.connected,title:`${eM.device_name} is ${eM.connected?"online":"offline"}`})]}),(0,a.jsx)("div",{className:"text-sm text-[var(--vk-text-muted)]",children:z(eM)}),ek.message&&ek.deviceId===eM.device_id?(0,a.jsxs)("div",{className:(0,$.cn)("flex flex-wrap items-center gap-2 text-xs leading-5","failed"===ek.phase?"text-[var(--vk-red)]":"skipped"===ek.phase?"text-[var(--vk-text-muted)]":"text-[var(--vk-text-faint)]"),children:[(0,a.jsx)("span",{className:"inline-flex items-center rounded-full border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--vk-text-muted)]",children:(0,_.qv)(ek.phase)}),(0,a.jsx)("span",{children:ek.message})]}):null,eN.message&&eN.deviceId===eM.device_id?(0,a.jsx)("div",{className:(0,$.cn)("text-xs leading-5","failed"===eN.status?"text-[var(--vk-red)]":"completed"===eN.status?"text-[var(--vk-green)]":"text-[var(--vk-text-faint)]"),children:eN.message}):null,eL?(0,a.jsx)(j.i,{deviceId:eM.device_id,deviceName:eM.device_name,dashboardUrl:s,installScriptUrl:v,relayUrl:r}):null,eM.connected?(0,a.jsxs)("div",{className:"flex w-full flex-wrap gap-2",children:[(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"md",disabled:eO||(0,_.xv)(ek,eM.device_id),onClick:()=>{eW(eM)},children:[eP?(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(u.A,{className:"h-4 w-4"}),"Repair bridge"]}),(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"md",disabled:(0,_.xv)(ek,eM.device_id)||eO,onClick:()=>{eH(eM)},children:[(0,_.xv)(ek,eM.device_id)?(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(g.A,{className:"h-4 w-4"}),(0,_.xv)(ek,eM.device_id)?"Updating...":"Update Conductor"]}),(0,a.jsx)(y.$,{asChild:!0,variant:"primary",size:"md",children:(0,a.jsxs)(n(),{href:`/?bridge=${encodeURIComponent(eM.device_id)}`,children:[(0,a.jsx)(d.A,{className:"h-4 w-4"}),"Continue with ",eM.device_name]})}),(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"md",disabled:eO||(0,_.xv)(ek,eM.device_id),onClick:()=>{eJ(eM)},children:[eF?(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(l.A,{className:"h-4 w-4"}),"Restart service"]})]}):(0,a.jsx)("div",{className:"text-sm text-[var(--vk-text-muted)]",children:"This laptop is paired, but it is not online right now."})]})}):null,(0,a.jsx)("div",{className:"mt-5 space-y-3",children:G?(0,a.jsxs)("div",{className:"flex items-center gap-3 rounded-[18px] border border-[var(--vk-border)] bg-[var(--vk-bg-main)] px-4 py-4 text-sm text-[var(--vk-text-muted)]",children:[(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin"}),"Loading paired devices..."]}):F.length>0?F.map(e=>{let t=eM?.device_id===e.device_id,s=(0,_.xv)(ek,e.device_id),i="running"===eN.status&&eN.deviceId===e.device_id,r=i&&"repair"===eN.kind,d=i&&"restart"===eN.kind;return(0,a.jsx)("div",{className:(0,$.cn)("rounded-[18px] border bg-[var(--vk-bg-main)] p-4",t?"border-[var(--vk-orange)]":"border-[var(--vk-border)]"),children:(0,a.jsxs)("div",{className:"flex flex-col gap-4 xl:flex-row xl:items-start xl:justify-between",children:[(0,a.jsxs)("button",{type:"button",className:"min-w-0 flex-1 text-left",onClick:()=>{ej(e.device_id)},children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("div",{className:"truncate text-base font-medium text-[var(--vk-text-strong)]",children:e.device_name}),(0,a.jsx)(k.J,{connected:e.connected,title:`${e.device_name} is ${e.connected?"online":"offline"}`}),t?(0,a.jsx)("span",{className:"rounded-full border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-2 py-1 text-[11px] text-[var(--vk-text-muted)]",children:"Selected"}):null]}),(0,a.jsx)("div",{className:"mt-2 text-sm text-[var(--vk-text-muted)]",children:z(e)}),(0,a.jsxs)("div",{className:"mt-1 text-xs text-[var(--vk-text-muted)]",children:["Relay: ",e.last_status?.hostname??e.hostname,(0,E.wj)(e.last_status?.version)]}),ek.message&&ek.deviceId===e.device_id?(0,a.jsxs)("div",{className:(0,$.cn)("mt-2 flex flex-wrap items-center gap-2 text-xs leading-5","failed"===ek.phase?"text-[var(--vk-red)]":"skipped"===ek.phase?"text-[var(--vk-text-muted)]":"text-[var(--vk-text-faint)]"),children:[(0,a.jsx)("span",{className:"inline-flex items-center rounded-full border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--vk-text-muted)]",children:(0,_.qv)(ek.phase)}),(0,a.jsx)("span",{children:ek.message})]}):null,eN.message&&eN.deviceId===e.device_id?(0,a.jsx)("div",{className:(0,$.cn)("mt-2 text-xs leading-5","failed"===eN.status?"text-[var(--vk-red)]":"completed"===eN.status?"text-[var(--vk-green)]":"text-[var(--vk-text-faint)]"),children:eN.message}):null]}),(0,a.jsxs)("div",{className:"flex w-full flex-wrap items-center gap-2 xl:w-auto xl:justify-end",children:[e.connected?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(y.$,{asChild:!0,variant:t?"primary":"outline",size:"md",children:(0,a.jsx)(n(),{href:`/?bridge=${encodeURIComponent(e.device_id)}`,children:t?"Continue":"Open"})}),(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"md",disabled:i||s,onClick:()=>{ej(e.device_id),eW(e)},children:[r?(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(u.A,{className:"h-4 w-4"}),"Repair"]}),(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"md",disabled:s||i,onClick:()=>{ej(e.device_id),eH(e)},children:[s?(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(g.A,{className:"h-4 w-4"}),s?"Updating...":"Update"]}),(0,a.jsxs)(y.$,{type:"button",variant:"outline",size:"md",disabled:i||s,onClick:()=>{ej(e.device_id),eJ(e)},children:[d?(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(l.A,{className:"h-4 w-4"}),"Restart"]})]}):(0,a.jsx)("span",{className:"text-xs text-[var(--vk-text-muted)]",children:"Offline"}),(0,a.jsx)(y.$,{type:"button",variant:"ghost",size:"icon",disabled:Y===e.device_id,onClick:()=>{eG(e.device_id)},"aria-label":`Revoke ${e.device_name}`,children:Y===e.device_id?(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(b,{className:"h-4 w-4"})})]})]})},e.device_id)}):(0,a.jsx)("div",{className:"rounded-[18px] border border-dashed border-[var(--vk-border)] bg-[var(--vk-bg-main)] px-4 py-6 text-sm text-[var(--vk-text-muted)]",children:"No laptops have been paired yet. Run the setup command on the laptop you want to use."})})]})]})]})}),et?(0,a.jsxs)("div",{className:"fixed inset-0 z-[85] flex items-start justify-center overflow-y-auto bg-black/70 px-3 py-3 sm:items-center sm:py-0",children:[(0,a.jsx)("button",{type:"button",className:"absolute inset-0","aria-label":"Close bridge terminal test",onClick:()=>{es(!1)}}),(0,a.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"bridge-test-title",className:"relative z-10 flex max-h-[92vh] w-full max-w-6xl flex-col overflow-hidden rounded-[24px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] shadow-[0_28px_80px_rgba(0,0,0,0.4)]",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-4 border-b border-[var(--vk-border)] px-5 py-5 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.24em] text-[var(--vk-text-muted)]",children:"Bridge terminal test"}),(0,a.jsx)("h2",{id:"bridge-test-title",className:"mt-2 text-xl font-semibold text-[var(--vk-text-strong)]",children:"Live session over Conductor Bridge"}),(0,a.jsx)("p",{className:"mt-2 max-w-2xl text-sm leading-6 text-[var(--vk-text-muted)]",children:ed?`${ed.projectId}${ed.branch?` \xb7 ${ed.branch}`:""}`:"Open a session here to verify terminal input and output through the bridge."})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)(k.J,{connected:eE.length>0,title:`${eE.length} connected device${1===eE.length?"":"s"}`}),(0,a.jsx)(y.$,{type:"button",variant:"ghost",size:"icon",onClick:()=>{es(!1)},"aria-label":"Close bridge test modal",children:(0,a.jsx)(f.A,{className:"h-4 w-4"})})]})]}),(0,a.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col px-5 py-5",children:[0===eE.length?(0,a.jsx)("div",{className:"mb-4 rounded-[18px] border border-[color:color-mix(in_srgb,var(--vk-red)_28%,transparent)] bg-[color:color-mix(in_srgb,var(--vk-red)_10%,transparent)] px-4 py-3 text-sm text-[var(--vk-text-muted)]",children:"No paired bridge reports as online right now. Reconnect a laptop to test the live terminal path."}):null,ea?(0,a.jsx)("div",{className:"flex min-h-[360px] flex-1 items-center justify-center rounded-[20px] border border-[var(--vk-border)] bg-[var(--vk-bg-main)] text-sm text-[var(--vk-text-muted)]",children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(c.A,{className:"h-4 w-4 animate-spin"}),"Preparing a session for the bridge test..."]})}):er?(0,a.jsx)("div",{className:"rounded-[20px] border border-[color:color-mix(in_srgb,var(--vk-red)_30%,transparent)] bg-[color:color-mix(in_srgb,var(--vk-red)_12%,transparent)] px-5 py-4 text-sm text-[var(--vk-red)]",children:er}):ed?(0,a.jsx)("div",{className:"min-h-[420px] flex-1 overflow-hidden rounded-[20px] border border-[var(--vk-border)] bg-[#060404]",children:(0,a.jsx)(N.SessionTerminal,{sessionId:ed.id,projectId:ed.projectId,bridgeId:ed.bridgeId,sessionState:ed.status,pendingInsert:null})}):(0,a.jsx)("div",{className:"rounded-[20px] border border-dashed border-[var(--vk-border)] bg-[var(--vk-bg-main)] px-5 py-10 text-sm text-[var(--vk-text-muted)]",children:"No session is available for bridge testing yet."})]})]})]}):null]})}},82767:(e,t,s)=>{Promise.resolve().then(s.t.bind(s,65587,23)),Promise.resolve().then(s.bind(s,69902)),Promise.resolve().then(s.bind(s,81677))}},e=>{e.O(0,[3357,5587,1455,1257,2175,9702,3954,587,1968,7358],()=>e(e.s=82767)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{4430:(e,r,t)=>{"use strict";t.d(r,{y:()=>n});var o=t(5974);let n=(0,o.createServerReference)("00249d3cbba183752317b04dee8c0881cc41d160a6",o.callServer,void 0,o.findSourceMapURL,"invalidateCacheAction")},24876:(e,r,t)=>{Promise.resolve().then(t.bind(t,37204)),Promise.resolve().then(t.bind(t,36727)),Promise.resolve().then(t.bind(t,76940)),Promise.resolve().then(t.bind(t,48914)),Promise.resolve().then(t.bind(t,30679)),Promise.resolve().then(t.bind(t,62520)),Promise.resolve().then(t.bind(t,93603)),Promise.resolve().then(t.t.bind(t,48477,23)),Promise.resolve().then(t.t.bind(t,91745,23)),Promise.resolve().then(t.t.bind(t,31008,23)),Promise.resolve().then(t.t.bind(t,78578,23)),Promise.resolve().then(t.t.bind(t,74471,23)),Promise.resolve().then(t.bind(t,48204)),Promise.resolve().then(t.bind(t,92690))},40490:(e,r,t)=>{"use strict";t.d(r,{A:()=>n});var o=t(5974);let n=(0,o.createServerReference)("002c7f1982bd171c8f20ed148dafe3714af9d1113e",o.callServer,void 0,o.findSourceMapURL,"detectKeylessEnvDriftAction")},46916:(e,r,t)=>{"use strict";t.d(r,{cn:()=>s});var o=t(9917),n=t(2809);function s(...e){return(0,n.QP)((0,o.$)(e))}},48204:(e,r,t)=>{"use strict";t.d(r,{ThemeProvider:()=>d});var o=t(54568),n=t(7620);let s=(0,n.createContext)({theme:"dark",toggleTheme:()=>{}});function i(e){let r=document.documentElement;r.classList.remove("dark","light"),r.classList.add(e)}function d({children:e}){let[r,t]=(0,n.useState)("dark");(0,n.useEffect)(()=>{let e=localStorage.getItem("conductor-theme");if("light"===e||"dark"===e){t(e),i(e);return}i("dark")},[]);let a=(0,n.useCallback)(()=>{t(e=>{let r="dark"===e?"light":"dark";return localStorage.setItem("conductor-theme",r),i(r),r})},[]);return(0,o.jsx)(s.Provider,{value:{theme:r,toggleTheme:a},children:e})}},74471:()=>{},92690:(e,r,t)=>{"use strict";t.d(r,{TooltipProvider:()=>d});var o=t(54568),n=t(97257),s=t(7620),i=t(46916);let d=n.Kq;n.bL,n.l9,(0,s.forwardRef)(({className:e,sideOffset:r=8,...t},s)=>(0,o.jsx)(n.ZL,{children:(0,o.jsx)(n.UC,{ref:s,sideOffset:r,className:(0,i.cn)("z-50 rounded-[var(--radius-xs)] border border-[var(--border-strong)] bg-[var(--bg-panel)] px-2 py-1.5","text-[11px] text-[var(--text-normal)] shadow-[var(--shadow-soft)]","animate-in fade-in-0 zoom-in-95",e),...t})})).displayName="TooltipContent"}},e=>{e.O(0,[7547,3357,524,1455,7220,587,1968,7358],()=>e(e.s=24876)),_N_E=e.O()}]);