1import{b as T,r as d,j as e,L as j}from"./main-XOGYdBKJ.js";import{i as H}from"./markdown-interactive-e-Kzm-7q.js";function A(){const{doc:t,markdown:r,headings:s,toc:l,rawMarkdown:o}=T.useLoaderData(),[n,c]=d.useState(""),[M,k]=d.useState(!1),[w,u]=d.useState(!1),[f,g]=d.useState(!1),L=async()=>{try{await navigator.clipboard.writeText(o),k(!0),setTimeout(()=>k(!1),2e3)}catch(a){console.error("Failed to copy markdown:",a)}};return d.useEffect(()=>{!t.imports||t.imports.length===0||t.imports.forEach(a=>{import(a).catch(x=>{console.error(`Failed to load web component from ${a}:`,x)})})},[t.imports]),d.useEffect(()=>{H()},[]),d.useEffect(()=>{if(s.length===0)return;const a=()=>{const m=s.map(h=>({id:h.id,el:document.getElementById(h.id)})).filter(h=>h.el!==null);if(m.length===0)return;const b=window.innerHeight,p=100;let v=m[0].id;for(const{id:h,el:C}of m)if(C.getBoundingClientRect().top<=p+b*.3)v=h;else break;c(v)};a();let x=!1;const i=()=>{x||(requestAnimationFrame(()=>{a(),x=!1}),x=!0)};return window.addEventListener("scroll",i,{passive:!0}),()=>window.removeEventListener("scroll",i)},[s]),e.jsxs("main",{className:"bg-white text-slate-900",children:[e.jsxs("div",{className:"sticky top-[62px] z-30 flex items-center justify-between border-b border-slate-200 bg-white px-4 py-2 lg:hidden",children:[e.jsxs("button",{type:"button",onClick:()=>{u(!w),g(!1)},className:"flex items-center gap-2 text-sm font-medium text-slate-600 hover:text-slate-900",children:[e.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h16M4 18h16"})}),"Menu"]}),e.jsxs("button",{type:"button",onClick:()=>{g(!f),u(!1)},className:"flex items-center gap-1 text-sm font-medium text-slate-600 hover:text-slate-900",children:["On this page",e.jsx("svg",{className:`h-4 w-4 transition-transform ${f?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]})]}),w&&e.jsx("div",{className:"fixed left-0 right-0 bottom-0 top-[106px] z-50 bg-white lg:hidden overflow-y-auto",children:e.jsx("div",{className:"px-4 pb-8 pt-4",children:e.jsx(N,{sections:l,currentSlug:t.slug,onNavigate:()=>u(!1)})})}),f&&e.jsx("div",{className:"fixed left-0 right-0 bottom-0 top-[106px] z-50 bg-white lg:hidden overflow-y-auto",children:e.jsx("div",{className:"px-4 pb-8 pt-4",children:e.jsx(S,{headings:s,activeId:n,onClose:()=>g(!1)})})}),e.jsx("div",{className:"bg-white",children:e.jsx("div",{className:"mx-auto max-w-7xl px-4 sm:px-6",children:e.jsxs("div",{className:"flex gap-6",children:[e.jsx("aside",{className:"sticky top-[97px] hidden h-[calc(100vh-97px)] w-56 shrink-0 lg:block",children:e.jsx("div",{className:"h-full overflow-y-auto pb-8 pr-2 pt-4",children:e.jsx(N,{sections:l,currentSlug:t.slug})})}),e.jsxs("section",{className:"min-w-0 flex-1 pb-16 min-h-[calc(100vh-97px)]",children:[(()=>{const a=e.jsx("button",{type:"button",onClick:L,className:"inline-flex h-10 shrink-0 items-center gap-2 rounded-md border border-slate-200 bg-white px-4 text-sm font-medium text-slate-600 transition-colors hover:border-slate-300 hover:bg-slate-50 hover:text-slate-900",children:M?e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"h-4 w-4 text-green-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"Copied!"]}):e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),"Copy markdown"]})});if(/^<h1[\s>]/i.test(r.trim())){const i=r.match(/^(<h1[^>]*>.*?<\/h1>)/is),m=i?i[1]:"",b=i?r.slice(i[0].length):r;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 pt-4",children:[e.jsx("div",{className:"marketplace-markdown flex-1 min-w-0 [&>h1]:!mt-0 [&>h1]:!pt-0",dangerouslySetInnerHTML:{__html:m}}),a]}),e.jsx("div",{className:"marketplace-markdown pb-2.5",onMouseDown:p=>{p.target.closest("a")?.getAttribute("href")?.startsWith("#")&&p.preventDefault()},dangerouslySetInnerHTML:{__html:b}})]})}return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-end pt-4 pb-2",children:a}),e.jsx("div",{className:"marketplace-markdown pb-2.5",onMouseDown:i=>{i.target.closest("a")?.getAttribute("href")?.startsWith("#")&&i.preventDefault()},dangerouslySetInnerHTML:{__html:r}}
1)]})})(),t.path&&e.jsx("div",{className:"mt-12",children:e.jsxs("a",{href:O(t.path),target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-2 text-sm text-slate-500 hover:text-slate-700",children:[e.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})}),"Edit this page on GitHub"]})}),e.jsx(I,{sections:l,currentSlug:t.slug})]}),e.jsx("aside",{className:"sticky top-[97px] hidden h-[calc(100vh-97px)] w-56 flex-shrink-0 xl:block",children:e.jsx("div",{className:"h-full overflow-y-auto pb-8 pl-2 pt-4",children:e.jsx(E,{headings:s,activeId:n})})})]})})})]})}function N({sections:t,currentSlug:r,onNavigate:s}){return e.jsx("div",{children:e.jsx("div",{className:"flex flex-col gap-1 text-sm text-slate-700",children:t.map((l,o)=>e.jsxs("div",{className:o===0?"pt-4":"pt-8",children:[e.jsx("p",{className:"px-3 pb-2 text-xs font-semibold uppercase tracking-wide text-slate-400",children:l.title}),e.jsx("div",{className:"flex flex-col gap-1",children:l.pages.map(n=>{const c=n.slug===r;return e.jsx(j,{to:"/docs/$slug",params:{slug:n.slug},className:`rounded-md px-3 py-2 text-sm transition-colors ${c?"bg-slate-200 font-semibold text-slate-900":"text-slate-600 hover:bg-slate-100 hover:text-slate-900"}`,onClick:s,children:n.title??n.slug},n.slug)})})]},l.title))})})}function E({headings:t,activeId:r}){return t.length===0?null:e.jsxs("div",{className:"text-sm text-slate-700",children:[e.jsx("p",{className:"pb-2 text-xs font-semibold uppercase tracking-wide text-slate-400",children:"On this page"}),e.jsx("div",{className:"flex flex-col",children:t.map(s=>{const l=s.id===r,o=s.level===3?"pl-3":s.level===2?"pl-1":"";return e.jsx("button",{type:"button",className:`text-left text-sm py-1 border-l-2 pl-3 transition-colors ${o} ${l?"border-blue-500 text-slate-900 font-medium":"border-transparent text-slate-500 hover:text-slate-900 hover:border-slate-300"}`,onClick:()=>y(s.id),children:s.text},s.id)})})]})}function S({headings:t,activeId:r,onClose:s}){return t.length===0?null:e.jsxs("div",{className:"text-sm text-slate-700",children:[e.jsx("p",{className:"pb-2 text-xs font-semibold uppercase tracking-wide text-slate-400",children:"On this page"}),e.jsx("div",{className:"flex flex-col",children:t.map(l=>{const o=l.id===r,n=l.level===3?"pl-3":l.level===2?"pl-1":"";return e.jsx("button",{type:"button",className:`text-left text-sm py-2 border-l-2 pl-3 transition-colors ${n} ${o?"border-blue-500 text-slate-900 font-medium":"border-transparent text-slate-500 hover:text-slate-900 hover:border-slate-300"}`,onClick:()=>{y(l.id),s()},children:l.text},l.id)})})]})}function I({sections:t,currentSlug:r}){const s=t.flatMap(c=>c.pages),l=s.findIndex(c=>c.slug===r);if(l===-1||s.length<=1)return null;const o=l>0?s[l-1]:null,n=l<s.length-1?s[l+1]:null;return!o&&!n?null:e.jsxs("nav",{className:"mt-8 grid grid-cols-2 gap-4 border-t border-slate-200 pt-8",children:[e.jsx("div",{children:o&&e.jsxs(j,{to:"/docs/$slug",params:{slug:o.slug},className:"group block rounded-xl border border-slate-200 p-4 hover:border-slate-300 transition-colors",children:[e.jsx("span",{className:"text-sm text-slate-400",children:"Previous"}),e.jsx("span",{className:"mt-1 block font-medium text-[#3451b2] group-hover:text-[#3a5ccc]",children:o.title??o.slug})]})}),e.jsx("div",{children:n&&e.jsxs(j,{to:"/docs/$slug",params:{slug:n.slug},className:"group block rounded-xl border border-slate-200 p-4 hover:border-slate-300 transition-colors text-right",children:[e.jsx("span",{className:"text-sm text-slate-400",children:"Next"}),e.jsx("span",{className:"mt-1 block font-medium text-[#3451b2] group-hover:text-[#3a5ccc]",children:n.title??n.slug})]})})]})}function y(t){const r=document.getElementById(t);r&&window&&window.scrollTo({top:r.offsetTop-120,behavior:"smooth"})}function O(t){return`https://github.com/opral/inlang/blob/main/docs/${t.replace(/^[./]+/,"")}`}export{A as component};
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.