1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[18681],{39763:function(e,t,n){n.d(t,{Z:function(){return c}});var a=n(2265),i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let s=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),c=(e,t)=>{let n=(0,a.forwardRef)((n,c)=>{let{color:l="currentColor",size:r=24,strokeWidth:o=2,absoluteStrokeWidth:d,className:x="",children:m,...h}=n;return(0,a.createElement)("svg",{ref:c,...i,width:r,height:r,stroke:l,strokeWidth:d?24*Number(o)/Number(r):o,className:["lucide","lucide-".concat(s(e)),x].join(" "),...h},[...t.map(e=>{let[t,n]=e;return(0,a.createElement)(t,n)}),...Array.isArray(m)?m:[m]])});return n.displayName="".concat(e),n}},32660:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(39763).Z)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},71769:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(39763).Z)("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]])},64972:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(39763).Z)("Brain",[["path",{d:"M9.5 2A2.5 2.5 0 0 1 12 4.5v15a2.5 2.5 0 0 1-4.96.44 2.5 2.5 0 0 1-2.96-3.08 3 3 0 0 1-.34-5.58 2.5 2.5 0 0 1 1.32-4.24 2.5 2.5 0 0 1 1.98-3A2.5 2.5 0 0 1 9.5 2Z",key:"1mhkh5"}],["path",{d:"M14.5 2A2.5 2.5 0 0 0 12 4.5v15a2.5 2.5 0 0 0 4.96.44 2.5 2.5 0 0 0 2.96-3.08 3 3 0 0 0 .34-5.58 2.5 2.5 0 0 0-1.32-4.24 2.5 2.5 0 0 0-1.98-3A2.5 2.5 0 0 0 14.5 2Z",key:"1d6s00"}]])},10407:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(39763).Z)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},91723:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(39763).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},50091:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(39763).Z)("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]])},48736:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(39763).Z)("FileText",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["line",{x1:"16",x2:"8",y1:"13",y2:"13",key:"14keom"}],["line",{x1:"16",x2:"8",y1:"17",y2:"17",key:"17nazh"}],["line",{x1:"10",x2:"8",y1:"9",y2:"9",key:"1a5vjj"}]])},41217:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(39763).Z)("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"}]])},15863:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(39763).Z)("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},82431:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(39763).Z)("RefreshCw",[["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"}]])},73247:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(39763).Z)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])},11239:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(39763).Z)("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]])},18681:function(e,t,n){n.r(t),n.d(t,{default:function(){return f}});var a=n(57437),i=n(2265),s=n(32660),c=n(71769),l=n(91723),r=n(41217),o=n(48736),d=n(64972),x=n(15863),m=n(11239),h=n(82431),u=n(73247),p=n(10407),g=n(50091);function b(){let e=localStorage.getItem("access_token"),t=localStorage.getItem("workspace_id"),n={"Content-Type":"application/json"};return e&&(n.Authorization="Bearer ".concat(e)),t&&(n["X-Workspace-ID"]=t),n}function w(e){if(!e)return"Never";let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<60)return"".concat(t,"m ago");let n=Math.floor(t/60);return n<24?"".concat(n,"h ago"):"".concat(Math.floor(n/24),"d ago")}let k={"daily-scan":"bg-blue-100 text-blue-700","weekly-calendar":"bg-purple-100 text-purple-700","lead-decay":"bg-red-100 text-red-700",competitor:"bg-amber-100 text-amber-700",conversation:"bg-green-100 text-green-700",campaign:"bg-indigo-100 text-indigo-700","social-metrics":"bg-pink-100 text-pink-700","seo-audit":"bg-cyan-100 text-cyan-700","call-transcript":"bg-orange-100 text-orange-700",manual:"bg-slate-100 text-slate-700"};function f(){let[e,t]=(0,i.useState)("wiki"),[n,f]=(0,i.useState)([]),[y,j]=(0,i.useState)([]),[v,N]=(0,i.useState)(null),[z,Z]=(0,i.useState)(!0),[_,C]=(0,i.useState)(!1),[S,M]=(0,i.useState)(null),[A,L]=(0,i.useState)(""),[R,E]=(0,i.useState)(null),I=(0,i.useCallback)(async()=>{Z(!0);let e=b();try{let[t,n,a]=await Promise.all([fetch("".concat("","/api/knowledge/wiki"),{headers:e}).then(e=>e.ok?e.json():{articles:[]}),fetch("".concat("","/api/knowledge/raw?limit=100"),{headers:e}).then(e=>e.ok?e.json():{items:[]}),fetch("".concat("","/api/knowledge/stats"),{headers:e}).then(e=>e.ok?e.json():null)]);f(t.articles||[]),j(n.items||[]),N(a)}catch(e){}finally{Z(!1)}},[]);(0,i.useEffect)(()=>{I()},[I]);let W=async()=>{C(!0);try{await fetch("".concat("","/api/knowledge/compile"),{method:"POST",headers:b()}),await I()}catch(e){}finally{C(!1)}},q=async()=>
1{if(!A.trim()){E(null);return}try{let e=await fetch("".concat("","/api/knowledge/search?q=").concat(encodeURIComponent(A)),{headers:b()}),t=await e.json();E(t.results||[])}catch(e){E([])}},B=async e=>{try{let t=await fetch("".concat("","/api/knowledge/wiki/").concat(encodeURIComponent(e)),{headers:b()});t.ok&&M(await t.json())}catch(e){}};return S?(0,a.jsxs)("div",{className:"p-4 md:p-6 max-w-4xl mx-auto",children:[(0,a.jsxs)("button",{onClick:()=>M(null),className:"flex items-center gap-1.5 text-sm text-indigo-600 hover:text-indigo-800 mb-4",children:[(0,a.jsx)(s.Z,{className:"w-4 h-4"})," Back"]}),(0,a.jsxs)("div",{className:"bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-700 p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,a.jsx)(c.Z,{className:"w-5 h-5 text-indigo-500"}),(0,a.jsx)("h1",{className:"text-lg font-bold text-zinc-900 dark:text-white",children:S.file_path.replace("wiki/","").replace(".md","")})]}),(0,a.jsxs)("div",{className:"flex gap-4 text-xs text-zinc-400 mb-6",children:[(0,a.jsxs)("span",{children:[(0,a.jsx)(l.Z,{className:"w-3 h-3 inline mr-1"}),w(S.updated_at)]}),(0,a.jsxs)("span",{children:[(0,a.jsx)(r.Z,{className:"w-3 h-3 inline mr-1"}),S.word_count," words"]}),(0,a.jsxs)("span",{children:[(0,a.jsx)(o.Z,{className:"w-3 h-3 inline mr-1"}),S.source_count," sources"]})]}),(0,a.jsx)("div",{className:"prose prose-sm dark:prose-invert max-w-none whitespace-pre-wrap",children:S.content})]})]}):(0,a.jsxs)("div",{className:"p-4 md:p-6 space-y-4 max-w-6xl mx-auto",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-10 h-10 bg-gradient-to-br from-indigo-500 to-purple-600 rounded-xl flex items-center justify-center shadow-md",children:(0,a.jsx)(d.Z,{className:"w-5 h-5 text-white"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-xl font-bold text-zinc-900 dark:text-white",children:"Knowledge Base"}),(0,a.jsx)("p",{className:"text-xs text-zinc-500",children:"AI-compiled intelligence from your marketing data"})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("button",{onClick:W,disabled:_||!(null==v?void 0:v.uncompiled_count),className:"flex items-center gap-1.5 px-3 py-2 rounded-lg text-sm font-medium ".concat(_?"bg-indigo-100 text-indigo-400":(null==v?void 0:v.uncompiled_count)?"bg-indigo-600 text-white hover:bg-indigo-700":"bg-zinc-100 text-zinc-400 cursor-not-allowed dark:bg-zinc-800"),children:[_?(0,a.jsx)(x.Z,{className:"w-4 h-4 animate-spin"}):(0,a.jsx)(m.Z,{className:"w-4 h-4"}),_?"Compiling...":"Compile".concat((null==v?void 0:v.uncompiled_count)?" (".concat(v.uncompiled_count,")"):"")]}),(0,a.jsx)("button",{onClick:I,className:"p-2 rounded-lg hover:bg-zinc-100 dark:hover:bg-zinc-800",children:(0,a.jsx)(h.Z,{className:"w-4 h-4 text-zinc-500 ".concat(z?"animate-spin":"")})})]})]}),v&&(0,a.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[{label:"Wiki Articles",value:v.wiki_count,sub:"".concat(v.wiki_words.toLocaleString()," words"),color:"text-indigo-600"},{label:"Raw Items",value:v.raw_count,sub:"".concat(v.raw_words.toLocaleString()," words"),color:"text-blue-600"},{label:"Pending",value:v.uncompiled_count,sub:"to compile",color:"text-amber-600"},{label:"Last Update",value:w(v.last_wiki||v.last_raw),sub:"compiles every 6h",color:"text-zinc-700 dark:text-zinc-300",isText:!0}].map((e,t)=>(0,a.jsxs)("div",{className:"bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-700 p-3",children:[(0,a.jsx)("div",{className:"text-xs text-zinc-500 mb-1",children:e.label}),(0,a.jsx)("div",{className:"".concat(e.isText?"text-sm":"text-2xl"," font-bold ").concat(e.color),children:e.value}),(0,a.jsx)("div",{className:"text-[10px] text-zinc-400",children:e.sub})]},t))}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsxs)("div",{className:"flex-1 relative",children:[(0,a.jsx)(u.Z,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-zinc-400"}),(0,a.jsx)("input",{type:"text",placeholder:"Search knowledge base...",value:A,onChange:e=>L(e.target.value),onKeyDown:e=>"Enter"===e.key&&q(),className:"w-full pl-9 pr-3 py-2 text-sm rounded-lg border border-zinc-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 focus:ring-2 focus:ring-indigo-500 outline-none"})]}),(0,a.jsx)("button",{onClick:q,className:"px-4 py-2 bg-indigo-600 text-white text-sm rounded-lg hover:bg-indigo-700",children:"Search"})]}),R&&(0,a.jsxs)("div",{className:"bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-700 p-4",children:[(0,a.jsxs)("div",{className:"flex justify-between mb-3",children:[(0,a.jsxs)("h3",{className:"text-sm font-semibold",children:["Results (",R.length,")"]}),(0,a.jsx)("button",{onClick:()=>E(null),className:"text-xs text-zinc-400 hover:text-zinc-600",children:"Clear"})]}),0===R.length?(0,a.jsx)("p",{className:"text-sm text-zinc-400",children:"No results"}):(0,a.jsx)("div",{className:"space-y-2",children:R.map(e=>(0,a.jsxs)("button",{onClick:()=>B(e.file_path),className:"w-full text-left p-2.5 rounded-lg hover:bg-zinc-50 dark:hover:bg-zinc-800",children:[(0,a.jsx)("div",{className:"text-sm font-medium text-zinc-800 dark:text-zinc-200",children:e.file_path}),(0,a.jsx)("p",{className:"text-xs text-zinc-400 mt-0.5 line-clamp-2",children:e.snippet})]},e.file_path))})]}),(0,a.jsx)("div",{className:"flex gap-1 bg-zinc-100 dark:bg-zinc-800 rounded-lg p-1",children:["wiki","raw","stats"].map(i=>(0,a.jsx)("button",{onClick:()=>t(i),className:"flex-1 py-1.5 px-3 rounded-md text-sm font-medium transition-all ".concat(e===i?"bg-white dark:bg-zinc-700 text-zinc-900 dark:text-white shadow-sm":"text-zinc-500"),children:"wiki"===i?"Wiki (".concat(n.length,")"):"raw"===i?"Raw (".concat(y.length,")"):"Overview"},i))}),z?(0,a.jsx)("div",{className:"flex justify-center py-16",children:(0,a.jsx)(x.Z,{className:"w-6 h-6 animate-spin text-indigo-400"})}):"wiki"===e?0===n.length?(0,a.jsxs)("div",{className:"text-center py-12 bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-700",children:[(0,a.jsx)(d.Z,{className:"w-10 h-10 mx-auto text-zinc-300 mb-3"}),(0,a.jsx)("h3",{className:"text-sm font-semibold text-zinc-700 dark:text-zinc-300 mb-1",children:"No wiki articles yet"}),(0,a.jsx)("p",{className:"text-xs text-zinc-400 mb-4",children:"Raw data compiles into articles every 6 hours, or click Compile now."}),v&&v.uncompiled_count>0&&(0,a.jsxs)("button",{onClick:W,disabled:_,className:"px-4 py-2 bg-indigo-600 text-white text-sm rounded-lg hover:bg-indigo-700",children:[(0,a.jsx)(m.Z,{className:"w-4 h-4 inline mr-1"})," Compile ",v.uncompiled_count," items"]})]}):(0,a.jsx)("div",{className:"space-y-2",children:n.map(e=>(0,a.jsxs)("button",{onClick:()=>B(e.file_path),className:"w-full text-left bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-700 p-4 hover:border-indigo-300 dark:hover:border-indigo-600 group",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(c.Z,{className:"w-4 h-4 text-indigo-500"}),(0,a.jsx)("h3",{className:"text-sm font-semibold text-zinc-800 dark:text-zinc-200",children:e.file_path.replace("wiki/","").replace(".md","")})]}),(0,a.jsx)(p.Z,{className:"w-4 h-4 text-zinc-300 group-hover:text-indigo-500"})]}),(0,a.jsx)("p",{className:"text-xs text-zinc-500 mt-1.5 line-clamp-2",children:e.snippet}),(0,a.jsxs)("div",{className:"flex gap-3 mt-2 text-[10px] text-zinc-400",children:[(0,a.jsxs)("span",{children:[(0,a.jsx)(l.Z,{className:"w-3 h-3 inline mr-0.5"}),w(e.updated_at)]}),(0,a.jsxs)("span",{children:[e.word_count," words"]}),(0,a.jsxs)("span",{children:[e.source_count," sources"]})]})]},e.file_path))}):"raw"===e?0===y.length?(0,a.jsxs)("div",{className:"text-center py-12 bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-700",children:[(0,a.jsx)(g.Z,{className:"w-10 h-10 mx-auto text-zinc-300 mb-3"}),(0,a.jsx)("h3",{className:"text-sm font-semibold text-zinc-700 dark:text-zinc-300",children:"No raw data yet"}),(0,a.jsx)("p",{className:"text-xs text-zinc-400",children:"Data appears as tasks run, campaigns complete, and conversations happen."})]}):(0,a.jsx)("div",{className:"space-y-1.5",children:y.map(e=>(0,a.jsxs)("div",{className:"bg-white dark:bg-zinc-900 rounded-lg border border-zinc-200 dark:border-zinc-700 px-3.5 py-2.5 flex items-center gap-3",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full font-medium ".concat(k[e.category]||"bg-zinc-100 text-zinc-600"),children:e.category}),(0,a.jsx)("span",{className:"text-xs font-medium text-zinc-700 dark:text-zinc-300 truncate",children:e.file_path.split("/").pop()})]}),(0,a.jsxs)("div",{className:"text-[10px] text-zinc-400 mt-0.5",children:[e.word_count," words | ",w(e.created_at),e.compiled&&(0,a.jsx)("span",{className:"text-green-600 ml-2",children:"Compiled"})]})]}),(0,a.jsx)("div",{className:"w-2 h-2 rounded-full flex-shrink-0 ".concat(e.compiled?"bg-green-500":"bg-amber-400")})]},e.id))}):(0,a.jsxs)("div",{className:"bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-700 p-6",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold mb-4",children:"Overview"}),(0,a.jsx)("div",{className:"space-y-3 text-sm",children:[["Wiki articles",(null==v?void 0:v.wiki_count)||0],["Wiki words",((null==v?void 0:v.wiki_words)||0).toLocaleStr
1ing()],["Raw items",(null==v?void 0:v.raw_count)||0],["Pending compile",(null==v?void 0:v.uncompiled_count)||0],["Last raw",w((null==v?void 0:v.last_raw)||null)],["Last wiki",w((null==v?void 0:v.last_wiki)||null)],["Schedule","Every 6 hours"]].map((e,t)=>{let[n,i]=e;return(0,a.jsxs)("div",{className:"flex justify-between py-2 border-b border-zinc-100 dark:border-zinc-800 last:border-0",children:[(0,a.jsx)("span",{className:"text-zinc-500",children:n}),(0,a.jsx)("span",{className:"font-semibold",children:i})]},t)})}),(0,a.jsxs)("div",{className:"mt-6 p-3 bg-indigo-50 dark:bg-indigo-950/30 rounded-lg",children:[(0,a.jsx)("h4",{className:"text-xs font-semibold text-indigo-700 dark:text-indigo-400 mb-1",children:"How it works"}),(0,a.jsx)("p",{className:"text-[11px] text-indigo-600/80 dark:text-indigo-400/80",children:"Raw data from scans, campaigns, conversations, SEO, and social posts is automatically ingested. Every 6 hours, AI compiles new raw items into wiki articles with insights and recommendations. Kodee PM reads these articles to give smarter, context-aware answers."})]})]})]})}}}]);
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.