1import{r as i,b as k,j as e,t as C}from"./index-DdU35jPJ.js";import{B as q}from"./button-BfxMpK8P.js";import{I as R}from"./input-cpzcpc5y.js";import{T as F}from"./textarea-RCbb6gBZ.js";import{B as g}from"./badge-O5l_SoDq.js";import{T as H,a as P,b as S,c as A}from"./tabs-BuOmPVeX.js";import{B as Q}from"./book-open-DRLFh2Pr.js";import{F as T}from"./file-text-BIInLmy-.js";import{B as h}from"./bot-CQDJBYgm.js";import{A as z}from"./arrow-right-BdTovHrw.js";import{S as I}from"./search-8uT820HJ.js";import{T as K}from"./tag-CE_kSim7.js";import{M as L}from"./index-B94C6_Mx.js";import{c as U}from"./createLucideIcon-DMxicyrC.js";import{M as Y}from"./message-square-UZdUIYzB.js";import{L as G}from"./loader-circle-B5Ydjp3O.js";import{S as O}from"./send-DYuvBuIV.js";import"./index-gN4drEn4.js";import"./index-Dp3B9jqt.js";import"./clsx-B-dksMZM.js";import"./utils-DCmAa5as.js";import"./bundle-mjs-BTmSotT-.js";import"./index-12QbP6l0.js";import"./index-B144cnSe.js";import"./index-B1Cc5OXO.js";import"./index-9bdZCgcr.js";import"./index-BvvUEucZ.js";import"./index-Bwgqm7vL.js";/** 2 * @license lucide-react v0.475.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const V=[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]],J=U("Code",V);function Ae(){const[m,D]=i.useState([]),[_,$]=i.useState(!0),[c,B]=i.useState(""),[W,X]=i.useState(!1),[f,p]=i.useState([]),[x,u]=i.useState(""),[j,b]=i.useState(!1);i.useEffect(()=>{E()},[]);const E=async()=>{try{const s=await k.entities.DocumentationItem.list();s.sort((r,a)=>(r.display_order||0)-(a.display_order||0)),D(s)}catch(s){console.error(s)}$(!1)},N=async()=>{if(!x.trim()){C.error("Please enter a question");return}b(!0);const s=x,r={role:"user",content:s};p(a=>[...a,r]),u("");try{const o=`You are a helpful assistant for the Truck Haters tire management system. 7 8Here is the complete documentation: 9 10${m.map(n=>`# ${n.title} 11Category: ${n.category} 12 13${n.content}`).join(` 14 15--- 16 17`)} 18 19User question: ${s} 20 21Please provide a clear, accurate answer based on the documentation above. Reference specific sections when relevant.`,l={role:"assistant",content:await k.integrations.Core.InvokeLLM({prompt:o})};p(n=>[...n,l]),b(!1)}catch(a){console.error("AI error:",a),C.error("Failed to get AI response"),b(!1),u(s),p(o=>o.slice(0,-1))}},d=m.filter(s=>{var n,w,v,y;if(!c)return!0;const r=c.toLowerCase(),a=(n=s.title)==null?void 0:n.toLowerCase().includes(r),o=(w=s.content)==null?void 0:w.toLowerCase().includes(r),t=(v=s.tags)==null?void 0:v.some(M=>M.toLowerCase().includes(r)),l=(y=s.category)==null?void 0:y.toLowerCase().includes(r);return a||o||t||l});return _?e.jsx("div",{className:"min-h-screen bg-[#f6f7fb] flex items-center justify-center",children:e.jsx("div",{className:"w-8 h-8 border-2 border-[#0073ea] border-t-transparent rounded-full animate-spin"})}):e.jsx("div",{className:"min-h-screen bg-[#f6f7fb] p-4 lg:p-10",children:e.jsxs("div",{className:"max-w-7xl mx-auto",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-4 mb-4",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-bold mb-2 flex items-center gap-3 text-[#323338]",children:[e.jsx(Q,{className:"w-8 h-8 text-[#0073ea]"}),"System Documentation"]}),e.jsx("p",{className:"text-[#676879]",children:"Comprehensive guide to features, logic, and workflows"})]})}),m.length===0&&e.jsx("div",{className:"bg-[#fdab3d]/10 rounded-xl p-4 border border-[#fdab3d]/20",children:e.jsx("p",{className:"text-[#323338] text-sm",children:`No documentation found. Click "Regenerate Documentation with AI" to automatically generate comprehensive docs from your app's code and entities.`})})]}),e.jsxs(H,{defaultValue:"docs",className:"space-y-6",children:[e.jsxs(P,{className:"bg-[#f6f7fb] border border-[#e6e9ef] p-1 rounded-xl inline-flex gap-1",children:[e.jsxs(S,{value:"docs",className:"data-[state=active]:bg-white data-[state=active]:text-[#323338] data-[state=active]:shadow-sm data-[state=inactive]:bg-transparent data-[state=inactive]:text-[#676879] hover:data-[state=inactive]:text-[#323338] transition-all px-5 py-2.5 rounded-lg font-medium",children:[e.jsx(T,{className:"w-4 h-4 mr-2.5"}),"Documentation"]}),e.jsxs(S,{value:"ai",className:"data-[state=active]:bg-white data-[state=active]:text-[#323338] data-[state=active]:shadow-sm data-[state=inactive]:bg-transparent data-[state=inactive]:text-[#676879] hover:data-[state=inactive]:text-[#323338] transition-all px-5 py-2.5 rounded-lg font-medium",children:[e.jsx(h,{className:"w-4 h-4 mr-2.5"}),"AI Assistant"]})]}),e.jsxs(A,{value:"docs",className:"space-y-6",children:[d.length>0&&c===""&&e.jsxs("div",{className:"bg-white rounded-2xl border border-[#e6e9ef] p-6 shadow-sm",children:[e.jsxs("h3",{className:"text-[#323338] text-lg font-bold mb-4 flex items-center gap-2",children:[e.jsx(T,{className:"w-5 h-5 text-[#0073ea]"}),"Quick Navigation"]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:m.map((s,r)=>e.jsxs("a",{href:`#doc-${r}`,className:"flex items-center gap-2 p-3 rounded-lg bg-[#f6f7fb] hover:bg-white border border-[#e6e9ef] hover:border-[#0073ea] hover:shadow-sm transition-all group",children:[e.jsx(z,{className:"w-4 h-4 text-[#0073ea] group-hover:translate-x-1 transition-transform"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-[#323338] text-sm font-medium truncate",children:s.title}),e.jsx("p",{className:"text-[#676879] text-xs",children:s.category})]})]},s.id))})]}),e.jsxs("div",{className:"relative w-full",children:[e.jsx(I,{className:"absolute left-5 top-1/2 -translate-y-1/2 w-6 h-6 text-[#676879]"}),e.jsx(R,{placeholder:"Search across all documentation - try searching for features, workflows, entities, or any keyword...",value:c,onChange:s=>B(s.target.value),className:"pl-16 pr-6 bg-white border-[#e6e9ef] text-[#323338] h-16 text-lg placeholder:text-[#9699a6] focu
21s:border-[#0073ea] transition-colors rounded-xl shadow-sm"}),c&&e.jsxs("div",{className:"absolute right-5 top-1/2 -translate-y-1/2 text-[#676879] text-sm",children:[d.length," result",d.length!==1?"s":""]})]}),d.length===0?e.jsxs("div",{className:"text-center py-16 bg-white rounded-2xl border border-[#e6e9ef] shadow-sm",children:[e.jsx(I,{className:"w-12 h-12 text-[#9699a6] mx-auto mb-4"}),e.jsx("p",{className:"text-[#323338] font-medium",children:"No documentation found"}),e.jsx("p",{className:"text-[#676879] text-sm",children:"Try adjusting your search or filters"})]}):e.jsx("div",{className:"space-y-4",children:d.map((s,r)=>{var a,o;return e.jsxs("div",{id:`doc-${r}`,className:"bg-white rounded-2xl border border-[#e6e9ef] p-6 scroll-mt-24 shadow-sm",children:[e.jsx("div",{className:"flex items-start justify-between mb-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-[#323338] text-xl font-bold mb-2",children:s.title}),e.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[e.jsx(g,{className:"bg-[#0073ea]/10 text-[#0073ea] border-0",children:s.category}),(a=s.tags)==null?void 0:a.map((t,l)=>e.jsxs(g,{variant:"outline",className:"border-[#e6e9ef] text-[#676879]",children:[e.jsx(K,{className:"w-3 h-3 mr-1"}),t]},l))]})]})}),e.jsx("div",{className:"prose prose-sm max-w-none",children:e.jsx(L,{components:{h1:({children:t})=>e.jsx("h1",{className:"text-2xl font-bold text-[#323338] mt-6 mb-3",children:t}),h2:({children:t})=>e.jsx("h2",{className:"text-xl font-bold text-[#323338] mt-5 mb-2",children:t}),h3:({children:t})=>e.jsx("h3",{className:"text-lg font-semibold text-[#323338] mt-4 mb-2",children:t}),p:({children:t})=>e.jsx("p",{className:"text-[#676879] my-2 leading-relaxed",children:t}),ul:({children:t})=>e.jsx("ul",{className:"list-disc text-[#676879] my-3 space-y-1.5 ml-6",children:t}),ol:({children:t})=>e.jsx("ol",{className:"list-decimal text-[#676879] my-3 space-y-1.5 ml-6",children:t}),li:({children:t})=>e.jsx("li",{className:"text-[#676879] leading-relaxed pl-2",children:t}),code:({inline:t,children:l})=>t?e.jsx("code",{className:"bg-[#f6f7fb] text-[#0073ea] px-1.5 py-0.5 rounded text-sm font-mono border border-[#e6e9ef]",children:l}):e.jsx("code",{className:"block bg-[#323338] text-[#d0d4e4] p-4 rounded-lg my-3 text-sm overflow-x-auto font-mono leading-relaxed border border-[#e6e9ef]",children:l}),strong:({children:t})=>e.jsx("strong",{className:"text-[#323338] font-semibold",children:t}),em:({children:t})=>e.jsx("em",{className:"text-[#676879] italic",children:t})},children:s.content})}),((o=s.code_references)==null?void 0:o.length)>0&&e.jsxs("div",{className:"mt-4 pt-4 border-t border-[#e6e9ef]",children:[e.jsxs("p",{className:"text-[#676879] text-xs uppercase tracking-wider mb-2 flex items-center gap-2",children:[e.jsx(J,{className:"w-3 h-3"}),"Code References"]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:s.code_references.map((t,l)=>e.jsx(g,{variant:"outline",className:"border-[#e6e9ef] text-[#676879] text-xs",children:t},l))})]}),s.last_updated_by_ai&&e.jsxs("p",{className:"text-[#9699a6] text-xs mt-3",children:["Last updated by AI: ",new Date(s.last_updated_by_ai).toLocaleDateString()]})]},s.id)})})]}),e.jsxs(A,{value:"ai",className:"space-y-6",children:[e.jsx("div",{className:"bg-gradient-to-r from-[#a25ddc]/10 to-[#0073ea]/10 rounded-xl p-4 border border-[#a25ddc]/20",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(h,{className:"w-6 h-6 text-[#a25ddc] mt-1"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-[#323338] font-semibold mb-1",children:"Documentation AI Assistant"}),e.jsx("p",{className:"text-[#676879] text-sm",children:"Ask me anything about the app's features, logic, and workflows. I'll search through all documentation to provide accurate answers."})]})]})}),e.jsxs("div",{className:"bg-white rounded-2xl border border-[#e6e9ef] overflow-hidden shadow-sm",children:[e.jsxs("div",{className:"h-[500px] overflow-y-auto p-6 space-y-4 bg-[#f6f7fb]",children:[!f||f.length===0?e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Y,{className:"w-12 h-12 text-[#9699a6] mx-auto mb-3"}),e.jsx("p",{className:"text-[#323338]",children:"Start a conversation by asking a question below"}),e.jsx("p",{className:"text-[#676879] text-sm mt-2",children:'Example: "How does the credit system work?" or "Explain the order workflow"'})]})}):(f||[]).map((s,r)=>e.jsxs("div",{className:`flex gap-3 ${s.role==="user"?"justify-end":"justify-start"}`,children:[s.role==="assistant"&&e.jsx("div",{className:"w-8 h-8 rounded-full bg-[#a25ddc]/10 flex items-center justify-center shrink-0",children:e.jsx(h,{className:"w-4 h-4 text-[#a25ddc]"})}),e.jsx("div",{className:`max-w-[80%] rounded-2xl px-4 py-3 ${s.role==="user"?"bg-[#0073ea] text-white":"bg-white text-[#323338] border border-[#e6e9ef]"}`,children:e.jsx(L,{components:{p:({children:a})=>e.jsx("p",{className:"leading-relaxed",children:a}),ul:({children:a})=>e.jsx("ul",{className:"list-disc list-inside my-2 space-y-1",children:a}),ol:({children:a})=>e.jsx("ol",{className:"list-decimal list-inside my-2 space-y-1",children:a}),code:({inline:a,children:o})=>a?e.jsx("code",{className:"bg-[#f6f7fb] text-[#0073ea] px-1 py-0.5 rounded text-xs border border-[#e6e9ef]",children:o}):e.jsx("code",{className:"block bg-[#323338] text-[#d0d4e4] p-2 rounded my-2 text-xs",children:o})},children:s.content})}),s.role==="user"&&e.jsx("div",{className:"w-8 h-8 rounded-full bg-[#0073ea]/10 flex items-center justify-center shrink-0",children:e.jsx("span",{className:"text-[#0073ea] text-sm font-medium",children:"You"})})]},r)),j&&e.jsxs("div",{className:"flex gap-3 justify-start",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-[#a25ddc]/10 flex items-center justify-center shrink-0",children:e.jsx(h,{className:"w-4 h-4 text-[#a25ddc]"})}),e.jsx("div",{className:"bg-white border border-[#e6e9ef] rounded-2xl px-4 py-3",children:e.jsx(G,{className:"w-4 h-4 text-[#a25ddc] animate-spin"})})]})]}),e.jsxs("div",{className:"border-t border-[#e6e9ef] p-4 bg-white",children:[e.jsxs("div",{className:"flex gap-3",children:[e.jsx(F,{placeholder:"Ask me anything about the app...",value:x,onChange:s=>u(s.target.value),onKeyDown:s=>{s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),N())},className:"bg-white border-[#e6e9ef] text-[#323338] resize-none",rows:2}),e.jsx(q,{onClick:N,disabled:!x.trim()||j,className:"bg-[#a25ddc] hover:bg-[#8b4bc4] shrink-0",children:e.jsx(O,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-[#9699a6] text-xs mt-2",children:"Press Enter to send, Shift+Enter for new line"})]})]})]})]})]})})}export{Ae as default};
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.