mirror of
https://github.com/zenlm/zen-blog.git
synced 2026-10-30 15:05:49 +00:00
1 line
16 KiB
JavaScript
1 line
16 KiB
JavaScript
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,80675,e=>{"use strict";let t=(0,e.i(21281).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",()=>t],80675)},51504,e=>{"use strict";e.i(644);var t=e.i(71193),r=e.i(40854),n=e.i(18796),i=e.i(96660),s=e.i(52540),o=e.i(73739),l=e.i(580),a=e.i(61773),u=e.i(13660),c=new WeakMap;function d(e,t){var r,n;let i,s,o;if("at"in Array.prototype)return Array.prototype.at.call(e,t);let l=(r=e,n=t,i=r.length,(o=(s=f(n))>=0?s:i+s)<0||o>=i?-1:o);return -1===l?void 0:e[l]}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()],c.set(this,!0)}set(e,t){return c.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,i=this.has(t),s=this.#e.length,o=f(e),l=o>=0?o:s+o,a=l<0||l>=s?-1:l;if(a===this.size||i&&a===this.size-1||-1===a)return this.set(t,r),this;let u=this.size+ +!i;o<0&&l++;let c=[...this.#e],d=!1;for(let e=l;e<u;e++)if(l===e){let s=c[e];c[e]===t&&(s=c[e+1]),i&&this.delete(t),n=this.get(s),this.set(t,r)}else{d||c[e-1]!==t||(d=!0);let r=c[d?e:e-1],i=n;n=this.get(r),this.delete(r),this.set(r,i)}return this}with(t,r,n){let i=new e(this);return i.insert(t,r,n),i}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=[],i=0;for(let e of this)Reflect.apply(t,r,[e,i,this])&&n.push(e),i++;return new e(n)}map(t,r){let n=[],i=0;for(let e of this)n.push([e[0],Reflect.apply(t,r,[e,i,this])]),i++;return new e(n)}reduce(...e){let[t,r]=e,n=0,i=r??this.at(0);for(let r of this)i=0===n&&1===e.length?r:Reflect.apply(t,this,[i,r,n,this]),n++;return i}reduceRight(...e){let[t,r]=e,n=r??this.at(-1);for(let r=this.size-1;r>=0;r--){let i=this.at(r);n=r===this.size-1&&1===e.length?i:Reflect.apply(t,this,[n,i,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,i=this.size-1;if(void 0===t)return n;t<0&&(t+=this.size),void 0!==r&&r>0&&(i=r-1);for(let e=t;e<=i;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(50588),p=e.i(97990),m=e.i(51622),v=e.i(37009),x=e.i(57545),y="rovingFocusGroup.onEntryFocus",g={bubbles:!1,cancelable:!0},b="RovingFocusGroup",[w,k,R]=function(e){let t=e+"CollectionProvider",[n,i]=(0,l.createContextScope)(t),[o,c]=n(t,{collectionRef:{current:null},itemMap:new Map}),d=e=>{let{scope:t,children:n}=e,i=r.default.useRef(null),l=r.default.useRef(new Map).current;return(0,s.jsx)(o,{scope:t,itemMap:l,collectionRef:i,children:n})};d.displayName=t;let f=e+"CollectionSlot",h=(0,u.createSlot)(f),p=r.default.forwardRef((e,t)=>{let{scope:r,children:n}=e,i=c(f,r),o=(0,a.useComposedRefs)(t,i.collectionRef);return(0,s.jsx)(h,{ref:o,children:n})});p.displayName=f;let m=e+"CollectionItemSlot",v="data-radix-collection-item",x=(0,u.createSlot)(m),y=r.default.forwardRef((e,t)=>{let{scope:n,children:i,...o}=e,l=r.default.useRef(null),u=(0,a.useComposedRefs)(t,l),d=c(m,n);return r.default.useEffect(()=>(d.itemMap.set(l,{ref:l,...o}),()=>void d.itemMap.delete(l))),(0,s.jsx)(x,{...{[v]:""},ref:u,children:i})});return y.displayName=m,[{Provider:d,Slot:p,ItemSlot:y},function(t){let n=c(e+"CollectionConsumer",t);return r.default.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${v}]`));return Array.from(n.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[n.collectionRef,n.itemMap])},i]}(b),[C,j]=(0,l.createContextScope)(b,[R]),[A,S]=C(b),N=r.forwardRef((e,t)=>(0,s.jsx)(w.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,s.jsx)(w.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,s.jsx)(T,{...e,ref:t})})}));N.displayName=b;var T=r.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:i,loop:l=!1,dir:u,currentTabStopId:c,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:f,onEntryFocus:h,preventScrollOnEntryFocus:w=!1,...R}=e,C=r.useRef(null),j=(0,a.useComposedRefs)(t,C),S=(0,x.useDirection)(u),[N,T]=(0,v.useControllableState)({prop:c,defaultProp:d??null,onChange:f,caller:b}),[I,E]=r.useState(!1),M=(0,m.useCallbackRef)(h),F=k(n),z=r.useRef(!1),[D,O]=r.useState(0);return r.useEffect(()=>{let e=C.current;if(e)return e.addEventListener(y,M),()=>e.removeEventListener(y,M)},[M]),(0,s.jsx)(A,{scope:n,orientation:i,dir:S,loop:l,currentTabStopId:N,onItemFocus:r.useCallback(e=>T(e),[T]),onItemShiftTab:r.useCallback(()=>E(!0),[]),onFocusableItemAdd:r.useCallback(()=>O(e=>e+1),[]),onFocusableItemRemove:r.useCallback(()=>O(e=>e-1),[]),children:(0,s.jsx)(p.Primitive.div,{tabIndex:I||0===D?-1:0,"data-orientation":i,...R,ref:j,style:{outline:"none",...e.style},onMouseDown:(0,o.composeEventHandlers)(e.onMouseDown,()=>{z.current=!0}),onFocus:(0,o.composeEventHandlers)(e.onFocus,e=>{let t=!z.current;if(e.target===e.currentTarget&&t&&!I){let t=new CustomEvent(y,g);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=F().filter(e=>e.focusable);P([e.find(e=>e.active),e.find(e=>e.id===N),...e].filter(Boolean).map(e=>e.ref.current),w)}}z.current=!1}),onBlur:(0,o.composeEventHandlers)(e.onBlur,()=>E(!1))})})}),I="RovingFocusGroupItem",E=r.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:i=!0,active:l=!1,tabStopId:a,children:u,...c}=e,d=(0,h.useId)(),f=a||d,m=S(I,n),v=m.currentTabStopId===f,x=k(n),{onFocusableItemAdd:y,onFocusableItemRemove:g,currentTabStopId:b}=m;return r.useEffect(()=>{if(i)return y(),()=>g()},[i,y,g]),(0,s.jsx)(w.ItemSlot,{scope:n,id:f,focusable:i,active:l,children:(0,s.jsx)(p.Primitive.span,{tabIndex:v?0:-1,"data-orientation":m.orientation,...c,ref:t,onMouseDown:(0,o.composeEventHandlers)(e.onMouseDown,e=>{i?m.onItemFocus(f):e.preventDefault()}),onFocus:(0,o.composeEventHandlers)(e.onFocus,()=>m.onItemFocus(f)),onKeyDown:(0,o.composeEventHandlers)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void m.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=function(e,t,r){var n;let i=(n=e.key,"rtl"!==r?n:"ArrowLeft"===n?"ArrowRight":"ArrowRight"===n?"ArrowLeft":n);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(i))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(i)))return M[i]}(e,m.orientation,m.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let i=x().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)i.reverse();else if("prev"===t||"next"===t){var r,n;"prev"===t&&i.reverse();let s=i.indexOf(e.currentTarget);i=m.loop?(r=i,n=s+1,r.map((e,t)=>r[(n+t)%r.length])):i.slice(s+1)}setTimeout(()=>P(i))}}),children:"function"==typeof u?u({isCurrentTabStop:v,hasTabStop:null!=b}):u})})});E.displayName=I;var M={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function P(e,t=!1){let r=document.activeElement;for(let n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}var F=e.i(44832),z="Tabs",[D,O]=(0,l.createContextScope)(z,[j]),B=j(),[H,K]=D(z),L=r.forwardRef((e,t)=>{let{__scopeTabs:r,value:n,onValueChange:i,defaultValue:o,orientation:l="horizontal",dir:a,activationMode:u="automatic",...c}=e,d=(0,x.useDirection)(a),[f,m]=(0,v.useControllableState)({prop:n,onChange:i,defaultProp:o??"",caller:z});return(0,s.jsx)(H,{scope:r,baseId:(0,h.useId)(),value:f,onValueChange:m,orientation:l,dir:d,activationMode:u,children:(0,s.jsx)(p.Primitive.div,{dir:d,"data-orientation":l,...c,ref:t})})});L.displayName=z;var V="TabsList",_=r.forwardRef((e,t)=>{let{__scopeTabs:r,loop:n=!0,...i}=e,o=K(V,r),l=B(r);return(0,s.jsx)(N,{asChild:!0,...l,orientation:o.orientation,dir:o.dir,loop:n,children:(0,s.jsx)(p.Primitive.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});_.displayName=V;var $="TabsTrigger",G=r.forwardRef((e,t)=>{let{__scopeTabs:r,value:n,disabled:i=!1,...l}=e,a=K($,r),u=B(r),c=W(a.baseId,n),d=Y(a.baseId,n),f=n===a.value;return(0,s.jsx)(E,{asChild:!0,...u,focusable:!i,active:f,children:(0,s.jsx)(p.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:c,...l,ref:t,onMouseDown:(0,o.composeEventHandlers)(e.onMouseDown,e=>{i||0!==e.button||!1!==e.ctrlKey?e.preventDefault():a.onValueChange(n)}),onKeyDown:(0,o.composeEventHandlers)(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&a.onValueChange(n)}),onFocus:(0,o.composeEventHandlers)(e.onFocus,()=>{let e="manual"!==a.activationMode;f||i||!e||a.onValueChange(n)})})})});G.displayName=$;var U="TabsContent",q=r.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,forceMount:o,children:l,...a}=e,u=K(U,n),c=W(u.baseId,i),d=Y(u.baseId,i),f=i===u.value,h=r.useRef(f);return r.useEffect(()=>{let e=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,s.jsx)(F.Presence,{present:o||f,children:({present:r})=>(0,s.jsx)(p.Primitive.div,{"data-state":f?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":c,hidden:!r,id:d,tabIndex:0,...a,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:r&&l})})});function W(e,t){return`${e}-trigger-${t}`}function Y(e,t){return`${e}-content-${t}`}q.displayName=U;let J=new Map,Q=(0,r.createContext)(null);function X({ref:e,groupId:t,persist:n=!1,updateAnchor:o=!1,defaultValue:l,value:a,onValueChange:u,...c}){let d=(0,r.useRef)(null),f=(0,r.useMemo)(()=>new Map,[]),[h,p]=void 0===a?(0,r.useState)(l):[a,(0,r.useEffectEvent)(e=>u?.(e))];return(0,r.useLayoutEffect)(()=>{if(!t)return;let e=sessionStorage.getItem(t);n&&(e??=localStorage.getItem(t)),e&&p(e);let r=J.get(t)??new Set;return r.add(p),J.set(t,r),()=>{r.delete(p)}},[t,n,p]),(0,r.useLayoutEffect)(()=>{let e=window.location.hash.slice(1);if(e){for(let[t,r]of f.entries())if(r===e){p(t),d.current?.scrollIntoView();break}}},[p,f]),(0,s.jsx)(L,{ref:(0,i.mergeRefs)(e,d),value:h,onValueChange:e=>{if(o){let t=f.get(e);t&&window.history.replaceState(null,"",`#${t}`)}if(t){let r=J.get(t);if(r)for(let t of r)t(e);sessionStorage.setItem(t,e),n&&localStorage.setItem(t,e)}else p(e)},...c,children:(0,s.jsx)(Q,{value:(0,r.useMemo)(()=>({valueToIdMap:f}),[f]),children:c.children})})}function Z({value:e,...t}){let{valueToIdMap:n}=function(){let e=(0,r.use)(Q);if(!e)throw Error("You must wrap your component in <Tabs>");return e}();return t.id&&n.set(e,t.id),(0,s.jsx)(q,{value:e,...t,children:t.children})}var ee=e.i(8646);let et=(0,e.i(21281).default)("clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]),er=(0,r.createContext)(null);function en(e){return(0,s.jsx)("pre",{...e,className:(0,t.cn)("min-w-full w-max *:flex *:flex-col",e.className),children:e.children})}function ei({ref:e,title:n,allowCopy:i=!0,keepBackground:o=!1,icon:l,viewportProps:a={},children:u,Actions:c=e=>(0,s.jsx)("div",{...e,className:(0,t.cn)("empty:hidden",e.className)}),...d}){let f=null!==(0,r.use)(er),h=(0,r.useRef)(null);return(0,s.jsxs)("figure",{ref:e,dir:"ltr",...d,tabIndex:-1,className:(0,t.cn)(f?"bg-fd-secondary -mx-px -mb-px last:rounded-b-xl":"my-4 bg-fd-card rounded-xl",o&&"bg-(--shiki-light-bg) dark:bg-(--shiki-dark-bg)","shiki relative border shadow-sm not-prose overflow-hidden text-sm",d.className),children:[n?(0,s.jsxs)("div",{className:"flex text-fd-muted-foreground items-center gap-2 h-9.5 border-b px-4",children:["string"==typeof l?(0,s.jsx)("div",{className:"[&_svg]:size-3.5",dangerouslySetInnerHTML:{__html:l}}):l,(0,s.jsx)("figcaption",{className:"flex-1 truncate",children:n}),c({className:"-me-2",children:i&&(0,s.jsx)(es,{containerRef:h})})]}):c({className:"absolute top-3 right-2 z-2 backdrop-blur-lg rounded-lg text-fd-muted-foreground",children:i&&(0,s.jsx)(es,{containerRef:h})}),(0,s.jsx)("div",{ref:h,...a,role:"region",tabIndex:0,className:(0,t.cn)("text-[0.8125rem] py-3.5 overflow-auto max-h-[600px] fd-scroll-container focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-fd-ring",a.className),style:{"--padding-right":n?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:u})]})}function es({className:e,containerRef:i,...o}){let[l,a]=function(e){let[t,n]=(0,r.useState)(!1),i=(0,r.useRef)(e),s=(0,r.useRef)(null);i.current=e;let o=(0,r.useCallback)(()=>{s.current&&window.clearTimeout(s.current),Promise.resolve(i.current()).then(()=>{n(!0),s.current=window.setTimeout(()=>{n(!1)},1500)})},[]);return(0,r.useEffect)(()=>()=>{s.current&&window.clearTimeout(s.current)},[]),[t,o]}(()=>{let e=i.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,s.jsx)("button",{type:"button","data-checked":l||void 0,className:(0,t.cn)((0,n.buttonVariants)({className:"hover:text-fd-accent-foreground data-checked:text-fd-accent-foreground",size:"icon-xs"}),e),"aria-label":l?"Copied Text":"Copy Text",onClick:a,...o,children:l?(0,s.jsx)(ee.Check,{}):(0,s.jsx)(et,{})})}function eo({ref:e,...n}){let o=(0,r.useRef)(null),l=null!==(0,r.use)(er);return(0,s.jsx)(X,{ref:(0,i.mergeRefs)(o,e),...n,className:(0,t.cn)("bg-fd-card rounded-xl border",!l&&"my-4",n.className),children:(0,s.jsx)(er,{value:(0,r.useMemo)(()=>({containerRef:o,nested:l}),[l]),children:n.children})})}function el(e){return(0,s.jsx)(_,{...e,className:(0,t.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,s.jsxs)(G,{...r,className:(0,t.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,s.jsx)("div",{className:"absolute inset-x-2 bottom-0 h-px group-data-[state=active]:bg-fd-primary"}),e]})}function eu(e){return(0,s.jsx)(Z,{...e})}e.s(["CodeBlock",()=>ei,"CodeBlockTab",()=>eu,"CodeBlockTabs",()=>eo,"CodeBlockTabsList",()=>el,"CodeBlockTabsTrigger",()=>ea,"Pre",()=>en],51504)},25063,e=>{e.v(t=>Promise.all(["static/chunks/d9fb2394f7227771.js"].map(t=>e.l(t))).then(()=>t(16495)))},74433,e=>{e.v(t=>Promise.all(["static/chunks/3411b08c7b763f3f.js","static/chunks/f19fe44237e54646.js"].map(t=>e.l(t))).then(()=>t(72646)))}]); |