viba-cli 0.8.0 → 0.10.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.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +2 -2
- package/.next/fallback-build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/app/_global-error.html +2 -2
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +2 -2
- package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +3 -3
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/new/page/server-reference-manifest.json +23 -23
- package/.next/server/app/new/page.js.nft.json +1 -1
- package/.next/server/app/new/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page/server-reference-manifest.json +23 -23
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/session/[sessionId]/page/server-reference-manifest.json +49 -34
- package/.next/server/app/session/[sessionId]/page.js +1 -1
- package/.next/server/app/session/[sessionId]/page.js.nft.json +1 -1
- package/.next/server/app/session/[sessionId]/page_client-reference-manifest.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__41b2f23a._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__41b2f23a._.js.map +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__528f3aa4._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__528f3aa4._.js.map +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__58bd04dc._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__58bd04dc._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__8174ed94._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__8174ed94._.js.map +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__f1bfaf02._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__f1bfaf02._.js.map +1 -1
- package/.next/server/chunks/ssr/{_782ca804._.js → _08dd3275._.js} +2 -2
- package/.next/server/chunks/ssr/{_782ca804._.js.map → _08dd3275._.js.map} +1 -1
- package/.next/server/chunks/ssr/{_44154301._.js → _44d5ffaf._.js} +2 -2
- package/.next/server/chunks/ssr/{_44154301._.js.map → _44d5ffaf._.js.map} +1 -1
- package/.next/server/chunks/ssr/{_3819cc0f._.js → _ff97e528._.js} +3 -3
- package/.next/server/chunks/ssr/{_3819cc0f._.js.map → _ff97e528._.js.map} +1 -1
- package/.next/server/chunks/ssr/src_app_session_[sessionId]_SessionPageClient_tsx_dab490d7._.js +2 -2
- package/.next/server/chunks/ssr/src_app_session_[sessionId]_SessionPageClient_tsx_dab490d7._.js.map +1 -1
- package/.next/server/chunks/ssr/src_components_GitRepoSelector_tsx_05c81afa._.js +1 -1
- package/.next/server/chunks/ssr/src_components_GitRepoSelector_tsx_05c81afa._.js.map +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +2 -2
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +68 -53
- package/.next/static/chunks/{f61d984b4435e61d.js → 26901e06414f205a.js} +2 -2
- package/.next/static/chunks/{6dfe6be0458c7506.js → 30acc0edfefa701e.js} +3 -3
- package/.next/static/chunks/418d3ae7813c92a6.js +3 -0
- package/.next/static/chunks/{8cc2a20e51da8dab.js → c304cff31afa933b.js} +2 -2
- package/.next/static/chunks/{800bdfe84e30a5fa.js → c4c5ade157263dd3.js} +1 -1
- package/.next/static/chunks/dc895d87368362da.css +3 -0
- package/package.json +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__36769160._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__36769160._.js.map +0 -1
- package/.next/static/chunks/7611b8b4cbbc4eb6.css +0 -3
- package/.next/static/chunks/d57d32332080776c.js +0 -3
- /package/.next/static/{Xe9W13zKv2qP1o6wN_YEA → XmzmXy1KkOkxyR6sw4pB0}/_buildManifest.js +0 -0
- /package/.next/static/{Xe9W13zKv2qP1o6wN_YEA → XmzmXy1KkOkxyR6sw4pB0}/_clientMiddlewareManifest.json +0 -0
- /package/.next/static/{Xe9W13zKv2qP1o6wN_YEA → XmzmXy1KkOkxyR6sw4pB0}/_ssgManifest.js +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,33525,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"warnOnce",{enumerable:!0,get:function(){return i}});let i=e=>{}},35027,e=>{e.v([{name:"Codex",cli:"codex",description:"OpenAI's specialized models for agentic coding and deep reasoning.",models:[{id:"gpt-5.3-codex",label:"GPT-5.3 Codex",description:"Latest frontier agentic coding model."},{id:"gpt-5.2-codex",label:"GPT-5.2 Codex",description:"Frontier agentic coding model."},{id:"gpt-5.1-codex-max",label:"GPT-5.1 Codex Max",description:"Codex-optimized flagship for deep and fast reasoning."},{id:"gpt-5.2",label:"GPT-5.2",description:"Latest frontier model with improvements across knowledge, reasoning and coding"},{id:"gpt-5.1-codex-mini",label:"GPT-5.1 Codex Mini",description:"Optimized for codex. Cheaper, faster, but less capable."}]},{name:"Gemini",cli:"gemini",description:"Google's powerful multimodal models with large context windows.",models:[{id:"gemini-3-pro-preview",label:"Gemini 3 Pro Preview",description:"Google's most capable model for complex reasoning and coding tasks."},{id:"gemini-3-flash-preview",label:"Gemini 3 Flash Preview",description:"Fast and efficient model optimized for speed and low latency."},{id:"gemini-2.5-pro",label:"Gemini 2.5 Pro",description:"High-performance model with excellent reasoning capabilities."},{id:"gemini-2.5-flash",label:"Gemini 2.5 Flash",description:"Streamlined model for quick responses and iterative tasks."},{id:"gemini-2.5-flash-lite",label:"Gemini 2.5 Flash Lite",description:"Optimized for extreme speed and cost efficiency."}]},{name:"Cursor Agent",cli:"agent",description:"Integrated agentic experience powered by Claude and GPT models.",models:[{id:"auto",label:"Auto"},{id:"composer-1.5",label:"Composer 1.5"},{id:"composer-1",label:"Composer 1"},{id:"gpt-5.3-codex",label:"GPT-5.3 Codex"},{id:"gpt-5.3-codex-low",label:"GPT-5.3 Codex Low"},{id:"gpt-5.3-codex-high",label:"GPT-5.3 Codex High"},{id:"gpt-5.3-codex-xhigh",label:"GPT-5.3 Codex Extra High"},{id:"gpt-5.3-codex-fast",label:"GPT-5.3 Codex Fast"},{id:"gpt-5.3-codex-low-fast",label:"GPT-5.3 Codex Low Fast"},{id:"gpt-5.3-codex-high-fast",label:"GPT-5.3 Codex High Fast"},{id:"gpt-5.3-codex-xhigh-fast",label:"GPT-5.3 Codex Extra High Fast"},{id:"gpt-5.2",label:"GPT-5.2"},{id:"gpt-5.2-codex",label:"GPT-5.2 Codex"},{id:"gpt-5.2-codex-high",label:"GPT-5.2 Codex High"},{id:"gpt-5.2-codex-low",label:"GPT-5.2 Codex Low"},{id:"gpt-5.2-codex-xhigh",label:"GPT-5.2 Codex Extra High"},{id:"gpt-5.2-codex-fast",label:"GPT-5.2 Codex Fast"},{id:"gpt-5.2-codex-high-fast",label:"GPT-5.2 Codex High Fast"},{id:"gpt-5.2-codex-low-fast",label:"GPT-5.2 Codex Low Fast"},{id:"gpt-5.2-codex-xhigh-fast",label:"GPT-5.2 Codex Extra High Fast"},{id:"gpt-5.1-codex-max",label:"GPT-5.1 Codex Max"},{id:"gpt-5.1-codex-max-high",label:"GPT-5.1 Codex Max High"},{id:"opus-4.6-thinking",label:"Claude 4.6 Opus (Thinking) (default)"},{id:"sonnet-4.5-thinking",label:"Claude 4.5 Sonnet (Thinking)"},{id:"gpt-5.2-high",label:"GPT-5.2 High"},{id:"opus-4.6",label:"Claude 4.6 Opus"},{id:"opus-4.5",label:"Claude 4.5 Opus"},{id:"opus-4.5-thinking",label:"Claude 4.5 Opus (Thinking)"},{id:"sonnet-4.5",label:"Claude 4.5 Sonnet"},{id:"gpt-5.1-high",label:"GPT-5.1 High"},{id:"gemini-3-pro",label:"Gemini 3 Pro"},{id:"gemini-3-flash",label:"Gemini 3 Flash"},{id:"grok",label:"Grok"}]}])},75254,e=>{"use strict";var t=e.i(71645);let r=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),i=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)};var n={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let a=(0,t.forwardRef)(({color:e="currentColor",size:i=24,strokeWidth:a=2,absoluteStrokeWidth:o,className:l="",children:s,iconNode:d,...u},c)=>(0,t.createElement)("svg",{ref:c,...n,width:i,height:i,stroke:e,strokeWidth:o?24*Number(a)/Number(i):a,className:r("lucide",l),...!s&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(u)&&{"aria-hidden":"true"},...u},[...d.map(([e,r])=>(0,t.createElement)(e,r)),...Array.isArray(s)?s:[s]])),o=(e,n)=>{let o=(0,t.forwardRef)(({className:o,...l},s)=>(0,t.createElement)(a,{ref:s,iconNode:n,className:r(`lucide-${i(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,o),...l}));return o.displayName=i(e),o};e.s(["default",()=>o],75254)},55716,7233,e=>{"use strict";var t=e.i(75254);let r=(0,t.default)("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);e.s(["GitBranch",()=>r],55716);let i=(0,t.default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["Plus",()=>i],7233)},27612,31343,e=>{"use strict";var t=e.i(75254);let r=(0,t.default)("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"}]]);e.s(["Trash2",()=>r],27612);let i=(0,t.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);e.s(["Play",()=>i],31343)},95187,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i={callServer:function(){return a.callServer},createServerReference:function(){return l.createServerReference},findSourceMapURL:function(){return o.findSourceMapURL}};for(var n in i)Object.defineProperty(r,n,{enumerable:!0,get:i[n]});let a=e.r(32120),o=e.r(92245),l=e.r(35326)},8043,e=>{"use strict";var t=e.i(95187);let r=(0,t.createServerReference)("00b2f585aab02de15106087cb132626fb625c0db26",t.callServer,void 0,t.findSourceMapURL,"getHomeDirectory");e.s(["getHomeDirectory",()=>r])},27025,e=>{"use strict";let t=(0,e.i(75254).default)("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);e.s(["Folder",()=>t],27025)},71689,e=>{"use strict";let t=(0,e.i(75254).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",()=>t],71689)},81016,e=>{"use strict";function t(e){return e&&e.replace(/\\/g,"/").split("/").filter(Boolean).pop()||""}function r(e){if(!e)return"";let t=e.replace(/\\/g,"/"),r=t.length>1&&t.endsWith("/")?t.slice(0,-1):t,i=r.lastIndexOf("/");return -1===i?e.includes(":")&&e.length<=3?e:".":0===i?"/":e.includes(":")&&2===i?r.substring(0,3):r.substring(0,i)}e.s(["getBaseName",()=>t,"getDirName",()=>r])},56382,e=>{"use strict";var t=e.i(95187);let r=(0,t.createServerReference)("7f76c1c5fa2a2a8ac1ef4cd8262e536b2376830e89",t.callServer,void 0,t.findSourceMapURL,"startTtydProcess");e.s(["startTtydProcess",()=>r])},73708,e=>{"use strict";var t=e.i(95187);let r=(0,t.createServerReference)("7ffb2975f419e7c26bdfb7b886d1a926fa4e634448",t.callServer,void 0,t.findSourceMapURL,"saveAttachments");e.s(["saveAttachments",()=>r])},11607,78669,e=>{"use strict";var t=e.i(95187);let r=(0,t.createServerReference)("003408daf503f563bd7702d8eae85f3b1294f2f284",t.callServer,void 0,t.findSourceMapURL,"getConfig");e.s(["getConfig",()=>r],11607);let i=(0,t.createServerReference)("40146ea4475c4e00f7633055de4ed6516650b2e88c",t.callServer,void 0,t.findSourceMapURL,"updateConfig");e.s(["updateConfig",()=>i],78669)},18566,(e,t,r)=>{t.exports=e.r(76562)},63671,e=>{"use strict";let t="viba:sessions-updated-at",r="viba:sessions-updated";function i(){try{localStorage.setItem(t,new Date().toISOString())}catch{}window.dispatchEvent(new CustomEvent(r))}e.s(["SESSIONS_UPDATED_EVENT",0,r,"SESSIONS_UPDATED_STORAGE_KEY",0,t,"notifySessionsUpdated",()=>i])},88143,(e,t,r)=>{"use strict";function i({widthInt:e,heightInt:t,blurWidth:r,blurHeight:i,blurDataURL:n,objectFit:a}){let o=r?40*r:e,l=i?40*i:t,s=o&&l?`viewBox='0 0 ${o} ${l}'`:"";return`%3Csvg xmlns='http://www.w3.org/2000/svg' ${s}%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='${s?"none":"contain"===a?"xMidYMid":"cover"===a?"xMidYMid slice":"none"}' style='filter: url(%23b);' href='${n}'/%3E%3C/svg%3E`}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"getImageBlurSvg",{enumerable:!0,get:function(){return i}})},87690,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i={VALID_LOADERS:function(){return a},imageConfigDefault:function(){return o}};for(var n in i)Object.defineProperty(r,n,{enumerable:!0,get:i[n]});let a=["default","imgix","cloudinary","akamai","custom"],o={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],path:"/_next/image",loader:"default",loaderFile:"",domains:[],disableStaticImages:!1,minimumCacheTTL:14400,formats:["image/webp"],maximumRedirects:3,maximumResponseBody:5e7,dangerouslyAllowLocalIP:!1,dangerouslyAllowSVG:!1,contentSecurityPolicy:"script-src 'none'; frame-src 'none'; sandbox;",contentDispositionType:"attachment",localPatterns:void 0,remotePatterns:[],qualities:[75],unoptimized:!1}},8927,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"getImgProps",{enumerable:!0,get:function(){return d}}),e.r(33525);let i=e.r(43369),n=e.r(88143),a=e.r(87690),o=["-moz-initial","fill","none","scale-down",void 0];function l(e){return void 0!==e.default}function s(e){return void 0===e?e:"number"==typeof e?Number.isFinite(e)?e:NaN:"string"==typeof e&&/^[0-9]+$/.test(e)?parseInt(e,10):NaN}function d({src:e,sizes:t,unoptimized:r=!1,priority:d=!1,preload:u=!1,loading:c,className:f,quality:p,width:g,height:m,fill:h=!1,style:b,overrideSrc:y,onLoad:v,onLoadingComplete:x,placeholder:w="empty",blurDataURL:P,fetchPriority:_,decoding:C="async",layout:S,objectFit:O,objectPosition:j,lazyBoundary:E,lazyRoot:R,...M},T){var k;let G,z,I,{imgConf:A,showAltText:L,blurComplete:D,defaultLoader:$}=T,F=A||a.imageConfigDefault;if("allSizes"in F)G=F;else{let e=[...F.deviceSizes,...F.imageSizes].sort((e,t)=>e-t),t=F.deviceSizes.sort((e,t)=>e-t),r=F.qualities?.sort((e,t)=>e-t);G={...F,allSizes:e,deviceSizes:t,qualities:r}}if(void 0===$)throw Object.defineProperty(Error("images.loaderFile detected but the file is missing default export.\nRead more: https://nextjs.org/docs/messages/invalid-images-config"),"__NEXT_ERROR_CODE",{value:"E163",enumerable:!1,configurable:!0});let U=M.loader||$;delete M.loader,delete M.srcSet;let N="__next_img_default"in U;if(N){if("custom"===G.loader)throw Object.defineProperty(Error(`Image with src "${e}" is missing "loader" prop.
|
|
2
|
-
Read more: https://nextjs.org/docs/messages/next-image-missing-loader`),"__NEXT_ERROR_CODE",{value:"E252",enumerable:!1,configurable:!0})}else{let e=U;U=t=>{let{config:r,...i}=t;return e(i)}}if(S){"fill"===S&&(h=!0);let e={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[S];e&&(b={...b,...e});let r={responsive:"100vw",fill:"100vw"}[S];r&&!t&&(t=r)}let H="",q=s(g),B=s(m);if((k=e)&&"object"==typeof k&&(l(k)||void 0!==k.src)){let t=l(e)?e.default:e;if(!t.src)throw Object.defineProperty(Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ${JSON.stringify(t)}`),"__NEXT_ERROR_CODE",{value:"E460",enumerable:!1,configurable:!0});if(!t.height||!t.width)throw Object.defineProperty(Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ${JSON.stringify(t)}`),"__NEXT_ERROR_CODE",{value:"E48",enumerable:!1,configurable:!0});if(z=t.blurWidth,I=t.blurHeight,P=P||t.blurDataURL,H=t.src,!h)if(q||B){if(q&&!B){let e=q/t.width;B=Math.round(t.height*e)}else if(!q&&B){let e=B/t.height;q=Math.round(t.width*e)}}else q=t.width,B=t.height}let W=!d&&!u&&("lazy"===c||void 0===c);(!(e="string"==typeof e?e:H)||e.startsWith("data:")||e.startsWith("blob:"))&&(r=!0,W=!1),G.unoptimized&&(r=!0),N&&!G.dangerouslyAllowSVG&&e.split("?",1)[0].endsWith(".svg")&&(r=!0);let V=s(p),X=Object.assign(h?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:O,objectPosition:j}:{},L?{}:{color:"transparent"},b),K=D||"empty"===w?null:"blur"===w?`url("data:image/svg+xml;charset=utf-8,${(0,
|
|
3
|
-
Read more: https://nextjs.org/docs/messages/next-image-unconfigured-localpatterns`),"__NEXT_ERROR_CODE",{value:"E871",enumerable:!1,configurable:!0});let o=(0,i.findClosestQuality)(
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,33525,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"warnOnce",{enumerable:!0,get:function(){return i}});let i=e=>{}},35027,e=>{e.v([{name:"Codex",cli:"codex",description:"OpenAI's specialized models for agentic coding and deep reasoning.",models:[{id:"gpt-5.3-codex",label:"GPT-5.3 Codex",description:"Latest frontier agentic coding model."},{id:"gpt-5.2-codex",label:"GPT-5.2 Codex",description:"Frontier agentic coding model."},{id:"gpt-5.1-codex-max",label:"GPT-5.1 Codex Max",description:"Codex-optimized flagship for deep and fast reasoning."},{id:"gpt-5.2",label:"GPT-5.2",description:"Latest frontier model with improvements across knowledge, reasoning and coding"},{id:"gpt-5.1-codex-mini",label:"GPT-5.1 Codex Mini",description:"Optimized for codex. Cheaper, faster, but less capable."}]},{name:"Gemini",cli:"gemini",description:"Google's powerful multimodal models with large context windows.",models:[{id:"gemini-3-pro-preview",label:"Gemini 3 Pro Preview",description:"Google's most capable model for complex reasoning and coding tasks."},{id:"gemini-3-flash-preview",label:"Gemini 3 Flash Preview",description:"Fast and efficient model optimized for speed and low latency."},{id:"gemini-2.5-pro",label:"Gemini 2.5 Pro",description:"High-performance model with excellent reasoning capabilities."},{id:"gemini-2.5-flash",label:"Gemini 2.5 Flash",description:"Streamlined model for quick responses and iterative tasks."},{id:"gemini-2.5-flash-lite",label:"Gemini 2.5 Flash Lite",description:"Optimized for extreme speed and cost efficiency."}]},{name:"Cursor Agent",cli:"agent",description:"Integrated agentic experience powered by Claude and GPT models.",models:[{id:"auto",label:"Auto"},{id:"composer-1.5",label:"Composer 1.5"},{id:"composer-1",label:"Composer 1"},{id:"gpt-5.3-codex",label:"GPT-5.3 Codex"},{id:"gpt-5.3-codex-low",label:"GPT-5.3 Codex Low"},{id:"gpt-5.3-codex-high",label:"GPT-5.3 Codex High"},{id:"gpt-5.3-codex-xhigh",label:"GPT-5.3 Codex Extra High"},{id:"gpt-5.3-codex-fast",label:"GPT-5.3 Codex Fast"},{id:"gpt-5.3-codex-low-fast",label:"GPT-5.3 Codex Low Fast"},{id:"gpt-5.3-codex-high-fast",label:"GPT-5.3 Codex High Fast"},{id:"gpt-5.3-codex-xhigh-fast",label:"GPT-5.3 Codex Extra High Fast"},{id:"gpt-5.2",label:"GPT-5.2"},{id:"gpt-5.2-codex",label:"GPT-5.2 Codex"},{id:"gpt-5.2-codex-high",label:"GPT-5.2 Codex High"},{id:"gpt-5.2-codex-low",label:"GPT-5.2 Codex Low"},{id:"gpt-5.2-codex-xhigh",label:"GPT-5.2 Codex Extra High"},{id:"gpt-5.2-codex-fast",label:"GPT-5.2 Codex Fast"},{id:"gpt-5.2-codex-high-fast",label:"GPT-5.2 Codex High Fast"},{id:"gpt-5.2-codex-low-fast",label:"GPT-5.2 Codex Low Fast"},{id:"gpt-5.2-codex-xhigh-fast",label:"GPT-5.2 Codex Extra High Fast"},{id:"gpt-5.1-codex-max",label:"GPT-5.1 Codex Max"},{id:"gpt-5.1-codex-max-high",label:"GPT-5.1 Codex Max High"},{id:"opus-4.6-thinking",label:"Claude 4.6 Opus (Thinking) (default)"},{id:"sonnet-4.5-thinking",label:"Claude 4.5 Sonnet (Thinking)"},{id:"gpt-5.2-high",label:"GPT-5.2 High"},{id:"opus-4.6",label:"Claude 4.6 Opus"},{id:"opus-4.5",label:"Claude 4.5 Opus"},{id:"opus-4.5-thinking",label:"Claude 4.5 Opus (Thinking)"},{id:"sonnet-4.5",label:"Claude 4.5 Sonnet"},{id:"gpt-5.1-high",label:"GPT-5.1 High"},{id:"gemini-3-pro",label:"Gemini 3 Pro"},{id:"gemini-3-flash",label:"Gemini 3 Flash"},{id:"grok",label:"Grok"}]}])},75254,e=>{"use strict";var t=e.i(71645);let r=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),i=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)};var a={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let n=(0,t.forwardRef)(({color:e="currentColor",size:i=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:l="",children:s,iconNode:d,...u},c)=>(0,t.createElement)("svg",{ref:c,...a,width:i,height:i,stroke:e,strokeWidth:o?24*Number(n)/Number(i):n,className:r("lucide",l),...!s&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(u)&&{"aria-hidden":"true"},...u},[...d.map(([e,r])=>(0,t.createElement)(e,r)),...Array.isArray(s)?s:[s]])),o=(e,a)=>{let o=(0,t.forwardRef)(({className:o,...l},s)=>(0,t.createElement)(n,{ref:s,iconNode:a,className:r(`lucide-${i(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,o),...l}));return o.displayName=i(e),o};e.s(["default",()=>o],75254)},55716,7233,e=>{"use strict";var t=e.i(75254);let r=(0,t.default)("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);e.s(["GitBranch",()=>r],55716);let i=(0,t.default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["Plus",()=>i],7233)},27612,31343,e=>{"use strict";var t=e.i(75254);let r=(0,t.default)("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"}]]);e.s(["Trash2",()=>r],27612);let i=(0,t.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);e.s(["Play",()=>i],31343)},95187,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i={callServer:function(){return n.callServer},createServerReference:function(){return l.createServerReference},findSourceMapURL:function(){return o.findSourceMapURL}};for(var a in i)Object.defineProperty(r,a,{enumerable:!0,get:i[a]});let n=e.r(32120),o=e.r(92245),l=e.r(35326)},79799,e=>{"use strict";var t=e.i(95187);let r=(0,t.createServerReference)("00345dad8414d3b6965f6affc2b493877ccad02add",t.callServer,void 0,t.findSourceMapURL,"getHomeDirectory");e.s(["getHomeDirectory",()=>r])},27025,e=>{"use strict";let t=(0,e.i(75254).default)("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);e.s(["Folder",()=>t],27025)},71689,e=>{"use strict";let t=(0,e.i(75254).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",()=>t],71689)},81016,e=>{"use strict";function t(e){return e&&e.replace(/\\/g,"/").split("/").filter(Boolean).pop()||""}function r(e){if(!e)return"";let t=e.replace(/\\/g,"/"),r=t.length>1&&t.endsWith("/")?t.slice(0,-1):t,i=r.lastIndexOf("/");return -1===i?e.includes(":")&&e.length<=3?e:".":0===i?"/":e.includes(":")&&2===i?r.substring(0,3):r.substring(0,i)}e.s(["getBaseName",()=>t,"getDirName",()=>r])},59119,e=>{"use strict";var t=e.i(95187);let r=(0,t.createServerReference)("7f0ea4ea9b37aac6ce656d36bdb84e85f7dd27e834",t.callServer,void 0,t.findSourceMapURL,"startTtydProcess");e.s(["startTtydProcess",()=>r])},84545,e=>{"use strict";var t=e.i(95187);let r=(0,t.createServerReference)("7f06d8ab4b89ecfb52d33d3ff54d41480e9ef2f454",t.callServer,void 0,t.findSourceMapURL,"saveAttachments");e.s(["saveAttachments",()=>r])},94520,93958,e=>{"use strict";var t=e.i(95187);let r=(0,t.createServerReference)("00280976a7ada27f603951a1c851e602aa64fba4a0",t.callServer,void 0,t.findSourceMapURL,"getConfig");e.s(["getConfig",()=>r],94520);let i=(0,t.createServerReference)("403e8923ba51b81fafb6786ea056f30cffe7d68de0",t.callServer,void 0,t.findSourceMapURL,"updateConfig");e.s(["updateConfig",()=>i],93958)},18566,(e,t,r)=>{t.exports=e.r(76562)},63671,e=>{"use strict";let t="viba:sessions-updated-at",r="viba:sessions-updated";function i(){try{localStorage.setItem(t,new Date().toISOString())}catch{}window.dispatchEvent(new CustomEvent(r))}e.s(["SESSIONS_UPDATED_EVENT",0,r,"SESSIONS_UPDATED_STORAGE_KEY",0,t,"notifySessionsUpdated",()=>i])},88143,(e,t,r)=>{"use strict";function i({widthInt:e,heightInt:t,blurWidth:r,blurHeight:i,blurDataURL:a,objectFit:n}){let o=r?40*r:e,l=i?40*i:t,s=o&&l?`viewBox='0 0 ${o} ${l}'`:"";return`%3Csvg xmlns='http://www.w3.org/2000/svg' ${s}%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='${s?"none":"contain"===n?"xMidYMid":"cover"===n?"xMidYMid slice":"none"}' style='filter: url(%23b);' href='${a}'/%3E%3C/svg%3E`}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"getImageBlurSvg",{enumerable:!0,get:function(){return i}})},87690,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i={VALID_LOADERS:function(){return n},imageConfigDefault:function(){return o}};for(var a in i)Object.defineProperty(r,a,{enumerable:!0,get:i[a]});let n=["default","imgix","cloudinary","akamai","custom"],o={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],path:"/_next/image",loader:"default",loaderFile:"",domains:[],disableStaticImages:!1,minimumCacheTTL:14400,formats:["image/webp"],maximumRedirects:3,maximumResponseBody:5e7,dangerouslyAllowLocalIP:!1,dangerouslyAllowSVG:!1,contentSecurityPolicy:"script-src 'none'; frame-src 'none'; sandbox;",contentDispositionType:"attachment",localPatterns:void 0,remotePatterns:[],qualities:[75],unoptimized:!1}},8927,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"getImgProps",{enumerable:!0,get:function(){return d}}),e.r(33525);let i=e.r(43369),a=e.r(88143),n=e.r(87690),o=["-moz-initial","fill","none","scale-down",void 0];function l(e){return void 0!==e.default}function s(e){return void 0===e?e:"number"==typeof e?Number.isFinite(e)?e:NaN:"string"==typeof e&&/^[0-9]+$/.test(e)?parseInt(e,10):NaN}function d({src:e,sizes:t,unoptimized:r=!1,priority:d=!1,preload:u=!1,loading:c,className:f,quality:p,width:g,height:m,fill:h=!1,style:b,overrideSrc:y,onLoad:v,onLoadingComplete:x,placeholder:w="empty",blurDataURL:P,fetchPriority:_,decoding:C="async",layout:S,objectFit:O,objectPosition:j,lazyBoundary:E,lazyRoot:R,...M},T){var k;let G,z,I,{imgConf:A,showAltText:L,blurComplete:D,defaultLoader:$}=T,F=A||n.imageConfigDefault;if("allSizes"in F)G=F;else{let e=[...F.deviceSizes,...F.imageSizes].sort((e,t)=>e-t),t=F.deviceSizes.sort((e,t)=>e-t),r=F.qualities?.sort((e,t)=>e-t);G={...F,allSizes:e,deviceSizes:t,qualities:r}}if(void 0===$)throw Object.defineProperty(Error("images.loaderFile detected but the file is missing default export.\nRead more: https://nextjs.org/docs/messages/invalid-images-config"),"__NEXT_ERROR_CODE",{value:"E163",enumerable:!1,configurable:!0});let U=M.loader||$;delete M.loader,delete M.srcSet;let N="__next_img_default"in U;if(N){if("custom"===G.loader)throw Object.defineProperty(Error(`Image with src "${e}" is missing "loader" prop.
|
|
2
|
+
Read more: https://nextjs.org/docs/messages/next-image-missing-loader`),"__NEXT_ERROR_CODE",{value:"E252",enumerable:!1,configurable:!0})}else{let e=U;U=t=>{let{config:r,...i}=t;return e(i)}}if(S){"fill"===S&&(h=!0);let e={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[S];e&&(b={...b,...e});let r={responsive:"100vw",fill:"100vw"}[S];r&&!t&&(t=r)}let H="",q=s(g),B=s(m);if((k=e)&&"object"==typeof k&&(l(k)||void 0!==k.src)){let t=l(e)?e.default:e;if(!t.src)throw Object.defineProperty(Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ${JSON.stringify(t)}`),"__NEXT_ERROR_CODE",{value:"E460",enumerable:!1,configurable:!0});if(!t.height||!t.width)throw Object.defineProperty(Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ${JSON.stringify(t)}`),"__NEXT_ERROR_CODE",{value:"E48",enumerable:!1,configurable:!0});if(z=t.blurWidth,I=t.blurHeight,P=P||t.blurDataURL,H=t.src,!h)if(q||B){if(q&&!B){let e=q/t.width;B=Math.round(t.height*e)}else if(!q&&B){let e=B/t.height;q=Math.round(t.width*e)}}else q=t.width,B=t.height}let W=!d&&!u&&("lazy"===c||void 0===c);(!(e="string"==typeof e?e:H)||e.startsWith("data:")||e.startsWith("blob:"))&&(r=!0,W=!1),G.unoptimized&&(r=!0),N&&!G.dangerouslyAllowSVG&&e.split("?",1)[0].endsWith(".svg")&&(r=!0);let V=s(p),X=Object.assign(h?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:O,objectPosition:j}:{},L?{}:{color:"transparent"},b),K=D||"empty"===w?null:"blur"===w?`url("data:image/svg+xml;charset=utf-8,${(0,a.getImageBlurSvg)({widthInt:q,heightInt:B,blurWidth:z,blurHeight:I,blurDataURL:P||"",objectFit:X.objectFit})}")`:`url("${w}")`,Y=o.includes(X.objectFit)?"fill"===X.objectFit?"100% 100%":"cover":X.objectFit,Z=K?{backgroundSize:Y,backgroundPosition:X.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:K}:{},J=function({config:e,src:t,unoptimized:r,width:a,quality:n,sizes:o,loader:l}){if(r){let e=(0,i.getDeploymentId)();if(t.startsWith("/")&&!t.startsWith("//")&&e){let r=t.includes("?")?"&":"?";t=`${t}${r}dpl=${e}`}return{src:t,srcSet:void 0,sizes:void 0}}let{widths:s,kind:d}=function({deviceSizes:e,allSizes:t},r,i){if(i){let r=/(^|\s)(1?\d?\d)vw/g,a=[];for(let e;e=r.exec(i);)a.push(parseInt(e[2]));if(a.length){let r=.01*Math.min(...a);return{widths:t.filter(t=>t>=e[0]*r),kind:"w"}}return{widths:t,kind:"w"}}return"number"!=typeof r?{widths:e,kind:"w"}:{widths:[...new Set([r,2*r].map(e=>t.find(t=>t>=e)||t[t.length-1]))],kind:"x"}}(e,a,o),u=s.length-1;return{sizes:o||"w"!==d?o:"100vw",srcSet:s.map((r,i)=>`${l({config:e,src:t,quality:n,width:r})} ${"w"===d?r:i+1}${d}`).join(", "),src:l({config:e,src:t,quality:n,width:s[u]})}}({config:G,src:e,unoptimized:r,width:q,quality:V,sizes:t,loader:U}),Q=W?"lazy":c;return{props:{...M,loading:Q,fetchPriority:_,width:q,height:B,decoding:C,className:f,style:{...X,...Z},sizes:J.sizes,srcSet:J.srcSet,src:y||J.src},meta:{unoptimized:r,preload:u||d,placeholder:w,fill:h}}}},98879,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return l}});let i=e.r(71645),a="u"<typeof window,n=a?()=>{}:i.useLayoutEffect,o=a?()=>{}:i.useEffect;function l(e){let{headManager:t,reduceComponentsToState:r}=e;function l(){if(t&&t.mountedInstances){let e=i.Children.toArray(Array.from(t.mountedInstances).filter(Boolean));t.updateHead(r(e))}}return a&&(t?.mountedInstances?.add(e.children),l()),n(()=>(t?.mountedInstances?.add(e.children),()=>{t?.mountedInstances?.delete(e.children)})),n(()=>(t&&(t._pendingUpdate=l),()=>{t&&(t._pendingUpdate=l)})),o(()=>(t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null),()=>{t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null)})),null}},25633,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i={default:function(){return m},defaultHead:function(){return c}};for(var a in i)Object.defineProperty(r,a,{enumerable:!0,get:i[a]});let n=e.r(55682),o=e.r(90809),l=e.r(43476),s=o._(e.r(71645)),d=n._(e.r(98879)),u=e.r(42732);function c(){return[(0,l.jsx)("meta",{charSet:"utf-8"},"charset"),(0,l.jsx)("meta",{name:"viewport",content:"width=device-width"},"viewport")]}function f(e,t){return"string"==typeof t||"number"==typeof t?e:t.type===s.default.Fragment?e.concat(s.default.Children.toArray(t.props.children).reduce((e,t)=>"string"==typeof t||"number"==typeof t?e:e.concat(t),[])):e.concat(t)}e.r(33525);let p=["name","httpEquiv","charSet","itemProp"];function g(e){let t,r,i,a;return e.reduce(f,[]).reverse().concat(c().reverse()).filter((t=new Set,r=new Set,i=new Set,a={},e=>{let n=!0,o=!1;if(e.key&&"number"!=typeof e.key&&e.key.indexOf("$")>0){o=!0;let r=e.key.slice(e.key.indexOf("$")+1);t.has(r)?n=!1:t.add(r)}switch(e.type){case"title":case"base":r.has(e.type)?n=!1:r.add(e.type);break;case"meta":for(let t=0,r=p.length;t<r;t++){let r=p[t];if(e.props.hasOwnProperty(r))if("charSet"===r)i.has(r)?n=!1:i.add(r);else{let t=e.props[r],i=a[r]||new Set;("name"!==r||!o)&&i.has(t)?n=!1:(i.add(t),a[r]=i)}}}return n})).reverse().map((e,t)=>{let r=e.key||t;return s.default.cloneElement(e,{key:r})})}let m=function({children:e}){let t=(0,s.useContext)(u.HeadManagerContext);return(0,l.jsx)(d.default,{reduceComponentsToState:g,headManager:t,children:e})};("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},18556,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"ImageConfigContext",{enumerable:!0,get:function(){return n}});let i=e.r(55682)._(e.r(71645)),a=e.r(87690),n=i.default.createContext(a.imageConfigDefault)},65856,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"RouterContext",{enumerable:!0,get:function(){return i}});let i=e.r(55682)._(e.r(71645)).default.createContext(null)},70965,(e,t,r)=>{"use strict";function i(e,t){let r=e||75;return t?.qualities?.length?t.qualities.reduce((e,t)=>Math.abs(t-r)<Math.abs(e-r)?t:e,0):r}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"findClosestQuality",{enumerable:!0,get:function(){return i}})},1948,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return o}});let i=e.r(70965),a=e.r(43369);function n({config:e,src:t,width:r,quality:n}){if(t.startsWith("/")&&t.includes("?")&&e.localPatterns?.length===1&&"**"===e.localPatterns[0].pathname&&""===e.localPatterns[0].search)throw Object.defineProperty(Error(`Image with src "${t}" is using a query string which is not configured in images.localPatterns.
|
|
3
|
+
Read more: https://nextjs.org/docs/messages/next-image-unconfigured-localpatterns`),"__NEXT_ERROR_CODE",{value:"E871",enumerable:!1,configurable:!0});let o=(0,i.findClosestQuality)(n,e),l=(0,a.getDeploymentId)();return`${e.path}?url=${encodeURIComponent(t)}&w=${r}&q=${o}${t.startsWith("/")&&l?`&dpl=${l}`:""}`}n.__next_img_default=!0;let o=n},18581,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"useMergedRef",{enumerable:!0,get:function(){return a}});let i=e.r(71645);function a(e,t){let r=(0,i.useRef)(null),a=(0,i.useRef)(null);return(0,i.useCallback)(i=>{if(null===i){let e=r.current;e&&(r.current=null,e());let t=a.current;t&&(a.current=null,t())}else e&&(r.current=n(e,i)),t&&(a.current=n(t,i))},[e,t])}function n(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let r=e(t);return"function"==typeof r?r:()=>e(null)}}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},5500,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"Image",{enumerable:!0,get:function(){return x}});let i=e.r(55682),a=e.r(90809),n=e.r(43476),o=a._(e.r(71645)),l=i._(e.r(74080)),s=i._(e.r(25633)),d=e.r(8927),u=e.r(87690),c=e.r(18556);e.r(33525);let f=e.r(65856),p=i._(e.r(1948)),g=e.r(18581),m={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1};function h(e,t,r,i,a,n,o){let l=e?.src;e&&e["data-loaded-src"]!==l&&(e["data-loaded-src"]=l,("decode"in e?e.decode():Promise.resolve()).catch(()=>{}).then(()=>{if(e.parentElement&&e.isConnected){if("empty"!==t&&a(!0),r?.current){let t=new Event("load");Object.defineProperty(t,"target",{writable:!1,value:e});let i=!1,a=!1;r.current({...t,nativeEvent:t,currentTarget:e,target:e,isDefaultPrevented:()=>i,isPropagationStopped:()=>a,persist:()=>{},preventDefault:()=>{i=!0,t.preventDefault()},stopPropagation:()=>{a=!0,t.stopPropagation()}})}i?.current&&i.current(e)}}))}function b(e){return o.use?{fetchPriority:e}:{fetchpriority:e}}"u"<typeof window&&(globalThis.__NEXT_IMAGE_IMPORTED=!0);let y=(0,o.forwardRef)(({src:e,srcSet:t,sizes:r,height:i,width:a,decoding:l,className:s,style:d,fetchPriority:u,placeholder:c,loading:f,unoptimized:p,fill:m,onLoadRef:y,onLoadingCompleteRef:v,setBlurComplete:x,setShowAltText:w,sizesInput:P,onLoad:_,onError:C,...S},O)=>{let j=(0,o.useCallback)(e=>{e&&(C&&(e.src=e.src),e.complete&&h(e,c,y,v,x,p,P))},[e,c,y,v,x,C,p,P]),E=(0,g.useMergedRef)(O,j);return(0,n.jsx)("img",{...S,...b(u),loading:f,width:a,height:i,decoding:l,"data-nimg":m?"fill":"1",className:s,style:d,sizes:r,srcSet:t,src:e,ref:E,onLoad:e=>{h(e.currentTarget,c,y,v,x,p,P)},onError:e=>{w(!0),"empty"!==c&&x(!0),C&&C(e)}})});function v({isAppRouter:e,imgAttributes:t}){let r={as:"image",imageSrcSet:t.srcSet,imageSizes:t.sizes,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,...b(t.fetchPriority)};return e&&l.default.preload?(l.default.preload(t.src,r),null):(0,n.jsx)(s.default,{children:(0,n.jsx)("link",{rel:"preload",href:t.srcSet?void 0:t.src,...r},"__nimg-"+t.src+t.srcSet+t.sizes)})}let x=(0,o.forwardRef)((e,t)=>{let r=(0,o.useContext)(f.RouterContext),i=(0,o.useContext)(c.ImageConfigContext),a=(0,o.useMemo)(()=>{let e=m||i||u.imageConfigDefault,t=[...e.deviceSizes,...e.imageSizes].sort((e,t)=>e-t),r=e.deviceSizes.sort((e,t)=>e-t),a=e.qualities?.sort((e,t)=>e-t);return{...e,allSizes:t,deviceSizes:r,qualities:a,localPatterns:"u"<typeof window?i?.localPatterns:e.localPatterns}},[i]),{onLoad:l,onLoadingComplete:s}=e,g=(0,o.useRef)(l);(0,o.useEffect)(()=>{g.current=l},[l]);let h=(0,o.useRef)(s);(0,o.useEffect)(()=>{h.current=s},[s]);let[b,x]=(0,o.useState)(!1),[w,P]=(0,o.useState)(!1),{props:_,meta:C}=(0,d.getImgProps)(e,{defaultLoader:p.default,imgConf:a,blurComplete:b,showAltText:w});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(y,{..._,unoptimized:C.unoptimized,placeholder:C.placeholder,fill:C.fill,onLoadRef:g,onLoadingCompleteRef:h,setBlurComplete:x,setShowAltText:P,sizesInput:e.sizes,ref:t}),C.preload?(0,n.jsx)(v,{isAppRouter:!r,imgAttributes:_}):null]})});("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},94909,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i={default:function(){return u},getImageProps:function(){return d}};for(var a in i)Object.defineProperty(r,a,{enumerable:!0,get:i[a]});let n=e.r(55682),o=e.r(8927),l=e.r(5500),s=n._(e.r(1948));function d(e){let{props:t}=(0,o.getImgProps)(e,{defaultLoader:s.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,r]of Object.entries(t))void 0===r&&delete t[e];return{props:t}}let u=l.Image},57688,(e,t,r)=>{t.exports=e.r(94909)}]);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,36438,e=>{"use strict";var t=e.i(43476),r=e.i(71645),n=e.i(18566),a=e.i(95187);let s=(0,a.createServerReference)("403ab16612d47368fb84b281b9844aa002737b79d8",a.callServer,void 0,a.findSourceMapURL,"deleteSessionInBackground"),i=(0,a.createServerReference)("40a82f35cbaa17280af7bd01d86d41791d02d3b68e",a.callServer,void 0,a.findSourceMapURL,"getSessionDivergence"),l=(0,a.createServerReference)("404dbaffc9974e556e03990fc0900e47c0333f977b",a.callServer,void 0,a.findSourceMapURL,"getSessionUncommittedFileCount"),o=(0,a.createServerReference)("40ecdc927e1f3b7d19f8fae0d2d674e7c64ace5060",a.callServer,void 0,a.findSourceMapURL,"listSessionBaseBranches"),c=(0,a.createServerReference)("40a9df1897dd31d49437365dd3c66c5b80c1600170",a.callServer,void 0,a.findSourceMapURL,"mergeSessionToBase"),d=(0,a.createServerReference)("40a7b20eda21f3da868da6c4400d557e52f032d987",a.callServer,void 0,a.findSourceMapURL,"rebaseSessionOntoBase"),u=(0,a.createServerReference)("6092e46ba9d2f76124d91b01c10c9a87cfbf8d42a4",a.callServer,void 0,a.findSourceMapURL,"updateSessionBaseBranch"),m=(0,a.createServerReference)("604afb6ba485adc0c2f4629111b97b17e57cffae69",a.callServer,void 0,a.findSourceMapURL,"writeSessionPromptFile"),h=(0,a.createServerReference)("7f5f9916ac76add7ffccbc67974fe8923b3edd8683",a.callServer,void 0,a.findSourceMapURL,"setTmuxSessionMouseMode");var p=e.i(94520),f=e.i(93958),b=e.i(27612),x=e.i(75254);let v=(0,x.default)("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"}]]);var w=e.i(31343);let g=(0,x.default)("git-commit-horizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]),y=(0,x.default)("git-merge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]),j=(0,x.default)("git-pull-request-arrow",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v12",key:"ih889a"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}]]);var k=e.i(55716);let N=(0,x.default)("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),S=(0,x.default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),C=(0,x.default)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),$=(0,x.default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),R=(0,x.default)("grip",[["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"19",cy:"5",r:"1",key:"w8mnmm"}],["circle",{cx:"5",cy:"5",r:"1",key:"lttvr7"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}],["circle",{cx:"19",cy:"19",r:"1",key:"shf9b7"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]]),M=(0,x.default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);var E=e.i(7233);let L=(0,x.default)("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]),P=(0,x.default)("mouse-pointer-2",[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]);var F=e.i(71689);let T=(0,x.default)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),D=(0,x.default)("rotate-cw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);var z=e.i(57688),A=e.i(79799);let q=(0,a.createServerReference)("401e06711f11b1d1a78af7f1d12d57f57ef1d46585",a.callServer,void 0,a.findSourceMapURL,"listPathEntries");var B=e.i(84545);let U=(0,x.default)("clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]),I=(0,x.default)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);var W=e.i(27025);let H=(0,x.default)("grid-2x2",[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),_=(0,x.default)("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]]),K=(0,x.default)("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),O=(0,x.default)("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]),V=(0,x.default)("pin-off",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]);var G=e.i(81016);let X="viba:session-file-browser:view-mode";function Y({initialPath:e,worktreePath:n,onConfirm:a,onCancel:s,onPathChange:i}){let l=(0,r.useMemo)(()=>new Set([".png",".jpg",".jpeg",".gif",".webp",".bmp",".svg",".ico",".avif"]),[]),[o,c]=(0,r.useState)(""),[d,u]=(0,r.useState)([]),[m,h]=(0,r.useState)(!1),[b,x]=(0,r.useState)(null),[v,w]=(0,r.useState)(""),[g,y]=(0,r.useState)([]),[j,k]=(0,r.useState)(null),[N,S]=(0,r.useState)("list"),[C,$]=(0,r.useState)(!1),[R,M]=(0,r.useState)({}),[E,L]=(0,r.useState)([]);(0,r.useEffect)(()=>{let t=!0;return(async()=>{try{let r=await (0,A.getHomeDirectory)();if(!t)return;w(r),e||c(r)}catch(e){console.error("Failed to resolve home directory:",e)}e&&t&&c(e)})(),()=>{t=!1}},[e]),(0,r.useEffect)(()=>{let e=!0;return(async()=>{try{let t=await (0,p.getConfig)();if(!e)return;let r=Array.isArray(t.pinnedFolderShortcuts)?t.pinnedFolderShortcuts.filter(e=>"string"==typeof e&&e.trim().length>0):[];L(Array.from(new Set(r)))}catch(e){console.error("Failed to load pinned folder shortcuts:",e)}})(),()=>{e=!1}},[]),(0,r.useEffect)(()=>{try{let e=localStorage.getItem(X);("list"===e||"grid"===e)&&S(e)}catch{}finally{$(!0)}},[]),(0,r.useEffect)(()=>{if(C)try{localStorage.setItem(X,N)}catch{}},[C,N]),(0,r.useEffect)(()=>{o&&(async()=>{h(!0),x(null);try{let e=await q(o);u(e)}catch(e){console.error("Failed to list files:",e),x("Failed to load directory contents")}finally{h(!1)}})()},[o]),(0,r.useEffect)(()=>{o&&i?.(o)},[o,i]),(0,r.useEffect)(()=>{y([]),k(null),M({})},[o]);let P=(0,r.useMemo)(()=>new Set(g),[g]),T=(e,t,r)=>{if(e.isDirectory)return void c(e.path);let n=r.metaKey||r.ctrlKey;if(r.shiftKey&&null!==j){let e=Math.min(j,t),r=Math.max(j,t);y(d.slice(e,r+1).filter(e=>!e.isDirectory).map(e=>e.path));return}if(n){y(t=>t.includes(e.path)?t.filter(t=>t!==e.path):[...t,e.path]),k(t);return}y([e.path]),k(t)},D=async()=>{if(x(null),!n)return void x("Cannot paste: Session worktree path is missing.");try{if(h(!0),!navigator.clipboard||!navigator.clipboard.read)throw Error("Clipboard API not supported in this browser");let e=await navigator.clipboard.read(),t=new FormData,r=!1;for(let n of e)for(let e of n.types)if(e.startsWith("image/")){let a=await n.getType(e),s=e.split("/")[1]||"png",i=`pasted-image-${Date.now()}.${s}`,l=new File([a],i,{type:e});t.append(i,l),r=!0;break}if(r){let e=await (0,B.saveAttachments)(n,t);if(e&&e.length>0)return void await a(e);x("Failed to save pasted files.")}else try{let e=await navigator.clipboard.readText();e&&e.trim().startsWith("/")?x("No file content found in clipboard. Copy an image or file first."):x("No file content found in clipboard.")}catch{x("No file content found in clipboard.")}}catch(t){let e=t instanceof Error?t.message:String(t);console.error("Paste error:",t),x(`Failed to read from clipboard: ${e}`)}finally{h(!1)}},Y=async e=>{L(e);try{await (0,f.updateConfig)({pinnedFolderShortcuts:e})}catch(e){console.error("Failed to save pinned folder shortcuts:",e),x("Failed to save pinned shortcuts")}},J=async e=>{(x(null),E.includes(e))?await Y(E.filter(t=>t!==e)):await Y([...E,e])},Z=async()=>{0!==g.length&&await a(g)};return(0,t.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm p-4",children:(0,t.jsxs)("div",{className:"bg-base-200 rounded-lg shadow-xl w-full max-w-5xl h-[82vh] flex flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-4 border-b border-base-300",children:[(0,t.jsxs)("h2",{className:"text-xl font-bold flex items-center gap-2",children:[(0,t.jsx)(W.Folder,{className:"w-5 h-5"}),"Browse Files"]}),(0,t.jsx)("button",{onClick:s,className:"btn btn-sm btn-ghost btn-circle",title:"Close file browser",children:"✕"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-base-300",children:[(0,t.jsx)("button",{onClick:()=>{let e=(0,G.getDirName)(o);e&&e!==o&&c(e)},className:"btn btn-sm btn-square btn-ghost",title:"Go Up",disabled:"/"===o||!o,children:(0,t.jsx)(F.ArrowLeft,{className:"w-4 h-4"})}),(0,t.jsxs)("button",{onClick:()=>{v&&o!==v&&c(v)},className:"btn btn-sm btn-ghost gap-1",title:v?`Go to Home Folder (${v})`:"Go to Home Folder",disabled:!v||o===v,children:[(0,t.jsx)(_,{className:"w-4 h-4"}),"Home"]}),(0,t.jsx)("div",{className:"flex-1 overflow-x-auto whitespace-nowrap px-2 font-mono text-sm",children:o}),(0,t.jsxs)("div",{className:"join",children:[(0,t.jsx)("button",{type:"button",onClick:()=>S("list"),className:`btn btn-sm join-item ${"list"===N?"btn-active":"btn-ghost"}`,title:"List view",children:(0,t.jsx)(K,{className:"w-4 h-4"})}),(0,t.jsx)("button",{type:"button",onClick:()=>S("grid"),className:`btn btn-sm join-item ${"grid"===N?"btn-active":"btn-ghost"}`,title:"Grid view",children:(0,t.jsx)(H,{className:"w-4 h-4"})})]}),(0,t.jsxs)("button",{onClick:Z,className:"btn btn-sm btn-primary gap-2",disabled:0===g.length,title:"Insert selected absolute paths",children:["Insert (",g.length,")"]}),(0,t.jsx)("div",{className:"w-[1px] h-6 bg-base-content/10 mx-1"}),(0,t.jsxs)("button",{onClick:D,className:"btn btn-sm btn-ghost gap-2",title:"Paste file/image from clipboard",disabled:!n,children:[(0,t.jsx)(U,{className:"w-4 h-4"}),"Paste"]})]}),E.length>0&&(0,t.jsx)("div",{className:"px-3 py-2 border-b border-base-300 bg-base-200/50",children:(0,t.jsx)("div",{className:"flex items-center gap-2 overflow-x-auto",children:E.map(e=>{let r=e===o,n=e.split(/[\\/]/).filter(Boolean).pop()||e;return(0,t.jsxs)("div",{className:"join shrink-0",children:[(0,t.jsxs)("button",{type:"button",className:`btn btn-xs join-item ${r?"btn-primary":"btn-ghost"}`,onClick:()=>c(e),title:e,children:[(0,t.jsx)(W.Folder,{className:"w-3 h-3"}),n]}),(0,t.jsx)("button",{type:"button",className:"btn btn-xs btn-ghost join-item",onClick:()=>void J(e),title:`Unpin ${e}`,children:(0,t.jsx)(V,{className:"w-3 h-3"})})]},e)})})}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto p-2",children:m?(0,t.jsx)("div",{className:"flex justify-center items-center h-full",children:(0,t.jsx)("span",{className:"loading loading-spinner loading-lg"})}):b?(0,t.jsx)("div",{className:"alert alert-error",children:b}):0===d.length?(0,t.jsx)("div",{className:"text-center text-base-content/50 mt-10",children:"Empty directory"}):"list"===N?(0,t.jsx)("div",{className:"grid grid-cols-1 gap-1",children:d.map((e,r)=>{let n=P.has(e.path);return(0,t.jsxs)("div",{className:`flex items-center justify-between p-2 rounded-md cursor-pointer transition-colors border ${n?"bg-primary text-primary-content border-primary":"hover:bg-base-100 border-transparent"}`,onClick:t=>T(e,r,t),title:e.path,children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 overflow-hidden",children:[e.isDirectory?(0,t.jsx)(W.Folder,{className:"w-5 h-5 shrink-0"}):(0,t.jsx)(I,{className:"w-5 h-5 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]}),(0,t.jsx)("span",{className:"text-[10px] opacity-70 shrink-0",children:e.isDirectory?(0,t.jsx)("button",{type:"button",className:"btn btn-ghost btn-xs h-6 min-h-6",onClick:t=>{t.stopPropagation(),J(e.path)},title:E.includes(e.path)?"Unpin folder":"Pin folder",children:(0,t.jsx)(O,{className:`w-3 h-3 ${E.includes(e.path)?"fill-current":""}`})}):"file"})]},e.path)})}):(0,t.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-3",children:d.map((e,r)=>{var n;let a,s=P.has(e.path),i=!e.isDirectory&&-1!==(a=(n=e.name).lastIndexOf("."))&&l.has(n.slice(a).toLowerCase()),o=`/api/file-thumbnail?path=${encodeURIComponent(e.path)}`;return(0,t.jsxs)("button",{type:"button",className:`rounded-lg border text-left overflow-hidden transition-colors ${s?"border-primary bg-primary/15":"border-base-300 hover:bg-base-100"}`,onClick:t=>T(e,r,t),title:e.path,children:[(0,t.jsxs)("div",{className:"aspect-square bg-base-300 flex items-center justify-center overflow-hidden relative",children:[i&&!R[e.path]?(0,t.jsx)(z.default,{src:o,alt:e.name,fill:!0,sizes:"(max-width: 768px) 50vw, (max-width: 1024px) 25vw, 20vw",className:"object-cover",unoptimized:!0,onError:()=>M(t=>({...t,[e.path]:!0}))}):e.isDirectory?(0,t.jsx)(W.Folder,{className:"w-10 h-10 opacity-80"}):(0,t.jsx)(I,{className:"w-10 h-10 opacity-80"}),e.isDirectory&&(0,t.jsx)("button",{type:"button",className:`absolute top-1 right-1 btn btn-xs btn-circle ${E.includes(e.path)?"btn-primary":"btn-ghost bg-base-100/70"}`,onClick:t=>{t.stopPropagation(),J(e.path)},title:E.includes(e.path)?"Unpin folder":"Pin folder",children:(0,t.jsx)(O,{className:`w-3 h-3 ${E.includes(e.path)?"fill-current":""}`})})]}),(0,t.jsxs)("div",{className:"px-2 py-2",children:[(0,t.jsx)("div",{className:"truncate text-sm font-medium",title:e.name,children:e.name}),(0,t.jsx)("div",{className:"text-[10px] opacity-70",children:e.isDirectory?"folder":i?"image":"file"})]})]},e.path)})})}),(0,t.jsx)("div",{className:"p-3 border-t border-base-300 text-xs text-base-content/60 text-center",children:"Click: single select. Cmd/Ctrl+Click: multi-select. Shift+Click: range select. Click a folder to open it."})]})})}var J=e.i(63671);function Z(e,t){var r,n;let a=(r=e,n=t,`viba-${(r.trim().replace(/[^a-zA-Z0-9_-]/g,"-")||"session").slice(0,40)}-${n}`),s=new URLSearchParams;return s.append("arg","new-session"),s.append("arg","-A"),s.append("arg","-s"),s.append("arg",a),`/terminal?${s.toString()}`}let Q=[{id:"vscode",name:"VS Code",protocol:"vscode"},{id:"cursor",name:"Cursor",protocol:"cursor"},{id:"windsurf",name:"Windsurf",protocol:"windsurf"},{id:"antigravity",name:"Antigravity",protocol:"antigravity"}],ee=e=>`'${e.replace(/'/g,"'\\''")}'`,et="viba-terminal-size",er="viba-agent-preview-split-ratio",en="__vibaTerminalBootstrapRegistry",ea=/(?:\$|%|#|>) $/,es=e=>Math.max(.2,Math.min(.8,e)),ei=e=>{let t=e.trim();return t?/^https?:\/\//i.test(t)?t:/^[a-z][a-z0-9+.-]*:/i.test(t)?null:`http://${t}`:null},el=(e,t)=>{let r=e.replace(/\\/g,"/").replace(/\/+$/,""),n=t.replace(/\\/g,"/").replace(/^\/+/,"");return`${r}/${n}`},eo=(e,t)=>{let r=t.trim().replace(/\\/g,"/").replace(/\/+$/,"");if(!r)return null;let n=(e=>{let t=e.trim();if(!t)return"";if(t=t.replace(/[#?].*$/,""),/^file:\/\//i.test(t))try{let e=new URL(t);t=decodeURIComponent(e.pathname)}catch{}else if(/^https?:\/\//i.test(t))try{let e=new URL(t);t=decodeURIComponent(e.pathname)}catch{}return(t=t.replace(/^webpack(?:-internal)?:\/\/\/?/,"").replace(/^rsc:\/\//,"").replace(/^\(.*?\)\//,"").replace(/^\/\.\//,"/").replace(/^\.\//,"").replace(/\\/g,"/")).trim()})(e);if(!n)return null;if(n.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(n))return n;let a=new Set;a.add(n.replace(/^\.\/+/,""));let s=n.indexOf("/src/");for(let e of(s>=0&&a.add(n.slice(s+1)),n.startsWith("src/")&&a.add(n),a))if(e)return el(r,e);return null},ec=e=>{let t=e.trim();if(!t)return"";let r=t.match(/[A-Za-z_$][\w$]*/);return r?r[0]:""};function ed({repo:e,worktree:n,branch:a,baseBranch:x,sessionName:z,agent:A,model:q,startupScript:B,devServerScript:U,initialMessage:I,rawInitialMessage:W,title:H,attachmentNames:_,onExit:K,isResume:O,terminalPersistenceMode:V="shell",onSessionStart:X}){let el="hidden min-[1900px]:inline",ed=(0,r.useRef)(null),eu=(0,r.useRef)(null),em=(0,r.useRef)(null),eh=(0,r.useRef)(null),ep=(0,r.useRef)(null),ef=(0,r.useRef)({startX:0,startRatio:.5}),eb=(0,r.useRef)(null),ex=(0,r.useRef)(null),ev=(0,r.useRef)({injected:!1,timer:null}),ew=(0,r.useMemo)(()=>Z(z,"agent"),[z]),eg=(0,r.useMemo)(()=>Z(z,"terminal"),[z]),ey=(0,r.useRef)({agent:"idle",terminal:"idle"});(0,r.useEffect)(()=>{ey.current={agent:"idle",terminal:"idle"},null!==ev.current.timer&&window.clearTimeout(ev.current.timer),ev.current={injected:!1,timer:null}},[z]),(0,r.useEffect)(()=>()=>{null!==ev.current.timer&&(window.clearTimeout(ev.current.timer),ev.current.timer=null)},[]);let ej=(0,r.useCallback)(e=>`viba:terminal-bootstrap:${z}:${e}`,[z]),ek=(0,r.useCallback)(e=>`${z}:${e}`,[z]),eN=(0,r.useCallback)(()=>{let e=window;return e[en]||(e[en]={}),e[en]||null},[]),eS=(0,r.useCallback)(e=>{let t=eN();return t&&t[ek(e)]||"idle"},[eN,ek]),eC=(0,r.useCallback)((e,t)=>{let r=eN();r&&(r[ek(e)]=t)},[eN,ek]),e$=(0,r.useCallback)(e=>{if("done"===ey.current[e]||"done"===eS(e))return!0;try{return"1"===window.sessionStorage.getItem(ej(e))}catch{return!1}},[eS,ej]),eR=(0,r.useCallback)(e=>{let t=ey.current[e],r=eS(e);return"done"!==t&&"in_progress"!==t&&"done"!==r&&"in_progress"!==r&&(ey.current[e]="in_progress",eC(e,"in_progress"),!0)},[eS,eC]),eM=(0,r.useCallback)(e=>{"done"!==ey.current[e]&&(ey.current[e]="idle"),"done"!==eS(e)&&eC(e,"idle")},[eS,eC]),eE=(0,r.useCallback)(e=>{ey.current[e]="done",eC(e,"done");try{window.sessionStorage.setItem(ej(e),"1")}catch{}},[ej,eC]),eL=(0,r.useCallback)(e=>{let t=e?.buffer?.active;if(!t||"function"!=typeof t.getLine)return!0;let r=t.baseY+t.cursorY;for(let e=0;e<6;e+=1){let n=t.getLine(r-e),a=n?.translateToString(!0)??"";if(a.trim())return ea.test(a)}return!1},[]),eP=(0,r.useCallback)((e,t,r)=>{if(O)return!1;let n=B?.trim();return!!n&&!ev.current.injected&&(ev.current.injected=!0,null!==ev.current.timer&&window.clearTimeout(ev.current.timer),ev.current.timer=window.setTimeout(()=>{ev.current.timer=null;try{let a;r.paste(n),(a=e.contentDocument?.querySelector("textarea.xterm-helper-textarea"))?a.dispatchEvent(new KeyboardEvent("keypress",{bubbles:!0,cancelable:!0,charCode:13,keyCode:13,key:"Enter",view:t})):r.paste("\r")}catch(e){ev.current.injected=!1,console.error("Failed to inject startup script into terminal iframe:",e)}},500),!0)},[O,B]);(0,r.useEffect)(()=>{if(O||!B?.trim()||ev.current.injected)return;let e=!1,t=(r=0)=>{if(e||ev.current.injected||r>30)return;if(!e$("terminal"))return void window.setTimeout(()=>t(r+1),200);let n=eu.current;if(n){try{let e=n.contentWindow;if(e?.term)return void eP(n,e,e.term)}catch{}window.setTimeout(()=>t(r+1),200)}};return t(),()=>{e=!0}},[e$,eP,O,B]);let[eF,eT]=(0,r.useState)("Initializing..."),[eD,ez]=(0,r.useState)("idle"),[eA,eq]=(0,r.useState)(null),[eB,eU]=(0,r.useState)(!1),[eI,eW]=(0,r.useState)(!1),[eH,e_]=(0,r.useState)(!1),[eK,eO]=(0,r.useState)(!1),[eV,eG]=(0,r.useState)(!1),[eX,eY]=(0,r.useState)(n||e),[eJ,eZ]=(0,r.useState)(!1),[eQ,e0]=(0,r.useState)(x?.trim()||""),[e1,e2]=(0,r.useState)([]),[e3,e6]=(0,r.useState)(!1),e4=(0,r.useRef)(!1),[e5,e9]=(0,r.useState)(!1),[e7,e8]=(0,r.useState)({ahead:0,behind:0}),[te,tt]=(0,r.useState)(0),[tr,tn]=(0,r.useState)(!1),[ta,ts]=(0,r.useState)(""),[ti,tl]=(0,r.useState)(""),[to,tc]=(0,r.useState)(!1),[td,tu]=(0,r.useState)(!1),[tm,th]=(0,r.useState)(.5),[tp,tf]=(0,r.useState)(!1),[tb,tx]=(0,r.useState)(!0),[tv,tw]=(0,r.useState)({width:460,height:320}),[tg,ty]=(0,r.useState)(!1),[tj,tk]=(0,r.useState)(!1),tN=(0,r.useRef)({startX:0,startY:0,startWidth:0,startHeight:0}),[tS,tC]=(0,r.useState)("scroll"),[t$,tR]=(0,r.useState)(!1),tM=(0,r.useRef)(0);(0,r.useEffect)(()=>{eY(n||e)},[e,n]),(0,r.useEffect)(()=>{let e=localStorage.getItem(et);if(e)try{tw(JSON.parse(e))}catch(e){console.error("Failed to parse saved terminal size",e)}let t=localStorage.getItem(er);if(t){let e=Number.parseFloat(t);Number.isNaN(e)||th(es(e))}tk(!0)},[]),(0,r.useEffect)(()=>{if(!tg)return;let e=e=>{let t=tN.current.startX-e.clientX,r=tN.current.startY-e.clientY;tw({width:Math.max(300,Math.min(window.innerWidth-32,tN.current.startWidth+t)),height:Math.max(100,Math.min(window.innerHeight-32,tN.current.startHeight+r))})},t=()=>{ty(!1)};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[tg]),(0,r.useEffect)(()=>{tj&&!tg&&localStorage.setItem(et,JSON.stringify(tv))},[tj,tg,tv]),(0,r.useEffect)(()=>{tj&&!tp&&localStorage.setItem(er,String(tm))},[tm,tj,tp]),(0,r.useEffect)(()=>{if(!tp)return;let e=e=>{let t=ep.current;if(!t)return;let r=t.getBoundingClientRect();if(r.width<=0)return;let n=e.clientX-ef.current.startX;th(es((ef.current.startRatio*r.width+n)/r.width))},t=()=>{tf(!1)};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[tp]),(0,r.useEffect)(()=>{if(!tb&&eu.current){let e=eu.current;setTimeout(()=>{try{let t=e.contentWindow;if(t&&t.term){t.term.scrollToBottom(),t.focus();let r=e.contentDocument?.querySelector("textarea.xterm-helper-textarea");r&&r.focus()}}catch(e){console.error("Failed to focus/scroll terminal on restore:",e)}},100)}},[tb]);let[tE,tL]=(0,r.useState)("vscode");(0,r.useEffect)(()=>{let e=H?.trim();if(e)return document.title=`${e} | Viba`,()=>{document.title="Viba"};document.title="Viba"},[H]),(0,r.useEffect)(()=>{(async()=>{let e=await (0,p.getConfig)();e.selectedIde&&Q.some(t=>t.id===e.selectedIde)&&tL(e.selectedIde)})()},[]),(0,r.useEffect)(()=>{e0(x?.trim()||""),e2([])},[x,z]),(0,r.useEffect)(()=>{tC("scroll"),tR(!1),tM.current+=1},[z]);let tP=async e=>{let t=e.target.value;tL(t),await (0,f.updateConfig)({selectedIde:t})},tF=(0,r.useCallback)(async(e,t)=>{if("tmux"!==V)return!0;let r=++tM.current;t?.silent||tR(!0);let n="scroll"===e,[a,s]=await Promise.all([h(z,"agent",n),h(z,"terminal",n)]);return r===tM.current&&((t?.silent||tR(!1),[a,s].find(e=>!e.success))?(t?.silent||eT(`Failed to switch to ${"scroll"===e?"scroll mode":"text select mode"}`),!1):(t?.silent||eT("scroll"===e?"Terminal mode: Scroll":"Terminal mode: Text Select"),!0))},[z,V]);(0,r.useEffect)(()=>{"tmux"===V&&tF("scroll",{silent:!0})},[tF,V]);let tT=(0,r.useCallback)(()=>{if("tmux"!==V||t$)return;let e="scroll"===tS?"select":"scroll";tC(e),(async()=>{await tF(e)||tC(tS)})()},[tF,t$,tS,V]),tD=async(t=!0)=>{if(!e||!n||!a||t&&!confirm("Are you sure you want to delete this session? This will remove the branch and worktree."))return!1;eq(null),ez("idle"),eT("Purging session...");try{let e=await s(z);if(!e.success)return console.error("Cleanup failed:",e.error||"Unknown error"),ez("error"),eq(e.error||"Failed to delete session"),!1;(0,J.notifySessionsUpdated)()}catch(e){return console.error("Cleanup request failed:",e),ez("error"),eq(e instanceof Error?e.message:"Unknown error"),!1}return K(!0),!0},tz=async()=>{await tD(!0)},tA=(0,r.useCallback)((e,t)=>new Promise(r=>{let n=ed.current;if(!n)return void r(!1);let s=(i=0)=>{if(i>30)return void r(!1);try{let l=n.contentWindow;if(!l||(l.postMessage({type:"viba:agent-request",action:t,prompt:e,sessionName:z,branch:a,baseBranch:eQ||void 0,timestamp:Date.now()},"*"),!l.term))return void setTimeout(()=>s(i+1),300);l.term.paste(e);let o=n.contentDocument?.querySelector("textarea.xterm-helper-textarea");o?(o.dispatchEvent(new KeyboardEvent("keypress",{bubbles:!0,cancelable:!0,charCode:13,keyCode:13,key:"Enter",view:l})),o.focus()):l.term.paste("\r"),l.focus(),r(!0)}catch(e){console.error("Failed to send prompt to agent iframe:",e),setTimeout(()=>s(i+1),300)}};s()}),[a,eQ,z]),tq=async()=>{eW(!0),eT("Requesting commit from agent..."),eT(await tA("Please create a git commit with the current changes in this worktree.","commit")?"Commit request sent to agent":"Failed to send commit request to agent"),eW(!1)},tB=(0,r.useCallback)(e=>new Promise(t=>{let r=ed.current;if(!r)return void t(!1);let n=(a=0)=>{if(a>30)return void t(!1);try{let s=r.contentWindow;if(!s||!s.term)return void setTimeout(()=>n(a+1),300);s.term.paste(e);let i=r.contentDocument?.querySelector("textarea.xterm-helper-textarea");i&&i.focus(),s.focus(),t(!0)}catch(e){console.error("Failed to paste into agent iframe:",e),setTimeout(()=>n(a+1),300)}};n()}),[]),tU=(0,r.useCallback)(async e=>{if(0===e.length)return;eZ(!0);let t=`${e.join(" ")} `;eT(await tB(t)?`Inserted ${e.length} file path${1===e.length?"":"s"} into agent input`:"Failed to insert file paths into agent input"),eZ(!1)},[tB]),tI=(0,r.useCallback)(async t=>{let r=t.map(ec).filter(Boolean);if(0===r.length)return null;let a=Array.from(new Set([e,n].map(e=>(e||"").trim()).filter(Boolean)));if(0===a.length)return null;for(let e of a)try{let t=await fetch("/api/component-source/resolve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({componentNames:r,workspaceRoot:e})}),n=await t.json().catch(()=>null);if(!t.ok){console.warn("Component source resolve miss",{componentNames:r,workspaceRoot:e,error:n?.error||t.statusText});continue}let a="string"==typeof n?.sourcePath?n.sourcePath.trim():"",s="string"==typeof n?.resolvedName?n.resolvedName.trim():"";if(a&&s)return{sourcePath:a,resolvedName:s}}catch(e){console.error("Failed to resolve component source path:",e)}return null},[e,n]),tW=(0,r.useCallback)(async()=>{if(z&&!e4.current){e4.current=!0,e6(!0);try{let e=await o(z);e.success?(e2(e.branches??[]),e0(e.baseBranch?.trim()||"")):e.error&&eT(`Failed to load branches: ${e.error}`)}catch(e){console.error("Failed to load base branches:",e)}finally{e4.current=!1,e6(!1)}}},[z]);(0,r.useEffect)(()=>{z&&tW()},[tW,z]);let tH=(0,r.useCallback)(async()=>{if(z)try{let e=await i(z);e.success&&"number"==typeof e.ahead&&"number"==typeof e.behind&&e8({ahead:e.ahead,behind:e.behind})}catch(e){console.error("Failed to load branch divergence:",e)}},[z]);(0,r.useEffect)(()=>{if(!z||!eQ)return void e8({ahead:0,behind:0});tH();let e=window.setInterval(()=>{tH()},6e4);return()=>window.clearInterval(e)},[eQ,tH,z]);let t_=(0,r.useCallback)(async()=>{if(z)try{let e=await l(z);e.success&&"number"==typeof e.count&&tt(e.count)}catch(e){console.error("Failed to load uncommitted file count:",e)}},[z]);(0,r.useEffect)(()=>{if(!z)return;t_();let e=window.setInterval(()=>{t_()},1e4);return()=>window.clearInterval(e)},[t_,z]);let tK=async()=>{if(!z||!eQ)return!1;e_(!0),eT("Merging session branch...");try{let e=await c(z);if(e.success)return eT(`Merged ${e.branchName} into ${e.baseBranch}`),tH(),!0;return eT(`Merge failed: ${e.error}`),!1}catch(e){return console.error("Merge request failed:",e),eT("Merge failed"),!1}finally{e_(!1)}},tO=async()=>{await tK()},[tV,tG]=(0,r.useState)(!1),tX=(0,r.useRef)(null);(0,r.useEffect)(()=>{let e=e=>{tX.current&&!tX.current.contains(e.target)&&tG(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let tY=async e=>{if(tG(!1),!z)return;let t=e!==eQ;eO(!0),eT(t?`Updating base to ${e} and rebasing...`:"Rebasing session branch...");try{if(t){let t=await u(z,e);if(!t.success){eT(`Failed to update base branch: ${t.error}`),eO(!1);return}e0(t.baseBranch),await tW()}let r=await d(z);r.success?(eT(`Rebased ${r.branchName} onto ${r.baseBranch}`),tH()):eT(`Rebase failed: ${r.error}`)}catch(e){console.error("Rebase request failed:",e),eT("Rebase failed")}finally{eO(!1)}},tJ=(0,r.useCallback)(async(e,t)=>{let r=ei(e);if(!r)return eT("Please enter a preview URL"),!1;ts(r),tc(!1),eT(`Loading preview: ${r}`);try{let e=await fetch("/api/preview-proxy/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:r})}),n=await e.json().catch(()=>null);if(!e.ok||!n?.proxyUrl)throw Error(n?.error||"Failed to start preview proxy");return tl(n.proxyUrl),t&&tn(!0),eT(`Loaded preview: ${r}`),!0}catch(t){let e=t instanceof Error?t.message:"Failed to load preview";return console.error("Failed to load preview via proxy:",t),eT(`Failed to load preview: ${e}`),!1}},[]),tZ=(0,r.useCallback)(()=>{if(!ti)return void eT("Load a preview before picking elements");let e=em.current?.contentWindow;if(!e)return void eT("Preview is not ready yet");let t=!to;e.postMessage({type:"viba:preview-picker-toggle",active:t},"*"),tc(t),eT(t?"Picker enabled: click an element in the preview":"Picker disabled")},[to,ti]),tQ=(0,r.useCallback)(e=>{let t=em.current?.contentWindow;return t?(t.postMessage(e,"*"),!0):(eT("Preview is not ready yet"),!1)},[]),t0=(0,r.useCallback)(e=>{ti?tQ({type:"viba:preview-navigation",action:e})&&"reload"===e&&eT("Reloading preview..."):eT("Load a preview before using navigation controls")},[tQ,ti]),t1=(0,r.useCallback)(()=>{tQ({type:"viba:preview-location-request"})},[tQ]),t2=(0,r.useCallback)((e,t)=>{let r=ei(e);return!!r&&(t?window.open(r,"_blank","noopener,noreferrer"):tJ(r,!0),!0)},[tJ]),t3=(0,r.useCallback)((e,t,r)=>{t.current?.();let n=e.contentWindow,a=n?.term;if(!n||!a)return;let s=r?.onLinkActivated,i=[],l=e.contentDocument,o={metaKey:!1,ctrlKey:!1,at:0};if(l){let e=e=>{o={metaKey:e.metaKey,ctrlKey:e.ctrlKey,at:Date.now()}};l.addEventListener("mousedown",e,!0),l.addEventListener("click",e,!0),i.push(()=>{l.removeEventListener("mousedown",e,!0),l.removeEventListener("click",e,!0)})}let c=n.open.bind(n);n.open=(...e)=>{let t=Date.now()-o.at<1e3&&(o.metaKey||o.ctrlKey);if("string"==typeof e[0]&&e[0].trim())return(s?.(),t2(e[0],t))?null:c(...e);if(0===e.length){let e=null;return{opener:null,location:{set href(url){if(s?.(),!t2(url,t)&&(e=c())){try{e.opener=null}catch{}e.location.href=url}},get href(){return""}}}}return c(...e)},i.push(()=>{n.open=c});let d=a._core?._linkProviderService?.linkProviders;if(d instanceof Map){for(let e of d.values())if(e&&"object"==typeof e){if("function"==typeof e._handler){let t=e._handler;e._handler=(e,r)=>{s?.(),t2(r,!!(e?.metaKey||e?.ctrlKey))||t(e,r)},i.push(()=>{e._handler=t})}if("function"==typeof e.provideLinks){let t=e.provideLinks.bind(e);e.provideLinks=(e,r)=>{t(e,e=>{if(Array.isArray(e))for(let t of e){if(!t||"object"!=typeof t||"function"!=typeof t.activate)continue;let e=t.activate.bind(t);t.activate=(t,r)=>{s?.(),t2(r,!!(t?.metaKey||t?.ctrlKey))||e(t,r)}}r(e)})},i.push(()=>{e.provideLinks=t})}}}let u=a.options.linkHandler,m={allowNonHttpProtocols:u?.allowNonHttpProtocols??!1,activate:(e,t,r)=>{s?.(),t2(t,!!(e?.metaKey||e?.ctrlKey))||u?.activate?.(e,t,r)},hover:(e,t,r)=>{u?.hover?.(e,t,r)},leave:(e,t,r)=>{u?.leave?.(e,t,r)}};a.options.linkHandler=m,i.push(()=>{a.options.linkHandler=u??null}),t.current=()=>{for(let e of i)e();t.current=null}},[t2]);if((0,r.useEffect)(()=>{if(!tr||ta.trim())return;let e=window.setTimeout(()=>{eh.current?.focus()},0);return()=>{window.clearTimeout(e)}},[tr,ta]),(0,r.useEffect)(()=>{let t=t=>{if(!em.current||t.source!==em.current.contentWindow)return;let r=t.data;if(r&&"object"==typeof r){if("viba:preview-picker-state"===r.type)return void tc(!!r.active);if("viba:preview-picker-ready"===r.type){let e=em.current?.contentWindow;e&&e.postMessage({type:"viba:preview-location-request"},"*");return}if("viba:preview-location-change"===r.type){"string"==typeof r.url&&r.url.trim().length>0&&ts(r.url);return}if("viba:preview-element-selected"===r.type){let t=r.element&&"object"==typeof r.element?r.element:null,a=Array.isArray(t?.reactComponentStack)?t.reactComponentStack:[],s=((e,t)=>{for(let r of e){if(!r||"object"!=typeof r)continue;let e="string"==typeof r.name?r.name.trim():"";if(!e)continue;let n="string"==typeof r.source?.fileName?r.source.fileName.trim():"",a=n?eo(n,t):null;if(a)return`${e} (${a})`}return null})(a,n||e),i=a[0]&&"object"==typeof a[0]?a[0].name:void 0,l="string"==typeof i&&i.trim().length>0?i.trim():"",o=new Set(["Suspense","ErrorBoundary","Router","AppRouter","LayoutRouter","RenderFromTemplateContext","ScrollAndFocusHandler","InnerLayoutRouter","RedirectErrorBoundary","NotFoundBoundary","LoadingBoundary","ReactDevOverlay","HotReload","AppContainer","Route","Link","Image","OuterLayoutRouter","Head","StringRefs","Fragment","Profiler","StrictMode","SuspenseList","Script","Page","__next_root_layout_boundary__"]),c=Array.from(new Set(a.map(e=>{if(!e||"object"!=typeof e)return"";let t=e.name;return"string"==typeof t?t.trim():""}).filter(e=>!(!e||o.has(e)||e.startsWith("styled.")||e.startsWith("Styled(")))));console.log("Filtered stack component names:",c);let d=s||l||("string"==typeof t?.selector?t.selector:"");if(console.log("Preview selected element:",t),console.log("Preview selected reactComponentStack:",a),console.log("Preview selected identifier:",d),tc(!1),!d)return void eT("Element selected. No identifier was resolved.");(async()=>{let e=s||"";if(!e&&c.length>0){tu(!0);try{let t=await tI(c);t?.resolvedName&&t?.sourcePath&&(e=`${t.resolvedName} (${t.sourcePath})`)}finally{tu(!1)}}if(!e){if(c.length>0)return eT("Element selected, but source file path could not be resolved for the component");e=d}console.log("Final resolved component identifier:",e),eT(await tB(`${e} `)?`Element identifier sent to agent: ${e}`:"Element selected, but failed to send identifier to agent input")})()}}};return window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}},[tB,e,tI,n]),(0,r.useEffect)(()=>{tc(!1)},[ti]),!e)return(0,t.jsx)("div",{className:"p-4 text-error",children:"No repository specified"});if("error"===eD)return(0,t.jsx)("div",{className:"flex h-screen w-full items-center justify-center bg-base-100",children:(0,t.jsx)("div",{className:"card w-96 bg-base-200 shadow-xl",children:(0,t.jsxs)("div",{className:"card-body items-center text-center",children:[(0,t.jsx)("h2",{className:"card-title text-error",children:"Cleanup failed"}),(0,t.jsx)("p",{children:eA||"An unknown error occurred while cleaning up this session."}),(0,t.jsx)("div",{className:"card-actions justify-end",children:(0,t.jsx)("button",{className:"btn btn-primary",onClick:()=>K(),children:"Back to Home"})})]})})});let t6=Array.from(new Set([...eQ?[eQ]:[],...e1])).filter(e=>e!==a||e===eQ),t4=tb?`calc(40px - min(${tv.width}px, calc(100vw - 2rem)))`:16;return(0,t.jsxs)("div",{className:`flex flex-col h-screen w-full overflow-hidden bg-base-100 ${tg||tp?"select-none":""}`,children:[(tg||tp)&&(0,t.jsx)("div",{className:`fixed inset-0 z-[9999] ${tg?"cursor-nwse-resize":"cursor-col-resize"}`}),(0,t.jsxs)("div",{className:"z-20 bg-base-300/95 p-2 text-xs flex justify-between px-4 font-mono select-none items-center shadow-md backdrop-blur-sm border-b border-base-content/10",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)("button",{className:"btn btn-ghost btn-xs h-6 min-h-6 px-1 hover:bg-base-content/10",onClick:()=>K(),title:"Back to Home",children:(0,t.jsx)($,{className:"w-4 h-4"})}),(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"opacity-50",children:"Repo:"}),(0,t.jsx)("span",{className:"font-bold",children:(0,G.getBaseName)(e)})]}),z&&(0,t.jsxs)("div",{className:"hidden min-[1200px]:flex min-w-0 items-center gap-2 text-[10px] opacity-70",children:[(0,t.jsx)("span",{children:"Session:"}),(0,t.jsx)("span",{className:"truncate max-w-[220px]",title:z,children:z})]})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsxs)("div",{className:"flex items-center border border-base-content/20 rounded overflow-hidden",children:[(0,t.jsx)("select",{className:"select select-xs h-6 min-h-6 bg-base-200 border-none focus:outline-none rounded-none pr-7",value:tE,onChange:tP,children:Q.map(e=>(0,t.jsx)("option",{value:e.id,children:e.name},e.id))}),(0,t.jsx)("div",{className:"w-[1px] h-4 bg-base-content/20"}),(0,t.jsxs)("button",{className:"btn btn-ghost btn-xs rounded-none h-6 min-h-6 border-none hover:bg-base-content/10",onClick:()=>{if(!n)return;let e=Q.find(e=>e.id===tE);if(!e)return;let t=`${e.protocol}://file/${encodeURI(n)}`;window.open(t,"_blank")},title:`Open in ${Q.find(e=>e.id===tE)?.name}`,children:[(0,t.jsx)(v,{className:"w-3 h-3"}),(0,t.jsx)("span",{className:el,children:"Open"})]})]}),(0,t.jsxs)("div",{className:"flex items-center border border-base-content/20 rounded overflow-hidden bg-base-100",children:[(0,t.jsxs)("button",{className:"btn btn-ghost btn-xs rounded-none h-6 min-h-6 border-none px-2 hover:bg-base-content/10",onClick:()=>{if(!n||!a)return;let e=new URLSearchParams({path:n,branch:a});window.open(`http://localhost:3100/workspace?${e.toString()}`,"_blank","noopener,noreferrer")},disabled:!n||!a,title:"Open this worktree and branch in Trident",children:[(0,t.jsx)(k.GitBranch,{className:"w-3 h-3"}),(0,t.jsx)("span",{className:el,children:"Diff"})]}),(0,t.jsx)("div",{className:"w-[1px] h-4 bg-base-content/10"}),(0,t.jsxs)("button",{className:"btn btn-ghost btn-xs rounded-none h-6 min-h-6 border-none px-2 hover:bg-base-content/10",onClick:tq,disabled:eI,title:"Ask agent to create a commit with current changes",children:[eI?(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}):(0,t.jsx)(g,{className:"w-3 h-3"}),(0,t.jsxs)("span",{className:el,children:["Commit (",te,")"]})]})]}),(0,t.jsxs)("div",{className:"flex items-center border border-base-content/20 rounded overflow-hidden bg-base-100",children:[(0,t.jsxs)("button",{className:"btn btn-ghost btn-xs rounded-none h-6 min-h-6 border-none px-2 hover:bg-base-content/10",onClick:()=>eG(!0),disabled:eJ,title:"Browse files and insert absolute paths into the agent input",children:[eJ?(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}):(0,t.jsx)(C,{className:"w-3 h-3"}),(0,t.jsx)("span",{className:el,children:"Add Files"})]}),(0,t.jsx)("div",{className:"w-[1px] h-4 bg-base-content/10"}),(0,t.jsxs)("button",{className:"btn btn-ghost btn-xs rounded-none h-6 min-h-6 border-none px-2 hover:bg-base-content/10",onClick:()=>{if(!e||!z)return;let t=`/new?repo=${encodeURIComponent(e)}&prefillFromSession=${encodeURIComponent(z)}`;window.open(t,"_blank","noopener,noreferrer")},title:"Start a new attempt in a new tab with this session context",children:[(0,t.jsx)(E.Plus,{className:"w-3 h-3"}),(0,t.jsx)("span",{className:el,children:"New Attempt"})]})]}),(0,t.jsxs)("div",{className:"flex items-center border border-base-content/20 rounded overflow-hidden bg-base-100",children:[U?.trim()&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{className:"btn btn-ghost btn-xs rounded-none h-6 min-h-6 border-none px-2 hover:bg-base-content/10",onClick:()=>{let e=U?.trim();if(!e||!eu.current)return;tx(!1);let t=eu.current;eU(!0),eT("Starting dev server...");let r=(n=0)=>{if(n>30){eT("Failed to start dev server: terminal is not ready"),eU(!1);return}try{let a=t.contentWindow;if(a&&a.term){a.term.paste(e);let r=t.contentDocument?.querySelector("textarea.xterm-helper-textarea");r?r.dispatchEvent(new KeyboardEvent("keypress",{bubbles:!0,cancelable:!0,charCode:13,keyCode:13,key:"Enter",view:a})):a.term.paste("\r"),a.focus(),r&&r.focus(),eT("Dev server start command sent"),eU(!1)}else setTimeout(()=>r(n+1),300)}catch(e){console.error("Dev server injection error",e),eT("Failed to start dev server"),eU(!1)}};r()},disabled:eB,title:"Run dev server script in terminal",children:[eB?(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}):(0,t.jsx)(w.Play,{className:"w-3 h-3"}),(0,t.jsx)("span",{className:el,children:"Dev"})]}),(0,t.jsx)("div",{className:"w-[1px] h-4 bg-base-content/10"})]}),(0,t.jsxs)("button",{className:"btn btn-ghost btn-xs rounded-none h-6 min-h-6 border-none px-2 hover:bg-base-content/10",onClick:()=>tn(e=>!e),title:tr?"Hide preview panel":"Show preview panel",children:[(0,t.jsx)(L,{className:"w-3 h-3"}),(0,t.jsx)("span",{className:el,children:tr?"Close":"Preview"})]})]}),(0,t.jsx)("div",{className:"flex items-center border border-base-content/20 rounded overflow-hidden bg-base-100",children:(0,t.jsxs)("button",{className:`btn btn-ghost btn-xs rounded-none h-6 min-h-6 border-none px-2 hover:bg-base-content/10 ${"select"===tS?"text-warning":""}`,onClick:tT,disabled:"tmux"!==V||t$,title:"tmux"===V?"scroll"===tS?"Switch to text select mode for easier copy":"Switch to scroll mode for wheel scrollback":"Mode toggle is available only in tmux persistence mode",children:[t$?(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}):(0,t.jsx)(P,{className:"w-3 h-3"}),(0,t.jsx)("span",{children:"scroll"===tS?"Scroll Mode":"Text Select"})]})}),(0,t.jsxs)("div",{className:"flex items-center border border-base-content/20 rounded relative bg-base-100",ref:tX,children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsxs)("button",{className:"btn btn-ghost btn-xs rounded-none rounded-l h-6 min-h-6 border-none px-2 hover:bg-base-content/10",onClick:()=>{tG(!tV)},disabled:eK||eH||e5,title:"Select base branch and rebase",children:[eK?(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}):(0,t.jsx)(j,{className:"w-3 h-3"}),(0,t.jsx)("span",{className:el,children:"Rebase"}),(0,t.jsx)(M,{className:"w-3 h-3 opacity-50 ml-0.5"})]}),tV&&(0,t.jsxs)("div",{className:"absolute top-full left-0 z-50 mt-1 w-64 p-0 shadow-xl dropdown-content bg-base-200 rounded-box border border-base-content/20 flex flex-col max-h-80 overflow-hidden",children:[(0,t.jsxs)("div",{className:"px-4 py-2 text-[10px] uppercase font-bold tracking-wider opacity-50 border-b border-base-content/10 bg-base-200 flex justify-between items-center shrink-0",children:[(0,t.jsx)("span",{children:"Select Base Branch"}),(e3||e5)&&(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"})]}),(0,t.jsxs)("ul",{className:"menu p-0 overflow-y-auto flex-nowrap custom-scrollbar overflow-x-hidden w-full",children:[t6.length>0?t6.map(e=>(0,t.jsx)("li",{children:(0,t.jsxs)("button",{onClick:()=>tY(e),className:`flex justify-between items-center text-xs py-2 truncate max-w-full rounded-none ${e===eQ?"active font-bold":""}`,title:e,children:[(0,t.jsx)("span",{className:"truncate",children:e}),e===eQ&&(0,t.jsx)("span",{className:"opacity-70 text-[10px] ml-2 shrink-0",children:"(Current)"})]})},e)):(0,t.jsx)("li",{className:"text-xs px-4 py-2 opacity-50 italic text-center",children:"No other branches found"}),(0,t.jsx)("div",{className:"divider my-1 opacity-50"}),(0,t.jsx)("li",{children:(0,t.jsx)("button",{onClick:()=>void tW(),className:"text-[10px] justify-center opacity-70 hover:opacity-100",children:"Refresh Branches"})})]})]})]}),(0,t.jsx)("div",{className:"w-[1px] h-4 bg-base-content/10"}),(0,t.jsxs)("button",{className:"btn btn-ghost btn-xs btn-success rounded-none h-6 min-h-6 border-none px-2 hover:bg-success/20 hover:border-transparent",onClick:tO,disabled:eH||eK||e5||!eQ,title:eQ?`Merge current branch (${a}) into target branch (${eQ})`:"Target branch unavailable for this session",children:[eH?(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"}):(0,t.jsx)(y,{className:"w-3 h-3"}),(0,t.jsx)("span",{className:el,children:"Merge"})]}),(0,t.jsx)("div",{className:"w-[1px] h-4 bg-base-content/10"}),(0,t.jsxs)("button",{className:"btn btn-ghost btn-error btn-xs rounded-none rounded-r h-6 min-h-6 border-none px-2 hover:bg-error/20 hover:border-transparent",onClick:tz,disabled:eH||eK||!n,title:"Clean up and exit",children:[(0,t.jsx)(b.Trash2,{className:"w-3 h-3"}),(0,t.jsx)("span",{className:el,children:"Purge"})]})]}),eQ&&(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs opacity-80",title:`Divergence against ${eQ}`,children:[(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(N,{className:"w-3 h-3"}),e7.ahead]}),(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(S,{className:"w-3 h-3"}),e7.behind]})]}),(0,t.jsx)("div",{className:"hidden min-[1200px]:block w-[1px] h-4 bg-base-content/20 mx-2"}),(0,t.jsxs)("div",{className:"hidden min-[1200px]:flex min-w-0 max-w-[280px] items-center gap-2",children:[(0,t.jsx)("span",{className:`w-2 h-2 rounded-full ${eF.includes("Error")||eF.includes("failed")?"bg-error":eF.includes("started")||eF.includes("Merged")||eF.includes("Rebased")||eF.includes("sent")?"bg-success":"bg-warning"}`}),(0,t.jsx)("span",{className:"truncate",title:eF,children:eF})]})]})]}),(0,t.jsxs)("div",{ref:ep,className:"flex min-h-0 flex-1 w-full",children:[(0,t.jsx)("div",{className:"h-full min-w-0",style:{width:tr?`${100*tm}%`:"100%"},children:(0,t.jsx)("iframe",{ref:ed,src:ew,className:`h-full w-full border-none dark:invert dark:brightness-90 ${tg||tp?"pointer-events-none":""}`,allow:"clipboard-read; clipboard-write",onLoad:()=>{if(!ed.current)return;let t=ed.current;try{t.contentWindow}catch(e){eT("Error: Cross-Origin access blocked. Ensure proxy is working.");return}t.contentWindow&&(t.contentWindow.onbeforeunload=null,t.contentWindow.addEventListener("beforeunload",e=>{e.stopImmediatePropagation()},!0)),eT("Connecting to terminal...");let r=(a=0)=>{if(a>30)return void eT("Timeout waiting for terminal to be ready");try{let s=t.contentWindow;if(s&&s.term){let i=s.term;t3(t,eb);try{i.options.theme={...i.options.theme||{},selectionBackground:"rgba(59, 130, 246, 0.4)"}}catch{}let l=e$("agent"),o=!!O&&"tmux"===V;if(l||o){o&&!l?(eE("agent"),eT("Attached to persisted terminal")):eT("Reconnected to terminal"),s.focus();let e=t.contentDocument?.querySelector("textarea.xterm-helper-textarea");e&&e.focus();return}if(!eL(i)&&a<10)return void setTimeout(()=>r(a+1),200);if(!eR("agent")){eT("Reconnected to terminal"),s.focus();let e=t.contentDocument?.querySelector("textarea.xterm-helper-textarea");e&&e.focus();return}let c=n||e,d=`cd ${ee(c)}`;i.paste(d);let u=()=>{let e=t.contentDocument?.querySelector("textarea.xterm-helper-textarea");e?e.dispatchEvent(new KeyboardEvent("keypress",{bubbles:!0,cancelable:!0,charCode:13,keyCode:13,key:"Enter",view:s})):i.paste("\r")};if(u(),eE("agent"),A){let t=async()=>{let t="";if(O)t=A.toLowerCase().includes("gemini")?"gemini --resume latest --yolo":A.toLowerCase().includes("codex")?"codex resume --last --sandbox danger-full-access --ask-for-approval on-request --search":"agent"===A.toLowerCase()||A.toLowerCase().includes("cursor")?"agent resume":`${ee(A)} resume`;else{let r=H?.trim()||"",a=[];r&&a.push(r),I&&a.push(I);let s=a.join("\n\n");if(_&&_.length>0){let t=`${n||e}-attachments`,r=["Attachments:",..._.map(e=>`- ${t}/${e}`)].join("\n");s=s?`${s}
|
|
2
|
+
|
|
3
|
+
${r}`:r}let i="";if(s)if(W&&W.trim().length>0||_&&_.length>0)try{let e=await m(z,s);e.success&&e.filePath?i=` "$(cat ${ee(e.filePath)})"`:(console.error("Failed to write prompt file, falling back to inline prompt",e.error),i=` ${ee(s)}`)}catch(e){console.error("Exception writing prompt file",e),i=` ${ee(s)}`}else i=` ${ee(s)}`;let l=q&&"auto"!==q.toLowerCase()?` --model ${ee(q)}`:"";t=A.toLowerCase().includes("codex")?`codex${l} --sandbox danger-full-access --ask-for-approval on-request --search${i}`:A.toLowerCase().includes("gemini")?`gemini${l} --yolo${i}`:"agent"===A.toLowerCase()||A.toLowerCase().includes("cursor")?`agent${l}${i}`:`${ee(A)}${l}${i}`}t&&(i.paste(t),u(),eT(O?`Resumed session with ${A}`:`Session started with ${A}`),!O&&X&&X())};setTimeout(()=>t(),500)}else eT(`Session started ${n?"(Worktree)":""}`),!O&&X&&X();s.focus();let h=t.contentDocument?.querySelector("textarea.xterm-helper-textarea");h&&h.focus()}else setTimeout(()=>r(a+1),500)}catch(e){eM("agent"),console.error("Access error during injection:",e),eT("Error accessing terminal: "+String(e))}};setTimeout(()=>r(),1e3)}})}),tr&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"relative h-full w-2 shrink-0 cursor-col-resize bg-base-300/40 hover:bg-base-content/20",onMouseDown:e=>{e.preventDefault(),tf(!0),ef.current={startX:e.clientX,startRatio:tm}},role:"separator","aria-orientation":"vertical","aria-label":"Resize preview panel",title:"Drag to resize preview panel",children:(0,t.jsx)("div",{className:"absolute left-1/2 top-1/2 h-12 w-[2px] -translate-x-1/2 -translate-y-1/2 rounded-full bg-base-content/30"})}),(0,t.jsxs)("div",{className:"flex h-full min-w-0 flex-1 flex-col border-l border-base-content/10 bg-base-200/50",children:[(0,t.jsxs)("form",{className:"flex items-center gap-2 border-b border-base-content/10 bg-base-200 px-3 py-2",onSubmit:e=>{e.preventDefault(),tJ(ta,!0)},children:[(0,t.jsx)("button",{className:"btn btn-ghost btn-xs h-7 min-h-7 w-7 p-0",type:"button",onClick:()=>t0("back"),disabled:!ti,title:"Go back","aria-label":"Go back",children:(0,t.jsx)(F.ArrowLeft,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("button",{className:"btn btn-ghost btn-xs h-7 min-h-7 w-7 p-0",type:"button",onClick:()=>t0("forward"),disabled:!ti,title:"Go forward","aria-label":"Go forward",children:(0,t.jsx)(T,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("button",{className:"btn btn-ghost btn-xs h-7 min-h-7 w-7 p-0",type:"button",onClick:()=>t0("reload"),disabled:!ti,title:"Reload preview","aria-label":"Reload preview",children:(0,t.jsx)(D,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("input",{ref:eh,type:"text",className:"input input-xs input-bordered w-full font-mono",value:ta,onChange:e=>ts(e.target.value),placeholder:"http://127.0.0.1:3000",spellCheck:!1}),(0,t.jsx)("button",{className:`btn btn-ghost btn-xs ${to?"btn-active text-success":""}`,type:"button",onClick:tZ,disabled:!ti||td,title:to?"Disable picker":"Pick element from preview",children:td?(0,t.jsx)("span",{className:"loading loading-spinner loading-xs w-3 h-3"}):(0,t.jsx)(P,{className:"h-3 w-3"})}),(0,t.jsx)("button",{className:"btn btn-xs",type:"submit",children:"Go"})]}),(0,t.jsx)("div",{className:"min-h-0 flex-1",children:ti?(0,t.jsx)("iframe",{ref:em,src:ti,className:`h-full w-full border-none ${tg||tp?"pointer-events-none":""}`,title:"Dev server preview",onLoad:t1,sandbox:"allow-forms allow-modals allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-downloads"}):(0,t.jsx)("div",{className:"flex h-full items-center justify-center px-6 text-center text-xs opacity-70",children:"Run the dev server, or enter a URL above to load a preview."})})]})]})]}),(0,t.jsxs)("div",{className:`absolute z-30 overflow-hidden rounded-lg border border-base-content/20 bg-base-200/95 shadow-2xl backdrop-blur-sm ${tg||tp?"":"transition-all"}`,style:{bottom:80,right:t4,width:tv.width,height:tb?40:tv.height,maxWidth:"calc(100vw - 2rem)",maxHeight:"calc(100vh - 2rem)"},children:[(0,t.jsx)("button",{className:`absolute left-0 top-0 z-50 flex h-10 w-10 items-center justify-center text-base-content/30 hover:text-base-content/60 ${tb?"cursor-pointer":"cursor-nwse-resize"}`,onMouseDown:tb?void 0:e=>{e.preventDefault(),e.stopPropagation(),ty(!0),tN.current={startX:e.clientX,startY:e.clientY,startWidth:tv.width,startHeight:tv.height}},onClick:tb?()=>tx(!1):void 0,title:tb?"Expand terminal":"Drag to resize",type:"button",children:(0,t.jsx)(R,{size:14})}),!tb&&(0,t.jsxs)("button",{className:"flex h-10 w-full items-center justify-between px-3 pl-10 text-xs font-mono hover:bg-base-content/10",onClick:()=>tx(e=>!e),title:"Minimize terminal",type:"button",children:[(0,t.jsx)("span",{children:"Terminal"}),(0,t.jsx)("span",{className:"opacity-70",children:"Hide"})]}),(0,t.jsx)("div",{className:tb?"h-0 overflow-hidden":"h-[calc(100%-2.5rem)]",children:(0,t.jsx)("iframe",{ref:eu,src:eg,className:`h-full w-full border-none dark:invert dark:brightness-90 ${tg||tp?"pointer-events-none":""}`,allow:"clipboard-read; clipboard-write",onLoad:()=>{if(!eu.current)return;let t=eu.current;try{t.contentWindow}catch(e){console.error("Secondary terminal: Cross-Origin access blocked.");return}t.contentWindow&&(t.contentWindow.onbeforeunload=null,t.contentWindow.addEventListener("beforeunload",e=>{e.stopImmediatePropagation()},!0));let r=(a=0)=>{if(!(a>30))try{let s=t.contentWindow;if(s&&s.term){let i,l=s.term;t3(t,ex,{onLinkActivated:()=>tx(!0)});try{l.options.theme={...l.options.theme||{},selectionBackground:"rgba(59, 130, 246, 0.4)"}}catch{}try{let e=()=>{l.buffer?.active&&(l.buffer.active.baseY,l.buffer.active.viewportY),l.scrollToBottom()};if(l.onWriteParsed)l.onWriteParsed(e);else{let r=t.contentDocument?.querySelector(".xterm-screen")||t.contentDocument?.body;r&&new MutationObserver(e).observe(r,{childList:!0,subtree:!0,characterData:!0})}}catch(e){console.error("Failed to setup auto-scroll:",e)}let o=e$("terminal"),c=!!O&&"tmux"===V;if(o||c){c&&!o&&eE("terminal"),o&&eP(t,s,l),s.focus();let e=t.contentDocument?.querySelector("textarea.xterm-helper-textarea");e&&e.focus();return}if(!eL(l)&&a<10)return void setTimeout(()=>r(a+1),200);if(!eR("terminal")){s.focus();let e=t.contentDocument?.querySelector("textarea.xterm-helper-textarea");e&&e.focus();return}let d=n||e,u=`cd ${ee(d)}`;l.paste(u),(i=t.contentDocument?.querySelector("textarea.xterm-helper-textarea"))?i.dispatchEvent(new KeyboardEvent("keypress",{bubbles:!0,cancelable:!0,charCode:13,keyCode:13,key:"Enter",view:s})):l.paste("\r"),eE("terminal"),eP(t,s,l),s.focus();let m=t.contentDocument?.querySelector("textarea.xterm-helper-textarea");m&&m.focus()}else setTimeout(()=>r(a+1),500)}catch(e){eM("terminal"),console.error("Secondary terminal injection error",e)}};setTimeout(()=>r(),1e3)}})})]}),eV&&(0,t.jsx)(Y,{initialPath:eX,worktreePath:n,onPathChange:eY,onConfirm:e=>{eG(!1),tU(e)},onCancel:()=>eG(!1)})]})}let eu=(0,a.createServerReference)("40357eb783999f3ea0c0f6a3dfa2d4e77085006dfc",a.callServer,void 0,a.findSourceMapURL,"consumeSessionLaunchContext"),em=(0,a.createServerReference)("401e617acd2d3a4a94e596d826c84325f456b481b8",a.callServer,void 0,a.findSourceMapURL,"getSessionMetadata"),eh=(0,a.createServerReference)("401c94f9bf976158f11e4512b8ac1867f3d54499f2",a.callServer,void 0,a.findSourceMapURL,"markSessionInitialized");var ep=e.i(59119);function ef(){let e=(0,n.useParams)().sessionId,a=Array.isArray(e)?e[0]:e,s=(0,n.useRouter)(),[i,l]=(0,r.useState)(null),[o,c]=(0,r.useState)(!0),[d,u]=(0,r.useState)(null),[m,h]=(0,r.useState)(void 0),[p,f]=(0,r.useState)(void 0),[b,x]=(0,r.useState)(void 0),[v,w]=(0,r.useState)([]),[g,y]=(0,r.useState)(void 0),[j,k]=(0,r.useState)(void 0),[N,S]=(0,r.useState)(void 0),[C,$]=(0,r.useState)(!0),[R,M]=(0,r.useState)("shell");(0,r.useEffect)(()=>(document.documentElement.classList.add("session-page"),()=>{document.documentElement.classList.remove("session-page")}),[]),(0,r.useEffect)(()=>{a&&(async()=>{try{let e=await (0,ep.startTtydProcess)();if(!e.success){u("Failed to start terminal service"),c(!1);return}M("tmux"===e.persistenceMode?"tmux":"shell");let t=await em(a);if(!t){u("Session not found"),c(!1);return}if(l(t),!1===t.initialized){let e=await eu(a);if(e.success&&e.context){let t=e.context;h(t.initialMessage),f(t.rawInitialMessage),x(t.startupScript),w(t.attachmentNames||[]),y(t.title),k(t.agentProvider),S(t.model)}$(!1)}else $(!0);c(!1)}catch(e){console.error("Failed to load session:",e),u("Failed to load session"),c(!1)}})()},[a]);let E=e=>{e?window.location.href="/":s.push("/")},L=async()=>{a&&await eh(a)};return o?(0,t.jsx)("div",{className:"flex h-screen w-full items-center justify-center bg-base-100",children:(0,t.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,t.jsx)("span",{className:"loading loading-spinner loading-lg text-primary"}),(0,t.jsx)("p",{className:"opacity-60",children:"Loading session..."})]})}):d||!i?(0,t.jsx)("div",{className:"flex h-screen w-full items-center justify-center bg-base-100",children:(0,t.jsx)("div",{className:"card w-96 bg-base-200 shadow-xl",children:(0,t.jsxs)("div",{className:"card-body items-center text-center",children:[(0,t.jsx)("h2",{className:"card-title text-error",children:"Error"}),(0,t.jsx)("p",{children:d||"Session not found"}),(0,t.jsx)("div",{className:"card-actions justify-end",children:(0,t.jsx)("button",{className:"btn btn-primary",onClick:()=>E(),children:"Back to Home"})})]})})}):(0,t.jsx)(ed,{repo:i.repoPath,worktree:i.worktreePath,branch:i.branchName,baseBranch:i.baseBranch,sessionName:i.sessionName,agent:j||i.agent,model:N||i.model,startupScript:b,devServerScript:i.devServerScript,initialMessage:m,rawInitialMessage:p,title:g||i.title,attachmentNames:v,onExit:E,isResume:C,terminalPersistenceMode:R,onSessionStart:L})}e.s(["default",()=>ef],36438)}]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,5951,e=>{"use strict";var t=e.i(43476),a=e.i(71645),s=e.i(75254);let r=(0,s.default)("folder-git-2",[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]);var l=e.i(55716),i=e.i(7233);let n=(0,s.default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),c=(0,s.default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),o=(0,s.default)("folder-cog",[["path",{d:"M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.98a2 2 0 0 1 1.69.9l.66 1.2A2 2 0 0 0 12 6h8a2 2 0 0 1 2 2v3.3",key:"128dxu"}],["path",{d:"m14.305 19.53.923-.382",key:"3m78fa"}],["path",{d:"m15.228 16.852-.923-.383",key:"npixar"}],["path",{d:"m16.852 15.228-.383-.923",key:"5xggr7"}],["path",{d:"m16.852 20.772-.383.924",key:"dpfhf9"}],["path",{d:"m19.148 15.228.383-.923",key:"1reyyz"}],["path",{d:"m19.53 21.696-.382-.924",key:"1goivc"}],["path",{d:"m20.772 16.852.924-.383",key:"htqkph"}],["path",{d:"m20.772 19.148.924.383",key:"9w9pjp"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]),d=(0,s.default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]),m=(0,s.default)("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);var u=e.i(27612),h=e.i(31343),p=e.i(95187);let f=(0,p.createServerReference)("40e04cf2a2afa6c7d306984663d4883f00455b36c3",p.callServer,void 0,p.findSourceMapURL,"checkDirectoryAccessible"),x=(0,p.createServerReference)("40ffd9754caf8d0c6f363b1ab1c5e87fcb004ac06d",p.callServer,void 0,p.findSourceMapURL,"listDirectories");var b=e.i(8043),g=e.i(27025),v=e.i(71689);let y=(0,s.default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);var w=e.i(81016);function j({title:e,initialPath:s,onSelect:r,onCancel:l,checkRepo:i}){let[n,c]=(0,a.useState)(""),[o,d]=(0,a.useState)(""),[m,u]=(0,a.useState)([]),[h,p]=(0,a.useState)(!1),[j,N]=(0,a.useState)(null);(0,a.useEffect)(()=>{let e=!0;return(async()=>{try{let t=await (0,b.getHomeDirectory)();if(!e)return;d(t),c(s||t)}catch(t){if(console.error("Failed to resolve home directory:",t),!e)return;N("Failed to access your home directory."),c(s||"/")}})(),()=>{e=!1}},[s]),(0,a.useEffect)(()=>{if(!n)return;let e=!0;return(async()=>{p(!0),N(null);try{let t=await x(n);if(!e)return;if(0===t.length&&o&&n!==o){let t=await f(n);if(!e)return;if(!t){N(`Could not access "${n}". Showing home directory.`),c(o);return}}let a=t.map(e=>({name:e.name,path:e.path,isDirectory:e.isDirectory,isGitRepo:e.isGitRepo}));u(a)}catch(t){if(console.error(t),!e)return;if(o&&n!==o){N(`Could not access "${n}". Showing home directory.`),c(o);return}u([]),N("Failed to load directory contents")}finally{e&&p(!1)}})(),()=>{e=!1}},[n,o]);let S=async e=>{if(i&&!await i(e)){N("Selected directory is not a valid git repository."),setTimeout(()=>N(null),3e3);return}await r(e)},k=async()=>{await S(n)};return(0,t.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm p-4",children:(0,t.jsxs)("div",{className:"bg-base-200 rounded-lg shadow-xl w-full max-w-3xl h-[80vh] flex flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-4 border-b border-base-300",children:[(0,t.jsxs)("h2",{className:"text-xl font-bold flex items-center gap-2",children:[(0,t.jsx)(g.Folder,{className:"w-5 h-5"}),e||"Browse Local Repository"]}),(0,t.jsx)("button",{onClick:l,className:"btn btn-sm btn-ghost btn-circle",children:"✕"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-base-300",children:[(0,t.jsx)("button",{onClick:()=>{let e=(0,w.getDirName)(n);e&&e!==n&&c(e)},className:"btn btn-sm btn-square btn-ghost",title:"Go Up",disabled:"/"===n||!n,children:(0,t.jsx)(v.ArrowLeft,{className:"w-4 h-4"})}),(0,t.jsx)("div",{className:"flex-1 overflow-x-auto whitespace-nowrap px-2 font-mono text-sm",children:n}),(0,t.jsx)("button",{onClick:k,className:"btn btn-sm btn-primary",children:"Select Current Folder"})]}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto p-2",children:h?(0,t.jsx)("div",{className:"flex justify-center items-center h-full",children:(0,t.jsx)("span",{className:"loading loading-spinner loading-lg"})}):j?(0,t.jsx)("div",{className:"alert alert-error",children:j}):0===m.length?(0,t.jsx)("div",{className:"text-center text-base-content/50 mt-10",children:"Empty directory"}):(0,t.jsx)("div",{className:"grid grid-cols-1 gap-1",children:m.map(e=>(0,t.jsxs)("div",{className:"flex items-center justify-between p-2 hover:bg-base-100 rounded-md cursor-pointer transition-colors",onClick:()=>{c(e.path)},children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 overflow-hidden",children:[(0,t.jsx)(g.Folder,{className:`w-5 h-5 ${e.isGitRepo?"text-primary":"text-base-content/70"}`}),(0,t.jsx)("span",{className:"truncate",children:e.name}),e.isGitRepo&&(0,t.jsx)("span",{className:"badge badge-xs badge-primary",children:"git"})]}),e.isGitRepo&&(0,t.jsxs)("button",{className:"btn btn-xs btn-primary",onClick:t=>{t.stopPropagation(),S(e.path)},title:`Select ${e.name}`,children:[(0,t.jsx)(y,{className:"w-3 h-3"}),"Select"]})]},e.path))})}),(0,t.jsx)("div",{className:"p-3 border-t border-base-300 text-xs text-base-content/50 text-center",children:'Navigate to a folder and click "Select Current Folder" to choose it.'})]})})}let N=(0,p.createServerReference)("400782a3f97715c98c967e2f396d19d693c2041dad",p.callServer,void 0,p.findSourceMapURL,"checkIsGitRepo"),S=(0,p.createServerReference)("40aa54365d229ff47bf5d53b3e4bfdd21ee82193aa",p.callServer,void 0,p.findSourceMapURL,"getBranches"),k=(0,p.createServerReference)("600382d582a4b4cf6c5b442390aacd42b500f83837",p.callServer,void 0,p.findSourceMapURL,"checkoutBranch");var R=e.i(56382);let C=(0,p.createServerReference)("7f9ed5e1e4229c377fd85f4f7524069b137baa5b87",p.callServer,void 0,p.findSourceMapURL,"getStartupScript"),M=(0,p.createServerReference)("7fc47c9eed1b7933ba384f96662dafa0a9b380bd60",p.callServer,void 0,p.findSourceMapURL,"getDefaultDevServerScript"),D=(0,p.createServerReference)("7fccca6ac13459bb9638e3a08cb7913c923227fc5d",p.callServer,void 0,p.findSourceMapURL,"listRepoFiles");var L=e.i(73708);let E=(0,p.createServerReference)("401b05e1609d7de213bdbd2f05ccb4a50355b81c8c",p.callServer,void 0,p.findSourceMapURL,"checkAgentCliInstalled"),F=(0,p.createServerReference)("40f0690e83fc46a0314a2ec86c258299ccb7c986ab",p.callServer,void 0,p.findSourceMapURL,"installAgentCli"),P=(0,p.createServerReference)("40642b5e03d55c14e450b5d9ed00241038d23516fa",p.callServer,void 0,p.findSourceMapURL,"resolveRepositoryByName"),$=(0,p.createServerReference)("70065a92fb1e241bd84f05b4e3b13affa3d1946c02",p.callServer,void 0,p.findSourceMapURL,"copySessionAttachments"),U=(0,p.createServerReference)("7000ceadf25434a3fee9e40e378cdd319c2d1ea8f1",p.callServer,void 0,p.findSourceMapURL,"createSession"),A=(0,p.createServerReference)("4043d0168426852ee7d28bc7b8672390ce05409e35",p.callServer,void 0,p.findSourceMapURL,"deleteSession"),T=(0,p.createServerReference)("405fb3fbd5af2014f0e0bd23a9c24cea6ad6c2c1ac",p.callServer,void 0,p.findSourceMapURL,"getSessionPrefillContext"),I=(0,p.createServerReference)("40950c45c77b1159158894addef799cbfa1868f05c",p.callServer,void 0,p.findSourceMapURL,"listSessions"),K=(0,p.createServerReference)("60a9dccd117bb437e297b227dac6296c048e8a7a0b",p.callServer,void 0,p.findSourceMapURL,"saveSessionLaunchContext");var B=e.i(11607),O=e.i(78669);let G=(0,p.createServerReference)("6001b7cb18e9eda22799a38833b5ada49df5ca199f",p.callServer,void 0,p.findSourceMapURL,"updateRepoSettings");var z=e.i(18566),V=e.i(63671),H=e.i(57688);let _=e.i(35027).default,q="After each round of conversation, if work is completed and files changed, commit all changes with an appropriate git commit message. The commit message must include a clear title and a detailed body describing what changed and why, not just a title. No need to confirm when creating commits.",W={gemini:"gemini",codex:"codex",agent:"agent"},Y={gemini:"Gemini CLI",codex:"Codex CLI",agent:"Cursor Agent CLI"};function J({mode:e="home",repoPath:s=null,fromRepoName:p=null,prefillFromSession:f=null}){let[x,b]=(0,a.useState)(!1),[g,v]=(0,a.useState)(!1),[y,J]=(0,a.useState)(null),[Q,X]=(0,a.useState)(null),Z=(0,z.useRouter)(),[ee,et]=(0,a.useState)([]),[ea,es]=(0,a.useState)(""),[er,el]=(0,a.useState)([]),[ei,en]=(0,a.useState)([]),[ec,eo]=(0,a.useState)(null),[ed,em]=(0,a.useState)(""),[eu,eh]=(0,a.useState)(""),[ep,ef]=(0,a.useState)(""),[ex,eb]=(0,a.useState)(!1),[eg,ev]=(0,a.useState)(""),[ey,ew]=(0,a.useState)(""),[ej,eN]=(0,a.useState)([]),[eS,ek]=(0,a.useState)([]),[eR,eC]=(0,a.useState)(null),[eM,eD]=(0,a.useState)(!1),[eL,eE]=(0,a.useState)(!1),[eF,eP]=(0,a.useState)(null),[e$,eU]=(0,a.useState)(null),[eA,eT]=(0,a.useState)(!1),[eI,eK]=(0,a.useState)(!1),[eB,eO]=(0,a.useState)(!1),[eG,ez]=(0,a.useState)(null),[eV,eH]=(0,a.useState)(!1),[e_,eq]=(0,a.useState)(null),[eW,eY]=(0,a.useState)(""),[eJ,eQ]=(0,a.useState)(!1),[eX,eZ]=(0,a.useState)(null),e0=(0,a.useRef)(null),e2=ec&&ed?`Show Session Setup (${ec.name} / ${ed})`:"Show Session Setup",e1=(0,a.useCallback)(()=>{(0,V.notifySessionsUpdated)()},[]),e3=(0,a.useCallback)(async(e=Q)=>{try{let[t,a]=await Promise.all([I(),e?I(e):Promise.resolve([])]);en(t),e&&el(a)}catch(e){console.error("Failed to refresh sessions",e)}},[Q]),e4=(0,a.useCallback)(e=>"gemini"===e||"codex"===e||"agent"===e?e:null,[]);(0,a.useEffect)(()=>{(async()=>{try{let[e,t]=await Promise.all([(0,B.getConfig)(),I()]);J(e),en(t)}catch(e){console.error("Failed to load data",e)}finally{eK(!0)}})()},[]),(0,a.useEffect)(()=>{let t=()=>{e3("new"===e?Q:null)},a=e=>{e.key===V.SESSIONS_UPDATED_STORAGE_KEY&&t()},s=()=>{t()},r=()=>{t()};return window.addEventListener("storage",a),window.addEventListener("focus",s),window.addEventListener(V.SESSIONS_UPDATED_EVENT,r),()=>{window.removeEventListener("storage",a),window.removeEventListener("focus",s),window.removeEventListener(V.SESSIONS_UPDATED_EVENT,r)}},[e,e3,Q]);let e5=async e=>{X(e),ty([]),await e7(e),await te(e),await e3(e)},e6=async t=>{eE(!0),eU(null);try{if(!await N(t))return eU("Selected directory is not a valid git repository."),!1;let a=[...(y||await (0,B.getConfig)()).recentRepos];a.includes(t)?a=[t,...a.filter(e=>e!==t)]:a.unshift(t);let s=await (0,O.updateConfig)({recentRepos:a});if(J(s),b(!1),"home"===e)return Z.push(`/new?repo=${encodeURIComponent(t)}`),!0;return await e5(t),!0}catch(e){return console.error(e),eU("Failed to open repository."),!1}finally{eE(!1)}},e8=async t=>{if("new"!==e)return;let a=t.target.value;if(!a||a===Q||!await e6(a))return;let s=new URLSearchParams;s.set("repo",a),f&&s.set("prefillFromSession",f),Z.replace(`/new?${s.toString()}`)};(0,a.useEffect)(()=>{if("new"===e){if(!s){X(null),el([]),et([]),es("");return}s!==Q&&e6(s)}},[e,s,Q]),(0,a.useEffect)(()=>{if("new"!==e)return;if(s)return void eT(!1);let t=p?.trim()??"";if(!t)return void eT(!1);let a=!1;return(async()=>{eU(null),eT(!0);let e=await P(t);if(a)return;if(!e.success){eU(e.error||"Failed to search repositories."),eT(!1);return}if(!e.repoPath){eU(`Could not find a matching repository for "${t}".`),eT(!1);return}let s=new URLSearchParams;s.set("repo",e.repoPath),f&&s.set("prefillFromSession",f),Z.replace(`/new?${s.toString()}`)})(),()=>{a=!0}},[p,e,f,s,Z]),(0,a.useEffect)(()=>{eD(!1),ek([]),eC(null)},[f]),(0,a.useEffect)(()=>{if("new"!==e||!Q||!f||eM)return;let t=!1;return(async()=>{let e=await T(f);if(t)return;if(!e.success||!e.context){e.error&&eU(e.error),eD(!0);return}let a=e.context;if(a.repoPath!==Q)return eD(!0);let s=_.find(e=>e.cli===a.agentProvider);s&&(eo(s),a.model&&("auto"===a.model||s.models.some(e=>e.id===a.model))?em(a.model):em("auto")),ew(a.title||""),ev(a.initialMessage||""),ek(a.attachmentNames||[]),eC(a.sourceSessionName),eb(!0),eD(!0)})(),()=>{t=!0}},[eM,e,f,Q]);let e7=async e=>{let t=y||await (0,B.getConfig)();y||J(t);let a=t.repoSettings[e]||{},s=a.agentProvider,r=a.agentModel,l=a.startupScript,i=a.devServerScript;if(s){let e=_.find(e=>e.cli===s);e?(eo(e),r&&("auto"===r||e.models.some(e=>e.id===r))?em(r):em("auto")):(eo(_[0]),em("auto"))}else eo(_[0]),em("auto");null!=l?eh(l):eh(await C(e)),null!=i?ef(i):ef(await M(e))},e9=async e=>{J(await (0,O.updateConfig)({defaultRoot:e})),v(!1)},te=async e=>{try{let t=await S(e);et(t);let a=((y||await (0,B.getConfig)()).repoSettings[e]||{}).lastBranch,s=t.find(e=>e.current)?.name;if(a&&t.some(e=>e.name===a)){if(es(a),a!==s)try{await k(e,a);let t=await S(e);et(t)}catch(e){console.warn("Could not auto-checkout to remembered branch",e),s&&es(s)}}else s&&es(s)}catch(e){console.error("Failed to load branches",e),eU("Failed to load branches.")}},tt=async e=>{let t=e.target.value;if(Q){eE(!0);try{await k(Q,t),es(t);let e=await G(Q,{lastBranch:t});J(e);let a=await S(Q);et(a)}catch{eU(`Failed to checkout branch ${t}`)}finally{eE(!1)}}},ta=async e=>{let t=e.target.value,a=_.find(e=>e.cli===t);if(a&&Q){eo(a);let e="auto";em(e),J(await G(Q,{agentProvider:a.cli,agentModel:e}))}},ts=async e=>{let t=e.target.value;em(t),Q&&J(await G(Q,{agentModel:t}))},tr=async e=>{eh(e.target.value)},tl=async()=>{Q&&J(await G(Q,{startupScript:eu}))},ti=async e=>{Q&&J(await G(Q,{devServerScript:e}))},tn=async()=>{await ti(ep)},tc=(0,a.useCallback)((e,t)=>{if(e.name&&e.name.trim().length>0)return e;let a=e.type&&e.type.split("/")[1]?.split("+")[0]||"bin";return new File([e],`pasted-file-${Date.now()}-${t+1}.${a}`,{type:e.type,lastModified:e.lastModified||Date.now()})},[]),to=(0,a.useCallback)(e=>{0!==e.length&&eN(t=>{let a=new Map(t.map(e=>[e.name,e]));return e.forEach(e=>{a.set(e.name,e)}),Array.from(a.values())})},[]),[td,tm]=(0,a.useState)(!1),[tu,th]=(0,a.useState)([]),[,tp]=(0,a.useState)(""),[tf,tx]=(0,a.useState)(0),[tb,tg]=(0,a.useState)(0),[tv,ty]=(0,a.useState)([]),tw=async e=>{let t=e.target.value,a=e.target.selectionStart;ev(t),tx(a);let s=t.substring(0,a),r=s.lastIndexOf("@");if(-1!==r){let e=s.substring(r+1);if(!/\s/.test(e)){if(tp(e),tm(!0),Q){var l;let t,a=tv;0===tv.length&&ty(a=await D(Q)),l=a,t=e.toLowerCase(),th([...[...ej.map(e=>e.name),...eS].filter(e=>e.toLowerCase().includes(t)),...l.filter(e=>e.toLowerCase().includes(t)).slice(0,20)]),tg(0)}return}}tm(!1)},tj=e=>{let t=eg.substring(0,tf).lastIndexOf("@");if(-1!==t){let a=eg.substring(0,t),s=eg.substring(tf);ev(`${a}@${e} ${s}`),tm(!1)}};(0,a.useEffect)(()=>{if("new"!==e||!Q)return;let t=e=>{let t=e.clipboardData;if(!t)return;let a=Array.from(t.items).filter(e=>"file"===e.kind).map(e=>e.getAsFile()).filter(e=>null!==e),s=(a.length>0?a:Array.from(t.files)).map((e,t)=>tc(e,t));0!==s.length&&(e.preventDefault(),to(s))};return window.addEventListener("paste",t),()=>{window.removeEventListener("paste",t)}},[to,e,tc,Q]);let tN=async(e,t)=>{if(e.stopPropagation(),y){let e=y.recentRepos.filter(e=>e!==t);J(await (0,O.updateConfig)({recentRepos:e}))}},tS=(0,a.useCallback)(()=>{if(!eV||!eW||!e0.current)return;let e=e0.current,t=(a=0)=>{if(a>40)return void eZ("Timed out while waiting for terminal to initialize.");try{let s=e.contentWindow;if(s?.term){s.term.paste(`${eW}\r`),eQ(!0),eZ(null),s.focus();return}setTimeout(()=>t(a+1),300)}catch(e){console.error("Failed to inject login command into terminal iframe:",e),eZ("Could not access ttyd terminal. Ensure ttyd is running and try again.")}};setTimeout(()=>t(),500)},[eV,eW]),tk=(0,a.useCallback)(async()=>{let e=e4(ec?.cli);if(!e)return!0;let t=await E(e);if(!t.success)return eU(t.error||`Failed to verify ${Y[e]} installation status.`),!1;if(t.installed)return!0;eO(!0),ez(e),eU(null);let a=await F(e);if(eO(!1),ez(null),!a.success)return eU(a.error||`Failed to install ${Y[e]}.`),!1;let s=await (0,R.startTtydProcess)();return s.success?(eq(e),eY(W[e]),eQ(!1),eZ(null),eH(!0)):eU(s.error||"Failed to start ttyd"),!1},[ec?.cli,e4]),tR=async(e={})=>{if(Q){eE(!0),eU(null);try{if(!e.skipAgentSetup&&!await tk())return void eE(!1);let t=ep.trim();!t&&(t=await M(Q))&&ef(t),await tl(),await ti(t);let a=await (0,R.startTtydProcess)();if(!a.success){eU(a.error||"Failed to start ttyd"),eE(!1);return}let s=await U(Q,ea||"main",{agent:ec?.cli||"agent",model:ed||"",title:ey,devServerScript:t||void 0});if(s.success&&s.sessionName&&s.worktreePath&&s.branchName){let e=[],t=[];if(ej.length>0){let t=new FormData;ej.forEach(e=>t.append(e.name,e)),e=await (0,L.saveAttachments)(s.worktreePath,t)}if(eR&&eS.length>0){let e=await $(eR,s.worktreePath,eS);if(!e.success){eU(e.error||"Failed to carry over attachments from source session"),eE(!1);return}t=e.copiedAttachmentNames}let a=Array.from(new Set([...e,...t])),r=eg.trim(),l=r;l&&(l.includes(q)||(l=`${l}
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,5951,e=>{"use strict";var t=e.i(43476),a=e.i(71645),s=e.i(75254);let r=(0,s.default)("folder-git-2",[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]);var l=e.i(55716),i=e.i(7233);let n=(0,s.default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),c=(0,s.default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),o=(0,s.default)("folder-cog",[["path",{d:"M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.98a2 2 0 0 1 1.69.9l.66 1.2A2 2 0 0 0 12 6h8a2 2 0 0 1 2 2v3.3",key:"128dxu"}],["path",{d:"m14.305 19.53.923-.382",key:"3m78fa"}],["path",{d:"m15.228 16.852-.923-.383",key:"npixar"}],["path",{d:"m16.852 15.228-.383-.923",key:"5xggr7"}],["path",{d:"m16.852 20.772-.383.924",key:"dpfhf9"}],["path",{d:"m19.148 15.228.383-.923",key:"1reyyz"}],["path",{d:"m19.53 21.696-.382-.924",key:"1goivc"}],["path",{d:"m20.772 16.852.924-.383",key:"htqkph"}],["path",{d:"m20.772 19.148.924.383",key:"9w9pjp"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]),d=(0,s.default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]),m=(0,s.default)("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);var u=e.i(27612),h=e.i(31343),p=e.i(95187);let f=(0,p.createServerReference)("40bca0b0c9ecf596f3ae0883a2e9b8f35fbc0091a2",p.callServer,void 0,p.findSourceMapURL,"checkDirectoryAccessible"),x=(0,p.createServerReference)("4075cc31cfcac99e0e20a7bb195648ea32adf11196",p.callServer,void 0,p.findSourceMapURL,"listDirectories");var b=e.i(79799),g=e.i(27025),v=e.i(71689);let y=(0,s.default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);var w=e.i(81016);function j({title:e,initialPath:s,onSelect:r,onCancel:l,checkRepo:i}){let[n,c]=(0,a.useState)(""),[o,d]=(0,a.useState)(""),[m,u]=(0,a.useState)([]),[h,p]=(0,a.useState)(!1),[j,N]=(0,a.useState)(null);(0,a.useEffect)(()=>{let e=!0;return(async()=>{try{let t=await (0,b.getHomeDirectory)();if(!e)return;d(t),c(s||t)}catch(t){if(console.error("Failed to resolve home directory:",t),!e)return;N("Failed to access your home directory."),c(s||"/")}})(),()=>{e=!1}},[s]),(0,a.useEffect)(()=>{if(!n)return;let e=!0;return(async()=>{p(!0),N(null);try{let t=await x(n);if(!e)return;if(0===t.length&&o&&n!==o){let t=await f(n);if(!e)return;if(!t){N(`Could not access "${n}". Showing home directory.`),c(o);return}}let a=t.map(e=>({name:e.name,path:e.path,isDirectory:e.isDirectory,isGitRepo:e.isGitRepo}));u(a)}catch(t){if(console.error(t),!e)return;if(o&&n!==o){N(`Could not access "${n}". Showing home directory.`),c(o);return}u([]),N("Failed to load directory contents")}finally{e&&p(!1)}})(),()=>{e=!1}},[n,o]);let S=async e=>{if(i&&!await i(e)){N("Selected directory is not a valid git repository."),setTimeout(()=>N(null),3e3);return}await r(e)},k=async()=>{await S(n)};return(0,t.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm p-4",children:(0,t.jsxs)("div",{className:"bg-base-200 rounded-lg shadow-xl w-full max-w-3xl h-[80vh] flex flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-4 border-b border-base-300",children:[(0,t.jsxs)("h2",{className:"text-xl font-bold flex items-center gap-2",children:[(0,t.jsx)(g.Folder,{className:"w-5 h-5"}),e||"Browse Local Repository"]}),(0,t.jsx)("button",{onClick:l,className:"btn btn-sm btn-ghost btn-circle",children:"✕"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-base-300",children:[(0,t.jsx)("button",{onClick:()=>{let e=(0,w.getDirName)(n);e&&e!==n&&c(e)},className:"btn btn-sm btn-square btn-ghost",title:"Go Up",disabled:"/"===n||!n,children:(0,t.jsx)(v.ArrowLeft,{className:"w-4 h-4"})}),(0,t.jsx)("div",{className:"flex-1 overflow-x-auto whitespace-nowrap px-2 font-mono text-sm",children:n}),(0,t.jsx)("button",{onClick:k,className:"btn btn-sm btn-primary",children:"Select Current Folder"})]}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto p-2",children:h?(0,t.jsx)("div",{className:"flex justify-center items-center h-full",children:(0,t.jsx)("span",{className:"loading loading-spinner loading-lg"})}):j?(0,t.jsx)("div",{className:"alert alert-error",children:j}):0===m.length?(0,t.jsx)("div",{className:"text-center text-base-content/50 mt-10",children:"Empty directory"}):(0,t.jsx)("div",{className:"grid grid-cols-1 gap-1",children:m.map(e=>(0,t.jsxs)("div",{className:"flex items-center justify-between p-2 hover:bg-base-100 rounded-md cursor-pointer transition-colors",onClick:()=>{c(e.path)},children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 overflow-hidden",children:[(0,t.jsx)(g.Folder,{className:`w-5 h-5 ${e.isGitRepo?"text-primary":"text-base-content/70"}`}),(0,t.jsx)("span",{className:"truncate",children:e.name}),e.isGitRepo&&(0,t.jsx)("span",{className:"badge badge-xs badge-primary",children:"git"})]}),e.isGitRepo&&(0,t.jsxs)("button",{className:"btn btn-xs btn-primary",onClick:t=>{t.stopPropagation(),S(e.path)},title:`Select ${e.name}`,children:[(0,t.jsx)(y,{className:"w-3 h-3"}),"Select"]})]},e.path))})}),(0,t.jsx)("div",{className:"p-3 border-t border-base-300 text-xs text-base-content/50 text-center",children:'Navigate to a folder and click "Select Current Folder" to choose it.'})]})})}let N=(0,p.createServerReference)("40d130e7b8ec1642852f3a01f9359123e34f13b30a",p.callServer,void 0,p.findSourceMapURL,"checkIsGitRepo"),S=(0,p.createServerReference)("40aec87fa2a1e4f86d2c585d9c28dbe19b8f847724",p.callServer,void 0,p.findSourceMapURL,"getBranches"),k=(0,p.createServerReference)("600f63db694a03b1d10532c2f3c157457456bc8520",p.callServer,void 0,p.findSourceMapURL,"checkoutBranch");var R=e.i(59119);let C=(0,p.createServerReference)("7f92a1b813706353c7e604850867398b28ba9cc70e",p.callServer,void 0,p.findSourceMapURL,"getStartupScript"),M=(0,p.createServerReference)("7f8e776a665389a110d75211a39241d1fef352e667",p.callServer,void 0,p.findSourceMapURL,"getDefaultDevServerScript"),D=(0,p.createServerReference)("7f1db36c9d8ba23fc7ae0b6413694764ccca41598a",p.callServer,void 0,p.findSourceMapURL,"listRepoFiles");var L=e.i(84545);let E=(0,p.createServerReference)("40cbaf3ed9a3344737c2f48b196d48c5c3719776d2",p.callServer,void 0,p.findSourceMapURL,"checkAgentCliInstalled"),F=(0,p.createServerReference)("40aed14319ee8e6c20a2a89efc8c40674a15a444a4",p.callServer,void 0,p.findSourceMapURL,"installAgentCli"),P=(0,p.createServerReference)("403279426f8869a09d4f587c52a762320d0b150c14",p.callServer,void 0,p.findSourceMapURL,"resolveRepositoryByName"),$=(0,p.createServerReference)("70a1db94e7986791fa3bc86fb32815613934ddbf97",p.callServer,void 0,p.findSourceMapURL,"copySessionAttachments"),U=(0,p.createServerReference)("70ff042b2d8a24036b9607675c5bd0a13944b18191",p.callServer,void 0,p.findSourceMapURL,"createSession"),A=(0,p.createServerReference)("40176b56c3afc94df27a831cbf551082c5c32f6b5f",p.callServer,void 0,p.findSourceMapURL,"deleteSession"),T=(0,p.createServerReference)("408e8336cb7d18347932719f021ed3433933cd4b8d",p.callServer,void 0,p.findSourceMapURL,"getSessionPrefillContext"),I=(0,p.createServerReference)("40596cafe83a8e70f5088a96d7cfade5464ca5dc39",p.callServer,void 0,p.findSourceMapURL,"listSessions"),K=(0,p.createServerReference)("60dddd600ff33583d1fdcd7390c720423f0ca69901",p.callServer,void 0,p.findSourceMapURL,"saveSessionLaunchContext");var B=e.i(94520),O=e.i(93958);let G=(0,p.createServerReference)("60ae7b91e5e728d12fc38dbdd01fb988c42dea9dc8",p.callServer,void 0,p.findSourceMapURL,"updateRepoSettings");var z=e.i(18566),V=e.i(63671),H=e.i(57688);let _=e.i(35027).default,q="After each round of conversation, if work is completed and files changed, commit all changes with an appropriate git commit message. The commit message must include a clear title and a detailed body describing what changed and why, not just a title. No need to confirm when creating commits.",W={gemini:"gemini",codex:"codex",agent:"agent"},Y={gemini:"Gemini CLI",codex:"Codex CLI",agent:"Cursor Agent CLI"};function J({mode:e="home",repoPath:s=null,fromRepoName:p=null,prefillFromSession:f=null}){let[x,b]=(0,a.useState)(!1),[g,v]=(0,a.useState)(!1),[y,J]=(0,a.useState)(null),[Q,X]=(0,a.useState)(null),Z=(0,z.useRouter)(),[ee,et]=(0,a.useState)([]),[ea,es]=(0,a.useState)(""),[er,el]=(0,a.useState)([]),[ei,en]=(0,a.useState)([]),[ec,eo]=(0,a.useState)(null),[ed,em]=(0,a.useState)(""),[eu,eh]=(0,a.useState)(""),[ep,ef]=(0,a.useState)(""),[ex,eb]=(0,a.useState)(!1),[eg,ev]=(0,a.useState)(""),[ey,ew]=(0,a.useState)(""),[ej,eN]=(0,a.useState)([]),[eS,ek]=(0,a.useState)([]),[eR,eC]=(0,a.useState)(null),[eM,eD]=(0,a.useState)(!1),[eL,eE]=(0,a.useState)(!1),[eF,eP]=(0,a.useState)(null),[e$,eU]=(0,a.useState)(null),[eA,eT]=(0,a.useState)(!1),[eI,eK]=(0,a.useState)(!1),[eB,eO]=(0,a.useState)(!1),[eG,ez]=(0,a.useState)(null),[eV,eH]=(0,a.useState)(!1),[e_,eq]=(0,a.useState)(null),[eW,eY]=(0,a.useState)(""),[eJ,eQ]=(0,a.useState)(!1),[eX,eZ]=(0,a.useState)(null),e0=(0,a.useRef)(null),e1=ec&&ed?`Show Session Setup (${ec.name} / ${ed})`:"Show Session Setup",e2=(0,a.useCallback)(()=>{(0,V.notifySessionsUpdated)()},[]),e3=(0,a.useCallback)(async(e=Q)=>{try{let[t,a]=await Promise.all([I(),e?I(e):Promise.resolve([])]);en(t),e&&el(a)}catch(e){console.error("Failed to refresh sessions",e)}},[Q]),e4=(0,a.useCallback)(e=>"gemini"===e||"codex"===e||"agent"===e?e:null,[]);(0,a.useEffect)(()=>{(async()=>{try{let[e,t]=await Promise.all([(0,B.getConfig)(),I()]);J(e),en(t)}catch(e){console.error("Failed to load data",e)}finally{eK(!0)}})()},[]),(0,a.useEffect)(()=>{let t=()=>{e3("new"===e?Q:null)},a=e=>{e.key===V.SESSIONS_UPDATED_STORAGE_KEY&&t()},s=()=>{t()},r=()=>{t()};return window.addEventListener("storage",a),window.addEventListener("focus",s),window.addEventListener(V.SESSIONS_UPDATED_EVENT,r),()=>{window.removeEventListener("storage",a),window.removeEventListener("focus",s),window.removeEventListener(V.SESSIONS_UPDATED_EVENT,r)}},[e,e3,Q]);let e8=async e=>{X(e),ty([]),await e7(e),await te(e),await e3(e)},e6=async t=>{eE(!0),eU(null);try{if(!await N(t))return eU("Selected directory is not a valid git repository."),!1;let a=[...(y||await (0,B.getConfig)()).recentRepos];a.includes(t)?a=[t,...a.filter(e=>e!==t)]:a.unshift(t);let s=await (0,O.updateConfig)({recentRepos:a});if(J(s),b(!1),"home"===e)return Z.push(`/new?repo=${encodeURIComponent(t)}`),!0;return await e8(t),!0}catch(e){return console.error(e),eU("Failed to open repository."),!1}finally{eE(!1)}},e5=async t=>{if("new"!==e)return;let a=t.target.value;if(!a||a===Q||!await e6(a))return;let s=new URLSearchParams;s.set("repo",a),f&&s.set("prefillFromSession",f),Z.replace(`/new?${s.toString()}`)};(0,a.useEffect)(()=>{if("new"===e){if(!s){X(null),el([]),et([]),es("");return}s!==Q&&e6(s)}},[e,s,Q]),(0,a.useEffect)(()=>{if("new"!==e)return;if(s)return void eT(!1);let t=p?.trim()??"";if(!t)return void eT(!1);let a=!1;return(async()=>{eU(null),eT(!0);let e=await P(t);if(a)return;if(!e.success){eU(e.error||"Failed to search repositories."),eT(!1);return}if(!e.repoPath){eU(`Could not find a matching repository for "${t}".`),eT(!1);return}let s=new URLSearchParams;s.set("repo",e.repoPath),f&&s.set("prefillFromSession",f),Z.replace(`/new?${s.toString()}`)})(),()=>{a=!0}},[p,e,f,s,Z]),(0,a.useEffect)(()=>{eD(!1),ek([]),eC(null)},[f]),(0,a.useEffect)(()=>{if("new"!==e||!Q||!f||eM)return;let t=!1;return(async()=>{let e=await T(f);if(t)return;if(!e.success||!e.context){e.error&&eU(e.error),eD(!0);return}let a=e.context;if(a.repoPath!==Q)return eD(!0);let s=_.find(e=>e.cli===a.agentProvider);s&&(eo(s),a.model&&("auto"===a.model||s.models.some(e=>e.id===a.model))?em(a.model):em("auto")),ew(a.title||""),ev(a.initialMessage||""),ek(a.attachmentNames||[]),eC(a.sourceSessionName),eb(!0),eD(!0)})(),()=>{t=!0}},[eM,e,f,Q]);let e7=async e=>{let t=y||await (0,B.getConfig)();y||J(t);let a=t.repoSettings[e]||{},s=a.agentProvider,r=a.agentModel,l=a.startupScript,i=a.devServerScript;if(s){let e=_.find(e=>e.cli===s);e?(eo(e),r&&("auto"===r||e.models.some(e=>e.id===r))?em(r):em("auto")):(eo(_[0]),em("auto"))}else eo(_[0]),em("auto");null!=l?eh(l):eh(await C(e)),null!=i?ef(i):ef(await M(e))},e9=async e=>{J(await (0,O.updateConfig)({defaultRoot:e})),v(!1)},te=async e=>{try{let t=await S(e);et(t);let a=((y||await (0,B.getConfig)()).repoSettings[e]||{}).lastBranch,s=t.find(e=>e.current)?.name;if(a&&t.some(e=>e.name===a)){if(es(a),a!==s)try{await k(e,a);let t=await S(e);et(t)}catch(e){console.warn("Could not auto-checkout to remembered branch",e),s&&es(s)}}else s&&es(s)}catch(e){console.error("Failed to load branches",e),eU("Failed to load branches.")}},tt=async e=>{let t=e.target.value;if(Q){eE(!0);try{await k(Q,t),es(t);let e=await G(Q,{lastBranch:t});J(e);let a=await S(Q);et(a)}catch{eU(`Failed to checkout branch ${t}`)}finally{eE(!1)}}},ta=async e=>{let t=e.target.value,a=_.find(e=>e.cli===t);if(a&&Q){eo(a);let e="auto";em(e),J(await G(Q,{agentProvider:a.cli,agentModel:e}))}},ts=async e=>{let t=e.target.value;em(t),Q&&J(await G(Q,{agentModel:t}))},tr=async e=>{eh(e.target.value)},tl=async()=>{Q&&J(await G(Q,{startupScript:eu}))},ti=async e=>{Q&&J(await G(Q,{devServerScript:e}))},tn=async()=>{await ti(ep)},tc=(0,a.useCallback)((e,t)=>{if(e.name&&e.name.trim().length>0)return e;let a=e.type&&e.type.split("/")[1]?.split("+")[0]||"bin";return new File([e],`pasted-file-${Date.now()}-${t+1}.${a}`,{type:e.type,lastModified:e.lastModified||Date.now()})},[]),to=(0,a.useCallback)(e=>{0!==e.length&&eN(t=>{let a=new Map(t.map(e=>[e.name,e]));return e.forEach(e=>{a.set(e.name,e)}),Array.from(a.values())})},[]),[td,tm]=(0,a.useState)(!1),[tu,th]=(0,a.useState)([]),[,tp]=(0,a.useState)(""),[tf,tx]=(0,a.useState)(0),[tb,tg]=(0,a.useState)(0),[tv,ty]=(0,a.useState)([]),tw=async e=>{let t=e.target.value,a=e.target.selectionStart;ev(t),tx(a);let s=t.substring(0,a),r=s.lastIndexOf("@");if(-1!==r){let e=s.substring(r+1);if(!/\s/.test(e)){if(tp(e),tm(!0),Q){var l;let t,a=tv;0===tv.length&&ty(a=await D(Q)),l=a,t=e.toLowerCase(),th([...[...ej.map(e=>e.name),...eS].filter(e=>e.toLowerCase().includes(t)),...l.filter(e=>e.toLowerCase().includes(t)).slice(0,20)]),tg(0)}return}}tm(!1)},tj=e=>{let t=eg.substring(0,tf).lastIndexOf("@");if(-1!==t){let a=eg.substring(0,t),s=eg.substring(tf);ev(`${a}@${e} ${s}`),tm(!1)}};(0,a.useEffect)(()=>{if("new"!==e||!Q)return;let t=e=>{let t=e.clipboardData;if(!t)return;let a=Array.from(t.items).filter(e=>"file"===e.kind).map(e=>e.getAsFile()).filter(e=>null!==e),s=(a.length>0?a:Array.from(t.files)).map((e,t)=>tc(e,t));0!==s.length&&(e.preventDefault(),to(s))};return window.addEventListener("paste",t),()=>{window.removeEventListener("paste",t)}},[to,e,tc,Q]);let tN=async(e,t)=>{if(e.stopPropagation(),y){let e=y.recentRepos.filter(e=>e!==t);J(await (0,O.updateConfig)({recentRepos:e}))}},tS=(0,a.useCallback)(()=>{if(!eV||!eW||!e0.current)return;let e=e0.current,t=(a=0)=>{if(a>40)return void eZ("Timed out while waiting for terminal to initialize.");try{let s=e.contentWindow;if(s?.term){s.term.paste(`${eW}\r`),eQ(!0),eZ(null),s.focus();return}setTimeout(()=>t(a+1),300)}catch(e){console.error("Failed to inject login command into terminal iframe:",e),eZ("Could not access ttyd terminal. Ensure ttyd is running and try again.")}};setTimeout(()=>t(),500)},[eV,eW]),tk=(0,a.useCallback)(async()=>{let e=e4(ec?.cli);if(!e)return!0;let t=await E(e);if(!t.success)return eU(t.error||`Failed to verify ${Y[e]} installation status.`),!1;if(t.installed)return!0;eO(!0),ez(e),eU(null);let a=await F(e);if(eO(!1),ez(null),!a.success)return eU(a.error||`Failed to install ${Y[e]}.`),!1;let s=await (0,R.startTtydProcess)();return s.success?(eq(e),eY(W[e]),eQ(!1),eZ(null),eH(!0)):eU(s.error||"Failed to start ttyd"),!1},[ec?.cli,e4]),tR=async(e={})=>{if(Q){eE(!0),eU(null);try{if(!e.skipAgentSetup&&!await tk())return void eE(!1);let t=ep.trim();!t&&(t=await M(Q))&&ef(t),await tl(),await ti(t);let a=await (0,R.startTtydProcess)();if(!a.success){eU(a.error||"Failed to start ttyd"),eE(!1);return}let s=await U(Q,ea||"main",{agent:ec?.cli||"agent",model:ed||"",title:ey,devServerScript:t||void 0});if(s.success&&s.sessionName&&s.worktreePath&&s.branchName){let e=[],t=[];if(ej.length>0){let t=new FormData;ej.forEach(e=>t.append(e.name,e)),e=await (0,L.saveAttachments)(s.worktreePath,t)}if(eR&&eS.length>0){let e=await $(eR,s.worktreePath,eS);if(!e.success){eU(e.error||"Failed to carry over attachments from source session"),eE(!1);return}t=e.copiedAttachmentNames}let a=Array.from(new Set([...e,...t])),r=eg.trim(),l=r;l&&(l.includes(q)||(l=`${l}
|
|
2
2
|
|
|
3
3
|
${q}`)),l=l.replace(/@(\S+)/g,(e,t)=>a.includes(t)?`${s.worktreePath}-attachments/${t}`:t);let i=await K(s.sessionName,{title:ey||void 0,initialMessage:l||void 0,rawInitialMessage:r||void 0,startupScript:eu||void 0,attachmentNames:a,agentProvider:ec?.cli||"agent",model:ed||""});if(!i.success){eU(i.error||"Failed to save session context"),eE(!1);return}let n=`/session/${s.sessionName}`;Z.push(n),eE(!1)}else eU(s.error||"Failed to create session worktree"),eE(!1)}catch(e){console.error(e),eU("Failed to start session"),eE(!1)}}},tC=()=>{tR()},tM=async()=>{eH(!1),eq(null),eY(""),eQ(!1),eZ(null),await tR({skipAgentSetup:!0})},tD=async e=>{if(Q){eE(!0);try{let t=await (0,R.startTtydProcess)();if(!t.success){eU(t.error||"Failed to start ttyd"),eE(!1);return}let a=`/session/${e.sessionName}`;Z.push(a),eE(!1)}catch(e){console.error(e),eU("Failed to resume session"),eE(!1)}}},tL=async e=>{if(Q&&confirm(`Delete session "${e.sessionName}"?
|
|
4
4
|
|
|
5
|
-
This will remove the worktree, branch, and session metadata.`)){eP(e.sessionName),eU(null);try{let t=await A(e.sessionName);if(!t.success)return void eU(t.error||"Failed to delete session");let a=await I(Q);el(a);let s=await I();en(s),e1()}catch(e){console.error(e),eU("Failed to delete session")}finally{eP(null)}}},tE=y?.recentRepos??[],tF=Q?tE.includes(Q)?tE:[Q,...tE]:tE;return(0,t.jsxs)(t.Fragment,{children:["home"===e&&(0,t.jsx)("div",{className:"card w-full max-w-2xl bg-base-200 shadow-xl",children:(0,t.jsxs)("div",{className:"card-body",children:[(0,t.jsxs)("h2",{className:"card-title flex justify-between items-center",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(H.default,{src:"/icon.png",alt:"Viba",width:24,height:24,className:"rounded-sm"}),"Viba"]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("button",{className:"btn btn-ghost btn-sm gap-2",onClick:()=>v(!0),title:y?.defaultRoot?`Default: ${y.defaultRoot}`:"Set default browsing folder",children:[(0,t.jsx)(o,{className:"w-4 h-4"}),y?.defaultRoot?"Change Default":"Set Default Root"]}),(0,t.jsxs)("button",{className:"btn btn-primary btn-sm gap-2",onClick:()=>b(!0),children:[(0,t.jsx)(i.Plus,{className:"w-4 h-4"})," Open Local Repo"]})]})]}),e$&&(0,t.jsx)("div",{className:"alert alert-error text-sm py-2 px-3 mt-2",children:e$}),(0,t.jsx)("div",{className:"mt-4 space-y-4",children:(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold opacity-70 uppercase tracking-wide",children:"Recent Repositories"}),eI?y&&0!==y.recentRepos.length?(0,t.jsx)("div",{className:"flex flex-col gap-2",children:y.recentRepos.map(e=>(0,t.jsxs)("div",{onClick:()=>e6(e),className:"flex items-center justify-between p-3 bg-base-100 hover:bg-base-300 rounded-md cursor-pointer group transition-all border border-base-300",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 overflow-hidden shrink min-w-0",children:[(0,t.jsx)(r,{className:"w-5 h-5 text-secondary shrink-0"}),(0,t.jsxs)("div",{className:"flex flex-col overflow-hidden",children:[(0,t.jsx)("span",{className:"font-medium truncate",children:(0,w.getBaseName)(e)}),(0,t.jsx)("span",{className:"text-xs opacity-50 truncate",children:e})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,t.jsx)("button",{onClick:t=>tN(t,e),className:"btn btn-circle btn-ghost btn-xs opacity-0 group-hover:opacity-100 text-error",title:"Remove from history",children:(0,t.jsx)(n,{className:"w-3 h-3"})}),(0,t.jsx)(c,{className:"w-4 h-4 opacity-30"})]})]},e))}):(0,t.jsx)("div",{className:"text-center py-8 text-base-content/40 italic bg-base-100 rounded-lg",children:"No recent repositories found."}):(0,t.jsx)("div",{className:"flex items-center justify-center py-8 bg-base-100 rounded-lg",children:(0,t.jsx)("span",{className:"loading loading-spinner loading-md"})})]})})]})}),"new"===e&&Q&&(0,t.jsxs)("div",{className:"w-full max-w-6xl space-y-4",children:[e$&&(0,t.jsx)("div",{className:"alert alert-error text-sm py-2 px-3",children:e$}),(0,t.jsxs)("div",{className:"flex flex-col gap-4 w-full",children:[(0,t.jsx)("div",{className:"card w-full bg-base-200 shadow-xl",children:(0,t.jsxs)("div",{className:"card-body",children:[(0,t.jsxs)("h2",{className:"card-title flex justify-between items-center",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(r,{className:"w-6 h-6 text-primary"}),"Git Repository Selector"]}),(0,t.jsx)("button",{className:"btn btn-sm btn-ghost",onClick:()=>Z.push("/"),children:"Change Repo"})]}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"bg-base-100 p-4 rounded-lg border border-base-300 space-y-2",children:[(0,t.jsx)("label",{className:"text-xs opacity-50 uppercase tracking-widest",children:"Current Repository"}),(0,t.jsxs)("div",{className:"join w-full",children:[(0,t.jsx)("div",{className:"join-item bg-base-300 flex items-center px-3 border border-base-content/20 border-r-0",children:(0,t.jsx)(r,{className:"w-4 h-4 text-primary"})}),(0,t.jsx)("select",{className:"select select-bordered join-item w-full font-mono focus:outline-none",value:Q,onChange:e=>{e8(e)},disabled:eL||0===tF.length,children:tF.map(e=>(0,t.jsx)("option",{value:e,children:(0,w.getBaseName)(e)},e))})]}),(0,t.jsx)("div",{className:"text-[10px] opacity-50 font-mono truncate px-1",title:Q,children:Q})]}),(0,t.jsxs)("div",{className:"bg-base-100 p-4 rounded-lg border border-base-300 space-y-2",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("label",{className:"text-sm font-medium opacity-70 uppercase tracking-widest",children:"Current Branch"}),eL&&(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"})]}),(0,t.jsxs)("div",{className:"join w-full",children:[(0,t.jsx)("div",{className:"join-item bg-base-300 flex items-center px-3 border border-base-content/20 border-r-0",children:(0,t.jsx)(l.GitBranch,{className:"w-4 h-4"})}),(0,t.jsx)("select",{className:"select select-bordered join-item w-full font-mono focus:outline-none",value:ea,onChange:tt,disabled:eL,children:ee.map(e=>(0,t.jsxs)("option",{value:e.name,children:[e.name," ",e.current?"(checked out)":""]},e.name))})]}),(0,t.jsx)("div",{className:"text-[10px] opacity-50 px-1 italic",children:"Switching branches updates the working directory."})]})]})})]})}),er.length>0&&(0,t.jsx)("div",{className:"card w-full bg-base-200 shadow-xl",children:(0,t.jsxs)("div",{className:"card-body",children:[(0,t.jsxs)("h2",{className:"card-title flex items-center gap-2",children:[(0,t.jsx)(h.Play,{className:"w-6 h-6 text-success"}),"Continue Existing Session"]}),(0,t.jsx)("div",{className:"flex flex-col gap-2 mt-4 max-h-64 overflow-y-auto",children:er.map(e=>(0,t.jsx)("div",{className:"flex flex-col gap-2 p-3 bg-base-100 rounded-md border border-base-300",children:(0,t.jsxs)("div",{className:"flex justify-between items-start",children:[(0,t.jsxs)("div",{children:[e.title&&(0,t.jsx)("div",{className:"font-semibold",children:e.title}),(0,t.jsx)("div",{className:"text-xs opacity-60 font-mono",children:e.sessionName}),(0,t.jsxs)("div",{className:"text-xs opacity-60 mt-1",children:["Agent: ",e.agent," • Model: ",e.model]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("button",{className:"btn btn-sm btn-success btn-outline gap-2",onClick:()=>tD(e),disabled:eL||eF===e.sessionName,children:[(0,t.jsx)(h.Play,{className:"w-3 h-3"})," Resume"]}),(0,t.jsxs)("button",{className:"btn btn-sm btn-secondary btn-outline gap-2",onClick:()=>(e=>{if(!Q)return;let t=`/new?repo=${encodeURIComponent(Q)}&prefillFromSession=${encodeURIComponent(e.sessionName)}`;Z.push(t)})(e),disabled:eL||eF===e.sessionName,title:"Start a new attempt prefilled from this session",children:[(0,t.jsx)(i.Plus,{className:"w-3 h-3"})," New Attempt"]}),(0,t.jsxs)("button",{className:"btn btn-sm btn-error btn-outline gap-2",onClick:()=>tL(e),disabled:eL||eF===e.sessionName,children:[(0,t.jsx)(u.Trash2,{className:"w-3 h-3"}),eF===e.sessionName?"Deleting...":"Delete"]})]})]})},e.sessionName))})]})}),(0,t.jsx)("div",{className:"card w-full bg-base-200 shadow-xl",children:(0,t.jsxs)("div",{className:"card-body",children:[(0,t.jsxs)("h2",{className:"card-title flex items-center gap-2",children:[(0,t.jsx)(d,{className:"w-6 h-6 text-secondary"}),"Start New Session"]}),(0,t.jsxs)("div",{className:"mt-4 space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("button",{type:"button",className:"btn btn-ghost btn-sm px-2 h-auto min-h-0 normal-case justify-start gap-2",onClick:()=>eb(e=>!e),children:[(0,t.jsx)(c,{className:`w-4 h-4 transition-transform ${ex?"rotate-90":""}`}),ex?"Hide Session Setup":e2]}),ex&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium opacity-70",children:"Agent Provider"}),(0,t.jsxs)("div",{className:"join w-full",children:[(0,t.jsx)("div",{className:"join-item bg-base-300 flex items-center px-3 border border-base-content/20 border-r-0",children:(0,t.jsx)(d,{className:"w-4 h-4"})}),(0,t.jsx)("select",{className:"select select-bordered join-item w-full focus:outline-none",value:ec?.cli||"",onChange:ta,disabled:eL,children:_.map(e=>(0,t.jsx)("option",{value:e.cli,children:e.name},e.cli))})]}),ec?.description&&(0,t.jsx)("p",{className:"text-[10px] opacity-60 mt-1 pl-1 italic leading-tight",children:ec.description})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium opacity-70",children:"Model"}),(0,t.jsxs)("div",{className:"join w-full",children:[(0,t.jsx)("div",{className:"join-item bg-base-300 flex items-center px-3 border border-base-content/20 border-r-0",children:(0,t.jsx)(m,{className:"w-4 h-4"})}),(0,t.jsxs)("select",{className:"select select-bordered join-item w-full focus:outline-none",value:ed,onChange:ts,disabled:eL||!ec,children:[(0,t.jsx)("option",{value:"auto",children:"Auto"}),ec?.models.map(e=>(0,t.jsx)("option",{value:e.id,children:e.label},e.id))]})]}),ec?.models.find(e=>e.id===ed)?.description&&(0,t.jsx)("p",{className:"text-[10px] opacity-60 mt-1 pl-1 italic leading-tight",children:ec.models.find(e=>e.id===ed)?.description})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium opacity-70",children:"Start up script (Optional)"}),(0,t.jsx)("input",{type:"text",className:"input input-bordered w-full font-mono text-sm",placeholder:"npm i",value:eu,onChange:tr,onBlur:tl,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),tC())},disabled:eL}),(0,t.jsx)("div",{className:"text-xs opacity-50 px-1",children:"Script to run in the terminal agent iframe upon startup."})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium opacity-70",children:"Dev server script (Optional)"}),(0,t.jsx)("input",{type:"text",className:"input input-bordered w-full font-mono text-sm",placeholder:"npm run dev",value:ep,onChange:e=>{ef(e.target.value)},onBlur:tn,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),tC())},disabled:eL}),(0,t.jsx)("div",{className:"text-xs opacity-50 px-1",children:"Script for the Session View Start Dev Server button in the right terminal."})]})]})]}),(0,t.jsx)("div",{className:"divider"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium opacity-70",children:"Title (Optional)"}),(0,t.jsx)("input",{type:"text",className:"input input-bordered w-full font-mono text-sm",placeholder:"Task Title",value:ey,onChange:e=>ew(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),tC())},disabled:eL})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium opacity-70",children:"Initial Message (Optional)"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("textarea",{className:"textarea textarea-bordered w-full h-64 font-mono text-sm leading-tight resize-none",placeholder:"Describe what you want the agent to do... Type @ to mention files.",value:eg,onChange:tw,onKeyDown:e=>{if((e.metaKey||e.ctrlKey)&&"Enter"===e.key){e.preventDefault(),tC();return}td&&tu.length>0&&("ArrowUp"===e.key?(e.preventDefault(),tg(e=>e>0?e-1:tu.length-1)):"ArrowDown"===e.key?(e.preventDefault(),tg(e=>e<tu.length-1?e+1:0)):"Enter"===e.key||"Tab"===e.key?(e.preventDefault(),tj(tu[tb])):"Escape"===e.key&&(e.preventDefault(),tm(!1)))},onClick:e=>{tx(e.currentTarget.selectionStart),tm(!1)},onKeyUp:e=>tx(e.currentTarget.selectionStart),disabled:eL}),td&&tu.length>0&&(0,t.jsx)("div",{className:"absolute left-0 right-0 z-50 mt-1 max-h-48 overflow-y-auto bg-base-100 border border-base-300 rounded-md shadow-lg",children:tu.map((e,a)=>(0,t.jsx)("button",{className:`w-full text-left px-3 py-2 text-xs border-b border-base-200 last:border-0 truncate ${a===tb?"bg-primary text-primary-content":"hover:bg-primary/10"}`,onMouseDown:t=>{t.preventDefault(),tj(e)},children:e},e))})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium opacity-70",children:"Attachments (Optional)"}),(0,t.jsx)("input",{type:"file",multiple:!0,className:"file-input file-input-bordered w-full",onChange:e=>{e.target.files&&(to(Array.from(e.target.files).map((e,t)=>tc(e,t))),e.target.value="")},disabled:eL}),(0,t.jsx)("div",{className:"text-xs opacity-50 px-1",children:"Paste files from clipboard with Cmd/Ctrl+V anywhere on this page."}),ej.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-2",children:ej.map((e,a)=>(0,t.jsxs)("span",{className:"badge badge-neutral gap-2 p-3",children:[e.name,(0,t.jsx)("button",{onClick:()=>{eN(e=>e.filter((e,t)=>t!==a))},className:"btn btn-ghost btn-xs btn-circle text-error",children:(0,t.jsx)(n,{className:"w-3 h-3"})})]},`upload-${a}`))}),eS.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-2",children:eS.map((e,a)=>(0,t.jsxs)("span",{className:"badge badge-secondary gap-2 p-3",children:[e,(0,t.jsx)("button",{onClick:()=>{ek(e=>e.filter((e,t)=>t!==a))},className:"btn btn-ghost btn-xs btn-circle text-error",title:"Remove carried attachment",children:(0,t.jsx)(n,{className:"w-3 h-3"})})]},`prefill-${e}-${a}`))})]}),(0,t.jsx)("div",{className:"card-actions justify-end mt-4",children:(0,t.jsx)("button",{className:"btn btn-primary btn-wide shadow-lg",onClick:tC,disabled:eL,children:eL?(0,t.jsx)("span",{className:"loading loading-spinner"}):"Start Session"})})]})]})})]})]}),"new"===e&&!Q&&(0,t.jsx)("div",{className:"card w-full max-w-2xl bg-base-200 shadow-xl",children:(0,t.jsxs)("div",{className:"card-body",children:[e$&&(0,t.jsx)("div",{className:"alert alert-error text-sm py-2 px-3",children:e$}),(0,t.jsx)("h2",{className:"card-title",children:"Select a Repository"}),(0,t.jsx)("p",{className:"opacity-70 text-sm",children:"Choose a repository first, then start or resume a session."}),(0,t.jsx)("div",{className:"card-actions justify-end mt-4",children:(0,t.jsx)("button",{className:"btn btn-primary",onClick:()=>Z.push("/"),children:"Go to Home"})})]})}),"new"===e&&eB&&eG&&(0,t.jsx)("div",{className:"fixed inset-0 z-[1000] flex items-center justify-center bg-base-content/45 px-4",children:(0,t.jsx)("div",{className:"w-full max-w-md rounded-xl border border-base-300 bg-base-100 p-6 shadow-2xl",children:(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)("span",{className:"loading loading-spinner loading-lg text-primary"}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("h3",{className:"text-lg font-semibold",children:["Installing ",Y[eG]]}),(0,t.jsx)("p",{className:"text-sm opacity-70",children:"Please wait while we install the coding agent CLI."})]})]})})}),"new"===e&&eV&&e_&&(0,t.jsx)("div",{className:"fixed inset-0 z-[1001] flex items-center justify-center bg-base-content/60 p-4",children:(0,t.jsx)("div",{className:"w-full max-w-5xl rounded-xl border border-base-300 bg-base-100 shadow-2xl",children:(0,t.jsxs)("div",{className:"space-y-4 p-5 md:p-6",children:[(0,t.jsx)("h3",{className:"text-xl font-semibold",children:"Login Required"}),(0,t.jsxs)("p",{className:"text-sm opacity-80",children:[Y[e_]," has been installed. Complete login in the terminal below, then click Done to continue."]}),(0,t.jsxs)("p",{className:"text-xs opacity-60",children:["Command: ",(0,t.jsx)("span",{className:"font-mono",children:eW})]}),(0,t.jsx)("div",{className:"h-[420px] overflow-hidden rounded-lg border border-base-300 bg-base-200",children:(0,t.jsx)("iframe",{ref:e0,src:"/terminal",className:"h-full w-full border-none",allow:"clipboard-read; clipboard-write",onLoad:tS})}),eX&&(0,t.jsx)("div",{className:"alert alert-error text-sm py-2",children:eX}),!eX&&(0,t.jsx)("div",{className:"text-xs opacity-70",children:eJ?"Login command was sent to the terminal automatically.":"Waiting for terminal to initialize..."}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)("button",{className:"btn btn-primary",onClick:()=>void tM(),disabled:eL,children:"Done"})})]})})}),"new"===e&&!Q&&(!s||!!e$)&&(0,t.jsx)("div",{className:"card w-full max-w-2xl bg-base-200 shadow-xl",children:(0,t.jsxs)("div",{className:"card-body",children:[(0,t.jsxs)("h2",{className:"card-title flex items-center gap-2",children:[(0,t.jsx)(r,{className:"w-6 h-6 text-primary"}),"Git Repository Selector"]}),eA?(0,t.jsxs)("div",{className:"alert text-sm py-2 px-3 mt-2 flex items-center gap-2",children:[(0,t.jsx)("span",{className:"loading loading-spinner loading-sm"}),p?`Searching for repository "${p}"...`:"Searching for repository..."]}):e$?(0,t.jsx)("div",{className:"alert alert-error text-sm py-2 px-3 mt-2",children:e$}):(0,t.jsx)("div",{className:"text-sm opacity-70 mt-2",children:"No repository specified."}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)("button",{className:"btn btn-primary btn-sm",onClick:()=>Z.push("/"),children:"Choose Repository"})})]})}),"home"===e&&x&&(0,t.jsx)(j,{initialPath:y?.defaultRoot||void 0,onSelect:e6,onCancel:()=>b(!1),checkRepo:N}),"home"===e&&g&&(0,t.jsx)(j,{title:"Default Root Folder",initialPath:y?.defaultRoot||void 0,onSelect:e9,onCancel:()=>v(!1)})]})}e.s(["default",()=>J],5951)}]);
|
|
5
|
+
This will remove the worktree, branch, and session metadata.`)){eP(e.sessionName),eU(null);try{let t=await A(e.sessionName);if(!t.success)return void eU(t.error||"Failed to delete session");let a=await I(Q);el(a);let s=await I();en(s),e2()}catch(e){console.error(e),eU("Failed to delete session")}finally{eP(null)}}},tE=y?.recentRepos??[],tF=Q?tE.includes(Q)?tE:[Q,...tE]:tE;return(0,t.jsxs)(t.Fragment,{children:["home"===e&&(0,t.jsx)("div",{className:"card w-full max-w-2xl bg-base-200 shadow-xl",children:(0,t.jsxs)("div",{className:"card-body",children:[(0,t.jsxs)("h2",{className:"card-title flex justify-between items-center",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(H.default,{src:"/icon.png",alt:"Viba",width:24,height:24,className:"rounded-sm"}),"Viba"]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("button",{className:"btn btn-ghost btn-sm gap-2",onClick:()=>v(!0),title:y?.defaultRoot?`Default: ${y.defaultRoot}`:"Set default browsing folder",children:[(0,t.jsx)(o,{className:"w-4 h-4"}),y?.defaultRoot?"Change Default":"Set Default Root"]}),(0,t.jsxs)("button",{className:"btn btn-primary btn-sm gap-2",onClick:()=>b(!0),children:[(0,t.jsx)(i.Plus,{className:"w-4 h-4"})," Open Local Repo"]})]})]}),e$&&(0,t.jsx)("div",{className:"alert alert-error text-sm py-2 px-3 mt-2",children:e$}),(0,t.jsx)("div",{className:"mt-4 space-y-4",children:(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold opacity-70 uppercase tracking-wide",children:"Recent Repositories"}),eI?y&&0!==y.recentRepos.length?(0,t.jsx)("div",{className:"flex flex-col gap-2",children:y.recentRepos.map(e=>(0,t.jsxs)("div",{onClick:()=>e6(e),className:"flex items-center justify-between p-3 bg-base-100 hover:bg-base-300 rounded-md cursor-pointer group transition-all border border-base-300",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 overflow-hidden shrink min-w-0",children:[(0,t.jsx)(r,{className:"w-5 h-5 text-secondary shrink-0"}),(0,t.jsxs)("div",{className:"flex flex-col overflow-hidden",children:[(0,t.jsx)("span",{className:"font-medium truncate",children:(0,w.getBaseName)(e)}),(0,t.jsx)("span",{className:"text-xs opacity-50 truncate",children:e})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,t.jsx)("button",{onClick:t=>tN(t,e),className:"btn btn-circle btn-ghost btn-xs opacity-0 group-hover:opacity-100 text-error",title:"Remove from history",children:(0,t.jsx)(n,{className:"w-3 h-3"})}),(0,t.jsx)(c,{className:"w-4 h-4 opacity-30"})]})]},e))}):(0,t.jsx)("div",{className:"text-center py-8 text-base-content/40 italic bg-base-100 rounded-lg",children:"No recent repositories found."}):(0,t.jsx)("div",{className:"flex items-center justify-center py-8 bg-base-100 rounded-lg",children:(0,t.jsx)("span",{className:"loading loading-spinner loading-md"})})]})})]})}),"new"===e&&Q&&(0,t.jsxs)("div",{className:"w-full max-w-6xl space-y-4",children:[e$&&(0,t.jsx)("div",{className:"alert alert-error text-sm py-2 px-3",children:e$}),(0,t.jsxs)("div",{className:"flex flex-col gap-4 w-full",children:[(0,t.jsx)("div",{className:"card w-full bg-base-200 shadow-xl",children:(0,t.jsxs)("div",{className:"card-body",children:[(0,t.jsxs)("h2",{className:"card-title flex justify-between items-center",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(r,{className:"w-6 h-6 text-primary"}),"Git Repository Selector"]}),(0,t.jsx)("button",{className:"btn btn-sm btn-ghost",onClick:()=>Z.push("/"),children:"Change Repo"})]}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"bg-base-100 p-4 rounded-lg border border-base-300 space-y-2",children:[(0,t.jsx)("label",{className:"text-xs opacity-50 uppercase tracking-widest",children:"Current Repository"}),(0,t.jsxs)("div",{className:"join w-full",children:[(0,t.jsx)("div",{className:"join-item bg-base-300 flex items-center px-3 border border-base-content/20 border-r-0",children:(0,t.jsx)(r,{className:"w-4 h-4 text-primary"})}),(0,t.jsx)("select",{className:"select select-bordered join-item w-full font-mono focus:outline-none",value:Q,onChange:e=>{e5(e)},disabled:eL||0===tF.length,children:tF.map(e=>(0,t.jsx)("option",{value:e,children:(0,w.getBaseName)(e)},e))})]}),(0,t.jsx)("div",{className:"text-[10px] opacity-50 font-mono truncate px-1",title:Q,children:Q})]}),(0,t.jsxs)("div",{className:"bg-base-100 p-4 rounded-lg border border-base-300 space-y-2",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("label",{className:"text-sm font-medium opacity-70 uppercase tracking-widest",children:"Current Branch"}),eL&&(0,t.jsx)("span",{className:"loading loading-spinner loading-xs"})]}),(0,t.jsxs)("div",{className:"join w-full",children:[(0,t.jsx)("div",{className:"join-item bg-base-300 flex items-center px-3 border border-base-content/20 border-r-0",children:(0,t.jsx)(l.GitBranch,{className:"w-4 h-4"})}),(0,t.jsx)("select",{className:"select select-bordered join-item w-full font-mono focus:outline-none",value:ea,onChange:tt,disabled:eL,children:ee.map(e=>(0,t.jsxs)("option",{value:e.name,children:[e.name," ",e.current?"(checked out)":""]},e.name))})]}),(0,t.jsx)("div",{className:"text-[10px] opacity-50 px-1 italic",children:"Switching branches updates the working directory."})]})]})})]})}),er.length>0&&(0,t.jsx)("div",{className:"card w-full bg-base-200 shadow-xl",children:(0,t.jsxs)("div",{className:"card-body",children:[(0,t.jsxs)("h2",{className:"card-title flex items-center gap-2",children:[(0,t.jsx)(h.Play,{className:"w-6 h-6 text-success"}),"Continue Existing Session"]}),(0,t.jsx)("div",{className:"flex flex-col gap-2 mt-4 max-h-64 overflow-y-auto",children:er.map(e=>(0,t.jsx)("div",{className:"flex flex-col gap-2 p-3 bg-base-100 rounded-md border border-base-300",children:(0,t.jsxs)("div",{className:"flex justify-between items-start",children:[(0,t.jsxs)("div",{children:[e.title&&(0,t.jsx)("div",{className:"font-semibold",children:e.title}),(0,t.jsx)("div",{className:"text-xs opacity-60 font-mono",children:e.sessionName}),(0,t.jsxs)("div",{className:"text-xs opacity-60 mt-1",children:["Agent: ",e.agent," • Model: ",e.model]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("button",{className:"btn btn-sm btn-success btn-outline gap-2",onClick:()=>tD(e),disabled:eL||eF===e.sessionName,children:[(0,t.jsx)(h.Play,{className:"w-3 h-3"})," Resume"]}),(0,t.jsxs)("button",{className:"btn btn-sm btn-secondary btn-outline gap-2",onClick:()=>(e=>{if(!Q)return;let t=`/new?repo=${encodeURIComponent(Q)}&prefillFromSession=${encodeURIComponent(e.sessionName)}`;Z.push(t)})(e),disabled:eL||eF===e.sessionName,title:"Start a new attempt prefilled from this session",children:[(0,t.jsx)(i.Plus,{className:"w-3 h-3"})," New Attempt"]}),(0,t.jsxs)("button",{className:"btn btn-sm btn-error btn-outline gap-2",onClick:()=>tL(e),disabled:eL||eF===e.sessionName,children:[(0,t.jsx)(u.Trash2,{className:"w-3 h-3"}),eF===e.sessionName?"Deleting...":"Delete"]})]})]})},e.sessionName))})]})}),(0,t.jsx)("div",{className:"card w-full bg-base-200 shadow-xl",children:(0,t.jsxs)("div",{className:"card-body",children:[(0,t.jsxs)("h2",{className:"card-title flex items-center gap-2",children:[(0,t.jsx)(d,{className:"w-6 h-6 text-secondary"}),"Start New Session"]}),(0,t.jsxs)("div",{className:"mt-4 space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("button",{type:"button",className:"btn btn-ghost btn-sm px-2 h-auto min-h-0 normal-case justify-start gap-2",onClick:()=>eb(e=>!e),children:[(0,t.jsx)(c,{className:`w-4 h-4 transition-transform ${ex?"rotate-90":""}`}),ex?"Hide Session Setup":e1]}),ex&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium opacity-70",children:"Agent Provider"}),(0,t.jsxs)("div",{className:"join w-full",children:[(0,t.jsx)("div",{className:"join-item bg-base-300 flex items-center px-3 border border-base-content/20 border-r-0",children:(0,t.jsx)(d,{className:"w-4 h-4"})}),(0,t.jsx)("select",{className:"select select-bordered join-item w-full focus:outline-none",value:ec?.cli||"",onChange:ta,disabled:eL,children:_.map(e=>(0,t.jsx)("option",{value:e.cli,children:e.name},e.cli))})]}),ec?.description&&(0,t.jsx)("p",{className:"text-[10px] opacity-60 mt-1 pl-1 italic leading-tight",children:ec.description})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium opacity-70",children:"Model"}),(0,t.jsxs)("div",{className:"join w-full",children:[(0,t.jsx)("div",{className:"join-item bg-base-300 flex items-center px-3 border border-base-content/20 border-r-0",children:(0,t.jsx)(m,{className:"w-4 h-4"})}),(0,t.jsxs)("select",{className:"select select-bordered join-item w-full focus:outline-none",value:ed,onChange:ts,disabled:eL||!ec,children:[(0,t.jsx)("option",{value:"auto",children:"Auto"}),ec?.models.map(e=>(0,t.jsx)("option",{value:e.id,children:e.label},e.id))]})]}),ec?.models.find(e=>e.id===ed)?.description&&(0,t.jsx)("p",{className:"text-[10px] opacity-60 mt-1 pl-1 italic leading-tight",children:ec.models.find(e=>e.id===ed)?.description})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium opacity-70",children:"Start up script (Optional)"}),(0,t.jsx)("input",{type:"text",className:"input input-bordered w-full font-mono text-sm",placeholder:"npm i",value:eu,onChange:tr,onBlur:tl,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),tC())},disabled:eL}),(0,t.jsx)("div",{className:"text-xs opacity-50 px-1",children:"Script to run in the terminal agent iframe upon startup."})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium opacity-70",children:"Dev server script (Optional)"}),(0,t.jsx)("input",{type:"text",className:"input input-bordered w-full font-mono text-sm",placeholder:"npm run dev",value:ep,onChange:e=>{ef(e.target.value)},onBlur:tn,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),tC())},disabled:eL}),(0,t.jsx)("div",{className:"text-xs opacity-50 px-1",children:"Script for the Session View Start Dev Server button in the right terminal."})]})]})]}),(0,t.jsx)("div",{className:"divider"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium opacity-70",children:"Title (Optional)"}),(0,t.jsx)("input",{type:"text",className:"input input-bordered w-full font-mono text-sm",placeholder:"Task Title",value:ey,onChange:e=>ew(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),tC())},disabled:eL})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium opacity-70",children:"Initial Message (Optional)"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("textarea",{className:"textarea textarea-bordered w-full h-64 font-mono text-sm leading-tight resize-none",placeholder:"Describe what you want the agent to do... Type @ to mention files.",value:eg,onChange:tw,onKeyDown:e=>{if((e.metaKey||e.ctrlKey)&&"Enter"===e.key){e.preventDefault(),tC();return}td&&tu.length>0&&("ArrowUp"===e.key?(e.preventDefault(),tg(e=>e>0?e-1:tu.length-1)):"ArrowDown"===e.key?(e.preventDefault(),tg(e=>e<tu.length-1?e+1:0)):"Enter"===e.key||"Tab"===e.key?(e.preventDefault(),tj(tu[tb])):"Escape"===e.key&&(e.preventDefault(),tm(!1)))},onClick:e=>{tx(e.currentTarget.selectionStart),tm(!1)},onKeyUp:e=>tx(e.currentTarget.selectionStart),disabled:eL}),td&&tu.length>0&&(0,t.jsx)("div",{className:"absolute left-0 right-0 z-50 mt-1 max-h-48 overflow-y-auto bg-base-100 border border-base-300 rounded-md shadow-lg",children:tu.map((e,a)=>(0,t.jsx)("button",{className:`w-full text-left px-3 py-2 text-xs border-b border-base-200 last:border-0 truncate ${a===tb?"bg-primary text-primary-content":"hover:bg-primary/10"}`,onMouseDown:t=>{t.preventDefault(),tj(e)},children:e},e))})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium opacity-70",children:"Attachments (Optional)"}),(0,t.jsx)("input",{type:"file",multiple:!0,className:"file-input file-input-bordered w-full",onChange:e=>{e.target.files&&(to(Array.from(e.target.files).map((e,t)=>tc(e,t))),e.target.value="")},disabled:eL}),(0,t.jsx)("div",{className:"text-xs opacity-50 px-1",children:"Paste files from clipboard with Cmd/Ctrl+V anywhere on this page."}),ej.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-2",children:ej.map((e,a)=>(0,t.jsxs)("span",{className:"badge badge-neutral gap-2 p-3",children:[e.name,(0,t.jsx)("button",{onClick:()=>{eN(e=>e.filter((e,t)=>t!==a))},className:"btn btn-ghost btn-xs btn-circle text-error",children:(0,t.jsx)(n,{className:"w-3 h-3"})})]},`upload-${a}`))}),eS.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-2",children:eS.map((e,a)=>(0,t.jsxs)("span",{className:"badge badge-secondary gap-2 p-3",children:[e,(0,t.jsx)("button",{onClick:()=>{ek(e=>e.filter((e,t)=>t!==a))},className:"btn btn-ghost btn-xs btn-circle text-error",title:"Remove carried attachment",children:(0,t.jsx)(n,{className:"w-3 h-3"})})]},`prefill-${e}-${a}`))})]}),(0,t.jsx)("div",{className:"card-actions justify-end mt-4",children:(0,t.jsx)("button",{className:"btn btn-primary btn-wide shadow-lg",onClick:tC,disabled:eL,children:eL?(0,t.jsx)("span",{className:"loading loading-spinner"}):"Start Session"})})]})]})})]})]}),"new"===e&&!Q&&(0,t.jsx)("div",{className:"card w-full max-w-2xl bg-base-200 shadow-xl",children:(0,t.jsxs)("div",{className:"card-body",children:[e$&&(0,t.jsx)("div",{className:"alert alert-error text-sm py-2 px-3",children:e$}),(0,t.jsx)("h2",{className:"card-title",children:"Select a Repository"}),(0,t.jsx)("p",{className:"opacity-70 text-sm",children:"Choose a repository first, then start or resume a session."}),(0,t.jsx)("div",{className:"card-actions justify-end mt-4",children:(0,t.jsx)("button",{className:"btn btn-primary",onClick:()=>Z.push("/"),children:"Go to Home"})})]})}),"new"===e&&eB&&eG&&(0,t.jsx)("div",{className:"fixed inset-0 z-[1000] flex items-center justify-center bg-base-content/45 px-4",children:(0,t.jsx)("div",{className:"w-full max-w-md rounded-xl border border-base-300 bg-base-100 p-6 shadow-2xl",children:(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)("span",{className:"loading loading-spinner loading-lg text-primary"}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("h3",{className:"text-lg font-semibold",children:["Installing ",Y[eG]]}),(0,t.jsx)("p",{className:"text-sm opacity-70",children:"Please wait while we install the coding agent CLI."})]})]})})}),"new"===e&&eV&&e_&&(0,t.jsx)("div",{className:"fixed inset-0 z-[1001] flex items-center justify-center bg-base-content/60 p-4",children:(0,t.jsx)("div",{className:"w-full max-w-5xl rounded-xl border border-base-300 bg-base-100 shadow-2xl",children:(0,t.jsxs)("div",{className:"space-y-4 p-5 md:p-6",children:[(0,t.jsx)("h3",{className:"text-xl font-semibold",children:"Login Required"}),(0,t.jsxs)("p",{className:"text-sm opacity-80",children:[Y[e_]," has been installed. Complete login in the terminal below, then click Done to continue."]}),(0,t.jsxs)("p",{className:"text-xs opacity-60",children:["Command: ",(0,t.jsx)("span",{className:"font-mono",children:eW})]}),(0,t.jsx)("div",{className:"h-[420px] overflow-hidden rounded-lg border border-base-300 bg-base-200",children:(0,t.jsx)("iframe",{ref:e0,src:"/terminal",className:"h-full w-full border-none",allow:"clipboard-read; clipboard-write",onLoad:tS})}),eX&&(0,t.jsx)("div",{className:"alert alert-error text-sm py-2",children:eX}),!eX&&(0,t.jsx)("div",{className:"text-xs opacity-70",children:eJ?"Login command was sent to the terminal automatically.":"Waiting for terminal to initialize..."}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)("button",{className:"btn btn-primary",onClick:()=>void tM(),disabled:eL,children:"Done"})})]})})}),"new"===e&&!Q&&(!s||!!e$)&&(0,t.jsx)("div",{className:"card w-full max-w-2xl bg-base-200 shadow-xl",children:(0,t.jsxs)("div",{className:"card-body",children:[(0,t.jsxs)("h2",{className:"card-title flex items-center gap-2",children:[(0,t.jsx)(r,{className:"w-6 h-6 text-primary"}),"Git Repository Selector"]}),eA?(0,t.jsxs)("div",{className:"alert text-sm py-2 px-3 mt-2 flex items-center gap-2",children:[(0,t.jsx)("span",{className:"loading loading-spinner loading-sm"}),p?`Searching for repository "${p}"...`:"Searching for repository..."]}):e$?(0,t.jsx)("div",{className:"alert alert-error text-sm py-2 px-3 mt-2",children:e$}):(0,t.jsx)("div",{className:"text-sm opacity-70 mt-2",children:"No repository specified."}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)("button",{className:"btn btn-primary btn-sm",onClick:()=>Z.push("/"),children:"Choose Repository"})})]})}),"home"===e&&x&&(0,t.jsx)(j,{initialPath:y?.defaultRoot||void 0,onSelect:e6,onCancel:()=>b(!1),checkRepo:N}),"home"===e&&g&&(0,t.jsx)(j,{title:"Default Root Folder",initialPath:y?.defaultRoot||void 0,onSelect:e9,onCancel:()=>v(!1)})]})}e.s(["default",()=>J],5951)}]);
|