/*! * Chirpy v6.5.3 | © 2019 Cotes Chung | MIT Licensed | https://github.com/cotes2020/jekyll-theme-chirpy/ */ !function(){"use strict";const t=$(".mode-toggle");function e(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var a=o.call(t,e||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function o(t,o,a){return(o=e(o))in t?Object.defineProperty(t,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[o]=a,t}const a=$("body"),r="sidebar-display";class s{static toggle(){!1===s.isExpanded?a.attr(r,""):a.removeAttr(r),s.isExpanded=!s.isExpanded}}o(s,"isExpanded",!1);const i=$("#sidebar-trigger"),n=$("#search-trigger"),l=$("#search-cancel"),c=$("#main-wrapper>.container>.row"),u=$("#topbar-title"),d=$("search"),m=$("#search-result-wrapper"),f=$("#search-results"),p=$("#search-input"),g=$("#search-hints"),h=$("html,body"),b="loaded",v="unloaded",C="input-focus",w="d-flex";class y{static on(){y.offset=window.scrollY,h.scrollTop(0)}static off(){h.scrollTop(y.offset)}}o(y,"offset",0),o(y,"resultVisible",!1);class S{static on(){i.addClass(v),u.addClass(v),n.addClass(v),d.addClass(w),l.addClass(b)}static off(){l.removeClass(b),d.removeClass(w),i.removeClass(v),u.removeClass(v),n.removeClass(v)}}class T{static on(){y.resultVisible||(y.on(),m.removeClass(v),c.addClass(v),y.resultVisible=!0)}static off(){y.resultVisible&&(f.empty(),g.hasClass(v)&&g.removeClass(v),m.addClass(v),c.removeClass(v),y.off(),p.val(""),y.resultVisible=!1)}}function k(){return l.hasClass(b)}$(".collapse");const x=".code-header>button",A="fas fa-check",E="timeout",j="data-title-succeed",D="data-bs-original-title",M=2e3;function F(t){if($(t)[0].hasAttribute(E)){let e=$(t).attr(E);if(Number(e)>Date.now())return!0}return!1}function R(t){$(t).attr(E,Date.now()+M)}function q(t){$(t).removeAttr(E)}const I=$(x).children().attr("class");const N="data-src",V="data-lqip",P={SHIMMER:"shimmer",BLUR:"blur"};function U(t){$(this).parent().removeClass(t)}function z(){this.complete&&(this.hasAttribute(V)?U.call(this,P.BLUR):U.call(this,P.SHIMMER))}function B(){const t=$(this),e=t.attr(N);t.attr("src",encodeURI(e)),t.removeAttr(N)}class H{static get attrTimestamp(){return"data-ts"}static get attrDateFormat(){return"data-df"}static get locale(){return $("html").attr("lang").substring(0,2)}static getTimestamp(t){return Number(t.attr(H.attrTimestamp))}static getDateFormat(t){return t.attr(H.attrDateFormat)}}0!==t.length&&t.off().on("click",(t=>{const e=$(t.target);let o=e.prop("tagName")==="button".toUpperCase()?e:e.parent();modeToggle.flipMode(),o.trigger("blur")})),$("#sidebar-trigger").on("click",s.toggle),$("#mask").on("click",s.toggle),n.on("click",(function(){S.on(),T.on(),p.trigger("focus")})),l.on("click",(function(){S.off(),T.off()})),p.on("focus",(function(){d.addClass(C)})),p.on("focusout",(function(){d.removeClass(C)})),p.on("input",(()=>{""===p.val()?k()?g.removeClass(v):T.off():(T.on(),k()&&g.addClass(v))})),function(){const t=$("article img");t.length&&t.on("load",z),$('article img[loading="lazy"]').each((function(){this.complete&&U.call(this,P.SHIMMER)}));const e=$("article img[".concat(V,'="true"]'));e.length&&e.each(B)}(),$(".popup")<=0||$(".popup").magnificPopup({type:"image",closeOnContentClick:!0,showCloseBtn:!1,zoom:{enabled:!0,duration:300,easing:"ease-in-out"}}),dayjs.locale(H.locale),dayjs.extend(window.dayjs_plugin_localizedFormat),$("[".concat(H.attrTimestamp,"]")).each((function(){const t=dayjs.unix(H.getTimestamp($(this))),e=t.format(H.getDateFormat($(this)));$(this).text(e),$(this).removeAttr(H.attrTimestamp),$(this).removeAttr(H.attrDateFormat);const o=$(this).attr("data-bs-toggle");if(void 0===o||"tooltip"!==o)return;const a=t.format("llll");$(this).attr("data-bs-title",a),new bootstrap.Tooltip($(this))})),function(){if($(x).length){const t=new ClipboardJS(x,{target:t=>t.parentNode.nextElementSibling.querySelector("code .rouge-code")});[...document.querySelectorAll(x)].map((t=>new bootstrap.Tooltip(t,{placement:"left"}))),t.on("success",(t=>{t.clearSelection();const e=t.trigger;F(e)||(!function(t){$(t).children().attr("class",A)}(e),function(t){const e=$(t).attr(j);$(t).attr(D,e).tooltip("show")}(e),R(e),setTimeout((()=>{!function(t){$(t).tooltip("hide").removeAttr(D)}(e),function(t){$(t).children().attr("class",I)}(e),q(e)}),M))}))}const t=$("#copy-link");t.on("click",(t=>{let e=$(t.target);F(e)||navigator.clipboard.writeText(window.location.href).then((()=>{const t=e.attr(D),o=e.attr(j);e.attr(D,o).tooltip("show"),R(e),setTimeout((()=>{e.attr(D,t),q(e)}),M)}))})),t.on("mouseleave",(function(t){$(t.target).tooltip("hide")}))}(),document.querySelector("main h2, main h3")&&tocbot.init({tocSelector:"#toc",contentSelector:".content",ignoreSelector:"[data-toc-skip]",headingSelector:"h2, h3, h4",orderedList:!1,scrollSmooth:!1}),function(){const t=$(window),e=$("#back-to-top");t.on("scroll",(()=>{t.scrollTop()>50?e.fadeIn():e.fadeOut()})),e.on("click",(()=>{t.scrollTop(0)}))}(),[...document.querySelectorAll('[data-bs-toggle="tooltip"]')].map((t=>new bootstrap.Tooltip(t)))}();