"use strict";exports.id=6938,exports.ids=[6938],exports.modules={"./src/commands/search.ts"(e,t,n){n.a(e,(async(e,o)=>{try{n.r(t),n.d(t,{handleSearch:()=>x});var r=n("../context/dist/core.js"),s=n("../indexing-client/dist/index.js"),c=n("../proto/dist/generated/aiserver/v1/repository_connect.js"),a=n("../proto/dist/generated/aiserver/v1/repository_pb.js"),i=n("../../../../../../../../../../private/tmp/buildkite-job-01a03ad4-00a2-4e4f-9a4f-0e1ec809f684/agent-cli-mac-macos-x64-01a03ad4-00a2-4e4f-9a4f-0e1ec809f684.LshlV881/pnpm-virtual-store/@connectrpc+connect@1.6.1_patch_hash=c9c7616ccfc0246b19c6537f56676d8501713cb6c94b440d13_ef7275568c8b1f1f499006dc986c70d2/node_modules/@connectrpc/connect/dist/esm/promise-client.js"),l=n("../../../../../../../../../../private/tmp/buildkite-job-01a03ad4-00a2-4e4f-9a4f-0e1ec809f684/agent-cli-mac-macos-x64-01a03ad4-00a2-4e4f-9a4f-0e1ec809f684.LshlV881/pnpm-virtual-store/@connectrpc+connect-node@1.6.1_@bufbuild+protobuf@1.10.1_@connectrpc+connect@1.6.1_patc_c333e1fd2007e07028093d0fe22e3f55/node_modules/@connectrpc/connect-node/dist/esm/index.js"),p=n("../../../../../../../../../../private/tmp/buildkite-job-01a03ad4-00a2-4e4f-9a4f-0e1ec809f684/agent-cli-mac-macos-x64-01a03ad4-00a2-4e4f-9a4f-0e1ec809f684.LshlV881/pnpm-virtual-store/chalk@5.6.2/node_modules/chalk/source/index.js"),d=n("./src/components/path-display.tsx"),u=n("./src/console-io.ts"),f=e([d]),h=f.then?(await f)():f;d=h[0];var m=function(e,t,n,o){return new(n||(n=Promise))((function(r,s){function c(e){try{i(o.next(e))}catch(e){s(e)}}function a(e){try{i(o.throw(e))}catch(e){s(e)}}function i(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}i((o=o.apply(e,t||[])).next())}))};function v(e){return t=>n=>m(this,void 0,void 0,(function*(){const o=yield e.getAccessToken();if(!o)throw new Error("No access token found");n.header.set("authorization",`Bearer ${o}`);const r=null!=="2026.08.25-3e8eec8"?"2026.08.25-3e8eec8":"unknown";return n.header.set("x-cursor-client-version",`cli-${r}`),yield t(n)}))}class g{constructor(e,t,n){this.repoName=e,this.repoOwner=t,this.pathEncryptionKey=n}loadRepositoryIdentity(){const e=new s.Gv(this.pathEncryptionKey);return Promise.resolve({repoName:this.repoName,repoOwner:this.repoOwner,encryptionScheme:e})}}function y(e,t){var n,o,r,s,c;if(0===t.length)return p.Ay.yellow(`No results found for "${e}"`);const a=[];a.push(p.Ay.green.bold(`Found ${t.length} result${1!==t.length?"s":""} for "${e}"`));for(let e=0;e<t.length;e+=1){const i=t[e].codeBlock;if(!i)continue;const l=null!==(n=i.relativeWorkspacePath)&&void 0!==n?n:"",u=p.Ay.cyan.bold(`${(e+1).toString().padStart(3," ")}.`),f=(0,d.j)(l),h=p.Ay.dim(`(L${null===(r=null===(o=i.range)||void 0===o?void 0:o.startPosition)||void 0===r?void 0:r.line} - L${null===(c=null===(s=i.range)||void 0===s?void 0:s.endPosition)||void 0===c?void 0:c.line})`);a.push(`${u} ${f} ${h}`)}return a.join("\n")}function x(e,t,n,o){return m(this,void 0,void 0,(function*(){(0,u.OT)(`🔍 Searching for "${e}"...`);try{const d=(0,r.q6)(),f=yield t.getRepositoryInfo();f.repoName&&f.repoOwner||((0,u.p2)(p.Ay.red("❌ Repository not properly initialized")),process.exit(1));const h=(0,l.wQ)({baseUrl:o.repoEndpoint,httpVersion:o.repoHttpVersion,interceptors:[v(n)],nodeOptions:{rejectUnauthorized:!o.repoInsecure}}),m=(0,i.UU)(c.B,h),x=new a.Ym({}),b=new g(f.repoName,f.repoOwner,f.pathEncryptionKey||""),j=new s.q$(m,x,b,process.cwd()),w=yield j.search(d,e);(0,u.OT)("✅ Search completed"),(0,u.OT)(y(e,null!=w?w:[])),process.exit(0)}catch(e){(0,u.p2)(e instanceof Error?e.message:String(e)),process.exit(1)}}))}o()}catch(b){o(b)}}))},"./src/components/path-display.tsx"(e,t,n){n.a(e,(async(e,o)=>{try{n.d(t,{j:()=>a}),n("../../../../../../../../../../private/tmp/buildkite-job-01a03ad4-00a2-4e4f-9a4f-0e1ec809f684/agent-cli-mac-macos-x64-01a03ad4-00a2-4e4f-9a4f-0e1ec809f684.LshlV881/pnpm-virtual-store/react@19.2.4/node_modules/react/jsx-runtime.js");var r=n("../ink/build/index.js"),s=(n("../../../../../../../../../../private/tmp/buildkite-job-01a03ad4-00a2-4e4f-9a4f-0e1ec809f684/agent-cli-mac-macos-x64-01a03ad4-00a2-4e4f-9a4f-0e1ec809f684.LshlV881/pnpm-virtual-store/react@19.2.4/node_modules/react/index.js"),n("./src/constants.ts"),e([r]));function c(e,t){const n=e.includes("\\")?"\\":"/";if(e.length<=t)return{segments:e.split(n),separator:n};const o=e.split(n),r=o[o.length-1];if(r.length+3>t)return{segments:["...",r.substring(0,t-3)],ellipsisIndex:0,separator:n};const s=n.length,c=t-r.length-3;let a=0;const i=[];let l=-1;for(let e=0;e<o.length-1;e++){const t=o[e].length+(e>0?s:0);if(!(a+t<=c)){l=i.length;break}i.push(o[e]),a+=t}return-1!==l?(i.splice(l,0,"..."),i.push(r),{segments:i,ellipsisIndex:l,separator:n}):{segments:o,separator:n}}r=(s.then?(await s)():s)[0];const a=(e,t=50)=>{const{segments:n,separator:o}=c(e,t);let r="";return n.forEach(((e,t)=>{t>0&&"..."!==e&&(r+=o),r+=e})),r};o()}catch(i){o(i)}}))}};