1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9883],{33260:(e,t,n)=>{n.d(t,{B:()=>r});var i=n(85778);let s=!1,l={json:"json.worker.js",css:"css.worker.js",scss:"css.worker.js",less:"css.worker.js",html:"html.worker.js",handlebars:"html.worker.js",razor:"html.worker.js",typescript:"ts.worker.js",javascript:"ts.worker.js"};function a(){let e=new URL("/monaco/vs/assets/",window.location.origin).toString(),t=window.MonacoEnvironment;window.MonacoEnvironment={...null!=t?t:{},getWorker:(t,n)=>{var i;return new Worker(new URL(null!=(i=l[n])?i:"editor.worker.js",e).toString(),{name:n})}}}function r(){if(s)return;let e=new URL("/monaco/vs",window.location.origin).toString();i.loader.config({paths:{vs:e}}),a(),i.loader.init().then(()=>{a()}).catch(e=>{console.error("[monaco] Failed to initialize:",e)}),s=!0}},59946:(e,t,n)=>{n.d(t,{A:()=>d,h:()=>o});var i=n(95155),s=n(12115),l=n(65229),a=n(25016);let r={create:"Created",update:"Updated",delete:"Deleted"};function d(e){var t,n,d;let{diff:o,changeType:c,title:u,subtitle:f,compact:m,showHeader:v=!0,onClose:h,className:p}=e,y=s.useMemo(()=>{var e;let t,n;return e=o.lines,t=0,n=0,e.forEach(e=>{e.startsWith("+")&&!e.startsWith("+++")&&(t+=1),e.startsWith("-")&&!e.startsWith("---")&&(n+=1)}),{added:t,removed:n}},[o.lines]),w=null!=(t=o.added)?t:y.added,g=null!=(n=o.removed)?n:y.removed,b=c&&null!=(d=r[c])?d:"Updated";return(0,i.jsxs)("div",{className:(0,a.cn)("ds-file-diff-panel",m&&"is-compact",p),children:[v?(0,i.jsxs)("div",{className:"ds-file-diff-header",children:[(0,i.jsxs)("div",{className:"ds-file-diff-header-text",children:[(0,i.jsx)("div",{className:"ds-file-diff-title",children:null!=u?u:"AI Change"}),(0,i.jsxs)("div",{className:"ds-file-diff-subtitle",children:[(0,i.jsx)("span",{className:"ds-file-diff-tag",children:b}),(0,i.jsxs)("span",{className:"ds-file-diff-meta",children:["+",w]}),(0,i.jsxs)("span",{className:"ds-file-diff-meta",children:["-",g]}),f?(0,i.jsx)("span",{className:"ds-file-diff-muted",children:f}):null]})]}),h?(0,i.jsx)("button",{type:"button",className:"ds-file-diff-close",onClick:h,"aria-label":"Dismiss diff",children:(0,i.jsx)(l.A,{size:14})}):null]}):null,(0,i.jsx)("div",{className:"ds-file-diff-body",children:o.lines.map((e,t)=>{let{isHunk:n,isAdd:s,isDel:l,isContext:r,prefix:d,text:o}=function(e){let t=e.startsWith("@@"),n=e.startsWith("+")&&!e.startsWith("+++"),i=e.startsWith("-")&&!e.startsWith("---"),s=t?e.slice(2).trimStart():e.slice(1);return{isHunk:t,isAdd:n,isDel:i,isContext:!t&&!n&&!i,prefix:t?"@@":n?"+":i?"-":" ",text:s}}(e);return(0,i.jsxs)("div",{className:(0,a.cn)("ds-file-diff-line",n&&"is-hunk",s&&"is-add",l&&"is-del",r&&"is-context"),children:[(0,i.jsx)("span",{className:"ds-file-diff-prefix",children:d}),(0,i.jsx)("span",{className:"ds-file-diff-text",children:o})]},"".concat(d,"-").concat(t))})}),o.truncated?(0,i.jsx)("div",{className:"ds-file-diff-footer",children:"Diff truncated. Open file for full details."}):null]})}let o=d},65229:(e,t,n)=>{n.d(t,{A:()=>i});let i=(0,n(45105).A)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},69883:(e,t,n)=>{n.r(t),n.d(t,{default:()=>g});var i=n(95155),s=n(12115),l=n(67909),a=n(919),r=n(46046),d=n(93779),o=n(89559),c=n(25016),u=n(12980),f=n(87725),m=n(26031),v=n(33260),h=n(11401),p=n(94620),y=n(59946);let w=(0,l.default)(()=>Promise.resolve().then(n.bind(n,85778)),{loadableGenerated:{webpack:()=>[85778]},ssr:!1});function g(e){var t,n,l,v,g,b,x,k;let{context:j,tabId:N,setDirty:S,setTitle:A}=e,W=null!=(l=null==(t=j.customData)?void 0:t.projectId)?l:void 0,T=null!=(v=null==(n=j.customData)?void 0:n.fileMeta)?v:void 0,C=j.resourceId,E=(0,h.Kd)(C),z=null!=(g=j.resourcePath)?g:void 0,M=j.resourceName||j.resourcePath||"Untitled",D=s.useMemo(()=>(function(e){let t=e.toLowerCase();return t.endsWith(".py")||t.endsWith(".pyw")||t.endsWith(".pyi")?"python":t.endsWith(".json")||t.endsWith(".jsonc")||t.endsWith(".json5")?"json":t.endsWith(".ts")||t.endsWith(".tsx")||t.endsWith(".mts")?"typescript":t.endsWith(".js")||t.endsWith(".jsx")||t.endsWith(".mjs")?"javascript":t.endsWith(".md")||t.endsWith(".markdown")?"markdown":t.endsWith(".yaml")||t.endsWith(".yml")?"yaml":t.endsWith(".html")||t.endsWith(".htm")?"html":t.endsWith(".css")||t.endsWith(".scss")||t.endsWith(".sass")?"css":"plaintext"})(M),[M]),L=function(){let[e,t]=s.useState(()=>"undefined"!=typeof document&&document.documentElement.classList.contains("dark"));return s.useEffect(()=>{let e=document.documentElement,n=new MutationObserver(()=>{t(e.classList.contains("dark"))});return n.observe(e,{attributes:!0,attributeFilter:["class"]}
1),()=>n.disconnect()},[]),e}(),B=(0,u.M)(e=>e.ensureLoaded),I=(0,u.M)(e=>e.reload),P=(0,u.M)(e=>e.save),F=(0,u.M)(e=>e.setContent),R=(0,u.M)(e=>e.applyServerSnapshot),U=W&&C?u.M.getState().getKey(W,C):null,K=(0,u.M)(e=>U?e.entries[U]:void 0),O=(0,u.f)(W,null!=C?C:void 0),_=(0,m.pT)(e=>e.updateFileMeta),{diffEvent:H,clearDiff:V}=(0,p.H)({fileId:C,filePath:z,projectId:W}),q=s.useRef(null),G=s.useRef(null),J=s.useRef(!1),[X,Q]=s.useState(!1);s.useEffect(()=>{A(M)},[M,A]),s.useEffect(()=>{var e;W&&C&&B({projectId:W,fileId:C,updatedAt:null==T?void 0:T.updatedAt,mimeType:null!=(e=j.mimeType)?e:null==T?void 0:T.mimeType,sizeBytes:null==T?void 0:T.sizeBytes}).catch(e=>{console.error("[CodeEditorPlugin] Failed to load file:",e)})},[W,C,B,null==T?void 0:T.updatedAt,null==T?void 0:T.mimeType,null==T?void 0:T.sizeBytes,j.mimeType]),s.useEffect(()=>{if(!W||!C||E)return;let{socket:e,release:t}=(0,f.O)();G.current={socket:e,release:t};let n=async()=>{if(!J.current&&e.connected)try{J.current=!0,await e.emitWithAck("file:join",{projectId:W,fileId:C,clientVersion:"1.0.0"}),Q(!0)}catch(e){console.warn("[CodeEditorPlugin] file:join failed:",e)}},i=()=>{Q(!0),n()},s=()=>{Q(!1),J.current=!1},l=e=>{var t,n,i;if((null==e?void 0:e.fileId)!==C)return;let s=u.M.getState().getKey(W,C),l=u.M.getState().entries[s];null!=l&&l.isDirty||(R({projectId:W,fileId:C,content:String(null!=(t=null==e?void 0:e.content)?t:""),updatedAt:String(null!=(n=null==e?void 0:e.updatedAt)?n:""),sizeBytes:"number"==typeof(null==e?void 0:e.size)?e.size:void 0,mimeType:null==l?void 0:l.mimeType}),_(C,{updatedAt:String(null!=(i=null==e?void 0:e.updatedAt)?i:""),size:"number"==typeof(null==e?void 0:e.size)?e.size:void 0}))};return e.on("connect",i),e.on("disconnect",s),e.on("file:content-updated",l),e.connected&&n(),()=>{try{e.off("connect",i),e.off("disconnect",s),e.off("file:content-updated",l),J.current&&e.emit("file:leave",{projectId:W,fileId:C})}finally{J.current=!1,Q(!1),G.current=null,t()}}},[W,C,E]),s.useEffect(()=>{S(!!(null==K?void 0:K.isDirty))},[null==K?void 0:K.isDirty,S]);let Y=s.useCallback(async()=>{var e;if(!W||!C||!K)return;try{let e=u.M.getState().getKey(W,C);u.M.setState(t=>{let n=t.entries[e];return n?{entries:{...t.entries,[e]:{...n,saveState:"saving",saveError:void 0}}}:t})}catch(e){}let t=null==(e=G.current)?void 0:e.socket;if(!E&&t&&t.connected&&J.current)try{let e=await t.emitWithAck("file:update-content",{projectId:W,fileId:C,content:K.content});if("error"in e)throw Error(e.error.message);R({projectId:W,fileId:C,content:K.content,updatedAt:e.data.updatedAt,sizeBytes:"number"==typeof e.data.size?e.data.size:K.sizeBytes,mimeType:K.mimeType}),E||_(C,{updatedAt:e.data.updatedAt,size:"number"==typeof e.data.size?e.data.size:void 0,mimeType:K.mimeType});return}catch(e){console.warn("[CodeEditorPlugin] realtime save failed, fallback to HTTP:",e)}let n=await P({projectId:W,fileId:C});!E&&n.updatedAt&&_(C,{updatedAt:n.updatedAt,size:n.sizeBytes,mimeType:n.mimeType})},[R,K,C,E,W,P,_]);x=()=>{W&&C&&(null==K?void 0:K.isDirty)&&"saving"!==K.saveState&&Y()},k=[W,C,null==K?void 0:K.content,null==K?void 0:K.isDirty],s.useEffect(()=>{let e=window.setTimeout(x,650);return()=>window.clearTimeout(e)},[...k,650]),s.useEffect(()=>{if(!W||!C)return;let e=e=>{(e.ctrlKey||e.metaKey)&&"s"===e.key.toLowerCase()&&(e.preventDefault(),Y())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[W,C,Y]);let Z=s.useMemo(()=>K?"saving"===K.saveState?"Savingâ¦":"error"===K.saveState?K.saveError||"Save failed":K.isDirty?"Unsaved":"Saved":"",[K]),$=!!W&&!!C&&!!K&&!O,ee="json"===D,et=async()=>{let e=q.current;if(e)try{await e.getAction("editor.action.formatDocument").run()}catch(e){console.warn("[CodeEditorPlugin] Format failed:",e)}},en=s.useCallback(async()=>{var e,t,n,i;if(!W||!C||(null==K?void 0:K.isDirty)&&!window.confirm("Discard unsaved changes and reload from server?"))return;let s=m.pT.getState().findNode(C),l=null!=(e=null==s?void 0:s.updatedAt)?e:null==T?void 0:T.updatedAt,a=null!=(t=null==s?void 0:s.size)?t:null==T?void 0:T.sizeBytes,r=null!=(i=null!=(n=null==s?void 0:s.mimeType)?n:j.mimeType)?i:null==T?void 0:T.mimeType;try{await I({projectId:W,fileId:C,updatedAt:l,sizeBytes:a,mimeType:r,ignoreDirty:!0})}catch(e){console.warn("[CodeEditorPlugin] Reload failed:",e)}},[W,C,null==K?void 0:K.isDirty,null==T?void 0:T.updatedAt,null==T?void 0:T.sizeBytes,null==T?void 0:T.mimeType,j.mimeType,I]);return(s.useEffect(()=>{var e;(null==H?void 0:H.diff)&&W&&C&&"delete"!==H.changeType&&(null!=K&&K.isDirty||I({projectId:W,fileId:C,mimeType:null!=(e=j.mimeType)?e:null==T?void 0:T.mimeType,sizeBytes:null==T?void 0:T.sizeBytes,updatedAt:null==T?void 0:T.updatedAt,ignoreDirty:!0}))},[H,null==K?void 0:K.isDirty,W,C,j.mimeType,null==T?void 0:T.mimeType,null==T?void 0:T.sizeBytes,null==T?void 0:T.updatedAt,I]),W&&C)?(0,i.jsxs)("div",{className:"flex flex-col h-full bg-background",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border/60 bg-white/60 backdrop-blur dark:bg-black/30",children:[(0,i.jsxs)("div",{className:"min-w-0 flex items-center gap-2",children:[(0,i.jsx)("div",{className:"truncate text-sm font-medium",children:M}),(0,i.jsx)("span",{className:"text-[11px] px-2 py-0.5 rounded bg-black/[0.06] dark:bg-white/[0.08] text-muted-foreground uppercase",children:D})]}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsxs)("span",{className:(0,
1c.cn)("text-xs",(null==K?void 0:K.saveState)==="error"?"text-red-600":"text-muted-foreground"),title:null==K?void 0:K.saveError,children:[Z,E||X?"":" (offline)"]}),(0,i.jsxs)("button",{type:"button",className:(0,c.cn)("inline-flex items-center gap-1.5 text-xs px-2.5 py-1.5 rounded-md","border border-black/10 bg-white hover:bg-black/[0.03]","dark:border-white/10 dark:bg-white/[0.04] dark:hover:bg-white/[0.07]",!$&&"opacity-60 pointer-events-none"),onClick:()=>void Y(),title:"Save (Ctrl/Cmd+S)",children:[(null==K?void 0:K.saveState)==="saving"?(0,i.jsx)(a.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,i.jsx)(r.A,{className:"h-3.5 w-3.5"}),"Save"]}),ee?(0,i.jsxs)("button",{type:"button",className:(0,c.cn)("inline-flex items-center gap-1.5 text-xs px-2.5 py-1.5 rounded-md","border border-black/10 bg-white hover:bg-black/[0.03]","dark:border-white/10 dark:bg-white/[0.04] dark:hover:bg-white/[0.07]"),onClick:et,title:"Format JSON",children:[(0,i.jsx)(d.A,{className:"h-3.5 w-3.5"}),"Format"]}):null,(0,i.jsxs)("button",{type:"button",className:(0,c.cn)("inline-flex items-center gap-1.5 text-xs px-2.5 py-1.5 rounded-md","border border-black/10 bg-white hover:bg-black/[0.03]","dark:border-white/10 dark:bg-white/[0.04] dark:hover:bg-white/[0.07]"),onClick:()=>void en(),title:"Reload from cache/server",children:[(0,i.jsx)(o.A,{className:"h-3.5 w-3.5"}),"Reload"]})]})]}),(0,i.jsxs)("div",{className:"relative flex-1 min-h-0",children:[(null==H?void 0:H.diff)?(0,i.jsx)(y.h,{diff:H.diff,changeType:H.changeType,title:"AI change",subtitle:M,onClose:V,className:"absolute right-4 top-4 z-10 w-[min(420px,46vw)]"}):null,O&&!K?(0,i.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:(0,i.jsx)(a.A,{className:"h-6 w-6 animate-spin"})}):(0,i.jsx)(w,{height:"100%",language:D,theme:L?"vs-dark":"vs",value:null!=(b=null==K?void 0:K.content)?b:"",beforeMount:e=>{try{e.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,allowComments:!0,trailingCommas:"ignore"})}catch(e){}},onMount:e=>{q.current=e},onChange:e=>{F({projectId:W,fileId:C,content:null!=e?e:""})},options:{automaticLayout:!0,minimap:{enabled:!1},fontFamily:'"Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',fontSize:13,wordWrap:"off",scrollBeyondLastLine:!1,renderWhitespace:"selection",tabSize:2,insertSpaces:!0}})]})]}):(0,i.jsx)("div",{className:"h-full flex items-center justify-center text-sm text-muted-foreground",children:"No file selected."})}(0,v.B)()},87725:(e,t,n)=>{n.d(t,{O:()=>r});var i=n(9829),s=n(67944);let l=n(60125).pi,a=new Map;function r(){let e=l(),t=a.get(e);return t||(t={socket:(0,i.io)(e,{path:"/ws/socket.io",autoConnect:!1,transports:["websocket","polling"],auth:e=>{e({token:s.n.getState().accessToken||window.localStorage.getItem("ds_access_token")})}}),refCount:0},a.set(e,t)),t.refCount+=1,t.socket.connected||t.socket.connect(),{socket:t.socket,release:()=>{let t=a.get(e);t&&(t.refCount-=1,t.refCount<=0&&(t.socket.disconnect(),a.delete(e)))}}}},93779:(e,t,n)=>{n.d(t,{A:()=>i});let i=(0,n(45105).A)("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"}]])},94620:(e,t,n)=>{n.d(t,{H:()=>s});var i=n(12115);function s(e){let{fileId:t,filePath:n,projectId:s,ttlMs:l=6e3}=e,[a,r]=i.useState(null);return i.useEffect(()=>{let e=e=>{var i;let l=e.detail;(null==l?void 0:l.diff)&&((i={fileId:t||void 0,filePath:n||void 0,projectId:s||void 0}).projectId&&l.projectId&&i.projectId!==l.projectId||i.fileId&&l.fileId&&i.fileId!==l.fileId||i.filePath&&l.filePath&&i.filePath!==l.filePath||0||r({...l}))};return window.addEventListener("ds:file:diff",e),()=>window.removeEventListener("ds:file:diff",e)},[t,n,s]),i.useEffect(()=>{let e=()=>{a&&r(null)};return window.addEventListener("ds:tool:call",e),()=>window.removeEventListener("ds:tool:call",e)},[a]),i.useEffect(()=>{if(!a)return;let e=window.setTimeout(()=>r(null),l);return()=>window.clearTimeout(e)},[a,l]),{diffEvent:a,clearDiff:()=>r(null)}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.