mirror of
https://github.com/luxfi/lpm.git
synced 2026-10-30 16:20:57 +00:00
1 line
28 KiB
JavaScript
1 line
28 KiB
JavaScript
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,1694,e=>{"use strict";function t(...e){return t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})}}e.s(["mergeRefs",()=>t])},46915,40838,35078,e=>{"use strict";var t=e.i(39326),r=e.i(27693);e.i(35317);var n=e.i(59979),s=e.i(87484),i=(0,n.createContext)([]),l=(0,n.createContext)({current:null});function o(){return(0,n.useContext)(i).at(-1)}function a(){return(0,n.useContext)(i)}function c({containerRef:e,children:r}){return(0,t.jsx)(l.Provider,{value:e,children:r})}function u({toc:e,single:r=!0,children:s}){let l=(0,n.useMemo)(()=>e.map(e=>e.url.split("#")[1]),[e]);return(0,t.jsx)(i.Provider,{value:function(e,t){let[r,s]=(0,n.useState)([]);return(0,n.useEffect)(()=>{let r=[],n=new IntersectionObserver(e=>{for(let t of e)t.isIntersecting&&!r.includes(t.target.id)?r=[...r,t.target.id]:!t.isIntersecting&&r.includes(t.target.id)&&(r=r.filter(e=>e!==t.target.id));r.length>0&&s(r)},{rootMargin:t?"-80px 0% -70% 0%":"-20px 0% -40% 0%",threshold:1});function i(){let r=document.scrollingElement;if(!r)return;let n=r.scrollTop;n<=0&&t?s(e.slice(0,1)):n+r.clientHeight>=r.scrollHeight-6&&s(r=>r.length>0&&!t?e.slice(e.indexOf(r[0])):e.slice(-1))}for(let t of e){let e=document.getElementById(t);e&&n.observe(e)}return i(),window.addEventListener("scroll",i),()=>{window.removeEventListener("scroll",i),n.disconnect()}},[t,e]),t?r.slice(0,1):r}(l,r),children:s})}var d=(0,n.forwardRef)(({onActiveChange:e,...i},o)=>{let c=(0,n.useContext)(l),u=a(),d=(0,n.useRef)(null),f=function(...e){return t=>{e.forEach(e=>{"function"==typeof e?e(t):null!==e&&(e.current=t)})}}(d,o),h=u.includes(i.href.slice(1));return(0,r.useOnChange)(h,t=>{let r=d.current;r&&(t&&c.current&&(0,s.default)(r,{behavior:"smooth",block:"center",inline:"center",scrollMode:"always",boundary:c.current}),e?.(t))}),(0,t.jsx)("a",{ref:f,"data-active":h,...i,children:i.children})});d.displayName="TOCItem",e.s(["AnchorProvider",()=>u,"ScrollProvider",()=>c,"TOCItem",()=>d,"useActiveAnchor",()=>o,"useActiveAnchors",()=>a],40838),e.i(95067);var f=e.i(83137),h=e.i(6657);e.i(72371);var m=e.i(21528);function p(e,t){if(0===t.length||0===e.clientHeight)return[0,0];let r=Number.MAX_VALUE,n=0;for(let s of t){let t=e.querySelector(`a[href="#${s}"]`);if(!t)continue;let i=getComputedStyle(t);r=Math.min(r,t.offsetTop+parseFloat(i.paddingTop)),n=Math.max(n,t.offsetTop+t.clientHeight-parseFloat(i.paddingBottom))}return[r,n-r]}function x(e,t){e.style.setProperty("--fd-top",`${t[0]}px`),e.style.setProperty("--fd-height",`${t[1]}px`)}function v({containerRef:e,...s}){let i=a(),l=(0,n.useRef)(null),o=(0,m.useEffectEvent)(()=>{e.current&&l.current&&x(l.current,p(e.current,i))});return(0,n.useEffect)(()=>{if(!e.current)return;let t=e.current;o();let r=new ResizeObserver(o);return r.observe(t),()=>{r.disconnect()}},[e]),(0,r.useOnChange)(i,()=>{e.current&&l.current&&x(l.current,p(e.current,i))}),(0,t.jsx)("div",{ref:l,role:"none",...s})}e.s(["TocThumb",()=>v],35078);var g=e.i(1694);let y=(0,n.createContext)([]);function b(){return(0,n.useContext)(y)}function w({toc:e,children:r,...n}){return(0,t.jsx)(y,{value:e,children:(0,t.jsx)(u,{toc:e,...n,children:r})})}function j({ref:e,className:r,...s}){let i=(0,n.useRef)(null);return(0,t.jsx)("div",{ref:(0,g.mergeRefs)(i,e),className:(0,f.cn)("relative min-h-0 text-sm ms-px overflow-auto [scrollbar-width:none] [mask-image:linear-gradient(to_bottom,transparent,white_16px,white_calc(100%-16px),transparent)] py-3",r),...s,children:(0,t.jsx)(c,{containerRef:i,children:s.children})})}function C({ref:e,className:r,...s}){let i=(0,n.useRef)(null),l=b(),{text:o}=(0,h.useI18n)();return 0===l.length?(0,t.jsx)("div",{className:"rounded-lg border bg-fd-card p-3 text-xs text-fd-muted-foreground",children:o.tocNoHeadings}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(v,{containerRef:i,className:"absolute top-(--fd-top) h-(--fd-height) w-px bg-fd-primary transition-all"}),(0,t.jsx)("div",{ref:(0,g.mergeRefs)(e,i),className:(0,f.cn)("flex flex-col border-s border-fd-foreground/10",r),...s,children:l.map(e=>(0,t.jsx)(N,{item:e},e.url))})]})}function N({item:e}){return(0,t.jsx)(d,{href:e.url,className:(0,f.cn)("prose py-1.5 text-sm text-fd-muted-foreground transition-colors [overflow-wrap:anywhere] first:pt-0 last:pb-0 data-[active=true]:text-fd-primary",e.depth<=2&&"ps-3",3===e.depth&&"ps-6",e.depth>=4&&"ps-8"),children:e.title})}e.s(["TOCItems",()=>C,"TOCProvider",()=>w,"TOCScrollArea",()=>j,"useTOCItems",()=>b],46915)},12080,e=>{"use strict";var t=e.i(39326),r=e.i(59979),n=e.i(96206);e.i(37210);var s=e.i(8032);e.i(95067);var i=e.i(83137),l=e.i(6657),o=e.i(20261);e.i(26140);var a=e.i(29501),c=e.i(51303),u=e.i(63003),d=e.i(83125),f=e.i(21528),h=e.i(60341),m=e.i(73675),p=e.i(46915),x=e.i(40838);let v=(0,a.createContext)("TocPopoverContext");function g(e){let{text:s}=(0,l.useI18n)(),{open:a}=v.use(),c=(0,p.useTOCItems)(),u=(0,x.useActiveAnchor)(),d=(0,r.useMemo)(()=>c.findIndex(e=>u===e.url.slice(1)),[c,u]),f=(0,o.useTreePath)().at(-1),m=-1!==d&&!a;return(0,t.jsxs)(h.CollapsibleTrigger,{...e,className:(0,i.cn)("flex w-full h-(--fd-tocnav-height) items-center text-sm text-fd-muted-foreground gap-2.5 px-4 py-2.5 text-start focus-visible:outline-none [&_svg]:size-4 md:px-6",e.className),children:[(0,t.jsx)(y,{value:(d+1)/Math.max(1,c.length),max:1,className:(0,i.cn)("shrink-0",a&&"text-fd-primary")}),(0,t.jsxs)("span",{className:"grid flex-1 *:my-auto *:row-start-1 *:col-start-1",children:[(0,t.jsx)("span",{className:(0,i.cn)("truncate transition-all",a&&"text-fd-foreground",m&&"opacity-0 -translate-y-full pointer-events-none"),children:f?.name??s.toc}),(0,t.jsx)("span",{className:(0,i.cn)("truncate transition-all",!m&&"opacity-0 translate-y-full pointer-events-none"),children:c[d]?.title})]}),(0,t.jsx)(n.ChevronDown,{className:(0,i.cn)("shrink-0 transition-transform mx-0.5",a&&"rotate-180")})]})}function y({value:e,strokeWidth:r=2,size:n=24,min:s=0,max:i=100,...l}){let o=e<s?s:e>i?i:e,a=(n-r)/2,c=2*Math.PI*a,u=o/i*c,d={cx:n/2,cy:n/2,r:a,fill:"none",strokeWidth:r};return(0,t.jsxs)("svg",{role:"progressbar",viewBox:`0 0 ${n} ${n}`,"aria-valuenow":o,"aria-valuemin":s,"aria-valuemax":i,...l,children:[(0,t.jsx)("circle",{...d,className:"stroke-current/25"}),(0,t.jsx)("circle",{...d,stroke:"currentColor",strokeDasharray:c,strokeDashoffset:c-u,strokeLinecap:"round",transform:`rotate(-90 ${n/2} ${n/2})`,className:"transition-all"})]})}function b(e){return(0,t.jsx)(h.CollapsibleContent,{"data-toc-popover":"",...e,className:(0,i.cn)("flex flex-col px-4 max-h-[50vh] md:px-6",e.className),children:e.children})}function w(e){let n=(0,r.useRef)(null),[s,l]=(0,r.useState)(!1),{collapsed:o}=(0,m.useSidebar)(),{isTransparent:a}=(0,u.useNav)(),c=(0,f.useEffectEvent)(e=>{s&&n.current&&!n.current.contains(e.target)&&l(!1)});return(0,r.useEffect)(()=>(window.addEventListener("click",c),()=>{window.removeEventListener("click",c)}),[]),(0,t.jsx)(v.Provider,{value:(0,r.useMemo)(()=>({open:s,setOpen:l}),[l,s]),children:(0,t.jsx)(h.Collapsible,{open:s,onOpenChange:l,asChild:!0,children:(0,t.jsx)("header",{ref:n,id:"nd-tocnav",...e,className:(0,i.cn)("fixed pr-(--removed-body-scroll-bar-size,0) z-10 border-b backdrop-blur-sm transition-colors xl:hidden max-xl:on-root:[--fd-tocnav-height:40px]",(!a||s)&&"bg-fd-background/80",s&&"shadow-lg",e.className),style:{...e.style,top:"calc(var(--fd-banner-height) + var(--fd-nav-height))",insetInlineStart:o?"0px":"calc(var(--fd-sidebar-width) + var(--fd-layout-offset))",insetInlineEnd:0},children:e.children})})})}function j({date:e,...n}){let{text:s}=(0,l.useI18n)(),[o,a]=(0,r.useState)("");return(0,r.useEffect)(()=>{a(new Date(e).toLocaleDateString())},[e]),(0,t.jsxs)("p",{...n,className:(0,i.cn)("text-sm text-fd-muted-foreground",n.className),children:[s.lastUpdate," ",o]})}let C=new Map;function N({items:e,...n}){let{root:s}=(0,o.useTreeContext)(),l=(0,a.usePathname)(),{previous:c,next:u}=(0,r.useMemo)(()=>{if(e)return e;let t=C.get(s.$id)??function e(t){let r=[];return t.forEach(t=>{if("folder"===t.type){t.index&&r.push(t.index),r.push(...e(t.children));return}"page"!==t.type||t.external||r.push(t)}),r}(s.children);C.set(s.$id,t);let r=t.findIndex(e=>(0,d.isActive)(e.url,l,!1));return -1===r?{}:{previous:t[r-1],next:t[r+1]}},[e,l,s]);return(0,t.jsxs)("div",{...n,className:(0,i.cn)("@container grid gap-4 pb-6",c&&u?"grid-cols-2":"grid-cols-1",n.className),children:[c?(0,t.jsx)(k,{item:c,index:0}):null,u?(0,t.jsx)(k,{item:u,index:1}):null]})}function k({item:e,index:r}){let{text:o}=(0,l.useI18n)(),a=0===r?n.ChevronLeft:n.ChevronRight;return(0,t.jsxs)(s.default,{href:e.url,className:(0,i.cn)("flex flex-col gap-2 rounded-lg border p-4 text-sm transition-colors hover:bg-fd-accent/80 hover:text-fd-accent-foreground @max-lg:col-span-full",1===r&&"text-end"),children:[(0,t.jsxs)("div",{className:(0,i.cn)("inline-flex items-center gap-1.5 font-medium",1===r&&"flex-row-reverse"),children:[(0,t.jsx)(a,{className:"-mx-1 size-4 shrink-0 rtl:rotate-180"}),(0,t.jsx)("p",{children:e.name})]}),(0,t.jsx)("p",{className:"text-fd-muted-foreground truncate",children:e.description??(0===r?o.previousPage:o.nextPage)})]})}function R({includeRoot:e,includeSeparator:l,includePage:a,...u}){let d=(0,o.useTreePath)(),{root:f}=(0,o.useTreeContext)(),h=(0,r.useMemo)(()=>(0,c.getBreadcrumbItemsFromPath)(f,d,{includePage:a,includeSeparator:l,includeRoot:e}),[a,e,l,d,f]);return 0===h.length?null:(0,t.jsx)("div",{...u,className:(0,i.cn)("flex items-center gap-1.5 text-sm text-fd-muted-foreground",u.className),children:h.map((e,l)=>{let o=(0,i.cn)("truncate",l===h.length-1&&"text-fd-primary font-medium");return(0,t.jsxs)(r.Fragment,{children:[0!==l&&(0,t.jsx)(n.ChevronRight,{className:"size-3.5 shrink-0"}),e.url?(0,t.jsx)(s.default,{href:e.url,className:(0,i.cn)(o,"transition-opacity hover:opacity-80"),children:e.name}):(0,t.jsx)("span",{className:o,children:e.name})]},l)})})}function T(e){let{collapsed:r}=(0,m.useSidebar)();return(0,t.jsx)("div",{id:"nd-toc",...e,className:(0,i.cn)("fixed bottom-0 pt-12 pb-2 pr-(--removed-body-scroll-bar-size,0) max-xl:hidden",e.className),style:{...e.style,top:"calc(var(--fd-banner-height) + var(--fd-nav-height))",insetInlineEnd:`max(${r?"0px":"var(--fd-layout-offset)"}, calc(50vw - var(--fd-sidebar-width)/2 - var(--fd-page-width)/2))`},children:(0,t.jsx)("div",{className:"flex h-full w-(--fd-toc-width) max-w-full flex-col pe-4",children:e.children})})}e.s(["PageBreadcrumb",()=>R,"PageFooter",()=>N,"PageLastUpdate",()=>j,"PageTOC",()=>T,"PageTOCPopover",()=>w,"PageTOCPopoverContent",()=>b,"PageTOCPopoverTrigger",()=>g])},19385,e=>{"use strict";var t=e.i(39326),r=e.i(40838),n=e.i(59979);e.i(95067);var s=e.i(83137),i=e.i(35078),l=e.i(46915),o=e.i(1694),a=e.i(6657);function c({ref:e,className:r,...c}){let f=(0,n.useRef)(null),h=(0,l.useTOCItems)(),{text:m}=(0,a.useI18n)(),[p,x]=(0,n.useState)();return((0,n.useEffect)(()=>{if(!f.current)return;let e=f.current;function t(){if(0===e.clientHeight)return;let t=0,r=0,n=[];for(let s=0;s<h.length;s++){let i=e.querySelector(`a[href="#${h[s].url.slice(1)}"]`);if(!i)continue;let l=getComputedStyle(i),o=u(h[s].depth)+1,a=i.offsetTop+parseFloat(l.paddingTop),c=i.offsetTop+i.clientHeight-parseFloat(l.paddingBottom);t=Math.max(o,t),r=Math.max(r,c),n.push(`${0===s?"M":"L"}${o} ${a}`),n.push(`L${o} ${c}`)}x({path:n.join(" "),width:t+1,height:r})}let r=new ResizeObserver(t);return t(),r.observe(e),()=>{r.disconnect()}},[h]),0===h.length)?(0,t.jsx)("div",{className:"rounded-lg border bg-fd-card p-3 text-xs text-fd-muted-foreground",children:m.tocNoHeadings}):(0,t.jsxs)(t.Fragment,{children:[p?(0,t.jsx)("div",{className:"absolute start-0 top-0 rtl:-scale-x-100",style:{width:p.width,height:p.height,maskImage:`url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${p.width} ${p.height}"><path d="${p.path}" stroke="black" stroke-width="1" fill="none" /></svg>`)}")`},children:(0,t.jsx)(i.TocThumb,{containerRef:f,className:"mt-(--fd-top) h-(--fd-height) bg-fd-primary transition-all"})}):null,(0,t.jsx)("div",{ref:(0,o.mergeRefs)(f,e),className:(0,s.cn)("flex flex-col",r),...c,children:h.map((e,r)=>(0,t.jsx)(d,{item:e,upper:h[r-1]?.depth,lower:h[r+1]?.depth},e.url))})]})}function u(e){return 10*(e>=3)}function d({item:e,upper:n=e.depth,lower:i=e.depth}){var l;let o=u(e.depth),a=u(n),c=u(i);return(0,t.jsxs)(r.TOCItem,{href:e.url,style:{paddingInlineStart:(l=e.depth)<=2?14:3===l?26:36},className:"prose relative py-1.5 text-sm text-fd-muted-foreground hover:text-fd-accent-foreground transition-colors [overflow-wrap:anywhere] first:pt-0 last:pb-0 data-[active=true]:text-fd-primary",children:[o!==a?(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",className:"absolute -top-1.5 start-0 size-4 rtl:-scale-x-100",children:(0,t.jsx)("line",{x1:a,y1:"0",x2:o,y2:"12",className:"stroke-fd-foreground/10",strokeWidth:"1"})}):null,(0,t.jsx)("div",{className:(0,s.cn)("absolute inset-y-0 w-px bg-fd-foreground/10",o!==a&&"top-1.5",o!==c&&"bottom-1.5"),style:{insetInlineStart:o}}),e.title]})}e.s(["default",()=>c])},72774,e=>{"use strict";e.i(26140);var t=e.i(29501);e.s(["FrameworkProvider",()=>t.FrameworkProvider,"Image",()=>t.Image,"Link",()=>t.Link,"createContext",()=>t.createContext,"useParams",()=>t.useParams,"usePathname",()=>t.usePathname,"useRouter",()=>t.useRouter])},84870,e=>{"use strict";var t=e.i(39326),r=e.i(96206),n=e.i(59979);e.i(95067);var s=e.i(83137),i=e.i(14749),l=e.i(91967),o=e.i(62568),a=e.i(7939),c=e.i(39914),u=new WeakMap;function d(e,t){var r,n;let s,i,l;if("at"in Array.prototype)return Array.prototype.at.call(e,t);let o=(r=e,n=t,s=r.length,(l=(i=f(n))>=0?i:s+i)<0||l>=s?-1:l);return -1===o?void 0:e[o]}function f(e){return e!=e||0===e?0:Math.trunc(e)}(class e extends Map{#e;constructor(e){super(e),this.#e=[...super.keys()],u.set(this,!0)}set(e,t){return u.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,r){let n,s=this.has(t),i=this.#e.length,l=f(e),o=l>=0?l:i+l,a=o<0||o>=i?-1:o;if(a===this.size||s&&a===this.size-1||-1===a)return this.set(t,r),this;let c=this.size+ +!s;l<0&&o++;let u=[...this.#e],d=!1;for(let e=o;e<c;e++)if(o===e){let i=u[e];u[e]===t&&(i=u[e+1]),s&&this.delete(t),n=this.get(i),this.set(t,r)}else{d||u[e-1]!==t||(d=!0);let r=u[d?e:e-1],s=n;n=this.get(r),this.delete(r),this.set(r,s)}return this}with(t,r,n){let s=new e(this);return s.insert(t,r,n),s}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,r){let n=this.#e.indexOf(e);return -1===n?this:this.insert(n,t,r)}after(e){let t=this.#e.indexOf(e);if(-1!==(t=-1===t||t===this.size-1?-1:t+1))return this.entryAt(t)}setAfter(e,t,r){let n=this.#e.indexOf(e);return -1===n?this:this.insert(n+1,t,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=d(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=d(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return d(this.#e,e)}from(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.at(n)}keyFrom(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.keyAt(n)}find(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return n;r++}}findIndex(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return r;r++}return -1}filter(t,r){let n=[],s=0;for(let e of this)Reflect.apply(t,r,[e,s,this])&&n.push(e),s++;return new e(n)}map(t,r){let n=[],s=0;for(let e of this)n.push([e[0],Reflect.apply(t,r,[e,s,this])]),s++;return new e(n)}reduce(...e){let[t,r]=e,n=0,s=r??this.at(0);for(let r of this)s=0===n&&1===e.length?r:Reflect.apply(t,this,[s,r,n,this]),n++;return s}reduceRight(...e){let[t,r]=e,n=r??this.at(-1);for(let r=this.size-1;r>=0;r--){let s=this.at(r);n=r===this.size-1&&1===e.length?s:Reflect.apply(t,this,[n,s,r,this])}return n}toSorted(t){return new e([...this.entries()].sort(t))}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let r=this.keyAt(e),n=this.get(r);t.set(r,n)}return t}toSpliced(...t){let r=[...this.entries()];return r.splice(...t),new e(r)}slice(t,r){let n=new e,s=this.size-1;if(void 0===t)return n;t<0&&(t+=this.size),void 0!==r&&r>0&&(s=r-1);for(let e=t;e<=s;e++){let t=this.keyAt(e),r=this.get(t);n.set(t,r)}return n}every(e,t){let r=0;for(let n of this){if(!Reflect.apply(e,t,[n,r,this]))return!1;r++}return!0}some(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return!0;r++}return!1}});var h=e.i(92822),m=e.i(21467),p=e.i(1896),x=e.i(76919),v=e.i(44941),g="rovingFocusGroup.onEntryFocus",y={bubbles:!1,cancelable:!0},b="RovingFocusGroup",[w,j,C]=function(e){let r=e+"CollectionProvider",[s,i]=(0,o.createContextScope)(r),[l,u]=s(r,{collectionRef:{current:null},itemMap:new Map}),d=e=>{let{scope:r,children:s}=e,i=n.default.useRef(null),o=n.default.useRef(new Map).current;return(0,t.jsx)(l,{scope:r,itemMap:o,collectionRef:i,children:s})};d.displayName=r;let f=e+"CollectionSlot",h=(0,c.createSlot)(f),m=n.default.forwardRef((e,r)=>{let{scope:n,children:s}=e,i=u(f,n),l=(0,a.useComposedRefs)(r,i.collectionRef);return(0,t.jsx)(h,{ref:l,children:s})});m.displayName=f;let p=e+"CollectionItemSlot",x="data-radix-collection-item",v=(0,c.createSlot)(p),g=n.default.forwardRef((e,r)=>{let{scope:s,children:i,...l}=e,o=n.default.useRef(null),c=(0,a.useComposedRefs)(r,o),d=u(p,s);return n.default.useEffect(()=>(d.itemMap.set(o,{ref:o,...l}),()=>void d.itemMap.delete(o))),(0,t.jsx)(v,{...{[x]:""},ref:c,children:i})});return g.displayName=p,[{Provider:d,Slot:m,ItemSlot:g},function(t){let r=u(e+"CollectionConsumer",t);return n.default.useCallback(()=>{let e=r.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${x}]`));return Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[r.collectionRef,r.itemMap])},i]}(b),[N,k]=(0,o.createContextScope)(b,[C]),[R,T]=N(b),I=n.forwardRef((e,r)=>(0,t.jsx)(w.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,t.jsx)(w.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,t.jsx)(P,{...e,ref:r})})}));I.displayName=b;var P=n.forwardRef((e,r)=>{let{__scopeRovingFocusGroup:s,orientation:i,loop:o=!1,dir:c,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:f,onEntryFocus:h,preventScrollOnEntryFocus:w=!1,...C}=e,N=n.useRef(null),k=(0,a.useComposedRefs)(r,N),T=(0,v.useDirection)(c),[I,P]=(0,x.useControllableState)({prop:u,defaultProp:d??null,onChange:f,caller:b}),[E,S]=n.useState(!1),A=(0,p.useCallbackRef)(h),O=j(s),F=n.useRef(!1),[z,$]=n.useState(0);return n.useEffect(()=>{let e=N.current;if(e)return e.addEventListener(g,A),()=>e.removeEventListener(g,A)},[A]),(0,t.jsx)(R,{scope:s,orientation:i,dir:T,loop:o,currentTabStopId:I,onItemFocus:n.useCallback(e=>P(e),[P]),onItemShiftTab:n.useCallback(()=>S(!0),[]),onFocusableItemAdd:n.useCallback(()=>$(e=>e+1),[]),onFocusableItemRemove:n.useCallback(()=>$(e=>e-1),[]),children:(0,t.jsx)(m.Primitive.div,{tabIndex:E||0===z?-1:0,"data-orientation":i,...C,ref:k,style:{outline:"none",...e.style},onMouseDown:(0,l.composeEventHandlers)(e.onMouseDown,()=>{F.current=!0}),onFocus:(0,l.composeEventHandlers)(e.onFocus,e=>{let t=!F.current;if(e.target===e.currentTarget&&t&&!E){let t=new CustomEvent(g,y);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=O().filter(e=>e.focusable);M([e.find(e=>e.active),e.find(e=>e.id===I),...e].filter(Boolean).map(e=>e.ref.current),w)}}F.current=!1}),onBlur:(0,l.composeEventHandlers)(e.onBlur,()=>S(!1))})})}),E="RovingFocusGroupItem",S=n.forwardRef((e,r)=>{let{__scopeRovingFocusGroup:s,focusable:i=!0,active:o=!1,tabStopId:a,children:c,...u}=e,d=(0,h.useId)(),f=a||d,p=T(E,s),x=p.currentTabStopId===f,v=j(s),{onFocusableItemAdd:g,onFocusableItemRemove:y,currentTabStopId:b}=p;return n.useEffect(()=>{if(i)return g(),()=>y()},[i,g,y]),(0,t.jsx)(w.ItemSlot,{scope:s,id:f,focusable:i,active:o,children:(0,t.jsx)(m.Primitive.span,{tabIndex:x?0:-1,"data-orientation":p.orientation,...u,ref:r,onMouseDown:(0,l.composeEventHandlers)(e.onMouseDown,e=>{i?p.onItemFocus(f):e.preventDefault()}),onFocus:(0,l.composeEventHandlers)(e.onFocus,()=>p.onItemFocus(f)),onKeyDown:(0,l.composeEventHandlers)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void p.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=function(e,t,r){var n;let s=(n=e.key,"rtl"!==r?n:"ArrowLeft"===n?"ArrowRight":"ArrowRight"===n?"ArrowLeft":n);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(s))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(s)))return A[s]}(e,p.orientation,p.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let s=v().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)s.reverse();else if("prev"===t||"next"===t){var r,n;"prev"===t&&s.reverse();let i=s.indexOf(e.currentTarget);s=p.loop?(r=s,n=i+1,r.map((e,t)=>r[(n+t)%r.length])):s.slice(i+1)}setTimeout(()=>M(s))}}),children:"function"==typeof c?c({isCurrentTabStop:x,hasTabStop:null!=b}):c})})});S.displayName=E;var A={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function M(e,t=!1){let r=document.activeElement;for(let n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}var O=e.i(62927),F="Tabs",[z,$]=(0,o.createContextScope)(F,[k]),D=k(),[L,B]=z(F),H=n.forwardRef((e,r)=>{let{__scopeTabs:n,value:s,onValueChange:i,defaultValue:l,orientation:o="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=(0,v.useDirection)(a),[f,p]=(0,x.useControllableState)({prop:s,onChange:i,defaultProp:l??"",caller:F});return(0,t.jsx)(L,{scope:n,baseId:(0,h.useId)(),value:f,onValueChange:p,orientation:o,dir:d,activationMode:c,children:(0,t.jsx)(m.Primitive.div,{dir:d,"data-orientation":o,...u,ref:r})})});H.displayName=F;var _="TabsList",K=n.forwardRef((e,r)=>{let{__scopeTabs:n,loop:s=!0,...i}=e,l=B(_,n),o=D(n);return(0,t.jsx)(I,{asChild:!0,...o,orientation:l.orientation,dir:l.dir,loop:s,children:(0,t.jsx)(m.Primitive.div,{role:"tablist","aria-orientation":l.orientation,...i,ref:r})})});K.displayName=_;var U="TabsTrigger",V=n.forwardRef((e,r)=>{let{__scopeTabs:n,value:s,disabled:i=!1,...o}=e,a=B(U,n),c=D(n),u=W(a.baseId,s),d=X(a.baseId,s),f=s===a.value;return(0,t.jsx)(S,{asChild:!0,...c,focusable:!i,active:f,children:(0,t.jsx)(m.Primitive.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":d,"data-state":f?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:u,...o,ref:r,onMouseDown:(0,l.composeEventHandlers)(e.onMouseDown,e=>{i||0!==e.button||!1!==e.ctrlKey?e.preventDefault():a.onValueChange(s)}),onKeyDown:(0,l.composeEventHandlers)(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&a.onValueChange(s)}),onFocus:(0,l.composeEventHandlers)(e.onFocus,()=>{let e="manual"!==a.activationMode;f||i||!e||a.onValueChange(s)})})})});V.displayName=U;var q="TabsContent",G=n.forwardRef((e,r)=>{let{__scopeTabs:s,value:i,forceMount:l,children:o,...a}=e,c=B(q,s),u=W(c.baseId,i),d=X(c.baseId,i),f=i===c.value,h=n.useRef(f);return n.useEffect(()=>{let e=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,t.jsx)(O.Presence,{present:l||f,children:({present:n})=>(0,t.jsx)(m.Primitive.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!n,id:d,tabIndex:0,...a,ref:r,style:{...e.style,animationDuration:h.current?"0s":void 0},children:n&&o})})});function W(e,t){return`${e}-trigger-${t}`}function X(e,t){return`${e}-content-${t}`}G.displayName=q;var Y=e.i(1694),J=e.i(21528);let Q=new Map,Z=(0,n.createContext)(null);function ee({ref:e,groupId:r,persist:s=!1,updateAnchor:i=!1,defaultValue:l,value:o,onValueChange:a,...c}){let u=(0,n.useRef)(null),[d,f]=void 0===o?(0,n.useState)(l):[o,a??(()=>void 0)],h=(0,J.useEffectEvent)(e=>f(e)),m=(0,n.useMemo)(()=>new Map,[]);return(0,n.useLayoutEffect)(()=>{let e;if(!r)return;let t=s?localStorage.getItem(r):sessionStorage.getItem(r);return t&&h(t),(e=Q.get(r)??[]).push(h),Q.set(r,e),()=>{let e;e=Q.get(r)??[],Q.set(r,e.filter(e=>e!==h))}},[r,s]),(0,n.useLayoutEffect)(()=>{let e=window.location.hash.slice(1);if(e){for(let[t,r]of m.entries())if(r===e){h(t),u.current?.scrollIntoView();break}}},[m]),(0,t.jsx)(H,{ref:(0,Y.mergeRefs)(e,u),value:d,onValueChange:e=>{if(i){let t=m.get(e);t&&window.history.replaceState(null,"",`#${t}`)}r?(Q.get(r)?.forEach(t=>{t(e)}),s?localStorage.setItem(r,e):sessionStorage.setItem(r,e)):f(e)},...c,children:(0,t.jsx)(Z.Provider,{value:(0,n.useMemo)(()=>({valueToIdMap:m}),[m]),children:c.children})})}function et({value:e,...r}){let{valueToIdMap:s}=function(){let e=(0,n.useContext)(Z);if(!e)throw Error("You must wrap your component in <Tabs>");return e}();return r.id&&s.set(e,r.id),(0,t.jsx)(G,{value:e,...r,children:r.children})}let er=(0,n.createContext)(null);function en(e){return(0,t.jsx)("pre",{...e,className:(0,s.cn)("min-w-full w-max *:flex *:flex-col",e.className),children:e.children})}function es({ref:e,title:r,allowCopy:i=!0,keepBackground:l=!1,icon:o,viewportProps:a={},children:c,Actions:u=e=>(0,t.jsx)("div",{...e,className:(0,s.cn)("empty:hidden",e.className)}),...d}){let f=null!==(0,n.useContext)(er),h=(0,n.useRef)(null);return(0,t.jsxs)("figure",{ref:e,dir:"ltr",...d,className:(0,s.cn)(f?"bg-fd-secondary -mx-px -mb-px last:rounded-b-xl":"my-4 bg-fd-card rounded-xl",l&&"bg-(--shiki-light-bg) dark:bg-(--shiki-dark-bg)","shiki relative border shadow-sm outline-none not-prose overflow-hidden text-sm",d.className),children:[r?(0,t.jsxs)("div",{className:"flex text-fd-muted-foreground items-center gap-2 h-9.5 border-b px-4",children:["string"==typeof o?(0,t.jsx)("div",{className:"[&_svg]:size-3.5",dangerouslySetInnerHTML:{__html:o}}):o,(0,t.jsx)("figcaption",{className:"flex-1 truncate",children:r}),u({className:"-me-2",children:i&&(0,t.jsx)(ei,{containerRef:h})})]}):u({className:"absolute top-2 right-2 z-2 backdrop-blur-lg rounded-lg text-fd-muted-foreground",children:i&&(0,t.jsx)(ei,{containerRef:h})}),(0,t.jsx)("div",{ref:h,...a,className:(0,s.cn)("text-[13px] py-3.5 overflow-auto max-h-[600px] fd-scroll-container",a.className),style:{"--padding-right":r?void 0:"calc(var(--spacing) * 8)",counterSet:d["data-line-numbers"]?`line ${Number(d["data-line-numbers-start"]??1)-1}`:void 0,...a.style},children:c})]})}function ei({className:e,containerRef:l,...o}){let[a,c]=function(e){let[t,r]=(0,n.useState)(!1),s=(0,n.useRef)(e),i=(0,n.useRef)(null);s.current=e;let l=(0,n.useCallback)(()=>{i.current&&window.clearTimeout(i.current),Promise.resolve(s.current()).then(()=>{r(!0),i.current=window.setTimeout(()=>{r(!1)},1500)})},[]);return(0,n.useEffect)(()=>()=>{i.current&&window.clearTimeout(i.current)},[]),[t,l]}(()=>{let e=l.current?.getElementsByTagName("pre").item(0);if(!e)return;let t=e.cloneNode(!0);t.querySelectorAll(".nd-copy-ignore").forEach(e=>{e.replaceWith("\n")}),navigator.clipboard.writeText(t.textContent??"")});return(0,t.jsx)("button",{type:"button","data-checked":a||void 0,className:(0,s.cn)((0,i.buttonVariants)({className:"hover:text-fd-accent-foreground data-[checked]:text-fd-accent-foreground",size:"icon-xs"}),e),"aria-label":a?"Copied Text":"Copy Text",onClick:c,...o,children:a?(0,t.jsx)(r.Check,{}):(0,t.jsx)(r.Clipboard,{})})}function el({ref:e,...r}){let i=(0,n.useRef)(null),l=null!==(0,n.useContext)(er);return(0,t.jsx)(ee,{ref:(0,Y.mergeRefs)(i,e),...r,className:(0,s.cn)("bg-fd-card rounded-xl border",!l&&"my-4",r.className),children:(0,t.jsx)(er.Provider,{value:(0,n.useMemo)(()=>({containerRef:i,nested:l}),[l]),children:r.children})})}function eo(e){return(0,t.jsx)(K,{...e,className:(0,s.cn)("flex flex-row px-2 overflow-x-auto text-fd-muted-foreground",e.className),children:e.children})}function ea({children:e,...r}){return(0,t.jsxs)(V,{...r,className:(0,s.cn)("relative group inline-flex text-sm font-medium text-nowrap items-center transition-colors gap-2 px-2 py-1.5 hover:text-fd-accent-foreground data-[state=active]:text-fd-primary [&_svg]:size-3.5",r.className),children:[(0,t.jsx)("div",{className:"absolute inset-x-2 bottom-0 h-px group-data-[state=active]:bg-fd-primary"}),e]})}function ec(e){return(0,t.jsx)(et,{...e})}e.s(["CodeBlock",()=>es,"CodeBlockTab",()=>ec,"CodeBlockTabs",()=>el,"CodeBlockTabsList",()=>eo,"CodeBlockTabsTrigger",()=>ea,"Pre",()=>en],84870)}]); |