var _e=Object.defineProperty;var be=(l,e,t)=>e in l?_e(l,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[e]=t;var le=(l,e,t)=>be(l,typeof e!="symbol"?e+"":e,t);var B=class{async postComment(e,t){try{let i=await fetch(e,{method:"POST",body:t,headers:{"X-Requested-With":"XMLHttpRequest"}}),s=i.headers.get("commentCount"),n=i.headers.get("content-type");if(n&&n.includes("application/json"))return{success:!1,msg:(await i.json()).msg||"\u63D0\u4EA4\u5931\u8D25"};let o=await i.text();try{let a=JSON.parse(o);if(a&&a.success===!1)return{success:!1,msg:a.msg}}catch{}return{success:!0,html:o,commentCount:s}}catch(i){return console.error("Comment Post Error:",i),{success:!1,msg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25"}}}async loadComments(e){try{let t=await fetch(e,{method:"GET",headers:{"X-Requested-With":"XMLHttpRequest"}});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);let i=t.headers.get("commentCount");return{success:!0,html:await t.text(),commentCount:i}}catch(t){return console.error("Comment Load Error:",t),{success:!1}}}};var S=class{constructor(e=null){this.element=e||document,this.init()}init(){this._applyPrismTheme(),!(typeof this.element.querySelector=="function"?this.element:document).querySelector(".code-view-wrapper")&&this._prismOnAll()}_applyPrismTheme(){if(typeof Prism>"u")return;let e=document.getElementById("prism_theme");!e||e.href||(e.href=window.matchMedia("(prefers-color-scheme: dark)").matches?"https://dpangzi.com/library/prism/prism-tomorrow-night.css":"https://dpangzi.com/library/prism/prism-light.css")}_prismOnAll(){typeof Prism>"u"||this.element.querySelectorAll("pre code").forEach((e,t)=>{this._decoratePre(e.parentNode,t),Prism.highlightElement(e)})}_decoratePre(e,t){e.id||(e.id=`code-block-${t}`),["rainbow-braces","match-braces","line-numbers","linkable-line-numbers"].forEach(i=>{e.classList.contains(i)||e.classList.add(i)}),e.hasAttribute("data-line")||e.setAttribute("data-line","")}};function K(){return window.matchMedia("(max-width: 768px), (pointer: coarse)").matches}function Z(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"vs-dark":"vs"}function M(l=document){let e=l.querySelectorAll("time");for(let t of e){let i=t.getAttribute("datetime");if(i&&!t.dataset.processed){let s=new Date(i),o=(new Date-s)/1e3,a="";o<60?a="\u521A\u521A":o<3600?a=`${Math.floor(o/60)}\u5206\u949F\u524D`:o<86400?a=`${Math.floor(o/3600)}\u5C0F\u65F6\u524D`:o<2592e3?a=`${Math.floor(o/86400)}\u5929\u524D`:o<31536e3?a=`${Math.floor(o/2592e3)}\u4E2A\u6708\u524D`:a=`${Math.floor(o/31536e3)}\u5E74\u524D`,t.textContent=a,!t.hasAttribute("title")&&!t.hasAttribute("data-original-title")&&t.setAttribute("title",i),t.dataset.processed="true"}}}var q=class{constructor(e){this.container=e||document.querySelector(".comment-section"),this.listContainer=this.container?this.container.querySelector(".comment-list"):null,this.drawer=null,this.drawerOverlay=null,this.icons={loading:'<svg class="animate-spin" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 12a9 9 0 11-6.219-8.56"></path></svg>',send:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="22" y1="2" x2="11" y2="13"></line><polygon points="22,2 15,22 11,13 2,9 22,2"></polygon></svg>',error:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>'}}setButtonState(e,t,i){if(e)switch(t){case"loading":e.disabled=!0,e.innerHTML=`${this.icons.loading} \u53D1\u9001\u4E2D...`,e.classList.add("btn-loading");break;case"error":e.disabled=!1,e.innerHTML=`${this.icons.error} ${i||"\u91CD\u8BD5"}`,e.classList.add("btn-error");break;case"normal":default:e.disabled=!1,e.innerHTML=`${this.icons.send} \u53D1\u9001`,e.classList.remove("btn-loading","btn-error");break}}showListSkeleton(){if(!this.container)return;let e=`
            <div class="comment-section-skeleton">
                <div class="comment-loading-spinner">
                    <svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="animate-spin">
                        <path d="M21 12a9 9 0 11-6.219-8.56"></path>
                    </svg>
                    <span>\u8BC4\u8BBA\u52A0\u8F7D\u4E2D...</span>
                </div>
            </div>
        `,t=this.container.parentElement;t&&(t.innerHTML=e)}showListLoading(){if(!this.listContainer)return;let e=this.listContainer.querySelector(".comment-list-loading");e||(e=document.createElement("div"),e.className="comment-list-loading",e.innerHTML=`
                <div class="comment-loading-spinner">
                    <svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="animate-spin">
                        <path d="M21 12a9 9 0 11-6.219-8.56"></path>
                    </svg>
                    <span>\u52A0\u8F7D\u4E2D...</span>
                </div>
            `,getComputedStyle(this.listContainer).position==="static"&&(this.listContainer.style.position="relative"),this.listContainer.appendChild(e)),e.style.display="flex",this.listContainer.classList.add("is-loading")}hideListLoading(){if(!this.listContainer)return;let e=this.listContainer.querySelector(".comment-list-loading");e&&(e.style.display="none"),this.listContainer.classList.remove("is-loading")}updateList(e){this.listContainer&&(this.listContainer.innerHTML=e,this.refreshPlugins(),this.listContainer.classList.remove("is-loading"))}appendList(e){if(this.listContainer){let t=this.listContainer.querySelector(".comment-load-more");t&&t.remove();let i=document.createElement("div");for(i.innerHTML=e;i.firstChild;)this.listContainer.appendChild(i.firstChild);this.refreshPlugins()}}updateCount(e){let t=this.container.querySelector(".comment-section__count");t&&e&&(t.textContent=e)}refreshPlugins(){typeof S<"u"&&new S(this.container),M(this.container),typeof LazyLoad<"u"&&new LazyLoad({container:this.container})}showReplyForm(e,t){let i=this.container.querySelector("form.comment-form");if(!i&&this.drawer&&(i=this.drawer.querySelector("form.comment-form"),i)){let n=this.container.querySelector(".comment-form-wrapper");n&&(n.appendChild(i),i.classList.remove("comment-form--reply"))}if(!i)return;window.innerWidth<=768?this.showMobileReplyDrawer(e,t,i):this.showDesktopReplyForm(e,t,i)}showDesktopReplyForm(e,t,i){this.resetForm(i);let s=i.querySelector('input[name="replyId"]');s&&(s.value=t);let n=i.querySelector(".comment-form__cancel-btn");n&&(n.style.display="inline-block");let o=e.querySelector(".comment-item__body"),a=o.querySelector(".comment-item__actions");a?a.after(i):o.appendChild(i),i.classList.add("comment-form--reply"),i.scrollIntoView({behavior:"smooth",block:"center"});let r=i.querySelector("textarea");r&&r.focus()}showMobileReplyDrawer(e,t,i){let s=e.querySelector(".comment-avatar-img"),n=e.querySelector(".comment-item__author, .comment-item__user-info"),o=e.querySelector(".comment-item__content"),a={avatarSrc:s?s.src:"",authorName:n?n.textContent.trim():"\u672A\u77E5\u7528\u6237",contentText:o?o.textContent.trim().substring(0,100):""};this.drawer||this.createMobileDrawer(),this.updateDrawerContext(a),this.resetForm(i);let r=i.querySelector('input[name="replyId"]');r&&(r.value=t);let c=this.drawer.querySelector(".comment-reply-drawer__body");c&&(c.innerHTML="",c.appendChild(i)),this.openDrawer()}createMobileDrawer(){this.drawerOverlay=document.createElement("div"),this.drawerOverlay.className="comment-reply-drawer__overlay",this.drawerOverlay.addEventListener("click",()=>this.closeDrawer()),this.drawer=document.createElement("div"),this.drawer.className="comment-reply-drawer",this.drawer.innerHTML=`
            <div class="comment-reply-drawer__header">
                <span class="comment-reply-drawer__title">\u56DE\u590D\u8BC4\u8BBA</span>
                <button type="button" class="comment-reply-drawer__close" aria-label="\u5173\u95ED">
                    <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                        <line x1="18" y1="6" x2="6" y2="18"></line>
                        <line x1="6" y1="6" x2="18" y2="18"></line>
                    </svg>
                </button>
            </div>
            <div class="comment-reply-drawer__context">
                <div class="comment-reply-drawer__context-label">\u56DE\u590D\u7ED9</div>
                <div class="comment-reply-drawer__context-item">
                    <img class="comment-reply-drawer__context-avatar" src="" alt="">
                    <div class="comment-reply-drawer__context-body">
                        <div class="comment-reply-drawer__context-author"></div>
                        <div class="comment-reply-drawer__context-text"></div>
                    </div>
                </div>
            </div>
            <div class="comment-reply-drawer__body"></div>
        `;let e=this.drawer.querySelector(".comment-reply-drawer__close");e&&e.addEventListener("click",()=>this.closeDrawer()),this.container.appendChild(this.drawerOverlay),this.container.appendChild(this.drawer)}updateDrawerContext(e){if(!this.drawer)return;let t=this.drawer.querySelector(".comment-reply-drawer__context-avatar"),i=this.drawer.querySelector(".comment-reply-drawer__context-author"),s=this.drawer.querySelector(".comment-reply-drawer__context-text");t&&(t.src=e.avatarSrc),i&&(i.textContent=e.authorName),s&&(s.textContent=e.contentText)}openDrawer(){!this.drawer||!this.drawerOverlay||(document.body.style.overflow="hidden",this.drawerOverlay.classList.add("comment-reply-drawer__overlay--visible"),requestAnimationFrame(()=>{this.drawer.classList.add("comment-reply-drawer--open")}),setTimeout(()=>{let e=this.drawer.querySelector(".comment-form__editor");e&&e.focus()},350))}closeDrawer(){if(!this.drawer||!this.drawerOverlay)return;let e=this.drawer.querySelector("form.comment-form");if(e){let t=this.container.querySelector(".comment-form-wrapper");if(t){this.resetForm(e),t.appendChild(e),e.classList.remove("comment-form--reply");let i=e.querySelector(".comment-form__cancel-btn");i&&(i.style.display="none")}}this.drawer.classList.remove("comment-reply-drawer--open"),this.drawerOverlay.classList.remove("comment-reply-drawer__overlay--visible"),document.body.style.overflow=""}resetReplyForm(){let e=this.container.querySelector("form.comment-form")||this.drawer&&this.drawer.querySelector("form.comment-form"),t=this.container.querySelector(".comment-form-wrapper");if(e&&t){this.resetForm(e),t.appendChild(e),e.classList.remove("comment-form--reply");let i=e.querySelector(".comment-form__cancel-btn");i&&(i.style.display="none")}this.drawer&&this.drawer.classList.contains("comment-reply-drawer--open")&&(this.drawer.classList.remove("comment-reply-drawer--open"),this.drawerOverlay&&this.drawerOverlay.classList.remove("comment-reply-drawer__overlay--visible"),document.body.style.overflow="")}resetForm(e){e.reset();let t=e.querySelector('input[name="replyId"]');t&&(t.value=""),this.setButtonState(e.querySelector('button[type="submit"]'),"normal"),this.hideListLoading();let i=e.querySelector(".comment-form__editor");i&&this.updateCharCount(i)}insertMarkdown(e){let t=this.container.querySelector("form.comment-form"),i=t?t.querySelector("textarea"):null;if(i){let s=i.selectionStart,n=i.selectionEnd,o=i.value;i.value=o.substring(0,s)+e+o.substring(n),i.focus(),i.selectionStart=i.selectionEnd=s+e.length,this.updateCharCount(i)}}updateCharCount(e){let t=e.closest(".comment-form");if(!t)return;let i=t.querySelector(".comment-form__char-count");if(!i)return;let s=parseInt(e.getAttribute("maxlength"))||1e3,n=e.value.length;i.textContent=`${n}/${s}`,i.classList.remove("comment-form__char-count--warn","comment-form__char-count--limit"),n>=s?i.classList.add("comment-form__char-count--limit"):n>s*.9&&i.classList.add("comment-form__char-count--warn")}};var ee=class{constructor(){this._notificationInstances=new Set}createDialog(e,t,i="alert"){let s=document.createElement("div");s.className="dialog-overlay";let n=document.createElement("div");n.className="dialog";let o=document.createElement("div");o.className="dialog__header",o.innerHTML=`
            <span>${e||"\u63D0\u793A"}</span>
            <button type="button" class="dialog__close" aria-label="\u5173\u95ED">
                <i class="fa fa-times"></i>
            </button>
        `;let a=document.createElement("div");if(a.className="dialog__body",a.innerHTML=`<div class="dialog__message">${t}</div>`,i==="prompt"){let c=document.createElement("div");c.className="dialog__input-wrapper",c.innerHTML='<input type="text" class="dialog__input" autocomplete="off">',a.appendChild(c)}let r=document.createElement("div");return r.className="dialog__footer",i==="alert"?r.innerHTML=`
                <button type="button" class="dialog__btn dialog__btn--primary" data-action="confirm">\u786E\u5B9A</button>
            `:(i==="confirm"||i==="prompt")&&(r.innerHTML=`
                <button type="button" class="dialog__btn dialog__btn--default" data-action="cancel">\u53D6\u6D88</button>
                <button type="button" class="dialog__btn dialog__btn--primary" data-action="confirm">\u786E\u5B9A</button>
            `),n.appendChild(o),n.appendChild(a),n.appendChild(r),s.appendChild(n),document.body.appendChild(s),s.offsetHeight,s.classList.add("dialog-overlay--visible"),{overlay:s,dialog:n}}closeDialog(e){e.classList.remove("dialog-overlay--visible"),e.addEventListener("transitionend",()=>{e.parentNode&&e.parentNode.removeChild(e)},{once:!0})}alert(e,t="\u63D0\u793A"){return new Promise(i=>{let{overlay:s,dialog:n}=this.createDialog(t,e,"alert"),o=()=>{this.closeDialog(s),i()};n.querySelector('[data-action="confirm"]').addEventListener("click",o),n.querySelector(".dialog__close").addEventListener("click",o),n.querySelector(".dialog__btn--primary").focus()})}confirm(e,t="\u786E\u8BA4"){return new Promise(i=>{let{overlay:s,dialog:n}=this.createDialog(t,e,"confirm"),o=()=>{this.closeDialog(s),i(!0)},a=()=>{this.closeDialog(s),i(!1)};n.querySelector('[data-action="confirm"]').addEventListener("click",o),n.querySelector('[data-action="cancel"]').addEventListener("click",a),n.querySelector(".dialog__close").addEventListener("click",a),n.querySelector(".dialog__btn--primary").focus()})}prompt(e,t="\u8F93\u5165",i=""){return new Promise(s=>{let{overlay:n,dialog:o}=this.createDialog(t,e,"prompt"),a=o.querySelector(".dialog__input");a.value=i;let r=()=>{let d=a.value;this.closeDialog(n),s(d)},c=()=>{this.closeDialog(n),s(null)};o.querySelector('[data-action="confirm"]').addEventListener("click",r),o.querySelector('[data-action="cancel"]').addEventListener("click",c),o.querySelector(".dialog__close").addEventListener("click",c),a.addEventListener("keydown",d=>{d.key==="Enter"&&r(),d.key==="Escape"&&c()}),setTimeout(()=>a.focus(),50)})}toast(e,t="info",i=3e3,s="top-center"){let n=this.getToastContainer(s),o=document.createElement("div");o.className=`toast toast--${t}`;let a="fa-info-circle";t==="success"&&(a="fa-check-circle"),t==="warning"&&(a="fa-exclamation-triangle"),t==="error"&&(a="fa-times-circle"),o.innerHTML=`
            <i class="toast__icon fa ${a}"></i>
            <span class="toast__content">${e}</span>
        `,n.appendChild(o);let r,c=i,d=Date.now(),u=()=>{o.classList.add("is-leaving"),o.addEventListener("animationend",()=>{o.parentNode&&o.parentNode.removeChild(o)},{once:!0})},m=()=>{d=Date.now(),r=setTimeout(u,c)},p=()=>{r&&(clearTimeout(r),c-=Date.now()-d,c<0&&(c=0))},g=()=>{c>0?m():u()};o.addEventListener("mouseenter",p),o.addEventListener("mouseleave",g),o.addEventListener("touchstart",p,{passive:!0}),o.addEventListener("touchend",g,{passive:!0}),m()}getToastContainer(e){let t=document.querySelector(`.toast-container[data-position="${e}"]`);return t||(t=document.createElement("div"),t.className=`toast-container toast-container--${e}`,t.dataset.position=e,document.body.appendChild(t)),t}showTooltip(e,t){if(!t)return;let i=document.getElementById("dialog-tooltip");i||(i=document.createElement("div"),i.id="dialog-tooltip",i.className="dialog-tooltip",document.body.appendChild(i)),this._tooltipTimer&&(clearInterval(this._tooltipTimer),this._tooltipTimer=null),i.textContent=t,i.classList.remove("is-bottom"),i.classList.add("is-visible");let s=()=>{if(!e||!document.body.contains(e)){this.hideTooltip();return}let n=e.getBoundingClientRect();if(n.width===0&&n.height===0){this.hideTooltip();return}let o=i.getBoundingClientRect(),a=n.top-o.height-8,r=n.left+(n.width-o.width)/2;a<0?(a=n.bottom+8,i.classList.add("is-bottom")):i.classList.remove("is-bottom"),r<0?r=4:r+o.width>window.innerWidth&&(r=window.innerWidth-o.width-4),i.style.top=`${a}px`,i.style.left=`${r}px`};s(),this._tooltipTimer=setInterval(s,200)}hideTooltip(){let e=document.getElementById("dialog-tooltip");e&&e.classList.remove("is-visible"),this._tooltipTimer&&(clearInterval(this._tooltipTimer),this._tooltipTimer=null)}showNotification(e={}){let t={title:"",content:"",bars:[],autoClose:0,type:"info",...e},i=this._calculateNotificationTopPosition(),s=this._createNotificationBox(t);return s.style.top=`${i}px`,document.body.appendChild(s),this._notificationInstances.add(s),t.autoClose>0&&setTimeout(()=>this.closeNotification(s),t.autoClose),requestAnimationFrame(()=>{s.classList.add("notification-box--enter")}),s}setNotificationContent(e,t){if(!this._validateNotificationBox(e))return;let i=e.querySelector(".notification-box__content");i&&(i.textContent=String(t||""))}setNotificationTitle(e,t){if(!this._validateNotificationBox(e))return;let i=e.querySelector(".notification-box__title");i&&(i.textContent=String(t||""))}setNotificationProgress(e,t){if(!this._validateNotificationBox(e)||!Array.isArray(t))return;let i=e.querySelectorAll(".notification-box__progress");t.forEach((s,n)=>{if(typeof s=="number"&&n<i.length){let o=Math.max(0,Math.min(100,s)),a=i[n],r=a.querySelector(".notification-box__progress-track"),c=a.querySelector(".notification-box__progress-bar"),d=`${o.toFixed(1)}%`;c&&(o>0?(c.style.width=`${o}%`,c.style.display=""):(c.style.width="0%",c.style.display="none"));let u=r?r.querySelector(".notification-box__progress-text"):null,m=a.querySelector(".notification-box__progress-text--external");if(u)u.textContent=d;else if(m){m.remove();let p=document.createElement("span");p.className="notification-box__progress-text",p.textContent=d,r&&r.appendChild(p)}else if(r){let p=document.createElement("span");p.className="notification-box__progress-text",p.textContent=d,r.appendChild(p)}}})}closeNotification(e){this._validateNotificationBox(e)&&(e.classList.add("notification-box--exit"),setTimeout(()=>{e.parentNode&&(this._notificationInstances.delete(e),e.parentNode.removeChild(e),this._recalculateNotificationPositions())},300))}closeAllNotifications(){Array.from(this._notificationInstances).forEach(t=>{this.closeNotification(t)})}getNotificationCount(){return this._notificationInstances.size}_validateNotificationBox(e){return e&&e.parentNode&&this._notificationInstances.has(e)}_calculateNotificationTopPosition(){let e=15;return this._notificationInstances.forEach(t=>{t.offsetParent!==null&&(e+=t.offsetHeight+15)}),e}_recalculateNotificationPositions(){let e=15;this._notificationInstances.forEach(t=>{t.offsetParent!==null&&(t.style.top=`${e}px`,e+=t.offsetHeight+15)})}_createNotificationBox(e){let t=document.createElement("div");if(t.className=`notification-box notification-box--${e.type}`,e.title){let n=document.createElement("div");n.className="notification-box__title",n.textContent=e.title,t.appendChild(n)}let i=document.createElement("div");i.className="notification-box__content-container";let s=document.createElement("div");return s.className="notification-box__content",s.textContent=e.content,i.appendChild(s),this._createNotificationProgressBars(i,e.bars),t.appendChild(i),this._addNotificationCloseButton(t),t}_createNotificationProgressBars(e,t){!Array.isArray(t)||t.length===0||t.forEach(i=>{if(typeof i=="number"){let s=Math.max(0,Math.min(100,i)),n=document.createElement("div");n.className="notification-box__progress";let o=document.createElement("div");o.className="notification-box__progress-track";let a=document.createElement("div");a.className="notification-box__progress-bar",s>0?(a.style.width=`${s}%`,a.style.display=""):(a.style.width="0%",a.style.display="none");let r=`${s.toFixed(1)}%`,c=document.createElement("span");c.className="notification-box__progress-text",c.textContent=r,o.appendChild(a),o.appendChild(c),n.appendChild(o),e.appendChild(n)}})}_addNotificationCloseButton(e){let t=document.createElement("button");t.className="notification-box__close",t.innerHTML="&times;",t.setAttribute("aria-label","\u5173\u95ED\u901A\u77E5"),t.addEventListener("click",i=>{i.preventDefault(),i.stopPropagation(),this.closeNotification(e)}),e.appendChild(t)}},h=new ee;var E=class l{constructor(e){this.api=new B,this.ui=new q(e),this.init()}init(){this.ui.container&&(console.log("Comment System Initialized"),this.unbindEvents(),this.bindEvents(),this.ui.refreshPlugins())}unbindEvents(){this.ui.container.commentSystem,this.ui.container.commentSystem=this}bindEvents(){let e=this.ui.container;if(!e)return;let t=async o=>{o.target.matches("form.comment-form")&&(o.preventDefault(),o.stopPropagation(),await this.handleSubmit(o.target))};e.addEventListener("submit",t);let i=async o=>{let a=o.target.closest(".comment-item__reply-btn");if(a){let u=a.closest(".comment-item"),m=a.dataset.replyId;this.ui.showReplyForm(u,m);return}if(o.target.matches(".comment-form__cancel-btn")){this.ui.resetReplyForm(),this.ui.drawer&&this.ui.drawer.classList.contains("comment-reply-drawer--open")&&this.ui.closeDrawer();return}let r=o.target.closest(".comment-section__refresh-btn");if(r){let u=r.dataset.url;await this.handleRefresh(u,r);return}let c=o.target.closest(".comment-load-more__btn");if(c){let u=c.dataset.pageRequest,m=parseInt(c.dataset.pageIndex),p=parseInt(c.dataset.pageSize),g=u.includes("?")?"&":"?",y=`${u}${g}pageIndex=${m+1}&pageSize=${p}`;await this.handleLoadMore(y,c);return}o.target.closest('[data-action="image"]')&&await this.handleImageInsert()};e.addEventListener("click",i);let s=o=>{o.target.matches("form.comment-form input")&&o.key==="Enter"&&o.preventDefault()};e.addEventListener("keydown",s);let n=o=>{o.target.matches(".comment-form__editor")&&this.ui.updateCharCount(o.target)};e.addEventListener("input",n),this.cleanup=()=>{e.removeEventListener("submit",t),e.removeEventListener("click",i),e.removeEventListener("keydown",s),e.removeEventListener("input",n)}}async handleSubmit(e){let t=e.querySelector('button[type="submit"]');this.ui.setButtonState(t,"loading");let i=new FormData(e),s=e.action,n=await this.api.postComment(s,i);n.success?(this.ui.resetReplyForm(),n.html&&this.ui.updateList(n.html),n.commentCount&&this.ui.updateCount(n.commentCount),this.ui.resetForm(e),this.ui.drawer&&this.ui.drawer.classList.contains("comment-reply-drawer--open")&&this.ui.closeDrawer(),h.toast("\u8BC4\u8BBA\u53D1\u5E03\u6210\u529F")):(this.ui.setButtonState(t,"error","\u91CD\u8BD5"),h.toast(n.msg||"\u53D1\u5E03\u5931\u8D25","error"),setTimeout(()=>{this.ui.setButtonState(t,"normal")},3e3))}async handleRefresh(e,t){if(t.disabled||t.classList.contains("is-loading"))return;t.classList.add("fa-spin"),t.classList.add("is-loading");let i=this.ui.container.parentElement;this.ui.showListSkeleton();let s=e.includes("?")?"&":"?",n=`${e}${s}t=${new Date().getTime()}`;this.ui.resetReplyForm();let o=await this.api.loadComments(n);if(o.success){if(i){i.innerHTML=o.html;let a=i.querySelector(".comment-section");new l(a)}h.toast("\u5237\u65B0\u6210\u529F")}else h.toast("\u5237\u65B0\u5931\u8D25","error"),window.location.reload()}async handleLoadMore(e,t){let i=t.innerHTML;t.innerHTML="\u52A0\u8F7D\u4E2D...",t.disabled=!0;let s=await this.api.loadComments(e);s.success?(s.html&&this.ui.appendList(s.html),s.commentCount&&this.ui.updateCount(s.commentCount)):(t.innerHTML="\u52A0\u8F7D\u5931\u8D25\uFF0C\u70B9\u51FB\u91CD\u8BD5",t.disabled=!1)}async handleImageInsert(){let e=await h.prompt("\u8BF7\u8F93\u5165\u7F51\u7EDC\u56FE\u7247\u5730\u5740","\u8BF7\u8F93\u5165\u7F51\u7EDC\u56FE\u7247\u5730\u5740","https://");if(e===null)return;let t;try{t=new URL(e)}catch{h.toast("\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u5730\u5740");return}if(t.protocol!=="https:"){h.toast("\u8BF7\u4F7F\u7528HTTPS\u534F\u8BAE\u7684\u56FE\u7247\u5730\u5740");return}let i=`![](${t.toString()})`;this.ui.insertMarkdown(i)}};var P=class{constructor(){this.init()}init(){let e=document.querySelector(".nav-toggle"),t=document.querySelector(".header-center"),i=document.querySelector(".mobile-menu-overlay"),s=document.querySelector("#js-nav-login");document.addEventListener("click",n=>{let o=n.target.closest(".nav-dropdown__item");if(o){document.querySelectorAll(".nav-dropdown__item").forEach(c=>c.classList.remove("active")),o.classList.add("active");let r=o.closest(".nav-menu__item");r&&(document.querySelectorAll(".nav-menu__item").forEach(c=>c.classList.remove("nav-menu__item--active")),r.classList.add("nav-menu__item--active"));return}let a=n.target.closest(".nav-menu__link");if(a&&a.tagName==="A"){let r=a.closest(".nav-menu__item");r&&(document.querySelectorAll(".nav-menu__item").forEach(c=>c.classList.remove("nav-menu__item--active")),r.classList.add("nav-menu__item--active"),document.querySelectorAll(".nav-dropdown__item").forEach(c=>c.classList.remove("active")))}}),e&&(e.dataset.navBound||(e.addEventListener("click",n=>{n.stopPropagation();let o=t.classList.contains("is-open");this.toggleMenu(!o,t,e,i)}),e.dataset.navBound="true")),i&&!i.dataset.navBound&&(i.addEventListener("click",()=>this.toggleMenu(!1,t,e,i)),i.dataset.navBound="true"),document.body.dataset.navKeyBound||(document.addEventListener("keydown",n=>{let o=document.querySelector(".header-center");if(n.key==="Escape"&&o?.classList.contains("is-open")){let a=document.querySelector(".nav-toggle"),r=document.querySelector(".mobile-menu-overlay");this.toggleMenu(!1,o,a,r)}}),document.body.dataset.navKeyBound="true"),t&&!t.dataset.navSubBound&&(t.addEventListener("click",n=>{if(window.innerWidth>900)return;let o=n.target.closest(".nav-menu__link");if(!o)return;let a=o.closest(".nav-menu__item--has-sub");a&&a.contains(o)&&(n.preventDefault(),n.stopPropagation(),a.classList.toggle("nav-menu__item--expanded"))}),t.dataset.navSubBound="true"),s&&!s.dataset.navBound&&(s.addEventListener("click",()=>{let n=window.location.href;window.location.href=`/connect/oidc?fromUrl=${encodeURIComponent(n)}`}),s.dataset.navBound="true")}closeMobileMenu(){let e=document.querySelector(".header-center"),t=document.querySelector(".nav-toggle"),i=document.querySelector(".mobile-menu-overlay");this.toggleMenu(!1,e,t,i)}toggleMenu(e,t,i,s){if(!t)return;let n=e?"add":"remove";t.classList[n]("is-open"),i&&(i.classList[n]("nav-toggle--active"),i.setAttribute("aria-expanded",e)),s&&s.classList[n]("is-open"),document.body.style.overflow=e?"hidden":""}};import xe from"https://dpangzi.com/library/artplayer/artplayer.mjs";import Le from"https://dpangzi.com/library/artplayer-plugin-danmuku/artplayer-plugin-danmuku.mjs";import de from"https://dpangzi.com/library/hls.js/hls.mjs";var N=class{constructor(){this.webApiBaseAddress=document.querySelector("meta[name=web-api-base-address]").content,this.webApiBaseAddress&&(this.playerVideoContainerSelector=".js-home-video-container",this.container=document.querySelector(this.playerVideoContainerSelector),this.container&&(this.hasPlayed=!1,this.init()))}init(){let e=this;this.getVideos().then(t=>{e.playRandom(t)}).catch(t=>console.warn("Failed to fetch videos:",t))}async getVideos(){try{return await(await fetch(`${this.webApiBaseAddress}/api/Video`,{method:"GET",headers:{"Content-Type":"application/json"},mode:"cors"})).json()}catch{return[]}}playRandom(e){if(!e||e.length===0)return;let t=Math.floor(Math.random()*e.length),i=e[t],s=i.id,n=new xe({container:this.container,url:i.m3u8,type:"m3u8",poster:i.cover,fullscreenWeb:!0,fullscreen:!0,customType:{m3u8:this.playM3u8},plugins:[Le({danmuku:async function(){return await(await fetch(`/history/danmaku/v2/${s}`)).json()},async beforeEmit(o){return o.text===null||o.text.trim()===""?!1:(o.id=s,await fetch("/send/danmaku/v2",{method:"post",headers:{"Content-Type":"application/json;charset=utf-8"},body:JSON.stringify(o)}),!0)}})],controls:[]});n.on("fullscreenWeb",o=>{o?this.container.classList.add("is-web-fullscreen"):this.container.classList.remove("is-web-fullscreen")}),n.on("fullscreen",o=>{o?this.container.classList.add("is-fullscreen"):this.container.classList.remove("is-fullscreen")}),n.on("play",async()=>{this.hasPlayed||(this.hasPlayed=!0,await fetch(`/play/${s}`,{method:"PATCH"}))})}playM3u8(e,t,i){if(de.isSupported()){i.hls&&i.hls.destroy();let s=new de;s.loadSource(t),s.attachMedia(e),i.hls=s,i.on("destroy",()=>s.destroy())}else e.canPlayType("application/vnd.apple.mpegurl")?e.src=t:i.notice.show="Unsupported playback format: m3u8"}};var A=class{constructor(){this.init()}init(){new N;let e=$("#runTime"),t=e.data("start-time");if(t){let s=new Date(t);window.runTimeInterval&&clearInterval(window.runTimeInterval),window.runTimeInterval=setInterval(function(){let o=new Date-s,a=Math.floor(o/(1e3*60*60*24)),r=Math.floor(o%(1e3*60*60*24)/(1e3*60*60)),c=Math.floor(o%(1e3*60*60)/(1e3*60)),d=Math.floor(o%(1e3*60)/1e3);e.text(`\u5DF2\u8FD0\u884C ${a}\u5929 ${r}\u5C0F\u65F6 ${c}\u5206 ${d}\u79D2`)},1e3)}let i=$(".hero__bg");if(i.length>0){let s=0,n=$("#hero-title"),o=$("#hero-caption"),a=$("#hero-indicators"),r=5e3,c=()=>{a.empty(),i.each(function(f){a.append($('<span class="hero__indicator">').data("index",f))})},d=f=>{let C=a.find(".hero__indicator");C.removeClass("is-active is-animating");let _=C.eq(f);_.addClass("is-active"),_[0].offsetWidth,_.css("--hero-progress-duration",`${r}ms`).addClass("is-animating")},u=f=>{f&&f!==""?o.text(f).addClass("has-text"):o.removeClass("has-text")},m=f=>{n.removeClass("is-entering"),n.text(f||""),n[0].offsetWidth,f&&n.addClass("is-entering")},p=f=>{let C=i.eq(s),_=i.eq(f);(!_.css("background-image")||_.css("background-image")==="none")&&_.css("background-image",`url('${_.data("bg")}')`),C.removeClass("active"),_.addClass("active"),m(_.data("desc")),u(_.data("desc")),d(f),s=f},g=()=>{let f=i.eq(0);f.css("background-image",`url('${f.data("bg")}')`).addClass("active"),c(),d(0);let C=f.data("desc");m(C),u(C)},y=null,x=!1,k=()=>{I(),!(i.length<=1)&&(y=setInterval(()=>{p((s+1)%i.length)},r))},I=()=>{y&&(clearInterval(y),y=null)};g(),a.on("click",".hero__indicator",function(){let f=$(this).data("index");f!==s&&(p(f),x||k())}).on("mouseenter",()=>{x=!0,I()}).on("mouseleave",()=>{x=!1,k()}),window.heroSliderInterval&&(clearInterval(window.heroSliderInterval),window.heroSliderInterval=null),k()}}};var D=class{constructor(){this.init()}init(){$(".article-content img").each(function(){$(this).addClass("img-fluid")}),this.generateToc(),this.initMobileEvents()}initMobileEvents(){let e=document.querySelector(".js-toc-fab"),t=document.querySelector(".js-toc");if(!e||!t)return;let i=()=>{t.classList.toggle("is-open-mobile")};e.addEventListener("click",s=>{s.preventDefault(),s.stopPropagation(),i()}),document.addEventListener("click",s=>{window.innerWidth>1200||!t.contains(s.target)&&!e.contains(s.target)&&t.classList.contains("is-open-mobile")&&t.classList.remove("is-open-mobile")}),t.addEventListener("click",s=>{(s.target.tagName==="A"||s.target.closest("a"))&&window.innerWidth<=1200&&t.classList.remove("is-open-mobile")})}generateToc(){let e=$(".js-toc"),t=$(".article-content");if(!(e.length===0||t.length===0)){if(t.find("h1,h2,h3").length===0){typeof tocbot<"u"&&tocbot.destroy(),e.hide();return}typeof tocbot<"u"&&(tocbot.init({tocSelector:".js-toc",contentSelector:".article-content",headingSelector:"h1, h2, h3",hasInnerContainers:!0,scrollSmooth:!0,scrollSmoothDuration:420,headingsOffset:80,scrollSmoothOffset:-80}),e.addClass("is-visible"))}}};import Ce from"https://dpangzi.com/library/photoswipe/photoswipe.esm.min.js";import Se from"https://dpangzi.com/library/photoswipe/photoswipe.esm.min.js";var R=class{constructor(e,t={}){this.images=Array.from(e),this.items=[],this.options=Object.assign({preloadAll:!1,preloadNeighbors:1,galleryId:1},t),this.lightbox=null,this._isClosedByNavigation=!1,this._isClosing=!1,this._clickHandlers=new Map,this.init(),this.checkHash(),window.addEventListener("hashchange",()=>this.handleHashChange())}init(){this.cleanup(),this.images.forEach((e,t)=>{if(e.dataset.pswpBound){delete e.dataset.pswpBound;let o=this._clickHandlers.get(e);o&&(e.removeEventListener("click",o),this._clickHandlers.delete(e))}e.dataset.pswpBound="true";let s={src:this.getImageSrc(e),w:0,h:0,element:e,index:t,loading:!1};this.items.push(s);let n=o=>this.handleClick(o,t);this._clickHandlers.set(e,n),e.addEventListener("click",n),e.style.cursor="zoom-in",this.options.preloadAll&&this.preloadImage(s)})}cleanup(){this._clickHandlers.forEach((e,t)=>{t.removeEventListener("click",e),delete t.dataset.pswpBound}),this._clickHandlers.clear(),this.lightbox&&this.lightbox.pswp&&this.lightbox.close(),this.items=[],this.lightbox=null,this._isClosedByNavigation=!1,this._isClosing=!1}getImageSrc(e){return e.dataset.origin&&e.dataset.origin.trim()!==""?e.dataset.origin:e.dataset.src&&e.dataset.src.trim()!==""?e.dataset.src:e.src}preloadImage(e){if(e.w>0&&e.h>0||e.loading)return;e.loading=!0;let t=new Image;t.src=e.src,t.onload=()=>{e.w=t.naturalWidth,e.h=t.naturalHeight,e.loading=!1},t.onerror=()=>{e.loading=!1}}preloadNeighbors(e){let t=this.options.preloadNeighbors;this.preloadImage(this.items[e]);for(let i=1;i<=t;i++){let s=e+i,n=e-i;s<this.items.length&&this.preloadImage(this.items[s]),n>=0&&this.preloadImage(this.items[n])}}handleClick(e,t){e.preventDefault();let i=this.items[t];if(i.w>0&&i.h>0){this.open(t);return}let s=new Image;s.src=i.src,s.onload=()=>{i.w=s.naturalWidth,i.h=s.naturalHeight,this.open(t)},s.onerror=()=>{this.open(t)}}open(e,t=!1){if(this.lightbox&&this.lightbox.pswp){this.lightbox.pswp.goTo(e);return}this._isClosing=!1;let i=new Ce({dataSource:this.items,pswpModule:Se,index:e,bgOpacity:.9,showHideAnimationType:"zoom",errorMsg:'<div class="pswp__error-msg">\u56FE\u7247\u52A0\u8F7D\u5931\u8D25</div>'});this.lightbox=i,this.options.preloadAll?i.on("change",()=>{this.updateHash(i.currIndex)}):(this.preloadNeighbors(e),i.on("change",()=>{let s=i.currIndex;this.preloadNeighbors(s),this.updateHash(s)})),i.on("contentLoad",s=>{let{content:n}=s;if(n.data.w>0&&n.data.h>0)return;let o=new Image;o.src=n.data.src,o.onload=()=>{n.data.w=o.naturalWidth,n.data.h=o.naturalHeight;let a=i.options.dataSource[n.index];a&&(a.w=o.naturalWidth,a.h=o.naturalHeight,a.loading=!1)},o.onerror=()=>{console.error("Failed to load image:",n.data.src)}}),i.on("close",()=>{this._isClosing=!0,!this._isClosedByNavigation&&window.location.hash.includes(`gid=${this.options.galleryId}`)&&window.history.back(),this.lightbox=null,this._isClosedByNavigation=!1}),t||this.pushHash(e),i.init()}parseHash(){let e=window.location.hash.substring(1),t={};if(e.length<5)return t;let i=e.split("&");for(let s=0;s<i.length;s++){if(!i[s])continue;let n=i[s].split("=");n.length<2||(t[n[0]]=n[1])}return t.gid&&(t.gid=parseInt(t.gid,10)),t.pid&&(t.pid=parseInt(t.pid,10)),t}checkHash(){let e=this.parseHash();e.gid===this.options.galleryId&&e.pid>0&&e.pid<=this.items.length&&this.open(e.pid-1,!0)}handleHashChange(){let e=this.parseHash();e.gid===this.options.galleryId&&e.pid>0&&e.pid<=this.items.length?this.open(e.pid-1,!0):this.lightbox&&!this._isClosing&&(this._isClosedByNavigation=!0,this.lightbox.close())}pushHash(e){let t=`&gid=${this.options.galleryId}&pid=${e+1}`;window.history.pushState(null,"",`#${t}`)}updateHash(e){let t=`&gid=${this.options.galleryId}&pid=${e+1}`;window.history.replaceState(null,"",`#${t}`)}};var O=class{constructor(){this.init()}init(){this.cleanup(),this.bindEvents(),this.animateProgressBars()}cleanup(){let e=document.querySelector(".steam-container")}bindEvents(){let e=document.querySelector(".steam-container");e&&(this.clickHandler=t=>{let i=t.target.closest(".steam-group__header");i&&(t.preventDefault(),t.stopPropagation(),this.toggleGroup(i))},e.addEventListener("click",this.clickHandler))}toggleGroup(e){let t=e.closest(".steam-group");if(t){t.classList.toggle("steam-is-collapsed");let i=t.classList.contains("steam-is-collapsed"),s=t.dataset.groupId;s&&localStorage.setItem(`steam-group-${s}`,i.toString())}else console.warn("Group container not found for header",e)}animateProgressBars(){document.querySelectorAll(".steam-summary__progress-bar").forEach(t=>{let i=t.dataset.width;i&&setTimeout(()=>{t.style.width=i},100)})}};var F=class{constructor(){this.button=document.getElementById("back-to-top"),this.threshold=300,this.button&&this.init()}init(){this.bindEvents(),this.checkScroll()}bindEvents(){let e=!1;window.addEventListener("scroll",()=>{e||(window.requestAnimationFrame(()=>{this.checkScroll(),e=!1}),e=!0)}),this.button.addEventListener("click",t=>{t.preventDefault(),this.scrollToTop()})}checkScroll(){window.scrollY>this.threshold?this.button.classList.add("is-visible"):this.button.classList.remove("is-visible")}scrollToTop(){window.scrollTo({top:0,behavior:"smooth"})}};var U=class{constructor(){this.container=document.querySelector(".mumble-layout"),this.container&&(this.initMarkdownExpand(),this.initGalleryImages(),this.initLikeButtons(),this.initCommentToggles())}initGalleryImages(){this.container.querySelectorAll(".mumble-gallery__image").forEach(t=>{let i=t.closest(".mumble-gallery__item");!i||i.classList.contains("mumble-gallery__more")||(t.complete&&t.naturalHeight!==0?i.classList.add("is-loaded"):(t.addEventListener("load",()=>{i.classList.add("is-loaded")},{once:!0}),t.addEventListener("error",()=>{i.classList.add("is-loaded"),console.warn("Failed to load image:",t.src)},{once:!0})))})}initMarkdownExpand(){let e=document.querySelectorAll(".mumble-card__content"),t=s=>{s.nextElementSibling?.classList.contains("mumble-card__read-more")||s.scrollHeight>300&&this.addExpandButton(s)},i=new ResizeObserver(s=>{s.forEach(n=>{requestAnimationFrame(()=>{t(n.target)})})});e.forEach(s=>{t(s),i.observe(s)})}addExpandButton(e){e.classList.add("is-collapsed");let t=document.createElement("div");t.className="mumble-card__read-more",t.style.display="block";let i=document.createElement("button");i.className="mumble-card__read-more-btn",i.textContent="\u5C55\u5F00\u5168\u6587",i.addEventListener("click",()=>{if(e.classList.contains("is-collapsed"))e.classList.remove("is-collapsed"),t.classList.add("is-expanded"),i.textContent="\u6536\u8D77";else{e.classList.add("is-collapsed"),t.classList.remove("is-expanded"),i.textContent="\u5C55\u5F00\u5168\u6587";let n=e.closest(".mumble-card");if(n){let o=n.getBoundingClientRect();if(o.top<0){let r=window.pageYOffset+o.top-80;window.scrollTo({top:r,behavior:"smooth"})}}}}),t.appendChild(i),e.parentNode.insertBefore(t,e.nextSibling)}initLikeButtons(){this.container.querySelectorAll("[data-like-id]").forEach(t=>{let i=t.getAttribute("data-like-id");localStorage.getItem(`mumble_like_${i}`)&&t.classList.add("mumble-action--active")}),this.container.addEventListener("click",async t=>{let i=t.target.closest("[data-like-id]");if(!i)return;t.preventDefault();let s=i.getAttribute("data-like-id");if(localStorage.getItem(`mumble_like_${s}`)){h.toast("\u60A8\u5DF2\u7ECF\u70B9\u8D5E\u8FC7\u4E86","info");return}let n=i.querySelector("[data-like-count]");if(i.classList.contains("is-loading")||i.disabled)return;let o=i.querySelector("i"),a=o?o.className:"";try{i.classList.add("is-loading"),i.disabled=!0,o&&(o.className="fa fa-spinner fa-spin");let c=await(await fetch(`/mumble/like/${s}`,{method:"POST"})).json(),d;c.success?(d=parseInt(c.data),localStorage.setItem(`mumble_like_${s}`,"true")):(d=parseInt(n.textContent||"0"),d++),n.textContent=d,i.classList.add("mumble-action--active")}catch(r){console.error("Failed to like",r)}finally{i.classList.remove("is-loading"),i.disabled=!1,o&&(o.className=a,o.className.includes("fa-thumbs-up")&&(o.style.transform="scale(1.2)",setTimeout(()=>o.style.transform="scale(1)",200)))}})}initCommentToggles(){this.container.addEventListener("click",e=>{let t=e.target.closest("[data-comment-toggle]");if(!t)return;e.preventDefault();let s=t.closest(".mumble-card").querySelector(".mumble-comments");if(s)if(s.classList.contains("is-hidden")){s.classList.remove("is-hidden");let n=s.getAttribute("data-load-url");if(n&&!s.querySelector(".comment-list")&&!s.querySelector(".comment-empty")){t.disabled=!0;let o=t.querySelector("i"),a=o?o.className:"";o&&(o.className="fa fa-spinner fa-spin"),this.loadComments(s,n).then(()=>{let r=s.querySelector(".comment-section");new E(r),console.log("Comments loaded")}).finally(()=>{t.disabled=!1,o&&(o.className=a)})}}else s.classList.add("is-hidden")})}async loadComments(e,t){try{let i=await fetch(t);i.ok?e.innerHTML=await i.text():h.toast("\u65E0\u6CD5\u52A0\u8F7D\u8BC4\u8BBA","error")}catch{e.innerHTML='<div class="text-center text-muted p-3">\u65E0\u6CD5\u52A0\u8F7D\u8BC4\u8BBA</div>'}}};var z=class{constructor(){if(window.__music_player_instance)return window.__music_player_instance;window.__music_player_instance=this,this.audio=new Audio,this.playlist=[],this.currentIndex=0,this.isPlaying=!1,this.isShuffled=!1,this.playMode="order",this.lyrics=[],this.showLyrics=!1,this.lyricsOnBackground=!1,this.showList=window.innerWidth>768,this.isSeeking=!1,this.currentLyricIndex=-1,this.el={},this.init()}async init(){this.initElements(),this.bindEvents(),await this.fetchMusic(),this._isHandlingHashChange=!1,window.addEventListener("hashchange",()=>{if(this._isHandlingHashChange)return;let e=window.location.hash==="#music-player",t=this.el.panel.classList.contains("music-player__panel--open");e&&!t?(this._isHandlingHashChange=!0,this.togglePanel(!0),this._isHandlingHashChange=!1):!e&&t&&(this._isHandlingHashChange=!0,this.togglePanel(!1),this._isHandlingHashChange=!1)}),window.location.hash==="#music-player"&&this.togglePanel(!0)}initElements(){this.el.mini=document.getElementById("mp-mini"),this.el.miniCover=document.getElementById("mp-mini-cover"),this.el.miniStatus=document.getElementById("mp-mini-status"),this.el.miniProgress=document.getElementById("mp-mini-progress"),this.el.panel=document.getElementById("mp-panel"),this.el.backdrop=document.getElementById("mp-backdrop"),this.el.close=document.getElementById("mp-close"),this.el.title=document.getElementById("mp-title"),this.el.artist=document.getElementById("mp-artist"),this.el.cover=document.getElementById("mp-cover"),this.el.play=document.getElementById("mp-play"),this.el.prev=document.getElementById("mp-prev"),this.el.next=document.getElementById("mp-next"),this.el.seek=document.getElementById("mp-seek"),this.el.timeCurrent=document.getElementById("mp-time-current"),this.el.timeTotal=document.getElementById("mp-time-total"),this.el.mode=document.getElementById("mp-mode"),this.el.lrcToggle=document.getElementById("mp-lrc-toggle"),this.el.listToggle=document.getElementById("mp-list-toggle"),this.el.list=document.getElementById("mp-list"),this.el.listItems=document.getElementById("mp-list-items"),this.el.listCloseMobile=document.getElementById("mp-list-close-mobile"),this.el.lyricsContainer=document.getElementById("mp-lyrics-container"),this.el.lyricsInner=document.getElementById("mp-lyrics-inner"),this.el.bgLyrics=document.getElementById("mp-bg-lyrics"),this.el.bgLyricsInner=document.getElementById("mp-bg-lyrics-inner"),this.circumference=213.6,this.showList&&this.toggleList(!0)}bindEvents(){let e=null;this.el.mini.addEventListener("click",()=>{e&&clearTimeout(e),e=setTimeout(()=>{this.togglePlay(),e=null},300)}),this.el.mini.addEventListener("dblclick",n=>{n.preventDefault(),e&&(clearTimeout(e),e=null),this.togglePanel(!0)});let t=null,i=()=>{t=setTimeout(()=>{this.togglePanel(!0),t=null},600)},s=()=>{t&&(clearTimeout(t),t=null)};this.el.mini.addEventListener("touchstart",i,{passive:!0}),this.el.mini.addEventListener("touchend",s),this.el.mini.addEventListener("touchmove",s),this.el.close.addEventListener("click",()=>this.togglePanel(!1)),this.el.backdrop.addEventListener("click",()=>this.togglePanel(!1)),this.el.play.addEventListener("click",()=>this.togglePlay()),this.el.prev.addEventListener("click",()=>this.skip("prev")),this.el.next.addEventListener("click",()=>this.skip("next")),this.el.seek.addEventListener("input",n=>{let o=n.target.value/100;this.el.timeCurrent.textContent=this.formatTime(this.audio.duration*o),this.isSeeking=!0}),this.el.seek.addEventListener("change",n=>{let o=n.target.value/100;this.audio.duration&&(this.audio.currentTime=this.audio.duration*o),this.isSeeking=!1}),this.el.mode.addEventListener("click",()=>this.cycleMode()),this.el.lrcToggle.addEventListener("click",()=>{!this.showLyrics&&!this.lyricsOnBackground?(this.showLyrics=!0,this.lyricsOnBackground=!1):this.showLyrics&&!this.lyricsOnBackground?(this.showLyrics=!1,this.lyricsOnBackground=!0):(this.showLyrics=!1,this.lyricsOnBackground=!1),this.updateLyricsDisplay(),this.saveState()}),this.el.listToggle.addEventListener("click",()=>{this.toggleList(!this.showList)}),this.el.listCloseMobile&&this.el.listCloseMobile.addEventListener("click",()=>{this.toggleList(!1)}),this.audio.addEventListener("timeupdate",()=>this.onTimeUpdate()),this.audio.addEventListener("ended",()=>this.onEnded()),this.audio.addEventListener("durationchange",()=>{this.el.timeTotal.textContent=this.formatTime(this.audio.duration)}),this.audio.addEventListener("play",()=>this.updatePlayState(!0)),this.audio.addEventListener("pause",()=>this.updatePlayState(!1)),this.audio.addEventListener("error",n=>{console.error("Audio error",n)}),"mediaSession"in navigator&&(navigator.mediaSession.setActionHandler("play",()=>this.play()),navigator.mediaSession.setActionHandler("pause",()=>this.pause()),navigator.mediaSession.setActionHandler("previoustrack",()=>this.skip("prev")),navigator.mediaSession.setActionHandler("nexttrack",()=>this.skip("next")))}async fetchMusic(){try{let e=await fetch("/Music/Recommend/v2");if(!e.ok){h.toast("Failed to load music");return}this.playlist=await e.json(),this.playlist.length>0&&(this.renderList(),this.restoreState())}catch(e){console.error(e),this.el.title.textContent="\u52A0\u8F7D\u5931\u8D25"}}renderList(){this.el.listItems.innerHTML=this.playlist.map((e,t)=>`
            <div class="music-player__item" data-index="${t}">
                <div class="music-player__item-index">${t+1}</div>
                <div class="music-player__item-meta">
                    <span class="music-player__item-title">${e.name}</span>
                    <span class="music-player__item-artist">${e.singer}</span>
                </div>
            </div>
        `).join(""),this.el.listItems.querySelectorAll(".music-player__item").forEach(e=>{e.addEventListener("click",()=>{let t=parseInt(e.dataset.index);this.loadTrack(t,!0)})})}loadTrack(e,t=!0,i=!1){if(!this.playlist[e])return;this.currentIndex=e;let s=this.playlist[e];this.audio.src=s.musicSrc,this.el.title.textContent=s.name,this.el.artist.textContent=s.singer,this.el.cover.style.backgroundImage=`url('${s.cover}')`,this.el.miniCover.style.backgroundImage=`url('${s.cover}')`;let n=this.el.list.querySelector(".music-player__item--active");n&&n.classList.remove("music-player__item--active");let o=this.el.list.querySelector(`.music-player__item[data-index="${e}"]`);o&&(o.classList.add("music-player__item--active"),this.showList&&o.scrollIntoView({behavior:"smooth",block:"nearest"})),this.parseLyrics(s.lyric),this.currentLyricIndex=-1,t?this.play():this.updatePlayState(!1),"mediaSession"in navigator&&(navigator.mediaSession.metadata=new MediaMetadata({title:s.name,artist:s.singer,artwork:[{src:s.cover,sizes:"512x512",type:"image/jpeg"}]})),i||this.saveState()}play(){let e=this.audio.play();e&&e.catch(t=>console.warn("Playback prevented:",t))}pause(){this.audio.pause()}togglePlay(){this.audio.paused?this.play():this.pause()}updatePlayState(e){this.isPlaying=e;let t=e?"fa-pause":"fa-play";this.el.play.innerHTML=`<i class="fa ${t}"></i>`,this.el.miniStatus.innerHTML=`<i class="fa ${t}"></i>`,e?(this.el.cover.classList.add("music-player__cover--rotating"),this.el.miniCover.classList.add("music-player__cover--rotating")):(this.el.cover.classList.remove("music-player__cover--rotating"),this.el.miniCover.classList.remove("music-player__cover--rotating")),"mediaSession"in navigator&&(navigator.mediaSession.playbackState=e?"playing":"paused")}skip(e){let t=this.currentIndex;if(this.playMode==="random"){if(this.playlist.length>1)do t=Math.floor(Math.random()*this.playlist.length);while(t===this.currentIndex)}else e==="next"?t=(this.currentIndex+1)%this.playlist.length:t=(this.currentIndex-1+this.playlist.length)%this.playlist.length;this.loadTrack(t,!0)}onEnded(){this.playMode==="single"?(this.audio.currentTime=0,this.play()):this.skip("next")}onTimeUpdate(){if(!this.isSeeking){let t=this.audio.currentTime||0,i=this.audio.duration||1,s=t/i*100;if(this.el.seek.value=isFinite(s)?s:0,this.el.timeCurrent.textContent=this.formatTime(t),isFinite(i)&&i>0){let n=this.circumference-t/i*this.circumference;this.el.miniProgress.style.strokeDashoffset=n}}this.syncLyrics(this.audio.currentTime);let e=Date.now();this._lastAutoSaveTime||(this._lastAutoSaveTime=e),e-this._lastAutoSaveTime>=5e3&&(this.saveState(),this._lastAutoSaveTime=e)}cycleMode(){let e=["order","random","single"],t={order:"\u987A\u5E8F\u64AD\u653E",random:"\u968F\u673A\u64AD\u653E",single:"\u5355\u66F2\u5FAA\u73AF"},i={order:"fa-sort-amount-asc",random:"fa-random",single:"fa-retweet"},s=e.indexOf(this.playMode);s=(s+1)%e.length,this.playMode=e[s];let n=t[this.playMode];this.el.mode.innerHTML=`<i class="fa ${i[this.playMode]}"></i>`,this.el.mode.setAttribute("data-original-title",n),this.el.mode.removeAttribute("title"),h.showTooltip(this.el.mode,n),this.saveState()}toggleList(e){if(this.showList=e,this.el.list.classList.toggle("music-player__list--visible",this.showList),this.el.listToggle.classList.toggle("music-player__text-btn--active",this.showList),this.el.listCloseMobile&&(window.innerWidth<=768?this.el.listCloseMobile.style.display=e?"flex":"none":this.el.listCloseMobile.style.display="none"),this.showList){let t=this.el.list.querySelector(".music-player__item--active");t&&setTimeout(()=>{t.scrollIntoView({behavior:"smooth",block:"center"})},100)}}togglePanel(e){e?(this.el.panel.classList.add("music-player__panel--open"),!this._isHandlingHashChange&&window.location.hash!=="#music-player"&&(window.location.hash="#music-player"),window.innerWidth<=768&&(document.body.style.overflow="hidden")):(this.el.panel.classList.remove("music-player__panel--open"),!this._isHandlingHashChange&&window.location.hash==="#music-player"&&window.history.replaceState(null,"",window.location.pathname+window.location.search),document.body.style.overflow="")}saveState(){let e=this.playlist[this.currentIndex],t={mode:this.playMode,trackId:e?e.id:null,time:this.audio.currentTime,showLyrics:this.showLyrics,lyricsOnBackground:this.lyricsOnBackground};localStorage.setItem("dpz_music_player_state",JSON.stringify(t))}restoreState(){try{let e=localStorage.getItem("dpz_music_player_state");if(e){let t=JSON.parse(e);if(t.mode&&["order","random","single"].includes(t.mode)){this.playMode=t.mode;let o={order:"fa-sort-amount-asc",random:"fa-random",single:"fa-retweet"},a={order:"\u987A\u5E8F\u64AD\u653E",random:"\u968F\u673A\u64AD\u653E",single:"\u5355\u66F2\u5FAA\u73AF"};this.el.mode.innerHTML=`<i class="fa ${o[this.playMode]}"></i>`,this.el.mode.setAttribute("title",a[this.playMode]),this.el.mode.hasAttribute("data-original-title")&&this.el.mode.setAttribute("data-original-title",a[this.playMode])}typeof t.showLyrics=="boolean"&&(this.showLyrics=t.showLyrics),typeof t.lyricsOnBackground=="boolean"&&(this.lyricsOnBackground=t.lyricsOnBackground);let i=0,s=0;if(t.trackId){let o=this.playlist.findIndex(a=>a.id===t.trackId);if(o!==-1){i=o;let a=parseFloat(t.time);isFinite(a)&&a>0&&(s=a)}}this.loadTrack(i,!1,!0),(()=>{if(s>0)if(this.audio.readyState>=2)try{this.audio.currentTime=s,this._lastAutoSaveTime=Date.now()}catch(o){console.warn("Failed to restore time:",o)}else{let o=()=>{try{s>0&&this.audio.duration&&s<this.audio.duration&&(this.audio.currentTime=s,this._lastAutoSaveTime=Date.now())}catch(a){console.warn("Failed to restore time on loadedmetadata:",a)}this.audio.removeEventListener("loadedmetadata",o)};this.audio.addEventListener("loadedmetadata",o)}})(),this.updateLyricsDisplay()}else this.loadTrack(0,!1)}catch(e){console.error("Failed to restore music player state",e),this.loadTrack(0,!1)}}formatTime(e){if(!isFinite(e))return"0:00";let t=Math.floor(e/60),i=Math.floor(e%60);return`${t}:${i<10?"0":""}${i}`}parseLyrics(e){if(this.lyrics=[],this.el.lyricsInner.innerHTML="",this.el.bgLyricsInner.innerHTML="",this.el.bgLyricsInner.style.transform="translateY(0)",!e){let o='<div class="music-player__lyric-line">\u6682\u65E0\u6B4C\u8BCD</div>';this.el.lyricsInner.innerHTML=o,this.el.bgLyricsInner.innerHTML=o;return}let t=e.split(`
`),i=/\[(\d{2}):(\d{2})\.(\d{2,3})\](.*)/;for(let o of t){let a=i.exec(o);if(a){let r=parseInt(a[1]),c=parseInt(a[2]),d=a[3].length===3?parseInt(a[3]):parseInt(a[3])*10,u=r*60+c+d/1e3,m=a[4].trim();m&&this.lyrics.push({time:u,text:m})}}let n=this.lyrics.length===0?'<div class="music-player__lyric-line">\u7EAF\u97F3\u4E50 / \u6682\u65E0\u6B4C\u8BCD</div>':this.lyrics.map((o,a)=>`<div class="music-player__lyric-line" data-index="${a}">${o.text}</div>`).join("");this.el.lyricsInner.innerHTML=n,this.el.bgLyricsInner.innerHTML=n,this.updateLyricsDisplay()}updateLyricsDisplay(){this.el.lyricsContainer.style.display=this.showLyrics&&!this.lyricsOnBackground?"block":"none",this.el.cover.style.display=this.showLyrics&&!this.lyricsOnBackground?"none":"block",this.el.bgLyrics.classList.toggle("music-player__bg-lyrics--visible",this.lyricsOnBackground);let e=this.showLyrics||this.lyricsOnBackground;this.el.lrcToggle.classList.toggle("music-player__text-btn--active",e),this.lyricsOnBackground?this.syncLyrics(this.audio.currentTime||0):e&&this.syncLyrics(this.audio.currentTime)}syncLyrics(e){if(!this.showLyrics&&!this.lyricsOnBackground||!this.lyrics.length)return;let t=-1;for(let i=0;i<this.lyrics.length&&e>=this.lyrics[i].time;i++)t=i;if(t!==this.currentLyricIndex){if(this.currentLyricIndex=t,this.showLyrics&&!this.lyricsOnBackground){let i=this.el.lyricsInner.children;for(let s of i)s.classList.remove("music-player__lyric-line--current");if(t>=0&&i[t]){let s=i[t];s.classList.add("music-player__lyric-line--current"),s.scrollIntoView({behavior:"smooth",block:"center"})}}if(this.lyricsOnBackground){let i=this.el.bgLyricsInner,s=i.children;for(let n of s)n.classList.remove("music-player__lyric-line--current");if(t>=0&&s[t]){let n=s[t];n.classList.add("music-player__lyric-line--current");let o=n.offsetTop;i.style.transform=`translateY(-${o}px)`}}}}};var j=class{constructor(){this.container=document.querySelector("#pjax-container>.bookmark"),this.container&&this.init()}init(){this.bindEvents(),this.initSearch(),this.initForms(),this.initMasonry()}bindEvents(){window._bookmarkEventsBound||(document.addEventListener("click",e=>{if(!e.target.closest(".bookmark__search")){let t=document.querySelector(".bookmark__search-results");t&&(t.style.display="none")}}),window._bookmarkEventsBound=!0)}initMasonry(){let e=this.container.querySelector(".bookmark__grid");!e||typeof Masonry>"u"||(this._masonry=new Masonry(e,{itemSelector:".bookmark-card",columnWidth:".bookmark__grid-sizer",percentPosition:!0,gutter:20,transitionDuration:"0.3s"}),e.classList.add("bookmark__grid--ready"),e.querySelectorAll(".bookmark-card__preview").forEach(t=>{t.addEventListener("load",()=>{t.naturalWidth>0&&this._masonry.layout()})}))}initSearch(){let e=document.querySelector(".bookmark__search-input"),t=document.querySelector(".bookmark__search-results"),i=document.querySelector(".bookmark__search-list"),s=document.querySelector(".bookmark__search-wrapper");if(!e)return;s&&s.addEventListener("submit",a=>{a.preventDefault();let r=Array.from(document.querySelectorAll(".bookmark__category--active")).map(d=>d.textContent.trim()),c=new URL(s.action,window.location.origin);c.searchParams.set("title",e.value),r.forEach(d=>c.searchParams.append("categories",d)),window.jQuery&&window.jQuery.pjax?window.jQuery.pjax({url:c.toString(),container:"#pjax-container"}):window.location.href=c.toString()});let n,o=-1;e.addEventListener("input",a=>{let r=a.target.value.trim();if(clearTimeout(n),o=-1,!r){t&&(t.style.display="none");return}n=setTimeout(async()=>{try{let c=Array.from(document.querySelectorAll(".bookmark__category--active")).map(p=>p.textContent.trim()),d=new URLSearchParams({title:r});c.forEach(p=>d.append("categories",p));let m=await(await fetch(`/bookmark/search?${d.toString()}`)).json();m.success&&m.data.length>0&&i&&t?(i.innerHTML=m.data.map((p,g)=>`<li class="bookmark__search-item" data-index="${g}">${this.escapeHtml(p)}</li>`).join(""),t.style.display="block"):t&&(t.style.display="none")}catch(c){console.error("Search failed:",c)}},300)}),e.addEventListener("keydown",a=>{let r=i?i.querySelectorAll(".bookmark__search-item"):[];a.key==="ArrowDown"?(a.preventDefault(),r.length>0&&(o=(o+1)%r.length,this.updateSelection(r,o,e))):a.key==="ArrowUp"?(a.preventDefault(),r.length>0&&(o=(o-1+r.length)%r.length,this.updateSelection(r,o,e))):a.key==="Enter"&&o>=0&&r[o]&&(a.preventDefault(),e.value=r[o].textContent,this.performSearch(r[o].textContent),t&&(t.style.display="none"))}),i&&i.addEventListener("mousedown",a=>{let r=a.target.closest(".bookmark__search-item");r&&(e.value=r.textContent,this.performSearch(r.textContent))})}updateSelection(e,t,i){e.forEach(s=>s.classList.remove("bookmark__search-item--active")),e[t]&&(e[t].classList.add("bookmark__search-item--active"),i.value=e[t].textContent,e[t].scrollIntoView({block:"nearest"}))}performSearch(e){let t=Array.from(document.querySelectorAll(".bookmark__category--active")).map(o=>o.textContent.trim()),i=document.querySelector(".bookmark__search-wrapper"),s=i?i.action:"/bookmark.html",n=new URL(s,window.location.origin);e&&n.searchParams.set("title",e),t.forEach(o=>n.searchParams.append("categories",o)),window.jQuery&&window.jQuery.pjax?window.jQuery.pjax({url:n.toString(),container:"#pjax-container"}):window.location.href=n.toString()}initForms(){let e=document.querySelector(".bookmark-form");if(!e||e.dataset.bound)return;e.dataset.bound="true",e.addEventListener("submit",async i=>{i.preventDefault();let s=e.querySelector(".bookmark-form__submit"),n=s.textContent;if(!s.disabled)try{s.disabled=!0,s.textContent="\u63D0\u4EA4\u4E2D...";let o=new FormData(e),r=await(await fetch(e.action,{method:"POST",body:o})).json().catch(()=>({success:!1,msg:"Unknown error"}));r.success?jQuery.pjax({url:"/bookmark.html",container:"#pjax-container"}):(await h.alert(r.msg||"\u63D0\u4EA4\u5931\u8D25"),s.disabled=!1,s.textContent=n)}catch(o){console.error(o),await h.alert("\u53D1\u751F\u9519\u8BEF\uFF0C\u8BF7\u91CD\u8BD5"),s.disabled=!1,s.textContent=n}});let t=document.querySelector(".bookmark-form__delete");t&&t.addEventListener("click",async()=>{if(!await h.confirm("\u786E\u5B9A\u8981\u5220\u9664\u8FD9\u4E2A\u4E66\u7B7E\u5417\uFF1F"))return;let i=t.dataset.id;try{let s=new FormData;s.append("id",i);let n=await fetch("/bookmark/delete",{method:"POST",body:s}),o=await n.json().catch(()=>({success:n.ok}));o.success||o.success===void 0&&n.ok?jQuery.pjax({url:"/bookmark.html",container:"#pjax-container"}):await h.alert(o.msg||"\u5220\u9664\u5931\u8D25")}catch(s){console.error(s),await h.alert("\u5220\u9664\u51FA\u9519")}})}escapeHtml(e){let t=document.createElement("div");return t.textContent=e,t.innerHTML}};var he="https://dpangzi.com/library/monaco-editor/min/vs",ue='"Cascadia Code", "Fira Code", "JetBrains Mono", Consolas, "Cascadia Mono", "Courier New", monospace',me=!0,ke={markup:"html",sh:"shell",bash:"shell",ps1:"powershell",docker:"dockerfile",ignore:"plaintext",git:"plaintext",sln:"ini",text:"plaintext"},Ee={csharp:"C#",javascript:"JavaScript",typescript:"TypeScript",html:"HTML",css:"CSS",less:"Less",scss:"SCSS",json:"JSON",xml:"XML",sql:"SQL",python:"Python",java:"Java",cpp:"C++",c:"C",go:"Go",rust:"Rust",php:"PHP",ruby:"Ruby",shell:"Shell",powershell:"PowerShell",yaml:"YAML",markdown:"Markdown",razor:"Razor",ini:"INI",dockerfile:"Dockerfile",plaintext:"\u7EAF\u6587\u672C"},te=class{constructor(){this._loadPromise=null,this._editor=null,this._hostEl=null,this._currentModel=null,this._decorations=null,this._monaco=null,this._clickDisposable=null}async show(e,t,i){let s=await this._loadMonaco();this._monaco=s;let n=this._toMonacoLang(i);this._setHeight(e,t),(!this._editor||this._hostEl!==e)&&(this._editor&&(this._clickDisposable?.dispose(),this._editor.dispose(),this._editor=null),this._currentModel&&(this._currentModel.dispose(),this._currentModel=null),this._editor=s.editor.create(e,{model:null,readOnly:!0,theme:Z(),minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:13,fontFamily:ue,fontLigatures:me,fontWeight:"normal",lineNumbers:"on",automaticLayout:!0,renderWhitespace:"none",contextmenu:!1,wordWrap:"off",smoothScrolling:!0,padding:{top:8,bottom:8}}),this._decorations=this._editor.createDecorationsCollection(),this._clickDisposable=this._bindLineClick(),this._hostEl=e);let o=this._parseHashLine();if(o){let r=this._editor.onDidContentSizeChange(()=>{r.dispose(),this._editor.revealLineInCenter(o)})}let a=this._currentModel;this._currentModel=s.editor.createModel(t,n),this._editor.setModel(this._currentModel),a&&a.dispose(),this._stabilizeTextMetrics(),o&&this._highlightLine(o),s.editor.setTheme(Z()),this._renderLangBadge(e,n)}destroy(){this._clickDisposable?.dispose(),this._clickDisposable=null,this._currentModel&&(this._currentModel.dispose(),this._currentModel=null),this._editor&&(this._editor.dispose(),this._editor=null),this._hostEl=null,this._decorations=null,this._monaco=null}_loadMonaco(){return this._loadPromise?this._loadPromise:(this._loadPromise=new Promise((e,t)=>{let i=()=>{window.require.config({paths:{vs:he},"vs/nls":{availableLanguages:{"*":"zh-cn"}}}),window.require(["vs/editor/editor.main"],()=>e(window.monaco),t)};if(window.require?.config){i();return}let s=document.createElement("script");s.src=`${he}/loader.js`,s.onload=i,s.onerror=()=>{this._loadPromise=null,t(new Error("Monaco loader.js \u52A0\u8F7D\u5931\u8D25"))},document.head.appendChild(s)}),this._loadPromise)}_setHeight(e,t){let i=t.split(`
`).length,s=19,n=Math.floor(window.innerHeight*.8),a=Math.max(300,Math.min(i*s+40,n));e.style.height=`${a}px`}_toMonacoLang(e){return ke[e]??e}_getDisplayName(e){return Ee[e]??e}_renderLangBadge(e,t){let i=e.querySelector(".monaco-lang-badge");i||(i=document.createElement("div"),i.className="monaco-lang-badge",e.appendChild(i)),i.textContent=this._getDisplayName(t)}_bindLineClick(){return this._editor.onMouseDown(e=>{let t=e.target?.position;if(!t)return;this._highlightLine(t.lineNumber);let i=`${window.location.pathname}${window.location.search}#L${t.lineNumber}`;window.history.replaceState(null,"",i)})}_parseHashLine(){let e=window.location.hash.match(/^#L(\d+)$/);if(!e)return null;let t=parseInt(e[1],10);return t>=1?t:null}_highlightLine(e){!this._editor||!this._monaco||!this._decorations||this._decorations.set([{range:new this._monaco.Range(e,1,e,1),options:{isWholeLine:!0,className:"monaco-highlighted-line",linesDecorationsClassName:"monaco-highlighted-line-gutter"}}])}_stabilizeTextMetrics(){if(!this._editor)return;this._editor.updateOptions({fontFamily:ue,fontLigatures:me}),this._editor.layout();let e=()=>{this._editor&&this._editor.layout()};document.fonts?.ready?document.fonts.ready.then(()=>{requestAnimationFrame(e)}):requestAnimationFrame(e)}},pe=new te,ie=(l,e,t)=>pe.show(l,e,t),fe=()=>pe.destroy();var W=class{constructor(){this.prefetchedDirectoryRows=new Map,this.init()}init(){if(this.container=document.querySelector(".code-explorer"),!!this.container){if(this.container.dataset.jsInitialized==="true"){this.treeContainer=this.container.querySelector(".code-explorer__tree"),this.syncTreeWithUrl().then(()=>{});return}this.treeContainer=this.container.querySelector(".code-explorer__tree"),this.contentContainer=this.container.querySelector(".code-explorer__content"),this.searchInput=this.container.querySelector(".code-explorer__search input"),this.searchButton=this.container.querySelector(".code-explorer__search .btn-search"),this.searchInput&&this.searchInput.addEventListener("keydown",e=>{e.key==="Enter"&&(e.preventDefault(),this.handleSearch(this.searchInput.value).then(()=>{}))}),this.searchButton&&this.searchInput&&this.searchButton.addEventListener("click",async()=>{await this.handleSearch(this.searchInput.value)}),this.container.addEventListener("click",async e=>await this.handleClick(e)),this._initResizeHandle(),this.syncTreeWithUrl().then(()=>{}),this._renderCodeView(),this.container.dataset.jsInitialized="true"}}_renderCodeView(){let e=document.querySelector(".code-view-wrapper");if(e)if(K()){if(typeof Prism<"u"){let t=e.querySelector(".prism-fallback code");t&&Prism.highlightElement(t)}}else{let t=e.querySelector(".monaco-host"),i=e.querySelector(".prism-fallback code")?.textContent??"",s=t?.dataset.language??"";t&&i.trim()&&ie(t,i,s).catch(n=>{if(console.warn("Monaco \u521D\u59CB\u5316\u5931\u8D25\uFF0C\u56DE\u9000\u5230 Prism:",n),e.classList.add("use-prism"),typeof Prism<"u"){let o=e.querySelector(".prism-fallback code");o&&Prism.highlightElement(o)}})}}async handleClick(e){let t=e.target.closest(".code-tree__toggle");if(t){e.preventDefault(),e.stopPropagation(),await this.toggleNode(t.closest(".code-tree__node"));return}let i=e.target.closest(".code-tree__content"),s=i?i.querySelector(".code-tree__label"):e.target.closest("a");if(!s?.href)return;let n;try{n=new URL(s.href)}catch{return}if(n.origin===window.location.origin&&!(n.protocol!=="http:"&&n.protocol!=="https:")&&n.pathname.toLowerCase().startsWith("/code")){if(e.preventDefault(),i){let o=i.closest(".code-tree__node");this.selectNode(o),o.dataset.isFolder==="true"&&o.classList.add("is-expanded")}this.loadContent(s.href)}}loadContent(e){let t=this;$.fn.pjax?($.pjax({url:e,container:".code-explorer__content",fragment:".code-explorer__content",timeout:5e3,push:!0,scrollTo:!1}),$(document).one("pjax:success",function(i,s,n,o,a){let r=new URL(e,window.location.origin).href,c=new URL(a.url,window.location.origin).href;if(r!==c)return;t.updateTreeFromResponse(e,s),t.updateBreadcrumbs(s);let d=document.querySelector(".code-view-wrapper");if(d)if(K()){if(typeof Prism<"u"){let u=d.querySelector(".prism-fallback code");u&&Prism.highlightElement(u)}}else{let u=d.querySelector(".monaco-host"),m=d.querySelector(".prism-fallback code")?.textContent??"",p=u?.dataset.language??"";u&&m.trim()&&ie(u,m,p).catch(g=>{if(console.warn("Monaco \u6E32\u67D3\u5931\u8D25\uFF0C\u56DE\u9000\u5230 Prism:",g),d.classList.add("use-prism"),typeof Prism<"u"){let y=d.querySelector(".prism-fallback code");y&&Prism.highlightElement(y)}})}else fe();window.scrollTo(0,0)})):window.location.href=e}updateBreadcrumbs(e){let s=new DOMParser().parseFromString(e,"text/html").querySelector(".code-explorer__breadcrumbs");if(s){let n=document.querySelector(".code-explorer__breadcrumbs");n&&(n.innerHTML=s.innerHTML)}}updateTreeFromResponse(e,t){let i=new URL(e,window.location.origin).pathname.replace(/^\/code\/?/i,"").replace(/^\//,""),s=new DOMParser().parseFromString(t,"text/html"),n=Array.from(s.querySelectorAll(".row")).filter(o=>!o.classList.contains("prev"));if(this.prefetchedDirectoryRows.set(decodeURIComponent(i),n),n.length===0){this.syncTreeWithUrl().then(()=>{});return}this.findNodeByPath(i).then(o=>{if(o&&o.dataset.isFolder==="true"){let a=o.querySelector(".code-tree__children");a&&a.dataset.loaded!=="true"&&(this.populateContainer(a,n),o.classList.add("is-expanded"))}this.syncTreeWithUrl().then(()=>{})})}async findNodeByPath(e){if(!e)return null;let t=e.split("/").filter(n=>n),i=this.treeContainer,s=null;for(let n of t){let o=decodeURIComponent(n),a=null;for(let r of i.querySelectorAll(":scope > .code-tree__node"))if(r.dataset.name===o){a=r;break}if(!a||(s=a,a.dataset.isFolder==="true"&&(i=a.querySelector(".code-tree__children"),i.dataset.loaded!=="true")))return null}return s}populateContainer(e,t){if(e.dataset.loaded==="true")return;let i=document.createDocumentFragment();t.forEach(s=>{if(s.classList.contains("prev"))return;let n=s.querySelector(".header a");if(!n)return;let o=s.dataset.name||n.getAttribute("title")||n.innerText.trim(),a=n.getAttribute("href"),r=s.querySelector(".icon"),c=r?r.innerHTML:"",d=s.dataset.isFolder==="true",u=this.createTreeNode(o,a,c,d);i.appendChild(u)}),e.appendChild(i),e.dataset.loaded="true"}async syncTreeWithUrl(){if(!this.treeContainer)return;let e=window.location.pathname.replace(/^\/code\/?/i,"").replace(/^\//,""),t=e.split("/").filter(n=>n);this.treeContainer.children.length===0&&await this.loadDirectory("",this.treeContainer);let i="",s=this.treeContainer;this.treeContainer.querySelectorAll(".code-tree__content").forEach(n=>n.classList.remove("is-active"));for(let n of t){i+=(i?"/":"")+n;let o=decodeURIComponent(n),a=null;for(let r of s.querySelectorAll(":scope > .code-tree__node"))if(r.dataset.name===o){a=r;break}if(!a)break;if(decodeURIComponent(i)===decodeURIComponent(e)&&this.selectNode(a),a.dataset.isFolder==="true"){let r=a.querySelector(".code-tree__children");r&&r.dataset.loaded==="true"?a.classList.add("is-expanded"):await this.expandNode(a),s=a.querySelector(".code-tree__children")}}}async loadDirectory(e,t){if(t.dataset.loaded==="true")return;let i=decodeURIComponent((e||"").replace(/^\//,"")),s=this.prefetchedDirectoryRows.get(i);if(s){this.populateContainer(t,s),this.prefetchedDirectoryRows.delete(i);return}let n=`/code/${e}`;try{let a=await(await fetch(n,{headers:{"X-PJAX":"true"}})).text(),d=new DOMParser().parseFromString(a,"text/html").querySelectorAll(".row");this.populateContainer(t,d)}catch(o){console.error("Failed to load directory",e,o)}}createTreeNode(e,t,i,s){let n=document.createElement("div");n.className="code-tree__node",n.dataset.name=e,n.dataset.isFolder=s;let o=document.createElement("div");o.className="code-tree__content";let a=document.createElement("div");a.className=`code-tree__toggle ${s?"":"is-hidden"}`,a.innerHTML='<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>',o.appendChild(a);let r=document.createElement("div");r.className="code-tree__icon",r.innerHTML=i,o.appendChild(r);let c=document.createElement("a");if(c.className="code-tree__label",c.href=t,c.innerText=e,o.appendChild(c),o.title=e,n.appendChild(o),s){let d=document.createElement("div");d.className="code-tree__children",n.appendChild(d)}return n}async toggleNode(e){e.dataset.isFolder==="true"&&(e.classList.contains("is-expanded")?e.classList.remove("is-expanded"):await this.expandNode(e))}async expandNode(e){if(!e||e.dataset.isFolder!=="true")return;e.classList.add("is-expanded");let t=e.querySelector(".code-tree__children");if(t&&t.dataset.loaded!=="true"){let n=e.querySelector(".code-tree__label").getAttribute("href").replace(/^\/code\/?/i,"").replace(/^\//,"");e.classList.add("is-loading"),await this.loadDirectory(n,t),e.classList.remove("is-loading")}}selectNode(e){if(!e)return;this.treeContainer.querySelectorAll(".code-tree__content").forEach(i=>i.classList.remove("is-active"));let t=e.querySelector(".code-tree__content");t&&(t.classList.add("is-active"),this._scrollNodeIntoView(t))}_scrollNodeIntoView(e){if(!this.treeContainer||!e)return;let t=this.treeContainer.getBoundingClientRect(),i=e.getBoundingClientRect(),s=i.top<t.top,n=i.bottom>t.bottom;if(s||n){let o=this.treeContainer.clientHeight/2,r=this.treeContainer.scrollTop+(i.top-t.top)-o+i.height/2,c=this.treeContainer.scrollHeight-this.treeContainer.clientHeight,d=Math.max(0,Math.min(r,Math.max(0,c)));this.treeContainer.scrollTo({top:d,behavior:"smooth"})}}_initResizeHandle(){let e=this.container.querySelector(".code-explorer__sidebar");if(!e)return;let t=document.createElement("div");t.className="code-explorer__resize-handle",e.insertAdjacentElement("afterend",t);let i,s;t.addEventListener("mousedown",n=>{i=n.clientX,s=e.offsetWidth,t.classList.add("is-resizing"),document.body.style.cursor="col-resize",document.body.style.userSelect="none";let o=r=>{let c=Math.min(Math.max(s+r.clientX-i,160),600);e.style.width=c+"px"},a=()=>{t.classList.remove("is-resizing"),document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",a)};document.addEventListener("mousemove",o),document.addEventListener("mouseup",a)})}async handleSearch(e){if(e=e.trim(),!e){this.treeContainer.innerHTML="",this.treeContainer.dataset.loaded="false",await this.loadDirectory("",this.treeContainer);return}try{let t=await fetch(`/search/code?keyword=${encodeURIComponent(e)}`);if(!t.ok)return;this.renderSearchResults(await t.json(),e)}catch(t){console.error("Search failed",t)}}renderSearchResults(e,t){if(!e)return;this.treeContainer.innerHTML="";let i=document.createDocumentFragment(),s=o=>o?'<svg viewBox="0 0 24 24" width="18" height="18" fill="#F4BF50"><path d="M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"/></svg>':'<svg viewBox="0 0 24 24" width="18" height="18" fill="#90A4AE"><path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"/></svg>',n=(o,a)=>{o&&o.forEach(r=>{let c=r.name,d=r.currentPath||[],u="/code/"+d.join("/"),m=this.createTreeNode(c,u,s(a),a),p=m.querySelector(".code-tree__label");t&&(p.innerHTML=c.replace(new RegExp(`(${t})`,"gi"),"<mark>$1</mark>"));let g=m.querySelector(".code-tree__content");g&&(g.title=d.join("/")),i.appendChild(m)})};if(n(e.directories,!0),n(e.files,!1),i.children.length===0){let o=document.createElement("div");o.className="text-center text-muted p-3",o.innerText="\u6CA1\u6709\u627E\u5230\u5339\u914D\u9879",i.appendChild(o)}this.treeContainer.appendChild(i)}};var V=class{constructor(){this.init()}init(){let e=document.querySelectorAll(".friend-card");e.length!==0&&e.forEach(t=>{let i=Math.floor(Math.random()*360);t.style.setProperty("--hover-hue",i.toString())})}};var L=class L{constructor(){L._instance&&L._instance.destroy(),this._loading=!1,this._hasMore=!0,this._pageIndex=1,this._pageSize=10,this._account="pengqian",this._scrollHandler=null,this._isInitialized=!1,L._instance=this,this.init()}init(){let e=document.querySelector(".timeline");e&&(this._pageIndex=parseInt(e.dataset.pageIndex)||1,this._pageSize=parseInt(e.dataset.pageSize)||10,this._account=e.dataset.account||"pengqian",this._hasMore=e.dataset.hasMore==="true",this._timelineContainer=e,this._loadingElement=document.querySelector(".timeline__loading"),this._endElement=document.querySelector(".timeline__end"),this.initItemsAnimation(),this.setupScrollListener(),this._loadingElement&&(this._loadingElement.style.display=this._hasMore?"flex":"none"),this._isInitialized=!0)}destroy(){this._scrollHandler&&(window.removeEventListener("scroll",this._scrollHandler),this._scrollHandler=null),this._isInitialized=!1,L._instance===this&&(L._instance=null)}initItemsAnimation(){let e=document.querySelectorAll(".timeline__item");if(e.length===0)return;let t={root:null,rootMargin:"0px",threshold:.1},i=new IntersectionObserver(s=>{s.forEach(n=>{n.isIntersecting&&(n.target.classList.add("is-visible"),i.unobserve(n.target))})},t);e.forEach(s=>{i.observe(s)})}setupScrollListener(){let e=!1,t=()=>{let i=window.pageYOffset||document.documentElement.scrollTop,s=window.innerHeight;document.documentElement.scrollHeight-(i+s)<500&&this._hasMore&&!this._loading&&this.loadMore(),e=!1};this._scrollHandler=()=>{e||(window.requestAnimationFrame(t),e=!0)},window.addEventListener("scroll",this._scrollHandler,{passive:!0})}async loadMore(){if(!(this._loading||!this._hasMore)){this._loading=!0,this._loadingElement&&(this._loadingElement.style.display="flex");try{let e=this._pageIndex+1,t=`/Timeline/LoadMore?account=${encodeURIComponent(this._account)}&pageIndex=${e}&pageSize=${this._pageSize}`,i=await fetch(t);if(!i.ok)throw new Error("Network response was not ok");let s=await i.text();if(s.trim()===""){this._hasMore=!1,this.showEndMessage();return}let n=document.createElement("div");n.innerHTML=s;let o=n.querySelectorAll(".timeline__item");if(o.length===0){this._hasMore=!1,this.showEndMessage();return}o.forEach(a=>{this._timelineContainer.appendChild(a)}),this.initItemsAnimation(),this._pageIndex=e,o.length<this._pageSize&&(this._hasMore=!1,this.showEndMessage())}catch(e){console.error("\u52A0\u8F7D\u65F6\u95F4\u8F74\u5931\u8D25:",e)}finally{this._loading=!1,this._loadingElement&&(this._loadingElement.style.display="none")}}}showEndMessage(){this._loadingElement&&(this._loadingElement.style.display="none"),this._endElement&&(this._endElement.style.display="flex")}};le(L,"_instance",null);var G=L;import Te from"https://dpangzi.com/library/photoswipe/photoswipe.esm.min.js";import Ie from"https://dpangzi.com/library/photoswipe/photoswipe.esm.min.js";var J=class{constructor(){this.container=document.querySelector(".albums"),this.container&&(this.grid=this.container.querySelector(".albums__grid"),this.loadingIndicator=this.container.querySelector(".albums__loading"),this.noMoreIndicator=this.container.querySelector(".albums__no-more"),this.statPageEl=this.container.querySelector(".albums__stats span:last-child"),this.pageIndex=parseInt(this.container.dataset.pageIndex)||1,this.pageSize=parseInt(this.container.dataset.pageSize)||20,this.totalPageCount=parseInt(this.container.dataset.totalPages)||0,this.hasMore=this.container.dataset.hasMore==="true",this.isLoading=!1,this.items=[],this._isClosedByNavigation=!1,this._isClosing=!1,this.lightbox=null,this.onHashChange=this.onHashChange.bind(this),this.init())}init(){this.initMasonry(),this.initInitialItems(),this.initObserver(),this.bindEvents(),window.addEventListener("hashchange",this.onHashChange),this.onHashChange()}initMasonry(){typeof Masonry>"u"||(this._masonry=new Masonry(this.grid,{itemSelector:".albums__item",columnWidth:".albums__grid-sizer",percentPosition:!0,gutter:16,transitionDuration:"0.3s"}),this.grid.classList.add("albums__grid--ready"))}initInitialItems(){this.grid.querySelectorAll(".albums__card").forEach(t=>{this.addItemFromCard(t)})}addItemFromCard(e){let t=e.querySelector(".albums__image");if(!t)return;let i=t.getAttribute("data-src-original")||t.src.replace("!albums",""),s=t.getAttribute("data-id")||"",n=parseInt(t.getAttribute("width"))||0,o=parseInt(t.getAttribute("height"))||0,a=t.alt||"";this.items.push({id:s,src:i,w:n,h:o,alt:a,element:t}),e.dataset.index=(this.items.length-1).toString(),s&&(e.dataset.id=s)}initObserver(){if(!this.hasMore){this.loadingIndicator&&(this.loadingIndicator.style.display="none"),this.noMoreIndicator&&(this.noMoreIndicator.style.display="block");return}let e={root:null,rootMargin:"200px",threshold:.1};this.observer=new IntersectionObserver(t=>{t.forEach(i=>{i.isIntersecting&&!this.isLoading&&this.hasMore&&this.loadMore()})},e),this.loadingIndicator&&this.observer.observe(this.loadingIndicator)}bindEvents(){this.grid.addEventListener("click",e=>{let t=e.target.closest(".albums__card"),i=e.target.closest(".albums__action-btn");if(i){e.stopPropagation(),this.handleAction(i);return}if(t){let s=parseInt(t.dataset.index);isNaN(s)||this.openGallery(s)}})}parseHash(){let t=window.location.hash.match(/#pid=([^&]+)/);return t?t[1]:null}findItemIndexById(e){return e?this.items.findIndex(t=>t.id===e):-1}onHashChange(){let e=this.parseHash();if(e!==null){let t=this.findItemIndexById(e);t>=0&&this.openGallery(t,!0)}else this.lightbox&&!this._isClosing&&(this._isClosedByNavigation=!0,this.lightbox.pswp&&this.lightbox.pswp.close())}async loadMore(){if(!(this.isLoading||!this.hasMore)){this.isLoading=!0;try{let e=this.pageIndex+1,t=`/pages/albums?pageIndex=${e}&pageSize=${this.pageSize}`,i=await fetch(t);if(!i.ok){h.toast("\u7F51\u7EDC\u54CD\u5E94\u9519\u8BEF","error");return}let s=await i.json(),n=s.items||s.Items||[];n.length>0?(this.appendItems(n),this.pageIndex=e,this.hasMore=e<(s.totalPageCount||s.TotalPageCount),this.updateStatPage()):this.hasMore=!1}catch(e){console.error("Error loading more albums:",e)}finally{this.isLoading=!1,this.updateUI()}}}appendItems(e){let t=document.createDocumentFragment(),i=[];e.forEach(s=>{let n=s.Id||s.id,o=s.AccessUrl||s.accessUrl,a=s.Description||s.description,r=s.Width||s.width,c=s.Height||s.height,d=s.Creator||s.creator,u=s.UploadTime||s.uploadTime,m=s.Length||s.length,p=this.createCardNode({id:n,url:o,desc:a,width:r,height:c,creator:d,uploadTime:u,length:m});t.appendChild(p),i.push(p),this.items.push({id:n,src:o,w:r,h:c,alt:a});let g=p.querySelector(".albums__card");g.dataset.index=(this.items.length-1).toString(),n&&(g.dataset.id=n)}),this.grid.appendChild(t),this._masonry&&this._masonry.appended(i)}createCardNode(e){let t=document.createElement("div");t.className="albums__item";let i=(e.length/1024/1024).toFixed(2),s=new Date(e.uploadTime).toLocaleDateString(),n=e.creator&&(e.creator.Name||e.creator.name)||"Unknown";return t.innerHTML=`
            <div class="albums__card">
                <div class="albums__image-wrapper">
                    <img class="albums__image is-loaded" 
                         src="${e.url}!albums" 
                         data-src-original="${e.url}"
                         data-id="${e.id||""}"
                         alt="${this.escapeHtml(e.desc||"")}"
                         width="${e.width}" 
                         height="${e.height}" 
                         loading="lazy">
                    <div class="albums__overlay">
                        <div class="albums__actions">
                            <button class="albums__action-btn" data-action="download" data-url="${e.url}" title="\u4E0B\u8F7D">
                                <i class="fa fa-download"></i>
                            </button>
                            <button class="albums__action-btn" data-action="share" data-url="${e.url}" title="\u5206\u4EAB">
                                <i class="fa fa-share"></i>
                            </button>
                        </div>
                        <div class="albums__info">
                            <div class="albums__desc">${this.escapeHtml(e.desc||"")}</div>
                            <div class="albums__meta">
                                <div class="albums__meta-row">
                                    <span>${this.escapeHtml(n)}</span>
                                    <span>${s}</span>
                                </div>
                                <div class="albums__meta-row">
                                    <span>${e.width} \xD7 ${e.height}</span>
                                    <span>${i} MB</span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        `,t}updateUI(){this.hasMore||(this.observer&&this.loadingIndicator&&this.observer.unobserve(this.loadingIndicator),this.loadingIndicator&&(this.loadingIndicator.style.display="none"),this.noMoreIndicator&&(this.noMoreIndicator.style.display="block"))}updateStatPage(){this.statPageEl&&(this.statPageEl.textContent=`\u7B2C ${this.pageIndex} / ${this.totalPageCount} \u9875`)}openGallery(e,t=!1){if(this.lightbox){this.lightbox.pswp&&this.lightbox.pswp.goTo(e);return}this._isClosing=!1;let i=new Te({dataSource:this.items,pswpModule:Ie,index:e,bgOpacity:.9,showHideAnimationType:"zoom"});if(this.lightbox=i,i.on("change",()=>{let s=i.pswp;if(s){let n=s.currSlide.data;if(n&&n.id){let o=`#pid=${n.id}`;window.location.hash!==o&&history.replaceState(null,null,o)}}}),i.on("close",()=>{this._isClosing=!0,!this._isClosedByNavigation&&this.parseHash()!==null&&history.back(),this.lightbox=null,this._isClosedByNavigation=!1}),!t){let s=this.items[e];s&&s.id&&history.pushState(null,"",`#pid=${s.id}`)}i.init()}handleAction(e){let t=e.dataset.action,i=e.dataset.url;t==="download"?this.downloadImage(i):t==="share"&&this.shareImage(i)}downloadImage(e){let t=document.createElement("a");t.href=e,t.download="",t.target="_blank",document.body.appendChild(t),t.click(),document.body.removeChild(t)}shareImage(e){navigator.share?navigator.share({title:"\u5206\u4EAB\u56FE\u7247",url:e}).catch(console.error):navigator.clipboard.writeText(e).then(()=>{alert("\u56FE\u7247\u94FE\u63A5\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F")}).catch(()=>{prompt("\u590D\u5236\u94FE\u63A5:",e)})}escapeHtml(e){return e?e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"):""}};import Me from"https://dpangzi.com/library/artplayer/artplayer.mjs";import He from"https://dpangzi.com/library/artplayer-plugin-danmuku/artplayer-plugin-danmuku.mjs";import ge from"https://dpangzi.com/library/hls.js/hls.mjs";var se=class{constructor(){this.containerSelector="#video-player",this.dataAttribute="data-video-config",this.hasPlayed=!1}init(){let e=document.querySelector(this.containerSelector);if(!e||e.classList.contains("artplayer-app"))return;let t=e.getAttribute(this.dataAttribute);if(t)try{let i=JSON.parse(t);this.setupPlayer(e,i)}catch(i){console.error("Failed to parse video config",i)}}setupPlayer(e,t){let{id:i,url:s,cover:n,title:o}=t,a=i;new Me({container:e,url:s,type:"m3u8",poster:n,title:o,volume:.5,isLive:!1,muted:!1,autoplay:!1,pip:!0,autoSize:!0,autoMini:!0,screenshot:!0,setting:!0,loop:!1,flip:!0,playbackRate:!0,aspectRatio:!0,fullscreen:!0,fullscreenWeb:!0,miniProgressBar:!0,mutex:!0,backdrop:!0,playsInline:!0,autoPlayback:!0,airplay:!0,theme:"#2563eb",customType:{m3u8:(c,d,u)=>{if(ge.isSupported()){u.hls&&u.hls.destroy();let m=new ge;m.loadSource(d),m.attachMedia(c),u.hls=m,u.on("destroy",()=>m.destroy())}else c.canPlayType("application/vnd.apple.mpegurl")?c.src=d:u.notice.show="Unsupported playback format: m3u8"}},plugins:[He({danmuku:async function(){try{return await(await fetch(`/history/danmaku/v2/${a}`)).json()}catch(c){return console.error("Failed to load danmaku",c),[]}},async beforeEmit(c){if(!c.text||c.text.trim()==="")return!1;c.id=a;try{await fetch("/send/danmaku/v2",{method:"POST",headers:{"Content-Type":"application/json;charset=utf-8"},body:JSON.stringify(c)});let d=document.querySelector('.video-info__meta-item[title="\u5F39\u5E55\u6570"] span');if(d){let m=d.innerText.match(/(\d+)\s*弹幕/);if(m){let p=parseInt(m[1])+1;d.innerText=`${p} \u5F39\u5E55`}}return!0}catch(d){return console.error("Failed to send danmaku",d),!1}}})]}).on("play",async()=>{this.hasPlayed||(this.hasPlayed=!0,await fetch(`/play/${a}`,{method:"PATCH"}))})}},X=class{constructor(){new se().init()}};function Y(){let l=new Date,e=l.getFullYear(),t=String(l.getMonth()+1).padStart(2,"0"),i=String(l.getDate()).padStart(2,"0"),s=String(l.getHours()).padStart(2,"0"),n=String(l.getMinutes()).padStart(2,"0"),o=String(l.getSeconds()).padStart(2,"0");return`${e}-${t}-${i} ${s}:${n}:${o}`}function b(l){let e=Y();console.log(`%c \u2713 Success %c [${e}] %c ${l}`,"color: #ffffff; background: linear-gradient(135deg, #10b981 0%, #059669 100%); padding: 4px 10px; border-radius: 4px 0 0 4px; font-weight: 600; letter-spacing: 0.3px;","color: #a7f3d0; background: rgba(16, 185, 129, 0.15); padding: 4px 10px; font-weight: 500; border-left: 1px solid rgba(16, 185, 129, 0.3); border-right: 1px solid rgba(16, 185, 129, 0.3);","color: #6ee7b7; background: rgba(16, 185, 129, 0.08); padding: 4px 10px; border-radius: 0 4px 4px 0; font-weight: 400;")}function v(l){let e=Y();console.log(`%c \u2139 Info %c [${e}] %c ${l}`,"color: #ffffff; background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); padding: 4px 10px; border-radius: 4px 0 0 4px; font-weight: 600; letter-spacing: 0.3px;","color: #93c5fd; background: rgba(59, 130, 246, 0.15); padding: 4px 10px; font-weight: 500; border-left: 1px solid rgba(59, 130, 246, 0.3); border-right: 1px solid rgba(59, 130, 246, 0.3);","color: #bfdbfe; background: rgba(59, 130, 246, 0.08); padding: 4px 10px; border-radius: 0 4px 4px 0; font-weight: 400;")}function ne(l){let e=Y();console.warn(`%c \u26A0 Warning %c [${e}] %c ${l}`,"color: #ffffff; background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); padding: 4px 10px; border-radius: 4px 0 0 4px; font-weight: 600; letter-spacing: 0.3px;","color: #fcd34d; background: rgba(245, 158, 11, 0.15); padding: 4px 10px; font-weight: 500; border-left: 1px solid rgba(245, 158, 11, 0.3); border-right: 1px solid rgba(245, 158, 11, 0.3);","color: #fde68a; background: rgba(245, 158, 11, 0.08); padding: 4px 10px; border-radius: 0 4px 4px 0; font-weight: 400;")}function w(l){let e=Y();console.error(`%c \u2717 Error %c [${e}] %c ${l}`,"color: #ffffff; background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); padding: 4px 10px; border-radius: 4px 0 0 4px; font-weight: 600; letter-spacing: 0.3px;","color: #fca5a5; background: rgba(239, 68, 68, 0.15); padding: 4px 10px; font-weight: 500; border-left: 1px solid rgba(239, 68, 68, 0.3); border-right: 1px solid rgba(239, 68, 68, 0.3);","color: #fecaca; background: rgba(239, 68, 68, 0.08); padding: 4px 10px; border-radius: 0 4px 4px 0; font-weight: 400;")}function H(l){let e=document.getElementById("signalr-status");if(e)switch(e.classList.remove("connection-status--connected","connection-status--disconnected"),l){case"connected":e.classList.add("connection-status--connected"),e.title="\u6D88\u606F\u670D\u52A1\uFF1A\u5DF2\u8FDE\u63A5";break;case"disconnected":e.classList.add("connection-status--disconnected"),e.title="\u6D88\u606F\u670D\u52A1\uFF1A\u5DF2\u65AD\u5F00";break;case"reconnecting":e.classList.add("connection-status--disconnected"),e.title="\u6D88\u606F\u670D\u52A1\uFF1A\u6B63\u5728\u91CD\u65B0\u8FDE\u63A5...";break;default:e.title="\u6D88\u606F\u670D\u52A1\uFF1A\u672A\u8FDE\u63A5";break}}async function Be(){try{let l=new signalR.HubConnectionBuilder().withUrl("/notification",{skipNegotiation:!0,transport:signalR.HttpTransportType.WebSockets}).withAutomaticReconnect().build();l.onreconnecting(()=>{console.warn("SignalR Reconnecting..."),H("reconnecting")}),l.onreconnected(()=>{console.info("SignalR Reconnected."),H("connected")}),l.onclose(()=>{console.error("SignalR Disconnected."),H("disconnected")}),await l.start(),H("connected"),await l.invoke("Init"),l.on("pushMessage",async function(i){let s={title:"\u5C0F\u5587\u53ED\u5F00\u59CB\u5E7F\u64AD\u8FA3",content:i.markdown},n=await Pe(s);n!==null&&(n.onclick=function(){window.open("/mumble.html")}),console.info(i)}),l.on("pushLogMessage",function(i,s){let n=new Date().toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"});i===0?(b(s),h.toast(`${n}
${s}`,"success")):i===1?(v(s),h.toast(`${n}
${s}`,"warning")):i===2&&(w(s),h.toast(`${n}
${s}`,"error"))});let e=null,t=[];return l.on("cnBetaSubscribe",function(i){let s=[];if(i.hasOwnProperty("progressValues")&&Array.isArray(i.progressValues))for(let n=0;n<i.progressValues.length;n++){let o=(i.progressValues[n]*100).toFixed(2);s.push(parseFloat(o))}switch(t.push(i),e==null?e=h.showNotification({title:"\u65B0\u95FB\u8BA2\u9605\u53D1\u5E03",content:i.message,bars:s,type:"info"}):(h.setNotificationContent(e,i.message),h.setNotificationProgress(e,s)),i.type){case 0:b(i.message);break;case 1:v(i.message);break;case 2:w(i.message);break;case 3:b(i.message),setTimeout(function(){h.closeNotification(e),e=null},1e3),console.log(t);break}}),l.on("ready",function(i){console.info(i)}),l.on("systemNotification",function(i){h.toast(i,"info")}),l.on("siteMapPushMessage",function(i){let n=["success","warning","error"][i.level]||"info",o=new Date(i.timestamp).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit"});h.toast(`[${o}] ${i.message}`,n,4e3,"top-right"),n==="error"?w(`[Sitemap] ${i.message}`):n==="warning"?ne(`[Sitemap] ${i.message}`):v(`[Sitemap] ${i.message}`)}),l}catch(l){return console.error("SignalR \u4E3B\u901A\u77E5\u8FDE\u63A5\u5931\u8D25:",l),H("disconnected"),null}}async function qe(){try{let l=new signalR.HubConnectionBuilder().withUrl("/app/notification",{skipNegotiation:!0,transport:signalR.HttpTransportType.WebSockets}).withAutomaticReconnect().build();return await l.start(),l.on("systemMessage",function(e,t){e===0?(b(t),h.toast(t,"success")):e===1?(ne(t),h.toast(t,"warning")):e===2&&(w(t),h.toast(t,"error"))}),l}catch(l){return console.error("SignalR \u5E94\u7528\u901A\u77E5\u8FDE\u63A5\u5931\u8D25:",l),null}}async function Pe(l){if(!("Notification"in window))return null;let e=await Notification.requestPermission(),t={title:"",content:"",image:"https://cdn.dpangzi.com/logo.png",...l};return e==="granted"?new Notification(t.title,{icon:t.image,body:t.content,lang:"zh-cn",tag:t.tag}):null}async function ye(){let l=document.getElementById("signalr-status");l&&l.addEventListener("click",e=>{e.stopPropagation()}),await Promise.all([Be(),qe()])}var oe=class{constructor(){this.connection=null,this.isOpen=!1,this.drawingUser=null,this.currentUserId=null,this.isDrawing=!1,this.context=null,this.lastPos={x:0,y:0},this.color=this.getDefaultColor(),this.size=2,this.canvasContainer=null,this.canvas=null,this.createUI(),this.setupThemeListener()}init(e){this.connection=e,this.connection&&(this.connection.on("OnDrawingUserChanged",t=>{this.handleDrawingUserChanged(t)}),this.connection.on("OnDraw",t=>{this.handleRemoteDraw(t)}))}setUserId(e){this.currentUserId=e}getDefaultColor(){let e=localStorage.getItem("canvas-chat-color");return e||(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"#ffffff":"#000000")}setupThemeListener(){window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",t=>{if(!localStorage.getItem("canvas-chat-color")){let s=t.matches?"#ffffff":"#000000";this.color=s,this.colorPicker&&(this.colorPicker.value=s)}})}createUI(){let e=document.createElement("div");e.className="canvas-chat",e.innerHTML=`
            <div class="canvas-chat__container">
                <div class="canvas-chat__header">
                    <div style="display:flex; align-items:center;">
                        <h3 class="canvas-chat__title">\u4F60\u753B\u6211\u731C (\u5B9E\u65F6\u753B\u677F)</h3>
                        <span class="canvas-chat__status" id="canvas-chat-status">\u7B49\u5F85\u5F00\u59CB...</span>
                    </div>
                    <button class="canvas-chat__close" aria-label="\u5173\u95ED">
                        <i class="fa fa-times"></i>
                    </button>
                </div>
                <div class="canvas-chat__body" id="canvas-chat-body">
                    <canvas class="canvas-chat__canvas" id="canvas-chat-canvas"></canvas>
                </div>
                <div class="canvas-chat__toolbar" id="canvas-chat-toolbar">
                    <input type="color" class="canvas-chat__color-picker" id="canvas-chat-color" value="${this.getDefaultColor()}" title="\u9009\u62E9\u989C\u8272">
                    <input type="range" class="canvas-chat__size-slider" id="canvas-chat-size" min="1" max="20" value="2" title="\u7B14\u5237\u5927\u5C0F">
                    <button class="canvas-chat__tool-btn" id="canvas-chat-clear" title="\u6E05\u7A7A\u753B\u677F">
                        <i class="fa fa-trash"></i>
                    </button>
                    <button class="canvas-chat__tool-btn canvas-chat__tool-btn--active" id="canvas-chat-pencil" title="\u753B\u7B14">
                        <i class="fa fa-pencil"></i>
                    </button>
                </div>
            </div>
        `,document.body.appendChild(e),this.canvasContainer=e,this.canvas=e.querySelector("#canvas-chat-canvas"),this.context=this.canvas.getContext("2d"),this.statusEl=e.querySelector("#canvas-chat-status"),this.toolbar=e.querySelector("#canvas-chat-toolbar"),this.closeBtn=e.querySelector(".canvas-chat__close"),this.colorPicker=e.querySelector("#canvas-chat-color"),this.sizeSlider=e.querySelector("#canvas-chat-size"),this.clearBtn=e.querySelector("#canvas-chat-clear"),this.bindEvents(),this.resizeCanvas(),window.addEventListener("resize",()=>this.resizeCanvas()),window.addEventListener("orientationchange",()=>{setTimeout(()=>this.resizeCanvas(),100)}),window.visualViewport&&(window.visualViewport.addEventListener("resize",()=>this.resizeCanvas()),window.visualViewport.addEventListener("scroll",()=>this.resizeCanvas()))}bindEvents(){this.closeBtn.addEventListener("click",()=>{this.close()}),this.colorPicker.addEventListener("change",s=>{this.color=s.target.value,localStorage.setItem("canvas-chat-color",s.target.value)}),this.sizeSlider.addEventListener("input",s=>{this.size=parseInt(s.target.value)}),this.clearBtn.addEventListener("click",()=>{this.canDraw()&&(this.clearCanvas(),this.sendDrawData({type:"clear"}))});let e=s=>{if(!this.canDraw())return;this.isDrawing=!0;let n=this.getPos(s);this.lastPos=n,this.draw(this.lastPos,n,this.color,this.size),this.sendDrawData({type:"path",x0:this.lastPos.x/this.canvas.width,y0:this.lastPos.y/this.canvas.height,x1:n.x/this.canvas.width,y1:n.y/this.canvas.height,color:this.color,size:this.size})},t=s=>{if(!this.isDrawing||!this.canDraw())return;s.preventDefault();let n=this.getPos(s);this.draw(this.lastPos,n,this.color,this.size),this.sendDrawData({type:"path",x0:this.lastPos.x/this.canvas.width,y0:this.lastPos.y/this.canvas.height,x1:n.x/this.canvas.width,y1:n.y/this.canvas.height,color:this.color,size:this.size}),this.lastPos=n},i=()=>{this.isDrawing=!1};this.canvas.addEventListener("mousedown",e),this.canvas.addEventListener("mousemove",t),this.canvas.addEventListener("mouseup",i),this.canvas.addEventListener("mouseout",i),this.canvas.addEventListener("touchstart",s=>{s.touches.length===1&&e(s.touches[0])},{passive:!1}),this.canvas.addEventListener("touchmove",s=>{s.touches.length===1&&t(s.touches[0])},{passive:!1}),this.canvas.addEventListener("touchend",i)}getPos(e){let t=this.canvas.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}resizeCanvas(){if(!this.canvasContainer)return;let t=window.visualViewport?window.visualViewport.height:window.innerHeight,i=window.innerWidth,s=i<=640,n=s?Math.min(i*.95,i-20):Math.min(i*.9,800),o=s?Math.min(t*.85,t-100):Math.min(t*.7,600);this.canvas.style.width=`${n}px`,this.canvas.style.height=`${o}px`,this.canvas.width=n,this.canvas.height=o,this.context.lineCap="round",this.context.lineJoin="round"}canDraw(){return this.isOpen&&this.drawingUser&&this.currentUserId&&this.drawingUser.id===this.currentUserId}async requestAccess(){if(this.connection)try{await this.connection.invoke("RequestDrawingAccess")}catch(e){w("\u8BF7\u6C42\u753B\u56FE\u6743\u9650\u5931\u8D25: "+e)}}async releaseAccess(){if(this.connection)try{await this.connection.invoke("ReleaseDrawingAccess")}catch(e){w("\u91CA\u653E\u753B\u56FE\u6743\u9650\u5931\u8D25: "+e)}}async sendDrawData(e){if(this.connection)try{await this.connection.invoke("SendDrawingData",e)}catch(t){console.error("\u53D1\u9001\u753B\u56FE\u6570\u636E\u5931\u8D25",t)}}handleDrawingUserChanged(e){this.drawingUser=e,e?e.id===this.currentUserId?(this.statusEl.textContent="\u6B63\u5728\u4F5C\u753B\uFF1A\u4F60\u81EA\u5DF1",this.statusEl.style.color="#2196f3",this.toolbar.style.display="flex",h.toast("\u4F60\u5DF2\u83B7\u5F97\u753B\u56FE\u6743\u9650\uFF0C\u5F00\u59CB\u5C55\u793A\u5427\uFF01","success"),this.isOpen||this.open()):(this.statusEl.textContent=`\u6B63\u5728\u4F5C\u753B\uFF1A${e.name}`,this.statusEl.style.color="#666",this.toolbar.style.display="none",this.isOpen?h.toast(`${e.name} \u5F00\u59CB\u4F5C\u753B\u4E86`,"info"):(this.open(),h.toast(`${e.name} \u6B63\u5728\u4F5C\u753B\uFF0C\u5DF2\u81EA\u52A8\u6253\u5F00\u753B\u677F`,"info"))):(this.statusEl.textContent="\u753B\u677F\u7A7A\u95F2",this.statusEl.style.color="#666",this.toolbar.style.display="none",this.isOpen&&(h.toast("\u753B\u56FE\u5DF2\u7ED3\u675F","info"),this.close()))}handleRemoteDraw(e){if(this.isOpen){if(e.type==="clear")this.clearCanvas();else if(e.type==="path"){let t=e.x0*this.canvas.width,i=e.y0*this.canvas.height,s=e.x1*this.canvas.width,n=e.y1*this.canvas.height;this.draw({x:t,y:i},{x:s,y:n},e.color,e.size)}}}draw(e,t,i,s){this.context.beginPath(),this.context.moveTo(e.x,e.y),this.context.lineTo(t.x,t.y),this.context.strokeStyle=i,this.context.lineWidth=s,this.context.stroke(),this.context.closePath()}clearCanvas(){this.context.clearRect(0,0,this.canvas.width,this.canvas.height)}open(){this.isOpen=!0,this.canvasContainer.classList.add("canvas-chat--visible");let e=window.innerHeight*.01;document.documentElement.style.setProperty("--vh",`${e}px`),requestAnimationFrame(()=>{this.resizeCanvas()})}close(){this.isOpen=!1,this.canvasContainer.classList.remove("canvas-chat--visible"),this.drawingUser&&this.currentUserId&&this.drawingUser.id===this.currentUserId&&this.releaseAccess()}},T=new oe;var ae=class{constructor(){this.connection=null,this.isOpen=!1,this.currentUserId=null,this.loadedPageIndex=0,this.hasMoreHistory=!0,this.isLoadingHistory=!1,this.maxHistoryCount=1e3,this.loadedHistoryCount=0,this.MOBILE_BREAKPOINT=768,this.CHAT_HASH="#group-chat",this.init(),this.initMobileViewport(),this.initHashListener()}init(){this.createTriggerButton(),this.setupConsoleCommand()}initHashListener(){window.addEventListener("hashchange",()=>{this.isMobile()&&this.isOpen&&window.location.hash!==this.CHAT_HASH&&this.close()})}isMobile(){return window.innerWidth<=this.MOBILE_BREAKPOINT}disableBodyScroll(){this.isMobile()&&(document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%",document.body.style.top=`-${window.scrollY}px`,this.scrollPosition=window.scrollY)}enableBodyScroll(){this.isMobile()&&(document.body.style.overflow="",document.body.style.position="",document.body.style.width="",document.body.style.top="",this.scrollPosition!==void 0&&(window.scrollTo(0,this.scrollPosition),this.scrollPosition=void 0))}initMobileViewport(){let e=()=>{let t=window.innerHeight*.01;document.documentElement.style.setProperty("--vh",`${t}px`)};if(e(),window.addEventListener("resize",e),window.addEventListener("orientationchange",()=>{setTimeout(e,100)}),/iPhone|iPad|iPod/.test(navigator.userAgent)){let t=0;window.addEventListener("scroll",()=>{let i=window.pageYOffset||document.documentElement.scrollTop;i!==t&&(e(),t=i)},{passive:!0})}window.visualViewport&&(window.visualViewport.addEventListener("resize",e),window.visualViewport.addEventListener("scroll",e))}createTriggerButton(){let e=document.createElement("button");e.className="group-chat__trigger",e.innerHTML="\u{1F4AC}",e.setAttribute("aria-label","\u6253\u5F00\u7FA4\u7EC4\u804A\u5929"),e.style.display="none",e.addEventListener("click",()=>this.open()),document.body.appendChild(e),this.triggerButton=e}setupConsoleCommand(){window.openGroupChat=()=>{this.isOpen?v("\u7FA4\u7EC4\u804A\u5929\u5DF2\u7ECF\u6253\u5F00"):this.open().then(()=>b("\u7FA4\u7EC4\u804A\u5929\u5DF2\u6253\u5F00"))},v("\u{1F4AC} \u7FA4\u7EC4\u804A\u5929"),v("\u8F93\u5165 window.openGroupChat() \u6765\u5F00\u542F\u7FA4\u7EC4\u804A\u5929")}async open(){this.isOpen||(this.isOpen=!0,this.isMobile()&&(window.location.hash!==this.CHAT_HASH&&(window.location.hash=this.CHAT_HASH),this.disableBodyScroll()),this.createUI(),await this.connect())}createUI(){let e=document.createElement("div");e.className="group-chat",e.innerHTML=`
            <div class="group-chat__header">
                <h3 class="group-chat__title">\u7FA4\u7EC4\u804A\u5929</h3>
                <button class="group-chat__close" aria-label="\u5173\u95ED">
                    <i class="fa fa-times"></i>
                </button>
            </div>
            <div class="group-chat__messages" id="group-chat-messages">
                <div class="group-chat__load-more" id="group-chat-load-more" style="display: none;">
                    <span>\u52A0\u8F7D\u66F4\u591A...</span>
                </div>
            </div>
            <div class="group-chat__input-area">
                <div class="group-chat__commands" id="group-chat-commands">
                    <div class="group-chat__command-item" data-command="/canvas">
                        <span class="group-chat__command-name">/canvas</span>
                        <span class="group-chat__command-desc">\u5F00\u542F/\u52A0\u5165 \u4F60\u753B\u6211\u731C</span>
                    </div>
                </div>
                <textarea 
                    class="group-chat__input" 
                    id="group-chat-input" 
                    placeholder="\u8F93\u5165\u6D88\u606F... (/ \u663E\u793A\u547D\u4EE4)"
                    rows="1"
                ></textarea>
                <button class="group-chat__send-btn" id="group-chat-send">\u53D1\u9001</button>
            </div>
        `,document.body.appendChild(e),this.chatPanel=e,this.messagesContainer=e.querySelector("#group-chat-messages"),this.loadMoreBtn=e.querySelector("#group-chat-load-more"),this.input=e.querySelector("#group-chat-input"),this.sendBtn=e.querySelector("#group-chat-send"),this.commandsPanel=e.querySelector("#group-chat-commands"),this.bindEvents(),requestAnimationFrame(()=>{e.classList.add("group-chat--visible");let t=window.innerHeight*.01;document.documentElement.style.setProperty("--vh",`${t}px`)}),this.triggerButton&&(this.triggerButton.style.display="none")}bindEvents(){this.chatPanel.querySelector(".group-chat__close").addEventListener("click",async()=>{await this.close()}),this.sendBtn.addEventListener("click",async()=>{await this.handleSend()}),this.input.addEventListener("keydown",async e=>{e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),await this.handleSend())}),this.input.addEventListener("input",()=>{this.input.style.height="auto",this.input.style.height=`${Math.min(this.input.scrollHeight,120)}px`,this.input.value.startsWith("/")?this.commandsPanel.classList.add("group-chat__commands--visible"):this.commandsPanel.classList.remove("group-chat__commands--visible")}),this.commandsPanel.querySelectorAll(".group-chat__command-item").forEach(e=>{e.addEventListener("click",()=>{let t=e.dataset.command;this.input.value=t,this.commandsPanel.classList.remove("group-chat__commands--visible"),this.input.focus()})}),this.loadMoreBtn.addEventListener("click",async()=>{await this.loadMoreHistory()}),this.messagesContainer.addEventListener("scroll",async()=>{this.messagesContainer.scrollTop===0&&this.hasMoreHistory&&!this.isLoadingHistory&&this.loadedHistoryCount<this.maxHistoryCount&&await this.loadMoreHistory()})}async handleSend(){let e=this.input.value.trim();e&&(e.startsWith("/")?await this.handleCommand(e):await this.sendMessage())}async handleCommand(e){e==="/canvas"?(this.input.value="",this.input.style.height="auto",this.commandsPanel.classList.remove("group-chat__commands--visible"),T.open(),T.drawingUser||await T.requestAccess()):await this.sendMessage()}async connect(){try{this.connection=new signalR.HubConnectionBuilder().withUrl("/groupchat",{skipNegotiation:!0,transport:signalR.HttpTransportType.WebSockets}).withAutomaticReconnect().build(),this.connection.on("OnMessageReceived",t=>{this.addMessage(t,t.userId===this.currentUserId)}),this.connection.on("OnUserJoined",t=>{this.addSystemMessage(`${t.name} \u52A0\u5165\u4E86\u7FA4\u7EC4`)}),this.connection.on("OnUserLeft",t=>{this.addSystemMessage(`${t.name} \u79BB\u5F00\u4E86\u7FA4\u7EC4`)}),this.connection.on("OnHistoryLoaded",(t,i)=>{this.handleHistoryLoaded(t,i)}),this.connection.on("OnError",t=>{h.toast(t,"error")}),await this.connection.start();let e=await this.connection.invoke("JoinGroup",null);e&&(this.currentUserId=e.id,T.setUserId(this.currentUserId)),T.init(this.connection),await this.loadInitialHistory(),b("\u5DF2\u8FDE\u63A5\u5230\u7FA4\u7EC4\u804A\u5929"),h.toast("\u5DF2\u8FDE\u63A5\u5230\u7FA4\u7EC4\u804A\u5929","success")}catch(e){w(`\u8FDE\u63A5\u7FA4\u7EC4\u804A\u5929\u5931\u8D25: ${e.message||e}`),h.toast("\u8FDE\u63A5\u5931\u8D25\uFF0C\u8BF7\u5237\u65B0\u9875\u9762\u91CD\u8BD5","error")}}async loadInitialHistory(){this.loadedPageIndex=1,this.loadedHistoryCount=0,this.hasMoreHistory=!0,await this.connection.invoke("GetHistory",1,50)}async loadMoreHistory(){if(!(this.isLoadingHistory||!this.hasMoreHistory||this.loadedHistoryCount>=this.maxHistoryCount)){this.isLoadingHistory=!0,this.loadMoreBtn.style.display="block",this.loadMoreBtn.classList.add("group-chat__load-more--loading"),this.loadMoreBtn.querySelector("span").textContent="\u52A0\u8F7D\u4E2D...";try{let e=this.loadedPageIndex+1,t=this.messagesContainer.scrollHeight,i=this.messagesContainer.scrollTop;await this.connection.invoke("GetHistory",e,50),requestAnimationFrame(()=>{let s=this.messagesContainer.scrollHeight;this.messagesContainer.scrollTop=s-t+i})}catch(e){w(`\u52A0\u8F7D\u5386\u53F2\u8BB0\u5F55\u5931\u8D25: ${e.message||e}`),h.toast("\u52A0\u8F7D\u5386\u53F2\u8BB0\u5F55\u5931\u8D25","error")}finally{this.isLoadingHistory=!1,this.loadMoreBtn.classList.remove("group-chat__load-more--loading")}}}handleHistoryLoaded(e,t){this.hasMoreHistory=t,this.loadedPageIndex++,this.loadedHistoryCount+=e.length,this.loadedHistoryCount>=this.maxHistoryCount?(this.hasMoreHistory=!1,this.loadMoreBtn.style.display="none"):t?(this.loadMoreBtn.style.display="block",this.loadMoreBtn.querySelector("span").textContent="\u52A0\u8F7D\u66F4\u591A..."):this.loadMoreBtn.style.display="none";let i=document.createDocumentFragment();e.forEach(s=>{let n=s.userId===this.currentUserId,o=this.createMessageElement(s,n);i.insertBefore(o,i.firstChild)}),this.loadedPageIndex===2?(this.messagesContainer.insertBefore(i,this.loadMoreBtn.nextSibling),this.scrollToBottom()):this.messagesContainer.insertBefore(i,this.loadMoreBtn.nextSibling)}async sendMessage(){let e=this.input.value.trim();if(!(!e||!this.connection)){this.sendBtn.disabled=!0,this.input.disabled=!0;try{await this.connection.invoke("SendMessage",e),this.input.value="",this.input.style.height="auto"}catch(t){w(`\u53D1\u9001\u6D88\u606F\u5931\u8D25: ${t.message||t}`),h.toast("\u53D1\u9001\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5","error")}finally{this.sendBtn.disabled=!1,this.input.disabled=!1,this.input.focus()}}}addMessage(e,t=!1){t&&!this.currentUserId&&(this.currentUserId=e.userId);let i=this.createMessageElement(e,t);this.messagesContainer.appendChild(i),this.scrollToBottom()}createMessageElement(e,t=!1){let i=document.createElement("div");i.className=`group-chat__message${t?" group-chat__message--own":""}`;let s=document.createElement("img");s.className="group-chat__avatar",s.src=e.avatar,s.alt=e.userName;let n=document.createElement("div");n.className="group-chat__message-content";let o=document.createElement("div");o.className="group-chat__username",o.textContent=e.userName;let a=document.createElement("div");a.className="group-chat__bubble",a.textContent=e.message;let r=document.createElement("div");return r.className="group-chat__timestamp",r.textContent=this.formatTime(e.sendTime),n.appendChild(o),n.appendChild(a),n.appendChild(r),i.appendChild(s),i.appendChild(n),i}addSystemMessage(e){let t=document.createElement("div");t.className="group-chat__system-message",t.textContent=e,this.messagesContainer.appendChild(t),this.scrollToBottom()}formatTime(e){let t=new Date(e),s=(new Date-t)/1e3;return s<60?"\u521A\u521A":s<3600?`${Math.floor(s/60)}\u5206\u949F\u524D`:s<86400?`${Math.floor(s/3600)}\u5C0F\u65F6\u524D`:t.toLocaleDateString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}scrollToBottom(){requestAnimationFrame(()=>{this.messagesContainer.scrollTop=this.messagesContainer.scrollHeight})}async close(){if(this.isOpen){if(this.connection)try{await this.connection.stop()}catch(e){w(`\u65AD\u5F00\u8FDE\u63A5\u5931\u8D25: ${e.message||e}`)}this.chatPanel&&(this.chatPanel.classList.remove("group-chat--visible"),setTimeout(()=>{this.chatPanel.parentNode&&this.chatPanel.parentNode.removeChild(this.chatPanel)},300)),this.isOpen=!1,this.connection=null,this.currentUserId=null,this.loadedPageIndex=0,this.hasMoreHistory=!0,this.isLoadingHistory=!1,this.loadedHistoryCount=0,this.isMobile()&&(this.enableBodyScroll(),window.location.hash===this.CHAT_HASH&&history.replaceState(null,"",window.location.pathname+window.location.search)),this.triggerButton&&(this.triggerButton.style.display="flex")}}},ve=new ae;var Q=class{constructor(){this.clickCount=0,this.lastClickTime=0,this.versionElement=document.getElementById("app-version"),this.audioCtx=null,this.versionElement&&this.init()}init(){this.versionElement.addEventListener("click",e=>this.handleClick(e)),this.versionElement.style.cursor="pointer",this.versionElement.style.userSelect="none",this.versionElement.title="\u7248\u672C\u53F7"}handleClick(e){let t=Date.now();t-this.lastClickTime>2e3&&(this.clickCount=0),this.lastClickTime=t,this.clickCount++,this.animateClick(),this.clickCount===5?this.triggerShakeEffect():this.clickCount>5&&this.clickCount<10?document.body.classList.contains("easter-egg--broken")&&this.resetAutoRestoreTimer():this.clickCount>=10&&this.triggerGroupChat()}animateClick(){this.versionElement.style.transition="transform 0.1s",this.versionElement.style.transform="scale(0.9)",setTimeout(()=>{this.versionElement.style.transform="scale(1)"},100)}triggerShakeEffect(){this.resetEffects();let e=document.createElement("div");e.classList.add("easter-egg-stone"),e.innerText="\u{1FAA8}",document.body.appendChild(e),setTimeout(()=>{e.remove(),this.playBreakSound(),document.body.classList.add("easter-egg--shake"),document.body.classList.add("easter-egg--broken"),setTimeout(()=>{document.body.classList.remove("easter-egg--shake")},500),this.resetAutoRestoreTimer()},600)}resetAutoRestoreTimer(){this.restoreTimer&&clearTimeout(this.restoreTimer);let e=5e3+Math.random()*5e3;this.restoreTimer=setTimeout(()=>{this.resetEffects()},e)}resetEffects(){document.body.classList.remove("easter-egg--shake"),document.body.classList.remove("easter-egg--broken"),this.restoreTimer&&clearTimeout(this.restoreTimer)}triggerGroupChat(){this.resetEffects(),ve.open(),this.clickCount=0}playBreakSound(){try{this.audioCtx||(this.audioCtx=new(window.AudioContext||window.webkitAudioContext)),this.audioCtx.state==="suspended"&&this.audioCtx.resume();let e=this.audioCtx,t=e.sampleRate*2,i=e.createBuffer(1,t,e.sampleRate),s=i.getChannelData(0);for(let c=0;c<t;c++)s[c]=Math.random()*2-1;let n=e.createBufferSource();n.buffer=i;let o=e.createBiquadFilter();o.type="highpass",o.frequency.value=800,o.Q.value=10;let a=e.createGain();n.connect(o),o.connect(a),a.connect(e.destination);let r=e.currentTime;a.gain.setValueAtTime(0,r),a.gain.linearRampToValueAtTime(.8,r+.01),a.gain.exponentialRampToValueAtTime(.01,r+.3),n.start(r),n.stop(r+.3)}catch(e){console.warn("Easter egg sound synthesis failed:",e)}}};var re=class{constructor(){this.FRUITS=[{level:0,key:"grape",label:"\u8461\u8404",radius:20,img:"/images/suika/grape.png"},{level:1,key:"cherry",label:"\u6A31\u6843",radius:30,img:"/images/suika/cherry.png"},{level:2,key:"orange",label:"\u6A58\u5B50",radius:40,img:"/images/suika/orange.png"},{level:3,key:"lemon",label:"\u67E0\u6AAC",radius:50,img:"/images/suika/lemon.png"},{level:4,key:"kiwi",label:"\u7315\u7334\u6843",radius:60,img:"/images/suika/kiwi.png"},{level:5,key:"tomato",label:"\u756A\u8304",radius:70,img:"/images/suika/tomato.png"},{level:6,key:"peach",label:"\u6843\u5B50",radius:80,img:"/images/suika/peach.png"},{level:7,key:"pineapple",label:"\u83E0\u841D",radius:95,img:"/images/suika/pineapple.png"},{level:8,key:"coconut",label:"\u6930\u5B50",radius:110,img:"/images/suika/coconut.png"},{level:9,key:"half-watermelon",label:"\u534A\u897F\u74DC",radius:130,img:"/images/suika/half-watermelon.png"},{level:10,key:"watermelon",label:"\u5927\u897F\u74DC",radius:150,img:"/images/suika/watermelon.png"}],this.PANEL_WIDTH=440,this.PANEL_HEIGHT=640,this.isOpen=!1,this.overlay=null,this.engine=null,this.render=null,this.runner=null,this.currentBody=null,this.nextFruitLevel=0,this.canDrop=!0,this.isGameOver=!1,this.Matter=null,this.bindConsoleCommand()}bindConsoleCommand(){window.openWatermelonGame=()=>{if(this.isOpen){v("\u5408\u6210\u5927\u897F\u74DC\u5DF2\u7ECF\u6253\u5F00\u4E86");return}this.open()},v("\u{1F349} \u5408\u6210\u5927\u897F\u74DC (Matter.js \u7248)"),v("\u8F93\u5165 window.openWatermelonGame() \u542F\u52A8\u6E38\u620F")}async loadMatterJs(){if(window.Matter){this.Matter=window.Matter;return}return new Promise((e,t)=>{let i=document.createElement("script");i.src="https://cdnjs.cloudflare.com/ajax/libs/matter-js/0.19.0/matter.min.js",i.onload=()=>{this.Matter=window.Matter,e()},i.onerror=()=>{v("Matter.js \u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC"),t(new Error("Failed to load Matter.js"))},document.body.appendChild(i)})}async open(){if(!this.isOpen){try{await this.loadMatterJs()}catch(e){console.error(e),h.alert("\u52A0\u8F7D\u6E38\u620F\u5F15\u64CE\u5931\u8D25");return}this.isOpen=!0,this.createUI(),this.initGame(),b("\u5408\u6210\u5927\u897F\u74DC\u5DF2\u542F\u52A8")}}createUI(){let e=document.createElement("div");e.className="watermelon-game",e.innerHTML=`
            <div class="watermelon-game__panel">
                <div class="watermelon-game__header">
                    <h3 class="watermelon-game__title">\u5408\u6210\u5927\u897F\u74DC</h3>
                    <div class="watermelon-game__actions">
                        <button class="watermelon-game__action" id="wg-restart">\u91CD\u5F00</button>
                        <button class="watermelon-game__action" id="wg-close" aria-label="\u5173\u95ED">
                            <i class="fa fa-times"></i>
                        </button>
                    </div>
                </div>
                <div class="watermelon-game__content">
                    <aside class="watermelon-game__side watermelon-game__side--left">
                        <h4>\u5408\u6210\u8DEF\u5F84</h4>
                        <div class="watermelon-game__path" id="watermelon-path"></div>
                    </aside>
                    <main class="watermelon-game__center" id="game-container" style="position: relative; padding: 0; overflow: hidden; background: #ffe8cd;">
                        <!-- Canvas will be injected here by Matter.js -->
                        <div id="game-over-mask" style="display:none; position:absolute; inset:0; background:rgba(0,0,0,0.7); color:white; flex-direction:column; justify-content:center; align-items:center; z-index:10;">
                            <h2 style="font-size: 2rem; margin-bottom: 1rem;">\u6E38\u620F\u7ED3\u675F</h2>
                            <button class="watermelon-game__action" id="wg-retry">\u518D\u6765\u4E00\u5C40</button>
                        </div>
                    </main>
                    <aside class="watermelon-game__side watermelon-game__side--right">
                        <h4>\u4E0B\u4E00\u4E2A</h4>
                        <div style="width: 140px; height: 140px; display: flex; justify-content: center; align-items: center; background: white; border-radius: 8px; border: 1px solid #e2e8f0;">
                            <img id="next-fruit-img" src="" style="max-width: 80%; max-height: 80%; object-fit: contain;">
                        </div>
                        <p class="watermelon-game__hint">\u968F\u673A\u751F\u6210\u524D 5 \u79CD\u6C34\u679C</p>
                    </aside>
                </div>
            </div>
        `,document.body.appendChild(e),this.overlay=e,e.querySelector("#wg-close").onclick=()=>this.close(),e.querySelector("#wg-restart").onclick=()=>this.restart(),e.querySelector("#wg-retry").onclick=()=>this.restart(),this.renderPath()}renderPath(){let e=document.getElementById("watermelon-path");if(e){e.innerHTML="";for(let t=0;t<this.FRUITS.length-1;t++){let i=document.createElement("div");i.className="watermelon-game__path-row",i.textContent=`${this.FRUITS[t].label} + ${this.FRUITS[t].label} \u2192 ${this.FRUITS[t+1].label}`,e.appendChild(i)}}}initGame(){let{Engine:e,Render:t,Runner:i,World:s,Bodies:n,Events:o,Composite:a,Body:r}=this.Matter;this.engine=e.create();let c=document.getElementById("game-container"),d=440,u=640;this.render=t.create({element:c,engine:this.engine,options:{width:d,height:u,wireframes:!1,background:"#ffe8cd",pixelRatio:window.devicePixelRatio}});let m={isStatic:!0,render:{fillStyle:"#ffd180"}},p=n.rectangle(d/2,u+30,d,60,{isStatic:!0,label:"Ground",render:{fillStyle:"#e6aac3"}}),g=n.rectangle(-30,u/2,60,u*2,{isStatic:!0,label:"Wall"}),y=n.rectangle(d+30,u/2,60,u*2,{isStatic:!0,label:"Wall"});s.add(this.engine.world,[p,g,y]),this.runner=i.create(),i.run(this.runner,this.engine),t.run(this.render),o.on(this.engine,"collisionStart",f=>this.handleCollision(f));let x=this.render.canvas,k=f=>{f.preventDefault(),this.inputMove(f)},I=f=>{f.preventDefault(),this.inputClick(f)};x.addEventListener("mousemove",k),x.addEventListener("touchmove",k,{passive:!1}),x.addEventListener("click",I),x.addEventListener("touchend",I),this.nextFruitLevel=Math.floor(Math.random()*5),this.createNewReadyFruit(),this.updateNextPreview()}inputMove(e){if(!this.canDrop||this.isGameOver||!this.currentBody)return;let t=this.render.canvas.getBoundingClientRect(),s=(e.touches?e.touches[0].clientX:e.clientX)-t.left,n=this.FRUITS[this.currentBody.plugin.level].radius;s<n&&(s=n),s>this.PANEL_WIDTH-n&&(s=this.PANEL_WIDTH-n),this.Matter.Body.setPosition(this.currentBody,{x:s,y:this.currentBody.position.y})}inputClick(e){if(!this.canDrop||this.isGameOver||!this.currentBody)return;this.canDrop=!1;let t=this.currentBody;this.Matter.Body.setStatic(t,!1),this.currentBody=null,setTimeout(()=>{this.isGameOver||(this.createNewReadyFruit(),this.canDrop=!0)},1e3)}createNewReadyFruit(){let e=this.nextFruitLevel;this.nextFruitLevel=Math.floor(Math.random()*5),this.updateNextPreview();let t=this.FRUITS[e],i=this.PANEL_WIDTH/2,n=this.createFruitBody(i,50,e,!0);this.Matter.Composite.add(this.engine.world,n),this.currentBody=n}createFruitBody(e,t,i,s=!1){let n=this.FRUITS[i],o=this.Matter.Bodies.circle(e,t,n.radius,{isStatic:s,label:"Fruit",restitution:.2,friction:.1,render:{sprite:{texture:n.img}}});o.plugin={level:i};let a=new Image;return a.src=n.img,a.onload=()=>{let r=n.radius*2/a.width;o.render.sprite.xScale=r,o.render.sprite.yScale=r},o}updateNextPreview(){let e=document.getElementById("next-fruit-img");e&&(e.src=this.FRUITS[this.nextFruitLevel].img)}handleCollision(e){if(this.isGameOver)return;let{pairs:t}=e,{Composite:i,Body:s,Vector:n,World:o}=this.Matter,a=new Set,r=[];for(let c=0;c<t.length;c++){let d=t[c],u=d.bodyA,m=d.bodyB;if(u.label==="Fruit"&&m.label==="Fruit"){let p=u.plugin.level,g=m.plugin.level;if(p===g&&p<this.FRUITS.length-1){if(a.has(u.id)||a.has(m.id))continue;a.add(u.id),a.add(m.id),r.push({bodyA:u,bodyB:m,level:p})}}}for(let c of r){let{bodyA:d,bodyB:u,level:m}=c;i.remove(this.engine.world,[d,u]);let p=(d.position.x+u.position.x)/2,g=(d.position.y+u.position.y)/2,y=m+1,x=this.createFruitBody(p,g,y,!1);i.add(this.engine.world,x),y===this.FRUITS.length-1&&b("\u592A\u5F3A\u4E86\uFF01\u5408\u6210\u5927\u897F\u74DC\uFF01")}}restart(){if(!this.engine)return;let{Composite:e}=this.Matter;e.clear(this.engine.world,!1),this.engine.events={};let i=e.allBodies(this.engine.world).filter(s=>s.label==="Fruit");e.remove(this.engine.world,i),this.cleanGameOver(),this.nextFruitLevel=0,this.canDrop=!0,this.createNewReadyFruit(),this.updateNextPreview()}cleanGameOver(){this.isGameOver=!1;let e=document.getElementById("game-over-mask");e&&(e.style.display="none")}close(){this.isOpen&&(this.runner&&this.Matter.Runner.stop(this.runner),this.render&&(this.Matter.Render.stop(this.render),this.render.canvas&&this.render.canvas.remove()),this.overlay&&(this.overlay.remove(),this.overlay=null),this.isOpen=!1,this.engine=null,this.render=null)}},we=new re;var ce=class{constructor(){this.init().then(()=>console.log("App init"))}async init(){this.nav=new P,new F,new Q,new z;let e=new LazyLoad({elements_selector:".lazy"});this.initComponents(),this.initTooltips(),M(),$.pjax.defaults.timeout=5e3,$(document).pjax("a[data-pjax],#pager:not(#article-pager #pager) a","#pjax-container"),$(document).pjax("#article-pager #pager a","#article-list"),$(document).on("submit","form[data-pjax]",function(i){$.pjax.submit(i,"#pjax-container")}),$(document).on("pjax:send",function(){typeof NProgress<"u"&&NProgress.start(),h.hideTooltip()});let t=this;$(document).on("pjax:complete",async function(i,s){let n=s.getResponseHeader("title");if(n===""||n===null)document.title="\uFF08\uFF1B\xB4\u0434\uFF40\uFF09\u309E\u6807\u9898\u4E0D\u89C1\u5566 - \u53EB\u6211\u963F\u80D6";else try{let o=atob(n),a=new Uint8Array(o.length);for(let c=0;c<o.length;c++)a[c]=o.charCodeAt(c);let r=new TextDecoder("utf-8");document.title=r.decode(a)}catch{document.title=n}}),$(document).on("pjax:end",async function(){typeof NProgress<"u"&&NProgress.done(),t.nav&&t.nav.closeMobileMenu(),await t.initFetchContent(),t.initComponents(),M(),e.update(),t.setUnSelect()}),await this.initFetchContent(),await ye(),this._initDebugConsole(),this.setUnSelect(),$(".mobile-menu-toggle").on("click",function(){$(".mobile-nav").addClass("is-open"),$(".mobile-nav-overlay").addClass("is-open")}),$(".mobile-nav-overlay, .mobile-nav a").on("click",function(){$(".mobile-nav").removeClass("is-open"),$(".mobile-nav-overlay").removeClass("is-open")})}initComponents(){new A,new D,new O,new U,new j,new W,new V,new G,new J,new X,new S;let e=document.querySelectorAll(".article-card__cover img,.markdown-body img,.mumble-gallery__image");e.length>0&&new R(e)}initTooltips(){let e=()=>h.hideTooltip();document.addEventListener("click",e,!0);let t=!1;document.addEventListener("touchstart",()=>{t=!0,e(),setTimeout(()=>t=!1,1e3)},{passive:!0,capture:!0}),document.addEventListener("contextmenu",n=>{if(!t)return;n.target.closest("[title], [data-original-title]")&&n.preventDefault()}),document.body.addEventListener("mouseenter",n=>{let o=n.target;if(o&&o.hasAttribute&&o.hasAttribute("title")){let a=o.getAttribute("title");if(!a)return;o.setAttribute("data-original-title",a),o.removeAttribute("title"),h.showTooltip(o,a)}},!0),document.body.addEventListener("mouseleave",n=>{let o=n.target;if(o&&o.hasAttribute&&o.hasAttribute("data-original-title")){let a=o.getAttribute("data-original-title");o.setAttribute("title",a),o.removeAttribute("data-original-title"),h.hideTooltip()}},!0);let i=n=>{let o=n.target.closest("time");if(o){let a=o.getAttribute("datetime");a&&h.showTooltip(o,a)}},s=n=>{n.target.closest("time")&&(n.type==="touchend"?setTimeout(()=>h.hideTooltip(),1500):h.hideTooltip())};document.body.addEventListener("touchstart",i,{passive:!0}),document.body.addEventListener("touchend",s,{passive:!0})}async initFetchContent(){let e=document.querySelectorAll("[data-request]");for(let t of e)if(t.dataset.status!=="loaded")try{let s=await fetch(t.dataset.request,{method:"GET"});if(s.ok){t.innerHTML=await s.text(),t.dataset.status="loaded";let n=t.querySelector(".comment-section");n&&new E(n)}else console.error("Failed to fetch content for",t.dataset.request),t.innerHTML='<div class="error-message">\u52A0\u8F7D\u5931\u8D25</div>'}catch(s){console.error("Error fetching content:",s)}}help(){console.group("\u{1F95A} \u5F69\u86CB\u6307\u5357"),console.log("1. \u8FDE\u7EED\u70B9\u51FB\u9875\u811A\u7248\u672C\u53F7 5 \u6B21\uFF1A\u89E6\u53D1\u7834\u788E\u7279\u6548"),console.log("2. \u8FDE\u7EED\u70B9\u51FB\u9875\u811A\u7248\u672C\u53F7 10 \u6B21\uFF1A\u5F00\u542F\u7FA4\u7EC4\u804A\u5929"),console.log('3. \u63A7\u5236\u53F0\u8F93\u5165 "openGroupChat()"\uFF1A\u76F4\u63A5\u5F00\u542F\u7FA4\u7EC4\u804A\u5929'),console.log('4. \u63A7\u5236\u53F0\u8F93\u5165 "openWatermelonGame()"\uFF1A\u5F00\u542F\u5408\u6210\u5927\u897F\u74DC'),console.log("5. \u8FDE\u7EED\u70B9\u51FB\u9875\u811A\u7248\u6743\u4FE1\u606F 5 \u6B21\uFF1A\u5F00\u542F\u79FB\u52A8\u7AEF\u8C03\u8BD5\u5DE5\u5177"),console.groupEnd()}_initDebugConsole(){let e=0,t=0,i=2e3,s=document.querySelector(".site-footer .container > p:last-child");s&&(s.style.cursor="pointer",s.style.userSelect="none",s.addEventListener("click",()=>{let n=Date.now();n-t>i&&(e=0),e++,t=n,e>=5&&(e=0,this._initEruda())}))}async _initEruda(){if(window.eruda){window.eruda._isInit||eruda.init();return}}setUnSelect(){document.querySelectorAll("time[datetime],[title]").forEach(e=>{e.style.userSelect!=="none"&&(e.style.userSelect="none")})}};document.addEventListener("DOMContentLoaded",()=>{let l=new ce;window.help=l.help});
//# sourceMappingURL=app.min.js.map
评论加载中...