mirror of
https://github.com/bspeice/speice.io
synced 2025-01-13 11:10:15 -05:00
1 line
6.1 KiB
JavaScript
1 line
6.1 KiB
JavaScript
|
"use strict";(self.webpackChunkspeice_io=self.webpackChunkspeice_io||[]).push([["3933"],{4352:function(e,t,n){n.r(t),n.d(t,{default:()=>T});var i=n("85893"),r=n("67294"),l=n("67026"),s=n("50357"),a=n("66171"),o=n("68141"),c=n("69890"),d=n("79489"),u=n("44284");function m(){let{assets:e,metadata:t}=(0,o.nO)(),{title:n,description:r,date:l,tags:a,authors:c,frontMatter:d}=t,{keywords:u}=d,m=e.image??d.image;return(0,i.jsxs)(s.d,{title:d.title_meta??n,description:r,keywords:u,image:m,children:[(0,i.jsx)("meta",{property:"og:type",content:"article"}),(0,i.jsx)("meta",{property:"article:published_time",content:l}),c.some(e=>e.url)&&(0,i.jsx)("meta",{property:"article:author",content:c.map(e=>e.url).filter(Boolean).join(",")}),a.length>0&&(0,i.jsx)("meta",{property:"article:tag",content:a.map(e=>e.label).join(",")})]})}var f=n("11199");function h(){let e=(0,o.iZ)();return(0,i.jsx)(f.Z,{children:(0,i.jsx)("script",{type:"application/ld+json",children:JSON.stringify(e)})})}var x=n("66009");function p(e){let t=e.getBoundingClientRect();return t.top===t.bottom?p(e.parentNode):t}var j=n("53367");let g=r.memo(function e(t){let{toc:n,className:r,linkClassName:l,isChild:s}=t;return n.length?(0,i.jsx)("ul",{className:s?void 0:r,children:n.map(t=>(0,i.jsxs)("li",{children:[(0,i.jsx)(j.Z,{to:`#${t.id}`,className:l??void 0,dangerouslySetInnerHTML:{__html:t.value}}),(0,i.jsx)(e,{isChild:!0,toc:t.children,className:r,linkClassName:l})]},t.id))}):null});function v(e){let{toc:t,className:n="table-of-contents table-of-contents__left-border",linkClassName:l="table-of-contents__link",linkActiveClassName:s,minHeadingLevel:a,maxHeadingLevel:o,...c}=e,d=(0,x.L)(),u=a??d.tableOfContents.minHeadingLevel,m=o??d.tableOfContents.maxHeadingLevel,f=function(e){let{toc:t,minHeadingLevel:n,maxHeadingLevel:i}=e;return(0,r.useMemo)(()=>(function e(t){let{toc:n,minHeadingLevel:i,maxHeadingLevel:r}=t;return n.flatMap(t=>{let n=e({toc:t.children,minHeadingLevel:i,maxHeadingLevel:r});return t.level>=i&&t.level<=r?[{...t,children:n}]:n})})({toc:function(e){let t=e.map(e=>({...e,parentIndex:-1,children:[]})),n=Array(7).fill(-1);t.forEach((e,t)=>{let i=n.slice(2,e.level);e.parentIndex=Math.max(...i),n[e.level]=t});let i=[];return t.forEach(e=>{let{parentIndex:n,...r}=e;n>=0?t[n].children.push(r):i.push(r)}),i}(t),minHeadingLevel:n,maxHeadingLevel:i}),[t,n,i])}({toc:t,minHeadingLevel:u,maxHeadingLevel:m});return!function(e){let t=(0,r.useRef)(void 0),n=function(){let e=(0,r.useRef)(0),{navbar:{hideOnScroll:t}}=(0,x.L)();return(0,r.useEffect)(()=>{e.current=t?0:document.querySelector(".navbar").clientHeight},[t]),e}();(0,r.useEffect)(()=>{if(!e)return()=>{};let{linkClassName:i,linkActiveClassName:r,minHeadingLevel:l,maxHeadingLevel:s}=e;function a(){let e=Array.from(document.getElementsByClassName(i)),a=function(e,t){let{anchorTopOffset:n}=t,i=e.find(e=>p(e).top>=n);if(i){var r;return(r=p(i)).top>0&&r.bottom<window.innerHeight/2?i:e[e.indexOf(i)-1]??null}return e[e.length-1]??null}(function(e){let{minHeadingLevel:t,maxHeadingLevel:n}=e,i=[];for(let e=t;e<=n;e+=1)i.push(`h${e}.anchor`);return Array.from(document.querySelectorAll(i.join()))}({minHeadingLevel:l,maxHeadingLevel:s}),{anchorTopOffset:n.current}),o=e.find(e=>a&&a.id===decodeURIComponent(e.href.substring(e.href.indexOf("#")+1)));e.forEach(e=>{e===o?(t.current&&t.current!==e&&t.current.classList.remove(r),e.classList.add(r),t.current=e):e.classList.remove(r)})}return document.addEventListener("scroll",a),document.addEventListener("resize",a),a(),()=>{document.removeEventListener("scroll",a),document.removeEventListener("resize",a)}},[e,n])}((0,r.useMemo)(()=>{if(l&&s)return{linkClassName:l,linkActiveClassName:s,minHeadingLevel:u,maxHeadingLevel:m}},[l,s,u,m])),(0,i.jsx)(g,{toc:f,className:n,linkClassName:l,...c})}function b(e){let{className:t,...n}=e;return(0,i.jsx)("div",{className:(0,l.Z)("tableOfContents_bqdL","thin-scrollbar",t),children:(0,i.jsx)(v,{...n,linkClassName:"table-of-contents__link toc-highlight",linkActiveClassName:"table-of-contents__link--active"})})}var _=n("7670");function y(){return(0,i.j
|