gitnexus 1.6.10-rc.55 → 1.6.10-rc.56

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitnexus",
3
- "version": "1.6.10-rc.55",
3
+ "version": "1.6.10-rc.56",
4
4
  "description": "Graph-powered code intelligence for AI agents. Index any codebase, query via MCP or CLI.",
5
5
  "author": "Abhigyan Patwari",
6
6
  "license": "PolyForm-Noncommercial-1.0.0",
@@ -11,7 +11,7 @@ Error generating stack: `+e.message+`
11
11
  `);d=r.pop()||``;let a=`message`;for(let e of r){if(e.startsWith(`id: `)){i=e.slice(4).trim();continue}if(!e.startsWith(`:`)){if(e.startsWith(`event: `))a=e.slice(7).trim();else if(e.startsWith(`data: `)){try{let n=JSON.parse(e.slice(6));if(a===`complete`){t.onComplete?.(n);return}else if(a===`failed`){let e=n;t.onError?.(e?.error||`Job failed`);return}else t.onMessage?.(n)}catch{}a=`message`}}}}!n.signal.aborted&&o<3&&setTimeout(()=>a(o+1),r*2**o)}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;!n.signal.aborted&&o<3?setTimeout(()=>a(o+1),r*2**o):t.onError?.(e instanceof Error?e.message:`Stream error`)}})()};return a(0),n}var Pe=`http://localhost:4747`;function Fe(e){let t;try{t=new URL(e)}catch{throw Error(`Invalid backend URL: must be a well-formed http:// or https:// URL`)}if(t.protocol!==`http:`&&t.protocol!==`https:`)throw Error(`Backend URL must use http:// or https:// (got ${t.protocol})`)}var Ie=e=>{let t=e.replace(/\/$/,``);Fe(t),Pe=t};function Le(e){let t=e.trim().replace(/\/+$/,``);return!t.startsWith(`http://`)&&!t.startsWith(`https://`)&&(t=t.startsWith(`localhost`)||t.startsWith(`127.0.0.1`)?`http://${t}`:`https://${t}`),t=t.replace(/\/api$/,``),t}var Re=3e4,ze=2e3,Be=new Set([`GET`,`HEAD`,`OPTIONS`]),Ve=async(e,t={},n=Re,r=!1)=>{let i=AbortSignal.timeout(n),a=t.signal,o=a?AbortSignal.any([i,a]):i,s=(t.method??`GET`).toUpperCase(),c=Be.has(s)||r?2:1,l;try{l=`web-backend:${new URL(Pe).origin}`}catch{l=`web-backend:invalid`}try{return await ue(e,{...t,signal:o},{breakerKey:l,retry:{maxAttempts:c,baseDelayMs:250,capDelayMs:1500}})}catch(t){if(t instanceof te)throw new je(`GitNexus backend at ${Pe} is unhealthy; retry in ${Math.ceil(t.retryAfterMs/1e3)}s`,0,`network`);if(t instanceof le)return t.response;throw t instanceof DOMException&&t.name===`TimeoutError`?new je(`Request to ${e} timed out after ${n}ms`,0,`timeout`):t instanceof DOMException&&t.name===`AbortError`?new je(`Request aborted`,0,`network`):t instanceof TypeError?new je(`Network error reaching GitNexus backend at ${Pe}: ${t.message}`,0,`network`):t}},He=async e=>{if(e.ok)return;let t=e.statusText,n;try{let r=await e.json();r&&typeof r.error==`string`?t=r.error:r&&typeof r.message==`string`&&(t=r.message),r&&typeof r.code==`string`&&(n=r.code)}catch{}let r=e.status===404?`not_found`:e.status===429?`rate_limited`:n===`origin_not_allowed`?`origin_blocked`:e.status>=400&&e.status<500?`client`:`server`,i;if(e.status===429){let t=e.headers.get(`retry-after`);if(t){let e=Number(t);if(Number.isFinite(e)&&e>=0)i=e*1e3;else{let e=Date.parse(t);Number.isFinite(e)&&(i=Math.max(0,e-Date.now()))}}}throw new je(t,e.status,r,i)},Ue=e=>e?`repo=${encodeURIComponent(e)}`:``,We=(e,t)=>{let n=!1,r=null,i=null,a=0,o=!1,s=()=>{n||(i=new EventSource(`${Pe}/api/heartbeat`),i.onopen=()=>{n||(a=0,o=!1,e())},i.onerror=()=>{if(i?.close(),i=null,n)return;o||(o=!0,t());let e=Math.min(1e3*2**a,15e3);a++,r=setTimeout(s,e)})};return s(),()=>{n=!0,i?.close(),r&&clearTimeout(r)}},Ge=async e=>{await He(await Ve(`${Pe}/api/repo?repo=${encodeURIComponent(e)}`,{method:`DELETE`}))},Ke=async()=>{try{return(await Ve(`${Pe}/api/repos`,{},ze)).status===200}catch{return!1}},qe=async()=>{let e=await Ve(`${Pe}/api/repos`);return await He(e),(await e.json()).map(e=>({...e,repoPath:e.repoPath??e.path}))},Je=3e5,Ye=async(e,t)=>{let n=await Ve(`${Pe}/api/repo${e?`?${Ue(e)}`:``}`,{},t?.awaitAnalysis?Je:void 0);await He(n);let r=await n.json();return{...r,repoPath:r.repoPath??r.path}},Xe=async(e,t)=>{let n=[Ue(e),t?.includeContent?`includeContent=true`:``,`stream=true`].filter(Boolean).join(`&`),r=await Ve(`${Pe}/api/graph${n?`?${n}`:``}`,{signal:t?.signal},12e4);if(await He(r),(r.headers.get(`Content-Type`)||``).includes(`application/x-ndjson`))return Ze(r,t?.onProgress,t?.maxNodes,t?.maxEdges);if(!t?.onProgress||!r.body)return r.json();let i=r.headers.get(`Content-Length`),a=i?parseInt(i,10):null,o=r.body.getReader(),s=[],c=0;for(;;){let{done:e,value:n}=await o.read();if(e)break;s.push(n),c+=n.length,t.onProgress(c,a)}let l=new Uint8Array(c),u=0;for(let e of s)l.set(e,u),u+=e.length;return JSON.parse(new TextDecoder().decode(l))},Ze=async(e,t,n,r)=>{if(!e.body)throw new je(`No response body`,e.status,`server`);let i=e.headers.get(`Content-Length`),a=i?parseInt(i,10):null,o=e.body.getReader(),s=new TextDecoder,c=[],l=[],u=``,d=0,f=()=>typeof n==`number`&&c.length>n||typeof r==`number`&&l.length>r,p=t=>{let n=t.trim();if(!n)return;let r=JSON.parse(n);if(r.type===`node`){c.push(r.data);return}if(r.type===`relationship`){l.push(r.data);return}if(r.type===`error`)throw new je(r.error,e.status||500,`server`)},m=async()=>{try{await o.cancel()}catch{}throw new Me(`Graph exceeds the size limit (nodes=${c.length}, relationships=${l.length})`,c.length,l.length)};for(;;){let{done:e,value:n}=await o.read();if(e)break;d+=n.length,t?.(d,a),u+=s.decode(n,{stream:!0});let r=u.split(`
12
12
  `);u=r.pop()||``;for(let e of r)p(e),f()&&await m()}return u+=s.decode(),p(u),f()&&await m(),{nodes:c,relationships:l}},Qe=async(e,t)=>{let n=await Ve(`${Pe}/api/query`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cypher:e,repo:t})});await He(n);let r=await n.json();return r.result??r},$e=async(e,t)=>{let n=await Ve(`${Pe}/api/search`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({query:e,limit:t?.limit,mode:t?.mode,enrich:t?.enrich,repo:t?.repo})});return await He(n),(await n.json()).results??[]},et=async(e,t,n)=>{let r=[`pattern=${encodeURIComponent(e)}`,Ue(t),n?`limit=${n}`:``].filter(Boolean).join(`&`),i=await Ve(`${Pe}/api/grep?${r}`);return await He(i),(await i.json()).results??[]},tt=async(e,t)=>{let n=[`path=${encodeURIComponent(e)}`,Ue(t?.repo),t?.startLine===void 0?``:`startLine=${t.startLine}`,t?.endLine===void 0?``:`endLine=${t.endLine}`].filter(Boolean).join(`&`),r=await Ve(`${Pe}/api/file?${n}`);return await He(r),r.json()},nt=async(e,t,n)=>{let r=new FormData;r.append(`manifest`,JSON.stringify(t));for(let t of e)r.append(`files`,t);let i=await Ve(`${Pe}/api/analyze/upload`,{method:`POST`,body:r,signal:n},5*6e4);return await He(i),i.json()},rt=async e=>{let t=await Ve(`${Pe}/api/analyze`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)},3e4);return await He(t),t.json()},it=async e=>{await He(await Ve(`${Pe}/api/analyze/${encodeURIComponent(e)}`,{method:`DELETE`}))},at=(e,t,n,r)=>Ne(`${Pe}/api/analyze/${encodeURIComponent(e)}/progress`,{onMessage:t,onComplete:n,onError:r}),ot=async e=>{let t=await Ve(`${Pe}/api/embed`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({repo:e})},3e4);return await He(t),t.json()},st=(e,t,n,r)=>Ne(`${Pe}/api/embed/${encodeURIComponent(e)}/progress`,{onMessage:t,onComplete:n,onError:r});async function ct(e,t,n,r,i){Ie(Le(e)),t?.(`validating`,0,null);let a=await Ye(r,{awaitAnalysis:i?.awaitAnalysis});if(De({explicit:i?.skipGraph,nodeCount:a.stats?.nodes,threshold:T,edgeCount:a.stats?.edges,edgeThreshold:C}))return{nodes:[],relationships:[],repoInfo:a,graphSkipped:!0};let o=i?.skipGraph!==!1;t?.(`downloading`,0,null);try{let{nodes:e,relationships:i}=await Xe(r,{signal:n,onProgress:(e,n)=>t?.(`downloading`,e,n),maxNodes:o?T:void 0,maxEdges:o?C:void 0});return{nodes:e,relationships:i,repoInfo:a,graphSkipped:!1}}catch(e){if(e instanceof Me)return{nodes:[],relationships:[],repoInfo:a,graphSkipped:!0};throw e}}var V=e=>typeof e==`string`,lt=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},ut=e=>e==null?``:String(e),dt=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},ft=/###/g,pt=e=>e&&e.includes(`###`)?e.replace(ft,`.`):e,mt=e=>!e||V(e),ht=(e,t,n)=>{let r=V(t)?t.split(`.`):t,i=0;for(;i<r.length-1;){if(mt(e))return{};let t=pt(r[i]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++i}return mt(e)?{}:{obj:e,k:pt(r[i])}},gt=(e,t,n)=>{let{obj:r,k:i}=ht(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let a=t[t.length-1],o=t.slice(0,t.length-1),s=ht(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=ht(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},_t=(e,t,n,r)=>{let{obj:i,k:a}=ht(e,t,Object);i[a]=i[a]||[],i[a].push(n)},vt=(e,t)=>{let{obj:n,k:r}=ht(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},yt=(e,t,n)=>{let r=vt(e,n);return r===void 0?vt(t,n):r},bt=(e,t,n)=>{for(let r in t)r!==`__proto__`&&r!==`constructor`&&(r in e?V(e[r])||e[r]instanceof String||V(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):bt(e[r],t[r],n):e[r]=t[r]);return e},xt=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`),St={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`,"/":`&#x2F;`},Ct=e=>V(e)?e.replace(/[&<>"'\/]/g,e=>St[e]):e,wt=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(t!==void 0)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}},Tt=[` `,`,`,`?`,`!`,`;`],Et=new wt(20),Dt=(e,t,n)=>{t||=``,n||=``;let r=Tt.filter(e=>!t.includes(e)&&!n.includes(e));if(r.length===0)return!0;let i=Et.getRegExp(`(${r.map(e=>e===`?`?`\\?`:e).join(`|`)})`),a=!i.test(e);if(!a){let t=e.indexOf(n);t>0&&!i.test(e.substring(0,t))&&(a=!0)}return a},Ot=(e,t,n=`.`)=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let r=t.split(n),i=e;for(let e=0;e<r.length;){if(!i||typeof i!=`object`)return;let t,a=``;for(let o=e;o<r.length;++o)if(o!==e&&(a+=n),a+=r[o],t=i[a],t!==void 0){if([`string`,`number`,`boolean`].includes(typeof t)&&o<r.length-1)continue;e+=o-e+1;break}i=t}return i},kt=e=>e?.replace(/_/g,`-`),At={type:`logger`,log(e){this.output(`log`,e)},warn(e){this.output(`warn`,e)},error(e){this.output(`error`,e)},output(e,t){console?.[e]?.apply?.(console,t)}},jt=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||At,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,`log`,``,!0)}warn(...e){return this.forward(e,`warn`,``,!0)}error(...e){return this.forward(e,`error`,``)}deprecate(...e){return this.forward(e,`warn`,`WARNING DEPRECATED: `,!0)}forward(e,t,n,r){return r&&!this.debug?null:(e=e.map(e=>V(e)?e.replace(/[\r\n\x00-\x1F\x7F]/g,` `):e),V(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t||=this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},Mt=class{constructor(){this.observers={}}on(e,t){return e.split(` `).forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}once(e,t){let n=(...r)=>{t(...r),this.off(e,n)};return this.on(e,n),this}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)}),this.observers[`*`]&&Array.from(this.observers[`*`].entries()).forEach(([n,r])=>{for(let i=0;i<r;i++)n(e,...t)})}},Nt=class extends Mt{constructor(e,t={ns:[`translation`],defaultNS:`translation`}){super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.includes(e)||this.options.ns.push(e)}removeNamespaces(e){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,r={}){let i=r.keySeparator===void 0?this.options.keySeparator:r.keySeparator,a=r.ignoreJSONStructure===void 0?this.options.ignoreJSONStructure:r.ignoreJSONStructure,o;e.includes(`.`)?o=e.split(`.`):(o=[e,t],n&&(Array.isArray(n)?o.push(...n):V(n)&&i?o.push(...n.split(i)):o.push(n)));let s=vt(this.data,o);return!s&&!t&&!n&&e.includes(`.`)&&(e=o[0],t=o[1],n=o.slice(2).join(`.`)),s||!a||!V(n)?s:Ot(this.data?.[e]?.[t],n,i)}addResource(e,t,n,r,i={silent:!1}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=[e,t];n&&(o=o.concat(a?n.split(a):n)),e.includes(`.`)&&(o=e.split(`.`),r=t,t=o[1]),this.addNamespaces(t),gt(this.data,o,r),i.silent||this.emit(`added`,e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(let r in n)(V(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit(`added`,e,t,n)}addResourceBundle(e,t,n,r,i,a={silent:!1,skipCopy:!1}){let o=[e,t];e.includes(`.`)&&(o=e.split(`.`),r=n,n=t,t=o[1]),this.addNamespaces(t);let s=vt(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?bt(s,n,i):s={...s,...n},gt(this.data,o,s),a.silent||this.emit(`added`,e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit(`removed`,e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||=this.options.defaultNS,this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}},Pt={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(e=>{t=this.processors[e]?.process(t,n,r,i)??t}),t}},Ft=Symbol(`i18next/PATH_KEY`);function It(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===Ft?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function Lt(e,t){let{[Ft]:n}=e(It()),r=t?.keySeparator??`.`,i=t?.nsSeparator??`:`,a=t?.enableSelector===`strict`;if(n.length>1&&i){let e=t?.ns,o=a?Array.isArray(e)?e:e?[e]:null:Array.isArray(e)?e:null;if(o&&(a?o:o.length>1?o.slice(1):[]).includes(n[0]))return`${n[0]}${i}${n.slice(1).join(r)}`}return n.join(r)}var Rt=e=>!V(e)&&typeof e!=`boolean`&&typeof e!=`number`,zt=class e extends Mt{constructor(e,t={}){super(),dt([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=jt.create(`translator`),this.checkedLoadedFor={}}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let n={...t};if(e==null)return!1;let r=this.resolve(e,n);if(r?.res===void 0)return!1;let i=Rt(r.res);return!(n.returnObjects===!1&&i)}extractFromKey(e,t){let n=t.nsSeparator===void 0?this.options.nsSeparator:t.nsSeparator;n===void 0&&(n=`:`);let r=t.keySeparator===void 0?this.options.keySeparator:t.keySeparator,i=t.ns||this.options.defaultNS||[],a=n&&e.includes(n),o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!Dt(e,n,r);if(a&&!o){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:V(i)?[i]:i};let a=e.split(n);(n!==r||n===r&&this.options.ns.includes(a[0]))&&(i=a.shift()),e=a.join(r)}return{key:e,namespaces:V(i)?[i]:i}}translate(t,n,r){let i=typeof n==`object`?{...n}:n;if(typeof i!=`object`&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i==`object`&&(i={...i}),i||={},t==null)return``;typeof t==`function`&&(t=Lt(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]),t=t.map(e=>typeof e==`function`?Lt(e,{...this.options,...i}):String(e));let a=i.returnDetails===void 0?this.options.returnDetails:i.returnDetails,o=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,{key:s,namespaces:c}=this.extractFromKey(t[t.length-1],i),l=c[c.length-1],u=i.nsSeparator===void 0?this.options.nsSeparator:i.nsSeparator;u===void 0&&(u=`:`);let d=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()===`cimode`)return f?a?{res:`${l}${u}${s}`,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:`${l}${u}${s}`:a?{res:s,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:s;let p=this.resolve(t,i),m=p?.res,h=p?.usedKey||s,g=p?.exactUsedKey||s,_=[`[object Number]`,`[object Function]`,`[object RegExp]`],v=i.joinArrays===void 0?this.options.joinArrays:i.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,b=i.count!==void 0&&!V(i.count),x=e.hasDefaultValue(i),S=b?this.pluralResolver.getSuffix(d,i.count,i):``,C=i.ordinal&&b?this.pluralResolver.getSuffix(d,i.count,{ordinal:!1}):``,w=b&&!i.ordinal&&i.count===0,T=w&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${S}`]||i[`defaultValue${C}`]||i.defaultValue,E=m;y&&!m&&x&&(E=T);let D=Rt(E),O=Object.prototype.toString.apply(E);if(y&&E&&D&&!_.includes(O)&&!(V(v)&&Array.isArray(E))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,E,{...i,ns:c}):`key '${s} (${this.language})' returned an object instead of string.`;return a?(p.res=e,p.usedParams=this.getUsedParamsDetails(i),p):e}if(o){let e=Array.isArray(E),t=e?[]:{},n=e?g:h;for(let e in E)if(Object.prototype.hasOwnProperty.call(E,e)){let r=`${n}${o}${e}`;x&&!m?t[e]=this.translate(r,{...i,defaultValue:Rt(T)?T[e]:void 0,joinArrays:!1,ns:c}):t[e]=this.translate(r,{...i,joinArrays:!1,ns:c}),t[e]===r&&(t[e]=E[e])}m=t}}else if(y&&V(v)&&Array.isArray(m))m=m.join(v),m&&=this.extendTranslation(m,t,i,r);else{let e=!1,n=!1;!this.isValidLookup(m)&&x&&(e=!0,m=T),this.isValidLookup(m)||(n=!0,m=s);let a=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:m,c=x&&T!==m&&this.options.updateMissing;if(n||e||c){if(this.logger.log(c?`updateKey`:`missingKey`,d,l,b&&!c?`${s}${this.pluralResolver.getSuffix(d,i.count,i)}`:s,c?T:m),o){let e=this.resolve(s,{...i,keySeparator:!1});e&&e.res&&this.logger.warn(`Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.`)}let e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo===`fallback`&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else this.options.saveMissingTo===`all`?e=this.languageUtils.toResolveHierarchy(i.lng||this.language):e.push(i.lng||this.language);let n=(e,t,n)=>{let r=x&&n!==m?n:a;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,r,c,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,t,r,c,i),this.emit(`missingKey`,e,l,t,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&b?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,i);w&&i[`defaultValue${this.options.pluralSeparator}zero`]&&!t.includes(`${this.options.pluralSeparator}zero`)&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],s+t,i[`defaultValue${t}`]||T)})}):n(e,s,T))}m=this.extendTranslation(m,t,i,p,r),n&&m===s&&this.options.appendNamespaceToMissingKey&&(m=`${l}${u}${s}`),(n||e)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${u}${s}`:s,e?m:void 0,i))}return a?(p.res=m,p.usedParams=this.getUsedParamsDetails(i),p):m}extendTranslation(e,t,n,r,i){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let a=V(e)&&(n?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:n.interpolation.skipOnVariables),o;if(a){let t=e.match(this.interpolator.nestingRegexp);o=t&&t.length}let s=n.replace&&!V(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),e=this.interpolator.interpolate(e,s,n.lng||this.language||r.usedLng,n),a){let t=e.match(this.interpolator.nestingRegexp),r=t&&t.length;o<r&&(n.nest=!1)}!n.lng&&r&&r.res&&(n.lng=this.language||r.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...e)=>i?.[0]===e[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null):this.translate(...e,t),n)),n.interpolation&&this.interpolator.reset()}let a=n.postProcess||this.options.postProcess,o=V(a)?[a]:a;return e!=null&&o?.length&&n.applyPostProcessor!==!1&&(e=Pt.handle(o,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,i,a,o;return V(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>typeof e==`function`?Lt(e,{...this.options,...t}):e)),e.forEach(e=>{if(this.isValidLookup(n))return;let s=this.extractFromKey(e,t),c=s.key;r=c;let l=s.namespaces;this.options.fallbackNS&&(l=l.concat(this.options.fallbackNS));let u=t.count!==void 0&&!V(t.count),d=u&&!t.ordinal&&t.count===0,f=t.context!==void 0&&(V(t.context)||typeof t.context==`number`)&&t.context!==``,p=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);l.forEach(e=>{this.isValidLookup(n)||(o=e,!this.checkedLoadedFor[`${p[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(o)&&(this.checkedLoadedFor[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${p.join(`, `)}" won't get resolved as namespace "${o}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`)),p.forEach(r=>{if(this.isValidLookup(n))return;a=r;let o=[c];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(o,c,r,e,t);else{let e;u&&(e=this.pluralResolver.getSuffix(r,t.count,t));let n=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(t.ordinal&&e.startsWith(i)&&o.push(c+e.replace(i,this.options.pluralSeparator)),o.push(c+e),d&&o.push(c+n)),f){let r=`${c}${this.options.contextSeparator||`_`}${t.context}`;o.push(r),u&&(t.ordinal&&e.startsWith(i)&&o.push(r+e.replace(i,this.options.pluralSeparator)),o.push(r+e),d&&o.push(r+n))}}let s;for(;s=o.pop();)this.isValidLookup(n)||(i=s,n=this.getResource(r,e,s,t))}))})}),{res:n,usedKey:r,exactUsedKey:i,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e===``)}getResource(e,t,n,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){let t=[`defaultValue`,`ordinal`,`context`,`replace`,`lng`,`lngs`,`fallbackLng`,`ns`,`keySeparator`,`nsSeparator`,`returnObjects`,`returnDetails`,`joinArrays`,`postProcess`,`interpolation`],n=e.replace&&!V(e.replace),r=n?e.replace:e;if(n&&e.count!==void 0&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(let e of t)delete r[e]}return r}static hasDefaultValue(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.startsWith(`defaultValue`)&&e[t]!==void 0)return!0;return!1}},Bt=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=jt.create(`languageUtils`)}getScriptPartFromCode(e){if(e=kt(e),!e||!e.includes(`-`))return null;let t=e.split(`-`);return t.length===2||(t.pop(),t[t.length-1].toLowerCase()===`x`)?null:this.formatLanguageCode(t.join(`-`))}getLanguagePartFromCode(e){if(e=kt(e),!e||!e.includes(`-`))return e;let t=e.split(`-`);return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(V(e)&&e.includes(`-`)){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load===`languageOnly`||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(e)}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>e===r?!0:!e.includes(`-`)&&!r.includes(`-`)?!1:!!(e.includes(`-`)&&!r.includes(`-`)&&e.slice(0,e.indexOf(`-`))===r||e.startsWith(r)&&r.length>1))}),t||=this.getFallbackCodes(this.options.fallbackLng)[0],t}getFallbackCodes(e,t){if(!e)return[];if(typeof e==`function`&&(e=e(t)),V(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||=e[this.getScriptPartFromCode(t)],n||=e[this.formatLanguageCode(t)],n||=e[this.getLanguagePartFromCode(t)],n||=e.default,n||[]}toResolveHierarchy(e,t){let n=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),r=[],i=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return V(e)&&(e.includes(`-`)||e.includes(`_`))?(this.options.load!==`languageOnly`&&i(this.formatLanguageCode(e)),this.options.load!==`languageOnly`&&this.options.load!==`currentOnly`&&i(this.getScriptPartFromCode(e)),this.options.load!==`currentOnly`&&i(this.getLanguagePartFromCode(e))):V(e)&&i(this.formatLanguageCode(e)),n.forEach(e=>{r.includes(e)||i(this.formatLanguageCode(e))}),r}},Vt={zero:0,one:1,two:2,few:3,many:4,other:5},Ht={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})},Ut=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=jt.create(`pluralResolver`),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=kt(e===`dev`?`en`:e),r=t.ordinal?`ordinal`:`cardinal`,i=JSON.stringify({cleanedCode:n,type:r});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(n,{type:r})}catch{if(typeof Intl>`u`)return this.logger.error(`No Intl support, please use an Intl polyfill!`),Ht;if(!e.match(/-|_/))return Ht;let n=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(n,t)}return this.pluralRulesCache[i]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?n.resolvedOptions().pluralCategories.sort((e,t)=>Vt[e]-Vt[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:``}${e}`):[]}getSuffix(e,t,n={}){let r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:``}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix(`dev`,t,n))}},Wt=(e,t,n,r=`.`,i=!0)=>{let a=yt(e,t,n);return!a&&i&&V(n)&&(a=Ot(e,n,r),a===void 0&&(a=Ot(t,n,r))),a},Gt=e=>e.replace(/\$/g,`$$$$`),Kt=class{constructor(e={}){this.logger=jt.create(`interpolator`),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||={escapeValue:!0};let{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:i,prefixEscaped:a,suffix:o,suffixEscaped:s,formatSeparator:c,unescapeSuffix:l,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:p,nestingSuffixEscaped:m,nestingOptionsSeparator:h,maxReplaces:g,alwaysFormat:_}=e.interpolation;this.escape=t===void 0?Ct:t,this.escapeValue=n===void 0||n,this.useRawValueToEscape=r!==void 0&&r,this.prefix=i?xt(i):a||`{{`,this.suffix=o?xt(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u?xt(u):`-`,this.unescapeSuffix=this.unescapePrefix?``:l?xt(l):``,this.nestingPrefix=d?xt(d):f||xt(`$t(`),this.nestingSuffix=p?xt(p):m||xt(`)`),this.nestingOptionsSeparator=h||`,`,this.maxReplaces=g||1e3,this.alwaysFormat=_!==void 0&&_,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,`g`);this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let i,a,o,s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=e=>{if(!e.includes(this.formatSeparator)){let i=Wt(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(i,void 0,n,{...r,...t,interpolationkey:e}):i}let i=e.split(this.formatSeparator),a=i.shift().trim(),o=i.join(this.formatSeparator).trim();return this.format(Wt(t,s,a,this.options.keySeparator,this.options.ignoreJSONStructure),o,n,{...r,...t,interpolationkey:a})};this.resetRegExp(),!this.escapeValue&&typeof e==`string`&&/\$t\([^)]*\{[^}]*\{\{/.test(e)&&this.logger.warn(`nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.`);let l=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,u=r?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:r.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>Gt(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?Gt(this.escape(e)):Gt(e)}].forEach(t=>{for(o=0;i=t.regex.exec(e);){let n=i[1].trim();if(a=c(n),a===void 0)if(typeof l==`function`){let t=l(e,i,r);a=V(t)?t:``}else if(r&&Object.prototype.hasOwnProperty.call(r,n))a=``;else if(u){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),a=``;else!V(a)&&!this.useRawValueToEscape&&(a=ut(a));let s=t.safeValue(a);if(e=e.replace(i[0],s),u?(t.regex.lastIndex+=a.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,i,a,o=(e,t)=>{let n=this.nestingOptionsSeparator;if(!e.includes(n))return e;let r=e.split(RegExp(`${xt(n)}[ ]*{`)),i=`{${r[1]}`;e=r[0],i=this.interpolate(i,a);let o=i.match(/'/g),s=i.match(/"/g);((o?.length??0)%2==0&&!s||(s?.length??0)%2!=0)&&(i=i.replace(/'/g,`"`));try{a=JSON.parse(i),t&&(a={...t,...a})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return a.defaultValue&&a.defaultValue.includes(this.prefix)&&delete a.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let s=[];a={...n},a=a.replace&&!V(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let c=/{.*}/.test(r[1])?r[1].lastIndexOf(`}`)+1:r[1].indexOf(this.formatSeparator);if(c!==-1&&(s=r[1].slice(c).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,c)),i=t(o.call(this,r[1].trim(),a),a),i&&r[0]===e&&!V(i))return i;V(i)||(i=ut(i)),i||=(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),``),s.length&&(i=s.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:r[1].trim()}),i.trim())),e=e.replace(r[0],i),this.regexp.lastIndex=0}return e}},qt=e=>{let t=e.toLowerCase().trim(),n={};if(e.includes(`(`)){let r=e.split(`(`);t=r[0].toLowerCase().trim();let i=r[1].slice(0,-1);t===`currency`&&!i.includes(`:`)?n.currency||=i.trim():t===`relativetime`&&!i.includes(`:`)?n.range||=i.trim():i.split(`;`).forEach(e=>{if(e){let[t,...r]=e.split(`:`),i=r.join(`:`).trim().replace(/^'+|'+$/g,``),a=t.trim();n[a]||(n[a]=i),i===`false`&&(n[a]=!1),i===`true`&&(n[a]=!0),isNaN(i)||(n[a]=parseInt(i,10))}})}return{formatName:t,formatOptions:n}},Jt=e=>{let t={};return(n,r,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let o=r+JSON.stringify(a),s=t[o];return s||(s=e(kt(r),i),t[o]=s),s(n)}},Yt=e=>(t,n,r)=>e(kt(n),r)(t),Xt=class{constructor(e={}){this.logger=jt.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?Jt:Yt;this.formats={number:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t,style:`currency`});return e=>n.format(e)}),datetime:n((e,t)=>{let n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{let n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||`day`)}),list:n((e,t)=>{let n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Jt(t)}format(e,t,n,r={}){if(!t||e==null)return e;let i=t.split(this.formatSeparator);if(i.length>1&&i[0].indexOf(`(`)>1&&!i[0].includes(`)`)&&i.find(e=>e.includes(`)`))){let e=i.findIndex(e=>e.includes(`)`));i[0]=[i[0],...i.splice(1,e)].join(this.formatSeparator)}return i.reduce((e,t)=>{let{formatName:i,formatOptions:a}=qt(t);if(this.formats[i]){let t=e;try{let o=r?.formatParams?.[r.interpolationkey]||{},s=o.locale||o.lng||r.locale||r.lng||n;t=this.formats[i](e,s,{...a,...r,...o})}catch(e){this.logger.warn(e)}return t}else this.logger.warn(`there was no format function for ${i}`);return e},e)}},Zt=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},Qt=class extends Mt{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=jt.create(`backendConnector`),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,r.backend,r)}queueLoad(e,t,n,r){let i={},a={},o={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{let o=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(this.state[o]===1?a[o]===void 0&&(a[o]=!0):(this.state[o]=1,r=!1,a[o]===void 0&&(a[o]=!0),i[o]===void 0&&(i[o]=!0),s[t]===void 0&&(s[t]=!0)))}),r||(o[e]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){let r=e.split(`|`),i=r[0],a=r[1];t&&this.emit(`failedLoading`,i,a,t),!t&&n&&this.store.addResourceBundle(i,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let o={};this.queue.forEach(n=>{_t(n.loaded,[i],a),Zt(n,e),t&&n.errors.push(t),n.pendingCount===0&&!n.done&&(Object.keys(n.loaded).forEach(e=>{o[e]||(o[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{o[e][t]===void 0&&(o[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit(`loaded`,o),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,i=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:i,callback:a});return}this.readingCalls++;let o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}if(o&&s&&r<this.maxRetries){setTimeout(()=>{this.read(e,t,n,r+1,i*2,a)},i);return}a(o,s)},s=this.backend[n].bind(this.backend);if(s.length===2){try{let n=s(e,t);n&&typeof n.then==`function`?n.then(e=>o(null,e)).catch(o):o(null,n)}catch(e){o(e)}return}return s(e,t,o)}prepareLoading(e,t,n={},r){if(!this.backend)return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`),r&&r();V(e)&&(e=this.languageUtils.toResolveHierarchy(e)),V(t)&&(t=[t]);let i=this.queueLoad(e,t,n,r);if(!i.toLoad.length)return i.pending.length||r(),null;i.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=``){let n=e.split(`|`),r=n[0],i=n[1];this.read(r,i,`read`,void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${i} for language ${r}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,r,i,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`);return}if(!(n==null||n===``)){if(this.backend?.create){let s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let i;i=c.length===5?c(e,t,n,r,s):c(e,t,n,r),i&&typeof i.then==`function`?i.then(e=>o(null,e)).catch(o):o(null,i)}catch(e){o(e)}else c(e,t,n,r,o,s)}!e||!e[0]||this.store.addResource(e[0],t,n,r)}}},$t=()=>({debug:!1,initAsync:!0,ns:[`translation`],defaultNS:[`translation`],fallbackLng:[`dev`],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:`all`,preload:!1,keySeparator:`.`,nsSeparator:`:`,pluralSeparator:`_`,contextSeparator:`_`,enableSelector:!1,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:`fallback`,saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]==`object`&&(t=e[1]),V(e[1])&&(t.defaultValue=e[1]),V(e[2])&&(t.tDescription=e[2]),typeof e[2]==`object`||typeof e[3]==`object`){let n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,prefix:`{{`,suffix:`}}`,formatSeparator:`,`,unescapePrefix:`-`,nestingPrefix:`$t(`,nestingSuffix:`)`,nestingOptionsSeparator:`,`,maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),en=e=>(V(e.ns)&&(e.ns=[e.ns]),V(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),V(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes(`cimode`)&&(e.supportedLngs=e.supportedLngs.concat([`cimode`])),e),tn=()=>{},nn=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},rn=class e extends Mt{constructor(e={},t){if(super(),this.options=en(e),this.services={},this.logger=jt,this.modules={external:[]},nn(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e==`function`&&(t=e,e={}),e.defaultNS==null&&e.ns&&(V(e.ns)?e.defaultNS=e.ns:e.ns.includes(`translation`)||(e.defaultNS=e.ns[0]));let n=$t();this.options={...n,...this.options,...en(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!=`function`&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler);let r=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){this.modules.logger?jt.init(r(this.modules.logger),this.options):jt.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:Xt;let t=new Bt(this.options);this.store=new Nt(this.options.resources,this.options);let n=this.services;n.logger=jt,n.resourceStore=this.store,n.languageUtils=t,n.pluralResolver=new Ut(t,{prepend:this.options.pluralSeparator}),e&&(n.formatter=r(e),n.formatter.init&&n.formatter.init(n,this.options),this.options.interpolation.format=n.formatter.format.bind(n.formatter)),n.interpolator=new Kt(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new Qt(r(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(n.languageDetector=r(this.modules.languageDetector),n.languageDetector.init&&n.languageDetector.init(n,this.options.detection,this.options)),this.modules.i18nFormat&&(n.i18nFormat=r(this.modules.i18nFormat),n.i18nFormat.init&&n.i18nFormat.init(this)),this.translator=new zt(this.services,this.options),this.translator.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||=tn,this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&e[0]!==`dev`&&(this.options.lng=e[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn(`init: no languageDetector is used and no lng is defined`),[`getResource`,`hasResourceBundle`,`getResourceBundle`,`getDataByLanguage`].forEach(e=>{this[e]=(...t)=>this.store[e](...t)}),[`addResource`,`addResources`,`addResourceBundle`,`removeResourceBundle`].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let i=lt(),a=()=>{let e=(e,n)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn(`init: i18next is already initialized. You should call init just once!`),this.isInitialized=!0,this.options.isClone||this.logger.log(`initialized`,this.options),this.emit(`initialized`,this.options),i.resolve(n),t(e,n)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?a():setTimeout(a,0),i}loadResources(e,t=tn){let n=t,r=V(e)?e:this.language;if(typeof e==`function`&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()===`cimode`&&(!this.options.preload||this.options.preload.length===0))return n();let e=[],t=t=>{t&&t!==`cimode`&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{t!==`cimode`&&(e.includes(t)||e.push(t))})};r?t(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{!e&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(e)})}else n(null)}reloadResources(e,t,n){let r=lt();return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=void 0),e||=this.languages,t||=this.options.ns,n||=tn,this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);if(!e.type)throw Error(`You are passing a wrong module! Please check the object you are passing to i18next.use()`);return e.type===`backend`&&(this.modules.backend=e),(e.type===`logger`||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type===`languageDetector`&&(this.modules.languageDetector=e),e.type===`i18nFormat`&&(this.modules.i18nFormat=e),e.type===`postProcessor`&&Pt.addPostProcessor(e),e.type===`formatter`&&(this.modules.formatter=e),e.type===`3rdParty`&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&![`cimode`,`dev`].includes(e)){for(let e=0;e<this.languages.length;e++){let t=this.languages[e];if(![`cimode`,`dev`].includes(t)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&!this.languages.includes(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;let n=lt();this.emit(`languageChanging`,e);let r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(i,a)=>{a?this.isLanguageChangingTo===e&&(r(a),this.translator.changeLanguage(a),this.isLanguageChangingTo=void 0,this.emit(`languageChanged`,a),this.logger.log(`languageChanged`,a)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(i,(...e)=>this.t(...e))},a=t=>{!e&&!t&&this.services.languageDetector&&(t=[]);let n=V(t)?t:t&&t[0],a=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes(V(t)?[t]:t);a&&(this.language||r(a),this.translator.language||this.translator.changeLanguage(a),this.services.languageDetector?.cacheUserLanguage?.(a)),this.loadResources(a,e=>{i(e,a)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),n}getFixedT(e,t,n,r){let i=r?.scopeNs,a=(e,t,...r)=>{let o;o=typeof t==`object`?{...t}:this.options.overloadTranslationOptionHandler([e,t].concat(r)),o.lng=o.lng||a.lng,o.lngs=o.lngs||a.lngs;let s=o.ns!==void 0&&o.ns!==null;o.ns=o.ns||a.ns,o.keyPrefix!==``&&(o.keyPrefix=o.keyPrefix||n||a.keyPrefix);let c={...this.options,...o};Array.isArray(i)&&!s&&(c.ns=i),typeof o.keyPrefix==`function`&&(o.keyPrefix=Lt(o.keyPrefix,c));let l=this.options.keySeparator||`.`,u;return o.keyPrefix&&Array.isArray(e)?u=e.map(e=>(typeof e==`function`&&(e=Lt(e,c)),`${o.keyPrefix}${l}${e}`)):(typeof e==`function`&&(e=Lt(e,c)),u=o.keyPrefix?`${o.keyPrefix}${l}${e}`:e),this.t(u,o)};return V(e)?a.lng=e:a.lngs=e,a.ns=t,a.keyPrefix=n,a}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn(`hasLoadedNamespace: i18next was not initialized`,this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn(`hasLoadedNamespace: i18n.languages were undefined or empty`,this.languages),!1;let n=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(n.toLowerCase()===`cimode`)return!0;let a=(e,t)=>{let n=this.services.backendConnector.state[`${e}|${t}`];return n===-1||n===0||n===2};if(t.precheck){let e=t.precheck(this,a);if(e!==void 0)return e}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(n,e)&&(!r||a(i,e)))}loadNamespaces(e,t){let n=lt();return this.options.ns?(V(e)&&(e=[e]),e.forEach(e=>{this.options.ns.includes(e)||this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){let n=lt();V(e)&&(e=[e]);let r=this.options.preload||[],i=e.filter(e=>!r.includes(e)&&this.services.languageUtils.isSupportedCode(e));return i.length?(this.options.preload=r.concat(i),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language),!e)return`rtl`;try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch{}let t=`ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb`.split(`.`),n=this.services?.languageUtils||new Bt($t());return e.toLowerCase().indexOf(`-latn`)>1?`ltr`:t.includes(n.getLanguagePartFromCode(e))||e.toLowerCase().indexOf(`-arab`)>1?`rtl`:`ltr`}static createInstance(t={},n){let r=new e(t,n);return r.createInstance=e.createInstance,r}cloneInstance(t={},n=tn){let r=t.forkResourceStore;r&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},a=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),[`store`,`services`,`language`].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},r&&(a.store=new Nt(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{}),i),a.services.resourceStore=a.store),t.interpolation){let e={...$t().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new Kt(n)}return a.translator=new zt(a.services,i),a.translator.on(`*`,(e,...t)=>{a.emit(e,...t)}),a.init(i,n),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}.createInstance();rn.createInstance,rn.dir,rn.init,rn.loadResources,rn.reloadResources,rn.use,rn.changeLanguage,rn.getFixedT,rn.t,rn.exists,rn.setDefaultNamespace,rn.hasLoadedNamespace,rn.loadNamespaces,rn.loadLanguages;var{slice:an,forEach:on}=[];function sn(e){return on.call(an.call(arguments,1),t=>{if(t)for(let n in t)e[n]===void 0&&(e[n]=t[n])}),e}function cn(e){return typeof e==`string`&&[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(t=>t.test(e))}var ln=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,un=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:`/`},r=`${e}=${encodeURIComponent(t)}`;if(n.maxAge>0){let e=n.maxAge-0;if(Number.isNaN(e))throw Error(`maxAge should be a Number`);r+=`; Max-Age=${Math.floor(e)}`}if(n.domain){if(!ln.test(n.domain))throw TypeError(`option domain is invalid`);r+=`; Domain=${n.domain}`}if(n.path){if(!ln.test(n.path))throw TypeError(`option path is invalid`);r+=`; Path=${n.path}`}if(n.expires){if(typeof n.expires.toUTCString!=`function`)throw TypeError(`option expires is invalid`);r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+=`; HttpOnly`),n.secure&&(r+=`; Secure`),n.sameSite)switch(typeof n.sameSite==`string`?n.sameSite.toLowerCase():n.sameSite){case!0:r+=`; SameSite=Strict`;break;case`lax`:r+=`; SameSite=Lax`;break;case`strict`:r+=`; SameSite=Strict`;break;case`none`:r+=`; SameSite=None`;break;default:throw TypeError(`option sameSite is invalid`)}return n.partitioned&&(r+=`; Partitioned`),r},dn={create(e,t,n,r){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:`/`,sameSite:`strict`};n&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+n*60*1e3)),r&&(i.domain=r),document.cookie=un(e,t,i)},read(e){let t=`${e}=`,n=document.cookie.split(`;`);for(let e=0;e<n.length;e++){let r=n[e];for(;r.charAt(0)===` `;)r=r.substring(1,r.length);if(r.indexOf(t)===0)return r.substring(t.length,r.length)}return null},remove(e,t){this.create(e,``,-1,t)}},fn={name:`cookie`,lookup(e){let{lookupCookie:t}=e;if(t&&typeof document<`u`)return dn.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:n,cookieMinutes:r,cookieDomain:i,cookieOptions:a}=t;n&&typeof document<`u`&&dn.create(n,e,r,i,a)}},pn={name:`querystring`,lookup(e){let{lookupQuerystring:t}=e,n;if(typeof window<`u`){let{search:e}=window.location;!window.location.search&&window.location.hash?.indexOf(`?`)>-1&&(e=window.location.hash.substring(window.location.hash.indexOf(`?`)));let r=e.substring(1).split(`&`);for(let e=0;e<r.length;e++){let i=r[e].indexOf(`=`);i>0&&r[e].substring(0,i)===t&&(n=r[e].substring(i+1))}}return n}},mn={name:`hash`,lookup(e){let{lookupHash:t,lookupFromHashIndex:n}=e,r;if(typeof window<`u`){let{hash:e}=window.location;if(e&&e.length>2){let i=e.substring(1);if(t){let e=i.split(`&`);for(let n=0;n<e.length;n++){let i=e[n].indexOf(`=`);i>0&&e[n].substring(0,i)===t&&(r=e[n].substring(i+1))}}if(r)return r;if(!r&&n>-1){let t=e.match(/\/([a-zA-Z-]*)/g);return Array.isArray(t)?t[typeof n==`number`?n:0]?.replace(`/`,``):void 0}}}return r}},hn=null,gn=()=>{if(hn!==null)return hn;try{if(hn=typeof window<`u`&&window.localStorage!==null,!hn)return!1;let e=`i18next.translate.boo`;window.localStorage.setItem(e,`foo`),window.localStorage.removeItem(e)}catch{hn=!1}return hn},_n={name:`localStorage`,lookup(e){let{lookupLocalStorage:t}=e;if(t&&gn())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:n}=t;n&&gn()&&window.localStorage.setItem(n,e)}},vn=null,yn=()=>{if(vn!==null)return vn;try{if(vn=typeof window<`u`&&window.sessionStorage!==null,!vn)return!1;let e=`i18next.translate.boo`;window.sessionStorage.setItem(e,`foo`),window.sessionStorage.removeItem(e)}catch{vn=!1}return vn},bn={name:`sessionStorage`,lookup(e){let{lookupSessionStorage:t}=e;if(t&&yn())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:n}=t;n&&yn()&&window.sessionStorage.setItem(n,e)}},xn={name:`navigator`,lookup(e){let t=[];if(typeof navigator<`u`){let{languages:e,userLanguage:n,language:r}=navigator;if(e)for(let n=0;n<e.length;n++)t.push(e[n]);n&&t.push(n),r&&t.push(r)}return t.length>0?t:void 0}},Sn={name:`htmlTag`,lookup(e){let{htmlTag:t}=e,n,r=t||(typeof document<`u`?document.documentElement:null);return r&&typeof r.getAttribute==`function`&&(n=r.getAttribute(`lang`)),n}},Cn={name:`path`,lookup(e){let{lookupFromPathIndex:t}=e;if(typeof window>`u`)return;let n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(Array.isArray(n))return n[typeof t==`number`?t:0]?.replace(`/`,``)}},wn={name:`subdomain`,lookup(e){let{lookupFromSubdomainIndex:t}=e,n=typeof t==`number`?t+1:1,r=typeof window<`u`&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[n]}},Tn=!1;try{document.cookie,Tn=!0}catch{}var En=[`querystring`,`cookie`,`localStorage`,`sessionStorage`,`navigator`,`htmlTag`];Tn||En.splice(1,1);var Dn=()=>({order:En,lookupQuerystring:`lng`,lookupCookie:`i18next`,lookupLocalStorage:`i18nextLng`,lookupSessionStorage:`i18nextLng`,caches:[`localStorage`],excludeCacheFor:[`cimode`],convertDetectedLanguage:e=>e}),On=class{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type=`languageDetector`,this.detectors={},this.init(e,t)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e,this.options=sn(t,this.options||{},Dn()),typeof this.options.convertDetectedLanguage==`string`&&this.options.convertDetectedLanguage.indexOf(`15897`)>-1&&(this.options.convertDetectedLanguage=e=>e.replace(`-`,`_`)),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(fn),this.addDetector(pn),this.addDetector(_n),this.addDetector(bn),this.addDetector(xn),this.addDetector(Sn),this.addDetector(Cn),this.addDetector(wn),this.addDetector(mn)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,t=[];return e.forEach(e=>{if(this.detectors[e]){let n=this.detectors[e].lookup(this.options);n&&typeof n==`string`&&(n=[n]),n&&(t=t.concat(n))}}),t=t.filter(e=>e!=null&&!cn(e)).map(e=>this.options.convertDetectedLanguage(e)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?t:t.length>0?t[0]:null}cacheUserLanguage(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||t.forEach(t=>{this.detectors[t]&&this.detectors[t].cacheUserLanguage(e,this.options)}))}};On.type=`languageDetector`;var kn={type:`3rdParty`,init(e){c(e.options.react),l(e)}},An=[{code:`en`,nativeName:`English`,englishName:`English`,dir:`ltr`},{code:`zh-CN`,nativeName:`简体中文`,englishName:`Simplified Chinese`,dir:`ltr`}],jn=An.map(e=>e.code);function Mn(e){let t=e?.trim().split(`.`)[0]?.replace(/_/g,`-`).toLowerCase();return t?t===`en`||t.startsWith(`en-`)?`en`:t===`zh`||t===`zh-cn`||t.startsWith(`zh-cn-`)||t===`zh-hans`||t.startsWith(`zh-hans-`)?`zh-CN`:null:null}function Nn(e){let t=Mn(e);return An.find(e=>e.code===t)??An[0]}var Pn=Object.assign({"../locales/en/chat.json":{tabs:{chat:`Nexus AI`,processes:`Processes`},suggestions:{architecture:`Explain the project architecture`,whatDoes:`What does this project do?`,importantFiles:`Show me the most important files`,apiHandlers:`Find all API handlers`},empty:{title:`Ask me anything`,description:`I can help you understand the architecture, find functions, or explain connections.`},input:{placeholder:`Ask about the codebase...`,initializing:`Initializing AI agent...`,configureProvider:`Configure an LLM provider to enable chat.`},actions:{closePanel:`Close Panel`,scrollBottom:`Scroll to bottom`,clearChat:`Clear chat`,stopResponse:`Stop response`},stopped:`Stopped by user`,badges:{configureAI:`Configure AI`,connecting:`Connecting`},chatOnly:{banner:`Graph not loaded (large project). Chat works normally; inline node citations won't highlight in the graph view.`},roles:{you:`You`,assistant:`Nexus AI`},newBadge:`NEW`},"../locales/en/common.json":{app:{name:`GitNexus`,nexusAI:`Nexus AI`},actions:{cancel:`Cancel`,dismiss:`Dismiss`,tryAgain:`Try again`,hide:`Hide`,retry:`Retry`,copy:`Copy`,copied:`Copied`,close:`Close`,run:`Run`,clear:`Clear`,remove:`Remove`,focusInGraph:`Focus in graph`,expand:`Expand`,collapse:`Collapse`},chat:{viewNodeInCodePanel:`View {{inner}} in Code panel`,openInCodePanel:`Open in Code panel • {{inner}}`,waitForVectorIndex:`Wait a moment, vector index is being created.`},counts:{files_one:`{{count}} file`,files_other:`{{count}} files`,nodes_one:`{{count}} node`,nodes_other:`{{count}} nodes`,edges_one:`{{count}} edge`,edges_other:`{{count}} edges`,symbols_one:`{{count}} symbol`,symbols_other:`{{count}} symbols`,flows_one:`{{count}} flow`,flows_other:`{{count}} flows`},progress:{connecting:`Connecting to server...`,connectingShort:`Connecting...`,validatingServer:`Validating server`,validatingServerEllipsis:`Validating server...`,downloadingGraph:`Downloading graph...`,downloadedMb:`{{mb}} MB downloaded`,downloadingWithPercent:`Downloading graph... {{percent}}%`,downloadingMb:`Downloading... {{mb}} MB`,processing:`Processing...`,processingGraph:`Processing graph...`,extractingFileContents:`Extracting file contents`,loadingGraph:`Loading graph...`,starting:`Starting...`,executing:`Executing...`,truncated:`... (truncated)`,ready:`Ready`,switchingRepository:`Switching repository...`,loadingRepository:`Loading {{repo}}`,validating:`Validating`,failedSwitchRepository:`Failed to switch repository`,unknownError:`Unknown error`},analyzePhases:{queued:`Queued`,cloning:`Cloning repository`,pulling:`Pulling latest`,extracting:`Scanning files`,structure:`Building structure`,parsing:`Parsing code`,imports:`Resolving imports`,calls:`Tracing calls`,heritage:`Extracting inheritance`,scopeResolution:`Resolving types`,communities:`Detecting communities`,processes:`Detecting processes`,complete:`Pipeline complete`,lbug:`Loading into database`,fts:`Creating search indexes`,embeddings:`Generating embeddings`,done:`Done`,retrying:`Retrying after crash`},units:{elapsedSeconds:`{{seconds}}s`,elapsedMinutesSeconds:`{{minutes}}m {{seconds}}s`}},"../locales/en/errors.json":{unknown:`Unknown error`,connectFailed:`Failed to connect to server`,loadGraphFailed:`Failed to load graph`,failedToConnect:`Failed to connect`,analysisFailed:`Analysis failed. Check server logs.`,startAnalysisFailed:`Failed to start analysis`,invalidGithubUrl:`Please enter a valid GitHub repository URL.`,invalidAzureDevOpsUrl:`Please enter a valid Azure DevOps repository URL.`,missingFolderPath:`Please enter a folder path.`,backend:{reconnecting:`Server connection lost. Reconnecting…`,network:"Unable to reach the GitNexus server. Make sure `gitnexus serve` is running.",timeout:`The server took too long to respond. Try again in a moment.`,rateLimited:`Too many requests. Try again in {{seconds}}s.`,notFound:`The requested repository or resource was not found.`,originBlocked:`This action isn't available from the hosted UI. Open GitNexus from the server's own address (e.g. http://localhost:4747) to continue.`,client:`Request failed: {{message}}`,server:`Server error: {{message}}`}},"../locales/en/graph.json":{statusBar:{sponsor:`Sponsor`,sponsorHint:`need to buy some API credits to run SWE-bench 😅`},loading:{filesProgress:`{{processed}} / {{total}} files`},toolCall:{status:{running:`running`,completed:`completed`,error:`error`,stopped:`stopped`},tools:{search:`🔍 Search Code`,cypher:`🔗 Cypher Query`,grep:`🔎 Pattern Search`,read:`📄 Read File`,overview:`🗺️ Codebase Overview`,explore:`🔬 Deep Dive`,impact:`💥 Impact Analysis`},query:`Query`,input:`Input`,result:`Result`,searchPrefix:`Search: "{{query}}"`},embedding:{generateTitle:`Generate embeddings for semantic search`,enable:`Enable Semantic Search`,loadingModel:`Loading AI model...`,embeddingNodes:`Embedding {{processed}}/{{total}} nodes`,creatingIndex:`Creating vector index...`,readyTitle:`Semantic search is ready! Use natural language in the AI chat.`,ready:`Semantic Ready`,errorTitle:`Embedding failed. Click to retry.`,failedRetry:`Failed - Retry`,fallback:{title:`WebGPU said "nope"`,subtitle:`Your browser doesn't support GPU acceleration`,description:`Couldn't create embeddings with WebGPU, so semantic search (Graph RAG) won't be as smart. The graph still works fine though!`,options:`Your options:`,useCpu:`Use CPU`,useCpuDescriptionSmall:`Works but a bit slower`,useCpuDescriptionLarge:`Works but way slower`,estimated:`(~{{minutes}} min for {{count}} nodes)`,skipIt:`Skip it`,skipDescription:`Graph works, just no AI semantic search`,smallCodebase:`Small codebase detected! CPU should be fine.`,tip:`💡 Tip: Try Chrome or Edge for WebGPU support`,skipEmbeddings:`Skip Embeddings`,useCpuRecommended:`Use CPU (Recommended)`,useCpuSlow:`Use CPU (Slow)`}},queryFab:{query:`Query`,cypherQuery:`Cypher Query`,examples:`Examples`,run:`Run`,noProject:`No project loaded. Load a project first.`,dbNotReady:`Database not ready. Please wait for loading to complete.`,executionFailed:`Query execution failed`,exampleLabels:{functions:`All Functions`,classes:`All Classes`,interfaces:`All Interfaces`,calls:`Function Calls`,imports:`Import Dependencies`},clear:`Clear`,rows:`rows`,highlighted:`highlighted`,showingRows:`Showing 50 of {{count}} rows`},fileTree:{expandPanel:`Expand Panel`,fileExplorer:`File Explorer`,filters:`Filters`,collapsePanel:`Collapse Panel`,searchFiles:`Search files...`,noFilesLoaded:`No files loaded`,all:`All`,selectNodeDepth:`Select a node to apply depth filter`,explorer:`Explorer`,nodeTypes:`Node Types`,nodeTypesDesc:`Toggle visibility of node types in the graph`,edgeTypes:`Edge Types`,edgeTypesDesc:`Toggle visibility of relationship types`,focusDepth:`Focus Depth`,focusDepthDesc:`Show nodes within N hops of selection`,hops_one:`{{count}} hop`,hops_other:`{{count}} hops`,colorLegend:`Color Legend`},codePanel:{expand:`Expand Code Panel`,dragResize:`Drag to resize`,title:`Code Inspector`,clearCitations:`Clear AI citations`,clearSelection:`Clear selection`,loadingSource:`Loading source...`,selectFile:`Select a file node to preview its contents.`,code:`Code`,selected:`Selected`,aiCitations:`AI Citations`,references_one:`{{count}} reference`,references_other:`{{count}} references`,lines_one:`{{count}} line`,lines_other:`{{count}} lines`,codeNotAvailable:`Code not available in memory for {{path}}`},canvas:{viewModes:{label:`Graph view mode`,force:`Force Graph`,tree:`Sequential Layout`,circles:`Radial Layout`},zoomIn:`Zoom In`,zoomOut:`Zoom Out`,fit:`Fit to Screen`,focusSelected:`Focus on Selected Node`,clearSelection:`Clear Selection`,clear:`Clear`,stopLayout:`Stop Layout`,runLayout:`Run Layout Again`,layoutOptimizing:`Layout optimizing...`,turnOffHighlights:`Turn off all highlights`,turnOnHighlights:`Turn on AI highlights`,chatOnly:{title:`Graph not loaded`,description:`This is a large project, so the graph was skipped to keep the browser responsive. AI chat works normally.`,descriptionWithCount:`This project has {{count}} nodes, so the graph was skipped to keep the browser responsive. AI chat works normally.`,citationNote:`While the graph is unloaded, inline file citations from chat won't auto-open in the Code panel.`,loadAnyway:`Load graph anyway`,loadAnywayWarning:`This project has {{count}} nodes. Loading the full graph may make the browser slow or unresponsive. Continue?`,loadAnywayWarningUnknown:`This may be a large project. Loading the full graph may make the browser slow or unresponsive. Continue?`}},processes:{unknownStep:`Unknown`,allProcessesLabel_one:`All Processes ({{count}} combined)`,allProcessesLabel_other:`All Processes ({{count}} combined)`,emptyTitle:`No Processes Detected`,emptyDescription:`Processes are execution flows traced from entry points. Load a codebase to see detected processes.`,filterPlaceholder:`Filter processes...`,detected_one:`{{count}} process detected`,detected_other:`{{count}} processes detected`,fullMap:`Full Process Map`,viewCombined_one:`View combined map of {{count}} process`,viewCombined_other:`View combined map of {{count}} processes`,crossCommunity:`Cross-Community`,intraCommunity:`Intra-Community`,steps_one:`{{count}} step`,steps_other:`{{count}} steps`,clusters_one:`{{count}} cluster`,clusters_other:`{{count}} clusters`,highlightTitle:`Click to highlight in graph`,removeHighlightTitle:`Click to remove highlight from graph`,loading:`Loading...`,viewing:`Viewing`,view:`View`},processFlow:{title:`Process: {{label}}`,diagramTooLarge:`📊 Diagram Too Large`,renderError:`⚠️ Render Error`,tooComplex_one:`This diagram has {{count}} step and is too complex to render. Try viewing individual processes instead of "All Processes".`,tooComplex_other:`This diagram has {{count}} steps and is too complex to render. Try viewing individual processes instead of "All Processes".`,unableToRender_one:`Unable to render diagram. Steps: {{count}}`,unableToRender_other:`Unable to render diagram. Steps: {{count}}`,zoomOutTitle:`Zoom out (-)`,zoomInTitle:`Zoom in (+)`,resetTitle:`Reset zoom and pan`,resetView:`Reset View`,toggleFocus:`Toggle Focus`,copyMermaid:`Copy Mermaid`},diagram:{aiGenerated:`AI Generated Diagram`,error:`Diagram Error`,showSource:`Show source`,label:`Diagram`,expandTitle:`Expand`,loading:`Loading diagram…`}},"../locales/en/header.json":{repositories:`Repositories`,active:`active`,reanalyzing:`Re-analyzing...`,reanalyzeRepo:`Re-analyze {{repoName}}`,deleteRepo:`Delete {{repoName}}`,reanalyzingRepo:`Re-analyzing {{repoName}}: {{message}}`,analyzeNew:`Analyze a new repository...`,searchRepositories:`Search repositories...`,noRepositoriesFound:`No repositories found for "{{query}}"`,searchNodes:`Search nodes...`,noNodesFound:`No nodes found for "{{query}}"`,starIfCool:`Star if cool`,aiSettings:`AI Settings`,help:`Help`,language:`Language`,selectLanguage:`Select language`},"../locales/en/help.json":{tabs:{overview:`Overview`,ai:`Nexus AI`,shortcuts:`Shortcuts`,status:`Status bar`,graph:`Graph & nodes`,search:`Search & filter`},shortcuts:{searchNodes:`Search nodes`,deselectClose:`Deselect / close`,columns:{action:`Action`,mac:`Mac`,windows:`Windows`}},nodeTypes:{function:`Function`,functionDesc:`Function declarations`,file:`File`,fileDesc:`Source files`,class:`Class`,classDesc:`Class declarations`,method:`Method`,methodDesc:`Class methods`,interface:`Interface`,interfaceDesc:`TypeScript interfaces`,folder:`Folder`,folderDesc:`Directory nodes`},status:{ready:`Ready`,readyDesc:`Graph is fully loaded and interactive`,nodesCount:`Nodes count`,nodesCountDesc:`Total files and symbols in the graph`,edgesCount:`Edges count`,edgesCountDesc:`Import / dependency connections`,aiIndexStatus:`AI index status`,aiIndexStatusDesc:`Repo is fully indexed for AI queries`,semanticReadyBadge:`Semantic Ready`,explained:`Status bar explained`},tryAsking:`Try asking:`,footer:`GitNexus — graph explorer`,title:`Help & Reference`,footerLong:`GitNexus — open source codebase graph explorer`,docsGithub:`Docs & GitHub ↗`,overview:{gettingStarted:`Getting started`,whatIsTitle:`What is GitNexus?`,whatIsDescription:`An interactive graph explorer for your codebase. Every file, function, and import becomes a node you can explore, query, and navigate visually.`,currentRepoTitle:`Your current repo`,loadedCounts:`Loaded: {{nodeCount}} nodes · {{edgeCount}} edges`,threeWaysTitle:`Three ways to explore`,wayInspect:`Click nodes to inspect`,waySearch:`Search by name or type`,wayAsk:`Ask Nexus AI a natural language question`,navigationTitle:`Navigation`,navZoom:`Scroll to zoom`,navPan:`Click and drag to pan`,navFocus:`Double-click a node to focus its subgraph`},graph:{nodeColorLegend:`Node color legend`,nodeLabel:`{{label}} nodes`,sizeDescription:`Node size reflects connection count — larger nodes are depended on by more files. Edges point from importer → imported.`,detailDescription:`Click any node to open its detail panel — showing imports, exports, and reverse dependencies.`},search:{title:`Search & filter`,searchNodes:`Search nodes`,searchDescription:`Search by filename, function name, or import path. Matching nodes are highlighted live in the graph.`,filterPanel:`Filter panel`,filterDescription:`Use the filter icon in the left sidebar to isolate specific node types, hide leaf nodes, or focus on a depth range from a selected root.`,syntax:`Search syntax`,hints:{nameFragment:`match by name fragment`,pathPrefix:`match by path prefix`,nodeType:`filter by node type`}},ai:{title:`Nexus AI`,semanticReady:`✓ Semantic Ready`,description:`Your repo is indexed and ready for semantic queries. Nexus AI understands code structure and relationships, not just file names.`,questions:{dependencies:`"Which files depend on the auth module?"`,circular:`"Find circular dependencies in this repo"`,connected:`"What are the most connected components?"`,imports:`"Show me all files that import useEffect"`},openPrompt:`Open the prompt via the Nexus AI button (top-right).`}},"../locales/en/onboarding.json":{success:{title:`Server Connected`,description:`Preparing your code knowledge graph...`},loading:{largeRepoHint:`This may take a moment for large repositories`},guide:{copyAria:`Copy to clipboard`,copiedAria:`Copied!`,startServer:`Start your local server`,devDescription:`Fire up the Express backend in a separate terminal to unlock the full graph.`,prodDescription:`One command is all it takes. The browser connects automatically.`,copyCommand:`Copy the command`,copyCommandDescription:`Click the icon in the terminal to copy.`,done:`done`,orInstallGlobally:`or install globally`,globalInstall:`Global install`,startBackend:`Start backend`,terminal:`Terminal`,waitingForServer:`Waiting for server to start`,pasteAndRun:`Paste and run in your terminal`,pasteAndRunDescription:`Open a terminal at the project root, paste, and hit Enter.`,listeningForServer:`Listening for server`,willAutoConnect:`Will auto-connect when detected`,autoConnects:`Auto-connects and opens the graph`,autoConnectsDescription:`No refresh needed — the page detects the server automatically.`,requires:`Requires`,port:`Port 4747`},analyzeFirst:{title:`Analyze your first repository`,description:`Paste a repository URL and GitNexus will clone it, parse the code, and build a live knowledge graph — right in your browser.`,footer:`Public repos only · Cloned locally by the server · No data leaves your machine`},landing:{chooseRepository:`Choose a repository`,description:`Select an indexed repository to explore, or analyze a new one.`,indexed:`Indexed {{time}}`,orAnalyzeNew:`or analyze new`,footer:`Public & private repos · Cloned locally by the server · No data leaves your machine`,time:{justNow:`just now`,minutesAgo:`{{count}}m ago`,hoursAgo:`{{count}}h ago`,daysAgo:`{{count}}d ago`}},repoAnalyzer:{inputType:`Input type`,githubUrl:`GitHub URL`,gitlabUrl:`GitLab URL`,azureDevOpsUrl:`Azure DevOps`,localFolder:`Local Folder`,starting:`Starting analysis...`,analyzeRepository:`Analyze Repository`,complete:`Analysis complete`,loadingGraph:`Loading graph...`,defaultRepoName:`repository`,githubRepositoryUrl:`GitHub Repository URL`,githubTokenLabel:`Personal Access Token (optional)`,githubTokenPlaceholder:`ghp_… or github_pat_…`,githubTokenHelp:`Required for private repos. Needs the 'repo' (or fine-grained Contents:read) scope. Sent once, not stored.`,gitlabRepositoryUrl:`GitLab Repository URL`,gitlabSupported:`Supports GitLab.com and self-hosted GitLab instances.`,azureDevOpsRepositoryUrl:`Azure DevOps Repository URL`,azureDevOpsSupported:`Format: https://dev.azure.com/organization/project/_git/repository`,localFolderPath:`Local Folder Path`,hideBackground:`Hide (analysis continues in background)`,upload:{button:`Upload a folder`,uploading:`Uploading…`,selected:`{{fileCount}} files ready ({{dropped}} skipped: .git, node_modules, build output)`,empty:`No analyzable files found in that folder.`}}},"../locales/en/settings.json":{title:`AI Settings`,subtitle:`Configure your LLM provider`,localServer:`Local Server`,backendUrl:`Backend URL`,connected:`Connected`,notConnected:`Not connected`,runServeHint:"Run `gitnexus serve` to connect the web UI to a local backend.",provider:`Provider`,apiKey:`API Key`,learnMore:`Learn more`,model:`Model`,searchModelPlaceholder:`Search or type model ID...`,selectModelPlaceholder:`Select or type a model...`,customModelHint:`Type a model ID or press Enter`,customModelExample:`e.g. openai/gpt-4o`,pressEnterCustom:`Press Enter to use as custom ID`,baseUrl:`Base URL`,optional:`optional`,deploymentName:`Deployment Name`,apiVersion:`API Version`,checkConnection:`Check connection`,privacyLabel:`Privacy:`,privacyText:`Your API keys are stored locally in this browser.`,providers:{openai:{description:`Use OpenAI models for chat and code reasoning.`,apiKeyPlaceholder:`Enter your OpenAI API key`,helperText:`Get your API key from`,helperLinkLabel:`OpenAI Platform`,modelPlaceholder:`e.g., gpt-4o, gpt-4-turbo, gpt-3.5-turbo`,baseUrlPlaceholder:`https://api.openai.com/v1 (default)`,baseUrlHint:`Leave empty to use the default OpenAI API. Set a custom URL for proxies or compatible APIs.`},gemini:{description:`Use Google Gemini models.`,apiKeyPlaceholder:`Enter your Google AI API key`,helperText:`Get your API key from`,helperLinkLabel:`Google AI Studio`,modelPlaceholder:`e.g., gemini-2.0-flash, gemini-1.5-pro`},anthropic:{description:`Use Anthropic Claude models.`,apiKeyPlaceholder:`Enter your Anthropic API key`,helperText:`Get your API key from`,helperLinkLabel:`Anthropic Console`,modelPlaceholder:`e.g., claude-sonnet-4-20250514, claude-3-opus`},azure:{apiKeyPlaceholder:`Enter your Azure OpenAI API key`,deploymentNamePlaceholder:`e.g., gpt-4o-deployment`},ollama:{quickStart:`📋 Quick Start:`,installFrom:`Install Ollama from`,thenRun:`, then run:`,modelPlaceholder:`e.g., llama3.2, mistral, codellama`},openrouter:{apiKeyPlaceholder:`Enter your OpenRouter API key`,helperText:`Get your API key from`,helperLinkLabel:`OpenRouter Keys`},minimax:{apiKeyPlaceholder:`Enter your MiniMax API key`,helperText:`Get your API key from`,helperLinkLabel:`MiniMax Platform`,modelPlaceholder:`e.g., MiniMax-M2.5, MiniMax-M2.5-highspeed`,helperModel:`Available: MiniMax-M2.5 (default), MiniMax-M2.5-highspeed (faster)`},glm:{apiKeyPlaceholder:`Enter your Z.AI API key`}},loadingModels:`Loading models...`,noModelsMatch:`No models match "{{searchTerm}}"`,moreModels:`+{{count}} more • Refine your search`,apiKeySession:`API keys are stored in session storage and will be cleared when you close this tab.`,startLocalServer:`start the local server`,settingsSaved:`Settings saved`,failedToSave:`Failed to save`,saveSettings:`Save Settings`,endpoint:`Endpoint`,azurePortal:`Azure Portal`,azureHint:`Configure your Azure OpenAI service in the`,defaultPort:`Default port is`,pullModel:`Pull a model with`,browseModels:`Browse all models at`,openRouterModels:`OpenRouter Models`,zaiPlatform:`Z.AI Platform`,glmCodingApi:`Coding API (default). Use https://api.z.ai/api/paas/v4 for the general API.`,privacyFull:`Your API keys are stored only in your browser's session storage and are cleared when the tab closes. They're sent directly to the LLM provider when you chat. Your code never leaves your machine.`},"../locales/zh-CN/chat.json":{tabs:{chat:`Nexus AI`,processes:`流程`},suggestions:{architecture:`解释项目架构`,whatDoes:`这个项目是做什么的?`,importantFiles:`显示最重要的文件`,apiHandlers:`查找所有 API 处理器`},empty:{title:`可以问我任何问题`,description:`我可以帮你理解架构、查找函数或解释连接关系。`},input:{placeholder:`询问这个代码库...`,initializing:`正在初始化 AI Agent...`,configureProvider:`配置 LLM 提供商以启用聊天。`},actions:{closePanel:`关闭面板`,scrollBottom:`滚动到底部`,clearChat:`清空聊天`,stopResponse:`停止响应`},stopped:`用户已停止`,badges:{configureAI:`配置 AI`,connecting:`连接中`},chatOnly:{banner:`图谱未加载(大型项目)。对话功能正常;内联节点引用不会在图谱视图中高亮。`},roles:{you:`你`,assistant:`Nexus AI`},newBadge:`新`},"../locales/zh-CN/common.json":{app:{name:`GitNexus`,nexusAI:`Nexus AI`},actions:{cancel:`取消`,dismiss:`关闭`,tryAgain:`重试`,hide:`隐藏`,retry:`重试`,copy:`复制`,copied:`已复制`,close:`关闭`,run:`运行`,clear:`清空`,remove:`移除`,focusInGraph:`在图中聚焦`,expand:`展开`,collapse:`折叠`},chat:{viewNodeInCodePanel:`在代码面板中查看 {{inner}}`,openInCodePanel:`在代码面板中打开 • {{inner}}`,waitForVectorIndex:`请稍候,正在创建向量索引。`},counts:{files_one:`{{count}} 个文件`,files_other:`{{count}} 个文件`,nodes_one:`{{count}} 个节点`,nodes_other:`{{count}} 个节点`,edges_one:`{{count}} 条边`,edges_other:`{{count}} 条边`,symbols_one:`{{count}} 个符号`,symbols_other:`{{count}} 个符号`,flows_one:`{{count}} 条流程`,flows_other:`{{count}} 条流程`},progress:{connecting:`正在连接服务器...`,connectingShort:`正在连接...`,validatingServer:`正在验证服务器`,validatingServerEllipsis:`正在验证服务器...`,downloadingGraph:`正在下载图数据...`,downloadedMb:`已下载 {{mb}} MB`,downloadingWithPercent:`正在下载图数据... {{percent}}%`,downloadingMb:`正在下载... {{mb}} MB`,processing:`正在处理...`,processingGraph:`正在处理图数据...`,extractingFileContents:`正在提取文件内容`,loadingGraph:`正在加载图数据...`,starting:`正在启动...`,executing:`正在执行...`,truncated:`...(已截断)`,ready:`就绪`,switchingRepository:`正在切换仓库...`,loadingRepository:`正在加载 {{repo}}`,validating:`正在验证`,failedSwitchRepository:`切换仓库失败`,unknownError:`未知错误`},analyzePhases:{queued:`已排队`,cloning:`正在克隆仓库`,pulling:`正在拉取最新代码`,extracting:`正在扫描文件`,structure:`正在构建结构`,parsing:`正在解析代码`,imports:`正在解析导入`,calls:`正在追踪调用`,heritage:`正在提取继承关系`,scopeResolution:`正在解析类型`,communities:`正在检测社区`,processes:`正在检测流程`,complete:`流水线完成`,lbug:`正在加载数据库`,fts:`正在创建搜索索引`,embeddings:`正在生成嵌入向量`,done:`完成`,retrying:`崩溃后正在重试`},units:{elapsedSeconds:`{{seconds}} 秒`,elapsedMinutesSeconds:`{{minutes}} 分 {{seconds}} 秒`}},"../locales/zh-CN/errors.json":{unknown:`未知错误`,connectFailed:`连接服务器失败`,loadGraphFailed:`加载图数据失败`,failedToConnect:`连接失败`,analysisFailed:`分析失败,请检查服务器日志。`,startAnalysisFailed:`启动分析失败`,invalidGithubUrl:`请输入有效的 GitHub 仓库 URL。`,invalidAzureDevOpsUrl:`请输入有效的 Azure DevOps 仓库 URL。`,missingFolderPath:`请输入文件夹路径。`,backend:{reconnecting:`服务器连接已断开,正在重连…`,network:"无法连接 GitNexus 服务器,请确认 `gitnexus serve` 正在运行。",timeout:`服务器响应超时,请稍后重试。`,rateLimited:`请求过于频繁,请在 {{seconds}} 秒后重试。`,notFound:`未找到请求的仓库或资源。`,originBlocked:`此操作无法从托管界面执行。请通过服务器自身地址(例如 http://localhost:4747)打开 GitNexus 后再继续。`,client:`请求失败:{{message}}`,server:`服务器错误:{{message}}`}},"../locales/zh-CN/graph.json":{statusBar:{sponsor:`赞助`,sponsorHint:`需要买点 API 额度跑 SWE-bench 😅`},loading:{filesProgress:`{{processed}} / {{total}} 个文件`},toolCall:{status:{running:`运行中`,completed:`已完成`,error:`错误`,stopped:`已停止`},tools:{search:`🔍 搜索代码`,cypher:`🔗 Cypher 查询`,grep:`🔎 模式搜索`,read:`📄 读取文件`,overview:`🗺️ 代码库概览`,explore:`🔬 深入分析`,impact:`💥 影响分析`},query:`查询`,input:`输入`,result:`结果`,searchPrefix:`搜索:"{{query}}"`},embedding:{generateTitle:`为语义搜索生成嵌入向量`,enable:`启用语义搜索`,loadingModel:`正在加载 AI 模型...`,embeddingNodes:`正在嵌入 {{processed}}/{{total}} 个节点`,creatingIndex:`正在创建向量索引...`,readyTitle:`语义搜索已就绪!可在 AI 聊天中使用自然语言。`,ready:`语义就绪`,errorTitle:`嵌入失败,点击重试。`,failedRetry:`失败 - 重试`,fallback:{title:`WebGPU 拒绝了请求`,subtitle:`你的浏览器不支持 GPU 加速`,description:`无法用 WebGPU 创建嵌入向量,因此语义搜索(Graph RAG)不会那么智能,但图谱仍可正常使用。`,options:`可选方案:`,useCpu:`使用 CPU`,useCpuDescriptionSmall:`可用,但会稍慢`,useCpuDescriptionLarge:`可用,但会慢很多`,estimated:`(约 {{minutes}} 分钟,{{count}} 个节点)`,skipIt:`跳过`,skipDescription:`图谱可用,但没有 AI 语义搜索`,smallCodebase:`检测到小型代码库!CPU 应该没问题。`,tip:`💡 提示:可尝试 Chrome 或 Edge 以获得 WebGPU 支持`,skipEmbeddings:`跳过嵌入`,useCpuRecommended:`使用 CPU(推荐)`,useCpuSlow:`使用 CPU(较慢)`}},queryFab:{query:`查询`,cypherQuery:`Cypher 查询`,examples:`示例`,run:`运行`,noProject:`未加载项目,请先加载项目。`,dbNotReady:`数据库尚未就绪,请等待加载完成。`,executionFailed:`查询执行失败`,exampleLabels:{functions:`所有函数`,classes:`所有类`,interfaces:`所有接口`,calls:`函数调用`,imports:`导入依赖`},clear:`清除`,rows:`行`,highlighted:`已高亮`,showingRows:`显示 {{count}} 行中的前 50 行`},fileTree:{expandPanel:`展开面板`,fileExplorer:`文件浏览器`,filters:`过滤器`,collapsePanel:`折叠面板`,searchFiles:`搜索文件...`,noFilesLoaded:`未加载文件`,all:`全部`,selectNodeDepth:`选择节点后才能应用深度过滤`,explorer:`浏览器`,nodeTypes:`节点类型`,nodeTypesDesc:`切换图中节点类型的可见性`,edgeTypes:`边类型`,edgeTypesDesc:`切换关系类型的可见性`,focusDepth:`聚焦深度`,focusDepthDesc:`显示所选节点 N 跳内的节点`,hops_one:`{{count}} 跳`,hops_other:`{{count}} 跳`,colorLegend:`颜色图例`},codePanel:{expand:`展开代码面板`,dragResize:`拖动调整大小`,title:`代码检查器`,clearCitations:`清除 AI 引用`,clearSelection:`清除选择`,loadingSource:`正在加载源码...`,selectFile:`选择文件节点以预览其内容。`,code:`代码`,selected:`已选择`,aiCitations:`AI 引用`,references_one:`{{count}} 条引用`,references_other:`{{count}} 条引用`,lines_one:`{{count}} 行`,lines_other:`{{count}} 行`,codeNotAvailable:`内存中没有 {{path}} 的代码内容`},canvas:{viewModes:{label:`图形视图模式`,force:`力导向图`,tree:`顺序布局`,circles:`径向布局`},zoomIn:`放大`,zoomOut:`缩小`,fit:`适应屏幕`,focusSelected:`聚焦所选节点`,clearSelection:`清除选择`,clear:`清除`,stopLayout:`停止布局`,runLayout:`重新运行布局`,layoutOptimizing:`正在优化布局...`,turnOffHighlights:`关闭全部高亮`,turnOnHighlights:`开启 AI 高亮`,chatOnly:{title:`图谱未加载`,description:`这是一个大型项目,已跳过图谱加载以保持浏览器响应。AI 对话功能正常可用。`,descriptionWithCount:`该项目包含 {{count}} 个节点,已跳过图谱加载以保持浏览器响应。AI 对话功能正常可用。`,citationNote:`图谱未加载时,对话中的内联文件引用不会自动在代码面板中打开。`,loadAnyway:`仍然加载图谱`,loadAnywayWarning:`该项目包含 {{count}} 个节点。加载完整图谱可能导致浏览器变慢或无响应。是否继续?`,loadAnywayWarningUnknown:`这可能是一个大型项目。加载完整图谱可能导致浏览器变慢或无响应。是否继续?`}},processes:{unknownStep:`未知`,allProcessesLabel_one:`全部流程(合并 {{count}} 个)`,allProcessesLabel_other:`全部流程(合并 {{count}} 个)`,emptyTitle:`未检测到流程`,emptyDescription:`流程是从入口点追踪出的执行链路。加载代码库后即可查看检测到的流程。`,filterPlaceholder:`过滤流程...`,detected_one:`检测到 {{count}} 个流程`,detected_other:`检测到 {{count}} 个流程`,fullMap:`完整流程图`,viewCombined_one:`查看 {{count}} 个流程的合并图`,viewCombined_other:`查看 {{count}} 个流程的合并图`,crossCommunity:`跨社区`,intraCommunity:`社区内`,steps_one:`{{count}} 步`,steps_other:`{{count}} 步`,clusters_one:`{{count}} 个聚类`,clusters_other:`{{count}} 个聚类`,highlightTitle:`在图谱中高亮`,removeHighlightTitle:`移除图谱高亮`,loading:`加载中...`,viewing:`查看中`,view:`查看`},processFlow:{title:`流程:{{label}}`,diagramTooLarge:`📊 图表过大`,renderError:`⚠️ 渲染错误`,tooComplex_one:`该图表包含 {{count}} 个步骤,复杂度过高无法渲染。请查看单个流程,而不是“全部流程”。`,tooComplex_other:`该图表包含 {{count}} 个步骤,复杂度过高无法渲染。请查看单个流程,而不是“全部流程”。`,unableToRender_one:`无法渲染图表。步骤数:{{count}}`,unableToRender_other:`无法渲染图表。步骤数:{{count}}`,zoomOutTitle:`缩小 (-)`,zoomInTitle:`放大 (+)`,resetTitle:`重置缩放和平移`,resetView:`重置视图`,toggleFocus:`切换聚焦`,copyMermaid:`复制 Mermaid`},diagram:{aiGenerated:`AI 生成图表`,error:`图表错误`,showSource:`显示源码`,label:`图表`,expandTitle:`展开`,loading:`正在加载图表…`}},"../locales/zh-CN/header.json":{repositories:`仓库`,active:`当前`,reanalyzing:`正在重新分析...`,reanalyzeRepo:`重新分析 {{repoName}}`,deleteRepo:`删除 {{repoName}}`,reanalyzingRepo:`正在重新分析 {{repoName}}:{{message}}`,analyzeNew:`分析新仓库...`,searchRepositories:`搜索仓库...`,noRepositoriesFound:`未找到“{{query}}”相关仓库`,searchNodes:`搜索节点...`,noNodesFound:`未找到“{{query}}”相关节点`,starIfCool:`觉得不错就点星`,aiSettings:`AI 设置`,help:`帮助`,language:`语言`,selectLanguage:`选择语言`},"../locales/zh-CN/help.json":{tabs:{overview:`概览`,ai:`Nexus AI`,shortcuts:`快捷键`,status:`状态栏`,graph:`图谱与节点`,search:`搜索与过滤`},shortcuts:{searchNodes:`搜索节点`,deselectClose:`取消选择 / 关闭`,columns:{action:`操作`,mac:`Mac`,windows:`Windows`}},nodeTypes:{function:`函数`,functionDesc:`函数声明`,file:`文件`,fileDesc:`源码文件`,class:`类`,classDesc:`类声明`,method:`方法`,methodDesc:`类方法`,interface:`接口`,interfaceDesc:`TypeScript 接口`,folder:`文件夹`,folderDesc:`目录节点`},status:{ready:`就绪`,readyDesc:`图谱已完全加载并可交互`,nodesCount:`节点数`,nodesCountDesc:`图谱中的文件与符号总数`,edgesCount:`边数`,edgesCountDesc:`导入 / 依赖连接`,aiIndexStatus:`AI 索引状态`,aiIndexStatusDesc:`仓库已完成 AI 查询索引`,semanticReadyBadge:`语义就绪`,explained:`状态栏说明`},tryAsking:`可以尝试问:`,footer:`GitNexus — 图谱浏览器`,title:`帮助与参考`,footerLong:`GitNexus — 开源代码库图谱浏览器`,docsGithub:`文档与 GitHub ↗`,overview:{gettingStarted:`开始使用`,whatIsTitle:`GitNexus 是什么?`,whatIsDescription:`GitNexus 是代码库的交互式图谱浏览器。每个文件、函数和导入关系都会变成可探索、可查询、可视化导航的节点。`,currentRepoTitle:`当前仓库`,loadedCounts:`已加载:{{nodeCount}} 个节点 · {{edgeCount}} 条边`,threeWaysTitle:`三种探索方式`,wayInspect:`点击节点查看详情`,waySearch:`按名称或类型搜索`,wayAsk:`向 Nexus AI 提出自然语言问题`,navigationTitle:`导航`,navZoom:`滚动缩放`,navPan:`点击并拖动进行平移`,navFocus:`双击节点聚焦其子图`},graph:{nodeColorLegend:`节点颜色图例`,nodeLabel:`{{label}}节点`,sizeDescription:`节点大小反映连接数量——越大的节点被越多文件依赖。边的方向表示从导入方 → 被导入方。`,detailDescription:`点击任意节点可打开详情面板,查看导入、导出和反向依赖。`},search:{title:`搜索与过滤`,searchNodes:`搜索节点`,searchDescription:`可按文件名、函数名或导入路径搜索,匹配的节点会在图谱中实时高亮。`,filterPanel:`过滤面板`,filterDescription:`使用左侧栏的过滤图标隔离特定节点类型、隐藏叶子节点,或以选中节点为根聚焦指定深度范围。`,syntax:`搜索语法`,hints:{nameFragment:`按名称片段匹配`,pathPrefix:`按路径前缀匹配`,nodeType:`按节点类型过滤`}},ai:{title:`Nexus AI`,semanticReady:`✓ 语义索引就绪`,description:`仓库已完成索引,可进行语义查询。Nexus AI 理解代码结构和关系,而不只是文件名。`,questions:{dependencies:`“哪些文件依赖 auth 模块?”`,circular:`“找出这个仓库中的循环依赖”`,connected:`“哪些组件连接最密集?”`,imports:`“显示所有导入 useEffect 的文件”`},openPrompt:`点击右上角的 Nexus AI 按钮打开提问面板。`}},"../locales/zh-CN/onboarding.json":{success:{title:`服务器已连接`,description:`正在准备代码知识图谱...`},loading:{largeRepoHint:`大型仓库可能需要一些时间`},guide:{copyAria:`复制到剪贴板`,copiedAria:`已复制!`,startServer:`启动本地服务器`,devDescription:`在另一个终端启动 Express 后端,即可启用完整图谱。`,prodDescription:`只需一条命令,浏览器会自动连接。`,copyCommand:`复制命令`,copyCommandDescription:`点击终端右侧图标复制。`,done:`完成`,orInstallGlobally:`或全局安装`,globalInstall:`全局安装`,startBackend:`启动后端`,terminal:`终端`,waitingForServer:`等待服务器启动`,pasteAndRun:`粘贴并在终端运行`,pasteAndRunDescription:`在项目根目录打开终端,粘贴命令并回车。`,listeningForServer:`正在监听服务器`,willAutoConnect:`检测到后会自动连接`,autoConnects:`自动连接并打开图谱`,autoConnectsDescription:`无需刷新,页面会自动检测服务器。`,requires:`需要`,port:`端口 4747`},analyzeFirst:{title:`分析你的第一个仓库`,description:`粘贴仓库 URL,GitNexus 会克隆仓库、解析代码,并直接在浏览器中构建实时知识图谱。`,footer:`仅支持公开仓库 · 服务器本地克隆 · 数据不会离开你的机器`},landing:{chooseRepository:`选择仓库`,description:`选择一个已索引仓库开始探索,或分析一个新仓库。`,indexed:`索引于 {{time}}`,orAnalyzeNew:`或分析新仓库`,footer:`支持公开与私有仓库 · 服务器本地克隆 · 数据不会离开你的机器`,time:{justNow:`刚刚`,minutesAgo:`{{count}} 分钟前`,hoursAgo:`{{count}} 小时前`,daysAgo:`{{count}} 天前`}},repoAnalyzer:{inputType:`输入类型`,githubUrl:`GitHub URL`,gitlabUrl:`GitLab URL`,azureDevOpsUrl:`Azure DevOps`,localFolder:`本地文件夹`,starting:`正在启动分析...`,analyzeRepository:`分析仓库`,complete:`分析完成`,loadingGraph:`正在加载图数据...`,defaultRepoName:`仓库`,githubRepositoryUrl:`GitHub 仓库 URL`,githubTokenLabel:`个人访问令牌(可选)`,githubTokenPlaceholder:`ghp_… 或 github_pat_…`,githubTokenHelp:`私有仓库需要此项。需 'repo' 范围(或细粒度 Contents:read)。仅发送一次,不会保存。`,gitlabRepositoryUrl:`GitLab 仓库 URL`,gitlabSupported:`支持 GitLab.com 和自托管 GitLab 实例。`,azureDevOpsRepositoryUrl:`Azure DevOps 仓库 URL`,azureDevOpsSupported:`格式: http://server/Collection/Project/_git/Repository`,localFolderPath:`本地文件夹路径`,hideBackground:`隐藏(分析继续在后台进行)`,upload:{button:`上传文件夹`,uploading:`上传中…`,selected:`已准备 {{fileCount}} 个文件(已跳过 {{dropped}} 个:.git、node_modules、构建产物)`,empty:`该文件夹中未找到可分析的文件。`}}},"../locales/zh-CN/settings.json":{title:`AI 设置`,subtitle:`配置你的 LLM 提供商`,localServer:`本地服务器`,backendUrl:`后端 URL`,connected:`已连接`,notConnected:`未连接`,runServeHint:"运行 `gitnexus serve` 将 Web UI 连接到本地后端。",provider:`提供商`,apiKey:`API Key`,learnMore:`了解更多`,model:`模型`,searchModelPlaceholder:`搜索或输入模型 ID...`,selectModelPlaceholder:`选择或输入模型...`,customModelHint:`输入模型 ID 或按 Enter`,customModelExample:`例如 openai/gpt-4o`,pressEnterCustom:`按 Enter 使用自定义 ID`,baseUrl:`Base URL`,optional:`可选`,deploymentName:`部署名称`,apiVersion:`API 版本`,checkConnection:`检查连接`,privacyLabel:`隐私:`,privacyText:`你的 API Key 仅保存在此浏览器本地。`,providers:{openai:{description:`使用 OpenAI 模型进行聊天和代码推理。`,apiKeyPlaceholder:`输入 OpenAI API Key`,helperText:`从这里获取 API Key:`,helperLinkLabel:`OpenAI Platform`,modelPlaceholder:`例如:gpt-4o、gpt-4-turbo、gpt-3.5-turbo`,baseUrlPlaceholder:`https://api.openai.com/v1(默认)`,baseUrlHint:`留空则使用默认 OpenAI API。可为代理或兼容 API 设置自定义 URL。`},gemini:{description:`使用 Google Gemini 模型。`,apiKeyPlaceholder:`输入 Google AI API Key`,helperText:`从这里获取 API Key:`,helperLinkLabel:`Google AI Studio`,modelPlaceholder:`例如:gemini-2.0-flash、gemini-1.5-pro`},anthropic:{description:`使用 Anthropic Claude 模型。`,apiKeyPlaceholder:`输入 Anthropic API Key`,helperText:`从这里获取 API Key:`,helperLinkLabel:`Anthropic Console`,modelPlaceholder:`例如:claude-sonnet-4-20250514、claude-3-opus`},azure:{apiKeyPlaceholder:`输入 Azure OpenAI API Key`,deploymentNamePlaceholder:`例如:gpt-4o-deployment`},ollama:{quickStart:`📋 快速开始:`,installFrom:`从这里安装 Ollama:`,thenRun:`,然后运行:`,modelPlaceholder:`例如:llama3.2、mistral、codellama`},openrouter:{apiKeyPlaceholder:`输入 OpenRouter API Key`,helperText:`从这里获取 API Key:`,helperLinkLabel:`OpenRouter Keys`},minimax:{apiKeyPlaceholder:`输入 MiniMax API Key`,helperText:`从这里获取 API Key:`,helperLinkLabel:`MiniMax Platform`,modelPlaceholder:`例如:MiniMax-M2.5、MiniMax-M2.5-highspeed`,helperModel:`可用:MiniMax-M2.5(默认)、MiniMax-M2.5-highspeed(更快)`},glm:{apiKeyPlaceholder:`输入 Z.AI API Key`}},loadingModels:`正在加载模型...`,noModelsMatch:`没有匹配“{{searchTerm}}”的模型`,moreModels:`+{{count}} 个更多模型 • 缩小搜索范围`,apiKeySession:`API Key 保存在会话存储中,关闭此标签页后会被清除。`,startLocalServer:`启动本地服务器`,settingsSaved:`设置已保存`,failedToSave:`保存失败`,saveSettings:`保存设置`,endpoint:`端点`,azurePortal:`Azure Portal`,azureHint:`在这里配置 Azure OpenAI 服务:`,defaultPort:`默认端口为`,pullModel:`使用以下命令拉取模型`,browseModels:`在这里浏览全部模型:`,openRouterModels:`OpenRouter Models`,zaiPlatform:`Z.AI Platform`,glmCodingApi:`Coding API(默认)。通用 API 请使用 https://api.z.ai/api/paas/v4。`,privacyFull:`你的 API Key 只保存在此浏览器的会话存储中,关闭标签页后会清除。聊天时会直接发送给 LLM 提供商,你的代码不会离开本机。`}}),Fn={},In=new Set;for(let[e,t]of Object.entries(Pn)){let n=e.match(/\.\.\/locales\/([^/]+)\/([^/.]+)\.json$/);if(!n)continue;let[,r,i]=n;Fn[r]??={},Fn[r][i]=t,In.add(i)}var Ln=Array.from(In).sort(),Rn=`common`,zn=`gitnexus.lng`;function Bn(e){if(typeof document>`u`)return;let t=Nn(e);document.documentElement.lang=t.code,document.documentElement.dir=t.dir}function Vn(e){return Mn(e)??`en`}function Hn(e){let t=Mn(e);if(!(!t||typeof window>`u`))try{window.localStorage.setItem(zn,t)}catch{}}rn.use(On).use(kn).init({resources:Fn,fallbackLng:`en`,supportedLngs:jn,load:`currentOnly`,ns:Ln,defaultNS:Rn,fallbackNS:!1,returnEmptyString:!1,interpolation:{escapeValue:!1},react:{useSuspense:!1},detection:{order:[`querystring`,`localStorage`,`navigator`,`htmlTag`],lookupQuerystring:`lng`,lookupLocalStorage:zn,caches:[],convertDetectedLanguage:Vn}}).then(()=>{let e=rn.resolvedLanguage||rn.language;Bn(e),Hn(e)}),rn.on(`languageChanged`,e=>{let t=rn.resolvedLanguage||e;Bn(t),Hn(t)});var Un=rn,Wn=e=>e.replace(/\\/g,`/`).replace(/^\.?\//,``),Gn=/\[\[([a-zA-Z0-9_\-./\\]+\.[a-zA-Z0-9]+)(?::(\d+)(?:[-–](\d+))?)?\]\]/g,Kn=/\[\[(?:graph:)?(Class|Function|Method|Interface|File|Folder|Variable|Enum|Type|CodeElement):([^\]]+)\]\]/g,qn={Project:`#a855f7`,Package:`#8b5cf6`,Module:`#7c3aed`,Folder:`#6366f1`,File:`#3b82f6`,Class:`#f59e0b`,Function:`#10b981`,Method:`#14b8a6`,Variable:`#64748b`,Interface:`#ec4899`,Enum:`#f97316`,Decorator:`#eab308`,Import:`#475569`,Type:`#a78bfa`,CodeElement:`#64748b`,Community:`#818cf8`,Process:`#f43f5e`,Section:`#60a5fa`,Struct:`#f59e0b`,Trait:`#ec4899`,Impl:`#14b8a6`,TypeAlias:`#a78bfa`,Const:`#64748b`,Static:`#64748b`,Namespace:`#7c3aed`,Union:`#f97316`,Typedef:`#a78bfa`,Macro:`#eab308`,Property:`#64748b`,Record:`#f59e0b`,Delegate:`#14b8a6`,Annotation:`#eab308`,Constructor:`#10b981`,Template:`#a78bfa`,Route:`#f43f5e`,Tool:`#a855f7`,BasicBlock:`#475569`},Jn={Project:20,Package:16,Module:13,Folder:10,File:6,Class:8,Function:4,Method:3,Variable:2,Interface:7,Enum:5,Decorator:2,Import:1.5,Type:3,CodeElement:2,Community:0,Process:0,Section:8,Struct:8,Trait:7,Impl:3,TypeAlias:3,Const:2,Static:2,Namespace:13,Union:5,Typedef:3,Macro:2,Property:2,Record:8,Delegate:3,Annotation:2,Constructor:4,Template:3,Route:5,Tool:5,BasicBlock:2},Yn=[`#ef4444`,`#f97316`,`#eab308`,`#22c55e`,`#06b6d4`,`#3b82f6`,`#8b5cf6`,`#d946ef`,`#ec4899`,`#f43f5e`,`#14b8a6`,`#84cc16`],Xn=e=>Yn[e%Yn.length],Zn=[`Project`,`Package`,`Module`,`Folder`,`File`,`Class`,`Function`,`Method`,`Property`,`Const`,`Interface`,`Enum`,`Type`],Qn=[`Folder`,`File`,`Class`,`Interface`,`Enum`,`Type`,`Function`,`Method`,`Variable`,`Property`,`Const`,`Decorator`,`Import`],$n=[`CONTAINS`,`DEFINES`,`IMPORTS`,`CALLS`,`EXTENDS`,`IMPLEMENTS`],er=[`CONTAINS`,`DEFINES`,`IMPORTS`,`EXTENDS`,`IMPLEMENTS`,`CALLS`],tr={CONTAINS:{color:`#2d5a3d`,label:`Contains`},DEFINES:{color:`#0e7490`,label:`Defines`},IMPORTS:{color:`#1d4ed8`,label:`Imports`},CALLS:{color:`#7c3aed`,label:`Calls`},EXTENDS:{color:`#c2410c`,label:`Extends`},IMPLEMENTS:{color:`#be185d`,label:`Implements`}},H=m(),nr=(0,P.createContext)(null),rr=({children:e})=>{let[t,n]=(0,P.useState)(null),[r,i]=(0,P.useState)(null),[a,o]=(0,P.useState)(Zn),[s,c]=(0,P.useState)(er),[l,u]=(0,P.useState)(null),[d,f]=(0,P.useState)(new Set),[p,m]=(0,P.useState)(`force`),[h,g]=(0,P.useState)(`full`),[_,v]=(0,P.useState)(null),y=(0,P.useCallback)(e=>{o(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),b=(0,P.useCallback)(e=>{c(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),x=(0,P.useMemo)(()=>({graph:t,setGraph:n,selectedNode:r,setSelectedNode:i,visibleLabels:a,toggleLabelVisibility:y,visibleEdgeTypes:s,toggleEdgeVisibility:b,depthFilter:l,setDepthFilter:u,highlightedNodeIds:d,setHighlightedNodeIds:f,graphViewMode:p,setGraphViewMode:m,graphMode:h,setGraphMode:g,chatOnlyNodeCount:_,setChatOnlyNodeCount:v}),[t,r,a,s,l,d,p,h,_]);return(0,H.jsx)(nr.Provider,{value:x,children:e})},ir=()=>{let e=(0,P.useContext)(nr);if(!e)throw Error(`useGraphState must be used within a GraphStateProvider`);return e},ar=`gitnexus.autoStartEmbeddings`,or=()=>typeof window>`u`||!window.localStorage?!1:window.localStorage.getItem(ar)===`true`,sr=(e,t)=>e.find(e=>Ae(e)===t)?.name??t.split(/[/\\]/).filter(Boolean).at(-1)??t,cr=(0,P.createContext)(null),lr=({children:e})=>(0,H.jsx)(rr,{children:(0,H.jsx)(ur,{children:e})}),ur=({children:e})=>{let[t,n]=(0,P.useState)(`onboarding`),{graph:r,setGraph:i,selectedNode:a,setSelectedNode:o,visibleLabels:s,toggleLabelVisibility:c,visibleEdgeTypes:l,toggleEdgeVisibility:u,depthFilter:d,setDepthFilter:f,highlightedNodeIds:p,setHighlightedNodeIds:m,graphViewMode:h,setGraphViewMode:g,graphMode:_,setGraphMode:v,chatOnlyNodeCount:b,setChatOnlyNodeCount:x}=ir(),[S,C]=(0,P.useState)(!1),[w,T]=(0,P.useState)(`code`),[E,O]=(0,P.useState)(!1),k=(0,P.useCallback)(()=>{Xe(!0)},[]),A=(0,P.useCallback)(()=>{C(!0),T(`chat`)},[]),[j,M]=(0,P.useState)(null),[N,F]=(0,P.useState)(new Set),[I,R]=(0,P.useState)(new Set),[ee,te]=(0,P.useState)(new Set),[ne,re]=(0,P.useState)(!0),z=(0,P.useCallback)(()=>{re(e=>!e)},[]),B=(0,P.useCallback)(()=>{R(new Set)},[]),ie=(0,P.useCallback)(()=>{F(new Set)},[]),ae=(0,P.useCallback)(()=>{te(new Set)},[]),oe=(0,P.useCallback)(()=>{m(new Set),M(null)},[]),[se,ce]=(0,P.useState)(new Map),le=(0,P.useRef)(null),ue=(0,P.useCallback)((e,t)=>{let n=Date.now(),r=t===`pulse`?2e3:t===`ripple`?3e3:4e3;ce(i=>{let a=new Map(i);for(let i of e)a.set(i,{type:t,startTime:n,duration:r});return a}),setTimeout(()=>{ce(t=>{let r=new Map(t);for(let t of e){let e=r.get(t);e&&e.startTime===n&&r.delete(t)}return r})},r+100)},[]),de=(0,P.useCallback)(()=>{ce(new Map),le.current&&=(clearInterval(le.current),null)},[]),[fe,pe]=(0,P.useState)(null),[me,_e]=(0,P.useState)(``),[ye,be]=(0,P.useState)(void 0),[xe,Ce]=(0,P.useState)(null),[we,Te]=(0,P.useState)([]),[Ee,De]=(0,P.useState)(`idle`),[Oe,ke]=(0,P.useState)(null),[Ae,je]=(0,P.useState)(he),[Me,Ne]=(0,P.useState)(!1),[Pe,Fe]=(0,P.useState)(!1),[Ie,Le]=(0,P.useState)(!1),[Re,ze]=(0,P.useState)(null),[Be,Ve]=(0,P.useState)([]),[He,Ue]=(0,P.useState)(!1),[We,Ge]=(0,P.useState)([]),[qe,Je]=(0,P.useState)([]),[Ye,Xe]=(0,P.useState)(!1),[Ze,nt]=(0,P.useState)(null),rt=(0,P.useMemo)(()=>{if(!r)return new Map;let e=new Map;for(let t of r.nodes)t.label===`File`&&e.set(Wn(t.properties.filePath),t.id);return e},[r]),it=(0,P.useMemo)(()=>{if(!r)return new Map;let e=new Map;for(let t of r.nodes)t.label===`File`&&t.properties.filePath&&e.set(Wn(t.properties.filePath),t.properties.filePath);return e},[r]),at=(0,P.useCallback)(e=>{let t=Wn(e);if(it.has(t))return it.get(t);for(let[e,n]of it)if(e.endsWith(t))return n;return null},[it]),V=(0,P.useCallback)(e=>rt.get(Wn(e)),[rt]),lt=(0,P.useCallback)(e=>{let t=`ref-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,n={...e,id:t};Je(t=>t.some(t=>t.filePath===e.filePath&&t.startLine===e.startLine&&t.endLine===e.endLine)?t:[...t,n]),Xe(!0),nt({filePath:e.filePath,startLine:e.startLine,endLine:e.endLine,ts:Date.now()}),e.nodeId&&e.source===`ai`&&F(t=>new Set([...t,e.nodeId]))},[]),ut=(0,P.useCallback)(()=>{Je(e=>{let t=e.filter(e=>e.source===`ai`),n=e.filter(e=>e.source!==`ai`),r=new Set(t.map(e=>e.nodeId).filter(Boolean));return r.size>0&&F(e=>{let t=new Set(e);for(let e of r)t.delete(e);return t}),n.length===0&&!a&&Xe(!1),n})},[a]);(0,P.useEffect)(()=>{a&&Xe(!0)},[a]);let dt=(0,P.useRef)(void 0),ft=(0,P.useCallback)(e=>{dt.current=e,be(e)},[]),pt=(0,P.useCallback)(async e=>Qe(e,dt.current),[]),mt=(0,P.useCallback)(async()=>Ke(),[]),ht=(0,P.useRef)(null),gt=(0,P.useCallback)(async()=>{let e=dt.current;if(!e)throw Error(`No repository loaded`);De(`loading`),ke(null);try{let{jobId:t}=await ot(e);await new Promise((e,n)=>{ht.current=st(t,e=>{ke({phase:e.phase,percent:e.percent}),e.phase===`loading-model`||e.phase===`loading`?De(`loading`):e.phase===`embedding`?De(`embedding`):e.phase===`indexing`&&De(`indexing`)},()=>{De(`ready`),ke({phase:`ready`,percent:100}),e()},e=>{De(`error`),n(Error(e))})})}catch(e){if(e?.message?.includes(`already in progress`)){De(`embedding`);return}throw De(`error`),e}},[]),_t=(0,P.useCallback)(()=>{if(typeof navigator<`u`&&navigator.webdriver||typeof process<`u`&&{}.PLAYWRIGHT_TEST){De(`idle`);return}if(!or()){De(`idle`);return}gt().catch(e=>{console.warn(`Embeddings auto-start failed:`,e)})},[gt]),vt=(0,P.useCallback)(async(e,t=10)=>$e(e,{limit:t,mode:`semantic`,repo:dt.current}),[]),yt=(0,P.useCallback)(async(e,t=5,n=2)=>$e(e,{limit:t,mode:`semantic`,enrich:!0,repo:dt.current}),[]),bt=(0,P.useCallback)(e=>{je(t=>{let n={...t,...e};return ge(n),n})},[]),xt=(0,P.useCallback)(()=>{je(he())},[]),St=(0,P.useRef)(null),Ct=(0,P.useRef)(null),wt=(0,P.useRef)(`idle`),Tt=(0,P.useRef)(_);(0,P.useEffect)(()=>{Tt.current=_},[_]);let Et=(0,P.useCallback)(async(e,t)=>{let n=ve();if(!n){ze(`Please configure an LLM provider in settings`);return}let r=t?.chatOnly??Tt.current===`chatOnly`;Le(!0),ze(null);try{let i=e||me||`project`;t?.repo&&ft(t.repo);let a=dt.current,{createGraphRAGAgent:o}=await D(async()=>{let{createGraphRAGAgent:e}=await import(`./agent-A0etRnOc.js`);return{createGraphRAGAgent:e}},__vite__mapDeps([0,1,2,3,4,5])),{buildCodebaseContext:s}=await D(async()=>{let{buildCodebaseContext:e}=await import(`./context-builder-BHiFUA8O.js`);return{buildCodebaseContext:e}},[]),c=e=>Qe(e,a),l=await s(c,i);St.current=o(n,{executeQuery:c,search:(e,t)=>$e(e,{...t,repo:a}),grep:(e,t)=>et(e,a,t),readFile:e=>tt(e,{repo:a}).then(e=>e.content)},l,r),Fe(!0),ze(null)}catch(e){let t=e instanceof Error?e.message:String(e);ze(t),Fe(!1)}finally{Le(!1)}},[]),Dt=(0,P.useCallback)(async e=>{if(wt.current!==`idle`||(ut(),B(),!Pe&&(await Et(),!St.current)))return;let t={id:`user-${Date.now()}`,role:`user`,content:e,timestamp:Date.now()};if(Ve(e=>[...e,t]),Ee===`indexing`){let e={id:`assistant-${Date.now()}`,role:`assistant`,content:Un.t(`common:chat.waitForVectorIndex`),timestamp:Date.now()};Ve(t=>[...t,e]),ze(null),Ue(!1),Ge([]);return}Ue(!0),wt.current=`streaming`,Ge([]),Ct.current?.abort();let n=new AbortController;Ct.current=n;let i=Se(Ae.activeProvider),a=[...Be,t].flatMap(e=>e.role===`user`?[{role:`user`,content:e.content}]:e.role===`tool`?e.toolCallId?[{role:`tool`,content:e.content,toolCallId:e.toolCallId}]:[]:i.preserveAssistantTranscript&&e.historyMessages?.length?e.historyMessages:[{role:`assistant`,content:e.content}]),o=`assistant-${Date.now()}`,s=[],c=[],l=0,u,d=()=>{let e=s.filter(e=>e.type===`reasoning`||e.type===`content`).map(e=>e.content).filter(Boolean).join(`
13
13
 
14
- `);Ve(t=>{let n=t.find(e=>e.id===o),r={id:o,role:`assistant`,content:e,historyMessages:u,steps:[...s],toolCalls:[...c],timestamp:n?.timestamp??Date.now()};return n?t.map(e=>e.id===o?r:e):[...t,r]})},f=!1,p=null,m=()=>{f||(f=!0,p=requestAnimationFrame(()=>{f=!1,p=null,d()}))};try{let e=e=>{switch(e.type){case`reasoning`:if(e.reasoning){let t=s[s.length-1];t&&t.type===`reasoning`?s[s.length-1]={...t,content:(t.content||``)+e.reasoning}:s.push({id:`step-${l++}`,type:`reasoning`,content:e.reasoning}),m()}break;case`content`:if(e.content){let t=s[s.length-1];t&&t.type===`content`?s[s.length-1]={...t,content:(t.content||``)+e.content}:s.push({id:`step-${l++}`,type:`content`,content:e.content}),m();let n=s[s.length-1],i=n&&n.type===`content`&&n.content||``,a=new RegExp(Gn.source,Gn.flags),o;for(;(o=a.exec(i))!==null;){let e=o[1].trim(),t=o[2]?parseInt(o[2],10):void 0,n=o[3]?parseInt(o[3],10):t,r=at(e);if(!r)continue;let i=t===void 0?void 0:Math.max(0,t-1),a=n===void 0?i:Math.max(0,n-1),s=V(r);lt({filePath:r,startLine:i,endLine:a,nodeId:s,label:`File`,name:r.split(`/`).pop()??r,source:`ai`})}let c=new RegExp(Kn.source,Kn.flags),u;for(;(u=c.exec(i))!==null;){let e=u[1],t=u[2].trim();if(!r)continue;let n=r.nodes.find(n=>n.label===e&&n.properties.name===t);if(!n||!n.properties.filePath)continue;let i=at(n.properties.filePath);i&&lt({filePath:i,startLine:n.properties.startLine?n.properties.startLine-1:void 0,endLine:n.properties.endLine?n.properties.endLine-1:void 0,nodeId:n.id,label:n.label,name:n.properties.name,source:`ai`})}}break;case`tool_call`:if(e.toolCall){let t=e.toolCall;c.push(t),s.push({id:`step-${l++}`,type:`tool_call`,toolCall:t}),Ge(e=>[...e,t]),m()}break;case`tool_result`:if(e.toolCall){let t=e.toolCall,n=c.findIndex(e=>e.id===t.id);n<0&&(n=c.findIndex(e=>e.name===t.name&&e.status===`running`)),n<0&&(n=c.findIndex(e=>e.name===t.name&&!e.result)),n>=0&&c[n].status!==`stopped`&&(c[n]={...c[n],result:t.result,status:`completed`});let i=s.findIndex(e=>e.type===`tool_call`&&e.toolCall&&(e.toolCall.id===t.id||e.toolCall.name===t.name&&e.toolCall.status===`running`));if(i>=0&&s[i].toolCall&&s[i].toolCall.status!==`stopped`&&(s[i]={...s[i],toolCall:{...s[i].toolCall,result:t.result,status:`completed`}}),Ge(e=>{let n=e.findIndex(e=>e.id===t.id);return n<0&&(n=e.findIndex(e=>e.name===t.name&&e.status===`running`)),n<0&&(n=e.findIndex(e=>e.name===t.name&&!e.result)),n>=0?e[n].status===`stopped`?e:e.map((e,r)=>r===n?{...e,result:t.result,status:`completed`}:e):e}),m(),t.result){let e=t.result.match(/\[HIGHLIGHT_NODES:([^\]]+)\]/);if(e){let t=e[1].split(`,`).map(e=>e.trim()).filter(Boolean);if(t.length>0&&r){let e=new Set,n=new Set(r.nodes.map(e=>e.id));for(let i of t)if(n.has(i))e.add(i);else{let t=r.nodes.find(e=>e.id.endsWith(i)||e.id.endsWith(`:`+i))?.id;t&&e.add(t)}e.size>0&&R(e)}else t.length>0&&R(new Set(t))}let n=t.result.match(/\[IMPACT:([^\]]+)\]/);if(n){let e=n[1].split(`,`).map(e=>e.trim()).filter(Boolean);if(e.length>0&&r){let t=new Set,n=new Set(r.nodes.map(e=>e.id));for(let i of e)if(n.has(i))t.add(i);else{let e=r.nodes.find(e=>e.id.endsWith(i)||e.id.endsWith(`:`+i))?.id;e&&t.add(e)}t.size>0&&te(t)}else e.length>0&&te(new Set(e))}}}break;case`error`:ze(e.error??`Unknown error`);break;case`done`:u=i.preserveAssistantTranscript?e.historyMessages:void 0,m();break}},t=St.current;if(!t)throw Error(`Agent not initialized`);let{streamAgentResponse:o}=await D(async()=>{let{streamAgentResponse:e}=await import(`./agent-A0etRnOc.js`);return{streamAgentResponse:e}},__vite__mapDeps([0,1,2,3,4,5]));for await(let r of o(t,a,{captureHistory:i.preserveAssistantTranscript,signal:n.signal})){if(r.type===`cancelled`)break;e(r)}}catch(e){if(!n.signal.aborted){let t=e instanceof Error?e.message:String(e);ze(t)}}finally{p!=null&&(cancelAnimationFrame(p),p=null),wt.current=`idle`,Ue(!1),Ge([])}},[Be,Pe,Et,at,V,lt,ut,B,r,Ee]),Ot=(0,P.useCallback)(()=>{if(!Ct.current)return;wt.current=`aborting`,Ct.current.abort(),Ct.current=null;let e=Un.t(`chat:stopped`),t=t=>t.status===`running`||t.status===`pending`?{...t,status:`stopped`,result:e}:t;Ge(e=>e.map(t)),Ve(e=>{let n=[...e].map((e,t)=>e.role===`assistant`?t:-1).filter(e=>e>=0).pop();if(n===void 0)return e;let r=e[n],i={...r,toolCalls:r.toolCalls?.map(t),steps:r.steps?.map(e=>e.type===`tool_call`&&e.toolCall?{...e,toolCall:t(e.toolCall)}:e)};return e.map((e,t)=>t===n?i:e)}),Ue(!1)},[]),kt=(0,P.useCallback)(()=>{Ct.current?.abort(),Ct.current=null,wt.current=`idle`,Ve([]),Ge([]),ze(null),Ue(!1)},[]),At=(0,P.useCallback)(async e=>{if(!xe)return;pe({phase:`extracting`,percent:0,message:Un.t(`common:progress.switchingRepository`),detail:Un.t(`common:progress.loadingRepository`,{repo:sr(we,e)})}),n(`loading`),Fe(!1),m(new Set),B(),ie(),ae(),o(null),M(null),Je([]),Xe(!1),nt(null),v(`full`),x(null);let t,r,a,s=!1;try{let n=await ct(xe,(e,t,n)=>{if(e===`validating`)pe({phase:`extracting`,percent:5,message:Un.t(`common:progress.switchingRepository`),detail:Un.t(`common:progress.validating`)});else if(e===`downloading`){let e=n?Math.round(t/n*90)+5:50,r=(t/(1024*1024)).toFixed(1);pe({phase:`extracting`,percent:e,message:Un.t(`common:progress.downloadingGraph`),detail:Un.t(`common:progress.downloadedMb`,{mb:r})})}else e===`extracting`&&pe({phase:`extracting`,percent:97,message:Un.t(`common:progress.processing`),detail:Un.t(`common:progress.extractingFileContents`)})},void 0,e,{awaitAnalysis:!0}),o=n.repoInfo.repoPath??n.repoInfo.path,c=n.repoInfo.name||(o||``).replace(/\\/g,`/`).split(`/`).filter(Boolean).pop()||e||`server-project`;a=e||o||c,_e(c),ft(a),t=n.repoInfo,r=c;let l=L(n);i(l.graph),v(l.graphMode),x(l.graphMode===`chatOnly`?l.nodeCount:null),s=l.graphMode===`chatOnly`}catch(e){console.error(`Repo switch failed:`,e),pe({phase:`error`,percent:0,message:Un.t(`common:progress.failedSwitchRepository`),detail:e instanceof Error?e.message:Un.t(`common:progress.unknownError`)}),Fe(!1),St.current=null,setTimeout(()=>{n(`exploring`),pe(null)},y);return}if(r){let e=new URL(window.location.href);e.searchParams.set(`project`,r);let n=t?.repoPath??t?.path;n&&e.searchParams.set(`repo`,n),e.searchParams.delete(`skipGraph`),window.history.replaceState(null,``,e.toString())}St.current=null,Fe(!1),Ve([]);try{ve()&&await Et(r,{chatOnly:s,repo:a}),n(`exploring`),_t(),pe(null)}catch(e){console.warn(`Failed to initialize agent:`,e),Fe(!1),St.current=null,ze(`Failed to initialize agent`),n(`exploring`),pe(null)}},[xe,we,pe,n,_e,i,v,x,Et,_t,m,B,ie,ae,o,M,Je,Xe,nt,Ve,ft]),jt=(0,P.useRef)(!1),Mt=(0,P.useRef)(null),Nt=(0,P.useRef)(!0);(0,P.useEffect)(()=>()=>{Nt.current=!1,Mt.current?.abort()},[]);let Pt=(0,P.useCallback)(async()=>{if(!xe||jt.current)return;jt.current=!0;let e=dt.current,t=new AbortController;Mt.current=t,pe({phase:`extracting`,percent:0,message:Un.t(`common:progress.downloadingGraph`),detail:Un.t(`common:progress.validating`)}),n(`loading`);try{let r=await ct(xe,(e,t,n)=>{if(e===`downloading`){let e=n?Math.round(t/n*90)+5:50,r=(t/(1024*1024)).toFixed(1);pe({phase:`extracting`,percent:e,message:Un.t(`common:progress.downloadingGraph`),detail:Un.t(`common:progress.downloadedMb`,{mb:r})})}},t.signal,e,{awaitAnalysis:!0,skipGraph:!1});if(!Nt.current||dt.current!==e)return;let a=L(r);i(a.graph),v(a.graphMode),x(a.graphMode===`chatOnly`?a.nodeCount:null),pe(null),n(`exploring`),ve()&&await Et(e?sr(we,e):void 0,{chatOnly:!1,repo:e})}catch(t){if(!Nt.current||dt.current!==e)return;console.error(`Load graph anyway failed:`,t),pe(null),n(`exploring`)}finally{Mt.current===t&&(Mt.current=null),jt.current=!1}},[xe,we,pe,n,i,v,x,Et]),Ft=(0,P.useCallback)(e=>{Je(t=>{let n=t.find(t=>t.id===e),r=t.filter(t=>t.id!==e);return n?.nodeId&&n.source===`ai`&&(r.some(e=>e.nodeId===n.nodeId&&e.source===`ai`)||F(e=>{let t=new Set(e);return t.delete(n.nodeId),t})),r.length===0&&!a&&Xe(!1),r})},[a]),It=(0,P.useCallback)(()=>{Je([]),Xe(!1),nt(null)},[]),Lt={viewMode:t,setViewMode:n,graph:r,setGraph:i,selectedNode:a,setSelectedNode:o,isRightPanelOpen:S,setRightPanelOpen:C,rightPanelTab:w,setRightPanelTab:T,openCodePanel:k,openChatPanel:A,helpDialogBoxOpen:E,setHelpDialogBoxOpen:O,visibleLabels:s,toggleLabelVisibility:c,visibleEdgeTypes:l,toggleEdgeVisibility:u,depthFilter:d,setDepthFilter:f,graphViewMode:h,setGraphViewMode:g,graphMode:_,setGraphMode:v,chatOnlyNodeCount:b,setChatOnlyNodeCount:x,highlightedNodeIds:p,setHighlightedNodeIds:m,aiCitationHighlightedNodeIds:N,aiToolHighlightedNodeIds:I,blastRadiusNodeIds:ee,isAIHighlightsEnabled:ne,toggleAIHighlights:z,clearAIToolHighlights:B,clearAICitationHighlights:ie,clearBlastRadius:ae,queryResult:j,setQueryResult:M,clearQueryHighlights:oe,animatedNodes:se,triggerNodeAnimation:ue,clearAnimations:de,progress:fe,setProgress:pe,projectName:me,setProjectName:_e,currentRepo:ye,serverBaseUrl:xe,setServerBaseUrl:Ce,availableRepos:we,setAvailableRepos:Te,switchRepo:At,setCurrentRepo:ft,loadGraphAnyway:Pt,runQuery:pt,isDatabaseReady:mt,embeddingStatus:Ee,embeddingProgress:Oe,startEmbeddings:gt,startEmbeddingsWithFallback:_t,semanticSearch:vt,semanticSearchWithContext:yt,isEmbeddingReady:Ee===`ready`,llmSettings:Ae,updateLLMSettings:bt,isSettingsPanelOpen:Me,setSettingsPanelOpen:Ne,isAgentReady:Pe,isAgentInitializing:Ie,agentError:Re,chatMessages:Be,isChatLoading:He,currentToolCalls:We,refreshLLMSettings:xt,initializeAgent:Et,sendChatMessage:Dt,stopChatResponse:Ot,clearChat:kt,codeReferences:qe,isCodePanelOpen:Ye,setCodePanelOpen:Xe,addCodeReference:lt,removeCodeReference:Ft,clearAICodeReferences:ut,clearCodeReferences:It,codeReferenceFocus:Ze};return(0,H.jsx)(cr.Provider,{value:Lt,children:e})},dr=()=>{let e=(0,P.useContext)(cr);if(!e)throw Error(`useAppState must be used within AppStateProvider`);return e},fr=s(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),pr=s(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),mr=s(`at-sign`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`,key:`7n84p3`}]]),hr=s(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),gr=s(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),_r=s(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),vr=s(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),yr=s(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),br=s(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),xr=s(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Sr=s(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Cr=s(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),wr=s(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Tr=s(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Er=s(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Dr=s(`file-code`,[[`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 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),Or=s(`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`}]]),kr=s(`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`}]]),Ar=s(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),jr=s(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Mr=s(`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`}]]),Nr=s(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Pr=s(`heart`,[[`path`,{d:`M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5`,key:`mvr1a0`}]]),Fr=s(`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`}]]),Ir=s(`key`,[[`path`,{d:`m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4`,key:`g0fldk`}],[`path`,{d:`m21 2-9.6 9.6`,key:`1j0ho8`}],[`circle`,{cx:`7.5`,cy:`15.5`,r:`5.5`,key:`yqb3hr`}]]),Lr=s(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),Rr=s(`lightbulb-off`,[[`path`,{d:`M16.8 11.2c.8-.9 1.2-2 1.2-3.2a6 6 0 0 0-9.3-5`,key:`1fkcox`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M6.3 6.3a4.67 4.67 0 0 0 1.2 5.2c.7.7 1.3 1.5 1.5 2.5`,key:`10m8kw`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),zr=s(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Br=s(`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`}]]),Vr=s(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Hr=s(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),Ur=s(`mouse-pointer-click`,[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]),Wr=s(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),Gr=s(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),Kr=s(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),qr=s(`panel-right-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]),Jr=s(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Yr=s(`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`}]]),Xr=s(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Zr=s(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),Qr=s(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),$r=s(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),ei=s(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),ti=s(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),ni=s(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ri=s(`skip-forward`,[[`path`,{d:`M21 4v16`,key:`7j8fe9`}],[`path`,{d:`M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z`,key:`zs4d6`}]]),ii=s(`snail`,[[`path`,{d:`M2 13a6 6 0 1 0 12 0 4 4 0 1 0-8 0 2 2 0 0 0 4 0`,key:`hneq2s`}],[`circle`,{cx:`10`,cy:`13`,r:`8`,key:`194lz3`}],[`path`,{d:`M2 21h12c4.4 0 8-3.6 8-8V7a2 2 0 1 0-4 0v6`,key:`ixqyt7`}],[`path`,{d:`M18 3 19.1 5.2`,key:`9tjm43`}],[`path`,{d:`M22 3 20.9 5.2`,key:`j3odrs`}]]),ai=s(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),oi=s(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),si=s(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),ci=s(`table`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}]]),li=s(`target`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`6`,key:`1vlfrh`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),ui=s(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),di=s(`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`}]]),fi=s(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),pi=s(`type`,[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]),mi=s(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),hi=s(`variable`,[[`path`,{d:`M8 21s-4-3-4-9 4-9 4-9`,key:`uto9ud`}],[`path`,{d:`M16 3s4 3 4 9-4 9-4 9`,key:`4w2vsq`}],[`line`,{x1:`15`,x2:`9`,y1:`9`,y2:`15`,key:`f7djnv`}],[`line`,{x1:`9`,x2:`15`,y1:`9`,y2:`15`,key:`1shsy8`}]]),gi=s(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),_i=s(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),vi=`gitnexus-backend-url`;function yi(){let[e]=(0,P.useState)(()=>{try{return localStorage.getItem(vi)??S}catch{return S}}),[t,n]=(0,P.useState)(!1),[r,i]=(0,P.useState)(!1),a=(0,P.useRef)(0),o=(0,P.useCallback)(async()=>{let e=++a.current;i(!0);try{let t=await Ke();return e===a.current?(n(t),t):!1}catch{return e===a.current&&n(!1),!1}finally{e===a.current&&i(!1)}},[]),s=(0,P.useRef)(null),[c,l]=(0,P.useState)(!1),u=(0,P.useRef)(o);u.current=o;let d=(0,P.useCallback)(()=>{s.current!==null&&(clearTimeout(s.current),s.current=null),l(!1)},[]),f=(0,P.useCallback)(()=>{d(),l(!0);let e=()=>{s.current=setTimeout(async()=>{if(document.hidden){s.current=null;return}await u.current()?(l(!1),s.current=null):e()},3e3)};e()},[d]);return(0,P.useEffect)(()=>{if(!c)return;let e=()=>{document.hidden||(s.current!==null&&(clearTimeout(s.current),s.current=null),u.current().then(e=>{!e&&c&&f()}))};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[c,f]),(0,P.useEffect)(()=>()=>{s.current!==null&&clearTimeout(s.current)},[]),(0,P.useEffect)(()=>{Ie(e),o()},[]),{isConnected:t,isProbing:r,backendUrl:e,startPolling:f,stopPolling:d,isPolling:c}}function bi({text:e}){let{t}=f(`onboarding`),[n,r]=(0,P.useState)(!1),i=(0,P.useRef)(null);return(0,P.useEffect)(()=>()=>{i.current&&clearTimeout(i.current)},[]),(0,H.jsx)(`button`,{onClick:async()=>{try{await navigator.clipboard.writeText(e),r(!0),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>r(!1),2e3)}catch{}},"aria-label":t(n?`guide.copiedAria`:`guide.copyAria`),className:`shrink-0 cursor-pointer rounded-md px-2 py-1 transition-all duration-200 focus-visible:ring-2 focus-visible:ring-accent/40 focus-visible:outline-none ${n?`bg-emerald-400/10 text-emerald-400`:`text-text-muted hover:bg-white/5 hover:text-text-primary`} `,children:n?(0,H.jsx)(vr,{className:`h-3.5 w-3.5`}):(0,H.jsx)(o,{className:`h-3.5 w-3.5`})})}function xi({command:e,label:t,isActive:n=!1}){return(0,H.jsxs)(`div`,{className:`overflow-hidden rounded-xl border transition-all duration-300 ${n?`border-accent/40 shadow-glow-soft`:`border-border-default hover:border-accent/20 hover:shadow-glow-soft`} `,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border-subtle bg-deep px-4 py-2.5`,children:[(0,H.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,H.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-full bg-red-500/60`}),(0,H.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-full bg-yellow-500/60`}),(0,H.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-full bg-emerald-500/60`})]}),(0,H.jsx)(`span`,{className:`flex-1 text-center font-mono text-[11px] text-text-muted`,children:t}),(0,H.jsx)(bi,{text:e})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 bg-void px-4 py-3.5 font-mono text-sm`,children:[(0,H.jsx)(`span`,{className:`text-accent/60 select-none`,"aria-hidden":`true`,children:`$`}),(0,H.jsx)(`code`,{className:`flex-1 overflow-x-auto tracking-wide whitespace-nowrap text-text-primary`,children:e})]})]})}function Si({state:e,number:t}){return e===`done`?(0,H.jsx)(`div`,{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-emerald-500/50 bg-emerald-500/20`,children:(0,H.jsx)(vr,{className:`h-3 w-3 text-emerald-400`})}):e===`active`?(0,H.jsxs)(`div`,{className:`relative flex h-6 w-6 shrink-0 items-center justify-center`,children:[(0,H.jsx)(`div`,{className:`absolute inset-0 animate-ping rounded-full border border-accent/30`}),(0,H.jsx)(`div`,{className:`flex h-6 w-6 items-center justify-center rounded-full border border-accent/60 bg-accent/20`,children:(0,H.jsx)(`span`,{className:`text-[10px] leading-none font-semibold text-accent`,children:t})})]}):(0,H.jsx)(`div`,{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-border-subtle bg-elevated`,children:(0,H.jsx)(`span`,{className:`text-[10px] leading-none font-semibold text-text-muted`,children:t})})}function Ci({state:e,number:t,title:n,description:r,children:i}){let{t:a}=f(`onboarding`),o=e!==`waiting`;return(0,H.jsx)(`div`,{className:`transition-all duration-300 ${e===`waiting`?`opacity-40`:`opacity-100`} `,children:(0,H.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,H.jsx)(Si,{state:e,number:t}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium transition-colors duration-200 ${e===`done`?`text-emerald-400`:e===`active`?`text-text-primary`:`text-text-muted`}`,children:n}),e===`done`&&(0,H.jsx)(`span`,{className:`animate-fade-in font-mono text-[10px] tracking-wider text-emerald-400/60 uppercase`,children:a(`guide.done`)})]}),r&&(0,H.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-text-muted`,children:r}),o&&i&&(0,H.jsx)(`div`,{className:`mt-3 animate-slide-up`,children:i})]})]})})}function wi(){let{t:e}=f(`onboarding`);return(0,H.jsxs)(`div`,{className:`flex animate-fade-in items-center gap-3 rounded-xl border border-accent/15 bg-accent/5 px-4 py-3`,"aria-live":`polite`,role:`status`,children:[(0,H.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,H.jsx)(_i,{className:`h-4 w-4 text-accent/70`}),(0,H.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,H.jsx)(`div`,{className:`h-5 w-5 animate-pulse rounded-full border border-accent/25`})})]}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`p`,{className:`text-xs font-medium text-text-secondary`,children:[e(`guide.listeningForServer`),(0,H.jsx)(`span`,{className:`ml-0.5 inline-flex text-text-muted`,children:(0,H.jsx)(`span`,{className:`animate-pulse`,children:`...`})})]}),(0,H.jsx)(`p`,{className:`mt-0.5 text-[11px] text-text-muted`,children:e(`guide.willAutoConnect`)})]})]})}var Ti=({isPolling:e})=>{let{t}=f(`onboarding`),n=t(`guide.terminal`),r=e?`done`:`active`,i=e?`active`:`waiting`;return(0,H.jsxs)(`div`,{className:`relative animate-fade-in overflow-hidden rounded-3xl border border-border-default bg-surface p-7`,children:[(0,H.jsx)(`div`,{className:`pointer-events-none absolute -top-28 -right-28 h-72 w-72 rounded-full bg-accent/6 blur-3xl`}),(0,H.jsx)(`div`,{className:`pointer-events-none absolute -bottom-24 -left-24 h-56 w-56 rounded-full bg-node-function/6 blur-3xl`}),(0,H.jsx)(`div`,{className:`relative mb-6`,children:(0,H.jsxs)(`div`,{className:`text-center`,children:[(0,H.jsxs)(`div`,{className:`mb-2 inline-flex items-center gap-1.5`,children:[(0,H.jsx)(ai,{className:`h-3.5 w-3.5 text-accent/70`}),(0,H.jsx)(`span`,{className:`text-[11px] font-medium tracking-widest text-accent/80 uppercase`,children:`GitNexus`})]}),(0,H.jsx)(`h2`,{className:`text-lg leading-snug font-semibold text-text-primary`,children:t(`guide.startServer`)}),(0,H.jsx)(`p`,{className:`mx-auto mt-1 max-w-xs text-sm leading-relaxed text-text-secondary`,children:t(`guide.prodDescription`)})]})}),(0,H.jsxs)(`div`,{className:`relative space-y-5`,children:[(0,H.jsx)(`div`,{className:`pointer-events-none absolute top-6 bottom-6 left-[11px] w-px bg-border-subtle`,"aria-hidden":`true`}),(0,H.jsxs)(Ci,{state:r,number:1,title:t(`guide.copyCommand`),description:e?void 0:t(`guide.copyCommandDescription`),children:[(0,H.jsx)(xi,{command:`npx gitnexus@latest serve`,label:n,isActive:r===`active`}),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`my-3 flex items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`h-px flex-1 bg-border-subtle`}),(0,H.jsx)(`span`,{className:`text-[11px] tracking-widest text-text-muted uppercase`,children:t(`guide.orInstallGlobally`)}),(0,H.jsx)(`div`,{className:`h-px flex-1 bg-border-subtle`})]}),(0,H.jsx)(xi,{command:`npm install -g gitnexus && gitnexus serve`,label:t(`guide.globalInstall`),isActive:!1})]})]}),(0,H.jsx)(Ci,{state:i,number:2,title:t(e?`guide.waitingForServer`:`guide.pasteAndRun`),description:e?void 0:t(`guide.pasteAndRunDescription`),children:e&&(0,H.jsx)(wi,{})}),(0,H.jsx)(Ci,{state:`waiting`,number:3,title:t(`guide.autoConnects`),description:t(`guide.autoConnectsDescription`)})]}),(0,H.jsxs)(`div`,{className:`mt-6 flex items-center justify-center gap-1.5 border-t border-border-subtle pt-5 text-xs text-text-muted`,children:[(0,H.jsx)(ti,{className:`h-3 w-3 shrink-0`}),(0,H.jsxs)(`span`,{children:[t(`guide.requires`),` `,(0,H.jsxs)(`a`,{href:`https://nodejs.org`,target:`_blank`,rel:`noopener noreferrer`,className:`text-accent transition-colors hover:text-accent/80 hover:underline`,children:[`Node.js `,b,`+`]})]}),(0,H.jsx)(`span`,{className:`mx-1 text-border-default`,children:`·`}),(0,H.jsx)(ui,{className:`h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:t(`guide.port`)})]})]})};function Ei(e,t,n){return n(`common:analyzePhases.${e}`,{defaultValue:``})||t||e}function Di(e,t){if(!e)return``;let n=Oi[e];return n?t(n):e}var Oi={"Connecting...":`common:progress.connectingShort`,"Connecting to server...":`common:progress.connecting`,"Validating server":`common:progress.validatingServer`,"Validating server...":`common:progress.validatingServerEllipsis`,"Downloading graph...":`common:progress.downloadingGraph`,"Extracting file contents":`common:progress.extractingFileContents`,"Processing...":`common:progress.processing`,"Processing graph...":`common:progress.processingGraph`,"Loading graph...":`common:progress.loadingGraph`,Queued:`common:analyzePhases.queued`,"Starting...":`common:progress.starting`},ki=({progress:e,onCancel:t})=>{let{t:n}=f(`common`),[r]=(0,P.useState)(()=>Date.now()),[i,a]=(0,P.useState)(0);(0,P.useEffect)(()=>{let e=setInterval(()=>a(Date.now()-r),1e3);return()=>clearInterval(e)},[r]);let o=e=>{let t=Math.floor(e/1e3);return t<60?n(`units.elapsedSeconds`,{seconds:t}):n(`units.elapsedMinutesSeconds`,{minutes:Math.floor(t/60),seconds:t%60})},s=Ei(e.phase,e.message,n),c=Math.max(0,Math.min(100,e.percent));return(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,H.jsx)(`span`,{className:`font-medium text-text-secondary`,children:s}),(0,H.jsx)(`span`,{className:`font-mono text-xs text-text-muted`,children:o(i)})]}),(0,H.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-elevated`,children:(0,H.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-all duration-300 ease-out`,style:{width:`${c}%`}})}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`span`,{className:`font-mono text-xs text-text-muted`,children:[c,`%`]}),(0,H.jsxs)(`button`,{onClick:t,className:`flex items-center gap-1.5 rounded-lg bg-red-500/10 px-3 py-1.5 text-xs text-red-400 transition-all duration-200 hover:bg-red-500/20`,children:[(0,H.jsx)(gi,{className:`h-3.5 w-3.5`}),n(`actions.cancel`)]})]})]})},Ai=new Set([`.git`,`.hg`,`.svn`,`node_modules`,`vendor`,`.venv`,`__pycache__`,`target`,`dist`,`build`,`out`,`.next`,`.nuxt`,`.cache`,`coverage`,`.idea`,`.gitnexus`]);function ji(e){let t=[],n=[],r=0,i=0;for(let a=0;a<e.length;a++){let o=e[a],s=o.webkitRelativePath&&o.webkitRelativePath.length>0?o.webkitRelativePath:o.name;if(s.split(`/`).some(e=>Ai.has(e))){r++;continue}if(o.size>26214400){r++;continue}t.push(o),n.push(s),i+=o.size}return{files:t,manifest:n,droppedCount:r,totalBytes:i}}var Mi=/^https?:\/\/(www\.)?github\.com\/[^/\s]+\/[^/\s]+/i,Ni=/^https?:\/\/[^/\s]+\/[^/\s]+\/[^/\s]+(\/.*)?$/i,Pi=/^https?:\/\/[^/\s]+\/(?:[^/\s]+\/)+_git\/[^/\s]+/i,Fi=navigator.userAgent.toLowerCase().includes(`win`);function Ii(e){return Mi.test(e.trim())}function Li(e){return Ni.test(e.trim())}function Ri(e){return Pi.test(e.trim())}function zi({mode:e,onChange:t}){let{t:n}=f(`onboarding`);return(0,H.jsxs)(`div`,{className:`flex gap-1 rounded-lg bg-elevated p-1`,role:`tablist`,"aria-label":n(`repoAnalyzer.inputType`),children:[(0,H.jsxs)(`button`,{role:`tab`,"aria-selected":e===`github`,onClick:()=>t(`github`),className:`flex flex-1 cursor-pointer items-center justify-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-all duration-150 ${e===`github`?`bg-accent text-white shadow-sm`:`text-text-muted hover:text-text-secondary`} `,children:[(0,H.jsx)(p,{className:`h-3 w-3`}),n(`repoAnalyzer.githubUrl`)]}),(0,H.jsxs)(`button`,{role:`tab`,"aria-selected":e===`gitlab`,onClick:()=>t(`gitlab`),className:`flex flex-1 cursor-pointer items-center justify-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-all duration-150 ${e===`gitlab`?`bg-accent text-white shadow-sm`:`text-text-muted hover:text-text-secondary`} `,children:[(0,H.jsx)(g,{className:`h-3 w-3`}),n(`repoAnalyzer.gitlabUrl`)]}),(0,H.jsxs)(`button`,{role:`tab`,"aria-selected":e===`azure`,onClick:()=>t(`azure`),className:`flex flex-1 cursor-pointer items-center justify-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-all duration-150 ${e===`azure`?`bg-accent text-white shadow-sm`:`text-text-muted hover:text-text-secondary`} `,children:[(0,H.jsx)(i,{className:`h-3 w-3`}),n(`repoAnalyzer.azureDevOpsUrl`)]}),(0,H.jsxs)(`button`,{role:`tab`,"aria-selected":e===`local`,onClick:()=>t(`local`),className:`flex flex-1 cursor-pointer items-center justify-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-all duration-150 ${e===`local`?`bg-accent text-white shadow-sm`:`text-text-muted hover:text-text-secondary`} `,children:[(0,H.jsx)(Or,{className:`h-3 w-3`}),n(`repoAnalyzer.localFolder`)]})]})}function Bi({canSubmit:e,isLoading:t,onClick:n,variant:r}){let{t:i}=f(`onboarding`);return(0,H.jsxs)(`button`,{onClick:n,disabled:!e||t,className:` ${r===`onboarding`?`w-full px-5 py-3.5 text-sm`:`w-full px-4 py-3 text-sm`} flex items-center justify-center gap-2.5 rounded-xl font-medium transition-all duration-200 ${e&&!t?`cursor-pointer bg-accent text-white shadow-glow-soft hover:-translate-y-0.5 hover:bg-accent/90 hover:shadow-glow`:`cursor-not-allowed border border-border-subtle bg-elevated text-text-muted`} `,children:[t?(0,H.jsx)(Vr,{className:`h-4 w-4 animate-spin`}):(0,H.jsx)(ai,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{children:i(t?`repoAnalyzer.starting`:`repoAnalyzer.analyzeRepository`)}),e&&!t&&(0,H.jsx)(pr,{className:`h-3.5 w-3.5`})]})}function Vi({repoName:e}){let{t}=f(`onboarding`);return(0,H.jsxs)(`div`,{className:`flex animate-fade-in flex-col items-center gap-3 py-4`,role:`status`,"aria-live":`polite`,children:[(0,H.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-xl border border-emerald-500/30 bg-emerald-500/15 shadow-[0_0_20px_rgba(16,185,129,0.15)]`,children:(0,H.jsx)(vr,{className:`h-6 w-6 text-emerald-400`})}),(0,H.jsxs)(`div`,{className:`text-center`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-emerald-400`,children:t(`repoAnalyzer.complete`)}),(0,H.jsx)(`p`,{className:`mt-0.5 font-mono text-xs text-text-muted`,children:e})]}),(0,H.jsx)(`p`,{className:`text-xs text-text-secondary`,children:t(`repoAnalyzer.loadingGraph`)})]})}var Hi=({variant:e,onComplete:t,onCancel:n})=>{let{t:r}=f([`common`,`errors`,`onboarding`]),a=(0,P.useId)(),[o,s]=(0,P.useState)(`github`),[c,l]=(0,P.useState)(!1),[u,d]=(0,P.useState)(null),[m,h]=(0,P.useState)(``),[_,v]=(0,P.useState)(``),[y,b]=(0,P.useState)(``),[x,S]=(0,P.useState)(``),[C,w]=(0,P.useState)(``),[T,E]=(0,P.useState)(`input`),[D,O]=(0,P.useState)(null),[k,A]=(0,P.useState)({phase:`queued`,percent:0,message:r(`common:analyzePhases.queued`)}),[j,M]=(0,P.useState)(``),N=(0,P.useRef)(null),F=(0,P.useRef)(null),I=(0,P.useRef)(null),L=(0,P.useRef)(null),R=(0,P.useRef)(null);(0,P.useEffect)(()=>()=>{F.current?.abort(),I.current?.abort(),L.current&&clearTimeout(L.current)},[]);let ee=()=>{I.current?.abort(),I.current=null},te=()=>{ee();let e=new AbortController;return I.current=e,e},ne=e=>{it(e).catch(()=>{})},re=e=>{e!==o&&(ee(),s(e),h(``),v(``),b(``),S(``),w(``),O(null),d(null),l(!1),E(`input`))},z=o===`github`?Ii(m)&&(T===`input`||T===`error`):o===`gitlab`?Li(y)&&(T===`input`||T===`error`):o===`azure`?Ri(x)&&(T===`input`||T===`error`):C.trim().length>1&&(T===`input`||T===`error`),B=async()=>{if(o===`github`&&!Ii(m)){O(r(`errors:invalidGithubUrl`));return}if(o===`gitlab`&&!Li(y)){O(`Please enter a valid GitLab repository URL.`);return}if(o===`azure`&&!Ri(x)){O(r(`errors:invalidAzureDevOpsUrl`));return}if(o===`local`&&C.trim().length<2){O(r(`errors:missingFolderPath`));return}O(null),E(`starting`);let e=te();try{let{jobId:t}=await rt(o===`github`?{url:m.trim(),..._.trim()?{token:_.trim()}:{}}:o===`gitlab`?{url:y.trim()}:o===`azure`?{url:x.trim()}:{path:C.trim()});if(e.signal.aborted)return;let n=o===`github`?m.trim():o===`gitlab`?y.trim():o===`azure`?x.trim():C.trim();ie(t,n)}catch(t){if(e.signal.aborted)return;O(t instanceof Error?t.message:r(`errors:startAnalysisFailed`)),E(`error`)}},ie=(e,n)=>{N.current=e,E(`analyzing`);let i=at(e,e=>A(e),e=>{let i=e.repoName??(n?n.split(/[/\\]/).filter(Boolean).at(-1):void 0)??r(`onboarding:repoAnalyzer.defaultRepoName`),a=e.repoPath??i;M(i),v(``),E(`done`),F.current=null,L.current=setTimeout(()=>{L.current=null,t(a)},1200)},e=>{O(e||r(`errors:analysisFailed`)),E(`error`)});F.current=i},ae=async e=>{if(c||se)return;let{files:t,manifest:n,droppedCount:i}=ji(e);if(t.length===0){O(r(`onboarding:repoAnalyzer.upload.empty`));return}O(null),d({count:t.length,dropped:i}),l(!0),E(`starting`);let a=n[0]?.split(`/`)[0]??null,o=te();try{let{jobId:e}=await nt(t,n,o.signal);if(o.signal.aborted){ne(e);return}l(!1),ie(e,a)}catch(e){if(o.signal.aborted)return;l(!1),O(e instanceof Error?e.message:r(`errors:startAnalysisFailed`)),E(`error`)}},oe=async()=>{if(F.current?.abort(),F.current=null,ee(),N.current){try{await it(N.current)}catch{}N.current=null}v(``),E(`input`),A({phase:`queued`,percent:0,message:r(`common:analyzePhases.queued`)}),l(!1),d(null)},se=T===`starting`,ce=T!==`analyzing`&&T!==`done`,le=Fi;return(0,H.jsxs)(`div`,{className:`space-y-4`,children:[ce&&(0,H.jsx)(zi,{mode:o,onChange:re}),ce&&o===`github`&&(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{htmlFor:a,className:`block text-xs font-medium tracking-wider text-text-secondary uppercase`,children:r(`onboarding:repoAnalyzer.githubRepositoryUrl`)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border bg-void px-4 py-3.5 transition-all duration-200 ${D&&T===`error`?`border-red-500/50`:Ii(m)?`border-accent/50 shadow-[0_0_0_3px_rgba(124,58,237,0.08)]`:`border-border-default focus-within:border-accent/40`} `,children:[(0,H.jsx)(p,{className:`h-4 w-4 shrink-0 text-text-muted`}),(0,H.jsx)(`input`,{id:a,type:`url`,value:m,onChange:e=>{h(e.target.value),D&&O(null)},onKeyDown:e=>{e.key===`Enter`&&z&&!se&&(e.preventDefault(),B())},disabled:se,placeholder:`https://github.com/owner/repo`,autoComplete:`url`,spellCheck:!1,className:`flex-1 border-none bg-transparent font-mono text-sm text-text-primary outline-none placeholder:text-text-muted disabled:opacity-50`}),m.length>10&&(0,H.jsx)(`div`,{className:`shrink-0`,children:Ii(m)?(0,H.jsx)(vr,{className:`h-3.5 w-3.5 text-emerald-400`}):(0,H.jsx)(Sr,{className:`h-3.5 w-3.5 text-text-muted`})})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5 pt-1`,children:[(0,H.jsx)(`label`,{htmlFor:`${a}-token`,className:`block text-xs font-medium tracking-wider text-text-secondary uppercase`,children:r(`onboarding:repoAnalyzer.githubTokenLabel`)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-border-default bg-void px-4 py-3 transition-all duration-200 focus-within:border-accent/40`,children:[(0,H.jsx)(Ir,{className:`h-4 w-4 shrink-0 text-text-muted`}),(0,H.jsx)(`input`,{id:`${a}-token`,type:`password`,value:_,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key===`Enter`&&z&&!se&&(e.preventDefault(),B())},disabled:se,placeholder:r(`onboarding:repoAnalyzer.githubTokenPlaceholder`),autoComplete:`off`,spellCheck:!1,className:`flex-1 border-none bg-transparent font-mono text-sm text-text-primary outline-none placeholder:text-text-muted disabled:opacity-50`})]}),(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:r(`onboarding:repoAnalyzer.githubTokenHelp`)})]})]}),ce&&o===`gitlab`&&(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{htmlFor:a,className:`block text-xs font-medium tracking-wider text-text-secondary uppercase`,children:r(`onboarding:repoAnalyzer.gitlabRepositoryUrl`)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border bg-void px-4 py-3.5 transition-all duration-200 ${D&&T===`error`?`border-red-500/50`:Li(y)?`border-accent/50 shadow-[0_0_0_3px_rgba(124,58,237,0.08)]`:`border-border-default focus-within:border-accent/40`} `,children:[(0,H.jsx)(g,{className:`h-4 w-4 shrink-0 text-text-muted`}),(0,H.jsx)(`input`,{id:a,type:`url`,value:y,onChange:e=>{b(e.target.value),D&&O(null)},onKeyDown:e=>{e.key===`Enter`&&z&&!se&&(e.preventDefault(),B())},disabled:se,placeholder:`https://gitlab.com/owner/repo`,autoComplete:`url`,spellCheck:!1,className:`flex-1 border-none bg-transparent font-mono text-sm text-text-primary outline-none placeholder:text-text-muted disabled:opacity-50`}),y.length>10&&(0,H.jsx)(`div`,{className:`shrink-0`,children:Li(y)?(0,H.jsx)(vr,{className:`h-3.5 w-3.5 text-emerald-400`}):(0,H.jsx)(Sr,{className:`h-3.5 w-3.5 text-text-muted`})})]}),(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:r(`onboarding:repoAnalyzer.gitlabSupported`)})]}),ce&&o===`azure`&&(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{htmlFor:a,className:`block text-xs font-medium tracking-wider text-text-secondary uppercase`,children:r(`onboarding:repoAnalyzer.azureDevOpsRepositoryUrl`)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border bg-void px-4 py-3.5 transition-all duration-200 ${D&&T===`error`?`border-red-500/50`:Ri(x)?`border-accent/50 shadow-[0_0_0_3px_rgba(124,58,237,0.08)]`:`border-border-default focus-within:border-accent/40`} `,children:[(0,H.jsx)(i,{className:`h-4 w-4 shrink-0 text-text-muted`}),(0,H.jsx)(`input`,{id:a,type:`url`,value:x,onChange:e=>{S(e.target.value),D&&O(null)},onKeyDown:e=>{e.key===`Enter`&&z&&!se&&(e.preventDefault(),B())},disabled:se,placeholder:`http://azuredevops.example.com/Collection/Project/_git/Repo`,autoComplete:`url`,spellCheck:!1,className:`flex-1 border-none bg-transparent font-mono text-sm text-text-primary outline-none placeholder:text-text-muted disabled:opacity-50`}),x.length>10&&(0,H.jsx)(`div`,{className:`shrink-0`,children:Ri(x)?(0,H.jsx)(vr,{className:`h-3.5 w-3.5 text-emerald-400`}):(0,H.jsx)(Sr,{className:`h-3.5 w-3.5 text-text-muted`})})]}),(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:r(`onboarding:repoAnalyzer.azureDevOpsSupported`)})]}),ce&&o===`local`&&(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{htmlFor:`${a}-local`,className:`block text-xs font-medium tracking-wider text-text-secondary uppercase`,children:r(`onboarding:repoAnalyzer.localFolderPath`)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border bg-void px-4 py-3.5 transition-all duration-200 ${D&&T===`error`?`border-red-500/50`:C.trim().length>1?`border-accent/50 shadow-[0_0_0_3px_rgba(124,58,237,0.08)]`:`border-border-default focus-within:border-accent/40`} `,children:[(0,H.jsx)(Or,{className:`h-4 w-4 shrink-0 text-text-muted`}),(0,H.jsx)(`input`,{id:`${a}-local`,type:`text`,value:C,onChange:e=>{w(e.target.value),D&&O(null)},onKeyDown:e=>{e.key===`Enter`&&z&&!se&&(e.preventDefault(),B())},disabled:se,placeholder:le?`C:\\Users\\you\\project`:`/home/you/project`,autoComplete:`off`,spellCheck:!1,className:`flex-1 border-none bg-transparent font-mono text-sm text-text-primary outline-none placeholder:text-text-muted disabled:opacity-50`}),C.trim().length>1&&(0,H.jsx)(vr,{className:`h-3.5 w-3.5 shrink-0 text-emerald-400`})]}),(0,H.jsx)(`input`,{ref:R,type:`file`,webkitdirectory:``,multiple:!0,className:`hidden`,"data-testid":`folder-upload-input`,onChange:e=>{e.target.files&&e.target.files.length>0&&ae(e.target.files),e.target.value=``}}),(0,H.jsxs)(`button`,{type:`button`,"data-testid":`upload-folder`,onClick:()=>R.current?.click(),disabled:se,className:`flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg border border-border-subtle bg-elevated px-3 py-2 text-xs font-medium text-text-secondary transition-all duration-150 hover:bg-hover hover:text-text-primary disabled:opacity-50`,children:[(0,H.jsx)(Or,{className:`h-3.5 w-3.5`}),r(`onboarding:repoAnalyzer.upload.button`)]}),c&&(0,H.jsxs)(`div`,{role:`status`,"aria-busy":`true`,"data-testid":`upload-progress`,className:`space-y-1`,children:[(0,H.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-elevated`,children:(0,H.jsx)(`div`,{className:`h-full w-1/3 animate-pulse rounded-full bg-accent`})}),(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:r(`onboarding:repoAnalyzer.upload.uploading`)})]}),u&&!c&&T!==`error`&&(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,"data-testid":`upload-summary`,children:r(`onboarding:repoAnalyzer.upload.selected`,{fileCount:u.count,dropped:u.dropped})})]}),(T===`error`||T===`input`&&D)&&D&&(0,H.jsxs)(`p`,{className:`flex animate-fade-in items-center gap-1.5 text-xs text-red-400`,children:[(0,H.jsx)(Sr,{className:`h-3 w-3 shrink-0`}),D]}),T===`analyzing`&&(0,H.jsx)(`div`,{className:`animate-slide-up`,children:(0,H.jsx)(ki,{progress:k,onCancel:oe})}),T===`done`&&(0,H.jsx)(Vi,{repoName:j}),(T===`input`||T===`starting`)&&(0,H.jsx)(Bi,{canSubmit:z,isLoading:se,onClick:B,variant:e}),T===`error`&&(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`button`,{onClick:()=>{O(null),E(`input`)},className:`flex-1 cursor-pointer rounded-xl border border-border-subtle bg-elevated px-4 py-2.5 text-sm text-text-secondary transition-all duration-200 hover:bg-hover hover:text-text-primary`,children:r(`common:actions.tryAgain`)}),n&&(0,H.jsx)(`button`,{onClick:n,className:`cursor-pointer px-4 py-2.5 text-sm text-text-muted transition-colors hover:text-text-secondary`,children:r(`common:actions.dismiss`)})]}),T===`analyzing`&&e===`sheet`&&n&&(0,H.jsx)(`button`,{onClick:n,className:`w-full cursor-pointer py-1 text-xs text-text-muted transition-colors hover:text-text-secondary`,children:r(`onboarding:repoAnalyzer.hideBackground`)})]})},Ui=({onComplete:e})=>{let{t}=f(`onboarding`);return(0,H.jsxs)(`div`,{className:`relative animate-fade-in overflow-hidden rounded-3xl border border-border-default bg-surface p-7`,children:[(0,H.jsx)(`div`,{className:`pointer-events-none absolute -top-28 -right-28 h-72 w-72 rounded-full bg-accent/6 blur-3xl`}),(0,H.jsx)(`div`,{className:`pointer-events-none absolute -bottom-24 -left-24 h-56 w-56 rounded-full bg-node-function/6 blur-3xl`}),(0,H.jsx)(`div`,{className:`relative mb-6`,children:(0,H.jsxs)(`div`,{className:`text-center`,children:[(0,H.jsxs)(`div`,{className:`mb-2 inline-flex items-center gap-1.5`,children:[(0,H.jsx)(ai,{className:`h-3.5 w-3.5 text-accent/70`}),(0,H.jsx)(`span`,{className:`text-[11px] font-medium tracking-widest text-accent/80 uppercase`,children:`GitNexus`})]}),(0,H.jsx)(`div`,{className:`mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-2xl border border-accent/30 bg-gradient-to-br from-accent/20 to-accent-dim/10 shadow-glow-soft`,children:(0,H.jsx)(jr,{className:`h-7 w-7 text-accent`})}),(0,H.jsx)(`h2`,{className:`text-lg leading-snug font-semibold text-text-primary`,children:t(`analyzeFirst.title`)}),(0,H.jsx)(`p`,{className:`mx-auto mt-1.5 max-w-xs text-sm leading-relaxed text-text-secondary`,children:t(`analyzeFirst.description`)})]})}),(0,H.jsx)(`div`,{className:`relative`,children:(0,H.jsx)(Hi,{variant:`onboarding`,onComplete:e})}),(0,H.jsx)(`p`,{className:`mt-5 text-center text-[11px] leading-relaxed text-text-muted`,children:t(`analyzeFirst.footer`)})]})};function Wi(e,t){let n=new Date(e),r=new Date().getTime()-n.getTime(),i=Math.floor(r/6e4);if(i<1)return t(`onboarding:landing.time.justNow`);if(i<60)return t(`onboarding:landing.time.minutesAgo`,{count:i});let a=Math.floor(i/60);if(a<24)return t(`onboarding:landing.time.hoursAgo`,{count:a});let o=Math.floor(a/24);return o<30?t(`onboarding:landing.time.daysAgo`,{count:o}):n.toLocaleDateString()}function Gi({repo:e,onClick:t}){let{t:n}=f([`common`,`onboarding`]),r=e.stats;return(0,H.jsxs)(`button`,{onClick:t,"data-testid":`landing-repo-card`,className:`group w-full cursor-pointer rounded-xl border border-border-default bg-elevated p-4 text-left transition-all duration-200 hover:border-accent/40 hover:bg-hover hover:shadow-glow-soft`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(jr,{className:`h-4 w-4 shrink-0 text-accent`}),(0,H.jsx)(`h3`,{className:`truncate text-sm font-semibold text-text-primary transition-colors group-hover:text-accent`,children:e.name})]}),e.indexedAt&&(0,H.jsx)(`p`,{className:`mt-1 pl-6 text-xs text-text-muted`,children:n(`onboarding:landing.indexed`,{time:Wi(e.indexedAt,n)})})]}),(0,H.jsx)(pr,{className:`h-4 w-4 shrink-0 text-text-muted opacity-0 transition-all duration-200 group-hover:translate-x-0.5 group-hover:text-accent group-hover:opacity-100`})]}),r&&(r.files||r.nodes)&&(0,H.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 pl-6`,children:[r.files!=null&&(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-void px-2 py-0.5 text-[11px] text-text-muted`,children:[(0,H.jsx)(Dr,{className:`h-3 w-3`}),` `,n(`common:counts.files`,{count:r.files})]}),r.nodes!=null&&(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-void px-2 py-0.5 text-[11px] text-text-muted`,children:[(0,H.jsx)(Lr,{className:`h-3 w-3`}),` `,n(`common:counts.symbols`,{count:r.nodes})]}),r.processes!=null&&r.processes>0&&(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-void px-2 py-0.5 text-[11px] text-text-muted`,children:[(0,H.jsx)(ai,{className:`h-3 w-3`}),` `,n(`common:counts.flows`,{count:r.processes})]})]})]})}var Ki=({repos:e,onSelectRepo:t,onAnalyzeComplete:n})=>{let{t:r}=f(`onboarding`);return(0,H.jsxs)(`div`,{className:`relative animate-fade-in overflow-hidden rounded-3xl border border-border-default bg-surface p-7`,children:[(0,H.jsx)(`div`,{className:`pointer-events-none absolute -top-28 -right-28 h-72 w-72 rounded-full bg-accent/6 blur-3xl`}),(0,H.jsx)(`div`,{className:`pointer-events-none absolute -bottom-24 -left-24 h-56 w-56 rounded-full bg-node-function/6 blur-3xl`}),(0,H.jsx)(`div`,{className:`relative mb-6`,children:(0,H.jsxs)(`div`,{className:`text-center`,children:[(0,H.jsxs)(`div`,{className:`mb-2 inline-flex items-center gap-1.5`,children:[(0,H.jsx)(ai,{className:`h-3.5 w-3.5 text-accent/70`}),(0,H.jsx)(`span`,{className:`text-[11px] font-medium tracking-widest text-accent/80 uppercase`,children:`GitNexus`})]}),(0,H.jsx)(`h2`,{className:`text-lg leading-snug font-semibold text-text-primary`,children:r(`landing.chooseRepository`)}),(0,H.jsx)(`p`,{className:`mx-auto mt-1.5 max-w-xs text-sm leading-relaxed text-text-secondary`,children:r(`landing.description`)})]})}),(0,H.jsx)(`div`,{className:`relative mb-5 space-y-2`,children:e.map(e=>(0,H.jsx)(Gi,{repo:e,onClick:()=>t(Ae(e))},Ae(e)))}),(0,H.jsxs)(`div`,{className:`mb-5 flex items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`h-px flex-1 bg-border-subtle`}),(0,H.jsx)(`span`,{className:`text-[11px] tracking-widest text-text-muted uppercase`,children:r(`landing.orAnalyzeNew`)}),(0,H.jsx)(`div`,{className:`h-px flex-1 bg-border-subtle`})]}),(0,H.jsx)(`div`,{className:`relative`,children:(0,H.jsx)(Hi,{variant:`onboarding`,onComplete:n})}),(0,H.jsx)(`p`,{className:`mt-5 text-center text-[11px] leading-relaxed text-text-muted`,children:r(`landing.footer`)})]})};function qi(e,t){if(e instanceof je){let n=e.retryAfterMs?Math.ceil(e.retryAfterMs/1e3):void 0,r=e.message||t(`errors:unknown`);switch(e.code){case`network`:return t(`errors:backend.network`,{defaultValue:r});case`timeout`:return t(`errors:backend.timeout`,{defaultValue:r});case`rate_limited`:return t(`errors:backend.rateLimited`,{seconds:n,defaultValue:r});case`not_found`:return t(`errors:backend.notFound`,{defaultValue:r});case`origin_blocked`:return t(`errors:backend.originBlocked`,{defaultValue:r});case`client`:return t(`errors:backend.client`,{message:e.message,defaultValue:r});case`server`:return t(`errors:backend.server`,{message:e.message,defaultValue:r});default:return r}}return e instanceof Error?e.message:t(`errors:unknown`)}function Ji({activeKey:e,children:t}){let[n,r]=(0,P.useState)(e),[i,a]=(0,P.useState)(!1),o=(0,P.useRef)(t),s=(0,P.useRef)(null);return!i&&e===n&&(o.current=t),(0,P.useEffect)(()=>(e!==n&&(a(!0),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{o.current=null,r(e),a(!1)},300)),()=>{s.current&&clearTimeout(s.current)}),[e,n]),(0,H.jsx)(`div`,{className:`transition-[opacity,transform] duration-300 ease-out`,style:{opacity:+!i,transform:i?`scale(0.97) translateY(8px)`:`scale(1) translateY(0)`},children:i?o.current:t})}function Yi(){let{t:e}=f(`onboarding`);return(0,H.jsxs)(`div`,{className:`relative overflow-hidden rounded-3xl border border-emerald-500/20 bg-surface p-7`,role:`status`,"aria-live":`polite`,children:[(0,H.jsx)(`div`,{className:`pointer-events-none absolute -top-20 left-1/2 h-64 w-64 -translate-x-1/2 rounded-full bg-emerald-500/8 blur-3xl`}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`div`,{className:`mx-auto mb-5 flex h-16 w-16 items-center justify-center rounded-2xl border border-emerald-500/30 bg-gradient-to-br from-emerald-500/20 to-emerald-600/10 shadow-[0_0_30px_rgba(16,185,129,0.15)]`,children:(0,H.jsx)(vr,{className:`h-8 w-8 text-emerald-400`})}),(0,H.jsx)(`h2`,{className:`mb-2 text-center text-lg font-semibold text-emerald-400`,children:e(`success.title`)}),(0,H.jsx)(`p`,{className:`text-center text-sm leading-relaxed text-text-secondary`,children:e(`success.description`)}),(0,H.jsx)(`div`,{className:`mt-6 flex items-center justify-center gap-2`,children:(0,H.jsx)(`div`,{className:`flex gap-1`,children:[0,1,2].map(e=>(0,H.jsx)(`div`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-emerald-400/60`,style:{animationDelay:`${e*200}ms`}},e))})})]})]})}function Xi({message:e}){let{t}=f([`common`,`onboarding`]);return(0,H.jsxs)(`div`,{className:`relative overflow-hidden rounded-3xl border border-accent/20 bg-surface p-7`,role:`status`,"aria-live":`polite`,children:[(0,H.jsx)(`div`,{className:`pointer-events-none absolute -top-20 left-1/2 h-64 w-64 -translate-x-1/2 rounded-full bg-accent/8 blur-3xl`}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`div`,{className:`mx-auto mb-5 flex h-16 w-16 items-center justify-center rounded-2xl border border-accent/30 bg-gradient-to-br from-accent/20 to-accent-dim/10 shadow-glow-soft`,children:(0,H.jsx)(Vr,{className:`h-8 w-8 animate-spin text-accent`})}),(0,H.jsx)(`h2`,{className:`mb-2 text-center text-lg font-semibold text-text-primary`,children:e||t(`common:progress.connectingShort`)}),(0,H.jsx)(`p`,{className:`text-center text-sm leading-relaxed text-text-secondary`,children:t(`onboarding:loading.largeRepoHint`)}),(0,H.jsx)(`div`,{className:`mt-5 flex items-center justify-center`,children:(0,H.jsx)(ai,{className:`h-4 w-4 text-accent/30`})})]})]})}var Zi=({onServerConnect:e})=>{let{t}=f([`common`,`errors`]),[n,r]=(0,P.useState)(null),{isConnected:i,isProbing:a,startPolling:o,stopPolling:s,isPolling:c,backendUrl:l}=yi(),[u,d]=(0,P.useState)(!1),p=(0,P.useRef)(!1),m=(0,P.useRef)(null),[h,g]=(0,P.useState)(`onboarding`),[_,v]=(0,P.useState)(``),y=(0,P.useRef)(null),[b,x]=(0,P.useState)([]),S=async()=>{g(`loading`),v(t(`common:progress.connectingShort`)),r(null);try{let e=await qe();if(e.length===0){g(`analyze`),p.current=!1;return}x(e),g(`landing`)}catch(e){if(e.name===`AbortError`)return;r(qi(e,t)),g(`onboarding`)}},C=(0,P.useRef)(S);C.current=S;let w=n=>{p.current=!0,g(`loading`),v(t(`common:progress.loadingGraph`)),r(null),(async()=>{let i=new AbortController;y.current=i;try{let r=await ct(l,(e,n,r)=>{if(e===`validating`)v(t(`common:progress.validatingServerEllipsis`));else if(e===`downloading`){let e=r?Math.round(n/r*100):null,i=(n/(1024*1024)).toFixed(1);v(e?t(`common:progress.downloadingWithPercent`,{percent:e}):t(`common:progress.downloadingMb`,{mb:i}))}else e===`extracting`&&v(t(`common:progress.processingGraph`))},i.signal,n);e&&await e(r,l)}catch(e){if(e.name===`AbortError`)return;r(qi(e,t)),g(b.length>0?`landing`:`analyze`)}finally{y.current=null}})()};(0,P.useEffect)(()=>{!a&&!u&&d(!0)},[a,u]),(0,P.useEffect)(()=>{u&&!i&&!c&&!p.current&&o()},[u,i,c,o]),(0,P.useEffect)(()=>{i&&!p.current&&(p.current=!0,s(),g(`success`),m.current=setTimeout(()=>{m.current=null,C.current()},1200)),!i&&p.current&&!a&&(p.current=!1,m.current!==null&&(clearTimeout(m.current),m.current=null),g(`onboarding`),r(null))},[i,a,s]),(0,P.useEffect)(()=>()=>{m.current!==null&&clearTimeout(m.current),y.current?.abort()},[]);let T=u?h:null;return(0,H.jsxs)(`div`,{className:`flex min-h-screen items-center justify-center bg-void p-8`,children:[(0,H.jsxs)(`div`,{className:`pointer-events-none fixed inset-0`,children:[(0,H.jsx)(`div`,{className:`absolute top-1/4 left-1/4 h-96 w-96 rounded-full bg-accent/10 blur-3xl`}),(0,H.jsx)(`div`,{className:`absolute right-1/4 bottom-1/4 h-96 w-96 rounded-full bg-node-interface/10 blur-3xl`})]}),(0,H.jsxs)(`div`,{className:`relative w-full max-w-lg`,children:[n&&(0,H.jsx)(`div`,{className:`mb-4 animate-fade-in rounded-xl border border-red-500/30 bg-red-500/10 p-3 text-center text-sm text-red-400`,children:n}),T&&(0,H.jsxs)(Ji,{activeKey:T,children:[T===`onboarding`&&(0,H.jsx)(Ti,{isPolling:c}),T===`analyze`&&(0,H.jsx)(Ui,{onComplete:w}),T===`landing`&&(0,H.jsx)(Ki,{repos:b,onSelectRepo:w,onAnalyzeComplete:w}),T===`success`&&(0,H.jsx)(Yi,{}),T===`loading`&&(0,H.jsx)(Xi,{message:_})]})]})]})},Qi=({progress:e})=>{let{t}=f([`common`,`graph`]),n=Di(e.message,t),r=Di(e.detail,t);return(0,H.jsxs)(`div`,{className:`fixed inset-0 z-50 flex flex-col items-center justify-center bg-void`,children:[(0,H.jsxs)(`div`,{className:`pointer-events-none absolute inset-0`,children:[(0,H.jsx)(`div`,{className:`absolute top-1/3 left-1/3 h-96 w-96 animate-pulse rounded-full bg-accent/10 blur-3xl`}),(0,H.jsx)(`div`,{className:`absolute right-1/3 bottom-1/3 h-96 w-96 animate-pulse rounded-full bg-node-interface/10 blur-3xl`})]}),(0,H.jsxs)(`div`,{className:`relative mb-10`,children:[(0,H.jsx)(`div`,{className:`h-28 w-28 animate-pulse-glow rounded-full bg-gradient-to-br from-accent to-node-interface`}),(0,H.jsx)(`div`,{className:`absolute inset-0 h-28 w-28 rounded-full bg-gradient-to-br from-accent to-node-interface opacity-50 blur-xl`})]}),(0,H.jsx)(`div`,{className:`mb-4 w-80`,children:(0,H.jsx)(`div`,{className:`h-1.5 overflow-hidden rounded-full bg-elevated`,children:(0,H.jsx)(`div`,{className:`h-full rounded-full bg-gradient-to-r from-accent to-node-interface transition-all duration-300 ease-out`,style:{width:`${e.percent}%`}})})}),(0,H.jsxs)(`div`,{className:`text-center`,children:[(0,H.jsxs)(`p`,{className:`mb-1 font-mono text-sm text-text-secondary`,children:[n,(0,H.jsx)(`span`,{className:`animate-pulse`,children:`|`})]}),e.detail&&(0,H.jsx)(`p`,{className:`max-w-md truncate font-mono text-xs text-text-muted`,children:r})]}),e.stats&&(0,H.jsxs)(`div`,{className:`mt-8 flex items-center gap-6 text-xs text-text-muted`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-node-file`}),(0,H.jsx)(`span`,{children:t(`graph:loading.filesProgress`,{processed:e.stats.filesProcessed,total:e.stats.totalFiles})})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-node-function`}),(0,H.jsx)(`span`,{children:t(`common:counts.nodes`,{count:e.stats.nodesCreated})})]})]}),(0,H.jsxs)(`p`,{className:`mt-4 font-mono text-3xl font-semibold text-text-primary`,children:[e.percent,`%`]})]})},$i=({isOpen:e,onClose:t,onUseCPU:n,onSkip:r,nodeCount:i})=>{let{t:a}=f(`graph`),[o,s]=(0,P.useState)(!0),[c,l]=(0,P.useState)(!1);if((0,P.useEffect)(()=>{e?requestAnimationFrame(()=>l(!0)):l(!1)},[e]),!e)return null;let u=Math.ceil(i*50/6e4),d=i<200;return(0,H.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,H.jsx)(`div`,{className:`absolute inset-0 bg-black/60 backdrop-blur-sm transition-opacity duration-200 ${c?`opacity-100`:`opacity-0`}`,onClick:t}),(0,H.jsxs)(`div`,{className:`relative mx-4 w-full max-w-md overflow-hidden rounded-2xl border border-border-subtle bg-surface shadow-2xl transition-all duration-200 ${c?`scale-100 opacity-100`:`scale-95 opacity-0`}`,children:[(0,H.jsxs)(`div`,{className:`relative border-b border-border-subtle bg-gradient-to-r from-amber-500/20 to-orange-500/20 px-6 py-5`,children:[(0,H.jsx)(`button`,{onClick:t,className:`absolute top-4 right-4 p-1 text-text-muted transition-colors hover:text-text-primary`,children:(0,H.jsx)(gi,{className:`h-5 w-5`})}),(0,H.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,H.jsx)(`div`,{className:`text-5xl ${o?`animate-bounce`:``}`,onAnimationEnd:()=>s(!1),onClick:()=>s(!0),children:`🤔`}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{className:`text-lg font-semibold text-text-primary`,children:a(`embedding.fallback.title`)}),(0,H.jsx)(`p`,{className:`mt-0.5 text-sm text-text-muted`,children:a(`embedding.fallback.subtitle`)})]})]})]}),(0,H.jsxs)(`div`,{className:`space-y-4 px-6 py-5`,children:[(0,H.jsx)(`p`,{className:`text-sm leading-relaxed text-text-secondary`,children:a(`embedding.fallback.description`)}),(0,H.jsxs)(`div`,{className:`rounded-lg border border-border-subtle bg-elevated/50 p-4`,children:[(0,H.jsx)(`p`,{className:`text-sm text-text-secondary`,children:(0,H.jsx)(`span`,{className:`font-medium text-text-primary`,children:a(`embedding.fallback.options`)})}),(0,H.jsxs)(`ul`,{className:`mt-2 space-y-1.5 text-sm text-text-muted`,children:[(0,H.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,H.jsx)(ii,{className:`mt-0.5 h-4 w-4 flex-shrink-0 text-amber-400`}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{className:`text-text-secondary`,children:a(`embedding.fallback.useCpu`)}),` `,`—`,` `,a(d?`embedding.fallback.useCpuDescriptionSmall`:`embedding.fallback.useCpuDescriptionLarge`),i>0&&(0,H.jsxs)(`span`,{className:`text-text-muted`,children:[` `,a(`embedding.fallback.estimated`,{minutes:u,count:i})]})]})]}),(0,H.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,H.jsx)(ri,{className:`mt-0.5 h-4 w-4 flex-shrink-0 text-blue-400`}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{className:`text-text-secondary`,children:a(`embedding.fallback.skipIt`)}),` `,`— `,a(`embedding.fallback.skipDescription`)]})]})]})]}),d&&(0,H.jsxs)(`p`,{className:`flex items-center gap-1.5 rounded-lg bg-node-function/10 px-3 py-2 text-xs text-node-function`,children:[(0,H.jsx)(Zr,{className:`h-3.5 w-3.5`}),a(`embedding.fallback.smallCodebase`)]}),(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:a(`embedding.fallback.tip`)})]}),(0,H.jsxs)(`div`,{className:`flex gap-3 border-t border-border-subtle bg-elevated/30 px-6 py-4`,children:[(0,H.jsxs)(`button`,{onClick:r,className:`flex flex-1 items-center justify-center gap-2 rounded-lg border border-border-subtle bg-surface px-4 py-2.5 text-sm font-medium text-text-secondary transition-all hover:bg-hover hover:text-text-primary`,children:[(0,H.jsx)(ri,{className:`h-4 w-4`}),a(`embedding.fallback.skipEmbeddings`)]}),(0,H.jsxs)(`button`,{onClick:n,className:`flex flex-1 items-center justify-center gap-2 rounded-lg px-4 py-2.5 text-sm font-medium transition-all ${d?`bg-node-function text-white hover:bg-node-function/90`:`border border-amber-500/30 bg-amber-500/20 text-amber-300 hover:bg-amber-500/30`}`,children:[(0,H.jsx)(ii,{className:`h-4 w-4`}),a(d?`embedding.fallback.useCpuRecommended`:`embedding.fallback.useCpuSlow`)]})]})]})]})},ea=()=>{let{t:e}=f(`graph`),{embeddingStatus:t,embeddingProgress:n,startEmbeddings:r,graph:i,viewMode:a,serverBaseUrl:o}=dr(),[s,c]=(0,P.useState)(!1);if(a!==`exploring`||!i||o)return null;let l=i.nodes.length,u=async e=>{try{await r()}catch(e){e?.name===`WebGPUNotAvailableError`||e?.message?.includes(`WebGPU not available`)?c(!0):console.error(`Embedding failed:`,e)}},d=(0,H.jsx)($i,{isOpen:s,onClose:()=>c(!1),onUseCPU:()=>{c(!1),u(`wasm`)},onSkip:()=>{c(!1)},nodeCount:l});if(t===`idle`)return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,H.jsxs)(`button`,{onClick:()=>u(),className:`group flex items-center gap-2 rounded-lg border border-border-subtle bg-surface px-3 py-1.5 text-sm text-text-secondary transition-all hover:border-accent/50 hover:bg-hover hover:text-text-primary`,title:e(`embedding.generateTitle`),children:[(0,H.jsx)(_r,{className:`h-4 w-4 text-node-interface transition-colors group-hover:text-accent`}),(0,H.jsx)(`span`,{className:`hidden sm:inline`,children:e(`embedding.enable`)}),(0,H.jsx)(_i,{className:`h-3 w-3 text-text-muted`})]})}),d]});if(t===`loading`){let t=n?.percent??0;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-lg border border-accent/30 bg-surface px-3 py-1.5 text-sm`,children:[(0,H.jsx)(Vr,{className:`h-4 w-4 animate-spin text-accent`}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,H.jsx)(`span`,{className:`text-xs text-text-secondary`,children:e(`embedding.loadingModel`)}),(0,H.jsx)(`div`,{className:`h-1 w-24 overflow-hidden rounded-full bg-elevated`,children:(0,H.jsx)(`div`,{className:`h-full rounded-full bg-gradient-to-r from-accent to-node-interface transition-all duration-300`,style:{width:`${t}%`}})})]})]}),d]})}if(t===`embedding`){let t=n?.percent??0;return(0,H.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-lg border border-node-function/30 bg-surface px-3 py-1.5 text-sm`,children:[(0,H.jsx)(Vr,{className:`h-4 w-4 animate-spin text-node-function`}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,H.jsx)(`span`,{className:`text-xs text-text-secondary`,children:e(`embedding.embeddingNodes`,{processed:0,total:0})}),(0,H.jsx)(`div`,{className:`h-1 w-24 overflow-hidden rounded-full bg-elevated`,children:(0,H.jsx)(`div`,{className:`h-full rounded-full bg-gradient-to-r from-node-function to-accent transition-all duration-300`,style:{width:`${t}%`}})})]})]})}return t===`indexing`?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-node-interface/30 bg-surface px-3 py-1.5 text-sm text-text-secondary`,children:[(0,H.jsx)(Vr,{className:`h-4 w-4 animate-spin text-node-interface`}),(0,H.jsx)(`span`,{className:`text-xs`,children:e(`embedding.creatingIndex`)})]}):t===`ready`?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-node-function/30 bg-node-function/10 px-3 py-1.5 text-sm text-node-function`,title:e(`embedding.readyTitle`),children:[(0,H.jsx)(vr,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`text-xs font-medium`,children:e(`embedding.ready`)})]}):t===`error`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`button`,{onClick:()=>u(),className:`flex items-center gap-2 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-1.5 text-sm text-red-400 transition-colors hover:bg-red-500/20`,title:e(`embedding.errorTitle`),children:[(0,H.jsx)(Sr,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`text-xs`,children:e(`embedding.failedRetry`)})]}),d]}):null},ta=()=>{let{t:e,i18n:t}=f(`header`),n=t.resolvedLanguage||t.language,r=An.find(e=>e.code.toLowerCase()===n.toLowerCase())??An[0],i=e=>{t.changeLanguage(e)};return(0,H.jsxs)(`label`,{className:`flex h-9 items-center gap-1.5 rounded-md border border-border-subtle bg-surface px-2 text-text-secondary transition-colors hover:border-border-default hover:bg-hover hover:text-text-primary`,title:e(`selectLanguage`),children:[(0,H.jsx)(Mr,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`sr-only`,children:e(`language`)}),(0,H.jsx)(`select`,{"data-testid":`language-switcher`,value:r.code,"aria-label":e(`selectLanguage`),onChange:e=>i(e.target.value),className:`cursor-pointer border-none bg-transparent text-xs font-medium outline-none`,children:An.map(e=>(0,H.jsx)(`option`,{value:e.code,className:`bg-surface text-text-primary`,children:e.nativeName},e.code))})]})},na={Folder:`#6366f1`,File:`#3b82f6`,Function:`#10b981`,Class:`#f59e0b`,Method:`#14b8a6`,Interface:`#ec4899`,Variable:`#64748b`,Import:`#475569`,Type:`#a78bfa`},ra=({onFocusNode:e,availableRepos:t=[],onSwitchRepo:n,onAnalyzeComplete:r,onReposChanged:i})=>{let{t:a}=f([`common`,`header`,`errors`]),{projectName:o,currentRepo:s,graph:c,graphMode:l,openChatPanel:u,isRightPanelOpen:d,rightPanelTab:m,setSettingsPanelOpen:h,setHelpDialogBoxOpen:g}=dr(),[_,v]=(0,P.useState)(``),[y,b]=(0,P.useState)(``),[x,S]=(0,P.useState)(!1),[C,w]=(0,P.useState)(!1),[T,E]=(0,P.useState)(null),[D,O]=(0,P.useState)(null),[k,A]=(0,P.useState)(null),j=(0,P.useRef)(null),M=(0,P.useRef)(null),[N,F]=(0,P.useState)(!1),[I,L]=(0,P.useState)(0),R=(0,P.useRef)(null),ee=(0,P.useRef)(null),te=c?.nodes.length??0,ne=c?.relationships.length??0,re=(0,P.useMemo)(()=>{if(!c||!_.trim())return[];let e=_.toLowerCase();return c.nodes.filter(t=>t.properties.name.toLowerCase().includes(e)).slice(0,10)},[c,_]),z=(0,P.useMemo)(()=>{let e=y.trim().toLowerCase();return e?t.filter(t=>t.name.toLowerCase().includes(e)):t},[t,y]),B=s??o;(0,P.useEffect)(()=>{let e=e=>{R.current&&!R.current.contains(e.target)&&F(!1),M.current&&!M.current.contains(e.target)&&(S(!1),w(!1),b(``))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]),(0,P.useEffect)(()=>()=>{j.current?.abort()},[]),(0,P.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`k`&&(e.preventDefault(),ee.current?.focus(),F(!0)),e.key===`Escape`&&(F(!1),ee.current?.blur())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[]);let ie=e=>{if(!(!N||re.length===0)){if(e.key===`ArrowDown`)e.preventDefault(),L(e=>Math.min(e+1,re.length-1));else if(e.key===`ArrowUp`)e.preventDefault(),L(e=>Math.max(e-1,0));else if(e.key===`Enter`){e.preventDefault();let t=re[I];t&&ae(t)}}},ae=t=>{e?.(t.id),v(``),F(!1),L(0)};return(0,H.jsxs)(`header`,{className:`flex items-center justify-between border-b border-dashed border-border-subtle bg-deep px-5 py-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,H.jsx)(`div`,{className:`flex h-7 w-7 items-center justify-center rounded-md bg-gradient-to-br from-accent to-node-interface text-sm font-bold text-white shadow-glow`,children:`◇`}),(0,H.jsx)(`span`,{className:`text-[15px] font-semibold tracking-tight`,children:`GitNexus`})]}),o&&(0,H.jsxs)(`div`,{className:`relative`,ref:M,children:[(0,H.jsxs)(`button`,{"data-testid":`repo-switcher-trigger`,onClick:()=>{let e=!x;S(e),w(!1),e||b(``)},className:`flex cursor-pointer items-center gap-2 rounded-lg border px-3 py-1.5 text-sm transition-all ${x?`border-accent/40 bg-accent/10 text-text-primary`:`border-border-subtle bg-surface text-text-secondary hover:border-border-default hover:bg-hover`} `,children:[(0,H.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-node-function`}),(0,H.jsx)(`span`,{className:`max-w-[160px] truncate`,children:o}),(0,H.jsx)(yr,{className:`h-3 w-3 text-text-muted transition-transform duration-200 ${x?`rotate-180`:``}`})]}),x&&(0,H.jsx)(`div`,{className:`absolute top-full left-0 z-50 mt-1.5 flex max-h-[calc(100vh-4.5rem)] w-80 animate-slide-up flex-col overflow-hidden rounded-xl border border-border-subtle bg-surface shadow-xl`,children:C?(0,H.jsx)(`div`,{className:`scrollbar-thin overflow-y-auto p-4`,children:(0,H.jsx)(Hi,{variant:`sheet`,onComplete:e=>{w(!1),S(!1),b(``),r?.(e)},onCancel:()=>w(!1)})}):(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[t.length>0&&(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,H.jsx)(`div`,{className:`shrink-0 px-3 pt-2.5 pb-1.5 text-[10px] font-medium tracking-wider text-text-muted uppercase`,children:a(`header:repositories`)}),(0,H.jsx)(`div`,{className:`shrink-0 px-3 pb-2`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border-subtle bg-deep/70 px-2.5 py-1.5 transition-colors focus-within:border-accent/60`,children:[(0,H.jsx)($r,{className:`h-3.5 w-3.5 shrink-0 text-text-muted`}),(0,H.jsx)(`input`,{type:`text`,"aria-label":a(`header:searchRepositories`),placeholder:a(`header:searchRepositories`),value:y,onChange:e=>b(e.target.value),className:`min-w-0 flex-1 border-none bg-transparent text-xs text-text-primary outline-none placeholder:text-text-muted`})]})}),(0,H.jsx)(`div`,{className:`scrollbar-thin min-h-0 flex-1 overflow-y-auto pb-1`,children:z.length===0?(0,H.jsx)(`div`,{className:`px-4 py-3 text-sm text-text-muted`,children:a(`header:noRepositoriesFound`,{query:y})}):z.map(e=>{let t=Ae(e),o=t===B;return(0,H.jsxs)(`div`,{"data-testid":`repo-switcher-row`,"data-active":o,className:`group flex items-center gap-2 px-4 py-2 transition-colors ${o?`border-l-2 border-accent bg-accent/10`:`hover:bg-hover`}`,children:[(0,H.jsxs)(`button`,{onClick:()=>{o||n?.(t),S(!1),b(``)},className:`flex min-w-0 flex-1 cursor-pointer items-center gap-3 text-left`,children:[(0,H.jsx)(Or,{className:`h-3.5 w-3.5 shrink-0 text-node-folder`}),(0,H.jsx)(`span`,{className:`flex-1 truncate font-mono text-sm text-text-primary`,children:e.name}),o&&(0,H.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-accent`,children:a(`header:active`)})]}),(0,H.jsx)(`button`,{"data-testid":`repo-switcher-reanalyze`,onClick:async n=>{if(n.stopPropagation(),!T){E(t),A({phase:`queued`,percent:0,message:a(`common:progress.starting`)});try{let{jobId:n}=await rt({path:e.path,force:!0});j.current=at(n,e=>A(e),()=>{E(null),A(null),j.current=null,r?.(t)},e=>{console.error(`Re-analyze failed:`,e),E(null),A(null),j.current=null})}catch(e){console.error(`Failed to start re-analysis:`,e),E(null),A(null)}}},disabled:!!T,className:`cursor-pointer rounded p-1 transition-all ${T===t?`text-accent`:`text-text-muted/0 group-hover:text-text-muted hover:!text-accent`}`,title:T===t?a(`header:reanalyzing`):a(`header:reanalyzeRepo`,{repoName:e.name}),children:(0,H.jsx)(Xr,{className:`h-3.5 w-3.5 ${T===t?`animate-spin`:``}`})}),(0,H.jsx)(`button`,{"data-testid":`repo-switcher-delete`,onClick:async e=>{e.stopPropagation(),T===t&&(j.current?.abort(),E(null),A(null),j.current=null),O(null);try{await Ge(t);let e=await qe();if(i?.(e),o&&e.length>0){let t=new URL(window.location.href);t.searchParams.delete(`repo`),t.searchParams.delete(`project`),window.history.replaceState(null,``,t.toString()),n?.(Ae(e[0]))}else if(e.length===0){let e=new URL(window.location.href);e.searchParams.delete(`repo`),e.searchParams.delete(`project`),e.searchParams.delete(`skipGraph`),window.history.replaceState(null,``,e.toString()),window.location.reload()}}catch(e){console.error(`Failed to delete repo:`,e),O(qi(e,a))}},className:`cursor-pointer rounded p-1 text-text-muted/0 transition-all group-hover:text-text-muted hover:!text-red-400`,title:a(`header:deleteRepo`,{repoName:e.name}),children:(0,H.jsx)(di,{className:`h-3.5 w-3.5`})})]},t)})})]}),D&&(0,H.jsx)(`div`,{className:`px-3 py-2 text-xs text-red-400`,role:`alert`,children:D}),T&&k&&(0,H.jsxs)(`div`,{className:`border-t border-border-subtle bg-accent/5 px-4 py-2.5`,children:[(0,H.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-2`,children:[(0,H.jsx)(Vr,{className:`h-3 w-3 shrink-0 animate-spin text-accent`}),(0,H.jsx)(`span`,{className:`truncate text-xs text-text-secondary`,children:a(`header:reanalyzingRepo`,{repoName:t.find(e=>Ae(e)===T)?.name??T.split(/[/\\]/).filter(Boolean).at(-1)??T,message:Di(k.message,a)})})]}),(0,H.jsx)(`div`,{className:`h-1 overflow-hidden rounded-full bg-elevated`,children:(0,H.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-all duration-300`,style:{width:`${Math.max(2,k.percent)}%`}})})]}),(0,H.jsx)(`div`,{className:t.length>0||T?`border-t border-border-subtle`:``,children:(0,H.jsxs)(`button`,{onClick:()=>{b(``),w(!0)},disabled:!!T,className:`flex w-full cursor-pointer items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-hover disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,H.jsx)(ai,{className:`h-3.5 w-3.5 shrink-0 text-accent`}),(0,H.jsx)(`span`,{className:`text-sm text-text-secondary`,children:a(`header:analyzeNew`)})]})})]})})]})]}),(0,H.jsxs)(`div`,{className:`relative mx-6 max-w-md flex-1`,ref:R,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-lg border border-border-subtle bg-surface px-3.5 py-2 transition-all focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20`,children:[(0,H.jsx)($r,{className:`h-4 w-4 flex-shrink-0 text-text-muted`}),(0,H.jsx)(`input`,{ref:ee,type:`text`,placeholder:a(`header:searchNodes`),value:_,onChange:e=>{v(e.target.value),F(!0),L(0)},onFocus:()=>F(!0),onKeyDown:ie,className:`flex-1 border-none bg-transparent text-sm text-text-primary outline-none placeholder:text-text-muted`}),(0,H.jsx)(`kbd`,{className:`rounded border border-border-subtle bg-elevated px-1.5 py-0.5 font-mono text-[10px] text-text-muted`,children:`⌘K`})]}),N&&_.trim()&&(0,H.jsx)(`div`,{className:`absolute top-full right-0 left-0 z-50 mt-1 overflow-hidden rounded-xl border border-border-subtle bg-surface shadow-xl`,children:re.length===0?(0,H.jsx)(`div`,{className:`px-4 py-3 text-sm text-text-muted`,children:a(`header:noNodesFound`,{query:_})}):(0,H.jsx)(`div`,{className:`max-h-80 overflow-y-auto`,children:re.map((e,t)=>(0,H.jsxs)(`button`,{onClick:()=>ae(e),className:`flex w-full cursor-pointer items-center gap-3 px-4 py-2.5 text-left transition-colors ${t===I?`bg-accent/20 text-text-primary`:`text-text-secondary hover:bg-hover`}`,children:[(0,H.jsx)(`span`,{className:`h-2.5 w-2.5 flex-shrink-0 rounded-full`,style:{backgroundColor:na[e.label]||`#6b7280`}}),(0,H.jsx)(`span`,{className:`flex-1 truncate text-sm font-medium`,children:e.properties.name}),(0,H.jsx)(`span`,{className:`rounded bg-elevated px-2 py-0.5 text-xs text-text-muted`,children:e.label})]},e.id))})})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(`a`,{href:`https://github.com/abhigyanpatwari/GitNexus`,target:`_blank`,rel:`noopener noreferrer`,className:`group flex items-center gap-2 rounded-lg bg-gradient-to-r from-purple-600 to-pink-600 px-3.5 py-2 text-sm font-medium text-white shadow-lg transition-all duration-200 hover:-translate-y-0.5 hover:from-purple-500 hover:to-pink-500 hover:shadow-xl`,children:[(0,H.jsx)(p,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`hidden sm:inline`,children:a(`header:starIfCool`)}),(0,H.jsx)(si,{className:`h-3.5 w-3.5 transition-all group-hover:fill-yellow-300 group-hover:text-yellow-300`}),(0,H.jsx)(`span`,{className:`hidden sm:inline`,children:`✨`})]}),c&&l!==`chatOnly`&&(0,H.jsxs)(`div`,{className:`mr-2 flex items-center gap-4 text-xs text-text-muted`,children:[(0,H.jsx)(`span`,{children:a(`common:counts.nodes`,{count:te})}),(0,H.jsx)(`span`,{children:a(`common:counts.edges`,{count:ne})})]}),(0,H.jsx)(ea,{}),(0,H.jsx)(ta,{}),(0,H.jsx)(`button`,{onClick:()=>h(!0),className:`flex h-9 w-9 cursor-pointer items-center justify-center rounded-md text-text-secondary transition-colors hover:bg-hover hover:text-text-primary`,title:a(`header:aiSettings`),children:(0,H.jsx)(ni,{className:`h-4.5 w-4.5`})}),(0,H.jsx)(`button`,{title:a(`header:help`),onClick:()=>g(!0),className:`flex h-9 w-9 cursor-pointer items-center justify-center rounded-md text-text-secondary transition-colors hover:bg-hover hover:text-text-primary`,children:(0,H.jsx)(Cr,{className:`h-4.5 w-4.5`})}),(0,H.jsxs)(`button`,{onClick:u,className:`flex items-center gap-1.5 rounded-lg px-3.5 py-2 text-sm font-medium transition-all ${d&&m===`chat`?`bg-accent text-white shadow-glow`:`bg-gradient-to-r from-accent to-accent-dim text-white shadow-glow hover:-translate-y-0.5 hover:shadow-lg`} `,children:[(0,H.jsx)(ai,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{children:a(`common:app.nexusAI`)})]})]})]})};function ia(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function aa(e){var t=ia(e,`string`);return typeof t==`symbol`?t:t+``}function oa(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function sa(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,aa(r.key),r)}}function ca(e,t,n){return t&&sa(e.prototype,t),n&&sa(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function la(e){return la=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},la(e)}function ua(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ua=function(){return!!e})()}function da(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function fa(e,t){if(t&&(typeof t==`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return da(e)}function pa(e,t,n){return t=la(t),fa(e,ua()?Reflect.construct(t,n||[],la(e).constructor):t.apply(e,n))}function ma(e,t){return ma=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ma(e,t)}function ha(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ma(e,t)}function ga(e){if(Array.isArray(e))return e}function _a(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function va(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ya(e,t){if(e){if(typeof e==`string`)return va(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?va(e,t):void 0}}function ba(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
14
+ `);Ve(t=>{let n=t.find(e=>e.id===o),r={id:o,role:`assistant`,content:e,historyMessages:u,steps:[...s],toolCalls:[...c],timestamp:n?.timestamp??Date.now()};return n?t.map(e=>e.id===o?r:e):[...t,r]})},f=!1,p=null,m=()=>{f||(f=!0,p=requestAnimationFrame(()=>{f=!1,p=null,d()}))};try{let e=e=>{switch(e.type){case`reasoning`:if(e.reasoning){let t=s[s.length-1];t&&t.type===`reasoning`?s[s.length-1]={...t,content:(t.content||``)+e.reasoning}:s.push({id:`step-${l++}`,type:`reasoning`,content:e.reasoning}),m()}break;case`content`:if(e.content){let t=s[s.length-1];t&&t.type===`content`?s[s.length-1]={...t,content:(t.content||``)+e.content}:s.push({id:`step-${l++}`,type:`content`,content:e.content}),m();let n=s[s.length-1],i=n&&n.type===`content`&&n.content||``,a=new RegExp(Gn.source,Gn.flags),o;for(;(o=a.exec(i))!==null;){let e=o[1].trim(),t=o[2]?parseInt(o[2],10):void 0,n=o[3]?parseInt(o[3],10):t,r=at(e);if(!r)continue;let i=t===void 0?void 0:Math.max(0,t-1),a=n===void 0?i:Math.max(0,n-1),s=V(r);lt({filePath:r,startLine:i,endLine:a,nodeId:s,label:`File`,name:r.split(`/`).pop()??r,source:`ai`})}let c=new RegExp(Kn.source,Kn.flags),u;for(;(u=c.exec(i))!==null;){let e=u[1],t=u[2].trim();if(!r)continue;let n=r.nodes.find(n=>n.label===e&&n.properties.name===t);if(!n||!n.properties.filePath)continue;let i=at(n.properties.filePath);i&&lt({filePath:i,startLine:n.properties.startLine?n.properties.startLine-1:void 0,endLine:n.properties.endLine?n.properties.endLine-1:void 0,nodeId:n.id,label:n.label,name:n.properties.name,source:`ai`})}}break;case`tool_call`:if(e.toolCall){let t=e.toolCall;c.push(t),s.push({id:`step-${l++}`,type:`tool_call`,toolCall:t}),Ge(e=>[...e,t]),m()}break;case`tool_result`:if(e.toolCall){let t=e.toolCall,n=c.findIndex(e=>e.id===t.id);n<0&&(n=c.findIndex(e=>e.name===t.name&&e.status===`running`)),n<0&&(n=c.findIndex(e=>e.name===t.name&&!e.result)),n>=0&&c[n].status!==`stopped`&&(c[n]={...c[n],result:t.result,status:`completed`});let i=s.findIndex(e=>e.type===`tool_call`&&e.toolCall&&(e.toolCall.id===t.id||e.toolCall.name===t.name&&e.toolCall.status===`running`));if(i>=0&&s[i].toolCall&&s[i].toolCall.status!==`stopped`&&(s[i]={...s[i],toolCall:{...s[i].toolCall,result:t.result,status:`completed`}}),Ge(e=>{let n=e.findIndex(e=>e.id===t.id);return n<0&&(n=e.findIndex(e=>e.name===t.name&&e.status===`running`)),n<0&&(n=e.findIndex(e=>e.name===t.name&&!e.result)),n>=0?e[n].status===`stopped`?e:e.map((e,r)=>r===n?{...e,result:t.result,status:`completed`}:e):e}),m(),t.result){let e=t.result.match(/\[HIGHLIGHT_NODES:([^\]]+)\]/);if(e){let t=e[1].split(`,`).map(e=>e.trim()).filter(Boolean);if(t.length>0&&r){let e=new Set,n=new Set(r.nodes.map(e=>e.id));for(let i of t)if(n.has(i))e.add(i);else{let t=r.nodes.find(e=>e.id.endsWith(i)||e.id.endsWith(`:`+i))?.id;t&&e.add(t)}e.size>0&&R(e)}else t.length>0&&R(new Set(t))}let n=t.result.match(/\[IMPACT:([^\]]+)\]/);if(n){let e=n[1].split(`,`).map(e=>e.trim()).filter(Boolean);if(e.length>0&&r){let t=new Set,n=new Set(r.nodes.map(e=>e.id));for(let i of e)if(n.has(i))t.add(i);else{let e=r.nodes.find(e=>e.id.endsWith(i)||e.id.endsWith(`:`+i))?.id;e&&t.add(e)}t.size>0&&te(t)}else e.length>0&&te(new Set(e))}}}break;case`error`:ze(e.error??`Unknown error`);break;case`done`:u=i.preserveAssistantTranscript?e.historyMessages:void 0,m();break}},t=St.current;if(!t)throw Error(`Agent not initialized`);let{streamAgentResponse:o}=await D(async()=>{let{streamAgentResponse:e}=await import(`./agent-A0etRnOc.js`);return{streamAgentResponse:e}},__vite__mapDeps([0,1,2,3,4,5]));for await(let r of o(t,a,{captureHistory:i.preserveAssistantTranscript,signal:n.signal})){if(r.type===`cancelled`)break;e(r)}}catch(e){if(!n.signal.aborted){let t=e instanceof Error?e.message:String(e);ze(t)}}finally{p!=null&&(cancelAnimationFrame(p),p=null),wt.current=`idle`,Ue(!1),Ge([])}},[Be,Pe,Et,at,V,lt,ut,B,r,Ee]),Ot=(0,P.useCallback)(()=>{if(!Ct.current)return;wt.current=`aborting`,Ct.current.abort(),Ct.current=null;let e=Un.t(`chat:stopped`),t=t=>t.status===`running`||t.status===`pending`?{...t,status:`stopped`,result:e}:t;Ge(e=>e.map(t)),Ve(e=>{let n=[...e].map((e,t)=>e.role===`assistant`?t:-1).filter(e=>e>=0).pop();if(n===void 0)return e;let r=e[n],i={...r,toolCalls:r.toolCalls?.map(t),steps:r.steps?.map(e=>e.type===`tool_call`&&e.toolCall?{...e,toolCall:t(e.toolCall)}:e)};return e.map((e,t)=>t===n?i:e)}),Ue(!1)},[]),kt=(0,P.useCallback)(()=>{Ct.current?.abort(),Ct.current=null,wt.current=`idle`,Ve([]),Ge([]),ze(null),Ue(!1)},[]),At=(0,P.useCallback)(async e=>{if(!xe)return;pe({phase:`extracting`,percent:0,message:Un.t(`common:progress.switchingRepository`),detail:Un.t(`common:progress.loadingRepository`,{repo:sr(we,e)})}),n(`loading`),Fe(!1),m(new Set),B(),ie(),ae(),o(null),M(null),Je([]),Xe(!1),nt(null),v(`full`),x(null);let t,r,a,s=!1;try{let n=await ct(xe,(e,t,n)=>{if(e===`validating`)pe({phase:`extracting`,percent:5,message:Un.t(`common:progress.switchingRepository`),detail:Un.t(`common:progress.validating`)});else if(e===`downloading`){let e=n?Math.round(t/n*90)+5:50,r=(t/(1024*1024)).toFixed(1);pe({phase:`extracting`,percent:e,message:Un.t(`common:progress.downloadingGraph`),detail:Un.t(`common:progress.downloadedMb`,{mb:r})})}else e===`extracting`&&pe({phase:`extracting`,percent:97,message:Un.t(`common:progress.processing`),detail:Un.t(`common:progress.extractingFileContents`)})},void 0,e,{awaitAnalysis:!0}),o=n.repoInfo.repoPath??n.repoInfo.path,c=n.repoInfo.name||(o||``).replace(/\\/g,`/`).split(`/`).filter(Boolean).pop()||e||`server-project`;a=e||o||c,_e(c),ft(a),t=n.repoInfo,r=c;let l=L(n);i(l.graph),v(l.graphMode),x(l.graphMode===`chatOnly`?l.nodeCount:null),s=l.graphMode===`chatOnly`}catch(e){console.error(`Repo switch failed:`,e),pe({phase:`error`,percent:0,message:Un.t(`common:progress.failedSwitchRepository`),detail:e instanceof Error?e.message:Un.t(`common:progress.unknownError`)}),Fe(!1),St.current=null,setTimeout(()=>{n(`exploring`),pe(null)},y);return}if(r){let e=new URL(window.location.href);e.searchParams.set(`project`,r);let n=t?.repoPath??t?.path;n&&e.searchParams.set(`repo`,n),e.searchParams.delete(`skipGraph`),window.history.replaceState(null,``,e.toString())}St.current=null,Fe(!1),Ve([]);try{ve()&&await Et(r,{chatOnly:s,repo:a}),n(`exploring`),_t(),pe(null)}catch(e){console.warn(`Failed to initialize agent:`,e),Fe(!1),St.current=null,ze(`Failed to initialize agent`),n(`exploring`),pe(null)}},[xe,we,pe,n,_e,i,v,x,Et,_t,m,B,ie,ae,o,M,Je,Xe,nt,Ve,ft]),jt=(0,P.useRef)(!1),Mt=(0,P.useRef)(null),Nt=(0,P.useRef)(!0);(0,P.useEffect)(()=>()=>{Nt.current=!1,Mt.current?.abort()},[]);let Pt=(0,P.useCallback)(async()=>{if(!xe||jt.current)return;jt.current=!0;let e=dt.current,t=new AbortController;Mt.current=t,pe({phase:`extracting`,percent:0,message:Un.t(`common:progress.downloadingGraph`),detail:Un.t(`common:progress.validating`)}),n(`loading`);try{let r=await ct(xe,(e,t,n)=>{if(e===`downloading`){let e=n?Math.round(t/n*90)+5:50,r=(t/(1024*1024)).toFixed(1);pe({phase:`extracting`,percent:e,message:Un.t(`common:progress.downloadingGraph`),detail:Un.t(`common:progress.downloadedMb`,{mb:r})})}},t.signal,e,{awaitAnalysis:!0,skipGraph:!1});if(!Nt.current||dt.current!==e)return;let a=L(r);i(a.graph),v(a.graphMode),x(a.graphMode===`chatOnly`?a.nodeCount:null),pe(null),n(`exploring`),ve()&&await Et(e?sr(we,e):void 0,{chatOnly:!1,repo:e})}catch(t){if(!Nt.current||dt.current!==e)return;console.error(`Load graph anyway failed:`,t),pe(null),n(`exploring`)}finally{Mt.current===t&&(Mt.current=null),jt.current=!1}},[xe,we,pe,n,i,v,x,Et]),Ft=(0,P.useCallback)(e=>{Je(t=>{let n=t.find(t=>t.id===e),r=t.filter(t=>t.id!==e);return n?.nodeId&&n.source===`ai`&&(r.some(e=>e.nodeId===n.nodeId&&e.source===`ai`)||F(e=>{let t=new Set(e);return t.delete(n.nodeId),t})),r.length===0&&!a&&Xe(!1),r})},[a]),It=(0,P.useCallback)(()=>{Je([]),Xe(!1),nt(null)},[]),Lt={viewMode:t,setViewMode:n,graph:r,setGraph:i,selectedNode:a,setSelectedNode:o,isRightPanelOpen:S,setRightPanelOpen:C,rightPanelTab:w,setRightPanelTab:T,openCodePanel:k,openChatPanel:A,helpDialogBoxOpen:E,setHelpDialogBoxOpen:O,visibleLabels:s,toggleLabelVisibility:c,visibleEdgeTypes:l,toggleEdgeVisibility:u,depthFilter:d,setDepthFilter:f,graphViewMode:h,setGraphViewMode:g,graphMode:_,setGraphMode:v,chatOnlyNodeCount:b,setChatOnlyNodeCount:x,highlightedNodeIds:p,setHighlightedNodeIds:m,aiCitationHighlightedNodeIds:N,aiToolHighlightedNodeIds:I,blastRadiusNodeIds:ee,isAIHighlightsEnabled:ne,toggleAIHighlights:z,clearAIToolHighlights:B,clearAICitationHighlights:ie,clearBlastRadius:ae,queryResult:j,setQueryResult:M,clearQueryHighlights:oe,animatedNodes:se,triggerNodeAnimation:ue,clearAnimations:de,progress:fe,setProgress:pe,projectName:me,setProjectName:_e,currentRepo:ye,serverBaseUrl:xe,setServerBaseUrl:Ce,availableRepos:we,setAvailableRepos:Te,switchRepo:At,setCurrentRepo:ft,loadGraphAnyway:Pt,runQuery:pt,isDatabaseReady:mt,embeddingStatus:Ee,embeddingProgress:Oe,startEmbeddings:gt,startEmbeddingsWithFallback:_t,semanticSearch:vt,semanticSearchWithContext:yt,isEmbeddingReady:Ee===`ready`,llmSettings:Ae,updateLLMSettings:bt,isSettingsPanelOpen:Me,setSettingsPanelOpen:Ne,isAgentReady:Pe,isAgentInitializing:Ie,agentError:Re,chatMessages:Be,isChatLoading:He,currentToolCalls:We,refreshLLMSettings:xt,initializeAgent:Et,sendChatMessage:Dt,stopChatResponse:Ot,clearChat:kt,codeReferences:qe,isCodePanelOpen:Ye,setCodePanelOpen:Xe,addCodeReference:lt,removeCodeReference:Ft,clearAICodeReferences:ut,clearCodeReferences:It,codeReferenceFocus:Ze};return(0,H.jsx)(cr.Provider,{value:Lt,children:e})},dr=()=>{let e=(0,P.useContext)(cr);if(!e)throw Error(`useAppState must be used within AppStateProvider`);return e},fr=s(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),pr=s(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),mr=s(`at-sign`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`,key:`7n84p3`}]]),hr=s(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),gr=s(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),_r=s(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),vr=s(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),yr=s(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),br=s(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),xr=s(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Sr=s(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Cr=s(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),wr=s(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Tr=s(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Er=s(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Dr=s(`file-code`,[[`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 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),Or=s(`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`}]]),kr=s(`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`}]]),Ar=s(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),jr=s(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Mr=s(`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`}]]),Nr=s(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Pr=s(`heart`,[[`path`,{d:`M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5`,key:`mvr1a0`}]]),Fr=s(`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`}]]),Ir=s(`key`,[[`path`,{d:`m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4`,key:`g0fldk`}],[`path`,{d:`m21 2-9.6 9.6`,key:`1j0ho8`}],[`circle`,{cx:`7.5`,cy:`15.5`,r:`5.5`,key:`yqb3hr`}]]),Lr=s(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),Rr=s(`lightbulb-off`,[[`path`,{d:`M16.8 11.2c.8-.9 1.2-2 1.2-3.2a6 6 0 0 0-9.3-5`,key:`1fkcox`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M6.3 6.3a4.67 4.67 0 0 0 1.2 5.2c.7.7 1.3 1.5 1.5 2.5`,key:`10m8kw`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),zr=s(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Br=s(`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`}]]),Vr=s(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Hr=s(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),Ur=s(`mouse-pointer-click`,[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]),Wr=s(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),Gr=s(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),Kr=s(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),qr=s(`panel-right-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]),Jr=s(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Yr=s(`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`}]]),Xr=s(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Zr=s(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),Qr=s(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),$r=s(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),ei=s(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),ti=s(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),ni=s(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ri=s(`skip-forward`,[[`path`,{d:`M21 4v16`,key:`7j8fe9`}],[`path`,{d:`M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z`,key:`zs4d6`}]]),ii=s(`snail`,[[`path`,{d:`M2 13a6 6 0 1 0 12 0 4 4 0 1 0-8 0 2 2 0 0 0 4 0`,key:`hneq2s`}],[`circle`,{cx:`10`,cy:`13`,r:`8`,key:`194lz3`}],[`path`,{d:`M2 21h12c4.4 0 8-3.6 8-8V7a2 2 0 1 0-4 0v6`,key:`ixqyt7`}],[`path`,{d:`M18 3 19.1 5.2`,key:`9tjm43`}],[`path`,{d:`M22 3 20.9 5.2`,key:`j3odrs`}]]),ai=s(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),oi=s(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),si=s(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),ci=s(`table`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}]]),li=s(`target`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`6`,key:`1vlfrh`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),ui=s(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),di=s(`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`}]]),fi=s(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),pi=s(`type`,[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]),mi=s(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),hi=s(`variable`,[[`path`,{d:`M8 21s-4-3-4-9 4-9 4-9`,key:`uto9ud`}],[`path`,{d:`M16 3s4 3 4 9-4 9-4 9`,key:`4w2vsq`}],[`line`,{x1:`15`,x2:`9`,y1:`9`,y2:`15`,key:`f7djnv`}],[`line`,{x1:`9`,x2:`15`,y1:`9`,y2:`15`,key:`1shsy8`}]]),gi=s(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),_i=s(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),vi=`gitnexus-backend-url`;function yi(){let[e]=(0,P.useState)(()=>{try{return localStorage.getItem(vi)??S}catch{return S}}),[t,n]=(0,P.useState)(!1),[r,i]=(0,P.useState)(!1),a=(0,P.useRef)(0),o=(0,P.useCallback)(async()=>{let e=++a.current;i(!0);try{let t=await Ke();return e===a.current?(n(t),t):!1}catch{return e===a.current&&n(!1),!1}finally{e===a.current&&i(!1)}},[]),s=(0,P.useRef)(null),[c,l]=(0,P.useState)(!1),u=(0,P.useRef)(o);u.current=o;let d=(0,P.useCallback)(()=>{s.current!==null&&(clearTimeout(s.current),s.current=null),l(!1)},[]),f=(0,P.useCallback)(()=>{d(),l(!0);let e=()=>{s.current=setTimeout(async()=>{if(document.hidden){s.current=null;return}await u.current()?(l(!1),s.current=null):e()},3e3)};e()},[d]);return(0,P.useEffect)(()=>{if(!c)return;let e=()=>{document.hidden||(s.current!==null&&(clearTimeout(s.current),s.current=null),u.current().then(e=>{!e&&c&&f()}))};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[c,f]),(0,P.useEffect)(()=>()=>{s.current!==null&&clearTimeout(s.current)},[]),(0,P.useEffect)(()=>{Ie(e),o()},[]),{isConnected:t,isProbing:r,backendUrl:e,startPolling:f,stopPolling:d,isPolling:c}}function bi({text:e}){let{t}=f(`onboarding`),[n,r]=(0,P.useState)(!1),i=(0,P.useRef)(null);return(0,P.useEffect)(()=>()=>{i.current&&clearTimeout(i.current)},[]),(0,H.jsx)(`button`,{onClick:async()=>{try{await navigator.clipboard.writeText(e),r(!0),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>r(!1),2e3)}catch{}},"aria-label":t(n?`guide.copiedAria`:`guide.copyAria`),className:`shrink-0 cursor-pointer rounded-md px-2 py-1 transition-all duration-200 focus-visible:ring-2 focus-visible:ring-accent/40 focus-visible:outline-none ${n?`bg-emerald-400/10 text-emerald-400`:`text-text-muted hover:bg-white/5 hover:text-text-primary`} `,children:n?(0,H.jsx)(vr,{className:`h-3.5 w-3.5`}):(0,H.jsx)(o,{className:`h-3.5 w-3.5`})})}function xi({command:e,label:t,isActive:n=!1}){return(0,H.jsxs)(`div`,{className:`overflow-hidden rounded-xl border transition-all duration-300 ${n?`border-accent/40 shadow-glow-soft`:`border-border-default hover:border-accent/20 hover:shadow-glow-soft`} `,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border-subtle bg-deep px-4 py-2.5`,children:[(0,H.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,H.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-full bg-red-500/60`}),(0,H.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-full bg-yellow-500/60`}),(0,H.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-full bg-emerald-500/60`})]}),(0,H.jsx)(`span`,{className:`flex-1 text-center font-mono text-[11px] text-text-muted`,children:t}),(0,H.jsx)(bi,{text:e})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 bg-void px-4 py-3.5 font-mono text-sm`,children:[(0,H.jsx)(`span`,{className:`text-accent/60 select-none`,"aria-hidden":`true`,children:`$`}),(0,H.jsx)(`code`,{className:`flex-1 overflow-x-auto tracking-wide whitespace-nowrap text-text-primary`,children:e})]})]})}function Si({state:e,number:t}){return e===`done`?(0,H.jsx)(`div`,{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-emerald-500/50 bg-emerald-500/20`,children:(0,H.jsx)(vr,{className:`h-3 w-3 text-emerald-400`})}):e===`active`?(0,H.jsxs)(`div`,{className:`relative flex h-6 w-6 shrink-0 items-center justify-center`,children:[(0,H.jsx)(`div`,{className:`absolute inset-0 animate-ping rounded-full border border-accent/30`}),(0,H.jsx)(`div`,{className:`flex h-6 w-6 items-center justify-center rounded-full border border-accent/60 bg-accent/20`,children:(0,H.jsx)(`span`,{className:`text-[10px] leading-none font-semibold text-accent`,children:t})})]}):(0,H.jsx)(`div`,{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-border-subtle bg-elevated`,children:(0,H.jsx)(`span`,{className:`text-[10px] leading-none font-semibold text-text-muted`,children:t})})}function Ci({state:e,number:t,title:n,description:r,children:i}){let{t:a}=f(`onboarding`),o=e!==`waiting`;return(0,H.jsx)(`div`,{className:`transition-all duration-300 ${e===`waiting`?`opacity-40`:`opacity-100`} `,children:(0,H.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,H.jsx)(Si,{state:e,number:t}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium transition-colors duration-200 ${e===`done`?`text-emerald-400`:e===`active`?`text-text-primary`:`text-text-muted`}`,children:n}),e===`done`&&(0,H.jsx)(`span`,{className:`animate-fade-in font-mono text-[10px] tracking-wider text-emerald-400/60 uppercase`,children:a(`guide.done`)})]}),r&&(0,H.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-text-muted`,children:r}),o&&i&&(0,H.jsx)(`div`,{className:`mt-3 animate-slide-up`,children:i})]})]})})}function wi(){let{t:e}=f(`onboarding`);return(0,H.jsxs)(`div`,{className:`flex animate-fade-in items-center gap-3 rounded-xl border border-accent/15 bg-accent/5 px-4 py-3`,"aria-live":`polite`,role:`status`,children:[(0,H.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,H.jsx)(_i,{className:`h-4 w-4 text-accent/70`}),(0,H.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,H.jsx)(`div`,{className:`h-5 w-5 animate-pulse rounded-full border border-accent/25`})})]}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`p`,{className:`text-xs font-medium text-text-secondary`,children:[e(`guide.listeningForServer`),(0,H.jsx)(`span`,{className:`ml-0.5 inline-flex text-text-muted`,children:(0,H.jsx)(`span`,{className:`animate-pulse`,children:`...`})})]}),(0,H.jsx)(`p`,{className:`mt-0.5 text-[11px] text-text-muted`,children:e(`guide.willAutoConnect`)})]})]})}var Ti=({isPolling:e})=>{let{t}=f(`onboarding`),n=t(`guide.terminal`),r=e?`done`:`active`,i=e?`active`:`waiting`;return(0,H.jsxs)(`div`,{className:`relative animate-fade-in overflow-hidden rounded-3xl border border-border-default bg-surface p-7`,children:[(0,H.jsx)(`div`,{className:`pointer-events-none absolute -top-28 -right-28 h-72 w-72 rounded-full bg-accent/6 blur-3xl`}),(0,H.jsx)(`div`,{className:`pointer-events-none absolute -bottom-24 -left-24 h-56 w-56 rounded-full bg-node-function/6 blur-3xl`}),(0,H.jsx)(`div`,{className:`relative mb-6`,children:(0,H.jsxs)(`div`,{className:`text-center`,children:[(0,H.jsxs)(`div`,{className:`mb-2 inline-flex items-center gap-1.5`,children:[(0,H.jsx)(ai,{className:`h-3.5 w-3.5 text-accent/70`}),(0,H.jsx)(`span`,{className:`text-[11px] font-medium tracking-widest text-accent/80 uppercase`,children:`GitNexus`})]}),(0,H.jsx)(`h2`,{className:`text-lg leading-snug font-semibold text-text-primary`,children:t(`guide.startServer`)}),(0,H.jsx)(`p`,{className:`mx-auto mt-1 max-w-xs text-sm leading-relaxed text-text-secondary`,children:t(`guide.prodDescription`)})]})}),(0,H.jsxs)(`div`,{className:`relative space-y-5`,children:[(0,H.jsx)(`div`,{className:`pointer-events-none absolute top-6 bottom-6 left-[11px] w-px bg-border-subtle`,"aria-hidden":`true`}),(0,H.jsxs)(Ci,{state:r,number:1,title:t(`guide.copyCommand`),description:e?void 0:t(`guide.copyCommandDescription`),children:[(0,H.jsx)(xi,{command:`npx gitnexus@latest serve`,label:n,isActive:r===`active`}),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`my-3 flex items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`h-px flex-1 bg-border-subtle`}),(0,H.jsx)(`span`,{className:`text-[11px] tracking-widest text-text-muted uppercase`,children:t(`guide.orInstallGlobally`)}),(0,H.jsx)(`div`,{className:`h-px flex-1 bg-border-subtle`})]}),(0,H.jsx)(xi,{command:`npm install -g gitnexus && gitnexus serve`,label:t(`guide.globalInstall`),isActive:!1})]})]}),(0,H.jsx)(Ci,{state:i,number:2,title:t(e?`guide.waitingForServer`:`guide.pasteAndRun`),description:e?void 0:t(`guide.pasteAndRunDescription`),children:e&&(0,H.jsx)(wi,{})}),(0,H.jsx)(Ci,{state:`waiting`,number:3,title:t(`guide.autoConnects`),description:t(`guide.autoConnectsDescription`)})]}),(0,H.jsxs)(`div`,{className:`mt-6 flex items-center justify-center gap-1.5 border-t border-border-subtle pt-5 text-xs text-text-muted`,children:[(0,H.jsx)(ti,{className:`h-3 w-3 shrink-0`}),(0,H.jsxs)(`span`,{children:[t(`guide.requires`),` `,(0,H.jsxs)(`a`,{href:`https://nodejs.org`,target:`_blank`,rel:`noopener noreferrer`,className:`text-accent transition-colors hover:text-accent/80 hover:underline`,children:[`Node.js `,b,`+`]})]}),(0,H.jsx)(`span`,{className:`mx-1 text-border-default`,children:`·`}),(0,H.jsx)(ui,{className:`h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:t(`guide.port`)})]})]})};function Ei(e,t,n){return n(`common:analyzePhases.${e}`,{defaultValue:``})||t||e}function Di(e,t){if(!e)return``;let n=Oi[e];return n?t(n):e}var Oi={"Connecting...":`common:progress.connectingShort`,"Connecting to server...":`common:progress.connecting`,"Validating server":`common:progress.validatingServer`,"Validating server...":`common:progress.validatingServerEllipsis`,"Downloading graph...":`common:progress.downloadingGraph`,"Extracting file contents":`common:progress.extractingFileContents`,"Processing...":`common:progress.processing`,"Processing graph...":`common:progress.processingGraph`,"Loading graph...":`common:progress.loadingGraph`,Queued:`common:analyzePhases.queued`,"Starting...":`common:progress.starting`},ki=({progress:e,onCancel:t})=>{let{t:n}=f(`common`),[r]=(0,P.useState)(()=>Date.now()),[i,a]=(0,P.useState)(0);(0,P.useEffect)(()=>{let e=setInterval(()=>a(Date.now()-r),1e3);return()=>clearInterval(e)},[r]);let o=e=>{let t=Math.floor(e/1e3);return t<60?n(`units.elapsedSeconds`,{seconds:t}):n(`units.elapsedMinutesSeconds`,{minutes:Math.floor(t/60),seconds:t%60})},s=Ei(e.phase,e.message,n),c=Math.max(0,Math.min(100,e.percent));return(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,H.jsx)(`span`,{className:`font-medium text-text-secondary`,children:s}),(0,H.jsx)(`span`,{className:`font-mono text-xs text-text-muted`,children:o(i)})]}),(0,H.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-elevated`,children:(0,H.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-all duration-300 ease-out`,style:{width:`${c}%`}})}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`span`,{className:`font-mono text-xs text-text-muted`,children:[c,`%`]}),(0,H.jsxs)(`button`,{onClick:t,className:`flex items-center gap-1.5 rounded-lg bg-red-500/10 px-3 py-1.5 text-xs text-red-400 transition-all duration-200 hover:bg-red-500/20`,children:[(0,H.jsx)(gi,{className:`h-3.5 w-3.5`}),n(`actions.cancel`)]})]})]})},Ai=new Set([`.git`,`.hg`,`.svn`,`node_modules`,`vendor`,`.venv`,`__pycache__`,`target`,`dist`,`build`,`out`,`.next`,`.nuxt`,`.cache`,`coverage`,`.idea`,`.gitnexus`]);function ji(e){let t=[],n=[],r=0,i=0;for(let a=0;a<e.length;a++){let o=e[a],s=o.webkitRelativePath&&o.webkitRelativePath.length>0?o.webkitRelativePath:o.name;if(s.split(`/`).some(e=>Ai.has(e))){r++;continue}if(o.size>26214400){r++;continue}t.push(o),n.push(s),i+=o.size}return{files:t,manifest:n,droppedCount:r,totalBytes:i}}function Mi(e,t){if(e instanceof je){let n=e.retryAfterMs?Math.ceil(e.retryAfterMs/1e3):void 0,r=e.message||t(`errors:unknown`);switch(e.code){case`network`:return t(`errors:backend.network`,{defaultValue:r});case`timeout`:return t(`errors:backend.timeout`,{defaultValue:r});case`rate_limited`:return t(`errors:backend.rateLimited`,{seconds:n,defaultValue:r});case`not_found`:return t(`errors:backend.notFound`,{defaultValue:r});case`origin_blocked`:return t(`errors:backend.originBlocked`,{defaultValue:r});case`client`:return t(`errors:backend.client`,{message:e.message,defaultValue:r});case`server`:return t(`errors:backend.server`,{message:e.message,defaultValue:r});default:return r}}return e instanceof Error?e.message:t(`errors:unknown`)}var Ni=/^https?:\/\/(www\.)?github\.com\/[^/\s]+\/[^/\s]+/i,Pi=/^https?:\/\/[^/\s]+\/[^/\s]+\/[^/\s]+(\/.*)?$/i,Fi=/^https?:\/\/[^/\s]+\/(?:[^/\s]+\/)+_git\/[^/\s]+/i,Ii=navigator.userAgent.toLowerCase().includes(`win`);function Li(e){return Ni.test(e.trim())}function Ri(e){return Pi.test(e.trim())}function zi(e){return Fi.test(e.trim())}function Bi({mode:e,onChange:t}){let{t:n}=f(`onboarding`);return(0,H.jsxs)(`div`,{className:`flex gap-1 rounded-lg bg-elevated p-1`,role:`tablist`,"aria-label":n(`repoAnalyzer.inputType`),children:[(0,H.jsxs)(`button`,{role:`tab`,"aria-selected":e===`github`,onClick:()=>t(`github`),className:`flex flex-1 cursor-pointer items-center justify-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-all duration-150 ${e===`github`?`bg-accent text-white shadow-sm`:`text-text-muted hover:text-text-secondary`} `,children:[(0,H.jsx)(p,{className:`h-3 w-3`}),n(`repoAnalyzer.githubUrl`)]}),(0,H.jsxs)(`button`,{role:`tab`,"aria-selected":e===`gitlab`,onClick:()=>t(`gitlab`),className:`flex flex-1 cursor-pointer items-center justify-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-all duration-150 ${e===`gitlab`?`bg-accent text-white shadow-sm`:`text-text-muted hover:text-text-secondary`} `,children:[(0,H.jsx)(g,{className:`h-3 w-3`}),n(`repoAnalyzer.gitlabUrl`)]}),(0,H.jsxs)(`button`,{role:`tab`,"aria-selected":e===`azure`,onClick:()=>t(`azure`),className:`flex flex-1 cursor-pointer items-center justify-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-all duration-150 ${e===`azure`?`bg-accent text-white shadow-sm`:`text-text-muted hover:text-text-secondary`} `,children:[(0,H.jsx)(i,{className:`h-3 w-3`}),n(`repoAnalyzer.azureDevOpsUrl`)]}),(0,H.jsxs)(`button`,{role:`tab`,"aria-selected":e===`local`,onClick:()=>t(`local`),className:`flex flex-1 cursor-pointer items-center justify-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-all duration-150 ${e===`local`?`bg-accent text-white shadow-sm`:`text-text-muted hover:text-text-secondary`} `,children:[(0,H.jsx)(Or,{className:`h-3 w-3`}),n(`repoAnalyzer.localFolder`)]})]})}function Vi({canSubmit:e,isLoading:t,onClick:n,variant:r}){let{t:i}=f(`onboarding`);return(0,H.jsxs)(`button`,{onClick:n,disabled:!e||t,className:` ${r===`onboarding`?`w-full px-5 py-3.5 text-sm`:`w-full px-4 py-3 text-sm`} flex items-center justify-center gap-2.5 rounded-xl font-medium transition-all duration-200 ${e&&!t?`cursor-pointer bg-accent text-white shadow-glow-soft hover:-translate-y-0.5 hover:bg-accent/90 hover:shadow-glow`:`cursor-not-allowed border border-border-subtle bg-elevated text-text-muted`} `,children:[t?(0,H.jsx)(Vr,{className:`h-4 w-4 animate-spin`}):(0,H.jsx)(ai,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{children:i(t?`repoAnalyzer.starting`:`repoAnalyzer.analyzeRepository`)}),e&&!t&&(0,H.jsx)(pr,{className:`h-3.5 w-3.5`})]})}function Hi({repoName:e}){let{t}=f(`onboarding`);return(0,H.jsxs)(`div`,{className:`flex animate-fade-in flex-col items-center gap-3 py-4`,role:`status`,"aria-live":`polite`,children:[(0,H.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-xl border border-emerald-500/30 bg-emerald-500/15 shadow-[0_0_20px_rgba(16,185,129,0.15)]`,children:(0,H.jsx)(vr,{className:`h-6 w-6 text-emerald-400`})}),(0,H.jsxs)(`div`,{className:`text-center`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-emerald-400`,children:t(`repoAnalyzer.complete`)}),(0,H.jsx)(`p`,{className:`mt-0.5 font-mono text-xs text-text-muted`,children:e})]}),(0,H.jsx)(`p`,{className:`text-xs text-text-secondary`,children:t(`repoAnalyzer.loadingGraph`)})]})}var Ui=({variant:e,onComplete:t,onCancel:n})=>{let{t:r}=f([`common`,`errors`,`onboarding`]),a=(0,P.useId)(),[o,s]=(0,P.useState)(`github`),[c,l]=(0,P.useState)(!1),[u,d]=(0,P.useState)(null),[m,h]=(0,P.useState)(``),[_,v]=(0,P.useState)(``),[y,b]=(0,P.useState)(``),[x,S]=(0,P.useState)(``),[C,w]=(0,P.useState)(``),[T,E]=(0,P.useState)(`input`),[D,O]=(0,P.useState)(null),[k,A]=(0,P.useState)({phase:`queued`,percent:0,message:r(`common:analyzePhases.queued`)}),[j,M]=(0,P.useState)(``),N=(0,P.useRef)(null),F=(0,P.useRef)(null),I=(0,P.useRef)(null),L=(0,P.useRef)(null),R=(0,P.useRef)(null);(0,P.useEffect)(()=>()=>{F.current?.abort(),I.current?.abort(),L.current&&clearTimeout(L.current)},[]);let ee=()=>{I.current?.abort(),I.current=null},te=()=>{ee();let e=new AbortController;return I.current=e,e},ne=e=>{it(e).catch(()=>{})},re=e=>{e!==o&&(ee(),s(e),h(``),v(``),b(``),S(``),w(``),O(null),d(null),l(!1),E(`input`))},z=o===`github`?Li(m)&&(T===`input`||T===`error`):o===`gitlab`?Ri(y)&&(T===`input`||T===`error`):o===`azure`?zi(x)&&(T===`input`||T===`error`):C.trim().length>1&&(T===`input`||T===`error`),B=async()=>{if(o===`github`&&!Li(m)){O(r(`errors:invalidGithubUrl`));return}if(o===`gitlab`&&!Ri(y)){O(`Please enter a valid GitLab repository URL.`);return}if(o===`azure`&&!zi(x)){O(r(`errors:invalidAzureDevOpsUrl`));return}if(o===`local`&&C.trim().length<2){O(r(`errors:missingFolderPath`));return}O(null),E(`starting`);let e=te();try{let{jobId:t}=await rt(o===`github`?{url:m.trim(),..._.trim()?{token:_.trim()}:{}}:o===`gitlab`?{url:y.trim()}:o===`azure`?{url:x.trim()}:{path:C.trim()});if(e.signal.aborted)return;let n=o===`github`?m.trim():o===`gitlab`?y.trim():o===`azure`?x.trim():C.trim();ie(t,n)}catch(t){if(e.signal.aborted)return;O(Mi(t,r)),E(`error`)}},ie=(e,n)=>{N.current=e,E(`analyzing`);let i=at(e,e=>A(e),e=>{let i=e.repoName??(n?n.split(/[/\\]/).filter(Boolean).at(-1):void 0)??r(`onboarding:repoAnalyzer.defaultRepoName`),a=e.repoPath??i;M(i),v(``),E(`done`),F.current=null,L.current=setTimeout(()=>{L.current=null,t(a)},1200)},e=>{O(e||r(`errors:analysisFailed`)),E(`error`)});F.current=i},ae=async e=>{if(c||se)return;let{files:t,manifest:n,droppedCount:i}=ji(e);if(t.length===0){O(r(`onboarding:repoAnalyzer.upload.empty`));return}O(null),d({count:t.length,dropped:i}),l(!0),E(`starting`);let a=n[0]?.split(`/`)[0]??null,o=te();try{let{jobId:e}=await nt(t,n,o.signal);if(o.signal.aborted){ne(e);return}l(!1),ie(e,a)}catch(e){if(o.signal.aborted)return;l(!1),O(Mi(e,r)),E(`error`)}},oe=async()=>{if(F.current?.abort(),F.current=null,ee(),N.current){try{await it(N.current)}catch{}N.current=null}v(``),E(`input`),A({phase:`queued`,percent:0,message:r(`common:analyzePhases.queued`)}),l(!1),d(null)},se=T===`starting`,ce=T!==`analyzing`&&T!==`done`,le=Ii;return(0,H.jsxs)(`div`,{className:`space-y-4`,children:[ce&&(0,H.jsx)(Bi,{mode:o,onChange:re}),ce&&o===`github`&&(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{htmlFor:a,className:`block text-xs font-medium tracking-wider text-text-secondary uppercase`,children:r(`onboarding:repoAnalyzer.githubRepositoryUrl`)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border bg-void px-4 py-3.5 transition-all duration-200 ${D&&T===`error`?`border-red-500/50`:Li(m)?`border-accent/50 shadow-[0_0_0_3px_rgba(124,58,237,0.08)]`:`border-border-default focus-within:border-accent/40`} `,children:[(0,H.jsx)(p,{className:`h-4 w-4 shrink-0 text-text-muted`}),(0,H.jsx)(`input`,{id:a,type:`url`,value:m,onChange:e=>{h(e.target.value),D&&O(null)},onKeyDown:e=>{e.key===`Enter`&&z&&!se&&(e.preventDefault(),B())},disabled:se,placeholder:`https://github.com/owner/repo`,autoComplete:`url`,spellCheck:!1,className:`flex-1 border-none bg-transparent font-mono text-sm text-text-primary outline-none placeholder:text-text-muted disabled:opacity-50`}),m.length>10&&(0,H.jsx)(`div`,{className:`shrink-0`,children:Li(m)?(0,H.jsx)(vr,{className:`h-3.5 w-3.5 text-emerald-400`}):(0,H.jsx)(Sr,{className:`h-3.5 w-3.5 text-text-muted`})})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5 pt-1`,children:[(0,H.jsx)(`label`,{htmlFor:`${a}-token`,className:`block text-xs font-medium tracking-wider text-text-secondary uppercase`,children:r(`onboarding:repoAnalyzer.githubTokenLabel`)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-border-default bg-void px-4 py-3 transition-all duration-200 focus-within:border-accent/40`,children:[(0,H.jsx)(Ir,{className:`h-4 w-4 shrink-0 text-text-muted`}),(0,H.jsx)(`input`,{id:`${a}-token`,type:`password`,value:_,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key===`Enter`&&z&&!se&&(e.preventDefault(),B())},disabled:se,placeholder:r(`onboarding:repoAnalyzer.githubTokenPlaceholder`),autoComplete:`off`,spellCheck:!1,className:`flex-1 border-none bg-transparent font-mono text-sm text-text-primary outline-none placeholder:text-text-muted disabled:opacity-50`})]}),(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:r(`onboarding:repoAnalyzer.githubTokenHelp`)})]})]}),ce&&o===`gitlab`&&(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{htmlFor:a,className:`block text-xs font-medium tracking-wider text-text-secondary uppercase`,children:r(`onboarding:repoAnalyzer.gitlabRepositoryUrl`)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border bg-void px-4 py-3.5 transition-all duration-200 ${D&&T===`error`?`border-red-500/50`:Ri(y)?`border-accent/50 shadow-[0_0_0_3px_rgba(124,58,237,0.08)]`:`border-border-default focus-within:border-accent/40`} `,children:[(0,H.jsx)(g,{className:`h-4 w-4 shrink-0 text-text-muted`}),(0,H.jsx)(`input`,{id:a,type:`url`,value:y,onChange:e=>{b(e.target.value),D&&O(null)},onKeyDown:e=>{e.key===`Enter`&&z&&!se&&(e.preventDefault(),B())},disabled:se,placeholder:`https://gitlab.com/owner/repo`,autoComplete:`url`,spellCheck:!1,className:`flex-1 border-none bg-transparent font-mono text-sm text-text-primary outline-none placeholder:text-text-muted disabled:opacity-50`}),y.length>10&&(0,H.jsx)(`div`,{className:`shrink-0`,children:Ri(y)?(0,H.jsx)(vr,{className:`h-3.5 w-3.5 text-emerald-400`}):(0,H.jsx)(Sr,{className:`h-3.5 w-3.5 text-text-muted`})})]}),(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:r(`onboarding:repoAnalyzer.gitlabSupported`)})]}),ce&&o===`azure`&&(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{htmlFor:a,className:`block text-xs font-medium tracking-wider text-text-secondary uppercase`,children:r(`onboarding:repoAnalyzer.azureDevOpsRepositoryUrl`)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border bg-void px-4 py-3.5 transition-all duration-200 ${D&&T===`error`?`border-red-500/50`:zi(x)?`border-accent/50 shadow-[0_0_0_3px_rgba(124,58,237,0.08)]`:`border-border-default focus-within:border-accent/40`} `,children:[(0,H.jsx)(i,{className:`h-4 w-4 shrink-0 text-text-muted`}),(0,H.jsx)(`input`,{id:a,type:`url`,value:x,onChange:e=>{S(e.target.value),D&&O(null)},onKeyDown:e=>{e.key===`Enter`&&z&&!se&&(e.preventDefault(),B())},disabled:se,placeholder:`http://azuredevops.example.com/Collection/Project/_git/Repo`,autoComplete:`url`,spellCheck:!1,className:`flex-1 border-none bg-transparent font-mono text-sm text-text-primary outline-none placeholder:text-text-muted disabled:opacity-50`}),x.length>10&&(0,H.jsx)(`div`,{className:`shrink-0`,children:zi(x)?(0,H.jsx)(vr,{className:`h-3.5 w-3.5 text-emerald-400`}):(0,H.jsx)(Sr,{className:`h-3.5 w-3.5 text-text-muted`})})]}),(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:r(`onboarding:repoAnalyzer.azureDevOpsSupported`)})]}),ce&&o===`local`&&(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{htmlFor:`${a}-local`,className:`block text-xs font-medium tracking-wider text-text-secondary uppercase`,children:r(`onboarding:repoAnalyzer.localFolderPath`)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border bg-void px-4 py-3.5 transition-all duration-200 ${D&&T===`error`?`border-red-500/50`:C.trim().length>1?`border-accent/50 shadow-[0_0_0_3px_rgba(124,58,237,0.08)]`:`border-border-default focus-within:border-accent/40`} `,children:[(0,H.jsx)(Or,{className:`h-4 w-4 shrink-0 text-text-muted`}),(0,H.jsx)(`input`,{id:`${a}-local`,type:`text`,value:C,onChange:e=>{w(e.target.value),D&&O(null)},onKeyDown:e=>{e.key===`Enter`&&z&&!se&&(e.preventDefault(),B())},disabled:se,placeholder:le?`C:\\Users\\you\\project`:`/home/you/project`,autoComplete:`off`,spellCheck:!1,className:`flex-1 border-none bg-transparent font-mono text-sm text-text-primary outline-none placeholder:text-text-muted disabled:opacity-50`}),C.trim().length>1&&(0,H.jsx)(vr,{className:`h-3.5 w-3.5 shrink-0 text-emerald-400`})]}),(0,H.jsx)(`input`,{ref:R,type:`file`,webkitdirectory:``,multiple:!0,className:`hidden`,"data-testid":`folder-upload-input`,onChange:e=>{e.target.files&&e.target.files.length>0&&ae(e.target.files),e.target.value=``}}),(0,H.jsxs)(`button`,{type:`button`,"data-testid":`upload-folder`,onClick:()=>R.current?.click(),disabled:se,className:`flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg border border-border-subtle bg-elevated px-3 py-2 text-xs font-medium text-text-secondary transition-all duration-150 hover:bg-hover hover:text-text-primary disabled:opacity-50`,children:[(0,H.jsx)(Or,{className:`h-3.5 w-3.5`}),r(`onboarding:repoAnalyzer.upload.button`)]}),c&&(0,H.jsxs)(`div`,{role:`status`,"aria-busy":`true`,"data-testid":`upload-progress`,className:`space-y-1`,children:[(0,H.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-elevated`,children:(0,H.jsx)(`div`,{className:`h-full w-1/3 animate-pulse rounded-full bg-accent`})}),(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:r(`onboarding:repoAnalyzer.upload.uploading`)})]}),u&&!c&&T!==`error`&&(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,"data-testid":`upload-summary`,children:r(`onboarding:repoAnalyzer.upload.selected`,{fileCount:u.count,dropped:u.dropped})})]}),(T===`error`||T===`input`&&D)&&D&&(0,H.jsxs)(`p`,{className:`flex animate-fade-in items-center gap-1.5 text-xs text-red-400`,children:[(0,H.jsx)(Sr,{className:`h-3 w-3 shrink-0`}),D]}),T===`analyzing`&&(0,H.jsx)(`div`,{className:`animate-slide-up`,children:(0,H.jsx)(ki,{progress:k,onCancel:oe})}),T===`done`&&(0,H.jsx)(Hi,{repoName:j}),(T===`input`||T===`starting`)&&(0,H.jsx)(Vi,{canSubmit:z,isLoading:se,onClick:B,variant:e}),T===`error`&&(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`button`,{onClick:()=>{O(null),E(`input`)},className:`flex-1 cursor-pointer rounded-xl border border-border-subtle bg-elevated px-4 py-2.5 text-sm text-text-secondary transition-all duration-200 hover:bg-hover hover:text-text-primary`,children:r(`common:actions.tryAgain`)}),n&&(0,H.jsx)(`button`,{onClick:n,className:`cursor-pointer px-4 py-2.5 text-sm text-text-muted transition-colors hover:text-text-secondary`,children:r(`common:actions.dismiss`)})]}),T===`analyzing`&&e===`sheet`&&n&&(0,H.jsx)(`button`,{onClick:n,className:`w-full cursor-pointer py-1 text-xs text-text-muted transition-colors hover:text-text-secondary`,children:r(`onboarding:repoAnalyzer.hideBackground`)})]})},Wi=({onComplete:e})=>{let{t}=f(`onboarding`);return(0,H.jsxs)(`div`,{className:`relative animate-fade-in overflow-hidden rounded-3xl border border-border-default bg-surface p-7`,children:[(0,H.jsx)(`div`,{className:`pointer-events-none absolute -top-28 -right-28 h-72 w-72 rounded-full bg-accent/6 blur-3xl`}),(0,H.jsx)(`div`,{className:`pointer-events-none absolute -bottom-24 -left-24 h-56 w-56 rounded-full bg-node-function/6 blur-3xl`}),(0,H.jsx)(`div`,{className:`relative mb-6`,children:(0,H.jsxs)(`div`,{className:`text-center`,children:[(0,H.jsxs)(`div`,{className:`mb-2 inline-flex items-center gap-1.5`,children:[(0,H.jsx)(ai,{className:`h-3.5 w-3.5 text-accent/70`}),(0,H.jsx)(`span`,{className:`text-[11px] font-medium tracking-widest text-accent/80 uppercase`,children:`GitNexus`})]}),(0,H.jsx)(`div`,{className:`mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-2xl border border-accent/30 bg-gradient-to-br from-accent/20 to-accent-dim/10 shadow-glow-soft`,children:(0,H.jsx)(jr,{className:`h-7 w-7 text-accent`})}),(0,H.jsx)(`h2`,{className:`text-lg leading-snug font-semibold text-text-primary`,children:t(`analyzeFirst.title`)}),(0,H.jsx)(`p`,{className:`mx-auto mt-1.5 max-w-xs text-sm leading-relaxed text-text-secondary`,children:t(`analyzeFirst.description`)})]})}),(0,H.jsx)(`div`,{className:`relative`,children:(0,H.jsx)(Ui,{variant:`onboarding`,onComplete:e})}),(0,H.jsx)(`p`,{className:`mt-5 text-center text-[11px] leading-relaxed text-text-muted`,children:t(`analyzeFirst.footer`)})]})};function Gi(e,t){let n=new Date(e),r=new Date().getTime()-n.getTime(),i=Math.floor(r/6e4);if(i<1)return t(`onboarding:landing.time.justNow`);if(i<60)return t(`onboarding:landing.time.minutesAgo`,{count:i});let a=Math.floor(i/60);if(a<24)return t(`onboarding:landing.time.hoursAgo`,{count:a});let o=Math.floor(a/24);return o<30?t(`onboarding:landing.time.daysAgo`,{count:o}):n.toLocaleDateString()}function Ki({repo:e,onClick:t}){let{t:n}=f([`common`,`onboarding`]),r=e.stats;return(0,H.jsxs)(`button`,{onClick:t,"data-testid":`landing-repo-card`,className:`group w-full cursor-pointer rounded-xl border border-border-default bg-elevated p-4 text-left transition-all duration-200 hover:border-accent/40 hover:bg-hover hover:shadow-glow-soft`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(jr,{className:`h-4 w-4 shrink-0 text-accent`}),(0,H.jsx)(`h3`,{className:`truncate text-sm font-semibold text-text-primary transition-colors group-hover:text-accent`,children:e.name})]}),e.indexedAt&&(0,H.jsx)(`p`,{className:`mt-1 pl-6 text-xs text-text-muted`,children:n(`onboarding:landing.indexed`,{time:Gi(e.indexedAt,n)})})]}),(0,H.jsx)(pr,{className:`h-4 w-4 shrink-0 text-text-muted opacity-0 transition-all duration-200 group-hover:translate-x-0.5 group-hover:text-accent group-hover:opacity-100`})]}),r&&(r.files||r.nodes)&&(0,H.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 pl-6`,children:[r.files!=null&&(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-void px-2 py-0.5 text-[11px] text-text-muted`,children:[(0,H.jsx)(Dr,{className:`h-3 w-3`}),` `,n(`common:counts.files`,{count:r.files})]}),r.nodes!=null&&(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-void px-2 py-0.5 text-[11px] text-text-muted`,children:[(0,H.jsx)(Lr,{className:`h-3 w-3`}),` `,n(`common:counts.symbols`,{count:r.nodes})]}),r.processes!=null&&r.processes>0&&(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-void px-2 py-0.5 text-[11px] text-text-muted`,children:[(0,H.jsx)(ai,{className:`h-3 w-3`}),` `,n(`common:counts.flows`,{count:r.processes})]})]})]})}var qi=({repos:e,onSelectRepo:t,onAnalyzeComplete:n})=>{let{t:r}=f(`onboarding`);return(0,H.jsxs)(`div`,{className:`relative animate-fade-in overflow-hidden rounded-3xl border border-border-default bg-surface p-7`,children:[(0,H.jsx)(`div`,{className:`pointer-events-none absolute -top-28 -right-28 h-72 w-72 rounded-full bg-accent/6 blur-3xl`}),(0,H.jsx)(`div`,{className:`pointer-events-none absolute -bottom-24 -left-24 h-56 w-56 rounded-full bg-node-function/6 blur-3xl`}),(0,H.jsx)(`div`,{className:`relative mb-6`,children:(0,H.jsxs)(`div`,{className:`text-center`,children:[(0,H.jsxs)(`div`,{className:`mb-2 inline-flex items-center gap-1.5`,children:[(0,H.jsx)(ai,{className:`h-3.5 w-3.5 text-accent/70`}),(0,H.jsx)(`span`,{className:`text-[11px] font-medium tracking-widest text-accent/80 uppercase`,children:`GitNexus`})]}),(0,H.jsx)(`h2`,{className:`text-lg leading-snug font-semibold text-text-primary`,children:r(`landing.chooseRepository`)}),(0,H.jsx)(`p`,{className:`mx-auto mt-1.5 max-w-xs text-sm leading-relaxed text-text-secondary`,children:r(`landing.description`)})]})}),(0,H.jsx)(`div`,{className:`relative mb-5 space-y-2`,children:e.map(e=>(0,H.jsx)(Ki,{repo:e,onClick:()=>t(Ae(e))},Ae(e)))}),(0,H.jsxs)(`div`,{className:`mb-5 flex items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`h-px flex-1 bg-border-subtle`}),(0,H.jsx)(`span`,{className:`text-[11px] tracking-widest text-text-muted uppercase`,children:r(`landing.orAnalyzeNew`)}),(0,H.jsx)(`div`,{className:`h-px flex-1 bg-border-subtle`})]}),(0,H.jsx)(`div`,{className:`relative`,children:(0,H.jsx)(Ui,{variant:`onboarding`,onComplete:n})}),(0,H.jsx)(`p`,{className:`mt-5 text-center text-[11px] leading-relaxed text-text-muted`,children:r(`landing.footer`)})]})};function Ji({activeKey:e,children:t}){let[n,r]=(0,P.useState)(e),[i,a]=(0,P.useState)(!1),o=(0,P.useRef)(t),s=(0,P.useRef)(null);return!i&&e===n&&(o.current=t),(0,P.useEffect)(()=>(e!==n&&(a(!0),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{o.current=null,r(e),a(!1)},300)),()=>{s.current&&clearTimeout(s.current)}),[e,n]),(0,H.jsx)(`div`,{className:`transition-[opacity,transform] duration-300 ease-out`,style:{opacity:+!i,transform:i?`scale(0.97) translateY(8px)`:`scale(1) translateY(0)`},children:i?o.current:t})}function Yi(){let{t:e}=f(`onboarding`);return(0,H.jsxs)(`div`,{className:`relative overflow-hidden rounded-3xl border border-emerald-500/20 bg-surface p-7`,role:`status`,"aria-live":`polite`,children:[(0,H.jsx)(`div`,{className:`pointer-events-none absolute -top-20 left-1/2 h-64 w-64 -translate-x-1/2 rounded-full bg-emerald-500/8 blur-3xl`}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`div`,{className:`mx-auto mb-5 flex h-16 w-16 items-center justify-center rounded-2xl border border-emerald-500/30 bg-gradient-to-br from-emerald-500/20 to-emerald-600/10 shadow-[0_0_30px_rgba(16,185,129,0.15)]`,children:(0,H.jsx)(vr,{className:`h-8 w-8 text-emerald-400`})}),(0,H.jsx)(`h2`,{className:`mb-2 text-center text-lg font-semibold text-emerald-400`,children:e(`success.title`)}),(0,H.jsx)(`p`,{className:`text-center text-sm leading-relaxed text-text-secondary`,children:e(`success.description`)}),(0,H.jsx)(`div`,{className:`mt-6 flex items-center justify-center gap-2`,children:(0,H.jsx)(`div`,{className:`flex gap-1`,children:[0,1,2].map(e=>(0,H.jsx)(`div`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-emerald-400/60`,style:{animationDelay:`${e*200}ms`}},e))})})]})]})}function Xi({message:e}){let{t}=f([`common`,`onboarding`]);return(0,H.jsxs)(`div`,{className:`relative overflow-hidden rounded-3xl border border-accent/20 bg-surface p-7`,role:`status`,"aria-live":`polite`,children:[(0,H.jsx)(`div`,{className:`pointer-events-none absolute -top-20 left-1/2 h-64 w-64 -translate-x-1/2 rounded-full bg-accent/8 blur-3xl`}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`div`,{className:`mx-auto mb-5 flex h-16 w-16 items-center justify-center rounded-2xl border border-accent/30 bg-gradient-to-br from-accent/20 to-accent-dim/10 shadow-glow-soft`,children:(0,H.jsx)(Vr,{className:`h-8 w-8 animate-spin text-accent`})}),(0,H.jsx)(`h2`,{className:`mb-2 text-center text-lg font-semibold text-text-primary`,children:e||t(`common:progress.connectingShort`)}),(0,H.jsx)(`p`,{className:`text-center text-sm leading-relaxed text-text-secondary`,children:t(`onboarding:loading.largeRepoHint`)}),(0,H.jsx)(`div`,{className:`mt-5 flex items-center justify-center`,children:(0,H.jsx)(ai,{className:`h-4 w-4 text-accent/30`})})]})]})}var Zi=({onServerConnect:e})=>{let{t}=f([`common`,`errors`]),[n,r]=(0,P.useState)(null),{isConnected:i,isProbing:a,startPolling:o,stopPolling:s,isPolling:c,backendUrl:l}=yi(),[u,d]=(0,P.useState)(!1),p=(0,P.useRef)(!1),m=(0,P.useRef)(null),[h,g]=(0,P.useState)(`onboarding`),[_,v]=(0,P.useState)(``),y=(0,P.useRef)(null),[b,x]=(0,P.useState)([]),S=async()=>{g(`loading`),v(t(`common:progress.connectingShort`)),r(null);try{let e=await qe();if(e.length===0){g(`analyze`),p.current=!1;return}x(e),g(`landing`)}catch(e){if(e.name===`AbortError`)return;r(Mi(e,t)),g(`onboarding`)}},C=(0,P.useRef)(S);C.current=S;let w=n=>{p.current=!0,g(`loading`),v(t(`common:progress.loadingGraph`)),r(null),(async()=>{let i=new AbortController;y.current=i;try{let r=await ct(l,(e,n,r)=>{if(e===`validating`)v(t(`common:progress.validatingServerEllipsis`));else if(e===`downloading`){let e=r?Math.round(n/r*100):null,i=(n/(1024*1024)).toFixed(1);v(e?t(`common:progress.downloadingWithPercent`,{percent:e}):t(`common:progress.downloadingMb`,{mb:i}))}else e===`extracting`&&v(t(`common:progress.processingGraph`))},i.signal,n);e&&await e(r,l)}catch(e){if(e.name===`AbortError`)return;r(Mi(e,t)),g(b.length>0?`landing`:`analyze`)}finally{y.current=null}})()};(0,P.useEffect)(()=>{!a&&!u&&d(!0)},[a,u]),(0,P.useEffect)(()=>{u&&!i&&!c&&!p.current&&o()},[u,i,c,o]),(0,P.useEffect)(()=>{i&&!p.current&&(p.current=!0,s(),g(`success`),m.current=setTimeout(()=>{m.current=null,C.current()},1200)),!i&&p.current&&!a&&(p.current=!1,m.current!==null&&(clearTimeout(m.current),m.current=null),g(`onboarding`),r(null))},[i,a,s]),(0,P.useEffect)(()=>()=>{m.current!==null&&clearTimeout(m.current),y.current?.abort()},[]);let T=u?h:null;return(0,H.jsxs)(`div`,{className:`flex min-h-screen items-center justify-center bg-void p-8`,children:[(0,H.jsxs)(`div`,{className:`pointer-events-none fixed inset-0`,children:[(0,H.jsx)(`div`,{className:`absolute top-1/4 left-1/4 h-96 w-96 rounded-full bg-accent/10 blur-3xl`}),(0,H.jsx)(`div`,{className:`absolute right-1/4 bottom-1/4 h-96 w-96 rounded-full bg-node-interface/10 blur-3xl`})]}),(0,H.jsxs)(`div`,{className:`relative w-full max-w-lg`,children:[n&&(0,H.jsx)(`div`,{className:`mb-4 animate-fade-in rounded-xl border border-red-500/30 bg-red-500/10 p-3 text-center text-sm text-red-400`,children:n}),T&&(0,H.jsxs)(Ji,{activeKey:T,children:[T===`onboarding`&&(0,H.jsx)(Ti,{isPolling:c}),T===`analyze`&&(0,H.jsx)(Wi,{onComplete:w}),T===`landing`&&(0,H.jsx)(qi,{repos:b,onSelectRepo:w,onAnalyzeComplete:w}),T===`success`&&(0,H.jsx)(Yi,{}),T===`loading`&&(0,H.jsx)(Xi,{message:_})]})]})]})},Qi=({progress:e})=>{let{t}=f([`common`,`graph`]),n=Di(e.message,t),r=Di(e.detail,t);return(0,H.jsxs)(`div`,{className:`fixed inset-0 z-50 flex flex-col items-center justify-center bg-void`,children:[(0,H.jsxs)(`div`,{className:`pointer-events-none absolute inset-0`,children:[(0,H.jsx)(`div`,{className:`absolute top-1/3 left-1/3 h-96 w-96 animate-pulse rounded-full bg-accent/10 blur-3xl`}),(0,H.jsx)(`div`,{className:`absolute right-1/3 bottom-1/3 h-96 w-96 animate-pulse rounded-full bg-node-interface/10 blur-3xl`})]}),(0,H.jsxs)(`div`,{className:`relative mb-10`,children:[(0,H.jsx)(`div`,{className:`h-28 w-28 animate-pulse-glow rounded-full bg-gradient-to-br from-accent to-node-interface`}),(0,H.jsx)(`div`,{className:`absolute inset-0 h-28 w-28 rounded-full bg-gradient-to-br from-accent to-node-interface opacity-50 blur-xl`})]}),(0,H.jsx)(`div`,{className:`mb-4 w-80`,children:(0,H.jsx)(`div`,{className:`h-1.5 overflow-hidden rounded-full bg-elevated`,children:(0,H.jsx)(`div`,{className:`h-full rounded-full bg-gradient-to-r from-accent to-node-interface transition-all duration-300 ease-out`,style:{width:`${e.percent}%`}})})}),(0,H.jsxs)(`div`,{className:`text-center`,children:[(0,H.jsxs)(`p`,{className:`mb-1 font-mono text-sm text-text-secondary`,children:[n,(0,H.jsx)(`span`,{className:`animate-pulse`,children:`|`})]}),e.detail&&(0,H.jsx)(`p`,{className:`max-w-md truncate font-mono text-xs text-text-muted`,children:r})]}),e.stats&&(0,H.jsxs)(`div`,{className:`mt-8 flex items-center gap-6 text-xs text-text-muted`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-node-file`}),(0,H.jsx)(`span`,{children:t(`graph:loading.filesProgress`,{processed:e.stats.filesProcessed,total:e.stats.totalFiles})})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-node-function`}),(0,H.jsx)(`span`,{children:t(`common:counts.nodes`,{count:e.stats.nodesCreated})})]})]}),(0,H.jsxs)(`p`,{className:`mt-4 font-mono text-3xl font-semibold text-text-primary`,children:[e.percent,`%`]})]})},$i=({isOpen:e,onClose:t,onUseCPU:n,onSkip:r,nodeCount:i})=>{let{t:a}=f(`graph`),[o,s]=(0,P.useState)(!0),[c,l]=(0,P.useState)(!1);if((0,P.useEffect)(()=>{e?requestAnimationFrame(()=>l(!0)):l(!1)},[e]),!e)return null;let u=Math.ceil(i*50/6e4),d=i<200;return(0,H.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,H.jsx)(`div`,{className:`absolute inset-0 bg-black/60 backdrop-blur-sm transition-opacity duration-200 ${c?`opacity-100`:`opacity-0`}`,onClick:t}),(0,H.jsxs)(`div`,{className:`relative mx-4 w-full max-w-md overflow-hidden rounded-2xl border border-border-subtle bg-surface shadow-2xl transition-all duration-200 ${c?`scale-100 opacity-100`:`scale-95 opacity-0`}`,children:[(0,H.jsxs)(`div`,{className:`relative border-b border-border-subtle bg-gradient-to-r from-amber-500/20 to-orange-500/20 px-6 py-5`,children:[(0,H.jsx)(`button`,{onClick:t,className:`absolute top-4 right-4 p-1 text-text-muted transition-colors hover:text-text-primary`,children:(0,H.jsx)(gi,{className:`h-5 w-5`})}),(0,H.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,H.jsx)(`div`,{className:`text-5xl ${o?`animate-bounce`:``}`,onAnimationEnd:()=>s(!1),onClick:()=>s(!0),children:`🤔`}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{className:`text-lg font-semibold text-text-primary`,children:a(`embedding.fallback.title`)}),(0,H.jsx)(`p`,{className:`mt-0.5 text-sm text-text-muted`,children:a(`embedding.fallback.subtitle`)})]})]})]}),(0,H.jsxs)(`div`,{className:`space-y-4 px-6 py-5`,children:[(0,H.jsx)(`p`,{className:`text-sm leading-relaxed text-text-secondary`,children:a(`embedding.fallback.description`)}),(0,H.jsxs)(`div`,{className:`rounded-lg border border-border-subtle bg-elevated/50 p-4`,children:[(0,H.jsx)(`p`,{className:`text-sm text-text-secondary`,children:(0,H.jsx)(`span`,{className:`font-medium text-text-primary`,children:a(`embedding.fallback.options`)})}),(0,H.jsxs)(`ul`,{className:`mt-2 space-y-1.5 text-sm text-text-muted`,children:[(0,H.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,H.jsx)(ii,{className:`mt-0.5 h-4 w-4 flex-shrink-0 text-amber-400`}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{className:`text-text-secondary`,children:a(`embedding.fallback.useCpu`)}),` `,`—`,` `,a(d?`embedding.fallback.useCpuDescriptionSmall`:`embedding.fallback.useCpuDescriptionLarge`),i>0&&(0,H.jsxs)(`span`,{className:`text-text-muted`,children:[` `,a(`embedding.fallback.estimated`,{minutes:u,count:i})]})]})]}),(0,H.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,H.jsx)(ri,{className:`mt-0.5 h-4 w-4 flex-shrink-0 text-blue-400`}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`strong`,{className:`text-text-secondary`,children:a(`embedding.fallback.skipIt`)}),` `,`— `,a(`embedding.fallback.skipDescription`)]})]})]})]}),d&&(0,H.jsxs)(`p`,{className:`flex items-center gap-1.5 rounded-lg bg-node-function/10 px-3 py-2 text-xs text-node-function`,children:[(0,H.jsx)(Zr,{className:`h-3.5 w-3.5`}),a(`embedding.fallback.smallCodebase`)]}),(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:a(`embedding.fallback.tip`)})]}),(0,H.jsxs)(`div`,{className:`flex gap-3 border-t border-border-subtle bg-elevated/30 px-6 py-4`,children:[(0,H.jsxs)(`button`,{onClick:r,className:`flex flex-1 items-center justify-center gap-2 rounded-lg border border-border-subtle bg-surface px-4 py-2.5 text-sm font-medium text-text-secondary transition-all hover:bg-hover hover:text-text-primary`,children:[(0,H.jsx)(ri,{className:`h-4 w-4`}),a(`embedding.fallback.skipEmbeddings`)]}),(0,H.jsxs)(`button`,{onClick:n,className:`flex flex-1 items-center justify-center gap-2 rounded-lg px-4 py-2.5 text-sm font-medium transition-all ${d?`bg-node-function text-white hover:bg-node-function/90`:`border border-amber-500/30 bg-amber-500/20 text-amber-300 hover:bg-amber-500/30`}`,children:[(0,H.jsx)(ii,{className:`h-4 w-4`}),a(d?`embedding.fallback.useCpuRecommended`:`embedding.fallback.useCpuSlow`)]})]})]})]})},ea=()=>{let{t:e}=f(`graph`),{embeddingStatus:t,embeddingProgress:n,startEmbeddings:r,graph:i,viewMode:a,serverBaseUrl:o}=dr(),[s,c]=(0,P.useState)(!1);if(a!==`exploring`||!i||o)return null;let l=i.nodes.length,u=async e=>{try{await r()}catch(e){e?.name===`WebGPUNotAvailableError`||e?.message?.includes(`WebGPU not available`)?c(!0):console.error(`Embedding failed:`,e)}},d=(0,H.jsx)($i,{isOpen:s,onClose:()=>c(!1),onUseCPU:()=>{c(!1),u(`wasm`)},onSkip:()=>{c(!1)},nodeCount:l});if(t===`idle`)return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,H.jsxs)(`button`,{onClick:()=>u(),className:`group flex items-center gap-2 rounded-lg border border-border-subtle bg-surface px-3 py-1.5 text-sm text-text-secondary transition-all hover:border-accent/50 hover:bg-hover hover:text-text-primary`,title:e(`embedding.generateTitle`),children:[(0,H.jsx)(_r,{className:`h-4 w-4 text-node-interface transition-colors group-hover:text-accent`}),(0,H.jsx)(`span`,{className:`hidden sm:inline`,children:e(`embedding.enable`)}),(0,H.jsx)(_i,{className:`h-3 w-3 text-text-muted`})]})}),d]});if(t===`loading`){let t=n?.percent??0;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-lg border border-accent/30 bg-surface px-3 py-1.5 text-sm`,children:[(0,H.jsx)(Vr,{className:`h-4 w-4 animate-spin text-accent`}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,H.jsx)(`span`,{className:`text-xs text-text-secondary`,children:e(`embedding.loadingModel`)}),(0,H.jsx)(`div`,{className:`h-1 w-24 overflow-hidden rounded-full bg-elevated`,children:(0,H.jsx)(`div`,{className:`h-full rounded-full bg-gradient-to-r from-accent to-node-interface transition-all duration-300`,style:{width:`${t}%`}})})]})]}),d]})}if(t===`embedding`){let t=n?.percent??0;return(0,H.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-lg border border-node-function/30 bg-surface px-3 py-1.5 text-sm`,children:[(0,H.jsx)(Vr,{className:`h-4 w-4 animate-spin text-node-function`}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,H.jsx)(`span`,{className:`text-xs text-text-secondary`,children:e(`embedding.embeddingNodes`,{processed:0,total:0})}),(0,H.jsx)(`div`,{className:`h-1 w-24 overflow-hidden rounded-full bg-elevated`,children:(0,H.jsx)(`div`,{className:`h-full rounded-full bg-gradient-to-r from-node-function to-accent transition-all duration-300`,style:{width:`${t}%`}})})]})]})}return t===`indexing`?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-node-interface/30 bg-surface px-3 py-1.5 text-sm text-text-secondary`,children:[(0,H.jsx)(Vr,{className:`h-4 w-4 animate-spin text-node-interface`}),(0,H.jsx)(`span`,{className:`text-xs`,children:e(`embedding.creatingIndex`)})]}):t===`ready`?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-node-function/30 bg-node-function/10 px-3 py-1.5 text-sm text-node-function`,title:e(`embedding.readyTitle`),children:[(0,H.jsx)(vr,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`text-xs font-medium`,children:e(`embedding.ready`)})]}):t===`error`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`button`,{onClick:()=>u(),className:`flex items-center gap-2 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-1.5 text-sm text-red-400 transition-colors hover:bg-red-500/20`,title:e(`embedding.errorTitle`),children:[(0,H.jsx)(Sr,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`text-xs`,children:e(`embedding.failedRetry`)})]}),d]}):null},ta=()=>{let{t:e,i18n:t}=f(`header`),n=t.resolvedLanguage||t.language,r=An.find(e=>e.code.toLowerCase()===n.toLowerCase())??An[0],i=e=>{t.changeLanguage(e)};return(0,H.jsxs)(`label`,{className:`flex h-9 items-center gap-1.5 rounded-md border border-border-subtle bg-surface px-2 text-text-secondary transition-colors hover:border-border-default hover:bg-hover hover:text-text-primary`,title:e(`selectLanguage`),children:[(0,H.jsx)(Mr,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`sr-only`,children:e(`language`)}),(0,H.jsx)(`select`,{"data-testid":`language-switcher`,value:r.code,"aria-label":e(`selectLanguage`),onChange:e=>i(e.target.value),className:`cursor-pointer border-none bg-transparent text-xs font-medium outline-none`,children:An.map(e=>(0,H.jsx)(`option`,{value:e.code,className:`bg-surface text-text-primary`,children:e.nativeName},e.code))})]})},na={Folder:`#6366f1`,File:`#3b82f6`,Function:`#10b981`,Class:`#f59e0b`,Method:`#14b8a6`,Interface:`#ec4899`,Variable:`#64748b`,Import:`#475569`,Type:`#a78bfa`},ra=({onFocusNode:e,availableRepos:t=[],onSwitchRepo:n,onAnalyzeComplete:r,onReposChanged:i})=>{let{t:a}=f([`common`,`header`,`errors`]),{projectName:o,currentRepo:s,graph:c,graphMode:l,openChatPanel:u,isRightPanelOpen:d,rightPanelTab:m,setSettingsPanelOpen:h,setHelpDialogBoxOpen:g}=dr(),[_,v]=(0,P.useState)(``),[y,b]=(0,P.useState)(``),[x,S]=(0,P.useState)(!1),[C,w]=(0,P.useState)(!1),[T,E]=(0,P.useState)(null),[D,O]=(0,P.useState)(null),[k,A]=(0,P.useState)(null),j=(0,P.useRef)(null),M=(0,P.useRef)(null),[N,F]=(0,P.useState)(!1),[I,L]=(0,P.useState)(0),R=(0,P.useRef)(null),ee=(0,P.useRef)(null),te=c?.nodes.length??0,ne=c?.relationships.length??0,re=(0,P.useMemo)(()=>{if(!c||!_.trim())return[];let e=_.toLowerCase();return c.nodes.filter(t=>t.properties.name.toLowerCase().includes(e)).slice(0,10)},[c,_]),z=(0,P.useMemo)(()=>{let e=y.trim().toLowerCase();return e?t.filter(t=>t.name.toLowerCase().includes(e)):t},[t,y]),B=s??o;(0,P.useEffect)(()=>{let e=e=>{R.current&&!R.current.contains(e.target)&&F(!1),M.current&&!M.current.contains(e.target)&&(S(!1),w(!1),b(``))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]),(0,P.useEffect)(()=>()=>{j.current?.abort()},[]),(0,P.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`k`&&(e.preventDefault(),ee.current?.focus(),F(!0)),e.key===`Escape`&&(F(!1),ee.current?.blur())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[]);let ie=e=>{if(!(!N||re.length===0)){if(e.key===`ArrowDown`)e.preventDefault(),L(e=>Math.min(e+1,re.length-1));else if(e.key===`ArrowUp`)e.preventDefault(),L(e=>Math.max(e-1,0));else if(e.key===`Enter`){e.preventDefault();let t=re[I];t&&ae(t)}}},ae=t=>{e?.(t.id),v(``),F(!1),L(0)};return(0,H.jsxs)(`header`,{className:`flex items-center justify-between border-b border-dashed border-border-subtle bg-deep px-5 py-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,H.jsx)(`div`,{className:`flex h-7 w-7 items-center justify-center rounded-md bg-gradient-to-br from-accent to-node-interface text-sm font-bold text-white shadow-glow`,children:`◇`}),(0,H.jsx)(`span`,{className:`text-[15px] font-semibold tracking-tight`,children:`GitNexus`})]}),o&&(0,H.jsxs)(`div`,{className:`relative`,ref:M,children:[(0,H.jsxs)(`button`,{"data-testid":`repo-switcher-trigger`,onClick:()=>{let e=!x;S(e),w(!1),e||b(``)},className:`flex cursor-pointer items-center gap-2 rounded-lg border px-3 py-1.5 text-sm transition-all ${x?`border-accent/40 bg-accent/10 text-text-primary`:`border-border-subtle bg-surface text-text-secondary hover:border-border-default hover:bg-hover`} `,children:[(0,H.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-node-function`}),(0,H.jsx)(`span`,{className:`max-w-[160px] truncate`,children:o}),(0,H.jsx)(yr,{className:`h-3 w-3 text-text-muted transition-transform duration-200 ${x?`rotate-180`:``}`})]}),x&&(0,H.jsx)(`div`,{className:`absolute top-full left-0 z-50 mt-1.5 flex max-h-[calc(100vh-4.5rem)] w-80 animate-slide-up flex-col overflow-hidden rounded-xl border border-border-subtle bg-surface shadow-xl`,children:C?(0,H.jsx)(`div`,{className:`scrollbar-thin overflow-y-auto p-4`,children:(0,H.jsx)(Ui,{variant:`sheet`,onComplete:e=>{w(!1),S(!1),b(``),r?.(e)},onCancel:()=>w(!1)})}):(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[t.length>0&&(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,H.jsx)(`div`,{className:`shrink-0 px-3 pt-2.5 pb-1.5 text-[10px] font-medium tracking-wider text-text-muted uppercase`,children:a(`header:repositories`)}),(0,H.jsx)(`div`,{className:`shrink-0 px-3 pb-2`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border-subtle bg-deep/70 px-2.5 py-1.5 transition-colors focus-within:border-accent/60`,children:[(0,H.jsx)($r,{className:`h-3.5 w-3.5 shrink-0 text-text-muted`}),(0,H.jsx)(`input`,{type:`text`,"aria-label":a(`header:searchRepositories`),placeholder:a(`header:searchRepositories`),value:y,onChange:e=>b(e.target.value),className:`min-w-0 flex-1 border-none bg-transparent text-xs text-text-primary outline-none placeholder:text-text-muted`})]})}),(0,H.jsx)(`div`,{className:`scrollbar-thin min-h-0 flex-1 overflow-y-auto pb-1`,children:z.length===0?(0,H.jsx)(`div`,{className:`px-4 py-3 text-sm text-text-muted`,children:a(`header:noRepositoriesFound`,{query:y})}):z.map(e=>{let t=Ae(e),o=t===B;return(0,H.jsxs)(`div`,{"data-testid":`repo-switcher-row`,"data-active":o,className:`group flex items-center gap-2 px-4 py-2 transition-colors ${o?`border-l-2 border-accent bg-accent/10`:`hover:bg-hover`}`,children:[(0,H.jsxs)(`button`,{onClick:()=>{o||n?.(t),S(!1),b(``)},className:`flex min-w-0 flex-1 cursor-pointer items-center gap-3 text-left`,children:[(0,H.jsx)(Or,{className:`h-3.5 w-3.5 shrink-0 text-node-folder`}),(0,H.jsx)(`span`,{className:`flex-1 truncate font-mono text-sm text-text-primary`,children:e.name}),o&&(0,H.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-accent`,children:a(`header:active`)})]}),(0,H.jsx)(`button`,{"data-testid":`repo-switcher-reanalyze`,onClick:async n=>{if(n.stopPropagation(),!T){E(t),A({phase:`queued`,percent:0,message:a(`common:progress.starting`)});try{let{jobId:n}=await rt({path:e.path,force:!0});j.current=at(n,e=>A(e),()=>{E(null),A(null),j.current=null,r?.(t)},e=>{console.error(`Re-analyze failed:`,e),E(null),A(null),j.current=null})}catch(e){console.error(`Failed to start re-analysis:`,e),E(null),A(null)}}},disabled:!!T,className:`cursor-pointer rounded p-1 transition-all ${T===t?`text-accent`:`text-text-muted/0 group-hover:text-text-muted hover:!text-accent`}`,title:T===t?a(`header:reanalyzing`):a(`header:reanalyzeRepo`,{repoName:e.name}),children:(0,H.jsx)(Xr,{className:`h-3.5 w-3.5 ${T===t?`animate-spin`:``}`})}),(0,H.jsx)(`button`,{"data-testid":`repo-switcher-delete`,onClick:async e=>{e.stopPropagation(),T===t&&(j.current?.abort(),E(null),A(null),j.current=null),O(null);try{await Ge(t);let e=await qe();if(i?.(e),o&&e.length>0){let t=new URL(window.location.href);t.searchParams.delete(`repo`),t.searchParams.delete(`project`),window.history.replaceState(null,``,t.toString()),n?.(Ae(e[0]))}else if(e.length===0){let e=new URL(window.location.href);e.searchParams.delete(`repo`),e.searchParams.delete(`project`),e.searchParams.delete(`skipGraph`),window.history.replaceState(null,``,e.toString()),window.location.reload()}}catch(e){console.error(`Failed to delete repo:`,e),O(Mi(e,a))}},className:`cursor-pointer rounded p-1 text-text-muted/0 transition-all group-hover:text-text-muted hover:!text-red-400`,title:a(`header:deleteRepo`,{repoName:e.name}),children:(0,H.jsx)(di,{className:`h-3.5 w-3.5`})})]},t)})})]}),D&&(0,H.jsx)(`div`,{className:`px-3 py-2 text-xs text-red-400`,role:`alert`,children:D}),T&&k&&(0,H.jsxs)(`div`,{className:`border-t border-border-subtle bg-accent/5 px-4 py-2.5`,children:[(0,H.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-2`,children:[(0,H.jsx)(Vr,{className:`h-3 w-3 shrink-0 animate-spin text-accent`}),(0,H.jsx)(`span`,{className:`truncate text-xs text-text-secondary`,children:a(`header:reanalyzingRepo`,{repoName:t.find(e=>Ae(e)===T)?.name??T.split(/[/\\]/).filter(Boolean).at(-1)??T,message:Di(k.message,a)})})]}),(0,H.jsx)(`div`,{className:`h-1 overflow-hidden rounded-full bg-elevated`,children:(0,H.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-all duration-300`,style:{width:`${Math.max(2,k.percent)}%`}})})]}),(0,H.jsx)(`div`,{className:t.length>0||T?`border-t border-border-subtle`:``,children:(0,H.jsxs)(`button`,{onClick:()=>{b(``),w(!0)},disabled:!!T,className:`flex w-full cursor-pointer items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-hover disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,H.jsx)(ai,{className:`h-3.5 w-3.5 shrink-0 text-accent`}),(0,H.jsx)(`span`,{className:`text-sm text-text-secondary`,children:a(`header:analyzeNew`)})]})})]})})]})]}),(0,H.jsxs)(`div`,{className:`relative mx-6 max-w-md flex-1`,ref:R,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-lg border border-border-subtle bg-surface px-3.5 py-2 transition-all focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20`,children:[(0,H.jsx)($r,{className:`h-4 w-4 flex-shrink-0 text-text-muted`}),(0,H.jsx)(`input`,{ref:ee,type:`text`,placeholder:a(`header:searchNodes`),value:_,onChange:e=>{v(e.target.value),F(!0),L(0)},onFocus:()=>F(!0),onKeyDown:ie,className:`flex-1 border-none bg-transparent text-sm text-text-primary outline-none placeholder:text-text-muted`}),(0,H.jsx)(`kbd`,{className:`rounded border border-border-subtle bg-elevated px-1.5 py-0.5 font-mono text-[10px] text-text-muted`,children:`⌘K`})]}),N&&_.trim()&&(0,H.jsx)(`div`,{className:`absolute top-full right-0 left-0 z-50 mt-1 overflow-hidden rounded-xl border border-border-subtle bg-surface shadow-xl`,children:re.length===0?(0,H.jsx)(`div`,{className:`px-4 py-3 text-sm text-text-muted`,children:a(`header:noNodesFound`,{query:_})}):(0,H.jsx)(`div`,{className:`max-h-80 overflow-y-auto`,children:re.map((e,t)=>(0,H.jsxs)(`button`,{onClick:()=>ae(e),className:`flex w-full cursor-pointer items-center gap-3 px-4 py-2.5 text-left transition-colors ${t===I?`bg-accent/20 text-text-primary`:`text-text-secondary hover:bg-hover`}`,children:[(0,H.jsx)(`span`,{className:`h-2.5 w-2.5 flex-shrink-0 rounded-full`,style:{backgroundColor:na[e.label]||`#6b7280`}}),(0,H.jsx)(`span`,{className:`flex-1 truncate text-sm font-medium`,children:e.properties.name}),(0,H.jsx)(`span`,{className:`rounded bg-elevated px-2 py-0.5 text-xs text-text-muted`,children:e.label})]},e.id))})})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(`a`,{href:`https://github.com/abhigyanpatwari/GitNexus`,target:`_blank`,rel:`noopener noreferrer`,className:`group flex items-center gap-2 rounded-lg bg-gradient-to-r from-purple-600 to-pink-600 px-3.5 py-2 text-sm font-medium text-white shadow-lg transition-all duration-200 hover:-translate-y-0.5 hover:from-purple-500 hover:to-pink-500 hover:shadow-xl`,children:[(0,H.jsx)(p,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`hidden sm:inline`,children:a(`header:starIfCool`)}),(0,H.jsx)(si,{className:`h-3.5 w-3.5 transition-all group-hover:fill-yellow-300 group-hover:text-yellow-300`}),(0,H.jsx)(`span`,{className:`hidden sm:inline`,children:`✨`})]}),c&&l!==`chatOnly`&&(0,H.jsxs)(`div`,{className:`mr-2 flex items-center gap-4 text-xs text-text-muted`,children:[(0,H.jsx)(`span`,{children:a(`common:counts.nodes`,{count:te})}),(0,H.jsx)(`span`,{children:a(`common:counts.edges`,{count:ne})})]}),(0,H.jsx)(ea,{}),(0,H.jsx)(ta,{}),(0,H.jsx)(`button`,{onClick:()=>h(!0),className:`flex h-9 w-9 cursor-pointer items-center justify-center rounded-md text-text-secondary transition-colors hover:bg-hover hover:text-text-primary`,title:a(`header:aiSettings`),children:(0,H.jsx)(ni,{className:`h-4.5 w-4.5`})}),(0,H.jsx)(`button`,{title:a(`header:help`),onClick:()=>g(!0),className:`flex h-9 w-9 cursor-pointer items-center justify-center rounded-md text-text-secondary transition-colors hover:bg-hover hover:text-text-primary`,children:(0,H.jsx)(Cr,{className:`h-4.5 w-4.5`})}),(0,H.jsxs)(`button`,{onClick:u,className:`flex items-center gap-1.5 rounded-lg px-3.5 py-2 text-sm font-medium transition-all ${d&&m===`chat`?`bg-accent text-white shadow-glow`:`bg-gradient-to-r from-accent to-accent-dim text-white shadow-glow hover:-translate-y-0.5 hover:shadow-lg`} `,children:[(0,H.jsx)(ai,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{children:a(`common:app.nexusAI`)})]})]})]})};function ia(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function aa(e){var t=ia(e,`string`);return typeof t==`symbol`?t:t+``}function oa(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function sa(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,aa(r.key),r)}}function ca(e,t,n){return t&&sa(e.prototype,t),n&&sa(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function la(e){return la=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},la(e)}function ua(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ua=function(){return!!e})()}function da(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function fa(e,t){if(t&&(typeof t==`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return da(e)}function pa(e,t,n){return t=la(t),fa(e,ua()?Reflect.construct(t,n||[],la(e).constructor):t.apply(e,n))}function ma(e,t){return ma=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ma(e,t)}function ha(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ma(e,t)}function ga(e){if(Array.isArray(e))return e}function _a(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function va(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ya(e,t){if(e){if(typeof e==`string`)return va(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?va(e,t):void 0}}function ba(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
15
15
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xa(e,t){return ga(e)||_a(e,t)||ya(e,t)||ba()}var Sa={black:`#000000`,silver:`#C0C0C0`,gray:`#808080`,grey:`#808080`,white:`#FFFFFF`,maroon:`#800000`,red:`#FF0000`,purple:`#800080`,fuchsia:`#FF00FF`,green:`#008000`,lime:`#00FF00`,olive:`#808000`,yellow:`#FFFF00`,navy:`#000080`,blue:`#0000FF`,teal:`#008080`,aqua:`#00FFFF`,darkblue:`#00008B`,mediumblue:`#0000CD`,darkgreen:`#006400`,darkcyan:`#008B8B`,deepskyblue:`#00BFFF`,darkturquoise:`#00CED1`,mediumspringgreen:`#00FA9A`,springgreen:`#00FF7F`,cyan:`#00FFFF`,midnightblue:`#191970`,dodgerblue:`#1E90FF`,lightseagreen:`#20B2AA`,forestgreen:`#228B22`,seagreen:`#2E8B57`,darkslategray:`#2F4F4F`,darkslategrey:`#2F4F4F`,limegreen:`#32CD32`,mediumseagreen:`#3CB371`,turquoise:`#40E0D0`,royalblue:`#4169E1`,steelblue:`#4682B4`,darkslateblue:`#483D8B`,mediumturquoise:`#48D1CC`,indigo:`#4B0082`,darkolivegreen:`#556B2F`,cadetblue:`#5F9EA0`,cornflowerblue:`#6495ED`,rebeccapurple:`#663399`,mediumaquamarine:`#66CDAA`,dimgray:`#696969`,dimgrey:`#696969`,slateblue:`#6A5ACD`,olivedrab:`#6B8E23`,slategray:`#708090`,slategrey:`#708090`,lightslategray:`#778899`,lightslategrey:`#778899`,mediumslateblue:`#7B68EE`,lawngreen:`#7CFC00`,chartreuse:`#7FFF00`,aquamarine:`#7FFFD4`,skyblue:`#87CEEB`,lightskyblue:`#87CEFA`,blueviolet:`#8A2BE2`,darkred:`#8B0000`,darkmagenta:`#8B008B`,saddlebrown:`#8B4513`,darkseagreen:`#8FBC8F`,lightgreen:`#90EE90`,mediumpurple:`#9370DB`,darkviolet:`#9400D3`,palegreen:`#98FB98`,darkorchid:`#9932CC`,yellowgreen:`#9ACD32`,sienna:`#A0522D`,brown:`#A52A2A`,darkgray:`#A9A9A9`,darkgrey:`#A9A9A9`,lightblue:`#ADD8E6`,greenyellow:`#ADFF2F`,paleturquoise:`#AFEEEE`,lightsteelblue:`#B0C4DE`,powderblue:`#B0E0E6`,firebrick:`#B22222`,darkgoldenrod:`#B8860B`,mediumorchid:`#BA55D3`,rosybrown:`#BC8F8F`,darkkhaki:`#BDB76B`,mediumvioletred:`#C71585`,indianred:`#CD5C5C`,peru:`#CD853F`,chocolate:`#D2691E`,tan:`#D2B48C`,lightgray:`#D3D3D3`,lightgrey:`#D3D3D3`,thistle:`#D8BFD8`,orchid:`#DA70D6`,goldenrod:`#DAA520`,palevioletred:`#DB7093`,crimson:`#DC143C`,gainsboro:`#DCDCDC`,plum:`#DDA0DD`,burlywood:`#DEB887`,lightcyan:`#E0FFFF`,lavender:`#E6E6FA`,darksalmon:`#E9967A`,violet:`#EE82EE`,palegoldenrod:`#EEE8AA`,lightcoral:`#F08080`,khaki:`#F0E68C`,aliceblue:`#F0F8FF`,honeydew:`#F0FFF0`,azure:`#F0FFFF`,sandybrown:`#F4A460`,wheat:`#F5DEB3`,beige:`#F5F5DC`,whitesmoke:`#F5F5F5`,mintcream:`#F5FFFA`,ghostwhite:`#F8F8FF`,salmon:`#FA8072`,antiquewhite:`#FAEBD7`,linen:`#FAF0E6`,lightgoldenrodyellow:`#FAFAD2`,oldlace:`#FDF5E6`,magenta:`#FF00FF`,deeppink:`#FF1493`,orangered:`#FF4500`,tomato:`#FF6347`,hotpink:`#FF69B4`,coral:`#FF7F50`,darkorange:`#FF8C00`,lightsalmon:`#FFA07A`,orange:`#FFA500`,lightpink:`#FFB6C1`,pink:`#FFC0CB`,gold:`#FFD700`,peachpuff:`#FFDAB9`,navajowhite:`#FFDEAD`,moccasin:`#FFE4B5`,bisque:`#FFE4C4`,mistyrose:`#FFE4E1`,blanchedalmond:`#FFEBCD`,papayawhip:`#FFEFD5`,lavenderblush:`#FFF0F5`,seashell:`#FFF5EE`,cornsilk:`#FFF8DC`,lemonchiffon:`#FFFACD`,floralwhite:`#FFFAF0`,snow:`#FFFAFA`,lightyellow:`#FFFFE0`,ivory:`#FFFFF0`},Ca=new Int8Array(4),wa=new Int32Array(Ca.buffer,0,1),Ta=new Float32Array(Ca.buffer,0,1),Ea=/^\s*rgba?\s*\(/,Da=/^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)(?:\s*,\s*(.*)?)?\)\s*$/;function Oa(e){var t=0,n=0,r=0,i=1;if(e[0]===`#`)e.length===4?(t=parseInt(e.charAt(1)+e.charAt(1),16),n=parseInt(e.charAt(2)+e.charAt(2),16),r=parseInt(e.charAt(3)+e.charAt(3),16)):(t=parseInt(e.charAt(1)+e.charAt(2),16),n=parseInt(e.charAt(3)+e.charAt(4),16),r=parseInt(e.charAt(5)+e.charAt(6),16)),e.length===9&&(i=parseInt(e.charAt(7)+e.charAt(8),16)/255);else if(Ea.test(e)){var a=e.match(Da);a&&(t=+a[1],n=+a[2],r=+a[3],a[4]&&(i=+a[4]))}return{r:t,g:n,b:r,a:i}}var ka={};for(var Aa in Sa)ka[Aa]=Ma(Sa[Aa]),ka[Sa[Aa]]=ka[Aa];function ja(e,t,n,r,i){return wa[0]=r<<24|n<<16|t<<8|e,i&&(wa[0]&=4278190079),Ta[0]}function Ma(e){if(e=e.toLowerCase(),ka[e]!==void 0)return ka[e];var t=Oa(e),n=t.r,r=t.g,i=t.b,a=t.a;a=a*255|0;var o=ja(n,r,i,a,!0);return ka[e]=o,o}var Na={};function Pa(e){if(Na[e]!==void 0)return Na[e];var t=ja((e&16711680)>>>16,(e&65280)>>>8,e&255,255,!0);return Na[e]=t,t}function Fa(e,t,n,r){return n+(t<<8)+(e<<16)}function Ia(e,t,n,r,i,a){var o=Math.floor(n/a*i),s=Math.floor(e.drawingBufferHeight/a-r/a*i),c=new Uint8Array(4);e.bindFramebuffer(e.FRAMEBUFFER,t),e.readPixels(o,s,1,1,e.RGBA,e.UNSIGNED_BYTE,c);var l=xa(c,4);return[l[0],l[1],l[2],l[3]]}function U(e,t,n){return(t=aa(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function La(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function W(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?La(Object(n),!0).forEach(function(t){U(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):La(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ra(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=la(e))!==null;);return e}function za(){return za=typeof Reflect<`u`&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=Ra(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},za.apply(null,arguments)}function Ba(e,t,n,r){var i=za(la(1&r?e.prototype:e),t,n);return 2&r&&typeof i==`function`?function(e){return i.apply(n,e)}:i}function Va(e){return e.normalized?1:e.size}function Ha(e){var t=0;return e.forEach(function(e){return t+=Va(e)}),t}function Ua(e,t,n){var r=e===`VERTEX`?t.VERTEX_SHADER:t.FRAGMENT_SHADER,i=t.createShader(r);if(i===null)throw Error(`loadShader: error while creating the shader`);if(t.shaderSource(i,n),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS)){var a=t.getShaderInfoLog(i);throw t.deleteShader(i),Error(`loadShader: error while compiling the shader:
16
16
  ${a}
17
17
  ${n}`)}return i}function Wa(e,t){return Ua(`VERTEX`,e,t)}function Ga(e,t){return Ua(`FRAGMENT`,e,t)}function Ka(e,t){var n=e.createProgram();if(n===null)throw Error(`loadProgram: error while creating the program.`);var r,i;for(r=0,i=t.length;r<i;r++)e.attachShader(n,t[r]);if(e.linkProgram(n),!e.getProgramParameter(n,e.LINK_STATUS)){var a=e.getProgramInfoLog(n);throw e.deleteProgram(n),Error(`loadProgram: error while linking the program: ${a}`)}return n}function qa(e){var t=e.gl,n=e.buffer,r=e.program,i=e.vertexShader,a=e.fragmentShader;t.deleteShader(i),t.deleteShader(a),t.deleteProgram(r),t.deleteBuffer(n)}var Ja=`#define PICKING_MODE
@@ -572,4 +572,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
572
572
  `;try{u=(await n(e)).map(e=>({from:e.fromId||e[0],to:e.toId||e[1],type:e.type||e[2]||`CALLS`})).filter(e=>e.from!==e.to)}catch(e){console.warn(`Could not fetch edges:`,e)}}let d=(t?.nodes.find(e=>e.id===r))?.properties.communities||[];c({id:r,label:i,processType:a,steps:s,edges:u,clusters:d})}catch(e){console.error(`Failed to load process steps:`,e)}finally{p(null)}}},[n,t,e]),[S,C]=(0,P.useState)(new Map),w=(0,P.useCallback)(async e=>{if(ZO(e)){if(m===e){r(new Set),h(null);return}if(S.has(e)){let t=S.get(e);r(new Set(t)),h(e);return}p(e);try{let t=`
573
573
  MATCH (s)-[r:CodeRelation {type: 'STEP_IN_PROCESS'}]->(p:Process {id: '${e.replace(/'/g,`''`)}'})
574
574
  RETURN s.id AS id
575
- `,i=(await n(t)).map(e=>e.id||e[0]);C(t=>new Map(t).set(e,i)),r(new Set(i)),h(e)}catch(e){console.error(`Failed to load process steps for focus:`,e)}finally{p(null)}}},[m,S,n,r]),T=(0,P.useCallback)((e,t)=>{m===t?(r(new Set),h(null)):(r(new Set(e)),h(t),C(n=>new Map(n).set(t,e)))},[m,r]);(0,P.useEffect)(()=>{i.size===0&&m!==null&&h(null)},[i,m]);let E=g.cross.length+g.intra.length;return E===0?(0,H.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center p-6 text-center`,children:[(0,H.jsx)(`div`,{className:`mb-4 flex h-14 w-14 items-center justify-center rounded-xl bg-surface`,children:(0,H.jsx)(jr,{className:`h-7 w-7 text-text-muted`})}),(0,H.jsx)(`h3`,{className:`mb-2 text-base font-medium text-text-primary`,children:e(`graph:processes.emptyTitle`)}),(0,H.jsx)(`p`,{className:`max-w-xs text-sm text-text-secondary`,children:e(`graph:processes.emptyDescription`)})]}):(0,H.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,H.jsxs)(`div`,{className:`border-b border-border-subtle p-3`,children:[(0,H.jsx)(`div`,{className:`mb-2 flex items-center gap-2`,children:(0,H.jsxs)(`div`,{className:`flex flex-1 items-center gap-2 rounded-lg border border-border-subtle bg-elevated px-3 py-2 focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20`,children:[(0,H.jsx)($r,{className:`h-4 w-4 text-text-muted`}),(0,H.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),placeholder:e(`graph:processes.filterPlaceholder`),className:`flex-1 border-none bg-transparent text-sm text-text-primary outline-none placeholder:text-text-muted`})]})}),(0,H.jsx)(`div`,{className:`flex items-center gap-2 text-xs text-text-muted`,"data-testid":`process-list-loaded`,children:(0,H.jsx)(`span`,{children:e(`graph:processes.detected`,{count:E})})})]}),(0,H.jsxs)(`div`,{className:`scrollbar-thin flex-1 overflow-y-auto`,children:[(0,H.jsx)(`div`,{className:`px-4 py-3`,children:(0,H.jsxs)(`button`,{onClick:b,disabled:d!==null,className:`group flex w-full items-center gap-3 rounded-xl border border-border-subtle bg-elevated/40 p-3 text-left shadow-sm transition-all hover:border-cyan-500/30 hover:bg-elevated/80 hover:shadow-cyan-900/10`,children:[(0,H.jsx)(`div`,{className:`rounded-lg bg-cyan-500/10 p-2 transition-colors group-hover:bg-cyan-500/20`,children:(0,H.jsx)(Lr,{className:`h-5 w-5 text-cyan-400`})}),(0,H.jsxs)(`div`,{className:`flex-1`,children:[(0,H.jsx)(`h4`,{className:`text-sm font-medium text-text-primary group-hover:text-cyan-200`,children:e(`graph:processes.fullMap`)}),(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:e(`graph:processes.viewCombined`,{count:E})})]}),d===`all`?(0,H.jsx)(`span`,{className:`mr-1 animate-spin`,children:(0,H.jsx)(ai,{className:`h-4 w-4 text-cyan-400`})}):(0,H.jsx)(Er,{className:`h-4 w-4 text-text-muted group-hover:text-cyan-400`})]})}),v.cross.length>0&&(0,H.jsxs)(`div`,{className:`border-b border-border-subtle`,children:[(0,H.jsxs)(`button`,{onClick:()=>y(`cross`),className:`flex w-full items-center gap-2 px-4 py-2.5 text-left transition-colors hover:bg-hover`,children:[l.has(`cross`)?(0,H.jsx)(yr,{className:`h-4 w-4 text-text-muted`}):(0,H.jsx)(br,{className:`h-4 w-4 text-text-muted`}),(0,H.jsx)(_i,{className:`h-4 w-4 text-amber-400`}),(0,H.jsx)(`span`,{className:`text-sm font-medium text-text-primary`,children:e(`graph:processes.crossCommunity`)}),(0,H.jsx)(`span`,{className:`ml-auto rounded-full bg-surface px-2 py-0.5 text-xs text-text-muted`,children:v.cross.length})]}),l.has(`cross`)&&(0,H.jsx)(`div`,{className:`pb-2`,children:v.cross.map(e=>(0,H.jsx)($O,{process:e,isLoading:d===e.id,isSelected:s?.id===e.id,isFocused:m===e.id,onView:()=>x(e.id,e.label,`cross_community`),onToggleFocus:()=>w(e.id)},e.id))})]}),v.intra.length>0&&(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`button`,{onClick:()=>y(`intra`),className:`flex w-full items-center gap-2 px-4 py-2.5 text-left transition-colors hover:bg-hover`,children:[l.has(`intra`)?(0,H.jsx)(yr,{className:`h-4 w-4 text-text-muted`}):(0,H.jsx)(br,{className:`h-4 w-4 text-text-muted`}),(0,H.jsx)(Fr,{className:`h-4 w-4 text-emerald-400`}),(0,H.jsx)(`span`,{className:`text-sm font-medium text-text-primary`,children:e(`graph:processes.intraCommunity`)}),(0,H.jsx)(`span`,{className:`ml-auto rounded-full bg-surface px-2 py-0.5 text-xs text-text-muted`,children:v.intra.length})]}),l.has(`intra`)&&(0,H.jsx)(`div`,{className:`pb-2`,children:v.intra.map(e=>(0,H.jsx)($O,{process:e,isLoading:d===e.id,isSelected:s?.id===e.id,isFocused:m===e.id,onView:()=>x(e.id,e.label,`intra_community`),onToggleFocus:()=>w(e.id)},e.id))})]})]}),(0,H.jsx)(_,{process:s,onClose:()=>c(null),onFocusInGraph:T,isFullScreen:s?.id===`combined-all`})]})},$O=({process:e,isLoading:t,isSelected:n,isFocused:r,onView:i,onToggleFocus:a})=>{let{t:o}=f([`graph`]);return(0,H.jsxs)(`div`,{"data-testid":`process-row`,className:`group mx-2 flex items-center gap-2 rounded-lg px-4 py-2 transition-all hover:bg-hover ${r?`bg-amber-950/40 border border-amber-500/50 ring-1 ring-amber-400/30`:n?`bg-cyan-950/40 border border-cyan-500/50 ring-1 ring-cyan-400/30`:``}`,children:[(0,H.jsx)(jr,{className:`h-4 w-4 flex-shrink-0 text-text-muted`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate text-sm text-text-primary`,children:e.label}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-text-muted`,children:[(0,H.jsx)(`span`,{children:o(`graph:processes.steps`,{count:e.stepCount})}),e.clusters.length>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{children:`•`}),(0,H.jsx)(`span`,{children:o(`graph:processes.clusters`,{count:e.clusters.length})})]})]})]}),(0,H.jsx)(`button`,{onClick:a,className:`rounded-md p-1.5 transition-all ${r?`animate-pulse border border-amber-400/40 bg-amber-500/20 text-amber-400 opacity-100 hover:bg-amber-500/30 hover:text-amber-300`:`border border-white/10 bg-white/5 text-text-muted opacity-0 group-hover:opacity-100 hover:border-cyan-400/40 hover:bg-cyan-500/20 hover:text-cyan-400`}`,title:o(r?`graph:processes.removeHighlightTitle`:`graph:processes.highlightTitle`),"data-testid":`process-highlight-button`,children:(0,H.jsx)(zr,{className:`h-4 w-4`})}),(0,H.jsx)(`button`,{onClick:i,disabled:t,"data-testid":`process-view-button`,className:`flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium shadow-sm transition-all disabled:opacity-50 ${n?`border border-cyan-400/60 bg-cyan-900/60 text-cyan-300 opacity-100`:`border border-cyan-500/30 bg-cyan-950/30 text-cyan-400 opacity-0 shadow-cyan-900/20 group-hover:opacity-100 hover:border-cyan-400/50 hover:bg-cyan-900/50 hover:text-cyan-300`}`,children:t?(0,H.jsx)(`span`,{className:`animate-pulse`,children:o(`graph:processes.loading`)}):n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Er,{className:`h-3.5 w-3.5`}),o(`graph:processes.viewing`)]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Er,{className:`h-3.5 w-3.5`}),o(`graph:processes.view`)]})})]})},ek=()=>{let{t:e}=f([`chat`,`common`]),{isRightPanelOpen:t,setRightPanelOpen:n,graph:r,graphMode:i,addCodeReference:a,chatMessages:o,isChatLoading:s,currentToolCalls:c,agentError:l,isAgentReady:u,isAgentInitializing:d,sendChatMessage:p,stopChatResponse:m,clearChat:h}=dr(),[g,_]=(0,P.useState)(``),[v,y]=(0,P.useState)(`chat`),b=(0,P.useRef)(null),{scrollContainerRef:x,messagesContainerRef:S,isAtBottom:C,scrollToBottom:w}=Qd(o,s),T=(0,P.useCallback)(e=>null,[]),E=(0,P.useCallback)(e=>{if(!r)return;let t=e.replace(/\\/g,`/`).replace(/^\.?\//,``);return r.nodes.find(e=>e.label===`File`&&e.properties.filePath.replace(/\\/g,`/`).replace(/^\.?\//,``)===t)?.id},[r]),D=(0,P.useCallback)(e=>{let t=e.trim();if(!t)return;let n=t,r,i,o=t.match(/^(.*):(\d+)(?:[-–](\d+))?$/);o&&(n=o[1].trim(),r=parseInt(o[2],10),i=parseInt(o[3]||o[2],10));let s=T(n);if(!s)return;let c=E(s);a({filePath:s,startLine:r?Math.max(0,r-1):void 0,endLine:i?Math.max(0,i-1):r?Math.max(0,r-1):void 0,nodeId:c,label:`File`,name:s.split(`/`).pop()??s,source:`ai`})},[a,E,T]),O=(0,P.useCallback)(e=>{let t=e.trim();if(!t||!r)return;let n=t.match(/^(Class|Function|Method|Interface|File|Folder|Variable|Enum|Type|CodeElement):(.+)$/);if(!n)return;let[,i,o]=n,s=o.trim(),c=r.nodes.find(e=>e.label===i&&e.properties.name===s);if(!c){console.warn(`Node not found: ${i}:${s}`);return}if(c.properties.filePath){let e=T(c.properties.filePath);e&&a({filePath:e,startLine:c.properties.startLine?c.properties.startLine-1:void 0,endLine:c.properties.endLine?c.properties.endLine-1:void 0,nodeId:c.id,label:c.label,name:c.properties.name,source:`ai`})}},[r,T,a]),k=(0,P.useCallback)(e=>{if(e.startsWith(`code-ref:`)){let t=decodeURIComponent(e.slice(9));D(t)}else if(e.startsWith(`node-ref:`)){let t=decodeURIComponent(e.slice(9));O(t)}},[D,O]),A=(0,P.useCallback)(()=>{let e=b.current;if(!e)return;e.style.height=`auto`;let t=Math.min(e.scrollHeight,160);e.style.height=`${t}px`,e.style.overflowY=e.scrollHeight>160?`auto`:`hidden`},[]);(0,P.useEffect)(()=>{A()},[g,A]);let j=async()=>{if(!g.trim())return;let e=g.trim();_(``),b.current&&(b.current.style.height=`36px`,b.current.style.overflowY=`hidden`),await p(e)},M=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),j())},N=[e(`chat:suggestions.architecture`),e(`chat:suggestions.whatDoes`),e(`chat:suggestions.importantFiles`),e(`chat:suggestions.apiHandlers`)];return t?(0,H.jsxs)(`aside`,{className:`relative z-30 flex w-[40%] max-w-[600px] min-w-[400px] flex-shrink-0 animate-slide-in flex-col border-l border-border-subtle bg-deep`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border-subtle bg-surface px-4 py-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsxs)(`button`,{onClick:()=>y(`chat`),className:`flex items-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium transition-colors ${v===`chat`?`bg-accent/15 text-accent`:`text-text-muted hover:bg-hover hover:text-text-primary`}`,children:[(0,H.jsx)(ai,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:e(`chat:tabs.chat`)})]}),(0,H.jsxs)(`button`,{onClick:()=>y(`processes`),className:`flex items-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium transition-colors ${v===`processes`?`bg-accent/15 text-accent`:`text-text-muted hover:bg-hover hover:text-text-primary`}`,children:[(0,H.jsx)(jr,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:e(`chat:tabs.processes`)}),(0,H.jsx)(`span`,{className:`rounded-full bg-gradient-to-r from-violet-500 to-fuchsia-500 px-1.5 py-0.5 text-[10px] font-semibold text-white`,children:e(`chat:newBadge`)})]})]}),(0,H.jsx)(`button`,{onClick:()=>n(!1),className:`rounded p-1.5 text-text-muted transition-colors hover:bg-hover hover:text-text-primary`,title:e(`chat:actions.closePanel`),children:(0,H.jsx)(qr,{className:`h-4 w-4`})})]}),v===`processes`&&(0,H.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:(0,H.jsx)(QO,{})}),v===`chat`&&(0,H.jsxs)(`div`,{className:`relative flex flex-1 flex-col overflow-hidden`,children:[(0,H.jsx)(`div`,{className:`flex items-center gap-2.5 border-b border-border-subtle bg-elevated/50 px-4 py-3`,children:(0,H.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[!u&&(0,H.jsx)(`span`,{className:`rounded-full border border-amber-500/30 bg-amber-500/15 px-2 py-1 text-[11px] text-amber-300`,children:e(`chat:badges.configureAI`)}),d&&(0,H.jsxs)(`span`,{className:`flex items-center gap-1 rounded-full border border-border-subtle bg-surface px-2 py-1 text-[11px] text-text-muted`,children:[(0,H.jsx)(Vr,{className:`h-3 w-3 animate-spin`}),` `,e(`chat:badges.connecting`)]})]})}),i===`chatOnly`&&(0,H.jsx)(`div`,{className:`border-b border-amber-500/20 bg-amber-500/10 px-4 py-2 text-[11px] text-amber-200/90`,children:e(`chat:chatOnly.banner`)}),l&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-rose-500/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-100`,children:[(0,H.jsx)(fi,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{children:l})]}),(0,H.jsx)(`div`,{ref:x,className:`scrollbar-thin flex-1 overflow-y-auto p-4`,children:o.length===0?(0,H.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center px-4 text-center`,children:[(0,H.jsx)(`div`,{className:`mb-4 flex h-14 w-14 items-center justify-center rounded-xl bg-gradient-to-br from-accent to-node-interface text-2xl shadow-glow`,children:`🧠`}),(0,H.jsx)(`h3`,{className:`mb-2 text-base font-medium`,children:e(`chat:empty.title`)}),(0,H.jsx)(`p`,{className:`mb-5 text-sm leading-relaxed text-text-secondary`,children:e(`chat:empty.description`)}),(0,H.jsx)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:N.map(e=>(0,H.jsx)(`button`,{onClick:()=>_(e),className:`rounded-full border border-border-subtle bg-elevated px-3 py-1.5 text-xs text-text-secondary transition-colors hover:border-accent hover:text-text-primary`,children:e},e))})]}):(0,H.jsx)(`div`,{ref:S,className:`flex flex-col gap-6`,children:o.map(t=>(0,H.jsxs)(`div`,{className:`animate-fade-in`,children:[t.role===`user`&&(0,H.jsxs)(`div`,{className:`mb-4`,children:[(0,H.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,H.jsx)(mi,{className:`h-4 w-4 text-text-muted`}),(0,H.jsx)(`span`,{className:`text-xs font-medium tracking-wide text-text-muted uppercase`,children:e(`chat:roles.you`)})]}),(0,H.jsx)(`div`,{className:`pl-6 text-sm text-text-primary`,children:t.content})]}),t.role===`assistant`&&(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,H.jsx)(ai,{className:`h-4 w-4 text-accent`}),(0,H.jsx)(`span`,{className:`text-xs font-medium tracking-wide text-text-muted uppercase`,children:e(`chat:roles.assistant`)}),s&&t===o[o.length-1]&&(0,H.jsx)(Vr,{className:`h-3 w-3 animate-spin text-accent`})]}),(0,H.jsx)(`div`,{className:`chat-prose pl-6`,children:t.steps&&t.steps.length>0?(0,H.jsx)(`div`,{className:`space-y-4`,children:t.steps.map((e,n)=>(0,H.jsxs)(`div`,{children:[e.type===`reasoning`&&e.content&&(0,H.jsx)(`div`,{className:`mb-3 border-l-2 border-text-muted/30 pl-3 text-sm text-text-secondary italic`,children:(0,H.jsx)(XO,{content:e.content,onLinkClick:k})}),e.type===`tool_call`&&e.toolCall&&(0,H.jsx)(`div`,{className:`mb-3`,children:(0,H.jsx)(nf,{toolCall:e.toolCall,defaultExpanded:!1})}),e.type===`content`&&e.content&&(0,H.jsx)(XO,{content:e.content,onLinkClick:k,showCopyButton:n===t.steps.length-1})]},e.id))}):(0,H.jsx)(XO,{content:t.content,onLinkClick:k,toolCalls:t.toolCalls,showCopyButton:!0})})]})]},t.id))})}),(0,H.jsxs)(`button`,{"aria-label":e(`chat:actions.scrollBottom`),onClick:()=>w(),className:`absolute bottom-20 left-1/2 z-10 -translate-x-1/2 rounded-full border border-border-subtle bg-elevated px-3 py-1.5 text-xs text-text-secondary shadow-lg transition-all duration-200 hover:border-accent hover:text-accent ${!C&&o.length>0?`translate-y-0 opacity-100`:`pointer-events-none translate-y-2 opacity-0`}`,children:[(0,H.jsx)(fr,{className:`mr-1 inline h-3.5 w-3.5`}),e(`chat:actions.scrollBottom`)]}),(0,H.jsxs)(`div`,{className:`border-t border-border-subtle bg-surface p-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-end gap-2 rounded-xl border border-border-subtle bg-elevated px-3 py-2 transition-all focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20`,children:[(0,H.jsx)(`textarea`,{ref:b,value:g,onChange:e=>_(e.target.value),onKeyDown:M,placeholder:e(`chat:input.placeholder`),rows:1,className:`scrollbar-thin min-h-[36px] flex-1 resize-none border-none bg-transparent text-sm text-text-primary outline-none placeholder:text-text-muted`,style:{height:`36px`,overflowY:`hidden`}}),(0,H.jsx)(`button`,{onClick:h,className:`px-2 py-1 text-xs text-text-muted transition-colors hover:text-text-primary`,title:e(`chat:actions.clearChat`),children:e(`common:actions.clear`)}),s?(0,H.jsx)(`button`,{onClick:m,className:`flex h-9 w-9 items-center justify-center rounded-md bg-red-500/80 text-white transition-all hover:bg-red-500`,title:e(`chat:actions.stopResponse`),children:(0,H.jsx)(oi,{className:`h-3.5 w-3.5 fill-current`})}):(0,H.jsx)(`button`,{onClick:j,disabled:!g.trim()||d,className:`flex h-9 w-9 items-center justify-center rounded-md bg-accent text-white transition-all hover:bg-accent-dim disabled:cursor-not-allowed disabled:opacity-50`,children:(0,H.jsx)(ei,{className:`h-3.5 w-3.5`})})]}),!u&&!d&&(0,H.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-xs text-amber-200`,children:[(0,H.jsx)(fi,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:ye()?e(`chat:input.initializing`):e(`chat:input.configureProvider`)})]})]})]})]}):null},tk=({title:e,description:t,apiKey:n,model:r,children:i})=>{let{t:a}=f(`settings`);return(0,H.jsxs)(`div`,{className:`animate-fade-in space-y-4`,children:[(0,H.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-text-primary`,children:e}),t?(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:t}):null]})}),n&&(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-text-secondary`,children:[(0,H.jsx)(Ir,{className:`h-4 w-4`}),a(`apiKey`)]}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`input`,{type:n.isVisible?`text`:`password`,value:n.value,onChange:e=>n.onChange(e.target.value),placeholder:n.placeholder,className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 pr-12 text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,H.jsx)(`button`,{type:`button`,onClick:n.onToggleVisibility,className:`absolute top-1/2 right-3 -translate-y-1/2 p-1 text-text-muted transition-colors hover:text-text-primary`,children:n.isVisible?(0,H.jsx)(Tr,{className:`h-4 w-4`}):(0,H.jsx)(Er,{className:`h-4 w-4`})})]}),n.helperText&&(0,H.jsxs)(`p`,{className:`text-xs text-text-muted`,children:[n.helperText,` `,n.helperLink?(0,H.jsx)(`a`,{href:n.helperLink,target:`_blank`,rel:`noopener noreferrer`,className:`text-accent hover:underline`,children:n.helperLinkLabel??a(`learnMore`)}):null]})]}),r&&(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{className:`text-sm font-medium text-text-secondary`,children:r.label??a(`model`)}),(0,H.jsx)(`input`,{type:`text`,value:r.value,onChange:e=>r.onChange(e.target.value),placeholder:r.placeholder,className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 font-mono text-sm text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`}),r.helperText?(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:r.helperText}):null]}),i]})},nk=({value:e,onChange:t,models:n,isLoading:r,onLoadModels:i})=>{let{t:a}=f(`settings`),[o,s]=(0,P.useState)(!1),[c,l]=(0,P.useState)(``),u=(0,P.useRef)(null),d=(0,P.useRef)(null),p=(0,P.useMemo)(()=>{if(!c.trim())return n;let e=c.toLowerCase();return n.filter(t=>t.id.toLowerCase().includes(e)||t.name.toLowerCase().includes(e))},[n,c]),m=(0,P.useMemo)(()=>{if(!e)return``;let t=n.find(t=>t.id===e);return t?t.name:e},[e,n]);(0,P.useEffect)(()=>{let e=e=>{d.current&&!d.current.contains(e.target)&&(s(!1),l(``))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]);let h=()=>{s(!0),n.length===0&&!r&&i(),setTimeout(()=>u.current?.focus(),10)},g=e=>{t(e),s(!1),l(``)};return(0,H.jsxs)(`div`,{ref:d,className:`relative`,children:[(0,H.jsxs)(`div`,{onClick:h,className:`flex w-full cursor-pointer items-center gap-2 rounded-xl border bg-elevated px-4 py-3 transition-all ${o?`border-accent ring-2 ring-accent/20`:`border-border-subtle hover:border-accent/50`}`,children:[o?(0,H.jsx)(`input`,{ref:u,type:`text`,value:c,onChange:e=>{let r=e.target.value;l(r),r&&n.length===0&&t(r)},onKeyDown:e=>{if(e.key===`Enter`&&c){let e=p.find(e=>e.id.toLowerCase()===c.toLowerCase());e?g(e.id):p.length===1?g(p[0].id):(t(c),s(!1),l(``))}else e.key===`Escape`&&(s(!1),l(``))},placeholder:a(`searchModelPlaceholder`),className:`flex-1 bg-transparent font-mono text-sm text-text-primary outline-none placeholder:text-text-muted`,onClick:e=>e.stopPropagation()}):(0,H.jsx)(`span`,{className:`flex-1 truncate font-mono text-sm ${e?`text-text-primary`:`text-text-muted`}`,children:m||a(`selectModelPlaceholder`)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[r&&(0,H.jsx)(Vr,{className:`h-4 w-4 animate-spin text-text-muted`}),(0,H.jsx)(yr,{className:`h-4 w-4 text-text-muted transition-transform ${o?`rotate-180`:``}`})]})]}),o&&(0,H.jsx)(`div`,{className:`absolute z-50 mt-1 w-full overflow-hidden rounded-xl border border-border-subtle bg-elevated shadow-xl`,children:r?(0,H.jsxs)(`div`,{className:`flex items-center justify-center gap-2 px-4 py-6 text-center text-sm text-text-muted`,children:[(0,H.jsx)(Vr,{className:`h-4 w-4 animate-spin`}),a(`loadingModels`)]}):p.length===0?(0,H.jsx)(`div`,{className:`px-4 py-4 text-center`,children:n.length===0?(0,H.jsxs)(`div`,{className:`text-sm text-text-muted`,children:[(0,H.jsx)($r,{className:`mx-auto mb-2 h-5 w-5 opacity-50`}),(0,H.jsx)(`p`,{children:a(`customModelHint`)}),(0,H.jsx)(`p`,{className:`mt-1 text-xs`,children:a(`customModelExample`)})]}):(0,H.jsxs)(`div`,{className:`text-sm text-text-muted`,children:[(0,H.jsx)(`p`,{children:a(`noModelsMatch`,{searchTerm:c})}),(0,H.jsx)(`p`,{className:`mt-1 text-xs`,children:a(`pressEnterCustom`)})]})}):(0,H.jsxs)(`div`,{className:`max-h-64 overflow-y-auto`,children:[p.slice(0,50).map(t=>(0,H.jsxs)(`button`,{onClick:()=>g(t.id),className:`flex w-full flex-col px-4 py-2.5 text-left transition-colors hover:bg-hover ${t.id===e?`bg-accent/10`:``}`,children:[(0,H.jsx)(`span`,{className:`truncate text-sm text-text-primary`,children:t.name}),(0,H.jsx)(`span`,{className:`truncate font-mono text-xs text-text-muted`,children:t.id})]},t.id)),p.length>50&&(0,H.jsx)(`div`,{className:`border-t border-border-subtle px-4 py-2 text-center text-xs text-text-muted`,children:a(`moreModels`,{count:p.length-50})})]})})]})},rk=async e=>{try{let t=await fetch(`${e}/api/tags`,{method:`GET`,headers:{"Content-Type":`application/json`}});return t.ok?{ok:!0,error:null}:t.status===0||t.status===404?{ok:!1,error:"Cannot connect to Ollama. Make sure it's running with `ollama serve`"}:{ok:!1,error:`Ollama API error: ${t.status}`}}catch{return{ok:!1,error:"Cannot connect to Ollama. Make sure it's running with `ollama serve`"}}},ik=({isOpen:e,onClose:t,onSettingsSaved:n,backendUrl:r,isBackendConnected:i,onBackendUrlChange:a})=>{let{t:o}=f([`common`,`settings`]),[s,c]=(0,P.useState)(he),[l,u]=(0,P.useState)({}),[d,p]=(0,P.useState)(`idle`),m=(0,P.useRef)(void 0),[h,g]=(0,P.useState)(null),[_,v]=(0,P.useState)(!1),[y,b]=(0,P.useState)([]),[x,S]=(0,P.useState)(!1);(0,P.useEffect)(()=>()=>{m.current&&clearTimeout(m.current)},[]),(0,P.useEffect)(()=>{e&&(c(he()),p(`idle`),g(null))},[e]);let C=(0,P.useCallback)(async e=>{v(!0),g(null);let{error:t}=await rk(e);v(!1),g(t)},[]),w=(0,P.useCallback)(async()=>{S(!0);let e=await Te();b(e),S(!1)},[]);(0,P.useEffect)(()=>{if(s.activeProvider===`ollama`){let e=s.ollama?.baseUrl??`http://localhost:11434`,t=setTimeout(()=>{C(e)},300);return()=>clearTimeout(t)}},[s.ollama?.baseUrl,s.activeProvider,C]);let T=e=>{c(t=>({...t,activeProvider:e}))},E=()=>{try{ge(s),p(`saved`),n?.(),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>p(`idle`),2e3)}catch{p(`error`)}},D=e=>{u(t=>({...t,[e]:!t[e]}))};return e?(0,H.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,H.jsx)(`div`,{className:`absolute inset-0 bg-black/60 backdrop-blur-sm`,onClick:t}),(0,H.jsxs)(`div`,{className:`relative mx-4 flex max-h-[90vh] w-full max-w-lg flex-col overflow-hidden rounded-2xl border border-border-subtle bg-surface shadow-2xl`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border-subtle bg-elevated/50 px-6 py-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-xl bg-accent/20`,children:(0,H.jsx)(_r,{className:`h-5 w-5 text-accent`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{className:`text-lg font-semibold text-text-primary`,children:o(`settings:title`)}),(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:o(`settings:subtitle`)})]})]}),(0,H.jsx)(`button`,{onClick:t,className:`rounded-lg p-2 text-text-muted transition-colors hover:bg-hover hover:text-text-primary`,children:(0,H.jsx)(gi,{className:`h-5 w-5`})})]}),(0,H.jsxs)(`div`,{className:`flex-1 space-y-6 overflow-y-auto p-6`,children:[r!==void 0&&a&&(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`label`,{className:`block text-sm font-medium text-text-secondary`,children:o(`settings:localServer`)}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,H.jsx)(ti,{className:`h-4 w-4 text-text-muted`}),(0,H.jsx)(`span`,{className:`text-sm text-text-secondary`,children:o(`settings:backendUrl`)}),(0,H.jsx)(`span`,{className:`h-2 w-2 rounded-full ${i?`bg-green-400`:`bg-red-400`}`}),(0,H.jsx)(`span`,{className:`text-xs text-text-muted`,children:o(i?`settings:connected`:`settings:notConnected`)})]}),(0,H.jsx)(`input`,{type:`url`,value:r,onChange:e=>a(e.target.value),placeholder:`http://localhost:4747`,className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 font-mono text-sm text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:o(`settings:runServeHint`)})]})]}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`label`,{className:`block text-sm font-medium text-text-secondary`,children:o(`settings:provider`)}),(0,H.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-3`,children:[`openai`,`gemini`,`anthropic`,`azure-openai`,`ollama`,`openrouter`,`minimax`,`glm`,`deepseek`].map(e=>(0,H.jsxs)(`button`,{onClick:()=>T(e),className:`flex items-center gap-3 rounded-xl border-2 p-4 transition-all ${s.activeProvider===e?`border-accent bg-accent/10 text-text-primary`:`border-border-subtle bg-elevated text-text-secondary hover:border-accent/50`} `,children:[(0,H.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-lg text-lg ${s.activeProvider===e?`bg-accent/20`:`bg-surface`} `,children:e===`openai`?`🤖`:e===`gemini`?`💎`:e===`anthropic`?`🧠`:e===`ollama`?`🦙`:e===`openrouter`?`🌐`:e===`minimax`?`⚡`:e===`glm`?`🔮`:e===`deepseek`?`🐋`:`☁️`}),(0,H.jsx)(`span`,{className:`font-medium`,children:Ce(e)})]},e))})]}),(0,H.jsx)(`div`,{className:`rounded-xl border border-amber-500/30 bg-amber-500/10 p-3 text-xs text-amber-200`,children:o(`settings:apiKeySession`)}),s.activeProvider===`openai`&&(0,H.jsx)(tk,{title:`OpenAI`,apiKey:{value:s.openai?.apiKey??``,placeholder:o(`settings:providers.openai.apiKeyPlaceholder`),helperText:o(`settings:providers.openai.helperText`),helperLink:`https://platform.openai.com/api-keys`,helperLinkLabel:o(`settings:providers.openai.helperLinkLabel`),isVisible:!!l.openai,onChange:e=>c(t=>({...t,openai:{...t.openai,apiKey:e}})),onToggleVisibility:()=>D(`openai`)},model:{value:s.openai?.model??`gpt-5.2-chat`,placeholder:o(`settings:providers.openai.modelPlaceholder`),onChange:e=>c(t=>({...t,openai:{...t.openai,model:e}}))},children:(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-text-secondary`,children:[(0,H.jsx)(ti,{className:`h-4 w-4`}),o(`settings:baseUrl`),` `,(0,H.jsxs)(`span`,{className:`font-normal text-text-muted`,children:[`(`,o(`settings:optional`),`)`]})]}),(0,H.jsx)(`input`,{type:`url`,value:s.openai?.baseUrl??``,onChange:e=>c(t=>({...t,openai:{...t.openai,baseUrl:e.target.value}})),placeholder:o(`settings:providers.openai.baseUrlPlaceholder`),className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:o(`settings:providers.openai.baseUrlHint`)})]})}),s.activeProvider===`gemini`&&(0,H.jsx)(tk,{title:`Google Gemini`,apiKey:{value:s.gemini?.apiKey??``,placeholder:o(`settings:providers.gemini.apiKeyPlaceholder`),helperText:o(`settings:providers.gemini.helperText`),helperLink:`https://aistudio.google.com/app/apikey`,helperLinkLabel:o(`settings:providers.gemini.helperLinkLabel`),isVisible:!!l.gemini,onChange:e=>c(t=>({...t,gemini:{...t.gemini,apiKey:e}})),onToggleVisibility:()=>D(`gemini`)},model:{value:s.gemini?.model??`gemini-2.0-flash`,placeholder:o(`settings:providers.gemini.modelPlaceholder`),onChange:e=>c(t=>({...t,gemini:{...t.gemini,model:e}}))}}),s.activeProvider===`anthropic`&&(0,H.jsx)(tk,{title:`Anthropic`,apiKey:{value:s.anthropic?.apiKey??``,placeholder:o(`settings:providers.anthropic.apiKeyPlaceholder`),helperText:o(`settings:providers.anthropic.helperText`),helperLink:`https://console.anthropic.com/settings/keys`,helperLinkLabel:o(`settings:providers.anthropic.helperLinkLabel`),isVisible:!!l.anthropic,onChange:e=>c(t=>({...t,anthropic:{...t.anthropic,apiKey:e}})),onToggleVisibility:()=>D(`anthropic`)},model:{value:s.anthropic?.model??`claude-sonnet-4-20250514`,placeholder:o(`settings:providers.anthropic.modelPlaceholder`),onChange:e=>c(t=>({...t,anthropic:{...t.anthropic,model:e}}))}}),s.activeProvider===`azure-openai`&&(0,H.jsxs)(`div`,{className:`animate-fade-in space-y-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-text-secondary`,children:[(0,H.jsx)(Ir,{className:`h-4 w-4`}),o(`settings:apiKey`)]}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`input`,{type:l.azure?`text`:`password`,value:s.azureOpenAI?.apiKey??``,onChange:e=>c(t=>({...t,azureOpenAI:{...t.azureOpenAI,apiKey:e.target.value}})),placeholder:o(`settings:providers.azure.apiKeyPlaceholder`),className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 pr-12 text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>D(`azure`),className:`absolute top-1/2 right-3 -translate-y-1/2 p-1 text-text-muted transition-colors hover:text-text-primary`,children:l.azure?(0,H.jsx)(Tr,{className:`h-4 w-4`}):(0,H.jsx)(Er,{className:`h-4 w-4`})})]})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-text-secondary`,children:[(0,H.jsx)(ti,{className:`h-4 w-4`}),o(`settings:endpoint`)]}),(0,H.jsx)(`input`,{type:`url`,value:s.azureOpenAI?.endpoint??``,onChange:e=>c(t=>({...t,azureOpenAI:{...t.azureOpenAI,endpoint:e.target.value}})),placeholder:`https://your-resource.openai.azure.com`,className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{className:`text-sm font-medium text-text-secondary`,children:o(`settings:deploymentName`)}),(0,H.jsx)(`input`,{type:`text`,value:s.azureOpenAI?.deploymentName??``,onChange:e=>c(t=>({...t,azureOpenAI:{...t.azureOpenAI,deploymentName:e.target.value}})),placeholder:o(`settings:providers.azure.deploymentNamePlaceholder`),className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{className:`text-sm font-medium text-text-secondary`,children:o(`settings:model`)}),(0,H.jsx)(`input`,{type:`text`,value:s.azureOpenAI?.model??`gpt-4o`,onChange:e=>c(t=>({...t,azureOpenAI:{...t.azureOpenAI,model:e.target.value}})),placeholder:`gpt-4o`,className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{className:`text-sm font-medium text-text-secondary`,children:o(`settings:apiVersion`)}),(0,H.jsx)(`input`,{type:`text`,value:s.azureOpenAI?.apiVersion??`2024-08-01-preview`,onChange:e=>c(t=>({...t,azureOpenAI:{...t.azureOpenAI,apiVersion:e.target.value}})),placeholder:`2024-08-01-preview`,className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`})]})]}),(0,H.jsxs)(`p`,{className:`text-xs text-text-muted`,children:[o(`settings:azureHint`),` `,(0,H.jsx)(`a`,{href:`https://portal.azure.com/#view/Microsoft_Azure_ProjectOxford/CognitiveServicesHub/~/OpenAI`,target:`_blank`,rel:`noopener noreferrer`,className:`text-accent hover:underline`,children:o(`settings:azurePortal`)})]})]}),s.activeProvider===`ollama`&&(0,H.jsxs)(`div`,{className:`animate-fade-in space-y-4`,children:[(0,H.jsxs)(`div`,{className:`rounded-xl border border-amber-500/30 bg-amber-500/10 p-3`,children:[(0,H.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-300`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:o(`settings:providers.ollama.quickStart`)}),` `,o(`settings:providers.ollama.installFrom`),` `,(0,H.jsx)(`a`,{href:`https://ollama.ai`,target:`_blank`,rel:`noopener noreferrer`,className:`text-accent hover:underline`,children:`ollama.ai`}),o(`settings:providers.ollama.thenRun`)]}),(0,H.jsx)(`code`,{className:`mt-2 block rounded-lg bg-black/30 px-3 py-2 font-mono text-sm text-amber-200`,children:`ollama serve`})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-text-secondary`,children:[(0,H.jsx)(ti,{className:`h-4 w-4`}),o(`settings:baseUrl`)]}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(`input`,{type:`url`,value:s.ollama?.baseUrl??`http://localhost:11434`,onChange:e=>c(t=>({...t,ollama:{...t.ollama,baseUrl:e.target.value}})),placeholder:`http://localhost:11434`,className:`flex-1 rounded-xl border border-border-subtle bg-elevated px-4 py-3 font-mono text-sm text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>C(s.ollama?.baseUrl??`http://localhost:11434`),disabled:_,className:`rounded-xl border border-border-subtle bg-elevated px-3 py-3 text-text-secondary transition-colors hover:border-accent/50 hover:text-text-primary disabled:opacity-50`,title:o(`settings:checkConnection`),children:(0,H.jsx)(Xr,{className:`h-4 w-4 ${_?`animate-spin`:``}`})})]}),(0,H.jsxs)(`p`,{className:`text-xs text-text-muted`,children:[o(`settings:defaultPort`),` `,(0,H.jsx)(`code`,{className:`rounded bg-elevated px-1 py-0.5`,children:`11434`}),`.`]})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{className:`text-sm font-medium text-text-secondary`,children:o(`settings:model`)}),h&&!_&&(0,H.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 p-2`,children:(0,H.jsxs)(`p`,{className:`flex items-center gap-1 text-xs text-red-400`,children:[(0,H.jsx)(Sr,{className:`h-3 w-3`}),h]})}),(0,H.jsx)(`input`,{type:`text`,value:s.ollama?.model??``,onChange:e=>c(t=>({...t,ollama:{...t.ollama,model:e.target.value}})),placeholder:o(`settings:providers.ollama.modelPlaceholder`),className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 font-mono text-sm text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,H.jsxs)(`p`,{className:`text-xs text-text-muted`,children:[o(`settings:pullModel`),` `,(0,H.jsx)(`code`,{className:`rounded bg-elevated px-1 py-0.5`,children:`ollama pull llama3.2`})]})]})]}),s.activeProvider===`openrouter`&&(0,H.jsx)(tk,{title:`OpenRouter`,apiKey:{value:s.openrouter?.apiKey??``,placeholder:o(`settings:providers.openrouter.apiKeyPlaceholder`),helperText:o(`settings:providers.openrouter.helperText`),helperLink:`https://openrouter.ai/keys`,helperLinkLabel:o(`settings:providers.openrouter.helperLinkLabel`),isVisible:!!l.openrouter,onChange:e=>c(t=>({...t,openrouter:{...t.openrouter,apiKey:e}})),onToggleVisibility:()=>D(`openrouter`)},children:(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{className:`text-sm font-medium text-text-secondary`,children:o(`settings:model`)}),(0,H.jsx)(nk,{value:s.openrouter?.model??``,onChange:e=>c(t=>({...t,openrouter:{...t.openrouter,model:e}})),models:y,isLoading:x,onLoadModels:w}),(0,H.jsxs)(`p`,{className:`text-xs text-text-muted`,children:[o(`settings:browseModels`),` `,(0,H.jsx)(`a`,{href:`https://openrouter.ai/models`,target:`_blank`,rel:`noopener noreferrer`,className:`text-accent hover:underline`,children:o(`settings:openRouterModels`)})]})]})}),s.activeProvider===`minimax`&&(0,H.jsx)(tk,{title:`MiniMax`,apiKey:{value:s.minimax?.apiKey??``,placeholder:o(`settings:providers.minimax.apiKeyPlaceholder`),helperText:o(`settings:providers.minimax.helperText`),helperLink:`https://platform.minimax.io`,helperLinkLabel:o(`settings:providers.minimax.helperLinkLabel`),isVisible:!!l.minimax,onChange:e=>c(t=>({...t,minimax:{...t.minimax,apiKey:e}})),onToggleVisibility:()=>D(`minimax`)},model:{value:s.minimax?.model??`MiniMax-M2.5`,placeholder:o(`settings:providers.minimax.modelPlaceholder`),onChange:e=>c(t=>({...t,minimax:{...t.minimax,model:e}})),helperText:o(`settings:providers.minimax.helperModel`)}}),s.activeProvider===`deepseek`&&(0,H.jsx)(tk,{title:`DeepSeek`,apiKey:{value:s.deepseek?.apiKey??``,placeholder:`Enter your DeepSeek API key`,helperText:`Get your API key from`,helperLink:`https://platform.deepseek.com/api_keys`,helperLinkLabel:`DeepSeek Platform`,isVisible:!!l.deepseek,onChange:e=>c(t=>({...t,deepseek:{...t.deepseek,apiKey:e}})),onToggleVisibility:()=>D(`deepseek`)},model:{value:s.deepseek?.model??`deepseek-v4-flash`,placeholder:`e.g., deepseek-v4-flash, deepseek-v4-pro, deepseek-chat`,onChange:e=>c(t=>({...t,deepseek:{...t.deepseek,model:e}})),helperText:`deepseek-v4-flash (default), deepseek-v4-pro, deepseek-chat (V3), deepseek-reasoner (R1)`},children:(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:`Compatible via OpenAI API format. The deepseek-reasoner model uses thinking mode and requires round-tripping reasoning content.`})}),s.activeProvider===`glm`&&(0,H.jsxs)(`div`,{className:`animate-fade-in space-y-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-text-secondary`,children:[(0,H.jsx)(Ir,{className:`h-4 w-4`}),o(`settings:apiKey`)]}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`input`,{type:l.glm?`text`:`password`,value:s.glm?.apiKey??``,onChange:e=>c(t=>({...t,glm:{...t.glm,apiKey:e.target.value}})),placeholder:o(`settings:providers.glm.apiKeyPlaceholder`),className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 pr-12 text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>D(`glm`),className:`absolute top-1/2 right-3 -translate-y-1/2 p-1 text-text-muted transition-colors hover:text-text-primary`,children:l.glm?(0,H.jsx)(Tr,{className:`h-4 w-4`}):(0,H.jsx)(Er,{className:`h-4 w-4`})})]}),(0,H.jsxs)(`p`,{className:`text-xs text-text-muted`,children:[o(`settings:providers.openai.helperText`),` `,(0,H.jsx)(`a`,{href:`https://docs.z.ai`,target:`_blank`,rel:`noopener noreferrer`,className:`text-accent hover:underline`,children:o(`settings:zaiPlatform`)})]})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{className:`text-sm font-medium text-text-secondary`,children:o(`settings:model`)}),(0,H.jsx)(`select`,{value:s.glm?.model??`GLM-5`,onChange:e=>c(t=>({...t,glm:{...t.glm,model:e.target.value}})),className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 font-mono text-sm text-text-primary transition-all outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,children:we(`glm`).map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{className:`text-sm font-medium text-text-secondary`,children:o(`settings:baseUrl`)}),(0,H.jsx)(`input`,{type:`text`,value:s.glm?.baseUrl??`https://api.z.ai/api/coding/paas/v4`,onChange:e=>c(t=>({...t,glm:{...t.glm,baseUrl:e.target.value}})),placeholder:`https://api.z.ai/api/coding/paas/v4`,className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 font-mono text-sm text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:o(`settings:glmCodingApi`)})]})]}),(0,H.jsx)(`div`,{className:`rounded-xl border border-border-subtle bg-elevated/50 p-4`,children:(0,H.jsxs)(`div`,{className:`flex gap-3`,children:[(0,H.jsx)(`div`,{className:`flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg bg-green-500/20 text-green-400`,children:`🔒`}),(0,H.jsxs)(`div`,{className:`text-xs leading-relaxed text-text-muted`,children:[(0,H.jsx)(`span`,{className:`font-medium text-text-secondary`,children:o(`settings:privacyLabel`)}),` `,o(`settings:privacyFull`)]})]})})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between border-t border-border-subtle bg-elevated/30 px-6 py-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[d===`saved`&&(0,H.jsxs)(`span`,{className:`flex animate-fade-in items-center gap-1.5 text-green-400`,children:[(0,H.jsx)(vr,{className:`h-4 w-4`}),o(`settings:settingsSaved`)]}),d===`error`&&(0,H.jsxs)(`span`,{className:`flex animate-fade-in items-center gap-1.5 text-red-400`,children:[(0,H.jsx)(Sr,{className:`h-4 w-4`}),o(`settings:failedToSave`)]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`button`,{onClick:t,className:`px-4 py-2 text-sm text-text-secondary transition-colors hover:text-text-primary`,children:o(`common:actions.cancel`)}),(0,H.jsx)(`button`,{onClick:E,className:`rounded-lg bg-accent px-5 py-2 text-sm font-medium text-white transition-colors hover:bg-accent-dim`,children:o(`settings:saveSettings`)})]})]})]})]}):null},ak=()=>{let{graph:e,graphMode:t,progress:n}=dr(),{t:r}=f([`common`,`graph`]),i=e?.nodes.length??0,a=e?.relationships.length??0,o=(0,P.useMemo)(()=>{if(!e)return null;let t=e.nodes.map(e=>e.properties.language).filter(Boolean);if(t.length===0)return null;let n=t.reduce((e,t)=>(e[t]=(e[t]||0)+1,e),{});return Object.entries(n).sort((e,t)=>t[1]-e[1])[0]?.[0]},[e]);return(0,H.jsxs)(`footer`,{className:`flex items-center justify-between border-t border-dashed border-border-subtle bg-deep px-5 py-2 text-[11px] text-text-muted`,children:[(0,H.jsx)(`div`,{className:`flex items-center gap-4`,children:n&&n.phase!==`complete`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`h-1 w-28 overflow-hidden rounded-full bg-elevated`,children:(0,H.jsx)(`div`,{className:`h-full rounded-full bg-gradient-to-r from-accent to-node-interface transition-all duration-300`,style:{width:`${n.percent}%`}})}),(0,H.jsx)(`span`,{children:Di(n.message,r)})]}):(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,"data-testid":`status-ready`,children:[(0,H.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-node-function`}),(0,H.jsx)(`span`,{children:r(`common:progress.ready`)})]})}),(0,H.jsxs)(`a`,{href:`https://github.com/sponsors/abhigyanpatwari`,target:`_blank`,rel:`noopener noreferrer`,className:`group flex cursor-pointer items-center gap-2 rounded-full border border-pink-500/20 bg-pink-500/10 px-3 py-1 transition-all duration-200 hover:scale-[1.02] hover:border-pink-500/40 hover:bg-pink-500/20`,children:[(0,H.jsx)(Pr,{className:`h-3.5 w-3.5 animate-pulse fill-pink-500/40 text-pink-500 transition-all duration-200 group-hover:scale-110 group-hover:fill-pink-500`}),(0,H.jsx)(`span`,{className:`text-[11px] font-medium text-pink-400 transition-colors group-hover:text-pink-300`,children:r(`graph:statusBar.sponsor`)}),(0,H.jsx)(`span`,{className:`hidden text-[10px] text-pink-300/50 italic transition-colors group-hover:text-pink-300/80 md:inline`,children:r(`graph:statusBar.sponsorHint`)})]}),(0,H.jsx)(`div`,{className:`flex items-center gap-3`,"data-testid":`graph-stats`,children:e&&t!==`chatOnly`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{children:r(`common:counts.nodes`,{count:i})}),(0,H.jsx)(`span`,{className:`text-border-default`,children:`•`}),(0,H.jsx)(`span`,{children:r(`common:counts.edges`,{count:a})}),o&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`text-border-default`,children:`•`}),(0,H.jsx)(`span`,{children:o})]})]})})]})},ok=e=>{let t=[],n=new Map,r=e.filter(e=>e.label===`Folder`||e.label===`File`);return r.sort((e,t)=>e.properties.filePath.localeCompare(t.properties.filePath)),r.forEach(e=>{let r=e.properties.filePath.split(`/`).filter(Boolean),i=``,a=t;r.forEach((t,o)=>{i=i?`${i}/${t}`:t;let s=n.get(i);if(!s){let c=o===r.length-1,l=c&&e.label===`File`;s={id:c?e.id:i,name:t,type:l?`file`:`folder`,path:i,children:[],graphNode:c?e:void 0},n.set(i,s),a.push(s)}a=s.children})}),t},sk=({node:e,depth:t,searchQuery:n,onNodeClick:r,expandedPaths:i,toggleExpanded:a,selectedPath:o})=>{let s=i.has(e.path),c=o===e.path,l=e.children.length>0,u=(0,P.useMemo)(()=>{if(!n)return e.children;let t=n.toLowerCase(),r=(e,t)=>e.name.toLowerCase().includes(t)?!0:e.children?.some(e=>r(e,t))??!1;return e.children.filter(e=>r(e,t))},[e.children,n]),d=n&&e.name.toLowerCase().includes(n.toLowerCase());return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`button`,{onClick:()=>{l&&a(e.path),r(e)},className:`relative flex w-full items-center gap-1.5 rounded px-2 py-1 text-left text-sm transition-colors hover:bg-hover ${c?`border-l-2 border-amber-400 bg-amber-500/15 text-amber-300`:`border-l-2 border-transparent text-text-secondary hover:text-text-primary`} ${d?`bg-accent/10`:``} `,style:{paddingLeft:`${t*12+8}px`},children:[l?s?(0,H.jsx)(yr,{className:`h-3.5 w-3.5 shrink-0 text-text-muted`}):(0,H.jsx)(br,{className:`h-3.5 w-3.5 shrink-0 text-text-muted`}):(0,H.jsx)(`span`,{className:`w-3.5`}),e.type===`folder`?s?(0,H.jsx)(Or,{className:`h-4 w-4 shrink-0`,style:{color:qn.Folder}}):(0,H.jsx)(kr,{className:`h-4 w-4 shrink-0`,style:{color:qn.Folder}}):(0,H.jsx)(Dr,{className:`h-4 w-4 shrink-0`,style:{color:qn.File}}),(0,H.jsx)(`span`,{className:`truncate font-mono text-xs`,children:e.name})]}),s&&u.length>0&&(0,H.jsx)(`div`,{children:u.map(e=>(0,H.jsx)(sk,{node:e,depth:t+1,searchQuery:n,onNodeClick:r,expandedPaths:i,toggleExpanded:a,selectedPath:o},e.id))})]})},ck=e=>{switch(e){case`Folder`:return kr;case`File`:return Dr;case`Class`:return hr;case`Function`:return gr;case`Method`:return gr;case`Interface`:return Nr;case`Enum`:return Br;case`Type`:return pi;case`Decorator`:return mr;case`Import`:return Dr;case`Variable`:case`Property`:return hi;case`Const`:return li;default:return hi}},lk=({onFocusNode:e})=>{let{t}=f([`common`,`graph`]),{graph:n,visibleLabels:r,toggleLabelVisibility:i,visibleEdgeTypes:a,toggleEdgeVisibility:o,selectedNode:s,setSelectedNode:c,openCodePanel:l,depthFilter:u,setDepthFilter:d}=dr(),[p,m]=(0,P.useState)(!1),[h,g]=(0,P.useState)(``),[_,v]=(0,P.useState)(new Set),[y,b]=(0,P.useState)(`files`),x=(0,P.useMemo)(()=>n?ok(n.nodes):[],[n]);(0,P.useEffect)(()=>{if(x.length>0&&_.size===0){let e=new Set(x.map(e=>e.path));v(e)}},[x.length]),(0,P.useEffect)(()=>{let e=s?.properties?.filePath;if(!e)return;let t=e.split(`/`).filter(Boolean),n=[],r=``;for(let e=0;e<t.length-1;e++)r=r?`${r}/${t[e]}`:t[e],n.push(r);n.length>0&&v(e=>{let t=new Set(e);return n.forEach(e=>t.add(e)),t})},[s?.id]);let S=(0,P.useCallback)(e=>{v(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),C=(0,P.useCallback)(t=>{if(t.graphNode){let n=s?.id===t.graphNode.id;c(t.graphNode),l(),n||e(t.graphNode.id)}},[c,l,e,s]),w=s?.properties.filePath||null;return p?(0,H.jsxs)(`div`,{className:`flex h-full w-12 flex-col items-center gap-2 border-r border-border-subtle bg-surface py-3`,children:[(0,H.jsx)(`button`,{onClick:()=>m(!1),className:`rounded p-2 text-text-secondary transition-colors hover:bg-hover hover:text-text-primary`,title:t(`graph:fileTree.expandPanel`),children:(0,H.jsx)(Kr,{className:`h-5 w-5`})}),(0,H.jsx)(`div`,{className:`my-1 h-px w-6 bg-border-subtle`}),(0,H.jsx)(`button`,{onClick:()=>{m(!1),b(`files`)},className:`rounded p-2 transition-colors ${y===`files`?`bg-accent/10 text-accent`:`text-text-secondary hover:bg-hover hover:text-text-primary`}`,title:t(`graph:fileTree.fileExplorer`),children:(0,H.jsx)(kr,{className:`h-5 w-5`})}),(0,H.jsx)(`button`,{onClick:()=>{m(!1),b(`filters`)},className:`rounded p-2 transition-colors ${y===`filters`?`bg-accent/10 text-accent`:`text-text-secondary hover:bg-hover hover:text-text-primary`}`,title:t(`graph:fileTree.filters`),children:(0,H.jsx)(Ar,{className:`h-5 w-5`})})]}):(0,H.jsxs)(`div`,{className:`flex h-full w-64 animate-slide-in flex-col border-r border-border-subtle bg-surface`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border-subtle px-3 py-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`button`,{onClick:()=>b(`files`),className:`rounded px-2 py-1 text-xs transition-colors ${y===`files`?`bg-accent/20 text-accent`:`text-text-secondary hover:bg-hover hover:text-text-primary`}`,children:t(`graph:fileTree.explorer`)}),(0,H.jsx)(`button`,{onClick:()=>b(`filters`),className:`rounded px-2 py-1 text-xs transition-colors ${y===`filters`?`bg-accent/20 text-accent`:`text-text-secondary hover:bg-hover hover:text-text-primary`}`,children:t(`graph:fileTree.filters`)})]}),(0,H.jsx)(`button`,{onClick:()=>m(!0),className:`rounded p-1 text-text-muted transition-colors hover:bg-hover hover:text-text-primary`,title:t(`graph:fileTree.collapsePanel`),children:(0,H.jsx)(Gr,{className:`h-4 w-4`})})]}),y===`files`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`border-b border-border-subtle px-3 py-2`,children:(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)($r,{className:`absolute top-1/2 left-2.5 h-3.5 w-3.5 -translate-y-1/2 text-text-muted`}),(0,H.jsx)(`input`,{type:`text`,placeholder:t(`graph:fileTree.searchFiles`),value:h,onChange:e=>g(e.target.value),className:`w-full rounded border border-border-subtle bg-elevated py-1.5 pr-3 pl-8 text-xs text-text-primary placeholder:text-text-muted focus:border-accent focus:outline-none`})]})}),(0,H.jsx)(`div`,{className:`scrollbar-thin flex-1 overflow-y-auto py-2`,children:x.length===0?(0,H.jsx)(`div`,{className:`px-3 py-4 text-center text-xs text-text-muted`,children:t(`graph:fileTree.noFilesLoaded`)}):x.map(e=>(0,H.jsx)(sk,{node:e,depth:0,searchQuery:h,onNodeClick:C,expandedPaths:_,toggleExpanded:S,selectedPath:w},e.id))})]}),y===`filters`&&(0,H.jsxs)(`div`,{className:`scrollbar-thin flex-1 overflow-y-auto p-3`,children:[(0,H.jsxs)(`div`,{className:`mb-3`,children:[(0,H.jsx)(`h3`,{className:`mb-2 text-xs font-medium tracking-wide text-text-secondary uppercase`,children:t(`graph:fileTree.nodeTypes`)}),(0,H.jsx)(`p`,{className:`mb-3 text-[11px] text-text-muted`,children:t(`graph:fileTree.nodeTypesDesc`)})]}),(0,H.jsx)(`div`,{className:`flex flex-col gap-1`,children:Qn.map(e=>{let t=ck(e),n=r.includes(e);return(0,H.jsxs)(`button`,{onClick:()=>i(e),className:`flex items-center gap-2.5 rounded px-2 py-1.5 text-left transition-colors ${n?`bg-elevated text-text-primary`:`text-text-muted hover:bg-hover hover:text-text-secondary`} `,children:[(0,H.jsx)(`div`,{className:`flex h-5 w-5 items-center justify-center rounded ${n?``:`opacity-40`}`,style:{backgroundColor:`${qn[e]}20`},children:(0,H.jsx)(t,{className:`h-3 w-3`,style:{color:qn[e]}})}),(0,H.jsx)(`span`,{className:`flex-1 text-xs`,children:e}),(0,H.jsx)(`div`,{className:`h-2 w-2 rounded-full transition-colors ${n?`bg-accent`:`bg-border-subtle`}`})]},e)})}),(0,H.jsxs)(`div`,{className:`mt-6 border-t border-border-subtle pt-4`,children:[(0,H.jsx)(`h3`,{className:`mb-2 text-xs font-medium tracking-wide text-text-secondary uppercase`,children:t(`graph:fileTree.edgeTypes`)}),(0,H.jsx)(`p`,{className:`mb-3 text-[11px] text-text-muted`,children:t(`graph:fileTree.edgeTypesDesc`)}),(0,H.jsx)(`div`,{className:`flex flex-col gap-1`,children:$n.map(e=>{let t=tr[e],n=a.includes(e);return(0,H.jsxs)(`button`,{onClick:()=>o(e),className:`flex items-center gap-2.5 rounded px-2 py-1.5 text-left transition-colors ${n?`bg-elevated text-text-primary`:`text-text-muted hover:bg-hover hover:text-text-secondary`} `,children:[(0,H.jsx)(`div`,{className:`h-1.5 w-6 rounded-full ${n?``:`opacity-40`}`,style:{backgroundColor:t.color}}),(0,H.jsx)(`span`,{className:`flex-1 text-xs`,children:t.label}),(0,H.jsx)(`div`,{className:`h-2 w-2 rounded-full transition-colors ${n?`bg-accent`:`bg-border-subtle`}`})]},e)})})]}),(0,H.jsxs)(`div`,{className:`mt-6 border-t border-border-subtle pt-4`,children:[(0,H.jsxs)(`h3`,{className:`mb-2 text-xs font-medium tracking-wide text-text-secondary uppercase`,children:[(0,H.jsx)(li,{className:`mr-1.5 inline h-3 w-3`}),t(`graph:fileTree.focusDepth`)]}),(0,H.jsx)(`p`,{className:`mb-3 text-[11px] text-text-muted`,children:t(`graph:fileTree.focusDepthDesc`)}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:[{value:null,label:t(`graph:fileTree.all`)},{value:1,label:t(`graph:fileTree.hops`,{count:1})},{value:2,label:t(`graph:fileTree.hops`,{count:2})},{value:3,label:t(`graph:fileTree.hops`,{count:3})},{value:5,label:t(`graph:fileTree.hops`,{count:5})}].map(({value:e,label:t})=>(0,H.jsx)(`button`,{onClick:()=>d(e),className:`rounded px-2 py-1 text-xs transition-colors ${u===e?`bg-accent text-white`:`bg-elevated text-text-secondary hover:bg-hover hover:text-text-primary`} `,children:t},t))}),u!==null&&!s&&(0,H.jsx)(`p`,{className:`mt-2 text-[10px] text-amber-400`,children:t(`graph:fileTree.selectNodeDepth`)})]}),(0,H.jsxs)(`div`,{className:`mt-6 border-t border-border-subtle pt-4`,children:[(0,H.jsx)(`h3`,{className:`mb-3 text-xs font-medium tracking-wide text-text-secondary uppercase`,children:t(`graph:fileTree.colorLegend`)}),(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:[`Folder`,`File`,`Class`,`Interface`,`Enum`,`Type`,`Function`,`Method`,`Variable`,`Decorator`].map(e=>(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-full`,style:{backgroundColor:qn[e]}}),(0,H.jsx)(`span`,{className:`text-[10px] text-text-muted`,children:e})]},e))})]})]}),n&&(0,H.jsx)(`div`,{className:`border-t border-border-subtle bg-elevated/50 px-3 py-2`,children:(0,H.jsxs)(`div`,{className:`flex items-center justify-between text-[10px] text-text-muted`,children:[(0,H.jsx)(`span`,{children:t(`common:counts.nodes`,{count:n.nodes.length})}),(0,H.jsx)(`span`,{children:t(`common:counts.edges`,{count:n.relationships.length})})]})})]})},uk=e=>e?E(e):`text`,dk={...KO,'pre[class*="language-"]':{...KO[`pre[class*="language-"]`],background:`#0a0a10`,margin:0,padding:`12px 0`,fontSize:`13px`,lineHeight:`1.6`},'code[class*="language-"]':{...KO[`code[class*="language-"]`],background:`transparent`,fontFamily:`"JetBrains Mono", "Fira Code", monospace`}},fk=({onFocusNode:e})=>{let{t}=f([`common`,`graph`]),{graph:n,selectedNode:r,codeReferences:i,removeCodeReference:a,clearCodeReferences:o,setSelectedNode:s,codeReferenceFocus:c,projectName:l,currentRepo:u}=dr(),d=(0,P.useMemo)(()=>n?new Map(n.nodes.map(e=>[e.id,e])):new Map,[n]),[p,m]=(0,P.useState)(!1),[h,g]=(0,P.useState)(null),_=(0,P.useRef)(null),v=(0,P.useRef)(null),y=(0,P.useRef)(new Map),b=(0,P.useRef)(null);(0,P.useEffect)(()=>()=>{b.current&&=(window.clearTimeout(b.current),null)},[]);let[x,S]=(0,P.useState)(()=>{try{let e=window.localStorage.getItem(`gitnexus.codePanelWidth`),t=e?parseInt(e,10):NaN;return Number.isFinite(t)?Math.max(420,Math.min(t,900)):560}catch{return 560}});(0,P.useEffect)(()=>{try{window.localStorage.setItem(`gitnexus.codePanelWidth`,String(x))}catch{}},[x]);let C=(0,P.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),v.current={startX:e.clientX,startWidth:x},document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let t=e=>{let t=v.current;if(!t)return;let n=e.clientX-t.startX,r=Math.max(420,Math.min(t.startWidth+n,900));S(r)},n=()=>{v.current=null,document.body.style.cursor=``,document.body.style.userSelect=``,window.removeEventListener(`mousemove`,t),window.removeEventListener(`mouseup`,n)};window.addEventListener(`mousemove`,t),window.addEventListener(`mouseup`,n)},[x]),w=(0,P.useMemo)(()=>i.filter(e=>e.source===`ai`),[i]);(0,P.useEffect)(()=>{if(!c)return;m(!1);let{filePath:e,startLine:t,endLine:n}=c,r=w.find(r=>r.filePath===e&&r.startLine===t&&r.endLine===n)??w.find(t=>t.filePath===e);if(!r)return;let i=[],a=requestAnimationFrame(()=>{let e=requestAnimationFrame(()=>{let e=y.current.get(r.id);e&&(e.scrollIntoView({behavior:`smooth`,block:`center`}),g(r.id),b.current&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>{g(e=>e===r.id?null:e),b.current=null},1200))});i.push(e)});return i.push(a),()=>{i.forEach(e=>cancelAnimationFrame(e))}},[c,w]);let T=(0,P.useMemo)(()=>w.map(e=>({ref:e,content:null,start:0,end:0,highlightStart:0,highlightEnd:0,totalLines:0})),[w]),E=r?.properties?.filePath,D=r?.label===`File`&&!!E,O=!!r&&!!E,k=w.length>0,[A,j]=(0,P.useState)(null),[M,N]=(0,P.useState)(!1),F=(0,P.useRef)(null),I=A?.content,L=A?.startLine??0;return(0,P.useEffect)(()=>{if(!E){j(null);return}let e=!1;N(!0),j(null);let t=r?.properties?.startLine,n=r?.properties?.endLine,i=D||t===void 0?{}:{startLine:Math.max(0,t-50),endLine:(n??t)+50};return tt(E,{...i,repo:u||l||void 0}).then(t=>{e||(j(t),N(!1))}).catch(()=>{e||(j(null),N(!1))}),()=>{e=!0}},[E,r?.properties?.startLine,r?.properties?.endLine,D,l,u]),(0,P.useEffect)(()=>{if(!I||!r?.properties?.startLine)return;let e=r.properties.startLine,t=!1,n=[requestAnimationFrame(()=>{let r=requestAnimationFrame(()=>{if(t)return;let n=F.current;if(!n)return;let r=n.querySelector(`[data-line-number="${e+1}"]`)??n.querySelectorAll(`.linenumber`)[e];r?r.scrollIntoView({behavior:`smooth`,block:`center`}):n.scrollTop=Math.max(0,e*20.8-n.clientHeight/3)});n.push(r)})];return()=>{t=!0,n.forEach(e=>cancelAnimationFrame(e))}},[I,r?.properties?.startLine]),p?(0,H.jsxs)(`aside`,{className:`flex h-full w-12 flex-shrink-0 flex-col items-center gap-2 border-r border-border-subtle bg-surface py-3`,children:[(0,H.jsx)(`button`,{onClick:()=>m(!1),className:`rounded p-2 text-text-secondary transition-colors hover:bg-cyan-500/10 hover:text-cyan-400`,title:t(`graph:codePanel.expand`),children:(0,H.jsx)(Kr,{className:`h-5 w-5`})}),(0,H.jsx)(`div`,{className:`my-1 h-px w-6 bg-border-subtle`}),O&&(0,H.jsx)(`div`,{className:`rotate-90 text-[9px] font-medium tracking-wide whitespace-nowrap text-amber-400`,children:t(`graph:codePanel.selected`)}),k&&(0,H.jsxs)(`div`,{className:`mt-4 rotate-90 text-[9px] font-medium tracking-wide whitespace-nowrap text-cyan-400`,children:[`AI • `,w.length]})]}):(0,H.jsxs)(`aside`,{ref:e=>{_.current=e},className:`relative flex h-full animate-slide-in flex-col border-r border-border-subtle bg-surface/95 shadow-2xl backdrop-blur-md`,style:{width:x},children:[(0,H.jsx)(`div`,{onMouseDown:C,className:`absolute top-0 right-0 h-full w-2 cursor-col-resize bg-transparent transition-colors hover:bg-cyan-500/25`,title:t(`graph:codePanel.dragResize`)}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border-subtle bg-gradient-to-r from-elevated/60 to-surface/60 px-3 py-2.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(wr,{className:`h-4 w-4 text-cyan-400`}),(0,H.jsx)(`span`,{className:`text-sm font-semibold text-text-primary`,children:t(`graph:codePanel.title`)})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[k&&(0,H.jsx)(`button`,{onClick:()=>o(),className:`rounded p-1.5 text-text-muted transition-colors hover:bg-red-500/10 hover:text-red-400`,title:t(`graph:codePanel.clearCitations`),children:(0,H.jsx)(di,{className:`h-4 w-4`})}),(0,H.jsx)(`button`,{onClick:()=>m(!0),className:`rounded p-1.5 text-text-muted transition-colors hover:bg-hover hover:text-text-primary`,title:t(`common:actions.collapse`),children:(0,H.jsx)(Gr,{className:`h-4 w-4`})})]})]}),(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[O&&(0,H.jsxs)(`div`,{className:`${k?`h-[42%]`:`flex-1`} flex min-h-0 flex-col`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-amber-500/20 bg-gradient-to-r from-amber-500/8 to-orange-500/5 px-3 py-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border border-amber-500/25 bg-amber-500/15 px-2 py-0.5`,children:[(0,H.jsx)(Ur,{className:`h-3 w-3 text-amber-400`}),(0,H.jsx)(`span`,{className:`text-[10px] font-semibold tracking-wide text-amber-300 uppercase`,children:t(`graph:codePanel.selected`)})]}),(0,H.jsx)(Dr,{className:`ml-1 h-3.5 w-3.5 text-amber-400/70`}),(0,H.jsx)(`span`,{className:`flex-1 truncate font-mono text-xs text-text-primary`,children:r?.properties?.filePath?.split(`/`).pop()??r?.properties?.name}),(0,H.jsx)(`button`,{onClick:()=>s(null),className:`rounded p-1 text-text-muted transition-colors hover:bg-amber-500/10 hover:text-amber-400`,title:t(`graph:codePanel.clearSelection`),children:(0,H.jsx)(gi,{className:`h-4 w-4`})})]}),(0,H.jsx)(`div`,{ref:F,className:`scrollbar-thin min-h-0 flex-1 overflow-auto`,children:M?(0,H.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-8 text-text-muted`,children:[(0,H.jsx)(Vr,{className:`h-4 w-4 animate-spin`}),(0,H.jsx)(`span`,{className:`text-sm`,children:t(`graph:codePanel.loadingSource`)})]}):I?(0,H.jsx)(GO,{language:uk(E),style:dk,showLineNumbers:!0,startingLineNumber:L+1,lineNumberStyle:{minWidth:`3em`,paddingRight:`1em`,color:`#5a5a70`,textAlign:`right`,userSelect:`none`},lineProps:e=>{let t=r?.properties?.startLine,n=r?.properties?.endLine??t,i=typeof t==`number`&&e>=t+1&&e<=(n??t)+1;return{style:{display:`block`,backgroundColor:i?`rgba(6, 182, 212, 0.14)`:`transparent`,borderLeft:i?`3px solid #06b6d4`:`3px solid transparent`,paddingLeft:`12px`,paddingRight:`16px`}}},wrapLines:!0,children:I}):(0,H.jsx)(`div`,{className:`px-3 py-3 text-sm text-text-muted`,children:D?(0,H.jsx)(H.Fragment,{children:t(`graph:codePanel.codeNotAvailable`,{path:E})}):(0,H.jsx)(H.Fragment,{children:t(`graph:codePanel.selectFile`)})})})]}),O&&k&&(0,H.jsx)(`div`,{className:`h-1.5 bg-gradient-to-r from-transparent via-border-subtle to-transparent`}),k&&(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-cyan-500/20 bg-gradient-to-r from-cyan-500/8 to-teal-500/5 px-3 py-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border border-cyan-500/25 bg-cyan-500/15 px-2 py-0.5`,children:[(0,H.jsx)(ai,{className:`h-3 w-3 text-cyan-400`}),(0,H.jsx)(`span`,{className:`text-[10px] font-semibold tracking-wide text-cyan-300 uppercase`,children:t(`graph:codePanel.aiCitations`)})]}),(0,H.jsx)(`span`,{className:`ml-1 text-xs text-text-muted`,children:t(`graph:codePanel.references`,{count:w.length})})]}),(0,H.jsx)(`div`,{className:`scrollbar-thin min-h-0 flex-1 space-y-3 overflow-y-auto p-3`,children:T.map(({ref:r,content:i,start:o,highlightStart:c,highlightEnd:l,totalLines:u})=>{let f=r.label&&qn[r.label]||`#6b7280`,p=typeof r.startLine==`number`,m=p?(r.startLine??0)+1:void 0,g=p?(r.endLine??r.startLine??0)+1:void 0,_=uk(r.filePath);return(0,H.jsxs)(`div`,{ref:e=>{y.current.set(r.id,e)},className:[`overflow-hidden rounded-xl border border-border-subtle bg-elevated transition-all`,h===r.id?`animate-pulse shadow-[0_0_0_6px_rgba(34,211,238,0.14)] ring-2 ring-cyan-300/70`:``].join(` `),children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-border-subtle bg-surface/40 px-3 py-2`,children:[(0,H.jsx)(`span`,{className:`mt-0.5 flex-shrink-0 rounded px-2 py-0.5 text-[10px] font-semibold tracking-wide uppercase`,style:{backgroundColor:f,color:`#06060a`},title:r.label??t(`graph:codePanel.code`),children:r.label??t(`graph:codePanel.code`)}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate text-xs font-medium text-text-primary`,children:r.name??r.filePath.split(`/`).pop()??r.filePath}),(0,H.jsxs)(`div`,{className:`truncate font-mono text-[11px] text-text-muted`,children:[r.filePath,m!==void 0&&(0,H.jsxs)(`span`,{className:`text-text-secondary`,children:[` `,`• L`,m,g===m?``:`–${g}`]}),u>0&&(0,H.jsxs)(`span`,{className:`text-text-muted`,children:[` `,`• `,t(`graph:codePanel.lines`,{count:u})]})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[r.nodeId&&(0,H.jsx)(`button`,{onClick:()=>{let t=r.nodeId;if(n){let e=d.get(t);e&&s(e)}e(t)},className:`rounded p-1.5 text-text-muted transition-colors hover:bg-hover hover:text-text-primary`,title:t(`common:actions.focusInGraph`),children:(0,H.jsx)(li,{className:`h-4 w-4`})}),(0,H.jsx)(`button`,{onClick:()=>a(r.id),className:`rounded p-1.5 text-text-muted transition-colors hover:bg-hover hover:text-text-primary`,title:t(`common:actions.remove`),children:(0,H.jsx)(gi,{className:`h-4 w-4`})})]})]}),(0,H.jsx)(`div`,{className:`overflow-x-auto`,children:i?(0,H.jsx)(GO,{language:_,style:dk,showLineNumbers:!0,startingLineNumber:o+1,lineNumberStyle:{minWidth:`3em`,paddingRight:`1em`,color:`#5a5a70`,textAlign:`right`,userSelect:`none`},lineProps:e=>{let t=p&&e>=o+c+1&&e<=o+l+1;return{style:{display:`block`,backgroundColor:t?`rgba(6, 182, 212, 0.14)`:`transparent`,borderLeft:t?`3px solid #06b6d4`:`3px solid transparent`,paddingLeft:`12px`,paddingRight:`16px`}}},wrapLines:!0,children:i}):(0,H.jsx)(`div`,{className:`px-3 py-3 text-sm text-text-muted`,children:t(`graph:codePanel.codeNotAvailable`,{path:r.filePath})})})]},r.id)})})]})]})]})},pk=e=>e.get(`repo`)??e.get(`project`)??void 0,mk=()=>{let{t:e}=f([`common`,`errors`]),{viewMode:t,setViewMode:n,setGraph:r,setGraphMode:i,setChatOnlyNodeCount:a,setProgress:o,setProjectName:s,progress:c,isRightPanelOpen:l,isSettingsPanelOpen:u,setSettingsPanelOpen:d,refreshLLMSettings:p,initializeAgent:m,startEmbeddingsWithFallback:h,codeReferences:g,selectedNode:_,isCodePanelOpen:v,serverBaseUrl:b,setServerBaseUrl:x,availableRepos:S,setAvailableRepos:C,switchRepo:w,setCurrentRepo:T}=dr(),E=(0,P.useRef)(null),[D,O]=(0,P.useState)(!1),k=(0,P.useCallback)(async e=>{let t=e.repoInfo.repoPath??e.repoInfo.path,o=e.repoInfo.name||(t||``).replace(/\\/g,`/`).split(`/`).filter(Boolean).pop()||`server-project`,c=t||o;s(o),T(c);let l=L(e);r(l.graph),i(l.graphMode),a(l.graphMode===`chatOnly`?l.nodeCount:null);let u=new URL(window.location.href);u.searchParams.set(`project`,o),t&&u.searchParams.set(`repo`,t),window.history.replaceState(null,``,u.toString()),n(`exploring`);try{ve()&&await m(o,{chatOnly:e.graphSkipped,repo:c}),h()}catch(e){console.warn(`Failed to initialize agent:`,e)}},[n,r,i,a,s,T,m,h]),A=(0,P.useRef)(!1),j=(0,P.useRef)(e);(0,P.useEffect)(()=>{j.current=e},[e]),(0,P.useEffect)(()=>{if(A.current)return;let e=new URLSearchParams(window.location.search),t=e.get(`server`),r=pk(e),i=ke(e.get(`skipGraph`));if(!t&&!r)return;A.current=!0,o({phase:`extracting`,percent:0,message:j.current(`common:progress.connecting`),detail:j.current(`common:progress.validatingServer`)}),n(`loading`);let a=t||window.location.origin,s=Le(a);(async()=>await ct(a,(e,t,n)=>{if(e===`validating`)o({phase:`extracting`,percent:5,message:j.current(`common:progress.connecting`),detail:j.current(`common:progress.validatingServer`)});else if(e===`downloading`){let e=n?Math.round(t/n*90)+5:50,r=(t/(1024*1024)).toFixed(1);o({phase:`extracting`,percent:e,message:j.current(`common:progress.downloadingGraph`),detail:j.current(`common:progress.downloadedMb`,{mb:r})})}else e===`extracting`&&o({phase:`extracting`,percent:97,message:j.current(`common:progress.processing`),detail:j.current(`common:progress.extractingFileContents`)})},void 0,r,{awaitAnalysis:!0,skipGraph:i}))().then(async e=>{x(s),await k(e),o(null),qe().then(e=>C(e)).catch(e=>console.warn(`Failed to fetch repo list:`,e))}).catch(e=>{console.error(`Auto-connect failed:`,e),o({phase:`error`,percent:0,message:j.current(`errors:connectFailed`),detail:qi(e,j.current)}),setTimeout(()=>{n(`onboarding`),o(null)},y)})},[k,o,n,x,C]);let M=(0,P.useCallback)(e=>{E.current?.focusNode(e)},[]),N=(0,P.useCallback)(()=>{p(),m()},[p,m]);return(0,P.useEffect)(()=>{if(t===`exploring`)return We(()=>O(!1),()=>O(!0))},[t]),t===`onboarding`?(0,H.jsx)(Zi,{onServerConnect:async(e,t)=>{let n=await qe().catch(()=>[]);if(C(n),await k(e),o(null),t){let e=Le(t);x(e);let n=new URL(window.location.href);n.searchParams.set(`server`,e),window.history.replaceState(null,``,n.toString())}}}):t===`loading`&&c?(0,H.jsx)(Qi,{progress:c}):(0,H.jsxs)(`div`,{className:`flex h-screen flex-col overflow-hidden bg-void`,children:[(0,H.jsx)(ra,{onFocusNode:M,availableRepos:S,onSwitchRepo:w,onReposChanged:e=>C(e),onAnalyzeComplete:async e=>{let t=b??`http://localhost:4747`;for(let n=0;n<2;n++)try{let n=await qe();C(n);let r=await ct(t,void 0,void 0,e);await k(r),x(Le(t)),o(null);return}catch(e){if(n===0&&e instanceof je){await new Promise(e=>setTimeout(e,1500));continue}console.error(`Failed to connect after analyze:`,e),qe().then(e=>C(e)).catch(()=>{});return}}}),(0,H.jsxs)(`main`,{className:`flex min-h-0 flex-1`,children:[(0,H.jsx)(lk,{onFocusNode:M}),(0,H.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,H.jsx)(Jd,{ref:E}),v&&(g.length>0||!!_)&&(0,H.jsx)(`div`,{className:`pointer-events-auto absolute inset-y-0 left-0 z-30`,children:(0,H.jsx)(fk,{onFocusNode:M})})]}),l&&(0,H.jsx)(ek,{})]}),(0,H.jsx)(ak,{}),D&&(0,H.jsx)(`div`,{className:`fixed bottom-12 left-1/2 z-50 -translate-x-1/2 rounded-lg border border-yellow-500/30 bg-yellow-900/80 px-4 py-2 text-sm text-yellow-200 shadow-lg backdrop-blur`,children:e(`errors:backend.reconnecting`)}),(0,H.jsx)(ik,{isOpen:u,onClose:()=>d(!1),onSettingsSaved:N})]})};function hk(){return(0,H.jsx)(lr,{children:(0,H.jsx)(mk,{})})}F.createRoot(document.getElementById(`root`)).render((0,H.jsx)(P.StrictMode,{children:(0,H.jsx)(hk,{})}));
575
+ `,i=(await n(t)).map(e=>e.id||e[0]);C(t=>new Map(t).set(e,i)),r(new Set(i)),h(e)}catch(e){console.error(`Failed to load process steps for focus:`,e)}finally{p(null)}}},[m,S,n,r]),T=(0,P.useCallback)((e,t)=>{m===t?(r(new Set),h(null)):(r(new Set(e)),h(t),C(n=>new Map(n).set(t,e)))},[m,r]);(0,P.useEffect)(()=>{i.size===0&&m!==null&&h(null)},[i,m]);let E=g.cross.length+g.intra.length;return E===0?(0,H.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center p-6 text-center`,children:[(0,H.jsx)(`div`,{className:`mb-4 flex h-14 w-14 items-center justify-center rounded-xl bg-surface`,children:(0,H.jsx)(jr,{className:`h-7 w-7 text-text-muted`})}),(0,H.jsx)(`h3`,{className:`mb-2 text-base font-medium text-text-primary`,children:e(`graph:processes.emptyTitle`)}),(0,H.jsx)(`p`,{className:`max-w-xs text-sm text-text-secondary`,children:e(`graph:processes.emptyDescription`)})]}):(0,H.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,H.jsxs)(`div`,{className:`border-b border-border-subtle p-3`,children:[(0,H.jsx)(`div`,{className:`mb-2 flex items-center gap-2`,children:(0,H.jsxs)(`div`,{className:`flex flex-1 items-center gap-2 rounded-lg border border-border-subtle bg-elevated px-3 py-2 focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20`,children:[(0,H.jsx)($r,{className:`h-4 w-4 text-text-muted`}),(0,H.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),placeholder:e(`graph:processes.filterPlaceholder`),className:`flex-1 border-none bg-transparent text-sm text-text-primary outline-none placeholder:text-text-muted`})]})}),(0,H.jsx)(`div`,{className:`flex items-center gap-2 text-xs text-text-muted`,"data-testid":`process-list-loaded`,children:(0,H.jsx)(`span`,{children:e(`graph:processes.detected`,{count:E})})})]}),(0,H.jsxs)(`div`,{className:`scrollbar-thin flex-1 overflow-y-auto`,children:[(0,H.jsx)(`div`,{className:`px-4 py-3`,children:(0,H.jsxs)(`button`,{onClick:b,disabled:d!==null,className:`group flex w-full items-center gap-3 rounded-xl border border-border-subtle bg-elevated/40 p-3 text-left shadow-sm transition-all hover:border-cyan-500/30 hover:bg-elevated/80 hover:shadow-cyan-900/10`,children:[(0,H.jsx)(`div`,{className:`rounded-lg bg-cyan-500/10 p-2 transition-colors group-hover:bg-cyan-500/20`,children:(0,H.jsx)(Lr,{className:`h-5 w-5 text-cyan-400`})}),(0,H.jsxs)(`div`,{className:`flex-1`,children:[(0,H.jsx)(`h4`,{className:`text-sm font-medium text-text-primary group-hover:text-cyan-200`,children:e(`graph:processes.fullMap`)}),(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:e(`graph:processes.viewCombined`,{count:E})})]}),d===`all`?(0,H.jsx)(`span`,{className:`mr-1 animate-spin`,children:(0,H.jsx)(ai,{className:`h-4 w-4 text-cyan-400`})}):(0,H.jsx)(Er,{className:`h-4 w-4 text-text-muted group-hover:text-cyan-400`})]})}),v.cross.length>0&&(0,H.jsxs)(`div`,{className:`border-b border-border-subtle`,children:[(0,H.jsxs)(`button`,{onClick:()=>y(`cross`),className:`flex w-full items-center gap-2 px-4 py-2.5 text-left transition-colors hover:bg-hover`,children:[l.has(`cross`)?(0,H.jsx)(yr,{className:`h-4 w-4 text-text-muted`}):(0,H.jsx)(br,{className:`h-4 w-4 text-text-muted`}),(0,H.jsx)(_i,{className:`h-4 w-4 text-amber-400`}),(0,H.jsx)(`span`,{className:`text-sm font-medium text-text-primary`,children:e(`graph:processes.crossCommunity`)}),(0,H.jsx)(`span`,{className:`ml-auto rounded-full bg-surface px-2 py-0.5 text-xs text-text-muted`,children:v.cross.length})]}),l.has(`cross`)&&(0,H.jsx)(`div`,{className:`pb-2`,children:v.cross.map(e=>(0,H.jsx)($O,{process:e,isLoading:d===e.id,isSelected:s?.id===e.id,isFocused:m===e.id,onView:()=>x(e.id,e.label,`cross_community`),onToggleFocus:()=>w(e.id)},e.id))})]}),v.intra.length>0&&(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`button`,{onClick:()=>y(`intra`),className:`flex w-full items-center gap-2 px-4 py-2.5 text-left transition-colors hover:bg-hover`,children:[l.has(`intra`)?(0,H.jsx)(yr,{className:`h-4 w-4 text-text-muted`}):(0,H.jsx)(br,{className:`h-4 w-4 text-text-muted`}),(0,H.jsx)(Fr,{className:`h-4 w-4 text-emerald-400`}),(0,H.jsx)(`span`,{className:`text-sm font-medium text-text-primary`,children:e(`graph:processes.intraCommunity`)}),(0,H.jsx)(`span`,{className:`ml-auto rounded-full bg-surface px-2 py-0.5 text-xs text-text-muted`,children:v.intra.length})]}),l.has(`intra`)&&(0,H.jsx)(`div`,{className:`pb-2`,children:v.intra.map(e=>(0,H.jsx)($O,{process:e,isLoading:d===e.id,isSelected:s?.id===e.id,isFocused:m===e.id,onView:()=>x(e.id,e.label,`intra_community`),onToggleFocus:()=>w(e.id)},e.id))})]})]}),(0,H.jsx)(_,{process:s,onClose:()=>c(null),onFocusInGraph:T,isFullScreen:s?.id===`combined-all`})]})},$O=({process:e,isLoading:t,isSelected:n,isFocused:r,onView:i,onToggleFocus:a})=>{let{t:o}=f([`graph`]);return(0,H.jsxs)(`div`,{"data-testid":`process-row`,className:`group mx-2 flex items-center gap-2 rounded-lg px-4 py-2 transition-all hover:bg-hover ${r?`bg-amber-950/40 border border-amber-500/50 ring-1 ring-amber-400/30`:n?`bg-cyan-950/40 border border-cyan-500/50 ring-1 ring-cyan-400/30`:``}`,children:[(0,H.jsx)(jr,{className:`h-4 w-4 flex-shrink-0 text-text-muted`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate text-sm text-text-primary`,children:e.label}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-text-muted`,children:[(0,H.jsx)(`span`,{children:o(`graph:processes.steps`,{count:e.stepCount})}),e.clusters.length>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{children:`•`}),(0,H.jsx)(`span`,{children:o(`graph:processes.clusters`,{count:e.clusters.length})})]})]})]}),(0,H.jsx)(`button`,{onClick:a,className:`rounded-md p-1.5 transition-all ${r?`animate-pulse border border-amber-400/40 bg-amber-500/20 text-amber-400 opacity-100 hover:bg-amber-500/30 hover:text-amber-300`:`border border-white/10 bg-white/5 text-text-muted opacity-0 group-hover:opacity-100 hover:border-cyan-400/40 hover:bg-cyan-500/20 hover:text-cyan-400`}`,title:o(r?`graph:processes.removeHighlightTitle`:`graph:processes.highlightTitle`),"data-testid":`process-highlight-button`,children:(0,H.jsx)(zr,{className:`h-4 w-4`})}),(0,H.jsx)(`button`,{onClick:i,disabled:t,"data-testid":`process-view-button`,className:`flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium shadow-sm transition-all disabled:opacity-50 ${n?`border border-cyan-400/60 bg-cyan-900/60 text-cyan-300 opacity-100`:`border border-cyan-500/30 bg-cyan-950/30 text-cyan-400 opacity-0 shadow-cyan-900/20 group-hover:opacity-100 hover:border-cyan-400/50 hover:bg-cyan-900/50 hover:text-cyan-300`}`,children:t?(0,H.jsx)(`span`,{className:`animate-pulse`,children:o(`graph:processes.loading`)}):n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Er,{className:`h-3.5 w-3.5`}),o(`graph:processes.viewing`)]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Er,{className:`h-3.5 w-3.5`}),o(`graph:processes.view`)]})})]})},ek=()=>{let{t:e}=f([`chat`,`common`]),{isRightPanelOpen:t,setRightPanelOpen:n,graph:r,graphMode:i,addCodeReference:a,chatMessages:o,isChatLoading:s,currentToolCalls:c,agentError:l,isAgentReady:u,isAgentInitializing:d,sendChatMessage:p,stopChatResponse:m,clearChat:h}=dr(),[g,_]=(0,P.useState)(``),[v,y]=(0,P.useState)(`chat`),b=(0,P.useRef)(null),{scrollContainerRef:x,messagesContainerRef:S,isAtBottom:C,scrollToBottom:w}=Qd(o,s),T=(0,P.useCallback)(e=>null,[]),E=(0,P.useCallback)(e=>{if(!r)return;let t=e.replace(/\\/g,`/`).replace(/^\.?\//,``);return r.nodes.find(e=>e.label===`File`&&e.properties.filePath.replace(/\\/g,`/`).replace(/^\.?\//,``)===t)?.id},[r]),D=(0,P.useCallback)(e=>{let t=e.trim();if(!t)return;let n=t,r,i,o=t.match(/^(.*):(\d+)(?:[-–](\d+))?$/);o&&(n=o[1].trim(),r=parseInt(o[2],10),i=parseInt(o[3]||o[2],10));let s=T(n);if(!s)return;let c=E(s);a({filePath:s,startLine:r?Math.max(0,r-1):void 0,endLine:i?Math.max(0,i-1):r?Math.max(0,r-1):void 0,nodeId:c,label:`File`,name:s.split(`/`).pop()??s,source:`ai`})},[a,E,T]),O=(0,P.useCallback)(e=>{let t=e.trim();if(!t||!r)return;let n=t.match(/^(Class|Function|Method|Interface|File|Folder|Variable|Enum|Type|CodeElement):(.+)$/);if(!n)return;let[,i,o]=n,s=o.trim(),c=r.nodes.find(e=>e.label===i&&e.properties.name===s);if(!c){console.warn(`Node not found: ${i}:${s}`);return}if(c.properties.filePath){let e=T(c.properties.filePath);e&&a({filePath:e,startLine:c.properties.startLine?c.properties.startLine-1:void 0,endLine:c.properties.endLine?c.properties.endLine-1:void 0,nodeId:c.id,label:c.label,name:c.properties.name,source:`ai`})}},[r,T,a]),k=(0,P.useCallback)(e=>{if(e.startsWith(`code-ref:`)){let t=decodeURIComponent(e.slice(9));D(t)}else if(e.startsWith(`node-ref:`)){let t=decodeURIComponent(e.slice(9));O(t)}},[D,O]),A=(0,P.useCallback)(()=>{let e=b.current;if(!e)return;e.style.height=`auto`;let t=Math.min(e.scrollHeight,160);e.style.height=`${t}px`,e.style.overflowY=e.scrollHeight>160?`auto`:`hidden`},[]);(0,P.useEffect)(()=>{A()},[g,A]);let j=async()=>{if(!g.trim())return;let e=g.trim();_(``),b.current&&(b.current.style.height=`36px`,b.current.style.overflowY=`hidden`),await p(e)},M=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),j())},N=[e(`chat:suggestions.architecture`),e(`chat:suggestions.whatDoes`),e(`chat:suggestions.importantFiles`),e(`chat:suggestions.apiHandlers`)];return t?(0,H.jsxs)(`aside`,{className:`relative z-30 flex w-[40%] max-w-[600px] min-w-[400px] flex-shrink-0 animate-slide-in flex-col border-l border-border-subtle bg-deep`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border-subtle bg-surface px-4 py-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsxs)(`button`,{onClick:()=>y(`chat`),className:`flex items-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium transition-colors ${v===`chat`?`bg-accent/15 text-accent`:`text-text-muted hover:bg-hover hover:text-text-primary`}`,children:[(0,H.jsx)(ai,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:e(`chat:tabs.chat`)})]}),(0,H.jsxs)(`button`,{onClick:()=>y(`processes`),className:`flex items-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium transition-colors ${v===`processes`?`bg-accent/15 text-accent`:`text-text-muted hover:bg-hover hover:text-text-primary`}`,children:[(0,H.jsx)(jr,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:e(`chat:tabs.processes`)}),(0,H.jsx)(`span`,{className:`rounded-full bg-gradient-to-r from-violet-500 to-fuchsia-500 px-1.5 py-0.5 text-[10px] font-semibold text-white`,children:e(`chat:newBadge`)})]})]}),(0,H.jsx)(`button`,{onClick:()=>n(!1),className:`rounded p-1.5 text-text-muted transition-colors hover:bg-hover hover:text-text-primary`,title:e(`chat:actions.closePanel`),children:(0,H.jsx)(qr,{className:`h-4 w-4`})})]}),v===`processes`&&(0,H.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:(0,H.jsx)(QO,{})}),v===`chat`&&(0,H.jsxs)(`div`,{className:`relative flex flex-1 flex-col overflow-hidden`,children:[(0,H.jsx)(`div`,{className:`flex items-center gap-2.5 border-b border-border-subtle bg-elevated/50 px-4 py-3`,children:(0,H.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[!u&&(0,H.jsx)(`span`,{className:`rounded-full border border-amber-500/30 bg-amber-500/15 px-2 py-1 text-[11px] text-amber-300`,children:e(`chat:badges.configureAI`)}),d&&(0,H.jsxs)(`span`,{className:`flex items-center gap-1 rounded-full border border-border-subtle bg-surface px-2 py-1 text-[11px] text-text-muted`,children:[(0,H.jsx)(Vr,{className:`h-3 w-3 animate-spin`}),` `,e(`chat:badges.connecting`)]})]})}),i===`chatOnly`&&(0,H.jsx)(`div`,{className:`border-b border-amber-500/20 bg-amber-500/10 px-4 py-2 text-[11px] text-amber-200/90`,children:e(`chat:chatOnly.banner`)}),l&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-rose-500/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-100`,children:[(0,H.jsx)(fi,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{children:l})]}),(0,H.jsx)(`div`,{ref:x,className:`scrollbar-thin flex-1 overflow-y-auto p-4`,children:o.length===0?(0,H.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center px-4 text-center`,children:[(0,H.jsx)(`div`,{className:`mb-4 flex h-14 w-14 items-center justify-center rounded-xl bg-gradient-to-br from-accent to-node-interface text-2xl shadow-glow`,children:`🧠`}),(0,H.jsx)(`h3`,{className:`mb-2 text-base font-medium`,children:e(`chat:empty.title`)}),(0,H.jsx)(`p`,{className:`mb-5 text-sm leading-relaxed text-text-secondary`,children:e(`chat:empty.description`)}),(0,H.jsx)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:N.map(e=>(0,H.jsx)(`button`,{onClick:()=>_(e),className:`rounded-full border border-border-subtle bg-elevated px-3 py-1.5 text-xs text-text-secondary transition-colors hover:border-accent hover:text-text-primary`,children:e},e))})]}):(0,H.jsx)(`div`,{ref:S,className:`flex flex-col gap-6`,children:o.map(t=>(0,H.jsxs)(`div`,{className:`animate-fade-in`,children:[t.role===`user`&&(0,H.jsxs)(`div`,{className:`mb-4`,children:[(0,H.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,H.jsx)(mi,{className:`h-4 w-4 text-text-muted`}),(0,H.jsx)(`span`,{className:`text-xs font-medium tracking-wide text-text-muted uppercase`,children:e(`chat:roles.you`)})]}),(0,H.jsx)(`div`,{className:`pl-6 text-sm text-text-primary`,children:t.content})]}),t.role===`assistant`&&(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,H.jsx)(ai,{className:`h-4 w-4 text-accent`}),(0,H.jsx)(`span`,{className:`text-xs font-medium tracking-wide text-text-muted uppercase`,children:e(`chat:roles.assistant`)}),s&&t===o[o.length-1]&&(0,H.jsx)(Vr,{className:`h-3 w-3 animate-spin text-accent`})]}),(0,H.jsx)(`div`,{className:`chat-prose pl-6`,children:t.steps&&t.steps.length>0?(0,H.jsx)(`div`,{className:`space-y-4`,children:t.steps.map((e,n)=>(0,H.jsxs)(`div`,{children:[e.type===`reasoning`&&e.content&&(0,H.jsx)(`div`,{className:`mb-3 border-l-2 border-text-muted/30 pl-3 text-sm text-text-secondary italic`,children:(0,H.jsx)(XO,{content:e.content,onLinkClick:k})}),e.type===`tool_call`&&e.toolCall&&(0,H.jsx)(`div`,{className:`mb-3`,children:(0,H.jsx)(nf,{toolCall:e.toolCall,defaultExpanded:!1})}),e.type===`content`&&e.content&&(0,H.jsx)(XO,{content:e.content,onLinkClick:k,showCopyButton:n===t.steps.length-1})]},e.id))}):(0,H.jsx)(XO,{content:t.content,onLinkClick:k,toolCalls:t.toolCalls,showCopyButton:!0})})]})]},t.id))})}),(0,H.jsxs)(`button`,{"aria-label":e(`chat:actions.scrollBottom`),onClick:()=>w(),className:`absolute bottom-20 left-1/2 z-10 -translate-x-1/2 rounded-full border border-border-subtle bg-elevated px-3 py-1.5 text-xs text-text-secondary shadow-lg transition-all duration-200 hover:border-accent hover:text-accent ${!C&&o.length>0?`translate-y-0 opacity-100`:`pointer-events-none translate-y-2 opacity-0`}`,children:[(0,H.jsx)(fr,{className:`mr-1 inline h-3.5 w-3.5`}),e(`chat:actions.scrollBottom`)]}),(0,H.jsxs)(`div`,{className:`border-t border-border-subtle bg-surface p-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-end gap-2 rounded-xl border border-border-subtle bg-elevated px-3 py-2 transition-all focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20`,children:[(0,H.jsx)(`textarea`,{ref:b,value:g,onChange:e=>_(e.target.value),onKeyDown:M,placeholder:e(`chat:input.placeholder`),rows:1,className:`scrollbar-thin min-h-[36px] flex-1 resize-none border-none bg-transparent text-sm text-text-primary outline-none placeholder:text-text-muted`,style:{height:`36px`,overflowY:`hidden`}}),(0,H.jsx)(`button`,{onClick:h,className:`px-2 py-1 text-xs text-text-muted transition-colors hover:text-text-primary`,title:e(`chat:actions.clearChat`),children:e(`common:actions.clear`)}),s?(0,H.jsx)(`button`,{onClick:m,className:`flex h-9 w-9 items-center justify-center rounded-md bg-red-500/80 text-white transition-all hover:bg-red-500`,title:e(`chat:actions.stopResponse`),children:(0,H.jsx)(oi,{className:`h-3.5 w-3.5 fill-current`})}):(0,H.jsx)(`button`,{onClick:j,disabled:!g.trim()||d,className:`flex h-9 w-9 items-center justify-center rounded-md bg-accent text-white transition-all hover:bg-accent-dim disabled:cursor-not-allowed disabled:opacity-50`,children:(0,H.jsx)(ei,{className:`h-3.5 w-3.5`})})]}),!u&&!d&&(0,H.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-xs text-amber-200`,children:[(0,H.jsx)(fi,{className:`h-3.5 w-3.5`}),(0,H.jsx)(`span`,{children:ye()?e(`chat:input.initializing`):e(`chat:input.configureProvider`)})]})]})]})]}):null},tk=({title:e,description:t,apiKey:n,model:r,children:i})=>{let{t:a}=f(`settings`);return(0,H.jsxs)(`div`,{className:`animate-fade-in space-y-4`,children:[(0,H.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-text-primary`,children:e}),t?(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:t}):null]})}),n&&(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-text-secondary`,children:[(0,H.jsx)(Ir,{className:`h-4 w-4`}),a(`apiKey`)]}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`input`,{type:n.isVisible?`text`:`password`,value:n.value,onChange:e=>n.onChange(e.target.value),placeholder:n.placeholder,className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 pr-12 text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,H.jsx)(`button`,{type:`button`,onClick:n.onToggleVisibility,className:`absolute top-1/2 right-3 -translate-y-1/2 p-1 text-text-muted transition-colors hover:text-text-primary`,children:n.isVisible?(0,H.jsx)(Tr,{className:`h-4 w-4`}):(0,H.jsx)(Er,{className:`h-4 w-4`})})]}),n.helperText&&(0,H.jsxs)(`p`,{className:`text-xs text-text-muted`,children:[n.helperText,` `,n.helperLink?(0,H.jsx)(`a`,{href:n.helperLink,target:`_blank`,rel:`noopener noreferrer`,className:`text-accent hover:underline`,children:n.helperLinkLabel??a(`learnMore`)}):null]})]}),r&&(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{className:`text-sm font-medium text-text-secondary`,children:r.label??a(`model`)}),(0,H.jsx)(`input`,{type:`text`,value:r.value,onChange:e=>r.onChange(e.target.value),placeholder:r.placeholder,className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 font-mono text-sm text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`}),r.helperText?(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:r.helperText}):null]}),i]})},nk=({value:e,onChange:t,models:n,isLoading:r,onLoadModels:i})=>{let{t:a}=f(`settings`),[o,s]=(0,P.useState)(!1),[c,l]=(0,P.useState)(``),u=(0,P.useRef)(null),d=(0,P.useRef)(null),p=(0,P.useMemo)(()=>{if(!c.trim())return n;let e=c.toLowerCase();return n.filter(t=>t.id.toLowerCase().includes(e)||t.name.toLowerCase().includes(e))},[n,c]),m=(0,P.useMemo)(()=>{if(!e)return``;let t=n.find(t=>t.id===e);return t?t.name:e},[e,n]);(0,P.useEffect)(()=>{let e=e=>{d.current&&!d.current.contains(e.target)&&(s(!1),l(``))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]);let h=()=>{s(!0),n.length===0&&!r&&i(),setTimeout(()=>u.current?.focus(),10)},g=e=>{t(e),s(!1),l(``)};return(0,H.jsxs)(`div`,{ref:d,className:`relative`,children:[(0,H.jsxs)(`div`,{onClick:h,className:`flex w-full cursor-pointer items-center gap-2 rounded-xl border bg-elevated px-4 py-3 transition-all ${o?`border-accent ring-2 ring-accent/20`:`border-border-subtle hover:border-accent/50`}`,children:[o?(0,H.jsx)(`input`,{ref:u,type:`text`,value:c,onChange:e=>{let r=e.target.value;l(r),r&&n.length===0&&t(r)},onKeyDown:e=>{if(e.key===`Enter`&&c){let e=p.find(e=>e.id.toLowerCase()===c.toLowerCase());e?g(e.id):p.length===1?g(p[0].id):(t(c),s(!1),l(``))}else e.key===`Escape`&&(s(!1),l(``))},placeholder:a(`searchModelPlaceholder`),className:`flex-1 bg-transparent font-mono text-sm text-text-primary outline-none placeholder:text-text-muted`,onClick:e=>e.stopPropagation()}):(0,H.jsx)(`span`,{className:`flex-1 truncate font-mono text-sm ${e?`text-text-primary`:`text-text-muted`}`,children:m||a(`selectModelPlaceholder`)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[r&&(0,H.jsx)(Vr,{className:`h-4 w-4 animate-spin text-text-muted`}),(0,H.jsx)(yr,{className:`h-4 w-4 text-text-muted transition-transform ${o?`rotate-180`:``}`})]})]}),o&&(0,H.jsx)(`div`,{className:`absolute z-50 mt-1 w-full overflow-hidden rounded-xl border border-border-subtle bg-elevated shadow-xl`,children:r?(0,H.jsxs)(`div`,{className:`flex items-center justify-center gap-2 px-4 py-6 text-center text-sm text-text-muted`,children:[(0,H.jsx)(Vr,{className:`h-4 w-4 animate-spin`}),a(`loadingModels`)]}):p.length===0?(0,H.jsx)(`div`,{className:`px-4 py-4 text-center`,children:n.length===0?(0,H.jsxs)(`div`,{className:`text-sm text-text-muted`,children:[(0,H.jsx)($r,{className:`mx-auto mb-2 h-5 w-5 opacity-50`}),(0,H.jsx)(`p`,{children:a(`customModelHint`)}),(0,H.jsx)(`p`,{className:`mt-1 text-xs`,children:a(`customModelExample`)})]}):(0,H.jsxs)(`div`,{className:`text-sm text-text-muted`,children:[(0,H.jsx)(`p`,{children:a(`noModelsMatch`,{searchTerm:c})}),(0,H.jsx)(`p`,{className:`mt-1 text-xs`,children:a(`pressEnterCustom`)})]})}):(0,H.jsxs)(`div`,{className:`max-h-64 overflow-y-auto`,children:[p.slice(0,50).map(t=>(0,H.jsxs)(`button`,{onClick:()=>g(t.id),className:`flex w-full flex-col px-4 py-2.5 text-left transition-colors hover:bg-hover ${t.id===e?`bg-accent/10`:``}`,children:[(0,H.jsx)(`span`,{className:`truncate text-sm text-text-primary`,children:t.name}),(0,H.jsx)(`span`,{className:`truncate font-mono text-xs text-text-muted`,children:t.id})]},t.id)),p.length>50&&(0,H.jsx)(`div`,{className:`border-t border-border-subtle px-4 py-2 text-center text-xs text-text-muted`,children:a(`moreModels`,{count:p.length-50})})]})})]})},rk=async e=>{try{let t=await fetch(`${e}/api/tags`,{method:`GET`,headers:{"Content-Type":`application/json`}});return t.ok?{ok:!0,error:null}:t.status===0||t.status===404?{ok:!1,error:"Cannot connect to Ollama. Make sure it's running with `ollama serve`"}:{ok:!1,error:`Ollama API error: ${t.status}`}}catch{return{ok:!1,error:"Cannot connect to Ollama. Make sure it's running with `ollama serve`"}}},ik=({isOpen:e,onClose:t,onSettingsSaved:n,backendUrl:r,isBackendConnected:i,onBackendUrlChange:a})=>{let{t:o}=f([`common`,`settings`]),[s,c]=(0,P.useState)(he),[l,u]=(0,P.useState)({}),[d,p]=(0,P.useState)(`idle`),m=(0,P.useRef)(void 0),[h,g]=(0,P.useState)(null),[_,v]=(0,P.useState)(!1),[y,b]=(0,P.useState)([]),[x,S]=(0,P.useState)(!1);(0,P.useEffect)(()=>()=>{m.current&&clearTimeout(m.current)},[]),(0,P.useEffect)(()=>{e&&(c(he()),p(`idle`),g(null))},[e]);let C=(0,P.useCallback)(async e=>{v(!0),g(null);let{error:t}=await rk(e);v(!1),g(t)},[]),w=(0,P.useCallback)(async()=>{S(!0);let e=await Te();b(e),S(!1)},[]);(0,P.useEffect)(()=>{if(s.activeProvider===`ollama`){let e=s.ollama?.baseUrl??`http://localhost:11434`,t=setTimeout(()=>{C(e)},300);return()=>clearTimeout(t)}},[s.ollama?.baseUrl,s.activeProvider,C]);let T=e=>{c(t=>({...t,activeProvider:e}))},E=()=>{try{ge(s),p(`saved`),n?.(),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>p(`idle`),2e3)}catch{p(`error`)}},D=e=>{u(t=>({...t,[e]:!t[e]}))};return e?(0,H.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,H.jsx)(`div`,{className:`absolute inset-0 bg-black/60 backdrop-blur-sm`,onClick:t}),(0,H.jsxs)(`div`,{className:`relative mx-4 flex max-h-[90vh] w-full max-w-lg flex-col overflow-hidden rounded-2xl border border-border-subtle bg-surface shadow-2xl`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border-subtle bg-elevated/50 px-6 py-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-xl bg-accent/20`,children:(0,H.jsx)(_r,{className:`h-5 w-5 text-accent`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{className:`text-lg font-semibold text-text-primary`,children:o(`settings:title`)}),(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:o(`settings:subtitle`)})]})]}),(0,H.jsx)(`button`,{onClick:t,className:`rounded-lg p-2 text-text-muted transition-colors hover:bg-hover hover:text-text-primary`,children:(0,H.jsx)(gi,{className:`h-5 w-5`})})]}),(0,H.jsxs)(`div`,{className:`flex-1 space-y-6 overflow-y-auto p-6`,children:[r!==void 0&&a&&(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`label`,{className:`block text-sm font-medium text-text-secondary`,children:o(`settings:localServer`)}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,H.jsx)(ti,{className:`h-4 w-4 text-text-muted`}),(0,H.jsx)(`span`,{className:`text-sm text-text-secondary`,children:o(`settings:backendUrl`)}),(0,H.jsx)(`span`,{className:`h-2 w-2 rounded-full ${i?`bg-green-400`:`bg-red-400`}`}),(0,H.jsx)(`span`,{className:`text-xs text-text-muted`,children:o(i?`settings:connected`:`settings:notConnected`)})]}),(0,H.jsx)(`input`,{type:`url`,value:r,onChange:e=>a(e.target.value),placeholder:`http://localhost:4747`,className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 font-mono text-sm text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:o(`settings:runServeHint`)})]})]}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`label`,{className:`block text-sm font-medium text-text-secondary`,children:o(`settings:provider`)}),(0,H.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-3`,children:[`openai`,`gemini`,`anthropic`,`azure-openai`,`ollama`,`openrouter`,`minimax`,`glm`,`deepseek`].map(e=>(0,H.jsxs)(`button`,{onClick:()=>T(e),className:`flex items-center gap-3 rounded-xl border-2 p-4 transition-all ${s.activeProvider===e?`border-accent bg-accent/10 text-text-primary`:`border-border-subtle bg-elevated text-text-secondary hover:border-accent/50`} `,children:[(0,H.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-lg text-lg ${s.activeProvider===e?`bg-accent/20`:`bg-surface`} `,children:e===`openai`?`🤖`:e===`gemini`?`💎`:e===`anthropic`?`🧠`:e===`ollama`?`🦙`:e===`openrouter`?`🌐`:e===`minimax`?`⚡`:e===`glm`?`🔮`:e===`deepseek`?`🐋`:`☁️`}),(0,H.jsx)(`span`,{className:`font-medium`,children:Ce(e)})]},e))})]}),(0,H.jsx)(`div`,{className:`rounded-xl border border-amber-500/30 bg-amber-500/10 p-3 text-xs text-amber-200`,children:o(`settings:apiKeySession`)}),s.activeProvider===`openai`&&(0,H.jsx)(tk,{title:`OpenAI`,apiKey:{value:s.openai?.apiKey??``,placeholder:o(`settings:providers.openai.apiKeyPlaceholder`),helperText:o(`settings:providers.openai.helperText`),helperLink:`https://platform.openai.com/api-keys`,helperLinkLabel:o(`settings:providers.openai.helperLinkLabel`),isVisible:!!l.openai,onChange:e=>c(t=>({...t,openai:{...t.openai,apiKey:e}})),onToggleVisibility:()=>D(`openai`)},model:{value:s.openai?.model??`gpt-5.2-chat`,placeholder:o(`settings:providers.openai.modelPlaceholder`),onChange:e=>c(t=>({...t,openai:{...t.openai,model:e}}))},children:(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-text-secondary`,children:[(0,H.jsx)(ti,{className:`h-4 w-4`}),o(`settings:baseUrl`),` `,(0,H.jsxs)(`span`,{className:`font-normal text-text-muted`,children:[`(`,o(`settings:optional`),`)`]})]}),(0,H.jsx)(`input`,{type:`url`,value:s.openai?.baseUrl??``,onChange:e=>c(t=>({...t,openai:{...t.openai,baseUrl:e.target.value}})),placeholder:o(`settings:providers.openai.baseUrlPlaceholder`),className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:o(`settings:providers.openai.baseUrlHint`)})]})}),s.activeProvider===`gemini`&&(0,H.jsx)(tk,{title:`Google Gemini`,apiKey:{value:s.gemini?.apiKey??``,placeholder:o(`settings:providers.gemini.apiKeyPlaceholder`),helperText:o(`settings:providers.gemini.helperText`),helperLink:`https://aistudio.google.com/app/apikey`,helperLinkLabel:o(`settings:providers.gemini.helperLinkLabel`),isVisible:!!l.gemini,onChange:e=>c(t=>({...t,gemini:{...t.gemini,apiKey:e}})),onToggleVisibility:()=>D(`gemini`)},model:{value:s.gemini?.model??`gemini-2.0-flash`,placeholder:o(`settings:providers.gemini.modelPlaceholder`),onChange:e=>c(t=>({...t,gemini:{...t.gemini,model:e}}))}}),s.activeProvider===`anthropic`&&(0,H.jsx)(tk,{title:`Anthropic`,apiKey:{value:s.anthropic?.apiKey??``,placeholder:o(`settings:providers.anthropic.apiKeyPlaceholder`),helperText:o(`settings:providers.anthropic.helperText`),helperLink:`https://console.anthropic.com/settings/keys`,helperLinkLabel:o(`settings:providers.anthropic.helperLinkLabel`),isVisible:!!l.anthropic,onChange:e=>c(t=>({...t,anthropic:{...t.anthropic,apiKey:e}})),onToggleVisibility:()=>D(`anthropic`)},model:{value:s.anthropic?.model??`claude-sonnet-4-20250514`,placeholder:o(`settings:providers.anthropic.modelPlaceholder`),onChange:e=>c(t=>({...t,anthropic:{...t.anthropic,model:e}}))}}),s.activeProvider===`azure-openai`&&(0,H.jsxs)(`div`,{className:`animate-fade-in space-y-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-text-secondary`,children:[(0,H.jsx)(Ir,{className:`h-4 w-4`}),o(`settings:apiKey`)]}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`input`,{type:l.azure?`text`:`password`,value:s.azureOpenAI?.apiKey??``,onChange:e=>c(t=>({...t,azureOpenAI:{...t.azureOpenAI,apiKey:e.target.value}})),placeholder:o(`settings:providers.azure.apiKeyPlaceholder`),className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 pr-12 text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>D(`azure`),className:`absolute top-1/2 right-3 -translate-y-1/2 p-1 text-text-muted transition-colors hover:text-text-primary`,children:l.azure?(0,H.jsx)(Tr,{className:`h-4 w-4`}):(0,H.jsx)(Er,{className:`h-4 w-4`})})]})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-text-secondary`,children:[(0,H.jsx)(ti,{className:`h-4 w-4`}),o(`settings:endpoint`)]}),(0,H.jsx)(`input`,{type:`url`,value:s.azureOpenAI?.endpoint??``,onChange:e=>c(t=>({...t,azureOpenAI:{...t.azureOpenAI,endpoint:e.target.value}})),placeholder:`https://your-resource.openai.azure.com`,className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{className:`text-sm font-medium text-text-secondary`,children:o(`settings:deploymentName`)}),(0,H.jsx)(`input`,{type:`text`,value:s.azureOpenAI?.deploymentName??``,onChange:e=>c(t=>({...t,azureOpenAI:{...t.azureOpenAI,deploymentName:e.target.value}})),placeholder:o(`settings:providers.azure.deploymentNamePlaceholder`),className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{className:`text-sm font-medium text-text-secondary`,children:o(`settings:model`)}),(0,H.jsx)(`input`,{type:`text`,value:s.azureOpenAI?.model??`gpt-4o`,onChange:e=>c(t=>({...t,azureOpenAI:{...t.azureOpenAI,model:e.target.value}})),placeholder:`gpt-4o`,className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{className:`text-sm font-medium text-text-secondary`,children:o(`settings:apiVersion`)}),(0,H.jsx)(`input`,{type:`text`,value:s.azureOpenAI?.apiVersion??`2024-08-01-preview`,onChange:e=>c(t=>({...t,azureOpenAI:{...t.azureOpenAI,apiVersion:e.target.value}})),placeholder:`2024-08-01-preview`,className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`})]})]}),(0,H.jsxs)(`p`,{className:`text-xs text-text-muted`,children:[o(`settings:azureHint`),` `,(0,H.jsx)(`a`,{href:`https://portal.azure.com/#view/Microsoft_Azure_ProjectOxford/CognitiveServicesHub/~/OpenAI`,target:`_blank`,rel:`noopener noreferrer`,className:`text-accent hover:underline`,children:o(`settings:azurePortal`)})]})]}),s.activeProvider===`ollama`&&(0,H.jsxs)(`div`,{className:`animate-fade-in space-y-4`,children:[(0,H.jsxs)(`div`,{className:`rounded-xl border border-amber-500/30 bg-amber-500/10 p-3`,children:[(0,H.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-300`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:o(`settings:providers.ollama.quickStart`)}),` `,o(`settings:providers.ollama.installFrom`),` `,(0,H.jsx)(`a`,{href:`https://ollama.ai`,target:`_blank`,rel:`noopener noreferrer`,className:`text-accent hover:underline`,children:`ollama.ai`}),o(`settings:providers.ollama.thenRun`)]}),(0,H.jsx)(`code`,{className:`mt-2 block rounded-lg bg-black/30 px-3 py-2 font-mono text-sm text-amber-200`,children:`ollama serve`})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-text-secondary`,children:[(0,H.jsx)(ti,{className:`h-4 w-4`}),o(`settings:baseUrl`)]}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(`input`,{type:`url`,value:s.ollama?.baseUrl??`http://localhost:11434`,onChange:e=>c(t=>({...t,ollama:{...t.ollama,baseUrl:e.target.value}})),placeholder:`http://localhost:11434`,className:`flex-1 rounded-xl border border-border-subtle bg-elevated px-4 py-3 font-mono text-sm text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>C(s.ollama?.baseUrl??`http://localhost:11434`),disabled:_,className:`rounded-xl border border-border-subtle bg-elevated px-3 py-3 text-text-secondary transition-colors hover:border-accent/50 hover:text-text-primary disabled:opacity-50`,title:o(`settings:checkConnection`),children:(0,H.jsx)(Xr,{className:`h-4 w-4 ${_?`animate-spin`:``}`})})]}),(0,H.jsxs)(`p`,{className:`text-xs text-text-muted`,children:[o(`settings:defaultPort`),` `,(0,H.jsx)(`code`,{className:`rounded bg-elevated px-1 py-0.5`,children:`11434`}),`.`]})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{className:`text-sm font-medium text-text-secondary`,children:o(`settings:model`)}),h&&!_&&(0,H.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 p-2`,children:(0,H.jsxs)(`p`,{className:`flex items-center gap-1 text-xs text-red-400`,children:[(0,H.jsx)(Sr,{className:`h-3 w-3`}),h]})}),(0,H.jsx)(`input`,{type:`text`,value:s.ollama?.model??``,onChange:e=>c(t=>({...t,ollama:{...t.ollama,model:e.target.value}})),placeholder:o(`settings:providers.ollama.modelPlaceholder`),className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 font-mono text-sm text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,H.jsxs)(`p`,{className:`text-xs text-text-muted`,children:[o(`settings:pullModel`),` `,(0,H.jsx)(`code`,{className:`rounded bg-elevated px-1 py-0.5`,children:`ollama pull llama3.2`})]})]})]}),s.activeProvider===`openrouter`&&(0,H.jsx)(tk,{title:`OpenRouter`,apiKey:{value:s.openrouter?.apiKey??``,placeholder:o(`settings:providers.openrouter.apiKeyPlaceholder`),helperText:o(`settings:providers.openrouter.helperText`),helperLink:`https://openrouter.ai/keys`,helperLinkLabel:o(`settings:providers.openrouter.helperLinkLabel`),isVisible:!!l.openrouter,onChange:e=>c(t=>({...t,openrouter:{...t.openrouter,apiKey:e}})),onToggleVisibility:()=>D(`openrouter`)},children:(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{className:`text-sm font-medium text-text-secondary`,children:o(`settings:model`)}),(0,H.jsx)(nk,{value:s.openrouter?.model??``,onChange:e=>c(t=>({...t,openrouter:{...t.openrouter,model:e}})),models:y,isLoading:x,onLoadModels:w}),(0,H.jsxs)(`p`,{className:`text-xs text-text-muted`,children:[o(`settings:browseModels`),` `,(0,H.jsx)(`a`,{href:`https://openrouter.ai/models`,target:`_blank`,rel:`noopener noreferrer`,className:`text-accent hover:underline`,children:o(`settings:openRouterModels`)})]})]})}),s.activeProvider===`minimax`&&(0,H.jsx)(tk,{title:`MiniMax`,apiKey:{value:s.minimax?.apiKey??``,placeholder:o(`settings:providers.minimax.apiKeyPlaceholder`),helperText:o(`settings:providers.minimax.helperText`),helperLink:`https://platform.minimax.io`,helperLinkLabel:o(`settings:providers.minimax.helperLinkLabel`),isVisible:!!l.minimax,onChange:e=>c(t=>({...t,minimax:{...t.minimax,apiKey:e}})),onToggleVisibility:()=>D(`minimax`)},model:{value:s.minimax?.model??`MiniMax-M2.5`,placeholder:o(`settings:providers.minimax.modelPlaceholder`),onChange:e=>c(t=>({...t,minimax:{...t.minimax,model:e}})),helperText:o(`settings:providers.minimax.helperModel`)}}),s.activeProvider===`deepseek`&&(0,H.jsx)(tk,{title:`DeepSeek`,apiKey:{value:s.deepseek?.apiKey??``,placeholder:`Enter your DeepSeek API key`,helperText:`Get your API key from`,helperLink:`https://platform.deepseek.com/api_keys`,helperLinkLabel:`DeepSeek Platform`,isVisible:!!l.deepseek,onChange:e=>c(t=>({...t,deepseek:{...t.deepseek,apiKey:e}})),onToggleVisibility:()=>D(`deepseek`)},model:{value:s.deepseek?.model??`deepseek-v4-flash`,placeholder:`e.g., deepseek-v4-flash, deepseek-v4-pro, deepseek-chat`,onChange:e=>c(t=>({...t,deepseek:{...t.deepseek,model:e}})),helperText:`deepseek-v4-flash (default), deepseek-v4-pro, deepseek-chat (V3), deepseek-reasoner (R1)`},children:(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:`Compatible via OpenAI API format. The deepseek-reasoner model uses thinking mode and requires round-tripping reasoning content.`})}),s.activeProvider===`glm`&&(0,H.jsxs)(`div`,{className:`animate-fade-in space-y-4`,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-text-secondary`,children:[(0,H.jsx)(Ir,{className:`h-4 w-4`}),o(`settings:apiKey`)]}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`input`,{type:l.glm?`text`:`password`,value:s.glm?.apiKey??``,onChange:e=>c(t=>({...t,glm:{...t.glm,apiKey:e.target.value}})),placeholder:o(`settings:providers.glm.apiKeyPlaceholder`),className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 pr-12 text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>D(`glm`),className:`absolute top-1/2 right-3 -translate-y-1/2 p-1 text-text-muted transition-colors hover:text-text-primary`,children:l.glm?(0,H.jsx)(Tr,{className:`h-4 w-4`}):(0,H.jsx)(Er,{className:`h-4 w-4`})})]}),(0,H.jsxs)(`p`,{className:`text-xs text-text-muted`,children:[o(`settings:providers.openai.helperText`),` `,(0,H.jsx)(`a`,{href:`https://docs.z.ai`,target:`_blank`,rel:`noopener noreferrer`,className:`text-accent hover:underline`,children:o(`settings:zaiPlatform`)})]})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{className:`text-sm font-medium text-text-secondary`,children:o(`settings:model`)}),(0,H.jsx)(`select`,{value:s.glm?.model??`GLM-5`,onChange:e=>c(t=>({...t,glm:{...t.glm,model:e.target.value}})),className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 font-mono text-sm text-text-primary transition-all outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,children:we(`glm`).map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`label`,{className:`text-sm font-medium text-text-secondary`,children:o(`settings:baseUrl`)}),(0,H.jsx)(`input`,{type:`text`,value:s.glm?.baseUrl??`https://api.z.ai/api/coding/paas/v4`,onChange:e=>c(t=>({...t,glm:{...t.glm,baseUrl:e.target.value}})),placeholder:`https://api.z.ai/api/coding/paas/v4`,className:`w-full rounded-xl border border-border-subtle bg-elevated px-4 py-3 font-mono text-sm text-text-primary transition-all outline-none placeholder:text-text-muted focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,H.jsx)(`p`,{className:`text-xs text-text-muted`,children:o(`settings:glmCodingApi`)})]})]}),(0,H.jsx)(`div`,{className:`rounded-xl border border-border-subtle bg-elevated/50 p-4`,children:(0,H.jsxs)(`div`,{className:`flex gap-3`,children:[(0,H.jsx)(`div`,{className:`flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg bg-green-500/20 text-green-400`,children:`🔒`}),(0,H.jsxs)(`div`,{className:`text-xs leading-relaxed text-text-muted`,children:[(0,H.jsx)(`span`,{className:`font-medium text-text-secondary`,children:o(`settings:privacyLabel`)}),` `,o(`settings:privacyFull`)]})]})})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between border-t border-border-subtle bg-elevated/30 px-6 py-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[d===`saved`&&(0,H.jsxs)(`span`,{className:`flex animate-fade-in items-center gap-1.5 text-green-400`,children:[(0,H.jsx)(vr,{className:`h-4 w-4`}),o(`settings:settingsSaved`)]}),d===`error`&&(0,H.jsxs)(`span`,{className:`flex animate-fade-in items-center gap-1.5 text-red-400`,children:[(0,H.jsx)(Sr,{className:`h-4 w-4`}),o(`settings:failedToSave`)]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`button`,{onClick:t,className:`px-4 py-2 text-sm text-text-secondary transition-colors hover:text-text-primary`,children:o(`common:actions.cancel`)}),(0,H.jsx)(`button`,{onClick:E,className:`rounded-lg bg-accent px-5 py-2 text-sm font-medium text-white transition-colors hover:bg-accent-dim`,children:o(`settings:saveSettings`)})]})]})]})]}):null},ak=()=>{let{graph:e,graphMode:t,progress:n}=dr(),{t:r}=f([`common`,`graph`]),i=e?.nodes.length??0,a=e?.relationships.length??0,o=(0,P.useMemo)(()=>{if(!e)return null;let t=e.nodes.map(e=>e.properties.language).filter(Boolean);if(t.length===0)return null;let n=t.reduce((e,t)=>(e[t]=(e[t]||0)+1,e),{});return Object.entries(n).sort((e,t)=>t[1]-e[1])[0]?.[0]},[e]);return(0,H.jsxs)(`footer`,{className:`flex items-center justify-between border-t border-dashed border-border-subtle bg-deep px-5 py-2 text-[11px] text-text-muted`,children:[(0,H.jsx)(`div`,{className:`flex items-center gap-4`,children:n&&n.phase!==`complete`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`h-1 w-28 overflow-hidden rounded-full bg-elevated`,children:(0,H.jsx)(`div`,{className:`h-full rounded-full bg-gradient-to-r from-accent to-node-interface transition-all duration-300`,style:{width:`${n.percent}%`}})}),(0,H.jsx)(`span`,{children:Di(n.message,r)})]}):(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,"data-testid":`status-ready`,children:[(0,H.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-node-function`}),(0,H.jsx)(`span`,{children:r(`common:progress.ready`)})]})}),(0,H.jsxs)(`a`,{href:`https://github.com/sponsors/abhigyanpatwari`,target:`_blank`,rel:`noopener noreferrer`,className:`group flex cursor-pointer items-center gap-2 rounded-full border border-pink-500/20 bg-pink-500/10 px-3 py-1 transition-all duration-200 hover:scale-[1.02] hover:border-pink-500/40 hover:bg-pink-500/20`,children:[(0,H.jsx)(Pr,{className:`h-3.5 w-3.5 animate-pulse fill-pink-500/40 text-pink-500 transition-all duration-200 group-hover:scale-110 group-hover:fill-pink-500`}),(0,H.jsx)(`span`,{className:`text-[11px] font-medium text-pink-400 transition-colors group-hover:text-pink-300`,children:r(`graph:statusBar.sponsor`)}),(0,H.jsx)(`span`,{className:`hidden text-[10px] text-pink-300/50 italic transition-colors group-hover:text-pink-300/80 md:inline`,children:r(`graph:statusBar.sponsorHint`)})]}),(0,H.jsx)(`div`,{className:`flex items-center gap-3`,"data-testid":`graph-stats`,children:e&&t!==`chatOnly`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{children:r(`common:counts.nodes`,{count:i})}),(0,H.jsx)(`span`,{className:`text-border-default`,children:`•`}),(0,H.jsx)(`span`,{children:r(`common:counts.edges`,{count:a})}),o&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`text-border-default`,children:`•`}),(0,H.jsx)(`span`,{children:o})]})]})})]})},ok=e=>{let t=[],n=new Map,r=e.filter(e=>e.label===`Folder`||e.label===`File`);return r.sort((e,t)=>e.properties.filePath.localeCompare(t.properties.filePath)),r.forEach(e=>{let r=e.properties.filePath.split(`/`).filter(Boolean),i=``,a=t;r.forEach((t,o)=>{i=i?`${i}/${t}`:t;let s=n.get(i);if(!s){let c=o===r.length-1,l=c&&e.label===`File`;s={id:c?e.id:i,name:t,type:l?`file`:`folder`,path:i,children:[],graphNode:c?e:void 0},n.set(i,s),a.push(s)}a=s.children})}),t},sk=({node:e,depth:t,searchQuery:n,onNodeClick:r,expandedPaths:i,toggleExpanded:a,selectedPath:o})=>{let s=i.has(e.path),c=o===e.path,l=e.children.length>0,u=(0,P.useMemo)(()=>{if(!n)return e.children;let t=n.toLowerCase(),r=(e,t)=>e.name.toLowerCase().includes(t)?!0:e.children?.some(e=>r(e,t))??!1;return e.children.filter(e=>r(e,t))},[e.children,n]),d=n&&e.name.toLowerCase().includes(n.toLowerCase());return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`button`,{onClick:()=>{l&&a(e.path),r(e)},className:`relative flex w-full items-center gap-1.5 rounded px-2 py-1 text-left text-sm transition-colors hover:bg-hover ${c?`border-l-2 border-amber-400 bg-amber-500/15 text-amber-300`:`border-l-2 border-transparent text-text-secondary hover:text-text-primary`} ${d?`bg-accent/10`:``} `,style:{paddingLeft:`${t*12+8}px`},children:[l?s?(0,H.jsx)(yr,{className:`h-3.5 w-3.5 shrink-0 text-text-muted`}):(0,H.jsx)(br,{className:`h-3.5 w-3.5 shrink-0 text-text-muted`}):(0,H.jsx)(`span`,{className:`w-3.5`}),e.type===`folder`?s?(0,H.jsx)(Or,{className:`h-4 w-4 shrink-0`,style:{color:qn.Folder}}):(0,H.jsx)(kr,{className:`h-4 w-4 shrink-0`,style:{color:qn.Folder}}):(0,H.jsx)(Dr,{className:`h-4 w-4 shrink-0`,style:{color:qn.File}}),(0,H.jsx)(`span`,{className:`truncate font-mono text-xs`,children:e.name})]}),s&&u.length>0&&(0,H.jsx)(`div`,{children:u.map(e=>(0,H.jsx)(sk,{node:e,depth:t+1,searchQuery:n,onNodeClick:r,expandedPaths:i,toggleExpanded:a,selectedPath:o},e.id))})]})},ck=e=>{switch(e){case`Folder`:return kr;case`File`:return Dr;case`Class`:return hr;case`Function`:return gr;case`Method`:return gr;case`Interface`:return Nr;case`Enum`:return Br;case`Type`:return pi;case`Decorator`:return mr;case`Import`:return Dr;case`Variable`:case`Property`:return hi;case`Const`:return li;default:return hi}},lk=({onFocusNode:e})=>{let{t}=f([`common`,`graph`]),{graph:n,visibleLabels:r,toggleLabelVisibility:i,visibleEdgeTypes:a,toggleEdgeVisibility:o,selectedNode:s,setSelectedNode:c,openCodePanel:l,depthFilter:u,setDepthFilter:d}=dr(),[p,m]=(0,P.useState)(!1),[h,g]=(0,P.useState)(``),[_,v]=(0,P.useState)(new Set),[y,b]=(0,P.useState)(`files`),x=(0,P.useMemo)(()=>n?ok(n.nodes):[],[n]);(0,P.useEffect)(()=>{if(x.length>0&&_.size===0){let e=new Set(x.map(e=>e.path));v(e)}},[x.length]),(0,P.useEffect)(()=>{let e=s?.properties?.filePath;if(!e)return;let t=e.split(`/`).filter(Boolean),n=[],r=``;for(let e=0;e<t.length-1;e++)r=r?`${r}/${t[e]}`:t[e],n.push(r);n.length>0&&v(e=>{let t=new Set(e);return n.forEach(e=>t.add(e)),t})},[s?.id]);let S=(0,P.useCallback)(e=>{v(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),C=(0,P.useCallback)(t=>{if(t.graphNode){let n=s?.id===t.graphNode.id;c(t.graphNode),l(),n||e(t.graphNode.id)}},[c,l,e,s]),w=s?.properties.filePath||null;return p?(0,H.jsxs)(`div`,{className:`flex h-full w-12 flex-col items-center gap-2 border-r border-border-subtle bg-surface py-3`,children:[(0,H.jsx)(`button`,{onClick:()=>m(!1),className:`rounded p-2 text-text-secondary transition-colors hover:bg-hover hover:text-text-primary`,title:t(`graph:fileTree.expandPanel`),children:(0,H.jsx)(Kr,{className:`h-5 w-5`})}),(0,H.jsx)(`div`,{className:`my-1 h-px w-6 bg-border-subtle`}),(0,H.jsx)(`button`,{onClick:()=>{m(!1),b(`files`)},className:`rounded p-2 transition-colors ${y===`files`?`bg-accent/10 text-accent`:`text-text-secondary hover:bg-hover hover:text-text-primary`}`,title:t(`graph:fileTree.fileExplorer`),children:(0,H.jsx)(kr,{className:`h-5 w-5`})}),(0,H.jsx)(`button`,{onClick:()=>{m(!1),b(`filters`)},className:`rounded p-2 transition-colors ${y===`filters`?`bg-accent/10 text-accent`:`text-text-secondary hover:bg-hover hover:text-text-primary`}`,title:t(`graph:fileTree.filters`),children:(0,H.jsx)(Ar,{className:`h-5 w-5`})})]}):(0,H.jsxs)(`div`,{className:`flex h-full w-64 animate-slide-in flex-col border-r border-border-subtle bg-surface`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border-subtle px-3 py-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`button`,{onClick:()=>b(`files`),className:`rounded px-2 py-1 text-xs transition-colors ${y===`files`?`bg-accent/20 text-accent`:`text-text-secondary hover:bg-hover hover:text-text-primary`}`,children:t(`graph:fileTree.explorer`)}),(0,H.jsx)(`button`,{onClick:()=>b(`filters`),className:`rounded px-2 py-1 text-xs transition-colors ${y===`filters`?`bg-accent/20 text-accent`:`text-text-secondary hover:bg-hover hover:text-text-primary`}`,children:t(`graph:fileTree.filters`)})]}),(0,H.jsx)(`button`,{onClick:()=>m(!0),className:`rounded p-1 text-text-muted transition-colors hover:bg-hover hover:text-text-primary`,title:t(`graph:fileTree.collapsePanel`),children:(0,H.jsx)(Gr,{className:`h-4 w-4`})})]}),y===`files`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`border-b border-border-subtle px-3 py-2`,children:(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)($r,{className:`absolute top-1/2 left-2.5 h-3.5 w-3.5 -translate-y-1/2 text-text-muted`}),(0,H.jsx)(`input`,{type:`text`,placeholder:t(`graph:fileTree.searchFiles`),value:h,onChange:e=>g(e.target.value),className:`w-full rounded border border-border-subtle bg-elevated py-1.5 pr-3 pl-8 text-xs text-text-primary placeholder:text-text-muted focus:border-accent focus:outline-none`})]})}),(0,H.jsx)(`div`,{className:`scrollbar-thin flex-1 overflow-y-auto py-2`,children:x.length===0?(0,H.jsx)(`div`,{className:`px-3 py-4 text-center text-xs text-text-muted`,children:t(`graph:fileTree.noFilesLoaded`)}):x.map(e=>(0,H.jsx)(sk,{node:e,depth:0,searchQuery:h,onNodeClick:C,expandedPaths:_,toggleExpanded:S,selectedPath:w},e.id))})]}),y===`filters`&&(0,H.jsxs)(`div`,{className:`scrollbar-thin flex-1 overflow-y-auto p-3`,children:[(0,H.jsxs)(`div`,{className:`mb-3`,children:[(0,H.jsx)(`h3`,{className:`mb-2 text-xs font-medium tracking-wide text-text-secondary uppercase`,children:t(`graph:fileTree.nodeTypes`)}),(0,H.jsx)(`p`,{className:`mb-3 text-[11px] text-text-muted`,children:t(`graph:fileTree.nodeTypesDesc`)})]}),(0,H.jsx)(`div`,{className:`flex flex-col gap-1`,children:Qn.map(e=>{let t=ck(e),n=r.includes(e);return(0,H.jsxs)(`button`,{onClick:()=>i(e),className:`flex items-center gap-2.5 rounded px-2 py-1.5 text-left transition-colors ${n?`bg-elevated text-text-primary`:`text-text-muted hover:bg-hover hover:text-text-secondary`} `,children:[(0,H.jsx)(`div`,{className:`flex h-5 w-5 items-center justify-center rounded ${n?``:`opacity-40`}`,style:{backgroundColor:`${qn[e]}20`},children:(0,H.jsx)(t,{className:`h-3 w-3`,style:{color:qn[e]}})}),(0,H.jsx)(`span`,{className:`flex-1 text-xs`,children:e}),(0,H.jsx)(`div`,{className:`h-2 w-2 rounded-full transition-colors ${n?`bg-accent`:`bg-border-subtle`}`})]},e)})}),(0,H.jsxs)(`div`,{className:`mt-6 border-t border-border-subtle pt-4`,children:[(0,H.jsx)(`h3`,{className:`mb-2 text-xs font-medium tracking-wide text-text-secondary uppercase`,children:t(`graph:fileTree.edgeTypes`)}),(0,H.jsx)(`p`,{className:`mb-3 text-[11px] text-text-muted`,children:t(`graph:fileTree.edgeTypesDesc`)}),(0,H.jsx)(`div`,{className:`flex flex-col gap-1`,children:$n.map(e=>{let t=tr[e],n=a.includes(e);return(0,H.jsxs)(`button`,{onClick:()=>o(e),className:`flex items-center gap-2.5 rounded px-2 py-1.5 text-left transition-colors ${n?`bg-elevated text-text-primary`:`text-text-muted hover:bg-hover hover:text-text-secondary`} `,children:[(0,H.jsx)(`div`,{className:`h-1.5 w-6 rounded-full ${n?``:`opacity-40`}`,style:{backgroundColor:t.color}}),(0,H.jsx)(`span`,{className:`flex-1 text-xs`,children:t.label}),(0,H.jsx)(`div`,{className:`h-2 w-2 rounded-full transition-colors ${n?`bg-accent`:`bg-border-subtle`}`})]},e)})})]}),(0,H.jsxs)(`div`,{className:`mt-6 border-t border-border-subtle pt-4`,children:[(0,H.jsxs)(`h3`,{className:`mb-2 text-xs font-medium tracking-wide text-text-secondary uppercase`,children:[(0,H.jsx)(li,{className:`mr-1.5 inline h-3 w-3`}),t(`graph:fileTree.focusDepth`)]}),(0,H.jsx)(`p`,{className:`mb-3 text-[11px] text-text-muted`,children:t(`graph:fileTree.focusDepthDesc`)}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:[{value:null,label:t(`graph:fileTree.all`)},{value:1,label:t(`graph:fileTree.hops`,{count:1})},{value:2,label:t(`graph:fileTree.hops`,{count:2})},{value:3,label:t(`graph:fileTree.hops`,{count:3})},{value:5,label:t(`graph:fileTree.hops`,{count:5})}].map(({value:e,label:t})=>(0,H.jsx)(`button`,{onClick:()=>d(e),className:`rounded px-2 py-1 text-xs transition-colors ${u===e?`bg-accent text-white`:`bg-elevated text-text-secondary hover:bg-hover hover:text-text-primary`} `,children:t},t))}),u!==null&&!s&&(0,H.jsx)(`p`,{className:`mt-2 text-[10px] text-amber-400`,children:t(`graph:fileTree.selectNodeDepth`)})]}),(0,H.jsxs)(`div`,{className:`mt-6 border-t border-border-subtle pt-4`,children:[(0,H.jsx)(`h3`,{className:`mb-3 text-xs font-medium tracking-wide text-text-secondary uppercase`,children:t(`graph:fileTree.colorLegend`)}),(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:[`Folder`,`File`,`Class`,`Interface`,`Enum`,`Type`,`Function`,`Method`,`Variable`,`Decorator`].map(e=>(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-full`,style:{backgroundColor:qn[e]}}),(0,H.jsx)(`span`,{className:`text-[10px] text-text-muted`,children:e})]},e))})]})]}),n&&(0,H.jsx)(`div`,{className:`border-t border-border-subtle bg-elevated/50 px-3 py-2`,children:(0,H.jsxs)(`div`,{className:`flex items-center justify-between text-[10px] text-text-muted`,children:[(0,H.jsx)(`span`,{children:t(`common:counts.nodes`,{count:n.nodes.length})}),(0,H.jsx)(`span`,{children:t(`common:counts.edges`,{count:n.relationships.length})})]})})]})},uk=e=>e?E(e):`text`,dk={...KO,'pre[class*="language-"]':{...KO[`pre[class*="language-"]`],background:`#0a0a10`,margin:0,padding:`12px 0`,fontSize:`13px`,lineHeight:`1.6`},'code[class*="language-"]':{...KO[`code[class*="language-"]`],background:`transparent`,fontFamily:`"JetBrains Mono", "Fira Code", monospace`}},fk=({onFocusNode:e})=>{let{t}=f([`common`,`graph`]),{graph:n,selectedNode:r,codeReferences:i,removeCodeReference:a,clearCodeReferences:o,setSelectedNode:s,codeReferenceFocus:c,projectName:l,currentRepo:u}=dr(),d=(0,P.useMemo)(()=>n?new Map(n.nodes.map(e=>[e.id,e])):new Map,[n]),[p,m]=(0,P.useState)(!1),[h,g]=(0,P.useState)(null),_=(0,P.useRef)(null),v=(0,P.useRef)(null),y=(0,P.useRef)(new Map),b=(0,P.useRef)(null);(0,P.useEffect)(()=>()=>{b.current&&=(window.clearTimeout(b.current),null)},[]);let[x,S]=(0,P.useState)(()=>{try{let e=window.localStorage.getItem(`gitnexus.codePanelWidth`),t=e?parseInt(e,10):NaN;return Number.isFinite(t)?Math.max(420,Math.min(t,900)):560}catch{return 560}});(0,P.useEffect)(()=>{try{window.localStorage.setItem(`gitnexus.codePanelWidth`,String(x))}catch{}},[x]);let C=(0,P.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),v.current={startX:e.clientX,startWidth:x},document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let t=e=>{let t=v.current;if(!t)return;let n=e.clientX-t.startX,r=Math.max(420,Math.min(t.startWidth+n,900));S(r)},n=()=>{v.current=null,document.body.style.cursor=``,document.body.style.userSelect=``,window.removeEventListener(`mousemove`,t),window.removeEventListener(`mouseup`,n)};window.addEventListener(`mousemove`,t),window.addEventListener(`mouseup`,n)},[x]),w=(0,P.useMemo)(()=>i.filter(e=>e.source===`ai`),[i]);(0,P.useEffect)(()=>{if(!c)return;m(!1);let{filePath:e,startLine:t,endLine:n}=c,r=w.find(r=>r.filePath===e&&r.startLine===t&&r.endLine===n)??w.find(t=>t.filePath===e);if(!r)return;let i=[],a=requestAnimationFrame(()=>{let e=requestAnimationFrame(()=>{let e=y.current.get(r.id);e&&(e.scrollIntoView({behavior:`smooth`,block:`center`}),g(r.id),b.current&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>{g(e=>e===r.id?null:e),b.current=null},1200))});i.push(e)});return i.push(a),()=>{i.forEach(e=>cancelAnimationFrame(e))}},[c,w]);let T=(0,P.useMemo)(()=>w.map(e=>({ref:e,content:null,start:0,end:0,highlightStart:0,highlightEnd:0,totalLines:0})),[w]),E=r?.properties?.filePath,D=r?.label===`File`&&!!E,O=!!r&&!!E,k=w.length>0,[A,j]=(0,P.useState)(null),[M,N]=(0,P.useState)(!1),F=(0,P.useRef)(null),I=A?.content,L=A?.startLine??0;return(0,P.useEffect)(()=>{if(!E){j(null);return}let e=!1;N(!0),j(null);let t=r?.properties?.startLine,n=r?.properties?.endLine,i=D||t===void 0?{}:{startLine:Math.max(0,t-50),endLine:(n??t)+50};return tt(E,{...i,repo:u||l||void 0}).then(t=>{e||(j(t),N(!1))}).catch(()=>{e||(j(null),N(!1))}),()=>{e=!0}},[E,r?.properties?.startLine,r?.properties?.endLine,D,l,u]),(0,P.useEffect)(()=>{if(!I||!r?.properties?.startLine)return;let e=r.properties.startLine,t=!1,n=[requestAnimationFrame(()=>{let r=requestAnimationFrame(()=>{if(t)return;let n=F.current;if(!n)return;let r=n.querySelector(`[data-line-number="${e+1}"]`)??n.querySelectorAll(`.linenumber`)[e];r?r.scrollIntoView({behavior:`smooth`,block:`center`}):n.scrollTop=Math.max(0,e*20.8-n.clientHeight/3)});n.push(r)})];return()=>{t=!0,n.forEach(e=>cancelAnimationFrame(e))}},[I,r?.properties?.startLine]),p?(0,H.jsxs)(`aside`,{className:`flex h-full w-12 flex-shrink-0 flex-col items-center gap-2 border-r border-border-subtle bg-surface py-3`,children:[(0,H.jsx)(`button`,{onClick:()=>m(!1),className:`rounded p-2 text-text-secondary transition-colors hover:bg-cyan-500/10 hover:text-cyan-400`,title:t(`graph:codePanel.expand`),children:(0,H.jsx)(Kr,{className:`h-5 w-5`})}),(0,H.jsx)(`div`,{className:`my-1 h-px w-6 bg-border-subtle`}),O&&(0,H.jsx)(`div`,{className:`rotate-90 text-[9px] font-medium tracking-wide whitespace-nowrap text-amber-400`,children:t(`graph:codePanel.selected`)}),k&&(0,H.jsxs)(`div`,{className:`mt-4 rotate-90 text-[9px] font-medium tracking-wide whitespace-nowrap text-cyan-400`,children:[`AI • `,w.length]})]}):(0,H.jsxs)(`aside`,{ref:e=>{_.current=e},className:`relative flex h-full animate-slide-in flex-col border-r border-border-subtle bg-surface/95 shadow-2xl backdrop-blur-md`,style:{width:x},children:[(0,H.jsx)(`div`,{onMouseDown:C,className:`absolute top-0 right-0 h-full w-2 cursor-col-resize bg-transparent transition-colors hover:bg-cyan-500/25`,title:t(`graph:codePanel.dragResize`)}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border-subtle bg-gradient-to-r from-elevated/60 to-surface/60 px-3 py-2.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(wr,{className:`h-4 w-4 text-cyan-400`}),(0,H.jsx)(`span`,{className:`text-sm font-semibold text-text-primary`,children:t(`graph:codePanel.title`)})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[k&&(0,H.jsx)(`button`,{onClick:()=>o(),className:`rounded p-1.5 text-text-muted transition-colors hover:bg-red-500/10 hover:text-red-400`,title:t(`graph:codePanel.clearCitations`),children:(0,H.jsx)(di,{className:`h-4 w-4`})}),(0,H.jsx)(`button`,{onClick:()=>m(!0),className:`rounded p-1.5 text-text-muted transition-colors hover:bg-hover hover:text-text-primary`,title:t(`common:actions.collapse`),children:(0,H.jsx)(Gr,{className:`h-4 w-4`})})]})]}),(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[O&&(0,H.jsxs)(`div`,{className:`${k?`h-[42%]`:`flex-1`} flex min-h-0 flex-col`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-amber-500/20 bg-gradient-to-r from-amber-500/8 to-orange-500/5 px-3 py-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border border-amber-500/25 bg-amber-500/15 px-2 py-0.5`,children:[(0,H.jsx)(Ur,{className:`h-3 w-3 text-amber-400`}),(0,H.jsx)(`span`,{className:`text-[10px] font-semibold tracking-wide text-amber-300 uppercase`,children:t(`graph:codePanel.selected`)})]}),(0,H.jsx)(Dr,{className:`ml-1 h-3.5 w-3.5 text-amber-400/70`}),(0,H.jsx)(`span`,{className:`flex-1 truncate font-mono text-xs text-text-primary`,children:r?.properties?.filePath?.split(`/`).pop()??r?.properties?.name}),(0,H.jsx)(`button`,{onClick:()=>s(null),className:`rounded p-1 text-text-muted transition-colors hover:bg-amber-500/10 hover:text-amber-400`,title:t(`graph:codePanel.clearSelection`),children:(0,H.jsx)(gi,{className:`h-4 w-4`})})]}),(0,H.jsx)(`div`,{ref:F,className:`scrollbar-thin min-h-0 flex-1 overflow-auto`,children:M?(0,H.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-8 text-text-muted`,children:[(0,H.jsx)(Vr,{className:`h-4 w-4 animate-spin`}),(0,H.jsx)(`span`,{className:`text-sm`,children:t(`graph:codePanel.loadingSource`)})]}):I?(0,H.jsx)(GO,{language:uk(E),style:dk,showLineNumbers:!0,startingLineNumber:L+1,lineNumberStyle:{minWidth:`3em`,paddingRight:`1em`,color:`#5a5a70`,textAlign:`right`,userSelect:`none`},lineProps:e=>{let t=r?.properties?.startLine,n=r?.properties?.endLine??t,i=typeof t==`number`&&e>=t+1&&e<=(n??t)+1;return{style:{display:`block`,backgroundColor:i?`rgba(6, 182, 212, 0.14)`:`transparent`,borderLeft:i?`3px solid #06b6d4`:`3px solid transparent`,paddingLeft:`12px`,paddingRight:`16px`}}},wrapLines:!0,children:I}):(0,H.jsx)(`div`,{className:`px-3 py-3 text-sm text-text-muted`,children:D?(0,H.jsx)(H.Fragment,{children:t(`graph:codePanel.codeNotAvailable`,{path:E})}):(0,H.jsx)(H.Fragment,{children:t(`graph:codePanel.selectFile`)})})})]}),O&&k&&(0,H.jsx)(`div`,{className:`h-1.5 bg-gradient-to-r from-transparent via-border-subtle to-transparent`}),k&&(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-cyan-500/20 bg-gradient-to-r from-cyan-500/8 to-teal-500/5 px-3 py-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border border-cyan-500/25 bg-cyan-500/15 px-2 py-0.5`,children:[(0,H.jsx)(ai,{className:`h-3 w-3 text-cyan-400`}),(0,H.jsx)(`span`,{className:`text-[10px] font-semibold tracking-wide text-cyan-300 uppercase`,children:t(`graph:codePanel.aiCitations`)})]}),(0,H.jsx)(`span`,{className:`ml-1 text-xs text-text-muted`,children:t(`graph:codePanel.references`,{count:w.length})})]}),(0,H.jsx)(`div`,{className:`scrollbar-thin min-h-0 flex-1 space-y-3 overflow-y-auto p-3`,children:T.map(({ref:r,content:i,start:o,highlightStart:c,highlightEnd:l,totalLines:u})=>{let f=r.label&&qn[r.label]||`#6b7280`,p=typeof r.startLine==`number`,m=p?(r.startLine??0)+1:void 0,g=p?(r.endLine??r.startLine??0)+1:void 0,_=uk(r.filePath);return(0,H.jsxs)(`div`,{ref:e=>{y.current.set(r.id,e)},className:[`overflow-hidden rounded-xl border border-border-subtle bg-elevated transition-all`,h===r.id?`animate-pulse shadow-[0_0_0_6px_rgba(34,211,238,0.14)] ring-2 ring-cyan-300/70`:``].join(` `),children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-border-subtle bg-surface/40 px-3 py-2`,children:[(0,H.jsx)(`span`,{className:`mt-0.5 flex-shrink-0 rounded px-2 py-0.5 text-[10px] font-semibold tracking-wide uppercase`,style:{backgroundColor:f,color:`#06060a`},title:r.label??t(`graph:codePanel.code`),children:r.label??t(`graph:codePanel.code`)}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate text-xs font-medium text-text-primary`,children:r.name??r.filePath.split(`/`).pop()??r.filePath}),(0,H.jsxs)(`div`,{className:`truncate font-mono text-[11px] text-text-muted`,children:[r.filePath,m!==void 0&&(0,H.jsxs)(`span`,{className:`text-text-secondary`,children:[` `,`• L`,m,g===m?``:`–${g}`]}),u>0&&(0,H.jsxs)(`span`,{className:`text-text-muted`,children:[` `,`• `,t(`graph:codePanel.lines`,{count:u})]})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[r.nodeId&&(0,H.jsx)(`button`,{onClick:()=>{let t=r.nodeId;if(n){let e=d.get(t);e&&s(e)}e(t)},className:`rounded p-1.5 text-text-muted transition-colors hover:bg-hover hover:text-text-primary`,title:t(`common:actions.focusInGraph`),children:(0,H.jsx)(li,{className:`h-4 w-4`})}),(0,H.jsx)(`button`,{onClick:()=>a(r.id),className:`rounded p-1.5 text-text-muted transition-colors hover:bg-hover hover:text-text-primary`,title:t(`common:actions.remove`),children:(0,H.jsx)(gi,{className:`h-4 w-4`})})]})]}),(0,H.jsx)(`div`,{className:`overflow-x-auto`,children:i?(0,H.jsx)(GO,{language:_,style:dk,showLineNumbers:!0,startingLineNumber:o+1,lineNumberStyle:{minWidth:`3em`,paddingRight:`1em`,color:`#5a5a70`,textAlign:`right`,userSelect:`none`},lineProps:e=>{let t=p&&e>=o+c+1&&e<=o+l+1;return{style:{display:`block`,backgroundColor:t?`rgba(6, 182, 212, 0.14)`:`transparent`,borderLeft:t?`3px solid #06b6d4`:`3px solid transparent`,paddingLeft:`12px`,paddingRight:`16px`}}},wrapLines:!0,children:i}):(0,H.jsx)(`div`,{className:`px-3 py-3 text-sm text-text-muted`,children:t(`graph:codePanel.codeNotAvailable`,{path:r.filePath})})})]},r.id)})})]})]})]})},pk=e=>e.get(`repo`)??e.get(`project`)??void 0,mk=()=>{let{t:e}=f([`common`,`errors`]),{viewMode:t,setViewMode:n,setGraph:r,setGraphMode:i,setChatOnlyNodeCount:a,setProgress:o,setProjectName:s,progress:c,isRightPanelOpen:l,isSettingsPanelOpen:u,setSettingsPanelOpen:d,refreshLLMSettings:p,initializeAgent:m,startEmbeddingsWithFallback:h,codeReferences:g,selectedNode:_,isCodePanelOpen:v,serverBaseUrl:b,setServerBaseUrl:x,availableRepos:S,setAvailableRepos:C,switchRepo:w,setCurrentRepo:T}=dr(),E=(0,P.useRef)(null),[D,O]=(0,P.useState)(!1),k=(0,P.useCallback)(async e=>{let t=e.repoInfo.repoPath??e.repoInfo.path,o=e.repoInfo.name||(t||``).replace(/\\/g,`/`).split(`/`).filter(Boolean).pop()||`server-project`,c=t||o;s(o),T(c);let l=L(e);r(l.graph),i(l.graphMode),a(l.graphMode===`chatOnly`?l.nodeCount:null);let u=new URL(window.location.href);u.searchParams.set(`project`,o),t&&u.searchParams.set(`repo`,t),window.history.replaceState(null,``,u.toString()),n(`exploring`);try{ve()&&await m(o,{chatOnly:e.graphSkipped,repo:c}),h()}catch(e){console.warn(`Failed to initialize agent:`,e)}},[n,r,i,a,s,T,m,h]),A=(0,P.useRef)(!1),j=(0,P.useRef)(e);(0,P.useEffect)(()=>{j.current=e},[e]),(0,P.useEffect)(()=>{if(A.current)return;let e=new URLSearchParams(window.location.search),t=e.get(`server`),r=pk(e),i=ke(e.get(`skipGraph`));if(!t&&!r)return;A.current=!0,o({phase:`extracting`,percent:0,message:j.current(`common:progress.connecting`),detail:j.current(`common:progress.validatingServer`)}),n(`loading`);let a=t||window.location.origin,s=Le(a);(async()=>await ct(a,(e,t,n)=>{if(e===`validating`)o({phase:`extracting`,percent:5,message:j.current(`common:progress.connecting`),detail:j.current(`common:progress.validatingServer`)});else if(e===`downloading`){let e=n?Math.round(t/n*90)+5:50,r=(t/(1024*1024)).toFixed(1);o({phase:`extracting`,percent:e,message:j.current(`common:progress.downloadingGraph`),detail:j.current(`common:progress.downloadedMb`,{mb:r})})}else e===`extracting`&&o({phase:`extracting`,percent:97,message:j.current(`common:progress.processing`),detail:j.current(`common:progress.extractingFileContents`)})},void 0,r,{awaitAnalysis:!0,skipGraph:i}))().then(async e=>{x(s),await k(e),o(null),qe().then(e=>C(e)).catch(e=>console.warn(`Failed to fetch repo list:`,e))}).catch(e=>{console.error(`Auto-connect failed:`,e),o({phase:`error`,percent:0,message:j.current(`errors:connectFailed`),detail:Mi(e,j.current)}),setTimeout(()=>{n(`onboarding`),o(null)},y)})},[k,o,n,x,C]);let M=(0,P.useCallback)(e=>{E.current?.focusNode(e)},[]),N=(0,P.useCallback)(()=>{p(),m()},[p,m]);return(0,P.useEffect)(()=>{if(t===`exploring`)return We(()=>O(!1),()=>O(!0))},[t]),t===`onboarding`?(0,H.jsx)(Zi,{onServerConnect:async(e,t)=>{let n=await qe().catch(()=>[]);if(C(n),await k(e),o(null),t){let e=Le(t);x(e);let n=new URL(window.location.href);n.searchParams.set(`server`,e),window.history.replaceState(null,``,n.toString())}}}):t===`loading`&&c?(0,H.jsx)(Qi,{progress:c}):(0,H.jsxs)(`div`,{className:`flex h-screen flex-col overflow-hidden bg-void`,children:[(0,H.jsx)(ra,{onFocusNode:M,availableRepos:S,onSwitchRepo:w,onReposChanged:e=>C(e),onAnalyzeComplete:async e=>{let t=b??`http://localhost:4747`;for(let n=0;n<2;n++)try{let n=await qe();C(n);let r=await ct(t,void 0,void 0,e);await k(r),x(Le(t)),o(null);return}catch(e){if(n===0&&e instanceof je){await new Promise(e=>setTimeout(e,1500));continue}console.error(`Failed to connect after analyze:`,e),qe().then(e=>C(e)).catch(()=>{});return}}}),(0,H.jsxs)(`main`,{className:`flex min-h-0 flex-1`,children:[(0,H.jsx)(lk,{onFocusNode:M}),(0,H.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,H.jsx)(Jd,{ref:E}),v&&(g.length>0||!!_)&&(0,H.jsx)(`div`,{className:`pointer-events-auto absolute inset-y-0 left-0 z-30`,children:(0,H.jsx)(fk,{onFocusNode:M})})]}),l&&(0,H.jsx)(ek,{})]}),(0,H.jsx)(ak,{}),D&&(0,H.jsx)(`div`,{className:`fixed bottom-12 left-1/2 z-50 -translate-x-1/2 rounded-lg border border-yellow-500/30 bg-yellow-900/80 px-4 py-2 text-sm text-yellow-200 shadow-lg backdrop-blur`,children:e(`errors:backend.reconnecting`)}),(0,H.jsx)(ik,{isOpen:u,onClose:()=>d(!1),onSettingsSaved:N})]})};function hk(){return(0,H.jsx)(lr,{children:(0,H.jsx)(mk,{})})}F.createRoot(document.getElementById(`root`)).render((0,H.jsx)(P.StrictMode,{children:(0,H.jsx)(hk,{})}));
package/web/index.html CHANGED
@@ -10,7 +10,7 @@
10
10
  href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Outfit:wght@300;400;500;600;700&display=swap"
11
11
  rel="stylesheet"
12
12
  />
13
- <script type="module" crossorigin src="/assets/index-DKqR2tAm.js"></script>
13
+ <script type="module" crossorigin src="/assets/index-B4E0OhHQ.js"></script>
14
14
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
15
15
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-Czpn1I53.js">
16
16
  <link rel="modulepreload" crossorigin href="/assets/chunk-AQ6EADP3-CZhslHi-.js">