blog-hexo/public/js/24e1d5fd.js
2023-11-08 10:11:56 +08:00

1 line
10 KiB
JavaScript

(()=>{var e,t,n={59:(e,t,n)=>{var r={"./prism-atom-dark.less":[271,271],"./prism-duotone-sea.less":[922,922],"./prism-laserwave.less":[796,21],"./prism-line-number.less":[206,206],"./prism-material-dark.less":[429,429],"./prism-night-owl.less":[291,291],"./prism-one-dark.less":[766,766],"./prism-one-light.less":[618,618],"./prism-vsc-dark-plus.less":[945,945]};function o(e){if(!n.o(r,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=r[e],o=t[0];return n.e(t[1]).then((()=>n(o)))}o.keys=()=>Object.keys(r),o.id=59,e.exports=o},837:()=>{"use strict";document.addEventListener("DOMContentLoaded",(function(){!function(e,t){const n=document.querySelector(e);n&&document.addEventListener("selectionchange",(()=>{const e=window.getSelection();if(e&&e.rangeCount>0&&!e.isCollapsed){const r=e.getRangeAt(0);if(n.contains(r.startContainer)&&n.contains(r.endContainer)){const o=e.toString(),s=[],a=document.createNodeIterator(r.commonAncestorContainer,NodeFilter.SHOW_ELEMENT);let i;for(;i=a.nextNode();)r.intersectsNode(i)&&s.push(i);const l=s.filter((e=>n!==e));t({selectedElements:l,selectedText:o})}}}))}(".article-container article",(e=>{}))}))}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var s=r[e]={exports:{}};return n[e](s,s.exports,o),s.exports}o.m=n,o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((t,n)=>(o.f[n](e,t),t)),[])),o.u=e=>"js/"+e+"."+{21:"282c05e7",206:"759361ed",271:"ee88a6de",291:"4ac6984b",429:"bc4769cb",618:"1a58fba9",766:"9503a62c",922:"689e0633",945:"0313a94c"}[e]+".js",o.miniCssF=e=>"css/"+e+"."+{21:"88950121",206:"a3a4e130",271:"54fa1675",291:"a8323266",429:"fb1dabcb",618:"6513d67e",766:"64ad3c35",922:"9efa0b6b",945:"fdf98cb0"}[e]+".css",o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="@ornn/dockyard:",o.l=(n,r,s,a)=>{if(e[n])e[n].push(r);else{var i,l;if(void 0!==s)for(var c=document.getElementsByTagName("script"),d=0;d<c.length;d++){var u=c[d];if(u.getAttribute("src")==n||u.getAttribute("data-webpack")==t+s){i=u;break}}i||(l=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,o.nc&&i.setAttribute("nonce",o.nc),i.setAttribute("data-webpack",t+s),i.src=n),e[n]=[r];var p=(t,r)=>{i.onerror=i.onload=null,clearTimeout(m);var o=e[n];if(delete e[n],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach((e=>e(r))),t)return t(r)},m=setTimeout(p.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=p.bind(null,i.onerror),i.onload=p.bind(null,i.onload),l&&document.head.appendChild(i)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var r=n.length-1;r>-1&&!e;)e=n[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e+"../"})(),(()=>{if("undefined"!=typeof document){var e=e=>new Promise(((t,n)=>{var r=o.miniCssF(e),s=o.p+r;if(((e,t)=>{for(var n=document.getElementsByTagName("link"),r=0;r<n.length;r++){var o=(a=n[r]).getAttribute("data-href")||a.getAttribute("href");if("stylesheet"===a.rel&&(o===e||o===t))return a}var s=document.getElementsByTagName("style");for(r=0;r<s.length;r++){var a;if((o=(a=s[r]).getAttribute("data-href"))===e||o===t)return a}})(r,s))return t();((e,t,n,r,o)=>{var s=document.createElement("link");s.rel="stylesheet",s.type="text/css",s.onerror=s.onload=n=>{if(s.onerror=s.onload=null,"load"===n.type)r();else{var a=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.href||t,l=new Error("Loading CSS chunk "+e+" failed.\n("+i+")");l.code="CSS_CHUNK_LOAD_FAILED",l.type=a,l.request=i,s.parentNode&&s.parentNode.removeChild(s),o(l)}},s.href=t,n?n.parentNode.insertBefore(s,n.nextSibling):document.head.appendChild(s)})(e,s,null,t,n)})),t={913:0};o.f.miniCss=(n,r)=>{t[n]?r.push(t[n]):0!==t[n]&&{21:1,206:1,271:1,291:1,429:1,618:1,766:1,922:1,945:1}[n]&&r.push(t[n]=e(n).then((()=>{t[n]=0}),(e=>{throw delete t[n],e})))}}})(),(()=>{var e={913:0};o.f.j=(t,n)=>{var r=o.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else{var s=new Promise(((n,o)=>r=e[t]=[n,o]));n.push(r[2]=s);var a=o.p+o.u(t),i=new Error;o.l(a,(n=>{if(o.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var s=n&&("load"===n.type?"missing":n.type),a=n&&n.target&&n.target.src;i.message="Loading chunk "+t+" failed.\n("+s+": "+a+")",i.name="ChunkLoadError",i.type=s,i.request=a,r[1](i)}}),"chunk-"+t,t)}};var t=(t,n)=>{var r,s,[a,i,l]=n,c=0;if(a.some((t=>0!==e[t]))){for(r in i)o.o(i,r)&&(o.m[r]=i[r]);if(l)l(o)}for(t&&t(n);c<a.length;c++)s=a[c],o.o(e,s)&&e[s]&&e[s][0](),e[s]=0},n=self.webpackChunk_ornn_dockyard=self.webpackChunk_ornn_dockyard||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),(()=>{"use strict";const e="__theme__",t=()=>{const t=localStorage.getItem(e);return null!=t?t:"light"};const n=new class{constructor(){this.listeners={}}on(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)}off(e,t){const n=this.listeners[e];n&&(this.listeners[e]=n.filter((e=>e!==t)))}emit(e,...t){const n=this.listeners[e];n&&n.length&&n.forEach((e=>{e(...t)}))}},r=e=>Promise.all(e.map((e=>new Promise(((t,n)=>{if("css"===e.type){const r=document.createElement("link");r.href=e.url,r.rel="stylesheet",r.onload=()=>t(),r.onerror=()=>n(new Error(`Failed to load CSS from ${e.url}`)),document.head.appendChild(r)}else if("js"===e.type){const r=document.createElement("script");r.src=e.url,r.onload=()=>t(),r.onerror=()=>n(new Error(`Failed to load JS from ${e.url}`)),document.body.appendChild(r)}else n(new Error("Invalid resource type specified."))}))))),s=e=>{const t=document.querySelector(e);if(t){const e=t.scrollTop;localStorage.setItem("scrolledHeight",String(e))}},a=e=>{const{enable:t,jsCdn:n,cssCdn:o}=e;t&&r([{type:"css",url:o},{type:"js",url:n}]).then((e=>{e&&(e=>{const t=/\$\$(.+?)\$\$/g,n=/\\\[(.+?)\\\]/g;function r(e,t,n){let r;const o=[];for(;null!==(r=t.exec(e.nodeValue));){const t=document.createRange();t.setStart(e,r.index),t.setEnd(e,r.index+r[0].length),o.push(t)}for(const e of o){const t=e.toString().replace(/^\$\$|\$\$$|\\\[|\\\]$/g,""),r=document.createElement("span");r.innerHTML=window.katex.renderToString(t,{throwOnError:!1,displayMode:n}),e.deleteContents(),e.insertNode(r)}}document.querySelectorAll(e).forEach((e=>{const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null);let s;for(;s=o.nextNode();)r(s,t,!1),r(s,n,!0)}))})(".article-container")}))};var i=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};const l=e=>{const{enable:t,cdn:n}=e,o=i(e,["enable","cdn"]);t&&r([{type:"js",url:n}]).then((e=>{e&&(((e="vcomments",t=".article-container")=>{const n=document.querySelector(t);if(!n)return;const r=document.createElement("div");r.id=e,n.appendChild(r)})(),new window.Valine(Object.assign({el:"#vcomments"},o)))}))};o(837);const c='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2"></path><rect x="9" y="3" width="6" height="4" rx="2"></rect></g></svg>',d={light:"prism-one-light",dark:"prism-one-dark"},u=e=>{document.querySelectorAll(".toc a").forEach((e=>e.classList.remove("active")));const t=document.querySelector('.toc a[href="'+e+'"]');t&&t.classList.add("active")};document.addEventListener("click",(function(e){const t=e.target.closest(".toc-link");if(t){const e=t.getAttribute("href");e&&u(e)}})),document.addEventListener("DOMContentLoaded",(function(){(e=>{const t=document.querySelector(e);if(t){const e=localStorage.getItem("scrolledHeight");e&&(t.scrollTop=Number(e))}})("main.scrollbar-obtrusive");const{hash:e}=window.location;e&&u(e);const{mermaid:i,katex:p,valine:m}=window;a(Object.assign(Object.assign({},p),{enable:window.page.use.indexOf("katex")>-1})),(e=>{const{enable:o,cdn:s}=e;o&&r([{type:"js",url:s}]).then((e=>{e&&(window.mermaid.initialize({theme:"dark"===t()?"dark":"default"}),n.on("theme:change",(()=>location.reload())))}))})(Object.assign(Object.assign({},i),{enable:window.page.use.indexOf("mermaid")>-1})),l(Object.assign(Object.assign({},m),{enable:window.page.use.indexOf("valine")>-1})),document.querySelectorAll(".article-container article pre > code").forEach((e=>{const t=e.parentNode;if(!t)return;const n=document.createElement("div");n.classList.add("code-wrapper"),t.parentNode.insertBefore(n,t),n.appendChild(t);const r=document.createElement("div");r.classList.add("btn-wrapper");const o=t.getAttribute("data-language"),s=document.createElement("span");s.classList.add("lang"),s.textContent=o,r.appendChild(s);const a=document.createElement("span");a.className="copy-button",a.innerHTML=c,a.addEventListener("click",(function(){const t=e.textContent;navigator.clipboard.writeText(t).then((()=>{a.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2"></path><rect x="9" y="3" width="6" height="4" rx="2"></rect><path d="M9 14l2 2l4-4"></path></g></svg>',setTimeout((()=>{a.innerHTML=c}),2e3)}))})),r.appendChild(a),n.appendChild(r)})),o(59)(`./${d[t()]}.less`);const h=document.getElementById("toggle-theme");null==h||h.addEventListener("click",(()=>{s("main.scrollbar-obtrusive"),window.location.reload()}))})),document.addEventListener("DOMContentLoaded",(function(){const e=document.querySelector("main.scrollbar-obtrusive");e&&e.addEventListener("scroll",(()=>{s("main.scrollbar-obtrusive")}))}))})()})();