docstra 1.9.9-next.3 → 1.9.9-next.4

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.
@@ -1 +1 @@
1
- "use strict";"use client";var Xe=Object.create;var q=Object.defineProperty,Ze=Object.defineProperties,Je=Object.getOwnPropertyDescriptor,je=Object.getOwnPropertyDescriptors,et=Object.getOwnPropertyNames,ge=Object.getOwnPropertySymbols,tt=Object.getPrototypeOf,he=Object.prototype.hasOwnProperty,rt=Object.prototype.propertyIsEnumerable;var be=(e,r,t)=>r in e?q(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,ne=(e,r)=>{for(var t in r||(r={}))he.call(r,t)&&be(e,t,r[t]);if(ge)for(var t of ge(r))rt.call(r,t)&&be(e,t,r[t]);return e},xe=(e,r)=>Ze(e,je(r));var ot=(e,r)=>{for(var t in r)q(e,t,{get:r[t],enumerable:!0})},ye=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of et(r))!he.call(e,a)&&a!==t&&q(e,a,{get:()=>r[a],enumerable:!(o=Je(r,a))||o.enumerable});return e};var z=(e,r,t)=>(t=e!=null?Xe(tt(e)):{},ye(r||!e||!e.__esModule?q(t,"default",{value:e,enumerable:!0}):t,e)),at=e=>ye(q({},"__esModule",{value:!0}),e);var pt={};ot(pt,{DocstraBody:()=>mt,DocstraCodeBlock:()=>dt,DocstraHeader:()=>se,DocstraLayout:()=>ct,DocstraProvider:()=>nt,useDocstra:()=>x});module.exports=at(pt);var E=require("react"),De=require("react-toast-msg");var Ne=require("lucide-react");var ve=require("tailwind-merge"),we=z(require("clsx"));function y(...e){return(0,ve.twMerge)((0,we.default)(e))}var P=require("react"),ke=z(require("fuse.js")),Se=z(require("next/link")),Ie=require("next/navigation"),v=require("react/jsx-runtime");function Ce(){let{openSearchBox:e,setOpenSearchBox:r,page:t}=x(),[o,a]=(0,P.useState)(""),[n,l]=(0,P.useState)([]),m=(0,Ie.useRouter)();(0,P.useEffect)(()=>{let i=c=>{c.ctrlKey&&c.key==="k"&&(c.preventDefault(),r(!0))};return window.addEventListener("keydown",i),()=>{window.removeEventListener("keydown",i)}},[]);let s=(0,P.useMemo)(()=>!t||t.length===0?null:new ke.default(t,{keys:["data.metadata.title","data.metadata.description"],threshold:.3}),[t]);(0,P.useEffect)(()=>{if(o&&s){let i=s.search(o);l(i.map(c=>c.item))}else o||l([])},[o,s]);let u=i=>{if(i.preventDefault(),o){let c=n[0];c&&(m.push(`/docs/${c.slug}`),a(""),r(!1))}};return(0,P.useEffect)(()=>{let i=c=>{c.key==="Escape"&&(r(!1),a(""))};return e&&window.addEventListener("keydown",i),()=>{window.removeEventListener("keydown",i)}},[e]),(0,v.jsx)("div",{onClick:()=>{r(!1),a("")},className:y("fixed inset-0 z-25 flex items-start justify-center bg-white/40 backdrop-blur-md opacity-0 pointer-events-none transition-all duration-300",e&&"opacity-100 pointer-events-auto"),children:(0,v.jsxs)("div",{onClick:i=>i.stopPropagation(),className:"flex flex-col items-center mt-30 max-w-lg w-full max-md:px-4",children:[(0,v.jsx)("form",{onSubmit:u,className:y("relative flex items-center justify-between w-full bg-white border border-slate-200 text-gray-400 h-15 p-0.5 rounded-md",o&&"rounded-b-none border-b-0"),children:e&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(Ne.SearchIcon,{className:"size-5.5 mx-3 shrink-0"}),(0,v.jsx)("input",{className:"w-full bg-transparent h-full outline-none text-gray-400 placeholder:text-gray-400",type:"text",placeholder:"Search docs...",spellCheck:"false",autoFocus:!0,value:o,onChange:i=>a(i.target.value),name:"searchQuery",required:!0}),(0,v.jsx)("span",{className:"border border-gray-200 px-2 mr-3 py-1 rounded text-xs",children:"Esc"})]})}),(0,v.jsxs)("div",{className:y("max-h-70 overflow-x-hidden overflow-y-auto scrollbar-y w-full bg-white text-slate-700 flex flex-col",o&&"rounded-b-md border border-slate-200"),children:[n.map(i=>{var c,N,f,k;return(0,v.jsxs)(Se.default,{href:`/docs/${i.slug==="index"?"":i.slug}`,onClick:()=>{r(!1),a("")},className:"w-full hover:bg-gray-100/70 border-b border-slate-200 transition-all py-4 px-4 last:mb-2",children:[(0,v.jsx)("h4",{className:"font-medium",children:((N=(c=i.data)==null?void 0:c.metadata)==null?void 0:N.title)||i.slug}),(0,v.jsx)("p",{className:"text-sm mt-1 text-gray-500",children:(k=(f=i.data)==null?void 0:f.metadata)==null?void 0:k.description})]},i.slug)}),o&&n.length===0&&(0,v.jsx)("div",{className:"text-gray-500 text-center py-20",children:"No results found"})]})]})})}var K=require("react/jsx-runtime"),Le=(0,E.createContext)(null);function nt({children:e,docstraConfig:r,page:t,sidebarItems:o}){let[a,n]=(0,E.useState)(!1),[l,m]=(0,E.useState)(!1),[s,u]=(0,E.useState)("npm");return(0,K.jsxs)(Le.Provider,{value:{openSidebar:a,setOpenSidebar:n,docstraConfig:r,openSearchBox:l,setOpenSearchBox:m,packageManager:s,setPackageManager:u,sidebarItems:o,page:t},children:[(0,K.jsx)(De.ToastContainer,{}),(0,K.jsx)(Ce,{}),e]})}function x(){let e=(0,E.useContext)(Le);if(!e)throw new Error("Please wrap your app with DocstraProvider");return e}var X=require("lucide-react"),Oe=require("react");var W=z(require("next/link")),C=require("react/jsx-runtime");function se(){var a,n,l,m,s,u,i,c,N,f,k,G;let{openSidebar:e,setOpenSidebar:r,docstraConfig:t}=x(),o="https://github.com/"+((a=t==null?void 0:t.editOnGithub)==null?void 0:a.owner)+"/"+((n=t==null?void 0:t.editOnGithub)==null?void 0:n.repo);return(0,Oe.useEffect)(()=>{e?document.body.classList.add("max-md:overflow-hidden"):document.body.classList.remove("max-md:overflow-hidden")},[e]),(0,C.jsxs)("header",{className:"fixed w-full top-0 z-10 text-sm flex items-center justify-between border-b border-gray-100 h-18 px-4 md:px-6 bg-white",children:[(0,C.jsx)(W.default,{href:((m=(l=t.navbar)==null?void 0:l.logo)==null?void 0:m.link)||"/",className:"hover:opacity-80 transition",children:(0,C.jsx)("img",{src:((u=(s=t.navbar)==null?void 0:s.logo)==null?void 0:u.src)||"/logo.png",alt:((c=(i=t.navbar)==null?void 0:i.logo)==null?void 0:c.alt)||"Logo",className:y("h-9.5 w-auto",(f=(N=t.navbar)==null?void 0:N.logo)==null?void 0:f.className)})}),(0,C.jsxs)("div",{className:"hidden divide-x divide-gray-200 md:flex items-center",children:[(G=(k=t.navbar)==null?void 0:k.links)==null?void 0:G.map(R=>(0,C.jsx)(W.default,{href:R.href,className:"px-6 hover:text-gray-600",children:R.name},R.name)),(0,C.jsx)(W.default,{href:o||"https://github.com/sudhucodes/docstra",children:(0,C.jsx)("svg",{className:"size-6 mx-6",width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:(0,C.jsx)("path",{d:"M12 .3a12 12 0 0 0-3.8 23.38c.6.12.83-.26.83-.57L9 21.07c-3.34.72-4.04-1.61-4.04-1.61-.55-1.39-1.34-1.76-1.34-1.76-1.08-.74.09-.73.09-.73 1.2.09 1.83 1.24 1.83 1.24 1.08 1.83 2.81 1.3 3.5 1 .1-.78.42-1.31.76-1.61-2.67-.3-5.47-1.33-5.47-5.93 0-1.31.47-2.38 1.24-3.22-.14-.3-.54-1.52.1-3.18 0 0 1-.32 3.3 1.23a11.5 11.5 0 0 1 6 0c2.28-1.55 3.29-1.23 3.29-1.23.64 1.66.24 2.88.12 3.18a4.65 4.65 0 0 1 1.23 3.22c0 4.61-2.8 5.63-5.48 5.92.42.36.81 1.1.81 2.22l-.01 3.29c0 .31.2.69.82.57A12 12 0 0 0 12 .3"})})})]}),(0,C.jsx)("button",{onClick:()=>r(!e),className:"md:hidden transition text-gray-600 active:ring-2 ring-gray-200 p-1.5 rounded-md",children:e?(0,C.jsx)(X.XIcon,{className:"size-6.5"}):(0,C.jsx)(X.TextAlignEnd,{className:"size-6.5"})})]})}var J=require("lucide-react"),Pe=require("next/navigation");var st=z(require("lucide-react"));function ie(e){if(e)return st[e]}var le=z(require("next/link")),Z=require("react"),d=require("react/jsx-runtime");function it({item:e,pathname:r,openSidebar:t,setOpenSidebar:o}){var s,u;let[a,n]=(0,Z.useState)((s=e.defaultOpen)!=null?s:!0),l=(u=e.collapsible)!=null?u:!0,m=ie(e.icon);return(0,d.jsxs)("div",{children:[(0,d.jsxs)(le.default,{href:e.href,onClick:()=>l&&n(i=>!i),className:"w-full flex items-center justify-between gap-2 text-gray-500 hover:bg-gray-100 py-2 px-2.5 rounded-lg",children:[(0,d.jsxs)("span",{className:"flex items-center gap-2",children:[m&&(0,d.jsx)(m,{className:"size-4 text-gray-400"}),e.title]}),l&&(0,d.jsx)(J.ChevronDownIcon,{className:y("size-4 text-black/50 transition-transform duration-300",a&&"rotate-180")})]}),(!l||a)&&(0,d.jsx)("ul",{className:"mb-4 ml-2",children:e.children.map((i,c)=>(0,d.jsx)(Re,{item:i,pathname:r,openSidebar:t,setOpenSidebar:o},`${i.type}-${c}`))})]})}function lt({item:e,pathname:r,openSidebar:t,setOpenSidebar:o}){let a=ie(e.icon);return(0,d.jsxs)(le.default,{href:e.href,onClick:()=>t&&o(!1),className:y("flex items-center gap-2 text-gray-500 hover:bg-gray-100 py-2 px-2.5 rounded-lg",r===e.href&&"bg-gray-100 text-gray-800"),children:[a&&(0,d.jsx)(a,{className:"size-4"}),(0,d.jsx)("span",{children:e.title})]})}function Re({item:e,pathname:r,openSidebar:t,setOpenSidebar:o}){switch(e.type){case"page":return(0,d.jsx)(lt,{item:e,pathname:r,openSidebar:t,setOpenSidebar:o});case"section":return(0,d.jsx)(it,{item:e,pathname:r,openSidebar:t,setOpenSidebar:o});default:return null}}function Te({sidebarItems:e}){let[r,t]=(0,Z.useState)(!1),[o,a]=(0,Z.useState)(!1),n=(0,Pe.usePathname)();return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:y("fixed inset-0 z-20 bg-black/50 opacity-0 pointer-events-none transition-all duration-300",r&&"opacity-100 pointer-events-auto"),onClick:()=>t(!1)}),(0,d.jsxs)("aside",{className:y("fixed md:top-18 h-[calc(100svh-72px)] scrollbar-y w-screen max-md:rounded-t-lg z-21 md:w-72 pb-10 text-base md:text-sm shrink-0 border-r border-gray-200 p-4 max-md:fixed bg-white overflow-y-auto transition-all duration-300",r?"top-32":"top-full"),children:[(0,d.jsxs)("div",{className:"flex items-center select-none gap-2 cursor-pointer mt-6 mb-4 p-2.5 text-gray-500 border border-gray-200 rounded-lg hover:bg-gray-50",onClick:()=>{t(r&&!1),a(!0)},children:[(0,d.jsx)(J.SearchIcon,{className:"size-4.5"}),(0,d.jsx)("p",{children:"Search"}),(0,d.jsxs)("div",{className:"ms-auto font-mono inline-flex gap-0.5",children:[(0,d.jsx)("span",{className:"rounded-md border border-gray-200 px-1.5",children:"Ctrl"}),(0,d.jsx)("span",{className:"rounded-md border border-gray-200 px-1.5",children:"K"})]})]}),e.map((l,m)=>(0,d.jsx)(Re,{item:l,pathname:n,openSidebar:r,setOpenSidebar:t},`${l.type}-${m}`))]})]})}var j=require("react/jsx-runtime");function ct({children:e,sidebarItems:r}){return(0,j.jsxs)("div",{className:"min-h-screen flex bg-white w-full",children:[(0,j.jsx)(Te,{sidebarItems:r}),e]})}var ze=require("next/navigation"),Ee=require("lucide-react"),ce=z(require("next/link")),O=require("react/jsx-runtime");function Be(){let r=(0,ze.usePathname)().split("/").filter(Boolean),t=r.map((o,a)=>{let n="/"+r.slice(0,a+1).join("/"),l=o.replace(/-/g," ").replace(/\b\w/g,m=>m.toUpperCase());return{href:n,title:l}});return(0,O.jsx)("nav",{"aria-label":"Breadcrumb",className:"flex text-sm items-center pb-4 text-gray-500 not-prose",children:(0,O.jsxs)("ol",{className:"flex items-center space-x-2",children:[(0,O.jsx)("li",{children:(0,O.jsx)(ce.default,{href:"/",className:"hover:text-gray-700 transition-colors font-medium",children:"Home"})}),t.map((o,a)=>{let n=a===t.length-1;return(0,O.jsxs)("li",{className:"flex items-center space-x-2",children:[(0,O.jsx)(Ee.ChevronRight,{className:"w-4 h-4 text-gray-400"}),n?(0,O.jsx)("span",{className:"text-gray-600 font-medium",children:o.title}):(0,O.jsx)(ce.default,{href:o.href,className:"hover:text-gray-700 font-medium transition-colors",children:o.title})]},o.href)})]})})}var U=require("lucide-react"),Me=require("next/navigation"),I=require("react");var S=require("react/jsx-runtime");function Ge(){var Q,_,H;let[e,r]=(0,I.useState)(null),[t,o]=(0,I.useState)("down"),[a,n]=(0,I.useState)(!1),[l,m]=(0,I.useState)(!1),{docstraConfig:s,page:u}=x(),i=u==null?void 0:u.path,c=(u==null?void 0:u.tableOfContents)||[],N=(0,I.useRef)(0),f=(0,I.useRef)(null),k=(0,Me.usePathname)(),R=`${"https://github.com/"+((Q=s==null?void 0:s.editOnGithub)==null?void 0:Q.owner)+"/"+((_=s==null?void 0:s.editOnGithub)==null?void 0:_.repo)}/edit/main/${(H=s==null?void 0:s.editOnGithub)==null?void 0:H.path}/${i}`;(0,I.useEffect)(()=>{let g=()=>{let h=window.scrollY;o(h>N.current?"down":"up"),n(h>100),N.current=h};return window.addEventListener("scroll",g),()=>window.removeEventListener("scroll",g)},[]),(0,I.useEffect)(()=>{let g=document.querySelectorAll("h2[id], h3[id]"),h=new IntersectionObserver(T=>{if(l)return;let B=T.filter(F=>F.isIntersecting).sort((F,We)=>F.boundingClientRect.top-We.boundingClientRect.top);if(B.length>0){let F=t==="down"?B[0].target.id:B[B.length-1].target.id;r(F)}},{rootMargin:"-40% 0px -50% 0px",threshold:[0,.2,.6,1]});return g.forEach(T=>h.observe(T)),f.current=h,()=>h.disconnect()},[k,t,l]),(0,I.useEffect)(()=>{var h;!(window.scrollY>100)&&r((h=c[0])==null?void 0:h.id)},[c]),(0,I.useEffect)(()=>{if(!e)return;let g=document.querySelector(".toc-scroll-container");if(!g)return;let h=g.querySelector(`a[href="#${e}"]`);if(!h)return;let T=g.getBoundingClientRect(),B=h.getBoundingClientRect();(B.top<T.top||B.bottom>T.bottom)&&h.scrollIntoView({behavior:"smooth",block:"nearest"})},[e]),(0,I.useEffect)(()=>{if(!l)return;let g=setTimeout(()=>m(!1),800);return()=>clearTimeout(g)},[l]);let L=g=>{r(g),m(!0)};return(0,S.jsxs)("aside",{className:"sticky top-18 text-sm hidden xl:block text-gray-500 shrink-0 h-[calc(100svh-72px)] w-64 border-l border-gray-200 p-6 overflow-y-auto",children:[(0,S.jsxs)("p",{className:"flex items-center gap-2 mb-5",children:[(0,S.jsx)(U.TextAlignStartIcon,{className:"size-4"}),"On this page"]}),(0,S.jsx)("ul",{className:"toc-scroll-container max-h-3/4 overflow-y-auto scrollbar-none",children:c.map(g=>(0,S.jsxs)("li",{children:[(0,S.jsx)($e,{heading:g,activeId:e,handleClick:L}),g.children.map(h=>(0,S.jsx)($e,{heading:h,activeId:e,handleClick:L,className:"pl-8"},h.id))]},g.id))}),(0,S.jsx)("hr",{className:"my-6 border-gray-200"}),s.editOnGithub&&(0,S.jsxs)("a",{href:R,rel:"noopener noreferrer",className:"flex items-center gap-2 text-gray-400 hover:text-gray-700 transition",children:["Edit this page on GitHub",(0,S.jsx)(U.SquareArrowOutUpRightIcon,{className:"size-4"})]}),a&&(0,S.jsxs)("button",{onClick:()=>scrollTo({top:0,behavior:"smooth"}),className:"flex items-center cursor-pointer gap-2 mt-3 text-gray-400 hover:text-gray-700 transition",children:["Scroll to top",(0,S.jsx)(U.ArrowUpCircleIcon,{className:"size-4"})]})]})}function $e({heading:e,activeId:r,handleClick:t,className:o}){return(0,S.jsx)("a",{href:`#${e.id}`,className:y("border-l border-gray-200 block py-1.5 pl-4 transition-colors",o,{"border-gray-800 text-gray-900 font-medium":r===e.id,"hover:text-gray-800 hover:border-gray-400":r!==e.id}),onClick:()=>t(e.id),children:e.text})}var V=require("react"),ee=require("lucide-react");var $=require("react/jsx-runtime");function me({label:e,type:r,placeholder:t="",id:o,required:a=!1,onChange:n,value:l,readOnly:m=!1,className:s="",optional:u=!1}){return(0,$.jsxs)("div",{className:y("flex flex-col mt-4 w-full",s),children:[e&&(0,$.jsxs)("label",{htmlFor:o,className:"font-medium w-max cursor-pointer",children:[e,u&&(0,$.jsx)("span",{className:"text-xs font-normal text-gray-400 ml-1 mt-1",children:"(Optional)"})]}),r==="textarea"?(0,$.jsx)("textarea",{id:o,name:o,className:y("mt-2 w-full p-3 border border-gray-300 resize-none not-focus:hover:border-gray-500 read-only:text-gray-400/80 outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition-all duration-200 rounded-lg",s),placeholder:t,required:a,onChange:n,rows:4,value:l,readOnly:m,maxLength:500}):(0,$.jsx)("input",{type:r,id:o,name:o,className:"mt-2 w-full h-12 px-3 border border-gray-300 not-focus:hover:border-gray-500 read-only:text-gray-400/80 outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition-all duration-200 rounded-lg",placeholder:t,required:a,onChange:n,value:l,readOnly:m,maxLength:500})]})}var Fe=require("lucide-react");var de=require("react/jsx-runtime");function pe({label:e,loading:r,type:t="submit",className:o="",disabled:a=!1,onClick:n}){return(0,de.jsx)("button",{type:t,disabled:a,className:y("relative w-full mt-4 h-12 px-6 py-3 cursor-pointer font-medium bg-gray-900 hover:opacity-85 text-white rounded-lg",o),"aria-label":e,onClick:n,children:r?(0,de.jsx)(Fe.Loader2Icon,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 animate-spin mx-auto"}):e})}var te=require("formsync"),p=require("react/jsx-runtime");function Ue(){var i,c,N,f;let[e,r]=(0,V.useState)(null),{docstraConfig:t}=x(),[o,a]=(0,V.useState)(""),[n,l]=(0,V.useState)(!1),[m,s]=(0,V.useState)(null),u="https://github.com/"+((i=t==null?void 0:t.editOnGithub)==null?void 0:i.owner)+"/"+((c=t==null?void 0:t.editOnGithub)==null?void 0:c.repo);return(0,p.jsx)("div",{className:"border-y border-gray-200 mt-10 py-10 space-y-4",children:n?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("p",{className:"font-medium text-gray-900",children:"We appreciate your feedback, Thank you!"}),(0,p.jsx)(pe,{onClick:()=>{l(!1),r(null),a("")},label:"Submit Again",className:"w-max text-sm"})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("p",{className:"font-medium",children:"How is this guide?"}),(0,p.jsxs)("div",{className:"flex gap-2",children:[(0,p.jsxs)("button",{onClick:()=>r("good"),className:`flex items-center cursor-pointer gap-1 px-3 py-2 rounded-full border text-sm ${e==="good"?"bg-green-100 text-green-600 border-green-300":"border-gray-200 text-gray-600 hover:bg-gray-100"}`,children:[(0,p.jsx)(ee.ThumbsUp,{className:`size-4 ${e==="good"?"fill-green-600":"text-gray-500"}`}),"Good"]}),(0,p.jsxs)("button",{onClick:()=>r("bad"),className:`flex items-center cursor-pointer gap-1 px-3 py-2 rounded-full border text-sm ${e==="bad"?"bg-red-100 text-red-600 border-red-300":"border-gray-200 text-gray-600 hover:bg-gray-100"}`,children:[(0,p.jsx)(ee.ThumbsDown,{className:`size-4 pt-0.5 ${e==="bad"?"fill-red-600":"text-gray-500"}`}),"Bad"]})]}),e&&(0,p.jsxs)(te.FormSyncForm,{className:"flex flex-col gap-2",formId:((N=t==null?void 0:t.feedback)==null?void 0:N.formSyncFormID)||"",onSuccess:k=>{l(!0),r(null),a("")},onSubmitError:k=>{s(k.message)},children:[(0,p.jsx)(me,{value:o,id:"message",onChange:k=>a(k.target.value),placeholder:"Leave your feedback...",required:!0,type:"textarea"}),m&&(0,p.jsx)("p",{className:"text-red-500",children:m}),(0,p.jsx)("input",{type:"hidden",name:"opinion",value:e}),(0,p.jsx)("input",{type:"hidden",name:"page",value:window.location.href}),(0,p.jsx)("input",{type:"hidden",name:"_redirect",value:window.location.href}),(0,p.jsx)(te.FormSyncButton,{className:"relative mt-4 h-12 px-6 py-3 cursor-pointer font-medium bg-gray-900 hover:opacity-85 text-white rounded-lg w-max text-sm",children:"Submit"}),((f=t==null?void 0:t.feedback)==null?void 0:f.watermark)!==!1&&(0,p.jsxs)("p",{className:"text-left text-sm text-gray-500 mt-6",children:["Powered by"," ",(0,p.jsx)("a",{href:`https://www.formsync.app?utm_source=${u}`,className:"text-gray-800 not-prose",children:"FormSync"})]})]})]})})}var He=require("react/jsx-runtime");function Ae(){var t;let{pageData:e}=x();if(!((t=e==null?void 0:e.data)!=null&&t.lastUpdated))return null;let r=new Date(e.data.lastUpdated).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",timeZone:"UTC"});return(0,He.jsxs)("p",{className:"text-sm text-gray-500",children:["Last updated on ",r]})}var re=require("lucide-react"),Y=require("react");var M=require("react/jsx-runtime");function qe(){let{pageData:e}=x(),[r,t]=(0,Y.useState)(!1),[o,a]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{a(window.location.href)},[]);let n=`Read from this URL: ${o} and explain it to me.`;return(0,M.jsxs)("div",{className:"flex items-center gap-3 mt-6",children:[(0,M.jsxs)("button",{title:"Copy Markdown",onClick:()=>{navigator.clipboard.writeText((e==null?void 0:e.data.raw)||""),t(!0),setTimeout(()=>t(!1),3e3)},className:"flex items-center cursor-pointer gap-2 bg-gray-50 hover:bg-gray-100 border border-gray-200 px-3 py-2 rounded-md text-xs",children:[r?(0,M.jsx)(re.CheckIcon,{className:"size-3.5"}):(0,M.jsx)(re.CopyIcon,{className:"size-3.5"}),"Copy Markdown"]}),(0,M.jsx)("a",{title:"Ask ChatGPT",href:`https://chatgpt.com/?hints=search&q=${encodeURIComponent(n)}`,className:"flex not-prose items-center gap-2 bg-gray-50 hover:bg-gray-100 border border-gray-200 px-3 py-2 rounded-md text-xs",rel:"noreferrer noopener",children:"Ask ChatGPT"})]})}var Ke=require("next/navigation"),ue=z(require("next/link")),oe=require("lucide-react");var D=require("react/jsx-runtime");function Ve(e){let r=[];for(let t of e)t.type==="page"?r.push({name:t.title,href:t.href,icon:t.icon}):t.type==="section"&&r.push(...Ve(t.children));return r}function Ye(){var m;let e=(0,Ke.usePathname)(),{docstraConfig:r,sidebarItems:t}=x(),o=[];t&&t.length>0?o=Ve(t):(m=r==null?void 0:r.sidebar)!=null&&m.links&&(o=r.sidebar.links.flatMap(s=>s.items));let a=o.findIndex(s=>s.href===e),n=a>0?o[a-1]:null,l=a<o.length-1?o[a+1]:null;return(0,D.jsxs)("div",{className:"flex flex-col lg:flex-row gap-2 justify-between py-10 mt-10",children:[n?(0,D.jsxs)(ue.default,{href:n.href,className:"flex flex-col not-prose items-start gap-2 border border-gray-200 hover:bg-gray-50 py-3 md:min-w-62 pl-4 pr-10 rounded-lg text-sm",children:[(0,D.jsx)("span",{className:"text-gray-500",children:"Previous"}),(0,D.jsxs)("p",{className:"flex items-center font-medium",children:[(0,D.jsx)(oe.ArrowLeftIcon,{className:"size-5 mr-2"}),n.name]})]}):(0,D.jsx)("div",{}),l?(0,D.jsxs)(ue.default,{href:l.href,className:"flex flex-col not-prose items-end gap-2 border border-gray-200 hover:bg-gray-50 py-3 pr-4 md:min-w-62 pl-10 rounded-lg text-sm",children:[(0,D.jsx)("span",{className:"text-gray-500",children:"Next"}),(0,D.jsxs)("p",{className:"flex items-center font-medium",children:[l.name,(0,D.jsx)(oe.ArrowRightIcon,{className:"size-5 ml-2"})]})]}):(0,D.jsx)("div",{})]})}var w=require("react/jsx-runtime");function mt({children:e}){var o,a,n;let{docstraConfig:r,page:t}=x();return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(se,{}),(0,w.jsxs)("main",{className:"flex-1 px-4 md:px-8 md:pl-80 pt-28 py-10 prose max-w-none",children:[(0,w.jsx)(Be,{}),(0,w.jsx)("h1",{className:"text-3xl font-bold",children:(o=t==null?void 0:t.metadata)==null?void 0:o.title}),(0,w.jsx)("p",{className:"my-4 text-gray-500",children:(a=t==null?void 0:t.metadata)==null?void 0:a.description}),(0,w.jsx)(qe,{}),(0,w.jsx)("hr",{className:"my-10 border-gray-200"}),e,((n=r==null?void 0:r.feedback)==null?void 0:n.enabled)&&(0,w.jsx)(Ue,{}),(0,w.jsx)(Ae,{}),(0,w.jsx)(Ye,{})]}),(0,w.jsx)(Ge,{})]})}var A=require("lucide-react"),ae=require("prism-react-renderer"),Qe=require("react");var _e=require("react-toast-msg");var b=require("react/jsx-runtime"),fe={npm:"npm install",pnpm:"pnpm add",yarn:"yarn add",bun:"bun add"};function dt(e){var G,R;let{filename:r,copyable:t,children:o,className:a}=e,{packageManager:n,setPackageManager:l}=x(),m=!(a!=null&&a.includes("language-")),s=typeof o=="string"?o:((G=o==null?void 0:o.props)==null?void 0:G.children)||"";if(m)return(0,b.jsx)("code",{className:"not-prose px-1 py-0.5 rounded border border-gray-200 bg-gray-50 text-gray-800 text-sm",children:s});let[u,i]=(0,Qe.useState)(!1),c=a==null?void 0:a.match(/language-([\w-]+)/),N=(R=c==null?void 0:c[1])!=null?R:"txt",f=N==="package-install",k=()=>{let L=f?`${fe[n]} ${s.trim()}`:s.trim();navigator.clipboard.writeText(L),i(!0),_e.toast.success("Code copied to clipboard"),setTimeout(()=>i(!1),2e3)};return(0,b.jsxs)("div",{className:"max-w-2xl overflow-hidden rounded-lg text-sm text-gray-800 border border-gray-200 mt-4 bg-white",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between bg-gray-50 border-b border-gray-200",children:[!f&&(0,b.jsx)("span",{className:"text-xs text-gray-400 px-4 py-3",children:r||N}),f&&(0,b.jsx)("div",{className:"flex items-center px-3",children:Object.keys(fe).map(L=>(0,b.jsx)("button",{onClick:()=>l(L),className:`px-3 pb-2.5 pt-3 text-sm font-medium border-b-2 transition-all ${n===L?"border-gray-900 text-gray-900":"border-transparent text-gray-500 hover:text-gray-800"}`,children:L},L))}),t&&!f&&(0,b.jsx)("button",{onClick:k,className:"rounded-lg cursor-pointer p-2 m-2 text-gray-500 hover:bg-gray-200 transition",children:u?(0,b.jsx)(A.CheckIcon,{className:"size-4 text-green-600"}):(0,b.jsx)(A.CopyIcon,{className:"size-4"})})]}),(0,b.jsx)(ae.Highlight,{theme:ae.themes.vsLight,code:s.trim(),language:f?"bash":N,children:({tokens:L,getLineProps:Q,getTokenProps:_})=>(0,b.jsxs)("pre",{className:`p-4 font-mono whitespace-pre overflow-x-auto text-sm leading-relaxed ${t&&f?"flex items-center justify-between":""}`,children:[L.map((H,g)=>(0,b.jsxs)("div",xe(ne({},Q({line:H})),{children:[!f&&(0,b.jsx)("span",{className:"text-gray-400 mr-4 select-none",children:g+1}),f&&(0,b.jsx)("span",{className:"mr-2",children:fe[n]}),H.map((h,T)=>(0,b.jsx)("span",ne({},_({token:h})),T))]}),g)),t&&f&&(0,b.jsx)("button",{onClick:k,className:"rounded-lg cursor-pointer p-2 text-gray-500 hover:bg-gray-100 transition",children:u?(0,b.jsx)(A.CheckIcon,{className:"size-4 text-green-600"}):(0,b.jsx)(A.CopyIcon,{className:"size-4"})})]})})]})}0&&(module.exports={DocstraBody,DocstraCodeBlock,DocstraHeader,DocstraLayout,DocstraProvider,useDocstra});
1
+ "use strict";"use client";var He=Object.create;var K=Object.defineProperty;var qe=Object.getOwnPropertyDescriptor;var Ke=Object.getOwnPropertyNames;var Ve=Object.getPrototypeOf,Ye=Object.prototype.hasOwnProperty;var Qe=(e,r)=>{for(var t in r)K(e,t,{get:r[t],enumerable:!0})},de=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of Ke(r))!Ye.call(e,a)&&a!==t&&K(e,a,{get:()=>r[a],enumerable:!(o=qe(r,a))||o.enumerable});return e};var R=(e,r,t)=>(t=e!=null?He(Ve(e)):{},de(r||!e||!e.__esModule?K(t,"default",{value:e,enumerable:!0}):t,e)),_e=e=>de(K({},"__esModule",{value:!0}),e);var rt={};Qe(rt,{DocstraBody:()=>et,DocstraCodeBlock:()=>tt,DocstraHeader:()=>re,DocstraLayout:()=>je,DocstraProvider:()=>We,useDocstra:()=>f});module.exports=_e(rt);var T=require("react"),ye=require("react-toast-msg");var fe=require("lucide-react");var pe=require("tailwind-merge"),ue=R(require("clsx"));function g(...e){return(0,pe.twMerge)((0,ue.default)(e))}var O=require("react"),ge=R(require("fuse.js")),be=R(require("next/link")),he=require("next/navigation"),h=require("react/jsx-runtime");function xe(){let{openSearchBox:e,setOpenSearchBox:r,page:t}=f(),[o,a]=(0,O.useState)(""),[n,s]=(0,O.useState)([]),c=(0,he.useRouter)();(0,O.useEffect)(()=>{let i=v=>{v.ctrlKey&&v.key==="k"&&(v.preventDefault(),r(!0))};return window.addEventListener("keydown",i),()=>{window.removeEventListener("keydown",i)}},[]);let m=(0,O.useMemo)(()=>!t||t.length===0?null:new ge.default(t,{keys:["data.metadata.title","data.metadata.description"],threshold:.3}),[t]);(0,O.useEffect)(()=>{if(o&&m){let i=m.search(o);s(i.map(v=>v.item))}else o||s([])},[o,m]);let y=i=>{if(i.preventDefault(),o){let v=n[0];v&&(c.push(`/docs/${v.slug}`),a(""),r(!1))}};return(0,O.useEffect)(()=>{let i=v=>{v.key==="Escape"&&(r(!1),a(""))};return e&&window.addEventListener("keydown",i),()=>{window.removeEventListener("keydown",i)}},[e]),(0,h.jsx)("div",{onClick:()=>{r(!1),a("")},className:g("fixed inset-0 z-25 flex items-start justify-center bg-white/40 backdrop-blur-md opacity-0 pointer-events-none transition-all duration-300",e&&"opacity-100 pointer-events-auto"),children:(0,h.jsxs)("div",{onClick:i=>i.stopPropagation(),className:"flex flex-col items-center mt-30 max-w-lg w-full max-md:px-4",children:[(0,h.jsx)("form",{onSubmit:y,className:g("relative flex items-center justify-between w-full bg-white border border-slate-200 text-gray-400 h-15 p-0.5 rounded-md",o&&"rounded-b-none border-b-0"),children:e&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(fe.SearchIcon,{className:"size-5.5 mx-3 shrink-0"}),(0,h.jsx)("input",{className:"w-full bg-transparent h-full outline-none text-gray-400 placeholder:text-gray-400",type:"text",placeholder:"Search docs...",spellCheck:"false",autoFocus:!0,value:o,onChange:i=>a(i.target.value),name:"searchQuery",required:!0}),(0,h.jsx)("span",{className:"border border-gray-200 px-2 mr-3 py-1 rounded text-xs",children:"Esc"})]})}),(0,h.jsxs)("div",{className:g("max-h-70 overflow-x-hidden overflow-y-auto scrollbar-y w-full bg-white text-slate-700 flex flex-col",o&&"rounded-b-md border border-slate-200"),children:[n.map(i=>(0,h.jsxs)(be.default,{href:`/docs/${i.slug==="index"?"":i.slug}`,onClick:()=>{r(!1),a("")},className:"w-full hover:bg-gray-100/70 border-b border-slate-200 transition-all py-4 px-4 last:mb-2",children:[(0,h.jsx)("h4",{className:"font-medium",children:i.data?.metadata?.title||i.slug}),(0,h.jsx)("p",{className:"text-sm mt-1 text-gray-500",children:i.data?.metadata?.description})]},i.slug)),o&&n.length===0&&(0,h.jsx)("div",{className:"text-gray-500 text-center py-20",children:"No results found"})]})]})})}var F=require("react/jsx-runtime"),ve=(0,T.createContext)(null);function We({children:e,docstraConfig:r,page:t,sidebarItems:o}){let[a,n]=(0,T.useState)(!1),[s,c]=(0,T.useState)(!1),[m,y]=(0,T.useState)("npm");return(0,F.jsxs)(ve.Provider,{value:{openSidebar:a,setOpenSidebar:n,docstraConfig:r,openSearchBox:s,setOpenSearchBox:c,packageManager:m,setPackageManager:y,sidebarItems:o,page:t},children:[(0,F.jsx)(ye.ToastContainer,{}),(0,F.jsx)(xe,{}),e]})}function f(){let e=(0,T.useContext)(ve);if(!e)throw new Error("Please wrap your app with DocstraProvider");return e}var Y=require("lucide-react"),we=require("react");var V=R(require("next/link")),k=require("react/jsx-runtime");function re(){let{openSidebar:e,setOpenSidebar:r,docstraConfig:t}=f(),o="https://github.com/"+t?.editOnGithub?.owner+"/"+t?.editOnGithub?.repo;return(0,we.useEffect)(()=>{e?document.body.classList.add("max-md:overflow-hidden"):document.body.classList.remove("max-md:overflow-hidden")},[e]),(0,k.jsxs)("header",{className:"fixed w-full top-0 z-10 text-sm flex items-center justify-between border-b border-gray-100 h-18 px-4 md:px-6 bg-white",children:[(0,k.jsx)(V.default,{href:t.navbar?.logo?.link||"/",className:"hover:opacity-80 transition",children:(0,k.jsx)("img",{src:t.navbar?.logo?.src||"/logo.png",alt:t.navbar?.logo?.alt||"Logo",className:g("h-9.5 w-auto",t.navbar?.logo?.className)})}),(0,k.jsxs)("div",{className:"hidden divide-x divide-gray-200 md:flex items-center",children:[t.navbar?.links?.map(a=>(0,k.jsx)(V.default,{href:a.href,className:"px-6 hover:text-gray-600",children:a.name},a.name)),(0,k.jsx)(V.default,{href:o||"https://github.com/sudhucodes/docstra",children:(0,k.jsx)("svg",{className:"size-6 mx-6",width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:(0,k.jsx)("path",{d:"M12 .3a12 12 0 0 0-3.8 23.38c.6.12.83-.26.83-.57L9 21.07c-3.34.72-4.04-1.61-4.04-1.61-.55-1.39-1.34-1.76-1.34-1.76-1.08-.74.09-.73.09-.73 1.2.09 1.83 1.24 1.83 1.24 1.08 1.83 2.81 1.3 3.5 1 .1-.78.42-1.31.76-1.61-2.67-.3-5.47-1.33-5.47-5.93 0-1.31.47-2.38 1.24-3.22-.14-.3-.54-1.52.1-3.18 0 0 1-.32 3.3 1.23a11.5 11.5 0 0 1 6 0c2.28-1.55 3.29-1.23 3.29-1.23.64 1.66.24 2.88.12 3.18a4.65 4.65 0 0 1 1.23 3.22c0 4.61-2.8 5.63-5.48 5.92.42.36.81 1.1.81 2.22l-.01 3.29c0 .31.2.69.82.57A12 12 0 0 0 12 .3"})})})]}),(0,k.jsx)("button",{onClick:()=>r(!e),className:"md:hidden transition text-gray-600 active:ring-2 ring-gray-200 p-1.5 rounded-md",children:e?(0,k.jsx)(Y.XIcon,{className:"size-6.5"}):(0,k.jsx)(Y.TextAlignEnd,{className:"size-6.5"})})]})}var _=require("lucide-react"),Ne=require("next/navigation");var Xe=R(require("lucide-react"));function oe(e){if(e)return Xe[e]}var ae=R(require("next/link")),Q=require("react"),l=require("react/jsx-runtime");function Ze({item:e,pathname:r,openSidebar:t,setOpenSidebar:o}){let[a,n]=(0,Q.useState)(e.defaultOpen??!0),s=e.collapsible??!0,c=oe(e.icon);return(0,l.jsxs)("div",{children:[(0,l.jsxs)(ae.default,{href:e.href,onClick:()=>s&&n(m=>!m),className:"w-full flex items-center justify-between gap-2 text-gray-500 hover:bg-gray-100 py-2 px-2.5 rounded-lg",children:[(0,l.jsxs)("span",{className:"flex items-center gap-2",children:[c&&(0,l.jsx)(c,{className:"size-4 text-gray-400"}),e.title]}),s&&(0,l.jsx)(_.ChevronDownIcon,{className:g("size-4 text-black/50 transition-transform duration-300",a&&"rotate-180")})]}),(!s||a)&&(0,l.jsx)("ul",{className:"mb-4 ml-2",children:e.children.map((m,y)=>(0,l.jsx)(ke,{item:m,pathname:r,openSidebar:t,setOpenSidebar:o},`${m.type}-${y}`))})]})}function Je({item:e,pathname:r,openSidebar:t,setOpenSidebar:o}){let a=oe(e.icon);return(0,l.jsxs)(ae.default,{href:e.href,onClick:()=>t&&o(!1),className:g("flex items-center gap-2 text-gray-500 hover:bg-gray-100 py-2 px-2.5 rounded-lg",r===e.href&&"bg-gray-100 text-gray-800"),children:[a&&(0,l.jsx)(a,{className:"size-4"}),(0,l.jsx)("span",{children:e.title})]})}function ke({item:e,pathname:r,openSidebar:t,setOpenSidebar:o}){switch(e.type){case"page":return(0,l.jsx)(Je,{item:e,pathname:r,openSidebar:t,setOpenSidebar:o});case"section":return(0,l.jsx)(Ze,{item:e,pathname:r,openSidebar:t,setOpenSidebar:o});default:return null}}function Se({sidebarItems:e}){let[r,t]=(0,Q.useState)(!1),[o,a]=(0,Q.useState)(!1),n=(0,Ne.usePathname)();return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:g("fixed inset-0 z-20 bg-black/50 opacity-0 pointer-events-none transition-all duration-300",r&&"opacity-100 pointer-events-auto"),onClick:()=>t(!1)}),(0,l.jsxs)("aside",{className:g("fixed md:top-18 h-[calc(100svh-72px)] scrollbar-y w-screen max-md:rounded-t-lg z-21 md:w-72 pb-10 text-base md:text-sm shrink-0 border-r border-gray-200 p-4 max-md:fixed bg-white overflow-y-auto transition-all duration-300",r?"top-32":"top-full"),children:[(0,l.jsxs)("div",{className:"flex items-center select-none gap-2 cursor-pointer mt-6 mb-4 p-2.5 text-gray-500 border border-gray-200 rounded-lg hover:bg-gray-50",onClick:()=>{t(r&&!1),a(!0)},children:[(0,l.jsx)(_.SearchIcon,{className:"size-4.5"}),(0,l.jsx)("p",{children:"Search"}),(0,l.jsxs)("div",{className:"ms-auto font-mono inline-flex gap-0.5",children:[(0,l.jsx)("span",{className:"rounded-md border border-gray-200 px-1.5",children:"Ctrl"}),(0,l.jsx)("span",{className:"rounded-md border border-gray-200 px-1.5",children:"K"})]})]}),e.map((s,c)=>(0,l.jsx)(ke,{item:s,pathname:n,openSidebar:r,setOpenSidebar:t},`${s.type}-${c}`))]})]})}var W=require("react/jsx-runtime");function je({children:e,sidebarItems:r}){return(0,W.jsxs)("div",{className:"min-h-screen flex bg-white w-full",children:[(0,W.jsx)(Se,{sidebarItems:r}),e]})}var Ce=require("next/navigation"),Ie=require("lucide-react"),ne=R(require("next/link")),I=require("react/jsx-runtime");function De(){let r=(0,Ce.usePathname)().split("/").filter(Boolean),t=r.map((o,a)=>{let n="/"+r.slice(0,a+1).join("/"),s=o.replace(/-/g," ").replace(/\b\w/g,c=>c.toUpperCase());return{href:n,title:s}});return(0,I.jsx)("nav",{"aria-label":"Breadcrumb",className:"flex text-sm items-center pb-4 text-gray-500 not-prose",children:(0,I.jsxs)("ol",{className:"flex items-center space-x-2",children:[(0,I.jsx)("li",{children:(0,I.jsx)(ne.default,{href:"/",className:"hover:text-gray-700 transition-colors font-medium",children:"Home"})}),t.map((o,a)=>{let n=a===t.length-1;return(0,I.jsxs)("li",{className:"flex items-center space-x-2",children:[(0,I.jsx)(Ie.ChevronRight,{className:"w-4 h-4 text-gray-400"}),n?(0,I.jsx)("span",{className:"text-gray-600 font-medium",children:o.title}):(0,I.jsx)(ne.default,{href:o.href,className:"hover:text-gray-700 font-medium transition-colors",children:o.title})]},o.href)})]})})}var M=require("lucide-react"),Oe=require("next/navigation"),N=require("react");var w=require("react/jsx-runtime");function Pe(){let[e,r]=(0,N.useState)(null),[t,o]=(0,N.useState)("down"),[a,n]=(0,N.useState)(!1),[s,c]=(0,N.useState)(!1),{docstraConfig:m,page:y}=f(),i=y?.path,v=y?.tableOfContents||[],B=(0,N.useRef)(0),C=(0,N.useRef)(null),H=(0,Oe.usePathname)(),te=`${"https://github.com/"+m?.editOnGithub?.owner+"/"+m?.editOnGithub?.repo}/edit/main/${m?.editOnGithub?.path}/${i}`;(0,N.useEffect)(()=>{let p=()=>{let b=window.scrollY;o(b>B.current?"down":"up"),n(b>100),B.current=b};return window.addEventListener("scroll",p),()=>window.removeEventListener("scroll",p)},[]),(0,N.useEffect)(()=>{let p=document.querySelectorAll("h2[id], h3[id]"),b=new IntersectionObserver(P=>{if(s)return;let L=P.filter($=>$.isIntersecting).sort(($,Ae)=>$.boundingClientRect.top-Ae.boundingClientRect.top);if(L.length>0){let $=t==="down"?L[0].target.id:L[L.length-1].target.id;r($)}},{rootMargin:"-40% 0px -50% 0px",threshold:[0,.2,.6,1]});return p.forEach(P=>b.observe(P)),C.current=b,()=>b.disconnect()},[H,t,s]),(0,N.useEffect)(()=>{!(window.scrollY>100)&&r(v[0]?.id)},[v]),(0,N.useEffect)(()=>{if(!e)return;let p=document.querySelector(".toc-scroll-container");if(!p)return;let b=p.querySelector(`a[href="#${e}"]`);if(!b)return;let P=p.getBoundingClientRect(),L=b.getBoundingClientRect();(L.top<P.top||L.bottom>P.bottom)&&b.scrollIntoView({behavior:"smooth",block:"nearest"})},[e]),(0,N.useEffect)(()=>{if(!s)return;let p=setTimeout(()=>c(!1),800);return()=>clearTimeout(p)},[s]);let q=p=>{r(p),c(!0)};return(0,w.jsxs)("aside",{className:"sticky top-18 text-sm hidden xl:block text-gray-500 shrink-0 h-[calc(100svh-72px)] w-64 border-l border-gray-200 p-6 overflow-y-auto",children:[(0,w.jsxs)("p",{className:"flex items-center gap-2 mb-5",children:[(0,w.jsx)(M.TextAlignStartIcon,{className:"size-4"}),"On this page"]}),(0,w.jsx)("ul",{className:"toc-scroll-container max-h-3/4 overflow-y-auto scrollbar-none",children:v.map(p=>(0,w.jsxs)("li",{children:[(0,w.jsx)(Le,{heading:p,activeId:e,handleClick:q}),p.children.map(b=>(0,w.jsx)(Le,{heading:b,activeId:e,handleClick:q,className:"pl-8"},b.id))]},p.id))}),(0,w.jsx)("hr",{className:"my-6 border-gray-200"}),m.editOnGithub&&(0,w.jsxs)("a",{href:te,rel:"noopener noreferrer",className:"flex items-center gap-2 text-gray-400 hover:text-gray-700 transition",children:["Edit this page on GitHub",(0,w.jsx)(M.SquareArrowOutUpRightIcon,{className:"size-4"})]}),a&&(0,w.jsxs)("button",{onClick:()=>scrollTo({top:0,behavior:"smooth"}),className:"flex items-center cursor-pointer gap-2 mt-3 text-gray-400 hover:text-gray-700 transition",children:["Scroll to top",(0,w.jsx)(M.ArrowUpCircleIcon,{className:"size-4"})]})]})}function Le({heading:e,activeId:r,handleClick:t,className:o}){return(0,w.jsx)("a",{href:`#${e.id}`,className:g("border-l border-gray-200 block py-1.5 pl-4 transition-colors",o,{"border-gray-800 text-gray-900 font-medium":r===e.id,"hover:text-gray-800 hover:border-gray-400":r!==e.id}),onClick:()=>t(e.id),children:e.text})}var U=require("react"),X=require("lucide-react");var z=require("react/jsx-runtime");function se({label:e,type:r,placeholder:t="",id:o,required:a=!1,onChange:n,value:s,readOnly:c=!1,className:m="",optional:y=!1}){return(0,z.jsxs)("div",{className:g("flex flex-col mt-4 w-full",m),children:[e&&(0,z.jsxs)("label",{htmlFor:o,className:"font-medium w-max cursor-pointer",children:[e,y&&(0,z.jsx)("span",{className:"text-xs font-normal text-gray-400 ml-1 mt-1",children:"(Optional)"})]}),r==="textarea"?(0,z.jsx)("textarea",{id:o,name:o,className:g("mt-2 w-full p-3 border border-gray-300 resize-none not-focus:hover:border-gray-500 read-only:text-gray-400/80 outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition-all duration-200 rounded-lg",m),placeholder:t,required:a,onChange:n,rows:4,value:s,readOnly:c,maxLength:500}):(0,z.jsx)("input",{type:r,id:o,name:o,className:"mt-2 w-full h-12 px-3 border border-gray-300 not-focus:hover:border-gray-500 read-only:text-gray-400/80 outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition-all duration-200 rounded-lg",placeholder:t,required:a,onChange:n,value:s,readOnly:c,maxLength:500})]})}var Re=require("lucide-react");var ie=require("react/jsx-runtime");function le({label:e,loading:r,type:t="submit",className:o="",disabled:a=!1,onClick:n}){return(0,ie.jsx)("button",{type:t,disabled:a,className:g("relative w-full mt-4 h-12 px-6 py-3 cursor-pointer font-medium bg-gray-900 hover:opacity-85 text-white rounded-lg",o),"aria-label":e,onClick:n,children:r?(0,ie.jsx)(Re.Loader2Icon,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 animate-spin mx-auto"}):e})}var Z=require("formsync"),d=require("react/jsx-runtime");function Te(){let[e,r]=(0,U.useState)(null),{docstraConfig:t}=f(),[o,a]=(0,U.useState)(""),[n,s]=(0,U.useState)(!1),[c,m]=(0,U.useState)(null),y="https://github.com/"+t?.editOnGithub?.owner+"/"+t?.editOnGithub?.repo;return(0,d.jsx)("div",{className:"border-y border-gray-200 mt-10 py-10 space-y-4",children:n?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:"font-medium text-gray-900",children:"We appreciate your feedback, Thank you!"}),(0,d.jsx)(le,{onClick:()=>{s(!1),r(null),a("")},label:"Submit Again",className:"w-max text-sm"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:"font-medium",children:"How is this guide?"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsxs)("button",{onClick:()=>r("good"),className:`flex items-center cursor-pointer gap-1 px-3 py-2 rounded-full border text-sm ${e==="good"?"bg-green-100 text-green-600 border-green-300":"border-gray-200 text-gray-600 hover:bg-gray-100"}`,children:[(0,d.jsx)(X.ThumbsUp,{className:`size-4 ${e==="good"?"fill-green-600":"text-gray-500"}`}),"Good"]}),(0,d.jsxs)("button",{onClick:()=>r("bad"),className:`flex items-center cursor-pointer gap-1 px-3 py-2 rounded-full border text-sm ${e==="bad"?"bg-red-100 text-red-600 border-red-300":"border-gray-200 text-gray-600 hover:bg-gray-100"}`,children:[(0,d.jsx)(X.ThumbsDown,{className:`size-4 pt-0.5 ${e==="bad"?"fill-red-600":"text-gray-500"}`}),"Bad"]})]}),e&&(0,d.jsxs)(Z.FormSyncForm,{className:"flex flex-col gap-2",formId:t?.feedback?.formSyncFormID||"",onSuccess:i=>{s(!0),r(null),a("")},onSubmitError:i=>{m(i.message)},children:[(0,d.jsx)(se,{value:o,id:"message",onChange:i=>a(i.target.value),placeholder:"Leave your feedback...",required:!0,type:"textarea"}),c&&(0,d.jsx)("p",{className:"text-red-500",children:c}),(0,d.jsx)("input",{type:"hidden",name:"opinion",value:e}),(0,d.jsx)("input",{type:"hidden",name:"page",value:window.location.href}),(0,d.jsx)("input",{type:"hidden",name:"_redirect",value:window.location.href}),(0,d.jsx)(Z.FormSyncButton,{className:"relative mt-4 h-12 px-6 py-3 cursor-pointer font-medium bg-gray-900 hover:opacity-85 text-white rounded-lg w-max text-sm",children:"Submit"}),t?.feedback?.watermark!==!1&&(0,d.jsxs)("p",{className:"text-left text-sm text-gray-500 mt-6",children:["Powered by"," ",(0,d.jsx)("a",{href:`https://www.formsync.app?utm_source=${y}`,className:"text-gray-800 not-prose",children:"FormSync"})]})]})]})})}var Ee=require("react/jsx-runtime");function ze(){let{pageData:e}=f();if(!e?.data?.lastUpdated)return null;let r=new Date(e.data.lastUpdated).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",timeZone:"UTC"});return(0,Ee.jsxs)("p",{className:"text-sm text-gray-500",children:["Last updated on ",r]})}var J=require("lucide-react"),A=require("react");var E=require("react/jsx-runtime");function Be(){let{pageData:e}=f(),[r,t]=(0,A.useState)(!1),[o,a]=(0,A.useState)(null);(0,A.useEffect)(()=>{a(window.location.href)},[]);let n=`Read from this URL: ${o} and explain it to me.`;return(0,E.jsxs)("div",{className:"flex items-center gap-3 mt-6",children:[(0,E.jsxs)("button",{title:"Copy Markdown",onClick:()=>{navigator.clipboard.writeText(e?.data.raw||""),t(!0),setTimeout(()=>t(!1),3e3)},className:"flex items-center cursor-pointer gap-2 bg-gray-50 hover:bg-gray-100 border border-gray-200 px-3 py-2 rounded-md text-xs",children:[r?(0,E.jsx)(J.CheckIcon,{className:"size-3.5"}):(0,E.jsx)(J.CopyIcon,{className:"size-3.5"}),"Copy Markdown"]}),(0,E.jsx)("a",{title:"Ask ChatGPT",href:`https://chatgpt.com/?hints=search&q=${encodeURIComponent(n)}`,className:"flex not-prose items-center gap-2 bg-gray-50 hover:bg-gray-100 border border-gray-200 px-3 py-2 rounded-md text-xs",rel:"noreferrer noopener",children:"Ask ChatGPT"})]})}var $e=require("next/navigation"),ce=R(require("next/link")),j=require("lucide-react");var S=require("react/jsx-runtime");function Me(e){let r=[];for(let t of e)t.type==="page"?r.push({name:t.title,href:t.href,icon:t.icon}):t.type==="section"&&r.push(...Me(t.children));return r}function Ge(){let e=(0,$e.usePathname)(),{docstraConfig:r,sidebarItems:t}=f(),o=[];t&&t.length>0?o=Me(t):r?.sidebar?.links&&(o=r.sidebar.links.flatMap(c=>c.items));let a=o.findIndex(c=>c.href===e),n=a>0?o[a-1]:null,s=a<o.length-1?o[a+1]:null;return(0,S.jsxs)("div",{className:"flex flex-col lg:flex-row gap-2 justify-between py-10 mt-10",children:[n?(0,S.jsxs)(ce.default,{href:n.href,className:"flex flex-col not-prose items-start gap-2 border border-gray-200 hover:bg-gray-50 py-3 md:min-w-62 pl-4 pr-10 rounded-lg text-sm",children:[(0,S.jsx)("span",{className:"text-gray-500",children:"Previous"}),(0,S.jsxs)("p",{className:"flex items-center font-medium",children:[(0,S.jsx)(j.ArrowLeftIcon,{className:"size-5 mr-2"}),n.name]})]}):(0,S.jsx)("div",{}),s?(0,S.jsxs)(ce.default,{href:s.href,className:"flex flex-col not-prose items-end gap-2 border border-gray-200 hover:bg-gray-50 py-3 pr-4 md:min-w-62 pl-10 rounded-lg text-sm",children:[(0,S.jsx)("span",{className:"text-gray-500",children:"Next"}),(0,S.jsxs)("p",{className:"flex items-center font-medium",children:[s.name,(0,S.jsx)(j.ArrowRightIcon,{className:"size-5 ml-2"})]})]}):(0,S.jsx)("div",{})]})}var x=require("react/jsx-runtime");function et({children:e}){let{docstraConfig:r,page:t}=f();return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(re,{}),(0,x.jsxs)("main",{className:"flex-1 px-4 md:px-8 md:pl-80 pt-28 py-10 prose max-w-none",children:[(0,x.jsx)(De,{}),(0,x.jsx)("h1",{className:"text-3xl font-bold",children:t?.metadata?.title}),(0,x.jsx)("p",{className:"my-4 text-gray-500",children:t?.metadata?.description}),(0,x.jsx)(Be,{}),(0,x.jsx)("hr",{className:"my-10 border-gray-200"}),e,r?.feedback?.enabled&&(0,x.jsx)(Te,{}),(0,x.jsx)(ze,{}),(0,x.jsx)(Ge,{})]}),(0,x.jsx)(Pe,{})]})}var G=require("lucide-react"),ee=require("prism-react-renderer"),Fe=require("react");var Ue=require("react-toast-msg"),u=require("react/jsx-runtime"),me={npm:"npm install",pnpm:"pnpm add",yarn:"yarn add",bun:"bun add"};function tt(e){let{filename:r,copyable:t,children:o,className:a}=e,{packageManager:n,setPackageManager:s}=f(),c=!a?.includes("language-"),m=typeof o=="string"?o:o?.props?.children||"";if(c)return(0,u.jsx)("code",{className:"not-prose px-1 py-0.5 rounded border border-gray-200 bg-gray-50 text-gray-800 text-sm",children:m});let[y,i]=(0,Fe.useState)(!1),B=a?.match(/language-([\w-]+)/)?.[1]??"txt",C=B==="package-install",H=()=>{let D=C?`${me[n]} ${m.trim()}`:m.trim();navigator.clipboard.writeText(D),i(!0),Ue.toast.success("Code copied to clipboard"),setTimeout(()=>i(!1),2e3)};return(0,u.jsxs)("div",{className:"max-w-2xl overflow-hidden rounded-lg text-sm text-gray-800 border border-gray-200 mt-4 bg-white",children:[(0,u.jsxs)("div",{className:"flex items-center justify-between bg-gray-50 border-b border-gray-200",children:[!C&&(0,u.jsx)("span",{className:"text-xs text-gray-400 px-4 py-3",children:r||B}),C&&(0,u.jsx)("div",{className:"flex items-center px-3",children:Object.keys(me).map(D=>(0,u.jsx)("button",{onClick:()=>s(D),className:`px-3 pb-2.5 pt-3 text-sm font-medium border-b-2 transition-all ${n===D?"border-gray-900 text-gray-900":"border-transparent text-gray-500 hover:text-gray-800"}`,children:D},D))}),t&&!C&&(0,u.jsx)("button",{onClick:H,className:"rounded-lg cursor-pointer p-2 m-2 text-gray-500 hover:bg-gray-200 transition",children:y?(0,u.jsx)(G.CheckIcon,{className:"size-4 text-green-600"}):(0,u.jsx)(G.CopyIcon,{className:"size-4"})})]}),(0,u.jsx)(ee.Highlight,{theme:ee.themes.vsLight,code:m.trim(),language:C?"bash":B,children:({tokens:D,getLineProps:te,getTokenProps:q})=>(0,u.jsxs)("pre",{className:`p-4 font-mono whitespace-pre overflow-x-auto text-sm leading-relaxed ${t&&C?"flex items-center justify-between":""}`,children:[D.map((p,b)=>(0,u.jsxs)("div",{...te({line:p}),children:[!C&&(0,u.jsx)("span",{className:"text-gray-400 mr-4 select-none",children:b+1}),C&&(0,u.jsx)("span",{className:"mr-2",children:me[n]}),p.map((P,L)=>(0,u.jsx)("span",{...q({token:P})},L))]},b)),t&&C&&(0,u.jsx)("button",{onClick:H,className:"rounded-lg cursor-pointer p-2 text-gray-500 hover:bg-gray-100 transition",children:y?(0,u.jsx)(G.CheckIcon,{className:"size-4 text-green-600"}):(0,u.jsx)(G.CopyIcon,{className:"size-4"})})]})})]})}0&&(module.exports={DocstraBody,DocstraCodeBlock,DocstraHeader,DocstraLayout,DocstraProvider,useDocstra});
@@ -1 +1 @@
1
- "use client";var $e=Object.defineProperty,Me=Object.defineProperties;var Ge=Object.getOwnPropertyDescriptors;var oe=Object.getOwnPropertySymbols;var Fe=Object.prototype.hasOwnProperty,Ue=Object.prototype.propertyIsEnumerable;var ae=(t,r,e)=>r in t?$e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,Y=(t,r)=>{for(var e in r||(r={}))Fe.call(r,e)&&ae(t,e,r[e]);if(oe)for(var e of oe(r))Ue.call(r,e)&&ae(t,e,r[e]);return t},ne=(t,r)=>Me(t,Ge(r));import{createContext as We,useContext as Xe,useState as _}from"react";import{ToastContainer as Ze}from"react-toast-msg";import{SearchIcon as qe}from"lucide-react";import{twMerge as Ae}from"tailwind-merge";import He from"clsx";function g(...t){return Ae(He(t))}import{useEffect as Q,useMemo as Ke,useState as se}from"react";import Ve from"fuse.js";import Ye from"next/link";import{useRouter as Qe}from"next/navigation";import{Fragment as _e,jsx as D,jsxs as H}from"react/jsx-runtime";function ie(){let{openSearchBox:t,setOpenSearchBox:r,page:e}=b(),[o,a]=se(""),[n,l]=se([]),m=Qe();Q(()=>{let i=c=>{c.ctrlKey&&c.key==="k"&&(c.preventDefault(),r(!0))};return window.addEventListener("keydown",i),()=>{window.removeEventListener("keydown",i)}},[]);let s=Ke(()=>!e||e.length===0?null:new Ve(e,{keys:["data.metadata.title","data.metadata.description"],threshold:.3}),[e]);Q(()=>{if(o&&s){let i=s.search(o);l(i.map(c=>c.item))}else o||l([])},[o,s]);let d=i=>{if(i.preventDefault(),o){let c=n[0];c&&(m.push(`/docs/${c.slug}`),a(""),r(!1))}};return Q(()=>{let i=c=>{c.key==="Escape"&&(r(!1),a(""))};return t&&window.addEventListener("keydown",i),()=>{window.removeEventListener("keydown",i)}},[t]),D("div",{onClick:()=>{r(!1),a("")},className:g("fixed inset-0 z-25 flex items-start justify-center bg-white/40 backdrop-blur-md opacity-0 pointer-events-none transition-all duration-300",t&&"opacity-100 pointer-events-auto"),children:H("div",{onClick:i=>i.stopPropagation(),className:"flex flex-col items-center mt-30 max-w-lg w-full max-md:px-4",children:[D("form",{onSubmit:d,className:g("relative flex items-center justify-between w-full bg-white border border-slate-200 text-gray-400 h-15 p-0.5 rounded-md",o&&"rounded-b-none border-b-0"),children:t&&H(_e,{children:[D(qe,{className:"size-5.5 mx-3 shrink-0"}),D("input",{className:"w-full bg-transparent h-full outline-none text-gray-400 placeholder:text-gray-400",type:"text",placeholder:"Search docs...",spellCheck:"false",autoFocus:!0,value:o,onChange:i=>a(i.target.value),name:"searchQuery",required:!0}),D("span",{className:"border border-gray-200 px-2 mr-3 py-1 rounded text-xs",children:"Esc"})]})}),H("div",{className:g("max-h-70 overflow-x-hidden overflow-y-auto scrollbar-y w-full bg-white text-slate-700 flex flex-col",o&&"rounded-b-md border border-slate-200"),children:[n.map(i=>{var c,h,p,x;return H(Ye,{href:`/docs/${i.slug==="index"?"":i.slug}`,onClick:()=>{r(!1),a("")},className:"w-full hover:bg-gray-100/70 border-b border-slate-200 transition-all py-4 px-4 last:mb-2",children:[D("h4",{className:"font-medium",children:((h=(c=i.data)==null?void 0:c.metadata)==null?void 0:h.title)||i.slug}),D("p",{className:"text-sm mt-1 text-gray-500",children:(x=(p=i.data)==null?void 0:p.metadata)==null?void 0:x.description})]},i.slug)}),o&&n.length===0&&D("div",{className:"text-gray-500 text-center py-20",children:"No results found"})]})]})})}import{jsx as le,jsxs as Je}from"react/jsx-runtime";var ce=We(null);function Jt({children:t,docstraConfig:r,page:e,sidebarItems:o}){let[a,n]=_(!1),[l,m]=_(!1),[s,d]=_("npm");return Je(ce.Provider,{value:{openSidebar:a,setOpenSidebar:n,docstraConfig:r,openSearchBox:l,setOpenSearchBox:m,packageManager:s,setPackageManager:d,sidebarItems:o,page:e},children:[le(Ze,{}),le(ie,{}),t]})}function b(){let t=Xe(ce);if(!t)throw new Error("Please wrap your app with DocstraProvider");return t}import{TextAlignEnd as je,XIcon as et}from"lucide-react";import{useEffect as tt}from"react";import W from"next/link";import{jsx as S,jsxs as me}from"react/jsx-runtime";function de(){var a,n,l,m,s,d,i,c,h,p,x,T;let{openSidebar:t,setOpenSidebar:r,docstraConfig:e}=b(),o="https://github.com/"+((a=e==null?void 0:e.editOnGithub)==null?void 0:a.owner)+"/"+((n=e==null?void 0:e.editOnGithub)==null?void 0:n.repo);return tt(()=>{t?document.body.classList.add("max-md:overflow-hidden"):document.body.classList.remove("max-md:overflow-hidden")},[t]),me("header",{className:"fixed w-full top-0 z-10 text-sm flex items-center justify-between border-b border-gray-100 h-18 px-4 md:px-6 bg-white",children:[S(W,{href:((m=(l=e.navbar)==null?void 0:l.logo)==null?void 0:m.link)||"/",className:"hover:opacity-80 transition",children:S("img",{src:((d=(s=e.navbar)==null?void 0:s.logo)==null?void 0:d.src)||"/logo.png",alt:((c=(i=e.navbar)==null?void 0:i.logo)==null?void 0:c.alt)||"Logo",className:g("h-9.5 w-auto",(p=(h=e.navbar)==null?void 0:h.logo)==null?void 0:p.className)})}),me("div",{className:"hidden divide-x divide-gray-200 md:flex items-center",children:[(T=(x=e.navbar)==null?void 0:x.links)==null?void 0:T.map(I=>S(W,{href:I.href,className:"px-6 hover:text-gray-600",children:I.name},I.name)),S(W,{href:o||"https://github.com/sudhucodes/docstra",children:S("svg",{className:"size-6 mx-6",width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:S("path",{d:"M12 .3a12 12 0 0 0-3.8 23.38c.6.12.83-.26.83-.57L9 21.07c-3.34.72-4.04-1.61-4.04-1.61-.55-1.39-1.34-1.76-1.34-1.76-1.08-.74.09-.73.09-.73 1.2.09 1.83 1.24 1.83 1.24 1.08 1.83 2.81 1.3 3.5 1 .1-.78.42-1.31.76-1.61-2.67-.3-5.47-1.33-5.47-5.93 0-1.31.47-2.38 1.24-3.22-.14-.3-.54-1.52.1-3.18 0 0 1-.32 3.3 1.23a11.5 11.5 0 0 1 6 0c2.28-1.55 3.29-1.23 3.29-1.23.64 1.66.24 2.88.12 3.18a4.65 4.65 0 0 1 1.23 3.22c0 4.61-2.8 5.63-5.48 5.92.42.36.81 1.1.81 2.22l-.01 3.29c0 .31.2.69.82.57A12 12 0 0 0 12 .3"})})})]}),S("button",{onClick:()=>r(!t),className:"md:hidden transition text-gray-600 active:ring-2 ring-gray-200 p-1.5 rounded-md",children:t?S(et,{className:"size-6.5"}):S(je,{className:"size-6.5"})})]})}import{ChevronDownIcon as ot,SearchIcon as at}from"lucide-react";import{usePathname as nt}from"next/navigation";import*as rt from"lucide-react";function X(t){if(t)return rt[t]}import pe from"next/link";import{useState as Z}from"react";import{Fragment as lt,jsx as y,jsxs as L}from"react/jsx-runtime";function st({item:t,pathname:r,openSidebar:e,setOpenSidebar:o}){var s,d;let[a,n]=Z((s=t.defaultOpen)!=null?s:!0),l=(d=t.collapsible)!=null?d:!0,m=X(t.icon);return L("div",{children:[L(pe,{href:t.href,onClick:()=>l&&n(i=>!i),className:"w-full flex items-center justify-between gap-2 text-gray-500 hover:bg-gray-100 py-2 px-2.5 rounded-lg",children:[L("span",{className:"flex items-center gap-2",children:[m&&y(m,{className:"size-4 text-gray-400"}),t.title]}),l&&y(ot,{className:g("size-4 text-black/50 transition-transform duration-300",a&&"rotate-180")})]}),(!l||a)&&y("ul",{className:"mb-4 ml-2",children:t.children.map((i,c)=>y(ue,{item:i,pathname:r,openSidebar:e,setOpenSidebar:o},`${i.type}-${c}`))})]})}function it({item:t,pathname:r,openSidebar:e,setOpenSidebar:o}){let a=X(t.icon);return L(pe,{href:t.href,onClick:()=>e&&o(!1),className:g("flex items-center gap-2 text-gray-500 hover:bg-gray-100 py-2 px-2.5 rounded-lg",r===t.href&&"bg-gray-100 text-gray-800"),children:[a&&y(a,{className:"size-4"}),y("span",{children:t.title})]})}function ue({item:t,pathname:r,openSidebar:e,setOpenSidebar:o}){switch(t.type){case"page":return y(it,{item:t,pathname:r,openSidebar:e,setOpenSidebar:o});case"section":return y(st,{item:t,pathname:r,openSidebar:e,setOpenSidebar:o});default:return null}}function fe({sidebarItems:t}){let[r,e]=Z(!1),[o,a]=Z(!1),n=nt();return L(lt,{children:[y("div",{className:g("fixed inset-0 z-20 bg-black/50 opacity-0 pointer-events-none transition-all duration-300",r&&"opacity-100 pointer-events-auto"),onClick:()=>e(!1)}),L("aside",{className:g("fixed md:top-18 h-[calc(100svh-72px)] scrollbar-y w-screen max-md:rounded-t-lg z-21 md:w-72 pb-10 text-base md:text-sm shrink-0 border-r border-gray-200 p-4 max-md:fixed bg-white overflow-y-auto transition-all duration-300",r?"top-32":"top-full"),children:[L("div",{className:"flex items-center select-none gap-2 cursor-pointer mt-6 mb-4 p-2.5 text-gray-500 border border-gray-200 rounded-lg hover:bg-gray-50",onClick:()=>{e(r&&!1),a(!0)},children:[y(at,{className:"size-4.5"}),y("p",{children:"Search"}),L("div",{className:"ms-auto font-mono inline-flex gap-0.5",children:[y("span",{className:"rounded-md border border-gray-200 px-1.5",children:"Ctrl"}),y("span",{className:"rounded-md border border-gray-200 px-1.5",children:"K"})]})]}),t.map((l,m)=>y(ue,{item:l,pathname:n,openSidebar:r,setOpenSidebar:e},`${l.type}-${m}`))]})]})}import{jsx as ct,jsxs as mt}from"react/jsx-runtime";function xr({children:t,sidebarItems:r}){return mt("div",{className:"min-h-screen flex bg-white w-full",children:[ct(fe,{sidebarItems:r}),t]})}import{usePathname as dt}from"next/navigation";import{ChevronRight as pt}from"lucide-react";import ge from"next/link";import{jsx as E,jsxs as be}from"react/jsx-runtime";function he(){let r=dt().split("/").filter(Boolean),e=r.map((o,a)=>{let n="/"+r.slice(0,a+1).join("/"),l=o.replace(/-/g," ").replace(/\b\w/g,m=>m.toUpperCase());return{href:n,title:l}});return E("nav",{"aria-label":"Breadcrumb",className:"flex text-sm items-center pb-4 text-gray-500 not-prose",children:be("ol",{className:"flex items-center space-x-2",children:[E("li",{children:E(ge,{href:"/",className:"hover:text-gray-700 transition-colors font-medium",children:"Home"})}),e.map((o,a)=>{let n=a===e.length-1;return be("li",{className:"flex items-center space-x-2",children:[E(pt,{className:"w-4 h-4 text-gray-400"}),n?E("span",{className:"text-gray-600 font-medium",children:o.title}):E(ge,{href:o.href,className:"hover:text-gray-700 font-medium transition-colors",children:o.title})]},o.href)})]})})}import{ArrowUpCircleIcon as ut,SquareArrowOutUpRightIcon as ft,TextAlignStartIcon as gt}from"lucide-react";import{usePathname as bt}from"next/navigation";import{useEffect as M,useRef as xe,useState as q}from"react";import{jsx as O,jsxs as G}from"react/jsx-runtime";function ve(){var U,A,$;let[t,r]=q(null),[e,o]=q("down"),[a,n]=q(!1),[l,m]=q(!1),{docstraConfig:s,page:d}=b(),i=d==null?void 0:d.path,c=(d==null?void 0:d.tableOfContents)||[],h=xe(0),p=xe(null),x=bt(),I=`${"https://github.com/"+((U=s==null?void 0:s.editOnGithub)==null?void 0:U.owner)+"/"+((A=s==null?void 0:s.editOnGithub)==null?void 0:A.repo)}/edit/main/${($=s==null?void 0:s.editOnGithub)==null?void 0:$.path}/${i}`;M(()=>{let u=()=>{let f=window.scrollY;o(f>h.current?"down":"up"),n(f>100),h.current=f};return window.addEventListener("scroll",u),()=>window.removeEventListener("scroll",u)},[]),M(()=>{let u=document.querySelectorAll("h2[id], h3[id]"),f=new IntersectionObserver(C=>{if(l)return;let P=C.filter(z=>z.isIntersecting).sort((z,Be)=>z.boundingClientRect.top-Be.boundingClientRect.top);if(P.length>0){let z=e==="down"?P[0].target.id:P[P.length-1].target.id;r(z)}},{rootMargin:"-40% 0px -50% 0px",threshold:[0,.2,.6,1]});return u.forEach(C=>f.observe(C)),p.current=f,()=>f.disconnect()},[x,e,l]),M(()=>{var f;!(window.scrollY>100)&&r((f=c[0])==null?void 0:f.id)},[c]),M(()=>{if(!t)return;let u=document.querySelector(".toc-scroll-container");if(!u)return;let f=u.querySelector(`a[href="#${t}"]`);if(!f)return;let C=u.getBoundingClientRect(),P=f.getBoundingClientRect();(P.top<C.top||P.bottom>C.bottom)&&f.scrollIntoView({behavior:"smooth",block:"nearest"})},[t]),M(()=>{if(!l)return;let u=setTimeout(()=>m(!1),800);return()=>clearTimeout(u)},[l]);let N=u=>{r(u),m(!0)};return G("aside",{className:"sticky top-18 text-sm hidden xl:block text-gray-500 shrink-0 h-[calc(100svh-72px)] w-64 border-l border-gray-200 p-6 overflow-y-auto",children:[G("p",{className:"flex items-center gap-2 mb-5",children:[O(gt,{className:"size-4"}),"On this page"]}),O("ul",{className:"toc-scroll-container max-h-3/4 overflow-y-auto scrollbar-none",children:c.map(u=>G("li",{children:[O(ye,{heading:u,activeId:t,handleClick:N}),u.children.map(f=>O(ye,{heading:f,activeId:t,handleClick:N,className:"pl-8"},f.id))]},u.id))}),O("hr",{className:"my-6 border-gray-200"}),s.editOnGithub&&G("a",{href:I,rel:"noopener noreferrer",className:"flex items-center gap-2 text-gray-400 hover:text-gray-700 transition",children:["Edit this page on GitHub",O(ft,{className:"size-4"})]}),a&&G("button",{onClick:()=>scrollTo({top:0,behavior:"smooth"}),className:"flex items-center cursor-pointer gap-2 mt-3 text-gray-400 hover:text-gray-700 transition",children:["Scroll to top",O(ut,{className:"size-4"})]})]})}function ye({heading:t,activeId:r,handleClick:e,className:o}){return O("a",{href:`#${t.id}`,className:g("border-l border-gray-200 block py-1.5 pl-4 transition-colors",o,{"border-gray-800 text-gray-900 font-medium":r===t.id,"hover:text-gray-800 hover:border-gray-400":r!==t.id}),onClick:()=>e(t.id),children:t.text})}import{useState as K}from"react";import{ThumbsUp as xt,ThumbsDown as yt}from"lucide-react";import{jsx as J,jsxs as we}from"react/jsx-runtime";function j({label:t,type:r,placeholder:e="",id:o,required:a=!1,onChange:n,value:l,readOnly:m=!1,className:s="",optional:d=!1}){return we("div",{className:g("flex flex-col mt-4 w-full",s),children:[t&&we("label",{htmlFor:o,className:"font-medium w-max cursor-pointer",children:[t,d&&J("span",{className:"text-xs font-normal text-gray-400 ml-1 mt-1",children:"(Optional)"})]}),r==="textarea"?J("textarea",{id:o,name:o,className:g("mt-2 w-full p-3 border border-gray-300 resize-none not-focus:hover:border-gray-500 read-only:text-gray-400/80 outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition-all duration-200 rounded-lg",s),placeholder:e,required:a,onChange:n,rows:4,value:l,readOnly:m,maxLength:500}):J("input",{type:r,id:o,name:o,className:"mt-2 w-full h-12 px-3 border border-gray-300 not-focus:hover:border-gray-500 read-only:text-gray-400/80 outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition-all duration-200 rounded-lg",placeholder:e,required:a,onChange:n,value:l,readOnly:m,maxLength:500})]})}import{Loader2Icon as ht}from"lucide-react";import{jsx as Ne}from"react/jsx-runtime";function ee({label:t,loading:r,type:e="submit",className:o="",disabled:a=!1,onClick:n}){return Ne("button",{type:e,disabled:a,className:g("relative w-full mt-4 h-12 px-6 py-3 cursor-pointer font-medium bg-gray-900 hover:opacity-85 text-white rounded-lg",o),"aria-label":t,onClick:n,children:r?Ne(ht,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 animate-spin mx-auto"}):t})}import{FormSyncButton as vt,FormSyncForm as wt}from"formsync";import{Fragment as ke,jsx as w,jsxs as R}from"react/jsx-runtime";function Se(){var i,c,h,p;let[t,r]=K(null),{docstraConfig:e}=b(),[o,a]=K(""),[n,l]=K(!1),[m,s]=K(null),d="https://github.com/"+((i=e==null?void 0:e.editOnGithub)==null?void 0:i.owner)+"/"+((c=e==null?void 0:e.editOnGithub)==null?void 0:c.repo);return w("div",{className:"border-y border-gray-200 mt-10 py-10 space-y-4",children:n?R(ke,{children:[w("p",{className:"font-medium text-gray-900",children:"We appreciate your feedback, Thank you!"}),w(ee,{onClick:()=>{l(!1),r(null),a("")},label:"Submit Again",className:"w-max text-sm"})]}):R(ke,{children:[w("p",{className:"font-medium",children:"How is this guide?"}),R("div",{className:"flex gap-2",children:[R("button",{onClick:()=>r("good"),className:`flex items-center cursor-pointer gap-1 px-3 py-2 rounded-full border text-sm ${t==="good"?"bg-green-100 text-green-600 border-green-300":"border-gray-200 text-gray-600 hover:bg-gray-100"}`,children:[w(xt,{className:`size-4 ${t==="good"?"fill-green-600":"text-gray-500"}`}),"Good"]}),R("button",{onClick:()=>r("bad"),className:`flex items-center cursor-pointer gap-1 px-3 py-2 rounded-full border text-sm ${t==="bad"?"bg-red-100 text-red-600 border-red-300":"border-gray-200 text-gray-600 hover:bg-gray-100"}`,children:[w(yt,{className:`size-4 pt-0.5 ${t==="bad"?"fill-red-600":"text-gray-500"}`}),"Bad"]})]}),t&&R(wt,{className:"flex flex-col gap-2",formId:((h=e==null?void 0:e.feedback)==null?void 0:h.formSyncFormID)||"",onSuccess:x=>{l(!0),r(null),a("")},onSubmitError:x=>{s(x.message)},children:[w(j,{value:o,id:"message",onChange:x=>a(x.target.value),placeholder:"Leave your feedback...",required:!0,type:"textarea"}),m&&w("p",{className:"text-red-500",children:m}),w("input",{type:"hidden",name:"opinion",value:t}),w("input",{type:"hidden",name:"page",value:window.location.href}),w("input",{type:"hidden",name:"_redirect",value:window.location.href}),w(vt,{className:"relative mt-4 h-12 px-6 py-3 cursor-pointer font-medium bg-gray-900 hover:opacity-85 text-white rounded-lg w-max text-sm",children:"Submit"}),((p=e==null?void 0:e.feedback)==null?void 0:p.watermark)!==!1&&R("p",{className:"text-left text-sm text-gray-500 mt-6",children:["Powered by"," ",w("a",{href:`https://www.formsync.app?utm_source=${d}`,className:"text-gray-800 not-prose",children:"FormSync"})]})]})]})})}import{jsxs as Nt}from"react/jsx-runtime";function Ie(){var e;let{pageData:t}=b();if(!((e=t==null?void 0:t.data)!=null&&e.lastUpdated))return null;let r=new Date(t.data.lastUpdated).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",timeZone:"UTC"});return Nt("p",{className:"text-sm text-gray-500",children:["Last updated on ",r]})}import{CheckIcon as kt,CopyIcon as St}from"lucide-react";import{useEffect as It,useState as Ce}from"react";import{jsx as te,jsxs as De}from"react/jsx-runtime";function Le(){let{pageData:t}=b(),[r,e]=Ce(!1),[o,a]=Ce(null);It(()=>{a(window.location.href)},[]);let n=`Read from this URL: ${o} and explain it to me.`;return De("div",{className:"flex items-center gap-3 mt-6",children:[De("button",{title:"Copy Markdown",onClick:()=>{navigator.clipboard.writeText((t==null?void 0:t.data.raw)||""),e(!0),setTimeout(()=>e(!1),3e3)},className:"flex items-center cursor-pointer gap-2 bg-gray-50 hover:bg-gray-100 border border-gray-200 px-3 py-2 rounded-md text-xs",children:[r?te(kt,{className:"size-3.5"}):te(St,{className:"size-3.5"}),"Copy Markdown"]}),te("a",{title:"Ask ChatGPT",href:`https://chatgpt.com/?hints=search&q=${encodeURIComponent(n)}`,className:"flex not-prose items-center gap-2 bg-gray-50 hover:bg-gray-100 border border-gray-200 px-3 py-2 rounded-md text-xs",rel:"noreferrer noopener",children:"Ask ChatGPT"})]})}import{usePathname as Ct}from"next/navigation";import Oe from"next/link";import{ArrowLeftIcon as Dt,ArrowRightIcon as Lt}from"lucide-react";import{jsx as B,jsxs as F}from"react/jsx-runtime";function Pe(t){let r=[];for(let e of t)e.type==="page"?r.push({name:e.title,href:e.href,icon:e.icon}):e.type==="section"&&r.push(...Pe(e.children));return r}function Re(){var m;let t=Ct(),{docstraConfig:r,sidebarItems:e}=b(),o=[];e&&e.length>0?o=Pe(e):(m=r==null?void 0:r.sidebar)!=null&&m.links&&(o=r.sidebar.links.flatMap(s=>s.items));let a=o.findIndex(s=>s.href===t),n=a>0?o[a-1]:null,l=a<o.length-1?o[a+1]:null;return F("div",{className:"flex flex-col lg:flex-row gap-2 justify-between py-10 mt-10",children:[n?F(Oe,{href:n.href,className:"flex flex-col not-prose items-start gap-2 border border-gray-200 hover:bg-gray-50 py-3 md:min-w-62 pl-4 pr-10 rounded-lg text-sm",children:[B("span",{className:"text-gray-500",children:"Previous"}),F("p",{className:"flex items-center font-medium",children:[B(Dt,{className:"size-5 mr-2"}),n.name]})]}):B("div",{}),l?F(Oe,{href:l.href,className:"flex flex-col not-prose items-end gap-2 border border-gray-200 hover:bg-gray-50 py-3 pr-4 md:min-w-62 pl-10 rounded-lg text-sm",children:[B("span",{className:"text-gray-500",children:"Next"}),F("p",{className:"flex items-center font-medium",children:[l.name,B(Lt,{className:"size-5 ml-2"})]})]}):B("div",{})]})}import{Fragment as Ot,jsx as k,jsxs as Te}from"react/jsx-runtime";function ho({children:t}){var o,a,n;let{docstraConfig:r,page:e}=b();return Te(Ot,{children:[k(de,{}),Te("main",{className:"flex-1 px-4 md:px-8 md:pl-80 pt-28 py-10 prose max-w-none",children:[k(he,{}),k("h1",{className:"text-3xl font-bold",children:(o=e==null?void 0:e.metadata)==null?void 0:o.title}),k("p",{className:"my-4 text-gray-500",children:(a=e==null?void 0:e.metadata)==null?void 0:a.description}),k(Le,{}),k("hr",{className:"my-10 border-gray-200"}),t,((n=r==null?void 0:r.feedback)==null?void 0:n.enabled)&&k(Se,{}),k(Ie,{}),k(Re,{})]}),k(ve,{})]})}import{CheckIcon as ze,CopyIcon as Ee}from"lucide-react";import{Highlight as Pt,themes as Rt}from"prism-react-renderer";import{useState as Tt}from"react";import{toast as zt}from"react-toast-msg";import{jsx as v,jsxs as V}from"react/jsx-runtime";var re={npm:"npm install",pnpm:"pnpm add",yarn:"yarn add",bun:"bun add"};function Io(t){var T,I;let{filename:r,copyable:e,children:o,className:a}=t,{packageManager:n,setPackageManager:l}=b(),m=!(a!=null&&a.includes("language-")),s=typeof o=="string"?o:((T=o==null?void 0:o.props)==null?void 0:T.children)||"";if(m)return v("code",{className:"not-prose px-1 py-0.5 rounded border border-gray-200 bg-gray-50 text-gray-800 text-sm",children:s});let[d,i]=Tt(!1),c=a==null?void 0:a.match(/language-([\w-]+)/),h=(I=c==null?void 0:c[1])!=null?I:"txt",p=h==="package-install",x=()=>{let N=p?`${re[n]} ${s.trim()}`:s.trim();navigator.clipboard.writeText(N),i(!0),zt.success("Code copied to clipboard"),setTimeout(()=>i(!1),2e3)};return V("div",{className:"max-w-2xl overflow-hidden rounded-lg text-sm text-gray-800 border border-gray-200 mt-4 bg-white",children:[V("div",{className:"flex items-center justify-between bg-gray-50 border-b border-gray-200",children:[!p&&v("span",{className:"text-xs text-gray-400 px-4 py-3",children:r||h}),p&&v("div",{className:"flex items-center px-3",children:Object.keys(re).map(N=>v("button",{onClick:()=>l(N),className:`px-3 pb-2.5 pt-3 text-sm font-medium border-b-2 transition-all ${n===N?"border-gray-900 text-gray-900":"border-transparent text-gray-500 hover:text-gray-800"}`,children:N},N))}),e&&!p&&v("button",{onClick:x,className:"rounded-lg cursor-pointer p-2 m-2 text-gray-500 hover:bg-gray-200 transition",children:d?v(ze,{className:"size-4 text-green-600"}):v(Ee,{className:"size-4"})})]}),v(Pt,{theme:Rt.vsLight,code:s.trim(),language:p?"bash":h,children:({tokens:N,getLineProps:U,getTokenProps:A})=>V("pre",{className:`p-4 font-mono whitespace-pre overflow-x-auto text-sm leading-relaxed ${e&&p?"flex items-center justify-between":""}`,children:[N.map(($,u)=>V("div",ne(Y({},U({line:$})),{children:[!p&&v("span",{className:"text-gray-400 mr-4 select-none",children:u+1}),p&&v("span",{className:"mr-2",children:re[n]}),$.map((f,C)=>v("span",Y({},A({token:f})),C))]}),u)),e&&p&&v("button",{onClick:x,className:"rounded-lg cursor-pointer p-2 text-gray-500 hover:bg-gray-100 transition",children:d?v(ze,{className:"size-4 text-green-600"}):v(Ee,{className:"size-4"})})]})})]})}export{ho as DocstraBody,Io as DocstraCodeBlock,de as DocstraHeader,xr as DocstraLayout,Jt as DocstraProvider,b as useDocstra};
1
+ "use client";import{createContext as Me,useContext as Ge,useState as K}from"react";import{ToastContainer as Fe}from"react-toast-msg";import{SearchIcon as Re}from"lucide-react";import{twMerge as Oe}from"tailwind-merge";import Pe from"clsx";function d(...e){return Oe(Pe(e))}import{useEffect as q,useMemo as Te,useState as j}from"react";import ze from"fuse.js";import Ee from"next/link";import{useRouter as Be}from"next/navigation";import{Fragment as $e,jsx as C,jsxs as G}from"react/jsx-runtime";function ee(){let{openSearchBox:e,setOpenSearchBox:r,page:t}=p(),[o,a]=j(""),[n,s]=j([]),l=Be();q(()=>{let i=g=>{g.ctrlKey&&g.key==="k"&&(g.preventDefault(),r(!0))};return window.addEventListener("keydown",i),()=>{window.removeEventListener("keydown",i)}},[]);let c=Te(()=>!t||t.length===0?null:new ze(t,{keys:["data.metadata.title","data.metadata.description"],threshold:.3}),[t]);q(()=>{if(o&&c){let i=c.search(o);s(i.map(g=>g.item))}else o||s([])},[o,c]);let f=i=>{if(i.preventDefault(),o){let g=n[0];g&&(l.push(`/docs/${g.slug}`),a(""),r(!1))}};return q(()=>{let i=g=>{g.key==="Escape"&&(r(!1),a(""))};return e&&window.addEventListener("keydown",i),()=>{window.removeEventListener("keydown",i)}},[e]),C("div",{onClick:()=>{r(!1),a("")},className:d("fixed inset-0 z-25 flex items-start justify-center bg-white/40 backdrop-blur-md opacity-0 pointer-events-none transition-all duration-300",e&&"opacity-100 pointer-events-auto"),children:G("div",{onClick:i=>i.stopPropagation(),className:"flex flex-col items-center mt-30 max-w-lg w-full max-md:px-4",children:[C("form",{onSubmit:f,className:d("relative flex items-center justify-between w-full bg-white border border-slate-200 text-gray-400 h-15 p-0.5 rounded-md",o&&"rounded-b-none border-b-0"),children:e&&G($e,{children:[C(Re,{className:"size-5.5 mx-3 shrink-0"}),C("input",{className:"w-full bg-transparent h-full outline-none text-gray-400 placeholder:text-gray-400",type:"text",placeholder:"Search docs...",spellCheck:"false",autoFocus:!0,value:o,onChange:i=>a(i.target.value),name:"searchQuery",required:!0}),C("span",{className:"border border-gray-200 px-2 mr-3 py-1 rounded text-xs",children:"Esc"})]})}),G("div",{className:d("max-h-70 overflow-x-hidden overflow-y-auto scrollbar-y w-full bg-white text-slate-700 flex flex-col",o&&"rounded-b-md border border-slate-200"),children:[n.map(i=>G(Ee,{href:`/docs/${i.slug==="index"?"":i.slug}`,onClick:()=>{r(!1),a("")},className:"w-full hover:bg-gray-100/70 border-b border-slate-200 transition-all py-4 px-4 last:mb-2",children:[C("h4",{className:"font-medium",children:i.data?.metadata?.title||i.slug}),C("p",{className:"text-sm mt-1 text-gray-500",children:i.data?.metadata?.description})]},i.slug)),o&&n.length===0&&C("div",{className:"text-gray-500 text-center py-20",children:"No results found"})]})]})})}import{jsx as te,jsxs as Ue}from"react/jsx-runtime";var re=Me(null);function Ft({children:e,docstraConfig:r,page:t,sidebarItems:o}){let[a,n]=K(!1),[s,l]=K(!1),[c,f]=K("npm");return Ue(re.Provider,{value:{openSidebar:a,setOpenSidebar:n,docstraConfig:r,openSearchBox:s,setOpenSearchBox:l,packageManager:c,setPackageManager:f,sidebarItems:o,page:t},children:[te(Fe,{}),te(ee,{}),e]})}function p(){let e=Ge(re);if(!e)throw new Error("Please wrap your app with DocstraProvider");return e}import{TextAlignEnd as Ae,XIcon as He}from"lucide-react";import{useEffect as qe}from"react";import V from"next/link";import{jsx as k,jsxs as oe}from"react/jsx-runtime";function ae(){let{openSidebar:e,setOpenSidebar:r,docstraConfig:t}=p(),o="https://github.com/"+t?.editOnGithub?.owner+"/"+t?.editOnGithub?.repo;return qe(()=>{e?document.body.classList.add("max-md:overflow-hidden"):document.body.classList.remove("max-md:overflow-hidden")},[e]),oe("header",{className:"fixed w-full top-0 z-10 text-sm flex items-center justify-between border-b border-gray-100 h-18 px-4 md:px-6 bg-white",children:[k(V,{href:t.navbar?.logo?.link||"/",className:"hover:opacity-80 transition",children:k("img",{src:t.navbar?.logo?.src||"/logo.png",alt:t.navbar?.logo?.alt||"Logo",className:d("h-9.5 w-auto",t.navbar?.logo?.className)})}),oe("div",{className:"hidden divide-x divide-gray-200 md:flex items-center",children:[t.navbar?.links?.map(a=>k(V,{href:a.href,className:"px-6 hover:text-gray-600",children:a.name},a.name)),k(V,{href:o||"https://github.com/sudhucodes/docstra",children:k("svg",{className:"size-6 mx-6",width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:k("path",{d:"M12 .3a12 12 0 0 0-3.8 23.38c.6.12.83-.26.83-.57L9 21.07c-3.34.72-4.04-1.61-4.04-1.61-.55-1.39-1.34-1.76-1.34-1.76-1.08-.74.09-.73.09-.73 1.2.09 1.83 1.24 1.83 1.24 1.08 1.83 2.81 1.3 3.5 1 .1-.78.42-1.31.76-1.61-2.67-.3-5.47-1.33-5.47-5.93 0-1.31.47-2.38 1.24-3.22-.14-.3-.54-1.52.1-3.18 0 0 1-.32 3.3 1.23a11.5 11.5 0 0 1 6 0c2.28-1.55 3.29-1.23 3.29-1.23.64 1.66.24 2.88.12 3.18a4.65 4.65 0 0 1 1.23 3.22c0 4.61-2.8 5.63-5.48 5.92.42.36.81 1.1.81 2.22l-.01 3.29c0 .31.2.69.82.57A12 12 0 0 0 12 .3"})})})]}),k("button",{onClick:()=>r(!e),className:"md:hidden transition text-gray-600 active:ring-2 ring-gray-200 p-1.5 rounded-md",children:e?k(He,{className:"size-6.5"}):k(Ae,{className:"size-6.5"})})]})}import{ChevronDownIcon as Ve,SearchIcon as Ye}from"lucide-react";import{usePathname as Qe}from"next/navigation";import*as Ke from"lucide-react";function Y(e){if(e)return Ke[e]}import ne from"next/link";import{useState as Q}from"react";import{Fragment as Xe,jsx as b,jsxs as I}from"react/jsx-runtime";function _e({item:e,pathname:r,openSidebar:t,setOpenSidebar:o}){let[a,n]=Q(e.defaultOpen??!0),s=e.collapsible??!0,l=Y(e.icon);return I("div",{children:[I(ne,{href:e.href,onClick:()=>s&&n(c=>!c),className:"w-full flex items-center justify-between gap-2 text-gray-500 hover:bg-gray-100 py-2 px-2.5 rounded-lg",children:[I("span",{className:"flex items-center gap-2",children:[l&&b(l,{className:"size-4 text-gray-400"}),e.title]}),s&&b(Ve,{className:d("size-4 text-black/50 transition-transform duration-300",a&&"rotate-180")})]}),(!s||a)&&b("ul",{className:"mb-4 ml-2",children:e.children.map((c,f)=>b(se,{item:c,pathname:r,openSidebar:t,setOpenSidebar:o},`${c.type}-${f}`))})]})}function We({item:e,pathname:r,openSidebar:t,setOpenSidebar:o}){let a=Y(e.icon);return I(ne,{href:e.href,onClick:()=>t&&o(!1),className:d("flex items-center gap-2 text-gray-500 hover:bg-gray-100 py-2 px-2.5 rounded-lg",r===e.href&&"bg-gray-100 text-gray-800"),children:[a&&b(a,{className:"size-4"}),b("span",{children:e.title})]})}function se({item:e,pathname:r,openSidebar:t,setOpenSidebar:o}){switch(e.type){case"page":return b(We,{item:e,pathname:r,openSidebar:t,setOpenSidebar:o});case"section":return b(_e,{item:e,pathname:r,openSidebar:t,setOpenSidebar:o});default:return null}}function ie({sidebarItems:e}){let[r,t]=Q(!1),[o,a]=Q(!1),n=Qe();return I(Xe,{children:[b("div",{className:d("fixed inset-0 z-20 bg-black/50 opacity-0 pointer-events-none transition-all duration-300",r&&"opacity-100 pointer-events-auto"),onClick:()=>t(!1)}),I("aside",{className:d("fixed md:top-18 h-[calc(100svh-72px)] scrollbar-y w-screen max-md:rounded-t-lg z-21 md:w-72 pb-10 text-base md:text-sm shrink-0 border-r border-gray-200 p-4 max-md:fixed bg-white overflow-y-auto transition-all duration-300",r?"top-32":"top-full"),children:[I("div",{className:"flex items-center select-none gap-2 cursor-pointer mt-6 mb-4 p-2.5 text-gray-500 border border-gray-200 rounded-lg hover:bg-gray-50",onClick:()=>{t(r&&!1),a(!0)},children:[b(Ye,{className:"size-4.5"}),b("p",{children:"Search"}),I("div",{className:"ms-auto font-mono inline-flex gap-0.5",children:[b("span",{className:"rounded-md border border-gray-200 px-1.5",children:"Ctrl"}),b("span",{className:"rounded-md border border-gray-200 px-1.5",children:"K"})]})]}),e.map((s,l)=>b(se,{item:s,pathname:n,openSidebar:r,setOpenSidebar:t},`${s.type}-${l}`))]})]})}import{jsx as Ze,jsxs as Je}from"react/jsx-runtime";function nr({children:e,sidebarItems:r}){return Je("div",{className:"min-h-screen flex bg-white w-full",children:[Ze(ie,{sidebarItems:r}),e]})}import{usePathname as je}from"next/navigation";import{ChevronRight as et}from"lucide-react";import le from"next/link";import{jsx as R,jsxs as ce}from"react/jsx-runtime";function me(){let r=je().split("/").filter(Boolean),t=r.map((o,a)=>{let n="/"+r.slice(0,a+1).join("/"),s=o.replace(/-/g," ").replace(/\b\w/g,l=>l.toUpperCase());return{href:n,title:s}});return R("nav",{"aria-label":"Breadcrumb",className:"flex text-sm items-center pb-4 text-gray-500 not-prose",children:ce("ol",{className:"flex items-center space-x-2",children:[R("li",{children:R(le,{href:"/",className:"hover:text-gray-700 transition-colors font-medium",children:"Home"})}),t.map((o,a)=>{let n=a===t.length-1;return ce("li",{className:"flex items-center space-x-2",children:[R(et,{className:"w-4 h-4 text-gray-400"}),n?R("span",{className:"text-gray-600 font-medium",children:o.title}):R(le,{href:o.href,className:"hover:text-gray-700 font-medium transition-colors",children:o.title})]},o.href)})]})})}import{ArrowUpCircleIcon as tt,SquareArrowOutUpRightIcon as rt,TextAlignStartIcon as ot}from"lucide-react";import{usePathname as at}from"next/navigation";import{useEffect as z,useRef as de,useState as F}from"react";import{jsx as D,jsxs as E}from"react/jsx-runtime";function ue(){let[e,r]=F(null),[t,o]=F("down"),[a,n]=F(!1),[s,l]=F(!1),{docstraConfig:c,page:f}=p(),i=f?.path,g=f?.tableOfContents||[],O=de(0),y=de(null),$=at(),H=`${"https://github.com/"+c?.editOnGithub?.owner+"/"+c?.editOnGithub?.repo}/edit/main/${c?.editOnGithub?.path}/${i}`;z(()=>{let m=()=>{let u=window.scrollY;o(u>O.current?"down":"up"),n(u>100),O.current=u};return window.addEventListener("scroll",m),()=>window.removeEventListener("scroll",m)},[]),z(()=>{let m=document.querySelectorAll("h2[id], h3[id]"),u=new IntersectionObserver(S=>{if(s)return;let N=S.filter(P=>P.isIntersecting).sort((P,Le)=>P.boundingClientRect.top-Le.boundingClientRect.top);if(N.length>0){let P=t==="down"?N[0].target.id:N[N.length-1].target.id;r(P)}},{rootMargin:"-40% 0px -50% 0px",threshold:[0,.2,.6,1]});return m.forEach(S=>u.observe(S)),y.current=u,()=>u.disconnect()},[$,t,s]),z(()=>{!(window.scrollY>100)&&r(g[0]?.id)},[g]),z(()=>{if(!e)return;let m=document.querySelector(".toc-scroll-container");if(!m)return;let u=m.querySelector(`a[href="#${e}"]`);if(!u)return;let S=m.getBoundingClientRect(),N=u.getBoundingClientRect();(N.top<S.top||N.bottom>S.bottom)&&u.scrollIntoView({behavior:"smooth",block:"nearest"})},[e]),z(()=>{if(!s)return;let m=setTimeout(()=>l(!1),800);return()=>clearTimeout(m)},[s]);let M=m=>{r(m),l(!0)};return E("aside",{className:"sticky top-18 text-sm hidden xl:block text-gray-500 shrink-0 h-[calc(100svh-72px)] w-64 border-l border-gray-200 p-6 overflow-y-auto",children:[E("p",{className:"flex items-center gap-2 mb-5",children:[D(ot,{className:"size-4"}),"On this page"]}),D("ul",{className:"toc-scroll-container max-h-3/4 overflow-y-auto scrollbar-none",children:g.map(m=>E("li",{children:[D(pe,{heading:m,activeId:e,handleClick:M}),m.children.map(u=>D(pe,{heading:u,activeId:e,handleClick:M,className:"pl-8"},u.id))]},m.id))}),D("hr",{className:"my-6 border-gray-200"}),c.editOnGithub&&E("a",{href:H,rel:"noopener noreferrer",className:"flex items-center gap-2 text-gray-400 hover:text-gray-700 transition",children:["Edit this page on GitHub",D(rt,{className:"size-4"})]}),a&&E("button",{onClick:()=>scrollTo({top:0,behavior:"smooth"}),className:"flex items-center cursor-pointer gap-2 mt-3 text-gray-400 hover:text-gray-700 transition",children:["Scroll to top",D(tt,{className:"size-4"})]})]})}function pe({heading:e,activeId:r,handleClick:t,className:o}){return D("a",{href:`#${e.id}`,className:d("border-l border-gray-200 block py-1.5 pl-4 transition-colors",o,{"border-gray-800 text-gray-900 font-medium":r===e.id,"hover:text-gray-800 hover:border-gray-400":r!==e.id}),onClick:()=>t(e.id),children:e.text})}import{useState as U}from"react";import{ThumbsUp as st,ThumbsDown as it}from"lucide-react";import{jsx as _,jsxs as fe}from"react/jsx-runtime";function W({label:e,type:r,placeholder:t="",id:o,required:a=!1,onChange:n,value:s,readOnly:l=!1,className:c="",optional:f=!1}){return fe("div",{className:d("flex flex-col mt-4 w-full",c),children:[e&&fe("label",{htmlFor:o,className:"font-medium w-max cursor-pointer",children:[e,f&&_("span",{className:"text-xs font-normal text-gray-400 ml-1 mt-1",children:"(Optional)"})]}),r==="textarea"?_("textarea",{id:o,name:o,className:d("mt-2 w-full p-3 border border-gray-300 resize-none not-focus:hover:border-gray-500 read-only:text-gray-400/80 outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition-all duration-200 rounded-lg",c),placeholder:t,required:a,onChange:n,rows:4,value:s,readOnly:l,maxLength:500}):_("input",{type:r,id:o,name:o,className:"mt-2 w-full h-12 px-3 border border-gray-300 not-focus:hover:border-gray-500 read-only:text-gray-400/80 outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition-all duration-200 rounded-lg",placeholder:t,required:a,onChange:n,value:s,readOnly:l,maxLength:500})]})}import{Loader2Icon as nt}from"lucide-react";import{jsx as ge}from"react/jsx-runtime";function X({label:e,loading:r,type:t="submit",className:o="",disabled:a=!1,onClick:n}){return ge("button",{type:t,disabled:a,className:d("relative w-full mt-4 h-12 px-6 py-3 cursor-pointer font-medium bg-gray-900 hover:opacity-85 text-white rounded-lg",o),"aria-label":e,onClick:n,children:r?ge(nt,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 animate-spin mx-auto"}):e})}import{FormSyncButton as lt,FormSyncForm as ct}from"formsync";import{Fragment as be,jsx as x,jsxs as L}from"react/jsx-runtime";function he(){let[e,r]=U(null),{docstraConfig:t}=p(),[o,a]=U(""),[n,s]=U(!1),[l,c]=U(null),f="https://github.com/"+t?.editOnGithub?.owner+"/"+t?.editOnGithub?.repo;return x("div",{className:"border-y border-gray-200 mt-10 py-10 space-y-4",children:n?L(be,{children:[x("p",{className:"font-medium text-gray-900",children:"We appreciate your feedback, Thank you!"}),x(X,{onClick:()=>{s(!1),r(null),a("")},label:"Submit Again",className:"w-max text-sm"})]}):L(be,{children:[x("p",{className:"font-medium",children:"How is this guide?"}),L("div",{className:"flex gap-2",children:[L("button",{onClick:()=>r("good"),className:`flex items-center cursor-pointer gap-1 px-3 py-2 rounded-full border text-sm ${e==="good"?"bg-green-100 text-green-600 border-green-300":"border-gray-200 text-gray-600 hover:bg-gray-100"}`,children:[x(st,{className:`size-4 ${e==="good"?"fill-green-600":"text-gray-500"}`}),"Good"]}),L("button",{onClick:()=>r("bad"),className:`flex items-center cursor-pointer gap-1 px-3 py-2 rounded-full border text-sm ${e==="bad"?"bg-red-100 text-red-600 border-red-300":"border-gray-200 text-gray-600 hover:bg-gray-100"}`,children:[x(it,{className:`size-4 pt-0.5 ${e==="bad"?"fill-red-600":"text-gray-500"}`}),"Bad"]})]}),e&&L(ct,{className:"flex flex-col gap-2",formId:t?.feedback?.formSyncFormID||"",onSuccess:i=>{s(!0),r(null),a("")},onSubmitError:i=>{c(i.message)},children:[x(W,{value:o,id:"message",onChange:i=>a(i.target.value),placeholder:"Leave your feedback...",required:!0,type:"textarea"}),l&&x("p",{className:"text-red-500",children:l}),x("input",{type:"hidden",name:"opinion",value:e}),x("input",{type:"hidden",name:"page",value:window.location.href}),x("input",{type:"hidden",name:"_redirect",value:window.location.href}),x(lt,{className:"relative mt-4 h-12 px-6 py-3 cursor-pointer font-medium bg-gray-900 hover:opacity-85 text-white rounded-lg w-max text-sm",children:"Submit"}),t?.feedback?.watermark!==!1&&L("p",{className:"text-left text-sm text-gray-500 mt-6",children:["Powered by"," ",x("a",{href:`https://www.formsync.app?utm_source=${f}`,className:"text-gray-800 not-prose",children:"FormSync"})]})]})]})})}import{jsxs as mt}from"react/jsx-runtime";function xe(){let{pageData:e}=p();if(!e?.data?.lastUpdated)return null;let r=new Date(e.data.lastUpdated).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",timeZone:"UTC"});return mt("p",{className:"text-sm text-gray-500",children:["Last updated on ",r]})}import{CheckIcon as dt,CopyIcon as pt}from"lucide-react";import{useEffect as ut,useState as ye}from"react";import{jsx as Z,jsxs as ve}from"react/jsx-runtime";function we(){let{pageData:e}=p(),[r,t]=ye(!1),[o,a]=ye(null);ut(()=>{a(window.location.href)},[]);let n=`Read from this URL: ${o} and explain it to me.`;return ve("div",{className:"flex items-center gap-3 mt-6",children:[ve("button",{title:"Copy Markdown",onClick:()=>{navigator.clipboard.writeText(e?.data.raw||""),t(!0),setTimeout(()=>t(!1),3e3)},className:"flex items-center cursor-pointer gap-2 bg-gray-50 hover:bg-gray-100 border border-gray-200 px-3 py-2 rounded-md text-xs",children:[r?Z(dt,{className:"size-3.5"}):Z(pt,{className:"size-3.5"}),"Copy Markdown"]}),Z("a",{title:"Ask ChatGPT",href:`https://chatgpt.com/?hints=search&q=${encodeURIComponent(n)}`,className:"flex not-prose items-center gap-2 bg-gray-50 hover:bg-gray-100 border border-gray-200 px-3 py-2 rounded-md text-xs",rel:"noreferrer noopener",children:"Ask ChatGPT"})]})}import{usePathname as ft}from"next/navigation";import Ne from"next/link";import{ArrowLeftIcon as gt,ArrowRightIcon as bt}from"lucide-react";import{jsx as T,jsxs as B}from"react/jsx-runtime";function ke(e){let r=[];for(let t of e)t.type==="page"?r.push({name:t.title,href:t.href,icon:t.icon}):t.type==="section"&&r.push(...ke(t.children));return r}function Se(){let e=ft(),{docstraConfig:r,sidebarItems:t}=p(),o=[];t&&t.length>0?o=ke(t):r?.sidebar?.links&&(o=r.sidebar.links.flatMap(l=>l.items));let a=o.findIndex(l=>l.href===e),n=a>0?o[a-1]:null,s=a<o.length-1?o[a+1]:null;return B("div",{className:"flex flex-col lg:flex-row gap-2 justify-between py-10 mt-10",children:[n?B(Ne,{href:n.href,className:"flex flex-col not-prose items-start gap-2 border border-gray-200 hover:bg-gray-50 py-3 md:min-w-62 pl-4 pr-10 rounded-lg text-sm",children:[T("span",{className:"text-gray-500",children:"Previous"}),B("p",{className:"flex items-center font-medium",children:[T(gt,{className:"size-5 mr-2"}),n.name]})]}):T("div",{}),s?B(Ne,{href:s.href,className:"flex flex-col not-prose items-end gap-2 border border-gray-200 hover:bg-gray-50 py-3 pr-4 md:min-w-62 pl-10 rounded-lg text-sm",children:[T("span",{className:"text-gray-500",children:"Next"}),B("p",{className:"flex items-center font-medium",children:[s.name,T(bt,{className:"size-5 ml-2"})]})]}):T("div",{})]})}import{Fragment as ht,jsx as v,jsxs as Ce}from"react/jsx-runtime";function oo({children:e}){let{docstraConfig:r,page:t}=p();return Ce(ht,{children:[v(ae,{}),Ce("main",{className:"flex-1 px-4 md:px-8 md:pl-80 pt-28 py-10 prose max-w-none",children:[v(me,{}),v("h1",{className:"text-3xl font-bold",children:t?.metadata?.title}),v("p",{className:"my-4 text-gray-500",children:t?.metadata?.description}),v(we,{}),v("hr",{className:"my-10 border-gray-200"}),e,r?.feedback?.enabled&&v(he,{}),v(xe,{}),v(Se,{})]}),v(ue,{})]})}import{CheckIcon as Ie,CopyIcon as De}from"lucide-react";import{Highlight as xt,themes as yt}from"prism-react-renderer";import{useState as vt}from"react";import{toast as wt}from"react-toast-msg";import{jsx as h,jsxs as A}from"react/jsx-runtime";var J={npm:"npm install",pnpm:"pnpm add",yarn:"yarn add",bun:"bun add"};function po(e){let{filename:r,copyable:t,children:o,className:a}=e,{packageManager:n,setPackageManager:s}=p(),l=!a?.includes("language-"),c=typeof o=="string"?o:o?.props?.children||"";if(l)return h("code",{className:"not-prose px-1 py-0.5 rounded border border-gray-200 bg-gray-50 text-gray-800 text-sm",children:c});let[f,i]=vt(!1),O=a?.match(/language-([\w-]+)/)?.[1]??"txt",y=O==="package-install",$=()=>{let w=y?`${J[n]} ${c.trim()}`:c.trim();navigator.clipboard.writeText(w),i(!0),wt.success("Code copied to clipboard"),setTimeout(()=>i(!1),2e3)};return A("div",{className:"max-w-2xl overflow-hidden rounded-lg text-sm text-gray-800 border border-gray-200 mt-4 bg-white",children:[A("div",{className:"flex items-center justify-between bg-gray-50 border-b border-gray-200",children:[!y&&h("span",{className:"text-xs text-gray-400 px-4 py-3",children:r||O}),y&&h("div",{className:"flex items-center px-3",children:Object.keys(J).map(w=>h("button",{onClick:()=>s(w),className:`px-3 pb-2.5 pt-3 text-sm font-medium border-b-2 transition-all ${n===w?"border-gray-900 text-gray-900":"border-transparent text-gray-500 hover:text-gray-800"}`,children:w},w))}),t&&!y&&h("button",{onClick:$,className:"rounded-lg cursor-pointer p-2 m-2 text-gray-500 hover:bg-gray-200 transition",children:f?h(Ie,{className:"size-4 text-green-600"}):h(De,{className:"size-4"})})]}),h(xt,{theme:yt.vsLight,code:c.trim(),language:y?"bash":O,children:({tokens:w,getLineProps:H,getTokenProps:M})=>A("pre",{className:`p-4 font-mono whitespace-pre overflow-x-auto text-sm leading-relaxed ${t&&y?"flex items-center justify-between":""}`,children:[w.map((m,u)=>A("div",{...H({line:m}),children:[!y&&h("span",{className:"text-gray-400 mr-4 select-none",children:u+1}),y&&h("span",{className:"mr-2",children:J[n]}),m.map((S,N)=>h("span",{...M({token:S})},N))]},u)),t&&y&&h("button",{onClick:$,className:"rounded-lg cursor-pointer p-2 text-gray-500 hover:bg-gray-100 transition",children:f?h(Ie,{className:"size-4 text-green-600"}):h(De,{className:"size-4"})})]})})]})}export{oo as DocstraBody,po as DocstraCodeBlock,ae as DocstraHeader,nr as DocstraLayout,Ft as DocstraProvider,p as useDocstra};
package/dist/mdx/index.js CHANGED
@@ -1,27 +1 @@
1
- "use strict";var ye=Object.create;var j=Object.defineProperty,Ee=Object.defineProperties,be=Object.getOwnPropertyDescriptor,Pe=Object.getOwnPropertyDescriptors,xe=Object.getOwnPropertyNames,vt=Object.getOwnPropertySymbols,ve=Object.getPrototypeOf,Dt=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable;var ct=(e,s,t)=>s in e?j(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,b=(e,s)=>{for(var t in s||(s={}))Dt.call(s,t)&&ct(e,t,s[t]);if(vt)for(var t of vt(s))De.call(s,t)&&ct(e,t,s[t]);return e},v=(e,s)=>Ee(e,Pe(s));var dt=(e,s)=>()=>(e&&(s=e(e=0)),s);var Rt=(e,s)=>{for(var t in s)j(e,t,{get:s[t],enumerable:!0})},It=(e,s,t,i)=>{if(s&&typeof s=="object"||typeof s=="function")for(let n of xe(s))!Dt.call(e,n)&&n!==t&&j(e,n,{get:()=>s[n],enumerable:!(i=be(s,n))||i.enumerable});return e};var D=(e,s,t)=>(t=e!=null?ye(ve(e)):{},It(s||!e||!e.__esModule?j(t,"default",{value:e,enumerable:!0}):t,e)),Re=e=>It(j({},"__esModule",{value:!0}),e);var f=(e,s,t)=>ct(e,typeof s!="symbol"?s+"":s,t);function Ot(e,s={}){let t=s.entryType||s.type;if(t==="both"&&(t=x.FILE_DIR_TYPE),t&&(s.type=t),e){if(typeof e!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(t&&!Nt.includes(t))throw new Error(`readdirp: Invalid type passed. Use one of ${Nt.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return s.root=e,new ut(s)}var T,S,Ct,x,ft,At,Te,Nt,Se,Fe,Ne,We,Wt,kt,ut,Lt=dt(()=>{"use strict";T=require("fs/promises"),S=require("path"),Ct=require("stream"),x={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},ft={root:".",fileFilter:e=>!0,directoryFilter:e=>!0,type:x.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(ft);At="READDIRP_RECURSIVE_ERROR",Te=new Set(["ENOENT","EPERM","EACCES","ELOOP",At]),Nt=[x.DIR_TYPE,x.EVERYTHING_TYPE,x.FILE_DIR_TYPE,x.FILE_TYPE],Se=new Set([x.DIR_TYPE,x.EVERYTHING_TYPE,x.FILE_DIR_TYPE]),Fe=new Set([x.EVERYTHING_TYPE,x.FILE_DIR_TYPE,x.FILE_TYPE]),Ne=e=>Te.has(e.code),We=process.platform==="win32",Wt=e=>!0,kt=e=>{if(e===void 0)return Wt;if(typeof e=="function")return e;if(typeof e=="string"){let s=e.trim();return t=>t.basename===s}if(Array.isArray(e)){let s=e.map(t=>t.trim());return t=>s.some(i=>t.basename===i)}return Wt},ut=class extends Ct.Readable{constructor(t={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:t.highWaterMark});f(this,"parents");f(this,"reading");f(this,"parent");f(this,"_stat");f(this,"_maxDepth");f(this,"_wantsDir");f(this,"_wantsFile");f(this,"_wantsEverything");f(this,"_root");f(this,"_isDirent");f(this,"_statsProp");f(this,"_rdOptions");f(this,"_fileFilter");f(this,"_directoryFilter");let i=b(b({},ft),t),{root:n,type:r}=i;this._fileFilter=kt(i.fileFilter),this._directoryFilter=kt(i.directoryFilter);let o=i.lstat?T.lstat:T.stat;We?this._stat=a=>o(a,{bigint:!0}):this._stat=o,this._maxDepth=i.depth!=null&&Number.isSafeInteger(i.depth)?i.depth:ft.depth,this._wantsDir=r?Se.has(r):!1,this._wantsFile=r?Fe.has(r):!1,this._wantsEverything=r===x.EVERYTHING_TYPE,this._root=(0,S.resolve)(n),this._isDirent=!i.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(n,1)],this.reading=!1,this.parent=void 0}async _read(t){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&t>0;){let i=this.parent,n=i&&i.files;if(n&&n.length>0){let{path:r,depth:o}=i,a=n.splice(0,t).map(c=>this._formatEntry(c,r)),l=await Promise.all(a);for(let c of l){if(!c)continue;if(this.destroyed)return;let h=await this._getEntryType(c);h==="directory"&&this._directoryFilter(c)?(o<=this._maxDepth&&this.parents.push(this._exploreDir(c.fullPath,o+1)),this._wantsDir&&(this.push(c),t--)):(h==="file"||this._includeAsFile(c))&&this._fileFilter(c)&&this._wantsFile&&(this.push(c),t--)}}else{let r=this.parents.pop();if(!r){this.push(null);break}if(this.parent=await r,this.destroyed)return}}}catch(i){this.destroy(i)}finally{this.reading=!1}}}async _exploreDir(t,i){let n;try{n=await(0,T.readdir)(t,this._rdOptions)}catch(r){this._onError(r)}return{files:n,depth:i,path:t}}async _formatEntry(t,i){let n,r=this._isDirent?t.name:t;try{let o=(0,S.resolve)((0,S.join)(i,r));n={path:(0,S.relative)(this._root,o),fullPath:o,basename:r},n[this._statsProp]=this._isDirent?t:await this._stat(o)}catch(o){this._onError(o);return}return n}_onError(t){Ne(t)&&!this.destroyed?this.emit("warn",t):this.destroy(t)}async _getEntryType(t){if(!t&&this._statsProp in t)return"";let i=t[this._statsProp];if(i.isFile())return"file";if(i.isDirectory())return"directory";if(i&&i.isSymbolicLink()){let n=t.fullPath;try{let r=await(0,T.realpath)(n),o=await(0,T.lstat)(r);if(o.isFile())return"file";if(o.isDirectory()){let a=r.length;if(n.startsWith(r)&&n.substr(a,1)===S.sep){let l=new Error(`Circular symlink detected: "${n}" points to "${r}"`);return l.code=At,this._onError(l)}return"directory"}}catch(r){return this._onError(r),""}}}_includeAsFile(t){let i=t&&t[this._statsProp];return i&&this._wantsEverything&&!i.isDirectory()}}});function jt(e,s,t,i,n){let r=(o,a)=>{t(e),n(o,a,{watchedPath:e}),a&&e!==a&&V(w.resolve(e,a),F,w.join(e,a))};try{return(0,N.watch)(e,{persistent:s.persistent},r)}catch(o){i(o);return}}var N,I,Mt,w,ke,_t,Ht,X,J,wt,Ce,Ae,Oe,zt,g,R,Le,je,F,B,O,Me,He,ze,mt,z,$e,$,$t,q,V,Ye,pt,Ue,K,Yt=dt(()=>{"use strict";N=require("fs"),I=require("fs/promises"),Mt=require("os"),w=D(require("path"),1),ke="data",_t="end",Ht="close",X=()=>{},J=process.platform,wt=J==="win32",Ce=J==="darwin",Ae=J==="linux",Oe=J==="freebsd",zt=(0,Mt.type)()==="OS400",g={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},R=g,Le="watch",je={lstat:I.lstat,stat:I.stat},F="listeners",B="errHandlers",O="rawEmitters",Me=[F,B,O],He=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),ze=e=>He.has(w.extname(e).slice(1).toLowerCase()),mt=(e,s)=>{e instanceof Set?e.forEach(s):s(e)},z=(e,s,t)=>{let i=e[s];i instanceof Set||(e[s]=i=new Set([i])),i.add(t)},$e=e=>s=>{let t=e[s];t instanceof Set?t.clear():delete e[s]},$=(e,s,t)=>{let i=e[s];i instanceof Set?i.delete(t):i===t&&delete e[s]},$t=e=>e instanceof Set?e.size===0:!e,q=new Map;V=(e,s,t,i,n)=>{let r=q.get(e);r&&mt(r[s],o=>{o(t,i,n)})},Ye=(e,s,t,i)=>{let{listener:n,errHandler:r,rawEmitter:o}=i,a=q.get(s),l;if(!t.persistent)return l=jt(e,t,n,r,o),l?l.close.bind(l):void 0;if(a)z(a,F,n),z(a,B,r),z(a,O,o);else{if(l=jt(e,t,V.bind(null,s,F),r,V.bind(null,s,O)),!l)return;l.on(R.ERROR,async c=>{let h=V.bind(null,s,B);if(a&&(a.watcherUnusable=!0),wt&&c.code==="EPERM")try{await(await(0,I.open)(e,"r")).close(),h(c)}catch(d){}else h(c)}),a={listeners:n,errHandlers:r,rawEmitters:o,watcher:l},q.set(s,a)}return()=>{$(a,F,n),$(a,B,r),$(a,O,o),$t(a.listeners)&&(a.watcher.close(),q.delete(s),Me.forEach($e(a)),a.watcher=void 0,Object.freeze(a))}},pt=new Map,Ue=(e,s,t,i)=>{let{listener:n,rawEmitter:r}=i,o=pt.get(s),a=o&&o.options;return a&&(a.persistent<t.persistent||a.interval>t.interval)&&((0,N.unwatchFile)(s),o=void 0),o?(z(o,F,n),z(o,O,r)):(o={listeners:n,rawEmitters:r,options:t,watcher:(0,N.watchFile)(s,t,(l,c)=>{mt(o.rawEmitters,d=>{d(R.CHANGE,s,{curr:l,prev:c})});let h=l.mtimeMs;(l.size!==c.size||h>c.mtimeMs||h===0)&&mt(o.listeners,d=>d(e,l))})},pt.set(s,o)),()=>{$(o,F,n),$(o,O,r),$t(o.listeners)&&(pt.delete(s),(0,N.unwatchFile)(s),o.options=o.watcher=void 0,Object.freeze(o))}},K=class{constructor(s){f(this,"fsw");f(this,"_boundHandleError");this.fsw=s,this._boundHandleError=t=>s._handleError(t)}_watchWithNodeFs(s,t){let i=this.fsw.options,n=w.dirname(s),r=w.basename(s);this.fsw._getWatchedDir(n).add(r);let a=w.resolve(s),l={persistent:i.persistent};t||(t=X);let c;if(i.usePolling){let h=i.interval!==i.binaryInterval;l.interval=h&&ze(r)?i.binaryInterval:i.interval,c=Ue(s,a,l,{listener:t,rawEmitter:this.fsw._emitRaw})}else c=Ye(s,a,l,{listener:t,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return c}_handleFile(s,t,i){if(this.fsw.closed)return;let n=w.dirname(s),r=w.basename(s),o=this.fsw._getWatchedDir(n),a=t;if(o.has(r))return;let l=async(h,d)=>{if(this.fsw._throttle(Le,s,5)){if(!d||d.mtimeMs===0)try{let u=await(0,I.stat)(s);if(this.fsw.closed)return;let m=u.atimeMs,_=u.mtimeMs;if((!m||m<=_||_!==a.mtimeMs)&&this.fsw._emit(R.CHANGE,s,u),(Ce||Ae||Oe)&&a.ino!==u.ino){this.fsw._closeFile(h),a=u;let E=this._watchWithNodeFs(s,l);E&&this.fsw._addPathCloser(h,E)}else a=u}catch(u){this.fsw._remove(n,r)}else if(o.has(r)){let u=d.atimeMs,m=d.mtimeMs;(!u||u<=m||m!==a.mtimeMs)&&this.fsw._emit(R.CHANGE,s,d),a=d}}},c=this._watchWithNodeFs(s,l);if(!(i&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(s)){if(!this.fsw._throttle(R.ADD,s,0))return;this.fsw._emit(R.ADD,s,t)}return c}async _handleSymlink(s,t,i,n){if(this.fsw.closed)return;let r=s.fullPath,o=this.fsw._getWatchedDir(t);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let a;try{a=await(0,I.realpath)(i)}catch(l){return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(o.has(n)?this.fsw._symlinkPaths.get(r)!==a&&(this.fsw._symlinkPaths.set(r,a),this.fsw._emit(R.CHANGE,i,s.stats)):(o.add(n),this.fsw._symlinkPaths.set(r,a),this.fsw._emit(R.ADD,i,s.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(r))return!0;this.fsw._symlinkPaths.set(r,!0)}_handleRead(s,t,i,n,r,o,a){s=w.join(s,"");let l=n?`${s}:${n}`:s;if(a=this.fsw._throttle("readdir",l,1e3),!a)return;let c=this.fsw._getWatchedDir(i.path),h=new Set,d=this.fsw._readdirp(s,{fileFilter:u=>i.filterPath(u),directoryFilter:u=>i.filterDir(u)});if(d)return d.on(ke,async u=>{if(this.fsw.closed){d=void 0;return}let m=u.path,_=w.join(s,m);if(h.add(m),!(u.stats.isSymbolicLink()&&await this._handleSymlink(u,s,_,m))){if(this.fsw.closed){d=void 0;return}(m===n||!n&&!c.has(m))&&(this.fsw._incrReadyCount(),_=w.join(r,w.relative(r,_)),this._addToNodeFs(_,t,i,o+1))}}).on(R.ERROR,this._boundHandleError),new Promise((u,m)=>{if(!d)return m();d.once(_t,()=>{if(this.fsw.closed){d=void 0;return}let _=a?a.clear():!1;u(void 0),c.getChildren().filter(E=>E!==s&&!h.has(E)).forEach(E=>{this.fsw._remove(s,E)}),d=void 0,_&&this._handleRead(s,!1,i,n,r,o,a)})})}async _handleDir(s,t,i,n,r,o,a){let l=this.fsw._getWatchedDir(w.dirname(s)),c=l.has(w.basename(s));!(i&&this.fsw.options.ignoreInitial)&&!r&&!c&&this.fsw._emit(R.ADD_DIR,s,t),l.add(w.basename(s)),this.fsw._getWatchedDir(s);let h,d,u=this.fsw.options.depth;if((u==null||n<=u)&&!this.fsw._symlinkPaths.has(a)){if(!r&&(await this._handleRead(s,i,o,r,s,n,h),this.fsw.closed))return;d=this._watchWithNodeFs(s,(m,_)=>{_&&_.mtimeMs===0||this._handleRead(m,!1,o,r,s,n,h)})}return d}async _addToNodeFs(s,t,i,n,r){let o=this.fsw._emitReady;if(this.fsw._isIgnored(s)||this.fsw.closed)return o(),!1;let a=this.fsw._getWatchHelpers(s);i&&(a.filterPath=l=>i.filterPath(l),a.filterDir=l=>i.filterDir(l));try{let l=await je[a.statMethod](a.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(a.watchPath,l))return o(),!1;let c=this.fsw.options.followSymlinks,h;if(l.isDirectory()){let d=w.resolve(s),u=c?await(0,I.realpath)(s):s;if(this.fsw.closed||(h=await this._handleDir(a.watchPath,l,t,n,r,a,u),this.fsw.closed))return;d!==u&&u!==void 0&&this.fsw._symlinkPaths.set(d,u)}else if(l.isSymbolicLink()){let d=c?await(0,I.realpath)(s):s;if(this.fsw.closed)return;let u=w.dirname(a.watchPath);if(this.fsw._getWatchedDir(u).add(a.watchPath),this.fsw._emit(R.ADD,a.watchPath,l),h=await this._handleDir(u,l,t,n,s,a,d),this.fsw.closed)return;d!==void 0&&this.fsw._symlinkPaths.set(w.resolve(s),d)}else h=this._handleFile(a.watchPath,l,t);return o(),h&&this.fsw._addPathCloser(s,h),!1}catch(l){if(this.fsw._handleError(l))return o(),s}}}});var te={};Rt(te,{FSWatcher:()=>Y,WatchHelper:()=>Z,default:()=>rs,watch:()=>Zt});function Q(e){return Array.isArray(e)?e:[e]}function Je(e){return typeof e=="function"?e:typeof e=="string"?s=>e===s:e instanceof RegExp?s=>e.test(s):typeof e=="object"&&e!==null?s=>{if(e.path===s)return!0;if(e.recursive){let t=p.relative(e.path,s);return t?!t.startsWith("..")&&!p.isAbsolute(t):!1}return!1}:()=>!1}function Qe(e){if(typeof e!="string")throw new Error("string expected");e=p.normalize(e),e=e.replace(/\\/g,"/");let s=!1;return e.startsWith("//")&&(s=!0),e=e.replace(Jt,"/"),s&&(e="/"+e),e}function Ut(e,s,t){let i=Qe(s);for(let n=0;n<e.length;n++){let r=e[n];if(r(i,t))return!0}return!1}function Ze(e,s){if(e==null)throw new TypeError("anymatch: specify first argument");let i=Q(e).map(n=>Je(n));return s==null?(n,r)=>Ut(i,n,r):Ut(i,s)}function Zt(e,s={}){let t=new Y(s);return t.add(e),t}var Vt,Kt,tt,p,gt,Ge,Xt,Be,qe,Ve,Jt,Ke,Xe,yt,Gt,Bt,Qt,qt,ts,es,Et,ss,is,Z,Y,rs,ee=dt(()=>{"use strict";Vt=require("events"),Kt=require("fs"),tt=require("fs/promises"),p=D(require("path"),1);Lt();Yt();gt="/",Ge="//",Xt=".",Be="..",qe="string",Ve=/\\/g,Jt=/\/\//g,Ke=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,Xe=/^\.[/\\]/;yt=e=>typeof e=="object"&&e!==null&&!(e instanceof RegExp);Gt=e=>{let s=Q(e).flat();if(!s.every(t=>typeof t===qe))throw new TypeError(`Non-string provided as watch path: ${s}`);return s.map(Qt)},Bt=e=>{let s=e.replace(Ve,gt),t=!1;return s.startsWith(Ge)&&(t=!0),s=s.replace(Jt,gt),t&&(s=gt+s),s},Qt=e=>Bt(p.normalize(Bt(e))),qt=(e="")=>s=>typeof s=="string"?Qt(p.isAbsolute(s)?s:p.join(e,s)):s,ts=(e,s)=>p.isAbsolute(e)?e:p.join(s,e),es=Object.freeze(new Set),Et=class{constructor(s,t){f(this,"path");f(this,"_removeWatcher");f(this,"items");this.path=s,this._removeWatcher=t,this.items=new Set}add(s){let{items:t}=this;t&&s!==Xt&&s!==Be&&t.add(s)}async remove(s){let{items:t}=this;if(!t||(t.delete(s),t.size>0))return;let i=this.path;try{await(0,tt.readdir)(i)}catch(n){this._removeWatcher&&this._removeWatcher(p.dirname(i),p.basename(i))}}has(s){let{items:t}=this;if(t)return t.has(s)}getChildren(){let{items:s}=this;return s?[...s.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=X,this.items=es,Object.freeze(this)}},ss="stat",is="lstat",Z=class{constructor(s,t,i){f(this,"fsw");f(this,"path");f(this,"watchPath");f(this,"fullWatchPath");f(this,"dirParts");f(this,"followSymlinks");f(this,"statMethod");this.fsw=i;let n=s;this.path=s=s.replace(Xe,""),this.watchPath=n,this.fullWatchPath=p.resolve(n),this.dirParts=[],this.dirParts.forEach(r=>{r.length>1&&r.pop()}),this.followSymlinks=t,this.statMethod=t?ss:is}entryPath(s){return p.join(this.watchPath,p.relative(this.watchPath,s.fullPath))}filterPath(s){let{stats:t}=s;if(t&&t.isSymbolicLink())return this.filterDir(s);let i=this.entryPath(s);return this.fsw._isntIgnored(i,t)&&this.fsw._hasReadPermissions(t)}filterDir(s){return this.fsw._isntIgnored(this.entryPath(s),s.stats)}},Y=class extends Vt.EventEmitter{constructor(t={}){super();f(this,"closed");f(this,"options");f(this,"_closers");f(this,"_ignoredPaths");f(this,"_throttled");f(this,"_streams");f(this,"_symlinkPaths");f(this,"_watched");f(this,"_pendingWrites");f(this,"_pendingUnlinks");f(this,"_readyCount");f(this,"_emitReady");f(this,"_closePromise");f(this,"_userIgnored");f(this,"_readyEmitted");f(this,"_emitRaw");f(this,"_boundRemove");f(this,"_nodeFsHandler");this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let i=t.awaitWriteFinish,n={stabilityThreshold:2e3,pollInterval:100},r=v(b({persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0},t),{ignored:t.ignored?Q(t.ignored):Q([]),awaitWriteFinish:i===!0?n:typeof i=="object"?b(b({},n),i):!1});zt&&(r.usePolling=!0),r.atomic===void 0&&(r.atomic=!r.usePolling);let o=process.env.CHOKIDAR_USEPOLLING;if(o!==void 0){let c=o.toLowerCase();c==="false"||c==="0"?r.usePolling=!1:c==="true"||c==="1"?r.usePolling=!0:r.usePolling=!!c}let a=process.env.CHOKIDAR_INTERVAL;a&&(r.interval=Number.parseInt(a,10));let l=0;this._emitReady=()=>{l++,l>=this._readyCount&&(this._emitReady=X,this._readyEmitted=!0,process.nextTick(()=>this.emit(g.READY)))},this._emitRaw=(...c)=>this.emit(g.RAW,...c),this._boundRemove=this._remove.bind(this),this.options=r,this._nodeFsHandler=new K(this),Object.freeze(r)}_addIgnoredPath(t){if(yt(t)){for(let i of this._ignoredPaths)if(yt(i)&&i.path===t.path&&i.recursive===t.recursive)return}this._ignoredPaths.add(t)}_removeIgnoredPath(t){if(this._ignoredPaths.delete(t),typeof t=="string")for(let i of this._ignoredPaths)yt(i)&&i.path===t&&this._ignoredPaths.delete(i)}add(t,i,n){let{cwd:r}=this.options;this.closed=!1,this._closePromise=void 0;let o=Gt(t);return r&&(o=o.map(a=>ts(a,r))),o.forEach(a=>{this._removeIgnoredPath(a)}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=o.length,Promise.all(o.map(async a=>{let l=await this._nodeFsHandler._addToNodeFs(a,!n,void 0,0,i);return l&&this._emitReady(),l})).then(a=>{this.closed||a.forEach(l=>{l&&this.add(p.dirname(l),p.basename(i||l))})}),this}unwatch(t){if(this.closed)return this;let i=Gt(t),{cwd:n}=this.options;return i.forEach(r=>{!p.isAbsolute(r)&&!this._closers.has(r)&&(n&&(r=p.join(n,r)),r=p.resolve(r)),this._closePath(r),this._addIgnoredPath(r),this._watched.has(r)&&this._addIgnoredPath({path:r,recursive:!0}),this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let t=[];return this._closers.forEach(i=>i.forEach(n=>{let r=n();r instanceof Promise&&t.push(r)})),this._streams.forEach(i=>i.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(i=>i.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=t.length?Promise.all(t).then(()=>{}):Promise.resolve(),this._closePromise}getWatched(){let t={};return this._watched.forEach((i,n)=>{let o=(this.options.cwd?p.relative(this.options.cwd,n):n)||Xt;t[o]=i.getChildren().sort()}),t}emitWithAll(t,i){this.emit(t,...i),t!==g.ERROR&&this.emit(g.ALL,t,...i)}async _emit(t,i,n){if(this.closed)return;let r=this.options;wt&&(i=p.normalize(i)),r.cwd&&(i=p.relative(r.cwd,i));let o=[i];n!=null&&o.push(n);let a=r.awaitWriteFinish,l;if(a&&(l=this._pendingWrites.get(i)))return l.lastChange=new Date,this;if(r.atomic){if(t===g.UNLINK)return this._pendingUnlinks.set(i,[t,...o]),setTimeout(()=>{this._pendingUnlinks.forEach((c,h)=>{this.emit(...c),this.emit(g.ALL,...c),this._pendingUnlinks.delete(h)})},typeof r.atomic=="number"?r.atomic:100),this;t===g.ADD&&this._pendingUnlinks.has(i)&&(t=g.CHANGE,this._pendingUnlinks.delete(i))}if(a&&(t===g.ADD||t===g.CHANGE)&&this._readyEmitted){let c=(h,d)=>{h?(t=g.ERROR,o[0]=h,this.emitWithAll(t,o)):d&&(o.length>1?o[1]=d:o.push(d),this.emitWithAll(t,o))};return this._awaitWriteFinish(i,a.stabilityThreshold,t,c),this}if(t===g.CHANGE&&!this._throttle(g.CHANGE,i,50))return this;if(r.alwaysStat&&n===void 0&&(t===g.ADD||t===g.ADD_DIR||t===g.CHANGE)){let c=r.cwd?p.join(r.cwd,i):i,h;try{h=await(0,tt.stat)(c)}catch(d){}if(!h||this.closed)return;o.push(h)}return this.emitWithAll(t,o),this}_handleError(t){let i=t&&t.code;return t&&i!=="ENOENT"&&i!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||i!=="EPERM"&&i!=="EACCES")&&this.emit(g.ERROR,t),t||this.closed}_throttle(t,i,n){this._throttled.has(t)||this._throttled.set(t,new Map);let r=this._throttled.get(t);if(!r)throw new Error("invalid throttle");let o=r.get(i);if(o)return o.count++,!1;let a,l=()=>{let h=r.get(i),d=h?h.count:0;return r.delete(i),clearTimeout(a),h&&clearTimeout(h.timeoutObject),d};a=setTimeout(l,n);let c={timeoutObject:a,clear:l,count:0};return r.set(i,c),c}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(t,i,n,r){let o=this.options.awaitWriteFinish;if(typeof o!="object")return;let a=o.pollInterval,l,c=t;this.options.cwd&&!p.isAbsolute(t)&&(c=p.join(this.options.cwd,t));let h=new Date,d=this._pendingWrites;function u(m){(0,Kt.stat)(c,(_,E)=>{if(_||!d.has(t)){_&&_.code!=="ENOENT"&&r(_);return}let P=Number(new Date);m&&E.size!==m.size&&(d.get(t).lastChange=P);let at=d.get(t);P-at.lastChange>=i?(d.delete(t),r(void 0,E)):l=setTimeout(u,a,E)})}d.has(t)||(d.set(t,{lastChange:h,cancelWait:()=>(d.delete(t),clearTimeout(l),n)}),l=setTimeout(u,a))}_isIgnored(t,i){if(this.options.atomic&&Ke.test(t))return!0;if(!this._userIgnored){let{cwd:n}=this.options,o=(this.options.ignored||[]).map(qt(n)),l=[...[...this._ignoredPaths].map(qt(n)),...o];this._userIgnored=Ze(l,void 0)}return this._userIgnored(t,i)}_isntIgnored(t,i){return!this._isIgnored(t,i)}_getWatchHelpers(t){return new Z(t,this.options.followSymlinks,this)}_getWatchedDir(t){let i=p.resolve(t);return this._watched.has(i)||this._watched.set(i,new Et(i,this._boundRemove)),this._watched.get(i)}_hasReadPermissions(t){return this.options.ignorePermissionErrors?!0:!!(Number(t.mode)&256)}_remove(t,i,n){let r=p.join(t,i),o=p.resolve(r);if(n=n!=null?n:this._watched.has(r)||this._watched.has(o),!this._throttle("remove",r,100))return;!n&&this._watched.size===1&&this.add(t,i,!0),this._getWatchedDir(r).getChildren().forEach(m=>this._remove(r,m));let c=this._getWatchedDir(t),h=c.has(i);c.remove(i),this._symlinkPaths.has(o)&&this._symlinkPaths.delete(o);let d=r;if(this.options.cwd&&(d=p.relative(this.options.cwd,r)),this.options.awaitWriteFinish&&this._pendingWrites.has(d)&&this._pendingWrites.get(d).cancelWait()===g.ADD)return;this._watched.delete(r),this._watched.delete(o);let u=n?g.UNLINK_DIR:g.UNLINK;h&&!this._isIgnored(r)&&this._emit(u,r),this._closePath(r)}_closePath(t){this._closeFile(t);let i=p.dirname(t);this._getWatchedDir(i).remove(p.basename(t))}_closeFile(t){let i=this._closers.get(t);i&&(i.forEach(n=>n()),this._closers.delete(t))}_addPathCloser(t,i){if(!i)return;let n=this._closers.get(t);n||(n=[],this._closers.set(t,n)),n.push(i)}_readdirp(t,i){if(this.closed)return;let n=v(b({type:g.ALL,alwaysStat:!0,lstat:!0},i),{depth:0}),r=Ot(t,n);return this._streams.add(r),r.once(Ht,()=>{r=void 0}),r.once(_t,()=>{r&&(this._streams.delete(r),r=void 0)}),r}};rs={watch:Zt,FSWatcher:Y}});var ws={};Rt(ws,{createSource:()=>ps,defaultMdxComponents:()=>Ie,defineDocstraConfig:()=>_s,generateSidebar:()=>ue,getPageData:()=>ms,loadDocstraConfig:()=>ge,runDocstraBuild:()=>nt,runDocstraDev:()=>_e,withDocstra:()=>us});module.exports=Re(ws);var C=require("lucide-react"),M=require("react/jsx-runtime");function ht({type:e="info",children:s}){let t={info:"border-blue-500 bg-blue-50 text-blue-500",warning:"border-yellow-500 bg-yellow-50 text-yellow-500",error:"border-red-500 bg-red-50 text-red-500"},n={info:C.InfoIcon,warning:C.AlertTriangleIcon,error:C.AlertCircleIcon}[e];return(0,M.jsxs)("div",{className:`flex not-prose items-center gap-2 border-l-4 ${t[e]} px-4 py-2.5`,children:[(0,M.jsx)(n,{className:"w-5 h-5 shrink-0"}),(0,M.jsx)("div",{children:s})]})}var Ft=D(require("next/link"));var St=require("lucide-react");function Tt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}var H=require("react/jsx-runtime");function A({children:e,level:s}){let t=`h${s}`,n=Tt(typeof e=="string"?e:"");return(0,H.jsxs)(t,{id:n,className:"group",children:[(0,H.jsx)("a",{className:"not-prose",href:`#${n}`,children:e}),(0,H.jsx)(St.LinkIcon,{className:"inline-block ml-2 size-5 text-gray-400 opacity-0 group-hover:opacity-100 transition"})]})}var y=require("react/jsx-runtime"),Ie={h1:e=>(0,y.jsx)("h1",{className:"text-3xl font-bold text-gray-900",children:e.children}),h2:e=>(0,y.jsx)(A,v(b({},e),{level:2})),h3:e=>(0,y.jsx)(A,v(b({},e),{level:3})),h4:e=>(0,y.jsx)(A,v(b({},e),{level:4})),h5:e=>(0,y.jsx)(A,v(b({},e),{level:5})),p:e=>(0,y.jsx)("p",{children:e.children}),hr:e=>(0,y.jsx)("hr",v(b({},e),{className:"border-gray-200"})),a:e=>e.href.startsWith("http")?(0,y.jsx)("a",v(b({href:e.href,className:"underline underline-offset-4"},e),{target:"_blank",rel:"noopener noreferrer",children:e.children})):(0,y.jsx)(Ft.default,v(b({href:e.href,className:"underline underline-offset-4"},e),{children:e.children})),ul:e=>(0,y.jsx)("ul",{children:e.children}),li:e=>(0,y.jsx)("li",{children:e.children}),ol:e=>(0,y.jsx)("ol",{children:e.children}),blockquote:e=>(0,y.jsx)("blockquote",{className:"not-italic",children:e.children}),pre:e=>(0,y.jsx)("pre",{className:"not-prose",children:e.children}),Callout:ht,table:e=>(0,y.jsx)("table",{children:e.children}),thead:e=>(0,y.jsx)("thead",{children:e.children}),tbody:e=>(0,y.jsx)("tbody",{children:e.children}),tr:e=>(0,y.jsx)("tr",{children:e.children}),th:e=>(0,y.jsx)("th",{children:e.children}),td:e=>(0,y.jsx)("td",{children:e.children})};var k=D(require("fs"),1),L=D(require("path"),1),ot=D(require("fs"),1),W=D(require("path"),1),he=D(require("fs"),1),fe=D(require("gray-matter"),1),it=D(require("path"),1),we=D(require("fs"),1),ns=Object.defineProperty,os=Object.defineProperties,as=Object.getOwnPropertyDescriptors,rt=Object.getOwnPropertySymbols,ce=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable,se=(e,s,t)=>s in e?ns(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,et=(e,s)=>{for(var t in s||(s={}))ce.call(s,t)&&se(e,t,s[t]);if(rt)for(var t of rt(s))de.call(s,t)&&se(e,t,s[t]);return e},st=(e,s)=>os(e,as(s)),U=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(s,t)=>(typeof require!="undefined"?require:s)[t]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),ls=(e,s)=>{var t={};for(var i in e)ce.call(e,i)&&s.indexOf(i)<0&&(t[i]=e[i]);if(e!=null&&rt)for(var i of rt(e))s.indexOf(i)<0&&de.call(e,i)&&(t[i]=e[i]);return t};function ie(e){try{let s=he.default.readFileSync(e,"utf-8"),{data:t}=(0,fe.default)(s);return{title:t.title,icon:t.icon,description:t.description,defaultOpen:t.defaultOpen,collapsible:t.collapsible}}catch(s){return{}}}function ue(e,s="/docs"){return ot.default.existsSync(e)?pe(e,e,s):[]}function pe(e,s,t){var i;let n=ot.default.readdirSync(e,{withFileTypes:!0}).sort((o,a)=>{let l=re(o.name),c=re(a.name);return l!==null&&c!==null?l-c:l!==null?-1:c!==null?1:o.name.localeCompare(a.name)}),r=[];for(let o of n){if(o.name.startsWith("_")||o.name.startsWith("."))continue;let a=W.default.join(e,o.name);if(o.isDirectory()){let l=G(o.name),c=cs(a),h=pe(a,s,t);if(c){let P=bt(W.default.relative(s,c).replace(/\\/g,"/")),at=Pt(P,t);h=h.filter(lt=>!(lt.type==="page"&&lt.href===at))}if(h.length===0&&!c)continue;let d=ne(l),u,m=!0,_=!0;if(c){let P=ie(c);P.title&&(d=P.title),P.icon&&(u=P.icon),P.defaultOpen!==void 0&&(m=P.defaultOpen),P.collapsible!==void 0&&(_=P.collapsible)}let E={type:"section",title:d,children:h,href:c?Pt(bt(W.default.relative(s,c).replace(/\\/g,"/")),t):"",icon:u,defaultOpen:m,collapsible:_};r.push(E)}else if(o.name.endsWith(".md")||o.name.endsWith(".mdx")){let l=W.default.relative(s,a).replace(/\\/g,"/"),c=bt(l),h=ie(a),d=o.name.replace(/\.(md|mdx)$/,""),u=G(d),m=Pt(c,t),_=u.toLowerCase()==="index",E={type:"page",title:(i=h.title)!=null?i:ne(_?G(W.default.basename(e)):u),href:m,icon:h.icon};r.push(E)}}return r}function re(e){let s=e.match(/^(\d+)-/);return s?parseInt(s[1],10):null}function G(e){return e.replace(/^\d+-/,"")}function cs(e){let s=ot.default.readdirSync(e);for(let t of s){let i=G(t);if(i==="index.md"||i==="index.mdx")return W.default.join(e,t)}return null}function ne(e){return e.toLowerCase()==="index"?"Home":e.replace(/[-_]/g," ").replace(/\b\w/g,s=>s.toUpperCase())}function bt(e){return e.replace(/\\/g,"/").split("/").map(s=>G(s)).join("/").replace(/\/index\.(md|mdx)$/,"").replace(/\.(md|mdx)$/,"").replace(/^index$/,"")}function Pt(e,s){return!e||e==="index"||e===""?s:`${s}/${e.startsWith("/")?e.slice(1):e}`}function nt(e,s="/docs"){let t=process.cwd(),i=L.default.join(t,".docstra"),n=L.default.join(i,"index.ts");k.default.existsSync(e)||(console.error(`Content directory not found: ${e}`),console.error(`Please create "${e}" or update "contentDir" in docstra.config.ts`),process.exit(1)),k.default.existsSync(i)||k.default.mkdirSync(i,{recursive:!0});let r=me(e);r.length===0&&console.warn(`No .md or .mdx files found in ${e}`);let o=[],a=[];r.forEach((h,d)=>{let u=L.default.relative(i,h).replace(/\\/g,"/"),m=`d${d}`;o.push(`import * as ${m} from "${u}?docstra";`);let _=L.default.relative(e,h).replace(/\\/g,"/"),E=hs(_);a.push(`{
2
- slug: "${E}",
3
- path: "${_}",
4
- data: {
5
- metadata: ${m}.metadata,
6
- raw: ${m}.raw,
7
- tableOfContents: ${m}.tableOfContents,
8
- body: ${m}.body,
9
- lastUpdated: ${m}.lastUpdated,
10
- }
11
- }`)});let l=ue(e,s),c=`// @ts-nocheck -- auto generated by docstra
12
- ${o.join(`
13
- `)}
14
- import type { SidebarItem } from "docstra-mdx";
15
-
16
- export const docs = [
17
- ${a.join(`,
18
- `)}
19
- ];
20
-
21
- export const sidebarItems: SidebarItem[] = ${JSON.stringify(l,null,2)} as SidebarItem[];
22
- `;k.default.writeFileSync(n,c,"utf8")}function me(e){return k.default.readdirSync(e).flatMap(s=>{let t=L.default.join(e,s);return k.default.statSync(t).isDirectory()?me(t):s.endsWith(".md")||s.endsWith(".mdx")?[t]:[]})}function ds(e){return e.replace(/^\d+-/,"")}function hs(e){return e.replace(/\\/g,"/").split("/").map(s=>ds(s)).join("/").replace(/\.(md|mdx)$/,"").replace(/\/index$/,"").replace(/^index$/,"")}var oe=!1,xt=null;async function _e(e){if(oe)return;oe=!0,await nt(e);let{FSWatcher:s}=await Promise.resolve().then(()=>(ee(),te)),t="docstra.config.ts",i=new s({ignoreInitial:!0,persistent:!0,ignored:["node_modules",".next"]});i.add([e,t]),console.log("\x1B[32m \u2713 \x1B[0mDocstra dev server started..."),i.on("all",async(n,r)=>{!r.endsWith(".md")&&!r.endsWith(".mdx")&&!r.endsWith("docstra.config.ts")||(xt&&clearTimeout(xt),xt=setTimeout(async()=>{await nt(e)},200),console.info("MDX content rebuilt successfully"))}),process.on("exit",()=>{i.closed||i.close()})}var fs="docs/content";function ge(){var e;let s=process.cwd(),t=it.default.join(s,"docstra.config.ts"),i={};if(we.default.existsSync(t))try{delete U.cache[U.resolve(t)];let r=U(t);i=(e=r.default)!=null?e:r}catch(r){console.error("Failed to load docstra.config.ts",r),process.exit(1)}else console.warn("No docstra.config.ts found, using defaults");let n=i.contentDir?it.default.resolve(s,i.contentDir):it.default.join(s,fs);return{root:s,contentDir:n,userConfig:i}}var ae=!1;function us(e={}){var s,t;let i=process.env.NODE_ENV==="development",n=process.env.NODE_ENV==="production",r=ge().contentDir;ae||(ae=!0,i&&_e(r),n&&(nt(r),console.log("\x1B[32m \u2713 \x1B[0mDocstra MDX index generated successfully")));let o=st(et({},e.turbopack),{rules:st(et({},(s=e.turbopack)==null?void 0:s.rules),{"*.{md,mdx}":{loaders:[{loader:U.resolve("./loader")}],as:"*.js"}})});return st(et({},e),{turbopack:o,pageExtensions:(t=e.pageExtensions)!=null?t:["ts","tsx","js","jsx","md","mdx"],webpack:(a,l)=>(a.module.rules.push({test:/\.(md|mdx)$/,resourceQuery:/docstra/,use:[{loader:U.resolve("./loader")}]}),typeof e.webpack=="function"?e.webpack(a,l):a)})}function le(e){return e!=null&&e.length?e.join("/"):""}function ps(e,s){return{getPage:t=>{let i=e.find(a=>a.slug===le(t));if(!i)return null;let n=i.data,{body:r}=n,o=ls(n,["body"]);return st(et({},o),{slug:i.slug,path:i.path})},getPageBody:t=>{let i=e.find(n=>n.slug===le(t));return i?i.data.body:null},generateStaticParams:()=>e.map(t=>({slug:t.slug===""?[]:t.slug.split("/")})),generateSitemap:({baseUrl:t,lastmod:i,changefreq:n,priority:r})=>e.map(o=>{let a=o.slug===""?"":o.slug.replace(/\/?index$/,"");return{url:`${t}/${a}`.replace(/\/$/,""),lastModified:i,changeFrequency:n,priority:r}}),sidebarItems:s!=null?s:[]}}function ms(e,s){return s.find(t=>t.slug===((e==null?void 0:e.filter(Boolean).join("/"))||""))}function _s(e){return e}0&&(module.exports={createSource,defaultMdxComponents,defineDocstraConfig,generateSidebar,getPageData,loadDocstraConfig,runDocstraBuild,runDocstraDev,withDocstra});
23
- /*! Bundled license information:
24
-
25
- chokidar/index.js:
26
- (*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) *)
27
- */
1
+ "use strict";var b=Object.create;var y=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var k=(e,n)=>{for(var t in n)y(e,t,{get:n[t],enumerable:!0})},h=(e,n,t,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of N(n))!C.call(e,l)&&l!==t&&y(e,l,{get:()=>n[l],enumerable:!(s=x(n,l))||s.enumerable});return e},f=(e,n,t)=>(h(e,n,"default"),t&&h(t,n,"default")),w=(e,n,t)=>(t=e!=null?b(v(e)):{},h(n||!e||!e.__esModule?y(t,"default",{value:e,enumerable:!0}):t,e)),I=e=>h(y({},"__esModule",{value:!0}),e);var d={};k(d,{defaultMdxComponents:()=>T});module.exports=I(d);var o=require("lucide-react"),i=require("react/jsx-runtime");function u({type:e="info",children:n}){let t={info:"border-blue-500 bg-blue-50 text-blue-500",warning:"border-yellow-500 bg-yellow-50 text-yellow-500",error:"border-red-500 bg-red-50 text-red-500"},l={info:o.InfoIcon,warning:o.AlertTriangleIcon,error:o.AlertCircleIcon}[e];return(0,i.jsxs)("div",{className:`flex not-prose items-center gap-2 border-l-4 ${t[e]} px-4 py-2.5`,children:[(0,i.jsx)(l,{className:"w-5 h-5 shrink-0"}),(0,i.jsx)("div",{children:n})]})}var m=w(require("next/link"));var g=require("lucide-react");function p(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}var c=require("react/jsx-runtime");function a({children:e,level:n}){let t=`h${n}`,l=p(typeof e=="string"?e:"");return(0,c.jsxs)(t,{id:l,className:"group",children:[(0,c.jsx)("a",{className:"not-prose",href:`#${l}`,children:e}),(0,c.jsx)(g.LinkIcon,{className:"inline-block ml-2 size-5 text-gray-400 opacity-0 group-hover:opacity-100 transition"})]})}var r=require("react/jsx-runtime"),T={h1:e=>(0,r.jsx)("h1",{className:"text-3xl font-bold text-gray-900",children:e.children}),h2:e=>(0,r.jsx)(a,{...e,level:2}),h3:e=>(0,r.jsx)(a,{...e,level:3}),h4:e=>(0,r.jsx)(a,{...e,level:4}),h5:e=>(0,r.jsx)(a,{...e,level:5}),p:e=>(0,r.jsx)("p",{children:e.children}),hr:e=>(0,r.jsx)("hr",{...e,className:"border-gray-200"}),a:e=>e.href.startsWith("http")?(0,r.jsx)("a",{href:e.href,className:"underline underline-offset-4",...e,target:"_blank",rel:"noopener noreferrer",children:e.children}):(0,r.jsx)(m.default,{href:e.href,className:"underline underline-offset-4",...e,children:e.children}),ul:e=>(0,r.jsx)("ul",{children:e.children}),li:e=>(0,r.jsx)("li",{children:e.children}),ol:e=>(0,r.jsx)("ol",{children:e.children}),blockquote:e=>(0,r.jsx)("blockquote",{className:"not-italic",children:e.children}),pre:e=>(0,r.jsx)("pre",{className:"not-prose",children:e.children}),Callout:u,table:e=>(0,r.jsx)("table",{children:e.children}),thead:e=>(0,r.jsx)("thead",{children:e.children}),tbody:e=>(0,r.jsx)("tbody",{children:e.children}),tr:e=>(0,r.jsx)("tr",{children:e.children}),th:e=>(0,r.jsx)("th",{children:e.children}),td:e=>(0,r.jsx)("td",{children:e.children})};f(d,require("docstra-mdx"),module.exports);0&&(module.exports={defaultMdxComponents,...require("docstra-mdx")});
@@ -1,27 +1 @@
1
- var wt=Object.defineProperty,ie=Object.defineProperties;var re=Object.getOwnPropertyDescriptors;var _t=Object.getOwnPropertySymbols;var ne=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable;var J=(e,s,t)=>s in e?wt(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,b=(e,s)=>{for(var t in s||(s={}))ne.call(s,t)&&J(e,t,s[t]);if(_t)for(var t of _t(s))oe.call(s,t)&&J(e,t,s[t]);return e},v=(e,s)=>ie(e,re(s));var R=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(s,t)=>(typeof require!="undefined"?require:s)[t]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Q=(e,s)=>()=>(e&&(s=e(e=0)),s);var ae=(e,s)=>{for(var t in s)wt(e,t,{get:s[t],enumerable:!0})};var f=(e,s,t)=>J(e,typeof s!="symbol"?s+"":s,t);import{lstat as bt,readdir as me,realpath as _e,stat as we}from"fs/promises";import{join as ge,relative as ye,resolve as Pt,sep as Ee}from"path";import{Readable as be}from"stream";function It(e,s={}){let t=s.entryType||s.type;if(t==="both"&&(t=x.FILE_DIR_TYPE),t&&(s.type=t),e){if(typeof e!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(t&&!xt.includes(t))throw new Error(`readdirp: Invalid type passed. Use one of ${xt.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return s.root=e,new et(s)}var x,tt,Rt,Pe,xt,xe,ve,De,Re,vt,Dt,et,Tt=Q(()=>{"use strict";x={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},tt={root:".",fileFilter:e=>!0,directoryFilter:e=>!0,type:x.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(tt);Rt="READDIRP_RECURSIVE_ERROR",Pe=new Set(["ENOENT","EPERM","EACCES","ELOOP",Rt]),xt=[x.DIR_TYPE,x.EVERYTHING_TYPE,x.FILE_DIR_TYPE,x.FILE_TYPE],xe=new Set([x.DIR_TYPE,x.EVERYTHING_TYPE,x.FILE_DIR_TYPE]),ve=new Set([x.EVERYTHING_TYPE,x.FILE_DIR_TYPE,x.FILE_TYPE]),De=e=>Pe.has(e.code),Re=process.platform==="win32",vt=e=>!0,Dt=e=>{if(e===void 0)return vt;if(typeof e=="function")return e;if(typeof e=="string"){let s=e.trim();return t=>t.basename===s}if(Array.isArray(e)){let s=e.map(t=>t.trim());return t=>s.some(i=>t.basename===i)}return vt},et=class extends be{constructor(t={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:t.highWaterMark});f(this,"parents");f(this,"reading");f(this,"parent");f(this,"_stat");f(this,"_maxDepth");f(this,"_wantsDir");f(this,"_wantsFile");f(this,"_wantsEverything");f(this,"_root");f(this,"_isDirent");f(this,"_statsProp");f(this,"_rdOptions");f(this,"_fileFilter");f(this,"_directoryFilter");let i=b(b({},tt),t),{root:n,type:r}=i;this._fileFilter=Dt(i.fileFilter),this._directoryFilter=Dt(i.directoryFilter);let o=i.lstat?bt:we;Re?this._stat=a=>o(a,{bigint:!0}):this._stat=o,this._maxDepth=i.depth!=null&&Number.isSafeInteger(i.depth)?i.depth:tt.depth,this._wantsDir=r?xe.has(r):!1,this._wantsFile=r?ve.has(r):!1,this._wantsEverything=r===x.EVERYTHING_TYPE,this._root=Pt(n),this._isDirent=!i.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(n,1)],this.reading=!1,this.parent=void 0}async _read(t){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&t>0;){let i=this.parent,n=i&&i.files;if(n&&n.length>0){let{path:r,depth:o}=i,a=n.splice(0,t).map(c=>this._formatEntry(c,r)),l=await Promise.all(a);for(let c of l){if(!c)continue;if(this.destroyed)return;let h=await this._getEntryType(c);h==="directory"&&this._directoryFilter(c)?(o<=this._maxDepth&&this.parents.push(this._exploreDir(c.fullPath,o+1)),this._wantsDir&&(this.push(c),t--)):(h==="file"||this._includeAsFile(c))&&this._fileFilter(c)&&this._wantsFile&&(this.push(c),t--)}}else{let r=this.parents.pop();if(!r){this.push(null);break}if(this.parent=await r,this.destroyed)return}}}catch(i){this.destroy(i)}finally{this.reading=!1}}}async _exploreDir(t,i){let n;try{n=await me(t,this._rdOptions)}catch(r){this._onError(r)}return{files:n,depth:i,path:t}}async _formatEntry(t,i){let n,r=this._isDirent?t.name:t;try{let o=Pt(ge(i,r));n={path:ye(this._root,o),fullPath:o,basename:r},n[this._statsProp]=this._isDirent?t:await this._stat(o)}catch(o){this._onError(o);return}return n}_onError(t){De(t)&&!this.destroyed?this.emit("warn",t):this.destroy(t)}async _getEntryType(t){if(!t&&this._statsProp in t)return"";let i=t[this._statsProp];if(i.isFile())return"file";if(i.isDirectory())return"directory";if(i&&i.isSymbolicLink()){let n=t.fullPath;try{let r=await _e(n),o=await bt(r);if(o.isFile())return"file";if(o.isDirectory()){let a=r.length;if(n.startsWith(r)&&n.substr(a,1)===Ee){let l=new Error(`Circular symlink detected: "${n}" points to "${r}"`);return l.code=Rt,this._onError(l)}return"directory"}}catch(r){return this._onError(r),""}}}_includeAsFile(t){let i=t&&t[this._statsProp];return i&&this._wantsEverything&&!i.isDirectory()}}});import{watch as Ie,unwatchFile as St,watchFile as Te}from"fs";import{realpath as st,lstat as Se,open as Fe,stat as Nt}from"fs/promises";import{type as Ne}from"os";import*as w from"path";function Ft(e,s,t,i,n){let r=(o,a)=>{t(e),n(o,a,{watchedPath:e}),a&&e!==a&&H(w.resolve(e,a),I,w.join(e,a))};try{return Ie(e,{persistent:s.persistent},r)}catch(o){i(o);return}}var We,nt,Wt,$,Y,ot,ke,Ce,Ae,kt,g,D,Oe,Le,I,j,S,je,Me,He,rt,W,ze,k,Ct,M,H,$e,it,Ye,z,At=Q(()=>{"use strict";We="data",nt="end",Wt="close",$=()=>{},Y=process.platform,ot=Y==="win32",ke=Y==="darwin",Ce=Y==="linux",Ae=Y==="freebsd",kt=Ne()==="OS400",g={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},D=g,Oe="watch",Le={lstat:Se,stat:Nt},I="listeners",j="errHandlers",S="rawEmitters",je=[I,j,S],Me=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),He=e=>Me.has(w.extname(e).slice(1).toLowerCase()),rt=(e,s)=>{e instanceof Set?e.forEach(s):s(e)},W=(e,s,t)=>{let i=e[s];i instanceof Set||(e[s]=i=new Set([i])),i.add(t)},ze=e=>s=>{let t=e[s];t instanceof Set?t.clear():delete e[s]},k=(e,s,t)=>{let i=e[s];i instanceof Set?i.delete(t):i===t&&delete e[s]},Ct=e=>e instanceof Set?e.size===0:!e,M=new Map;H=(e,s,t,i,n)=>{let r=M.get(e);r&&rt(r[s],o=>{o(t,i,n)})},$e=(e,s,t,i)=>{let{listener:n,errHandler:r,rawEmitter:o}=i,a=M.get(s),l;if(!t.persistent)return l=Ft(e,t,n,r,o),l?l.close.bind(l):void 0;if(a)W(a,I,n),W(a,j,r),W(a,S,o);else{if(l=Ft(e,t,H.bind(null,s,I),r,H.bind(null,s,S)),!l)return;l.on(D.ERROR,async c=>{let h=H.bind(null,s,j);if(a&&(a.watcherUnusable=!0),ot&&c.code==="EPERM")try{await(await Fe(e,"r")).close(),h(c)}catch(d){}else h(c)}),a={listeners:n,errHandlers:r,rawEmitters:o,watcher:l},M.set(s,a)}return()=>{k(a,I,n),k(a,j,r),k(a,S,o),Ct(a.listeners)&&(a.watcher.close(),M.delete(s),je.forEach(ze(a)),a.watcher=void 0,Object.freeze(a))}},it=new Map,Ye=(e,s,t,i)=>{let{listener:n,rawEmitter:r}=i,o=it.get(s),a=o&&o.options;return a&&(a.persistent<t.persistent||a.interval>t.interval)&&(St(s),o=void 0),o?(W(o,I,n),W(o,S,r)):(o={listeners:n,rawEmitters:r,options:t,watcher:Te(s,t,(l,c)=>{rt(o.rawEmitters,d=>{d(D.CHANGE,s,{curr:l,prev:c})});let h=l.mtimeMs;(l.size!==c.size||h>c.mtimeMs||h===0)&&rt(o.listeners,d=>d(e,l))})},it.set(s,o)),()=>{k(o,I,n),k(o,S,r),Ct(o.listeners)&&(it.delete(s),St(s),o.options=o.watcher=void 0,Object.freeze(o))}},z=class{constructor(s){f(this,"fsw");f(this,"_boundHandleError");this.fsw=s,this._boundHandleError=t=>s._handleError(t)}_watchWithNodeFs(s,t){let i=this.fsw.options,n=w.dirname(s),r=w.basename(s);this.fsw._getWatchedDir(n).add(r);let a=w.resolve(s),l={persistent:i.persistent};t||(t=$);let c;if(i.usePolling){let h=i.interval!==i.binaryInterval;l.interval=h&&He(r)?i.binaryInterval:i.interval,c=Ye(s,a,l,{listener:t,rawEmitter:this.fsw._emitRaw})}else c=$e(s,a,l,{listener:t,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return c}_handleFile(s,t,i){if(this.fsw.closed)return;let n=w.dirname(s),r=w.basename(s),o=this.fsw._getWatchedDir(n),a=t;if(o.has(r))return;let l=async(h,d)=>{if(this.fsw._throttle(Oe,s,5)){if(!d||d.mtimeMs===0)try{let u=await Nt(s);if(this.fsw.closed)return;let m=u.atimeMs,_=u.mtimeMs;if((!m||m<=_||_!==a.mtimeMs)&&this.fsw._emit(D.CHANGE,s,u),(ke||Ce||Ae)&&a.ino!==u.ino){this.fsw._closeFile(h),a=u;let E=this._watchWithNodeFs(s,l);E&&this.fsw._addPathCloser(h,E)}else a=u}catch(u){this.fsw._remove(n,r)}else if(o.has(r)){let u=d.atimeMs,m=d.mtimeMs;(!u||u<=m||m!==a.mtimeMs)&&this.fsw._emit(D.CHANGE,s,d),a=d}}},c=this._watchWithNodeFs(s,l);if(!(i&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(s)){if(!this.fsw._throttle(D.ADD,s,0))return;this.fsw._emit(D.ADD,s,t)}return c}async _handleSymlink(s,t,i,n){if(this.fsw.closed)return;let r=s.fullPath,o=this.fsw._getWatchedDir(t);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let a;try{a=await st(i)}catch(l){return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(o.has(n)?this.fsw._symlinkPaths.get(r)!==a&&(this.fsw._symlinkPaths.set(r,a),this.fsw._emit(D.CHANGE,i,s.stats)):(o.add(n),this.fsw._symlinkPaths.set(r,a),this.fsw._emit(D.ADD,i,s.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(r))return!0;this.fsw._symlinkPaths.set(r,!0)}_handleRead(s,t,i,n,r,o,a){s=w.join(s,"");let l=n?`${s}:${n}`:s;if(a=this.fsw._throttle("readdir",l,1e3),!a)return;let c=this.fsw._getWatchedDir(i.path),h=new Set,d=this.fsw._readdirp(s,{fileFilter:u=>i.filterPath(u),directoryFilter:u=>i.filterDir(u)});if(d)return d.on(We,async u=>{if(this.fsw.closed){d=void 0;return}let m=u.path,_=w.join(s,m);if(h.add(m),!(u.stats.isSymbolicLink()&&await this._handleSymlink(u,s,_,m))){if(this.fsw.closed){d=void 0;return}(m===n||!n&&!c.has(m))&&(this.fsw._incrReadyCount(),_=w.join(r,w.relative(r,_)),this._addToNodeFs(_,t,i,o+1))}}).on(D.ERROR,this._boundHandleError),new Promise((u,m)=>{if(!d)return m();d.once(nt,()=>{if(this.fsw.closed){d=void 0;return}let _=a?a.clear():!1;u(void 0),c.getChildren().filter(E=>E!==s&&!h.has(E)).forEach(E=>{this.fsw._remove(s,E)}),d=void 0,_&&this._handleRead(s,!1,i,n,r,o,a)})})}async _handleDir(s,t,i,n,r,o,a){let l=this.fsw._getWatchedDir(w.dirname(s)),c=l.has(w.basename(s));!(i&&this.fsw.options.ignoreInitial)&&!r&&!c&&this.fsw._emit(D.ADD_DIR,s,t),l.add(w.basename(s)),this.fsw._getWatchedDir(s);let h,d,u=this.fsw.options.depth;if((u==null||n<=u)&&!this.fsw._symlinkPaths.has(a)){if(!r&&(await this._handleRead(s,i,o,r,s,n,h),this.fsw.closed))return;d=this._watchWithNodeFs(s,(m,_)=>{_&&_.mtimeMs===0||this._handleRead(m,!1,o,r,s,n,h)})}return d}async _addToNodeFs(s,t,i,n,r){let o=this.fsw._emitReady;if(this.fsw._isIgnored(s)||this.fsw.closed)return o(),!1;let a=this.fsw._getWatchHelpers(s);i&&(a.filterPath=l=>i.filterPath(l),a.filterDir=l=>i.filterDir(l));try{let l=await Le[a.statMethod](a.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(a.watchPath,l))return o(),!1;let c=this.fsw.options.followSymlinks,h;if(l.isDirectory()){let d=w.resolve(s),u=c?await st(s):s;if(this.fsw.closed||(h=await this._handleDir(a.watchPath,l,t,n,r,a,u),this.fsw.closed))return;d!==u&&u!==void 0&&this.fsw._symlinkPaths.set(d,u)}else if(l.isSymbolicLink()){let d=c?await st(s):s;if(this.fsw.closed)return;let u=w.dirname(a.watchPath);if(this.fsw._getWatchedDir(u).add(a.watchPath),this.fsw._emit(D.ADD,a.watchPath,l),h=await this._handleDir(u,l,t,n,s,a,d),this.fsw.closed)return;d!==void 0&&this.fsw._symlinkPaths.set(w.resolve(s),d)}else h=this._handleFile(a.watchPath,l,t);return o(),h&&this.fsw._addPathCloser(s,h),!1}catch(l){if(this.fsw._handleError(l))return o(),s}}}});var Ut={};ae(Ut,{FSWatcher:()=>C,WatchHelper:()=>G,default:()=>as,watch:()=>Yt});import{EventEmitter as Ue}from"events";import{stat as Ge}from"fs";import{readdir as Be,stat as qe}from"fs/promises";import*as p from"path";function U(e){return Array.isArray(e)?e:[e]}function ts(e){return typeof e=="function"?e:typeof e=="string"?s=>e===s:e instanceof RegExp?s=>e.test(s):typeof e=="object"&&e!==null?s=>{if(e.path===s)return!0;if(e.recursive){let t=p.relative(e.path,s);return t?!t.startsWith("..")&&!p.isAbsolute(t):!1}return!1}:()=>!1}function es(e){if(typeof e!="string")throw new Error("string expected");e=p.normalize(e),e=e.replace(/\\/g,"/");let s=!1;return e.startsWith("//")&&(s=!0),e=e.replace(zt,"/"),s&&(e="/"+e),e}function Ot(e,s,t){let i=es(s);for(let n=0;n<e.length;n++){let r=e[n];if(r(i,t))return!0}return!1}function ss(e,s){if(e==null)throw new TypeError("anymatch: specify first argument");let i=U(e).map(n=>ts(n));return s==null?(n,r)=>Ot(i,n,r):Ot(i,s)}function Yt(e,s={}){let t=new C(s);return t.add(e),t}var at,Ve,Ht,Ke,Xe,Je,zt,Qe,Ze,lt,Lt,jt,$t,Mt,is,rs,ct,ns,os,G,C,as,Gt=Q(()=>{"use strict";Tt();At();at="/",Ve="//",Ht=".",Ke="..",Xe="string",Je=/\\/g,zt=/\/\//g,Qe=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,Ze=/^\.[/\\]/;lt=e=>typeof e=="object"&&e!==null&&!(e instanceof RegExp);Lt=e=>{let s=U(e).flat();if(!s.every(t=>typeof t===Xe))throw new TypeError(`Non-string provided as watch path: ${s}`);return s.map($t)},jt=e=>{let s=e.replace(Je,at),t=!1;return s.startsWith(Ve)&&(t=!0),s=s.replace(zt,at),t&&(s=at+s),s},$t=e=>jt(p.normalize(jt(e))),Mt=(e="")=>s=>typeof s=="string"?$t(p.isAbsolute(s)?s:p.join(e,s)):s,is=(e,s)=>p.isAbsolute(e)?e:p.join(s,e),rs=Object.freeze(new Set),ct=class{constructor(s,t){f(this,"path");f(this,"_removeWatcher");f(this,"items");this.path=s,this._removeWatcher=t,this.items=new Set}add(s){let{items:t}=this;t&&s!==Ht&&s!==Ke&&t.add(s)}async remove(s){let{items:t}=this;if(!t||(t.delete(s),t.size>0))return;let i=this.path;try{await Be(i)}catch(n){this._removeWatcher&&this._removeWatcher(p.dirname(i),p.basename(i))}}has(s){let{items:t}=this;if(t)return t.has(s)}getChildren(){let{items:s}=this;return s?[...s.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=$,this.items=rs,Object.freeze(this)}},ns="stat",os="lstat",G=class{constructor(s,t,i){f(this,"fsw");f(this,"path");f(this,"watchPath");f(this,"fullWatchPath");f(this,"dirParts");f(this,"followSymlinks");f(this,"statMethod");this.fsw=i;let n=s;this.path=s=s.replace(Ze,""),this.watchPath=n,this.fullWatchPath=p.resolve(n),this.dirParts=[],this.dirParts.forEach(r=>{r.length>1&&r.pop()}),this.followSymlinks=t,this.statMethod=t?ns:os}entryPath(s){return p.join(this.watchPath,p.relative(this.watchPath,s.fullPath))}filterPath(s){let{stats:t}=s;if(t&&t.isSymbolicLink())return this.filterDir(s);let i=this.entryPath(s);return this.fsw._isntIgnored(i,t)&&this.fsw._hasReadPermissions(t)}filterDir(s){return this.fsw._isntIgnored(this.entryPath(s),s.stats)}},C=class extends Ue{constructor(t={}){super();f(this,"closed");f(this,"options");f(this,"_closers");f(this,"_ignoredPaths");f(this,"_throttled");f(this,"_streams");f(this,"_symlinkPaths");f(this,"_watched");f(this,"_pendingWrites");f(this,"_pendingUnlinks");f(this,"_readyCount");f(this,"_emitReady");f(this,"_closePromise");f(this,"_userIgnored");f(this,"_readyEmitted");f(this,"_emitRaw");f(this,"_boundRemove");f(this,"_nodeFsHandler");this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let i=t.awaitWriteFinish,n={stabilityThreshold:2e3,pollInterval:100},r=v(b({persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0},t),{ignored:t.ignored?U(t.ignored):U([]),awaitWriteFinish:i===!0?n:typeof i=="object"?b(b({},n),i):!1});kt&&(r.usePolling=!0),r.atomic===void 0&&(r.atomic=!r.usePolling);let o=process.env.CHOKIDAR_USEPOLLING;if(o!==void 0){let c=o.toLowerCase();c==="false"||c==="0"?r.usePolling=!1:c==="true"||c==="1"?r.usePolling=!0:r.usePolling=!!c}let a=process.env.CHOKIDAR_INTERVAL;a&&(r.interval=Number.parseInt(a,10));let l=0;this._emitReady=()=>{l++,l>=this._readyCount&&(this._emitReady=$,this._readyEmitted=!0,process.nextTick(()=>this.emit(g.READY)))},this._emitRaw=(...c)=>this.emit(g.RAW,...c),this._boundRemove=this._remove.bind(this),this.options=r,this._nodeFsHandler=new z(this),Object.freeze(r)}_addIgnoredPath(t){if(lt(t)){for(let i of this._ignoredPaths)if(lt(i)&&i.path===t.path&&i.recursive===t.recursive)return}this._ignoredPaths.add(t)}_removeIgnoredPath(t){if(this._ignoredPaths.delete(t),typeof t=="string")for(let i of this._ignoredPaths)lt(i)&&i.path===t&&this._ignoredPaths.delete(i)}add(t,i,n){let{cwd:r}=this.options;this.closed=!1,this._closePromise=void 0;let o=Lt(t);return r&&(o=o.map(a=>is(a,r))),o.forEach(a=>{this._removeIgnoredPath(a)}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=o.length,Promise.all(o.map(async a=>{let l=await this._nodeFsHandler._addToNodeFs(a,!n,void 0,0,i);return l&&this._emitReady(),l})).then(a=>{this.closed||a.forEach(l=>{l&&this.add(p.dirname(l),p.basename(i||l))})}),this}unwatch(t){if(this.closed)return this;let i=Lt(t),{cwd:n}=this.options;return i.forEach(r=>{!p.isAbsolute(r)&&!this._closers.has(r)&&(n&&(r=p.join(n,r)),r=p.resolve(r)),this._closePath(r),this._addIgnoredPath(r),this._watched.has(r)&&this._addIgnoredPath({path:r,recursive:!0}),this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let t=[];return this._closers.forEach(i=>i.forEach(n=>{let r=n();r instanceof Promise&&t.push(r)})),this._streams.forEach(i=>i.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(i=>i.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=t.length?Promise.all(t).then(()=>{}):Promise.resolve(),this._closePromise}getWatched(){let t={};return this._watched.forEach((i,n)=>{let o=(this.options.cwd?p.relative(this.options.cwd,n):n)||Ht;t[o]=i.getChildren().sort()}),t}emitWithAll(t,i){this.emit(t,...i),t!==g.ERROR&&this.emit(g.ALL,t,...i)}async _emit(t,i,n){if(this.closed)return;let r=this.options;ot&&(i=p.normalize(i)),r.cwd&&(i=p.relative(r.cwd,i));let o=[i];n!=null&&o.push(n);let a=r.awaitWriteFinish,l;if(a&&(l=this._pendingWrites.get(i)))return l.lastChange=new Date,this;if(r.atomic){if(t===g.UNLINK)return this._pendingUnlinks.set(i,[t,...o]),setTimeout(()=>{this._pendingUnlinks.forEach((c,h)=>{this.emit(...c),this.emit(g.ALL,...c),this._pendingUnlinks.delete(h)})},typeof r.atomic=="number"?r.atomic:100),this;t===g.ADD&&this._pendingUnlinks.has(i)&&(t=g.CHANGE,this._pendingUnlinks.delete(i))}if(a&&(t===g.ADD||t===g.CHANGE)&&this._readyEmitted){let c=(h,d)=>{h?(t=g.ERROR,o[0]=h,this.emitWithAll(t,o)):d&&(o.length>1?o[1]=d:o.push(d),this.emitWithAll(t,o))};return this._awaitWriteFinish(i,a.stabilityThreshold,t,c),this}if(t===g.CHANGE&&!this._throttle(g.CHANGE,i,50))return this;if(r.alwaysStat&&n===void 0&&(t===g.ADD||t===g.ADD_DIR||t===g.CHANGE)){let c=r.cwd?p.join(r.cwd,i):i,h;try{h=await qe(c)}catch(d){}if(!h||this.closed)return;o.push(h)}return this.emitWithAll(t,o),this}_handleError(t){let i=t&&t.code;return t&&i!=="ENOENT"&&i!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||i!=="EPERM"&&i!=="EACCES")&&this.emit(g.ERROR,t),t||this.closed}_throttle(t,i,n){this._throttled.has(t)||this._throttled.set(t,new Map);let r=this._throttled.get(t);if(!r)throw new Error("invalid throttle");let o=r.get(i);if(o)return o.count++,!1;let a,l=()=>{let h=r.get(i),d=h?h.count:0;return r.delete(i),clearTimeout(a),h&&clearTimeout(h.timeoutObject),d};a=setTimeout(l,n);let c={timeoutObject:a,clear:l,count:0};return r.set(i,c),c}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(t,i,n,r){let o=this.options.awaitWriteFinish;if(typeof o!="object")return;let a=o.pollInterval,l,c=t;this.options.cwd&&!p.isAbsolute(t)&&(c=p.join(this.options.cwd,t));let h=new Date,d=this._pendingWrites;function u(m){Ge(c,(_,E)=>{if(_||!d.has(t)){_&&_.code!=="ENOENT"&&r(_);return}let P=Number(new Date);m&&E.size!==m.size&&(d.get(t).lastChange=P);let K=d.get(t);P-K.lastChange>=i?(d.delete(t),r(void 0,E)):l=setTimeout(u,a,E)})}d.has(t)||(d.set(t,{lastChange:h,cancelWait:()=>(d.delete(t),clearTimeout(l),n)}),l=setTimeout(u,a))}_isIgnored(t,i){if(this.options.atomic&&Qe.test(t))return!0;if(!this._userIgnored){let{cwd:n}=this.options,o=(this.options.ignored||[]).map(Mt(n)),l=[...[...this._ignoredPaths].map(Mt(n)),...o];this._userIgnored=ss(l,void 0)}return this._userIgnored(t,i)}_isntIgnored(t,i){return!this._isIgnored(t,i)}_getWatchHelpers(t){return new G(t,this.options.followSymlinks,this)}_getWatchedDir(t){let i=p.resolve(t);return this._watched.has(i)||this._watched.set(i,new ct(i,this._boundRemove)),this._watched.get(i)}_hasReadPermissions(t){return this.options.ignorePermissionErrors?!0:!!(Number(t.mode)&256)}_remove(t,i,n){let r=p.join(t,i),o=p.resolve(r);if(n=n!=null?n:this._watched.has(r)||this._watched.has(o),!this._throttle("remove",r,100))return;!n&&this._watched.size===1&&this.add(t,i,!0),this._getWatchedDir(r).getChildren().forEach(m=>this._remove(r,m));let c=this._getWatchedDir(t),h=c.has(i);c.remove(i),this._symlinkPaths.has(o)&&this._symlinkPaths.delete(o);let d=r;if(this.options.cwd&&(d=p.relative(this.options.cwd,r)),this.options.awaitWriteFinish&&this._pendingWrites.has(d)&&this._pendingWrites.get(d).cancelWait()===g.ADD)return;this._watched.delete(r),this._watched.delete(o);let u=n?g.UNLINK_DIR:g.UNLINK;h&&!this._isIgnored(r)&&this._emit(u,r),this._closePath(r)}_closePath(t){this._closeFile(t);let i=p.dirname(t);this._getWatchedDir(i).remove(p.basename(t))}_closeFile(t){let i=this._closers.get(t);i&&(i.forEach(n=>n()),this._closers.delete(t))}_addPathCloser(t,i){if(!i)return;let n=this._closers.get(t);n||(n=[],this._closers.set(t,n)),n.push(i)}_readdirp(t,i){if(this.closed)return;let n=v(b({type:g.ALL,alwaysStat:!0,lstat:!0},i),{depth:0}),r=It(t,n);return this._streams.add(r),r.once(Wt,()=>{r=void 0}),r.once(nt,()=>{r&&(this._streams.delete(r),r=void 0)}),r}};as={watch:Yt,FSWatcher:C}});import{AlertTriangleIcon as le,InfoIcon as ce,AlertCircleIcon as de}from"lucide-react";import{jsx as gt,jsxs as he}from"react/jsx-runtime";function Z({type:e="info",children:s}){let t={info:"border-blue-500 bg-blue-50 text-blue-500",warning:"border-yellow-500 bg-yellow-50 text-yellow-500",error:"border-red-500 bg-red-50 text-red-500"},n={info:ce,warning:le,error:de}[e];return he("div",{className:`flex not-prose items-center gap-2 border-l-4 ${t[e]} px-4 py-2.5`,children:[gt(n,{className:"w-5 h-5 shrink-0"}),gt("div",{children:s})]})}import pe from"next/link";import{LinkIcon as fe}from"lucide-react";function yt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}import{jsx as Et,jsxs as ue}from"react/jsx-runtime";function T({children:e,level:s}){let t=`h${s}`,n=yt(typeof e=="string"?e:"");return ue(t,{id:n,className:"group",children:[Et("a",{className:"not-prose",href:`#${n}`,children:e}),Et(fe,{className:"inline-block ml-2 size-5 text-gray-400 opacity-0 group-hover:opacity-100 transition"})]})}import{jsx as y}from"react/jsx-runtime";var Cs={h1:e=>y("h1",{className:"text-3xl font-bold text-gray-900",children:e.children}),h2:e=>y(T,v(b({},e),{level:2})),h3:e=>y(T,v(b({},e),{level:3})),h4:e=>y(T,v(b({},e),{level:4})),h5:e=>y(T,v(b({},e),{level:5})),p:e=>y("p",{children:e.children}),hr:e=>y("hr",v(b({},e),{className:"border-gray-200"})),a:e=>e.href.startsWith("http")?y("a",v(b({href:e.href,className:"underline underline-offset-4"},e),{target:"_blank",rel:"noopener noreferrer",children:e.children})):y(pe,v(b({href:e.href,className:"underline underline-offset-4"},e),{children:e.children})),ul:e=>y("ul",{children:e.children}),li:e=>y("li",{children:e.children}),ol:e=>y("ol",{children:e.children}),blockquote:e=>y("blockquote",{className:"not-italic",children:e.children}),pre:e=>y("pre",{className:"not-prose",children:e.children}),Callout:Z,table:e=>y("table",{children:e.children}),thead:e=>y("thead",{children:e.children}),tbody:e=>y("tbody",{children:e.children}),tr:e=>y("tr",{children:e.children}),th:e=>y("th",{children:e.children}),td:e=>y("td",{children:e.children})};import N from"fs";import A from"path";import mt from"fs";import F from"path";import fs from"fs";import us from"gray-matter";import ut from"path";import ys from"fs";var ls=Object.defineProperty,cs=Object.defineProperties,ds=Object.getOwnPropertyDescriptors,V=Object.getOwnPropertySymbols,Zt=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable,Bt=(e,s,t)=>s in e?ls(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,B=(e,s)=>{for(var t in s||(s={}))Zt.call(s,t)&&Bt(e,t,s[t]);if(V)for(var t of V(s))te.call(s,t)&&Bt(e,t,s[t]);return e},q=(e,s)=>cs(e,ds(s)),O=(e=>typeof R!="undefined"?R:typeof Proxy!="undefined"?new Proxy(e,{get:(s,t)=>(typeof R!="undefined"?R:s)[t]}):e)(function(e){if(typeof R!="undefined")return R.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),hs=(e,s)=>{var t={};for(var i in e)Zt.call(e,i)&&s.indexOf(i)<0&&(t[i]=e[i]);if(e!=null&&V)for(var i of V(e))s.indexOf(i)<0&&te.call(e,i)&&(t[i]=e[i]);return t};function qt(e){try{let s=fs.readFileSync(e,"utf-8"),{data:t}=us(s);return{title:t.title,icon:t.icon,description:t.description,defaultOpen:t.defaultOpen,collapsible:t.collapsible}}catch(s){return{}}}function ps(e,s="/docs"){return mt.existsSync(e)?ee(e,e,s):[]}function ee(e,s,t){var i;let n=mt.readdirSync(e,{withFileTypes:!0}).sort((o,a)=>{let l=Vt(o.name),c=Vt(a.name);return l!==null&&c!==null?l-c:l!==null?-1:c!==null?1:o.name.localeCompare(a.name)}),r=[];for(let o of n){if(o.name.startsWith("_")||o.name.startsWith("."))continue;let a=F.join(e,o.name);if(o.isDirectory()){let l=L(o.name),c=ms(a),h=ee(a,s,t);if(c){let P=dt(F.relative(s,c).replace(/\\/g,"/")),K=ht(P,t);h=h.filter(X=>!(X.type==="page"&&X.href===K))}if(h.length===0&&!c)continue;let d=Kt(l),u,m=!0,_=!0;if(c){let P=qt(c);P.title&&(d=P.title),P.icon&&(u=P.icon),P.defaultOpen!==void 0&&(m=P.defaultOpen),P.collapsible!==void 0&&(_=P.collapsible)}let E={type:"section",title:d,children:h,href:c?ht(dt(F.relative(s,c).replace(/\\/g,"/")),t):"",icon:u,defaultOpen:m,collapsible:_};r.push(E)}else if(o.name.endsWith(".md")||o.name.endsWith(".mdx")){let l=F.relative(s,a).replace(/\\/g,"/"),c=dt(l),h=qt(a),d=o.name.replace(/\.(md|mdx)$/,""),u=L(d),m=ht(c,t),_=u.toLowerCase()==="index",E={type:"page",title:(i=h.title)!=null?i:Kt(_?L(F.basename(e)):u),href:m,icon:h.icon};r.push(E)}}return r}function Vt(e){let s=e.match(/^(\d+)-/);return s?parseInt(s[1],10):null}function L(e){return e.replace(/^\d+-/,"")}function ms(e){let s=mt.readdirSync(e);for(let t of s){let i=L(t);if(i==="index.md"||i==="index.mdx")return F.join(e,t)}return null}function Kt(e){return e.toLowerCase()==="index"?"Home":e.replace(/[-_]/g," ").replace(/\b\w/g,s=>s.toUpperCase())}function dt(e){return e.replace(/\\/g,"/").split("/").map(s=>L(s)).join("/").replace(/\/index\.(md|mdx)$/,"").replace(/\.(md|mdx)$/,"").replace(/^index$/,"")}function ht(e,s){return!e||e==="index"||e===""?s:`${s}/${e.startsWith("/")?e.slice(1):e}`}function pt(e,s="/docs"){let t=process.cwd(),i=A.join(t,".docstra"),n=A.join(i,"index.ts");N.existsSync(e)||(console.error(`Content directory not found: ${e}`),console.error(`Please create "${e}" or update "contentDir" in docstra.config.ts`),process.exit(1)),N.existsSync(i)||N.mkdirSync(i,{recursive:!0});let r=se(e);r.length===0&&console.warn(`No .md or .mdx files found in ${e}`);let o=[],a=[];r.forEach((h,d)=>{let u=A.relative(i,h).replace(/\\/g,"/"),m=`d${d}`;o.push(`import * as ${m} from "${u}?docstra";`);let _=A.relative(e,h).replace(/\\/g,"/"),E=ws(_);a.push(`{
2
- slug: "${E}",
3
- path: "${_}",
4
- data: {
5
- metadata: ${m}.metadata,
6
- raw: ${m}.raw,
7
- tableOfContents: ${m}.tableOfContents,
8
- body: ${m}.body,
9
- lastUpdated: ${m}.lastUpdated,
10
- }
11
- }`)});let l=ps(e,s),c=`// @ts-nocheck -- auto generated by docstra
12
- ${o.join(`
13
- `)}
14
- import type { SidebarItem } from "docstra-mdx";
15
-
16
- export const docs = [
17
- ${a.join(`,
18
- `)}
19
- ];
20
-
21
- export const sidebarItems: SidebarItem[] = ${JSON.stringify(l,null,2)} as SidebarItem[];
22
- `;N.writeFileSync(n,c,"utf8")}function se(e){return N.readdirSync(e).flatMap(s=>{let t=A.join(e,s);return N.statSync(t).isDirectory()?se(t):s.endsWith(".md")||s.endsWith(".mdx")?[t]:[]})}function _s(e){return e.replace(/^\d+-/,"")}function ws(e){return e.replace(/\\/g,"/").split("/").map(s=>_s(s)).join("/").replace(/\.(md|mdx)$/,"").replace(/\/index$/,"").replace(/^index$/,"")}var Xt=!1,ft=null;async function gs(e){if(Xt)return;Xt=!0,await pt(e);let{FSWatcher:s}=await Promise.resolve().then(()=>(Gt(),Ut)),t="docstra.config.ts",i=new s({ignoreInitial:!0,persistent:!0,ignored:["node_modules",".next"]});i.add([e,t]),console.log("\x1B[32m \u2713 \x1B[0mDocstra dev server started..."),i.on("all",async(n,r)=>{!r.endsWith(".md")&&!r.endsWith(".mdx")&&!r.endsWith("docstra.config.ts")||(ft&&clearTimeout(ft),ft=setTimeout(async()=>{await pt(e)},200),console.info("MDX content rebuilt successfully"))}),process.on("exit",()=>{i.closed||i.close()})}var Es="docs/content";function bs(){var e;let s=process.cwd(),t=ut.join(s,"docstra.config.ts"),i={};if(ys.existsSync(t))try{delete O.cache[O.resolve(t)];let r=O(t);i=(e=r.default)!=null?e:r}catch(r){console.error("Failed to load docstra.config.ts",r),process.exit(1)}else console.warn("No docstra.config.ts found, using defaults");let n=i.contentDir?ut.resolve(s,i.contentDir):ut.join(s,Es);return{root:s,contentDir:n,userConfig:i}}var Jt=!1;function di(e={}){var s,t;let i=process.env.NODE_ENV==="development",n=process.env.NODE_ENV==="production",r=bs().contentDir;Jt||(Jt=!0,i&&gs(r),n&&(pt(r),console.log("\x1B[32m \u2713 \x1B[0mDocstra MDX index generated successfully")));let o=q(B({},e.turbopack),{rules:q(B({},(s=e.turbopack)==null?void 0:s.rules),{"*.{md,mdx}":{loaders:[{loader:O.resolve("./loader")}],as:"*.js"}})});return q(B({},e),{turbopack:o,pageExtensions:(t=e.pageExtensions)!=null?t:["ts","tsx","js","jsx","md","mdx"],webpack:(a,l)=>(a.module.rules.push({test:/\.(md|mdx)$/,resourceQuery:/docstra/,use:[{loader:O.resolve("./loader")}]}),typeof e.webpack=="function"?e.webpack(a,l):a)})}function Qt(e){return e!=null&&e.length?e.join("/"):""}function hi(e,s){return{getPage:t=>{let i=e.find(a=>a.slug===Qt(t));if(!i)return null;let n=i.data,{body:r}=n,o=hs(n,["body"]);return q(B({},o),{slug:i.slug,path:i.path})},getPageBody:t=>{let i=e.find(n=>n.slug===Qt(t));return i?i.data.body:null},generateStaticParams:()=>e.map(t=>({slug:t.slug===""?[]:t.slug.split("/")})),generateSitemap:({baseUrl:t,lastmod:i,changefreq:n,priority:r})=>e.map(o=>{let a=o.slug===""?"":o.slug.replace(/\/?index$/,"");return{url:`${t}/${a}`.replace(/\/$/,""),lastModified:i,changeFrequency:n,priority:r}}),sidebarItems:s!=null?s:[]}}function fi(e,s){return s.find(t=>t.slug===((e==null?void 0:e.filter(Boolean).join("/"))||""))}function ui(e){return e}export{hi as createSource,Cs as defaultMdxComponents,ui as defineDocstraConfig,ps as generateSidebar,fi as getPageData,bs as loadDocstraConfig,pt as runDocstraBuild,gs as runDocstraDev,di as withDocstra};
23
- /*! Bundled license information:
24
-
25
- chokidar/index.js:
26
- (*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) *)
27
- */
1
+ import{AlertTriangleIcon as h,InfoIcon as y,AlertCircleIcon as f}from"lucide-react";import{jsx as i,jsxs as u}from"react/jsx-runtime";function a({type:e="info",children:l}){let o={info:"border-blue-500 bg-blue-50 text-blue-500",warning:"border-yellow-500 bg-yellow-50 text-yellow-500",error:"border-red-500 bg-red-50 text-red-500"},t={info:y,warning:h,error:f}[e];return u("div",{className:`flex not-prose items-center gap-2 border-l-4 ${o[e]} px-4 py-2.5`,children:[i(t,{className:"w-5 h-5 shrink-0"}),i("div",{children:l})]})}import m from"next/link";import{LinkIcon as p}from"lucide-react";function c(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}import{jsx as d,jsxs as g}from"react/jsx-runtime";function n({children:e,level:l}){let o=`h${l}`,t=c(typeof e=="string"?e:"");return g(o,{id:t,className:"group",children:[d("a",{className:"not-prose",href:`#${t}`,children:e}),d(p,{className:"inline-block ml-2 size-5 text-gray-400 opacity-0 group-hover:opacity-100 transition"})]})}import{jsx as r}from"react/jsx-runtime";var L={h1:e=>r("h1",{className:"text-3xl font-bold text-gray-900",children:e.children}),h2:e=>r(n,{...e,level:2}),h3:e=>r(n,{...e,level:3}),h4:e=>r(n,{...e,level:4}),h5:e=>r(n,{...e,level:5}),p:e=>r("p",{children:e.children}),hr:e=>r("hr",{...e,className:"border-gray-200"}),a:e=>e.href.startsWith("http")?r("a",{href:e.href,className:"underline underline-offset-4",...e,target:"_blank",rel:"noopener noreferrer",children:e.children}):r(m,{href:e.href,className:"underline underline-offset-4",...e,children:e.children}),ul:e=>r("ul",{children:e.children}),li:e=>r("li",{children:e.children}),ol:e=>r("ol",{children:e.children}),blockquote:e=>r("blockquote",{className:"not-italic",children:e.children}),pre:e=>r("pre",{className:"not-prose",children:e.children}),Callout:a,table:e=>r("table",{children:e.children}),thead:e=>r("thead",{children:e.children}),tbody:e=>r("tbody",{children:e.children}),tr:e=>r("tr",{children:e.children}),th:e=>r("th",{children:e.children}),td:e=>r("td",{children:e.children})};export*from"docstra-mdx";export{L as defaultMdxComponents};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docstra",
3
- "version": "1.9.9-next.3",
3
+ "version": "1.9.9-next.4",
4
4
  "description": "The Modern Documentation Framework for Next.js",
5
5
  "files": [
6
6
  "dist"
@@ -31,9 +31,7 @@
31
31
  "tsdown": "0.21.0-beta.2",
32
32
  "tsup": "^8.5.1",
33
33
  "typescript": "^5.9.3",
34
- "@docstra/eslint-config": "1.0.0",
35
- "@docstra/typescript-config": "1.0.0",
36
- "docstra-mdx": "0.0.2"
34
+ "docstra-mdx": "0.0.3"
37
35
  },
38
36
  "dependencies": {
39
37
  "clsx": "^2.1.1",
@@ -41,13 +39,15 @@
41
39
  "fuse.js": "^7.1.0",
42
40
  "gray-matter": "^4.0.3",
43
41
  "lucide-react": "^0.554.0",
44
- "next": "^16.0.3",
45
42
  "prism-react-renderer": "^2.4.1",
46
- "react": "^18 || ^19",
47
- "react-dom": "^18 || ^19",
48
43
  "react-toast-msg": "^2.5.5",
49
44
  "tailwind-merge": "^3.4.0"
50
45
  },
46
+ "peerDependencies": {
47
+ "next": ">=16.0.0",
48
+ "react": ">=18.0.0",
49
+ "react-dom": ">=18.0.0"
50
+ },
51
51
  "keywords": [
52
52
  "next",
53
53
  "nextjs",